[llvm-commits] CVS: llvm/tools/llvm-ld/Makefile llvm-ld.cpp

Chris Lattner sabre at nondot.org
Sat May 5 22:57:17 PDT 2007



Changes in directory llvm/tools/llvm-ld:

Makefile updated: 1.10 -> 1.11
llvm-ld.cpp updated: 1.51 -> 1.52
---
Log message:

add bitcode support.



---
Diffs of the changes:  (+12 -5)

 Makefile    |    2 +-
 llvm-ld.cpp |   15 +++++++++++----
 2 files changed, 12 insertions(+), 5 deletions(-)


Index: llvm/tools/llvm-ld/Makefile
diff -u llvm/tools/llvm-ld/Makefile:1.10 llvm/tools/llvm-ld/Makefile:1.11
--- llvm/tools/llvm-ld/Makefile:1.10	Mon Sep  4 00:59:09 2006
+++ llvm/tools/llvm-ld/Makefile	Sun May  6 00:56:58 2007
@@ -10,7 +10,7 @@
 LEVEL = ../..
 
 TOOLNAME = llvm-ld
-LINK_COMPONENTS = ipo scalaropts linker archive bcreader bcwriter
+LINK_COMPONENTS = ipo scalaropts linker archive bcwriter bitwriter
 REQUIRES_EH := 1
 
 include $(LEVEL)/Makefile.common


Index: llvm/tools/llvm-ld/llvm-ld.cpp
diff -u llvm/tools/llvm-ld/llvm-ld.cpp:1.51 llvm/tools/llvm-ld/llvm-ld.cpp:1.52
--- llvm/tools/llvm-ld/llvm-ld.cpp:1.51	Sun Apr 29 18:59:47 2007
+++ llvm/tools/llvm-ld/llvm-ld.cpp	Sun May  6 00:56:58 2007
@@ -25,7 +25,7 @@
 #include "llvm/System/Program.h"
 #include "llvm/Module.h"
 #include "llvm/PassManager.h"
-#include "llvm/Bytecode/Reader.h"
+#include "llvm/Bitcode/ReaderWriter.h"
 #include "llvm/Bytecode/Writer.h"
 #include "llvm/Target/TargetData.h"
 #include "llvm/Target/TargetMachine.h"
@@ -33,6 +33,7 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/FileUtilities.h"
 #include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Streams.h"
 #include "llvm/Support/SystemUtils.h"
 #include "llvm/System/Signals.h"
@@ -40,6 +41,8 @@
 #include <memory>
 using namespace llvm;
 
+cl::opt<bool> Bitcode("bitcode");
+
 // Input/Output Options
 static cl::list<std::string> InputFilenames(cl::Positional, cl::OneOrMore,
   cl::desc("<input bytecode files>"));
@@ -224,8 +227,12 @@
   sys::RemoveFileOnSignal(sys::Path(FileName));
 
   // Write it out
-  OStream L(Out);
-  WriteBytecodeToFile(M, L, !DisableCompression);
+  if (Bitcode) {
+    WriteBitcodeToFile(M, Out);
+  } else {
+    OStream L(Out);
+    WriteBytecodeToFile(M, L, !DisableCompression);
+  }
 
   // Close the bytecode file.
   Out.close();
@@ -547,7 +554,7 @@
           args[2] = tmp_output.c_str();
           args[3] = 0;
           if (0 == sys::Program::ExecuteAndWait(prog, args, 0,0,0,0, &ErrMsg)) {
-            if (tmp_output.isBytecodeFile()) {
+            if (tmp_output.isBytecodeFile() || tmp_output.isBitcodeFile()) {
               sys::Path target(RealBytecodeOutput);
               target.eraseFromDisk();
               if (tmp_output.renamePathOnDisk(target, &ErrMsg))






More information about the llvm-commits mailing list