diff options
| author | Jordan Rupprecht <rupprecht@google.com> | 2018-11-13 19:32:27 +0000 |
|---|---|---|
| committer | Jordan Rupprecht <rupprecht@google.com> | 2018-11-13 19:32:27 +0000 |
| commit | c5bae7834e60307ed422a00ceab068d9471d2509 (patch) | |
| tree | 0b356e10709829214192a247f8a07a8ddfd70b3a /llvm/tools/llvm-objcopy | |
| parent | 69396af1948ba057e2f123321da361057911e55d (diff) | |
| download | bcm5719-llvm-c5bae7834e60307ed422a00ceab068d9471d2509.tar.gz bcm5719-llvm-c5bae7834e60307ed422a00ceab068d9471d2509.zip | |
[llvm-objcopy] Rename --keep to --keep-section.
Summary:
llvm-objcopy/strip support `--keep` (for sections) and `--keep-symbols` (for symbols). For consistency and clarity, rename `--keep` to `--keep-section`.
In fact, for GNU compatability, -K is --keep-symbol, so it's weird that the alias `-K` is not the same as the short-ish `--keep`.
Reviewers: jakehehrlich, jhenderson, alexshap, MaskRay, espindola
Reviewed By: jakehehrlich, MaskRay
Subscribers: emaste, arichardson, llvm-commits
Differential Revision: https://reviews.llvm.org/D54477
llvm-svn: 346782
Diffstat (limited to 'llvm/tools/llvm-objcopy')
| -rw-r--r-- | llvm/tools/llvm-objcopy/CopyConfig.cpp | 8 | ||||
| -rw-r--r-- | llvm/tools/llvm-objcopy/CopyConfig.h | 2 | ||||
| -rw-r--r-- | llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp | 4 | ||||
| -rw-r--r-- | llvm/tools/llvm-objcopy/ObjcopyOpts.td | 3 | ||||
| -rw-r--r-- | llvm/tools/llvm-objcopy/StripOpts.td | 3 |
5 files changed, 11 insertions, 9 deletions
diff --git a/llvm/tools/llvm-objcopy/CopyConfig.cpp b/llvm/tools/llvm-objcopy/CopyConfig.cpp index 67963a22a1c..b4ebbc5fcfd 100644 --- a/llvm/tools/llvm-objcopy/CopyConfig.cpp +++ b/llvm/tools/llvm-objcopy/CopyConfig.cpp @@ -305,8 +305,8 @@ DriverConfig parseObjcopyOptions(ArrayRef<const char *> ArgsArr) { for (auto Arg : InputArgs.filtered(OBJCOPY_remove_section)) Config.ToRemove.push_back(Arg->getValue()); - for (auto Arg : InputArgs.filtered(OBJCOPY_keep)) - Config.Keep.push_back(Arg->getValue()); + for (auto Arg : InputArgs.filtered(OBJCOPY_keep_section)) + Config.KeepSection.push_back(Arg->getValue()); for (auto Arg : InputArgs.filtered(OBJCOPY_only_keep)) Config.OnlyKeep.push_back(Arg->getValue()); for (auto Arg : InputArgs.filtered(OBJCOPY_add_section)) @@ -411,8 +411,8 @@ DriverConfig parseStripOptions(ArrayRef<const char *> ArgsArr) { !Config.StripAllGNU) Config.StripAll = true; - for (auto Arg : InputArgs.filtered(STRIP_keep)) - Config.Keep.push_back(Arg->getValue()); + for (auto Arg : InputArgs.filtered(STRIP_keep_section)) + Config.KeepSection.push_back(Arg->getValue()); for (auto Arg : InputArgs.filtered(STRIP_remove_section)) Config.ToRemove.push_back(Arg->getValue()); diff --git a/llvm/tools/llvm-objcopy/CopyConfig.h b/llvm/tools/llvm-objcopy/CopyConfig.h index 7ebe2a072bb..68cd2477126 100644 --- a/llvm/tools/llvm-objcopy/CopyConfig.h +++ b/llvm/tools/llvm-objcopy/CopyConfig.h @@ -57,7 +57,7 @@ struct CopyConfig { // Repeated options std::vector<StringRef> AddSection; std::vector<StringRef> DumpSection; - std::vector<StringRef> Keep; + std::vector<StringRef> KeepSection; std::vector<StringRef> OnlyKeep; std::vector<StringRef> SymbolsToGlobalize; std::vector<StringRef> SymbolsToKeep; diff --git a/llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp b/llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp index 05985d3d2f1..111dfc0d496 100644 --- a/llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp +++ b/llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp @@ -385,10 +385,10 @@ static void handleArgs(const CopyConfig &Config, Object &Obj, }; } - if (!Config.Keep.empty()) { + if (!Config.KeepSection.empty()) { RemovePred = [&Config, RemovePred](const SectionBase &Sec) { // Explicitly keep these sections regardless of previous removes. - if (is_contained(Config.Keep, Sec.Name)) + if (is_contained(Config.KeepSection, Sec.Name)) return false; // Otherwise defer to RemovePred. return RemovePred(Sec); diff --git a/llvm/tools/llvm-objcopy/ObjcopyOpts.td b/llvm/tools/llvm-objcopy/ObjcopyOpts.td index 285ab9d69db..6a84155a089 100644 --- a/llvm/tools/llvm-objcopy/ObjcopyOpts.td +++ b/llvm/tools/llvm-objcopy/ObjcopyOpts.td @@ -76,7 +76,8 @@ defm rename_section defm redefine_symbol : Eq<"redefine-sym", "Change the name of a symbol old to new">, MetaVarName<"old=new">; -defm keep : Eq<"keep", "Keep <section>">, MetaVarName<"section">; +defm keep_section : Eq<"keep-section", "Keep <section>">, + MetaVarName<"section">; defm only_keep : Eq<"only-keep", "Remove all but <section>">, MetaVarName<"section">; def j : JoinedOrSeparate<["-"], "j">, Alias<only_keep>; diff --git a/llvm/tools/llvm-objcopy/StripOpts.td b/llvm/tools/llvm-objcopy/StripOpts.td index 3660148f883..032aa6f85c7 100644 --- a/llvm/tools/llvm-objcopy/StripOpts.td +++ b/llvm/tools/llvm-objcopy/StripOpts.td @@ -51,7 +51,8 @@ defm remove_section : Eq<"remove-section", "Remove <section>">, MetaVarName<"section">; def R : JoinedOrSeparate<["-"], "R">, Alias<remove_section>; -defm keep : Eq<"keep", "Keep <section>">, MetaVarName<"section">; +defm keep_section : Eq<"keep-section", "Keep <section>">, + MetaVarName<"section">; defm keep_symbol : Eq<"keep-symbol", "Do not remove symbol <symbol>">, MetaVarName<"symbol">; def K : JoinedOrSeparate<["-"], "K">, Alias<keep_symbol>; |

