annotate gen/linker.cpp @ 275:665b81613475 trunk

[svn r296] Removed: the 'suite' dir, it never took off! Fixed: foreach statement, key-type checks were buggy. Fixed: setting LLVMDC versions on the command line is now an error. Fixed: array compare runtime had incorrect param attrs on call. Fixed: index expressions on dynamic array slices w/o storage was broken. Fixed: scope classes had incorrect finalization in some cases. Fixed: when outputting !ClassInfoS !OffsetTypeInfoS, static class members were trying to be included, crashing the compiler. Fixed: calling LLVMDC with -inline but not any -O option caused assertion failure. Changed: the runtime now uses a single interface to "get" to !TypeInfoS, part of eliminating duplicate !TypeInfo codegen.
author lindquist
date Thu, 19 Jun 2008 17:30:32 +0200
parents a95056b3c996
children 21f85bac0b1a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
244
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
1 #include "gen/llvm.h"
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
2 #include "llvm/Linker.h"
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
3
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
4 #include "root.h"
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
5 #include "mars.h"
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
6
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
7 typedef std::vector<llvm::Module*> Module_vector;
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
8
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
9 void linkModules(llvm::Module* dst, const Module_vector& MV)
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
10 {
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
11 if (MV.empty())
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
12 return;
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
13
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
14 llvm::Linker linker("llvmdc", dst);
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
15
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
16 std::string err;
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
17 for (Module_vector::const_iterator i=MV.begin(); i!=MV.end(); ++i)
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
18 {
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
19 if (!linker.LinkInModule(*i, &err))
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
20 {
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
21 error("%s", err.c_str());
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
22 fatal();
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
23 }
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
24 }
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
25 }