[arm32] using lld, the names of functions in plt are replaced by $*
Using lld, the names of functions in plt are replaced by $* in arm32,
code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int func()
{
char c = 'b';
char str1[8];
memset(str1, c, 8);
return 0;
}
int main()
{
func();
return 0;
}
clang demo.c -o demo32.o -fuse-ld=lld -fstack-protector llvm-objdump -d demo32.o
Disassembly of section .plt:
000106e0 <$a>: <<<<----- There is the question 106e0: e52de004 str lr, [sp, #-4]! 106e4: e28fe600 add lr, pc, #0, #12 106e8: e28eea20 add lr, lr, #32, #20 106ec: e5bef1a4 ldr pc, [lr, #420]!
000106f0 <$d>: <<<<----- There is the question 106f0: d4 d4 d4 d4 .word 0xd4d4d4d4 106f4: d4 d4 d4 d4 .word 0xd4d4d4d4 106f8: d4 d4 d4 d4 .word 0xd4d4d4d4 106fc: d4 d4 d4 d4 .word 0xd4d4d4d4
00010700 <$a>: <<<<----- There is the question 10700: e28fc600 add r12, pc, #0, #12 10704: e28cca20 add r12, r12, #32, #20 10708: e5bcf18c ldr pc, [r12, #396]!
These are so-called mapping symbols: https://sourceware.org/binutils/docs/as/ARM-Mapping-Symbols.html Their presence is expected.
These are so-called mapping symbols: https://sourceware.org/binutils/docs/as/ARM-Mapping-Symbols.html Their presence is expected.
But why doesn't this happen when I use the arm64 architecture? ... 0000000000010980 <.plt>: 10980: a9bf7bf0 stp x16, x30, [sp, #-16]! 10984: 90000110 adrp x16, 0x30000 <__stack_chk_fail@plt+0x4> 10988: f9461211 ldr x17, [x16, #3104] 1098c: 91308210 add x16, x16, #3104 10990: d61f0220 br x17 10994: d503201f nop 10998: d503201f nop 1099c: d503201f nop
00000000000109a0 abort@plt: <<<<----- There is the question 109a0: 90000110 adrp x16, 0x30000 <__stack_chk_fail@plt+0x20> 109a4: f9461611 ldr x17, [x16, #3112] 109a8: 9130a210 add x16, x16, #3112 109ac: d61f0220 br x17
00000000000109b0 __libc_start_main@plt: <<<<----- There is the question 109b0: 90000110 adrp x16, 0x30000 <__stack_chk_fail@plt+0x30> 109b4: f9461a11 ldr x17, [x16, #3120] 109b8: 9130c210 add x16, x16, #3120 109bc: d61f0220 br x17
00000000000109c0 __gmon_start__@plt: <<<<----- There is the question 109c0: 90000110 adrp x16, 0x30000 <__stack_chk_fail@plt+0x40> 109c4: f9461e11 ldr x17, [x16, #3128] 109c8: 9130e210 add x16, x16, #3128 109cc: d61f0220 br x17
00000000000109d0 __register_frame_info@plt: <<<<----- There is the question 109d0: 90000110 adrp x16, 0x30000 <__stack_chk_fail@plt+0x50> 109d4: f9462211 ldr x17, [x16, #3136] 109d8: 91310210 add x16, x16, #3136 109dc: d61f0220 br x17 ...
But why doesn't this happen when I use the arm64 architecture?
Because there are no mapping symbols on aarch64. It's entirely different architecture.
But why doesn't this happen when I use the arm64 architecture?
Because there are no mapping symbols on aarch64. It's entirely different architecture.
But why is it possible to use binutils tools, especially this document is from binutils extract? And arrch64 use $x as mapping symbols:https://sourceware.org/binutils/docs/as/AArch64-Mapping-Symbols.html
There are no plt symbols in the binary. They are made up on the fly by objdump, and afaik this only works for x86 and AArch64. You can see symbols in the binary with llvm-readelf --syms.
There are no plt symbols in the binary. They are made up on the fly by objdump, and afaik this only works for x86 and AArch64. You can see symbols in the binary with
llvm-readelf --syms.
I think you're right, but I want to know why objdump only works for x86 and aarch64?
There are no plt symbols in the binary. They are made up on the fly by objdump, and afaik this only works for x86 and AArch64. You can see symbols in the binary with
llvm-readelf --syms.
I see that the llvm doesn't have the implementation of adding plt symbols for arm. What is the reason for this? @quic-akaryaki