summaryrefslogtreecommitdiff
path: root/lld/ELF
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2023-03-03 12:48:16 -0800
committerFangrui Song <i@maskray.me>2023-03-03 12:48:16 -0800
commitb30b1f173c911d9b04bbe70ad9b1e3c6c3cd6246 (patch)
tree726532b11d91addce9b43b431bdb74676c5a7949 /lld/ELF
parentffa11183303289654d26b8f761dcf54e611058ca (diff)
downloadllvm-b30b1f173c911d9b04bbe70ad9b1e3c6c3cd6246.tar.gz
[ELF] Add single quotes around out of range errors
to match the convention we use for other diagnostics.
Diffstat (limited to 'lld/ELF')
-rw-r--r--lld/ELF/Relocations.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index fc0c022f8096..6f2280b678b4 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -101,7 +101,7 @@ void elf::reportRangeError(uint8_t *loc, const Relocation &rel, const Twine &v,
std::string hint;
if (rel.sym) {
if (!rel.sym->isSection())
- hint = "; references " + lld::toString(*rel.sym);
+ hint = "; references '" + lld::toString(*rel.sym) + '\'';
else if (auto *d = dyn_cast<Defined>(rel.sym))
hint = ("; references section '" + d->section->name + "'").str();
}
@@ -124,7 +124,8 @@ void elf::reportRangeError(uint8_t *loc, int64_t v, int n, const Symbol &sym,
ErrorPlace errPlace = getErrorPlace(loc);
std::string hint;
if (!sym.getName().empty())
- hint = "; references " + lld::toString(sym) + getDefinedLocation(sym);
+ hint =
+ "; references '" + lld::toString(sym) + '\'' + getDefinedLocation(sym);
errorOrWarn(errPlace.loc + msg + " is out of range: " + Twine(v) +
" is not in [" + Twine(llvm::minIntN(n)) + ", " +
Twine(llvm::maxIntN(n)) + "]" + hint);