summaryrefslogtreecommitdiffstats
path: root/lld/ELF/Writer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/ELF/Writer.cpp')
-rw-r--r--lld/ELF/Writer.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 153c645c8f1..6937dd59f88 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -1391,7 +1391,9 @@ template <class ELFT> void Writer<ELFT>::createSections() {
if (auto *SS = dyn_cast<SharedSymbol<ELFT>>(Body))
SS->File->IsUsed = true;
- if (Body->isUndefined() && !S->isWeak())
+ // We only report undefined symbols in regular objects. This means that we
+ // will accept an undefined reference in bitcode if it can be optimized out.
+ if (S->IsUsedInRegularObj && Body->isUndefined() && !S->isWeak())
reportUndefined<ELFT>(Symtab, Body);
if (auto *C = dyn_cast<DefinedCommon>(Body))
OpenPOWER on IntegriCloud