diff options
Diffstat (limited to 'lld/ELF/Writer.cpp')
-rw-r--r-- | lld/ELF/Writer.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index e3601f4e7cf..27a1e0f4f6b 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -1069,9 +1069,11 @@ template <class ELFT> void Writer<ELFT>::createSections() { std::vector<DefinedCommon *> CommonSymbols; for (auto &P : Symtab.getSymbols()) { SymbolBody *Body = P.second->Body; - if (auto *U = dyn_cast<Undefined>(Body)) - if (!U->isWeak() && !U->canKeepUndefined()) + if (Body->isUndefined() && !Body->isWeak()) { + auto *U = dyn_cast<UndefinedElf<ELFT>>(Body); + if (!U || !U->canKeepUndefined()) reportUndefined<ELFT>(Symtab, Body); + } if (auto *C = dyn_cast<DefinedCommon>(Body)) CommonSymbols.push_back(C); |