Index: ELF/Driver.cpp =================================================================== --- ELF/Driver.cpp +++ ELF/Driver.cpp @@ -660,7 +660,7 @@ 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); @@ -806,7 +806,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 @@ -155,8 +155,8 @@ // Strip directories to prevent the issue. OS << "-o " << quote(sys::path::filename(Arg->getValue())) << "\n"; break; - case OPT_L: case OPT_dynamic_list: + case OPT_library_path: case OPT_rpath: case OPT_script: case OPT_version_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>; + 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,24 @@ def build_id_eq: J<"build-id=">, HelpText<"Generate build ID note">; -def compress_debug_sections : J<"compress-debug-sections=">, +defm compress_debug_sections : Eq<"compress-debug-sections">, HelpText<"Compress DWARF debug sections">; -def defsym: J<"defsym=">, HelpText<"Define a symbol alias">; +defm defsym: Eq<"defsym">, HelpText<"Define a symbol alias">; -def L: JoinedOrSeparate<["-"], "L">, MetaVarName<"">, - HelpText<"Add a directory to the library search path">; +defm library_path: Eq<"library-path">, + HelpText<"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">, + HelpText<"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">, + HelpText<"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">, + HelpText<"Same as --section-start with .text as the sectionname">; def allow_multiple_definition: F<"allow-multiple-definition">, HelpText<"Allow multiple definitions">; @@ -72,7 +80,7 @@ def dynamic_linker: S<"dynamic-linker">, HelpText<"Which dynamic linker to use">; -def dynamic_list: S<"dynamic-list">, +defm dynamic_list: Eq<"dynamic-list">, HelpText<"Read a list of dynamic symbols">; def eh_frame_hdr: F<"eh-frame-hdr">, @@ -86,37 +94,39 @@ 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">, HelpText<"Name of entry point symbol">, + MetaVarName<"">; -def error_limit: S<"error-limit">, +defm error_limit: Eq<"error-limit">, HelpText<"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">, +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">; -def export_dynamic_symbol: S<"export-dynamic-symbol">, +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">; -def filter: J<"filter=">, HelpText<"Set DT_FILTER field to the specified name">; +defm filter: Eq<"filter">, + HelpText<"Set DT_FILTER field to the specified name">; -def fini: S<"fini">, MetaVarName<"">, - HelpText<"Specify a finalizer function">; +defm fini: Eq<"fini">, + HelpText<"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">, + 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">; @@ -124,27 +134,27 @@ def gdb_index: F<"gdb-index">, HelpText<"Generate .gdb_index section">; -def hash_style: S<"hash-style">, +defm hash_style: Eq<"hash-style">, HelpText<"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">, HelpText<"Set the base address">; -def init: S<"init">, MetaVarName<"">, - HelpText<"Specify an initializer function">; +defm init: Eq<"init">, HelpText<"Specify an initializer function">, + MetaVarName<"">; -def l: JoinedOrSeparate<["-"], "l">, MetaVarName<"">, - HelpText<"Root name of library to use">; +defm library: Eq<"library">, HelpText<"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">, HelpText<"Print a link map to the specified file">; def nostdlib: F<"nostdlib">, HelpText<"Only search directories specified on the command line">; @@ -184,7 +194,8 @@ def nopie: F<"nopie">, HelpText<"Do not create a position independent executable">; -def no_rosegment: F<"no-rosegment">, HelpText<"Do not put read-only non-executable sections in their own segment">; +def no_rosegment: F<"no-rosegment">, + HelpText<"Do not put read-only non-executable sections in their own segment">; def no_undefined: F<"no-undefined">, HelpText<"Report unresolved symbols even if the linker is creating a shared library">; @@ -209,26 +220,28 @@ def print_map: F<"print-map">, HelpText<"Print a link map to the standard output">; -def reproduce: S<"reproduce">, +defm reproduce: Eq<"reproduce">, HelpText<"Dump linker invocation and input files for debugging">; -def rpath: S<"rpath">, HelpText<"Add a DT_RUNPATH to the output">; +defm rpath: Eq<"rpath">, HelpText<"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">, + HelpText<"Retain only the symbols listed in the file">, + MetaVarName<"">; -def script: S<"script">, HelpText<"Read linker script">; +defm script: Eq<"script">, HelpText<"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">, HelpText<"Set DT_SONAME">; -def sort_section: S<"sort-section">, HelpText<"Specifies sections sorting rule when linkerscript is used">; +defm sort_section: Eq<"sort-section">, + HelpText<"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">; @@ -240,27 +253,29 @@ 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">, HelpText<"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">, + 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">; 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">, HelpText<"Trace references to symbols">; -def undefined: S<"undefined">, +defm undefined: Eq<"undefined">, HelpText<"Force undefined symbol during linking">; -def unresolved_symbols: J<"unresolved-symbols=">, +defm unresolved_symbols: Eq<"unresolved-symbols">, HelpText<"Determine how to handle unresolved symbols">; -def rsp_quoting: J<"rsp-quoting=">, +defm rsp_quoting: Eq<"rsp-quoting">, HelpText<"Quoting style for response files. Values supported: windows|posix">; def v: Flag<["-"], "v">, HelpText<"Display the version number">; @@ -269,8 +284,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">, HelpText<"Read a version script">; def warn_common: F<"warn-common">, HelpText<"Warn about duplicate common symbols">; @@ -281,8 +295,8 @@ 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">, HelpText<"Use wrapper functions for symbol">, + MetaVarName<"">; def z: JoinedOrSeparate<["-"], "z">, MetaVarName<"