[lld] r337484 - Add support for R_HEX_B32_PCREL_X, R_HEX_B22_PCREL_X relocations

Sid Manning via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 19 12:10:56 PDT 2018


Author: sidneym
Date: Thu Jul 19 12:10:56 2018
New Revision: 337484

URL: http://llvm.org/viewvc/llvm-project?rev=337484&view=rev
Log:
Add support for R_HEX_B32_PCREL_X, R_HEX_B22_PCREL_X relocations

A couple more basic relocations plus testcase.

Differential Revision: https://reviews.llvm.org/D47791

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

Modified: lld/trunk/ELF/Arch/Hexagon.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Arch/Hexagon.cpp?rev=337484&r1=337483&r2=337484&view=diff
==============================================================================
--- lld/trunk/ELF/Arch/Hexagon.cpp (original)
+++ lld/trunk/ELF/Arch/Hexagon.cpp Thu Jul 19 12:10:56 2018
@@ -54,6 +54,8 @@ RelExpr Hexagon::getRelExpr(RelType Type
                             const uint8_t *Loc) const {
   switch (Type) {
   case R_HEX_B22_PCREL:
+  case R_HEX_B22_PCREL_X:
+  case R_HEX_B32_PCREL_X:
     return R_PC;
   default:
     return R_ABS;
@@ -69,6 +71,12 @@ void Hexagon::relocateOne(uint8_t *Loc,
   case R_HEX_B22_PCREL:
     or32le(Loc, applyMask(0x1ff3ffe, Val >> 2));
     break;
+  case R_HEX_B22_PCREL_X:
+    or32le(Loc, applyMask(0x1ff3ffe, Val & 0x3f));
+    break;
+  case R_HEX_B32_PCREL_X:
+    or32le(Loc, applyMask(0x0fff3fff, Val >> 6));
+    break;
   default:
     error(getErrorLocation(Loc) + "unrecognized reloc " + toString(Type));
     break;

Modified: lld/trunk/test/ELF/hexagon.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/hexagon.s?rev=337484&r1=337483&r2=337484&view=diff
==============================================================================
--- lld/trunk/test/ELF/hexagon.s (original)
+++ lld/trunk/test/ELF/hexagon.s Thu Jul 19 12:10:56 2018
@@ -7,3 +7,9 @@
 # R_HEX_B22_PCREL
 call #_start
 # CHECK: call 0x11000
+
+# R_HEX_B32_PCREL_X
+# R_HEX_B22_PCREL_X
+call ##_start
+# CHECK: immext(#4294967232)
+# CHECK: call 0x11000




More information about the llvm-commits mailing list