aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2022-01-06 01:02:14 -0800
committerFangrui Song <i@maskray.me>2022-01-06 01:02:14 -0800
commit6e4bbbfcc8327465440da38d86f1f4b37d452e43 (patch)
tree2a312cefe97b681af83532324a71ae932526cef6
parentc41aa41957c102fdbe1e92c31fd1aec1c5fccbd5 (diff)
downloadllvm-6e4bbbfcc8327465440da38d86f1f4b37d452e43.zip
llvm-6e4bbbfcc8327465440da38d86f1f4b37d452e43.tar.gz
llvm-6e4bbbfcc8327465440da38d86f1f4b37d452e43.tar.bz2
[ELF] Enforce double-dash form for --color-diagnostics/--rsp-quoting/--symbol-ordering-file
They are LLD-specific and by convention we enforce the double-dash form to avoid collision with short options (e.g. weird `-c olor-diagnostics` interpretation in GNU ld). They are rarely used and to the best of my investigation the undesired single-dash forms are not used in the wild.
-rw-r--r--lld/ELF/Options.td8
-rw-r--r--lld/test/ELF/color-diagnostics.test10
2 files changed, 9 insertions, 9 deletions
diff --git a/lld/ELF/Options.td b/lld/ELF/Options.td
index 14b138e..ca9fdcd 100644
--- a/lld/ELF/Options.td
+++ b/lld/ELF/Options.td
@@ -119,10 +119,10 @@ defm call_graph_profile_sort: BB<"call-graph-profile-sort",
// --chroot doesn't have a help text because it is an internal option.
def chroot: Separate<["--"], "chroot">;
-defm color_diagnostics: B<"color-diagnostics",
+defm color_diagnostics: BB<"color-diagnostics",
"Alias for --color-diagnostics=always",
"Alias for --color-diagnostics=never">;
-def color_diagnostics_eq: J<"color-diagnostics=">,
+def color_diagnostics_eq: JJ<"color-diagnostics=">,
HelpText<"Use colors in diagnostics (default: auto)">,
MetaVarName<"[auto,always,never]">;
@@ -395,7 +395,7 @@ def strip_all: F<"strip-all">, HelpText<"Strip all symbols. Implies --strip-debu
def strip_debug: F<"strip-debug">, HelpText<"Strip debugging information">;
defm symbol_ordering_file:
- Eq<"symbol-ordering-file", "Layout sections to place symbols in the order specified by symbol ordering file">;
+ EEq<"symbol-ordering-file", "Layout sections to place symbols in the order specified by symbol ordering file">;
defm sysroot: Eq<"sysroot", "Set the system root">;
@@ -445,7 +445,7 @@ defm undefined_version: B<"undefined-version",
"Allow unused version in version script (default)",
"Report version scripts that refer undefined symbols">;
-defm rsp_quoting: Eq<"rsp-quoting", "Quoting style for response files">,
+defm rsp_quoting: EEq<"rsp-quoting", "Quoting style for response files">,
MetaVarName<"[posix,windows]">;
def v: Flag<["-"], "v">, HelpText<"Display the version number">;
diff --git a/lld/test/ELF/color-diagnostics.test b/lld/test/ELF/color-diagnostics.test
index 7f1e46c..6d87b11 100644
--- a/lld/test/ELF/color-diagnostics.test
+++ b/lld/test/ELF/color-diagnostics.test
@@ -1,21 +1,21 @@
# Windows command prompt doesn't support ANSI escape sequences.
# REQUIRES: shell
-# RUN: not ld.lld -xyz -color-diagnostics /nosuchfile 2>&1 \
+# RUN: not ld.lld -xyz --color-diagnostics /nosuchfile 2>&1 \
# RUN: | FileCheck -check-prefix=COLOR %s
-# RUN: not ld.lld -xyz -color-diagnostics=always /nosuchfile 2>&1 \
+# RUN: not ld.lld -xyz --color-diagnostics=always /nosuchfile 2>&1 \
# RUN: | FileCheck -check-prefix=COLOR %s
# COLOR: {{ld.lld: .\[0;31merror: .\[0munknown argument '-xyz'}}
# COLOR: {{ld.lld: .\[0;31merror: .\[0mcannot open /nosuchfile}}
-# RUN: not ld.lld -color-diagnostics=foobar 2>&1 | FileCheck -check-prefix=ERR %s
+# RUN: not ld.lld --color-diagnostics=foobar 2>&1 | FileCheck -check-prefix=ERR %s
# ERR: unknown option: --color-diagnostics=foobar
# RUN: not ld.lld /nosuchfile 2>&1 | FileCheck -check-prefix=NOCOLOR %s
-# RUN: not ld.lld -color-diagnostics=never /nosuchfile 2>&1 \
+# RUN: not ld.lld --color-diagnostics=never /nosuchfile 2>&1 \
# RUN: | FileCheck -check-prefix=NOCOLOR %s
-# RUN: not ld.lld -color-diagnostics=always -no-color-diagnostics \
+# RUN: not ld.lld --color-diagnostics=always --no-color-diagnostics \
# RUN: /nosuchfile 2>&1 | FileCheck -check-prefix=NOCOLOR %s
# NOCOLOR: ld.lld: error: cannot open /nosuchfile