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]

[PATCH] libssp + using glibc stack protector support if available


Hi!

Here is a new version of the patch.  libssp now includes both the
stack protector support and _FORTIFY_SOURCE support (the latter
tested with a modified version of glibc's tst-chk1.c and using
a modified __chk_fail, so that I could intercept it and test).

I have not included the libssp.spec including, because
it is extra work and we risk that the gcc/configure test
gets out of sync with the potential libssp/configure test.
But, if GCC decides to use TLS canary for -fstack-protector,
then it ought to avoid -lssp_nonshared -lssp, while if
it decides not to use them, then it should force -lssp_nonshared -lssp
(as glibc doesn't provide __stack_chk_guard on the architectures
that provide TLS canary).

Tested with both older and latest CVS glibc on ppc64-linux, ok to commit if
it works also on i386-linux and x86_64-linux?

Just FYI, I have discovered a bug with -fstack-protector on ppc32 with
stdarg function, wrote already a patch but still need to debug some
things in it.

2005-07-01  Jakub Jelinek  <jakub@redhat.com>

	* Makefile.def (target_modules): Add libssp.
	* configure.in (target_libraries): Add target-libssp.
	* configure: Rebuilt.
	* Makefile.in: Rebuilt.
gcc/
	* gcc.c (LINK_SSP_SPEC): Define.
	(link_ssp_spec): New variable.
	(LINK_COMMAND_SPEC): Add %(link_ssp).
	(static_specs): Add link_ssp_spec.
	* configure.ac (TARGET_LIBC_PROVIDES_SSP): New test.
	* configure: Rebuilt.
	* config.in: Rebuilt.

	* config/rs6000/linux.h (TARGET_THREAD_SSP_OFFSET): Define.
	* config/rs6000/linux64.h (TARGET_THREAD_SSP_OFFSET): Likewise.
	* config/i386/linux.h (TARGET_THREAD_SSP_OFFSET): Likewise.
	* config/i386/linux64.h (TARGET_THREAD_SSP_OFFSET): Likewise.
	* config/rs6000/rs6000.md (stack_protect_set, stack_protect_test):
	If TARGET_THREAD_SSP_OFFSET is defined, use -0x7010(13) resp.
	-0x7008(2) instead of reading __stack_chk_guard variable.
	* config/i386/i386.md (UNSPEC_SP_SET, UNSPEC_SP_TEST): Change
	number.
	(UNSPEC_SP_TLS_SET, UNSPEC_SP_TLS_TEST): New constants.
	(stack_protect_set, stack_protect_test): Use *_tls* patterns
	if TARGET_THREAD_SSP_OFFSET is defined.
	(stack_tls_protect_set_si, stack_tls_protect_set_di,
	stack_tls_protect_test_si, stack_tls_protect_test_di): New insns.

	Revert:
	2005-06-27  Richard Henderson  <rth@redhat.com>
	* libgcc-std.ver (GCC_4.1.0): New.
	* libgcc.h (__stack_chk_guard): Declare.
	(__stack_chk_fail, __stack_chk_fail_local): Declare.
	* libgcc2.c (L_stack_chk, L_stack_chk_local): New.
	* mklibgcc.in (lib2funcs): Add them.

--- gcc/gcc/config/rs6000/linux.h.jj	2005-06-25 21:30:48.000000000 +0200
+++ gcc/gcc/config/rs6000/linux.h	2005-07-01 22:14:34.000000000 +0200
@@ -113,3 +113,8 @@
 #define TARGET_HAS_F_SETLKW
 
 #define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h"
+
+#ifdef TARGET_LIBC_PROVIDES_SSP
+/* ppc32 glibc provides __stack_chk_guard in -0x7008(2).  */
+#define TARGET_THREAD_SSP_OFFSET	-0x7008
+#endif
--- gcc/gcc/config/rs6000/linux64.h.jj	2005-06-25 21:30:48.000000000 +0200
+++ gcc/gcc/config/rs6000/linux64.h	2005-07-01 22:15:08.000000000 +0200
@@ -547,3 +547,9 @@ while (0)
 #endif
 
 #define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h"
+
+#ifdef TARGET_LIBC_PROVIDES_SSP
+/* ppc32 glibc provides __stack_chk_guard in -0x7008(2),
+   ppc64 glibc provides it at -0x7010(13).  */
+#define TARGET_THREAD_SSP_OFFSET	(TARGET_64BIT ? -0x7010 : -0x7008)
+#endif
--- gcc/gcc/config/i386/linux.h.jj	2005-06-25 21:30:40.000000000 +0200
+++ gcc/gcc/config/i386/linux.h	2005-07-01 22:19:19.000000000 +0200
@@ -185,3 +185,8 @@ Boston, MA 02110-1301, USA.  */
 
 /* This macro may be overridden in i386/k*bsd-gnu.h.  */
 #define REG_NAME(reg) reg
+
+#ifdef TARGET_LIBC_PROVIDES_SSP
+/* i386 glibc provides __stack_chk_guard in %gs:0x14.  */
+#define TARGET_THREAD_SSP_OFFSET	0x14
+#endif
--- gcc/gcc/config/i386/linux64.h.jj	2005-06-25 21:30:40.000000000 +0200
+++ gcc/gcc/config/i386/linux64.h	2005-07-01 22:19:48.000000000 +0200
@@ -73,3 +73,9 @@ Boston, MA 02110-1301, USA.  */
 
 /* This macro may be overridden in i386/k*bsd-gnu.h.  */
 #define REG_NAME(reg) reg
