Use binary mode for reading/writing bytecode files

llvm-svn: 19751
diff --git a/llvm/tools/llvm-ld/llvm-ld.cpp b/llvm/tools/llvm-ld/llvm-ld.cpp
index 07879ac..f8287f8 100644
--- a/llvm/tools/llvm-ld/llvm-ld.cpp
+++ b/llvm/tools/llvm-ld/llvm-ld.cpp
@@ -186,7 +186,9 @@
 void GenerateBytecode(Module* M, const std::string& FileName) {
 
   // Create the output file.
-  std::ofstream Out(FileName.c_str());
+  std::ios::openmode io_mode = std::ios::out | std::ios::trunc |
+                               std::ios::binary;
+  std::ofstream Out(FileName.c_str(), io_mode);
   if (!Out.good()) {
     PrintAndReturn("error opening '" + FileName + "' for writing!");
     return;