$NetBSD: patch-gcc_configure,v 1.3 2015/11/17 11:21:15 wiz Exp $

First chunk: SSP is in libc on NetBSD
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68380

Second chunk: XXX

--- gcc/configure.orig	2015-07-03 17:00:49.000000000 +0000
+++ gcc/configure
@@ -27775,7 +27775,7 @@ fi
 	 # simply assert that glibc does provide this, which is true for all
 	 # realistically usable GNU/Hurd configurations.
 	 gcc_cv_libc_provides_ssp=yes;;
-       *-*-darwin* | *-*-freebsd*)
+       *-*-darwin* | *-*-freebsd* | *-*-netbsd*)
 	 ac_fn_c_check_func "$LINENO" "__stack_chk_fail" "ac_cv_func___stack_chk_fail"
 if test "x$ac_cv_func___stack_chk_fail" = x""yes; then :
   gcc_cv_libc_provides_ssp=yes
@@ -27870,6 +27870,13 @@ case "$target" in
       gcc_cv_target_dl_iterate_phdr=no
     fi
     ;;
+  *-*-netbsd* | *-*-openbsd*)
+    if grep dl_iterate_phdr $target_header_dir/sys/link_elf.h > /dev/null 2>&1; then
+      gcc_cv_target_dl_iterate_phdr=yes
+    else
+      gcc_cv_target_dl_iterate_phdr=no
+    fi
+    ;;
 esac
 
 if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
