Supply -z,nobtcfi on x86_64 as well.

On older x86_64 hardware, this isn't a problem since CET IBT hardware
support may not have been available. However, newer x86_64 hardware
supports the feature, which will lead to BTCFI failures. Therefore ensure
the same BTCFI disabling logic applies on x86_64 as well as aarch64.
This commit is contained in:
3405691582
2025-10-20 21:19:08 -04:00
parent f095990bf8
commit 0158137afc
2 changed files with 5 additions and 2 deletions

View File

@@ -995,7 +995,7 @@ function(add_swift_host_tool executable)
endif() endif()
# Opt-out of OpenBSD BTCFI if instructed where it is enforced by default. # 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) if(SWIFT_HOST_VARIANT_SDK STREQUAL "OPENBSD" AND SWIFT_HOST_VARIANT_ARCH MATCHES "aarch64|x86_64" AND NOT SWIFT_OPENBSD_BTCFI)
target_link_options(${executable} PRIVATE "LINKER:-z,nobtcfi") target_link_options(${executable} PRIVATE "LINKER:-z,nobtcfi")
endif() endif()

View File

@@ -150,7 +150,10 @@ bool swift::tripleRequiresRPathForSwiftLibrariesInOS(
} }
bool swift::tripleBTCFIByDefaultInOpenBSD(const llvm::Triple &triple) { bool swift::tripleBTCFIByDefaultInOpenBSD(const llvm::Triple &triple) {
return triple.isOSOpenBSD() && triple.getArch() == llvm::Triple::aarch64; return triple.isOSOpenBSD() && (
triple.getArch() == llvm::Triple::aarch64 ||
triple.getArch() == llvm::Triple::x86_64);
} }
DarwinPlatformKind swift::getDarwinPlatformKind(const llvm::Triple &triple) { DarwinPlatformKind swift::getDarwinPlatformKind(const llvm::Triple &triple) {