--- gcc/configure.orig	2014-12-08 11:29:43 UTC
+++ gcc/configure
@@ -12409,7 +12409,7 @@ else
     lt_cv_sys_max_cmd_len=8192;
     ;;
 
-  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+  netbsd* | bsdsunix* | freebsd* | openbsd* | darwin* | dragonfly*)
     # This has been around since 386BSD, at least.  Likely further.
     if test -x /sbin/sysctl; then
       lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
@@ -12759,13 +12759,13 @@ darwin* | rhapsody*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-freebsd* | dragonfly*)
+bsdsunix* | freebsd* | dragonfly*)
   if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
     case $host_cpu in
     i*86 )
       # Not sure whether the presence of OpenBSD here was a mistake.
       # Let's accept both of them until this is cleared up.
-      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
+      lt_cv_deplibs_check_method='file_magic (BSDSUniX|FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
       lt_cv_file_magic_cmd=/usr/bin/file
       lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
       ;;
@@ -13603,7 +13603,7 @@ ia64-*-hpux*)
   rm -rf conftest*
   ;;
 
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
+x86_64-*kbsdsunix*-gnu|x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
   # Find out which ABI we are using.
   echo 'int i;' > conftest.$ac_ext
@@ -13615,6 +13615,9 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*
     case `/usr/bin/file conftest.o` in
       *32-bit*)
 	case $host in
+	  x86_64-*kbsdsunix*-gnu)
+	    LD="${LD-ld} -m elf_i386_bsdsux"
+	    ;;
 	  x86_64-*kfreebsd*-gnu)
 	    LD="${LD-ld} -m elf_i386_fbsd"
 	    ;;
@@ -13644,6 +13647,9 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*
 	;;
       *64-bit*)
 	case $host in
+	  x86_64-*kbsdsunix*-gnu)
+	    LD="${LD-ld} -m elf_x86_64_bsdsux"
+	    ;;
 	  x86_64-*kfreebsd*-gnu)
 	    LD="${LD-ld} -m elf_x86_64_fbsd"
 	    ;;
@@ -15442,7 +15448,7 @@ $as_echo_n "checking whether the $compil
   hardcode_minus_L=no
   hardcode_shlibpath_var=unsupported
   inherit_rpath=no
-  link_all_deplibs=unknown
+  link_all_deplibs=no
   module_cmds=
   module_expsym_cmds=
   old_archive_from_new_cmds=
@@ -15708,7 +15714,7 @@ _LT_EOF
 	wlarc=
       else
 	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	archive_expsym_cmds='echo "{ global:" > $lib-ver~			 sed -e "s|$|;|" < $export_symbols >> $lib-ver~		 echo "local: *; };" >> $lib-ver~$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script $wl$lib-ver -o $lib'
       fi
       ;;
 
@@ -15727,7 +15733,7 @@ _LT_EOF
 _LT_EOF
       elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
 	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	archive_expsym_cmds='echo "{ global:" > $lib-ver~			 sed -e "s|$|;|" < $export_symbols >> $lib-ver~		 echo "local: *; };" >> $lib-ver~$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script $wl$lib-ver -o $lib'
       else
 	ld_shlibs=no
       fi
@@ -15756,7 +15762,7 @@ _LT_EOF
 	  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
 	    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
 	    archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	    archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	    archive_expsym_cmds='echo "{ global:" > $lib-ver~			 sed -e "s|$|;|" < $export_symbols >> $lib-ver~		 echo "local: *; };" >> $lib-ver~$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script $wl$lib-ver -o $lib'
 	  else
 	    ld_shlibs=no
 	  fi
@@ -15774,7 +15780,7 @@ _LT_EOF
     *)
       if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
 	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	archive_expsym_cmds='echo "{ global:" > $lib-ver~			 sed -e "s|$|;|" < $export_symbols >> $lib-ver~		 echo "local: *; };" >> $lib-ver~$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script $wl$lib-ver -o $lib'
       else
 	ld_shlibs=no
       fi
@@ -16090,7 +16096,7 @@ if test -z "$aix_libpath"; then aix_libp
       ;;
 
     # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
-    freebsd* | dragonfly*)
+    bsdsunix* | freebsd* | dragonfly*)
       archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
       hardcode_libdir_flag_spec='-R$libdir'
       hardcode_direct=yes
