[lld] r337494 - [ELF][HEXAGON] Add support for R_HEX_B15_PCREL

Sid Manning via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 19 13:27:43 PDT 2018


Author: sidneym
Date: Thu Jul 19 13:27:43 2018
New Revision: 337494

URL: http://llvm.org/viewvc/llvm-project?rev=337494&view=rev
Log:
[ELF][HEXAGON] Add support for R_HEX_B15_PCREL

Add support and update the testcase.

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

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=337494&r1=337493&r2=337494&view=diff
==============================================================================
--- lld/trunk/ELF/Arch/Hexagon.cpp (original)
+++ lld/trunk/ELF/Arch/Hexagon.cpp Thu Jul 19 13:27:43 2018
@@ -53,6 +53,7 @@ static uint32_t applyMask(uint32_t Mask,
 RelExpr Hexagon::getRelExpr(RelType Type, const Symbol &S,
                             const uint8_t *Loc) const {
   switch (Type) {
+  case R_HEX_B15_PCREL:
   case R_HEX_B22_PCREL:
   case R_HEX_B22_PCREL_X:
   case R_HEX_B32_PCREL_X:
@@ -68,6 +69,9 @@ void Hexagon::relocateOne(uint8_t *Loc,
   switch (Type) {
   case R_HEX_NONE:
     break;
+  case R_HEX_B15_PCREL:
+    or32le(Loc, applyMask(0x00df20fe, Val >> 2));
+    break;
   case R_HEX_B22_PCREL:
     or32le(Loc, applyMask(0x1ff3ffe, Val >> 2));
     break;

Modified: lld/trunk/test/ELF/hexagon.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/hexagon.s?rev=337494&r1=337493&r2=337494&view=diff
==============================================================================
--- lld/trunk/test/ELF/hexagon.s (original)
+++ lld/trunk/test/ELF/hexagon.s Thu Jul 19 13:27:43 2018
@@ -4,6 +4,10 @@
 # RUN: ld.lld %t2 %t  -o %t3
 # RUN: llvm-objdump -d  %t3 | FileCheck %s
 
+# R_HEX_B15_PCREL
+if (p0) jump:nt #_start
+# CHECK: if (p0) jump:nt 0x11000
+
 # R_HEX_B22_PCREL
 call #_start
 # CHECK: call 0x11000




More information about the llvm-commits mailing list