summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/test/tools/llvm-objcopy/strip-all.test8
-rw-r--r--llvm/tools/llvm-objcopy/StripOpts.td3
-rw-r--r--llvm/tools/llvm-objcopy/llvm-objcopy.cpp1
3 files changed, 12 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-objcopy/strip-all.test b/llvm/test/tools/llvm-objcopy/strip-all.test
index d650ab790b8..71e024de072 100644
--- a/llvm/test/tools/llvm-objcopy/strip-all.test
+++ b/llvm/test/tools/llvm-objcopy/strip-all.test
@@ -27,6 +27,14 @@
# RUN: llvm-ar p %t.a > %t6
# RUN: cmp %t2 %t6
+# RUN: cp %t %t7
+# RUN: llvm-strip -strip-all %t7
+# RUN: cmp %t2 %t7
+
+# RUN: cp %t %t8
+# RUN: llvm-strip --strip-all %t8
+# RUN: cmp %t2 %t8
+
!ELF
FileHeader:
Class: ELFCLASS64
diff --git a/llvm/tools/llvm-objcopy/StripOpts.td b/llvm/tools/llvm-objcopy/StripOpts.td
index 5825f23297c..333b0d288ef 100644
--- a/llvm/tools/llvm-objcopy/StripOpts.td
+++ b/llvm/tools/llvm-objcopy/StripOpts.td
@@ -11,6 +11,9 @@ defm output : Eq<"o">,
MetaVarName<"output">,
HelpText<"Write output to <file>">;
+def strip_all : Flag<["-", "--"], "strip-all">,
+ HelpText<"Remove non-allocated sections other than .gnu.warning* sections">;
+
def strip_debug : Flag<["-", "--"], "strip-debug">,
HelpText<"Remove debugging symbols only">;
diff --git a/llvm/tools/llvm-objcopy/llvm-objcopy.cpp b/llvm/tools/llvm-objcopy/llvm-objcopy.cpp
index c28862f073a..a4936ddfa4a 100644
--- a/llvm/tools/llvm-objcopy/llvm-objcopy.cpp
+++ b/llvm/tools/llvm-objcopy/llvm-objcopy.cpp
@@ -655,6 +655,7 @@ CopyConfig ParseStripOptions(ArrayRef<const char *> ArgsArr) {
Config.DiscardAll = InputArgs.hasArg(STRIP_discard_all);
Config.StripUnneeded = InputArgs.hasArg(STRIP_strip_unneeded);
+ Config.StripAll = InputArgs.hasArg(STRIP_strip_all);
if (!Config.StripDebug && !Config.StripUnneeded && !Config.DiscardAll)
Config.StripAll = true;
OpenPOWER on IntegriCloud