summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Rowe <mark@vector35.com>2025-12-02 13:16:47 -0800
committerMark Rowe <mark@vector35.com>2025-12-08 14:03:38 -0800
commit31c0faa9753601eb7d41965ce5d7f96dcef9b71c (patch)
tree8033a7e5178e6a3724e0a8c8adc837ba090c92cb
parent52040a4a15fe84461d1e8c1c592c19be840b48ad (diff)
[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.
-rw-r--r--view/sharedcache/core/MachOProcessor.cpp3
1 files changed, 3 insertions, 0 deletions
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.