Skip to content

Commit 31c0faa

Browse files
committed
[DSC] Wrap section creation within BeginBulkAddSegments / EndBulkAddSegments
This defers rebuilding of the section map until after all sections for an image have been added, rather than having the section map be rebuilt after adding each section.
1 parent 52040a4 commit 31c0faa

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

view/sharedcache/core/MachOProcessor.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,15 @@ void SharedCacheMachOProcessor::ApplyHeader(const SharedCache& cache, SharedCach
3131
};
3232

3333
// Add a section for the header itself.
34+
m_view->BeginBulkAddSegments();
3435
std::string headerSection = fmt::format("{}::__macho_header", header.identifierPrefix);
3536
uint64_t machHeaderSize = m_vm->GetAddressSize() == 8 ? sizeof(mach_header_64) : sizeof(mach_header);
3637
uint64_t headerSectionSize = machHeaderSize + header.ident.sizeofcmds;
3738
m_view->AddUserSection(headerSection, header.textBase, headerSectionSize, ReadOnlyDataSectionSemantics);
3839

3940
ApplyHeaderSections(header);
41+
m_view->EndBulkAddSegments();
42+
4043
ApplyHeaderDataVariables(header);
4144

4245
// Pull the available type library for the image we are loading, so we can apply known types.

0 commit comments

Comments
 (0)