diff options
Diffstat (limited to 'lib/Core/SymbolTable.cpp')
| -rw-r--r-- | lib/Core/SymbolTable.cpp | 92 |
1 files changed, 11 insertions, 81 deletions
diff --git a/lib/Core/SymbolTable.cpp b/lib/Core/SymbolTable.cpp index b85a83ffbfe6..44631a5d40dc 100644 --- a/lib/Core/SymbolTable.cpp +++ b/lib/Core/SymbolTable.cpp @@ -28,8 +28,6 @@ #include <vector> namespace lld { -SymbolTable::SymbolTable(LinkingContext &context) : _ctx(context) {} - bool SymbolTable::add(const UndefinedAtom &atom) { return addByName(atom); } bool SymbolTable::add(const SharedLibraryAtom &atom) { return addByName(atom); } @@ -55,25 +53,6 @@ bool SymbolTable::add(const DefinedAtom &atom) { return false; } -const Atom *SymbolTable::findGroup(StringRef sym) { - NameToAtom::iterator pos = _groupTable.find(sym); - if (pos == _groupTable.end()) - return nullptr; - return pos->second; -} - -bool SymbolTable::addGroup(const DefinedAtom &da) { - StringRef name = da.name(); - assert(!name.empty()); - const Atom *existing = findGroup(name); - if (existing == nullptr) { - _groupTable[name] = &da; - return true; - } - _replacedAtoms[&da] = existing; - return false; -} - enum NameCollisionResolution { NCR_First, NCR_Second, @@ -185,19 +164,16 @@ bool SymbolTable::addByName(const Atom &newAtom) { // fallthrough } case MCR_Error: - if (!_ctx.getAllowDuplicates()) { - llvm::errs() << "Duplicate symbols: " - << existing->name() - << ":" - << existing->file().path() - << " and " - << newAtom.name() - << ":" - << newAtom.file().path() - << "\n"; - llvm::report_fatal_error("duplicate symbol error"); - } - useNew = false; + llvm::errs() << "Duplicate symbols: " + << existing->name() + << ":" + << existing->file().path() + << " and " + << newAtom.name() + << ":" + << newAtom.file().path() + << "\n"; + llvm::report_fatal_error("duplicate symbol error"); break; } break; @@ -207,56 +183,13 @@ bool SymbolTable::addByName(const Atom &newAtom) { const UndefinedAtom* newUndef = cast<UndefinedAtom>(&newAtom); bool sameCanBeNull = (existingUndef->canBeNull() == newUndef->canBeNull()); - if (!sameCanBeNull && _ctx.warnIfCoalesableAtomsHaveDifferentCanBeNull()) { - llvm::errs() << "lld warning: undefined symbol " - << existingUndef->name() - << " has different weakness in " - << existingUndef->file().path() - << " and in " << newUndef->file().path() << "\n"; - } - - const UndefinedAtom *existingFallback = existingUndef->fallback(); - const UndefinedAtom *newFallback = newUndef->fallback(); - bool hasDifferentFallback = - (existingFallback && newFallback && - existingFallback->name() != newFallback->name()); - if (hasDifferentFallback) { - llvm::errs() << "lld warning: undefined symbol " - << existingUndef->name() << " has different fallback: " - << existingFallback->name() << " in " - << existingUndef->file().path() << " and " - << newFallback->name() << " in " - << newUndef->file().path() << "\n"; - } - - bool hasNewFallback = newUndef->fallback(); if (sameCanBeNull) - useNew = hasNewFallback; + useNew = false; else useNew = (newUndef->canBeNull() < existingUndef->canBeNull()); break; } case NCR_DupShLib: { - const SharedLibraryAtom *curShLib = cast<SharedLibraryAtom>(existing); - const SharedLibraryAtom *newShLib = cast<SharedLibraryAtom>(&newAtom); - bool sameNullness = - (curShLib->canBeNullAtRuntime() == newShLib->canBeNullAtRuntime()); - bool sameName = curShLib->loadName().equals(newShLib->loadName()); - if (sameName && !sameNullness && - _ctx.warnIfCoalesableAtomsHaveDifferentCanBeNull()) { - // FIXME: need diagonstics interface for writing warning messages - llvm::errs() << "lld warning: shared library symbol " - << curShLib->name() << " has different weakness in " - << curShLib->file().path() << " and in " - << newShLib->file().path(); - } - if (!sameName && _ctx.warnIfCoalesableAtomsHaveDifferentLoadName()) { - // FIXME: need diagonstics interface for writing warning messages - llvm::errs() << "lld warning: shared library symbol " - << curShLib->name() << " has different load path in " - << curShLib->file().path() << " and in " - << newShLib->file().path(); - } useNew = false; break; } @@ -266,9 +199,6 @@ bool SymbolTable::addByName(const Atom &newAtom) { break; } - // Give context a chance to change which is kept. - _ctx.notifySymbolTableCoalesce(existing, &newAtom, useNew); - if (useNew) { // Update name table to use new atom. _nameTable[name] = &newAtom; |
