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: Alexander Monakov <amonakov at ispras dot ru>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Fri, 16 Oct 2015 16:25:26 +0300 (MSK)
- Subject: Re: Purpose of attribute_tls_model_ie
- Authentication-results: sourceware.org; auth=none
- References: <5620D4D3 dot 5060109 at redhat dot com>
On Fri, 16 Oct 2015, Florian Weimer wrote:
> Why are some thread-local variables marked with attribute_tls_model_ie?
>
> 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.
Can you please clarify, what does it override? I see:
include/libc-symbols.h:
#define attribute_tls_model_ie __attribute__ ((tls_model ("initial-exec")))
So the macro requests IE model, same as the command line flag. Did you mean
that the attribute was redundant?
A problem with the attribute is that it disallows the compiler to optimize
initial-exec to local-exec for accesses to locally-defined variables. Is that
what you meant?
Alexander