X-Git-Url: https://git.saurik.com/apple/ld64.git/blobdiff_plain/9543cb2f21e50a417dc8cf37eb7173f353536979..599556ff3dd31aab68bb9685f1ed7fc4867803e7:/src/ld/Options.h diff --git a/src/ld/Options.h b/src/ld/Options.h index 0195815..8395fc9 100644 --- a/src/ld/Options.h +++ b/src/ld/Options.h @@ -140,6 +140,11 @@ public: uint8_t alignment; }; + struct SectionOrderList { + const char* segmentName; + std::vector sectionOrder; + }; + struct OrderedSymbol { const char* symbolName; const char* objectFileName; @@ -179,6 +184,10 @@ public: const char* toSection; }; + struct SegmentRename { + const char* fromSegment; + const char* toSegment; + }; enum { depLinkerVersion=0x00, depObjectFile=0x10, depDirectDylib=0x10, depIndirectDylib=0x10, depUpwardDirectDylib=0x10, depUpwardIndirectDylib=0x10, depArchive=0x10, @@ -248,6 +257,7 @@ public: bool hasNonExecutableHeap() const { return fNonExecutableHeap; } UndefinesIterator initialUndefinesBegin() const { return &fInitialUndefines[0]; } UndefinesIterator initialUndefinesEnd() const { return &fInitialUndefines[fInitialUndefines.size()]; } + const std::vector& initialUndefines() const { return fInitialUndefines; } bool printWhyLive(const char* name) const; uint32_t minimumHeaderPad() const { return fMinimumHeaderPad; } bool maxMminimumHeaderPad() const { return fMaxMinimumHeaderPad; } @@ -300,7 +310,10 @@ public: bool makeEncryptable() const { return fEncryptable; } bool needsUnwindInfoSection() const { return fAddCompactUnwindEncoding; } const std::vector& llvmOptions() const{ return fLLVMOptions; } + const std::vector& segmentOrder() const{ return fSegmentOrder; } + const std::vector* sectionOrder(const char* segName) const; const std::vector& dyldEnvironExtras() const{ return fDyldEnvironExtras; } + const std::vector& astFilePaths() const{ return fASTFilePaths; } bool makeCompressedDyldInfo() const { return fMakeCompressedDyldInfo; } bool hasExportedSymbolOrder(); bool exportedSymbolOrder(const char* sym, unsigned int* order) const; @@ -347,6 +360,10 @@ public: bool ignoreOptimizationHints() const { return fIgnoreOptimizationHints; } bool generateDtraceDOF() const { return fGenerateDtraceDOF; } bool allowBranchIslands() const { return fAllowBranchIslands; } + bool traceSymbolLayout() const { return fTraceSymbolLayout; } + bool markAppExtensionSafe() const { return fMarkAppExtensionSafe; } + bool checkDylibsAreAppExtensionSafe() const { return fCheckAppExtensionSafe; } + bool forceLoadSwiftLibs() const { return fForceLoadSwiftLibs; } bool hasWeakBitTweaks() const; bool forceWeak(const char* symbolName) const; bool forceNotWeak(const char* symbolName) const; @@ -374,6 +391,9 @@ public: FileInfo findFramework(const char* frameworkName) const; FileInfo findLibrary(const char* rootName, bool dylibsOnly=false) const; const std::vector& sectionRenames() const { return fSectionRenames; } + const std::vector& segmentRenames() const { return fSegmentRenames; } + bool moveRoSymbol(const char* symName, const char* filePath, const char*& seg, bool& wildCardMatch) const; + bool moveRwSymbol(const char* symName, const char* filePath, const char*& seg, bool& wildCardMatch) const; private: typedef std::unordered_map NameToOrder; @@ -385,7 +405,8 @@ private: class SetWithWildcards { public: void insert(const char*); - bool contains(const char*) const; + bool contains(const char*, bool* wildCardMatch=NULL) const; + bool containsWithPrefix(const char* symbol, const char* file, bool& wildCardMatch) const; bool containsNonWildcard(const char*) const; bool empty() const { return fRegular.empty() && fWildCard.empty(); } bool hasWildCards() const { return !fWildCard.empty(); } @@ -401,6 +422,10 @@ private: std::vector fWildCard; }; + struct SymbolsMove { + const char* toSegment; + SetWithWildcards symbols; + }; void parse(int argc, const char* argv[]); void checkIllegalOptionCombinations(); @@ -437,7 +462,8 @@ private: uint32_t parseProtection(const char* prot); void loadSymbolOrderFile(const char* fileOfExports, NameToOrder& orderMapping); void addSectionRename(const char* srcSegment, const char* srcSection, const char* dstSegment, const char* dstSection); - + void addSegmentRename(const char* srcSegment, const char* dstSegment); + void addSymbolMove(const char* dstSegment, const char* symbolList, std::vector& list, const char* optionName); // ObjectFile::ReaderOptions fReaderOptions; @@ -608,6 +634,10 @@ private: bool fIgnoreOptimizationHints; bool fGenerateDtraceDOF; bool fAllowBranchIslands; + bool fTraceSymbolLayout; + bool fMarkAppExtensionSafe; + bool fCheckAppExtensionSafe; + bool fForceLoadSwiftLibs; DebugInfoStripping fDebugInfoStripping; const char* fTraceOutputFile; ld::MacVersionMin fMacVersionMin; @@ -628,8 +658,15 @@ private: std::vector fFrameworkSearchPaths; std::vector fSDKPaths; std::vector fDyldEnvironExtras; + std::vector fSegmentOrder; + std::vector fASTFilePaths; + std::vector fSectionOrder; std::vector< std::vector > fLinkerOptions; std::vector fSectionRenames; + std::vector fSegmentRenames; + std::vector fSymbolsMovesData; + std::vector fSymbolsMovesCode; + std::vector fSymbolsMovesZeroFill; bool fSaveTempFiles; mutable Snapshot fLinkSnapshot; bool fSnapshotRequested;