[lld] r290419 - [ELF] - Return file offset as address only for allocatable sections when building .gdb_index
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 22 23:52:00 PST 2016
Author: grimar
Date: Fri Dec 23 01:51:59 2016
New Revision: 290419
URL: http://llvm.org/viewvc/llvm-project?rev=290419&view=rev
Log:
[ELF] - Return file offset as address only for allocatable sections when building .gdb_index
This fixes issue revealed by r289961.
Differential revision: https://reviews.llvm.org/D28045
Modified:
lld/trunk/ELF/GdbIndex.cpp
Modified: lld/trunk/ELF/GdbIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/GdbIndex.cpp?rev=290419&r1=290418&r2=290419&view=diff
==============================================================================
--- lld/trunk/ELF/GdbIndex.cpp (original)
+++ lld/trunk/ELF/GdbIndex.cpp Fri Dec 23 01:51:59 2016
@@ -179,10 +179,15 @@ GdbIndexBuilder<ELFT>::readAddressArea(s
return Ret;
}
+// We return file offset as load address for allocatable sections. That is
+// currently used for collecting address ranges in readAddressArea(). We are
+// able then to find section index that range belongs to.
template <class ELFT>
uint64_t GdbIndexBuilder<ELFT>::getSectionLoadAddress(
const object::SectionRef &Sec) const {
- return static_cast<const ELFSectionRef &>(Sec).getOffset();
+ if (static_cast<const ELFSectionRef &>(Sec).getFlags() & ELF::SHF_ALLOC)
+ return static_cast<const ELFSectionRef &>(Sec).getOffset();
+ return 0;
}
template <class ELFT>
More information about the llvm-commits
mailing list