[PATCH] D25069: Fix PREL31 relocation on ARM

Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 20 14:24:57 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL284780: Fix PREL31 relocation on ARM (authored by kfischer).

Changed prior to commit:
  https://reviews.llvm.org/D25069?vs=74091&id=75355#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25069

Files:
  llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
  llvm/trunk/test/ExecutionEngine/RuntimeDyld/ARM/ELF_ARM_EXIDX_relocations.s


Index: llvm/trunk/test/ExecutionEngine/RuntimeDyld/ARM/ELF_ARM_EXIDX_relocations.s
===================================================================
--- llvm/trunk/test/ExecutionEngine/RuntimeDyld/ARM/ELF_ARM_EXIDX_relocations.s
+++ llvm/trunk/test/ExecutionEngine/RuntimeDyld/ARM/ELF_ARM_EXIDX_relocations.s
@@ -0,0 +1,23 @@
+# RUN: llvm-mc -triple=arm-linux-gnueabihf -filetype=obj -o %T/reloc.o %s
+# RUN: llvm-rtdyld -triple=arm-linux-gnueabihf -verify -map-section reloc.o,.ARM.exidx=0x6000 -map-section reloc.o,.text=0x4000  -dummy-extern __aeabi_unwind_cpp_pr0=0x1234 -check=%s %T/reloc.o
+
+        .text
+        .syntax unified
+        .eabi_attribute 67, "2.09"      @ Tag_conformance
+        .cpu    cortex-a8
+        .fpu    neon
+        .file   "reloc.c"
+        .globl  g
+        .align  2
+        .type   g,%function
+g:
+        .fnstart
+        movw    r0, #1
+        bx      lr
+        .Lfunc_end0:
+        .size   g, .Lfunc_end0-g
+        .fnend
+
+# rtdyld-check: *{4}(section_addr(reloc.o, .ARM.exidx)) = (g - (section_addr(reloc.o, .ARM.exidx))) & 0x7fffffff
+# Compat unwind info: finish(0xb0), finish(0xb0), finish(0xb0)
+# rtdyld-check: *{4}(section_addr(reloc.o, .ARM.exidx) + 0x4) = 0x80b0b0b0
Index: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
===================================================================
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
@@ -463,7 +463,11 @@
 
   case ELF::R_ARM_NONE:
     break;
+    // Write a 31bit signed offset
   case ELF::R_ARM_PREL31:
+    *TargetPtr &= 0x80000000;
+    *TargetPtr |= (Value - FinalAddress) & ~0x80000000;
+    break;
   case ELF::R_ARM_TARGET1:
   case ELF::R_ARM_ABS32:
     *TargetPtr = Value;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25069.75355.patch
Type: text/x-patch
Size: 1807 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161020/a3a92842/attachment.bin>


More information about the llvm-commits mailing list