summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp')
-rw-r--r--llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp b/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
index 437dccbd3d5..dd2e4829218 100644
--- a/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
+++ b/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
@@ -27,9 +27,17 @@ using namespace object;
using namespace COFF;
static Error handleArgs(const CopyConfig &Config, Object &Obj) {
+ // Perform the actual section removals.
+ Obj.removeSections([&Config](const Section &Sec) {
+ if (is_contained(Config.ToRemove, Sec.Name))
+ return true;
+
+ return false;
+ });
+
// StripAll removes all symbols and thus also removes all relocations.
if (Config.StripAll || Config.StripAllGNU)
- for (Section &Sec : Obj.Sections)
+ for (Section &Sec : Obj.getMutableSections())
Sec.Relocs.clear();
// If we need to do per-symbol removals, initialize the Referenced field.
OpenPOWER on IntegriCloud