]> git.saurik.com Git - apple/ld64.git/blobdiff - src/ld/Options.h
ld64-305.tar.gz
[apple/ld64.git] / src / ld / Options.h
index 4289e68239dcb5837ac00df5411c2df9b421d1a7..4ff780ca35073dd75d7160ed568206e2039f405f 100644 (file)
 #include <mach/machine.h>
 
 #include <vector>
-#include <ext/hash_set>
-#include <ext/hash_map>
+#include <unordered_set>
+#include <unordered_map>
 
 #include "ld.hpp"
 #include "Snapshot.h"
+#include "MachOFileAbstraction.hpp"
 
 extern void throwf (const char* format, ...) __attribute__ ((noreturn,format(printf, 1, 2)));
 extern void warning(const char* format, ...) __attribute__((format(printf, 1, 2)));
@@ -45,13 +46,15 @@ class LibraryOptions
 {
 public:
        LibraryOptions() : fWeakImport(false), fReExport(false), fBundleLoader(false), 
-                                               fLazyLoad(false), fUpward(false), fForceLoad(false) {}
+                                               fLazyLoad(false), fUpward(false), fIndirectDylib(false), 
+                                               fForceLoad(false) {}
        // for dynamic libraries
        bool            fWeakImport;
        bool            fReExport;
        bool            fBundleLoader;
        bool            fLazyLoad;
        bool            fUpward;
+       bool            fIndirectDylib;
        // for static libraries
        bool            fForceLoad;
 };
@@ -83,12 +86,79 @@ public:
        enum CommonsMode { kCommonsIgnoreDylibs, kCommonsOverriddenByDylibs, kCommonsConflictsDylibsError };
        enum UUIDMode { kUUIDNone, kUUIDRandom, kUUIDContent };
        enum LocalSymbolHandling { kLocalSymbolsAll, kLocalSymbolsNone, kLocalSymbolsSelectiveInclude, kLocalSymbolsSelectiveExclude };
+       enum BitcodeMode { kBitcodeProcess, kBitcodeAsData, kBitcodeMarker, kBitcodeStrip };
        enum DebugInfoStripping { kDebugInfoNone, kDebugInfoMinimal, kDebugInfoFull };
