[PATCH] D51166: Add R_HEX_B13_PCREL relocation support

Sid Manning via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 23 08:26:53 PDT 2018


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

While the _X extended version of this relocation is documented there is no practical way to make use of it in the ISA.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D51166

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


Index: test/ELF/hexagon.s
===================================================================
--- test/ELF/hexagon.s
+++ test/ELF/hexagon.s
@@ -194,3 +194,7 @@
 # 0xb0000000
 r0 = add(r1, ##_start)
 # CHECK: b001c000   r0 = add(r1,##69632) }
+
+# R_HEX_B13_PCREL
+if (r0 == #0) jump:t #_start
+# CHECK: if (r0==#0) jump:t 0x11000
Index: ELF/Arch/Hexagon.cpp
===================================================================
--- ELF/Arch/Hexagon.cpp
+++ ELF/Arch/Hexagon.cpp
@@ -53,6 +53,7 @@
 RelExpr Hexagon::getRelExpr(RelType Type, const Symbol &S,
                             const uint8_t *Loc) const {
   switch (Type) {
+  case R_HEX_B13_PCREL:
   case R_HEX_B15_PCREL:
   case R_HEX_B15_PCREL_X:
   case R_HEX_B22_PCREL:
@@ -152,6 +153,9 @@
   case R_HEX_32_6_X:
     or32le(Loc, applyMask(0x0fff3fff, Val >> 6));
     break;
+  case R_HEX_B13_PCREL:
+    or32le(Loc, applyMask(0x00202ffe, Val >> 2));
+    break;
   case R_HEX_B15_PCREL:
     or32le(Loc, applyMask(0x00df20fe, Val >> 2));
     break;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51166.162188.patch
Type: text/x-patch
Size: 1013 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180823/528d0c64/attachment.bin>


More information about the llvm-commits mailing list