Mercurial > projects > ldc
diff gen/linker.cpp @ 244:a95056b3c996 trunk
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
Did a lot of smaller cleans up here and there.
Replaced more llvm::Foo with LLFoo for common stuff.
Split up tollvm.cpp.
author | lindquist |
---|---|
date | Mon, 09 Jun 2008 09:37:08 +0200 |
parents | |
children | 21f85bac0b1a |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gen/linker.cpp Mon Jun 09 09:37:08 2008 +0200 @@ -0,0 +1,25 @@ +#include "gen/llvm.h" +#include "llvm/Linker.h" + +#include "root.h" +#include "mars.h" + +typedef std::vector<llvm::Module*> Module_vector; + +void linkModules(llvm::Module* dst, const Module_vector& MV) +{ + if (MV.empty()) + return; + + llvm::Linker linker("llvmdc", dst); + + std::string err; + for (Module_vector::const_iterator i=MV.begin(); i!=MV.end(); ++i) + { + if (!linker.LinkInModule(*i, &err)) + { + error("%s", err.c_str()); + fatal(); + } + } +}