FreeBSD: Set runtime module triple correctly

LLVM FreeBSD triples include the version number, which gets encoded into
the swiftmodule. The filename should not include the version number
though. This patch drops the version number from the filename, but not
from the target triple.

This fixes several tests which uses the computed target triple as the
flag to pass to `-target`. Since it was missing the version number, the
compiler assumed it defaulted to zero and would report
"compiling for freebsd 0, but module 'Dispatch' has a minimum deployment
target of freebsd 14.3"

Fixes: rdar://156163594
This commit is contained in:
Evan Wilde
2025-08-07 10:23:13 -07:00
parent 95dfa3d818
commit 8f3341e7be

View File

@@ -440,7 +440,8 @@ macro(configure_sdk_unix name architectures)
string(REGEX REPLACE "[-].*" "" freebsd_system_version ${CMAKE_SYSTEM_VERSION})
message(STATUS "FreeBSD Version: ${freebsd_system_version}")
set(SWIFT_SDK_FREEBSD_ARCH_${arch}_TRIPLE "${arch}-unknown-freebsd")
set(SWIFT_SDK_FREEBSD_ARCH_${arch}_TRIPLE "${arch}-unknown-freebsd${freebsd_system_version}}")
set(SWIFT_SDK_FREEBSD_ARCH_${arch}_MODULE "${arch}-unknown-freebsd")
elseif("${prefix}" STREQUAL "OPENBSD")
if(NOT arch STREQUAL "x86_64" AND NOT arch STREQUAL "aarch64")
message(FATAL_ERROR "unsupported arch for OpenBSD: ${arch}")