Index: test/tools/llvm-objcopy/basic-keep.test =================================================================== --- test/tools/llvm-objcopy/basic-keep.test +++ test/tools/llvm-objcopy/basic-keep.test @@ -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 Index: test/tools/llvm-objcopy/explicit-keep-remove.test =================================================================== --- test/tools/llvm-objcopy/explicit-keep-remove.test +++ test/tools/llvm-objcopy/explicit-keep-remove.test @@ -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 Index: test/tools/llvm-objcopy/keep-many.test =================================================================== --- test/tools/llvm-objcopy/keep-many.test +++ test/tools/llvm-objcopy/keep-many.test @@ -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 Index: test/tools/llvm-objcopy/keep-only-keep.test =================================================================== --- test/tools/llvm-objcopy/keep-only-keep.test +++ test/tools/llvm-objcopy/keep-only-keep.test @@ -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 Index: test/tools/llvm-objcopy/strip-sections-keep.test =================================================================== --- test/tools/llvm-objcopy/strip-sections-keep.test +++ test/tools/llvm-objcopy/strip-sections-keep.test @@ -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 Index: tools/llvm-objcopy/CopyConfig.h =================================================================== --- tools/llvm-objcopy/CopyConfig.h +++ tools/llvm-objcopy/CopyConfig.h @@ -57,7 +57,7 @@ // Repeated options std::vector AddSection; std::vector DumpSection; - std::vector Keep; + std::vector KeepSection; std::vector OnlyKeep; std::vector SymbolsToGlobalize; std::vector SymbolsToKeep; Index: tools/llvm-objcopy/CopyConfig.cpp =================================================================== --- tools/llvm-objcopy/CopyConfig.cpp +++ tools/llvm-objcopy/CopyConfig.cpp @@ -305,8 +305,8 @@ 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 @@ !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()); Index: tools/llvm-objcopy/ELF/ELFObjcopy.cpp =================================================================== --- tools/llvm-objcopy/ELF/ELFObjcopy.cpp +++ tools/llvm-objcopy/ELF/ELFObjcopy.cpp @@ -385,10 +385,10 @@ }; } - 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); Index: tools/llvm-objcopy/ObjcopyOpts.td =================================================================== --- tools/llvm-objcopy/ObjcopyOpts.td +++ tools/llvm-objcopy/ObjcopyOpts.td @@ -76,7 +76,8 @@ defm redefine_symbol : Eq<"redefine-sym", "Change the name of a symbol old to new">, MetaVarName<"old=new">; -defm keep : Eq<"keep", "Keep
">, MetaVarName<"section">; +defm keep_section : Eq<"keep-section", "Keep
">, + MetaVarName<"section">; defm only_keep : Eq<"only-keep", "Remove all but
">, MetaVarName<"section">; def j : JoinedOrSeparate<["-"], "j">, Alias; Index: tools/llvm-objcopy/StripOpts.td =================================================================== --- tools/llvm-objcopy/StripOpts.td +++ tools/llvm-objcopy/StripOpts.td @@ -51,7 +51,8 @@ MetaVarName<"section">; def R : JoinedOrSeparate<["-"], "R">, Alias; -defm keep : Eq<"keep", "Keep
">, MetaVarName<"section">; +defm keep_section : Eq<"keep-section", "Keep
">, + MetaVarName<"section">; defm keep_symbol : Eq<"keep-symbol", "Do not remove symbol ">, MetaVarName<"symbol">; def K : JoinedOrSeparate<["-"], "K">, Alias;