+
+#ifdef TARGET_LIBC_PROVIDES_SSP
+/* i386 glibc provides __stack_chk_guard in %gs:0x14,
+   x86_64 glibc provides it in %fs:0x28.  */
+#define TARGET_THREAD_SSP_OFFSET	(TARGET_64BIT ? 0x28 : 0x14)
+#endif
--- gcc/gcc/config/i386/i386.md.jj	2005-07-01 01:08:47.000000000 +0200
+++ gcc/gcc/config/i386/i386.md	2005-07-01 22:24:29.000000000 +0200
@@ -81,8 +81,6 @@
    (UNSPEC_FLDCW		25)
    (UNSPEC_REP			26)
    (UNSPEC_EH_RETURN		27)
-   (UNSPEC_SP_SET		28)
-   (UNSPEC_SP_TEST		29)
 
    ; For SSE/MMX support:
    (UNSPEC_FIX_NOTRUNC		30)
@@ -140,6 +138,12 @@
    (UNSPEC_FPREM_U		89)
    (UNSPEC_FPREM1_F		90)
    (UNSPEC_FPREM1_U		91)
+
+   ; SSP patterns
+   (UNSPEC_SP_SET		100)
+   (UNSPEC_SP_TEST		101)
+   (UNSPEC_SP_TLS_SET		102)
+   (UNSPEC_SP_TLS_TEST		103)
   ])
 
 (define_constants
@@ -19613,10 +19617,19 @@
    (match_operand 1 "memory_operand" "")]
   ""
 {
+#ifdef TARGET_THREAD_SSP_OFFSET
+  if (TARGET_64BIT)
+    emit_insn (gen_stack_tls_protect_set_di (operands[0],
+					GEN_INT (TARGET_THREAD_SSP_OFFSET)));
+  else
+    emit_insn (gen_stack_tls_protect_set_si (operands[0],
+					GEN_INT (TARGET_THREAD_SSP_OFFSET)));
+#else
   if (TARGET_64BIT)
     emit_insn (gen_stack_protect_set_di (operands[0], operands[1]));
   else
     emit_insn (gen_stack_protect_set_si (operands[0], operands[1]));
+#endif
   DONE;
 })
 
@@ -19638,6 +19651,24 @@
   "mov{q}\t{%1, %2|%2, %1}\;mov{q}\t{%2, %0|%0, %2}\;xor{l}\t%k2, %k2"
   [(set_attr "type" "multi")])
 
+(define_insn "stack_tls_protect_set_si"
+  [(set (match_operand:SI 0 "memory_operand" "=m")
+	(unspec:SI [(match_operand:SI 1 "const_int_operand" "i")] UNSPEC_SP_TLS_SET))
+   (set (match_scratch:SI 2 "=&r") (const_int 0))
+   (clobber (reg:CC FLAGS_REG))]
+  ""
+  "mov{l}\t{%%gs:%P1, %2|%2, DWORD PTR %%gs:%P1}\;mov{l}\t{%2, %0|%0, %2}\;xor{l}\t%2, %2"
+  [(set_attr "type" "multi")])
+
+(define_insn "stack_tls_protect_set_di"
+  [(set (match_operand:DI 0 "memory_operand" "=m")
+	(unspec:DI [(match_operand:DI 1 "const_int_operand" "i")] UNSPEC_SP_TLS_SET))
+   (set (match_scratch:DI 2 "=&r") (const_int 0))
+   (clobber (reg:CC FLAGS_REG))]
+  "TARGET_64BIT"
+  "mov{q}\t{%%fs:%P1, %2|%2, QWORD PTR %%fs:%P1}\;mov{q}\t{%2, %0|%0, %2}\;xor{l}\t%k2, %k2"
+  [(set_attr "type" "multi")])
+
 (define_expand "stack_protect_test"
   [(match_operand 0 "memory_operand" "")
    (match_operand 1 "memory_operand" "")
@@ -19649,10 +19680,19 @@
   ix86_compare_op1 = operands[1];
   ix86_compare_emitted = flags;
 
+#ifdef TARGET_THREAD_SSP_OFFSET
+  if (TARGET_64BIT)
+    emit_insn (gen_stack_tls_protect_test_di (flags, operands[0],
+					GEN_INT (TARGET_THREAD_SSP_OFFSET)));
+  else
+    emit_insn (gen_stack_tls_protect_test_si (flags, operands[0],
+					GEN_INT (TARGET_THREAD_SSP_OFFSET)));
+#else
   if (TARGET_64BIT)
     emit_insn (gen_stack_protect_test_di (flags, operands[0], operands[1]));
   else
     emit_insn (gen_stack_protect_test_si (flags, operands[0], operands[1]));
+#endif
   emit_jump_insn (gen_beq (operands[2]));
   DONE;
 })
@@ -19677,6 +19717,26 @@
   "mov{q}\t{%1, %3|%3, %1}\;xor{q}\t{%2, %3|%3, %2}"
   [(set_attr "type" "multi")])
 