+       enum UnalignedPointerTreatment { kUnalignedPointerError, kUnalignedPointerWarning, kUnalignedPointerIgnore };
+#if SUPPORT_APPLE_TV
+       enum Platform { kPlatformUnknown, kPlatformOSX=1, kPlatformiOS=2, kPlatformWatchOS=3, kPlatform_tvOS=4, kPlatform_bridgeOS=5 };
+#else
+       enum Platform { kPlatformUnknown, kPlatformOSX, kPlatformiOS, kPlatformWatchOS };
+#endif
+
+       static Platform platformForLoadCommand(uint32_t lc) {
+               switch (lc) {
+                       case LC_VERSION_MIN_MACOSX:
+                               return kPlatformOSX;
+                       case LC_VERSION_MIN_IPHONEOS:
+                               return kPlatformiOS;
+                       case LC_VERSION_MIN_WATCHOS:
+                               return kPlatformWatchOS;
+               #if SUPPORT_APPLE_TV
+                       case LC_VERSION_MIN_TVOS:
+                               return kPlatform_tvOS;
+               #endif
+               }
+               assert(!lc && "unknown LC_VERSION_MIN load command");
+               return kPlatformUnknown;
+       }
+
+       static const char* platformName(Platform platform) {
+               switch (platform) {
+                       case kPlatformOSX:
+                               return "OSX";
+                       case kPlatformiOS:
+                               return "iOS";
+                       case kPlatformWatchOS:
+                               return "watchOS";
+               #if SUPPORT_APPLE_TV
+                       case kPlatform_tvOS:
+                               return "tvOS";
+               #endif
+                       case kPlatform_bridgeOS:
+                               return "bridgeOS";
+                       case kPlatformUnknown:
+                       default:
+                               return "(unknown)";
+               }
+       }
+
+       static void userReadableSwiftVersion(uint8_t value, char versionString[64])
+       {
+               switch (value) {
+                       case 1:
+                               strcpy(versionString, "1.0");
+                               break;
+                       case 2:
+                               strcpy(versionString, "1.1");
+                               break;
+                       case 3:
+                               strcpy(versionString, "2.0");
+                               break;
+                       case 4:
+                               strcpy(versionString, "3.0");
+                               break;
+                       case 5:
+                               strcpy(versionString, "4.0");
+                               break;
+                       default:
+                               sprintf(versionString, "unknown ABI version 0x%02X", value);
+               }
+       }
+
 
        class FileInfo {
     public:
                const char*                             path;
-               uint64_t                                fileLen;
                time_t                                  modTime;
                LibraryOptions                  options;
                ld::File::Ordinal               ordinal;
@@ -101,13 +171,24 @@ public:
         // The use pattern for FileInfo is to create one on the stack in a leaf function and return
         // it to the calling frame by copy. Therefore the copy constructor steals the path string from
         // the source, which dies with the stack frame.
-        FileInfo(FileInfo const &other) : path(other.path), fileLen(other.fileLen), modTime(other.modTime), options(other.options), ordinal(other.ordinal), fromFileList(other.fromFileList), inputFileSlot(-1) { ((FileInfo&)other).path = NULL; };
+        FileInfo(FileInfo const &other) : path(other.path), modTime(other.modTime), options(other.options), ordinal(other.ordinal), fromFileList(other.fromFileList), inputFileSlot(-1) { ((FileInfo&)other).path = NULL; };
+
+               FileInfo &operator=(FileInfo other) {
+                       std::swap(path, other.path);
+                       std::swap(modTime, other.modTime);
+                       std::swap(options, other.options);
+                       std::swap(ordinal, other.ordinal);
+                       std::swap(fromFileList, other.fromFileList);
+                       std::swap(inputFileSlot, other.inputFileSlot);
+                       std::swap(readyToParse, other.readyToParse);
+                       return *this;
+               }
 
         // Create an empty FileInfo. The path can be set implicitly by checkFileExists().
-        FileInfo() : path(NULL), fileLen(0), modTime(0), options(), fromFileList(false) {};
+        FileInfo() : path(NULL), modTime(-1), options(), fromFileList(false) {};
         
         // Create a FileInfo for a specific path, but does not stat the file.
-        FileInfo(const char *_path) : path(strdup(_path)), fileLen(0), modTime(0), options(), fromFileList(false) {};
+        FileInfo(const char *_path) : path(strdup(_path)), modTime(-1), options(), fromFileList(false) {};
 
         ~FileInfo() { if (path) ::free((void*)path); }
         
@@ -115,12 +196,12 @@ public:
         // If the object already has a path the p must be NULL.
         // If the object does not have a path then p can be any candidate path, and if the file exists the object permanently remembers the path.
         // Returns true if the file exists, false if not.
-        bool checkFileExists(const char *p=NULL);
+        bool checkFileExists(const Options& options, const char *p=NULL);
         
         // Returns true if a previous call to checkFileExists() succeeded.
         // Returns false if the file does not exist of checkFileExists() has never been called.
-        bool missing() const { return modTime==0; }
-};
+        bool missing() const { return modTime == -1; }
+       };
 
        struct ExtraSection {
                const char*                             segmentName;
@@ -138,6 +219,11 @@ public:
                uint8_t                                 alignment;
        };
 
+       struct SectionOrderList {
+               const char*                                     segmentName;
+               std::vector<const char*>        sectionOrder;
+       };
+
        struct OrderedSymbol {
                const char*                             symbolName;
                const char*                             objectFileName;
@@ -170,6 +256,25 @@ public:
                const char*                     alias;
        };
 
