For PR998:

Fix an infinite loop in the Linker and a few other assorted link problems.

Patch contributed by Scott Michel. Thanks, Scott!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31680 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer
2006-11-11 11:54:25 +00:00
parent 44e2f8f9fa
commit 4952143236
5 changed files with 52 additions and 31 deletions

View File

@@ -32,10 +32,10 @@ Linker::LinkInItems(const ItemList& Items, ItemList& NativeItems) {
I != E; ++I) {
if (I->second) {
// Link in the library suggested.
bool is_file = true;
if (LinkInLibrary(I->first,is_file))
bool is_bytecode = true;
if (LinkInLibrary(I->first,is_bytecode))
return true;
if (!is_file)
if (!is_bytecode)
NativeItems.push_back(*I);
} else {
// Link in the file suggested
@@ -61,8 +61,8 @@ Linker::LinkInItems(const ItemList& Items, ItemList& NativeItems) {
/// LinkInLibrary - links one library into the HeadModule.
///
bool Linker::LinkInLibrary(const std::string& Lib, bool& is_file) {
is_file = false;
bool Linker::LinkInLibrary(const std::string& Lib, bool& is_bytecode) {
is_bytecode = false;
// Determine where this library lives.
sys::Path Pathname = FindLib(Lib);
if (Pathname.isEmpty())
@@ -77,11 +77,12 @@ bool Linker::LinkInLibrary(const std::string& Lib, bool& is_file) {
// LLVM ".so" file.
if (LinkInFile(Pathname))
return error("Cannot link file '" + Pathname.toString() + "'");
is_file = true;
is_bytecode = true;
break;
case sys::ArchiveFileType:
if (LinkInArchive(Pathname))
return error("Cannot link archive '" + Pathname.toString() + "'");
is_bytecode = true;
break;
default:
return warning("Supposed library '" + Lib + "' isn't a library.");