forked from OSchip/llvm-project
[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. llvm-svn: 266923
This commit is contained in:
parent
0257603c2d
commit
98a4ba54df
|
@ -1752,10 +1752,6 @@ bool MipsTargetInfo<ELFT>::isRelRelative(uint32_t Type) const {
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,@function
|
||||
|
|
Loading…
Reference in New Issue