Skip to content

Commit

Permalink
cmake: only use _FORTIFY_SOURCE with hardening
Browse files Browse the repository at this point in the history
  • Loading branch information
illwieckz committed Dec 4, 2024
1 parent 79598bf commit aa32c01
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions cmake/DaemonFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -315,17 +315,15 @@ else()
endif()

# Hardening.
if (USE_HARDENING OR NOT MINGW)
if (USE_HARDENING)
# MinGW with _FORTIFY_SOURCE and without -fstack-protector
# causes unsatisfied dependency on libssp.
# https://github.com/msys2/MINGW-packages/issues/5868
set_c_cxx_flag("-D_FORTIFY_SOURCE=2" RELEASE)
set_c_cxx_flag("-D_FORTIFY_SOURCE=2" RELWITHDEBINFO)
set_c_cxx_flag("-D_FORTIFY_SOURCE=2" MINSIZEREL)
# Don't set _FORTIFY_SOURCE in debug builds.
endif()

if (USE_HARDENING)
# PNaCl accepts the flags but does not define __stack_chk_guard and __stack_chk_fail.
if (NOT NACL)
try_c_cxx_flag(FSTACK_PROTECTOR_STRONG "-fstack-protector-strong")
Expand Down

0 comments on commit aa32c01

Please sign in to comment.