+ // leaving out the just added .symtab which is at
+ // the very end
+ unsigned Index = 1;
+ for (MCAssembler::const_iterator it = Asm.begin(),
+ ie = Asm.end(); it != ie; ++it, ++Index) {
+ const MCSectionData &SD = *it;
+ const MCSectionELF &Section =
+ static_cast<const MCSectionELF&>(SD.getSection());
+ // Leave out relocations so we don't have indexes within
+ // the relocations messed up
+ if (Section.getType() == ELF::SHT_RELA)
+ continue;
+ if (Index == Asm.size())
+ continue;