[llvm-commits] [llvm] r47900 - /llvm/trunk/lib/Linker/LinkArchives.cpp
Anton Korobeynikov
asl at math.spbu.ru
Tue Mar 4 12:16:11 PST 2008
Author: asl
Date: Tue Mar 4 14:16:11 2008
New Revision: 47900
URL: http://llvm.org/viewvc/llvm-project?rev=47900&view=rev
Log:
Properly populate lists of defined/undefined symbols in presence of aliases
Modified:
llvm/trunk/lib/Linker/LinkArchives.cpp
Modified: llvm/trunk/lib/Linker/LinkArchives.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkArchives.cpp?rev=47900&r1=47899&r2=47900&view=diff
==============================================================================
--- llvm/trunk/lib/Linker/LinkArchives.cpp (original)
+++ llvm/trunk/lib/Linker/LinkArchives.cpp Tue Mar 4 14:16:11 2008
@@ -56,6 +56,7 @@
DefinedSymbols.insert(I->getName());
}
}
+
for (Module::global_iterator I = M->global_begin(), E = M->global_end();
I != E; ++I)
if (I->hasName()) {
@@ -68,6 +69,16 @@
}
}
+ for (Module::alias_iterator I = M->alias_begin(), E = M->alias_end();
+ I != E; ++I)
+ if (I->hasName()) {
+ const GlobalValue *Aliased = I->getAliasedGlobal();
+ if (Aliased->isDeclaration())
+ UndefinedSymbols.insert(I->getName());
+ else
+ DefinedSymbols.insert(I->getName());
+ }
+
// Prune out any defined symbols from the undefined symbols set...
for (std::set<std::string>::iterator I = UndefinedSymbols.begin();
I != UndefinedSymbols.end(); )
@@ -88,7 +99,6 @@
/// FALSE - No errors.
bool
Linker::LinkInArchive(const sys::Path &Filename, bool &is_native) {
-
// Make sure this is an archive file we're dealing with
if (!Filename.isArchive())
return error("File '" + Filename.toString() + "' is not an archive.");
More information about the llvm-commits
mailing list