This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Finding the source code for ___tls_get_addr_internal()


On Thu, Jan 17, 2013 at 2:11 PM, Saul Tamari <stamari@gmail.com> wrote:
> On Thu, Jan 17, 2013 at 12:07 AM, Ian Lance Taylor <iant@google.com> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]