Loading...
--- dyld/dyld-1231.3/cache_builder/NewSharedCacheBuilder.cpp
+++ dyld/dyld-1245.1/cache_builder/NewSharedCacheBuilder.cpp
@@ -310,11 +310,14 @@
if ( !builder )
return Error("swift_externalMetadataBuilder_create failed");
- for ( const CacheDylib* dylib : this->objcOptimizer.objcDylibs ) {
- if ( dylib->inputMF == nullptr ) continue;
-
- if ( const char* err = swift_externalMetadataBuilder_addDylib(builder, dylib->inputMF->installName(),
- (const struct mach_header*)dylib->inputMF, dylib->inputFile->size) )
+ for ( const CacheDylib& dylib : this->cacheDylibs ) {
+ if ( dylib.inputMF == nullptr ) continue;
+
+ // TODO: rdar://132262275 (dyld shared cache builder should tell Swift Metadata builder also about dyld)
+ if ( dylib.inputMF->isDyld() ) continue;
+
+ if ( const char* err = swift_externalMetadataBuilder_addDylib(builder, dylib.inputMF->installName(),
+ (const struct mach_header*)dylib.inputMF, dylib.inputFile->size) )
return Error("swift_externalMetadataBuilder_addDylib failed: %s", err);
}
@@ -3049,6 +3052,43 @@
break;
}
case cache_builder::Region::Kind::readOnly:
+ case cache_builder::Region::Kind::linkedit:
+ case cache_builder::Region::Kind::unmapped:
+ case cache_builder::Region::Kind::dynamicConfig:
+ case cache_builder::Region::Kind::codeSignature:
+ case cache_builder::Region::Kind::numKinds:
+ break;
+ }
+ }
+ }
+
+ // Also split the current file so that read-only are in their own files
+ {
+ // Create a new subCache
+ newSubCaches.push_back(SubCache::makeSubCache(options));
+ SubCache& newSubCache = newSubCaches.back();
+
+ // Move all data to the new subCache
+ for ( Region& oldRegion : subCache.regions ) {
+ if ( oldRegion.chunks.empty() )
+ continue;
+
+ // Move all the data regions, leave the rest
+ switch ( oldRegion.kind ) {
+ case cache_builder::Region::Kind::text:
+ case cache_builder::Region::Kind::dataConst:
+ case cache_builder::Region::Kind::tproConst:
+ case cache_builder::Region::Kind::data:
+ case cache_builder::Region::Kind::auth:
+ case cache_builder::Region::Kind::authConst:
+ case cache_builder::Region::Kind::tproAuthConst:
+ // Nothing to do here
+ break;
+ case cache_builder::Region::Kind::readOnly:{
+ Region& newRegion = newSubCache.regions[(uint32_t)oldRegion.kind];
+ newRegion.chunks = std::move(oldRegion.chunks);
+ break;
+ }
case cache_builder::Region::Kind::linkedit:
case cache_builder::Region::Kind::unmapped:
case cache_builder::Region::Kind::dynamicConfig:
@@ -7827,11 +7867,6 @@
// We must be a largeContiguous cache. Others were dealt with above in the x86_64 and/or sim cases
assert(this->config.layout.contiguous.has_value());
- // Some caches have a fixed max slide
- if ( this->config.layout.cacheFixedSlide.has_value() ) {
- return this->config.layout.cacheFixedSlide.value();
- }
-
// Start off making sure we can't slide past the end of the cache
CacheVMAddress maxVMAddress(0ULL);
for ( const Region& region : this->subCaches.back().regions ) {