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

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 35 additions & 16 deletions stdlib/public/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -149,23 +149,42 @@ elseif(BOOTSTRAPPING_MODE STREQUAL "OFF")
endif()

if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB)
set(EMBEDDED_STDLIB_TARGET_TRIPLES
# arch module_name target triple
"armv6 armv6-apple-none-macho armv6-apple-none-macho"
"armv6m armv6m-apple-none-macho armv6m-apple-none-macho"
"armv7 armv7-apple-none-macho armv7-apple-none-macho"
"armv7em armv7em-apple-none-macho armv7em-apple-none-macho"
"arm64 arm64-apple-none-macho arm64-apple-none-macho"

# the following are all ELF targets
"armv6 armv6-none-none-eabi armv6-none-none-eabi"
"armv6m armv6m-none-none-eabi armv6-none-none-eabi"
"armv7 armv7-none-none-eabi armv7-none-none-eabi"
"armv7em armv7em-none-none-eabi armv7em-none-none-eabi"
"aarch64 aarch64-none-none-elf aarch64-none-none-elf"
"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.

list(APPEND EMBEDDED_STDLIB_TARGET_TRIPLES
# arch module_name target triple
"armv6 armv6-apple-none-macho armv6-apple-none-macho"
"armv6m armv6m-apple-none-macho armv6m-apple-none-macho"
"armv7 armv7-apple-none-macho armv7-apple-none-macho"
"armv7em armv7em-apple-none-macho armv7em-apple-none-macho"
)
endif()
if("AArch64" IN_LIST LLVM_TARGETS_TO_BUILD)
list(APPEND EMBEDDED_STDLIB_TARGET_TRIPLES
"arm64 arm64-apple-none-macho arm64-apple-none-macho"
)
endif()

# the following are all ELF targets
if("ARM" IN_LIST LLVM_TARGETS_TO_BUILD)
list(APPEND EMBEDDED_STDLIB_TARGET_TRIPLES
"armv6 armv6-none-none-eabi armv6-none-none-eabi"
"armv6m armv6m-none-none-eabi armv6-none-none-eabi"
"armv7 armv7-none-none-eabi armv7-none-none-eabi"
"armv7em armv7em-none-none-eabi armv7em-none-none-eabi"
)
endif()
if("AArch64" IN_LIST LLVM_TARGETS_TO_BUILD)
list(APPEND EMBEDDED_STDLIB_TARGET_TRIPLES
"aarch64 aarch64-none-none-elf aarch64-none-none-elf"
)
endif()
if("RISCV" IN_LIST LLVM_TARGETS_TO_BUILD)
list(APPEND EMBEDDED_STDLIB_TARGET_TRIPLES
"riscv32 riscv32-none-none-eabi riscv32-none-none-eabi"
"riscv64 riscv64-none-none-eabi riscv64-none-none-eabi"
)
endif()

if (SWIFT_HOST_VARIANT STREQUAL "linux")
set(EMBEDDED_STDLIB_TARGET_TRIPLES ${EMBEDDED_STDLIB_TARGET_TRIPLES}
Expand Down