]> git.saurik.com Git - apple/dyld.git/blobdiff - dyld3/Closure.h
dyld-851.27.tar.gz
[apple/dyld.git] / dyld3 / Closure.h
index ab1a15fdbfb5c72deb38e4279c5903b46dc5f302..628208bdb60c53ca537fed592429cdd47e2201a7 100644 (file)
@@ -110,7 +110,6 @@ struct VIS_HIDDEN TypedBytes
         topImage                = 36,  // sizeof(ImageNum)
         libDyldEntry            = 37,  // sizeof(ResolvedSymbolTarget)
         libSystemNum            = 38,  // sizeof(ImageNum)
-        bootUUID                = 39,  // c-string 40
         mainEntry               = 40,  // sizeof(ResolvedSymbolTarget)
         startEntry              = 41,  // sizeof(ResolvedSymbolTarget)     // used by programs built with crt1.o
         cacheOverrides          = 42,  // sizeof(PatchEntry) * count       // used if process uses interposing or roots (cached dylib overrides)
@@ -119,8 +118,9 @@ struct VIS_HIDDEN TypedBytes
         selectorTable           = 45,  // uint32_t + (sizeof(ObjCSelectorImage) * count) + hashTable size
         classTable              = 46,  // (3 * uint32_t) + (sizeof(ObjCClassImage) * count) + classHashTable size + protocolHashTable size
         warning                 = 47,  // len = uint32_t + length path + 1, use one entry per warning
-        duplicateClassesTable   = 48, // duplicateClassesHashTable
-   };
+        duplicateClassesTable   = 48,  // duplicateClassesHashTable
+        progVars                = 49,  // sizeof(uint32_t)
+    };
 
     Type         type          : 8;
     uint32_t     payloadLength : 24;
@@ -165,6 +165,8 @@ struct VIS_HIDDEN Image : ContainerTypedBytes
     bool                hasObjC() const;
     bool                hasInitializers() const;
     bool                hasPrecomputedObjC() const;
+    bool                fixupsNotEncoded() const;   // minimal closure, dyld must parse and apply fixups
+    bool                rebasesNotEncoded() const;
     bool                hasTerminators() const;
     bool                hasReadOnlyData() const;
     bool                hasChainedFixups() const;
@@ -176,7 +178,6 @@ struct VIS_HIDDEN Image : ContainerTypedBytes
     bool                is64() const;
     bool                neverUnload() const;
     bool                cwdMustBeThisDir() const;
-    bool                isPlatformBinary() const;
     bool                overridableDylib() const;
     bool                hasFileModTimeAndInode(uint64_t& inode, uint64_t& mTime) const;
     void                forEachCDHash(void (^handler)(const uint8_t cdHash[20], bool& stop)) const;
@@ -192,6 +193,7 @@ struct VIS_HIDDEN Image : ContainerTypedBytes
     bool                hasPathWithHash(const char* path, uint32_t hash) const;
     bool                isOverrideOfDyldCacheImage(ImageNum& cacheImageNum) const;
     uint64_t            textSize() const;
+    const char*         variantString() const; // "minimal" or "full" closure
 
        union ResolvedSymbolTarget
     {
@@ -227,7 +229,7 @@ struct VIS_HIDDEN Image : ContainerTypedBytes
             return (raw != rhs.raw);
         }
      };
-     static_assert(sizeof(ResolvedSymbolTarget) == 8);
+     static_assert(sizeof(ResolvedSymbolTarget) == 8, "Invalid size");
 
 
     // ObjC optimisations
@@ -359,6 +361,8 @@ struct VIS_HIDDEN Image : ContainerTypedBytes
     void                forEachTextReloc(void (^rebase)(uint32_t imageOffsetToRebase, bool& stop),
                                          void (^bind)(uint32_t imageOffsetToBind, ResolvedSymbolTarget bindTarget, bool& stop)) const;
 
+    bool                forEachBind(void (^bind)(uint64_t imageOffsetToBind, ResolvedSymbolTarget bindTarget, bool& stop)) const;
+
        static_assert(sizeof(ResolvedSymbolTarget) == 8, "Overflow in size of SymbolTargetLocation");
 
     static uint32_t     hashFunction(const char*);
@@ -369,7 +373,9 @@ private:
     friend class ClosureBuilder;
     friend class ClosureWriter;
     friend class LaunchClosureWriter;
-
+    friend class RebasePatternBuilder;
+    friend class BindPatternBuilder;
+    
     uint32_t             pageSize() const;
 
     struct Flags
@@ -395,7 +401,10 @@ private:
                         hasReadOnlyData              : 1,
                         hasChainedFixups             : 1,
                         hasPrecomputedObjC           : 1,
-                        padding                      : 17;
+                        fixupsNotEncoded             : 1,
+                        rebasesNotEncoded            : 1,
+                        hasOverrideImageNum          : 1,
+                        padding                      : 14;
     };
 
     static_assert(sizeof(Flags) == sizeof(uint64_t), "Flags overflow");
@@ -656,7 +665,8 @@ struct VIS_HIDDEN Closure : public ContainerTypedBytes
 {
     size_t              size() const;
     const ImageArray*   images() const;
-    ImageNum            topImage() const;
+    ImageNum            topImageNum() const;
+    const Image*        topImage() const;
     void                deallocate() const;
 
     friend class ClosureWriter;
@@ -697,7 +707,6 @@ struct VIS_HIDDEN LaunchClosure : public Closure
     };
 
     bool                builtAgainstDyldCache(uuid_t cacheUUID) const;
-    const char*         bootUUID() const;
     void                forEachMustBeMissingFile(void (^handler)(const char* path, bool& stop)) const;
     void                forEachSkipIfExistsFile(void (^handler)(const SkippedFile& file, bool& stop)) const;
     void                forEachEnvVar(void (^handler)(const char* keyEqualValue, bool& stop)) const;
@@ -718,9 +727,10 @@ struct VIS_HIDDEN LaunchClosure : public Closure
     void                duplicateClassesHashTable(const ObjCClassDuplicatesOpt*& duplicateClassesHashTable) const;
     bool                hasInsertedLibraries() const;
     bool                hasInterposings() const;
+    bool                hasProgramVars(uint32_t& runtimeOffset) const;
     
-    static bool         buildClosureCachePath(const char* mainExecutablePath, char closurePath[], const char* tempDir,
-                                              bool makeDirsIfMissing);
+    static bool         buildClosureCachePath(const char* mainExecutablePath, const char* envp[],
+                                              bool makeDirsIfMissing, char closurePath[]);
 
 private:
     friend class LaunchClosureWriter;
@@ -731,8 +741,9 @@ private:
                         usedFallbackPaths        :  1,
                         initImageCount           : 16,
                         hasInsertedLibraries     :  1,
+                        hasProgVars              :  1,
                         usedInterposing          :  1,
-                        padding                  : 12;
+                        padding                  : 11;
     };
     const Flags&        getFlags() const;
 };