Hi, I am working on an Elf64 parser to find symbol. Im working on 'libc.so' and found some strange things about how objdump/gdb resolve the PLT symbols.
Here is what I get from my own parser: ============================== ------------------------------------- # Plt addr for 'realloc' >>> get_symbol_addr('realloc') '0x1f4b0' # Got addr for 'realloc' >>> get_symbol_addr('realloc.got') '0x3a4028 ------------------------------------- Here is what objdump find: ========================== 000000000001f490 <realloc@plt>: 1f490: ff 25 82 4b 38 00 jmpq *0x384b82(%rip) # 3a4018 # So I have differents values: # me | objdump # PLT : 0x1f4b0 | 0x1f490 # GOT : 0x3a4028 | 0x3a4018 But Here is the infos from readelf about the GOT reloc : Objdump rela.plt info : ====================== # It seems to be same offset that mine. 000003a4028 01e800000007 R_X86_64_JUMP_SLO 000000000007c110 realloc + 0 Even weirder ! Info extracted from GDB: =================== ------------------------------------- (gdb) info proc map ...... 0x7ffff7a33000 0x7ffff7bd4000 0x1a1000 0x0 /usr/lib/libc-2.18.so # Let's disas MY 'realloc' PLT entry. (gdb) x/i 0x7ffff7a33000 + 0x1f4b0 0x7ffff7a524b0 <__tls_get_addr@plt>: jmpq *0x384b72(%rip) # 0x7ffff7dd7028 # __tls_get_addr : it seems I was wrong : but let's follow the GOT ! (gdb) x/gx 0x7ffff7dd7028 0x7ffff7dd7028: 0x00007ffff7aaf110 # (following the GOT) (gdb) x/i 0x00007ffff7aaf110 0x7ffff7aaf110 <realloc>: push %r15 ------------------------------------- So, according to GDB, the PLT entry <__tls_get_addr@plt> resolve into <realloc>. It seems to be a bug in BFD. If I am missing something: please tell me. Thanks, -- Clement "Hakril" Rouault _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils