mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-27 14:34:58 +00:00
Modified the linker so that it always links in an object from an archive
that defines the symbol "main." This is a hack that ensures that programs that place their main function in a library and then link it in (i.e. Apache 2.x) get their main function linked in. There is probably a more correct way to do this, but this works for now. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10594 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ac1ccae982
commit
1715ce00e4
@ -200,17 +200,27 @@ static bool LinkInArchive(Module *M,
|
||||
const std::set<std::string> &DefSymbols = DefinedSymbols[i];
|
||||
|
||||
bool ObjectRequired = false;
|
||||
for (std::set<std::string>::iterator I = UndefinedSymbols.begin(),
|
||||
E = UndefinedSymbols.end(); I != E; ++I)
|
||||
if (DefSymbols.count(*I)) {
|
||||
if (Verbose)
|
||||
std::cerr << " Found object '"
|
||||
<< Objects[i]->getModuleIdentifier ()
|
||||
<< "' providing symbol '" << *I << "'...\n";
|
||||
ObjectRequired = true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// If the object defines main(), then it is automatically required.
|
||||
// Otherwise, look to see if it defines a symbol that is currently
|
||||
// undefined.
|
||||
//
|
||||
if ((DefSymbols.find ("main")) == DefSymbols.end()) {
|
||||
for (std::set<std::string>::iterator I = UndefinedSymbols.begin(),
|
||||
E = UndefinedSymbols.end(); I != E; ++I)
|
||||
if (DefSymbols.count(*I)) {
|
||||
if (Verbose)
|
||||
std::cerr << " Found object '"
|
||||
<< Objects[i]->getModuleIdentifier ()
|
||||
<< "' providing symbol '" << *I << "'...\n";
|
||||
ObjectRequired = true;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
ObjectRequired = true;
|
||||
}
|
||||
|
||||
// We DO need to link this object into the program...
|
||||
if (ObjectRequired) {
|
||||
if (LinkModules(M, Objects[i], &ErrorMessage))
|
||||
|
@ -200,17 +200,27 @@ static bool LinkInArchive(Module *M,
|
||||
const std::set<std::string> &DefSymbols = DefinedSymbols[i];
|
||||
|
||||
bool ObjectRequired = false;
|
||||
for (std::set<std::string>::iterator I = UndefinedSymbols.begin(),
|
||||
E = UndefinedSymbols.end(); I != E; ++I)
|
||||
if (DefSymbols.count(*I)) {
|
||||
if (Verbose)
|
||||
std::cerr << " Found object '"
|
||||
<< Objects[i]->getModuleIdentifier ()
|
||||
<< "' providing symbol '" << *I << "'...\n";
|
||||
ObjectRequired = true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// If the object defines main(), then it is automatically required.
|
||||
// Otherwise, look to see if it defines a symbol that is currently
|
||||
// undefined.
|
||||
//
|
||||
if ((DefSymbols.find ("main")) == DefSymbols.end()) {
|
||||
for (std::set<std::string>::iterator I = UndefinedSymbols.begin(),
|
||||
E = UndefinedSymbols.end(); I != E; ++I)
|
||||
if (DefSymbols.count(*I)) {
|
||||
if (Verbose)
|
||||
std::cerr << " Found object '"
|
||||
<< Objects[i]->getModuleIdentifier ()
|
||||
<< "' providing symbol '" << *I << "'...\n";
|
||||
ObjectRequired = true;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
ObjectRequired = true;
|
||||
}
|
||||
|
||||
// We DO need to link this object into the program...
|
||||
if (ObjectRequired) {
|
||||
if (LinkModules(M, Objects[i], &ErrorMessage))
|
||||
|
Loading…
x
Reference in New Issue
Block a user