summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2019-08-19 14:07:14 +0000
committerFangrui Song <maskray@google.com>2019-08-19 14:07:14 +0000
commitc8a1dfc484c94238c01567247c0cf83584f8719c (patch)
treec4b1893b3d0afb548b7b30f2a8b187dc99b832ee
parentb6ab533b93420e828ea6f555bc7d34d91cb07a34 (diff)
downloadbcm5719-llvm-c8a1dfc484c94238c01567247c0cf83584f8719c.tar.gz
bcm5719-llvm-c8a1dfc484c94238c01567247c0cf83584f8719c.zip
[ELF][Hexagon] Improve error message for unknown relocations
Like rLLD354040 Previously, for unknown relocation types, in -no-pie/-pie mode, we got something like: foo.o: unrecognized relocation ... In -shared mode: error: can't create dynamic relocation ... against symbol: yyy in readonly segment Delete the default case from Hexagon::getRelExpr and add the error there. We will get consistent error message like `error: unknown relocation (1024) against symbol foo` Reviewed By: sidneym Differential Revision: https://reviews.llvm.org/D66275 llvm-svn: 369260
-rw-r--r--lld/ELF/Arch/Hexagon.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/lld/ELF/Arch/Hexagon.cpp b/lld/ELF/Arch/Hexagon.cpp
index 6e9335f3030..355ba9de4b9 100644
--- a/lld/ELF/Arch/Hexagon.cpp
+++ b/lld/ELF/Arch/Hexagon.cpp
@@ -87,6 +87,20 @@ static uint32_t applyMask(uint32_t mask, uint32_t data) {
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:
@@ -111,7 +125,9 @@ RelExpr Hexagon::getRelExpr(RelType type, const Symbol &s,
case R_HEX_GOT_32_6_X:
return R_GOTPLT;
default:
- return R_ABS;
+ error(getErrorLocation(loc) + "unknown relocation (" + Twine(type) +
+ ") against symbol " + toString(s));
+ return R_NONE;
}
}
@@ -258,8 +274,7 @@ void Hexagon::relocateOne(uint8_t *loc, RelType type, uint64_t val) const {
or32le(loc, applyMask(0x00c03fff, val));
break;
default:
- error(getErrorLocation(loc) + "unrecognized relocation " + toString(type));
- break;
+ llvm_unreachable("unknown relocation");
}
}
OpenPOWER on IntegriCloud