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