+       struct SectionRename {
+               const char*                     fromSegment;
+               const char*                     fromSection;
+               const char*                     toSegment;
+               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,
+                 depFileList=0x10, depSection=0x10, depBundleLoader=0x10, depMisc=0x10, depNotFound=0x11,
+                 depOutputFile = 0x40 };
+       
+       void                                            dumpDependency(uint8_t, const char* path) const;
+       
        typedef const char* const*      UndefinesIterator;
 
 //     const ObjectFile::ReaderOptions&        readerOptions();
@@ -180,9 +285,10 @@ public:
        bool                                            preferSubArchitecture() const { return fHasPreferredSubType; }
        cpu_subtype_t                           subArchitecture() const { return fSubArchitecture; }
        bool                                            allowSubArchitectureMismatches() const { return fAllowCpuSubtypeMismatches; }
+       bool                                            enforceDylibSubtypesMatch() const { return fEnforceDylibSubtypesMatch; }
        bool                                            forceCpuSubtypeAll() const { return fForceSubtypeAll; }
        const char*                                     architectureName() const { return fArchitectureName; }
-       void                                            setArchitecture(cpu_type_t, cpu_subtype_t subtype);
+       void                                            setArchitecture(cpu_type_t, cpu_subtype_t subtype, Options::Platform platform);
        bool                                            archSupportsThumb2() const { return fArchSupportsThumb2; }
        OutputKind                                      outputKind() const { return fOutputKind; }
        bool                                            prebind() const { return fPrebind; }
@@ -207,14 +313,19 @@ public:
        bool                                            allGlobalsAreDeadStripRoots() const;
        bool                                            shouldExport(const char*) const;
        bool                                            shouldReExport(const char*) const;
+       std::vector<const char*>        exportsData() const;
        bool                                            ignoreOtherArchInputFiles() const { return fIgnoreOtherArchFiles; }
        bool                                            traceDylibs() const     { return fTraceDylibs; }
        bool                                            traceArchives() const { return fTraceArchives; }
+       bool                                            traceEmitJSON() const { return fTraceEmitJSON; }
        bool                                            deadCodeStrip() const   { return fDeadStrip; }
        UndefinedTreatment                      undefinedTreatment() const { return fUndefinedTreatment; }
        ld::MacVersionMin                       macosxVersionMin() const { return fMacVersionMin; }
        ld::IOSVersionMin                       iOSVersionMin() const { return fIOSVersionMin; }
+       ld::WatchOSVersionMin           watchOSVersionMin() const { return fWatchOSVersionMin; }
+       uint32_t                                        minOSversion() const;
        bool                                            minOS(ld::MacVersionMin mac, ld::IOSVersionMin iPhoneOS);
+       bool                                            min_iOS(ld::IOSVersionMin requirediOSMin);
        bool                                            messagesPrefixedWithArchitecture();
        Treatment                                       picTreatment();
        WeakReferenceMismatchTreatment  weakReferenceMismatchTreatment() const { return fWeakReferenceMismatchTreatment; }
@@ -231,6 +342,7 @@ public:
        bool                                            hasNonExecutableHeap() const { return fNonExecutableHeap; }
        UndefinesIterator                       initialUndefinesBegin() const { return &fInitialUndefines[0]; }
        UndefinesIterator                       initialUndefinesEnd() const { return &fInitialUndefines[fInitialUndefines.size()]; }
+       const std::vector<const char*>& initialUndefines() const { return fInitialUndefines; }
        bool                                            printWhyLive(const char* name) const;
        uint32_t                                        minimumHeaderPad() const { return fMinimumHeaderPad; }
        bool                                            maxMminimumHeaderPad() const { return fMaxMinimumHeaderPad; }
@@ -239,7 +351,8 @@ public:
        CommonsMode                                     commonsMode() const { return fCommonsMode; }
        bool                                            warnCommons() const { return fWarnCommons; }
        bool                                            keepRelocations();
