This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] configure option to override TARGET_LIBC_PROVIDES_SSP


On 10/09/2017 09:13 AM, Joseph Myers wrote:
The install.texi documentation for --disable-libssp only says "Specify
that the run-time libraries for stack smashing protection should not be
built.".  I think it needs updating to mention these additional effects as
well.

Oops.  :")  How about this version?

-Sandra


2017-10-09  Sandra Loosemore  <sandra@codesourcery.com>

	gcc/
	* configure.ac (--enable-libssp): New.
	(gcc_cv_libc_provides_ssp): Check for explicit setting before
	trying to determine target-specific default.  Adjust indentation.
	* configure: Regenerated.
	* doc/install.texi (Configuration): Expand --disable-libssp
	documentation.
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 253502)
+++ gcc/configure.ac	(working copy)
@@ -5751,10 +5751,25 @@ if test x$gcc_cv_solaris_crts = xyes; th
   	    [Define if the system-provided CRTs are present on Solaris.])
 fi
 
+AC_ARG_ENABLE(libssp,
+[AS_HELP_STRING([--enable-libssp], [enable linking against libssp])],
+[case "${enableval}" in
+  yes|no)
+    ;;
+  *)
+    AC_MSG_ERROR(unknown libssp setting $enableval)
+    ;;
+esac], [])
+
 # Test for stack protector support in target C library.
 AC_CACHE_CHECK(__stack_chk_fail in target C library,
-      gcc_cv_libc_provides_ssp,
-      [gcc_cv_libc_provides_ssp=no
+  gcc_cv_libc_provides_ssp,
+  [gcc_cv_libc_provides_ssp=no
+  if test "x$enable_libssp" = "xno"; then
+    gcc_cv_libc_provides_ssp=yes
+  elif test "x$enable_libssp" = "xyes"; then
+    gcc_cv_libc_provides_ssp=no
+  else
     case "$target" in
        *-*-musl*)
 	 # All versions of musl provide stack protector
@@ -5791,8 +5806,9 @@ AC_CACHE_CHECK(__stack_chk_fail in targe
 	 AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
            [echo "no __stack_chk_fail on this target"])
         ;;
-  *) gcc_cv_libc_provides_ssp=no ;;
-    esac])
+       *) gcc_cv_libc_provides_ssp=no ;;
+    esac
+  fi])
 
 if test x$gcc_cv_libc_provides_ssp = xyes; then
   AC_DEFINE(TARGET_LIBC_PROVIDES_SSP, 1,
Index: gcc/doc/install.texi
===================================================================
--- gcc/doc/install.texi	(revision 253502)
+++ gcc/doc/install.texi	(working copy)
@@ -1665,7 +1665,8 @@ not be built.
 
 @item --disable-libssp
 Specify that the run-time libraries for stack smashing protection
-should not be built.
+should not be built or linked against.  On many targets library support
+is provided by the C library instead.
 
 @item --disable-libquadmath
 Specify that the GCC quad-precision math library should not be built.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]