Options.td revision 321369
1205354Simpinclude "llvm/Option/OptParser.td" 2205354Simp 3205354Simp// For options whose names are multiple letters, either one dash or 4205354Simp// two can precede the option name except those that start with 'o'. 5205354Simpclass F<string name>: Flag<["--", "-"], name>; 6205354Simpclass J<string name>: Joined<["--", "-"], name>; 7205354Simpclass S<string name>: Separate<["--", "-"], name>; 8205354Simpclass JS<string name>: JoinedOrSeparate<["--", "-"], name>; 9205354Simp 10205354Simpdef auxiliary: S<"auxiliary">, HelpText<"Set DT_AUXILIARY field to the specified name">; 11205354Simp 12205354Simpdef Bsymbolic: F<"Bsymbolic">, HelpText<"Bind defined symbols locally">; 13205354Simp 14205354Simpdef Bsymbolic_functions: F<"Bsymbolic-functions">, 15205354Simp HelpText<"Bind defined function symbols locally">; 16205354Simp 17205354Simpdef Bdynamic: F<"Bdynamic">, HelpText<"Link against shared libraries">; 18205354Simp 19205354Simpdef Bstatic: F<"Bstatic">, HelpText<"Do not link against shared libraries">; 20205354Simp 21205354Simpdef build_id: F<"build-id">, HelpText<"Generate build ID note">; 22205354Simp 23205354Simpdef build_id_eq: J<"build-id=">, HelpText<"Generate build ID note">; 24205354Simp 25205354Simpdef compress_debug_sections : J<"compress-debug-sections=">, 26205354Simp HelpText<"Compress DWARF debug sections">; 27205354Simp 28205354Simpdef defsym: J<"defsym=">, HelpText<"Define a symbol alias">; 29205354Simp 30205354Simpdef L: JoinedOrSeparate<["-"], "L">, MetaVarName<"<dir>">, 31205354Simp HelpText<"Add a directory to the library search path">; 32205354Simp 33205354Simpdef O: Joined<["-"], "O">, HelpText<"Optimize output file size">; 34205354Simp 35205354Simpdef Tbss: S<"Tbss">, HelpText<"Same as --section-start with .bss as the sectionname">; 36205354Simp 37205354Simpdef Tdata: S<"Tdata">, HelpText<"Same as --section-start with .data as the sectionname">; 38205354Simp 39205354Simpdef Ttext: S<"Ttext">, HelpText<"Same as --section-start with .text as the sectionname">; 40205354Simp 41205354Simpdef allow_multiple_definition: F<"allow-multiple-definition">, 42205354Simp HelpText<"Allow multiple definitions">; 43205354Simp 44205354Simpdef as_needed: F<"as-needed">, 45205354Simp HelpText<"Only set DT_NEEDED for shared libraries if used">; 46205354Simp 47205354Simpdef color_diagnostics: F<"color-diagnostics">, 48205354Simp HelpText<"Use colors in diagnostics">; 49205354Simp 50205354Simpdef color_diagnostics_eq: J<"color-diagnostics=">, 51205354Simp HelpText<"Use colors in diagnostics">; 52205354Simp 53205354Simpdef define_common: F<"define-common">, 54205354Simp HelpText<"Assign space to common symbols">; 55205354Simp 56205354Simpdef demangle: F<"demangle">, HelpText<"Demangle symbol names">; 57205354Simp 58205354Simpdef disable_new_dtags: F<"disable-new-dtags">, 59205354Simp HelpText<"Disable new dynamic tags">; 60205354Simp 61205354Simpdef discard_all: F<"discard-all">, HelpText<"Delete all local symbols">; 62205354Simp 63205354Simpdef discard_locals: F<"discard-locals">, 64205354Simp HelpText<"Delete temporary local symbols">; 65205354Simp 66205354Simpdef discard_none: F<"discard-none">, 67205354Simp HelpText<"Keep all symbols in the symbol table">; 68205354Simp 69205354Simpdef dynamic_linker: S<"dynamic-linker">, 70205354Simp HelpText<"Which dynamic linker to use">; 71205354Simp 72205354Simpdef dynamic_list: S<"dynamic-list">, 73205354Simp HelpText<"Read a list of dynamic symbols">; 74205354Simp 75205354Simpdef eh_frame_hdr: F<"eh-frame-hdr">, 76205354Simp HelpText<"Request creation of .eh_frame_hdr section and PT_GNU_EH_FRAME segment header">; 77205354Simp 78205354Simpdef emit_relocs: F<"emit-relocs">, HelpText<"Generate relocations in output">; 79205354Simp 80205354Simpdef enable_new_dtags: F<"enable-new-dtags">, 81205354Simp HelpText<"Enable new dynamic tags">; 82205354Simp 83205354Simpdef end_lib: F<"end-lib">, 84205354Simp HelpText<"End a grouping of objects that should be treated as if they were together in an archive">; 85205354Simp 86205354Simpdef entry: S<"entry">, MetaVarName<"<entry>">, 87205354Simp HelpText<"Name of entry point symbol">; 88205354Simp 89205354Simpdef error_limit: S<"error-limit">, 90205354Simp HelpText<"Maximum number of errors to emit before stopping (0 = no limit)">; 91205354Simp 92205354Simpdef error_unresolved_symbols: F<"error-unresolved-symbols">, 93205354Simp HelpText<"Report unresolved symbols as errors">; 94205354Simp 95205354Simpdef exclude_libs: S<"exclude-libs">, 96205354Simp HelpText<"Exclude static libraries from automatic export">; 97205354Simp 98205354Simpdef export_dynamic: F<"export-dynamic">, 99205354Simp HelpText<"Put symbols in the dynamic symbol table">; 100205354Simp 101205354Simpdef export_dynamic_symbol: S<"export-dynamic-symbol">, 102205354Simp HelpText<"Put a symbol in the dynamic symbol table">; 103205354Simp 104205354Simpdef fatal_warnings: F<"fatal-warnings">, 105205354Simp HelpText<"Treat warnings as errors">; 106205354Simp 107205354Simpdef filter: J<"filter=">, HelpText<"Set DT_FILTER field to the specified name">; 108205354Simp 109205354Simpdef fini: S<"fini">, MetaVarName<"<symbol>">, 110205354Simp HelpText<"Specify a finalizer function">; 111205354Simp 112205354Simpdef full_shutdown : F<"full-shutdown">, 113205354Simp HelpText<"Perform a full shutdown instead of calling _exit">; 114205354Simp 115205354Simpdef format: J<"format=">, MetaVarName<"<input-format>">, 116205354Simp HelpText<"Change the input format of the inputs following this option">; 117205354Simp 118205354Simpdef gc_sections: F<"gc-sections">, 119205354Simp HelpText<"Enable garbage collection of unused sections">; 120205354Simp 121205354Simpdef gdb_index: F<"gdb-index">, 122205354Simp HelpText<"Generate .gdb_index section">; 123205354Simp 124205354Simpdef hash_style: S<"hash-style">, 125205354Simp HelpText<"Specify hash style (sysv, gnu or both)">; 126205354Simp 127205354Simpdef help: F<"help">, HelpText<"Print option help">; 128205354Simp 129205354Simpdef icf: F<"icf=all">, HelpText<"Enable identical code folding">; 130205354Simp 131205354Simpdef image_base : J<"image-base=">, HelpText<"Set the base address">; 132205354Simp 133205354Simpdef init: S<"init">, MetaVarName<"<symbol>">, 134205354Simp HelpText<"Specify an initializer function">; 135205354Simp 136205354Simpdef l: JoinedOrSeparate<["-"], "l">, MetaVarName<"<libName>">, 137205354Simp HelpText<"Root name of library to use">; 138205354Simp 139205354Simpdef lto_O: J<"lto-O">, MetaVarName<"<opt-level>">, 140 HelpText<"Optimization level for LTO">; 141 142def m: JoinedOrSeparate<["-"], "m">, HelpText<"Set target emulation">; 143 144def Map: JS<"Map">, HelpText<"Print a link map to the specified file">; 145 146def nostdlib: F<"nostdlib">, 147 HelpText<"Only search directories specified on the command line">; 148 149def no_as_needed: F<"no-as-needed">, 150 HelpText<"Always DT_NEEDED for shared libraries">; 151 152def no_color_diagnostics: F<"no-color-diagnostics">, 153 HelpText<"Do not use colors in diagnostics">; 154 155def no_define_common: F<"no-define-common">, 156 HelpText<"Do not assign space to common symbols">; 157 158def no_demangle: F<"no-demangle">, 159 HelpText<"Do not demangle symbol names">; 160 161def no_dynamic_linker: F<"no-dynamic-linker">, 162 HelpText<"Inhibit output of .interp section">; 163 164def no_export_dynamic: F<"no-export-dynamic">; 165def no_fatal_warnings: F<"no-fatal-warnings">; 166 167def no_gc_sections: F<"no-gc-sections">, 168 HelpText<"Disable garbage collection of unused sections">; 169 170def no_gnu_unique: F<"no-gnu-unique">, 171 HelpText<"Disable STB_GNU_UNIQUE symbol binding">; 172 173def no_threads: F<"no-threads">, 174 HelpText<"Do not run the linker multi-threaded">; 175 176def no_whole_archive: F<"no-whole-archive">, 177 HelpText<"Restores the default behavior of loading archive members">; 178 179def noinhibit_exec: F<"noinhibit-exec">, 180 HelpText<"Retain the executable output file whenever it is still usable">; 181 182def nopie: F<"nopie">, HelpText<"Do not create a position independent executable">; 183 184def no_rosegment: F<"no-rosegment">, HelpText<"Do not put read-only non-executable sections in their own segment">; 185 186def no_undefined: F<"no-undefined">, 187 HelpText<"Report unresolved symbols even if the linker is creating a shared library">; 188 189def no_undefined_version: F<"no-undefined-version">, 190 HelpText<"Report version scripts that refer undefined symbols">; 191 192def o: JoinedOrSeparate<["-"], "o">, MetaVarName<"<path>">, 193 HelpText<"Path to file to write output">; 194 195def oformat: Separate<["--"], "oformat">, MetaVarName<"<format>">, 196 HelpText<"Specify the binary format for the output object file">; 197 198def omagic: Flag<["--"], "omagic">, MetaVarName<"<magic>">, 199 HelpText<"Set the text and data sections to be readable and writable">; 200 201def pie: F<"pie">, HelpText<"Create a position independent executable">; 202 203def print_gc_sections: F<"print-gc-sections">, 204 HelpText<"List removed unused sections">; 205 206def print_map: F<"print-map">, 207 HelpText<"Print a link map to the standard output">; 208 209def reproduce: S<"reproduce">, 210 HelpText<"Dump linker invocation and input files for debugging">; 211 212def rpath: S<"rpath">, HelpText<"Add a DT_RUNPATH to the output">; 213 214def relocatable: F<"relocatable">, HelpText<"Create relocatable object file">; 215 216def retain_symbols_file: J<"retain-symbols-file=">, MetaVarName<"<file>">, 217 HelpText<"Retain only the symbols listed in the file">; 218 219def script: S<"script">, HelpText<"Read linker script">; 220 221def section_start: S<"section-start">, MetaVarName<"<address>">, 222 HelpText<"Set address of section">; 223 224def shared: F<"shared">, HelpText<"Build a shared object">; 225 226def soname: J<"soname=">, HelpText<"Set DT_SONAME">; 227 228def sort_section: S<"sort-section">, HelpText<"Specifies sections sorting rule when linkerscript is used">; 229 230def start_lib: F<"start-lib">, 231 HelpText<"Start a grouping of objects that should be treated as if they were together in an archive">; 232 233def strip_all: F<"strip-all">, HelpText<"Strip all symbols">; 234 235def strip_debug: F<"strip-debug">, HelpText<"Strip debugging information">; 236 237def symbol_ordering_file: S<"symbol-ordering-file">, 238 HelpText<"Layout sections in the order specified by symbol file">; 239 240def sysroot: J<"sysroot=">, HelpText<"Set the system root">; 241 242def target1_rel: F<"target1-rel">, HelpText<"Interpret R_ARM_TARGET1 as R_ARM_REL32">; 243 244def target1_abs: F<"target1-abs">, HelpText<"Interpret R_ARM_TARGET1 as R_ARM_ABS32">; 245 246def target2: J<"target2=">, MetaVarName<"<type>">, HelpText<"Interpret R_ARM_TARGET2 as <type>, where <type> is one of rel, abs, or got-rel">; 247 248def threads: F<"threads">, HelpText<"Run the linker multi-threaded">; 249 250def trace: F<"trace">, HelpText<"Print the names of the input files">; 251 252def trace_symbol : S<"trace-symbol">, HelpText<"Trace references to symbols">; 253 254def undefined: S<"undefined">, 255 HelpText<"Force undefined symbol during linking">; 256 257def unresolved_symbols: J<"unresolved-symbols=">, 258 HelpText<"Determine how to handle unresolved symbols">; 259 260def rsp_quoting: J<"rsp-quoting=">, 261 HelpText<"Quoting style for response files. Values supported: windows|posix">; 262 263def v: Flag<["-"], "v">, HelpText<"Display the version number">; 264 265def verbose: F<"verbose">, HelpText<"Verbose mode">; 266 267def version: F<"version">, HelpText<"Display the version number and exit">; 268 269def version_script: S<"version-script">, 270 HelpText<"Read a version script">; 271 272def warn_common: F<"warn-common">, 273 HelpText<"Warn about duplicate common symbols">; 274 275def warn_unresolved_symbols: F<"warn-unresolved-symbols">, 276 HelpText<"Report unresolved symbols as warnings">; 277 278def whole_archive: F<"whole-archive">, 279 HelpText<"Force load of all members in a static library">; 280 281def wrap: S<"wrap">, MetaVarName<"<symbol>">, 282 HelpText<"Use wrapper functions for symbol">; 283 284def z: JoinedOrSeparate<["-"], "z">, MetaVarName<"<option>">, 285 HelpText<"Linker option extensions">; 286 287// Aliases 288def alias_auxiliary: Separate<["-"], "f">, Alias<auxiliary>; 289def alias_Bdynamic_call_shared: F<"call_shared">, Alias<Bdynamic>; 290def alias_Bdynamic_dy: F<"dy">, Alias<Bdynamic>; 291def alias_Bstatic_dn: F<"dn">, Alias<Bstatic>; 292def alias_Bstatic_non_shared: F<"non_shared">, Alias<Bstatic>; 293def alias_Bstatic_static: F<"static">, Alias<Bstatic>; 294def alias_L__library_path: J<"library-path=">, Alias<L>; 295def alias_define_common_d: Flag<["-"], "d">, Alias<define_common>; 296def alias_define_common_dc: F<"dc">, Alias<define_common>; 297def alias_define_common_dp: F<"dp">, Alias<define_common>; 298def alias_defsym: S<"defsym">, Alias<defsym>; 299def alias_discard_all_x: Flag<["-"], "x">, Alias<discard_all>; 300def alias_discard_locals_X: Flag<["-"], "X">, Alias<discard_locals>; 301def alias_dynamic_list: J<"dynamic-list=">, Alias<dynamic_list>; 302def alias_emit_relocs: Flag<["-"], "q">, Alias<emit_relocs>; 303def alias_entry_e: JoinedOrSeparate<["-"], "e">, Alias<entry>; 304def alias_entry_entry: J<"entry=">, Alias<entry>; 305def alias_error_limit: J<"error-limit=">, Alias<error_limit>; 306def alias_exclude_libs: J<"exclude-libs=">, Alias<exclude_libs>; 307def alias_export_dynamic_E: Flag<["-"], "E">, Alias<export_dynamic>; 308def alias_export_dynamic_symbol: J<"export-dynamic-symbol=">, 309 Alias<export_dynamic_symbol>; 310def alias_filter: Separate<["-"], "F">, Alias<filter>; 311def alias_fini_fini: J<"fini=">, Alias<fini>; 312def alias_format_b: S<"b">, Alias<format>; 313def alias_hash_style_hash_style: J<"hash-style=">, Alias<hash_style>; 314def alias_init_init: J<"init=">, Alias<init>; 315def alias_l__library: J<"library=">, Alias<l>; 316def alias_Map_eq: J<"Map=">, Alias<Map>; 317def alias_omagic: Flag<["-"], "N">, Alias<omagic>; 318def alias_o_output: Joined<["--"], "output=">, Alias<o>; 319def alias_o_output2 : Separate<["--"], "output">, Alias<o>; 320def alias_pie_pic_executable: F<"pic-executable">, Alias<pie>; 321def alias_print_map_M: Flag<["-"], "M">, Alias<print_map>; 322def alias_relocatable_r: Flag<["-"], "r">, Alias<relocatable>; 323def alias_reproduce_eq: J<"reproduce=">, Alias<reproduce>; 324def alias_retain_symbols_file: S<"retain-symbols-file">, Alias<retain_symbols_file>; 325def alias_rpath_R: JoinedOrSeparate<["-"], "R">, Alias<rpath>; 326def alias_rpath_rpath: J<"rpath=">, Alias<rpath>; 327def alias_script_T: JoinedOrSeparate<["-"], "T">, Alias<script>; 328def alias_shared_Bshareable: F<"Bshareable">, Alias<shared>; 329def alias_soname_h: JoinedOrSeparate<["-"], "h">, Alias<soname>; 330def alias_soname_soname: S<"soname">, Alias<soname>; 331def alias_sort_section: J<"sort-section=">, Alias<sort_section>; 332def alias_script: J<"script=">, Alias<script>; 333def alias_strip_all: Flag<["-"], "s">, Alias<strip_all>; 334def alias_strip_debug_S: Flag<["-"], "S">, Alias<strip_debug>; 335def alias_Tbss: J<"Tbss=">, Alias<Tbss>; 336def alias_Tdata: J<"Tdata=">, Alias<Tdata>; 337def alias_trace: Flag<["-"], "t">, Alias<trace>; 338def trace_trace_symbol_eq : J<"trace-symbol=">, Alias<trace_symbol>; 339def alias_trace_symbol_y : JoinedOrSeparate<["-"], "y">, Alias<trace_symbol>; 340def alias_Ttext: J<"Ttext=">, Alias<Ttext>; 341def alias_Ttext_segment: S<"Ttext-segment">, Alias<Ttext>; 342def alias_Ttext_segment_eq: J<"Ttext-segment=">, Alias<Ttext>; 343def alias_undefined_eq: J<"undefined=">, Alias<undefined>; 344def alias_undefined_u: JoinedOrSeparate<["-"], "u">, Alias<undefined>; 345def alias_version_script_eq: J<"version-script=">, Alias<version_script>; 346def alias_version_V: Flag<["-"], "V">, Alias<version>; 347def alias_wrap_wrap: J<"wrap=">, Alias<wrap>; 348 349// Our symbol resolution algorithm handles symbols in archive files differently 350// than traditional linkers, so we don't need --start-group and --end-group. 351// These options are recongized for compatibility but ignored. 352def end_group: F<"end-group">; 353def end_group_paren: Flag<["-"], ")">; 354def start_group: F<"start-group">; 355def start_group_paren: Flag<["-"], "(">; 356 357// LTO-related options. 358def lto_aa_pipeline: J<"lto-aa-pipeline=">, 359 HelpText<"AA pipeline to run during LTO. Used in conjunction with -lto-newpm-passes">; 360def lto_newpm_passes: J<"lto-newpm-passes=">, 361 HelpText<"Passes to run during LTO">; 362def lto_partitions: J<"lto-partitions=">, 363 HelpText<"Number of LTO codegen partitions">; 364def disable_verify: F<"disable-verify">; 365def mllvm: S<"mllvm">; 366def opt_remarks_filename: Separate<["--"], "opt-remarks-filename">, 367 HelpText<"YAML output file for optimization remarks">; 368def opt_remarks_with_hotness: Flag<["--"], "opt-remarks-with-hotness">, 369 HelpText<"Include hotness informations in the optimization remarks file">; 370def save_temps: F<"save-temps">; 371def thinlto_cache_dir: J<"thinlto-cache-dir=">, 372 HelpText<"Path to ThinLTO cached object file directory">; 373def thinlto_cache_policy: S<"thinlto-cache-policy">, 374 HelpText<"Pruning policy for the ThinLTO cache">; 375def thinlto_jobs: J<"thinlto-jobs=">, HelpText<"Number of ThinLTO jobs">; 376 377// Ignore LTO plugin-related options. 378// clang -flto passes -plugin and -plugin-opt to the linker. This is required 379// for ld.gold and ld.bfd to get LTO working. But it's not for lld which doesn't 380// rely on a plugin. Instead of detecting which linker is used on clang side we 381// just ignore the option on lld side as it's easier. In fact, the linker could 382// be called 'ld' and understanding which linker is used would require parsing of 383// --version output. 384def plugin: S<"plugin">; 385def plugin_eq: J<"plugin=">; 386def plugin_opt: S<"plugin-opt">; 387def plugin_opt_eq: J<"plugin-opt=">; 388 389// Options listed below are silently ignored for now for compatibility. 390def allow_shlib_undefined: F<"allow-shlib-undefined">; 391def cref: Flag<["--"], "cref">; 392def detect_odr_violations: F<"detect-odr-violations">; 393def g: Flag<["-"], "g">; 394def no_add_needed: F<"no-add-needed">; 395def no_allow_shlib_undefined: F<"no-allow-shlib-undefined">; 396def no_copy_dt_needed_entries: F<"no-copy-dt-needed-entries">, 397 Alias<no_add_needed>; 398def no_keep_memory: F<"no-keep-memory">; 399def no_mmap_output_file: F<"no-mmap-output-file">; 400def no_warn_common: F<"no-warn-common">; 401def no_warn_mismatch: F<"no-warn-mismatch">; 402def rpath_link: S<"rpath-link">; 403def rpath_link_eq: J<"rpath-link=">; 404def sort_common: F<"sort-common">; 405def stats: F<"stats">; 406def warn_execstack: F<"warn-execstack">; 407def warn_shared_textrel: F<"warn-shared-textrel">; 408def EB : F<"EB">; 409def EL : F<"EL">; 410def G: JoinedOrSeparate<["-"], "G">; 411def Qy : F<"Qy">; 412 413