-       FileInfo                                        findFile(const char* path) const;
+       FileInfo                                        findFile(const std::string &path, const ld::dylib::File* fromDylib=nullptr) const;
+       bool                                            findFile(const std::string &path, const std::vector<std::string> &tbdExtensions, FileInfo& result) const;
        UUIDMode                                        UUIDMode() const { return fUUIDMode; }
        bool                                            warnStabs();
        bool                                            pauseAtEnd() { return fPause; }
@@ -269,7 +382,7 @@ public:
        const std::vector<DylibOverride>&       dylibOverrides() const { return fDylibOverrides; }
        const char*                                     generatedMapPath() const { return fMapPath; }
        bool                                            positionIndependentExecutable() const { return fPositionIndependentExecutable; }
-       Options::FileInfo                       findFileUsingPaths(const char* path) const;
+       Options::FileInfo                       findIndirectDylib(const std::string& installName, const ld::dylib::File* fromDylib) const;
        bool                                            deadStripDylibs() const { return fDeadStripDylibs; }
        bool                                            allowedUndefined(const char* name) const { return ( fAllowedUndefined.find(name) != fAllowedUndefined.end() ); }
        bool                                            someAllowedUndefines() const { return (fAllowedUndefined.size() != 0); }
@@ -283,7 +396,11 @@ public:
        bool                                            makeEncryptable() const { return fEncryptable; }
        bool                                            needsUnwindInfoSection() const { return fAddCompactUnwindEncoding; }
        const std::vector<const char*>& llvmOptions() const{ return fLLVMOptions; }
+       const std::vector<const char*>& segmentOrder() const{ return fSegmentOrder; }
+       bool                                            segmentOrderAfterFixedAddressSegment(const char* segName) const;
+       const std::vector<const char*>* sectionOrder(const char* segName) const;
        const std::vector<const char*>& dyldEnvironExtras() const{ return fDyldEnvironExtras; }
+       const std::vector<const char*>& astFilePaths() const{ return fASTFilePaths; }
        bool                                            makeCompressedDyldInfo() const { return fMakeCompressedDyldInfo; }
        bool                                            hasExportedSymbolOrder();
        bool                                            exportedSymbolOrder(const char* sym, unsigned int* order) const;
@@ -316,39 +433,92 @@ public:
        bool                                            objcGc() const { return fObjCGc; }
        bool                                            objcGcOnly() const { return fObjCGcOnly; }
        bool                                            canUseThreadLocalVariables() const { return fTLVSupport; }
-       bool                                            addVersionLoadCommand() const { return fVersionLoadCommand; }
+       bool                                            addVersionLoadCommand() const { return fVersionLoadCommand && (fPlatform != kPlatformUnknown); }
+       bool                                            addBuildVersionLoadCommand() const { return fBuildVersionLoadCommand; }
        bool                                            addFunctionStarts() const { return fFunctionStartsLoadCommand; }
        bool                                            addDataInCodeInfo() const { return fDataInCodeInfoLoadCommand; }
        bool                                            canReExportSymbols() const { return fCanReExportSymbols; }
+       const char*                                     ltoCachePath() const { return fLtoCachePath; }
+       int                                                     ltoPruneInterval() const { return fLtoPruneInterval; }
+       int                                                     ltoPruneAfter() const { return fLtoPruneAfter; }
+       unsigned                                        ltoMaxCacheSize() const { return fLtoMaxCacheSize; }
        const char*                                     tempLtoObjectPath() const { return fTempLtoObjectPath; }
        const char*                                     overridePathlibLTO() const { return fOverridePathlibLTO; }
+       const char*                                     mcpuLTO() const { return fLtoCpu; }
        bool                                            objcCategoryMerging() const { return fObjcCategoryMerging; }
        bool                                            pageAlignDataAtoms() const { return fPageAlignDataAtoms; }
