$NetBSD: patch-gcc_configure,v 1.2 2017/07/10 15:55:40 maya Exp $

Add dl_iterate_phdr detection for FreeBSD and DragonFly.
Detection for NetBSD and OpenBSD is added but commented out in case this
error handling mechanism is activated for these platforms later.

netbsd provides ssp in libc and doesn't build libssp, adjust ssp spec fragment
for it too

--- gcc/configure.orig	2014-05-28 11:37:50.000000000 +0000
+++ gcc/configure
@@ -27513,7 +27513,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
@@ -27601,6 +27601,20 @@ case "$target" in
       gcc_cv_target_dl_iterate_phdr=no
     fi
     ;;
+  *-*-dragonfly* | *-*-freebsd*)
+  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
+  ;;
+# *-*-netbsd* | *-*-openbsd*)
+# if grep dl_iterate_phdr $target_header_dir/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