+(define_insn "stack_tls_protect_test_si"
+  [(set (match_operand:CCZ 0 "flags_reg_operand" "")
+	(unspec:CCZ [(match_operand:SI 1 "memory_operand" "m")
+		     (match_operand:SI 2 "const_int_operand" "i")]
+		    UNSPEC_SP_TLS_TEST))
+   (clobber (match_scratch:SI 3 "=r"))]
+  ""
+  "mov{l}\t{%1, %3|%3, %1}\;xor{l}\t{%%gs:%P2, %3|%3, DWORD PTR %%gs:%P2}"
+  [(set_attr "type" "multi")])
+
+(define_insn "stack_tls_protect_test_di"
+  [(set (match_operand:CCZ 0 "flags_reg_operand" "")
+	(unspec:CCZ [(match_operand:DI 1 "memory_operand" "m")
+		     (match_operand:DI 2 "const_int_operand" "i")]
+		    UNSPEC_SP_TLS_TEST))
+   (clobber (match_scratch:DI 3 "=r"))]
+  "TARGET_64BIT"
+  "mov{q}\t{%1, %3|%3, %1}\;xor{q}\t{%%fs:%P2, %3|%3, QWORD PTR %%fs:%P2}"
+  [(set_attr "type" "multi")])
+
 (include "sse.md")
 (include "mmx.md")
 (include "sync.md")
--- gcc/gcc/gcc.c.jj	2005-06-25 21:30:20.000000000 +0200
+++ gcc/gcc/gcc.c	2005-07-01 22:33:21.000000000 +0200
@@ -668,6 +668,14 @@ proper position among the other output f
 #define LINK_GCC_C_SEQUENCE_SPEC "%G %L %G"
 #endif
 
+#ifndef LINK_SSP_SPEC
+#ifdef TARGET_LIBC_PROVIDES_SSP
+#define LINK_SSP_SPEC "%{fstack-protector:}"
+#else
+#define LINK_SSP_SPEC "%{fstack-protector:-lssp_nonshared -lssp }"
+#endif
+#endif
+
 #ifndef LINK_PIE_SPEC
 #ifdef HAVE_LD_PIE
 #define LINK_PIE_SPEC "%{pie:-pie} "
@@ -689,7 +697,7 @@ proper position among the other output f
     %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
     %{static:} %{L*} %(mfwrap) %(link_libgcc) %o %(mflib)\
     %{fprofile-arcs|fprofile-generate|coverage:-lgcov}\
-    %{!nostdlib:%{!nodefaultlibs:%(link_gcc_c_sequence)}}\
+    %{!nostdlib:%{!nodefaultlibs:%(link_ssp)%(link_gcc_c_sequence)}}\
     %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}"
 #endif
 
@@ -719,6 +727,7 @@ static const char *cpp_spec = CPP_SPEC;
 static const char *cc1_spec = CC1_SPEC;
 static const char *cc1plus_spec = CC1PLUS_SPEC;
 static const char *link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC;
+static const char *link_ssp_spec = LINK_SSP_SPEC;
 static const char *asm_spec = ASM_SPEC;
 static const char *asm_final_spec = ASM_FINAL_SPEC;
 static const char *link_spec = LINK_SPEC;
@@ -1516,6 +1525,7 @@ static struct spec_list static_specs[] =
   INIT_STATIC_SPEC ("cc1_options",		&cc1_options),
   INIT_STATIC_SPEC ("cc1plus",			&cc1plus_spec),
   INIT_STATIC_SPEC ("link_gcc_c_sequence",	&link_gcc_c_sequence_spec),
+  INIT_STATIC_SPEC ("link_ssp",			&link_ssp_spec),
   INIT_STATIC_SPEC ("endfile",			&endfile_spec),
   INIT_STATIC_SPEC ("link",			&link_spec),
   INIT_STATIC_SPEC ("lib",			&lib_spec),
--- gcc/gcc/libgcc2.h.jj	2005-06-27 09:38:14.000000000 +0200
+++ gcc/gcc/libgcc2.h	2005-06-30 17:45:20.000000000 +0200
@@ -390,11 +390,6 @@ extern int __parityDI2 (UDWtype);
 
 extern void __enable_execute_stack (void *);
 
-extern void *__stack_chk_guard;
-extern void __stack_chk_fail (void) __attribute__ ((__noreturn__));
-extern void __stack_chk_fail_local (void)
-	__attribute__ ((__noreturn__)) ATTRIBUTE_HIDDEN;
-
 #ifndef HIDE_EXPORTS
 #pragma GCC visibility pop
 #endif
--- gcc/gcc/libgcc2.c.jj	2005-06-27 09:38:14.000000000 +0200
+++ gcc/gcc/libgcc2.c	2005-06-30 17:45:20.000000000 +0200
@@ -2015,141 +2015,3 @@ func_ptr __DTOR_LIST__[2];
 #endif
 #endif /* no INIT_SECTION_ASM_OP and not CTOR_LISTS_DEFINED_EXTERNALLY */
 #endif /* L_ctors */
