Skip to content

[embedded] Make embedded target triples conditional on LLVM support #70218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

drodriguez
Copy link
Contributor

LLVM might not be build with support for all architectures to save time. The changes in this commit check the value of LLVM_TARGETS_TO_BUILD provided by LLVMConfig.cmake to add or skip the different embedded targets if LLVM happens to not build with support for that target.

While x86_64 and ARM/AArch64 are very common in LLVM_TARGETS_TO_BUILD, targets like RISCV are more specialized and might not be always enabled.

This is not a problem for builds using the build-script because of the changes introduced in #70057, but it is still a problem for other builds that do not use build-script. This solution should work for any build.

LLVM might not be build with support for all architectures to save time.
The changes in this commit check the value of LLVM_TARGETS_TO_BUILD
provided by LLVMConfig.cmake to add or skip the different embedded
targets if LLVM happens to not build with support for that target.

While x86_64 and ARM/AArch64 are very common in `LLVM_TARGETS_TO_BUILD`,
targets like RISCV are more specialized and might not be always enabled.

This is not a problem for builds using the `build-script` because of the
changes introduced in swiftlang#70057, but it is still a problem for other builds
that do not use `build-script`. This solution should work for any build.
@drodriguez drodriguez requested a review from kubamracek December 5, 2023 00:03
@drodriguez drodriguez requested a review from a team as a code owner December 5, 2023 00:03
"riscv32 riscv32-none-none-eabi riscv32-none-none-eabi"
"riscv64 riscv64-none-none-eabi riscv64-none-none-eabi"
set(EMBEDDED_STDLIB_TARGET_TRIPLES)
if("ARM" IN_LIST LLVM_TARGETS_TO_BUILD)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this catch when we specify --llvm-targets-to-build all?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should. all is already the default, and it is transformed in https://github.com/apple/llvm-project/blob/94624bdf65b8ad61f9bf3948a5bf387c6fa0a967/llvm/CMakeLists.txt#L569-L571 to expand to the actual list. One never has to check for "all" explicitly.

@drodriguez
Copy link
Contributor Author

@swift-ci please test

@drodriguez drodriguez enabled auto-merge (squash) December 5, 2023 16:46
@drodriguez drodriguez merged commit f0594a4 into swiftlang:main Dec 5, 2023
@drodriguez drodriguez deleted the embedded-targets-depend-on-llvm-targets branch December 5, 2023 21:01
Catfish-Man pushed a commit to Catfish-Man/swift that referenced this pull request Jan 19, 2024
…wiftlang#70218)

LLVM might not be build with support for all architectures to save time.
The changes in this commit check the value of LLVM_TARGETS_TO_BUILD
provided by LLVMConfig.cmake to add or skip the different embedded
targets if LLVM happens to not build with support for that target.

While x86_64 and ARM/AArch64 are very common in `LLVM_TARGETS_TO_BUILD`,
targets like RISCV are more specialized and might not be always enabled.

This is not a problem for builds using the `build-script` because of the
changes introduced in swiftlang#70057, but it is still a problem for other builds
that do not use `build-script`. This solution should work for any build.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants