[llvm] r236257 - Avoid an extra loop over the sections.
Rafael Espindola
rafael.espindola at gmail.com
Thu Apr 30 13:57:14 PDT 2015
Author: rafael
Date: Thu Apr 30 15:57:14 2015
New Revision: 236257
URL: http://llvm.org/viewvc/llvm-project?rev=236257&view=rev
Log:
Avoid an extra loop over the sections.
Add string to the section header string table as we add sections.
Modified:
llvm/trunk/lib/MC/ELFObjectWriter.cpp
Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=236257&r1=236256&r2=236257&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Thu Apr 30 15:57:14 2015
@@ -263,6 +263,7 @@ class ELFObjectWriter : public MCObjectW
unsigned ELFObjectWriter::addToSectionTable(const MCSectionELF *Sec) {
SectionTable.push_back(Sec);
+ ShStrTabBuilder.add(Sec->getSectionName());
return SectionTable.size();
}
@@ -1310,14 +1311,7 @@ void ELFObjectWriter::writeRelocations(c
const MCSectionELF *
ELFObjectWriter::createSectionHeaderStringTable(MCAssembler &Asm) {
const MCSectionELF *ShstrtabSection = SectionTable[ShstrtabIndex - 1];
-
Asm.getOrCreateSectionData(*ShstrtabSection);
-
- for (MCSectionData &SD : Asm) {
- const MCSectionELF &Section =
- static_cast<const MCSectionELF &>(SD.getSection());
- ShStrTabBuilder.add(Section.getSectionName());
- }
ShStrTabBuilder.finalize(StringTableBuilder::ELF);
OS << ShStrTabBuilder.data();
return ShstrtabSection;
More information about the llvm-commits
mailing list