diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2008-06-06 07:24:01 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2008-06-06 07:24:01 +0000 |
commit | b0a882f540e015e35ab90d0b549f3d1c24acdb9c (patch) | |
tree | d0957898b1c29800f27684303e7adeaed9fa89dd | |
parent | 232a4ab77a078703de787c51a281efd8bed10d68 (diff) | |
download | external_llvm-b0a882f540e015e35ab90d0b549f3d1c24acdb9c.zip external_llvm-b0a882f540e015e35ab90d0b549f3d1c24acdb9c.tar.gz external_llvm-b0a882f540e015e35ab90d0b549f3d1c24acdb9c.tar.bz2 |
Turn stdout into binary mode during bitcode emission.
This is necessary on windows targets, since stdout is in text mode there.
Patch by Julien Lerouge!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52038 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Bitcode/Writer/BitcodeWriter.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index df644d0..0030aca 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -23,6 +23,7 @@ #include "llvm/TypeSymbolTable.h" #include "llvm/ValueSymbolTable.h" #include "llvm/Support/MathExtras.h" +#include "llvm/System/Program.h" using namespace llvm; /// These are manifest constants used by the bitcode writer. They do not need to @@ -1292,6 +1293,10 @@ void llvm::WriteBitcodeToFile(const Module *M, std::ostream &Out) { // Emit the module. WriteModule(M, Stream); + // If writing to stdout, set binary mode. + if (llvm::cout == Out) + sys::Program::ChangeStdoutToBinary(); + // Write the generated bitstream to "Out". Out.write((char*)&Buffer.front(), Buffer.size()); |