[llvm] r346782 - [llvm-objcopy] Rename --keep to --keep-section.
Jordan Rupprecht via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 13 11:32:27 PST 2018
Author: rupprecht
Date: Tue Nov 13 11:32:27 2018
New Revision: 346782
URL: http://llvm.org/viewvc/llvm-project?rev=346782&view=rev
Log:
[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
Modified:
llvm/trunk/test/tools/llvm-objcopy/basic-keep.test
llvm/trunk/test/tools/llvm-objcopy/explicit-keep-remove.test
llvm/trunk/test/tools/llvm-objcopy/keep-many.test
llvm/trunk/test/tools/llvm-objcopy/keep-only-keep.test
llvm/trunk/test/tools/llvm-objcopy/strip-sections-keep.test
llvm/trunk/test/tools/llvm-symbolizer/split-debug.test
llvm/trunk/tools/llvm-objcopy/CopyConfig.cpp
llvm/trunk/tools/llvm-objcopy/CopyConfig.h
llvm/trunk/tools/llvm-objcopy/ELF/ELFObjcopy.cpp
llvm/trunk/tools/llvm-objcopy/ObjcopyOpts.td
llvm/trunk/tools/llvm-objcopy/StripOpts.td
Modified: llvm/trunk/test/tools/llvm-objcopy/basic-keep.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/basic-keep.test?rev=346782&r1=346781&r2=346782&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/basic-keep.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/basic-keep.test Tue Nov 13 11:32:27 2018
@@ -1,6 +1,6 @@
# RUN: yaml2obj %s > %t
-# RUN: llvm-objcopy -strip-non-alloc -keep=.test %t %t2
-# RUN: llvm-strip --strip-all -keep=.test %t -o %t3
+# RUN: llvm-objcopy -strip-non-alloc -keep-section=.test %t %t2
+# RUN: llvm-strip --strip-all -keep-section=.test %t -o %t3
# RUN: llvm-readobj -file-headers -sections %t2 | FileCheck %s
# RUN: cmp %t2 %t3
Modified: llvm/trunk/test/tools/llvm-objcopy/explicit-keep-remove.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/explicit-keep-remove.test?rev=346782&r1=346781&r2=346782&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/explicit-keep-remove.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/explicit-keep-remove.test Tue Nov 13 11:32:27 2018
@@ -1,5 +1,5 @@
# RUN: yaml2obj %s > %t
-# RUN: llvm-objcopy -R=.test -keep=.test %t %t2
+# RUN: llvm-objcopy -R=.test -keep-section=.test %t %t2
# RUN: llvm-readobj -file-headers -sections %t2 | FileCheck %s
!ELF
Modified: llvm/trunk/test/tools/llvm-objcopy/keep-many.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/keep-many.test?rev=346782&r1=346781&r2=346782&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/keep-many.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/keep-many.test Tue Nov 13 11:32:27 2018
@@ -1,5 +1,5 @@
# RUN: yaml2obj %s > %t
-# RUN: llvm-objcopy -strip-non-alloc -keep=.test -keep=.test3 %t %t2
+# RUN: llvm-objcopy -strip-non-alloc -keep-section=.test -keep-section=.test3 %t %t2
# RUN: llvm-readobj -file-headers -sections %t2 | FileCheck %s
!ELF
Modified: llvm/trunk/test/tools/llvm-objcopy/keep-only-keep.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/keep-only-keep.test?rev=346782&r1=346781&r2=346782&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/keep-only-keep.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/keep-only-keep.test Tue Nov 13 11:32:27 2018
@@ -1,6 +1,6 @@
# RUN: yaml2obj %s > %t
-# RUN: llvm-objcopy -keep=.test2 -only-keep=.test %t %t2
-# RUN: llvm-objcopy -j .test -keep=.test2 %t %t3
+# RUN: llvm-objcopy -keep-section=.test2 -only-keep=.test %t %t2
+# RUN: llvm-objcopy -j .test -keep-section=.test2 %t %t3
# RUN: llvm-readobj -file-headers -sections %t2 | FileCheck %s
# RUN: diff %t2 %t3
Modified: llvm/trunk/test/tools/llvm-objcopy/strip-sections-keep.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/strip-sections-keep.test?rev=346782&r1=346781&r2=346782&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/strip-sections-keep.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/strip-sections-keep.test Tue Nov 13 11:32:27 2018
@@ -1,5 +1,5 @@
# RUN: yaml2obj %s > %t
-# RUN: llvm-objcopy -strip-sections -keep=.shstrtab %t %t2
+# RUN: llvm-objcopy -strip-sections -keep-section=.shstrtab %t %t2
# RUN: od -Ax -t c %t2 | FileCheck %s
!ELF
Modified: llvm/trunk/test/tools/llvm-symbolizer/split-debug.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-symbolizer/split-debug.test?rev=346782&r1=346781&r2=346782&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-symbolizer/split-debug.test (original)
+++ llvm/trunk/test/tools/llvm-symbolizer/split-debug.test Tue Nov 13 11:32:27 2018
@@ -18,7 +18,7 @@
#Build as : clang -g -O2 addr.c
RUN: mkdir -p %t/.debug
-RUN: llvm-objcopy --keep=.debug_info %p/Inputs/addr.exe %t/.debug/addr
+RUN: llvm-objcopy --keep-section=.debug_info %p/Inputs/addr.exe %t/.debug/addr
RUN: llvm-objcopy --strip-debug --add-gnu-debuglink=%t/.debug/addr %p/Inputs/addr.exe %t/addr.exe
RUN: llvm-symbolizer -print-address -obj=%t/addr.exe < %p/Inputs/addr.inp | FileCheck %s
Modified: llvm/trunk/tools/llvm-objcopy/CopyConfig.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objcopy/CopyConfig.cpp?rev=346782&r1=346781&r2=346782&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objcopy/CopyConfig.cpp (original)
+++ llvm/trunk/tools/llvm-objcopy/CopyConfig.cpp Tue Nov 13 11:32:27 2018
@@ -305,8 +305,8 @@ DriverConfig parseObjcopyOptions(ArrayRe
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<
!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());
Modified: llvm/trunk/tools/llvm-objcopy/CopyConfig.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objcopy/CopyConfig.h?rev=346782&r1=346781&r2=346782&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objcopy/CopyConfig.h (original)
+++ llvm/trunk/tools/llvm-objcopy/CopyConfig.h Tue Nov 13 11:32:27 2018
@@ -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;
Modified: llvm/trunk/tools/llvm-objcopy/ELF/ELFObjcopy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objcopy/ELF/ELFObjcopy.cpp?rev=346782&r1=346781&r2=346782&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objcopy/ELF/ELFObjcopy.cpp (original)
+++ llvm/trunk/tools/llvm-objcopy/ELF/ELFObjcopy.cpp Tue Nov 13 11:32:27 2018
@@ -385,10 +385,10 @@ static void handleArgs(const CopyConfig
};
}
- 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);
Modified: llvm/trunk/tools/llvm-objcopy/ObjcopyOpts.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objcopy/ObjcopyOpts.td?rev=346782&r1=346781&r2=346782&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objcopy/ObjcopyOpts.td (original)
+++ llvm/trunk/tools/llvm-objcopy/ObjcopyOpts.td Tue Nov 13 11:32:27 2018
@@ -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>;
Modified: llvm/trunk/tools/llvm-objcopy/StripOpts.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objcopy/StripOpts.td?rev=346782&r1=346781&r2=346782&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objcopy/StripOpts.td (original)
+++ llvm/trunk/tools/llvm-objcopy/StripOpts.td Tue Nov 13 11:32:27 2018
@@ -51,7 +51,8 @@ defm remove_section : Eq<"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>;
More information about the llvm-commits
mailing list