Index: ELF/Driver.cpp =================================================================== --- ELF/Driver.cpp +++ ELF/Driver.cpp @@ -653,13 +653,13 @@ Config->OptRemarksFilename = Args.getLastArgValue(OPT_opt_remarks_filename); Config->OptRemarksWithHotness = Args.hasArg(OPT_opt_remarks_with_hotness); Config->Optimize = getInteger(Args, OPT_O, 1); - Config->OutputFile = Args.getLastArgValue(OPT_o); + Config->OutputFile = Args.getLastArgValue(OPT_output); Config->Pie = getArg(Args, OPT_pie, OPT_nopie, false); Config->PrintGcSections = Args.hasArg(OPT_print_gc_sections); Config->Rpath = getRpath(Args); Config->Relocatable = Args.hasArg(OPT_relocatable); Config->SaveTemps = Args.hasArg(OPT_save_temps); - Config->SearchPaths = getArgs(Args, OPT_L); + Config->SearchPaths = getArgs(Args, OPT_library_path); Config->SectionStartMap = getSectionStartMap(Args); Config->Shared = Args.hasArg(OPT_shared); Config->SingleRoRx = Args.hasArg(OPT_no_rosegment); @@ -805,7 +805,7 @@ void LinkerDriver::createFiles(opt::InputArgList &Args) { for (auto *Arg : Args) { switch (Arg->getOption().getUnaliasedOption().getID()) { - case OPT_l: + case OPT_library: addLibrary(Arg->getValue()); break; case OPT_INPUT: Index: ELF/DriverUtils.cpp =================================================================== --- ELF/DriverUtils.cpp +++ ELF/DriverUtils.cpp @@ -147,14 +147,14 @@ case OPT_INPUT: OS << quote(rewritePath(Arg->getValue())) << "\n"; break; - case OPT_o: + case OPT_output: // If -o path contains directories, "lld @response.txt" will likely // fail because the archive we are creating doesn't contain empty // directories for the output path (-o doesn't create directories). // Strip directories to prevent the issue. OS << "-o " << quote(sys::path::filename(Arg->getValue())) << "\n"; break; - case OPT_L: + case OPT_library_path: case OPT_dynamic_list: case OPT_rpath: case OPT_script: Index: ELF/Options.td =================================================================== --- ELF/Options.td +++ ELF/Options.td @@ -7,6 +7,11 @@ class S: Separate<["--", "-"], name>; class JS: JoinedOrSeparate<["--", "-"], name>; +multiclass Eq { + def "": Separate<["--", "-"], name>, HelpText; + def _eq: Joined<["--", "-"], name # "=">, Alias(NAME)>; +} + def auxiliary: S<"auxiliary">, HelpText<"Set DT_AUXILIARY field to the specified name">; def Bsymbolic: F<"Bsymbolic">, HelpText<"Bind defined symbols locally">; @@ -22,21 +27,20 @@ def build_id_eq: J<"build-id=">, HelpText<"Generate build ID note">; -def compress_debug_sections : J<"compress-debug-sections=">, - HelpText<"Compress DWARF debug sections">; +defm compress_debug_sections : Eq<"compress-debug-sections", "Compress DWARF debug sections">; -def defsym: J<"defsym=">, HelpText<"Define a symbol alias">; +defm defsym: Eq<"defsym", "Define a symbol alias">; -def L: JoinedOrSeparate<["-"], "L">, MetaVarName<"">, - HelpText<"Add a directory to the library search path">; +defm library_path: Eq<"library-path", "Add a directory to the library search path">, + MetaVarName<"">; def O: Joined<["-"], "O">, HelpText<"Optimize output file size">; -def Tbss: S<"Tbss">, HelpText<"Same as --section-start with .bss as the sectionname">; +defm Tbss: Eq<"Tbss", "Same as --section-start with .bss as the sectionname">; -def Tdata: S<"Tdata">, HelpText<"Same as --section-start with .data as the sectionname">; +defm Tdata: Eq<"Tdata", "Same as --section-start with .data as the sectionname">; -def Ttext: S<"Ttext">, HelpText<"Same as --section-start with .text as the sectionname">; +defm Ttext: Eq<"Ttext", "Same as --section-start with .text as the sectionname">; def allow_multiple_definition: F<"allow-multiple-definition">, HelpText<"Allow multiple definitions">; @@ -69,8 +73,7 @@ def dynamic_linker: S<"dynamic-linker">, HelpText<"Which dynamic linker to use">; -def dynamic_list: S<"dynamic-list">, - HelpText<"Read a list of dynamic symbols">; +defm dynamic_list: Eq<"dynamic-list", "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">; @@ -83,37 +86,32 @@ def end_lib: F<"end-lib">, HelpText<"End a grouping of objects that should be treated as if they were together in an archive">; -def entry: S<"entry">, MetaVarName<"">, - HelpText<"Name of entry point symbol">; +defm entry: Eq<"entry", "Name of entry point symbol">, MetaVarName<"">; -def error_limit: S<"error-limit">, - HelpText<"Maximum number of errors to emit before stopping (0 = no limit)">; +defm error_limit: Eq<"error-limit", "Maximum number of errors to emit before stopping (0 = no limit)">; def error_unresolved_symbols: F<"error-unresolved-symbols">, HelpText<"Report unresolved symbols as errors">; -def exclude_libs: S<"exclude-libs">, - HelpText<"Exclude static libraries from automatic export">; +defm exclude_libs: Eq<"exclude-libs", "Exclude static libraries from automatic export">; def export_dynamic: F<"export-dynamic">, HelpText<"Put symbols in the dynamic symbol table">; -def export_dynamic_symbol: S<"export-dynamic-symbol">, - HelpText<"Put a symbol in the dynamic symbol table">; +defm export_dynamic_symbol: Eq<"export-dynamic-symbol", "Put a symbol in the dynamic symbol table">; def fatal_warnings: F<"fatal-warnings">, HelpText<"Treat warnings as errors">; -def filter: J<"filter=">, HelpText<"Set DT_FILTER field to the specified name">; +defm filter: Eq<"filter", "Set DT_FILTER field to the specified name">; -def fini: S<"fini">, MetaVarName<"">, - HelpText<"Specify a finalizer function">; +defm fini: Eq<"fini", "Specify a finalizer function">, MetaVarName<"">; def full_shutdown : F<"full-shutdown">, HelpText<"Perform a full shutdown instead of calling _exit">; -def format: J<"format=">, MetaVarName<"">, - HelpText<"Change the input format of the inputs following this option">; +defm format: Eq<"format", "Change the input format of the inputs following this option">, + MetaVarName<"">; def gc_sections: F<"gc-sections">, HelpText<"Enable garbage collection of unused sections">; @@ -121,27 +119,24 @@ def gdb_index: F<"gdb-index">, HelpText<"Generate .gdb_index section">; -def hash_style: S<"hash-style">, - HelpText<"Specify hash style (sysv, gnu or both)">; +defm hash_style: Eq<"hash-style", "Specify hash style (sysv, gnu or both)">; def help: F<"help">, HelpText<"Print option help">; def icf: F<"icf=all">, HelpText<"Enable identical code folding">; -def image_base : J<"image-base=">, HelpText<"Set the base address">; +defm image_base : Eq<"image-base", "Set the base address">; -def init: S<"init">, MetaVarName<"">, - HelpText<"Specify an initializer function">; +defm init: Eq<"init", "Specify an initializer function">, MetaVarName<"">; -def l: JoinedOrSeparate<["-"], "l">, MetaVarName<"">, - HelpText<"Root name of library to use">; +defm library: Eq<"library", "Root name of library to use">, MetaVarName<"">; def lto_O: J<"lto-O">, MetaVarName<"">, HelpText<"Optimization level for LTO">; def m: JoinedOrSeparate<["-"], "m">, HelpText<"Set target emulation">; -def Map: JS<"Map">, HelpText<"Print a link map to the specified file">; +defm Map: Eq<"Map", "Print a link map to the specified file">; def nostdlib: F<"nostdlib">, HelpText<"Only search directories specified on the command line">; @@ -189,8 +184,7 @@ def no_undefined_version: F<"no-undefined-version">, HelpText<"Report version scripts that refer undefined symbols">; -def o: JoinedOrSeparate<["-"], "o">, MetaVarName<"">, - HelpText<"Path to file to write output">; +defm output: Eq<"output", "Path to file to write output">, MetaVarName<"">; def oformat: Separate<["--"], "oformat">, MetaVarName<"">, HelpText<"Specify the binary format for the output object file">; @@ -206,26 +200,25 @@ def print_map: F<"print-map">, HelpText<"Print a link map to the standard output">; -def reproduce: S<"reproduce">, - HelpText<"Dump linker invocation and input files for debugging">; +defm reproduce: Eq<"reproduce", "Dump linker invocation and input files for debugging">; -def rpath: S<"rpath">, HelpText<"Add a DT_RUNPATH to the output">; +defm rpath: Eq<"rpath", "Add a DT_RUNPATH to the output">; def relocatable: F<"relocatable">, HelpText<"Create relocatable object file">; -def retain_symbols_file: J<"retain-symbols-file=">, MetaVarName<"">, - HelpText<"Retain only the symbols listed in the file">; +defm retain_symbols_file: Eq<"retain-symbols-file", + "Retain only the symbols listed in the file">, MetaVarName<"">; -def script: S<"script">, HelpText<"Read linker script">; +defm script: Eq<"script", "Read linker script">; def section_start: S<"section-start">, MetaVarName<"
">, HelpText<"Set address of section">; def shared: F<"shared">, HelpText<"Build a shared object">; -def soname: J<"soname=">, HelpText<"Set DT_SONAME">; +defm soname: Eq<"soname", "Set DT_SONAME">; -def sort_section: S<"sort-section">, HelpText<"Specifies sections sorting rule when linkerscript is used">; +defm sort_section: Eq<"sort-section", "Specifies sections sorting rule when linkerscript is used">; def start_lib: F<"start-lib">, HelpText<"Start a grouping of objects that should be treated as if they were together in an archive">; @@ -237,28 +230,26 @@ def symbol_ordering_file: S<"symbol-ordering-file">, HelpText<"Layout sections in the order specified by symbol file">; -def sysroot: J<"sysroot=">, HelpText<"Set the system root">; +defm sysroot: Eq<"sysroot", "Set the system root">; def target1_rel: F<"target1-rel">, HelpText<"Interpret R_ARM_TARGET1 as R_ARM_REL32">; def target1_abs: F<"target1-abs">, HelpText<"Interpret R_ARM_TARGET1 as R_ARM_ABS32">; -def target2: J<"target2=">, MetaVarName<"">, HelpText<"Interpret R_ARM_TARGET2 as , where is one of rel, abs, or got-rel">; +defm target2: Eq<"target2", "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">; def trace: F<"trace">, HelpText<"Print the names of the input files">; -def trace_symbol : S<"trace-symbol">, HelpText<"Trace references to symbols">; +defm trace_symbol : Eq<"trace-symbol", "Trace references to symbols">; -def undefined: S<"undefined">, - HelpText<"Force undefined symbol during linking">; +defm undefined: Eq<"undefined", "Force undefined symbol during linking">; -def unresolved_symbols: J<"unresolved-symbols=">, - HelpText<"Determine how to handle unresolved symbols">; +defm unresolved_symbols: Eq<"unresolved-symbols", "Determine how to handle unresolved symbols">; -def rsp_quoting: J<"rsp-quoting=">, - HelpText<"Quoting style for response files. Values supported: windows|posix">; +defm rsp_quoting: Eq<"rsp-quoting", "Quoting style for response files. Values supported: windows|posix">; def v: Flag<["-"], "v">, HelpText<"Display the version number">; @@ -266,8 +257,7 @@ def version: F<"version">, HelpText<"Display the version number and exit">; -def version_script: S<"version-script">, - HelpText<"Read a version script">; +defm version_script: Eq<"version-script", "Read a version script">; def warn_common: F<"warn-common">, HelpText<"Warn about duplicate common symbols">; @@ -278,8 +268,7 @@ def whole_archive: F<"whole-archive">, HelpText<"Force load of all members in a static library">; -def wrap: S<"wrap">, MetaVarName<"">, - HelpText<"Use wrapper functions for symbol">; +defm wrap: Eq<"wrap", "Use wrapper functions for symbol">, MetaVarName<"">; def z: JoinedOrSeparate<["-"], "z">, MetaVarName<"