diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index 60182e5d119b..97b60e660313 100644 --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -107,7 +107,7 @@ std::string elf::ObjectFile::getLineInfo(InputSectionBase *S, // section. See comments for ObjectInfo class. DILineInfo Info; Tbl->getFileLineInfoForAddress( - S->getOffset() + Offset, nullptr, + S->getOffsetInFile() + Offset, nullptr, DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath, Info); if (Info.Line == 0) return ""; diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index 218fcdbccafa..3ad0b2391f5c 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -93,7 +93,7 @@ size_t InputSectionBase::getSize() const { return Data.size(); } -uint64_t InputSectionBase::getOffset() const { +uint64_t InputSectionBase::getOffsetInFile() const { const uint8_t *FileStart = (const uint8_t *)File->MB.getBufferStart(); const uint8_t *SecStart = Data.begin(); return SecStart - FileStart; diff --git a/lld/ELF/InputSection.h b/lld/ELF/InputSection.h index f7081beb7f67..4baf121a57b1 100644 --- a/lld/ELF/InputSection.h +++ b/lld/ELF/InputSection.h @@ -63,7 +63,7 @@ public: uint32_t Link; uint32_t Info; - uint64_t getOffset() const; + uint64_t getOffsetInFile() const; static InputSectionBase Discarded; diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp index 637f2ea499f4..fca9be58f430 100644 --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -1733,7 +1733,8 @@ static InputSectionBase *findSection(ArrayRef Arr, uint64_t Offset) { for (InputSectionBase *S : Arr) if (S && S != &InputSection::Discarded) - if (Offset >= S->getOffset() && Offset < S->getOffset() + S->getSize()) + if (Offset >= S->getOffsetInFile() && + Offset < S->getOffsetInFile() + S->getSize()) return S; return nullptr; } @@ -1752,8 +1753,8 @@ readAddressArea(DWARFContext &Dwarf, InputSection *Sec, size_t CurrentCU) { for (std::pair &R : Ranges) if (InputSectionBase *S = findSection(Sections, R.first)) - Ret.push_back({S, R.first - S->getOffset(), R.second - S->getOffset(), - CurrentCU}); + Ret.push_back({S, R.first - S->getOffsetInFile(), + R.second - S->getOffsetInFile(), CurrentCU}); ++CurrentCU; } return Ret;