diff options
author | Martin Storsjo <martin@martin.st> | 2019-01-19 19:42:54 +0000 |
---|---|---|
committer | Martin Storsjo <martin@martin.st> | 2019-01-19 19:42:54 +0000 |
commit | e8305175b0f99566e429e1644f121ff0207fc7f0 (patch) | |
tree | 3d6dcbf57b58d51df3099d6dae17c185baa61281 /llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp | |
parent | 1868d88b2efd705a11f44f8bef1960599a2346c1 (diff) | |
download | bcm5719-llvm-e8305175b0f99566e429e1644f121ff0207fc7f0.tar.gz bcm5719-llvm-e8305175b0f99566e429e1644f121ff0207fc7f0.zip |
[llvm-objcopy] [COFF] Implement --only-section
Differential Revision: https://reviews.llvm.org/D56873
llvm-svn: 351663
Diffstat (limited to 'llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp')
-rw-r--r-- | llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp b/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp index 60afbf7bb54..99929d10a1f 100644 --- a/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp +++ b/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp @@ -33,6 +33,12 @@ static bool isDebugSection(const Section &Sec) { static Error handleArgs(const CopyConfig &Config, Object &Obj) { // Perform the actual section removals. Obj.removeSections([&Config](const Section &Sec) { + // Contrary to --only-keep-debug, --only-section fully removes sections that + // aren't mentioned. + if (!Config.OnlySection.empty() && + !is_contained(Config.OnlySection, Sec.Name)) + return true; + if (Config.StripDebug || Config.StripAll || Config.StripAllGNU || Config.DiscardAll || Config.StripUnneeded) { if (isDebugSection(Sec) && |