$OpenBSD: patch-gcc_config_gcc,v 1.2 2008/07/25 20:50:26 martynas Exp $
--- gcc/config.gcc.orig	Thu Apr 29 07:42:47 2004
+++ gcc/config.gcc	Fri Jul 25 12:34:57 2008
@@ -402,9 +402,19 @@ case $machine in
 	esac
 	;;
 *-*-openbsd*)
-	tm_file=${cpu_type}/openbsd.h
+	case $machine in
+	*-*-openbsd2* | *-*-openbsd3.[012])
+		openbsd_libspec="openbsd-libc_r.h"
+		;;
+	*)
+		openbsd_libspec="openbsd-libpthread.h"
+		;;
+	esac
+	tm_file="${openbsd_libspec} ${cpu_type}/openbsd.h"
 	tmake_file="t-libc-ok t-openbsd t-libgcc-pic"
 	xm_defines=POSIX
+	# for gcc in tree, we use our own fragment
+	xmake_file=x-openbsd
 	if test x$enable_threads = xyes; then
 		thread_file='posix'
 		tmake_file="${tmake_file} t-openbsd-thread"
@@ -578,10 +588,12 @@ alpha*-*-netbsd*)
 	;;
 
 alpha*-*-openbsd*)
-	tm_file="${cpu_type}/${cpu_type}.h ${tm_file}"
+ 	tm_file="alpha/alpha.h alpha/elf.h alpha/openbsd1.h openbsd.h ${tm_file}"
+	tm_file="${tm_file} exec-stack.h"
 	# default x-alpha is only appropriate for dec-osf.
 	target_cpu_default="MASK_GAS"
 	tmake_file="alpha/t-alpha alpha/t-ieee"
+	gas=yes gnu_ld=yes
 	;;
 
 alpha*-dec-osf[45]*)
@@ -691,6 +703,11 @@ arm*-*-netbsdelf*)
 	tm_file="dbxelf.h elfos.h netbsd.h netbsd-elf.h arm/elf.h arm/aout.h arm/arm.h arm/netbsd-elf.h"
 	tmake_file="${tmake_file} arm/t-netbsd"
 	;;
+arm*-*-openbsd*)
+	tm_file="dbxelf.h elfos.h arm/openbsd1.h arm/elf.h arm/aout.h arm/arm.h openbsd.h ${tm_file}"
+	tm_file="${tm_file} exec-stack.h"
+	tmake_file="${tmake_file} arm/t-openbsd"
+	;;
 arm*-*-netbsd*)
 	tm_file="arm/aout.h arm/arm.h netbsd.h netbsd-aout.h arm/netbsd.h"
 	tmake_file="t-netbsd arm/t-netbsd"
@@ -818,12 +835,13 @@ hppa*-*-linux* | parisc*-*-linux*)
 	tmake_file="t-slibgcc-elf-ver t-linux pa/t-linux"
 	;;
 hppa*-*-openbsd*)
-	target_cpu_default="MASK_PA_11"
-	tmake_file=pa/t-bsd
+	target_cpu_default="MASK_PA_11 | MASK_NO_SPACE_REGS"
+	tmake_file="t-libc-ok t-openbsd t-openbsd-thread pa/t-openbsd"
 	;;
 hppa1.1-*-pro*)
 	target_cpu_default="(MASK_JUMP_IN_DELAY | MASK_PORTABLE_RUNTIME | MASK_GAS | MASK_NO_SPACE_REGS | MASK_SOFT_FLOAT)"
 	tm_file="${tm_file} pa/pa32-regs.h dbxelf.h elfos.h pa/elf.h pa/pa-pro-end.h libgloss.h"
+	tm_file="${tm_file} exec-stack.h"
 	tmake_file="pa/t-bsd pa/t-pro"
 	xmake_file="pa/x-ada"
 	;;
@@ -1142,13 +1160,28 @@ i[34567]86-*-netbsd*)
 x86_64-*-netbsd*)
 	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/x86-64.h i386/netbsd64.h"
 	;;
-i[34567]86-*-openbsd*)
+i[34567]86-*-openbsd2* | i[34567]86-*-openbsd3.[0123])
 	tm_file="${cpu_type}/${cpu_type}.h i386/unix.h i386/bsd.h i386/gas.h i386/gstabs.h openbsd-oldgas.h openbsd.h ${tm_file}"
 	# needed to unconfuse gdb
 	tmake_file="t-libc-ok t-openbsd i386/t-openbsd"
 	# we need collect2 until our bug is fixed...
 	use_collect2=yes
 	;;
