Permalink
Browse files

Test both compiler and linker with -fstack-protector-all

Some platforms support compiling with this flag, but lack the runtime support
library.  By contrast, clang won't error on the linker check even when the flag
is totally unsupported.  So we need both checks.
  • Loading branch information...
kmcallister committed May 4, 2012
1 parent 8a95fe0 commit 330e67694031adb5d4da2c4dbef5e6774b4e9d66
Showing with 6 additions and 5 deletions.
  1. +6 −5 configure.ac
View
@@ -46,11 +46,12 @@ AS_IF([test x"$hardening" != x"no"], [
check_cc_cxx_flag([-D_FORTIFY_SOURCE=2], [HARDEN_CFLAGS="$HARDEN_CFLAGS -D_FORTIFY_SOURCE=2"])
check_cc_cxx_flag([-fstack-protector-all],
- [HARDEN_CFLAGS="$HARDEN_CFLAGS -fstack-protector-all"
- check_cc_cxx_flag([-Wstack-protector], [HARDEN_CFLAGS="$HARDEN_CFLAGS -Wstack-protector"],
- [], [-fstack-protector-all])
- check_cc_cxx_flag([--param ssp-buffer-size=1], [HARDEN_CFLAGS="$HARDEN_CFLAGS --param ssp-buffer-size=1"],
- [], [-fstack-protector-all])])
+ [check_link_flag([-fstack-protector-all],
+ [HARDEN_CFLAGS="$HARDEN_CFLAGS -fstack-protector-all"
+ check_cc_cxx_flag([-Wstack-protector], [HARDEN_CFLAGS="$HARDEN_CFLAGS -Wstack-protector"],
+ [], [-fstack-protector-all])
+ check_cc_cxx_flag([--param ssp-buffer-size=1], [HARDEN_CFLAGS="$HARDEN_CFLAGS --param ssp-buffer-size=1"],
+ [], [-fstack-protector-all])])])
check_cc_cxx_flag([-fPIE],
[check_link_flag([-fPIE -pie],

0 comments on commit 330e676

Please sign in to comment.