From 31c0faa9753601eb7d41965ce5d7f96dcef9b71c Mon Sep 17 00:00:00 2001 From: Mark Rowe Date: Tue, 2 Dec 2025 13:16:47 -0800 Subject: [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. --- view/sharedcache/core/MachOProcessor.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'view/sharedcache/core/MachOProcessor.cpp') diff --git a/view/sharedcache/core/MachOProcessor.cpp b/view/sharedcache/core/MachOProcessor.cpp index 31fdbe6c..3d922268 100644 --- a/view/sharedcache/core/MachOProcessor.cpp +++ b/view/sharedcache/core/MachOProcessor.cpp @@ -31,12 +31,15 @@ void SharedCacheMachOProcessor::ApplyHeader(const SharedCache& cache, SharedCach }; // Add a section for the header itself. + m_view->BeginBulkAddSegments(); std::string headerSection = fmt::format("{}::__macho_header", header.identifierPrefix); uint64_t machHeaderSize = m_vm->GetAddressSize() == 8 ? sizeof(mach_header_64) : sizeof(mach_header); uint64_t headerSectionSize = machHeaderSize + header.ident.sizeofcmds; m_view->AddUserSection(headerSection, header.textBase, headerSectionSize, ReadOnlyDataSectionSemantics); ApplyHeaderSections(header); + m_view->EndBulkAddSegments(); + ApplyHeaderDataVariables(header); // Pull the available type library for the image we are loading, so we can apply known types. -- cgit v1.3.1