+       bool                                            keepDwarfUnwind() const { return fKeepDwarfUnwind; }
+       bool                                            verboseOptimizationHints() const { return fVerboseOptimizationHints; }
+       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                                            bundleBitcode() const { return fBundleBitcode; }
+       bool                                            hideSymbols() const { return fHideSymbols; }
+       bool                                            verifyBitcode() const { return fVerifyBitcode; }
+       bool                                            renameReverseSymbolMap() const { return fReverseMapUUIDRename; }
+       bool                                            deduplicateFunctions() const { return fDeDupe; }
+       bool                                            verboseDeduplicate() const { return fVerboseDeDupe; }
+       const char*                                     reverseSymbolMapPath() const { return fReverseMapPath; }
+       std::string                                     reverseMapTempPath() const { return fReverseMapTempPath; }
+       bool                                            ltoCodegenOnly() const { return fLTOCodegenOnly; }
+       bool                                            ignoreAutoLink() const { return fIgnoreAutoLink; }
+       bool                                            allowDeadDuplicates() const { return fAllowDeadDups; }
+       bool                                            allowWeakImports() const { return fAllowWeakImports; }
+       bool                                            noInitializers() const { return fNoInitializers; }
+       BitcodeMode                                     bitcodeKind() const { return fBitcodeKind; }
+       bool                                            sharedRegionEncodingV2() const { return fSharedRegionEncodingV2; }
+       bool                                            useDataConstSegment() const { return fUseDataConstSegment; }
+       bool                                            useTextExecSegment() const { return fUseTextExecSegment; }
        bool                                            hasWeakBitTweaks() const;
        bool                                            forceWeak(const char* symbolName) const;
        bool                                            forceNotWeak(const char* symbolName) const;
        bool                                            forceWeakNonWildCard(const char* symbolName) const;
        bool                                            forceNotWeakNonWildcard(const char* symbolName) const;
+       bool                                            forceCoalesce(const char* symbolName) const;
     Snapshot&                   snapshot() const { return fLinkSnapshot; }
        bool                                            errorBecauseOfWarnings() const;
        bool                                            needsThreadLoadCommand() const { return fNeedsThreadLoadCommand; }
        bool                                            needsEntryPointLoadCommand() const { return fEntryPointLoadCommand; }
        bool                                            needsSourceVersionLoadCommand() const { return fSourceVersionLoadCommand; }
-       bool                                            needsDependentDRInfo() const { return fDependentDRInfo; }
+       bool                                            canUseAbsoluteSymbols() const { return fAbsoluteSymbols; }
+       bool                                            allowSimulatorToLinkWithMacOSX() const { return fAllowSimulatorToLinkWithMacOSX; }
        uint64_t                                        sourceVersion() const { return fSourceVersion; }
        uint32_t                                        sdkVersion() const { return fSDKVersion; }
        const char*                                     demangleSymbol(const char* sym) const;
     bool                                               pipelineEnabled() const { return fPipelineFifo != NULL; }
     const char*                                        pipelineFifo() const { return fPipelineFifo; }
-       
+       bool                                            dumpDependencyInfo() const { return (fDependencyInfoPath != NULL); }
+       const char*                                     dependencyInfoPath() const { return fDependencyInfoPath; }
+       bool                                            targetIOSSimulator() const { return fTargetIOSSimulator; }
+       ld::relocatable::File::LinkerOptionsList&       
+                                                               linkerOptions() const { return fLinkerOptions; }
+       FileInfo                                        findFramework(const char* frameworkName) const;
+       FileInfo                                        findLibrary(const char* rootName, bool dylibsOnly=false) const;
+       bool                                            armUsesZeroCostExceptions() const;
+       const std::vector<SectionRename>& sectionRenames() const { return fSectionRenames; }
+       const std::vector<SegmentRename>& 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;
+       Platform                                        platform() const { return fPlatform; }
+       const std::vector<const char*>& sdkPaths() const { return fSDKPaths; }
+       std::vector<std::string>        writeBitcodeLinkOptions() const;
+       std::string                                     getSDKVersionStr() const;
+       std::string                                     getPlatformStr() const;
+       uint8_t                                         maxDefaultCommonAlign() const { return fMaxDefaultCommonAlign; }
+       bool                                            hasDataSymbolMoves() const { return !fSymbolsMovesData.empty(); }
+       bool                                            hasCodeSymbolMoves() const { return !fSymbolsMovesCode.empty(); }
+       void                                            writeToTraceFile(const char* buffer, size_t len) const;
+       UnalignedPointerTreatment       unalignedPointerTreatment() const { return fUnalignedPointerTreatment; }
+
+       static uint32_t                         parseVersionNumber32(const char*);
+
 private:
