[PATCH] D66275: [ELF][Hexagon] Improve error message for unknown relocations
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 14 21:46:07 PDT 2019
MaskRay created this revision.
MaskRay added reviewers: bcain, kparzysz, ruiu, shankare, sidneym.
Herald added subscribers: llvm-commits, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
Like rLLD354040 <https://reviews.llvm.org/rLLD354040>
With this change, for new unrecognized relocation types, we will not see
unhelpful error messages like:
error: can't create dynamic relocation R_HEX_xxx against symbol: yyy in readonly segment
in -pie/-shared mode.
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D66275
Files:
ELF/Arch/Hexagon.cpp
Index: ELF/Arch/Hexagon.cpp
===================================================================
--- ELF/Arch/Hexagon.cpp
+++ ELF/Arch/Hexagon.cpp
@@ -86,6 +86,20 @@
RelExpr Hexagon::getRelExpr(RelType type, const Symbol &s,
const uint8_t *loc) const {
switch (type) {
+ case R_HEX_NONE:
+ return R_NONE;
+ case R_HEX_6_X:
+ case R_HEX_8_X:
+ case R_HEX_9_X:
+ case R_HEX_10_X:
+ case R_HEX_11_X:
+ case R_HEX_12_X:
+ case R_HEX_16_X:
+ case R_HEX_32:
+ case R_HEX_32_6_X:
+ case R_HEX_HI16:
+ case R_HEX_LO16:
+ return R_ABS;
case R_HEX_B9_PCREL:
case R_HEX_B9_PCREL_X:
case R_HEX_B13_PCREL:
@@ -104,7 +118,9 @@
case R_HEX_GOT_32_6_X:
return R_HEXAGON_GOT;
default:
- return R_ABS;
+ error(getErrorLocation(loc) + "unknown relocation (" + Twine(type) +
+ ") against symbol " + toString(s));
+ return R_NONE;
}
}
@@ -246,8 +262,7 @@
or32le(loc, applyMask(0x00c03fff, val));
break;
default:
- error(getErrorLocation(loc) + "unrecognized relocation " + toString(type));
- break;
+ llvm_unreachable("unknown relocation");
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66275.215320.patch
Type: text/x-patch
Size: 1145 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190815/8dda1863/attachment.bin>
More information about the llvm-commits
mailing list