summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/ELFObjectWriter.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2018-05-21 18:11:35 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2018-05-21 18:11:35 +0000
commit147db3e628369d5d8cfee192647912ebaea28f0e (patch)
tree7d7e7c5165da3f8661810aabe8c564115fa46ef2 /llvm/lib/MC/ELFObjectWriter.cpp
parent571a3301aeaaddcb1d784d8f27957170fe0cfd15 (diff)
downloadbcm5719-llvm-147db3e628369d5d8cfee192647912ebaea28f0e.tar.gz
bcm5719-llvm-147db3e628369d5d8cfee192647912ebaea28f0e.zip
MC: Change MCAssembler::writeSectionData and writeFragmentPadding to take a raw_ostream. NFCI.
Also clean up a couple of hacks where we were writing the section contents to another stream by setting the object writer's stream, writing and setting it back. Part of PR37466. Differential Revision: https://reviews.llvm.org/D47038 llvm-svn: 332858
Diffstat (limited to 'llvm/lib/MC/ELFObjectWriter.cpp')
-rw-r--r--llvm/lib/MC/ELFObjectWriter.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp
index 07b1d924e2b..3f7b873ccec 100644
--- a/llvm/lib/MC/ELFObjectWriter.cpp
+++ b/llvm/lib/MC/ELFObjectWriter.cpp
@@ -996,7 +996,7 @@ void ELFObjectWriter::writeSectionData(const MCAssembler &Asm, MCSection &Sec,
MAI->compressDebugSections() != DebugCompressionType::None;
if (!CompressionEnabled || !SectionName.startswith(".debug_") ||
SectionName == ".debug_frame") {
- Asm.writeSectionData(&Section, Layout);
+ Asm.writeSectionData(getStream(), &Section, Layout);
return;
}
@@ -1006,10 +1006,7 @@ void ELFObjectWriter::writeSectionData(const MCAssembler &Asm, MCSection &Sec,
SmallVector<char, 128> UncompressedData;
raw_svector_ostream VecOS(UncompressedData);
- raw_pwrite_stream &OldStream = getStream();
- setStream(VecOS);
- Asm.writeSectionData(&Section, Layout);
- setStream(OldStream);
+ Asm.writeSectionData(VecOS, &Section, Layout);
SmallVector<char, 128> CompressedContents;
if (Error E = zlib::compress(
OpenPOWER on IntegriCloud