This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: TLS question
- From: Ian Lance Taylor <iant at google dot com>
- To: alireza dot moshtaghi at ericsson dot com
- Cc: binutils at sourceware dot org
- Date: Thu, 22 Mar 2012 11:53:24 -0700
- Subject: Re: TLS question
- References: <1332437561.4731.3377.camel@linux.site>
Alireza Moshtaghi <alireza.moshtaghi@ericsson.com> writes:
> An extern variable is defined as an UND symbol in the elf file, however,
> when it is classified with __thread, the linker needs to match it up
> with the correct definition from another object file.
> The way that I have implemented TLS support in my port of binutils, the
> linker complains that the extern symbol is not TLS and it can not link
> it to the definition from the other object file.
>
> The only thing that I can think of is to teach ld to look at the
> relocation for that symbol and if it is a TLS relocation, it should be
> able to match the two, but I don't know how to teach ld to do so.
>
> Question is: where in the linker I must modify?
An extern __thread variable should be SHN_UNDEF, STB_GLOBAL, STT_TLS.
In other words, you don't have to look at relocations, you just have to
look at the symbol type.
Ian