[lld/mac] Resolve defined symbols before undefined symbols
authorNico Weber <thakis@chromium.org>
Mon, 19 Jul 2021 18:38:15 +0000 (14:38 -0400)
committerNico Weber <thakis@chromium.org>
Mon, 19 Jul 2021 20:37:41 +0000 (16:37 -0400)
commitfbb45947b2a77c6295c110c7fbb648adac14d2c9
tree9c2e72c63dc850d85d76ad551cbee3493762fc24
parent9da70ab3d43c79116f80fc06aa7cf517374ce42c
[lld/mac] Resolve defined symbols before undefined symbols

Ports https://reviews.llvm.org/D95985 to the MachO port.
Happens to fix PR51135; see that bug for details.
Also makes lld's behavior match ld64 for the included test case.

Differential Revision: https://reviews.llvm.org/D106293
lld/ELF/InputFiles.cpp
lld/MachO/InputFiles.cpp
lld/test/MachO/weak-definition-in-main-file.s [new file with mode: 0644]