[llvm] [llvm-strip] Remove empty SHT_GROUP sections. (PR #97204)
Dmitriy Chestnykh via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 30 08:22:42 PDT 2024
================
@@ -2206,8 +2206,16 @@ Error Object::removeSections(
// Transfer removed sections into the Object RemovedSections container for use
// later.
std::move(Iter, Sections.end(), std::back_inserter(RemovedSections));
- // Now finally get rid of them all together.
+ // Now get rid of them all together.
Sections.erase(Iter, std::end(Sections));
+
+ // Finally iterate over all sections and erase empty SHT_GROUP sections.
+ for (auto Iter = Sections.begin(); Iter != Sections.end(); ++Iter) {
----------------
chestnykh wrote:
Removed the braces. The loop cannot be rewritten to `auto I = Sections.begin(), E = Sections.End(); I != E; ++I` because `Sections` may change size every time
https://github.com/llvm/llvm-project/pull/97204
More information about the llvm-commits
mailing list