Index: ELF/GdbIndex.cpp =================================================================== --- ELF/GdbIndex.cpp +++ ELF/GdbIndex.cpp @@ -179,10 +179,15 @@ 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 uint64_t GdbIndexBuilder::getSectionLoadAddress( const object::SectionRef &Sec) const { - return static_cast(Sec).getOffset(); + if (static_cast(Sec).getFlags() & ELF::SHF_ALLOC) + return static_cast(Sec).getOffset(); + return 0; } template