Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if compiler supports -fstack-clash-protection #2205

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions cmake/helpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ macro(add_sanitizer_flag flag)
endmacro()

check_cxx_compiler_flag("-fcf-protection=full" CXX_HAS_FCF_PROTECTION_FULL)
check_cxx_compiler_flag("-fstack-clash-protection" CXX_HAS_FSTACK_CLASH_PROTECTION)

function(add_ur_target_compile_options name)
if(NOT MSVC)
Expand All @@ -81,9 +82,7 @@ function(add_ur_target_compile_options name)
# -flto
# $<$<CXX_COMPILER_ID:Clang,AppleClang>:-fsanitize=cfi>
$<$<BOOL:${CXX_HAS_FCF_PROTECTION_FULL}>:-fcf-protection=full>
# -fstack-clash-protection is not supported in apple clang or GCC < 8
$<$<AND:$<CXX_COMPILER_ID:GNU>,$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,8>>:-fstack-clash-protection>
$<$<CXX_COMPILER_ID:Clang>:-fstack-clash-protection>
$<$<BOOL:${CXX_HAS_FSTACK_CLASH_PROTECTION}>:-fstack-clash-protection>

# Colored output
$<$<CXX_COMPILER_ID:GNU>:-fdiagnostics-color=always>
Expand Down
Loading