Skip to content
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

[🍒6.2]: [compiler-rt] Fix detecting _Float16 support for secondary targets #10446

Open
wants to merge 2 commits into
base: swift/release/6.2
Choose a base branch
from

Conversation

etcwilde
Copy link

@etcwilde etcwilde commented Apr 7, 2025

Cherry-picked from: #10366
Which is a cherry-pick of: llvm#117813 and llvm#133952

This fixes the float16 detection when building compiler-rt, which is required for building on FreeBSD.

rdar://148052531

arichardson and others added 2 commits April 7, 2025 13:47
…lvm#117813)

It turns out we were not passing -m32 to the check_c_source_compiles()
invocation since CMAKE_REQUIRE_FLAGS needs to be string separated list
and
we were passing a ;-separated CMake list which appears to be parsed by
CMake as 'ignore all arguments beyond the first'.
Fix this by transforming the list to a command line first.

With this change, Clang 17 no longer claims to support _Float16 for
i386.

(cherry picked from commit a4c8ef0)
(cherry picked from commit 8b57579)
)

The try-compile mechanism requires that `CMAKE_REQUIRED_FLAGS` is a
space-separated string instead of a list of flags. The original code
expanded `BUILTIN_FLAGS` into `CMAKE_REQUIRED_FLAGS` as a
space-separated string and then would overwrite `CMAKE_REQUIRED_FLAGS`
with `TARGET_${arch}_CFLAGS` prepended to the unexpanded
`BUILTIN_CFLAGS_${arch}`. This resulted in the first two arguments being
passed into the try-compile invocation, but dropping the other arguments
listed in `BUILTIN_CFLAGS_${arch}`.

This patch appends `TARGET_${arch}_CFLAGS` and `BUILTIN_CFLAGS_${arch}` to
`CMAKE_REQUIRED_FLAGS` before expanding CMAKE_REQUIRED_FLAGS as a
space-separated string. This passes any pre-set required flags, in addition to
all of the builtin and target flags to the Float16 detection.

(cherry picked from commit 0d3f5ec)
(cherry picked from commit e958952)
@etcwilde etcwilde requested a review from a team as a code owner April 7, 2025 20:52
@etcwilde
Copy link
Author

etcwilde commented Apr 7, 2025

@swift-ci please test

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