Work around llvm bug #3749 better, or not at all if using a fixed llvm revision.

This commit is contained in:
Frits van Bommel
2009-03-09 13:29:25 +01:00
parent 0182641f85
commit c1d9694494

View File

@@ -845,11 +845,15 @@ int main(int argc, char** argv)
delete llvmModules[i];
}
// workaround for llvm::Linker bug, see llvm #3749
#if LLVM_REV < 66404
// Workaround for llvm bug #3749
// Not needed since LLVM r66404 (it no longer checks for this)
llvm::GlobalVariable* ctors = linker.getModule()->getGlobalVariable("llvm.global_ctors");
if (ctors)
while (ctors->getNumUses() > 0)
delete *ctors->use_begin();
if (ctors) {
ctors->removeDeadConstantUsers();
assert(ctors->use_empty());
}
#endif
m->deleteObjFile();
writeModule(linker.getModule(), filename);