Loading...
cache-builder/kernel_collection_builder.cpp dyld-1245.1 dyld-941.5
--- dyld/dyld-1245.1/cache-builder/kernel_collection_builder.cpp
+++ dyld/dyld-941.5/cache-builder/kernel_collection_builder.cpp
@@ -29,7 +29,6 @@
 #include "ClosureFileSystemNull.h"
 #include "MachOAppCache.h"
 
-#include <dispatch/dispatch.h>
 #include <span>
 #include <string>
 #include <vector>
@@ -500,43 +499,6 @@
             return false;
     }
 
-    // Make sure we have an xnu binary, from this collection or an existing one
-    __block const dyld3::MachOAnalyzer* kernelMA = nullptr;
-    if ( builder->options.collectionKind == baseKC ) {
-        for (const AppCacheBuilder::InputDylib& input : builder->inputFiles) {
-            const dyld3::MachOAnalyzer* ma = (const dyld3::MachOAnalyzer*)input.dylib.loadedFileInfo.fileContent;
-
-            // Skip codeless kexts
-            if ( ma == nullptr )
-                continue;
-
-            if ( ma->isStaticExecutable() ) {
-                kernelMA = ma;
-            }
-        }
-        if ( !kernelMA ) {
-            builder->error("Cannot build bootKC without xnu binary");
-            return false;
-        }
-    } else {
-        // auxKC/pageableKC
-        Diagnostics diag;
-
-        const dyld3::MachOAppCache* kernelCacheMA = (const dyld3::MachOAppCache*)builder->kernelCollectionFileInfo.fileContent;
-        kernelCacheMA->forEachDylib(diag, ^(const dyld3::MachOAnalyzer *ma, const char *name, bool &stop) {
-            if ( ma->isStaticExecutable() ) {
-                kernelMA = ma;
-                stop = true;
-            }
-        });
-
-        if ( !kernelMA ) {
-            builder->error("Cannot build pageableKC/auxKC without xnu binary from bootKC");
-            return false;
-        }
-    }
-
-
     dispatch_apply(builder->inputFiles.size(), DISPATCH_APPLY_AUTO, ^(size_t index) {
         const AppCacheBuilder::InputDylib& input = builder->inputFiles[index];
         auto errorHandler = ^(const char* msg) {
@@ -548,9 +510,7 @@
             return;
         if (!ma->canBePlacedInKernelCollection(input.dylib.loadedFileInfo.path, errorHandler)) {
             assert(input.errors->hasError());
-            return;
-        }
-
+        }
     });
     for (const AppCacheBuilder::InputDylib& input : builder->inputFiles) {
         if ( input.errors->hasError() ) {
@@ -567,7 +527,7 @@
     builderOptions.archs = &dyld3::GradedArchs::forName(builder->arch);
     builderOptions.platform = dyld3::Platform::unknown;
     builderOptions.localSymbolMode = DyldSharedCache::LocalSymbolsMode::keep;
-    builderOptions.cacheConfiguration = kDyldSharedCacheTypeProduction;
+    builderOptions.optimizeStubs = true;
     builderOptions.optimizeDyldDlopens = false;
     builderOptions.optimizeDyldLaunches = false;
     builderOptions.codeSigningDigestMode = DyldSharedCache::CodeSigningDigestMode::SHA256only;