Skip to content

Commit 8ac63e8

Browse files
committed
[LLDB][MIPS] Set the Section's file address for
ELF section to LLDB_INVALID_ADDRESS if SHF_ALLOC is not set. Reviewers: labath, clayborg Subscribers: jaydeep, bhushan, lldb-commits Differential Revision: https://reviews.llvm.org/D35784 llvm-svn: 310855
1 parent c3f6b28 commit 8ac63e8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1987,7 +1987,9 @@ void ObjectFileELF::CreateSections(SectionList &unified_section_list) {
19871987
? m_arch_spec.GetDataByteSize()
19881988
: eSectionTypeCode == sect_type ? m_arch_spec.GetCodeByteSize()
19891989
: 1;
1990-
1990+
const addr_t sect_file_addr = header.sh_flags & SHF_ALLOC
1991+
? header.sh_addr
1992+
: LLDB_INVALID_ADDRESS;
19911993
elf::elf_xword log2align =
19921994
(header.sh_addralign == 0) ? 0 : llvm::Log2_64(header.sh_addralign);
19931995
SectionSP section_sp(new Section(
@@ -1997,7 +1999,7 @@ void ObjectFileELF::CreateSections(SectionList &unified_section_list) {
19971999
SectionIndex(I), // Section ID.
19982000
name, // Section name.
19992001
sect_type, // Section type.
2000-
header.sh_addr, // VM address.
2002+
sect_file_addr, // VM address.
20012003
vm_size, // VM size in bytes of this section.
20022004
header.sh_offset, // Offset of this section in the file.
20032005
file_size, // Size of the section as found in the file.

0 commit comments

Comments
 (0)