Skip to content

Commit

Permalink
Always build with -fhardened if the compiler supports it
Browse files Browse the repository at this point in the history
This enables all manner of highly useful safety checks that we generally
want enabled.
  • Loading branch information
pmatilai committed Nov 14, 2024
1 parent 6ba8b6b commit e4b2c63
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,8 @@ if (ENABLE_ASAN OR ENABLE_UBSAN)
add_compile_options(-fno-omit-frame-pointer)
endif()

# try to ensure some compiler sanity
foreach (flag -fno-strict-overflow -fno-delete-null-pointer-checks)
# try to ensure some compiler sanity and hardening options where supported
foreach (flag -fno-strict-overflow -fno-delete-null-pointer-checks -fhardened)
check_c_compiler_flag(${flag} found)
if (found)
add_compile_options(${flag})
Expand Down

0 comments on commit e4b2c63

Please sign in to comment.