diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2016-03-11 18:33:48 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2016-03-11 18:33:48 +0000 |
commit | 2230483812b21eab10e5e645207b31e4b8b202e2 (patch) | |
tree | 1156a7fc979dd9148ef2e9916ab52b8d9a3a464b | |
parent | bced68c760631a6e08c34ebdc44e021d0e34171e (diff) | |
download | bcm5719-llvm-2230483812b21eab10e5e645207b31e4b8b202e2.tar.gz bcm5719-llvm-2230483812b21eab10e5e645207b31e4b8b202e2.zip |
Now that it is trivial, fix pr26878.
llvm-svn: 263271
-rw-r--r-- | lld/ELF/Writer.cpp | 6 | ||||
-rw-r--r-- | lld/test/ELF/tls-initial-exec-local.s | 36 |
2 files changed, 40 insertions, 2 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 1a85b8d0ddc..a3c24bf4c6b 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -420,8 +420,10 @@ void Writer<ELFT>::scanRelocs( !Target->isSizeRel(Type); if (CBP || Dynrel) { uint32_t DynType; - if (CBP) - DynType = Body.IsTls ? Target->TlsGotRel : Target->GotRel; + if (Body.IsTls) + DynType = Target->TlsGotRel; + else if (CBP) + DynType = Target->GotRel; else DynType = Target->RelativeRel; Out<ELFT>::RelaDyn->addReloc( diff --git a/lld/test/ELF/tls-initial-exec-local.s b/lld/test/ELF/tls-initial-exec-local.s new file mode 100644 index 00000000000..0aef3c8237b --- /dev/null +++ b/lld/test/ELF/tls-initial-exec-local.s @@ -0,0 +1,36 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: ld.lld -shared %t.o -o %t +// RUN: llvm-readobj -r -s %t | FileCheck %s +// RUN: llvm-objdump -d %t | FileCheck --check-prefix=DISASM %s + +// CHECK: Name: .got +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC (0x2) +// CHECK-NEXT: SHF_WRITE (0x1) +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x2090 + +// CHECK: Relocations [ +// CHECK-NEXT: Section ({{.*}}) .rela.dyn { +// CHECK-NEXT: 0x2090 R_X86_64_TPOFF64 - 0x0 +// CHECK-NEXT: 0x2098 R_X86_64_TPOFF64 - 0x4 +// CHECK-NEXT: } +// CHECK-NEXT: ] + +// 0x1007 + 4233 = 0x2090 +// 0x100e + 4234 = 0x2098 +// DISASM: Disassembly of section .text: +// DISASM-NEXT: .text: +// DISASM-NEXT: 1000: {{.*}} addq 4233(%rip), %rax +// DISASM-NEXT: 1007: {{.*}} addq 4234(%rip), %rax + + addq foo@GOTTPOFF(%rip), %rax + addq bar@GOTTPOFF(%rip), %rax + + .section .tbss,"awT",@nobits +foo: + .long 0 +bar: + .long 0 |