diff options
author | Rui Ueyama <ruiu@google.com> | 2017-09-14 18:33:21 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2017-09-14 18:33:21 +0000 |
commit | 1f4cdcfec93e3c6fa7d9ccd552c6b48fab6831cc (patch) | |
tree | 2501b297c7786db92fe1269e72431b2a32bfaa0b | |
parent | b359263011f3a7dfbc0200049ff5f039c17be49b (diff) | |
download | llvm-1f4cdcfec93e3c6fa7d9ccd552c6b48fab6831cc.zip llvm-1f4cdcfec93e3c6fa7d9ccd552c6b48fab6831cc.tar.gz llvm-1f4cdcfec93e3c6fa7d9ccd552c6b48fab6831cc.tar.bz2 |
Accept not only --foo but also -foo.
GNU ld manual says that multi-letter long option can be prefixed with
either -- or -. Therefore, we should accept not only --subsystem but
also -subsystem, for example.
There is one exception. If an option starts with "o", it should only be
prefixed with -- to avoid ambiguity with -o<filename> option.
Differential Revision: https://reviews.llvm.org/D37825
llvm-svn: 313286
-rw-r--r-- | lld/MinGW/Options.td | 10 | ||||
-rw-r--r-- | lld/test/MinGW/driver.test | 7 |
2 files changed, 12 insertions, 5 deletions
diff --git a/lld/MinGW/Options.td b/lld/MinGW/Options.td index 53fb656..7909341 100644 --- a/lld/MinGW/Options.td +++ b/lld/MinGW/Options.td @@ -18,8 +18,8 @@ def o: JoinedOrSeparate<["-"], "o">, MetaVarName<"<path>">, HelpText<"Path to file to write output">; def out_implib: Separate<["--"], "out-implib">, HelpText<"Import library name">; def shared: F<"shared">, HelpText<"Build a shared object">; -def subs: Separate<["--"], "subsystem">, HelpText<"Specify subsystem">; -def stack: Separate<["--"], "stack">; +def subs: S<"subsystem">, HelpText<"Specify subsystem">; +def stack: S<"stack">; def whole_archive: F<"whole-archive">, HelpText<"Include all object files for following archives">; def verbose: F<"verbose">, HelpText<"Verbose mode">; @@ -32,10 +32,10 @@ def _HASH_HASH_HASH : Flag<["-"], "###">, def Bdynamic: F<"Bdynamic">, HelpText<"Link against shared libraries">; def Bstatic: F<"Bstatic">, HelpText<"Do not link against shared libraries">; def O: Joined<["-"], "O">, HelpText<"Optimize output file size">; -def enable_auto_image_base: Flag<["--"], "enable-auto-image-base">; +def enable_auto_image_base: F<"enable-auto-image-base">; def full_shutdown: Flag<["--"], "full-shutdown">; -def major_image_version: Separate<["--"], "major-image-version">; -def minor_image_version: Separate<["--"], "minor-image-version">; +def major_image_version: S<"major-image-version">; +def minor_image_version: S<"minor-image-version">; def sysroot: J<"sysroot">, HelpText<"Sysroot">; def v: Flag<["-"], "v">, HelpText<"Display the version number">; def version: F<"version">, HelpText<"Display the version number and exit">; diff --git a/lld/test/MinGW/driver.test b/lld/test/MinGW/driver.test index 109516b..5ed1d76 100644 --- a/lld/test/MinGW/driver.test +++ b/lld/test/MinGW/driver.test @@ -23,6 +23,7 @@ ARM64-SAME: -alternatename:__image_base__=__ImageBase ARM64-SAME: foo.o RUN: ld.lld -### foo.o -m i386pep -shared | FileCheck -check-prefix=SHARED %s +RUN: ld.lld -### foo.o -m i386pep --shared | FileCheck -check-prefix=SHARED %s SHARED: -out:a.dll SHARED-SAME: -dll @@ -32,22 +33,27 @@ DEF1: -def:foo.def RUN: ld.lld -### foo.o -m i386pep -shared FOO.DEF | FileCheck -check-prefix=DEF2 %s DEF2: -def:FOO.DEF +RUN: ld.lld -### foo.o -m i386pep -obar.exe | FileCheck -check-prefix=OUT %s RUN: ld.lld -### foo.o -m i386pep -o bar.exe | FileCheck -check-prefix=OUT %s OUT: -out:bar.exe RUN: ld.lld -### foo.o -m i386pep -e bar | FileCheck -check-prefix=ENTRY %s +RUN: ld.lld -### foo.o -m i386pep -entry bar | FileCheck -check-prefix=ENTRY %s RUN: ld.lld -### foo.o -m i386pep --entry bar | FileCheck -check-prefix=ENTRY %s ENTRY: -entry:bar RUN: ld.lld -### foo.o -m i386pep -mllvm bar -mllvm baz | FileCheck -check-prefix=MLLVM %s MLLVM: -mllvm:bar -mllvm:baz +RUN: ld.lld -### foo.o -m i386pep -subsystem console | FileCheck -check-prefix=SUBSYSTEM %s RUN: ld.lld -### foo.o -m i386pep --subsystem console | FileCheck -check-prefix=SUBSYSTEM %s SUBSYSTEM: -subsystem:console +RUN: ld.lld -### foo.o -m i386pep -stack 4194304,8192 | FileCheck -check-prefix=STACK %s RUN: ld.lld -### foo.o -m i386pep --stack 4194304,8192 | FileCheck -check-prefix=STACK %s STACK: -stack:4194304,8192 +RUN: ld.lld -### foo.o -m i386pep -verbose | FileCheck -check-prefix=VERBOSE %s RUN: ld.lld -### foo.o -m i386pep --verbose | FileCheck -check-prefix=VERBOSE %s VERBOSE: -verbose @@ -55,6 +61,7 @@ RUN: ld.lld -### -shared -m i386pe -e _DllMainCRTStartup@12 foo.o | FileCheck -c I386-ENTRY: -entry:DllMainCRTStartup@12 RUN: ld.lld -### -m i386pep foo.o --whole-archive bar.a --no-whole-archive baz.a | FileCheck -check-prefix WHOLE-ARCHIVE %s +RUN: ld.lld -### -m i386pep foo.o -whole-archive bar.a -no-whole-archive baz.a | FileCheck -check-prefix WHOLE-ARCHIVE %s WHOLE-ARCHIVE: foo.o -wholearchive:bar.a baz.a RUN: ld.lld -### -m i386pep foo.o | FileCheck -check-prefix MINGW-FLAG %s |