]> git.saurik.com Git - apple/dyld.git/blobdiff - src/ImageLoaderMachOCompressed.h
dyld-360.22.tar.gz
[apple/dyld.git] / src / ImageLoaderMachOCompressed.h
index 99c55294d0be209d058374f6070aa12e88b11ce1..e655adcf84f3eea86f088f04cfe87fcc2a6bdaf0 100644 (file)
@@ -39,10 +39,12 @@ class ImageLoaderMachOCompressed : public ImageLoaderMachO {
 public:
        static ImageLoaderMachOCompressed*      instantiateMainExecutable(const macho_header* mh, uintptr_t slide, const char* path, 
                                                                                                                                        unsigned int segCount, unsigned int libCount, const LinkContext& context);
 public:
        static ImageLoaderMachOCompressed*      instantiateMainExecutable(const macho_header* mh, uintptr_t slide, const char* path, 
                                                                                                                                        unsigned int segCount, unsigned int libCount, const LinkContext& context);
-       static ImageLoaderMachOCompressed*      instantiateFromFile(const char* path, int fd, const uint8_t* fileData, 
+       static ImageLoaderMachOCompressed*      instantiateFromFile(const char* path, int fd, const uint8_t *fileData, size_t lenFileData,
                                                                                                                        uint64_t offsetInFat, uint64_t lenInFat, const struct stat& info, 
                                                                                                                        unsigned int segCount, unsigned int libCount, 
                                                                                                                        uint64_t offsetInFat, uint64_t lenInFat, const struct stat& info, 
                                                                                                                        unsigned int segCount, unsigned int libCount, 
-                                                                                                                       const struct linkedit_data_command* codeSigCmd, const LinkContext& context);
+                                                                                                                       const struct linkedit_data_command* codeSigCmd, 
+                                                                                                                       const struct encryption_info_command* encryptCmd,
+                                                                                                                       const LinkContext& context);
        static ImageLoaderMachOCompressed*      instantiateFromCache(const macho_header* mh, const char* path, long slide, const struct stat& info,
                                                                                                                                unsigned int segCount, unsigned int libCount, const LinkContext& context);
        static ImageLoaderMachOCompressed*      instantiateFromMemory(const char* moduleName, const macho_header* mh, uint64_t len, 
        static ImageLoaderMachOCompressed*      instantiateFromCache(const macho_header* mh, const char* path, long slide, const struct stat& info,
                                                                                                                                unsigned int segCount, unsigned int libCount, const LinkContext& context);
        static ImageLoaderMachOCompressed*      instantiateFromMemory(const char* moduleName, const macho_header* mh, uint64_t len, 
@@ -68,6 +70,7 @@ public:
        
 protected:
        virtual void                                            doInterpose(const LinkContext& context);
        
 protected:
        virtual void                                            doInterpose(const LinkContext& context);
+       virtual void                                            dynamicInterpose(const LinkContext& context);
        virtual void                                            setDyldInfo(const dyld_info_command* dyldInfo) { fDyldInfo = dyldInfo; }
        virtual void                                            setSymbolTableInfo(const macho_nlist*, const char*, const dysymtab_command*) {}
        virtual bool                                            isSubframeworkOf(const LinkContext& context, const ImageLoader* image) const { return false; }
        virtual void                                            setDyldInfo(const dyld_info_command* dyldInfo) { fDyldInfo = dyldInfo; }
        virtual void                                            setSymbolTableInfo(const macho_nlist*, const char*, const dysymtab_command*) {}
        virtual bool                                            isSubframeworkOf(const LinkContext& context, const ImageLoader* image) const { return false; }
@@ -76,7 +79,7 @@ protected:
        virtual void                                            rebase(const LinkContext& context);
        virtual const ImageLoader::Symbol*      findExportedSymbol(const char* name, const ImageLoader** foundIn) const;
        virtual bool                                            containsSymbol(const void* addr) const;
        virtual void                                            rebase(const LinkContext& context);
        virtual const ImageLoader::Symbol*      findExportedSymbol(const char* name, const ImageLoader** foundIn) const;
        virtual bool                                            containsSymbol(const void* addr) const;
-       virtual uintptr_t                                       exportedSymbolAddress(const LinkContext& context, const Symbol* symbol, bool runResolver) const;
+       virtual uintptr_t                                       exportedSymbolAddress(const LinkContext& context, const Symbol* symbol, const ImageLoader* requestor, bool runResolver) const;
        virtual bool                                            exportedSymbolIsWeakDefintion(const Symbol* symbol) const;
        virtual const char*                                     exportedSymbolName(const Symbol* symbol) const;
        virtual unsigned int                            exportedSymbolCount() const;
        virtual bool                                            exportedSymbolIsWeakDefintion(const Symbol* symbol) const;
        virtual const char*                                     exportedSymbolName(const Symbol* symbol) const;
        virtual unsigned int                            exportedSymbolCount() const;
@@ -90,11 +93,11 @@ protected:
 
                
 private:
 
                
 private:
-       struct LastLookup { int ordinal; uint8_t flags; const char* name; uintptr_t result; const ImageLoader* foundIn; };
+       struct LastLookup { long ordinal; uint8_t flags; const char* name; uintptr_t result; const ImageLoader* foundIn; };
 
 
        typedef uintptr_t (ImageLoaderMachOCompressed::*bind_handler)(const LinkContext& context, uintptr_t addr, uint8_t type, 
 
 
        typedef uintptr_t (ImageLoaderMachOCompressed::*bind_handler)(const LinkContext& context, uintptr_t addr, uint8_t type, 
-                                                                                       const char* symbolName, uint8_t symboFlags, intptr_t addend, int libraryOrdinal, 
+                                                                                       const char* symbolName, uint8_t symboFlags, intptr_t addend, long libraryOrdinal, 
                                                                                        const char* msg, LastLookup* last, bool runResolver);
 
        void                                                            eachLazyBind(const LinkContext& context, bind_handler);
                                                                                        const char* msg, LastLookup* last, bool runResolver);
 
        void                                                            eachLazyBind(const LinkContext& context, bind_handler);
@@ -113,13 +116,13 @@ private:
        void                                                            throwBadRebaseAddress(uintptr_t address, uintptr_t segmentEndAddress, int segmentIndex, 
                                                                                                const uint8_t* startOpcodes, const uint8_t* endOpcodes, const uint8_t* pos);
        uintptr_t                                                       bindAt(const LinkContext& context, uintptr_t addr, uint8_t type, const char* symbolName, 
        void                                                            throwBadRebaseAddress(uintptr_t address, uintptr_t segmentEndAddress, int segmentIndex, 
                                                                                                const uint8_t* startOpcodes, const uint8_t* endOpcodes, const uint8_t* pos);
        uintptr_t                                                       bindAt(const LinkContext& context, uintptr_t addr, uint8_t type, const char* symbolName, 
-                                                                                               uint8_t symboFlags, intptr_t addend, int libraryOrdinal, const char* msg,
+                                                                                               uint8_t symboFlags, intptr_t addend, long libraryOrdinal, const char* msg,
                                                                                                LastLookup* last, bool runResolver=false);
        void                                                            bindCompressed(const LinkContext& context);
        void                                                            throwBadBindingAddress(uintptr_t address, uintptr_t segmentEndAddress, int segmentIndex, 
                                                                                                const uint8_t* startOpcodes, const uint8_t* endOpcodes, const uint8_t* pos);
        uintptr_t                                                       resolve(const LinkContext& context, const char* symbolName, 
                                                                                                LastLookup* last, bool runResolver=false);
        void                                                            bindCompressed(const LinkContext& context);
        void                                                            throwBadBindingAddress(uintptr_t address, uintptr_t segmentEndAddress, int segmentIndex, 
                                                                                                const uint8_t* startOpcodes, const uint8_t* endOpcodes, const uint8_t* pos);
        uintptr_t                                                       resolve(const LinkContext& context, const char* symbolName, 
-                                                                                               uint8_t symboFlags, int libraryOrdinal, const ImageLoader** targetImage, 
+                                                                                               uint8_t symboFlags, long libraryOrdinal, const ImageLoader** targetImage, 
                                                                                                LastLookup* last = NULL, bool runResolver=false);
        uintptr_t                                                       resolveFlat(const LinkContext& context, const char* symbolName, bool weak_import, bool runResolver,
                                                                                                        const ImageLoader** foundIn);
                                                                                                LastLookup* last = NULL, bool runResolver=false);
        uintptr_t                                                       resolveFlat(const LinkContext& context, const char* symbolName, bool weak_import, bool runResolver,
                                                                                                        const ImageLoader** foundIn);
@@ -127,11 +130,14 @@ private:
        uintptr_t                                                       resolveTwolevel(const LinkContext& context, const ImageLoader* targetImage, bool weak_import, 
                                                                                                                const char* symbolName, bool runResolver, const ImageLoader** foundIn);
        uintptr_t                                                       interposeAt(const LinkContext& context, uintptr_t addr, uint8_t type, const char*, 
        uintptr_t                                                       resolveTwolevel(const LinkContext& context, const ImageLoader* targetImage, bool weak_import, 
                                                                                                                const char* symbolName, bool runResolver, const ImageLoader** foundIn);
        uintptr_t                                                       interposeAt(const LinkContext& context, uintptr_t addr, uint8_t type, const char*, 
-                                                                                               uint8_t, intptr_t, int, const char*, LastLookup*, bool runResolver);
+                                                                                               uint8_t, intptr_t, long, const char*, LastLookup*, bool runResolver);
+       uintptr_t                                                       dynamicInterposeAt(const LinkContext& context, uintptr_t addr, uint8_t type, const char*, 
+                                                                                               uint8_t, intptr_t, long, const char*, LastLookup*, bool runResolver);
        static const uint8_t*                           trieWalk(const uint8_t* start, const uint8_t* end, const  char* s);
     void                                updateOptimizedLazyPointers(const LinkContext& context);
        static const uint8_t*                           trieWalk(const uint8_t* start, const uint8_t* end, const  char* s);
     void                                updateOptimizedLazyPointers(const LinkContext& context);
-    void                                updateAlternateLazyPointer(uint8_t* stub, void** originalLazyPointerAddr);
-               
+    void                                updateAlternateLazyPointer(uint8_t* stub, void** originalLazyPointerAddr, const LinkContext& context);
+       void                                                            registerEncryption(const struct encryption_info_command* encryptCmd, const LinkContext& context);
+       
        const struct dyld_info_command*                 fDyldInfo;
 };
 
        const struct dyld_info_command*                 fDyldInfo;
 };