[llvm-branch-commits] [lld] r370312 - Merging r368964:
Hans Wennborg via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Aug 29 02:20:22 PDT 2019
Author: hans
Date: Thu Aug 29 02:20:22 2019
New Revision: 370312
URL: http://llvm.org/viewvc/llvm-project?rev=370312&view=rev
Log:
Merging r368964:
------------------------------------------------------------------------
r368964 | maskray | 2019-08-15 07:22:23 +0200 (Thu, 15 Aug 2019) | 11 lines
[ELF][PPC] Improve error message for unknown relocations
Like rLLD354040.
Previously, for unrecognized relocation types, in -no-pie mode:
foo.o: unrecognized reloc 256
In -pie/-shared mode:
error: can't create dynamic relocation R_PPC_xxx against symbol: yyy in readonly segment
------------------------------------------------------------------------
Modified:
lld/branches/release_90/ (props changed)
lld/branches/release_90/ELF/Arch/PPC.cpp
lld/branches/release_90/ELF/Arch/PPC64.cpp
Propchange: lld/branches/release_90/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Aug 29 02:20:22 2019
@@ -1 +1 @@
-/lld/trunk:366445,366447,366500,366504,366573,366780,366784,366836,367836-367837,368041,368078,368145,369445,369694
+/lld/trunk:366445,366447,366500,366504,366573,366780,366784,366836,367836-367837,368041,368078,368145,368964,369445,369694
Modified: lld/branches/release_90/ELF/Arch/PPC.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/branches/release_90/ELF/Arch/PPC.cpp?rev=370312&r1=370311&r2=370312&view=diff
==============================================================================
--- lld/branches/release_90/ELF/Arch/PPC.cpp (original)
+++ lld/branches/release_90/ELF/Arch/PPC.cpp Thu Aug 29 02:20:22 2019
@@ -190,6 +190,13 @@ bool PPC::inBranchRange(RelType type, ui
RelExpr PPC::getRelExpr(RelType type, const Symbol &s,
const uint8_t *loc) const {
switch (type) {
+ case R_PPC_NONE:
+ return R_NONE;
+ case R_PPC_ADDR16_HA:
+ case R_PPC_ADDR16_HI:
+ case R_PPC_ADDR16_LO:
+ case R_PPC_ADDR32:
+ return R_ABS;
case R_PPC_DTPREL16:
case R_PPC_DTPREL16_HA:
case R_PPC_DTPREL16_HI:
@@ -227,7 +234,9 @@ RelExpr PPC::getRelExpr(RelType type, co
case R_PPC_TPREL16_HI:
return R_TLS;
default:
- return R_ABS;
+ error(getErrorLocation(loc) + "unknown relocation (" + Twine(type) +
+ ") against symbol " + toString(s));
+ return R_NONE;
}
}
@@ -319,7 +328,7 @@ void PPC::relocateOne(uint8_t *loc, RelT
break;
}
default:
- error(getErrorLocation(loc) + "unrecognized relocation " + toString(type));
+ llvm_unreachable("unknown relocation");
}
}
Modified: lld/branches/release_90/ELF/Arch/PPC64.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/branches/release_90/ELF/Arch/PPC64.cpp?rev=370312&r1=370311&r2=370312&view=diff
==============================================================================
--- lld/branches/release_90/ELF/Arch/PPC64.cpp (original)
+++ lld/branches/release_90/ELF/Arch/PPC64.cpp Thu Aug 29 02:20:22 2019
@@ -532,6 +532,21 @@ void PPC64::relaxTlsIeToLe(uint8_t *loc,
RelExpr PPC64::getRelExpr(RelType type, const Symbol &s,
const uint8_t *loc) const {
switch (type) {
+ case R_PPC64_NONE:
+ return R_NONE;
+ case R_PPC64_ADDR16:
+ case R_PPC64_ADDR16_DS:
+ case R_PPC64_ADDR16_HA:
+ case R_PPC64_ADDR16_HI:
+ case R_PPC64_ADDR16_HIGHER:
+ case R_PPC64_ADDR16_HIGHERA:
+ case R_PPC64_ADDR16_HIGHEST:
+ case R_PPC64_ADDR16_HIGHESTA:
+ case R_PPC64_ADDR16_LO:
+ case R_PPC64_ADDR16_LO_DS:
+ case R_PPC64_ADDR32:
+ case R_PPC64_ADDR64:
+ return R_ABS;
case R_PPC64_GOT16:
case R_PPC64_GOT16_DS:
case R_PPC64_GOT16_HA:
@@ -607,7 +622,9 @@ RelExpr PPC64::getRelExpr(RelType type,
case R_PPC64_TLS:
return R_TLSIE_HINT;
default:
- return R_ABS;
+ error(getErrorLocation(loc) + "unknown relocation (" + Twine(type) +
+ ") against symbol " + toString(s));
+ return R_NONE;
}
}
@@ -870,7 +887,7 @@ void PPC64::relocateOne(uint8_t *loc, Re
write64(loc, val - dynamicThreadPointerOffset);
break;
default:
- error(getErrorLocation(loc) + "unrecognized relocation " + toString(type));
+ llvm_unreachable("unknown relocation");
}
}
More information about the llvm-branch-commits
mailing list