aboutsummaryrefslogtreecommitdiff
path: root/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
commit1d739a010d49914eae7b6c415dd6de76ca142030 (patch)
treee7235381fa86db615447d81f56b5af02e17f2464 /lib/MC/ELFObjectWriter.cpp
parent62367045a493f9bffa433e34b68fc7dda96e1edd (diff)
Update the section index map after we add the medatada sections.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118728 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/ELFObjectWriter.cpp')
-rw-r--r--lib/MC/ELFObjectWriter.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/MC/ELFObjectWriter.cpp b/lib/MC/ELFObjectWriter.cpp
index cd6c042296..4928d115fe 100644
--- a/lib/MC/ELFObjectWriter.cpp
+++ b/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;