diff options
-rw-r--r-- | config_host.mk.in | 1 | ||||
-rw-r--r-- | configure.ac | 12 | ||||
-rw-r--r-- | solenv/gbuild/platform/com_GCC_defs.mk | 5 |
3 files changed, 18 insertions, 0 deletions
diff --git a/config_host.mk.in b/config_host.mk.in index 648705a4a8c8..13639e86a878 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -240,6 +240,7 @@ export GUIBASE=@GUIBASE@ export HAMCREST_JAR=@HAMCREST_JAR@ export HARDLINKDELIVER=@HARDLINKDELIVER@ export HAVE_GCC_AVX=@HAVE_GCC_AVX@ +export HAVE_GCC_STACK_PROTECTOR_STRONG=@HAVE_GCC_STACK_PROTECTOR_STRONG@ export HAVE_GCC_BUILTIN_ATOMIC=@HAVE_GCC_BUILTIN_ATOMIC@ export HAVE_GCC_FINLINE_LIMIT=@HAVE_GCC_FINLINE_LIMIT@ export HAVE_GCC_FNO_DEFAULT_INLINE=@HAVE_GCC_FNO_DEFAULT_INLINE@ diff --git a/configure.ac b/configure.ac index ae82b5647d17..3be712e961b1 100644 --- a/configure.ac +++ b/configure.ac @@ -5751,6 +5751,17 @@ if test "$GCC" = "yes"; then AC_MSG_RESULT([no]) fi + AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong]) + save_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -Werror -fstack-protector-strong" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[]) + CFLAGS=$save_CFLAGS + if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + AC_MSG_CHECKING([whether $CC supports atomic functions]) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ int v = 0; @@ -5844,6 +5855,7 @@ if test "$GCC" = "yes"; then fi AC_SUBST(HAVE_GCC_AVX) +AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG) AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC) dnl =================================================================== diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk index b6d973536113..7acd06808471 100644 --- a/solenv/gbuild/platform/com_GCC_defs.mk +++ b/solenv/gbuild/platform/com_GCC_defs.mk @@ -96,6 +96,11 @@ gb_CXXFLAGS_COMMON += -fvisibility-inlines-hidden endif endif +ifeq ($(HAVE_GCC_STACK_PROTECTOR_STRONG),TRUE) +gb_CFLAGS_COMMON += -fstack-protector-strong +gb_CXXFLAGS_COMMON += -fstack-protector-strong +endif + gb_CFLAGS_WERROR := $(if $(ENABLE_WERROR),-Werror) # This is the default in non-C++11 mode |