Simplify reporting of undefined symbols.

llvm-svn: 247016
This commit is contained in:
Rafael Espindola
2015-09-08 14:32:29 +00:00
parent 64319286d0
commit 4f624b9581
4 changed files with 2 additions and 15 deletions

View File

@@ -89,9 +89,6 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) {
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()) {

View File

@@ -72,14 +72,6 @@ void SymbolTable::addELFFile(ELFFileBase *File) {
}
}
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) {

View File

@@ -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;
}

View File

@@ -327,7 +327,8 @@ template <class ELFT> void SymbolTableSection<ELFT>::writeTo(uint8_t *Buf) {
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: