changeset 1324:b3674ad4026d

Strip metadata for -singleobj as a workaround to a LLVM linking bug.
author Christian Kamm <kamm incasoftware de>
date Sat, 09 May 2009 18:57:21 +0200
parents c74dfdcc5043
children 5a9dc345c70a
files gen/main.cpp
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gen/main.cpp	Sat May 09 18:57:00 2009 +0200
+++ b/gen/main.cpp	Sat May 09 18:57:21 2009 +0200
@@ -36,6 +36,7 @@
 #include "gen/linker.h"
 #include "gen/irstate.h"
 #include "gen/toobj.h"
+#include "gen/passes/Passes.h"
 #include "gen/llvm-version.h"
 
 #include "gen/cl_options.h"
@@ -869,6 +870,12 @@
         std::string errormsg;
         for (int i = 0; i < llvmModules.size(); i++)
         {
+            //FIXME: workaround for llvm metadata bug:
+            //  the LinkInModule call asserts with metadata unstripped
+            llvm::ModulePass* stripMD = createStripMetaData();
+            stripMD->runOnModule(*llvmModules[i]);
+            delete stripMD;
+        
             if(linker.LinkInModule(llvmModules[i], &errormsg))
                 error(errormsg.c_str());
             delete llvmModules[i];