This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/82906] thread_local address not uniqued across shared libraries
- From: "podbot88 at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 11 Jun 2018 12:07:25 +0000
- Subject: [Bug c++/82906] thread_local address not uniqued across shared libraries
- Auto-submitted: auto-generated
- References: <bug-82906-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82906
Anders <podbot88 at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |podbot88 at gmail dot com
--- Comment #3 from Anders <podbot88 at gmail dot com> ---
I have run into this problem while using https://github.com/ReactiveX/RxCpp.
When building test.o with clang, it works.
clang++ --std=c++14 -c -O2 -fPIC test.cpp
readelf -r test.o
Relocation section '.rela.text' at offset 0x170 contains 2 entries:
Offset Info Type Sym. Value Sym. Name +
Addend
000000000005 000500000013 R_X86_64_TLSGD 0000000000000000 _ZZ3foovE1i - 4
00000000000d 000600000004 R_X86_64_PLT32 0000000000000000 __tls_get_addr -
4
Relocation section '.rela.eh_frame' at offset 0x1a0 contains 1 entries:
Offset Info Type Sym. Value Sym. Name +
Addend
000000000020 000300000002 R_X86_64_PC32 0000000000000000 .text + 0
/usr/bin/g++-8 --std=c++14 -c -O2 -fPIC test.cpp
readelf -r test.o
Relocation section '.rela.text' at offset 0x268 contains 3 entries:
Offset Info Type Sym. Value Sym. Name +
Addend
000000000007 000c00000014 R_X86_64_TLSLD 0000000000000000 _ZZ3foovE1i - 4
00000000000c 000d00000004 R_X86_64_PLT32 0000000000000000 __tls_get_addr -
4
000000000016 000c00000015 R_X86_64_DTPOFF32 0000000000000000 _ZZ3foovE1i + 0
Relocation section '.rela.eh_frame' at offset 0x2b0 contains 1 entries:
Offset Info Type Sym. Value Sym. Name +
Addend
000000000020 000200000002 R_X86_64_PC32 0000000000000000 .text + 0
g++ test.o -shared -o test.so
test.so if test.o is build with clang.
000000200fe0 000600000010 R_X86_64_DTPMOD64 0000000000000000 _ZZ3foovE1i + 0
000000200fe8 000600000011 R_X86_64_DTPOFF64 0000000000000000 _ZZ3foovE1i + 0
test.so if test.o is build with gcc.
000000200fc8 000000000010 R_X86_64_DTPMOD64 0