[PATCH] D66542: R_HEX_B15_PCREL_X/R_HEX_B9_PCREL_X can be in shared objects

Sid Manning via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 27 10:47:43 PDT 2019


sidneym updated this revision to Diff 222181.
sidneym added a comment.

Updated testcase.

Local jumps are almost always resolved by the assembler unless -mno-fixup is used.

There are no specific rules regarding which relocations are preemptible.

If there are some behaviors you would like me to model on hexagon let me know which tests and I will take a look at them and try to add Hexagon versions.

Thanks,


Repository:
  rLLD LLVM Linker

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66542/new/

https://reviews.llvm.org/D66542

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


Index: lld/test/ELF/hexagon-shared.s
===================================================================
--- lld/test/ELF/hexagon-shared.s
+++ lld/test/ELF/hexagon-shared.s
@@ -17,6 +17,10 @@
 
 # R_HEX_PLT_B22_PCREL
 call bar at PLT
+# R_HEX_B15_PCREL_X
+if (p0) jump bar
+# R_HEX_B9_PCREL_X
+{ r0 = #0; jump bar }
 
 # R_HEX_GOT_11_X and R_HEX_GOT_32_6_X
 r2=add(pc,##_GLOBAL_OFFSET_TABLE_ at PCREL)
@@ -41,25 +45,27 @@
    .size pvar, 4
 
 # PLT: { immext(#131200
-# PLT: r28 = add(pc,##131252) }
-# PLT: { r14 -= add(r28,#16)
-# PLT: r15 = memw(r28+#8)
-# PLT: r28 = memw(r28+#4) }
-# PLT: { r14 = asr(r14,#2)
-# PLT: jumpr r28 }
-# PLT: { trap0(#219) }
-# PLT: immext(#131200)
-# PLT: r14 = add(pc,##131236) }
-# PLT: r28 = memw(r14+#0) }
-# PLT: jumpr r28 }
+# PLT-NEXT: r28 = add(pc,##131252) }
+# PLT-NEXT: { r14 -= add(r28,#16)
+# PLT-NEXT: r15 = memw(r28+#8)
+# PLT-NEXT: r28 = memw(r28+#4) }
+# PLT-NEXT: { r14 = asr(r14,#2)
+# PLT-NEXT: jumpr r28 }
+# PLT-NEXT: { trap0(#219) }
+# PLT-NEXT: immext(#131200)
+# PLT-NEXT: r14 = add(pc,##131236) }
+# PLT-NEXT: r28 = memw(r14+#0) }
+# PLT-NEXT: jumpr r28 }
 
-# TEXT:  10218: 68 00 01 00 00010068
-# TEXT: { 	call 0x10270 }
-# TEXT: r0 = add(r1,##-65548) }
+# TEXT:  10218: 78 00 01 00 00010078
+# TEXT: { 	call 0x10280 }
+# TEXT: if (p0) jump:nt 0x10280
+# TEXT: r0 = #0 ; jump 0x10280
+# TEXT: r0 = add(r1,##-65548)
 
 # GOT: .got:
-# GOT: 202f8:	00 00 00 00 00000000 <unknown>
+# GOT:  00 00 00 00 00000000 <unknown>
 
-# RELO: 000202f8  00000121 R_HEX_GLOB_DAT
-# RELO: 00030300  00000406 R_HEX_32
-# RELO: 00030314  00000122 R_HEX_JMP_SLOT
+# RELO: 00000121 R_HEX_GLOB_DAT
+# RELO: 00000406 R_HEX_32
+# RELO: 00000122 R_HEX_JMP_SLOT
Index: lld/ELF/Arch/Hexagon.cpp
===================================================================
--- lld/ELF/Arch/Hexagon.cpp
+++ lld/ELF/Arch/Hexagon.cpp
@@ -102,13 +102,13 @@
   case R_HEX_LO16:
     return R_ABS;
   case R_HEX_B9_PCREL:
-  case R_HEX_B9_PCREL_X:
   case R_HEX_B13_PCREL:
   case R_HEX_B15_PCREL:
-  case R_HEX_B15_PCREL_X:
   case R_HEX_6_PCREL_X:
   case R_HEX_32_PCREL:
     return R_PC;
+  case R_HEX_B9_PCREL_X:
+  case R_HEX_B15_PCREL_X:
   case R_HEX_B22_PCREL:
   case R_HEX_PLT_B22_PCREL:
   case R_HEX_B22_PCREL_X:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66542.222181.patch
Type: text/x-patch
Size: 2238 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190927/def56b91/attachment.bin>


More information about the llvm-commits mailing list