Don't create a got entry if we optimize it out.

llvm-svn: 263669
This commit is contained in:
Rafael Espindola 2016-03-16 22:43:36 +00:00
parent 6cec10572f
commit 48b9102a7a
2 changed files with 20 additions and 1 deletions

View File

@ -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;

View File

@ -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