[lld] Improve readability of "undefined reference" message (PR #82671)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 22 10:22:06 PST 2024
https://github.com/DeanSturtevant1 created https://github.com/llvm/llvm-project/pull/82671
The current message implies a command line flag caused an undefined reference. This of course is wrong and causes confusion. The message now more accurately reflects the true state of affairs.
>From 023cf559b06a111b9683129fe3f5d112a0dbea70 Mon Sep 17 00:00:00 2001
From: DeanSturtevant1 <48059325+DeanSturtevant1 at users.noreply.github.com>
Date: Thu, 22 Feb 2024 13:21:25 -0500
Subject: [PATCH] Improve readability of "undefined reference" message
The current message implies a command line flag caused an undefined reference. This of course is wrong and causes confusion. The message now more accurately reflects the true state of affairs.
---
lld/ELF/Writer.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 0bbf43ddf694aa..cf8825296213b2 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -2057,8 +2057,9 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
if (sym->dsoDefined)
continue;
if (sym->isUndefined() && !sym->isWeak()) {
- diagnose("undefined reference due to --no-allow-shlib-undefined: " +
- toString(*sym) + "\n>>> referenced by " + toString(file));
+ diagnose("undefined reference: " +
+ toString(*sym) + "\n>>> referenced by " + toString(file) +
+ " (disallowed by --no-allow-shlib-undefined)");
} else if (sym->isDefined() && sym->computeBinding() == STB_LOCAL) {
diagnose("non-exported symbol '" + toString(*sym) + "' in '" +
toString(sym->file) + "' is referenced by DSO '" +
More information about the llvm-commits
mailing list