[PATCH] D97641: [lld/mac] Add support for -flat_namespace

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 1 12:07:26 PST 2021


thakis added a comment.

Hm, still fails with

  lld: error: unable to locate library '/usr/lib/libSystem.B.dylib' loaded from '/mnt/disks/ssd0/agent/llvm-project/build/tools/lld/test/MachO/Output/flat-namespace.s.tmp/baz.dylib' for -flat_namespace

I think that's because `lld/test/MachO/Inputs/MacOSX.sdk/usr/lib/libSystem.tbd` contains `/usr/lib/libSystem.B.dylib` (note `.B`) but we don't have a `lld/test/MachO/Inputs/MacOSX.sdk/usr/lib/libSystem.B.tbd`. In Real Life, `libSystem.dylib` links to `libSystem.B.dylib`. Symlinks are tricky because Windows. Options:

1. Make a copy of `lld/test/MachO/Inputs/MacOSX.sdk/usr/lib/libSystem.tbd` at `lld/test/MachO/Inputs/MacOSX.sdk/usr/lib/libSystem.B.tbd` and check it in. Somewhat ugly because two copies of that file checked in, but the file basically never changes.
2. In the test, make a temp dummy dir, copy `lld/test/MachO/Inputs/MacOSX.sdk/usr/lib/libSystem.tbd` to both `%t/mysysroot/libSystem.tbd` and `%t/mysysroot/libSystem.B.tbd`, and use that as `-libsysroot`. Somewhat ugly because the test doesn't "know" about libsysroot since that comes in via `%lld`.

Opinions? I weakly lean towards 1.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97641/new/

https://reviews.llvm.org/D97641



More information about the llvm-commits mailing list