Use binary mode for reading/writing bytecode files
llvm-svn: 19751
diff --git a/llvm/tools/gccas/gccas.cpp b/llvm/tools/gccas/gccas.cpp
index deb9397..83de4eb 100644
--- a/llvm/tools/gccas/gccas.cpp
+++ b/llvm/tools/gccas/gccas.cpp
@@ -164,9 +164,12 @@
}
if (OutputFilename == "-")
+ // FIXME: cout is not binary!
Out = &std::cout;
else {
- Out = new std::ofstream(OutputFilename.c_str(), std::ios::out);
+ std::ios::openmode io_mode = std::ios::out | std::ios::trunc |
+ std::ios::binary;
+ Out = new std::ofstream(OutputFilename.c_str(), io_mode);
// Make sure that the Out file gets unlinked from the disk if we get a
// signal