llvm.org GIT mirror llvm / bb3f3d3
add bitcode support. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36853 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 13 years ago
2 changed file(s) with 12 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
99 LEVEL = ../..
1010
1111 TOOLNAME = llvm-ld
12 LINK_COMPONENTS = ipo scalaropts linker archive bcreader bcwriter
12 LINK_COMPONENTS = ipo scalaropts linker archive bcwriter bitwriter
1313 REQUIRES_EH := 1
1414
1515 include $(LEVEL)/Makefile.common
2424 #include "llvm/System/Program.h"
2525 #include "llvm/Module.h"
2626 #include "llvm/PassManager.h"
27 #include "llvm/Bytecode/Reader.h"
27 #include "llvm/Bitcode/ReaderWriter.h"
2828 #include "llvm/Bytecode/Writer.h"
2929 #include "llvm/Target/TargetData.h"
3030 #include "llvm/Target/TargetMachine.h"
3232 #include "llvm/Support/CommandLine.h"
3333 #include "llvm/Support/FileUtilities.h"
3434 #include "llvm/Support/ManagedStatic.h"
35 #include "llvm/Support/MemoryBuffer.h"
3536 #include "llvm/Support/Streams.h"
3637 #include "llvm/Support/SystemUtils.h"
3738 #include "llvm/System/Signals.h"
3839 #include
3940 #include
4041 using namespace llvm;
42
43 cl::opt Bitcode("bitcode");
4144
4245 // Input/Output Options
4346 static cl::list InputFilenames(cl::Positional, cl::OneOrMore,
223226 sys::RemoveFileOnSignal(sys::Path(FileName));
224227
225228 // Write it out
226 OStream L(Out);
227 WriteBytecodeToFile(M, L, !DisableCompression);
229 if (Bitcode) {
230 WriteBitcodeToFile(M, Out);
231 } else {
232 OStream L(Out);
233 WriteBytecodeToFile(M, L, !DisableCompression);
234 }
228235
229236 // Close the bytecode file.
230237 Out.close();
546553 args[2] = tmp_output.c_str();
547554 args[3] = 0;
548555 if (0 == sys::Program::ExecuteAndWait(prog, args, 0,0,0,0, &ErrMsg)) {
549 if (tmp_output.isBytecodeFile()) {
556 if (tmp_output.isBytecodeFile() || tmp_output.isBitcodeFile()) {
550557 sys::Path target(RealBytecodeOutput);
551558 target.eraseFromDisk();
552559 if (tmp_output.renamePathOnDisk(target, &ErrMsg))