[PATCH] D77017: lld: Reduce number of references to undefined printed from 10 to 3.
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 29 10:08:24 PDT 2020
thakis created this revision.
thakis added a reviewer: ruiu.
Herald added subscribers: MaskRay, arichardson, emaste.
Herald added a reviewer: espindola.
thakis added a comment.
(If someone wants to see _all_ undefined refs, we could make it so that -ferror-limit=0 disables this limiting, but I haven't heard anyone wishing for that so far, so I wouldn't do that for now.)
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.
https://reviews.llvm.org/D77017
Files:
lld/COFF/SymbolTable.cpp
lld/ELF/Relocations.cpp
lld/test/COFF/undefined-symbol-multi.s
lld/test/ELF/undef-multi.s
Index: lld/test/ELF/undef-multi.s
===================================================================
--- lld/test/ELF/undef-multi.s
+++ 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"
Index: lld/test/COFF/undefined-symbol-multi.s
===================================================================
--- lld/test/COFF/undefined-symbol-multi.s
+++ 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)
Index: lld/ELF/Relocations.cpp
===================================================================
--- lld/ELF/Relocations.cpp
+++ lld/ELF/Relocations.cpp
@@ -870,7 +870,7 @@
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)
Index: lld/COFF/SymbolTable.cpp
===================================================================
--- lld/COFF/SymbolTable.cpp
+++ lld/COFF/SymbolTable.cpp
@@ -204,7 +204,7 @@
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 =
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77017.253431.patch
Type: text/x-patch
Size: 3297 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200329/dfa36c81/attachment-0001.bin>
More information about the llvm-commits
mailing list