On Wed, Jun 13, 2012 at 11:07 AM, Jakub Jelinek <jakub@xxxxxxxxxx> wrote: > 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. Are there any known examples of code that depends on this behavior? I like the "you get what you asked for" semantics, I'm just trying to figure out if there are more reasons. Thanks, Hans