diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2015-04-28 22:03:22 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2015-04-28 22:03:22 +0000 |
commit | 41920d0382806957a433e23a86de26721abe5005 (patch) | |
tree | ac259e707043372ca296a318235a7e0df73fd4fc /llvm/lib/MC/ELFObjectWriter.cpp | |
parent | 91307434f4da187496b4c7c336fe15b89fa6c299 (diff) | |
download | bcm5719-llvm-41920d0382806957a433e23a86de26721abe5005.tar.gz bcm5719-llvm-41920d0382806957a433e23a86de26721abe5005.zip |
Avoid one more walk over all sections. NFC.
Set the group section index as they are created.
llvm-svn: 236049
Diffstat (limited to 'llvm/lib/MC/ELFObjectWriter.cpp')
-rw-r--r-- | llvm/lib/MC/ELFObjectWriter.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp index 068c1293548..185b66332be 100644 --- a/llvm/lib/MC/ELFObjectWriter.cpp +++ b/llvm/lib/MC/ELFObjectWriter.cpp @@ -957,15 +957,6 @@ void ELFObjectWriter::maybeAddToGroup(MCAssembler &Asm, void ELFObjectWriter::computeIndexMap( MCAssembler &Asm, std::vector<const MCSectionELF *> &Sections, SectionIndexMapTy &SectionIndexMap, const RevGroupMapTy &RevGroupMap) { - for (const MCSectionData &SD : Asm) { - const MCSectionELF &Section = - static_cast<const MCSectionELF &>(SD.getSection()); - if (Section.getType() != ELF::SHT_GROUP) - continue; - Sections.push_back(&Section); - SectionIndexMap[&Section] = Sections.size(); - } - std::vector<const MCSectionELF *> 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); |