summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/ELF/GdbIndex.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lld/ELF/GdbIndex.cpp b/lld/ELF/GdbIndex.cpp
index 74ebcf92400..762144dd0a9 100644
--- a/lld/ELF/GdbIndex.cpp
+++ b/lld/ELF/GdbIndex.cpp
@@ -179,10 +179,15 @@ GdbIndexBuilder<ELFT>::readAddressArea(size_t CurrentCU) {
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>
OpenPOWER on IntegriCloud