-       class CStringEquals
-       {
-       public:
-               bool operator()(const char* left, const char* right) const { return (strcmp(left, right) == 0); }
-       };
-       typedef __gnu_cxx::hash_map<const char*, unsigned int, __gnu_cxx::hash<const char*>, CStringEquals> NameToOrder;
-       typedef __gnu_cxx::hash_set<const char*, __gnu_cxx::hash<const char*>, CStringEquals>  NameSet;
+       typedef std::unordered_map<const char*, unsigned int, ld::CStringHash, ld::CStringEquals> NameToOrder;
+       typedef std::unordered_set<const char*, ld::CStringHash, ld::CStringEquals>  NameSet;
        enum ExportMode { kExportDefault, kExportSome, kDontExportSome };
        enum LibrarySearchMode { kSearchDylibAndArchiveInEachDir, kSearchAllDirsForDylibsThenAllDirsForArchives };
        enum InterposeMode { kInterposeNone, kInterposeAllExternal, kInterposeSome };
@@ -356,13 +526,15 @@ 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(); }
                NameSet::iterator               regularBegin() const    { return fRegular.begin(); }
                NameSet::iterator               regularEnd() const              { return fRegular.end(); }
                void                                    remove(const NameSet&); 
+               std::vector<const char*>                data() const;
        private:
                static bool                             hasWildCards(const char*);
                bool                                    wildCardMatch(const char* pattern, const char* candidate) const;
@@ -372,18 +544,22 @@ private:
                std::vector<const char*>                fWildCard;
        };
 
+       struct SymbolsMove {
+               const char*                     toSegment;
+               SetWithWildcards        symbols;
+       };
 
        void                                            parse(int argc, const char* argv[]);
        void                                            checkIllegalOptionCombinations();
        void                                            buildSearchPaths(int argc, const char* argv[]);
        void                                            parseArch(const char* architecture);
-       FileInfo                                        findLibrary(const char* rootName, bool dylibsOnly=false);
-       FileInfo                                        findFramework(const char* frameworkName);
-       FileInfo                                        findFramework(const char* rootName, const char* suffix);
+       FileInfo                                        findFramework(const char* rootName, const char* suffix) const;
        bool                                            checkForFile(const char* format, const char* dir, const char* rootName,
                                                                                         FileInfo& result) const;
        uint64_t                                        parseVersionNumber64(const char*);
-       uint32_t                                        parseVersionNumber32(const char*);
+       std::string                                     getVersionString32(uint32_t ver) const;
+       std::string                                     getVersionString64(uint64_t ver) const;
+       bool                                            parsePackedVersion32(const std::string& versionStr, uint32_t &result);
        void                                            parseSectionOrderFile(const char* segment, const char* section, const char* path);
        void                                            parseOrderFile(const char* path, bool cstring);
        void                                            addSection(const char* segment, const char* section, const char* path);
@@ -397,6 +573,7 @@ private:
        void                                            setUndefinedTreatment(const char* treatment);
        void                                            setMacOSXVersionMin(const char* version);
        void                                            setIOSVersionMin(const char* version);
+       void                                            setWatchOSVersionMin(const char* version);
        void                                            setWeakReferenceMismatchTreatment(const char* treatment);
        void                                            addDylibOverride(const char* paths);
        void                                            addSectionAlignment(const char* segment, const char* section, const char* alignment);
