Skip to content

Commit 802909f

Browse files
authored
Merge pull request #80836 from 3405691582/nobtcfi_part2_62
[6.2][cherrypick] Use -z,nobtcfi when BTCFI is disabled on OpenBSD.
2 parents d7b44f4 + fdf70a2 commit 802909f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -965,6 +965,11 @@ function(add_swift_host_tool executable)
965965
endif()
966966
endif()
967967

968+
# Opt-out of OpenBSD BTCFI if instructed where it is enforced by default.
969+
if(SWIFT_HOST_VARIANT_SDK STREQUAL "OPENBSD" AND SWIFT_HOST_VARIANT_ARCH STREQUAL "aarch64" AND NOT SWIFT_OPENBSD_BTCFI)
970+
target_link_options(${executable} PRIVATE "LINKER:-z,nobtcfi")
971+
endif()
972+
968973
if(SWIFT_BUILD_SWIFT_SYNTAX)
969974
set(extra_relative_rpath "")
970975
if(NOT "${ASHT_BOOTSTRAPPING}" STREQUAL "")

0 commit comments

Comments
 (0)