[lld] r263271 - Now that it is trivial, fix pr26878.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 11 10:33:48 PST 2016
Author: rafael
Date: Fri Mar 11 12:33:48 2016
New Revision: 263271
URL: http://llvm.org/viewvc/llvm-project?rev=263271&view=rev
Log:
Now that it is trivial, fix pr26878.
Added:
lld/trunk/test/ELF/tls-initial-exec-local.s
Modified:
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=263271&r1=263270&r2=263271&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Fri Mar 11 12:33:48 2016
@@ -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(
Added: lld/trunk/test/ELF/tls-initial-exec-local.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/tls-initial-exec-local.s?rev=263271&view=auto
==============================================================================
--- lld/trunk/test/ELF/tls-initial-exec-local.s (added)
+++ lld/trunk/test/ELF/tls-initial-exec-local.s Fri Mar 11 12:33:48 2016
@@ -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 at GOTTPOFF(%rip), %rax
+ addq bar at GOTTPOFF(%rip), %rax
+
+ .section .tbss,"awT", at nobits
+foo:
+ .long 0
+bar:
+ .long 0
More information about the llvm-commits
mailing list