1//===- Options.td ---------------------------------------------------------===//
2//
3//                     The MCLinker Project
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9include "llvm/Option/OptParser.td"
10
11//===----------------------------------------------------------------------===//
12// Dynamic
13//===----------------------------------------------------------------------===//
14def DynamicGroup : OptionGroup<"dynamic">,
15                   HelpText<"DYNAMIC OPTIONS">;
16
17def Entry : Joined<["--"], "entry=">,
18            Group<DynamicGroup>,
19            HelpText<"Use the explicit symbol as the entrance of your program">;
20def EntryAlias : Separate<["-"], "e">,
21                 Alias<Entry>;
22
23def Bsymbolic : Flag<["-"], "Bsymbolic">,
24                Group<DynamicGroup>,
25                HelpText<"Bind references within the shared library">;
26
27def Bgroup : Flag<["-"], "Bgroup">,
28             Group<DynamicGroup>,
29             HelpText<"Info the dynamic linker to lookup only inside the group">;
30
31def SOName : Joined<["-"], "soname=">,
32             Group<DynamicGroup>,
33             HelpText<"Set internal name of shared library">;
34def SONameAlias : Separate<["-"], "soname">,
35                  Group<DynamicGroup>,
36                  Alias<SOName>;
37
38def NoUndef : Flag<["--"], "no-undefined">,
39              Group<DynamicGroup>,
40              HelpText<"Do not allow unresolved references">;
41
42def AllowMulDefs : Flag<["--"], "allow-multiple-definition">,
43                   Group<DynamicGroup>,
44                   HelpText<"Allow multiple definitions">;
45
46def Z : Separate<["-"], "z">,
47        Group<DynamicGroup>,
48        HelpText<"Extensions for GNU ld compatibility">;
49
50def Dyld : Joined<["--"], "dynamic-linker=">,
51           Group<DynamicGroup>,
52           HelpText<"Set the name of the dynamic linker">;
53def DyldAlias : Separate<["-"], "dynamic-linker">,
54                Group<DynamicGroup>,
55                Alias<Dyld>;
56
57def EnableNewDTags : Flag<["--"], "enable-new-dtags">,
58                     Group<DynamicGroup>,
59                     HelpText<"Enable use of DT_RUNPATH and DT_FLAGS">;
60
61def SpareDTags: Separate<["--"], "spare-dynamic-tags">,
62                Group<DynamicGroup>,
63                HelpText<"Set the number of spare dyanmic tags (DT_NULL)">;
64
65//===----------------------------------------------------------------------===//
66// Optimization
67//===----------------------------------------------------------------------===//
68def OptimizationGroup : OptionGroup<"optimization">,
69                        HelpText<"OPTIMIZATION OPTIONS">;
70
71def GCSections : Flag<["--"], "gc-sections">,
72                 Group<OptimizationGroup>,
73                 HelpText<"Enable garbage collection of unused input sections">;
74
75def NoGCSections : Flag<["--"], "no-gc-sections">,
76                   Group<OptimizationGroup>,
77                   HelpText<"Disable garbage collection of unused input sections">;
78
79def PrintGCSections : Flag<["--"], "print-gc-sections">,
80                      Group<OptimizationGroup>,
81                      HelpText<"List all sections removed by garbage collection">;
82
83def NoPrintGCSections : Flag<["--"], "no-print-gc-sections">,
84                        Group<OptimizationGroup>,
85                        HelpText<"Do not list sections removed by garbage collection">;
86
87def LDGeneratedUnwindInfo : Flag<["--"], "ld-generated-unwind-info">,
88                            Group<OptimizationGroup>,
89                            HelpText<"Request creation of unwind info for linker generated code sections like PLT">;
90
91def NoLDGeneratedUnwindInfo : Flag<["--"], "no-ld-generated-unwind-info">,
92                              Group<OptimizationGroup>,
93                              HelpText<"Don't create unwind info for linker generated sections to save size">;
94
95def ICF : Joined<["--"], "icf=">,
96          Group<OptimizationGroup>,
97          HelpText<"Identical Code Folding">;
98
99def ICFIters : Separate<["--"], "icf-iterations">,
100               Group<OptimizationGroup>,
101               HelpText<"Set number of iterations to do ICF">;
102
103def PrintICFSections : Flag<["--"], "print-icf-sections">,
104                       Group<OptimizationGroup>,
105                       HelpText<"List all sections folded by ICF">;
106
107def NoPrintICFSections : Flag<["--"], "no-print-icf-sections">,
108                         Group<OptimizationGroup>,
109                         HelpText<"Do not list sections folded by ICF">;
110
111//===----------------------------------------------------------------------===//
112// Output
113//===----------------------------------------------------------------------===//
114def OutputGroup : OptionGroup<"output">,
115                  HelpText<"OUTPUT OPTIONS">;
116
117def Output : Separate<["-"], "o">,
118             Group<OutputGroup>,
119             HelpText<"Output filename">;
120def OutputAlias : Joined<["--"], "output=">,
121                  Group<OutputGroup>,
122                  Alias<Output>;
123
124def OutputFormat: Joined<["--"], "oformat=">,
125                  Group<OutputGroup>,
126                  HelpText<"Output format">;
127
128def Shared : Flag<["-"], "shared">,
129             Group<OutputGroup>,
130             HelpText<"Create a shared library">;
131def Bshareable : Flag<["-"], "Bshareable">,
132                 Group<OutputGroup>,
133                 Alias<Shared>;
134
135def Bdynamic : Flag<["-"], "Bdynamic">,
136               Group<OutputGroup>,
137               HelpText<"Link against dynamic library">;
138def BdynamicAlias1 : Flag<["-"], "dy">,
139                     Group<OutputGroup>,
140                     Alias<Bdynamic>;
141def BdynamicAlias2 : Flag<["-"], "call_shared">,
142                     Group<OutputGroup>,
143                     Alias<Bdynamic>;
144
145def Bstatic : Flag<["-"], "Bstatic">,
146              Group<OutputGroup>,
147              HelpText<"Link against static library">;
148def BstaticAlias1 : Flag<["-"], "dn">,
149                    Group<OutputGroup>,
150                    Alias<Bstatic>;
151def BstaticAlias2 : Flag<["-"], "non_shared">,
152                    Group<OutputGroup>,
153                    Alias<Bstatic>;
154def BstaticAlias3 : Flag<["-"], "static">,
155                    Group<OutputGroup>,
156                    Alias<Bstatic>;
157
158def PIE : Flag<["-"], "pie">,
159          Group<OutputGroup>,
160          HelpText<"Emit a position-independent executable file">;
161def PICExec : Flag<["--"], "pic-executable">,
162              Group<OutputGroup>,
163              Alias<PIE>;
164
165def Relocatable : Flag<["--"], "relocatable">,
166                  Group<OutputGroup>,
167                  HelpText<"Generate relocatable output">;
168def RelocatableAlias : Flag<["-"], "r">,
169                       Group<OutputGroup>,
170                       Alias<Relocatable>;
171
172def InputFormat : Joined<["--"], "format=">,
173                  Group<OutputGroup>,
174                  HelpText<"Specify the binary format for input object files that follow this option on the command line">;
175def InputFormatAlias : Separate<["-"], "b">,
176                       Group<OutputGroup>,
177                       Alias<InputFormat>;
178
179def StripDebug : Flag<["--"], "strip-debug">,
180                 Group<OutputGroup>,
181                 HelpText<"Omit debugger symbol information from the output file">;
182def StripDebugAlias : Flag<["-"], "S">,
183                      Group<OutputGroup>,
184                      Alias<StripDebug>;
185
186def StripAll : Flag<["--"], "strip-all">,
187               Group<OutputGroup>,
188               HelpText<"Omit all symbol information from the output file">;
189def StripAllAlias : Flag<["-"], "s">,
190                    Group<OutputGroup>,
191                    Alias<StripAll>;
192
193def DiscardLocals : Flag<["--"], "discard-debug">,
194                    Group<OutputGroup>,
195                    HelpText<"Discard all temporary local symbols">;
196def DiscardLocalsAlias : Flag<["-"], "X">,
197                         Group<OutputGroup>,
198                         Alias<DiscardLocals>;
199
200def DiscardAll : Flag<["--"], "discard-all">,
201                 Group<OutputGroup>,
202                 HelpText<"Discard all local symbols">;
203def DiscardAllAlias : Flag<["-"], "x">,
204                      Group<OutputGroup>,
205                      Alias<DiscardAll>;
206
207def EHFrameHdr : Flag<["--"], "eh-frame-hdr">,
208                 Group<OutputGroup>,
209                 HelpText<"Request creation of .eh_frame_hdr section and PT_GNU_EH_FRAME segment">;
210
211def NMagic : Flag<["--"], "nmagic">,
212             Group<OutputGroup>,
213             HelpText<"Do not page align data">;
214def NMagicAlias : Flag<["-"], "n">,
215                  Group<OutputGroup>,
216                  Alias<NMagic>;
217
218def OMagic : Flag<["--"], "omagic">,
219             Group<OutputGroup>,
220             HelpText<"Do not page align data, do not make text readonly">;
221def OMagicAlias : Flag<["-"], "N">,
222                  Group<OutputGroup>,
223                  Alias<OMagic>;
224
225def HashStyle : Joined<["--"], "hash-style=">,
226                Group<OutputGroup>,
227                HelpText<"Set the type of linker's hash table(s)">;
228
229def ExportDynamic : Flag<["--"], "export-dynamic">,
230                    Group<OutputGroup>,
231                    HelpText<"Export all dynamic symbols">;
232def ExportDynamicAlias : Flag<["-"], "E">,
233                         Group<OutputGroup>,
234                         Alias<ExportDynamic>;
235
236def NoExportDynamic : Flag<["--"], "no-export-dynamic">,
237                   Group<OutputGroup>,
238                   HelpText<"Not export all dynamic symbols">;
239
240
241
242def NoWarnMismatch : Flag<["--"], "no-warn-mismatch">,
243                     Group<OutputGroup>,
244                     HelpText<"Allow linking together mismatched input files">;
245
246def ExcludeLibs : Separate<["--"], "exclude-libs">,
247                  Group<OutputGroup>,
248                  HelpText<"Allow linking together mismatched input files">;
249
250def BuildID : Flag<["--"], "build-id">,
251              Group<OutputGroup>,
252              HelpText<"Request creation of .note.gnu.build-id ELF note section">;
253
254//===----------------------------------------------------------------------===//
255// Positional
256//===----------------------------------------------------------------------===//
257def PositionalGroup : OptionGroup<"positional">,
258                      HelpText<"POSITIONAL OPTIONS">;
259
260def Script : Joined<["--"], "script=">,
261             Group<PositionalGroup>,
262             HelpText<"Use the given file as the linker script">;
263def ScriptAlias : Separate<["-"], "T">,
264                  Group<PositionalGroup>,
265                  Alias<Script>;
266
267def Namespec : Joined<["--"], "library=">,
268               Group<PositionalGroup>,
269               HelpText<"Add the archive or object file specified by namespec to the list of files to link">;
270def NamespecAlias : Joined<["-"], "l">,
271                    Group<PositionalGroup>,
272                    Alias<Namespec>;
273
274def WholeArchive : Flag<["--"], "whole-archive">,
275                   Group<PositionalGroup>,
276                   HelpText<"Include every object file in the archive in the link">;
277
278def NoWholeArchive : Flag<["--"], "no-whole-archive">,
279                     Group<PositionalGroup>,
280                     HelpText<"Turn off the effect of the --whole-archive option">;
281
282def AsNeeded : Flag<["--"], "as-needed">,
283               Group<PositionalGroup>,
284               HelpText<"Add the dynamic libraries mentioned to DT_NEEDED where there is "
285                        "a non-weak undefined symbol reference from">;
286
287def NoAsNeeded : Flag<["--"], "no-as-needed">,
288                 Group<PositionalGroup>,
289                 HelpText<"Turn off the effect of the --as-needed">;
290
291def AddNeeded : Flag<["--"], "add-needed">,
292                Group<PositionalGroup>,
293                HelpText<"Deprecated">;
294
295def NoAddNeeded : Flag<["--"], "no-add-needed">,
296                  Group<PositionalGroup>,
297                  HelpText<"Deprecated">;
298
299def CopyDTNeeded : Flag<["--"], "copy-dt-needed-entries">,
300                   Group<PositionalGroup>,
301                   HelpText<"Add the dynamic libraries mentioned to DT_NEEDED">;
302
303def NoCopyDTNeeded : Flag<["--"], "no-copy-dt-needed-entries">,
304                     Group<PositionalGroup>,
305                     HelpText<"Turn off the effect of the --copy-dt-needed-entries">;
306
307def StartGroup : Flag<["--"], "start-group">,
308                 Group<PositionalGroup>,
309                 HelpText<"Start to record a group of archives">;
310def StartGroupAlias : Flag<["-"], "(">,
311                      Group<PositionalGroup>,
312                      Alias<StartGroup>;
313
314def EndGroup : Flag<["--"], "end-group">,
315               Group<PositionalGroup>,
316               HelpText<"Stop recording a group of archives">;
317def EndGroupAlias : Flag<["-"], ")">,
318                    Group<PositionalGroup>,
319                    Alias<EndGroup>;
320
321//===----------------------------------------------------------------------===//
322// Preference
323//===----------------------------------------------------------------------===//
324def PreferenceGroup : OptionGroup<"preference">,
325                      HelpText<"PREFERENCE OPTIONS">;
326
327def Color : Joined<["--"], "colormc=">,
328            Group<PreferenceGroup>,
329            HelpText<"Surround the result strings with the marker">;
330
331def Trace : Flag<["--"], "trace">,
332            Group<PreferenceGroup>,
333            HelpText<"Print the names of the input files as ld processes them">;
334def TraceAlias : Flag<["-"], "t">,
335                 Group<PreferenceGroup>,
336                 Alias<Trace>;
337
338def Help : Flag<["-", "--"], "help">,
339           Group<PreferenceGroup>,
340           HelpText<"Display available options (to standard output)">;
341def HelpAlias : Flag<["-"], "h">,
342                Group<PreferenceGroup>,
343                Alias<Help>;
344
345def Verbose : Joined<["--"], "verbose=">,
346              Group<PreferenceGroup>,
347              HelpText<"Set linker diagnostic output level">;
348
349def Version : Flag<["--"], "version">,
350              Group<PreferenceGroup>,
351              HelpText<"Display MCLinker version">;
352def VersionAlias1 : Flag<["-"], "v">,
353                    Group<PreferenceGroup>,
354                    Alias<Version>;
355def VersionAlias2 : Flag<["-"], "V">,
356                    Group<PreferenceGroup>,
357                    Alias<Version>;
358
359def ErrorLimit : Joined<["--"], "error-limit=">,
360                 Group<PreferenceGroup>,
361                 HelpText<"Set the maximum limit of errors">;
362
363def WarningLimit : Joined<["--"], "warning-limit=">,
364                   Group<PreferenceGroup>,
365                   HelpText<"Set the maximum limit of warnings">;
366
367def FatalWarnings : Flag<["--"], "fatal-warnings">,
368                    Group<PreferenceGroup>,
369                    HelpText<"Turn all warnings into errors">;
370
371def NoFatalWarnings : Flag<["--"], "no-fatal-warnings">,
372                      Group<PreferenceGroup>,
373                      HelpText<"Do not turn all warnings into errors">;
374
375def WarnSharedTextrel : Flag<["--"], "warn-shared-textrel">,
376                        Group<PreferenceGroup>,
377                        HelpText<"Warn if there is a text relocation in the output shared object">;
378
379//===----------------------------------------------------------------------===//
380// Script
381//===----------------------------------------------------------------------===//
382def ScriptGroup : OptionGroup<"script">,
383                  HelpText<"SCRIPT OPTIONS">;
384
385def DefSym : Joined<["--"], "defsym=">,
386             Group<ScriptGroup>,
387             HelpText<"Define a symbol">;
388
389def Wrap : Joined<["--"], "wrap=">,
390           Group<ScriptGroup>,
391           HelpText<"Use a wrap function for the symbol">;
392
393def Portable : Joined<["--"], "portable=">,
394               Group<ScriptGroup>,
395               HelpText<"Use a portable function for the symbol">;
396
397def SectionStart : Joined<["--"], "section-start=">,
398                   Group<ScriptGroup>,
399                   HelpText<"Locate a output section at the given absolute address">;
400
401def Tbss : Joined<["-"], "Tbss=">,
402           Group<ScriptGroup>,
403           HelpText<"Set the address of the bss segment">;
404
405def Tdata : Joined<["-"], "Tdata=">,
406            Group<ScriptGroup>,
407            HelpText<"Set the address of the data segment">;
408
409def Ttext : Joined<["-"], "Ttext=">,
410            Group<ScriptGroup>,
411            HelpText<"Set the address of the text segment">;
412
413//===----------------------------------------------------------------------===//
414// Search Path
415//===----------------------------------------------------------------------===//
416def SearchpathGroup : OptionGroup<"searchpath">,
417                      HelpText<"SEARCHPATH OPTIONS">;
418
419def Sysroot : Joined<["--"], "sysroot=">,
420              Group<SearchpathGroup>,
421              HelpText<"Use the given directory as the location of the sysroot">;
422
423def LibraryPath : Joined<["--"], "library-path=">,
424                  Group<SearchpathGroup>,
425                  HelpText<"Add the given directory to the list of search paths">;
426def LibraryPathAlias : Joined<["-"], "L">,
427                       Group<SearchpathGroup>,
428                       Alias<LibraryPath>;
429
430def NoStdlib : Flag<["-"], "nostdlib">,
431               Group<SearchpathGroup>,
432               HelpText<"Only search lib dirs explicitly specified on cmdline">;
433
434def RPath : Joined<["-"], "rpath=">,
435            Group<SearchpathGroup>,
436            HelpText<"Add a directory to the runtime library search path">;
437
438def RPathLink : Joined<["-"], "rpath-link=">,
439                Group<SearchpathGroup>,
440                HelpText<"Add a directory to the link time library search path">;
441
442//===----------------------------------------------------------------------===//
443// Symbol
444//===----------------------------------------------------------------------===//
445def SymbolGroup : OptionGroup<"symbol">,
446                  HelpText<"SYMBOL OPTIONS">;
447
448def Undefined : Joined<["--"], "undefined=">,
449                Group<SymbolGroup>,
450                HelpText<"Force symbol to be undefined in the output file">;
451def UndefinedAlias : Separate<["-"], "u">,
452                     Group<SymbolGroup>,
453                     Alias<Undefined>;
454
455def DefineCommon : Flag<["-"], "d">,
456                   Group<SymbolGroup>,
457                   HelpText<"Define common symbol">;
458def DefineCommonAlias1 : Flag<["-"], "dc">,
459                         Group<SymbolGroup>,
460                         Alias<DefineCommon>;
461def DefineCommonAlias2 : Flag<["-"], "dp">,
462                         Group<SymbolGroup>,
463                         Alias<DefineCommon>;
464
465//===----------------------------------------------------------------------===//
466// Target
467//===----------------------------------------------------------------------===//
468def TargetGroup : OptionGroup<"target">,
469                  HelpText<"TARGET OPTIONS">;
470
471def GPSize : Joined<["--"], "gpsize=">,
472             Group<TargetGroup>,
473             HelpText<"Set the maximum size of objects to be optimized using GP">;
474def GPSizeAlias : Separate<["-"], "G">,
475                  Group<TargetGroup>,
476                  Alias<GPSize>;
477
478def Triple : Joined<["-"], "mtriple=">,
479             Group<TargetGroup>,
480             HelpText<"Override target triple for module">;
481
482def Arch : Joined<["-"], "march=">,
483           Group<TargetGroup>,
484           HelpText<"Architecture to generate code for">;
485
486def CPU : Joined<["-"], "mcpu=">,
487          Group<TargetGroup>,
488          HelpText<"Set a specific cpu type">;
489
490def Emulation : Separate<["-"], "m">,
491                Group<TargetGroup>,
492                HelpText<"Set GNU linker emulation">;
493