@@ -16278,7 +16284,7 @@ rm -f core conftest.err conftest.$ac_obj
 	hardcode_direct_absolute=yes
 	if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
 	  archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	  archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	  archive_expsym_cmds='echo "{ global:" > $lib-ver~			 sed -e "s|$|;|" < $export_symbols >> $lib-ver~		 echo "local: *; };" >> $lib-ver~$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-version-script,$lib-ver'
 	  hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
 	  export_dynamic_flag_spec='${wl}-E'
 	else
@@ -16988,6 +16994,25 @@ dgux*)
   shlibpath_var=LD_LIBRARY_PATH
   ;;
 
+bsdsunix*)
+  objformat=elf
+  version_type=bsdsunix-$objformat
+  case $version_type in
+    bsdsunix-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    bsdsunix-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
 freebsd* | dragonfly*)
   # DragonFly does not have aout.  When/if they implement a new
   # versioning mechanism, adjust this.
@@ -17002,7 +17027,7 @@ freebsd* | dragonfly*)
   version_type=freebsd-$objformat
   case $version_type in
     freebsd-elf*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      library_names_spec='$libname$release$shared_ext$versuffix 	 $libname$release$shared_ext$major		 $libname$shared_ext'				 soname_spec='$libname$release$shared_ext$major'
       need_version=no
       need_lib_prefix=no
       ;;
@@ -18084,7 +18109,7 @@ striplib=
 old_striplib=
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5
 $as_echo_n "checking whether stripping libraries is possible... " >&6; }
-if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "strip" >/dev/null; then
   test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
   test -z "$striplib" && striplib="$STRIP --strip-unneeded"
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
@@ -18333,7 +18358,7 @@ hardcode_automatic_CXX=no
 inherit_rpath_CXX=no
 module_cmds_CXX=
 module_expsym_cmds_CXX=
-link_all_deplibs_CXX=unknown
+link_all_deplibs_CXX=no
 old_archive_cmds_CXX=$old_archive_cmds
 reload_flag_CXX=$reload_flag
 reload_cmds_CXX=$reload_cmds
@@ -18549,7 +18574,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
       # archiving commands below assume that GNU ld is being used.
       if test "$with_gnu_ld" = yes; then
         archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-        archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+        archive_expsym_cmds_CXX='echo "{ global:" > $lib-ver~			 sed -e "s|$|;|" < $export_symbols >> $lib-ver~		 echo "local: *; };" >> $lib-ver~$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script $wl$lib-ver -o $lib'
 
         hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
         export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
@@ -18889,7 +18914,7 @@ if test -z "$aix_libpath"; then aix_libp
         archive_cmds_need_lc_CXX=no
         ;;
 
-      freebsd* | dragonfly*)
+      bsdsunix* | freebsd* | dragonfly*)
         # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
         # conventions
         ld_shlibs_CXX=yes
@@ -19095,7 +19120,7 @@ if test -z "$aix_libpath"; then aix_libp
 	    case `$CC -V 2>&1` in
 	      *"Version 7."*)
 	        archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-		archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+		archive_expsym_cmds_CXX='echo "{ global:" > $lib-ver~			 sed -e "s|$|;|" < $export_symbols >> $lib-ver~		 echo "local: *; };" >> $lib-ver~$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script $wl$lib-ver -o $lib'
 		;;
 	      *)  # Version 8.0 or newer
 	        tmp_idyn=
@@ -19103,7 +19128,7 @@ if test -z "$aix_libpath"; then aix_libp
 		  ia64*) tmp_idyn=' -i_dynamic';;
 		esac
 	        archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-		archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+		archive_expsym_cmds_CXX='echo "{ global:" > $lib-ver~			 sed -e "s|$|;|" < $export_symbols >> $lib-ver~		 echo "local: *; };" >> $lib-ver~$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script $wl$lib-ver -o $lib'
 		;;
 	    esac
 	    archive_cmds_need_lc_CXX=no
@@ -19135,7 +19160,7 @@ if test -z "$aix_libpath"; then aix_libp
 	      ;;
 	    *) # Version 6 and above use weak symbols
 	      archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
-	      archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+	      archive_expsym_cmds_CXX='echo "{ global:" > $lib-ver~			 sed -e "s|$|;|" < $export_symbols >> $lib-ver~		 echo "local: *; };" >> $lib-ver~$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-version-script ${wl}$lib-ver -o $lib'
 	      ;;
 	    esac
 
