[lld] r266923 - [ELF][MIPS] Treat R_MIPS_TLS_{D}TPREL_HI16/LO16 as relative relocations
Simon Atanasyan via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 20 14:57:51 PDT 2016
Author: atanasyan
Date: Wed Apr 20 16:57:51 2016
New Revision: 266923
URL: http://llvm.org/viewvc/llvm-project?rev=266923&view=rev
Log:
[ELF][MIPS] Treat R_MIPS_TLS_{D}TPREL_HI16/LO16 as relative relocations
These relocations are calculated as S + A - DTPREL or S + A - TPREL,
where DTPREL = TlsVA - 0x8000, TPREL = TlsVA - 0x7000. So the result
is relative to the TLS output section and is not an absolut value
The fix allows to escape creation of unnecessary dynamic relocations
in case of DSO linking.
Modified:
lld/trunk/ELF/Target.cpp
lld/trunk/test/ELF/mips-tls-hilo.s
Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=266923&r1=266922&r2=266923&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Wed Apr 20 16:57:51 2016
@@ -1752,10 +1752,6 @@ bool MipsTargetInfo<ELFT>::isRelRelative
case R_MIPS_32:
case R_MIPS_64:
case R_MIPS_HI16:
- case R_MIPS_TLS_DTPREL_HI16:
- case R_MIPS_TLS_DTPREL_LO16:
- case R_MIPS_TLS_TPREL_HI16:
- case R_MIPS_TLS_TPREL_LO16:
return false;
}
}
Modified: lld/trunk/test/ELF/mips-tls-hilo.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/mips-tls-hilo.s?rev=266923&r1=266922&r2=266923&view=diff
==============================================================================
--- lld/trunk/test/ELF/mips-tls-hilo.s (original)
+++ lld/trunk/test/ELF/mips-tls-hilo.s Wed Apr 20 16:57:51 2016
@@ -6,6 +6,9 @@
# RUN: llvm-objdump -d -t %t.exe | FileCheck -check-prefix=DIS %s
# RUN: llvm-readobj -r -mips-plt-got %t.exe | FileCheck %s
+# RUN: ld.lld %t.o -shared -o %t.so
+# RUN: llvm-readobj -r -mips-plt-got %t.so | FileCheck -check-prefix=SO %s
+
# REQUIRES: mips
# DIS: __start:
@@ -25,6 +28,16 @@
# CHECK-NEXT: ]
# CHECK-NOT: Primary GOT
+# SO: Relocations [
+# SO-NEXT: ]
+# SO: Primary GOT {
+# SO: Local entries [
+# SO-NEXT: ]
+# SO-NEXT: Global entries [
+# SO-NEXT: ]
+# SO-NEXT: Number of TLS and multi-GOT entries: 0
+# SO-NEXT: }
+
.text
.globl __start
.type __start, at function
More information about the llvm-commits
mailing list