[llvm] r265881 - [MC] support TLSDESC and TLSCALL / GNU2 tls dialect
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 9 13:32:33 PDT 2016
Author: davide
Date: Sat Apr 9 15:32:33 2016
New Revision: 265881
URL: http://llvm.org/viewvc/llvm-project?rev=265881&view=rev
Log:
[MC] support TLSDESC and TLSCALL / GNU2 tls dialect
Differential Revision: http://reviews.llvm.org/D18885
Added:
llvm/trunk/test/MC/ELF/relocation-tls.s
Modified:
llvm/trunk/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp
Modified: llvm/trunk/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp?rev=265881&r1=265880&r2=265881&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp Sat Apr 9 15:32:33 2016
@@ -154,6 +154,10 @@ static unsigned getRelocType64(MCContext
case RT64_8:
llvm_unreachable("Unimplemented");
}
+ case MCSymbolRefExpr::VK_TLSCALL:
+ return ELF::R_X86_64_TLSDESC_CALL;
+ case MCSymbolRefExpr::VK_TLSDESC:
+ return ELF::R_X86_64_GOTPC32_TLSDESC;
case MCSymbolRefExpr::VK_TLSGD:
checkIs32(Ctx, Loc, Type);
return ELF::R_X86_64_TLSGD;
Added: llvm/trunk/test/MC/ELF/relocation-tls.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/relocation-tls.s?rev=265881&view=auto
==============================================================================
--- llvm/trunk/test/MC/ELF/relocation-tls.s (added)
+++ llvm/trunk/test/MC/ELF/relocation-tls.s Sat Apr 9 15:32:33 2016
@@ -0,0 +1,26 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -s -sr | FileCheck %s
+
+// Test that we produce the correct relocation.
+
+ leaq _ZL3ccc at TLSDESC(%rip), %rax
+ call *_ZL3ccc at TLSCALL(%rax)
+ addq %fs:0, %rax
+
+// CHECK: Section {
+// CHECK: Index:
+// CHECK: Name: .rela.text
+// CHECK-NEXT: Type: SHT_RELA
+// CHECK-NEXT: Flags [
+// CHECK-NEXT: ]
+// CHECK-NEXT: Address: 0x0
+// CHECK-NEXT: Offset:
+// CHECK-NEXT: Size:
+// CHECK-NEXT: Link:
+// CHECK-NEXT: Info:
+// CHECK-NEXT: AddressAlignment: 8
+// CHECK-NEXT: EntrySize: 24
+// CHECK-NEXT: Relocations [
+// CHECK-NEXT: 0x3 R_X86_64_GOTPC32_TLSDESC _ZL3ccc 0xFFFFFFFFFFFFFFFC
+// CHECK-NEXT: 0x9 R_X86_64_TLSDESC_CALL _ZL3ccc 0x0
+// CHECK-NEXT: ]
+// CHECK-NEXT: }
More information about the llvm-commits
mailing list