Update the section index map after we add the medatada sections.

llvm-svn: 118728
This commit is contained in:
Rafael Espindola 2010-11-10 22:34:07 +00:00
parent 82abab0812
commit eb97f59753
1 changed files with 4 additions and 0 deletions

View File

@ -1253,6 +1253,9 @@ void ELFObjectWriterImpl::WriteObject(MCAssembler &Asm,
const_cast<MCAsmLayout&>(Layout),
SectionIndexMap);
// Update to include the metadata sections.
ComputeIndexMap(Asm, SectionIndexMap);
// Add 1 for the null section.
unsigned NumSections = Asm.size() + 1;
uint64_t NaturalAlignment = Is64Bit ? 8 : 4;
@ -1335,6 +1338,7 @@ void ELFObjectWriterImpl::WriteObject(MCAssembler &Asm,
SectionKind::getReadOnly(),
false);
sh_link = SectionIndexMap[SymtabSection];
assert(sh_link && ".symtab not found");
// Remove ".rel" and ".rela" prefixes.
unsigned SecNameLen = (Section.getType() == ELF::SHT_REL) ? 4 : 5;