Index: test/tools/llvm-objcopy/ELF/help-message.test =================================================================== --- test/tools/llvm-objcopy/ELF/help-message.test +++ test/tools/llvm-objcopy/ELF/help-message.test @@ -1,11 +1,11 @@ -# RUN: llvm-objcopy -help | FileCheck --check-prefix=OBJCOPY-USAGE %s +# RUN: llvm-objcopy -h | FileCheck --check-prefix=OBJCOPY-USAGE %s # RUN: llvm-objcopy --help | FileCheck --check-prefix=OBJCOPY-USAGE %s # RUN: not llvm-objcopy 2>&1 | FileCheck --check-prefix=OBJCOPY-USAGE %s # RUN: not llvm-objcopy -abcabc 2>&1 | FileCheck --check-prefix=UNKNOWN-ARG %s # RUN: not llvm-objcopy --abcabc 2>&1 | FileCheck --check-prefix=UNKNOWN-ARG %s # RUN: not llvm-objcopy --strip-debug 2>&1 | FileCheck %s --check-prefix=NO-INPUT-FILES -# RUN: llvm-strip -help | FileCheck --check-prefix=STRIP-USAGE %s +# RUN: llvm-strip -h | FileCheck --check-prefix=STRIP-USAGE %s # RUN: llvm-strip --help | FileCheck --check-prefix=STRIP-USAGE %s # RUN: not llvm-strip 2>&1 | FileCheck --check-prefix=STRIP-USAGE %s # RUN: not llvm-strip -abcabc 2>&1 | FileCheck --check-prefix=UNKNOWN-ARG %s Index: test/tools/llvm-objcopy/ELF/objcopy-version.test =================================================================== --- test/tools/llvm-objcopy/ELF/objcopy-version.test +++ test/tools/llvm-objcopy/ELF/objcopy-version.test @@ -1,4 +1,3 @@ -# RUN: llvm-objcopy -version | FileCheck %s # RUN: llvm-objcopy --version | FileCheck %s # RUN: llvm-objcopy -V | FileCheck %s Index: test/tools/llvm-objcopy/ELF/strip-all.test =================================================================== --- test/tools/llvm-objcopy/ELF/strip-all.test +++ test/tools/llvm-objcopy/ELF/strip-all.test @@ -28,27 +28,23 @@ # RUN: cmp %t2 %t6 # RUN: cp %t %t7 -# RUN: llvm-strip -strip-all %t7 +# RUN: llvm-strip --strip-all %t7 # RUN: cmp %t2 %t7 # RUN: cp %t %t8 -# RUN: llvm-strip --strip-all %t8 +# RUN: llvm-objcopy -S %t8 %t8 # RUN: cmp %t2 %t8 # RUN: cp %t %t9 -# RUN: llvm-objcopy -S %t9 %t9 +# RUN: llvm-strip -s %t9 # RUN: cmp %t2 %t9 -# RUN: cp %t %t10 -# RUN: llvm-strip -s %t10 -# RUN: cmp %t2 %t10 - # Verify that a non-existent symbol table (after first call to llvm-strip) # can be handled correctly. -# RUN: cp %t %t11 -# RUN: llvm-strip --strip-all --keep-symbol=unavailable_symbol %t11 -# RUN: llvm-strip --strip-all --keep-symbol=unavailable_symbol %t11 -# RUN: cmp %t2 %t11 +# RUN: cp %t %t10 +# RUN: llvm-strip --strip-all --keep-symbol=unavailable_symbol %t10 +# RUN: llvm-strip --strip-all --keep-symbol=unavailable_symbol %t10 +# RUN: cmp %t2 %t10 !ELF FileHeader: Index: test/tools/llvm-objcopy/ELF/strip-version.test =================================================================== --- test/tools/llvm-objcopy/ELF/strip-version.test +++ test/tools/llvm-objcopy/ELF/strip-version.test @@ -1,4 +1,3 @@ -# RUN: llvm-strip -version | FileCheck %s # RUN: llvm-strip --version | FileCheck %s # RUN: llvm-strip -V | FileCheck %s Index: tools/llvm-objcopy/ObjcopyOpts.td =================================================================== --- tools/llvm-objcopy/ObjcopyOpts.td +++ tools/llvm-objcopy/ObjcopyOpts.td @@ -1,16 +1,17 @@ include "llvm/Option/OptParser.td" multiclass Eq { - def NAME : Separate<["--", "-"], name>; - def NAME #_eq : Joined<["--", "-"], name #"=">, + def NAME : Separate<["--"], name>; + def NAME #_eq : Joined<["--"], name #"=">, Alias(NAME)>, HelpText; } -def help : Flag<["-", "--"], "help">; +def help : Flag<["--"], "help">; +def h : Flag<["-"], "h">, Alias; def allow_broken_links - : Flag<["-", "--"], "allow-broken-links">, + : Flag<["--"], "allow-broken-links">, HelpText<"Allow llvm-objcopy to remove sections even if it would leave " "invalid section references. The appropriate sh_link fields" "will be set to zero.">; @@ -32,13 +33,13 @@ Values<"binary">; def O : JoinedOrSeparate<["-"], "O">, Alias; -def compress_debug_sections : Flag<["--", "-"], "compress-debug-sections">; +def compress_debug_sections : Flag<["--"], "compress-debug-sections">; def compress_debug_sections_eq - : Joined<["--", "-"], "compress-debug-sections=">, + : Joined<["--"], "compress-debug-sections=">, MetaVarName<"[ zlib | zlib-gnu ]">, HelpText<"Compress DWARF debug sections using specified style. Supported " "styles: 'zlib-gnu' and 'zlib'">; -def decompress_debug_sections : Flag<["-", "--"], "decompress-debug-sections">, +def decompress_debug_sections : Flag<["--"], "decompress-debug-sections">, HelpText<"Decompress DWARF debug sections.">; defm split_dwo : Eq<"split-dwo", "Equivalent to extract-dwo on the input file to " @@ -46,7 +47,7 @@ MetaVarName<"dwo-file">; def enable_deterministic_archives - : Flag<["-", "--"], "enable-deterministic-archives">, + : Flag<["--"], "enable-deterministic-archives">, HelpText<"Enable deterministic mode when copying archives (use zero for " "UIDs, GIDs, and timestamps).">; def D : Flag<["-"], "D">, @@ -54,14 +55,14 @@ HelpText<"Alias for --enable-deterministic-archives">; def disable_deterministic_archives - : Flag<["-", "--"], "disable-deterministic-archives">, + : Flag<["--"], "disable-deterministic-archives">, HelpText<"Disable deterministic mode when copying archives (use real " "values for UIDs, GIDs, and timestamps).">; def U : Flag<["-"], "U">, Alias, HelpText<"Alias for --disable-deterministic-archives">; -def preserve_dates : Flag<["-", "--"], "preserve-dates">, +def preserve_dates : Flag<["--"], "preserve-dates">, HelpText<"Preserve access and modification timestamps">; def p : Flag<["-"], "p">, Alias; @@ -109,25 +110,25 @@ "rom, share, contents, merge, strings.">, MetaVarName<"section=flag1[,flag2,...]">; -def strip_all : Flag<["-", "--"], "strip-all">, +def strip_all : Flag<["--"], "strip-all">, HelpText<"Remove non-allocated sections outside segments. " ".gnu.warning* sections are not removed">; def S : Flag<["-"], "S">, Alias; -def strip_all_gnu : Flag<["-", "--"], "strip-all-gnu">, +def strip_all_gnu : Flag<["--"], "strip-all-gnu">, HelpText<"Compatible with GNU objcopy's --strip-all">; -def strip_debug : Flag<["-", "--"], "strip-debug">, +def strip_debug : Flag<["--"], "strip-debug">, HelpText<"Remove all debug information">; def g : Flag<["-"], "g">, Alias, HelpText<"Alias for --strip-debug">; -def strip_dwo : Flag<["-", "--"], "strip-dwo">, +def strip_dwo : Flag<["--"], "strip-dwo">, HelpText<"Remove all DWARF .dwo sections from file">; def strip_sections - : Flag<["-", "--"], "strip-sections">, + : Flag<["--"], "strip-sections">, HelpText<"Remove all section headers and all sections not in segments">; def strip_non_alloc - : Flag<["-", "--"], "strip-non-alloc">, + : Flag<["--"], "strip-non-alloc">, HelpText<"Remove all non-allocated sections outside segments">; -def strip_unneeded : Flag<["-", "--"], "strip-unneeded">, +def strip_unneeded : Flag<["--"], "strip-unneeded">, HelpText<"Remove all symbols not needed by relocations">; defm strip_unneeded_symbol : Eq<"strip-unneeded-symbol", @@ -140,12 +141,12 @@ MetaVarName<"filename">; def extract_dwo - : Flag<["-", "--"], "extract-dwo">, + : Flag<["--"], "extract-dwo">, HelpText< "Remove all sections that are not DWARF .dwo sections from file">; def localize_hidden - : Flag<["-", "--"], "localize-hidden">, + : Flag<["--"], "localize-hidden">, HelpText< "Mark all symbols that have hidden or internal visibility as local">; defm localize_symbol : Eq<"localize-symbol", "Mark as local">, @@ -189,16 +190,16 @@ MetaVarName<"filename">; def W : JoinedOrSeparate<["-"], "W">, Alias; -def weaken : Flag<["-", "--"], "weaken">, +def weaken : Flag<["--"], "weaken">, HelpText<"Mark all global symbols as weak">; -def discard_locals : Flag<["-", "--"], "discard-locals">, +def discard_locals : Flag<["--"], "discard-locals">, HelpText<"Remove compiler-generated local symbols, (e.g. " "symbols starting with .L)">; def X : Flag<["-"], "X">, Alias; def discard_all - : Flag<["-", "--"], "discard-all">, + : Flag<["--"], "discard-all">, HelpText<"Remove all local symbols except file and section symbols">; def x : Flag<["-"], "x">, Alias; defm strip_symbol : Eq<"strip-symbol", "Remove symbol ">, @@ -223,11 +224,11 @@ MetaVarName<"filename">; def only_keep_debug - : Flag<["-", "--"], "only-keep-debug">, + : Flag<["--"], "only-keep-debug">, HelpText<"Clear sections that would not be stripped by --strip-debug. " "Currently only implemented for COFF.">; -def keep_file_symbols : Flag<["-", "--"], "keep-file-symbols">, +def keep_file_symbols : Flag<["--"], "keep-file-symbols">, HelpText<"Do not remove file symbols">; defm dump_section : Eq<"dump-section", @@ -237,7 +238,7 @@ : Eq<"prefix-symbols", "Add to the start of every symbol name">, MetaVarName<"prefix">; -def version : Flag<["-", "--"], "version">, +def version : Flag<["--"], "version">, HelpText<"Print the version and exit.">; def V : Flag<["-"], "V">, Alias; defm build_id_link_dir @@ -254,7 +255,7 @@ MetaVarName<"suffix">; def regex - : Flag<["-", "--"], "regex">, + : Flag<["--"], "regex">, HelpText<"Permit regular expressions in name comparison">; defm set_start : Eq<"set-start", "Set the start address to . Overrides " @@ -264,7 +265,7 @@ "specified multiple times, all values will be applied " "cumulatively.">, MetaVarName<"incr">; -def adjust_start : JoinedOrSeparate<["-", "--"], "adjust-start">, +def adjust_start : JoinedOrSeparate<["--"], "adjust-start">, Alias; defm add_symbol Index: tools/llvm-objcopy/StripOpts.td =================================================================== --- tools/llvm-objcopy/StripOpts.td +++ tools/llvm-objcopy/StripOpts.td @@ -1,22 +1,23 @@ include "llvm/Option/OptParser.td" multiclass Eq { - def NAME : Separate<["--", "-"], name>; - def NAME #_eq : Joined<["--", "-"], name #"=">, + def NAME : Separate<["--"], name>; + def NAME #_eq : Joined<["--"], name #"=">, Alias(NAME)>, HelpText; } -def help : Flag<["-", "--"], "help">; +def help : Flag<["--"], "help">; +def h : Flag<["-"], "h">, Alias; def allow_broken_links - : Flag<["-", "--"], "allow-broken-links">, + : Flag<["--"], "allow-broken-links">, HelpText<"Allow llvm-strip to remove sections even if it would leave " "invalid section references. The appropriate sh_link fields" "will be set to zero.">; def enable_deterministic_archives - : Flag<["-", "--"], "enable-deterministic-archives">, + : Flag<["--"], "enable-deterministic-archives">, HelpText<"Enable deterministic mode when stripping archives (use zero " "for UIDs, GIDs, and timestamps).">; def D : Flag<["-"], "D">, @@ -24,32 +25,32 @@ HelpText<"Alias for --enable-deterministic-archives">; def disable_deterministic_archives - : Flag<["-", "--"], "disable-deterministic-archives">, + : Flag<["--"], "disable-deterministic-archives">, HelpText<"Disable deterministic mode when stripping archives (use real " "values for UIDs, GIDs, and timestamps).">; def U : Flag<["-"], "U">, Alias, HelpText<"Alias for --disable-deterministic-archives">; -defm output : Eq<"o", "Write output to ">, MetaVarName<"output">; +def output : JoinedOrSeparate<["-"], "o">, HelpText<"Write output to ">; -def preserve_dates : Flag<["-", "--"], "preserve-dates">, +def preserve_dates : Flag<["--"], "preserve-dates">, HelpText<"Preserve access and modification timestamps">; def p : Flag<["-"], "p">, Alias; -def strip_all : Flag<["-", "--"], "strip-all">, +def strip_all : Flag<["--"], "strip-all">, HelpText<"Remove non-allocated sections outside segments. " ".gnu.warning* sections are not removed">; def s : Flag<["-"], "s">, Alias; -def strip_all_gnu : Flag<["-", "--"], "strip-all-gnu">, +def strip_all_gnu : Flag<["--"], "strip-all-gnu">, HelpText<"Compatible with GNU strip's --strip-all">; -def strip_debug : Flag<["-", "--"], "strip-debug">, +def strip_debug : Flag<["--"], "strip-debug">, HelpText<"Remove debugging symbols only">; def d : Flag<["-"], "d">, Alias; def g : Flag<["-"], "g">, Alias; def S : Flag<["-"], "S">, Alias; -def strip_unneeded : Flag<["-", "--"], "strip-unneeded">, +def strip_unneeded : Flag<["--"], "strip-unneeded">, HelpText<"Remove all symbols not needed by relocations">; defm remove_section : Eq<"remove-section", "Remove
">, @@ -64,30 +65,30 @@ MetaVarName<"section">; defm keep_symbol : Eq<"keep-symbol", "Do not remove symbol ">, MetaVarName<"symbol">; -def keep_file_symbols : Flag<["-", "--"], "keep-file-symbols">, +def keep_file_symbols : Flag<["--"], "keep-file-symbols">, HelpText<"Do not remove file symbols">; def K : JoinedOrSeparate<["-"], "K">, Alias; def only_keep_debug - : Flag<["-", "--"], "only-keep-debug">, + : Flag<["--"], "only-keep-debug">, HelpText<"Clear sections that would not be stripped by --strip-debug. " "Currently only implemented for COFF.">; -def discard_locals : Flag<["-", "--"], "discard-locals">, +def discard_locals : Flag<["--"], "discard-locals">, HelpText<"Remove compiler-generated local symbols, (e.g. " "symbols starting with .L)">; def X : Flag<["-"], "X">, Alias; def discard_all - : Flag<["-", "--"], "discard-all">, + : Flag<["--"], "discard-all">, HelpText<"Remove all local symbols except file and section symbols">; def x : Flag<["-"], "x">, Alias; def regex - : Flag<["-", "--"], "regex">, + : Flag<["--"], "regex">, HelpText<"Permit regular expressions in name comparison">; -def version : Flag<["-", "--"], "version">, +def version : Flag<["--"], "version">, HelpText<"Print the version and exit.">; def V : Flag<["-"], "V">, Alias;