summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/ELFObjectWriter.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2010-11-10 22:34:07 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2010-11-10 22:34:07 +0000
commiteb97f5975368efd97cf6e1d07100519f0d5046b9 (patch)
treee803059b3e213cac43b909cc882c717a57872abd /llvm/lib/MC/ELFObjectWriter.cpp
parent82abab08123dab161f34070212ec872d7e1b071d (diff)
downloadbcm5719-llvm-eb97f5975368efd97cf6e1d07100519f0d5046b9.tar.gz
bcm5719-llvm-eb97f5975368efd97cf6e1d07100519f0d5046b9.zip
Update the section index map after we add the medatada sections.
llvm-svn: 118728
Diffstat (limited to 'llvm/lib/MC/ELFObjectWriter.cpp')
-rw-r--r--llvm/lib/MC/ELFObjectWriter.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp
index cd6c0422963..4928d115fe7 100644
--- a/llvm/lib/MC/ELFObjectWriter.cpp
+++ b/llvm/lib/MC/ELFObjectWriter.cpp
@@ -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;
OpenPOWER on IntegriCloud