On Thu, Jan 17, 2013 at 2:11 PM, Saul Tamari <stamari@xxxxxxxxx> wrote: > On Thu, Jan 17, 2013 at 12:07 AM, Ian Lance Taylor <iant@xxxxxxxxxx> wrote: >> If you put code that accesses TLS variables into a shared library, and >> that code was not compiled with -fpic/-fPIC nor with >> -ftls-model=global-dynamic, then accessing the TLS variables will read >> the wrong values. > > Is there a way to verify if there are wrongly initialized TLS > variables in some application or I can only detect such cases when the > application fails? You could probably look at the dynamic relocations and see if there are any TLS relocations in the shared library that are not global dynamic. > Can the linker or runtime linker warn about these cases? Or because we > haven't compiled with -fpic or -ftls-model=global-dynamic, then the > runtime linker doesn't know there are TLS variables in our binary? I think the linker (ld) could warn about this case. Ian