This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [libc patch] __tls_get_addr with link_map * instead of modid


On Sat, 18 Oct 2014 23:20:48 +0200, Rich Felker wrote:
> > Additionally one could also fetch the module id from R_X86_64_DTPMOD64 but that
> > would require arch specific code in GDB.  I do not plan to implement this way.
> 
> I don't see how this would work; how would you request the dynamic
> linker to resolve that for you?

When the inferior is running the relocation is already resolved.  So GDB can
just read the module id from relocation's location.  The problem is that
'.rela.dyn' is not parsed by BFD so one would either have to extend BFD to
parse it or provide a separate '.rela.dyn' parser in GDB for each arch.
>From '.rela.dyn' one can find the symbol name and relocation's location.

Relocation section '.rela.dyn' at offset 0x520 contains 10 entries:
    Offset             Info             Type               Symbol's Value  Symbol's Name + Addend
0000000000200fd0  0000000a00000010 R_X86_64_DTPMOD64      0000000000000000 x + 0
0000000000200fd8  0000000a00000011 R_X86_64_DTPOFF64      0000000000000000 x + 0

 7ac:   66 48 8d 3d 1c 08 20    data32 lea 0x20081c(%rip),%rdi        # 200fd0 <_DYNAMIC+0x1d8>
 7b3:   00
 7b4:   66 66 48 e8 d4 fe ff    data32 data32 callq 690 <__tls_get_addr@plt>
 7bb:   ff

But that is an offtopic discussion for this patch.


Jan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]