1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

This commit adds some (but not all) of the x86-64 relocations that are not

currently supported in the ELF object writer, along with a simple test case.

llvm-svn: 193709
This commit is contained in:
Tom Roeder 2013-10-30 18:47:25 +00:00
parent 75714118ae
commit 9290de3a99
2 changed files with 16 additions and 6 deletions

View File

@ -108,6 +108,12 @@ unsigned X86ELFObjectWriter::GetRelocType(const MCValue &Target,
case MCSymbolRefExpr::VK_None:
Type = ELF::R_X86_64_64;
break;
case MCSymbolRefExpr::VK_GOT:
Type = ELF::R_X86_64_GOT64;
break;
case MCSymbolRefExpr::VK_GOTOFF:
Type = ELF::R_X86_64_GOTOFF64;
break;
case MCSymbolRefExpr::VK_TPOFF:
Type = ELF::R_X86_64_TPOFF64;
break;

View File

@ -14,6 +14,8 @@ bar:
leaq foo@TPOFF(%rax), %rax # R_X86_64_TPOFF32
leaq foo@TLSLD(%rip), %rdi # R_X86_64_TLSLD
leaq foo@dtpoff(%rax), %rcx # R_X86_64_DTPOFF32
movabs foo@GOT, %rax # R_X86_64_GOT64
movabs foo@GOTOFF, %rax # R_X86_64_GOTOFF64
pushq $bar
movq foo(%rip), %rdx
leaq foo-bar(%r14),%r14
@ -35,12 +37,14 @@ bar:
// CHECK-NEXT: 0x3B R_X86_64_TPOFF32 foo 0x0
// CHECK-NEXT: 0x42 R_X86_64_TLSLD foo 0xFFFFFFFFFFFFFFFC
// CHECK-NEXT: 0x49 R_X86_64_DTPOFF32 foo 0x0
// CHECK-NEXT: 0x4E R_X86_64_32S .text 0x0
// 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: 0x71 R_X86_64_TPOFF64 baz 0x0
// CHECK-NEXT: 0x4F R_X86_64_GOT64 foo 0x0
// CHECK-NEXT: 0x59 R_X86_64_GOTOFF64 foo 0x0
// CHECK-NEXT: 0x62 R_X86_64_32S .text 0x0
// CHECK-NEXT: 0x69 R_X86_64_PC32 foo 0xFFFFFFFFFFFFFFFC
// CHECK-NEXT: 0x70 R_X86_64_PC32 foo 0x70
// CHECK-NEXT: 0x77 R_X86_64_32S .text 0x0
// CHECK-NEXT: 0x7B R_X86_64_DTPOFF64 foo 0x0
// CHECK-NEXT: 0x85 R_X86_64_TPOFF64 baz 0x0
// CHECK-NEXT: ]
// CHECK-NEXT: }