ELF: Remove DefinedCommon.
Common symbols are now represented with a DefinedRegular that points
to a BssSection, even during symbol resolution.
Differential Revision: https://reviews.llvm.org/D39666
llvm-svn: 317447
diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp
index a398efe..504d3b6 100644
--- a/lld/ELF/Symbols.cpp
+++ b/lld/ELF/Symbols.cpp
@@ -99,8 +99,6 @@
}
return VA;
}
- case Symbol::DefinedCommonKind:
- llvm_unreachable("common are converted to bss");
case Symbol::SharedKind: {
auto &SS = cast<SharedSymbol>(Sym);
if (SS.CopyRelSec)
@@ -182,8 +180,6 @@
}
uint64_t Symbol::getSize() const {
- if (const auto *C = dyn_cast<DefinedCommon>(this))
- return C->Size;
if (const auto *DR = dyn_cast<DefinedRegular>(this))
return DR->Size;
if (const auto *S = dyn_cast<SharedSymbol>(this))
@@ -204,12 +200,6 @@
return nullptr;
}
- if (auto *S = dyn_cast<DefinedCommon>(this)) {
- if (Config->DefineCommon)
- return S->Section->getParent();
- return nullptr;
- }
-
return nullptr;
}
@@ -321,12 +311,12 @@
std::string S;
if (Sym->isUndefined())
S = ": reference to ";
- else if (Sym->isCommon())
- S = ": common definition of ";
else if (Sym->isLazy())
S = ": lazy definition of ";
else if (Sym->isShared())
S = ": shared definition of ";
+ else if (dyn_cast_or_null<BssSection>(cast<DefinedRegular>(Sym)->Section))
+ S = ": common definition of ";
else
S = ": definition of ";