[PATCH] D66282: [llvm-objcopy][MachO] Implement --remove-section

Jordan Rupprecht via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 8 10:58:03 PDT 2019


rupprecht accepted this revision.
rupprecht added inline comments.


================
Comment at: llvm/tools/llvm-objcopy/MachO/MachOObjcopy.cpp:42-46
   if (!Config.OnlySection.empty()) {
     RemovePred = [&Config, RemovePred](const Section &Sec) {
       return !Config.OnlySection.matches(Sec.CanonicalName);
     };
   }
----------------
Not related to this patch, but looks like this discards `RemovePred`, e.g. `--strip-all --only-section` will effectively work like `--only-section`.

I found this after noticing that `RemovePred` is not referenced in the bit you added, which is actually fine there but error prone if the iterative construction of `RemovePred` is ever reordered. ELF objcopy works like this too, but correctly chains `RemovePred` for the `--only-section` switch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66282/new/

https://reviews.llvm.org/D66282





More information about the llvm-commits mailing list