diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2018-05-21 18:23:50 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2018-05-21 18:23:50 +0000 |
commit | 438390fae1f0f6125b914e5f1bd4ef2e7deb8c05 (patch) | |
tree | 75c6368bbd66ae73103e12c73b87459488056a7c /llvm/lib/MC/ELFObjectWriter.cpp | |
parent | 9badad2051c41049354e2650c1b321e7e0d0d3e1 (diff) | |
download | bcm5719-llvm-438390fae1f0f6125b914e5f1bd4ef2e7deb8c05.tar.gz bcm5719-llvm-438390fae1f0f6125b914e5f1bd4ef2e7deb8c05.zip |
MC: Have the object writers return the number of bytes written. NFCI.
This removes the last external use of the stream.
Part of PR37466.
Differential Revision: https://reviews.llvm.org/D47042
llvm-svn: 332863
Diffstat (limited to 'llvm/lib/MC/ELFObjectWriter.cpp')
-rw-r--r-- | llvm/lib/MC/ELFObjectWriter.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp index e5014e64043..9826996c571 100644 --- a/llvm/lib/MC/ELFObjectWriter.cpp +++ b/llvm/lib/MC/ELFObjectWriter.cpp @@ -247,7 +247,7 @@ public: const MCFragment &FB, bool InSet, bool IsPCRel) const override; - void writeObject(MCAssembler &Asm, const MCAsmLayout &Layout) override; + uint64_t writeObject(MCAssembler &Asm, const MCAsmLayout &Layout) override; void writeSection(const SectionIndexMapTy &SectionIndexMap, uint32_t GroupSymbolIndex, uint64_t Offset, uint64_t Size, const MCSectionELF &Section); @@ -1205,8 +1205,10 @@ void ELFObjectWriter::writeSectionHeader( } } -void ELFObjectWriter::writeObject(MCAssembler &Asm, - const MCAsmLayout &Layout) { +uint64_t ELFObjectWriter::writeObject(MCAssembler &Asm, + const MCAsmLayout &Layout) { + uint64_t StartOffset = W.OS.tell(); + MCContext &Ctx = Asm.getContext(); MCSectionELF *StrtabSection = Ctx.getELFSection(".strtab", ELF::SHT_STRTAB, 0); @@ -1334,6 +1336,8 @@ void ELFObjectWriter::writeObject(MCAssembler &Asm, } Stream.pwrite(reinterpret_cast<char *>(&NumSections), sizeof(NumSections), NumSectionsOffset); + + return W.OS.tell() - StartOffset; } bool ELFObjectWriter::isSymbolRefDifferenceFullyResolvedImpl( |