[llvm-commits] CVS: llvm/tools/gccld/Linker.cpp
John Criswell
criswell at cs.uiuc.edu
Tue Dec 23 14:28:00 PST 2003
Changes in directory llvm/tools/gccld:
Linker.cpp updated: 1.20 -> 1.21
---
Log message:
Modified the logic so that library objects with main() are only linked in
if the program currently has main undefined.
---
Diffs of the changes: (+7 -6)
Index: llvm/tools/gccld/Linker.cpp
diff -u llvm/tools/gccld/Linker.cpp:1.20 llvm/tools/gccld/Linker.cpp:1.21
--- llvm/tools/gccld/Linker.cpp:1.20 Tue Dec 23 11:37:06 2003
+++ llvm/tools/gccld/Linker.cpp Tue Dec 23 14:27:14 2003
@@ -202,11 +202,14 @@
bool ObjectRequired = false;
//
- // If the object defines main(), then it is automatically required.
- // Otherwise, look to see if it defines a symbol that is currently
- // undefined.
+ // If the object defines main() and the program currently has main()
+ // undefined, then automatically link in the module. Otherwise, look to
+ // see if it defines a symbol that is currently undefined.
//
- if ((DefSymbols.find ("main")) == DefSymbols.end()) {
+ if ((M->getMainFunction() == NULL) &&
+ ((DefSymbols.find ("main")) != DefSymbols.end())) {
+ ObjectRequired = true;
+ } else {
for (std::set<std::string>::iterator I = UndefinedSymbols.begin(),
E = UndefinedSymbols.end(); I != E; ++I)
if (DefSymbols.count(*I)) {
@@ -217,8 +220,6 @@
ObjectRequired = true;
break;
}
- } else {
- ObjectRequired = true;
}
// We DO need to link this object into the program...
More information about the llvm-commits
mailing list