Changes in directory llvm/lib/Transforms/IPO:
Internalize.cpp updated: 1.28 -> 1.29 --- Log message: Don't internalize llvm.global[cd]tor unless there are uses of it. This unbreaks front-ends that don't use __main (like the new CFE). --- Diffs of the changes: (+9 -3) Internalize.cpp | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) Index: llvm/lib/Transforms/IPO/Internalize.cpp diff -u llvm/lib/Transforms/IPO/Internalize.cpp:1.28 llvm/lib/Transforms/IPO/Internalize.cpp:1.29 --- llvm/lib/Transforms/IPO/Internalize.cpp:1.28 Tue Jan 3 13:13:17 2006 +++ llvm/lib/Transforms/IPO/Internalize.cpp Wed Jan 18 18:40:39 2006 @@ -109,7 +109,7 @@ // Never internalize the llvm.used symbol. It is used to implement // attribute((used)). ExternalNames.insert("llvm.used"); - + // Never internalize anchors used by the debugger, else the debugger won't // find them. ExternalNames.insert("llvm.dbg.translation_units"); @@ -125,13 +125,19 @@ // the list if it's empty. // if (I->hasAppendingLinkage() && (I->getName() == "llvm.global_ctors" || - I->getName() == "llvm.global_dtors")) + I->getName() == "llvm.global_dtors")) { I->setConstant(true); + + // If the global ctors/dtors list has no uses, do not internalize it, as + // there is no __main in this program, so the asmprinter should handle + // it. + if (I->use_empty()) continue; + } I->setLinkage(GlobalValue::InternalLinkage); Changed = true; ++NumGlobals; - DEBUG(std::cerr << "Internalizing gvar " << I->getName() << "\n"); + DEBUG(std::cerr << "Internalized gvar " << I->getName() << "\n"); } return Changed; _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits