From: Rafael Espindola Date: Tue, 28 Apr 2015 22:03:22 +0000 (+0000) Subject: Avoid one more walk over all sections. NFC. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=f75160b8d9ddd4df09dfcc1eb3f025497edbadac;p=oota-llvm.git Avoid one more walk over all sections. NFC. Set the group section index as they are created. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236049 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/MC/ELFObjectWriter.cpp b/lib/MC/ELFObjectWriter.cpp index 068c1293548..185b66332be 100644 --- a/lib/MC/ELFObjectWriter.cpp +++ b/lib/MC/ELFObjectWriter.cpp @@ -957,15 +957,6 @@ void ELFObjectWriter::maybeAddToGroup(MCAssembler &Asm, void ELFObjectWriter::computeIndexMap( MCAssembler &Asm, std::vector &Sections, SectionIndexMapTy &SectionIndexMap, const RevGroupMapTy &RevGroupMap) { - for (const MCSectionData &SD : Asm) { - const MCSectionELF &Section = - static_cast(SD.getSection()); - if (Section.getType() != ELF::SHT_GROUP) - continue; - Sections.push_back(&Section); - SectionIndexMap[&Section] = Sections.size(); - } - std::vector RelSections; for (const MCSectionData &SD : Asm) { const MCSectionELF &Section = @@ -1465,6 +1456,9 @@ void ELFObjectWriter::createIndexedSections( const MCSectionELF *&Group = RevGroupMap[SignatureSymbol]; if (!Group) { Group = Ctx.createELFGroupSection(SignatureSymbol); + Sections.push_back(Group); + SectionIndexMap[Group] = Sections.size(); + MCSectionData &Data = Asm.getOrCreateSectionData(*Group); Data.setAlignment(4); MCDataFragment *F = new MCDataFragment(&Data);