aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm/tools/llvm-objcopy/ObjcopyOpts.td
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/tools/llvm-objcopy/ObjcopyOpts.td')
-rw-r--r--contrib/llvm/tools/llvm-objcopy/ObjcopyOpts.td166
1 files changed, 137 insertions, 29 deletions
diff --git a/contrib/llvm/tools/llvm-objcopy/ObjcopyOpts.td b/contrib/llvm/tools/llvm-objcopy/ObjcopyOpts.td
index 1f7e64e4091c..5fce4fbde539 100644
--- a/contrib/llvm/tools/llvm-objcopy/ObjcopyOpts.td
+++ b/contrib/llvm/tools/llvm-objcopy/ObjcopyOpts.td
@@ -1,13 +1,20 @@
include "llvm/Option/OptParser.td"
multiclass Eq<string name, string help> {
- def NAME : Separate<["--", "-"], name>;
- def NAME #_eq : Joined<["--", "-"], name #"=">,
+ def NAME : Separate<["--"], name>;
+ def NAME #_eq : Joined<["--"], name #"=">,
Alias<!cast<Separate>(NAME)>,
HelpText<help>;
}
-def help : Flag<["-", "--"], "help">;
+def help : Flag<["--"], "help">;
+def h : Flag<["-"], "h">, Alias<help>;
+
+def 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.">;
defm binary_architecture
: Eq<"binary-architecture", "Used when transforming an architecture-less "
@@ -26,13 +33,13 @@ defm output_target : Eq<"output-target", "Format of the output file">,
Values<"binary">;
def O : JoinedOrSeparate<["-"], "O">, Alias<output_target>;
-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 "
@@ -40,7 +47,7 @@ defm split_dwo
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">,
@@ -48,14 +55,14 @@ def D : Flag<["-"], "D">,
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<disable_deterministic_archives>,
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<preserve_dates>;
@@ -76,6 +83,16 @@ defm rename_section
defm redefine_symbol
: Eq<"redefine-sym", "Change the name of a symbol old to new">,
MetaVarName<"old=new">;
+defm redefine_symbols
+ : Eq<"redefine-syms",
+ "Reads a list of symbol pairs from <filename> and runs as if "
+ "--redefine-sym=<old>=<new> is set for each one. <filename> "
+ "contains two symbols per line separated with whitespace and may "
+ "contain comments beginning with '#'. Leading and trailing "
+ "whitespace is stripped from each line. May be repeated to read "
+ "symbols from many files.">,
+ MetaVarName<"filename">;
+
defm keep_section : Eq<"keep-section", "Keep <section>">,
MetaVarName<"section">;
defm only_section : Eq<"only-section", "Remove all but <section>">,
@@ -86,39 +103,76 @@ defm add_section
"Make a section named <section> with the contents of <file>.">,
MetaVarName<"section=file">;
-def strip_all
- : Flag<["-", "--"], "strip-all">,
- HelpText<
- "Remove non-allocated sections other than .gnu.warning* sections">;
+defm set_section_flags
+ : Eq<"set-section-flags",
+ "Set section flags for a given section. Flags supported for GNU "
+ "compatibility: alloc, load, noload, readonly, debug, code, data, "
+ "rom, share, contents, merge, strings.">,
+ MetaVarName<"section=flag1[,flag2,...]">;
+
+def strip_all : Flag<["--"], "strip-all">,
+ HelpText<"Remove non-allocated sections outside segments. "
+ ".gnu.warning* sections are not removed">;
def S : Flag<["-"], "S">, Alias<strip_all>;
-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 strip_dwo : Flag<["-", "--"], "strip-dwo">,
+def g : Flag<["-"], "g">, Alias<strip_debug>,
+ HelpText<"Alias for --strip-debug">;
+def strip_dwo : Flag<["--"], "strip-dwo">,
HelpText<"Remove all DWARF .dwo sections from file">;
-def strip_sections : Flag<["-", "--"], "strip-sections">,
- HelpText<"Remove all section headers">;
-def strip_non_alloc : Flag<["-", "--"], "strip-non-alloc">,
- HelpText<"Remove all non-allocated sections">;
-def strip_unneeded : Flag<["-", "--"], "strip-unneeded">,
+def strip_sections
+ : Flag<["--"], "strip-sections">,
+ HelpText<"Remove all section headers and all sections not in segments">;
+def strip_non_alloc
+ : Flag<["--"], "strip-non-alloc">,
+ HelpText<"Remove all non-allocated sections outside segments">;
+def strip_unneeded : Flag<["--"], "strip-unneeded">,
HelpText<"Remove all symbols not needed by relocations">;
+defm strip_unneeded_symbol
+ : Eq<"strip-unneeded-symbol",
+ "Remove symbol <symbol> if it is not needed by relocations">,
+ MetaVarName<"symbol">;
+defm strip_unneeded_symbols
+ : Eq<"strip-unneeded-symbols",
+ "Reads a list of symbols from <filename> and removes them "
+ "if they are not needed by relocations">,
+ MetaVarName<"filename">;
def extract_dwo
- : Flag<["-", "--"], "extract-dwo">,
+ : Flag<["--"], "extract-dwo">,
HelpText<
"Remove all sections that are not DWARF .dwo sections from file">;
+defm extract_partition
+ : Eq<"extract-partition", "Extract named partition from input file">,
+ MetaVarName<"name">;
+def extract_main_partition
+ : Flag<["--"], "extract-main-partition">,
+ HelpText<"Extract main partition from the input 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 <symbol> as local">,
MetaVarName<"symbol">;
+defm localize_symbols
+ : Eq<"localize-symbols",
+ "Reads a list of symbols from <filename> and marks them local.">,
+ MetaVarName<"filename">;
+
def L : JoinedOrSeparate<["-"], "L">, Alias<localize_symbol>;
defm globalize_symbol : Eq<"globalize-symbol", "Mark <symbol> as global">,
MetaVarName<"symbol">;
+
+defm globalize_symbols
+ : Eq<"globalize-symbols",
+ "Reads a list of symbols from <filename> and marks them global.">,
+ MetaVarName<"filename">;
+
defm keep_global_symbol
: Eq<"keep-global-symbol",
"Convert all symbols except <symbol> to local. May be repeated to "
@@ -137,23 +191,51 @@ defm keep_global_symbols
defm weaken_symbol : Eq<"weaken-symbol", "Mark <symbol> as weak">,
MetaVarName<"symbol">;
+defm weaken_symbols
+ : Eq<"weaken-symbols",
+ "Reads a list of symbols from <filename> and marks them weak.">,
+ MetaVarName<"filename">;
+
def W : JoinedOrSeparate<["-"], "W">, Alias<weaken_symbol>;
-def weaken : Flag<["-", "--"], "weaken">,
+def weaken : Flag<["--"], "weaken">,
HelpText<"Mark all global symbols as weak">;
+
+def discard_locals : Flag<["--"], "discard-locals">,
+ HelpText<"Remove compiler-generated local symbols, (e.g. "
+ "symbols starting with .L)">;
+def X : Flag<["-"], "X">, Alias<discard_locals>;
+
def discard_all
- : Flag<["-", "--"], "discard-all">,
+ : Flag<["--"], "discard-all">,
HelpText<"Remove all local symbols except file and section symbols">;
def x : Flag<["-"], "x">, Alias<discard_all>;
defm strip_symbol : Eq<"strip-symbol", "Remove symbol <symbol>">,
MetaVarName<"symbol">;
+defm strip_symbols
+ : Eq<"strip-symbols",
+ "Reads a list of symbols from <filename> and removes them.">,
+ MetaVarName<"filename">;
+
def N : JoinedOrSeparate<["-"], "N">, Alias<strip_symbol>;
defm keep_symbol : Eq<"keep-symbol", "Do not remove symbol <symbol>">,
MetaVarName<"symbol">;
def K : JoinedOrSeparate<["-"], "K">, Alias<keep_symbol>;
+
+defm keep_symbols
+ : Eq<"keep-symbols",
+ "Reads a list of symbols from <filename> and runs as if "
+ "--keep-symbol=<symbol> is set for each one. <filename> "
+ "contains one symbol per line and may contain comments beginning with "
+ "'#'. Leading and trailing whitespace is stripped from each line. May "
+ "be repeated to read symbols from many files.">,
+ MetaVarName<"filename">;
+
def only_keep_debug
- : Flag<["-", "--"], "only-keep-debug">,
- HelpText<"Currently ignored. Only for compatibility with GNU objcopy.">;
-def keep_file_symbols : Flag<["-", "--"], "keep-file-symbols">,
+ : 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">,
HelpText<"Do not remove file symbols">;
defm dump_section
: Eq<"dump-section",
@@ -163,7 +245,11 @@ defm prefix_symbols
: Eq<"prefix-symbols", "Add <prefix> to the start of every symbol name">,
MetaVarName<"prefix">;
-def version : Flag<["-", "--"], "version">,
+defm prefix_alloc_sections
+ : Eq<"prefix-alloc-sections", "Add <prefix> to the start of every allocated section name">,
+ MetaVarName<"prefix">;
+
+def version : Flag<["--"], "version">,
HelpText<"Print the version and exit.">;
def V : Flag<["-"], "V">, Alias<version>;
defm build_id_link_dir
@@ -178,3 +264,25 @@ defm build_id_link_output
: Eq<"build-id-link-output", "Hard-link the output to <dir>/xx/xxx<suffix> "
"name derived from hex build ID">,
MetaVarName<"suffix">;
+
+def regex
+ : Flag<["--"], "regex">,
+ HelpText<"Permit regular expressions in name comparison">;
+
+defm set_start : Eq<"set-start", "Set the start address to <addr>. Overrides "
+ "any previous --change-start or --adjust-start values.">,
+ MetaVarName<"addr">;
+defm change_start : Eq<"change-start", "Add <incr> to the start address. Can be "
+ "specified multiple times, all values will be applied "
+ "cumulatively.">,
+ MetaVarName<"incr">;
+def adjust_start : JoinedOrSeparate<["--"], "adjust-start">,
+ Alias<change_start>;
+
+defm add_symbol
+ : Eq<"add-symbol", "Add new symbol <name> to .symtab. Accepted flags: "
+ "global, local, weak, default, hidden, file, section, object, "
+ "function, indirect-function. Accepted but ignored for "
+ "compatibility: debug, constructor, warning, indirect, synthetic, "
+ "unique-object, before.">,
+ MetaVarName<"name=[section:]value[,flags]">;