mirror of
https://github.com/intel/llvm.git
synced 2026-01-24 08:30:34 +08:00
ObjectFile: remove ReadSectionData/MemoryMapSectionData mutual recursion
Summary: These two functions were calling each other, while handling different branches of the if(IsInMemory()). This had a reason at some point in the past, but right now it's just confusing. I resolve this by removing the MemoryMapSectionData function and inlining the !IsInMemory branch into ReadSectionData. There isn't anything mmap-related in this function anyway, as the decision whether to mmap is handled at a higher level. This is a preparatory step to make ObjectFileELF be able to decompress compressed sections (I want to make sure that all calls reading section data are routed through a single piece of code). Reviewers: clayborg Subscribers: emaste, JDevlieghere, lldb-commits Differential Revision: https://reviews.llvm.org/D41169 llvm-svn: 320705
This commit is contained in:
@@ -561,25 +561,9 @@ size_t ObjectFile::ReadSectionData(Section *section,
|
||||
} else {
|
||||
// The object file now contains a full mmap'ed copy of the object file data,
|
||||
// so just use this
|
||||
return MemoryMapSectionData(section, section_data);
|
||||
}
|
||||
}
|
||||
|
||||
size_t ObjectFile::MemoryMapSectionData(Section *section,
|
||||
DataExtractor §ion_data) {
|
||||
// If some other objectfile owns this data, pass this to them.
|
||||
if (section->GetObjectFile() != this)
|
||||
return section->GetObjectFile()->MemoryMapSectionData(section,
|
||||
section_data);
|
||||
|
||||
if (IsInMemory()) {
|
||||
return ReadSectionData(section, section_data);
|
||||
} else {
|
||||
if (!section->IsRelocated())
|
||||
RelocateSection(section);
|
||||
|
||||
// The object file now contains a full mmap'ed copy of the object file data,
|
||||
// so just use this
|
||||
return GetData(section->GetFileOffset(), section->GetFileSize(),
|
||||
section_data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user