Index: lld/ELF/Options.td =================================================================== --- lld/ELF/Options.td +++ lld/ELF/Options.td @@ -11,6 +11,11 @@ def _eq: Joined<["--", "-"], name # "=">, Alias(NAME)>; } +multiclass B { + def NAME: Flag<["--", "-"], name>, HelpText; + def no_ # NAME: Flag<["--", "-"], "no-" # name>, HelpText; +} + def auxiliary: S<"auxiliary">, HelpText<"Set DT_AUXILIARY field to the specified name">; def Bsymbolic: F<"Bsymbolic">, HelpText<"Bind defined symbols locally">; @@ -48,8 +53,9 @@ def allow_multiple_definition: F<"allow-multiple-definition">, HelpText<"Allow multiple definitions">; -def as_needed: F<"as-needed">, - HelpText<"Only set DT_NEEDED for shared libraries if used">; +defm as_needed: B<"as-needed", + "Always DT_NEEDED for shared libraries", + "Only set DT_NEEDED for shared libraries if used">; // -chroot doesn't have a help text because it is an internal option. def chroot: S<"chroot">; @@ -60,10 +66,13 @@ def color_diagnostics_eq: J<"color-diagnostics=">, HelpText<"Use colors in diagnostics">; -def define_common: F<"define-common">, - HelpText<"Assign space to common symbols">; +defm define_common: B<"define-common", + "Assign space to common symbols", + "Do not assign space to common symbols">; -def demangle: F<"demangle">, HelpText<"Demangle symbol names">; +defm demangle: B<"demangle", + "Do not demangle symbol names", + "Demangle symbol names">; def disable_new_dtags: F<"disable-new-dtags">, HelpText<"Disable new dynamic tags">; @@ -82,8 +91,9 @@ defm dynamic_list: Eq<"dynamic-list">, HelpText<"Read a list of dynamic symbols">; -def eh_frame_hdr: F<"eh-frame-hdr">, - HelpText<"Request creation of .eh_frame_hdr section and PT_GNU_EH_FRAME segment header">; +defm eh_frame_hdr: B<"eh-frame-hdr", + "Request creation of .eh_frame_hdr section and PT_GNU_EH_FRAME segment header", + "Do not create .eh_frame_hdr section">; def emit_relocs: F<"emit-relocs">, HelpText<"Generate relocations in output">; @@ -105,14 +115,16 @@ defm exclude_libs: Eq<"exclude-libs">, HelpText<"Exclude static libraries from automatic export">; -def export_dynamic: F<"export-dynamic">, - HelpText<"Put symbols in the dynamic symbol table">; +defm export_dynamic: B<"export-dynamic", + "Put symbols in the dynamic symbol table", + "Do not put symbols in the dynamic symbol table">; defm export_dynamic_symbol: Eq<"export-dynamic-symbol">, HelpText<"Put a symbol in the dynamic symbol table">; -def fatal_warnings: F<"fatal-warnings">, - HelpText<"Treat warnings as errors">; +defm fatal_warnings: B<"fatal-warnings", + "Treat warnings as errors", + "Do not treat warnings as errors">; defm filter: Eq<"filter">, HelpText<"Set DT_FILTER field to the specified name">; @@ -130,11 +142,13 @@ HelpText<"Change the input format of the inputs following this option">, MetaVarName<"">; -def gc_sections: F<"gc-sections">, - HelpText<"Enable garbage collection of unused sections">; +defm gc_sections: B<"gc-sections", + "Enable garbage collection of unused sections", + "Disable garbage collection of unused sections">; -def gdb_index: F<"gdb-index">, - HelpText<"Generate .gdb_index section">; +defm gdb_index: B<"gdb-index", + "Generate .gdb_index section", + "Do not generate .gdb_index section">; defm hash_style: Eq<"hash-style">, HelpText<"Specify hash style (sysv, gnu or both)">; @@ -166,65 +180,28 @@ defm Map: Eq<"Map">, HelpText<"Print a link map to the specified file">; -def merge_exidx_entries: F<"merge-exidx-entries">, - HelpText<"Enable merging .ARM.exidx entries">; +defm merge_exidx_entries: B<"merge-exidx-entries", + "Enable merging .ARM.exidx entries", + "Disable merging .ARM.exidx entries">; def nostdlib: F<"nostdlib">, HelpText<"Only search directories specified on the command line">; -def no_as_needed: F<"no-as-needed">, - HelpText<"Always DT_NEEDED for shared libraries">; - def no_color_diagnostics: F<"no-color-diagnostics">, HelpText<"Do not use colors in diagnostics">; -def no_define_common: F<"no-define-common">, - HelpText<"Do not assign space to common symbols">; - -def no_demangle: F<"no-demangle">, - HelpText<"Do not demangle symbol names">; - def no_dynamic_linker: F<"no-dynamic-linker">, HelpText<"Inhibit output of .interp section">; -def no_eh_frame_hdr: F<"no-eh-frame-hdr">, - HelpText<"Do not create .eh_frame_hdr section">; - -def no_export_dynamic: F<"no-export-dynamic">; -def no_fatal_warnings: F<"no-fatal-warnings">; - -def no_gc_sections: F<"no-gc-sections">, - HelpText<"Disable garbage collection of unused sections">; - -def no_gdb_index: F<"no-gdb-index">, - HelpText<"Do not generate .gdb_index section">; - def no_gnu_unique: F<"no-gnu-unique">, HelpText<"Disable STB_GNU_UNIQUE symbol binding">; -def no_merge_exidx_entries: F<"no-merge-exidx-entries">, - HelpText<"Disable merging .ARM.exidx entries">; - -def no_pie: F<"no-pie">, HelpText<"Do not create a position independent executable">; - -def no_threads: F<"no-threads">, - HelpText<"Do not run the linker multi-threaded">; - -def no_whole_archive: F<"no-whole-archive">, - HelpText<"Restores the default behavior of loading archive members">; - def noinhibit_exec: F<"noinhibit-exec">, HelpText<"Retain the executable output file whenever it is still usable">; def no_omagic: Flag<["--"], "no-omagic">, MetaVarName<"">, HelpText<"Do not set the text data sections to be writable">; -def no_print_gc_sections: F<"no-print-gc-sections">, - HelpText<"Do not list removed unused sections">; - -def no_print_icf_sections: F<"no-print-icf-sections">, - HelpText<"Do not list identical folded sections">; - def no_rosegment: F<"no-rosegment">, HelpText<"Do not put read-only non-executable sections in their own segment">; @@ -249,13 +226,17 @@ def pack_dyn_relocs_eq: J<"pack-dyn-relocs=">, MetaVarName<"">, HelpText<"Pack dynamic relocations in the given format (none or android)">; -def pie: F<"pie">, HelpText<"Create a position independent executable">; +defm pie: B<"pie", + "Create a position independent executable", + "Do not create a position independent executable">; -def print_gc_sections: F<"print-gc-sections">, - HelpText<"List removed unused sections">; +defm print_gc_sections: B<"print-gc-sections", + "List removed unused sections", + "Do not list removed unused sections">; -def print_icf_sections: F<"print-icf-sections">, - HelpText<"List identical folded sections">; +defm print_icf_sections: B<"print-icf-sections", + "List identical folded sections", + "Do not list identical folded sections">; def print_map: F<"print-map">, HelpText<"Print a link map to the standard output">; @@ -303,7 +284,9 @@ HelpText<"Interpret R_ARM_TARGET2 as , where is one of rel, abs, or got-rel">, MetaVarName<"">; -def threads: F<"threads">, HelpText<"Run the linker multi-threaded">; +defm threads: B<"threads", + "Run the linker multi-threaded", + "Do not run the linker multi-threaded">; def trace: F<"trace">, HelpText<"Print the names of the input files">; @@ -332,8 +315,9 @@ def warn_unresolved_symbols: F<"warn-unresolved-symbols">, HelpText<"Report unresolved symbols as warnings">; -def whole_archive: F<"whole-archive">, - HelpText<"Force load of all members in a static library">; +defm whole_archive: B<"whole-archive", + "Force load of all members in a static library", + "Restores the default behavior of loading archive members">; defm wrap: Eq<"wrap">, HelpText<"Use wrapper functions for symbol">, MetaVarName<"">;