[llvm-commits] CVS: llvm/tools/llvm-link/llvm-link.cpp

Jeff Cohen jeffc at jolt-lang.org
Sat Jan 22 09:36:31 PST 2005



Changes in directory llvm/tools/llvm-link:

llvm-link.cpp updated: 1.54 -> 1.55
---
Log message:

Use binary mode for reading/writing bytecode files

---
Diffs of the changes:  (+4 -1)

 llvm-link.cpp |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)


Index: llvm/tools/llvm-link/llvm-link.cpp
diff -u llvm/tools/llvm-link/llvm-link.cpp:1.54 llvm/tools/llvm-link/llvm-link.cpp:1.55
--- llvm/tools/llvm-link/llvm-link.cpp:1.54	Sat Jan  1 16:10:32 2005
+++ llvm/tools/llvm-link/llvm-link.cpp	Sat Jan 22 11:36:17 2005
@@ -112,6 +112,7 @@
 
     if (DumpAsm) std::cerr << "Here's the assembly:\n" << Composite.get();
 
+    // FIXME: cout is not binary!
     std::ostream *Out = &std::cout;  // Default to printing to stdout...
     if (OutputFilename != "-") {
       if (!Force && std::ifstream(OutputFilename.c_str())) {
@@ -121,7 +122,9 @@
                   << "Use -f command line argument to force output\n";
         return 1;
       }
-      Out = new std::ofstream(OutputFilename.c_str());
+      std::ios::openmode io_mode = std::ios::out | std::ios::trunc |
+                                   std::ios::binary;
+      Out = new std::ofstream(OutputFilename.c_str(), io_mode);
       if (!Out->good()) {
         std::cerr << argv[0] << ": error opening '" << OutputFilename << "'!\n";
         return 1;






More information about the llvm-commits mailing list