-
-#ifdef L_stack_chk
-#ifndef TARGET_LIBC_PROVIDES_SSP
-
-#ifndef inhibit_libc
-# include <string.h>
-# include <unistd.h>
-# include <fcntl.h>
-# ifdef HAVE_PATHS_H
-#  include <paths.h>
-# endif
-# ifndef _PATH_TTY
-#  define _PATH_TTY "/dev/tty"
-# endif
-# ifdef HAVE_SYSLOG_H
-#  include <syslog.h>
-# endif
-#endif
-
-void *__stack_chk_guard = 0;
-
-static void __attribute__ ((constructor))
-__guard_setup (void)
-{
-  unsigned char *p;
-
-  if (__stack_chk_guard != 0)
-    return;
-
-#ifndef inhibit_libc
-  {
-    int fd = open ("/dev/urandom", O_RDONLY);
-    if (fd != -1)
-      {
-	ssize_t size = read (fd, &__stack_chk_guard,
-			     sizeof (__stack_chk_guard));
-	close (fd);
-	if (size == sizeof(__stack_chk_guard))
-	  return;
-      }
-  }
-#endif
-
-  /* If a random generator can't be used, the protector switches the guard
-     to the "terminator canary".  */
-  p = (unsigned char *)&__stack_chk_guard;
-  p[sizeof(__stack_chk_guard)-1] = 255;
-  p[sizeof(__stack_chk_guard)-2] = '\n';
-  p[0] = 0;
-}
-
-void
-__stack_chk_fail (void)
-{
-#ifndef inhibit_libc
-# ifdef __GNU_LIBRARY__
-  extern char * __progname;
-# else
-  static const char __progname[] = "";
-# endif
-
-  int fd;
-
-  /* Print error message directly to the tty.  This avoids Bad Things
-     happening if stderr is redirected.  */
-  fd = open (_PATH_TTY, O_WRONLY);
-  if (fd != -1)
-    {
-      static const char msg1[] = "*** stack smashing detected ***: ";
-      static const char msg2[] = " terminated\n";
-      size_t progname_len, len;
-      char *buf, *p;
-
-      progname_len = strlen (__progname);
-      len = sizeof(msg1)-1 + progname_len + sizeof(msg2)-1 + 1;
-      p = buf = alloca (len);
-
-      memcpy (p, msg1, sizeof(msg1)-1);
-      p += sizeof(msg1)-1;
-      memcpy (p, __progname, progname_len);
-      p += progname_len;
-      memcpy (p, msg2, sizeof(msg2));
-
-      while (len > 0)
-	{
-	  ssize_t wrote = write (fd, buf, len);
-	  if (wrote < 0)
-	    break;
-	  len -= wrote;
-	}
-      close (fd);
-    }
-
-# ifdef HAVE_SYSLOG_H
-  /* Only send the error to syslog if there was no tty available.  */
-  else
-    syslog (LOG_CRIT, "stack smashing detected: terminated");
-# endif /* HAVE_SYSLOG_H */
-#endif /* inhibit_libc */
-
-  /* Try very hard to exit.  Note that signals may be blocked preventing
-     the first two options from working.  The use of volatile is here to
-     prevent optimizers from "knowing" that __builtin_trap is called first,
-     and that it doesn't return, and so "obviously" the rest of the code
-     is dead.  */
-  {
-    volatile int state;
-    for (state = 0; ; state++)
-      switch (state)
-	{
-	case 0:
-	  __builtin_trap ();
-	  break;
-	case 1:
-	  *(volatile int *)-1L = 0;
-	  break;
-	case 2:
-	  _exit (127);
-	  break;
-	}
-  }
-}
-#endif /* TARGET_LIBC_PROVIDES_SSP */
-#endif /* L_stack_chk */
-
-#ifdef L_stack_chk_local
-#ifndef TARGET_LIBC_PROVIDES_SSP
-/* Some targets can avoid loading a GP for calls to hidden functions.
-   Using this entry point may avoid the load of a GP entirely for the
-   function, making the overall code smaller.  */
-
-void
-__stack_chk_fail_local (void)
-{
-  __stack_chk_fail ();
-}
-#endif /* TARGET_LIBC_PROVIDES_SSP */
-#endif /* L_stack_chk_local */
--- gcc/gcc/libgcc-std.ver.jj	2005-06-27 09:38:14.000000000 +0200
+++ gcc/gcc/libgcc-std.ver	2005-06-30 17:45:20.000000000 +0200
@@ -252,10 +252,3 @@ GCC_4.0.0 {
   __mulxc3
   __multc3
 }
-
-%inherit GCC_4.1.0 GCC_4.0.0
-GCC_4.1.0 {
-  # stack smash handler symbols
-  __stack_chk_guard
-  __stack_chk_fail
-}
--- gcc/gcc/mklibgcc.in.jj	2005-06-27 09:38:14.000000000 +0200
+++ gcc/gcc/mklibgcc.in	2005-06-30 17:45:20.000000000 +0200
@@ -63,7 +63,7 @@ lib2funcs='_muldi3 _negdi2 _lshrdi3 _ash
 	_ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _popcount_tab
 	_popcountsi2 _popcountdi2 _paritysi2 _paritydi2 _powisf2 _powidf2
 	_powixf2 _powitf2 _mulsc3 _muldc3 _mulxc3 _multc3 _divsc3 _divdc3
-	_divxc3 _divtc3 _stack_chk _stack_chk_local'
+	_divxc3 _divtc3'
 
 # Disable SHLIB_LINK if shared libgcc not enabled.
 if [ "@enable_shared@" = "no" ]; then
--- gcc/gcc/configure.ac.jj	2005-06-25 21:30:18.000000000 +0200
+++ gcc/gcc/configure.ac	2005-07-01 23:11:20.000000000 +0200
@@ -2972,6 +2972,45 @@ if test x$with_sysroot = x && test x$hos
 [Define to PREFIX/include if cpp should also search that directory.])
 fi
 
