https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121318

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Alexander Monakov from comment #3)
> When necessary to upgrade global-dynamic to initial-exec (in libraries)
> without downgrading local-exec to initial-exec (in executables), the code
> can attach the attribute conditionally:
> 
> #if defined(__pic__) && !defined(__pie__)
> __attribute__ ((tls_model ("initial-exec")))
> #endif
> __thread const int *pfoo = afoo;
> 
> LLVM performs the requested optimization. Refusing to do this optimization
> without a justification would be weird.

Note see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78294#c18 . It mentions
clang implements the extension differently than gcc. 

https://gcc.gnu.org/onlinedocs/gcc-15.1.0/gcc/Code-Gen-Options.html#index-ftls-model

I really think this is not a GCC bug with respect to this attribute. The
attribute is overriding what the default is always.

Reply via email to