On Fri, 19 Jul 2013, Jakub Jelinek wrote: > If user code has __attribute__((tls_model ("global-dynamic"))) and the > compiler determines that it is not going to be used in a shared library, > then it of course optimizes it to a better code
I see your point, but that's not how tls_model attribute works in today's GCC. It takes precedence over -ftls-model flag and whatever GCC deduced from flag_shlib and binds_local_p in decl_default_tls_model. So if the user wants to force a specific allocation they can do so with the attribute. > That is the common case, the case where people compile incorrectly objects > that they want to link into shared libraries is simply a user error that we > shouldn't in any way promote or support. On 32-bit x86, some GCC users will do that regardless (citing PIC overhead as the reason for going non-PIC; I don't want to defend this position, I'm just explaining a possible motivation). Even if the attribute didn't work, they could revert to pthread_setspecific and co. for TLS. I don't see why make using GCC harder for them. Thanks again. Alexander