Skip to content

cmake: only use _FORTIFY_SOURCE with hardening #1456

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

Open
wants to merge 1 commit into
base: master
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
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
Loading