From 607d1f6d3216b647c07965bafae8d1aba6312136 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Mon, 4 Oct 2010 19:51:39 +0000 Subject: [PATCH] Implement ELF::R_X86_64_GOTPCREL. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115547 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/ELFObjectWriter.cpp | 3 +++ test/MC/ELF/got.s | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/MC/ELFObjectWriter.cpp b/lib/MC/ELFObjectWriter.cpp index d6502597b58..6a2a6e53da5 100644 --- a/lib/MC/ELFObjectWriter.cpp +++ b/lib/MC/ELFObjectWriter.cpp @@ -588,6 +588,9 @@ void ELFObjectWriterImpl::RecordRelocation(const MCAssembler &Asm, case MCSymbolRefExpr::VK_PLT: Type = ELF::R_X86_64_PLT32; break; + case llvm::MCSymbolRefExpr::VK_GOTPCREL: + Type = ELF::R_X86_64_GOTPCREL; + break; default: llvm_unreachable("Unimplemented"); } diff --git a/test/MC/ELF/got.s b/test/MC/ELF/got.s index c44245d078b..47b0285a99d 100644 --- a/test/MC/ELF/got.s +++ b/test/MC/ELF/got.s @@ -2,7 +2,8 @@ // Test that this produces a R_X86_64_GOT32. - movl foo@GOT, %eax + movl foo@GOT, %eax + movl foo@GOTPCREL(%rip), %eax // CHECK: ('_relocations', [ // CHECK-NEXT: # Relocation 0 @@ -11,4 +12,10 @@ // CHECK-NEXT: ('r_type', 3) // CHECK-NEXT: ('r_addend', // CHECK-NEXT: ), +// CHECK-NEXT: # Relocation 1 +// CHECK-NEXT: (('r_offset', +// CHECK-NEXT: ('r_sym', +// CHECK-NEXT: ('r_type', 9) +// CHECK-NEXT: ('r_addend', +// CHECK-NEXT: ), // CHECK-NEXT: ])