Skip to content

Commit

Permalink
Integrate Assembler: Support X86_64_DTPOFF64 relocations
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185131 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
dwblaikie committed Jun 28, 2013
1 parent 8e7294f commit c084c09
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
13 changes: 12 additions & 1 deletion lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,18 @@ unsigned X86ELFObjectWriter::GetRelocType(const MCValue &Target,
} else {
switch ((unsigned)Fixup.getKind()) {
default: llvm_unreachable("invalid fixup kind!");
case FK_Data_8: Type = ELF::R_X86_64_64; break;
case FK_Data_8:
switch (Modifier) {
default:
llvm_unreachable("Unimplemented");
case MCSymbolRefExpr::VK_None:
Type = ELF::R_X86_64_64;
break;
case MCSymbolRefExpr::VK_DTPOFF:
Type = ELF::R_X86_64_DTPOFF64;
break;
}
break;
case X86::reloc_signed_4byte:
switch (Modifier) {
default:
Expand Down
3 changes: 2 additions & 1 deletion test/MC/ELF/relocation.s
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ bar:
movq foo(%rip), %rdx
leaq foo-bar(%r14),%r14
addq $bar,%rax # R_X86_64_32S

.quad foo@DTPOFF

// CHECK: Section {
// CHECK: Name: .rela.text
Expand All @@ -38,6 +38,7 @@ bar:
// CHECK-NEXT: 0x55 R_X86_64_PC32 foo 0xFFFFFFFFFFFFFFFC
// 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: ]
// CHECK-NEXT: }

Expand Down

0 comments on commit c084c09

Please sign in to comment.