Fix -output option.
authorRui Ueyama <ruiu@google.com>
Fri, 9 Sep 2016 00:25:56 +0000 (00:25 +0000)
committerRui Ueyama <ruiu@google.com>
Fri, 9 Sep 2016 00:25:56 +0000 (00:25 +0000)
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
"--".

llvm-svn: 281004

lld/ELF/Options.td
lld/test/ELF/driver.test

index d4ee652..881d163 100644 (file)
@@ -215,8 +215,8 @@ def alias_fini_fini: J<"fini=">, Alias<fini>;
 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>;
index cc86ff2..804da98 100644 (file)
 # 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