From 2c35bca3f8128fb9fc015c311efb415d2111ab6b Mon Sep 17 00:00:00 2001 From: 3405691582 Date: Fri, 4 Apr 2025 18:13:01 -0400 Subject: [PATCH] Use -z,nobtcfi when BTCFI is disabled on OpenBSD. This was accidentally left off from #80389, and will properly ensure BTCFI enforcement is disabled on the platform when required. --- cmake/modules/AddSwift.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmake/modules/AddSwift.cmake b/cmake/modules/AddSwift.cmake index 9dc517f62b6..f219fde451b 100644 --- a/cmake/modules/AddSwift.cmake +++ b/cmake/modules/AddSwift.cmake @@ -965,6 +965,11 @@ function(add_swift_host_tool executable) endif() endif() + # Opt-out of OpenBSD BTCFI if instructed where it is enforced by default. + if(SWIFT_HOST_VARIANT_SDK STREQUAL "OPENBSD" AND SWIFT_HOST_VARIANT_ARCH STREQUAL "aarch64" AND NOT SWIFT_OPENBSD_BTCFI) + target_link_options(${executable} PRIVATE "LINKER:-z,nobtcfi") + endif() + if(SWIFT_BUILD_SWIFT_SYNTAX) set(extra_relative_rpath "") if(NOT "${ASHT_BOOTSTRAPPING}" STREQUAL "")