• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
250//===----------------------------------------------------------------------===//
251// Positional
252//===----------------------------------------------------------------------===//
253def PositionalGroup : OptionGroup<"positional">,
254                      HelpText<"POSITIONAL OPTIONS">;
255
256def Script : Joined<["--"], "script=">,
257             Group<PositionalGroup>,
258             HelpText<"Use the given file as the linker script">;
259def ScriptAlias : Separate<["-"], "T">,
260                  Group<PositionalGroup>,
261                  Alias<Script>;
262
263def Namespec : Joined<["--"], "library=">,
264               Group<PositionalGroup>,
265               HelpText<"Add the archive or object file specified by namespec to the list of files to link">;
266def NamespecAlias : Joined<["-"], "l">,
267                    Group<PositionalGroup>,
268                    Alias<Namespec>;
269
270def WholeArchive : Flag<["--"], "whole-archive">,
271                   Group<PositionalGroup>,
272                   HelpText<"Include every object file in the archive in the link">;
273
274def NoWholeArchive : Flag<["--"], "no-whole-archive">,
275                     Group<PositionalGroup>,
276                     HelpText<"Turn off the effect of the --whole-archive option">;
277
278def AsNeeded : Flag<["--"], "as-needed">,
279               Group<PositionalGroup>,
280               HelpText<"Add the dynamic libraries mentioned to DT_NEEDED where there is "
281                        "a non-weak undefined symbol reference from">;
282
283def NoAsNeeded : Flag<["--"], "no-as-needed">,
284                 Group<PositionalGroup>,
285                 HelpText<"Turn off the effect of the --as-needed">;
286
287def AddNeeded : Flag<["--"], "add-needed">,
288                Group<PositionalGroup>,
289                HelpText<"Deprecated">;
290
291def NoAddNeeded : Flag<["--"], "no-add-needed">,
292                  Group<PositionalGroup>,
293                  HelpText<"Deprecated">;
294
295def CopyDTNeeded : Flag<["--"], "copy-dt-needed-entries">,
296                   Group<PositionalGroup>,
297                   HelpText<"Add the dynamic libraries mentioned to DT_NEEDED">;
298
299def NoCopyDTNeeded : Flag<["--"], "no-copy-dt-needed-entries">,
300                     Group<PositionalGroup>,
301                     HelpText<"Turn off the effect of the --copy-dt-needed-entries">;
302
303def StartGroup : Flag<["--"], "start-group">,
304                 Group<PositionalGroup>,
305                 HelpText<"Start to record a group of archives">;
306def StartGroupAlias : Flag<["-"], "(">,
307                      Group<PositionalGroup>,
308                      Alias<StartGroup>;
309
310def EndGroup : Flag<["--"], "end-group">,
311               Group<PositionalGroup>,
312               HelpText<"Stop recording a group of archives">;
313def EndGroupAlias : Flag<["-"], ")">,
314                    Group<PositionalGroup>,
315                    Alias<EndGroup>;
316
317//===----------------------------------------------------------------------===//
318// Preference
319//===----------------------------------------------------------------------===//
320def PreferenceGroup : OptionGroup<"preference">,
321                      HelpText<"PREFERENCE OPTIONS">;
322
323def Color : Joined<["--"], "color=">,
324            Group<PreferenceGroup>,
325            HelpText<"Surround the result strings with the marker">;
326
327def Trace : Flag<["--"], "trace">,
328            Group<PreferenceGroup>,
329            HelpText<"Print the names of the input files as ld processes them">;
330def TraceAlias : Flag<["-"], "t">,
331                 Group<PreferenceGroup>,
332                 Alias<Trace>;
333
334def Help : Flag<["-", "--"], "help">,
335           Group<PreferenceGroup>,
336           HelpText<"Display available options (to standard output)">;
337def HelpAlias : Flag<["-"], "h">,
338                Group<PreferenceGroup>,
339                Alias<Help>;
340
341def Verbose : Joined<["--"], "verbose=">,
342              Group<PreferenceGroup>,
343              HelpText<"Set linker diagnostic output level">;
344
345def Version : Flag<["--"], "version">,
346              Group<PreferenceGroup>,
347              HelpText<"Display MCLinker version">;
348def VersionAlias1 : Flag<["-"], "v">,
349                    Group<PreferenceGroup>,
350                    Alias<Version>;
351def VersionAlias2 : Flag<["-"], "V">,
352                    Group<PreferenceGroup>,
353                    Alias<Version>;
354
355def ErrorLimit : Joined<["--"], "error-limit=">,
356                 Group<PreferenceGroup>,
357                 HelpText<"Set the maximum limit of errors">;
358
359def WarningLimit : Joined<["--"], "warning-limit=">,
360                   Group<PreferenceGroup>,
361                   HelpText<"Set the maximum limit of warnings">;
362
363def FatalWarnings : Flag<["--"], "fatal-warnings">,
364                    Group<PreferenceGroup>,
365                    HelpText<"Turn all warnings into errors">;
366
367def NoFatalWarnings : Flag<["--"], "no-fatal-warnings">,
368                      Group<PreferenceGroup>,
369                      HelpText<"Do not turn all warnings into errors">;
370
371def WarnSharedTextrel : Flag<["--"], "warn-shared-textrel">,
372                        Group<PreferenceGroup>,
373                        HelpText<"Warn if there is a text relocation in the output shared object">;
374
375//===----------------------------------------------------------------------===//
376// Script
377//===----------------------------------------------------------------------===//
378def ScriptGroup : OptionGroup<"script">,
379                  HelpText<"SCRIPT OPTIONS">;
380
381def DefSym : Joined<["--"], "defsym=">,
382             Group<ScriptGroup>,
383             HelpText<"Define a symbol">;
384
385def Wrap : Joined<["--"], "wrap=">,
386           Group<ScriptGroup>,
387           HelpText<"Use a wrap function for the symbol">;
388
389def Portable : Joined<["--"], "portable=">,
390               Group<ScriptGroup>,
391               HelpText<"Use a portable function for the symbol">;
392
393def SectionStart : Joined<["--"], "section-start=">,
394                   Group<ScriptGroup>,
395                   HelpText<"Locate a output section at the given absolute address">;
396
397def Tbss : Joined<["-"], "Tbss=">,
398           Group<ScriptGroup>,
399           HelpText<"Set the address of the bss segment">;
400
401def Tdata : Joined<["-"], "Tdata=">,
402            Group<ScriptGroup>,
403            HelpText<"Set the address of the data segment">;
404
405def Ttext : Joined<["-"], "Ttext=">,
406            Group<ScriptGroup>,
407            HelpText<"Set the address of the text segment">;
408
409//===----------------------------------------------------------------------===//
410// Search Path
411//===----------------------------------------------------------------------===//
412def SearchpathGroup : OptionGroup<"searchpath">,
413                      HelpText<"SEARCHPATH OPTIONS">;
414
415def Sysroot : Joined<["--"], "sysroot=">,
416              Group<SearchpathGroup>,
417              HelpText<"Use the given directory as the location of the sysroot">;
418
419def LibraryPath : Joined<["--"], "library-path=">,
420                  Group<SearchpathGroup>,
421                  HelpText<"Add the given directory to the list of search paths">;
422def LibraryPathAlias : Joined<["-"], "L">,
423                       Group<SearchpathGroup>,
424                       Alias<LibraryPath>;
425
426def NoStdlib : Flag<["-"], "nostdlib">,
427               Group<SearchpathGroup>,
428               HelpText<"Only search lib dirs explicitly specified on cmdline">;
429
430def RPath : Joined<["-"], "rpath=">,
431            Group<SearchpathGroup>,
432            HelpText<"Add a directory to the runtime library search path">;
433
434//===----------------------------------------------------------------------===//
435// Symbol
436//===----------------------------------------------------------------------===//
437def SymbolGroup : OptionGroup<"symbol">,
438                  HelpText<"SYMBOL OPTIONS">;
439
440def Undefined : Joined<["--"], "undefined=">,
441                Group<SymbolGroup>,
442                HelpText<"Force symbol to be undefined in the output file">;
443def UndefinedAlias : Separate<["-"], "u">,
444                     Group<SymbolGroup>,
445                     Alias<Undefined>;
446
447def DefineCommon : Flag<["-"], "d">,
448                   Group<SymbolGroup>,
449                   HelpText<"Define common symbol">;
450def DefineCommonAlias1 : Flag<["-"], "dc">,
451                         Group<SymbolGroup>,
452                         Alias<DefineCommon>;
453def DefineCommonAlias2 : Flag<["-"], "dp">,
454                         Group<SymbolGroup>,
455                         Alias<DefineCommon>;
456
457//===----------------------------------------------------------------------===//
458// Target
459//===----------------------------------------------------------------------===//
460def TargetGroup : OptionGroup<"target">,
461                  HelpText<"TARGET OPTIONS">;
462
463def GPSize : Joined<["--"], "gpsize=">,
464             Group<TargetGroup>,
465             HelpText<"Set the maximum size of objects to be optimized using GP">;
466def GPSizeAlias : Separate<["-"], "G">,
467                  Group<TargetGroup>,
468                  Alias<GPSize>;
469
470def Triple : Joined<["-"], "mtriple=">,
471             Group<TargetGroup>,
472             HelpText<"Override target triple for module">;
473
474def Arch : Joined<["-"], "march=">,
475           Group<TargetGroup>,
476           HelpText<"Architecture to generate code for">;
477
478def CPU : Joined<["-"], "mcpu=">,
479          Group<TargetGroup>,
480          HelpText<"Set a specific cpu type">;
481
482def Emulation : Separate<["-"], "m">,
483                Group<TargetGroup>,
484                HelpText<"Set GNU linker emulation">;
485
486def StubGroupSize : Joined<["--"], "stub-group-size=">,
487                    Group<TargetGroup>,
488                    HelpText<"Set the group size to place stubs between sections">;
489
490def FixCA53Erratum835769 : Flag<["--"], "fix-cortex-a53-835769">,
491                           Group<TargetGroup>,
492                           HelpText<"Enable fix for cortex a53 erratum 835769">;
493
494def FixCA53Erratum843419 : Flag<["--"], "fix-cortex-a53-843419">,
495                           Group<TargetGroup>,
496                           HelpText<"Enable fix for cortex a53 erratum 843419">;
497