summaryrefslogtreecommitdiffstats
path: root/lld/lib/Core
diff options
context:
space:
mode:
Diffstat (limited to 'lld/lib/Core')
-rw-r--r--lld/lib/Core/Resolver.cpp16
-rw-r--r--lld/lib/Core/SymbolTable.cpp6
2 files changed, 13 insertions, 9 deletions
diff --git a/lld/lib/Core/Resolver.cpp b/lld/lib/Core/Resolver.cpp
index b80a2214173..d0dd41fb5b4 100644
--- a/lld/lib/Core/Resolver.cpp
+++ b/lld/lib/Core/Resolver.cpp
@@ -191,7 +191,7 @@ void Resolver::resolveUndefines() {
unsigned int undefineGenCount = 0xFFFFFFFF;
while (undefineGenCount != _symbolTable.size()) {
undefineGenCount = _symbolTable.size();
- std::vector<const Atom *> undefines;
+ std::vector<const UndefinedAtom *> undefines;
_symbolTable.undefines(undefines);
for ( const Atom *undefAtom : undefines ) {
StringRef undefName = undefAtom->name();
@@ -301,7 +301,7 @@ void Resolver::checkUndefines(bool final) {
return;
// build vector of remaining undefined symbols
- std::vector<const Atom *> undefinedAtoms;
+ std::vector<const UndefinedAtom *> undefinedAtoms;
_symbolTable.undefines(undefinedAtoms);
if (_targetInfo.getLinkerOptions()._deadStrip) {
// When dead code stripping, we don't care if dead atoms are undefined.
@@ -315,11 +315,15 @@ void Resolver::checkUndefines(bool final) {
(!_targetInfo.getLinkerOptions()._noInhibitExec ||
_targetInfo.getLinkerOptions()._outputKind == OutputKind::Relocatable)) {
// FIXME: need diagonstics interface for writing error messages
- llvm::errs() << "Undefined symbols:\n";
- for ( const Atom *undefAtom : undefinedAtoms ) {
- llvm::errs() << " " << undefAtom->name() << "\n";
+ bool isError = false;
+ for (const UndefinedAtom *undefAtom : undefinedAtoms) {
+ if (undefAtom->canBeNull() == UndefinedAtom::canBeNullNever) {
+ llvm::errs() << "Undefined Symbol: " << undefAtom->name() << "\n";
+ isError = true;
+ }
}
- llvm::report_fatal_error("symbol(s) not found");
+ if (isError)
+ llvm::report_fatal_error("symbol(s) not found");
}
}
diff --git a/lld/lib/Core/SymbolTable.cpp b/lld/lib/Core/SymbolTable.cpp
index 7a35ed90144..29e58796022 100644
--- a/lld/lib/Core/SymbolTable.cpp
+++ b/lld/lib/Core/SymbolTable.cpp
@@ -332,13 +332,13 @@ unsigned int SymbolTable::size() {
return _nameTable.size();
}
-void SymbolTable::undefines(std::vector<const Atom *> &undefs) {
+void SymbolTable::undefines(std::vector<const UndefinedAtom *> &undefs) {
for (NameToAtom::iterator it = _nameTable.begin(),
end = _nameTable.end(); it != end; ++it) {
const Atom *atom = it->second;
assert(atom != nullptr);
- if (atom->definition() == Atom::definitionUndefined)
- undefs.push_back(atom);
+ if (const auto undef = dyn_cast<const UndefinedAtom>(atom))
+ undefs.push_back(undef);
}
}
OpenPOWER on IntegriCloud