Question about the tls_model attribute
Jakub Jelinek
jakub@redhat.com
Wed Jun 13 10:07:00 GMT 2012
On Wed, Jun 13, 2012 at 11:03:01AM +0100, Hans Wennborg wrote:
> I have a question about the semantics of the tls_model attribute in GCC.
>
> For code such as this:
>
> static __thread int __attribute((tls_model("global-dynamic"))) x;
> int *f() { return &x; }
>
> GCC will generate code using the global-dynamic model, also when
> compiled without -fpic.
That is correct, you've asked for it, therefore you get what you've asked
for. The linker will probably optimize it back into local exec model,
but that is a separate thing.
Jakub
More information about the Gcc-help
mailing list