[PATCH] D49394: Add R_HEX_B15_PCREL relocation

Sid Manning via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 16 11:54:35 PDT 2018


sidneym created this revision.
sidneym added reviewers: ruiu, kparzysz, shankare.
sidneym added a project: lld.
Herald added subscribers: llvm-commits, MaskRay, arichardson, emaste.
Herald added a reviewer: espindola.

Add B15_PCREL relocation support and test, presumes that https://reviews.llvm.org/D48235 has merged.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D49394

Files:
  ELF/Arch/Hexagon.cpp
  test/ELF/hexagon.s


Index: test/ELF/hexagon.s
===================================================================
--- test/ELF/hexagon.s
+++ test/ELF/hexagon.s
@@ -12,3 +12,6 @@
 call ##_start
 # CHECK: immext(#4294967232)
 # CHECK: call 0x11000
+# R_HEX_B15_PCREL
+if (p0) jump:nt #_start
+# CHECK: if (p0) jump:nt 0x11000
Index: ELF/Arch/Hexagon.cpp
===================================================================
--- ELF/Arch/Hexagon.cpp
+++ ELF/Arch/Hexagon.cpp
@@ -56,6 +56,7 @@
   case R_HEX_B32_PCREL_X:
   case R_HEX_B22_PCREL_X:
   case R_HEX_B22_PCREL:
+  case R_HEX_B15_PCREL:
     return R_PC;
   default:
     return R_ABS;
@@ -77,6 +78,9 @@
   case R_HEX_B22_PCREL:
     or32le(Loc, applyMask(0x1ff3ffe, Val >> 2));
     break;
+  case R_HEX_B15_PCREL:
+    or32le(Loc, applyMask(0x00df20fe, Val >> 2));
+    break;
   default:
     error(getErrorLocation(Loc) + "unrecognized reloc " + toString(Type));
     break;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49394.155731.patch
Type: text/x-patch
Size: 914 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180716/b0e03b6d/attachment.bin>


More information about the llvm-commits mailing list