[lld-macho] Implement `-no_implicit_dylibs`
authorJez Ng <jezng@fb.com>
Wed, 9 Dec 2020 23:08:05 +0000 (15:08 -0800)
committerJez Ng <jezng@fb.com>
Thu, 10 Dec 2020 23:57:52 +0000 (15:57 -0800)
commit6a348f6158ecdb7a4bcac3f4cd1d3c5b6e80a550
tree9c7fe8cc9574f843afdc0f4033b9be8050e88447
parent74d799926e557928352dcd980788cae6487e421c
[lld-macho] Implement `-no_implicit_dylibs`

Dylibs that are "public" -- i.e. top-level system libraries -- are considered
implicitly linked when another library re-exports them. That is, we should load
them & bind directly to their symbols instead of via their re-exporting
umbrella library. This diff implements that behavior by default, as well as an
opt-out flag.

In theory, this is just a performance optimization, but in practice it seems
that it's needed for correctness.

Fixes llvm.org/PR48395.

Reviewed By: thakis

Differential Revision: https://reviews.llvm.org/D93000
lld/MachO/Config.h
lld/MachO/Driver.cpp
lld/MachO/InputFiles.cpp
lld/MachO/Options.td
lld/test/MachO/implicit-dylibs.s [new file with mode: 0644]
lld/test/MachO/reexport-stub.s
lld/test/MachO/stub-link.s