[PATCH] D78474: [llvm-objcopy][MachO] Make --remove-section clean up dead symbols

Alexander Shaposhnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 20 17:22:49 PDT 2020


alexshap marked an inline comment as done.
alexshap added inline comments.


================
Comment at: llvm/tools/llvm-objcopy/MachO/Object.cpp:30
+  for (LoadCommand &LC : LoadCommands) {
+    auto It = std::stable_partition(
+        std::begin(LC.Sections), std::end(LC.Sections),
----------------
smeenai wrote:
> This is gonna reorder the actual section load commands, right? Is that okay?
this could be "remove_if" if "remove_if" didn't modify the elements.
https://en.cppreference.com/w/cpp/algorithm/remove
https://en.cppreference.com/w/cpp/algorithm/stable_partition
https://iterator.wordpress.com/2016/01/31/algorithms_0/ .
Quite the opposite - with std::stable_partition we preserve the order of sections which have not been removed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78474





More information about the llvm-commits mailing list