Skip to content

Commit 291822d

Browse files
authored
Merge pull request #77879 from 3405691582/arm64
Swift on OpenBSD supports arm64.
2 parents abcb0d6 + 301a0c4 commit 291822d

File tree

5 files changed

+11
-5
lines changed

5 files changed

+11
-5
lines changed

cmake/modules/SwiftConfigureSDK.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,14 +429,14 @@ macro(configure_sdk_unix name architectures)
429429

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

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

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

441441
if(CMAKE_SYSROOT)
442442
set(SWIFT_SDK_OPENBSD_ARCH_${arch}_PATH "${CMAKE_SYSROOT}${SWIFT_SDK_OPENBSD_ARCH_${arch}_PATH}" CACHE INTERNAL "sysroot path" FORCE)

stdlib/cmake/modules/AddSwiftStdlib.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,7 @@ function(_add_target_variant_link_flags)
529529
list(APPEND link_libraries "pthread")
530530
elseif("${LFLAGS_SDK}" STREQUAL "OPENBSD")
531531
list(APPEND link_libraries "pthread")
532+
list(APPEND result "-Wl,-Bsymbolic")
532533
elseif("${LFLAGS_SDK}" STREQUAL "CYGWIN")
533534
# No extra libraries required.
534535
elseif("${LFLAGS_SDK}" STREQUAL "WINDOWS")

stdlib/public/core/CTypes.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ public typealias CLongDouble = Double
108108
#elseif os(OpenBSD)
109109
#if arch(x86_64)
110110
public typealias CLongDouble = Float80
111+
#elseif arch(arm64)
112+
public typealias CLongDouble = Double
111113
#else
112114
#error("CLongDouble needs to be defined for this OpenBSD architecture")
113115
#endif

utils/build-script-impl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,8 @@ function verify_host_is_supported() {
459459
case ${host} in
460460
freebsd-arm64 \
461461
| freebsd-x86_64 \
462-
| openbsd-amd64 \
462+
| openbsd-x86_64 \
463+
| openbsd-aarch64 \
463464
| cygwin-x86_64 \
464465
| haiku-x86_64 \
465466
| linux-x86_64 \

utils/swift_build_support/swift_build_support/targets.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ class StdlibDeploymentTarget(object):
296296
'x86_64',
297297
'aarch64'])
298298

299-
OpenBSD = OpenBSDPlatform("openbsd", archs=["amd64"])
299+
OpenBSD = OpenBSDPlatform("openbsd", archs=["x86_64", "aarch64"])
300300

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

@@ -403,7 +403,9 @@ def host_target():
403403

404404
elif system == 'OpenBSD':
405405
if machine == 'amd64':
406-
return StdlibDeploymentTarget.OpenBSD.amd64
406+
return StdlibDeploymentTarget.OpenBSD.x86_64
407+
elif machine == 'arm64':
408+
return StdlibDeploymentTarget.OpenBSD.aarch64
407409

408410
elif system == 'CYGWIN_NT-10.0':
409411
if machine == 'x86_64':

0 commit comments

Comments
 (0)