[lld/mac] Abort link immediately on invalid -undefined argument
authorNico Weber <thakis@chromium.org>
Wed, 7 Dec 2022 18:48:08 +0000 (13:48 -0500)
committerNico Weber <thakis@chromium.org>
Thu, 8 Dec 2022 13:30:59 +0000 (08:30 -0500)
commita414044012920059ac4bfd2756669f2fca3a4b99
tree9ebf5ab436c524e2e3589966df1c03cefdbdae0d
parent1fe65d866c5285261b7766f2d3930ae975b878ff
[lld/mac] Abort link immediately on invalid -undefined argument

I tried `-undefined suppress` without `-flat_namespace`.
lld printed `'-undefined suppress' only valid with '-flat_namespace'`
followed by many many screenfuls of error messages about undefined
symbols, making the original diag hard to see.

This is probably the common case when using `-undefined`, so let's
just abort the link immediately when there's an invalid `-undefined`
arg.

Differential Revision: https://reviews.llvm.org/D139559
lld/MachO/Driver.cpp
lld/test/MachO/treat-undef-sym.s