[lld] 20eb719 - lld: Reduce number of references to undefined printed from 10 to 3.
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 30 11:31:43 PDT 2020
Author: Nico Weber
Date: 2020-03-30T14:31:32-04:00
New Revision: 20eb719f99c4979838c2995a447452f9fc3d3605
URL: https://github.com/llvm/llvm-project/commit/20eb719f99c4979838c2995a447452f9fc3d3605
DIFF: https://github.com/llvm/llvm-project/commit/20eb719f99c4979838c2995a447452f9fc3d3605.diff
LOG: lld: Reduce number of references to undefined printed from 10 to 3.
As of a while ago, lld groups all undefined references to a single
symbol in a single diagnostic. Back then, I made it so that we
print up to 10 references to each undefined symbol.
Having used this for a while, I never wished there were more
references, but I sometimes found that this can print a lot of
output. lld prints up to 10 diagnostics by default, and if
each has 10 references (which I've seen in practice), and each
undefined symbol produces 2 (possibly very long) lines of output,
that's over 200 lines of error output.
Let's try it with just 3 references for a while and see how
that feels in practice.
Differential Revision: https://reviews.llvm.org/D77017
Added:
Modified:
lld/COFF/SymbolTable.cpp
lld/ELF/Relocations.cpp
lld/test/COFF/undefined-symbol-multi.s
lld/test/ELF/undef-multi.s
Removed:
################################################################################
diff --git a/lld/COFF/SymbolTable.cpp b/lld/COFF/SymbolTable.cpp
index 7072f4d8d0e3..8c5556a451b9 100644
--- a/lld/COFF/SymbolTable.cpp
+++ b/lld/COFF/SymbolTable.cpp
@@ -204,7 +204,7 @@ static void reportUndefinedSymbol(const UndefinedDiag &undefDiag) {
llvm::raw_string_ostream os(out);
os << "undefined symbol: " << toString(*undefDiag.sym);
- const size_t maxUndefReferences = 10;
+ const size_t maxUndefReferences = 3;
size_t i = 0, numRefs = 0;
for (const UndefinedDiag::File &ref : undefDiag.files) {
std::vector<std::string> symbolLocations =
diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index 59c9ecf0019d..61812ab40205 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -870,7 +870,7 @@ static void reportUndefinedSymbol(const UndefinedDiag &undef,
if (msg.empty())
msg = "undefined " + visibility() + "symbol: " + toString(sym);
- const size_t maxUndefReferences = 10;
+ const size_t maxUndefReferences = 3;
size_t i = 0;
for (UndefinedDiag::Loc l : undef.locs) {
if (i >= maxUndefReferences)
diff --git a/lld/test/COFF/undefined-symbol-multi.s b/lld/test/COFF/undefined-symbol-multi.s
index 5942972a0251..2d3d8285338c 100644
--- a/lld/test/COFF/undefined-symbol-multi.s
+++ b/lld/test/COFF/undefined-symbol-multi.s
@@ -22,14 +22,7 @@
# CHECK-NEXT: >>> referenced by {{.*}}tmp.obj:(main)
# CHECK-NEXT: >>> referenced by {{.*}}tmp.obj:(main)
# CHECK-NEXT: >>> referenced by {{.*}}tmp2.obj:(bar)
-# CHECK-NEXT: >>> referenced by {{.*}}tmp2.obj:(bar)
-# CHECK-NEXT: >>> referenced by {{.*}}tmp2.obj:(bar)
-# CHECK-NEXT: >>> referenced by {{.*}}tmp2.obj:(bar)
-# CHECK-NEXT: >>> referenced by {{.*}}tmp2.obj:(bar)
-# CHECK-NEXT: >>> referenced by {{.*}}tmp2.obj:(bar)
-# CHECK-NEXT: >>> referenced by {{.*}}tmp2.obj:(bar)
-# CHECK-NEXT: >>> referenced by {{.*}}tmp2.obj:(bar)
-# CHECK-NEXT: >>> referenced 2 more times
+# CHECK-NEXT: >>> referenced 9 more times
# CHECK-EMPTY:
# CHECK-NEXT: error: undefined symbol: int __cdecl bar(void)
# CHECK-NEXT: >>> referenced by {{.*}}.obj:(main)
diff --git a/lld/test/ELF/undef-multi.s b/lld/test/ELF/undef-multi.s
index 627235b37b15..bc1b0623fa58 100644
--- a/lld/test/ELF/undef-multi.s
+++ b/lld/test/ELF/undef-multi.s
@@ -10,9 +10,7 @@
# CHECK-NEXT: >>> {{.*}}:(.text+0x6)
# CHECK-NEXT: >>> referenced by undef-multi.s
# CHECK-NEXT: >>> {{.*}}:(.text+0xB)
-# CHECK-NEXT: >>> referenced by undef-multi.s
-# CHECK-NEXT: >>> {{.*}}:(.text+0x10)
-# CHECK-NEXT: >>> referenced by {{.*}}tmp2.o:(.text+0x0)
+# CHECK-NEXT: >>> referenced 2 more times
# All references to a single undefined symbol count as a single error -- but
# at most 10 references are printed.
@@ -36,15 +34,7 @@
# LIMIT-NEXT: >>> {{.*}}:(.text+0x6)
# LIMIT-NEXT: >>> referenced by undef-multi.s
# LIMIT-NEXT: >>> {{.*}}:(.text+0xB)
-# LIMIT-NEXT: >>> referenced by undef-multi.s
-# LIMIT-NEXT: >>> {{.*}}:(.text+0x10)
-# LIMIT-NEXT: >>> referenced by {{.*}}tmp2.o:(.text+0x0)
-# LIMIT-NEXT: >>> referenced by {{.*}}tmp3.o:(.text+0x1)
-# LIMIT-NEXT: >>> referenced by {{.*}}tmp3.o:(.text+0x6)
-# LIMIT-NEXT: >>> referenced by {{.*}}tmp3.o:(.text+0xB)
-# LIMIT-NEXT: >>> referenced by {{.*}}tmp3.o:(.text+0x10)
-# LIMIT-NEXT: >>> referenced by {{.*}}tmp3.o:(.text+0x15)
-# LIMIT-NEXT: >>> referenced 2 more times
+# LIMIT-NEXT: >>> referenced 9 more times
.file "undef-multi.s"
More information about the llvm-commits
mailing list