[all-commits] [llvm/llvm-project] bdd374: [runtimes] Add a mechanism to use cache files for ...

Shoaib Meenai via All-commits all-commits at lists.llvm.org
Mon Sep 18 12:19:57 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bdd3748ac833180a41e42f5db6397834ebfda9f3
      https://github.com/llvm/llvm-project/commit/bdd3748ac833180a41e42f5db6397834ebfda9f3
  Author: Shoaib Meenai <smeenai at fb.com>
  Date:   2023-09-18 (Mon, 18 Sep 2023)

  Changed paths:
    M llvm/runtimes/CMakeLists.txt

  Log Message:
  -----------
  [runtimes] Add a mechanism to use cache files for a runtimes build

Projects like libc++ include their own cache files, and it's convenient
to just be able to reuse those cache files as part of a runtimes build
instead of having to duplicate the settings inside a special runtimes
cache file (which will inevitably get out of sync).

I'm not completely happy about overloading the existing argument passing
behavior based on the argument name, but I also couldn't think of a good
alternative. Suggestions are welcome.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D158791


  Commit: b1e3cd1d79443603dc003441e07cdd8d30bb7f26
      https://github.com/llvm/llvm-project/commit/b1e3cd1d79443603dc003441e07cdd8d30bb7f26
  Author: Shoaib Meenai <smeenai at fb.com>
  Date:   2023-09-18 (Mon, 18 Sep 2023)

  Changed paths:
    M clang/lib/Driver/ToolChains/Gnu.cpp
    A clang/test/Driver/android-installed-libcxx.cpp
    M clang/test/Driver/android-ndk-standalone.cpp
    R clang/test/Driver/android-no-installed-libcxx.cpp
    M clang/test/Driver/linux-header-search.cpp
    M clang/test/Driver/linux-musl-header-search.cpp
    M clang/test/Driver/linux-per-target-runtime-dir.c

  Log Message:
  -----------
  [driver] Conditionally include installed libc++ headers for Android

https://reviews.llvm.org/D71154 prevented Clang from search for libc++
headers installed alongside the driver when targeting Android. The
motivation was the NDK's use of a different libc++ inline namespace
(`__ndk1` instead of the standard `__1`), which made regular libc++
headers incompatible with the NDK's libc++ library.

Since then, libc++ has gained the ability to install its `__config_site`
header (which controls the inline namespace, among other things) to a
per-target include directory, which enables per-target customizations.
If this directory is present, the user has expressly built libc++ for
Android, and we should use those headers.

The motivation is that, with the current setup, if a user builds their
own libc++ for Android, they'll use the library they built themselves
but the NDK's headers instead of their own, which is surprising at best
and can cause all sorts of problems (e.g. if you built your own libc++
with a different ABI configuration). It's important to match the headers
and libraries in that scenario, and checking for an Android per-target
include directory lets us do so without regressing the original scenario
which https://reviews.llvm.org/D71154 was addressing.

While I'm here, switch to using sys::path::append instead of slashes
directly, to get system path separators on Windows, which is consistent
with how library paths are constructed (and that consistency will be
important in a follow-up, where we use a common search function for the
include and library path construction).

(As an aside, one of the motivations for https://reviews.llvm.org/D71154
was to support targeting both Android and Apple platforms, which
expected libc++ headers to be provided by the toolcain at the time.
Apple has since switched to including libc++ headers in the platform SDK
instead of in the toolchain, so that specific motivation no longer
applies either.)

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D159292


  Commit: 1212d1b511251de69939c8aa380f660373e26419
      https://github.com/llvm/llvm-project/commit/1212d1b511251de69939c8aa380f660373e26419
  Author: Shoaib Meenai <smeenai at fb.com>
  Date:   2023-09-18 (Mon, 18 Sep 2023)

  Changed paths:
    M clang/include/clang/Driver/ToolChain.h
    M clang/lib/Driver/ToolChain.cpp
    M clang/lib/Driver/ToolChains/Fuchsia.cpp
    M clang/lib/Driver/ToolChains/Gnu.cpp
    M clang/lib/Driver/ToolChains/VEToolchain.cpp
    A clang/test/Driver/Inputs/basic_android_libcxx_tree/usr/bin/.keep
    A clang/test/Driver/Inputs/basic_android_libcxx_tree/usr/lib/aarch64-unknown-linux-android/libc++.so
    A clang/test/Driver/Inputs/basic_android_libcxx_tree/usr/lib/aarch64-unknown-linux-android21/libc++.so
    M clang/test/Driver/android-installed-libcxx.cpp
    M clang/test/Driver/linux-per-target-runtime-dir.c

  Log Message:
  -----------
  [driver] Perform fallback target searches for stdlib

Searching for target-specific standard library header and library paths
should perform fallback searches for targets, the same way searching for
the runtime libraries does. It's important for the header and library
searches to be consistent, otherwise we could end up using mismatched
headers and libraries. (See also https://reviews.llvm.org/D146664.)

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D159293


Compare: https://github.com/llvm/llvm-project/compare/448ad65d3d5b...1212d1b51125


More information about the All-commits mailing list