+i[34567]86-*-openbsd*)
+	# needed to unconfuse gdb
+	tmake_file="t-libc-ok t-openbsd i386/t-openbsd"
+	tm_file="${cpu_type}/${cpu_type}.h i386/unix.h i386/att.h dbxelf.h elfos.h i386/i386elf.h"
+	tm_file="${tm_file} exec-stack.h"
+	tm_file="${tm_file} openbsd.h openbsd-libpthread.h i386/openbsdelf.h"
+	gas=yes
+	gnu_ld=yes
+	stabs=yes
+  	;;
+x86_64-*-openbsd*)
+	tm_file="i386/biarch64.h i386/i386.h i386/unix.h i386/att.h dbxelf.h elfos.h openbsd.h openbsd-libpthread.h i386/x86-64.h i386/openbsd64.h"
+	tm_file="${tm_file} exec-stack.h"
+	tmake_file="t-libc-ok t-openbsd i386/t-openbsd"
+	;;
 i[34567]86-*-coff*)
 	tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/i386-coff.h"
 	;;
@@ -1711,6 +1744,7 @@ m68k*-*-openbsd*)
 	tmake_file="t-libc-ok t-openbsd m68k/t-openbsd"
 	# we need collect2 until our bug is fixed...
 	use_collect2=yes
+	tm_file="${tm_file} exec-stack.h"
 	;;
 m68k-*-sysv4*)			# Motorola m68k's running system V.4
 	tm_file=m68k/m68kv4.h
@@ -1762,6 +1796,7 @@ m88k-*-aout*)
 m88k-*-openbsd*)
 	tmake_file="${tmake_file} m88k/t-luna-gas"
 	tm_file="m88k/aout-dbx.h aoutos.h m88k/m88k.h openbsd.h ${tm_file}"
+	tm_file="${tm_file} exec-stack.h"
 	;;
 m88k-*-sysv4*)
 	xm_defines=POSIX
@@ -1893,13 +1928,19 @@ mips*-*-linux*)				# Linux MIPS, either endian.
         esac
 	tmake_file="t-slibgcc-elf-ver t-linux mips/t-linux"
 	;;
-mips*el-*-openbsd*)	# mips little endian
+mips*-*-openbsd*)
 	target_cpu_default="MASK_GAS|MASK_ABICALLS"
+	tm_file="elfos.h ${tm_file}"
+	case $machine in
+        mips64*-*)
+		tm_defines="MIPS_ISA_DEFAULT=3 MIPS_ABI_DEFAULT=ABI_64"
+		tmake_file="mips/t-openbsd64"
+		;;
+        mips*-*)
+		tm_defines="MIPS_ISA_DEFAULT=3 MIPS_ABI_DEFAULT=ABI_N32"
+		;;
+	esac
 	;;
-mips*-*-openbsd*)		# mips big endian
-	target_cpu_default="MASK_GAS|MASK_ABICALLS"
-	tm_file="mips/openbsd-be.h ${tm_file}"
-	;;
 mips-*-ecoff* | mipsel-*-ecoff*)
 	if test x$stabs = xyes; then
 		tm_file="${tm_file} dbx.h"
@@ -2016,8 +2057,9 @@ romp-*-openbsd*)
 	# Nothing special
 	;;
 powerpc-*-openbsd*)
-	tmake_file="${tmake_file} rs6000/t-rs6000 rs6000/t-openbsd"
-	extra_headers=
+	tm_file="rs6000/rs6000.h rs6000/openbsd1.h dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h openbsd.h ${tm_file}"
+	tmake_file="${tmake_file} rs6000/t-ppcos rs6000/t-openbsd"
+	tm_file="${tm_file} exec-stack.h"
 	;;
 powerpc64-*-linux*)
 	tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/linux64.h"
@@ -2397,17 +2439,21 @@ sparc-*-netbsd*)
 	use_collect2=yes
 	;;
 sparc-*-openbsd*)
-	tm_file="sparc/sparc.h ${tm_file}"
+	tm_file="sparc/sparc.h elfos.h svr4.h sparc/sysv4.h ${tm_file}"
+	tm_file="${tm_file} exec-stack.h"
 	# needed to unconfuse gdb
 	tmake_file="t-libc-ok t-openbsd sparc/t-openbsd"
 	# we need collect2 until our bug is fixed...
+	gas=yes gnu_ld=yes
 	use_collect2=yes
 	;;
 sparc64-*-openbsd*)
-	tm_file="sparc/openbsd1-64.h sparc/sparc.h elfos.h svr4.h sparc/sysv4.h sparc/sol2.h sparc/sp64-elf.h openbsd.h sparc/openbsd64.h"
+	tm_file="sparc/openbsd1-64.h sparc/sparc.h elfos.h svr4.h sparc/sysv4.h sparc/sp64-elf.h openbsd.h ${openbsd_libspec} sparc/openbsd64.h"
+	tm_file="${tm_file} exec-stack.h"
 	xm_file=sparc/xm-sp64.h
 	gas=yes gnu_ld=yes
 	with_cpu=ultrasparc
+	float_format=i128
 	;;
 sparc-*-bsd*)
 	tm_file="${tm_file} sparc/bsd.h"
@@ -2717,6 +2763,7 @@ vax-*-netbsd*)
 	;;
 vax-*-openbsd*)
 	tm_file="vax/vax.h vax/openbsd1.h openbsd.h ${tm_file}"
+	tm_file="${tm_file} exec-stack.h"
 	use_collect2=yes
 	;;
 vax-*-ultrix*)			# VAXen running ultrix
