Make undefines check into an assertion.

Dead-strip root symbols can be undefined atoms, but should not really be
nonexistent, because dead-strip root symbols should be added to initial
undefined atoms at startup. Whenever you look up its name in the symbol
table, some type of atom will always exist.

llvm-svn: 192831
diff --git a/lld/lib/Core/Resolver.cpp b/lld/lib/Core/Resolver.cpp
index 7fdb6f5..3a34cd3 100644
--- a/lld/lib/Core/Resolver.cpp
+++ b/lld/lib/Core/Resolver.cpp
@@ -363,11 +363,11 @@
 
 
 // remove all atoms not actually used
-bool Resolver::deadStripOptimize() {
+void Resolver::deadStripOptimize() {
   ScopedTask task(getDefaultDomain(), "deadStripOptimize");
   // only do this optimization with -dead_strip
   if (!_context.deadStrip())
-    return true;
+    return;
 
   // clear liveness on all atoms
   _liveAtoms.clear();
@@ -386,11 +386,11 @@
   // Or, use list of names that are dead stip roots.
   for (const StringRef &name : _context.deadStripRoots()) {
     const Atom *symAtom = _symbolTable.findByName(name);
-    if (!symAtom || symAtom->definition() == Atom::definitionUndefined) {
-      llvm::errs() << "Dead strip root '" << symAtom->name()
-                   << "' is not defined\n";
-      return false;
-    }
+    assert(symAtom);
+    if (symAtom->definition() == Atom::definitionUndefined)
+      // Dead-strip root atoms can be undefined at this point only when
+      // allowUndefines flag is on. Skip such undefines.
+      continue;
     _deadStripRoots.insert(symAtom);
   }
 
@@ -402,7 +402,6 @@
   // now remove all non-live atoms from _atoms
   _atoms.erase(std::remove_if(_atoms.begin(), _atoms.end(),
                               NotLive(_liveAtoms)), _atoms.end());
-  return true;
 }
 
 
@@ -474,8 +473,7 @@
   if (!this->resolveUndefines())
     return false;
   this->updateReferences();
-  if (!this->deadStripOptimize())
-    return false;
+  this->deadStripOptimize();
   if (this->checkUndefines(false)) {
     if (!_context.allowRemainingUndefines())
       return false;