[lld/mac] Handle symbols from -U in treatUndefinedSymbol()
authorNico Weber <thakis@chromium.org>
Thu, 22 Jul 2021 15:20:36 +0000 (11:20 -0400)
committerNico Weber <thakis@chromium.org>
Thu, 22 Jul 2021 23:43:57 +0000 (19:43 -0400)
commit2d6fb62ef2d961bf41bf6b36d370228e3fb8a48b
treee41d4bea64d140854ae553e5da94909b7558647e
parent681107e9f0289a8514821e2954025554c8fabb1e
[lld/mac] Handle symbols from -U in treatUndefinedSymbol()

In ld64, `-U section$start$FOO$bar` handles `section$start$FOO$bar`
as a regular `section$start` symbol, that is section$start processing
happens before -U processing.

Likely, nobody uses that in practice so it doesn't seem very important
to be compatible with this, but it also moves the -U handling code next
to the `-undefined dynamic_lookup` handling code, which is nice because
they do the same thing. And, in fact, this did identify a bug in a corner
case in the intersection of `-undefined dynamic_lookup` and dead-stripping
(fix for that in D106565).

Vaguely related to PR50760.

No interesting behavior change.

Differential Revision: https://reviews.llvm.org/D106566
lld/MachO/Config.h
lld/MachO/Driver.cpp
lld/MachO/SymbolTable.cpp
lld/test/MachO/dead-strip.s