a49231
commit b73fb7a614e1b5d60af23fb0752b5cead995e02e
a49231
Author: Mark Wielaard <mark@klomp.org>
a49231
Date:   Sun Apr 14 00:30:05 2019 +0200
a49231
a49231
    Remove no-stack-protector, add stack-protector-strong to some.
a49231
a49231
diff --git a/auxprogs/Makefile.am b/auxprogs/Makefile.am
a49231
index 56cc5ef..1b7842b 100644
a49231
--- a/auxprogs/Makefile.am
a49231
+++ b/auxprogs/Makefile.am
a49231
@@ -30,7 +30,7 @@ bin_PROGRAMS = valgrind-listener valgrind-di-server
a49231
 
a49231
 valgrind_listener_SOURCES = valgrind-listener.c
a49231
 valgrind_listener_CPPFLAGS  = $(AM_CPPFLAGS_PRI) -I$(top_srcdir)/coregrind
a49231
-valgrind_listener_CFLAGS    = $(AM_CFLAGS_PRI)
a49231
+valgrind_listener_CFLAGS    = $(AM_CFLAGS_PRI) -fstack-protector-strong
a49231
 valgrind_listener_CCASFLAGS = $(AM_CCASFLAGS_PRI)
a49231
 valgrind_listener_LDFLAGS   = $(AM_CFLAGS_PRI)
a49231
 if VGCONF_PLATVARIANT_IS_ANDROID
a49231
@@ -49,7 +49,7 @@ endif
a49231
 
a49231
 valgrind_di_server_SOURCES   = valgrind-di-server.c
a49231
 valgrind_di_server_CPPFLAGS  = $(AM_CPPFLAGS_PRI) -I$(top_srcdir)/coregrind
a49231
-valgrind_di_server_CFLAGS    = $(AM_CFLAGS_PRI)
a49231
+valgrind_di_server_CFLAGS    = $(AM_CFLAGS_PRI) -fstack-protector-strong
a49231
 valgrind_di_server_CCASFLAGS = $(AM_CCASFLAGS_PRI)
a49231
 valgrind_di_server_LDFLAGS   = $(AM_CFLAGS_PRI)
a49231
 if VGCONF_PLATVARIANT_IS_ANDROID
a49231
@@ -84,7 +84,7 @@ endif
a49231
 
a49231
 getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES   = getoff.c
a49231
 getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CPPFLAGS  = $(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
a49231
-getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS    = $(AM_CFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
a49231
+getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS    = $(AM_CFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) -fstack-protector-strong
a49231
 getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CCASFLAGS = $(AM_CCASFLAGS_PRI)
a49231
 getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS   = $(AM_CFLAGS_PRI) @LIB_UBSAN@
a49231
 if HAVE_DLINFO_RTLD_DI_TLS_MODID
a49231
diff --git a/cachegrind/Makefile.am b/cachegrind/Makefile.am
a49231
index f8447a1..f572741 100644
a49231
--- a/cachegrind/Makefile.am
a49231
+++ b/cachegrind/Makefile.am
a49231
@@ -25,7 +25,7 @@ bin_PROGRAMS = cg_merge
a49231
 
a49231
 cg_merge_SOURCES = cg_merge.c
a49231
 cg_merge_CPPFLAGS  = $(AM_CPPFLAGS_PRI)
a49231
-cg_merge_CFLAGS    = $(AM_CFLAGS_PRI)
a49231
+cg_merge_CFLAGS    = $(AM_CFLAGS_PRI) -fstack-protector-strong
a49231
 cg_merge_CCASFLAGS = $(AM_CCASFLAGS_PRI)
a49231
 cg_merge_LDFLAGS   = $(AM_CFLAGS_PRI)
a49231
 # If there is no secondary platform, and the platforms include x86-darwin,
a49231
diff --git a/configure.ac b/configure.ac
a49231
index f8c798b..ccc8f52 100755
a49231
--- a/configure.ac
a49231
+++ b/configure.ac
a49231
@@ -2352,24 +2352,24 @@
a49231
 AM_CONDITIONAL([HAVE_ALIGNED_CXX_ALLOC], [test x$ac_have_aligned_cxx_alloc = xyes])
a49231
 
a49231
 # does this compiler support -fno-stack-protector ?
a49231
-AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
a49231
-
a49231
-safe_CFLAGS=$CFLAGS
a49231
-CFLAGS="-fno-stack-protector -Werror"
a49231
-
a49231
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
a49231
-  return 0;
a49231
-]])], [
a49231
-no_stack_protector=yes
a49231
-FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
a49231
-AC_MSG_RESULT([yes])
a49231
-], [
a49231
-no_stack_protector=no
a49231
+#AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
a49231
+#
a49231
+#safe_CFLAGS=$CFLAGS
a49231
+#CFLAGS="-fno-stack-protector -Werror"
a49231
+#
a49231
+#AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
a49231
+#  return 0;
a49231
+#]])], [
a49231
+#no_stack_protector=yes
a49231
+#FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
a49231
+#AC_MSG_RESULT([yes])
a49231
+#], [
a49231
+#no_stack_protector=no
a49231
 FLAG_FNO_STACK_PROTECTOR=""
a49231
-AC_MSG_RESULT([no])
a49231
-])
a49231
-CFLAGS=$safe_CFLAGS
a49231
-
a49231
+#AC_MSG_RESULT([no])
a49231
+#])
a49231
+#CFLAGS=$safe_CFLAGS
a49231
+#
a49231
 AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
a49231
 
a49231
 # does this compiler support -finline-functions ?
a49231
diff --git a/coregrind/Makefile.am b/coregrind/Makefile.am
a49231
index 94030fd..3c73210 100644
a49231
--- a/coregrind/Makefile.am
a49231
+++ b/coregrind/Makefile.am
a49231
@@ -55,7 +55,7 @@ AR = ${LTO_AR}
a49231
 RANLIB = ${LTO_RANLIB}
a49231
 
a49231
 valgrind_CPPFLAGS  = $(AM_CPPFLAGS_PRI)
a49231
-valgrind_CFLAGS    = $(AM_CFLAGS_PRI) $(LTO_CFLAGS)
a49231
+valgrind_CFLAGS    = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) -fstack-protector-strong
a49231
 valgrind_CCASFLAGS = $(AM_CCASFLAGS_PRI)
a49231
 valgrind_LDFLAGS   = $(AM_CFLAGS_PRI) @LIB_UBSAN@
a49231
 # If there is no secondary platform, and the platforms include x86-darwin,
a49231
@@ -94,7 +94,7 @@ vgdb_SOURCES += vgdb-invoker-solaris.c
a49231
 endif
a49231
 
a49231
 vgdb_CPPFLAGS  = $(AM_CPPFLAGS_PRI)
a49231
-vgdb_CFLAGS    = $(AM_CFLAGS_PRI) $(LTO_CFLAGS)
a49231
+vgdb_CFLAGS    = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) -fstack-protector-strong
a49231
 vgdb_CCASFLAGS = $(AM_CCASFLAGS_PRI)
a49231
 vgdb_LDFLAGS   = $(AM_CFLAGS_PRI) @LIB_UBSAN@
a49231
 if VGCONF_PLATVARIANT_IS_ANDROID