This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: TLS variables access for -static -lpthread executables
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: "Carlos O'Donell" <carlos at redhat dot com>
- Cc: libc-help at sourceware dot org, Ben Woodard <woodard at redhat dot com>, "Maciej W. Rozycki" <macro at codesourcery dot com>
- Date: Thu, 27 Mar 2014 19:18:05 +0100
- Subject: Re: TLS variables access for -static -lpthread executables
- Authentication-results: sourceware.org; auth=none
- References: <20140326182101 dot GA13552 at host2 dot jankratochvil dot net> <5333D711 dot 5050902 at redhat dot com>
On Thu, 27 Mar 2014 08:45:21 +0100, Carlos O'Donell wrote:
> The best way forward would be to ensure you can get a link map even for
> static executables, and then use that with td_thr_tls_get_addr(). This
> would allow gdb to avoid doing two different things for static and
> dynamic executables. It also helps all other applications using libthread_db
> interfaces.
>
> Would you mind testing something like this in fedora rawhide?
Yes, it works for me. Just one has to additionally used the attached patch.
The -static -pthread executable does not have ".dynamic" section so GDB
thinks the main executable cannot be present in link_map.
How to fix this compatibility is a topic for upstream GDB, I am not sure how
the patch is compatible with other SVR4 OSes (like Solaris).
Thanks,
Jan