diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2017-03-14 19:28:51 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2017-03-14 19:28:51 +0000 |
commit | 43dcf4d330452605faf895f00732f5414127fd61 (patch) | |
tree | f7dc554d5d12ab1936ba9db94ba02e66b44e26d5 /llvm/lib/MC/ELFObjectWriter.cpp | |
parent | caea769f11d937c63fa2741ed834e129171007bd (diff) | |
download | bcm5719-llvm-43dcf4d330452605faf895f00732f5414127fd61.tar.gz bcm5719-llvm-43dcf4d330452605faf895f00732f5414127fd61.zip |
Fix asm printing of associated sections.
Make MCSectionELF::AssociatedSection be a link to a symbol, because
that's how it works in the assembly, and use it in the asm printer.
llvm-svn: 297769
Diffstat (limited to 'llvm/lib/MC/ELFObjectWriter.cpp')
-rw-r--r-- | llvm/lib/MC/ELFObjectWriter.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp index 18dd50826a5..b6f21ba26b6 100644 --- a/llvm/lib/MC/ELFObjectWriter.cpp +++ b/llvm/lib/MC/ELFObjectWriter.cpp @@ -1156,8 +1156,8 @@ void ELFObjectWriter::writeSection(const SectionIndexMapTy &SectionIndexMap, case ELF::SHT_RELA: { sh_link = SymbolTableIndex; assert(sh_link && ".symtab not found"); - const MCSectionELF *InfoSection = Section.getAssociatedSection(); - sh_info = SectionIndexMap.lookup(InfoSection); + const MCSection *InfoSection = Section.getAssociatedSection(); + sh_info = SectionIndexMap.lookup(cast<MCSectionELF>(InfoSection)); break; } @@ -1177,8 +1177,11 @@ void ELFObjectWriter::writeSection(const SectionIndexMapTy &SectionIndexMap, break; } - if (Section.getFlags() & ELF::SHF_LINK_ORDER) - sh_link = SectionIndexMap.lookup(Section.getAssociatedSection()); + if (Section.getFlags() & ELF::SHF_LINK_ORDER) { + const MCSymbol *Sym = Section.getAssociatedSymbol(); + const MCSectionELF *Sec = cast<MCSectionELF>(&Sym->getSection()); + sh_link = SectionIndexMap.lookup(Sec); + } WriteSecHdrEntry(StrTabBuilder.getOffset(Section.getSectionName()), Section.getType(), Section.getFlags(), 0, Offset, Size, @@ -1302,7 +1305,8 @@ void ELFObjectWriter::writeObject(MCAssembler &Asm, // Remember the offset into the file for this section. uint64_t SecStart = getStream().tell(); - writeRelocations(Asm, *RelSection->getAssociatedSection()); + writeRelocations(Asm, + cast<MCSectionELF>(*RelSection->getAssociatedSection())); uint64_t SecEnd = getStream().tell(); SectionOffsets[RelSection] = std::make_pair(SecStart, SecEnd); |