Follow up to #32038 which dropped NO_HARDEN
from depends builds, this PR drops the ENABLE_HARDENING
build option since disabling hardening of binaries should not be a supported or maintained use case. With this change, hardening flags are always enabled.
Individual hardening flags and options can still be disabled by appending flags, e.g.:
0cmake -B build \
1 -DAPPEND_CPPFLAGS='-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -fno-stack-protector -fcf-protection=none -fno-stack-clash-protection' \
2 -DAPPEND_LDFLAGS='-Wl,-z,lazy -Wl,-z,norelro -Wl,-z,noseparate-code'
There is an issue with NetBSD 10.0’s dynamic linker that makes one of the hardening linker flags, -z separate-code
, problematic, so this PR also introduces a check to prevent the use of this flag in NetBSD versions < 11.0, (where this issue is fixed). The fix for this might be backported to NetBSD 10.0.
I suggest reviewing the diff with whitespace changes hidden (git diff -w
or using github’s hide whitespace option)