Skip to content

Commit 2c759a5

Browse files
committed
[DSC] Place synthetic sections after the cache's address range
This ensures they do not overlap with any images that may later be loaded from the shared cache.
1 parent b33cd4b commit 2c759a5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

view/sharedcache/core/SharedCacheView.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,14 @@ Ref<Settings> SharedCacheViewType::GetLoadSettingsForData(BinaryView* data)
109109
"description" : "Add function starts sourced from the Function Starts tables to the core for analysis."
110110
})");
111111

112+
// Place the synthetic sections well after the shared cache to ensure they do
113+
// not collide with any images that are later loaded from the shared cache.
114+
// We do not have easy access to the size of the shared cache's mapping here
115+
// so we use a large fixed offset.
116+
// TODO: This will have to be updated if we add support for 32-bit shared caches.
117+
const uint64_t syntheticSectionsOffset = 12ull * 1024 * 1024 * 1024;
118+
settings->UpdateProperty("loader.syntheticSectionBase", "default", viewRef->GetStart() + syntheticSectionsOffset);
119+
112120
// Merge existing load settings if they exist. This allows for the selection of a specific object file from a Mach-O
113121
// Universal file. The 'Universal' BinaryViewType generates a schema with 'loader.universal.architectures'. This
114122
// schema contains an appropriate 'Mach-O' load schema for selecting a specific object file. The embedded schema

0 commit comments

Comments
 (0)