[lld-macho] Group undefined symbol diagnostics by symbol
authorDaniel Bertalan <dani@danielbertalan.dev>
Tue, 14 Jun 2022 20:35:09 +0000 (16:35 -0400)
committerNico Weber <thakis@chromium.org>
Tue, 14 Jun 2022 20:38:11 +0000 (16:38 -0400)
commitd61341768cf0cff7ceeaddecc2f769b5c1b901c4
treeb4039814f476315b9def864cb46732be5e23a126
parent7c0089d7351cf7ab067e987aa2e32db4b07b3adf
[lld-macho] Group undefined symbol diagnostics by symbol

ld64.lld used to print the "undefined symbol" line for each reference to
an undefined symbol previously:

  ld64.lld: error: undefined symbol: _foo
  >>> referenced by /path/to/bar.o:(symbol _baz+0x0)

  ld64.lld: error: undefined symbol: _foo
  >>> referenced by /path/to/bar.o:(symbol _quux+0x1)

Now they are deduplicated:

  ld64.lld: error: undefined symbol: _foo
  >>> referenced by /path/to/bar.o:(symbol _baz+0x0)
  >>> referenced by /path/to/bar.o:(symbol _quux+0x1)

As with the other lld ports, only the first 3 references are printed.

Differential Revision: https://reviews.llvm.org/D127753
lld/MachO/SymbolTable.cpp
lld/MachO/SymbolTable.h
lld/MachO/Writer.cpp
lld/test/MachO/invalid/undef-multi.s [new file with mode: 0644]