mirror of
https://github.com/intel/llvm.git
synced 2026-01-22 07:01:03 +08:00
Simplify reporting of undefined symbols.
llvm-svn: 247016
This commit is contained in:
@@ -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()) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user