Implement --enable-gcc-hardening configure option

Using --enable-gcc-hardening enables some additional safety features
that gcc makes available such as stack smashing protection using
canaries and ASLR.

This commit is based on a patch for Tor:
(git commit 04fa935e02270bc90aca0f1c652d31c7a872175b by Jacob Appelbaum)
Copyright (c) 2007-2011, The Tor Project, Inc.
This commit is contained in:
Sebastian Hahn 2011-04-10 18:25:05 +02:00 committed by Nick Mathewson
parent d46517ee55
commit 755026771a

View File

@ -56,6 +56,13 @@ fi
AC_ARG_ENABLE(gcc-warnings,
AS_HELP_STRING(--disable-gcc-warnings, disable verbose warnings with GCC))
AC_ARG_ENABLE(gcc-hardening,
AS_HELP_STRING(--enable-gcc-hardening, enable compiler security checks),
[if test x$enableval = xyes; then
CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2 -fstack-protector-all"
CFLAGS="$CFLAGS -fwrapv -fPIE -Wstack-protector"
CFLAGS="$CFLAGS --param ssp-buffer-size=1"
fi])
AC_ARG_ENABLE(thread-support,
AS_HELP_STRING(--disable-thread-support, disable support for threading),