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,
- 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,
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 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;
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,
- 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);
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,
- 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);
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);
- 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;
};