Skip to content

Commit

Permalink
[DO NOT MERGE] build: Delete source fortification logic
Browse files Browse the repository at this point in the history
  • Loading branch information
hebasto committed Sep 10, 2024
1 parent be4f782 commit a4b627a
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -481,24 +481,6 @@ if(ENABLE_HARDENING)
try_append_linker_flag("/NXCOMPAT" TARGET hardening_interface)
else()

# _FORTIFY_SOURCE requires that there is some level of optimization,
# otherwise it does nothing and just creates a compiler warning.
try_append_cxx_flags("-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3"
RESULT_VAR cxx_supports_fortify_source
SOURCE "int main() {
# if !defined __OPTIMIZE__ || __OPTIMIZE__ <= 0
#error
#endif
}"
)
if(cxx_supports_fortify_source)
target_compile_options(hardening_interface INTERFACE
-U_FORTIFY_SOURCE
-D_FORTIFY_SOURCE=3
)
endif()
unset(cxx_supports_fortify_source)

try_append_cxx_flags("-Wstack-protector" TARGET hardening_interface SKIP_LINK)
try_append_cxx_flags("-fstack-protector-all" TARGET hardening_interface)
try_append_cxx_flags("-fcf-protection=full" TARGET hardening_interface)
Expand Down

0 comments on commit a4b627a

Please sign in to comment.