Loading...
cache-builder/FileUtils.cpp dyld-1122.1.2 dyld-1245.1
--- dyld/dyld-1122.1.2/cache-builder/FileUtils.cpp
+++ dyld/dyld-1245.1/cache-builder/FileUtils.cpp
@@ -37,8 +37,6 @@
 #include <sys/mman.h>
 #include <dispatch/dispatch.h>
 #include <mach-o/dyld.h>
-#include <System/sys/csr.h>
-#include <rootless.h>
 
 #include <string>
 #include <fstream>
@@ -89,6 +87,17 @@
                 break;
             case DT_LNK:
                 // don't follow symlinks, dylib will be found through absolute path
+#if BUILDING_SIM_CACHE_BUILDER
+                // But special case simulator WebKit and related frameworks that are installed into Cryptex path with symlinks
+                if ( recurse && dirAndFile.starts_with("/System/Library/") && dirAndFile.ends_with(".framework") ) {
+                    char symlinkContent[2048];
+                    if ( readlink(fullDirAndFile.c_str(), symlinkContent, sizeof(symlinkContent)) > 0 ) {
+                        if ( strncmp(symlinkContent, "../../../System/Cryptexes/OS/System/Library/", 44) == 0 )  {
+                            iterateDirectoryTree(pathPrefix, dirAndFile, dirFilter, fileCallback, processFiles, true);
+                       }
+                    }
+                }
+#endif
                 break;
         }
     }