[PATCH] D26981: Limit maximum number of errors to 1000.

Filipe Cabecinhas via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 22 10:35:01 PST 2016


filcab added a comment.

Test case?
It seems having a --full-shutdown will make lld not "bail out" after N errors, but stop printing errors anyway. In that case, no use going on with the link.



================
Comment at: ELF/Error.cpp:44
 void elf::error(const Twine &Msg) {
-  *ErrorOS << Argv0 << ": error: " << Msg << "\n";
+  if (ErrorLimit == 0 || ErrorCount <= ErrorLimit)
+    *ErrorOS << Argv0 << ": error: " << Msg << "\n";
----------------
Nit: The `<=` condition and `ErrorCount++` below this check make lld emit N+1 errors.


================
Comment at: ELF/Error.cpp:46
+    *ErrorOS << Argv0 << ": error: " << Msg << "\n";
+  else if (Config->ExitEarly)
+    exitLld(1);
----------------
I don't think this should really be tied to `--full-shutdown`. I see those features as orthogonal.


================
Comment at: ELF/Error.cpp:47
+  else if (Config->ExitEarly)
+    exitLld(1);
+
----------------
You probably want to tell the user why lld exited. Something like "Too many errors emitted, halting link" should do it.
(No need to go overboard with messages like "go fix your program" like valgrind had :-) )


https://reviews.llvm.org/D26981





More information about the llvm-commits mailing list