[llvm] r333676 - Relax GOTPCREL relocations for tail jmp instructions.

Sriraman Tallam via llvm-commits llvm-commits at lists.llvm.org
Thu May 31 11:12:33 PDT 2018


Author: tmsriram
Date: Thu May 31 11:12:33 2018
New Revision: 333676

URL: http://llvm.org/viewvc/llvm-project?rev=333676&view=rev
Log:
Relax GOTPCREL relocations for tail jmp instructions.

Differential Revision: https://reviews.llvm.org/D47563

Added:
    llvm/trunk/test/CodeGen/X86/tailjmp_gotpcrel_relax_relocation.ll
Modified:
    llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp

Modified: llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp?rev=333676&r1=333675&r2=333676&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp (original)
+++ llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp Thu May 31 11:12:33 2018
@@ -399,6 +399,7 @@ void X86MCCodeEmitter::emitMemModRMByte(
         return X86::reloc_riprel_4byte_movq_load;
       case X86::CALL64m:
       case X86::JMP64m:
+      case X86::TAILJMPm64:
       case X86::TEST64mr:
       case X86::ADC64rm:
       case X86::ADD64rm:

Added: llvm/trunk/test/CodeGen/X86/tailjmp_gotpcrel_relax_relocation.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/tailjmp_gotpcrel_relax_relocation.ll?rev=333676&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/tailjmp_gotpcrel_relax_relocation.ll (added)
+++ llvm/trunk/test/CodeGen/X86/tailjmp_gotpcrel_relax_relocation.ll Thu May 31 11:12:33 2018
@@ -0,0 +1,15 @@
+; RUN: llc -filetype=obj -relax-elf-relocations=true -mtriple=x86_64-linux-gnu -o - %s |  llvm-objdump - -d -r | FileCheck %s
+
+; CHECK: jmpq *(%rip)
+; CHECK-NEXT: R_X86_64_GOTPCRELX
+
+define i32 @main() {
+entry:
+  %call = tail call i32 @foo()
+  ret i32 %call
+}
+
+; Function Attrs: nonlazybind
+declare i32 @foo() #1
+
+attributes #1 = { nonlazybind }




More information about the llvm-commits mailing list