diff options
Diffstat (limited to 'lib/Bytecode/Writer/Writer.cpp')
-rw-r--r-- | lib/Bytecode/Writer/Writer.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Bytecode/Writer/Writer.cpp b/lib/Bytecode/Writer/Writer.cpp index 83e8a57acf..4dc80d1809 100644 --- a/lib/Bytecode/Writer/Writer.cpp +++ b/lib/Bytecode/Writer/Writer.cpp @@ -29,6 +29,7 @@ #include "llvm/Support/GetElementPtrTypeIterator.h" #include "llvm/Support/Compressor.h" #include "llvm/Support/MathExtras.h" +#include "llvm/System/Program.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/Statistic.h" #include <cstring> @@ -1217,6 +1218,11 @@ void llvm::WriteBytecodeToFile(const Module *M, std::ostream &Out, bool compress ) { assert(M && "You can't write a null module!!"); + // Make sure that std::cout is put into binary mode for systems + // that care. + if (&Out == std::cout) + sys::Program::ChangeStdoutToBinary(); + // Create a vector of unsigned char for the bytecode output. We // reserve 256KBytes of space in the vector so that we avoid doing // lots of little allocations. 256KBytes is sufficient for a large |