diff options
| -rw-r--r-- | lld/ELF/Target.cpp | 3 | ||||
| -rw-r--r-- | lld/test/ELF/aarch64-got.s | 18 |
2 files changed, 20 insertions, 1 deletions
diff --git a/lld/ELF/Target.cpp b/lld/ELF/Target.cpp index 7549b5597c3..89fd5c004e9 100644 --- a/lld/ELF/Target.cpp +++ b/lld/ELF/Target.cpp @@ -1319,8 +1319,9 @@ bool AArch64TargetInfo::needsCopyRelImpl(uint32_t Type) const { bool AArch64TargetInfo::needsGot(uint32_t Type, SymbolBody &S) const { switch (Type) { - case R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC: case R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21: + return !canRelaxTls(Type, &S); + case R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC: case R_AARCH64_ADR_GOT_PAGE: case R_AARCH64_LD64_GOT_LO12_NC: return true; diff --git a/lld/test/ELF/aarch64-got.s b/lld/test/ELF/aarch64-got.s new file mode 100644 index 00000000000..f56d8a73478 --- /dev/null +++ b/lld/test/ELF/aarch64-got.s @@ -0,0 +1,18 @@ +# REQUIRES: aarch64 +# RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-freebsd %s -o %t.o +# RUN: ld.lld %t.o -o %t +# RUN: llvm-readobj -s %t | FileCheck %s + +# CHECK-NOT: Name: .got + +.globl _start +_start: + adrp x0, :gottprel:foo + + .global foo + .section .tdata,"awT",%progbits + .align 2 + .type foo, %object + .size foo, 4 +foo: + .word 5 |

