Skip to content

Swift on OpenBSD supports arm64. #77879

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
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions cmake/modules/SwiftConfigureSDK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -429,14 +429,14 @@ macro(configure_sdk_unix name architectures)

set(SWIFT_SDK_FREEBSD_ARCH_${arch}_TRIPLE "${arch}-unknown-freebsd${freebsd_system_version}")
elseif("${prefix}" STREQUAL "OPENBSD")
if(NOT arch STREQUAL "amd64")
if(NOT arch STREQUAL "x86_64" AND NOT arch STREQUAL "aarch64")
message(FATAL_ERROR "unsupported arch for OpenBSD: ${arch}")
endif()

set(openbsd_system_version ${CMAKE_SYSTEM_VERSION})
message(STATUS "OpenBSD Version: ${openbsd_system_version}")

set(SWIFT_SDK_OPENBSD_ARCH_amd64_TRIPLE "amd64-unknown-openbsd${openbsd_system_version}")
set(SWIFT_SDK_OPENBSD_ARCH_${arch}_TRIPLE "${arch}-unknown-openbsd${openbsd_system_version}")

if(CMAKE_SYSROOT)
set(SWIFT_SDK_OPENBSD_ARCH_${arch}_PATH "${CMAKE_SYSROOT}${SWIFT_SDK_OPENBSD_ARCH_${arch}_PATH}" CACHE INTERNAL "sysroot path" FORCE)
Expand Down
1 change: 1 addition & 0 deletions stdlib/cmake/modules/AddSwiftStdlib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@ function(_add_target_variant_link_flags)
list(APPEND link_libraries "pthread")
elseif("${LFLAGS_SDK}" STREQUAL "OPENBSD")
list(APPEND link_libraries "pthread")
list(APPEND result "-Wl,-Bsymbolic")
elseif("${LFLAGS_SDK}" STREQUAL "CYGWIN")
# No extra libraries required.
elseif("${LFLAGS_SDK}" STREQUAL "WINDOWS")
Expand Down
2 changes: 2 additions & 0 deletions stdlib/public/core/CTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ public typealias CLongDouble = Double
#elseif os(OpenBSD)
#if arch(x86_64)
public typealias CLongDouble = Float80
#elseif arch(arm64)
public typealias CLongDouble = Double
#else
#error("CLongDouble needs to be defined for this OpenBSD architecture")
#endif
Expand Down
3 changes: 2 additions & 1 deletion utils/build-script-impl
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,8 @@ function verify_host_is_supported() {
case ${host} in
freebsd-arm64 \
| freebsd-x86_64 \
| openbsd-amd64 \
| openbsd-x86_64 \
| openbsd-aarch64 \
| cygwin-x86_64 \
| haiku-x86_64 \
| linux-x86_64 \
Expand Down
6 changes: 4 additions & 2 deletions utils/swift_build_support/swift_build_support/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ class StdlibDeploymentTarget(object):
'x86_64',
'aarch64'])

OpenBSD = OpenBSDPlatform("openbsd", archs=["amd64"])
OpenBSD = OpenBSDPlatform("openbsd", archs=["x86_64", "aarch64"])

Cygwin = Platform("cygwin", archs=["x86_64"])

Expand Down Expand Up @@ -403,7 +403,9 @@ def host_target():

elif system == 'OpenBSD':
if machine == 'amd64':
return StdlibDeploymentTarget.OpenBSD.amd64
return StdlibDeploymentTarget.OpenBSD.x86_64
elif machine == 'arm64':
return StdlibDeploymentTarget.OpenBSD.aarch64

elif system == 'CYGWIN_NT-10.0':
if machine == 'x86_64':
Expand Down