diff options
| author | Shankar Easwaran <shankare@codeaurora.org> | 2013-04-11 02:56:30 +0000 |
|---|---|---|
| committer | Shankar Easwaran <shankare@codeaurora.org> | 2013-04-11 02:56:30 +0000 |
| commit | eeee23e60a0d576660bfce5820d0d34614f0ae40 (patch) | |
| tree | 1f96e4756f0911aadcf96e333a114c489b0631b9 /lld/lib/Core/Resolver.cpp | |
| parent | 1d532a30831f3fac353b8e676858356f17b50a79 (diff) | |
| download | bcm5719-llvm-eeee23e60a0d576660bfce5820d0d34614f0ae40.tar.gz bcm5719-llvm-eeee23e60a0d576660bfce5820d0d34614f0ae40.zip | |
This adds functionality for undefined atoms from dynamic libraries to be added
to the list of undefined atoms.
The processing of undefined atoms from dynamic libraries is controlled by
use-shlib-undefines command line option.
This patch also adds additional command line arguments to allow/disallow
unresolved symbols from shared libraries and mimics GNU ld behavior.
llvm-svn: 179257
Diffstat (limited to 'lld/lib/Core/Resolver.cpp')
| -rw-r--r-- | lld/lib/Core/Resolver.cpp | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/lld/lib/Core/Resolver.cpp b/lld/lib/Core/Resolver.cpp index d5e747fc0de..fa3467c473b 100644 --- a/lld/lib/Core/Resolver.cpp +++ b/lld/lib/Core/Resolver.cpp @@ -181,11 +181,11 @@ void Resolver::addAtoms(const std::vector<const DefinedAtom*>& newAtoms) { // ask symbol table if any definitionUndefined atoms still exist // if so, keep searching libraries until no more atoms being added void Resolver::resolveUndefines() { - const bool searchArchives = - _targetInfo.searchArchivesToOverrideTentativeDefinitions(); - const bool searchSharedLibs = - _targetInfo.searchSharedLibrariesToOverrideTentativeDefinitions(); - + const bool searchArchives = + _targetInfo.searchArchivesToOverrideTentativeDefinitions(); + const bool searchSharedLibs = + _targetInfo.searchSharedLibrariesToOverrideTentativeDefinitions(); + // keep looping until no more undefines were added in last loop unsigned int undefineGenCount = 0xFFFFFFFF; while (undefineGenCount != _symbolTable.size()) { @@ -311,15 +311,23 @@ bool Resolver::checkUndefines(bool final) { // error message about missing symbols if (!undefinedAtoms.empty()) { - // FIXME: need diagonstics interface for writing error messages + // FIXME: need diagnostics interface for writing error messages bool foundUndefines = false; for (const UndefinedAtom *undefAtom : undefinedAtoms) { - if (undefAtom->canBeNull() == UndefinedAtom::canBeNullNever) { - foundUndefines = true; - if (_targetInfo.printRemainingUndefines()) { - llvm::errs() << "Undefined Symbol: " << undefAtom->file().path() - << " : " << undefAtom->name() << "\n"; + const File &f = undefAtom->file(); + bool isAtomUndefined = false; + if (isa<SharedLibraryFile>(f)) { + if (!_targetInfo.allowShlibUndefines()) { + foundUndefines = true; + isAtomUndefined = true; } + } else if (undefAtom->canBeNull() == UndefinedAtom::canBeNullNever) { + foundUndefines = true; + isAtomUndefined = true; + } + if (isAtomUndefined && _targetInfo.printRemainingUndefines()) { + llvm::errs() << "Undefined Symbol: " << undefAtom->file().path() + << " : " << undefAtom->name() << "\n"; } } if (foundUndefines) { |

