This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [libc patch] __tls_get_addr with link_map * instead of modid
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Rich Felker <dalias at libc dot org>
- Cc: libc-alpha at sourceware dot org, gdb-patches at sourceware dot org
- Date: Sat, 18 Oct 2014 23:27:27 +0200
- Subject: Re: [libc patch] __tls_get_addr with link_map * instead of modid
- Authentication-results: sourceware.org; auth=none
- References: <20141018201540 dot GA26252 at host2 dot jankratochvil dot net> <20141018212048 dot GH32028 at brightrain dot aerifal dot cx>
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