aboutsummaryrefslogtreecommitdiff
path: root/tools/llvm-ld/llvm-ld.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/llvm-ld/llvm-ld.cpp')
-rw-r--r--tools/llvm-ld/llvm-ld.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/llvm-ld/llvm-ld.cpp b/tools/llvm-ld/llvm-ld.cpp
index 07879acbc1..f8287f8e8d 100644
--- a/tools/llvm-ld/llvm-ld.cpp
+++ b/tools/llvm-ld/llvm-ld.cpp
@@ -186,7 +186,9 @@ static void RemoveEnv(const char * name, char ** const envp) {
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;