From 001b1cf010453adbb1316a6fa8911398953afe61 Mon Sep 17 00:00:00 2001 From: fanquake Date: Wed, 20 Mar 2024 14:39:41 +0000 Subject: [PATCH] build: use standard branch-protection for aarch64-linux --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 555e5b99b76..b8fdeefbdae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -506,7 +506,11 @@ if(ENABLE_HARDENING) endif() if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64") - try_append_cxx_flags("-mbranch-protection=bti" TARGET hardening_interface SKIP_LINK) + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + try_append_cxx_flags("-mbranch-protection=bti" TARGET hardening_interface SKIP_LINK) + else() + try_append_cxx_flags("-mbranch-protection=standard" TARGET hardening_interface SKIP_LINK) + endif() endif() try_append_linker_flag("-Wl,--enable-reloc-section" TARGET hardening_interface)