[lld] 7b265e9 - [ELF] Move -l -L canonical and --library-path --library aliases

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 15 21:49:59 PST 2021


Author: Fangrui Song
Date: 2021-12-15T21:49:53-08:00
New Revision: 7b265e979152a7293b6dd2c3ab75c1bc8488cc77

URL: https://github.com/llvm/llvm-project/commit/7b265e979152a7293b6dd2c3ab75c1bc8488cc77
DIFF: https://github.com/llvm/llvm-project/commit/7b265e979152a7293b6dd2c3ab75c1bc8488cc77.diff

LOG: [ELF] Move -l -L canonical and --library-path --library aliases

Everyone uses -l -L instead of the long option counterparts.
Make help messages attach to -L -l and (--reproduce) use them for response.txt
command line options.

Added: 
    

Modified: 
    lld/ELF/Options.td
    lld/test/ELF/reproduce.s

Removed: 
    


################################################################################
diff  --git a/lld/ELF/Options.td b/lld/ELF/Options.td
index f9f9f54a80d88..bddf13a3cb425 100644
--- a/lld/ELF/Options.td
+++ b/lld/ELF/Options.td
@@ -79,9 +79,6 @@ defm split_stack_adjust_size
          "non-split-stack function">,
       MetaVarName<"<value>">;
 
-defm library_path:
-  Eq<"library-path", "Add a directory to the library search path">, MetaVarName<"<dir>">;
-
 def O: JoinedOrSeparate<["-"], "O">, HelpText<"Optimize output file size">;
 
 defm Tbss: Eq<"Tbss", "Same as --section-start with .bss as the sectionname">;
@@ -266,8 +263,10 @@ defm just_symbols: Eq<"just-symbols", "Just link symbols">;
 
 defm keep_unique: Eq<"keep-unique", "Do not fold this symbol during ICF">;
 
-defm library: Eq<"library", "Root name of library to use">,
-  MetaVarName<"<libName>">;
+def library: JoinedOrSeparate<["-"], "l">, MetaVarName<"<libname>">,
+  HelpText<"Search for library <libname>">;
+def library_path: JoinedOrSeparate<["-"], "L">, MetaVarName<"<dir>">,
+  HelpText<"Add <dir> to the library search path">;
 
 def m: JoinedOrSeparate<["-"], "m">, HelpText<"Set target emulation">;
 
@@ -524,8 +523,10 @@ def: JoinedOrSeparate<["-"], "e">, Alias<entry>, HelpText<"Alias for --entry">;
 def: Flag<["-"], "E">, Alias<export_dynamic>, HelpText<"Alias for --export-dynamic">;
 def: Separate<["-"], "F">, Alias<filter>, HelpText<"Alias for --filter">;
 def: Separate<["-"], "b">, Alias<format>, HelpText<"Alias for --format">;
-def: JoinedOrSeparate<["-"], "l">, Alias<library>, HelpText<"Alias for --library">;
-def: JoinedOrSeparate<["-"], "L">, Alias<library_path>, HelpText<"Alias for --library-path">;
+def: Separate<["--", "-"], "library">, Alias<library>;
+def: Joined<["--", "-"], "library=">, Alias<library>;
+def: Separate<["--", "-"], "library-path">, Alias<library_path>;
+def: Joined<["--", "-"], "library-path=">, Alias<library_path>;
 def: Flag<["-"], "n">, Alias<nmagic>, HelpText<"Alias for --nmagic">;
 def: Flag<["-"], "N">, Alias<omagic>, HelpText<"Alias for --omagic">;
 def: Joined<["--"], "output=">, Alias<o>, HelpText<"Alias for -o">;

diff  --git a/lld/test/ELF/reproduce.s b/lld/test/ELF/reproduce.s
index 3f42c20bf273b..cc20804935033 100644
--- a/lld/test/ELF/reproduce.s
+++ b/lld/test/ELF/reproduce.s
@@ -44,8 +44,8 @@
 # RUN: tar xOf repro3.tar repro3/response.txt | FileCheck %s --check-prefix=RSP3
 # RSP3:      --chroot .
 # RSP3:      "{{.*}}foo bar"
-# RSP3-NEXT: --library-path "[[BASEDIR:.+]]/foo bar"
-# RSP3-NEXT: --library-path [[BASEDIR]]/file
+# RSP3-NEXT: -L "[[BASEDIR:.+]]/foo bar"
+# RSP3-NEXT: -L [[BASEDIR]]/file
 # RSP3-NEXT: --script [[BASEDIR]]/file2
 # RSP3-NEXT: --dynamic-list [[BASEDIR]]/dyn
 # RSP3-NEXT: -rpath [[BASEDIR]]/file


        


More information about the llvm-commits mailing list