diff --git a/llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.h b/llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.h --- a/llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.h +++ b/llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.h @@ -91,9 +91,6 @@ const object::MachOObjectFile &getObject() const { return Obj; } - void addCustomSectionParser(StringRef SectionName, - SectionParserFunction Parse); - virtual Error addRelocations() = 0; /// Create a symbol. @@ -214,9 +211,6 @@ size_t Size, bool IsText, bool IsNoDeadStrip, bool IsCanonical); - /// Create graph blocks and symbols for all sections. - Error graphifySectionsWithCustomParsers(); - /// Graphify cstring section. Error graphifyCStringSection(NormalizedSection &NSec, std::vector NSyms); @@ -233,7 +227,6 @@ Section *CommonSection = nullptr; DenseMap IndexToSymbol; - StringMap CustomSectionParserFunctions; }; /// A pass to split up __LD,__compact_unwind sections. diff --git a/llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.cpp b/llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.cpp --- a/llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.cpp +++ b/llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.cpp @@ -37,9 +37,6 @@ if (auto Err = graphifyRegularSymbols()) return std::move(Err); - if (auto Err = graphifySectionsWithCustomParsers()) - return std::move(Err); - if (auto Err = addRelocations()) return std::move(Err); @@ -59,13 +56,6 @@ SubsectionsViaSymbols = MachHeader.flags & MachO::MH_SUBSECTIONS_VIA_SYMBOLS; } -void MachOLinkGraphBuilder::addCustomSectionParser( - StringRef SectionName, SectionParserFunction Parser) { - assert(!CustomSectionParserFunctions.count(SectionName) && - "Custom parser for this section already exists"); - CustomSectionParserFunctions[SectionName] = std::move(Parser); -} - Linkage MachOLinkGraphBuilder::getLinkage(uint16_t Desc) { if ((Desc & MachO::N_WEAK_DEF) || (Desc & MachO::N_WEAK_REF)) return Linkage::Weak; @@ -421,14 +411,7 @@ continue; } - // Skip sections with custom parsers. - if (CustomSectionParserFunctions.count(NSec.GraphSection->getName())) { - LLVM_DEBUG({ - dbgs() << " Skipping section " << NSec.GraphSection->getName() - << " as it has a custom parser.\n"; - }); - continue; - } else if ((NSec.Flags & MachO::SECTION_TYPE) == + if ((NSec.Flags & MachO::SECTION_TYPE) == MachO::S_CSTRING_LITERALS) { if (auto Err = graphifyCStringSection( NSec, std::move(SecIndexToSymbols[SecIndex]))) @@ -609,26 +592,6 @@ return Sym; } -Error MachOLinkGraphBuilder::graphifySectionsWithCustomParsers() { - // Graphify special sections. - for (auto &KV : IndexToSection) { - auto &NSec = KV.second; - - // Skip non-graph sections. - if (!NSec.GraphSection) - continue; - - auto HI = CustomSectionParserFunctions.find(NSec.GraphSection->getName()); - if (HI != CustomSectionParserFunctions.end()) { - auto &Parse = HI->second; - if (auto Err = Parse(NSec)) - return Err; - } - } - - return Error::success(); -} - Error MachOLinkGraphBuilder::graphifyCStringSection( NormalizedSection &NSec, std::vector NSyms) { assert(NSec.GraphSection && "C string literal section missing graph section");