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)
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;
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;
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;
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
{
unused : 62; // all zeros
};
struct SharedCache {
- uint64_t kind : 2, // kindSharedCache
- offset : 62;
+ uint64_t kind : 2; // kindSharedCache
+ int64_t offset : 62;
};
struct Image {
uint64_t kind : 2, // kindImage
- imageNum : 22, // ImageNum
- offset : 40;
+ imageNum : 22; // ImageNum
+ int64_t offset : 40;
};
struct Absolute {
uint64_t kind : 2, // kindAbsolute
return (raw != rhs.raw);
}
};
+ static_assert(sizeof(ResolvedSymbolTarget) == 8, "Invalid size");
// ObjC optimisations
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*);
friend class ClosureBuilder;
friend class ClosureWriter;
friend class LaunchClosureWriter;
-
+ friend class RebasePatternBuilder;
+ friend class BindPatternBuilder;
+
uint32_t pageSize() const;
struct Flags
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");
{
size_t size() const;
const ImageArray* images() const;
- ImageNum topImage() const;
+ ImageNum topImageNum() const;
+ const Image* topImage() const;
void deallocate() const;
friend class ClosureWriter;
};
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;
void forEachInterposingTuple(void (^handler)(const InterposingTuple& tuple, bool& stop)) const;
bool usedAtPaths() const;
bool usedFallbackPaths() const;
+ bool usedInterposing() const;
bool selectorHashTable(Array<Image::ObjCSelectorImage>& imageNums,
const ObjCSelectorOpt*& hashTable) const;
bool classAndProtocolHashTables(Array<Image::ObjCClassImage>& imageNums,
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;
usedFallbackPaths : 1,
initImageCount : 16,
hasInsertedLibraries : 1,
- padding : 13;
+ hasProgVars : 1,
+ usedInterposing : 1,
+ padding : 11;
};
const Flags& getFlags() const;
};