Bug 16728

Summary: gold fails to hide hidden tls symbols
Product: binutils Reporter: maillist-gdb
Component: goldAssignee: Cary Coutant <ccoutant>
Status: NEW ---    
Severity: critical CC: ccoutant, maillist-gdb, nheghathivhistha
Priority: P2    
Version: 2.24   
Target Milestone: 2.25   
Host: Target:
Build: Last reconfirmed:

Description maillist-gdb 2014-03-20 04:13:38 UTC
firefox 27.0.1 fails to build with gold.

Error relocating /src/build/firefox/mozilla-release/firefox-build-dir/dist/bin/libxul.so: gTLSThreadID: symbol not found

readelf output:
000001fbc4e0  029300000010 R_X86_64_DTPMOD64 0000000000000000 gTLSThreadID + 0
000001fbc4e8  029300000011 R_X86_64_DTPOFF64 0000000000000000 gTLSThreadID + 0
659: 0000000000000000     4 TLS     LOCAL  HIDDEN    17 gTLSThreadID@@xul27

with ld.bfd, grepping for gTLSThreadID returns nothing.

minimal testcase dso_tls_hidden.cc:
#pragma GCC visibility push(hidden)
__thread int foo;
#pragma GCC visibility pop
int bar() { return foo == 1; }

$ g++ -fPIC -shared dso_tls_hidden.cc -o libfoo.so
$ readelf -a libfoo.so  | grep foo
000000001b80  000900000010 R_X86_64_DTPMOD64 0000000000000000 foo + 0
000000001b88  000900000011 R_X86_64_DTPOFF64 0000000000000000 foo + 0
     9: 0000000000000000     4 TLS     LOCAL  HIDDEN    15 foo
    21: 0000000000000000     4 TLS     LOCAL  HIDDEN    15 foo
  000000: Rev: 1  Flags: BASE   Index: 1  Cnt: 1  Name: libfoo.so

with ld.bfd:
$ g++ -fPIC -shared dso_tls_hidden.cc -o libfoo.so
$ readelf -a libfoo.so  | grep foo
    44: 0000000000000000     4 TLS     LOCAL  DEFAULT   14 foo
Comment 1 maillist-gdb 2014-06-12 17:03:35 UTC
ping.
fixing this bug is crucial to make gold fit for real-world usage; instead of staying a toy.