------- Comment #4 from scovich at gmail dot com  2008-04-09 15:18 -------
If it's any help, adding some inline asm to the file makes the Sun toolchain
croak on my machine.

SunOS 5.10 Generic_118833-23 sun4v sparc SUNW,Sun-Fire-T200
Sun C 5.9 SunOS_sparc Patch 124867-01 2007/07/12
Solaris Link Editors: 5.10-1.482

// begin tls-bug.c
void membar_producer() { asm volatile("membar #StoreStore"); }
static __thread bool val;
int main() { return val; }
// end tls-bug.c

This bug seems to show up in arbitrary ways for each of the three compilers on
my machine:
$ cc -V
cc: Sun C 5.9 SunOS_sparc Patch 124867-01 2007/07/12
$ gcc -v
Reading specs from /usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/specs
Configured with:
/gates/sfw10/builds/sfw10-gate/usr/src/cmd/gcc/gcc-3.4.3/configure
--prefix=/usr/sfw --with-as=/usr/sfw/bin/gas --with-gnu-as
--with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++
--enable-shared
Thread model: posix
gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath)
$ ~/apps/gcc/4.3/bin/gcc-4.3 -v
Using built-in specs.
Target: sparc64-sun-solaris2.10
Configured with: ../configure --prefix=/export/home/ryanjohn/apps/gcc/4.3
--build=sparc64-sun-solaris2.10 --program-suffix=-4.3
--with-mpfr=/export/home/ryanjohn/apps --with-gmp=/export/home/ryanjohn/apps
--disable-multilib --with-as=/usr/ccs/bin/as --without-gnu-as
--with-ld=/usr/ccs/bin/ld --without-gnu-ld
Thread model: posix
gcc version 4.3.0 (GCC) 

Note that all three use the same copy of ld

$ cc tls-bug.c
$ cc -g tls-bug.c

$ CC tls-bug.c
ld: fatal: relocation error: R_SPARC_TLS_GD_HI22: file tls-bug.o:
symbol<unknown>: bad symbol type SECT: symbol type must be TLS
$ CC -g tls-bug.c

$ gcc -m64 tls-bug.c
$ gcc -m64 -g tls-bug.c
ld: fatal: relocation error: R_SPARC_TLS_DTPOFF64: file /var/tmp//ccuJHWqp.o:
symbol done: offset 0xffffffff7d901c33 is non-aligned
collect2: ld returned 1 exit status

$ gcc-4.3 tls-bug.c
ld: fatal: relocation error: R_SPARC_TLS_LE_HIX22: file /var/tmp//ccUeK1AZ.o:
symbol <unknown>: bad symbol type SECT: symbol type must be TLS
collect2: ld returned 1 exit status
$ gcc-4.3 tls-bug.c -g
ld: fatal: relocation error: R_SPARC_TLS_LE_HIX22: file /var/tmp//cceRP4ZP.o:
symbol <unknown>: bad symbol type SECT: symbol type must be TLS
collect2: ld returned 1 exit status


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29986

Reply via email to