]>
Commit | Line | Data |
---|---|---|
d696c285 | 1 | /* -*- mode: C++; c-basic-offset: 4; tab-width: 4 -*- |
6e880c60 | 2 | * |
a645023d | 3 | * Copyright (c) 2005-2010 Apple Inc. All rights reserved. |
c2646906 A |
4 | * |
5 | * @APPLE_LICENSE_HEADER_START@ | |
d696c285 | 6 | * |
c2646906 A |
7 | * This file contains Original Code and/or Modifications of Original Code |
8 | * as defined in and that are subject to the Apple Public Source License | |
9 | * Version 2.0 (the 'License'). You may not use this file except in | |
10 | * compliance with the License. Please obtain a copy of the License at | |
11 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
12 | * file. | |
d696c285 | 13 | * |
c2646906 A |
14 | * The Original Code and all software distributed under the License are |
15 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
16 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
17 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
18 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
19 | * Please see the License for the specific language governing rights and | |
20 | * limitations under the License. | |
d696c285 | 21 | * |
c2646906 A |
22 | * @APPLE_LICENSE_HEADER_END@ |
23 | */ | |
24 | ||
25 | #ifndef __OPTIONS__ | |
26 | #define __OPTIONS__ | |
27 | ||
28 | ||
29 | #include <stdint.h> | |
30 | #include <mach/machine.h> | |
31 | ||
c2646906 A |
32 | #include <vector> |
33 | #include <ext/hash_set> | |
55e3d2f6 | 34 | #include <ext/hash_map> |
c2646906 | 35 | |
a645023d | 36 | #include "ld.hpp" |
c2646906 | 37 | |
fb24a050 A |
38 | extern void throwf (const char* format, ...) __attribute__ ((noreturn,format(printf, 1, 2))); |
39 | extern void warning(const char* format, ...) __attribute__((format(printf, 1, 2))); | |
c2646906 | 40 | |
55e3d2f6 | 41 | class LibraryOptions |
c2646906 A |
42 | { |
43 | public: | |
a645023d A |
44 | LibraryOptions() : fWeakImport(false), fReExport(false), fBundleLoader(false), |
45 | fLazyLoad(false), fUpward(false), fForceLoad(false) {} | |
55e3d2f6 | 46 | // for dynamic libraries |
c2646906 A |
47 | bool fWeakImport; |
48 | bool fReExport; | |
69a49097 | 49 | bool fBundleLoader; |
2f2f92e4 | 50 | bool fLazyLoad; |
a645023d | 51 | bool fUpward; |
55e3d2f6 A |
52 | // for static libraries |
53 | bool fForceLoad; | |
c2646906 A |
54 | }; |
55 | ||
55e3d2f6 A |
56 | |
57 | ||
d696c285 A |
58 | // |
59 | // The public interface to the Options class is the abstract representation of what work the linker | |
60 | // should do. | |
61 | // | |
62 | // This abstraction layer will make it easier to support a future where the linker is a shared library | |
63 | // invoked directly from Xcode. The target settings in Xcode would be used to directly construct an Options | |
64 | // object (without building a command line which is then parsed). | |
65 | // | |
66 | // | |
c2646906 A |
67 | class Options |
68 | { | |
69 | public: | |
d696c285 A |
70 | Options(int argc, const char* argv[]); |
71 | ~Options(); | |
c2646906 | 72 | |
55e3d2f6 | 73 | enum OutputKind { kDynamicExecutable, kStaticExecutable, kDynamicLibrary, kDynamicBundle, kObjectFile, kDyld, kPreload, kKextBundle }; |
c2646906 | 74 | enum NameSpace { kTwoLevelNameSpace, kFlatNameSpace, kForceFlatNameSpace }; |
d696c285 A |
75 | // Standard treatment for many options. |
76 | enum Treatment { kError, kWarning, kSuppress, kNULL, kInvalid }; | |
c2646906 | 77 | enum UndefinedTreatment { kUndefinedError, kUndefinedWarning, kUndefinedSuppress, kUndefinedDynamicLookup }; |
d696c285 A |
78 | enum WeakReferenceMismatchTreatment { kWeakReferenceMismatchError, kWeakReferenceMismatchWeak, |
79 | kWeakReferenceMismatchNonWeak }; | |
c2646906 | 80 | enum CommonsMode { kCommonsIgnoreDylibs, kCommonsOverriddenByDylibs, kCommonsConflictsDylibsError }; |
a61fdf0a A |
81 | enum UUIDMode { kUUIDNone, kUUIDRandom, kUUIDContent }; |
82 | enum LocalSymbolHandling { kLocalSymbolsAll, kLocalSymbolsNone, kLocalSymbolsSelectiveInclude, kLocalSymbolsSelectiveExclude }; | |
a645023d | 83 | enum DebugInfoStripping { kDebugInfoNone, kDebugInfoMinimal, kDebugInfoFull }; |
c2646906 A |
84 | |
85 | struct FileInfo { | |
86 | const char* path; | |
87 | uint64_t fileLen; | |
d696c285 | 88 | time_t modTime; |
55e3d2f6 | 89 | LibraryOptions options; |
c2646906 | 90 | }; |
d696c285 | 91 | |
c2646906 A |
92 | struct ExtraSection { |
93 | const char* segmentName; | |
94 | const char* sectionName; | |
95 | const char* path; | |
96 | const uint8_t* data; | |
97 | uint64_t dataLen; | |
a645023d A |
98 | typedef ExtraSection* iterator; |
99 | typedef const ExtraSection* const_iterator; | |
c2646906 | 100 | }; |
d696c285 | 101 | |
c2646906 A |
102 | struct SectionAlignment { |
103 | const char* segmentName; | |
104 | const char* sectionName; | |
105 | uint8_t alignment; | |
106 | }; | |
107 | ||
a61fdf0a A |
108 | struct OrderedSymbol { |
109 | const char* symbolName; | |
110 | const char* objectFileName; | |
111 | }; | |
a645023d | 112 | typedef const OrderedSymbol* OrderedSymbolsIterator; |
a61fdf0a A |
113 | |
114 | struct SegmentStart { | |
115 | const char* name; | |
116 | uint64_t address; | |
117 | }; | |
118 | ||
55e3d2f6 A |
119 | struct SegmentSize { |
120 | const char* name; | |
121 | uint64_t size; | |
122 | }; | |
123 | ||
a61fdf0a A |
124 | struct SegmentProtect { |
125 | const char* name; | |
126 | uint32_t max; | |
127 | uint32_t init; | |
128 | }; | |
129 | ||
130 | struct DylibOverride { | |
131 | const char* installName; | |
132 | const char* useInstead; | |
133 | }; | |
134 | ||
a645023d A |
135 | struct AliasPair { |
136 | const char* realName; | |
137 | const char* alias; | |
138 | }; | |
139 | ||
140 | typedef const char* const* UndefinesIterator; | |
a61fdf0a | 141 | |
a645023d A |
142 | // const ObjectFile::ReaderOptions& readerOptions(); |
143 | const char* outputFilePath() const { return fOutputFile; } | |
144 | const std::vector<FileInfo>& getInputFiles() const { return fInputFiles; } | |
d696c285 | 145 | |
a645023d A |
146 | cpu_type_t architecture() const { return fArchitecture; } |
147 | bool preferSubArchitecture() const { return fHasPreferredSubType; } | |
148 | cpu_subtype_t subArchitecture() const { return fSubArchitecture; } | |
149 | bool allowSubArchitectureMismatches() const { return fAllowCpuSubtypeMismatches; } | |
150 | bool forceCpuSubtypeAll() const { return fForceSubtypeAll; } | |
151 | const char* architectureName() const { return fArchitectureName; } | |
152 | void setArchitecture(cpu_type_t, cpu_subtype_t subtype); | |
afe874b1 | 153 | bool archSupportsThumb2() const { return fArchSupportsThumb2; } |
a645023d A |
154 | OutputKind outputKind() const { return fOutputKind; } |
155 | bool prebind() const { return fPrebind; } | |
156 | bool bindAtLoad() const { return fBindAtLoad; } | |
157 | NameSpace nameSpace() const { return fNameSpace; } | |
158 | const char* installPath() const; // only for kDynamicLibrary | |
b2fa67a8 A |
159 | uint64_t currentVersion() const { return fDylibCurrentVersion; } // only for kDynamicLibrary |
160 | uint32_t currentVersion32() const; // only for kDynamicLibrary | |
a645023d A |
161 | uint32_t compatibilityVersion() const { return fDylibCompatVersion; } // only for kDynamicLibrary |
162 | const char* entryName() const { return fEntryName; } // only for kDynamicExecutable or kStaticExecutable | |
d696c285 | 163 | const char* executablePath(); |
a645023d A |
164 | uint64_t baseAddress() const { return fBaseAddress; } |
165 | uint64_t maxAddress() const { return fMaxAddress; } | |
166 | bool keepPrivateExterns() const { return fKeepPrivateExterns; } // only for kObjectFile | |
167 | bool needsModuleTable() const { return fNeedsModuleTable; } // only for kDynamicLibrary | |
168 | bool interposable(const char* name) const; | |
169 | bool hasExportRestrictList() const { return (fExportMode != kExportDefault); } // -exported_symbol or -unexported_symbol | |
170 | bool hasExportMaskList() const { return (fExportMode == kExportSome); } // just -exported_symbol | |
171 | bool hasWildCardExportRestrictList() const; | |
172 | bool hasReExportList() const { return ! fReExportSymbols.empty(); } | |
173 | bool wasRemovedExport(const char* sym) const { return ( fRemovedExports.find(sym) != fRemovedExports.end() ); } | |
174 | bool allGlobalsAreDeadStripRoots() const; | |
175 | bool shouldExport(const char*) const; | |
176 | bool shouldReExport(const char*) const; | |
177 | bool ignoreOtherArchInputFiles() const { return fIgnoreOtherArchFiles; } | |
178 | bool traceDylibs() const { return fTraceDylibs; } | |
179 | bool traceArchives() const { return fTraceArchives; } | |
180 | bool deadCodeStrip() const { return fDeadStrip; } | |
181 | UndefinedTreatment undefinedTreatment() const { return fUndefinedTreatment; } | |
182 | ld::MacVersionMin macosxVersionMin() const { return fMacVersionMin; } | |
afe874b1 A |
183 | ld::IOSVersionMin iOSVersionMin() const { return fIOSVersionMin; } |
184 | bool minOS(ld::MacVersionMin mac, ld::IOSVersionMin iPhoneOS); | |
c2646906 | 185 | bool messagesPrefixedWithArchitecture(); |
d696c285 | 186 | Treatment picTreatment(); |
a645023d A |
187 | WeakReferenceMismatchTreatment weakReferenceMismatchTreatment() const { return fWeakReferenceMismatchTreatment; } |
188 | const char* umbrellaName() const { return fUmbrellaName; } | |
189 | const std::vector<const char*>& allowableClients() const { return fAllowableClients; } | |
190 | const char* clientName() const { return fClientName; } | |
191 | const char* initFunctionName() const { return fInitFunctionName; } // only for kDynamicLibrary | |
d696c285 | 192 | const char* dotOutputFile(); |
a645023d A |
193 | uint64_t pageZeroSize() const { return fZeroPageSize; } |
194 | bool hasCustomStack() const { return (fStackSize != 0); } | |
195 | uint64_t customStackSize() const { return fStackSize; } | |
196 | uint64_t customStackAddr() const { return fStackAddr; } | |
197 | bool hasExecutableStack() const { return fExecutableStack; } | |
198 | bool hasNonExecutableHeap() const { return fNonExecutableHeap; } | |
199 | UndefinesIterator initialUndefinesBegin() const { return &fInitialUndefines[0]; } | |
200 | UndefinesIterator initialUndefinesEnd() const { return &fInitialUndefines[fInitialUndefines.size()]; } | |
201 | bool printWhyLive(const char* name) const; | |
202 | uint32_t minimumHeaderPad() const { return fMinimumHeaderPad; } | |
203 | bool maxMminimumHeaderPad() const { return fMaxMinimumHeaderPad; } | |
204 | ExtraSection::const_iterator extraSectionsBegin() const { return &fExtraSections[0]; } | |
205 | ExtraSection::const_iterator extraSectionsEnd() const { return &fExtraSections[fExtraSections.size()]; } | |
206 | CommonsMode commonsMode() const { return fCommonsMode; } | |
207 | bool warnCommons() const { return fWarnCommons; } | |
d696c285 | 208 | bool keepRelocations(); |
a645023d A |
209 | FileInfo findFile(const char* path) const; |
210 | UUIDMode UUIDMode() const { return fUUIDMode; } | |
d696c285 A |
211 | bool warnStabs(); |
212 | bool pauseAtEnd() { return fPause; } | |
a645023d A |
213 | bool printStatistics() const { return fStatistics; } |
214 | bool printArchPrefix() const { return fMessagesPrefixedWithArchitecture; } | |
a61fdf0a | 215 | void gotoClassicLinker(int argc, const char* argv[]); |
a645023d A |
216 | bool sharedRegionEligible() const { return fSharedRegionEligible; } |
217 | bool printOrderFileStatistics() const { return fPrintOrderFileStatistics; } | |
a61fdf0a A |
218 | const char* dTraceScriptName() { return fDtraceScriptName; } |
219 | bool dTrace() { return (fDtraceScriptName != NULL); } | |
a645023d A |
220 | unsigned long orderedSymbolsCount() const { return fOrderedSymbols.size(); } |
221 | OrderedSymbolsIterator orderedSymbolsBegin() const { return &fOrderedSymbols[0]; } | |
222 | OrderedSymbolsIterator orderedSymbolsEnd() const { return &fOrderedSymbols[fOrderedSymbols.size()]; } | |
223 | bool splitSeg() const { return fSplitSegs; } | |
a61fdf0a | 224 | uint64_t baseWritableAddress() { return fBaseWritableAddress; } |
a645023d A |
225 | uint64_t segmentAlignment() const { return fSegmentAlignment; } |
226 | uint64_t segPageSize(const char* segName) const; | |
227 | uint64_t customSegmentAddress(const char* segName) const; | |
228 | bool hasCustomSegmentAddress(const char* segName) const; | |
229 | bool hasCustomSectionAlignment(const char* segName, const char* sectName) const; | |
230 | uint8_t customSectionAlignment(const char* segName, const char* sectName) const; | |
231 | uint32_t initialSegProtection(const char*) const; | |
232 | uint32_t maxSegProtection(const char*) const; | |
233 | bool saveTempFiles() const { return fSaveTempFiles; } | |
234 | const std::vector<const char*>& rpaths() const { return fRPaths; } | |
a61fdf0a | 235 | bool readOnlyx86Stubs() { return fReadOnlyx86Stubs; } |
a645023d A |
236 | const std::vector<DylibOverride>& dylibOverrides() const { return fDylibOverrides; } |
237 | const char* generatedMapPath() const { return fMapPath; } | |
238 | bool positionIndependentExecutable() const { return fPositionIndependentExecutable; } | |
239 | Options::FileInfo findFileUsingPaths(const char* path) const; | |
240 | bool deadStripDylibs() const { return fDeadStripDylibs; } | |
241 | bool allowedUndefined(const char* name) const { return ( fAllowedUndefined.find(name) != fAllowedUndefined.end() ); } | |
242 | bool someAllowedUndefines() const { return (fAllowedUndefined.size() != 0); } | |
a61fdf0a | 243 | LocalSymbolHandling localSymbolHandling() { return fLocalSymbolHandling; } |
a645023d A |
244 | bool keepLocalSymbol(const char* symbolName) const; |
245 | bool allowTextRelocs() const { return fAllowTextRelocs; } | |
246 | bool warnAboutTextRelocs() const { return fWarnTextRelocs; } | |
247 | bool usingLazyDylibLinking() const { return fUsingLazyDylibLinking; } | |
248 | bool verbose() const { return fVerbose; } | |
249 | bool makeEncryptable() const { return fEncryptable; } | |
250 | bool needsUnwindInfoSection() const { return fAddCompactUnwindEncoding; } | |
251 | const std::vector<const char*>& llvmOptions() const{ return fLLVMOptions; } | |
252 | const std::vector<const char*>& dyldEnvironExtras() const{ return fDyldEnvironExtras; } | |
253 | bool makeCompressedDyldInfo() const { return fMakeCompressedDyldInfo; } | |
55e3d2f6 | 254 | bool hasExportedSymbolOrder(); |
a645023d | 255 | bool exportedSymbolOrder(const char* sym, unsigned int* order) const; |
55e3d2f6 | 256 | bool orderData() { return fOrderData; } |
a645023d A |
257 | bool errorOnOtherArchFiles() const { return fErrorOnOtherArchFiles; } |
258 | bool markAutoDeadStripDylib() const { return fMarkDeadStrippableDylib; } | |
259 | bool removeEHLabels() const { return fNoEHLabels; } | |
260 | bool useSimplifiedDylibReExports() const { return fUseSimplifiedDylibReExports; } | |
261 | bool objCABIVersion2POverride() const { return fObjCABIVersion2Override; } | |
262 | bool useUpwardDylibs() const { return fCanUseUpwardDylib; } | |
263 | bool fullyLoadArchives() const { return fFullyLoadArchives; } | |
264 | bool loadAllObjcObjectsFromArchives() const { return fLoadAllObjcObjectsFromArchives; } | |
265 | bool autoOrderInitializers() const { return fAutoOrderInitializers; } | |
266 | bool optimizeZeroFill() const { return fOptimizeZeroFill; } | |
afe874b1 | 267 | bool mergeZeroFill() const { return fMergeZeroFill; } |
a645023d A |
268 | bool logAllFiles() const { return fLogAllFiles; } |
269 | DebugInfoStripping debugInfoStripping() const { return fDebugInfoStripping; } | |
270 | bool flatNamespace() const { return fFlatNamespace; } | |
271 | bool linkingMainExecutable() const { return fLinkingMainExecutable; } | |
272 | bool implicitlyLinkIndirectPublicDylibs() const { return fImplicitlyLinkPublicDylibs; } | |
273 | bool whyLoad() const { return fWhyLoad; } | |
274 | const char* traceOutputFile() const { return fTraceOutputFile; } | |
275 | bool outputSlidable() const { return fOutputSlidable; } | |
276 | bool haveCmdLineAliases() const { return (fAliases.size() != 0); } | |
277 | const std::vector<AliasPair>& cmdLineAliases() const { return fAliases; } | |
278 | bool makeTentativeDefinitionsReal() const { return fMakeTentativeDefinitionsReal; } | |
279 | const char* dyldInstallPath() const { return fDyldInstallPath; } | |
280 | bool warnWeakExports() const { return fWarnWeakExports; } | |
281 | bool objcGcCompaction() const { return fObjcGcCompaction; } | |
282 | bool objcGc() const { return fObjCGc; } | |
283 | bool objcGcOnly() const { return fObjCGcOnly; } | |
284 | bool canUseThreadLocalVariables() const { return fTLVSupport; } | |
285 | bool demangleSymbols() const { return fDemangle; } | |
286 | bool addVersionLoadCommand() const { return fVersionLoadCommand; } | |
287 | bool addFunctionStarts() const { return fFunctionStartsLoadCommand; } | |
288 | bool canReExportSymbols() const { return fCanReExportSymbols; } | |
289 | const char* tempLtoObjectPath() const { return fTempLtoObjectPath; } | |
290 | bool objcCategoryMerging() const { return fObjcCategoryMerging; } | |
afe874b1 | 291 | bool pageAlignDataAtoms() const { return fPageAlignDataAtoms; } |
a645023d A |
292 | bool hasWeakBitTweaks() const; |
293 | bool forceWeak(const char* symbolName) const; | |
294 | bool forceNotWeak(const char* symbolName) const; | |
295 | bool forceWeakNonWildCard(const char* symbolName) const; | |
296 | bool forceNotWeakNonWildcard(const char* symbolName) const; | |
b2fa67a8 | 297 | bool errorBecauseOfWarnings() const; |
9d2e0767 | 298 | |
c2646906 A |
299 | private: |
300 | class CStringEquals | |
301 | { | |
302 | public: | |
303 | bool operator()(const char* left, const char* right) const { return (strcmp(left, right) == 0); } | |
304 | }; | |
55e3d2f6 | 305 | typedef __gnu_cxx::hash_map<const char*, unsigned int, __gnu_cxx::hash<const char*>, CStringEquals> NameToOrder; |
c2646906 A |
306 | typedef __gnu_cxx::hash_set<const char*, __gnu_cxx::hash<const char*>, CStringEquals> NameSet; |
307 | enum ExportMode { kExportDefault, kExportSome, kDontExportSome }; | |
308 | enum LibrarySearchMode { kSearchDylibAndArchiveInEachDir, kSearchAllDirsForDylibsThenAllDirsForArchives }; | |
2f2f92e4 | 309 | enum InterposeMode { kInterposeNone, kInterposeAllExternal, kInterposeSome }; |
c2646906 | 310 | |
a61fdf0a A |
311 | class SetWithWildcards { |
312 | public: | |
313 | void insert(const char*); | |
a645023d A |
314 | bool contains(const char*) const; |
315 | bool containsNonWildcard(const char*) const; | |
316 | bool empty() const { return fRegular.empty() && fWildCard.empty(); } | |
317 | bool hasWildCards() const { return !fWildCard.empty(); } | |
318 | NameSet::iterator regularBegin() const { return fRegular.begin(); } | |
319 | NameSet::iterator regularEnd() const { return fRegular.end(); } | |
320 | void remove(const NameSet&); | |
a61fdf0a | 321 | private: |
2f2f92e4 | 322 | static bool hasWildCards(const char*); |
a645023d A |
323 | bool wildCardMatch(const char* pattern, const char* candidate) const; |
324 | bool inCharRange(const char*& range, unsigned char c) const; | |
a61fdf0a A |
325 | |
326 | NameSet fRegular; | |
327 | std::vector<const char*> fWildCard; | |
328 | }; | |
329 | ||
330 | ||
c2646906 A |
331 | void parse(int argc, const char* argv[]); |
332 | void checkIllegalOptionCombinations(); | |
333 | void buildSearchPaths(int argc, const char* argv[]); | |
334 | void parseArch(const char* architecture); | |
2f2f92e4 | 335 | FileInfo findLibrary(const char* rootName, bool dylibsOnly=false); |
74cfe461 A |
336 | FileInfo findFramework(const char* frameworkName); |
337 | FileInfo findFramework(const char* rootName, const char* suffix); | |
d696c285 | 338 | bool checkForFile(const char* format, const char* dir, const char* rootName, |
a645023d | 339 | FileInfo& result) const; |
b2fa67a8 A |
340 | uint64_t parseVersionNumber64(const char*); |
341 | uint32_t parseVersionNumber32(const char*); | |
c2646906 | 342 | void parseSectionOrderFile(const char* segment, const char* section, const char* path); |
a61fdf0a | 343 | void parseOrderFile(const char* path, bool cstring); |
c2646906 A |
344 | void addSection(const char* segment, const char* section, const char* path); |
345 | void addSubLibrary(const char* name); | |
346 | void loadFileList(const char* fileOfPaths); | |
347 | uint64_t parseAddress(const char* addr); | |
a61fdf0a A |
348 | void loadExportFile(const char* fileOfExports, const char* option, SetWithWildcards& set); |
349 | void parseAliasFile(const char* fileOfAliases); | |
c2646906 A |
350 | void parsePreCommandLineEnvironmentSettings(); |
351 | void parsePostCommandLineEnvironmentSettings(); | |
352 | void setUndefinedTreatment(const char* treatment); | |
2f2f92e4 | 353 | void setMacOSXVersionMin(const char* version); |
afe874b1 | 354 | void setIOSVersionMin(const char* version); |
c2646906 | 355 | void setWeakReferenceMismatchTreatment(const char* treatment); |
a61fdf0a | 356 | void addDylibOverride(const char* paths); |
c2646906 A |
357 | void addSectionAlignment(const char* segment, const char* section, const char* alignment); |
358 | CommonsMode parseCommonsTreatment(const char* mode); | |
d696c285 | 359 | Treatment parseTreatment(const char* treatment); |
69a49097 | 360 | void reconfigureDefaults(); |
a61fdf0a A |
361 | void checkForClassic(int argc, const char* argv[]); |
362 | void parseSegAddrTable(const char* segAddrPath, const char* installPath); | |
363 | void addLibrary(const FileInfo& info); | |
364 | void warnObsolete(const char* arg); | |
365 | uint32_t parseProtection(const char* prot); | |
55e3d2f6 | 366 | void loadSymbolOrderFile(const char* fileOfExports, NameToOrder& orderMapping); |
d696c285 A |
367 | |
368 | ||
a645023d A |
369 | |
370 | // ObjectFile::ReaderOptions fReaderOptions; | |
c2646906 A |
371 | const char* fOutputFile; |
372 | std::vector<Options::FileInfo> fInputFiles; | |
373 | cpu_type_t fArchitecture; | |
2f2f92e4 | 374 | cpu_subtype_t fSubArchitecture; |
a645023d | 375 | const char* fArchitectureName; |
c2646906 | 376 | OutputKind fOutputKind; |
2f2f92e4 | 377 | bool fHasPreferredSubType; |
afe874b1 | 378 | bool fArchSupportsThumb2; |
d696c285 | 379 | bool fPrebind; |
c2646906 | 380 | bool fBindAtLoad; |
c2646906 | 381 | bool fKeepPrivateExterns; |
a61fdf0a | 382 | bool fNeedsModuleTable; |
c2646906 | 383 | bool fIgnoreOtherArchFiles; |
55e3d2f6 | 384 | bool fErrorOnOtherArchFiles; |
c2646906 | 385 | bool fForceSubtypeAll; |
2f2f92e4 | 386 | InterposeMode fInterposeMode; |
a645023d | 387 | bool fDeadStrip; |
c2646906 A |
388 | NameSpace fNameSpace; |
389 | uint32_t fDylibCompatVersion; | |
b2fa67a8 | 390 | uint64_t fDylibCurrentVersion; |
c2646906 | 391 | const char* fDylibInstallName; |
a61fdf0a | 392 | const char* fFinalName; |
c2646906 A |
393 | const char* fEntryName; |
394 | uint64_t fBaseAddress; | |
a645023d | 395 | uint64_t fMaxAddress; |
a61fdf0a A |
396 | uint64_t fBaseWritableAddress; |
397 | bool fSplitSegs; | |
398 | SetWithWildcards fExportSymbols; | |
399 | SetWithWildcards fDontExportSymbols; | |
2f2f92e4 | 400 | SetWithWildcards fInterposeList; |
a645023d A |
401 | SetWithWildcards fForceWeakSymbols; |
402 | SetWithWildcards fForceNotWeakSymbols; | |
403 | SetWithWildcards fReExportSymbols; | |
404 | NameSet fRemovedExports; | |
55e3d2f6 | 405 | NameToOrder fExportSymbolsOrder; |
c2646906 A |
406 | ExportMode fExportMode; |
407 | LibrarySearchMode fLibrarySearchMode; | |
408 | UndefinedTreatment fUndefinedTreatment; | |
409 | bool fMessagesPrefixedWithArchitecture; | |
c2646906 A |
410 | WeakReferenceMismatchTreatment fWeakReferenceMismatchTreatment; |
411 | std::vector<const char*> fSubUmbellas; | |
412 | std::vector<const char*> fSubLibraries; | |
d696c285 | 413 | std::vector<const char*> fAllowableClients; |
a61fdf0a | 414 | std::vector<const char*> fRPaths; |
d696c285 | 415 | const char* fClientName; |
c2646906 A |
416 | const char* fUmbrellaName; |
417 | const char* fInitFunctionName; | |
d696c285 A |
418 | const char* fDotOutputFile; |
419 | const char* fExecutablePath; | |
69a49097 | 420 | const char* fBundleLoader; |
a61fdf0a A |
421 | const char* fDtraceScriptName; |
422 | const char* fSegAddrTablePath; | |
423 | const char* fMapPath; | |
a645023d A |
424 | const char* fDyldInstallPath; |
425 | const char* fTempLtoObjectPath; | |
c2646906 A |
426 | uint64_t fZeroPageSize; |
427 | uint64_t fStackSize; | |
428 | uint64_t fStackAddr; | |
d696c285 | 429 | bool fExecutableStack; |
a645023d A |
430 | bool fNonExecutableHeap; |
431 | bool fDisableNonExecutableHeap; | |
c2646906 | 432 | uint32_t fMinimumHeaderPad; |
55e3d2f6 | 433 | uint64_t fSegmentAlignment; |
c2646906 | 434 | CommonsMode fCommonsMode; |
a645023d | 435 | enum UUIDMode fUUIDMode; |
a61fdf0a A |
436 | SetWithWildcards fLocalSymbolsIncluded; |
437 | SetWithWildcards fLocalSymbolsExcluded; | |
438 | LocalSymbolHandling fLocalSymbolHandling; | |
c2646906 | 439 | bool fWarnCommons; |
6e880c60 | 440 | bool fVerbose; |
d696c285 | 441 | bool fKeepRelocations; |
d696c285 A |
442 | bool fWarnStabs; |
443 | bool fTraceDylibSearching; | |
444 | bool fPause; | |
445 | bool fStatistics; | |
446 | bool fPrintOptions; | |
a61fdf0a A |
447 | bool fSharedRegionEligible; |
448 | bool fPrintOrderFileStatistics; | |
449 | bool fReadOnlyx86Stubs; | |
450 | bool fPositionIndependentExecutable; | |
a645023d | 451 | bool fPIEOnCommandLine; |
d9246299 | 452 | bool fDisablePositionIndependentExecutable; |
a61fdf0a A |
453 | bool fMaxMinimumHeaderPad; |
454 | bool fDeadStripDylibs; | |
2f2f92e4 A |
455 | bool fAllowTextRelocs; |
456 | bool fWarnTextRelocs; | |
457 | bool fUsingLazyDylibLinking; | |
458 | bool fEncryptable; | |
55e3d2f6 A |
459 | bool fOrderData; |
460 | bool fMarkDeadStrippableDylib; | |
55e3d2f6 | 461 | bool fMakeCompressedDyldInfo; |
a645023d | 462 | bool fMakeCompressedDyldInfoForceOff; |
55e3d2f6 A |
463 | bool fNoEHLabels; |
464 | bool fAllowCpuSubtypeMismatches; | |
fb24a050 | 465 | bool fUseSimplifiedDylibReExports; |
a645023d A |
466 | bool fObjCABIVersion2Override; |
467 | bool fObjCABIVersion1Override; | |
468 | bool fCanUseUpwardDylib; | |
469 | bool fFullyLoadArchives; | |
470 | bool fLoadAllObjcObjectsFromArchives; | |
471 | bool fFlatNamespace; | |
472 | bool fLinkingMainExecutable; | |
473 | bool fForFinalLinkedImage; | |
474 | bool fForStatic; | |
475 | bool fForDyld; | |
476 | bool fMakeTentativeDefinitionsReal; | |
477 | bool fWhyLoad; | |
478 | bool fRootSafe; | |
479 | bool fSetuidSafe; | |
480 | bool fImplicitlyLinkPublicDylibs; | |
481 | bool fAddCompactUnwindEncoding; | |
482 | bool fWarnCompactUnwind; | |
483 | bool fRemoveDwarfUnwindIfCompactExists; | |
484 | bool fAutoOrderInitializers; | |
485 | bool fOptimizeZeroFill; | |
afe874b1 | 486 | bool fMergeZeroFill; |
a645023d A |
487 | bool fLogObjectFiles; |
488 | bool fLogAllFiles; | |
489 | bool fTraceDylibs; | |
490 | bool fTraceIndirectDylibs; | |
491 | bool fTraceArchives; | |
492 | bool fOutputSlidable; | |
493 | bool fWarnWeakExports; | |
494 | bool fObjcGcCompaction; | |
495 | bool fObjCGc; | |
496 | bool fObjCGcOnly; | |
497 | bool fDemangle; | |
498 | bool fTLVSupport; | |
499 | bool fVersionLoadCommand; | |
afe874b1 A |
500 | bool fVersionLoadCommandForcedOn; |
501 | bool fVersionLoadCommandForcedOff; | |
a645023d | 502 | bool fFunctionStartsLoadCommand; |
afe874b1 A |
503 | bool fFunctionStartsForcedOn; |
504 | bool fFunctionStartsForcedOff; | |
a645023d A |
505 | bool fCanReExportSymbols; |
506 | bool fObjcCategoryMerging; | |
afe874b1 | 507 | bool fPageAlignDataAtoms; |
a645023d A |
508 | DebugInfoStripping fDebugInfoStripping; |
509 | const char* fTraceOutputFile; | |
510 | ld::MacVersionMin fMacVersionMin; | |
afe874b1 | 511 | ld::IOSVersionMin fIOSVersionMin; |
a645023d | 512 | std::vector<AliasPair> fAliases; |
c2646906 | 513 | std::vector<const char*> fInitialUndefines; |
a61fdf0a | 514 | NameSet fAllowedUndefined; |
69a49097 | 515 | NameSet fWhyLive; |
c2646906 A |
516 | std::vector<ExtraSection> fExtraSections; |
517 | std::vector<SectionAlignment> fSectionAlignments; | |
a61fdf0a A |
518 | std::vector<OrderedSymbol> fOrderedSymbols; |
519 | std::vector<SegmentStart> fCustomSegmentAddresses; | |
55e3d2f6 | 520 | std::vector<SegmentSize> fCustomSegmentSizes; |
a61fdf0a A |
521 | std::vector<SegmentProtect> fCustomSegmentProtections; |
522 | std::vector<DylibOverride> fDylibOverrides; | |
55e3d2f6 | 523 | std::vector<const char*> fLLVMOptions; |
c2646906 A |
524 | std::vector<const char*> fLibrarySearchPaths; |
525 | std::vector<const char*> fFrameworkSearchPaths; | |
6e880c60 | 526 | std::vector<const char*> fSDKPaths; |
a645023d | 527 | std::vector<const char*> fDyldEnvironExtras; |
a61fdf0a | 528 | bool fSaveTempFiles; |
c2646906 A |
529 | }; |
530 | ||
531 | ||
532 | ||
c2646906 | 533 | #endif // __OPTIONS__ |