[PATCH] D51045: Add R_HEX_B9_PCREL and R_HEX_B9_PCREL_X relocation support

Sid Manning via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 25 14:27:13 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL340692: [ELF][HEXAGON] Add R_HEX_B9_PCREL and R_HEX_B9_PCREL_X relocation support (authored by sidneym, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D51045?vs=161749&id=162565#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D51045

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


Index: lld/trunk/test/ELF/hexagon.s
===================================================================
--- lld/trunk/test/ELF/hexagon.s
+++ lld/trunk/test/ELF/hexagon.s
@@ -194,3 +194,11 @@
 # 0xb0000000
 r0 = add(r1, ##_start)
 # CHECK: b001c000   r0 = add(r1,##69632) }
+
+# R_HEX_B9_PCREL:
+{r0=#1 ; jump #_start}
+# CHECK: jump 0x11000
+
+# R_HEX_B9_PCREL_X:
+{r0=#1 ; jump ##_start}
+# CHECK: jump 0x11000
Index: lld/trunk/ELF/Arch/Hexagon.cpp
===================================================================
--- lld/trunk/ELF/Arch/Hexagon.cpp
+++ lld/trunk/ELF/Arch/Hexagon.cpp
@@ -53,6 +53,8 @@
 RelExpr Hexagon::getRelExpr(RelType Type, const Symbol &S,
                             const uint8_t *Loc) const {
   switch (Type) {
+  case R_HEX_B9_PCREL:
+  case R_HEX_B9_PCREL_X:
   case R_HEX_B15_PCREL:
   case R_HEX_B15_PCREL_X:
   case R_HEX_B22_PCREL:
@@ -152,6 +154,12 @@
   case R_HEX_32_6_X:
     or32le(Loc, applyMask(0x0fff3fff, Val >> 6));
     break;
+  case R_HEX_B9_PCREL:
+    or32le(Loc, applyMask(0x003000fe, Val >> 2));
+    break;
+  case R_HEX_B9_PCREL_X:
+    or32le(Loc, applyMask(0x003000fe, Val & 0x3f));
+    break;
   case R_HEX_B15_PCREL:
     or32le(Loc, applyMask(0x00df20fe, Val >> 2));
     break;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51045.162565.patch
Type: text/x-patch
Size: 1241 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180825/5d0e1220/attachment.bin>


More information about the llvm-commits mailing list