@@ -768,7 +768,7 @@ Error SymbolTableSection::removeSymbols(
768768 std::remove_if (std::begin (Symbols) + 1 , std::end (Symbols),
769769 [ToRemove](const SymPtr &Sym) {
770770 if (ToRemove (*Sym)) {
771- dbgs ()<< " Symbols Removed:" << Sym->Name << " \n " ;
771+ llvm::outs () << " Symbols Removed:" << Sym->Name << " \n " ;
772772 return true ;
773773 }
774774 return false ;
@@ -2236,6 +2236,9 @@ Error Object::removeSections(
22362236 for (auto &RemoveSec : make_range (Iter, std::end (Sections))) {
22372237 for (auto &Segment : Segments)
22382238 Segment->removeSection (RemoveSec.get ());
2239+ if (isVerboseEnabled) {
2240+ llvm::outs () << " Removed Section: " << (RemoveSec.get ()->Name );
2241+ }
22392242 RemoveSec->onRemove ();
22402243 RemoveSections.insert (RemoveSec.get ());
22412244 }
@@ -2255,18 +2258,10 @@ Error Object::removeSections(
22552258
22562259 // Transfer removed sections into the Object RemovedSections container for use
22572260 // later.
2258- for (auto &KeepSec : make_range (std::begin (Sections) , Iter))
2259- {
2260-
2261- if (Error E = KeepSec->removeSectionReferences (
2262- AllowBrokenLinks, [&RemoveSections](const SectionBase *Sec) {
2263- return RemoveSections.find (Sec) != RemoveSections.end ();
2264- }))
2265- std::move (Iter, Sections.end (), std::back_inserter (RemovedSections));
2266- dbgs ()<<" Sections Removed:" <<KeepSec->Name <<' \n ' ;
2267- Sections.erase (Iter, std::end (Sections));
2268- return Error::success ();
2269- }
2261+ std::move (Iter, Sections.end (), std::back_inserter (RemovedSections));
2262+ // Now finally get rid of them all together.
2263+ Sections.erase (Iter, std::end (Sections));
2264+ return Error::success ();
22702265}
22712266
22722267Error Object::replaceSections (
@@ -2296,8 +2291,12 @@ Error Object::replaceSections(
22962291Error Object::removeSymbols (function_ref<bool (const Symbol &)> ToRemove) {
22972292 if (SymbolTable)
22982293 for (const SecPtr &Sec : Sections)
2299- if (Error E = Sec->removeSymbols (ToRemove))
2294+ if (Error E = Sec->removeSymbols (ToRemove)){
2295+ if (isVerboseEnabled){
2296+ llvm::outs () << " Removed Symbols:" << Sec->Name ;
2297+ }
23002298 return E;
2299+ }
23012300 return Error::success ();
23022301}
23032302
0 commit comments