diff options
author | George Rimar <grimar@accesssoftek.com> | 2016-12-23 07:51:59 +0000 |
---|---|---|
committer | George Rimar <grimar@accesssoftek.com> | 2016-12-23 07:51:59 +0000 |
commit | 58f84a01a3b757b9b5a0244bb5b0553037feea85 (patch) | |
tree | 84fe96f21d87b5cd7cb3b641c6bb05744f5cf777 /lld/ELF/GdbIndex.cpp | |
parent | 0791d5f5aa19533b9f18888914a4dc8c23831d90 (diff) | |
download | bcm5719-llvm-58f84a01a3b757b9b5a0244bb5b0553037feea85.tar.gz bcm5719-llvm-58f84a01a3b757b9b5a0244bb5b0553037feea85.zip |
[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
llvm-svn: 290419
Diffstat (limited to 'lld/ELF/GdbIndex.cpp')
-rw-r--r-- | lld/ELF/GdbIndex.cpp | 7 |
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> |