[PATCH] D148266: [clang][driver] Linking to just-built libc++.dylib when bootstrapping libc++ with clang

Louis Dionne via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 14 10:45:54 PDT 2023


ldionne requested changes to this revision.
ldionne added a comment.
This revision now requires changes to proceed.

Thanks for working on this! This generally LGTM, with a few comments. You should be able to add tests in a way similar to `clang/test/Driver/darwin-header-search-libcxx.cpp`. The idea is basically to create a dummy sysroot that contains a `libc++.dylib` file in the right location and trick the compiler into adding `-L` as you want.



================
Comment at: clang/lib/Driver/ToolChains/Darwin.cpp:416
+
+  llvm::SmallString<128> LibCXXDylibDirPath =
+      llvm::StringRef(D.getInstalledDir()); // <install>/bin
----------------



================
Comment at: clang/lib/Driver/ToolChains/Darwin.cpp:421
+  llvm::SmallString<128> LibCXXDylibPath = LibCXXDylibDirPath;
+  llvm::sys::path::append(LibCXXDylibPath, "..", "lib", "libc++.dylib");
+
----------------
Otherwise you are forming the path `<install>/bin/../lib/../lib/libc++.dylib`, which is correct but weird.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148266



More information about the cfe-commits mailing list