summaryrefslogtreecommitdiff
path: root/lld/ELF/Target.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/ELF/Target.cpp')
-rw-r--r--lld/ELF/Target.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/lld/ELF/Target.cpp b/lld/ELF/Target.cpp
index baf2c1009c3c..88d3006f9a2d 100644
--- a/lld/ELF/Target.cpp
+++ b/lld/ELF/Target.cpp
@@ -106,8 +106,14 @@ template <class ELFT> static ErrorPlace getErrPlace(const uint8_t *loc) {
assert(isa<SyntheticSection>(isec) && "No data but not synthetic?");
continue;
}
- if (isecLoc <= loc && loc < isecLoc + isec->getSize())
- return {isec, isec->template getLocation<ELFT>(loc - isecLoc) + ": "};
+ if (isecLoc <= loc && loc < isecLoc + isec->getSize()) {
+ auto objLoc = isec->template getLocation<ELFT>(loc - isecLoc);
+ // Return object file location and source file location.
+ // TODO: Refactor getSrcMsg not to take a variable.
+ Undefined dummy(nullptr, "", STB_LOCAL, 0, 0);
+ return {isec, objLoc + ": ",
+ isec->file ? isec->getSrcMsg(dummy, loc - isecLoc) : ""};
+ }
}
return {};
}