@@ -19146,7 +19171,7 @@ if test -z "$aix_libpath"; then aix_libp
 	  cxx*)
 	    # Compaq C++
 	    archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	    archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+	    archive_expsym_cmds_CXX='echo "{ global:" > $lib-ver~			 sed -e "s|$|;|" < $export_symbols >> $lib-ver~		 echo "local: *; };" >> $lib-ver~$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-version-script $wl$lib-ver'
 
 	    runpath_var=LD_RUN_PATH
 	    hardcode_libdir_flag_spec_CXX='-rpath $libdir'
@@ -19180,7 +19205,7 @@ if test -z "$aix_libpath"; then aix_libp
 	      # Sun C++ 5.9
 	      no_undefined_flag_CXX=' -zdefs'
 	      archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	      archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+	      archive_expsym_cmds_CXX='echo "{ global:" > $lib-ver~			 sed -e "s|$|;|" < $export_symbols >> $lib-ver~		 echo "local: *; };" >> $lib-ver~$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-version-script ${wl}$lib-ver'
 	      hardcode_libdir_flag_spec_CXX='-R$libdir'
 	      whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
 	      compiler_needs_object_CXX=yes
@@ -19253,7 +19278,7 @@ if test -z "$aix_libpath"; then aix_libp
 	  archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
 	  hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
 	  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-	    archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+	    archive_expsym_cmds_CXX='echo "{ global:" > $lib-ver~			 sed -e "s|$|;|" < $export_symbols >> $lib-ver~		 echo "local: *; };" >> $lib-ver~$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-version-script,$lib-ver -o $lib'
 	    export_dynamic_flag_spec_CXX='${wl}-E'
 	    whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
 	  fi
@@ -19854,7 +19879,7 @@ $as_echo_n "checking for $compiler optio
 	    ;;
 	esac
 	;;
-      freebsd* | dragonfly*)
+      bsdsunix* | freebsd* | dragonfly*)
 	# FreeBSD uses GNU C++
 	;;
       hpux9* | hpux10* | hpux11*)
@@ -20648,6 +20673,25 @@ dgux*)
   shlibpath_var=LD_LIBRARY_PATH
   ;;
 
+bsdsunix*)
+  objformat=elf
+  version_type=bsdsunix-$objformat
+  case $version_type in
+    bsdsunix-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    bsdsunix-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
 freebsd* | dragonfly*)
   # DragonFly does not have aout.  When/if they implement a new
   # versioning mechanism, adjust this.
@@ -20662,7 +20706,7 @@ freebsd* | dragonfly*)
   version_type=freebsd-$objformat
   case $version_type in
     freebsd-elf*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      library_names_spec='$libname$release$shared_ext$versuffix 	 $libname$release$shared_ext$major		 $libname$shared_ext'				 soname_spec='$libname$release$shared_ext$major'
       need_version=no
       need_lib_prefix=no
       ;;
@@ -26583,7 +26627,7 @@ $as_echo "#define HAVE_LD_AS_NEEDED 1" >
 fi
 
 case "$target:$tm_file" in
-  powerpc64-*-freebsd* | powerpc64*-*-linux* | powerpc*-*-linux*rs6000/biarch64.h*)
+  powerpc64-*-bsdsunix* | powerpc64-*-freebsd* | powerpc64*-*-linux* | powerpc*-*-linux*rs6000/biarch64.h*)
   case "$target" in
      *le-*-linux*)
      emul_name="-melf64lppc"
@@ -26591,6 +26635,9 @@ case "$target:$tm_file" in
      *-*-linux*)
      emul_name="-melf64ppc"
       ;;
+     *-*-bsdsunix*)
+     emul_name="-melf64ppc_bsdsux"
+      ;;
      *-*-freebsd*)
      emul_name="-melf64ppc_fbsd"
       ;;
@@ -26852,7 +26899,7 @@ if test "${gcc_cv_libc_provides_ssp+set}
 else
   gcc_cv_libc_provides_ssp=no
     case "$target" in
-       *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
+       *-*-linux* | *-*-kfreebsd*-gnu | *-*-kbsdsunix*-gnu | *-*-knetbsd*-gnu)
       # glibc 2.4 and later provides __stack_chk_fail and
       # either __stack_chk_guard, or TLS access to stack guard canary.
       if test -f $target_header_dir/features.h \
@@ -26886,7 +26933,7 @@ else
 	 # 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*)
+       *-*-bsdsunix* | *-*-darwin* | *-*-freebsd*)
 	 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