[PATCH] D107799: [CMake] Enable LLVM_ENABLE_PER_TARGET_RUNTIME_DIR by default on Linux

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 10 13:11:28 PDT 2021


phosek added a comment.

In D107799#2937886 <https://reviews.llvm.org/D107799#2937886>, @MaskRay wrote:

> In D107799#2937768 <https://reviews.llvm.org/D107799#2937768>, @phosek wrote:
>
>> @MaskRay is there a reason why we're restricting this only to Linux? This layout is supported on all platforms except for Darwin which already has special handling so setting `LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON` everywhere is going to work.
>
> I'd love to enable it for other OSes as well.

Regarding the `LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE`, this is the Darwin exception I mentioned earlier. We never figured out what `LLVM_ENABLE_PER_TARGET_RUNTIME_DIR` should look like on Darwin hence the carve out.

Darwin uses fat libraries, so using target triples like we do on other platforms doesn't make sense since the same library can be used across multiple architectures. We could just keep the status quo for Darwin where all the runtime end up in `lib/clang/14.0.0/lib/darwin`.

Alternative would be to try and split the runtimes for different systems into different directories. Today, you'll end up with:

  lib/clang/14.0.0/lib/darwin/libclang_rt.profile_ios.a
  lib/clang/14.0.0/lib/darwin/libclang_rt.profile_iossim.a
  lib/clang/14.0.0/lib/darwin/libclang_rt.profile_osx.a
  ...

Instead we could do:

  lib/clang/14.0.0/lib/ios/libclang_rt.profile.a
  lib/clang/14.0.0/lib/iossim/libclang_rt.profile.a
  lib/clang/14.0.0/lib/osx/libclang_rt.profile.a
  ...

That would better match other platforms, but I'd like to hear from Apple folks like @beanz whether this is something that would make sense.

> However, some `*.cmake` files have `LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE`.
> And I do not know what the Windows case is. @mstorsjo

We use `LLVM_ENABLE_PER_TARGET_RUNTIME_DIR` on Windows (in MSVC) with our toolchain without any issues. That toolchain is also used by several projects like Fluter, Dart and Pigweed and they haven't reported any issues.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107799



More information about the llvm-commits mailing list