This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: TLS on x86-64 question..
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Andreas Jaeger <aj at suse dot de>
- Cc: binutils at sources dot redhat dot com, Thorsten Kukuk <kukuk at suse dot de>
- Date: Fri, 5 Sep 2003 10:36:00 +0200
- Subject: Re: TLS on x86-64 question..
- References: <u8llt3zhej.fsf@gromit.moeb>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Fri, Sep 05, 2003 at 11:57:56AM +0200, Andreas Jaeger wrote:
>
> If I compile the following small program on x86-64 (with either GCC
> 3.3 CVS, GCC 3.3 hammer-branch CVS or 3.4 CVS) I get the following
> error:
>
> $ /opt/gcc/3.3-devel/bin/gcc -g -c tls.c -o tls.o -fPIC -ftls-model=local-exec
> $ /opt/gcc/3.3-devel/bin/gcc -g -o tls.so -shared tls.o
> /usr/bin/ld: tls.o: relocation R_X86_64_TPOFF32 can not be used when making a shared object; recompile with -fPIC
> tls.o: could not read symbols: Bad value
> collect2: ld returned 1 exit status
>
> The program is:
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> static __thread int foo;
>
> int getTLSVar(void)
> {
> return foo;
> }
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> This works fine on other platforms, e.g. i386.
>
> Jakub, any ideas on this one?
local-exec is not supported in shared libraries on x86_64 (well, it is not
supported on most arches).
It is the same thing as supporting -fno-pic code in shared libraries
- local-exec would mean TLS relocations against .text segment.
Jakub