mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-26 09:18:56 +00:00
Modified the logic so that library objects with main() are only linked in
if the program currently has main undefined. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10597 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -202,11 +202,14 @@ static bool LinkInArchive(Module *M,
|
|||||||
bool ObjectRequired = false;
|
bool ObjectRequired = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
// If the object defines main(), then it is automatically required.
|
// If the object defines main() and the program currently has main()
|
||||||
// Otherwise, look to see if it defines a symbol that is currently
|
// undefined, then automatically link in the module. Otherwise, look to
|
||||||
// undefined.
|
// 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(),
|
for (std::set<std::string>::iterator I = UndefinedSymbols.begin(),
|
||||||
E = UndefinedSymbols.end(); I != E; ++I)
|
E = UndefinedSymbols.end(); I != E; ++I)
|
||||||
if (DefSymbols.count(*I)) {
|
if (DefSymbols.count(*I)) {
|
||||||
@@ -217,8 +220,6 @@ static bool LinkInArchive(Module *M,
|
|||||||
ObjectRequired = true;
|
ObjectRequired = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
ObjectRequired = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We DO need to link this object into the program...
|
// We DO need to link this object into the program...
|
||||||
|
@@ -202,11 +202,14 @@ static bool LinkInArchive(Module *M,
|
|||||||
bool ObjectRequired = false;
|
bool ObjectRequired = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
// If the object defines main(), then it is automatically required.
|
// If the object defines main() and the program currently has main()
|
||||||
// Otherwise, look to see if it defines a symbol that is currently
|
// undefined, then automatically link in the module. Otherwise, look to
|
||||||
// undefined.
|
// 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(),
|
for (std::set<std::string>::iterator I = UndefinedSymbols.begin(),
|
||||||
E = UndefinedSymbols.end(); I != E; ++I)
|
E = UndefinedSymbols.end(); I != E; ++I)
|
||||||
if (DefSymbols.count(*I)) {
|
if (DefSymbols.count(*I)) {
|
||||||
@@ -217,8 +220,6 @@ static bool LinkInArchive(Module *M,
|
|||||||
ObjectRequired = true;
|
ObjectRequired = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
ObjectRequired = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We DO need to link this object into the program...
|
// We DO need to link this object into the program...
|
||||||
|
Reference in New Issue
Block a user