mirror of
https://github.com/intel/llvm.git
synced 2026-01-27 06:06:34 +08:00
[ELF] Fix error reporting for synthetic sections
Synthetic sections don't belong to any input file, but still they are input sections. Whenever problem occurs with relocations in these sections lld crashes in error reporting, trying to print input file name. Differential revision: https://reviews.llvm.org/D30889 llvm-svn: 297711
This commit is contained in:
@@ -172,6 +172,11 @@ InputSectionBase *InputSectionBase::getLinkOrderDep() const {
|
||||
// Returns a source location string. Used to construct an error message.
|
||||
template <class ELFT>
|
||||
std::string InputSectionBase::getLocation(uint64_t Offset) {
|
||||
// We don't have file for synthetic sections.
|
||||
if (getFile<ELFT>() == nullptr)
|
||||
return (Config->OutputFile + ":(" + Name + "+0x" + utohexstr(Offset) + ")")
|
||||
.str();
|
||||
|
||||
// First check if we can get desired values from debugging information.
|
||||
std::string LineInfo = getFile<ELFT>()->getLineInfo(this, Offset);
|
||||
if (!LineInfo.empty())
|
||||
|
||||
Reference in New Issue
Block a user