Use binary mode for reading/writing bytecode files


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19751 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/gccld/gccld.cpp b/tools/gccld/gccld.cpp
index d33d64a..809db2a 100644
--- a/tools/gccld/gccld.cpp
+++ b/tools/gccld/gccld.cpp
@@ -238,7 +238,9 @@
     // Create the output file.
     std::string RealBytecodeOutput = OutputFilename;
     if (!LinkAsLibrary) RealBytecodeOutput += ".bc";
-    std::ofstream Out(RealBytecodeOutput.c_str());
+    std::ios::openmode io_mode = std::ios::out | std::ios::trunc |
+                                 std::ios::binary;
+    std::ofstream Out(RealBytecodeOutput.c_str(), io_mode);
     if (!Out.good())
       return PrintAndReturn(argv[0], "error opening '" + RealBytecodeOutput +
                                      "' for writing!");