This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: __tls_get_addr in localplt.data
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: Chris Metcalf <cmetcalf at ezchip dot com>, GLIBC Devel <libc-alpha at sourceware dot org>
- Date: Fri, 19 Dec 2014 23:01:39 -0500
- Subject: Re: __tls_get_addr in localplt.data
- Authentication-results: sourceware.org; auth=none
- References: <5494CB6E dot 6090706 at ezchip dot com>
On 12/19/2014 08:05 PM, Chris Metcalf wrote:
> In https://sourceware.org/ml/libc-alpha/2014-11/msg00123.html,
> Carlos added support for checking ld.so for appropriate PLT use.
> Running on tilegx just now, it fails, complaining that there is a
> missing required PLT reference to __tls_get_addr in ld.so.
It is always safe to remove entries from localplt.data, but you
should not add them without realizing you *need* the PLT entry.
> However, it's not at all clear to me that this is in fact a bug. Looking at
> libc.so for x86, for example, it seems that the only reason there is a PLT
> reference is because it is called via an explicit @PLT reference from
> _dl_tlsdesc_dynamic in sysdeps/x86_64/dl-tlsdesc.S.
Correct.
> With tilegx we don't have any calls to __tls_get_addr from within
> ld.so itself, so there's no PLT created, so the test fails.
OK.
> It seems that Ulrich wrote the original x86 version of _dl_tlsdesc_dynamic
> with the @PLT reference, but it's certainly not clear to me why; I
> think this code is used only in ld.so, and I can't see a good reason
> why you'd want to allow an override from another shared library for
> __tls_get_addr. So there are multiple mysteries here.
I don't know either, I took only the existing status quo and maintained it.
> I can fix this by creating a local copy of localplt.data for tile,
> of course, but I wonder why it's not "ld.so: __tls_get_addr ?"
> in the generic localplt.data, i.e. marked as an optional symbol.
> Or, more deeply, why the PLT references are needed on any platform
> in the first place.
All very good questions. Someone would have to dig into it to determine
if it is possible to remove the reference.
> Any guidance for an appropriate change would be appreciated.
The appropriate immediate change is for tile to have it's own copy of
localplt.data with the right entries. Less entries is always better.
Making the generic localplt.data better is secondary with the freeze
so close.
Cheers,
Carlos.