[llvm] r267309 - [RuntimeDyldELF] Handle GOTPCRELX/REX_GOTPCRELX.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 23 18:36:38 PDT 2016


Author: davide
Date: Sat Apr 23 20:36:37 2016
New Revision: 267309

URL: http://llvm.org/viewvc/llvm-project?rev=267309&view=rev
Log:
[RuntimeDyldELF] Handle GOTPCRELX/REX_GOTPCRELX.

Added:
    llvm/trunk/test/ExecutionEngine/RuntimeDyld/X86/ELF-relaxed.s
Modified:
    llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp

Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp?rev=267309&r1=267308&r2=267309&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp Sat Apr 23 20:36:37 2016
@@ -1708,7 +1708,9 @@ relocation_iterator RuntimeDyldELF::proc
                   Value.Offset);
         addRelocationForSection(RE, Value.SectionID);
       }
-    } else if (RelType == ELF::R_X86_64_GOTPCREL) {
+    } else if (RelType == ELF::R_X86_64_GOTPCREL ||
+               RelType == ELF::R_X86_64_GOTPCRELX ||
+               RelType == ELF::R_X86_64_REX_GOTPCRELX) {
       uint64_t GOTOffset = allocateGOTEntries(SectionID, 1);
       resolveGOTOffsetRelocation(SectionID, Offset, GOTOffset + Addend);
 
@@ -1869,6 +1871,8 @@ bool RuntimeDyldELF::relocationNeedsStub
 
 
   case ELF::R_X86_64_GOTPCREL:
+  case ELF::R_X86_64_GOTPCRELX:
+  case ELF::R_X86_64_REX_GOTPCRELX:
   case ELF::R_X86_64_PC32:
   case ELF::R_X86_64_PC64:
   case ELF::R_X86_64_64:

Added: llvm/trunk/test/ExecutionEngine/RuntimeDyld/X86/ELF-relaxed.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/RuntimeDyld/X86/ELF-relaxed.s?rev=267309&view=auto
==============================================================================
--- llvm/trunk/test/ExecutionEngine/RuntimeDyld/X86/ELF-relaxed.s (added)
+++ llvm/trunk/test/ExecutionEngine/RuntimeDyld/X86/ELF-relaxed.s Sat Apr 23 20:36:37 2016
@@ -0,0 +1,8 @@
+# RUN: llvm-mc -triple=x86_64-pc-linux -relocation-model=pic -filetype=obj -o %T/file.o %p/Inputs/ELF_STT_FILE_GLOBAL.s
+# RUN: llvm-mc -triple=x86_64-pc-linux -relax-relocations -relocation-model=pic -filetype=obj -o %T/relaxed.o %s
+# RUN: llvm-rtdyld -triple=x86_64-pc-linux -verify %T/file.o %T/relaxed.o
+
+# Test that RTDyldELF does not crash with 'unimplemented relocation'
+
+_main:
+    movq    foo.c at GOTPCREL(%rip), %rax




More information about the llvm-commits mailing list