[PATCH] D48235: Add R_HEX_B32_PCREL_X and R_HEX_B22_PCREL_X relocations
Sid Manning via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 15 13:25:56 PDT 2018
sidneym created this revision.
sidneym added reviewers: ruiu, kparzysz.
sidneym added a project: lld.
Herald added subscribers: MaskRay, arichardson, emaste.
Herald added a reviewer: espindola.
Add R_HEX_B32_PCREL_X, R_HEX_B22_PCREL_X relocations and a testcase.
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D48235
Files:
ELF/Arch/Hexagon.cpp
test/ELF/hexagon.s
Index: test/ELF/hexagon.s
===================================================================
--- test/ELF/hexagon.s
+++ test/ELF/hexagon.s
@@ -7,3 +7,8 @@
# 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
Index: ELF/Arch/Hexagon.cpp
===================================================================
--- ELF/Arch/Hexagon.cpp
+++ 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_B32_PCREL_X:
+ case R_HEX_B22_PCREL_X:
case R_HEX_B22_PCREL:
return R_PC;
default:
@@ -66,6 +68,12 @@
switch (Type) {
case R_HEX_NONE:
break;
+ case R_HEX_B32_PCREL_X:
+ or32le(Loc, applyMask(0x0fff3fff, Val >> 6));
+ break;
+ case R_HEX_B22_PCREL_X:
+ or32le(Loc, applyMask(0x1ff3ffe, Val & 0x3f));
+ break;
case R_HEX_B22_PCREL:
or32le(Loc, applyMask(0x1ff3ffe, Val >> 2));
break;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48235.151551.patch
Type: text/x-patch
Size: 1069 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180615/c3a7901d/attachment-0001.bin>
More information about the llvm-commits
mailing list