@@ -409,7 +586,10 @@ private:
        void                                            warnObsolete(const char* arg);
        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<SymbolsMove>& list, const char* optionName);
+       void                                            cannotBeUsedWithBitcode(const char* arg);
 
 
 //     ObjectFile::ReaderOptions                       fReaderOptions;
@@ -446,6 +626,7 @@ private:
        SetWithWildcards                                        fForceWeakSymbols;
        SetWithWildcards                                        fForceNotWeakSymbols;
        SetWithWildcards                                        fReExportSymbols;
+       SetWithWildcards                                        fForceCoalesceSymbols;
        NameSet                                                         fRemovedExports;
        NameToOrder                                                     fExportSymbolsOrder;
        ExportMode                                                      fExportMode;
@@ -467,8 +648,13 @@ private:
        const char*                                                     fSegAddrTablePath;
        const char*                                                     fMapPath;
        const char*                                                     fDyldInstallPath;
+       const char*                                                     fLtoCachePath;
+       int                                                                     fLtoPruneInterval;
+       int                                                                     fLtoPruneAfter;
+       unsigned                                                        fLtoMaxCacheSize;
        const char*                                                     fTempLtoObjectPath;
        const char*                                                     fOverridePathlibLTO;
+       const char*                                                     fLtoCpu;
        uint64_t                                                        fZeroPageSize;
        uint64_t                                                        fStackSize;
        uint64_t                                                        fStackAddr;
@@ -493,6 +679,7 @@ private:
        bool                                                            fStatistics;
        bool                                                            fPrintOptions;
        bool                                                            fSharedRegionEligible;
+       bool                                                            fSharedRegionEligibleForceOff;
        bool                                                            fPrintOrderFileStatistics;
        bool                                                            fReadOnlyx86Stubs;
        bool                                                            fPositionIndependentExecutable;
@@ -505,12 +692,15 @@ private:
        bool                                                            fKextsUseStubs;
        bool                                                            fUsingLazyDylibLinking;
        bool                                                            fEncryptable;
+       bool                                                            fEncryptableForceOn;
+       bool                                                            fEncryptableForceOff;
        bool                                                            fOrderData;
        bool                                                            fMarkDeadStrippableDylib;
        bool                                                            fMakeCompressedDyldInfo;
        bool                                                            fMakeCompressedDyldInfoForceOff;
        bool                                                            fNoEHLabels;
        bool                                                            fAllowCpuSubtypeMismatches;
+       bool                                                            fEnforceDylibSubtypesMatch;
        bool                                                            fUseSimplifiedDylibReExports;
        bool                                                            fObjCABIVersion2Override;
        bool                                                            fObjCABIVersion1Override;
@@ -538,6 +728,7 @@ private:
        bool                                                            fTraceDylibs;
        bool                                                            fTraceIndirectDylibs;
        bool                                                            fTraceArchives;
+       bool                                                            fTraceEmitJSON;
        bool                                                            fOutputSlidable;
        bool                                                            fWarnWeakExports;
        bool                                                            fObjcGcCompaction;
@@ -548,6 +739,7 @@ private:
        bool                                                            fVersionLoadCommand;
        bool                                                            fVersionLoadCommandForcedOn;
        bool                                                            fVersionLoadCommandForcedOff;
+       bool                                                            fBuildVersionLoadCommand;
        bool                                                            fFunctionStartsLoadCommand;
        bool                                                            fFunctionStartsForcedOn;
        bool                                                            fFunctionStartsForcedOff;
@@ -564,17 +756,50 @@ private:
        bool                                                            fSourceVersionLoadCommand;
        bool                                                            fSourceVersionLoadCommandForceOn;
        bool                                                            fSourceVersionLoadCommandForceOff;      
