https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82906
--- Comment #2 from Rafael Avila de Espindola <rafael.espindola at gmail dot com> --- (In reply to Andrew Pinski from comment #1) > Could this be a bug in ld.so rather than gcc? Not doing copy relocs for TLS? I don't think there is enough information left for ld.so to fix the situation. With local dynamic the relocations in test.so are Relocation section '.rela.dyn' at offset 0x2a8 contains 1 entries: Offset Info Type Sym. Value Sym. Name + Addend 000000200ff0 000000000010 R_X86_64_DTPMOD64 0 Relocation section '.rela.plt' at offset 0x2c0 contains 1 entries: Offset Info Type Sym. Value Sym. Name + Addend 000000201018 000100000007 R_X86_64_JUMP_SLO 0000000000000000 __tls_get_addr + 0 So it will always get variable in test.so.