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