-       bool                                                            fDependentDRInfo;
-       bool                                                            fDependentDRInfoForcedOn;
-       bool                                                            fDependentDRInfoForcedOff;
+       bool                                                            fTargetIOSSimulator;
+       bool                                                            fExportDynamic;
+       bool                                                            fAbsoluteSymbols;
+       bool                                                            fAllowSimulatorToLinkWithMacOSX;
+       bool                                                            fKeepDwarfUnwind;
+       bool                                                            fKeepDwarfUnwindForcedOn;
+       bool                                                            fKeepDwarfUnwindForcedOff;
+       bool                                                            fVerboseOptimizationHints;
+       bool                                                            fIgnoreOptimizationHints;
+       bool                                                            fGenerateDtraceDOF;
+       bool                                                            fAllowBranchIslands;
+       bool                                                            fTraceSymbolLayout;
+       bool                                                            fMarkAppExtensionSafe;
+       bool                                                            fCheckAppExtensionSafe;
+       bool                                                            fForceLoadSwiftLibs;
+       bool                                                            fSharedRegionEncodingV2;
+       bool                                                            fUseDataConstSegment;
+       bool                                                            fUseDataConstSegmentForceOn;
+       bool                                                            fUseDataConstSegmentForceOff;
+       bool                                                            fUseTextExecSegment;
+       bool                                                            fBundleBitcode;
+       bool                                                            fHideSymbols;
+       bool                                                            fVerifyBitcode;
+       bool                                                            fReverseMapUUIDRename;
+       bool                                                            fDeDupe;
+       bool                                                            fVerboseDeDupe;
+       const char*                                                     fReverseMapPath;
+       std::string                                                     fReverseMapTempPath;
+       bool                                                            fLTOCodegenOnly;
+       bool                                                            fIgnoreAutoLink;
+       bool                                                            fAllowDeadDups;
+       bool                                                            fAllowWeakImports;
+       bool                                                            fNoInitializers;
+       BitcodeMode                                                     fBitcodeKind;
+       Platform                                                        fPlatform;
        DebugInfoStripping                                      fDebugInfoStripping;
        const char*                                                     fTraceOutputFile;
        ld::MacVersionMin                                       fMacVersionMin;
        ld::IOSVersionMin                                       fIOSVersionMin;
+       ld::WatchOSVersionMin                           fWatchOSVersionMin;
        std::vector<AliasPair>                          fAliases;
        std::vector<const char*>                        fInitialUndefines;
        NameSet                                                         fAllowedUndefined;
-       NameSet                                                         fWhyLive;
+       SetWithWildcards                                        fWhyLive;
        std::vector<ExtraSection>                       fExtraSections;
        std::vector<SectionAlignment>           fSectionAlignments;
        std::vector<OrderedSymbol>                      fOrderedSymbols;
@@ -587,10 +812,23 @@ private:
        std::vector<const char*>                        fFrameworkSearchPaths;
        std::vector<const char*>                        fSDKPaths;
        std::vector<const char*>                        fDyldEnvironExtras;
+       std::vector<const char*>                        fSegmentOrder;
+       std::vector<const char*>                        fASTFilePaths;
+       std::vector<SectionOrderList>           fSectionOrder;
+       std::vector< std::vector<const char*> > fLinkerOptions;
+       std::vector<SectionRename>                      fSectionRenames;
+       std::vector<SegmentRename>                      fSegmentRenames;
+       std::vector<SymbolsMove>                        fSymbolsMovesData;
+       std::vector<SymbolsMove>                        fSymbolsMovesCode;
        bool                                                            fSaveTempFiles;
-    mutable Snapshot                  fLinkSnapshot;
-    bool                              fSnapshotRequested;
-    const char *                      fPipelineFifo;
+    mutable Snapshot                                   fLinkSnapshot;
+    bool                                                               fSnapshotRequested;
+    const char*                                                        fPipelineFifo;
+       const char*                                                     fDependencyInfoPath;
+       mutable int                                                     fDependencyFileDescriptor;
+       mutable int                                                     fTraceFileDescriptor;
+       uint8_t                                                         fMaxDefaultCommonAlign;
+       UnalignedPointerTreatment                       fUnalignedPointerTreatment;
 };