This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Purpose of attribute_tls_model_ie
- From: Florian Weimer <fweimer at redhat dot com>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Fri, 16 Oct 2015 16:00:28 +0200
- Subject: Re: Purpose of attribute_tls_model_ie
- Authentication-results: sourceware.org; auth=none
- References: <5620D4D3 dot 5060109 at redhat dot com> <alpine dot DEB dot 2 dot 10 dot 1510161329250 dot 18339 at digraph dot polyomino dot org dot uk>
On 10/16/2015 03:31 PM, Joseph Myers wrote:
> On Fri, 16 Oct 2015, Florian Weimer wrote:
>
>> Why are some thread-local variables marked with attribute_tls_model_ie?
>
> Maybe to indicate variables located in initial modules that are accessed
> from other modules (i.e. for use when those other modules are being built,
> without -ftls-model=initial-exec)?
But this would not apply to the arena pointer in malloc/arena.c, right?
(It's a static TLS variable, after all.) So we could drop it there and
get better code for statically linked glibc.
>> As far as I can tell, the default for PIC is set by
>> -ftls-model=initial-exec, and for non-PIC, it's the compiler default.
>> The latter is more efficient (no GOT indirection), but
>> attribute_tls_model_ie overrides this.
>
> I suppose there's a case for static libraries being built for local-exec.
Yes, the code looks quite a bit better on x86_64 in the statically
linked case.
Florian