[lld] r247016 - Simplify reporting of undefined symbols.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 8 07:32:30 PDT 2015
Author: rafael
Date: Tue Sep 8 09:32:29 2015
New Revision: 247016
URL: http://llvm.org/viewvc/llvm-project?rev=247016&view=rev
Log:
Simplify reporting of undefined symbols.
Modified:
lld/trunk/ELF/Driver.cpp
lld/trunk/ELF/SymbolTable.cpp
lld/trunk/ELF/SymbolTable.h
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=247016&r1=247015&r2=247016&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Tue Sep 8 09:32:29 2015
@@ -89,9 +89,6 @@ void LinkerDriver::link(ArrayRef<const c
Symtab.addFile(std::move(File));
}
- // Make sure we have resolved all symbols.
- Symtab.reportRemainingUndefines();
-
// Write the result.
const ELFFileBase *FirstObj = Symtab.getFirstELF();
switch (FirstObj->getELFKind()) {
Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=247016&r1=247015&r2=247016&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Tue Sep 8 09:32:29 2015
@@ -72,14 +72,6 @@ void SymbolTable::addELFFile(ELFFileBase
}
}
-void SymbolTable::reportRemainingUndefines() {
- for (auto &I : Symtab) {
- SymbolBody *Body = I.second->Body;
- if (Body->isStrongUndefined())
- error(Twine("undefined symbol: ") + Body->getName());
- }
-}
-
// This function resolves conflicts if there's an existing symbol with
// the same name. Decisions are made based on symbol type.
template <class ELFT> void SymbolTable::resolve(SymbolBody *New) {
Modified: lld/trunk/ELF/SymbolTable.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.h?rev=247016&r1=247015&r2=247016&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.h (original)
+++ lld/trunk/ELF/SymbolTable.h Tue Sep 8 09:32:29 2015
@@ -42,9 +42,6 @@ public:
return nullptr;
}
- // Print an error message on undefined symbols.
- void reportRemainingUndefines();
-
const llvm::DenseMap<StringRef, Symbol *> &getSymbols() const {
return Symtab;
}
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=247016&r1=247015&r2=247016&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Tue Sep 8 09:32:29 2015
@@ -327,7 +327,8 @@ template <class ELFT> void SymbolTableSe
Out = BSSSec;
break;
case SymbolBody::UndefinedKind:
- assert(Body->isWeak() && "Should be defined by now");
+ if (!Body->isWeak())
+ error(Twine("undefined symbol: ") + Name);
case SymbolBody::DefinedAbsoluteKind:
break;
case SymbolBody::LazyKind:
More information about the llvm-commits
mailing list