+# Test for stack protector support in target C library.
+case "$target" in
+  *-*-linux*)
+    AC_CACHE_CHECK(__stack_chk_fail in target GNU C library,
+      gcc_cv_libc_provides_ssp,
+      [gcc_cv_libc_provides_ssp=no
+      if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then
+	if test "x$with_sysroot" = x; then
+	  glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-include"
+	elif test "x$with_sysroot" = xyes; then
+	  glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-root/usr/include"
+	else
+	  glibc_header_dir="${with_sysroot}/usr/include"
+	fi
+      else
+	glibc_header_dir=/usr/include
+      fi
+      # glibc 2.4 and later provides __stack_chk_fail and
+      # either __stack_chk_guard, or TLS access to stack guard canary.
+      if test -f $glibc_header_dir/features.h \
+	 && $EGREP '^@<:@ 	@:>@*#[ 	]*define[ 	]+__GNU_LIBRARY__[ 	]+([1-9][0-9]|[6-9])' \
+	    $glibc_header_dir/features.h > /dev/null; then
+	if $EGREP '^@<:@ 	@:>@*#[ 	]*define[ 	]+__GLIBC__[ 	]+([1-9][0-9]|[3-9])' \
+	   $glibc_header_dir/features.h > /dev/null; then
+	  gcc_cv_libc_provides_ssp=yes
+	elif $EGREP '^@<:@ 	@:>@*#[ 	]*define[ 	]+__GLIBC__[ 	]+2' \
+	     $glibc_header_dir/features.h > /dev/null \
+	     && $EGREP '^@<:@ 	@:>@*#[ 	]*define[ 	]+__GLIBC_MINOR__[ 	]+([1-9][0-9]|[4-9])' \
+	     $glibc_header_dir/features.h > /dev/null; then
+	  gcc_cv_libc_provides_ssp=yes
+	fi
+      fi]) ;;
+  *) gcc_cv_libc_provides_ssp=no ;;
+esac
+if test x$gcc_cv_libc_provides_ssp = xyes; then
+  AC_DEFINE(TARGET_LIBC_PROVIDES_SSP, 1,
+	    [Define if your target C library provides stack protector support])
+fi
+
 # Find out what GC implementation we want, or may, use.
 AC_ARG_WITH(gc,
 [  --with-gc={page,zone}   choose the garbage collection mechanism to use
--- gcc/gcc/configure.jj	2005-06-17 17:08:49.000000000 +0200
+++ gcc/gcc/configure	2005-07-01 23:11:56.000000000 +0200
@@ -15514,6 +15514,54 @@ _ACEOF
 
 fi
 
+# Test for stack protector support in target C library.
+case "$target" in
+  *-*-linux*)
+    echo "$as_me:$LINENO: checking __stack_chk_fail in target GNU C library" >&5
+echo $ECHO_N "checking __stack_chk_fail in target GNU C library... $ECHO_C" >&6
+if test "${gcc_cv_libc_provides_ssp+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  gcc_cv_libc_provides_ssp=no
+      if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then
+	if test "x$with_sysroot" = x; then
+	  glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-include"
+	elif test "x$with_sysroot" = xyes; then
+	  glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-root/usr/include"
+	else
+	  glibc_header_dir="${with_sysroot}/usr/include"
+	fi
+      else
+	glibc_header_dir=/usr/include
+      fi
+      # glibc 2.4 and later provides __stack_chk_fail and
+      # either __stack_chk_guard, or TLS access to stack guard canary.
+      if test -f $glibc_header_dir/features.h \
+	 && $EGREP '^[ 	]*#[ 	]*define[ 	]+__GNU_LIBRARY__[ 	]+([1-9][0-9]|[6-9])' \
+	    $glibc_header_dir/features.h > /dev/null; then
+	if $EGREP '^[ 	]*#[ 	]*define[ 	]+__GLIBC__[ 	]+([1-9][0-9]|[3-9])' \
+	   $glibc_header_dir/features.h > /dev/null; then
+	  gcc_cv_libc_provides_ssp=yes
+	elif $EGREP '^[ 	]*#[ 	]*define[ 	]+__GLIBC__[ 	]+2' \
+	     $glibc_header_dir/features.h > /dev/null \
+	     && $EGREP '^[ 	]*#[ 	]*define[ 	]+__GLIBC_MINOR__[ 	]+([1-9][0-9]|[4-9])' \
+	     $glibc_header_dir/features.h > /dev/null; then
+	  gcc_cv_libc_provides_ssp=yes
+	fi
+      fi
+fi
+echo "$as_me:$LINENO: result: $gcc_cv_libc_provides_ssp" >&5
+echo "${ECHO_T}$gcc_cv_libc_provides_ssp" >&6 ;;
+  *) gcc_cv_libc_provides_ssp=no ;;
+esac
+if test x$gcc_cv_libc_provides_ssp = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define TARGET_LIBC_PROVIDES_SSP 1
+_ACEOF
+
+fi
+
 # Find out what GC implementation we want, or may, use.
 
 # Check whether --with-gc or --without-gc was given.
--- gcc/gcc/config.in.jj	2005-06-06 10:38:45.000000000 +0200
+++ gcc/gcc/config.in	2005-07-01 22:10:51.000000000 +0200
@@ -1270,6 +1270,12 @@
 #endif
 
 
+/* Define if your target C library provides stack protector support */
+#ifndef USED_FOR_TARGET
+#undef TARGET_LIBC_PROVIDES_SSP
+#endif
+
+
 /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
 #ifndef USED_FOR_TARGET
 #undef TIME_WITH_SYS_TIME
