From be8ebccaed22135669fd3716ed4cd235085ef5fd Mon Sep 17 00:00:00 2001 From: Jordan Rupprecht Date: Fri, 17 Aug 2018 22:34:48 +0000 Subject: [llvm-objcopy] Implement -G/--keep-global-symbol(s). Summary: Port GNU Objcopy -G/--keep-global-symbol(s). This is slightly different than the already-implemented --globalize-symbol, which marks a symbol as global when copying. When --keep-global-symbol (alias -G) is used, *only* those symbols marked will stay global, and all other globals are demoted to local. (Also note that it doesn't *promote* a symbol to global). Additionally, there is a pluralized version of the flag --keep-global-symbols, which effectively applies --keep-global-symbol for every non-comment in a file. Reviewers: jakehehrlich, jhenderson, alexshap Reviewed By: jhenderson Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D50589 llvm-svn: 340105 --- llvm/tools/llvm-objcopy/ObjcopyOpts.td | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'llvm/tools/llvm-objcopy/ObjcopyOpts.td') diff --git a/llvm/tools/llvm-objcopy/ObjcopyOpts.td b/llvm/tools/llvm-objcopy/ObjcopyOpts.td index 8cdef453b74..c34494736c3 100644 --- a/llvm/tools/llvm-objcopy/ObjcopyOpts.td +++ b/llvm/tools/llvm-objcopy/ObjcopyOpts.td @@ -81,6 +81,24 @@ def L : JoinedOrSeparate<["-"], "L">, defm globalize_symbol : Eq<"globalize-symbol">, MetaVarName<"symbol">, HelpText<"Mark as global">; + +defm keep_global_symbol + : Eq<"keep-global-symbol">, + MetaVarName<"symbol">, + HelpText<"Convert all symbols except to local. May be repeated " + "to convert all except a set of symbols to local.">; +def G : JoinedOrSeparate<[ "-" ], "G">, Alias; + +defm keep_global_symbols + : Eq<"keep-global-symbols">, + MetaVarName<"filename">, + HelpText< + "Reads a list of symbols from and runs as if " + "--keep-global-symbol= is set for each one. " + "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.">; + defm weaken_symbol : Eq<"weaken-symbol">, MetaVarName<"symbol">, HelpText<"Mark as weak">; -- cgit v1.2.3