[PATCH] D117263: [CMake] Support runtimes targets without specifying triple

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 13 18:39:50 PST 2022


phosek added a comment.

In D117263#3242414 <https://reviews.llvm.org/D117263#3242414>, @smeenai wrote:

> I don't understand the motivation for this change.
>
> The Darwin compiler-rt support works by overriding the `OSX_ARCHITECTURES` target property (which makes CMake pass `-arch` flags), and emptying `CMAKE_OSX_DEPLOYMENT_TARGET` and passing its own `-m*-version-min` flags. The Clang driver seems to have some special support where if your triple is `x86_64-apple-darwin` (I assume other architectures would work too, but I haven't checked), it'll override the architecture and the deployment target based on the `-arch` and `-m*-version-min` flags, which means the `-target` is effectively a no-op in this case (besides enabling the overwriting based on those other flags). The result is that you can add `x86_64-apple-darwin` to your `LLVM_BUILTIN_TARGETS` and `LLVM_RUNTIME_TARGETS`, and then control the actual platforms and architectures via the appropriate CMake variables for that target (`COMPILER_RT_ENABLE_<PLATFORM>`, `DARWIN_<PLATFORM>_BUILTIN_ARCHS`, etc.), which is what I set up in D86313 <https://reviews.llvm.org/D86313>, and what we use internally. Does that not work for your use case?

I'm mostly concerned about the potential confusion. Specifically, I'd like to start building libunwind, libc++abi, libc++ as a universal library for arm64 and x86_64 in our toolchain and I'd like to use `CMAKE_OSX_ARCHITECTURES` for that purpose. I could do what you've suggested, it's just that seeing something like:

  RUNTIMES_x86_64-apple-darwin_CMAKE_OSX_ARCHITECTURES=arm64;x64

is in my opinion more confusing then something like:

  RUNTIMES_darwin_CMAKE_OSX_ARCHITECTURES=arm64;x64

which is what I'm trying to achieve. I'm interested in your experience and thoughts on this, especially if there are other alternatives you think I should consider.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117263



More information about the llvm-commits mailing list