]> git.saurik.com Git - apple/ld64.git/blame - src/ld/Options.h
ld64-224.1.tar.gz
[apple/ld64.git] / src / ld / Options.h
CommitLineData
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 32#include <vector>
d425e388
A
33#include <unordered_set>
34#include <unordered_map>
c2646906 35
a645023d 36#include "ld.hpp"
ebf6f434 37#include "Snapshot.h"
c2646906 38
fb24a050
A
39extern void throwf (const char* format, ...) __attribute__ ((noreturn,format(printf, 1, 2)));
40extern void warning(const char* format, ...) __attribute__((format(printf, 1, 2)));
c2646906 41
ebf6f434
A
42class Snapshot;
43
55e3d2f6 44class LibraryOptions
c2646906
A
45{
46public:
a645023d 47 LibraryOptions() : fWeakImport(false), fReExport(false), fBundleLoader(false),
f80fe69f
A
48 fLazyLoad(false), fUpward(false), fIndirectDylib(false),
49 fForceLoad(false) {}
55e3d2f6 50 // for dynamic libraries
c2646906
A
51 bool fWeakImport;
52 bool fReExport;
69a49097 53 bool fBundleLoader;
2f2f92e4 54 bool fLazyLoad;
a645023d 55 bool fUpward;
f80fe69f 56 bool fIndirectDylib;
55e3d2f6
A
57 // for static libraries
58 bool fForceLoad;
c2646906
A
59};
60
55e3d2f6
A
61
62
d696c285
A
63//
64// The public interface to the Options class is the abstract representation of what work the linker
65// should do.
66//
67// This abstraction layer will make it easier to support a future where the linker is a shared library
68// invoked directly from Xcode. The target settings in Xcode would be used to directly construct an Options
69// object (without building a command line which is then parsed).
70//
71//
c2646906
A
72class Options
73{
74public:
d696c285
A
75 Options(int argc, const char* argv[]);
76 ~Options();
c2646906 77
55e3d2f6 78 enum OutputKind { kDynamicExecutable, kStaticExecutable, kDynamicLibrary, kDynamicBundle, kObjectFile, kDyld, kPreload, kKextBundle };
c2646906 79 enum NameSpace { kTwoLevelNameSpace, kFlatNameSpace, kForceFlatNameSpace };
d696c285
A
80 // Standard treatment for many options.
81 enum Treatment { kError, kWarning, kSuppress, kNULL, kInvalid };
c2646906 82 enum UndefinedTreatment { kUndefinedError, kUndefinedWarning, kUndefinedSuppress, kUndefinedDynamicLookup };
d696c285
A
83 enum WeakReferenceMismatchTreatment { kWeakReferenceMismatchError, kWeakReferenceMismatchWeak,
84 kWeakReferenceMismatchNonWeak };
c2646906 85 enum CommonsMode { kCommonsIgnoreDylibs, kCommonsOverriddenByDylibs, kCommonsConflictsDylibsError };
a61fdf0a
A
86 enum UUIDMode { kUUIDNone, kUUIDRandom, kUUIDContent };
87 enum LocalSymbolHandling { kLocalSymbolsAll, kLocalSymbolsNone, kLocalSymbolsSelectiveInclude, kLocalSymbolsSelectiveExclude };
a645023d 88 enum DebugInfoStripping { kDebugInfoNone, kDebugInfoMinimal, kDebugInfoFull };
c2646906 89
ebf6f434
A
90 class FileInfo {
91 public:
c2646906
A
92 const char* path;
93 uint64_t fileLen;
d696c285 94 time_t modTime;
55e3d2f6 95 LibraryOptions options;
ebf6f434
A
96 ld::File::Ordinal ordinal;
97 bool fromFileList;
98
99 // These are used by the threaded input file parsing engine.
100 mutable int inputFileSlot; // The input file "slot" assigned to this particular file
101 bool readyToParse;
102
103 // The use pattern for FileInfo is to create one on the stack in a leaf function and return
104 // it to the calling frame by copy. Therefore the copy constructor steals the path string from
105 // the source, which dies with the stack frame.
106 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; };
107
108 // Create an empty FileInfo. The path can be set implicitly by checkFileExists().
109 FileInfo() : path(NULL), fileLen(0), modTime(0), options(), fromFileList(false) {};
110
111 // Create a FileInfo for a specific path, but does not stat the file.
112 FileInfo(const char *_path) : path(strdup(_path)), fileLen(0), modTime(0), options(), fromFileList(false) {};
113
114 ~FileInfo() { if (path) ::free((void*)path); }
115
116 // Stat the file and update fileLen and modTime.
117 // If the object already has a path the p must be NULL.
118 // 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.
119 // Returns true if the file exists, false if not.
f80fe69f 120 bool checkFileExists(const Options& options, const char *p=NULL);
ebf6f434
A
121
122 // Returns true if a previous call to checkFileExists() succeeded.
123 // Returns false if the file does not exist of checkFileExists() has never been called.
124 bool missing() const { return modTime==0; }
f80fe69f 125 };
d696c285 126
c2646906
A
127 struct ExtraSection {
128 const char* segmentName;
129 const char* sectionName;
130 const char* path;
131 const uint8_t* data;
132 uint64_t dataLen;
a645023d
A
133 typedef ExtraSection* iterator;
134 typedef const ExtraSection* const_iterator;
c2646906 135 };
d696c285 136
c2646906
A
137 struct SectionAlignment {
138 const char* segmentName;
139 const char* sectionName;
140 uint8_t alignment;
141 };
142
a61fdf0a
A
143 struct OrderedSymbol {
144 const char* symbolName;
145 const char* objectFileName;
146 };
a645023d 147 typedef const OrderedSymbol* OrderedSymbolsIterator;
a61fdf0a
A
148
149 struct SegmentStart {
150 const char* name;
151 uint64_t address;
152 };
153
55e3d2f6
A
154 struct SegmentSize {
155 const char* name;
156 uint64_t size;
157 };
158
a61fdf0a
A
159 struct SegmentProtect {
160 const char* name;
161 uint32_t max;
162 uint32_t init;
163 };
164
165 struct DylibOverride {
166 const char* installName;
167 const char* useInstead;
168 };
169
a645023d
A
170 struct AliasPair {
171 const char* realName;
172 const char* alias;
173 };
174
f80fe69f
A
175 enum { depLinkerVersion=0x00, depObjectFile=0x10, depDirectDylib=0x10, depIndirectDylib=0x10,
176 depUpwardDirectDylib=0x10, depUpwardIndirectDylib=0x10, depArchive=0x10,
177 depFileList=0x10, depSection=0x10, depBundleLoader=0x10, depMisc=0x10, depNotFound=0x11,
178 depOutputFile = 0x40 };
179
180 void dumpDependency(uint8_t, const char* path) const;
181
a645023d 182 typedef const char* const* UndefinesIterator;
a61fdf0a 183
a645023d
A
184// const ObjectFile::ReaderOptions& readerOptions();
185 const char* outputFilePath() const { return fOutputFile; }
186 const std::vector<FileInfo>& getInputFiles() const { return fInputFiles; }
d696c285 187
a645023d
A
188 cpu_type_t architecture() const { return fArchitecture; }
189 bool preferSubArchitecture() const { return fHasPreferredSubType; }
190 cpu_subtype_t subArchitecture() const { return fSubArchitecture; }
191 bool allowSubArchitectureMismatches() const { return fAllowCpuSubtypeMismatches; }
192 bool forceCpuSubtypeAll() const { return fForceSubtypeAll; }
193 const char* architectureName() const { return fArchitectureName; }
194 void setArchitecture(cpu_type_t, cpu_subtype_t subtype);
afe874b1 195 bool archSupportsThumb2() const { return fArchSupportsThumb2; }
a645023d
A
196 OutputKind outputKind() const { return fOutputKind; }
197 bool prebind() const { return fPrebind; }
198 bool bindAtLoad() const { return fBindAtLoad; }
199 NameSpace nameSpace() const { return fNameSpace; }
200 const char* installPath() const; // only for kDynamicLibrary
b2fa67a8
A
201 uint64_t currentVersion() const { return fDylibCurrentVersion; } // only for kDynamicLibrary
202 uint32_t currentVersion32() const; // only for kDynamicLibrary
a645023d
A
203 uint32_t compatibilityVersion() const { return fDylibCompatVersion; } // only for kDynamicLibrary
204 const char* entryName() const { return fEntryName; } // only for kDynamicExecutable or kStaticExecutable
d696c285 205 const char* executablePath();
a645023d
A
206 uint64_t baseAddress() const { return fBaseAddress; }
207 uint64_t maxAddress() const { return fMaxAddress; }
208 bool keepPrivateExterns() const { return fKeepPrivateExterns; } // only for kObjectFile
209 bool needsModuleTable() const { return fNeedsModuleTable; } // only for kDynamicLibrary
210 bool interposable(const char* name) const;
211 bool hasExportRestrictList() const { return (fExportMode != kExportDefault); } // -exported_symbol or -unexported_symbol
212 bool hasExportMaskList() const { return (fExportMode == kExportSome); } // just -exported_symbol
213 bool hasWildCardExportRestrictList() const;
214 bool hasReExportList() const { return ! fReExportSymbols.empty(); }
215 bool wasRemovedExport(const char* sym) const { return ( fRemovedExports.find(sym) != fRemovedExports.end() ); }
216 bool allGlobalsAreDeadStripRoots() const;
217 bool shouldExport(const char*) const;
218 bool shouldReExport(const char*) const;
219 bool ignoreOtherArchInputFiles() const { return fIgnoreOtherArchFiles; }
220 bool traceDylibs() const { return fTraceDylibs; }
221 bool traceArchives() const { return fTraceArchives; }
222 bool deadCodeStrip() const { return fDeadStrip; }
223 UndefinedTreatment undefinedTreatment() const { return fUndefinedTreatment; }
224 ld::MacVersionMin macosxVersionMin() const { return fMacVersionMin; }
afe874b1
A
225 ld::IOSVersionMin iOSVersionMin() const { return fIOSVersionMin; }
226 bool minOS(ld::MacVersionMin mac, ld::IOSVersionMin iPhoneOS);
c2646906 227 bool messagesPrefixedWithArchitecture();
d696c285 228 Treatment picTreatment();
a645023d
A
229 WeakReferenceMismatchTreatment weakReferenceMismatchTreatment() const { return fWeakReferenceMismatchTreatment; }
230 const char* umbrellaName() const { return fUmbrellaName; }
231 const std::vector<const char*>& allowableClients() const { return fAllowableClients; }
232 const char* clientName() const { return fClientName; }
233 const char* initFunctionName() const { return fInitFunctionName; } // only for kDynamicLibrary
d696c285 234 const char* dotOutputFile();
a645023d
A
235 uint64_t pageZeroSize() const { return fZeroPageSize; }
236 bool hasCustomStack() const { return (fStackSize != 0); }
237 uint64_t customStackSize() const { return fStackSize; }
238 uint64_t customStackAddr() const { return fStackAddr; }
239 bool hasExecutableStack() const { return fExecutableStack; }
240 bool hasNonExecutableHeap() const { return fNonExecutableHeap; }
241 UndefinesIterator initialUndefinesBegin() const { return &fInitialUndefines[0]; }
242 UndefinesIterator initialUndefinesEnd() const { return &fInitialUndefines[fInitialUndefines.size()]; }
243 bool printWhyLive(const char* name) const;
244 uint32_t minimumHeaderPad() const { return fMinimumHeaderPad; }
245 bool maxMminimumHeaderPad() const { return fMaxMinimumHeaderPad; }
246 ExtraSection::const_iterator extraSectionsBegin() const { return &fExtraSections[0]; }
247 ExtraSection::const_iterator extraSectionsEnd() const { return &fExtraSections[fExtraSections.size()]; }
248 CommonsMode commonsMode() const { return fCommonsMode; }
249 bool warnCommons() const { return fWarnCommons; }
d696c285 250 bool keepRelocations();
a645023d
A
251 FileInfo findFile(const char* path) const;
252 UUIDMode UUIDMode() const { return fUUIDMode; }
d696c285
A
253 bool warnStabs();
254 bool pauseAtEnd() { return fPause; }
a645023d
A
255 bool printStatistics() const { return fStatistics; }
256 bool printArchPrefix() const { return fMessagesPrefixedWithArchitecture; }
a61fdf0a 257 void gotoClassicLinker(int argc, const char* argv[]);
a645023d
A
258 bool sharedRegionEligible() const { return fSharedRegionEligible; }
259 bool printOrderFileStatistics() const { return fPrintOrderFileStatistics; }
a61fdf0a
A
260 const char* dTraceScriptName() { return fDtraceScriptName; }
261 bool dTrace() { return (fDtraceScriptName != NULL); }
a645023d
A
262 unsigned long orderedSymbolsCount() const { return fOrderedSymbols.size(); }
263 OrderedSymbolsIterator orderedSymbolsBegin() const { return &fOrderedSymbols[0]; }
264 OrderedSymbolsIterator orderedSymbolsEnd() const { return &fOrderedSymbols[fOrderedSymbols.size()]; }
265 bool splitSeg() const { return fSplitSegs; }
a61fdf0a 266 uint64_t baseWritableAddress() { return fBaseWritableAddress; }
a645023d
A
267 uint64_t segmentAlignment() const { return fSegmentAlignment; }
268 uint64_t segPageSize(const char* segName) const;
269 uint64_t customSegmentAddress(const char* segName) const;
270 bool hasCustomSegmentAddress(const char* segName) const;
271 bool hasCustomSectionAlignment(const char* segName, const char* sectName) const;
272 uint8_t customSectionAlignment(const char* segName, const char* sectName) const;
273 uint32_t initialSegProtection(const char*) const;
274 uint32_t maxSegProtection(const char*) const;
275 bool saveTempFiles() const { return fSaveTempFiles; }
276 const std::vector<const char*>& rpaths() const { return fRPaths; }
a61fdf0a 277 bool readOnlyx86Stubs() { return fReadOnlyx86Stubs; }
a645023d
A
278 const std::vector<DylibOverride>& dylibOverrides() const { return fDylibOverrides; }
279 const char* generatedMapPath() const { return fMapPath; }
280 bool positionIndependentExecutable() const { return fPositionIndependentExecutable; }
281 Options::FileInfo findFileUsingPaths(const char* path) const;
282 bool deadStripDylibs() const { return fDeadStripDylibs; }
283 bool allowedUndefined(const char* name) const { return ( fAllowedUndefined.find(name) != fAllowedUndefined.end() ); }
284 bool someAllowedUndefines() const { return (fAllowedUndefined.size() != 0); }
a61fdf0a 285 LocalSymbolHandling localSymbolHandling() { return fLocalSymbolHandling; }
a645023d
A
286 bool keepLocalSymbol(const char* symbolName) const;
287 bool allowTextRelocs() const { return fAllowTextRelocs; }
288 bool warnAboutTextRelocs() const { return fWarnTextRelocs; }
ebf6f434 289 bool kextsUseStubs() const { return fKextsUseStubs; }
a645023d
A
290 bool usingLazyDylibLinking() const { return fUsingLazyDylibLinking; }
291 bool verbose() const { return fVerbose; }
292 bool makeEncryptable() const { return fEncryptable; }
293 bool needsUnwindInfoSection() const { return fAddCompactUnwindEncoding; }
294 const std::vector<const char*>& llvmOptions() const{ return fLLVMOptions; }
295 const std::vector<const char*>& dyldEnvironExtras() const{ return fDyldEnvironExtras; }
296 bool makeCompressedDyldInfo() const { return fMakeCompressedDyldInfo; }
55e3d2f6 297 bool hasExportedSymbolOrder();
a645023d 298 bool exportedSymbolOrder(const char* sym, unsigned int* order) const;
55e3d2f6 299 bool orderData() { return fOrderData; }
a645023d
A
300 bool errorOnOtherArchFiles() const { return fErrorOnOtherArchFiles; }
301 bool markAutoDeadStripDylib() const { return fMarkDeadStrippableDylib; }
302 bool removeEHLabels() const { return fNoEHLabels; }
303 bool useSimplifiedDylibReExports() const { return fUseSimplifiedDylibReExports; }
304 bool objCABIVersion2POverride() const { return fObjCABIVersion2Override; }
305 bool useUpwardDylibs() const { return fCanUseUpwardDylib; }
306 bool fullyLoadArchives() const { return fFullyLoadArchives; }
307 bool loadAllObjcObjectsFromArchives() const { return fLoadAllObjcObjectsFromArchives; }
308 bool autoOrderInitializers() const { return fAutoOrderInitializers; }
309 bool optimizeZeroFill() const { return fOptimizeZeroFill; }
afe874b1 310 bool mergeZeroFill() const { return fMergeZeroFill; }
a645023d
A
311 bool logAllFiles() const { return fLogAllFiles; }
312 DebugInfoStripping debugInfoStripping() const { return fDebugInfoStripping; }
313 bool flatNamespace() const { return fFlatNamespace; }
314 bool linkingMainExecutable() const { return fLinkingMainExecutable; }
315 bool implicitlyLinkIndirectPublicDylibs() const { return fImplicitlyLinkPublicDylibs; }
316 bool whyLoad() const { return fWhyLoad; }
317 const char* traceOutputFile() const { return fTraceOutputFile; }
318 bool outputSlidable() const { return fOutputSlidable; }
319 bool haveCmdLineAliases() const { return (fAliases.size() != 0); }
320 const std::vector<AliasPair>& cmdLineAliases() const { return fAliases; }
321 bool makeTentativeDefinitionsReal() const { return fMakeTentativeDefinitionsReal; }
322 const char* dyldInstallPath() const { return fDyldInstallPath; }
323 bool warnWeakExports() const { return fWarnWeakExports; }
324 bool objcGcCompaction() const { return fObjcGcCompaction; }
325 bool objcGc() const { return fObjCGc; }
326 bool objcGcOnly() const { return fObjCGcOnly; }
327 bool canUseThreadLocalVariables() const { return fTLVSupport; }
a645023d
A
328 bool addVersionLoadCommand() const { return fVersionLoadCommand; }
329 bool addFunctionStarts() const { return fFunctionStartsLoadCommand; }
ebf6f434 330 bool addDataInCodeInfo() const { return fDataInCodeInfoLoadCommand; }
a645023d
A
331 bool canReExportSymbols() const { return fCanReExportSymbols; }
332 const char* tempLtoObjectPath() const { return fTempLtoObjectPath; }
ebf6f434 333 const char* overridePathlibLTO() const { return fOverridePathlibLTO; }
f80fe69f 334 const char* mcpuLTO() const { return fLtoCpu; }
a645023d 335 bool objcCategoryMerging() const { return fObjcCategoryMerging; }
afe874b1 336 bool pageAlignDataAtoms() const { return fPageAlignDataAtoms; }
f80fe69f
A
337 bool keepDwarfUnwind() const { return fKeepDwarfUnwind; }
338 bool generateDtraceDOF() const { return fGenerateDtraceDOF; }
a645023d
A
339 bool hasWeakBitTweaks() const;
340 bool forceWeak(const char* symbolName) const;
341 bool forceNotWeak(const char* symbolName) const;
342 bool forceWeakNonWildCard(const char* symbolName) const;
343 bool forceNotWeakNonWildcard(const char* symbolName) const;
f80fe69f 344 bool forceCoalesce(const char* symbolName) const;
ebf6f434 345 Snapshot& snapshot() const { return fLinkSnapshot; }
b2fa67a8 346 bool errorBecauseOfWarnings() const;
ebf6f434
A
347 bool needsThreadLoadCommand() const { return fNeedsThreadLoadCommand; }
348 bool needsEntryPointLoadCommand() const { return fEntryPointLoadCommand; }
349 bool needsSourceVersionLoadCommand() const { return fSourceVersionLoadCommand; }
350 bool needsDependentDRInfo() const { return fDependentDRInfo; }
f80fe69f
A
351 bool canUseAbsoluteSymbols() const { return fAbsoluteSymbols; }
352 bool allowSimulatorToLinkWithMacOSX() const { return fAllowSimulatorToLinkWithMacOSX; }
ebf6f434
A
353 uint64_t sourceVersion() const { return fSourceVersion; }
354 uint32_t sdkVersion() const { return fSDKVersion; }
355 const char* demangleSymbol(const char* sym) const;
356 bool pipelineEnabled() const { return fPipelineFifo != NULL; }
357 const char* pipelineFifo() const { return fPipelineFifo; }
f80fe69f
A
358 bool dumpDependencyInfo() const { return (fDependencyInfoPath != NULL); }
359 const char* dependencyInfoPath() const { return fDependencyInfoPath; }
360 bool targetIOSSimulator() const { return fTargetIOSSimulator; }
361 ld::relocatable::File::LinkerOptionsList&
362 linkerOptions() const { return fLinkerOptions; }
363 FileInfo findFramework(const char* frameworkName) const;
364 FileInfo findLibrary(const char* rootName, bool dylibsOnly=false) const;
365
c2646906 366private:
d425e388
A
367 typedef std::unordered_map<const char*, unsigned int, ld::CStringHash, ld::CStringEquals> NameToOrder;
368 typedef std::unordered_set<const char*, ld::CStringHash, ld::CStringEquals> NameSet;
c2646906
A
369 enum ExportMode { kExportDefault, kExportSome, kDontExportSome };
370 enum LibrarySearchMode { kSearchDylibAndArchiveInEachDir, kSearchAllDirsForDylibsThenAllDirsForArchives };
2f2f92e4 371 enum InterposeMode { kInterposeNone, kInterposeAllExternal, kInterposeSome };
c2646906 372
a61fdf0a
A
373 class SetWithWildcards {
374 public:
375 void insert(const char*);
a645023d
A
376 bool contains(const char*) const;
377 bool containsNonWildcard(const char*) const;
378 bool empty() const { return fRegular.empty() && fWildCard.empty(); }
379 bool hasWildCards() const { return !fWildCard.empty(); }
380 NameSet::iterator regularBegin() const { return fRegular.begin(); }
381 NameSet::iterator regularEnd() const { return fRegular.end(); }
382 void remove(const NameSet&);
a61fdf0a 383 private:
2f2f92e4 384 static bool hasWildCards(const char*);
a645023d
A
385 bool wildCardMatch(const char* pattern, const char* candidate) const;
386 bool inCharRange(const char*& range, unsigned char c) const;
a61fdf0a
A
387
388 NameSet fRegular;
389 std::vector<const char*> fWildCard;
390 };
391
392
c2646906
A
393 void parse(int argc, const char* argv[]);
394 void checkIllegalOptionCombinations();
395 void buildSearchPaths(int argc, const char* argv[]);
396 void parseArch(const char* architecture);
f80fe69f 397 FileInfo findFramework(const char* rootName, const char* suffix) const;
d696c285 398 bool checkForFile(const char* format, const char* dir, const char* rootName,
a645023d 399 FileInfo& result) const;
b2fa67a8
A
400 uint64_t parseVersionNumber64(const char*);
401 uint32_t parseVersionNumber32(const char*);
c2646906 402 void parseSectionOrderFile(const char* segment, const char* section, const char* path);
a61fdf0a 403 void parseOrderFile(const char* path, bool cstring);
c2646906
A
404 void addSection(const char* segment, const char* section, const char* path);
405 void addSubLibrary(const char* name);
ebf6f434 406 void loadFileList(const char* fileOfPaths, ld::File::Ordinal baseOrdinal);
c2646906 407 uint64_t parseAddress(const char* addr);
a61fdf0a
A
408 void loadExportFile(const char* fileOfExports, const char* option, SetWithWildcards& set);
409 void parseAliasFile(const char* fileOfAliases);
c2646906
A
410 void parsePreCommandLineEnvironmentSettings();
411 void parsePostCommandLineEnvironmentSettings();
412 void setUndefinedTreatment(const char* treatment);
2f2f92e4 413 void setMacOSXVersionMin(const char* version);
afe874b1 414 void setIOSVersionMin(const char* version);
c2646906 415 void setWeakReferenceMismatchTreatment(const char* treatment);
a61fdf0a 416 void addDylibOverride(const char* paths);
c2646906
A
417 void addSectionAlignment(const char* segment, const char* section, const char* alignment);
418 CommonsMode parseCommonsTreatment(const char* mode);
d696c285 419 Treatment parseTreatment(const char* treatment);
69a49097 420 void reconfigureDefaults();
a61fdf0a
A
421 void checkForClassic(int argc, const char* argv[]);
422 void parseSegAddrTable(const char* segAddrPath, const char* installPath);
423 void addLibrary(const FileInfo& info);
424 void warnObsolete(const char* arg);
425 uint32_t parseProtection(const char* prot);
55e3d2f6 426 void loadSymbolOrderFile(const char* fileOfExports, NameToOrder& orderMapping);
d696c285
A
427
428
a645023d
A
429
430// ObjectFile::ReaderOptions fReaderOptions;
c2646906
A
431 const char* fOutputFile;
432 std::vector<Options::FileInfo> fInputFiles;
433 cpu_type_t fArchitecture;
2f2f92e4 434 cpu_subtype_t fSubArchitecture;
a645023d 435 const char* fArchitectureName;
c2646906 436 OutputKind fOutputKind;
2f2f92e4 437 bool fHasPreferredSubType;
afe874b1 438 bool fArchSupportsThumb2;
d696c285 439 bool fPrebind;
c2646906 440 bool fBindAtLoad;
c2646906 441 bool fKeepPrivateExterns;
a61fdf0a 442 bool fNeedsModuleTable;
c2646906 443 bool fIgnoreOtherArchFiles;
55e3d2f6 444 bool fErrorOnOtherArchFiles;
c2646906 445 bool fForceSubtypeAll;
2f2f92e4 446 InterposeMode fInterposeMode;
a645023d 447 bool fDeadStrip;
c2646906
A
448 NameSpace fNameSpace;
449 uint32_t fDylibCompatVersion;
b2fa67a8 450 uint64_t fDylibCurrentVersion;
c2646906 451 const char* fDylibInstallName;
a61fdf0a 452 const char* fFinalName;
c2646906
A
453 const char* fEntryName;
454 uint64_t fBaseAddress;
a645023d 455 uint64_t fMaxAddress;
a61fdf0a
A
456 uint64_t fBaseWritableAddress;
457 bool fSplitSegs;
458 SetWithWildcards fExportSymbols;
459 SetWithWildcards fDontExportSymbols;
2f2f92e4 460 SetWithWildcards fInterposeList;
a645023d
A
461 SetWithWildcards fForceWeakSymbols;
462 SetWithWildcards fForceNotWeakSymbols;
463 SetWithWildcards fReExportSymbols;
f80fe69f 464 SetWithWildcards fForceCoalesceSymbols;
a645023d 465 NameSet fRemovedExports;
55e3d2f6 466 NameToOrder fExportSymbolsOrder;
c2646906
A
467 ExportMode fExportMode;
468 LibrarySearchMode fLibrarySearchMode;
469 UndefinedTreatment fUndefinedTreatment;
470 bool fMessagesPrefixedWithArchitecture;
c2646906
A
471 WeakReferenceMismatchTreatment fWeakReferenceMismatchTreatment;
472 std::vector<const char*> fSubUmbellas;
473 std::vector<const char*> fSubLibraries;
d696c285 474 std::vector<const char*> fAllowableClients;
a61fdf0a 475 std::vector<const char*> fRPaths;
d696c285 476 const char* fClientName;
c2646906
A
477 const char* fUmbrellaName;
478 const char* fInitFunctionName;
d696c285
A
479 const char* fDotOutputFile;
480 const char* fExecutablePath;
69a49097 481 const char* fBundleLoader;
a61fdf0a
A
482 const char* fDtraceScriptName;
483 const char* fSegAddrTablePath;
484 const char* fMapPath;
a645023d
A
485 const char* fDyldInstallPath;
486 const char* fTempLtoObjectPath;
ebf6f434 487 const char* fOverridePathlibLTO;
f80fe69f 488 const char* fLtoCpu;
c2646906
A
489 uint64_t fZeroPageSize;
490 uint64_t fStackSize;
491 uint64_t fStackAddr;
ebf6f434
A
492 uint64_t fSourceVersion;
493 uint32_t fSDKVersion;
d696c285 494 bool fExecutableStack;
a645023d
A
495 bool fNonExecutableHeap;
496 bool fDisableNonExecutableHeap;
c2646906 497 uint32_t fMinimumHeaderPad;
55e3d2f6 498 uint64_t fSegmentAlignment;
c2646906 499 CommonsMode fCommonsMode;
a645023d 500 enum UUIDMode fUUIDMode;
a61fdf0a
A
501 SetWithWildcards fLocalSymbolsIncluded;
502 SetWithWildcards fLocalSymbolsExcluded;
503 LocalSymbolHandling fLocalSymbolHandling;
c2646906 504 bool fWarnCommons;
6e880c60 505 bool fVerbose;
d696c285 506 bool fKeepRelocations;
d696c285
A
507 bool fWarnStabs;
508 bool fTraceDylibSearching;
509 bool fPause;
510 bool fStatistics;
511 bool fPrintOptions;
a61fdf0a
A
512 bool fSharedRegionEligible;
513 bool fPrintOrderFileStatistics;
514 bool fReadOnlyx86Stubs;
515 bool fPositionIndependentExecutable;
a645023d 516 bool fPIEOnCommandLine;
d9246299 517 bool fDisablePositionIndependentExecutable;
a61fdf0a
A
518 bool fMaxMinimumHeaderPad;
519 bool fDeadStripDylibs;
2f2f92e4
A
520 bool fAllowTextRelocs;
521 bool fWarnTextRelocs;
ebf6f434 522 bool fKextsUseStubs;
2f2f92e4
A
523 bool fUsingLazyDylibLinking;
524 bool fEncryptable;
55e3d2f6
A
525 bool fOrderData;
526 bool fMarkDeadStrippableDylib;
55e3d2f6 527 bool fMakeCompressedDyldInfo;
a645023d 528 bool fMakeCompressedDyldInfoForceOff;
55e3d2f6
A
529 bool fNoEHLabels;
530 bool fAllowCpuSubtypeMismatches;
fb24a050 531 bool fUseSimplifiedDylibReExports;
a645023d
A
532 bool fObjCABIVersion2Override;
533 bool fObjCABIVersion1Override;
534 bool fCanUseUpwardDylib;
535 bool fFullyLoadArchives;
536 bool fLoadAllObjcObjectsFromArchives;
537 bool fFlatNamespace;
538 bool fLinkingMainExecutable;
539 bool fForFinalLinkedImage;
540 bool fForStatic;
541 bool fForDyld;
542 bool fMakeTentativeDefinitionsReal;
543 bool fWhyLoad;
544 bool fRootSafe;
545 bool fSetuidSafe;
546 bool fImplicitlyLinkPublicDylibs;
547 bool fAddCompactUnwindEncoding;
548 bool fWarnCompactUnwind;
549 bool fRemoveDwarfUnwindIfCompactExists;
550 bool fAutoOrderInitializers;
551 bool fOptimizeZeroFill;
afe874b1 552 bool fMergeZeroFill;
a645023d
A
553 bool fLogObjectFiles;
554 bool fLogAllFiles;
555 bool fTraceDylibs;
556 bool fTraceIndirectDylibs;
557 bool fTraceArchives;
558 bool fOutputSlidable;
559 bool fWarnWeakExports;
560 bool fObjcGcCompaction;
561 bool fObjCGc;
562 bool fObjCGcOnly;
563 bool fDemangle;
564 bool fTLVSupport;
565 bool fVersionLoadCommand;
afe874b1
A
566 bool fVersionLoadCommandForcedOn;
567 bool fVersionLoadCommandForcedOff;
a645023d 568 bool fFunctionStartsLoadCommand;
afe874b1
A
569 bool fFunctionStartsForcedOn;
570 bool fFunctionStartsForcedOff;
ebf6f434 571 bool fDataInCodeInfoLoadCommand;
b1f7435d
A
572 bool fDataInCodeInfoLoadCommandForcedOn;
573 bool fDataInCodeInfoLoadCommandForcedOff;
a645023d
A
574 bool fCanReExportSymbols;
575 bool fObjcCategoryMerging;
afe874b1 576 bool fPageAlignDataAtoms;
ebf6f434
A
577 bool fNeedsThreadLoadCommand;
578 bool fEntryPointLoadCommand;
579 bool fEntryPointLoadCommandForceOn;
580 bool fEntryPointLoadCommandForceOff;
581 bool fSourceVersionLoadCommand;
582 bool fSourceVersionLoadCommandForceOn;
583 bool fSourceVersionLoadCommandForceOff;
584 bool fDependentDRInfo;
585 bool fDependentDRInfoForcedOn;
586 bool fDependentDRInfoForcedOff;
f80fe69f
A
587 bool fTargetIOSSimulator;
588 bool fExportDynamic;
589 bool fAbsoluteSymbols;
590 bool fAllowSimulatorToLinkWithMacOSX;
591 bool fKeepDwarfUnwind;
592 bool fKeepDwarfUnwindForcedOn;
593 bool fKeepDwarfUnwindForcedOff;
594 bool fGenerateDtraceDOF;
a645023d
A
595 DebugInfoStripping fDebugInfoStripping;
596 const char* fTraceOutputFile;
597 ld::MacVersionMin fMacVersionMin;
afe874b1 598 ld::IOSVersionMin fIOSVersionMin;
a645023d 599 std::vector<AliasPair> fAliases;
c2646906 600 std::vector<const char*> fInitialUndefines;
a61fdf0a 601 NameSet fAllowedUndefined;
69a49097 602 NameSet fWhyLive;
c2646906
A
603 std::vector<ExtraSection> fExtraSections;
604 std::vector<SectionAlignment> fSectionAlignments;
a61fdf0a
A
605 std::vector<OrderedSymbol> fOrderedSymbols;
606 std::vector<SegmentStart> fCustomSegmentAddresses;
55e3d2f6 607 std::vector<SegmentSize> fCustomSegmentSizes;
a61fdf0a
A
608 std::vector<SegmentProtect> fCustomSegmentProtections;
609 std::vector<DylibOverride> fDylibOverrides;
55e3d2f6 610 std::vector<const char*> fLLVMOptions;
c2646906
A
611 std::vector<const char*> fLibrarySearchPaths;
612 std::vector<const char*> fFrameworkSearchPaths;
6e880c60 613 std::vector<const char*> fSDKPaths;
a645023d 614 std::vector<const char*> fDyldEnvironExtras;
f80fe69f 615 std::vector< std::vector<const char*> > fLinkerOptions;
a61fdf0a 616 bool fSaveTempFiles;
f80fe69f
A
617 mutable Snapshot fLinkSnapshot;
618 bool fSnapshotRequested;
619 const char* fPipelineFifo;
620 const char* fDependencyInfoPath;
621 mutable int fDependencyFileDescriptor;
c2646906
A
622};
623
624
625
c2646906 626#endif // __OPTIONS__