unsigned SymtabShndxSectionIndex = 0;
// Sections in the order they are to be output in the section table.
- std::vector<MCSectionELF *> SectionTable;
- unsigned addToSectionTable(MCSectionELF *Sec);
+ std::vector<const MCSectionELF *> SectionTable;
+ unsigned addToSectionTable(const MCSectionELF *Sec);
// TargetObjectWriter wrappers.
bool is64Bit() const { return TargetObjectWriter->is64Bit(); }
};
}
-unsigned ELFObjectWriter::addToSectionTable(MCSectionELF *Sec) {
+unsigned ELFObjectWriter::addToSectionTable(const MCSectionELF *Sec) {
SectionTable.push_back(Sec);
StrTabBuilder.add(Sec->getSectionName());
return SectionTable.size();
void ELFObjectWriter::writeSymbolTable(MCContext &Ctx,
const MCAsmLayout &Layout,
SectionOffsetsTy &SectionOffsets) {
- MCSectionELF *SymtabSection = SectionTable[SymbolTableIndex - 1];
+ const MCSectionELF *SymtabSection = SectionTable[SymbolTableIndex - 1];
// The string table must be emitted first because we need the index
// into the string table for all the symbol names.
assert(SymtabShndxSectionIndex != 0);
SecStart = OS.tell();
- MCSectionELF *SymtabShndxSection = SectionTable[SymtabShndxSectionIndex - 1];
+ const MCSectionELF *SymtabShndxSection =
+ SectionTable[SymtabShndxSectionIndex - 1];
for (uint32_t Index : ShndxIndexes)
write(Index);
SecEnd = OS.tell();
}
const MCSectionELF *ELFObjectWriter::createStringTable(MCContext &Ctx) {
- MCSectionELF *StrtabSection = SectionTable[StringTableIndex - 1];
+ const MCSectionELF *StrtabSection = SectionTable[StringTableIndex - 1];
OS << StrTabBuilder.data();
return StrtabSection;
}
(NumSections + 1) >= ELF::SHN_LORESERVE ? NumSections + 1 : 0;
WriteSecHdrEntry(0, 0, 0, 0, 0, FirstSectionSize, 0, 0, 0, 0);
- for (MCSectionELF *Section : SectionTable) {
+ for (const MCSectionELF *Section : SectionTable) {
uint32_t GroupSymbolIndex;
unsigned Type = Section->getType();
if (Type != ELF::SHT_GROUP)
std::vector<MCSectionELF *> Groups;
std::vector<MCSectionELF *> Relocations;
for (const MCSectionData &SD : Asm) {
- MCSectionELF &Section = static_cast<MCSectionELF &>(SD.getSection());
+ const MCSectionELF &Section = static_cast<MCSectionELF &>(SD.getSection());
uint64_t Padding = OffsetToAlignment(OS.tell(), Section.getAlignment());
WriteZeros(Padding);