[ELF][HEXAGON] Add R_HEX_HI16/R_HEX_LO16 relocations
authorSid Manning <sidneym@codeaurora.org>
Thu, 9 Aug 2018 20:04:53 +0000 (20:04 +0000)
committerSid Manning <sidneym@codeaurora.org>
Thu, 9 Aug 2018 20:04:53 +0000 (20:04 +0000)
Differential Revision: https://reviews.llvm.org/D50520

llvm-svn: 339371

lld/ELF/Arch/Hexagon.cpp
lld/test/ELF/hexagon.s

index b82c30f..c3c4aba 100644 (file)
@@ -135,6 +135,12 @@ void Hexagon::relocateOne(uint8_t *Loc, RelType Type, uint64_t Val) const {
   case R_HEX_B32_PCREL_X:
     or32le(Loc, applyMask(0x0fff3fff, Val >> 6));
     break;
+  case R_HEX_HI16:
+    or32le(Loc, applyMask(0x00c03fff, Val >> 16));
+    break;
+  case R_HEX_LO16:
+    or32le(Loc, applyMask(0x00c03fff, Val));
+    break;
   default:
     error(getErrorLocation(Loc) + "unrecognized reloc " + toString(Type));
     break;
index 4424735..d3eaa37 100644 (file)
@@ -151,3 +151,11 @@ r0=add(r1,mpyi(r2,##_start))
 # R_HEX_6_X
 { r0 = ##_start; r2 = r16 }
 # CHECK: 28003082      r0 = ##69632;   r2 = r16 }
+
+# R_HEX_HI16
+r0.h = #HI(_start)
+# CHECK: r0.h = #1
+
+# R_HEX_LO16
+r0.l = #LO(_start)
+# CHECK: r0.l = #4096