--- gcc/Makefile.def.jj	2005-06-25 21:30:10.000000000 +0200
+++ gcc/Makefile.def	2005-06-30 17:45:20.000000000 +0200
@@ -115,6 +115,7 @@ host_modules= { module= gnattools; };
 
 target_modules = { module= libstdc++-v3; lib_path=.libs; raw_cxx=true; };
 target_modules = { module= libmudflap; lib_path=.libs; };
+target_modules = { module= libssp; lib_path=.libs; };
 target_modules = { module= newlib; };
 target_modules = { module= libgfortran; };
 target_modules = { module= libobjc; };
--- gcc/configure.in.jj	2005-06-17 17:08:44.000000000 +0200
+++ gcc/configure.in	2005-06-30 17:45:20.000000000 +0200
@@ -147,6 +147,7 @@ target_libraries="target-libiberty \
 		target-newlib \
 		target-libstdc++-v3 \
 		target-libmudflap \
+		target-libssp \
 		target-libgfortran \
 		${libgcj} \
 		target-libobjc \
--- gcc/configure.jj	2005-06-17 17:08:44.000000000 +0200
+++ gcc/configure	2005-06-30 17:45:20.000000000 +0200
@@ -900,6 +900,7 @@ target_libraries="target-libiberty \
 		target-newlib \
 		target-libstdc++-v3 \
 		target-libmudflap \
+		target-libssp \
 		target-libgfortran \
 		${libgcj} \
 		target-libobjc \
--- gcc/Makefile.in.jj	2005-06-25 21:30:11.000000000 +0200
+++ gcc/Makefile.in	2005-06-30 17:45:20.000000000 +0200
@@ -480,7 +480,7 @@ PICFLAG_FOR_TARGET = 
 
 # This is the list of directories that may be needed in RPATH_ENVVAR
 # so that prorgams built for the target machine work.
-TARGET_LIB_PATH = $(TARGET_LIB_PATH_libstdc++-v3)$(TARGET_LIB_PATH_libmudflap)$(HOST_LIB_PATH_gcc)
+TARGET_LIB_PATH = $(TARGET_LIB_PATH_libstdc++-v3)$(TARGET_LIB_PATH_libmudflap)$(TARGET_LIB_PATH_libssp)$(HOST_LIB_PATH_gcc)
 
 @if target-libstdc++-v3
 TARGET_LIB_PATH_libstdc++-v3 = $$r/$(TARGET_SUBDIR)/libstdc++-v3/.libs:
