Skip to content

Commit

Permalink
build: cmake: sdl: check for endbr64
Browse files Browse the repository at this point in the history
  • Loading branch information
spalicki committed Dec 5, 2024
1 parent 262fb02 commit 19ef223
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmake/SDL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ macro(sdl_gnu_common_ccxx_flags var gnu_version)
else()
append(${var} "-fstack-protector-strong")
if(NOT (${gnu_version} VERSION_LESS 8.0) AND (DNNL_TARGET_ARCH STREQUAL "X64"))
append(${var} "-fcf-protection=full")
check_toolchain_for_endbr64()
if(ENDBR64_SUPPORT_FLAG)
append(${var} "-fcf-protection=full")
endif()
endif()
endif()
endmacro()
Expand Down
5 changes: 5 additions & 0 deletions cmake/utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,8 @@ function(find_libm var)
find_library(${var} m REQUIRED)
endif()
endfunction()

include(CheckCXXSourceCompiles)
function(check_toolchain_for_endbr64)
check_cxx_source_compiles("int main() { asm volatile(\"endbr64\"); return 0; }" ENDBR64_SUPPORT_FLAG)
endfunction()

0 comments on commit 19ef223

Please sign in to comment.