[lld] r297508 - Options such as -omagic or -opt-remarks-* should be interpreted as -o.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 10 13:22:28 PST 2017
Author: ruiu
Date: Fri Mar 10 15:22:28 2017
New Revision: 297508
URL: http://llvm.org/viewvc/llvm-project?rev=297508&view=rev
Log:
Options such as -omagic or -opt-remarks-* should be interpreted as -o.
Options can start with `-` or `--` unless they start with "o".
Any option that starts with `-o` should be interpreted as an output
file name. This is a quote from the GNU ld man page.
Note -- there is one exception to this rule. Multiple letter
options that start with a lower case 'o' can only be preceded by
two dashes. This is to reduce confusion with the -o option.
So for example -omagic sets the output file name to magic whereas
--omagic sets the NMAGIC flag on the output.
We didn't handle that properly before.
Modified:
lld/trunk/ELF/Options.td
lld/trunk/test/ELF/lto/opt-remarks.ll
Modified: lld/trunk/ELF/Options.td
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Options.td?rev=297508&r1=297507&r2=297508&view=diff
==============================================================================
--- lld/trunk/ELF/Options.td (original)
+++ lld/trunk/ELF/Options.td Fri Mar 10 15:22:28 2017
@@ -185,7 +185,7 @@ def o: JoinedOrSeparate<["-"], "o">, Met
def oformat: Separate<["--"], "oformat">, MetaVarName<"<format>">,
HelpText<"Specify the binary format for the output object file">;
-def omagic: F<"omagic">, MetaVarName<"<magic>">,
+def omagic: Flag<["--"], "omagic">, MetaVarName<"<magic>">,
HelpText<"Set the text and data sections to be readable and writable">;
def pie: F<"pie">, HelpText<"Create a position independent executable">;
@@ -387,9 +387,9 @@ def lto_partitions: J<"lto-partitions=">
HelpText<"Number of LTO codegen partitions">;
def disable_verify: F<"disable-verify">;
def mllvm: S<"mllvm">;
-def opt_remarks_filename: S<"opt-remarks-filename">,
+def opt_remarks_filename: Separate<["--"], "opt-remarks-filename">,
HelpText<"YAML output file for optimization remarks">;
-def opt_remarks_with_hotness: F<"opt-remarks-with-hotness">,
+def opt_remarks_with_hotness: Flag<["--"], "opt-remarks-with-hotness">,
HelpText<"Include hotness informations in the optimization remarks file">;
def save_temps: F<"save-temps">;
def thinlto_cache_dir: J<"thinlto-cache-dir=">,
Modified: lld/trunk/test/ELF/lto/opt-remarks.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto/opt-remarks.ll?rev=297508&r1=297507&r2=297508&view=diff
==============================================================================
--- lld/trunk/test/ELF/lto/opt-remarks.ll (original)
+++ lld/trunk/test/ELF/lto/opt-remarks.ll Fri Mar 10 15:22:28 2017
@@ -1,9 +1,9 @@
; RUN: llvm-as %s -o %t.o
; RUN: rm -f %t.yaml
-; RUN: ld.lld -opt-remarks-filename %t.yaml %t.o -o %t -shared -save-temps
+; RUN: ld.lld --opt-remarks-filename %t.yaml %t.o -o %t -shared -save-temps
; RUN: llvm-dis %t.0.4.opt.bc -o - | FileCheck %s
-; RUN: ld.lld -opt-remarks-with-hotness -opt-remarks-filename %t.hot.yaml \
+; RUN: ld.lld --opt-remarks-with-hotness --opt-remarks-filename %t.hot.yaml \
; RUN: %t.o -o %t -shared
; RUN: cat %t.yaml | FileCheck %s -check-prefix=YAML
; RUN: cat %t.hot.yaml | FileCheck %s -check-prefix=YAML-HOT
More information about the llvm-commits
mailing list