For preemptable symbols the dynamic linker does all the work. Trying
to compute the addend is at best wasteful and can also lead to crashes
in cases of programs that uses tls but doesn't define any tls
variables.
llvm-svn: 288803
bool Constant = !Preemptible && !(Config->Pic && !isAbsolute<ELFT>(Body));
if (!Constant)
AddDyn({DynType, In<ELFT>::Got, Off, !Preemptible, &Body, 0});
- if (Constant || !RelTy::IsRela)
+ if (Constant || (!RelTy::IsRela && !Preemptible))
In<ELFT>::Got->Relocations.push_back({GotRE, DynType, Off, 0, &Body});
continue;
}
--- /dev/null
+ .type foobar,@object
+ .section .tdata,"awT",@progbits
+ .globl foobar
+foobar:
+ .long 42
--- /dev/null
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=i386-pc-linux %S/Inputs/i386-tls-got.s -o %t1.o
+# RUN: ld.lld %t1.o -o %t1.so -shared
+# RUN: llvm-mc -filetype=obj -triple=i386-pc-linux %s -o %t2.o
+# RUN: ld.lld %t2.o %t1.so -o %t
+
+ addl foobar@INDNTPOFF, %eax