[lld] r281004 - Fix -output option.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 8 17:25:57 PDT 2016


Author: ruiu
Date: Thu Sep  8 19:25:56 2016
New Revision: 281004

URL: http://llvm.org/viewvc/llvm-project?rev=281004&view=rev
Log:
Fix -output option.

Usually, options that are longer than one character can be preceded
either by "-" or "--", but options starting with "o" are exceptions
because they conflict with "-o" option. They have to be preceded by
"--".

Modified:
    lld/trunk/ELF/Options.td
    lld/trunk/test/ELF/driver.test

Modified: lld/trunk/ELF/Options.td
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Options.td?rev=281004&r1=281003&r2=281004&view=diff
==============================================================================
--- lld/trunk/ELF/Options.td (original)
+++ lld/trunk/ELF/Options.td Thu Sep  8 19:25:56 2016
@@ -215,8 +215,8 @@ def alias_fini_fini: J<"fini=">, Alias<f
 def alias_hash_style_hash_style: J<"hash-style=">, Alias<hash_style>;
 def alias_init_init: J<"init=">, Alias<init>;
 def alias_l__library: J<"library=">, Alias<l>;
-def alias_o_output: J<"output=">, Alias<o>;
-def alias_o_output2 : S<"output">, Alias<o>;
+def alias_o_output: Joined<["--"], "output=">, Alias<o>;
+def alias_o_output2 : Separate<["--"], "output">, Alias<o>;
 def alias_pie_pic_executable: F<"pic-executable">, Alias<pie>;
 def alias_relocatable_r: Flag<["-"], "r">, Alias<relocatable>;
 def alias_rpath_R: Joined<["-"], "R">, Alias<rpath>;

Modified: lld/trunk/test/ELF/driver.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/driver.test?rev=281004&r1=281003&r2=281004&view=diff
==============================================================================
--- lld/trunk/test/ELF/driver.test (original)
+++ lld/trunk/test/ELF/driver.test Thu Sep  8 19:25:56 2016
@@ -44,6 +44,14 @@
 # RUN: not ld.lld -shared -pie %t -o %tfail 2>&1 | FileCheck -check-prefix=ERR6 %s
 # ERR6: -shared and -pie may not be used together
 
+## "--output=foo" is equivalent to "-o foo".
+# RUN: not ld.lld %t --output=/no/such/file 2>&1 | FileCheck -check-prefix=ERR7 %s
+# ERR7: failed to open /no/such/file
+
+## "-output=foo" is equivalent to "-o utput=foo".
+# RUN: not ld.lld %t -output=/no/such/file 2>&1 | FileCheck -check-prefix=ERR8 %s
+# ERR8: failed to open utput=/no/such/file
+
 .globl _start
 _start:
   nop




More information about the llvm-commits mailing list