diff options
Diffstat (limited to 'lld/lib')
-rw-r--r-- | lld/lib/Core/Resolver.cpp | 7 | ||||
-rw-r--r-- | lld/lib/ReaderWriter/MachO/CompactUnwindPass.cpp | 6 | ||||
-rw-r--r-- | lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp | 6 |
3 files changed, 12 insertions, 7 deletions
diff --git a/lld/lib/Core/Resolver.cpp b/lld/lib/Core/Resolver.cpp index 16578661602..e4a1b53cc33 100644 --- a/lld/lib/Core/Resolver.cpp +++ b/lld/lib/Core/Resolver.cpp @@ -445,6 +445,13 @@ MutableFile::DefinedAtomRange Resolver::MergedFile::definedAtoms() { _definedAtoms._atoms.begin(), _definedAtoms._atoms.end()); } +void Resolver::MergedFile::removeDefinedAtomsIf( + std::function<bool(const DefinedAtom *)> pred) { + auto &atoms = _definedAtoms._atoms; + auto newEnd = std::remove_if(atoms.begin(), atoms.end(), pred); + atoms.erase(newEnd, atoms.end()); +} + void Resolver::MergedFile::addAtoms(std::vector<const Atom *> &all) { ScopedTask task(getDefaultDomain(), "addAtoms"); DEBUG_WITH_TYPE("resolver", llvm::dbgs() << "Resolver final atom list:\n"); diff --git a/lld/lib/ReaderWriter/MachO/CompactUnwindPass.cpp b/lld/lib/ReaderWriter/MachO/CompactUnwindPass.cpp index f440cede201..9280ec43320 100644 --- a/lld/lib/ReaderWriter/MachO/CompactUnwindPass.cpp +++ b/lld/lib/ReaderWriter/MachO/CompactUnwindPass.cpp @@ -337,11 +337,15 @@ private: << " has " << entriesInPage << " entries\n"); } while (pageStart < unwindInfos.size()); - // FIXME: we should also erase all compact-unwind atoms; their job is done. UnwindInfoAtom *unwind = new (_file.allocator()) UnwindInfoAtom(_archHandler, _file, _isBig, std::vector<uint32_t>(), personalities, pages, numLSDAs); mergedFile->addAtom(*unwind); + + // Finally, remove all __compact_unwind atoms now that we've processed them. + mergedFile->removeDefinedAtomsIf([](const DefinedAtom *atom) { + return atom->contentType() == DefinedAtom::typeCompactUnwindInfo; + }); } void collectCompactUnwindEntries( diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp index 4a4ba792028..dc015c5f296 100644 --- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp +++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp @@ -231,12 +231,6 @@ const MachOFinalSectionFromAtomType sectsToAtomType[] = { ENTRY("__DATA", "___got", S_NON_LAZY_SYMBOL_POINTERS, typeGOT), ENTRY("__DATA", "___bss", S_ZEROFILL, typeZeroFill), - - // FIXME: __compact_unwind actually needs to be processed by a pass and put - // into __TEXT,__unwind_info. For now, forwarding it back to - // __LD,__compact_unwind is harmless (it's ignored by the unwinder, which then - // proceeds to process __TEXT,__eh_frame for its instructions). - ENTRY("__LD", "__compact_unwind", S_REGULAR, typeCompactUnwindInfo), }; #undef ENTRY |