[lld/mac] Don't assert during thunk insertion if there are undefined symbols
authorNico Weber <thakis@chromium.org>
Wed, 1 Sep 2021 18:28:51 +0000 (14:28 -0400)
committerNico Weber <thakis@chromium.org>
Fri, 3 Sep 2021 16:22:41 +0000 (12:22 -0400)
commitc15b5888527bce7c794270d76484068ff3dc73a4
tree5957a6b4de08869407adb7e79bc88a687d57fc9b
parent75620fadf5c391b6450eb658dea6194167f522f7
[lld/mac] Don't assert during thunk insertion if there are undefined symbols

We end up calling resolveBranchVA(), which asserts for Undefineds.

As fix, just return early in Writer::run() if there are any diagnostics
after processing relocations (which is where undefined symbol errors are
emitted). This matches what the ELF port does.

Differential Revision: https://reviews.llvm.org/D109079
lld/MachO/Writer.cpp
lld/test/MachO/invalid/arm64-thunk-undefined.s [new file with mode: 0644]