X86: Use R_X86_64_TPOFF64 for FK_Data_8

Summary:
LLVM would crash when trying to come up with a relocation type for
assembly like:
movabsq $V@TPOFF, %rax

Instead, we say the relocation type is R_X86_64_TPOFF64.

Fixes PR17274.

Reviewers: dblaikie, nrieck, rafael

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1717

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191163 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Majnemer 2013-09-22 05:30:16 +00:00
parent ecd4965c13
commit 7d7db75a55
2 changed files with 5 additions and 0 deletions

View File

@ -108,6 +108,9 @@ unsigned X86ELFObjectWriter::GetRelocType(const MCValue &Target,
case MCSymbolRefExpr::VK_None:
Type = ELF::R_X86_64_64;
break;
case MCSymbolRefExpr::VK_TPOFF:
Type = ELF::R_X86_64_TPOFF64;
break;
case MCSymbolRefExpr::VK_DTPOFF:
Type = ELF::R_X86_64_DTPOFF64;
break;

View File

@ -19,6 +19,7 @@ bar:
leaq foo-bar(%r14),%r14
addq $bar,%rax # R_X86_64_32S
.quad foo@DTPOFF
movabsq $baz@TPOFF, %rax
// CHECK: Section {
// CHECK: Name: .rela.text
@ -39,6 +40,7 @@ bar:
// CHECK-NEXT: 0x5C R_X86_64_PC32 foo 0x5C
// CHECK-NEXT: 0x63 R_X86_64_32S .text 0x0
// CHECK-NEXT: 0x67 R_X86_64_DTPOFF64 foo 0x0
// CHECK-NEXT: 0x71 R_X86_64_TPOFF64 baz 0x0
// CHECK-NEXT: ]
// CHECK-NEXT: }