@@ -490,6 +490,10 @@ TARGET_LIB_PATH_libstdc++-v3 = $$r/$(TAR
 TARGET_LIB_PATH_libmudflap = $$r/$(TARGET_SUBDIR)/libmudflap/.libs:
 @endif target-libmudflap
 
+@if target-libssp
+TARGET_LIB_PATH_libssp = $$r/$(TARGET_SUBDIR)/libssp/.libs:
+@endif target-libssp
+
 
 
 # This is the list of directories that may be needed in RPATH_ENVVAR
@@ -731,6 +735,7 @@ configure-host:  \
 configure-target:  \
     maybe-configure-target-libstdc++-v3 \
     maybe-configure-target-libmudflap \
+    maybe-configure-target-libssp \
     maybe-configure-target-newlib \
     maybe-configure-target-libgfortran \
     maybe-configure-target-libobjc \
@@ -834,6 +839,7 @@ all-host:  \
 all-target:  \
     maybe-all-target-libstdc++-v3 \
     maybe-all-target-libmudflap \
+    maybe-all-target-libssp \
     maybe-all-target-newlib \
     maybe-all-target-libgfortran \
     maybe-all-target-libobjc \
@@ -933,6 +939,7 @@ info-host:  \
 info-target:  \
     maybe-info-target-libstdc++-v3 \
     maybe-info-target-libmudflap \
+    maybe-info-target-libssp \
     maybe-info-target-newlib \
     maybe-info-target-libgfortran \
     maybe-info-target-libobjc \
@@ -1027,6 +1034,7 @@ dvi-host:  \
 dvi-target:  \
     maybe-dvi-target-libstdc++-v3 \
     maybe-dvi-target-libmudflap \
+    maybe-dvi-target-libssp \
     maybe-dvi-target-newlib \
     maybe-dvi-target-libgfortran \
     maybe-dvi-target-libobjc \
@@ -1121,6 +1129,7 @@ html-host:  \
 html-target:  \
     maybe-html-target-libstdc++-v3 \
     maybe-html-target-libmudflap \
+    maybe-html-target-libssp \
     maybe-html-target-newlib \
     maybe-html-target-libgfortran \
     maybe-html-target-libobjc \
@@ -1215,6 +1224,7 @@ TAGS-host:  \
 TAGS-target:  \
     maybe-TAGS-target-libstdc++-v3 \
     maybe-TAGS-target-libmudflap \
+    maybe-TAGS-target-libssp \
     maybe-TAGS-target-newlib \
     maybe-TAGS-target-libgfortran \
     maybe-TAGS-target-libobjc \
@@ -1309,6 +1319,7 @@ install-info-host:  \
 install-info-target:  \
     maybe-install-info-target-libstdc++-v3 \
     maybe-install-info-target-libmudflap \
+    maybe-install-info-target-libssp \
     maybe-install-info-target-newlib \
     maybe-install-info-target-libgfortran \
     maybe-install-info-target-libobjc \
@@ -1403,6 +1414,7 @@ installcheck-host:  \
 installcheck-target:  \
     maybe-installcheck-target-libstdc++-v3 \
     maybe-installcheck-target-libmudflap \
+    maybe-installcheck-target-libssp \
     maybe-installcheck-target-newlib \
     maybe-installcheck-target-libgfortran \
     maybe-installcheck-target-libobjc \
@@ -1497,6 +1509,7 @@ mostlyclean-host:  \
 mostlyclean-target:  \
     maybe-mostlyclean-target-libstdc++-v3 \
     maybe-mostlyclean-target-libmudflap \
+    maybe-mostlyclean-target-libssp \
     maybe-mostlyclean-target-newlib \
     maybe-mostlyclean-target-libgfortran \
     maybe-mostlyclean-target-libobjc \
@@ -1591,6 +1604,7 @@ clean-host:  \
 clean-target:  \
     maybe-clean-target-libstdc++-v3 \
     maybe-clean-target-libmudflap \
+    maybe-clean-target-libssp \
     maybe-clean-target-newlib \
     maybe-clean-target-libgfortran \
     maybe-clean-target-libobjc \
@@ -1685,6 +1699,7 @@ distclean-host:  \
 distclean-target:  \
     maybe-distclean-target-libstdc++-v3 \
     maybe-distclean-target-libmudflap \
+    maybe-distclean-target-libssp \
     maybe-distclean-target-newlib \
     maybe-distclean-target-libgfortran \
     maybe-distclean-target-libobjc \
@@ -1779,6 +1794,7 @@ maintainer-clean-host:  \
 maintainer-clean-target:  \
     maybe-maintainer-clean-target-libstdc++-v3 \
     maybe-maintainer-clean-target-libmudflap \
+    maybe-maintainer-clean-target-libssp \
     maybe-maintainer-clean-target-newlib \
     maybe-maintainer-clean-target-libgfortran \
     maybe-maintainer-clean-target-libobjc \
@@ -1932,6 +1948,7 @@ do-check: unstage  \
     maybe-check-gnattools \
     maybe-check-target-libstdc++-v3 \
     maybe-check-target-libmudflap \
+    maybe-check-target-libssp \
     maybe-check-target-newlib \
     maybe-check-target-libgfortran \
     maybe-check-target-libobjc \
@@ -2118,6 +2135,7 @@ install-host:  \
 install-target:  \
     maybe-install-target-libstdc++-v3 \
     maybe-install-target-libmudflap \
+    maybe-install-target-libssp \
     maybe-install-target-newlib \
     maybe-install-target-libgfortran \
     maybe-install-target-libobjc \
@@ -27936,6 +27954,341 @@ maintainer-clean-target-libmudflap: 
 
 
 # There's only one multilib.out.  Cleverer subdirs shouldn't need it copied.
+@if target-libssp
+$(TARGET_SUBDIR)/libssp/multilib.out: multilib.out
+	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libssp ; \
+	rm -f $(TARGET_SUBDIR)/libssp/Makefile || : ; \
+	cp multilib.out $(TARGET_SUBDIR)/libssp/multilib.out
+@endif target-libssp
+
+
+
+.PHONY: configure-target-libssp maybe-configure-target-libssp
+maybe-configure-target-libssp:
+@if target-libssp
+maybe-configure-target-libssp: configure-target-libssp
+configure-target-libssp: $(TARGET_SUBDIR)/libssp/multilib.out
+	@test ! -f $(TARGET_SUBDIR)/libssp/Makefile || exit 0; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libssp ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo Configuring in $(TARGET_SUBDIR)/libssp; \
+	cd "$(TARGET_SUBDIR)/libssp" || exit 1; \
+	case $(srcdir) in \
+	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+	  *) topdir=`echo $(TARGET_SUBDIR)/libssp/ | \
+		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+	esac; \
+	srcdiroption="--srcdir=$${topdir}/libssp"; \
+	libsrcdir="$$s/libssp"; \
+	rm -f no-such-file || : ; \
+	CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
+	  $(TARGET_CONFIGARGS) $${srcdiroption}  \
+	  || exit 1
+@endif target-libssp
+
+
+
+
+
+.PHONY: all-target-libssp maybe-all-target-libssp
+maybe-all-target-libssp:
+@if target-libssp
+TARGET-target-libssp=all
+maybe-all-target-libssp: all-target-libssp
+all-target-libssp: configure-target-libssp
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	(cd $(TARGET_SUBDIR)/libssp && \
+	  $(MAKE) $(TARGET_FLAGS_TO_PASS)  $(TARGET-target-libssp))
+@endif target-libssp
+
+
+
+
+
+.PHONY: check-target-libssp maybe-check-target-libssp
+maybe-check-target-libssp:
+@if target-libssp
+maybe-check-target-libssp: check-target-libssp
+
+check-target-libssp:
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	(cd $(TARGET_SUBDIR)/libssp && \
+	  $(MAKE) $(TARGET_FLAGS_TO_PASS)   check)
+
+@endif target-libssp
+
+.PHONY: install-target-libssp maybe-install-target-libssp
+maybe-install-target-libssp:
+@if target-libssp
+maybe-install-target-libssp: install-target-libssp
+
+install-target-libssp: installdirs
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	(cd $(TARGET_SUBDIR)/libssp && \
+	  $(MAKE) $(TARGET_FLAGS_TO_PASS)  install)
+
+@endif target-libssp
+
+# Other targets (info, dvi, etc.)
+
+.PHONY: maybe-info-target-libssp info-target-libssp
+maybe-info-target-libssp:
+@if target-libssp
+maybe-info-target-libssp: info-target-libssp
+
+info-target-libssp: \
+    configure-target-libssp 
+	@[ -f $(TARGET_SUBDIR)/libssp/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing info in $(TARGET_SUBDIR)/libssp" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libssp && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+	           info) \
+	  || exit 1
+
+@endif target-libssp
+
+.PHONY: maybe-dvi-target-libssp dvi-target-libssp
+maybe-dvi-target-libssp:
+@if target-libssp
+maybe-dvi-target-libssp: dvi-target-libssp
+
+dvi-target-libssp: \
+    configure-target-libssp 
+	@[ -f $(TARGET_SUBDIR)/libssp/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing dvi in $(TARGET_SUBDIR)/libssp" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libssp && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+	           dvi) \
+	  || exit 1
+
+@endif target-libssp
+
+.PHONY: maybe-html-target-libssp html-target-libssp
+maybe-html-target-libssp:
+@if target-libssp
+maybe-html-target-libssp: html-target-libssp
+
+html-target-libssp: \
+    configure-target-libssp 
+	@[ -f $(TARGET_SUBDIR)/libssp/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing html in $(TARGET_SUBDIR)/libssp" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libssp && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+	           html) \
+	  || exit 1
+
+@endif target-libssp
+
+.PHONY: maybe-TAGS-target-libssp TAGS-target-libssp
+maybe-TAGS-target-libssp:
+@if target-libssp
+maybe-TAGS-target-libssp: TAGS-target-libssp
+
+TAGS-target-libssp: \
+    configure-target-libssp 
+	@[ -f $(TARGET_SUBDIR)/libssp/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing TAGS in $(TARGET_SUBDIR)/libssp" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libssp && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+	           TAGS) \
+	  || exit 1
+
+@endif target-libssp
+
+.PHONY: maybe-install-info-target-libssp install-info-target-libssp
+maybe-install-info-target-libssp:
+@if target-libssp
+maybe-install-info-target-libssp: install-info-target-libssp
+
+install-info-target-libssp: \
+    configure-target-libssp \
+    info-target-libssp 
+	@[ -f $(TARGET_SUBDIR)/libssp/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing install-info in $(TARGET_SUBDIR)/libssp" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libssp && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+	           install-info) \
+	  || exit 1
+
+@endif target-libssp
+
+.PHONY: maybe-installcheck-target-libssp installcheck-target-libssp
+maybe-installcheck-target-libssp:
+@if target-libssp
+maybe-installcheck-target-libssp: installcheck-target-libssp
+
+installcheck-target-libssp: \
+    configure-target-libssp 
+	@[ -f $(TARGET_SUBDIR)/libssp/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing installcheck in $(TARGET_SUBDIR)/libssp" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libssp && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+	           installcheck) \
+	  || exit 1
+
+@endif target-libssp
+
+.PHONY: maybe-mostlyclean-target-libssp mostlyclean-target-libssp
+maybe-mostlyclean-target-libssp:
+@if target-libssp
+maybe-mostlyclean-target-libssp: mostlyclean-target-libssp
+
+mostlyclean-target-libssp: 
+	@[ -f $(TARGET_SUBDIR)/libssp/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing mostlyclean in $(TARGET_SUBDIR)/libssp" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libssp && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+	           mostlyclean) \
+	  || exit 1
+
+@endif target-libssp
+
+.PHONY: maybe-clean-target-libssp clean-target-libssp
+maybe-clean-target-libssp:
+@if target-libssp
+maybe-clean-target-libssp: clean-target-libssp
+
+clean-target-libssp: 
+	@[ -f $(TARGET_SUBDIR)/libssp/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing clean in $(TARGET_SUBDIR)/libssp" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libssp && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+	           clean) \
+	  || exit 1
+
+@endif target-libssp
+
+.PHONY: maybe-distclean-target-libssp distclean-target-libssp
+maybe-distclean-target-libssp:
+@if target-libssp
+maybe-distclean-target-libssp: distclean-target-libssp
+
+distclean-target-libssp: 
+	@[ -f $(TARGET_SUBDIR)/libssp/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing distclean in $(TARGET_SUBDIR)/libssp" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libssp && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+	           distclean) \
+	  || exit 1
+
+@endif target-libssp
+
+.PHONY: maybe-maintainer-clean-target-libssp maintainer-clean-target-libssp
+maybe-maintainer-clean-target-libssp:
+@if target-libssp
+maybe-maintainer-clean-target-libssp: maintainer-clean-target-libssp
+
+maintainer-clean-target-libssp: 
+	@[ -f $(TARGET_SUBDIR)/libssp/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libssp" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libssp && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+	           maintainer-clean) \
+	  || exit 1
+
+@endif target-libssp
+
+
+
+# There's only one multilib.out.  Cleverer subdirs shouldn't need it copied.
 @if target-newlib
 $(TARGET_SUBDIR)/newlib/multilib.out: multilib.out
 	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/newlib ; \
@@ -34567,6 +34920,8 @@ configure-target-libstdc++-v3: maybe-all
 
 configure-target-libmudflap: maybe-all-gcc
 
+configure-target-libssp: maybe-all-gcc
+
 configure-target-newlib: maybe-all-gcc
 
 configure-target-libgfortran: maybe-all-gcc

	Jakub

Attachment: libssp.tar.bz2
Description: BZip2 compressed data


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