unsigned ELFObjectWriter::addToSectionTable(const MCSectionELF *Sec) {
SectionTable.push_back(Sec);
+ ShStrTabBuilder.add(Sec->getSectionName());
return SectionTable.size();
}
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;