Permalink
Browse files

add gcc 4.6 WIP

  • Loading branch information...
1 parent 8b4aecb commit 0e7c01821600e51cfe3fc9edcae9c2700645bc23 Pascal Stumpf committed Nov 13, 2011
Showing with 2,726 additions and 0 deletions.
  1. +209 −0 lang/gcc/4.6/Makefile
  2. +12 −0 lang/gcc/4.6/TODO
  3. +5 −0 lang/gcc/4.6/distinfo
  4. +74 −0 lang/gcc/4.6/gcc4.port.mk
  5. +33 −0 lang/gcc/4.6/patches/patch-boehm-gc_Makefile_in
  6. +40 −0 lang/gcc/4.6/patches/patch-boehm-gc_configure
  7. +48 −0 lang/gcc/4.6/patches/patch-boehm-gc_dyn_load_c
  8. +13 −0 lang/gcc/4.6/patches/patch-boehm-gc_include_gc_config_h_in
  9. +14 −0 lang/gcc/4.6/patches/patch-boehm-gc_include_gc_config_macros_h
  10. +21 −0 lang/gcc/4.6/patches/patch-boehm-gc_include_gc_pthread_redirects_h
  11. +328 −0 lang/gcc/4.6/patches/patch-boehm-gc_include_private_gcconfig_h
  12. +16 −0 lang/gcc/4.6/patches/patch-boehm-gc_include_private_openbsd_stop_world_h
  13. +21 −0 lang/gcc/4.6/patches/patch-boehm-gc_mach_dep_c
  14. +188 −0 lang/gcc/4.6/patches/patch-boehm-gc_openbsd_stop_world_c
  15. +184 −0 lang/gcc/4.6/patches/patch-boehm-gc_os_dep_c
  16. +13 −0 lang/gcc/4.6/patches/patch-boehm-gc_pthread_stop_world_c
  17. +22 −0 lang/gcc/4.6/patches/patch-boehm-gc_pthread_support_c
  18. +13 −0 lang/gcc/4.6/patches/patch-boehm-gc_tests_test_c
  19. +13 −0 lang/gcc/4.6/patches/patch-boehm-gc_threadlibs_c
  20. +109 −0 lang/gcc/4.6/patches/patch-gcc_c-family_c-format_c
  21. +32 −0 lang/gcc/4.6/patches/patch-gcc_config_alpha_alpha_c
  22. +13 −0 lang/gcc/4.6/patches/patch-gcc_config_alpha_alpha_md
  23. +17 −0 lang/gcc/4.6/patches/patch-gcc_config_alpha_alpha_opt
  24. +60 −0 lang/gcc/4.6/patches/patch-gcc_config_alpha_openbsd_h
  25. +44 −0 lang/gcc/4.6/patches/patch-gcc_config_exec-stack_h
  26. +31 −0 lang/gcc/4.6/patches/patch-gcc_config_gcc
  27. +13 −0 lang/gcc/4.6/patches/patch-gcc_config_host
  28. +111 −0 lang/gcc/4.6/patches/patch-gcc_config_host-openbsd_c
  29. +125 −0 lang/gcc/4.6/patches/patch-gcc_config_i386_openbsd64_h
  30. +25 −0 lang/gcc/4.6/patches/patch-gcc_config_i386_openbsd_h
  31. +13 −0 lang/gcc/4.6/patches/patch-gcc_config_i386_openbsdelf_h
  32. +33 −0 lang/gcc/4.6/patches/patch-gcc_config_openbsd-libpthread_h
  33. +28 −0 lang/gcc/4.6/patches/patch-gcc_config_rs6000_openbsd1_h
  34. +136 −0 lang/gcc/4.6/patches/patch-gcc_config_rs6000_openbsd_h
  35. +59 −0 lang/gcc/4.6/patches/patch-gcc_config_rs6000_t-openbsd
  36. +12 −0 lang/gcc/4.6/patches/patch-gcc_config_t-openbsd
  37. +8 −0 lang/gcc/4.6/patches/patch-gcc_config_x-openbsd
  38. +12 −0 lang/gcc/4.6/patches/patch-gcc_cp_g++spec_c
  39. +17 −0 lang/gcc/4.6/patches/patch-gcc_testsuite_gcc_dg_format_format_h
  40. +12 −0 lang/gcc/4.6/patches/patch-gcc_unwind-dw2-fde-glibc_c
  41. +14 −0 lang/gcc/4.6/patches/patch-gcc_unwind-dw2-fde-openbsd_c
  42. +51 −0 lang/gcc/4.6/patches/patch-gcc_unwind-dw2_c
  43. +26 −0 lang/gcc/4.6/patches/patch-libffi_Makefile_in
  44. +13 −0 lang/gcc/4.6/patches/patch-libffi_configure
  45. +12 −0 lang/gcc/4.6/patches/patch-libffi_include_Makefile_in
  46. +12 −0 lang/gcc/4.6/patches/patch-libgcc_config_host
  47. +13 −0 lang/gcc/4.6/patches/patch-libgfortran_Makefile_in
  48. +55 −0 lang/gcc/4.6/patches/patch-libjava_Makefile_in
  49. +12 −0 lang/gcc/4.6/patches/patch-libjava_configure
  50. +16 −0 lang/gcc/4.6/patches/patch-libjava_configure_host
  51. +13 −0 lang/gcc/4.6/patches/patch-libjava_libltdl_configure
  52. +12 −0 lang/gcc/4.6/patches/patch-libmudflap_mf-runtime_h
  53. +26 −0 lang/gcc/4.6/patches/patch-libobjc_Makefile_in
  54. +15 −0 lang/gcc/4.6/patches/patch-libssp_Makefile_in
  55. +14 −0 lang/gcc/4.6/patches/patch-libstdc++-v3_configure
  56. +21 −0 lang/gcc/4.6/patches/patch-libstdc++-v3_libsupc++_Makefile_in
  57. +39 −0 lang/gcc/4.6/patches/patch-libstdc++-v3_src_Makefile_in
  58. +16 −0 lang/gcc/4.6/patches/patch-libtool_m4
  59. +12 −0 lang/gcc/DESCR
  60. +12 −0 lang/gcc/DESCR-ada
  61. +12 −0 lang/gcc/DESCR-c++
  62. +12 −0 lang/gcc/DESCR-estdc
  63. +12 −0 lang/gcc/DESCR-f95
  64. +12 −0 lang/gcc/DESCR-g77
  65. +12 −0 lang/gcc/DESCR-go
  66. +12 −0 lang/gcc/DESCR-java
  67. +12 −0 lang/gcc/DESCR-objc
  68. +12 −0 lang/gcc/Makefile
  69. +49 −0 lang/gcc/Makefile.inc
View
209 lang/gcc/4.6/Makefile
@@ -0,0 +1,209 @@
+# $OpenBSD: Makefile,v 1.66 2011/10/04 07:08:54 espie Exp $
+
+ONLY_FOR_ARCHS = alpha i386 m68k sparc sparc64 powerpc vax amd64
+#BROKEN=adjust for types changes
+
+V = 4.6.2
+FULL_VERSION = $V
+FULL_PKGVERSION = $V
+BOOTSTRAP_GEN = 3
+# XXX this needs libc.so.53.0 to build on i386
+#ADASTRAP = adastrap-i386-$V-${BOOTSTRAP_GEN}.tgz
+
+PKGNAME-main = gcc-${FULL_PKGVERSION}
+PKGNAME-c++ = g++-${FULL_PKGVERSION}
+PKGNAME-estdc = libstdc++-${FULL_PKGVERSION}
+PKGNAME-f95 = g95-${FULL_PKGVERSION}
+PKGNAME-java = gcj-${FULL_PKGVERSION}
+PKGNAME-objc = gobjc-${FULL_PKGVERSION}
+PKGNAME-ada = gnat-${FULL_PKGVERSION}
+#PKGNAME-go = gccgo-${FULL_PKGVERSION}
+
+SHARED_LIBS = estdc++ 11.0 \
+ gfortran 2.0 \
+ -org-w3c-dom 1.0 \
+ -org-xml-sax 1.0 \
+ gcj 0.0 \
+ ffi 0.0 \
+ gcj-tools 0.0 \
+ gij 0.0 \
+ objc 2.0 \
+ objc_gc 2.0 \
+ ssp 0.0 \
+ gomp 1.0
+
+USE_GROFF = Yes
+PSEUDO_FLAVORS = no_c++ no_f95 no_objc no_java no_ada
+FLAVOR ?=
+
+ONLY_FOR_ARCHS-ada = i386
+ONLY_FOR_ARCHS-java = amd64 sparc64 i386
+#ONLY_FOR_ARCHS-go = amd64 i386 # XXX
+
+MULTI_PACKAGES = -main -f95 -objc -java -c++ -estdc -ada
+
+.include <bsd.port.arch.mk>
+
+# kill both C++ subpackages
+.if !${BUILD_PACKAGES:M-c++}
+BUILD_PACKAGES := ${BUILD_PACKAGES:N-estdc}
+.endif
+
+DISTFILES = ${DISTNAME}.tar.bz2
+SUPDISTFILES = ${ADASTRAP}:0
+
+#BUILD_DEPENDS += devel/autoconf/2.64
+#BUILD_DEPENDS += devel/metaauto
+USE_LIBTOOL = Yes
+
+BUILD_DEPENDS += devel/bison
+
+
+REGRESS_DEPENDS = devel/dejagnu \
+ devel/autogen
+
+DISTNAME = gcc-${FULL_VERSION}
+
+
+MASTER_SITES = ${MASTER_SITE_GCC:=releases/gcc-$(FULL_VERSION)/}
+MASTER_SITES0 = ftp://quatramaran.ens.fr/pub/espie/
+
+CONFIGURE_STYLE = gnu
+MODGNU_CONFIG_GUESS_DIRS = ${WRKSRC} ${WRKSRC}/gcc
+
+LANGS = c
+.if ${BUILD_PACKAGES:M-c++}
+LANGS := ${LANGS},c++
+REGRESS_DEPENDS += libstdc++->=4.6,<4.7:${BUILD_PKGPATH},-estdc
+.endif
+.if ${BUILD_PACKAGES:M-f95}
+LANGS := ${LANGS},fortran
+CONFIGURE_ARGS += --with-gmp=${LOCALBASE}
+.endif
+.if ${BUILD_PACKAGES:M-objc}
+LANGS := ${LANGS},objc
+.endif
+.if ${BUILD_PACKAGES:M-java}
+LANGS := ${LANGS},java
+BUILD_DEPENDS += archivers/zip>=2.3p0
+CONFIGURE_ARGS += --enable-libgcj
+.endif
+.if ${BUILD_PACKAGES:M-ada}
+LANGS := ${LANGS},ada
+DISTFILES += ${ADASTRAP}:0
+CONFIGURE_ENV = ADAC=${WRKDIR}/bin/egcc GNATBIND=${WRKDIR}/bin/gnatbind
+MAKE_ENV = ADAC=${WRKDIR}/bin/egcc GNATBIND=${WRKDIR}/bin/gnatbind
+CC = ${WRKDIR}/bin/egcc
+REGRESS_DEPENDS += ${BUILD_PKGPATH},-ada
+.endif
+#.if ${BUILD_PACKAGES:M-go}
+#LANGS := ${LANGS},go
+#.endif
+
+post-extract:
+.for f in egcc gnatbind gnatmake gnatlink
+ echo "#! /bin/sh" >${WRKDIR}/bin/$f
+ echo 'GNAT_ROOT=${WRKDIR}/bootstrap GCC_ROOT=${WRKDIR}/bootstrap exec ${WRKDIR}/bootstrap/bin/$f "$$@"' >>${WRKDIR}/bin/$f
+ chmod a+x ${WRKDIR}/bin/$f
+.endfor
+ ln -s /usr/bin/nm ${WRKDIR}/bin/enm
+ echo "# This file automatically generated" >> ${WRKSRC}/libversions
+.for l v in ${SHARED_LIBS}
+ echo "LIB$l_LTVERSION = -version-info ${v:S/./:/}" >> ${WRKSRC}/libversions
+.endfor
+
+post-install:
+.if ${BUILD_PACKAGES:M-ada}
+ chown -R ${SHAREOWN}:${SHAREGRP} ${PREFIX}/lib/gcc/*/$V/adainclude
+ chown -R ${SHAREOWN}:${SHAREGRP} ${PREFIX}/lib/gcc/*/$V/adalib
+.endif
+ chown -R ${SHAREOWN}:${SHAREGRP} ${PREFIX}/lib/gcc/*/$V/include
+CONFIGURE_ENV += am_cv_func_iconv=no
+CONFIGURE_ENV += ac_cv_prog_CONFIGURED_M4=/usr/bin/m4
+
+# Note: the configure target passes CFLAGS to the configure script anyways.
+
+CFLAGS = -O2 -g
+
+
+CONFIGURE_ARGS += \
+ --verbose \
+ --program-transform-name=s,^,e, \
+ --disable-nls \
+ --disable-checking \
+ --with-system-zlib \
+ --disable-libmudflap \
+ --disable-libgomp \
+ --disable-tls \
+ --with-as=/usr/bin/as \
+ --with-ld=/usr/bin/ld \
+ --with-gnu-ld \
+ --with-gnu-as \
+ --enable-threads=posix \
+ --enable-wchar_t \
+ --enable-languages=${LANGS}
+
+# This is needed, as internal cpp is no longer compatible with the
+# visible beast
+CONFIGURE_ARGS += --enable-cpp
+
+CONFIGURE_ARGS += ${CONFIGURE_SHARED}
+
+#post-patch:
+# cd ${WRKDIST}/libstdc++-v3 && AUTOCONF_VERSION=2.64 autoconf
+
+SEPARATE_BUILD = flavored
+
+USE_GMAKE = yes
+
+# you shouldn't skip bootstrap unless you know what you're doing
+# use bootstrap-lean if you're pressed for space
+ALL_TARGET = bootstrap
+
+MAKE_FLAGS = libstdc___la_LDFLAGS='-version-info 31:0:0 -lm'
+
+
+.if ${MACHINE_ARCH} == "m68k" || ${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "amd64"
+PKG_ARGS += -DPIC=1
+.else
+PKG_ARGS += -DPIC=0
+.endif
+
+.if ${MACHINE_ARCH} == "powerpc"
+PKG_ARGS += -DPPC=1
+.else
+PKG_ARGS += -DPPC=0
+.endif
+.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
+PKG_ARGS += -DI386=1
+.else
+PKG_ARGS += -DI386=0
+.endif
+
+RUN_DEPENDS = gcc-${FULL_PKGVERSION}:${BUILD_PKGPATH}
+WANTLIB = c
+
+RUN_DEPENDS-main =
+RUN_DEPENDS-estdc =
+RUN_DEPENDS-java =
+
+RUN_DEPENDS-c++ = ${RUN_DEPENDS} libstdc++->=4.6,<4.7:${BUILD_PKGPATH},-estdc
+WANTLIB-estdc = c m
+WANTLIB-java = c m pthread z
+
+LIB_DEPENDS-f95 = devel/gmp>=4.2 \
+ devel/mpfr \
+ devel/libmpc
+WANTLIB-f95 = ${WANTLIB} gmp mpc mpfr
+.include <bsd.port.mk>
+
+ADA_PACKAGE = ${PACKAGE_REPOSITORY}/i386/all/${PKGNAME-ada}${PKG_SUFX}
+GCC_PACKAGE = ${PACKAGE_REPOSITORY}/i386/all/${PKGNAME-main}${PKG_SUFX}
+
+adastrap: ${ADA_PACKAGE} ${GCC_PACKAGE}
+ mkdir -p ${WRKDIR}/prepare/bootstrap
+ cd ${WRKDIR}/prepare/bootstrap && tar zxf ${ADA_PACKAGE}
+ cd ${WRKDIR}/prepare/bootstrap && tar zxf ${GCC_PACKAGE}
+ rm -rf ${WRKDIR}/prepare/bootstrap/{+*,info,man}
+ cd ${WRKDIR}/prepare && tar zcf ${FULLDISTDIR}/${ADASTRAP} bootstrap
+
View
12 lang/gcc/4.6/TODO
@@ -0,0 +1,12 @@
+- PCH support (yeah right, mmap is broken ...)
+ http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39618
+- test all arches (alpha will probably break, hppa didn't work for 4.2.4)
+- ada
+- go?
+- (sub)packaging
+- build as non-root (install -o root ... at build stage, ugh)
+- gcj-dbtool hangs on amd64, needs to be killed
+ apparently, threads and signal handling are to blame:
+ https://bugzilla.redhat.com/show_bug.cgi?id=179002
+ https://bugzilla.redhat.com/show_bug.cgi?id=179228
+ https://bugzilla.redhat.com/show_bug.cgi?id=180567
View
5 lang/gcc/4.6/distinfo
@@ -0,0 +1,5 @@
+MD5 (gcc/gcc-4.6.2.tar.bz2) = AoEVxPv7bP111jafSpDYfg==
+RMD160 (gcc/gcc-4.6.2.tar.bz2) = 5wQZM7OWKflSSEjc+BoaTAKiJcY=
+SHA1 (gcc/gcc-4.6.2.tar.bz2) = aRl0YTscHxXtAYLsU5+lShLdb5M=
+SHA256 (gcc/gcc-4.6.2.tar.bz2) = YLBUY9/hjUDWj7inGyW0CKAfhsxs6vXmsiI4trD0UMI=
+SIZE (gcc/gcc-4.6.2.tar.bz2) = 71995338
View
74 lang/gcc/4.6/gcc4.port.mk
@@ -0,0 +1,74 @@
+# $OpenBSD: gcc4.port.mk,v 1.14 2011/09/15 17:25:35 espie Exp $
+
+MODGCC4_ARCHES?=
+MODGCC4_LANGS?=
+
+
+.if ${MODGCC4_LANGS:L} != "java" && !${MODGCC4_LANGS:L:Mc}
+# Always include support for this
+# unless only java is needed
+MODGCC4_LANGS+= c
+.endif
+
+_MODGCC4_OKAY = c c++ java fortran
+.for _l in ${MODGCC4_LANGS:L}
+. if !${_MODGCC4_OKAY:M${_l}}
+ERRORS += "Fatal: unknown language ${_l}"
+. endif
+.endfor
+
+_MODGCC4_ARCH_USES = No
+
+.if ${MODGCC4_ARCHES:L} != ""
+. for _i in ${MODGCC4_ARCHES}
+. if !empty(MACHINE_ARCH:M${_i})
+_MODGCC4_ARCH_USES = Yes
+. endif
+. endfor
+.endif
+
+COMPILER_VERSION ?= gcc2
+
+_MODGCC4_LINKS =
+.if ${_MODGCC4_ARCH_USES:L} == "yes"
+
+. if ${MODGCC4_LANGS:L:Mc} && ${COMPILER_VERSION:L:Ngcc4*}
+BUILD_DEPENDS += gcc->=4.6,<4.7:lang/gcc/4.6
+_MODGCC4_LINKS += egcc gcc egcc cc
+. endif
+
+. if ${MODGCC4_LANGS:L:Mc++}
+. if ${COMPILER_VERSION:L:Mgcc4*}
+MODGCC4STDCPP = stdc++
+WANTLIB += stdc++>=53.0
+. else
+BUILD_DEPENDS += g++->=4.6,<4.7:lang/gcc/4.6,-c++
+MODGCC4STDCPP = estdc++
+LIB_DEPENDS += libstdc++->=4.6,<4.7:lang/gcc/4.6,-estdc
+WANTLIB += estdc++>=7
+_MODGCC4_LINKS += eg++ g++ eg++ c++
+. endif
+. endif
+
+. if ${MODGCC4_LANGS:L:Mfortran}
+BUILD_DEPENDS += g95->=4.6,<4.7:lang/gcc/4.6,-f95
+WANTLIB += gfortran>=2
+LIB_DEPENDS += g95->=4.6,<4.7:lang/gcc/4.6,-f95
+_MODGCC4_LINKS += egfortran gfortran
+. endif
+
+. if ${MODGCC4_LANGS:L:Mjava}
+BUILD_DEPENDS += gcj->=4.6,<4.7:lang/gcc/4.6,-java
+MODGCC4_GCJWANTLIB = gcj
+MODGCC4_GCJLIBDEP = gcj->=4.6,<4.7:lang/gcc/4.6,-java
+_MODGCC4_LINKS += egcj gcj egcjh gcjh ejar gjar egij gij
+. endif
+
+.endif
+
+.if !empty(_MODGCC4_LINKS)
+. for _src _dest in ${_MODGCC4_LINKS}
+MODGCC4_post-patch += ln -sf ${LOCALBASE}/bin/${_src} ${WRKDIR}/bin/${_dest};
+. endfor
+.endif
+
View
33 lang/gcc/4.6/patches/patch-boehm-gc_Makefile_in
@@ -0,0 +1,33 @@
+$OpenBSD$
+--- boehm-gc/Makefile.in.orig Sat Nov 12 10:20:15 2011
++++ boehm-gc/Makefile.in Sat Nov 12 10:23:12 2011
+@@ -64,6 +64,7 @@ CONFIG_CLEAN_VPATH_FILES =
+ LTLIBRARIES = $(noinst_LTLIBRARIES)
+ am__DEPENDENCIES_1 =
+ @POWERPC_DARWIN_TRUE@am__objects_1 = powerpc_darwin_mach_dep.lo
++@OPENBSD_THREADS_TRUE@am__objects_1 = openbsd_stop_world.lo
+ am_libgcjgc_la_OBJECTS = allchblk.lo alloc.lo blacklst.lo checksums.lo \
+ dbg_mlc.lo dyn_load.lo finalize.lo gc_dlopen.lo gcj_mlc.lo \
+ headers.lo malloc.lo mallocx.lo mark.lo mark_rts.lo misc.lo \
+@@ -209,6 +210,8 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
+ PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
++OPENBSD_THREADS_FALSE = @OPENBSD_THREADS_FALSE@
++OPENBSD_THREADS_TRUE = @OPENBSD_THREADS_TRUE@
+ RANLIB = @RANLIB@
+ SED = @SED@
+ SET_MAKE = @SET_MAKE@
+@@ -287,8 +290,11 @@ AUTOMAKE_OPTIONS = cygnus subdir-objects
+ ACLOCAL_AMFLAGS = -I .. -I ../config
+ SUBDIRS = include
+ noinst_LTLIBRARIES = libgcjgc.la libgcjgc_convenience.la
+-@POWERPC_DARWIN_FALSE@asm_libgcjgc_sources =
+ @POWERPC_DARWIN_TRUE@asm_libgcjgc_sources = powerpc_darwin_mach_dep.s
++@OPENBSD_THREADS_TRUE@asm_libgcjgc_sources = openbsd_stop_world.c.s
++libgcjgc_la_SOURCES = allchblk.c alloc.c blacklst.c checksums.c dbg_mlc.c \
++dyn_load.c finalize.c gc_dlopen.c gcj_mlc.c headers.c \
++malloc.c mallocx.c mark.c mark_rts.c misc.c new_hblk.c \
+ libgcjgc_la_SOURCES = allchblk.c alloc.c blacklst.c checksums.c dbg_mlc.c \
+ dyn_load.c finalize.c gc_dlopen.c gcj_mlc.c headers.c \
+ malloc.c mallocx.c mark.c mark_rts.c misc.c new_hblk.c \
View
40 lang/gcc/4.6/patches/patch-boehm-gc_configure
@@ -0,0 +1,40 @@
+$OpenBSD$
+--- boehm-gc/configure.orig Sat Nov 12 09:45:26 2011
++++ boehm-gc/configure Sat Nov 12 09:53:37 2011
+@@ -14855,6 +14855,12 @@ $as_echo "#define _REENTRANT 1" >>confdefs.h
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"Only HP-UX 11 POSIX threads are supported.\"" >&5
+ $as_echo "$as_me: WARNING: \"Only HP-UX 11 POSIX threads are supported.\"" >&2;}
+ ;;
++ *-*-openbsd*)
++ $as_echo "#define GC_OPENBSD_THREADS 1" >>confdefs.h
++ THREADDLLIBS=-pthread
++ INCLUDES="$INCLUDES -pthread"
++ openbsd_threads=true
++ ;;
+ *-*-kfreebsd*-gnu)
+ $as_echo "#define GC_FREEBSD_THREADS 1" >>confdefs.h
+
+@@ -14995,6 +15001,13 @@ else
+ POWERPC_DARWIN_FALSE=
+ fi
+
++if test x$openbsd_threads = xtrue; then
++ OPENBSD_THREADS_TRUE=
++ OPENBSD_THREADS_FALSE='#'
++else
++ OPENBSD_THREADS_TRUE='#'
++ OPENBSD_THREADS_FALSE=
++fi
+
+ # Darwin needs a few extra special tests to deal with variation in the
+ # system headers.
+@@ -15294,6 +15307,9 @@ $as_echo "#define DATASTART_IS_ETEXT 1" >>confdefs.h
+ ;;
+ sparc-*-netbsd*)
+ machdep="sparc_netbsd_mach_dep.lo"
++ ;;
++ sparc*-*-openbsd*)
++ machdep="sparc_mach_dep.lo"
+ ;;
+ sparc-sun-solaris2.3)
+ machdep="sparc_mach_dep.lo"
View
48 lang/gcc/4.6/patches/patch-boehm-gc_dyn_load_c
@@ -0,0 +1,48 @@
+$OpenBSD$
+--- boehm-gc/dyn_load.c.orig Sat Nov 12 09:53:59 2011
++++ boehm-gc/dyn_load.c Sat Nov 12 10:28:04 2011
+@@ -60,6 +60,7 @@
+ !defined(HPUX) && !(defined(LINUX) && defined(__ELF__)) && \
+ !defined(RS6000) && !defined(SCO_ELF) && !defined(DGUX) && \
+ !(defined(FREEBSD) && defined(__ELF__)) && \
++ !(defined(OPENBSD) && defined(__ELF__)) && \
+ !(defined(NETBSD) && defined(__ELF__)) && !defined(HURD) && \
+ !defined(DARWIN)
+ --> We only know how to find data segments of dynamic libraries for the
+@@ -90,9 +91,9 @@
+
+ #if defined(LINUX) && defined(__ELF__) || defined(SCO_ELF) || \
+ (defined(FREEBSD) && defined(__ELF__)) || defined(DGUX) || \
++ (defined(OPENBSD) && defined(__ELF__)) || \
+ (defined(NETBSD) && defined(__ELF__)) || defined(HURD)
+ # include <stddef.h>
+-# include <elf.h>
+ # include <link.h>
+ #endif
+
+@@ -106,7 +107,7 @@
+ # define ElfW(type) Elf64_##type
+ # endif
+ # else
+-# ifdef NETBSD
++# if defined(NETBSD) || defined(OPENBSD)
+ # if ELFSIZE == 32
+ # define ElfW(type) Elf32_##type
+ # else
+@@ -301,6 +302,7 @@ void GC_register_dynamic_libraries()
+
+ #if defined(LINUX) && defined(__ELF__) || defined(SCO_ELF) || \
+ (defined(FREEBSD) && defined(__ELF__)) || defined(DGUX) || \
++ (defined(OPENBSD) && defined(__ELF__)) || \
+ (defined(NETBSD) && defined(__ELF__)) || defined(HURD)
+
+
+@@ -492,7 +494,7 @@ GC_bool GC_register_main_static_data()
+ /* This doesn't necessarily work in all cases, e.g. with preloaded
+ * dynamic libraries. */
+
+-#if defined(NETBSD)
++#if defined(NETBSD) || defined(OPENBSD)
+ # include <sys/exec_elf.h>
+ /* for compatibility with 1.4.x */
+ # ifndef DT_DEBUG
View
13 lang/gcc/4.6/patches/patch-boehm-gc_include_gc_config_h_in
@@ -0,0 +1,13 @@
+$OpenBSD$
+--- boehm-gc/include/gc_config.h.in.orig Sat Nov 12 09:58:20 2011
++++ boehm-gc/include/gc_config.h.in Sat Nov 12 09:58:43 2011
+@@ -30,6 +30,9 @@
+ /* support FreeBSD threads */
+ #undef GC_FREEBSD_THREADS
+
++/* support OpenBSD threads */
++#undef GC_OPENBSD_THREADS
++
+ /* include support for gcj */
+ #undef GC_GCJ_SUPPORT
+
View
14 lang/gcc/4.6/patches/patch-boehm-gc_include_gc_config_macros_h
@@ -0,0 +1,14 @@
+$OpenBSD$
+--- boehm-gc/include/gc_config_macros.h.orig Sat Nov 12 09:56:59 2011
++++ boehm-gc/include/gc_config_macros.h Sat Nov 12 09:57:55 2011
+@@ -55,6 +55,10 @@
+ # define GC_FREEBSD_THREADS
+ # define GC_PTHREADS
+ # endif
++# if !defined(GC_PTHREADS) && defined(__OpenBSD__)
++# define GC_FREEBSD_THREADS
++# define GC_PTHREADS
++# endif
+ # if defined(DGUX) && (defined(i386) || defined(__i386__))
+ # define GC_DGUX386_THREADS
+ # define GC_PTHREADS
View
21 lang/gcc/4.6/patches/patch-boehm-gc_include_gc_pthread_redirects_h
@@ -0,0 +1,21 @@
+$OpenBSD$
+--- boehm-gc/include/gc_pthread_redirects.h.orig Sat Nov 12 09:59:52 2011
++++ boehm-gc/include/gc_pthread_redirects.h Sat Nov 12 10:01:19 2011
+@@ -52,7 +52,7 @@
+ int GC_pthread_create(pthread_t *new_thread,
+ const pthread_attr_t *attr,
+ void *(*start_routine)(void *), void *arg);
+-#ifndef GC_DARWIN_THREADS
++#if !defined(GC_DARWIN_THREADS) && !defined(GC_OPENBSD_THREADS)
+ int GC_pthread_sigmask(int how, const sigset_t *set, sigset_t *oset);
+ #endif
+ int GC_pthread_join(pthread_t thread, void **retval);
+@@ -72,7 +72,7 @@
+ # define pthread_join GC_pthread_join
+ # define pthread_detach GC_pthread_detach
+
+-#ifndef GC_DARWIN_THREADS
++#if !defined(GC_DARWIN_THREADS) && !defined(GC_OPENBSD_THREADS)
+ # define pthread_sigmask GC_pthread_sigmask
+ # define dlopen GC_dlopen
+ #endif
View
328 lang/gcc/4.6/patches/patch-boehm-gc_include_private_gcconfig_h
@@ -0,0 +1,328 @@
+$OpenBSD$
+--- boehm-gc/include/private/gcconfig.h.orig Sat Nov 12 10:01:29 2011
++++ boehm-gc/include/private/gcconfig.h Sat Nov 12 10:17:43 2011
+@@ -62,7 +62,7 @@
+ /* Determine the machine type: */
+ # if defined(__arm__) || defined(__thumb__)
+ # define ARM32
+-# if !defined(LINUX) && !defined(NETBSD)
++# if !defined(LINUX) && !defined(NETBSD) && !defined(OPENBSD)
+ # define NOSYS
+ # define mach_type_known
+ # endif
+@@ -77,14 +77,18 @@
+ # define HP
+ # define mach_type_known
+ # endif
+-# if defined(OPENBSD) && defined(m68k)
+-# define M68K
+-# define mach_type_known
+-# endif
+ # if defined(OPENBSD) && defined(__sparc__)
+ # define SPARC
+ # define mach_type_known
+ # endif
++# if defined(OPENBSD) && defined(__arm__)
++# define ARM32
++# define mach_type_known
++# endif
++# if defined(OPENBSD) && defined(__sh__)
++# define SH
++# define mach_type_known
++# endif
+ # if defined(NETBSD) && (defined(m68k) || defined(__m68k__))
+ # define M68K
+ # define mach_type_known
+@@ -101,7 +105,7 @@
+ # define SH
+ # define mach_type_known
+ # endif
+-# if defined(vax)
++# if defined(vax) || defined(__vax__)
+ # define VAX
+ # ifdef ultrix
+ # define ULTRIX
+@@ -119,7 +123,7 @@
+ # if defined(nec_ews) || defined(_nec_ews)
+ # define EWS4800
+ # endif
+-# if !defined(LINUX) && !defined(EWS4800) && !defined(NETBSD)
++# if !defined(LINUX) && !defined(EWS4800) && !defined(NETBSD) && !defined(OPENBSD)
+ # if defined(ultrix) || defined(__ultrix)
+ # define ULTRIX
+ # else
+@@ -210,7 +214,7 @@
+ # if defined(_PA_RISC1_0) || defined(_PA_RISC1_1) || defined(_PA_RISC2_0) \
+ || defined(hppa) || defined(__hppa__)
+ # define HP_PA
+-# if !defined(LINUX) && !defined(HPUX)
++# if !defined(LINUX) && !defined(HPUX) && !defined(OPENBSD)
+ # define HPUX
+ # endif
+ # define mach_type_known
+@@ -231,6 +235,10 @@
+ # define I386
+ # define mach_type_known
+ # endif
++# if defined(OPENBSD) && defined(__amd64)
++# define X86_64
++# define mach_type_known
++# endif
+ # if defined(LINUX) && defined(__x86_64__)
+ # define X86_64
+ # define mach_type_known
+@@ -302,6 +310,11 @@
+ # define MACOS
+ # define mach_type_known
+ # endif
++# if defined(__OpenBSD__) && defined(__powerpc__)
++# define POWERPC
++# define OPENBSD
++# define mach_type_known
++# endif
+ # if defined(macosx) || (defined(__APPLE__) && defined(__MACH__))
+ # define DARWIN
+ # if defined(__ppc__) || defined(__ppc64__)
+@@ -651,18 +664,6 @@
+ # ifdef M68K
+ # define MACH_TYPE "M68K"
+ # define ALIGNMENT 2
+-# ifdef OPENBSD
+-# define OS_TYPE "OPENBSD"
+-# define HEURISTIC2
+-# ifdef __ELF__
+-# define DATASTART GC_data_start
+-# define DYNAMIC_LOADING
+-# else
+- extern char etext[];
+-# define DATASTART ((ptr_t)(etext))
+-# endif
+-# define USE_GENERIC_PUSH_REGS
+-# endif
+ # ifdef NETBSD
+ # define OS_TYPE "NETBSD"
+ # define HEURISTIC2
+@@ -836,6 +837,24 @@
+ should be looked into some more */
+ # define NO_PTHREAD_TRYLOCK
+ # endif
++# ifdef OPENBSD
++# define OS_TYPE "OPENBSD"
++# define ALIGNMENT 4
++# ifdef GC_OPENBSD_THREADS
++# define UTHREAD_SP_OFFSET 268
++# else
++# include <sys/param.h>
++# include <uvm/uvm_extern.h>
++# define STACKBOTTOM USRSTACK
++# endif
++ extern int __data_start[];
++# define DATASTART ((ptr_t)(__data_start))
++ extern char _end[];
++# define DATAEND ((ptr_t)(&_end))
++# define DYNAMIC_LOADING
++# define USE_MMAP
++# define USE_MMAP_ANON
++# endif
+ # ifdef FREEBSD
+ # define ALIGNMENT 4
+ # define OS_TYPE "FREEBSD"
+@@ -994,9 +1013,20 @@
+ # endif
+ # ifdef OPENBSD
+ # define OS_TYPE "OPENBSD"
+-# define STACKBOTTOM ((ptr_t) 0xf8000000)
+- extern int etext[];
+-# define DATASTART ((ptr_t)(etext))
++# ifdef GC_OPENBSD_THREADS
++# define UTHREAD_SP_OFFSET 232
++# else
++# include <sys/param.h>
++# include <uvm/uvm_extern.h>
++# define STACKBOTTOM USRSTACK
++# endif
++ extern int __data_start[];
++# define DATASTART ((ptr_t)(__data_start))
++ extern char _end[];
++# define DATAEND ((ptr_t)(&_end))
++# define DYNAMIC_LOADING
++# define USE_MMAP
++# define USE_MMAP_ANON
+ # endif
+ # ifdef NETBSD
+ # define OS_TYPE "NETBSD"
+@@ -1250,6 +1280,20 @@
+ # endif
+ # ifdef OPENBSD
+ # define OS_TYPE "OPENBSD"
++# ifdef GC_OPENBSD_THREADS
++# define UTHREAD_SP_OFFSET 192
++# else
++# include <sys/param.h>
++# include <uvm/uvm_extern.h>
++# define STACKBOTTOM USRSTACK
++# endif
++ extern int __data_start[];
++# define DATASTART ((ptr_t)(__data_start))
++ extern char _end[];
++# define DATAEND ((ptr_t)(&_end))
++# define DYNAMIC_LOADING
++# define USE_MMAP
++# define USE_MMAP_ANON
+ # endif
+ # ifdef FREEBSD
+ # define OS_TYPE "FREEBSD"
+@@ -1471,6 +1515,24 @@
+ # define STACKBOTTOM ((ptr_t) 0x7ffff000)
+ # endif /* _ELF_ */
+ # endif
++# ifdef OPENBSD
++# define OS_TYPE "OPENBSD"
++# define ALIGNMENT 4
++# ifdef GC_OPENBSD_THREADS
++# define UTHREAD_SP_OFFSET 808
++# else
++# include <sys/param.h>
++# include <uvm/uvm_extern.h>
++# define STACKBOTTOM USRSTACK
++# endif
++ extern int _fdata[];
++# define DATASTART ((ptr_t)(_fdata))
++ extern char _end[];
++# define DATAEND ((ptr_t)(&_end))
++# define DYNAMIC_LOADING
++# define USE_MMAP
++# define USE_MMAP_ANON
++# endif
+ # endif
+
+ # ifdef RS6000
+@@ -1570,6 +1632,23 @@
+ extern int _end[];
+ # define DATAEND (&_end)
+ # endif /* LINUX */
++# ifdef OPENBSD
++# define OS_TYPE "OPENBSD"
++# ifdef GC_OPENBSD_THREADS
++# define UTHREAD_SP_OFFSET 520
++# else
++# include <sys/param.h>
++# include <uvm/uvm_extern.h>
++# define STACKBOTTOM USRSTACK
++# endif
++ extern int __data_start[];
++# define DATASTART ((ptr_t)(__data_start))
++ extern char _end[];
++# define DATAEND ((ptr_t)(&_end))
++# define DYNAMIC_LOADING
++# define USE_MMAP
++# define USE_MMAP_ANON
++# endif
+ # endif /* HP_PA */
+
+ # ifdef ALPHA
+@@ -1594,15 +1673,21 @@
+ # endif
+ # ifdef OPENBSD
+ # define OS_TYPE "OPENBSD"
+-# define HEURISTIC2
+-# ifdef __ELF__ /* since OpenBSD/Alpha 2.9 */
+-# define DATASTART GC_data_start
+-# define ELFCLASS32 32
+-# define ELFCLASS64 64
+-# define ELF_CLASS ELFCLASS64
+-# else /* ECOFF, until OpenBSD/Alpha 2.7 */
+-# define DATASTART ((ptr_t) 0x140000000)
+-# endif
++# define ELF_CLASS ELFCLASS64
++# ifdef GC_OPENBSD_THREADS
++# define UTHREAD_SP_OFFSET 816
++# else
++# include <sys/param.h>
++# include <uvm/uvm_extern.h>
++# define STACKBOTTOM USRSTACK
++# endif
++ extern int __data_start[];
++# define DATASTART ((ptr_t)(__data_start))
++ extern char _end[];
++# define DATAEND ((ptr_t)(&_end))
++# define DYNAMIC_LOADING
++# define USE_MMAP
++# define USE_MMAP_ANON
+ # endif
+ # ifdef FREEBSD
+ # define OS_TYPE "FREEBSD"
+@@ -1892,6 +1977,24 @@
+ # define OS_TYPE "MSWINCE"
+ # define DATAEND /* not needed */
+ # endif
++# ifdef OPENBSD
++# define ALIGNMENT 4
++# define OS_TYPE "OPENBSD"
++# ifdef GC_OPENBSD_THREADS
++# define UTHREAD_SP_OFFSET 176
++# else
++# include <sys/param.h>
++# include <uvm/uvm_extern.h>
++# define STACKBOTTOM USRSTACK
++# endif
++ extern int __data_start[];
++# define DATASTART ((ptr_t)(__data_start))
++ extern char _end[];
++# define DATAEND ((ptr_t)(&_end))
++# define DYNAMIC_LOADING
++# define USE_MMAP
++# define USE_MMAP_ANON
++# endif
+ # ifdef NOSYS
+ /* __data_start is usually defined in the target linker script. */
+ extern int __data_start[];
+@@ -1939,6 +2042,23 @@
+ # define USE_GENERIC_PUSH_REGS
+ # define DYNAMIC_LOADING
+ # endif
++# ifdef OPENBSD
++# define OS_TYPE "OPENBSD"
++# ifdef GC_OPENBSD_THREADS
++# define UTHREAD_SP_OFFSET 332
++# else
++# include <sys/param.h>
++# include <uvm/uvm_extern.h>
++# define STACKBOTTOM USRSTACK
++# endif
++ extern int __data_start[];
++# define DATASTART ((ptr_t)(__data_start))
++ extern char _end[];
++# define DATAEND ((ptr_t)(&_end))
++# define DYNAMIC_LOADING
++# define USE_MMAP
++# define USE_MMAP_ANON
++# endif
+ # endif
+
+ # ifdef SH4
+@@ -1971,6 +2091,24 @@
+ # define CPP_WORDSZ 64
+ # ifndef HBLKSIZE
+ # define HBLKSIZE 4096
++# endif
++# ifdef OPENBSD
++# define OS_TYPE "OPENBSD"
++# define ELF_CLASS ELFCLASS64
++# ifdef GC_OPENBSD_THREADS
++# define UTHREAD_SP_OFFSET 400
++# else
++# include <sys/param.h>
++# include <uvm/uvm_extern.h>
++# define STACKBOTTOM USRSTACK
++# endif
++ extern int __data_start[];
++# define DATASTART ((ptr_t)(__data_start))
++ extern char _end[];
++# define DATAEND ((ptr_t)(&_end))
++# define DYNAMIC_LOADING
++# define USE_MMAP
++# define USE_MMAP_ANON
+ # endif
+ # define CACHE_LINE_SIZE 64
+ # define USE_GENERIC_PUSH_REGS
View
16 lang/gcc/4.6/patches/patch-boehm-gc_include_private_openbsd_stop_world_h
@@ -0,0 +1,16 @@
+$OpenBSD: patch-boehm-gc_include_private_openbsd_stop_world_h,v 1.1 2009/06/04 18:24:20 kurt Exp $
+--- boehm-gc/include/private/openbsd_stop_world.h.orig Thu Mar 5 17:44:00 2009
++++ boehm-gc/include/private/openbsd_stop_world.h Thu Mar 5 17:44:00 2009
+@@ -0,0 +1,12 @@
++#ifndef GC_OPENBSD_STOP_WORLD_H
++#define GC_OPENBSD_STOP_WORLD_H
++
++#if !defined(GC_OPENBSD_THREADS)
++#error openbsd_stop_world.h included without GC_OPENBSD_THREADS defined
++#endif
++
++struct thread_stop_info {
++ ptr_t stack_ptr; /* Valid only when stopped. */
++};
++
++#endif
View
21 lang/gcc/4.6/patches/patch-boehm-gc_mach_dep_c
@@ -0,0 +1,21 @@
+$OpenBSD$
+--- boehm-gc/mach_dep.c.orig Sat Nov 12 10:28:43 2011
++++ boehm-gc/mach_dep.c Sat Nov 12 10:29:37 2011
+@@ -27,7 +27,7 @@
+ # endif
+ # endif
+
+-#if defined(RS6000) || defined(POWERPC)
++#if defined(RS6000) || defined(POWERPC) && !defined(OPENBSD)
+ # include <ucontext.h>
+ #endif
+
+@@ -417,7 +417,7 @@ ptr_t arg;
+ /* the stack. */
+ __builtin_unwind_init();
+ # else /* !HAVE_BUILTIN_UNWIND_INIT */
+-# if defined(RS6000) || defined(POWERPC)
++# if defined(RS6000) || defined(POWERPC) && !defined(OPENBSD)
+ /* FIXME: RS6000 means AIX. */
+ /* This should probably be used in all Posix/non-gcc */
+ /* settings. We defer that change to minimize risk. */
View
188 lang/gcc/4.6/patches/patch-boehm-gc_openbsd_stop_world_c
@@ -0,0 +1,188 @@
+$OpenBSD: patch-boehm-gc_openbsd_stop_world_c,v 1.1 2009/06/04 18:24:20 kurt Exp $
+--- boehm-gc/openbsd_stop_world.c.orig Thu Mar 12 15:07:24 2009
++++ boehm-gc/openbsd_stop_world.c Thu Mar 12 18:07:50 2009
+@@ -0,0 +1,184 @@
++#include "private/pthread_support.h"
++
++/* derived from pthread_stop_world.c */
++
++# if defined(GC_OPENBSD_THREADS)
++
++/* We hold allocation lock. Should do exactly the right thing if the */
++/* world is stopped. Should not fail if it isn't. */
++void GC_push_all_stacks()
++{
++ GC_bool found_me = FALSE;
++ size_t nthreads = 0;
++ int i;
++ GC_thread p;
++ ptr_t lo, hi;
++ pthread_t me = pthread_self();
++
++ if (!GC_thr_initialized) GC_thr_init();
++# if DEBUG_THREADS
++ GC_printf1("Pushing stacks from thread 0x%x\n", (unsigned) me);
++# endif
++ for (i = 0; i < THREAD_TABLE_SZ; i++) {
++ for (p = GC_threads[i]; p != 0; p = p -> next) {
++ if (p -> flags & FINISHED) continue;
++ ++nthreads;
++ if (pthread_equal(p -> id, me)) {
++# ifdef SPARC
++ lo = (ptr_t)GC_save_regs_in_stack();
++# else
++ lo = GC_approx_sp();
++# endif
++ found_me = TRUE;
++ } else {
++ lo = p -> stop_info.stack_ptr;
++ }
++ if ((p -> flags & MAIN_THREAD) == 0) {
++ hi = p -> stack_end;
++ } else {
++ /* The original stack. */
++ hi = GC_stackbottom;
++ }
++# if DEBUG_THREADS
++ GC_printf3("Stack for thread 0x%x = [%p,%p)\n",
++ (unsigned)(p -> id), lo, hi);
++# endif
++ if (0 == lo) ABORT("GC_push_all_stacks: sp not set!\n");
++# ifdef STACK_GROWS_UP
++ /* We got them backwards! */
++ GC_push_all_stack(hi, lo);
++# else
++ GC_push_all_stack(lo, hi);
++# endif
++ }
++ }
++ if (GC_print_stats) {
++ GC_printf1("Pushed %d thread stacks\n", nthreads);
++ }
++ if (!found_me && !GC_in_thread_creation)
++ ABORT("Collecting from unknown thread.");
++}
++
++/* We hold the allocation lock. Suspend all threads that might */
++/* still be running. */
++void GC_suspend_all()
++{
++ int i;
++ GC_thread p;
++ int result;
++ pthread_t my_thread = pthread_self();
++
++ for (i = 0; i < THREAD_TABLE_SZ; i++) {
++ for (p = GC_threads[i]; p != 0; p = p -> next) {
++ if (!pthread_equal(p -> id, my_thread)) {
++ if (p -> flags & FINISHED) continue;
++ if (p -> thread_blocked) /* Will wait */ continue;
++# if DEBUG_THREADS
++ GC_printf1("Suspending thread 0x%x\n",
++ (unsigned)(p -> id));
++# endif
++
++ if (pthread_suspend_np(p -> id) != 0)
++ ABORT("pthread_suspend_np failed");
++
++ /*
++ * This will only work for userland pthreads. It will
++ * fail badly on rthreads. Perhaps we should consider
++ * a pthread_sp_np() function that returns the stack
++ * pointer for a suspended thread and implement in
++ * both pthreads and rthreads.
++ */
++ p -> stop_info.stack_ptr = *(ptr_t*)((char *)p -> id + UTHREAD_SP_OFFSET);
++ }
++ }
++ }
++}
++
++void GC_stop_world()
++{
++ int i;
++
++ GC_ASSERT(I_HOLD_LOCK());
++# if DEBUG_THREADS
++ GC_printf1("Stopping the world from 0x%x\n", (unsigned)pthread_self());
++# endif
++
++ /* Make sure all free list construction has stopped before we start. */
++ /* No new construction can start, since free list construction is */
++ /* required to acquire and release the GC lock before it starts, */
++ /* and we have the lock. */
++# ifdef PARALLEL_MARK
++ GC_acquire_mark_lock();
++ GC_ASSERT(GC_fl_builder_count == 0);
++ /* We should have previously waited for it to become zero. */
++# endif /* PARALLEL_MARK */
++
++ GC_suspend_all();
++
++# ifdef PARALLEL_MARK
++ GC_release_mark_lock();
++# endif
++ #if DEBUG_THREADS
++ GC_printf1("World stopped from 0x%x\n", (unsigned)pthread_self());
++ #endif
++}
++
++/* Caller holds allocation lock, and has held it continuously since */
++/* the world stopped. */
++void GC_start_world()
++{
++ pthread_t my_thread = pthread_self();
++ register int i;
++ register GC_thread p;
++ register int result;
++
++# if DEBUG_THREADS
++ GC_printf0("World starting\n");
++# endif
++
++ for (i = 0; i < THREAD_TABLE_SZ; i++) {
++ for (p = GC_threads[i]; p != 0; p = p -> next) {
++ if (!pthread_equal(p -> id, my_thread)) {
++ if (p -> flags & FINISHED) continue;
++ if (p -> thread_blocked) continue;
++ #if DEBUG_THREADS
++ GC_printf1("Resuming thread 0x%x\n",
++ (unsigned)(p -> id));
++ #endif
++
++ if (pthread_resume_np(p -> id) != 0)
++ ABORT("pthread_kill failed");
++ }
++ }
++ }
++# if DEBUG_THREADS
++ GC_printf0("World started\n");
++# endif
++}
++
++void GC_stop_init() {
++}
++
++void GC_suspend_thread(pthread_t thread) {
++ if (thread == pthread_self()) {
++ ABORT("attempting to suspend self");
++ } else {
++ GC_thread t = GC_lookup_thread(thread);
++ if (t == NULL)
++ ABORT("attempting to suspend unknown thread");
++
++ if (pthread_suspend_np(t -> id) != 0)
++ ABORT("pthread_suspend_np failed");
++ }
++}
++
++void GC_resume_thread(pthread_t thread) {
++ GC_thread t = GC_lookup_thread(thread);
++ if (t == NULL)
++ ABORT("attempting to resume unknown thread");
++
++ if (pthread_resume_np(t -> id) != 0)
++ ABORT("pthread_resume_np failed");
++}
++
++#endif
View
184 lang/gcc/4.6/patches/patch-boehm-gc_os_dep_c
@@ -0,0 +1,184 @@
+$OpenBSD$
+--- boehm-gc/os_dep.c.orig Sun Mar 21 20:34:19 2010
++++ boehm-gc/os_dep.c Sun Nov 13 10:50:24 2011
+@@ -393,6 +393,103 @@ static void *tiny_sbrk(ptrdiff_t increment)
+ }
+ #endif
+
++#if defined(OPENBSD)
++ static struct sigaction old_segv_act;
++ sigjmp_buf GC_jmp_buf_openbsd;
++
++# if defined(GC_OPENBSD_THREADS)
++# include <sys/syscall.h>
++ sigset_t __syscall(quad_t, ...);
++# endif
++
++ /*
++ * Dont use GC_find_limit() because siglongjmp out of the
++ * signal handler by-passes our userland pthreads lib, leaving
++ * SIGSEGV and SIGPROF masked. Instead use this custom one
++ * that works-around the issues.
++ */
++
++ /*ARGSUSED*/
++ void GC_fault_handler_openbsd(int sig)
++ {
++ siglongjmp(GC_jmp_buf_openbsd, 1);
++ }
++
++ /* Return the first nonaddressible location > p or bound */
++ /* Requires allocation lock. */
++ ptr_t GC_find_limit_openbsd(ptr_t p, ptr_t bound)
++ {
++ static volatile ptr_t result;
++ /* Safer if static, since otherwise it may not be */
++ /* preserved across the longjmp. Can safely be */
++ /* static since it's only called with the */
++ /* allocation lock held. */
++ struct sigaction act;
++ size_t pgsz = (size_t)sysconf(_SC_PAGESIZE);
++
++ GC_ASSERT(I_HOLD_LOCK());
++
++ act.sa_handler = GC_fault_handler_openbsd;
++ sigemptyset(&act.sa_mask);
++ act.sa_flags = SA_NODEFER | SA_RESTART;
++ sigaction(SIGSEGV, &act, &old_segv_act);
++
++ if (sigsetjmp(GC_jmp_buf_openbsd, 1) == 0) {
++ result = (ptr_t)(((word)(p)) & ~(pgsz-1));
++ for (;;) {
++ result += pgsz;
++ if (result >= bound) {
++ result = bound;
++ break;
++ }
++ GC_noop1((word)(*result));
++ }
++ }
++
++# if defined(GC_OPENBSD_THREADS)
++ /* due to the siglongjump we need to manually unmask SIGPROF */
++ __syscall(SYS_sigprocmask, SIG_UNBLOCK, sigmask(SIGPROF));
++# endif
++
++ sigaction(SIGSEGV, &old_segv_act, 0);
++
++ return(result);
++ }
++
++ /* Return first addressable location > p or bound */
++ /* Requires allocation lock. */
++ ptr_t GC_skip_hole_openbsd(ptr_t p, ptr_t bound)
++ {
++ static volatile ptr_t result;
++ struct sigaction act;
++ size_t pgsz = (size_t)sysconf(_SC_PAGESIZE);
++ static volatile int firstpass;
++
++ GC_ASSERT(I_HOLD_LOCK());
++
++ act.sa_handler = GC_fault_handler_openbsd;
++ sigemptyset(&act.sa_mask);
++ act.sa_flags = SA_NODEFER | SA_RESTART;
++ sigaction(SIGSEGV, &act, &old_segv_act);
++
++ firstpass = 1;
++ result = (ptr_t)(((word)(p)) & ~(pgsz-1));
++ if (sigsetjmp(GC_jmp_buf_openbsd, 1) != 0 || firstpass) {
++ firstpass = 0;
++ result += pgsz;
++ if (result >= bound) {
++ result = bound;
++ } else
++ GC_noop1((word)(*result));
++ }
++
++ sigaction(SIGSEGV, &old_segv_act, 0);
++
++ return(result);
++ }
++#endif
++
++
+ # ifdef OS2
+
+ # include <stddef.h>
+@@ -1009,7 +1106,8 @@ ptr_t GC_get_stack_base()
+ #endif /* FREEBSD_STACKBOTTOM */
+
+ #if !defined(BEOS) && !defined(AMIGA) && !defined(MSWIN32) \
+- && !defined(MSWINCE) && !defined(OS2) && !defined(NOSYS) && !defined(ECOS)
++ && !defined(MSWINCE) && !defined(OS2) && !defined(NOSYS) && !defined(ECOS) \
++ && !defined(GC_OPENBSD_THREADS)
+
+ ptr_t GC_get_stack_base()
+ {
+@@ -1069,6 +1167,25 @@ ptr_t GC_get_stack_base()
+
+ # endif /* ! AMIGA, !OS 2, ! MS Windows, !BEOS, !NOSYS, !ECOS */
+
++#if defined(GC_OPENBSD_THREADS)
++
++/* Find the stack using pthread_stackseg_np() */
++
++# include <sys/signal.h>
++# include <pthread.h>
++# include <pthread_np.h>
++
++#define HAVE_GET_STACK_BASE
++
++ptr_t GC_get_stack_base()
++{
++ stack_t stack;
++ pthread_stackseg_np(pthread_self(), &stack);
++ return stack.ss_sp;
++}
++#endif /* GC_OPENBSD_THREADS */
++
++
+ /*
+ * Register static data segment(s) as roots.
+ * If more data segments are added later then they need to be registered
+@@ -1440,6 +1557,32 @@ int * etext_addr;
+
+ #else /* !OS2 && !Windows && !AMIGA */
+
++#if defined(OPENBSD)
++
++/*
++ * Depending on arch alignment there can be multiple holes
++ * between DATASTART & DATAEND. Scan from DATASTART - DATAEND
++ * and register each region.
++ */
++void GC_register_data_segments(void)
++{
++ ptr_t region_start, region_end;
++
++ region_start = DATASTART;
++
++ for(;;) {
++ region_end = GC_find_limit_openbsd(region_start, DATAEND);
++ GC_add_roots_inner(region_start, region_end, FALSE);
++ if (region_end < DATAEND)
++ region_start = GC_skip_hole_openbsd(region_end, DATAEND);
++ else
++ break;
++ }
++}
++
++# else /* !OS2 && !Windows && !AMIGA && !OPENBSD */
++
++
+ void GC_register_data_segments()
+ {
+ # if !defined(PCR) && !defined(SRC_M3) && !defined(MACOS)
+@@ -1497,6 +1640,7 @@ void GC_register_data_segments()
+ /* change. */
+ }
+
++# endif /* ! OPENBSD */
+ # endif /* ! AMIGA */
+ # endif /* ! MSWIN32 && ! MSWINCE*/
+ # endif /* ! OS2 */
View
13 lang/gcc/4.6/patches/patch-boehm-gc_pthread_stop_world_c
@@ -0,0 +1,13 @@
+$OpenBSD$
+--- boehm-gc/pthread_stop_world.c.orig Sat Nov 12 10:40:58 2011
++++ boehm-gc/pthread_stop_world.c Sat Nov 12 10:41:52 2011
+@@ -1,7 +1,8 @@
+ #include "private/pthread_support.h"
+
+ #if defined(GC_PTHREADS) && !defined(GC_SOLARIS_THREADS) \
+- && !defined(GC_WIN32_THREADS) && !defined(GC_DARWIN_THREADS)
++ && !defined(GC_WIN32_THREADS) && !defined(GC_DARWIN_THREADS) \
++ && !defined(GC_OPENBSD_THREADS)
+
+ #include <signal.h>
+ #include <semaphore.h>
View
22 lang/gcc/4.6/patches/patch-boehm-gc_pthread_support_c
@@ -0,0 +1,22 @@
+$OpenBSD$
+--- boehm-gc/pthread_support.c.orig Sat Nov 12 10:42:07 2011
++++ boehm-gc/pthread_support.c Sat Nov 12 10:44:30 2011
+@@ -892,6 +892,9 @@ void GC_thr_init()
+ GC_nprocs = sysconf(_SC_NPROC_ONLN);
+ if (GC_nprocs <= 0) GC_nprocs = 1;
+ # endif
++# if defined(GC_OPENBSD_THREADS)
++ GC_nprocs = 1;
++# endif
+ # if defined(GC_DARWIN_THREADS) || defined(GC_FREEBSD_THREADS)
+ int ncpus = 1;
+ size_t len = sizeof(ncpus);
+@@ -966,7 +969,7 @@ void GC_init_parallel()
+ }
+
+
+-#if !defined(GC_DARWIN_THREADS)
++#if !defined(GC_DARWIN_THREADS) && !defined(GC_OPENBSD_THREADS)
+ int WRAP_FUNC(pthread_sigmask)(int how, const sigset_t *set, sigset_t *oset)
+ {
+ sigset_t fudged_set;
View
13 lang/gcc/4.6/patches/patch-boehm-gc_tests_test_c
@@ -0,0 +1,13 @@
+$OpenBSD$
+--- boehm-gc/tests/test.c.orig Sat Nov 12 10:44:45 2011
++++ boehm-gc/tests/test.c Sat Nov 12 10:45:14 2011
+@@ -1804,7 +1804,8 @@ main()
+
+ pthread_attr_init(&attr);
+ # if defined(GC_IRIX_THREADS) || defined(GC_FREEBSD_THREADS) \
+- || defined(GC_DARWIN_THREADS) || defined(GC_AIX_THREADS)
++ || defined(GC_DARWIN_THREADS) || defined(GC_AIX_THREADS) \
++ || defined(GC_OPENBSD_THREADS)
+ pthread_attr_setstacksize(&attr, 1000000);
+ # endif
+ n_tests = 0;
View
13 lang/gcc/4.6/patches/patch-boehm-gc_threadlibs_c
@@ -0,0 +1,13 @@
+$OpenBSD$
+--- boehm-gc/threadlibs.c.orig Sat Nov 12 10:45:24 2011
++++ boehm-gc/threadlibs.c Sat Nov 12 10:46:11 2011
+@@ -15,6 +15,9 @@ int main()
+ || defined(GC_DARWIN_THREADS) || defined(GC_AIX_THREADS)
+ printf("-lpthread\n");
+ # endif
++# if defined(GC_OPENBSD_THREADS)
++ printf("-pthread\n");
++# endif
+ # if defined(GC_FREEBSD_THREADS)
+ # if (__FREEBSD_version >= 500000)
+ printf("-lpthread\n");
View
109 lang/gcc/4.6/patches/patch-gcc_c-family_c-format_c
@@ -0,0 +1,109 @@
+$OpenBSD$
+--- gcc/c-family/c-format.c.orig Mon Dec 6 01:56:06 2010
++++ gcc/c-family/c-format.c Sat Nov 12 12:39:38 2011
+@@ -61,6 +61,7 @@ set_Wformat (int setting)
+ format_type_error. Target-specific format types do not have
+ matching enum values. */
+ enum format_type { printf_format_type, asm_fprintf_format_type,
++ kprintf_format_type, syslog_format_type,
+ gcc_diag_format_type, gcc_tdiag_format_type,
+ gcc_cdiag_format_type,
+ gcc_cxxdiag_format_type, gcc_gfc_format_type,
+@@ -74,6 +75,7 @@ typedef struct function_format_info
+ unsigned HOST_WIDE_INT first_arg_num; /* number of first arg (zero for varargs) */
+ } function_format_info;
+
++
+ static bool decode_format_attr (tree, function_format_info *, int);
+ static int decode_format_type (const char *);
+
+@@ -440,6 +442,15 @@ static const format_length_info gcc_diag_length_specs[
+ { NO_FMT, NO_FMT, 0 }
+ };
+
++static const format_length_info kprintf_length_specs[] =
++{
++ { "h", FMT_LEN_h, STD_C89, NULL, 0, 0, 0 },
++ { "l", FMT_LEN_l, STD_C89, "ll", FMT_LEN_ll, STD_C9L, 0 },
++ { "q", FMT_LEN_ll, STD_EXT, NULL, 0, 0, 0 },
++ { "L", FMT_LEN_L, STD_C89, NULL, 0, 0, 0 },
++ { NO_FMT, NO_FMT, 0 }
++};
++
+ /* The custom diagnostics all accept the same length specifiers. */
+ #define gcc_tdiag_length_specs gcc_diag_length_specs
+ #define gcc_cdiag_length_specs gcc_diag_length_specs
+@@ -620,7 +631,6 @@ static const format_flag_pair strfmon_flag_pairs[] =
+ { 0, 0, 0, 0 }
+ };
+
+-
+ static const format_char_info print_char_table[] =
+ {
+ /* C89 conversion specifiers. */
+@@ -664,6 +674,46 @@ static const format_char_info asm_fprintf_char_table[]
+ { NULL, 0, STD_C89, NOLENGTHS, NULL, NULL, NULL }
+ };
+
++static const format_char_info kprint_char_table[] =
++{
++ /* C89 conversion specifiers. */
++ { "di", 0, STD_C89, { T89_I, T99_SC, T89_S, T89_L, T9L_LL, TEX_LL, T99_SST, T99_PD, T99_IM }, "-wp0 +'I", "i", NULL },
++ { "oxX", 0, STD_C89, { T89_UI, T99_UC, T89_US, T89_UL, T9L_ULL, TEX_ULL, T99_ST, T99_UPD, T99_UIM }, "-wp0#", "i", NULL },
++ { "u", 0, STD_C89, { T89_UI, T99_UC, T89_US, T89_UL, T9L_ULL, TEX_ULL, T99_ST, T99_UPD, T99_UIM }, "-wp0'I", "i", NULL },
++ { "c", 0, STD_C89, { T89_I, BADLEN, BADLEN, T94_WI, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w", "", NULL },
++ { "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, T94_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "cR", NULL },
++ { "p", 1, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w", "c", NULL },
++/* Kernel bitmap formatting */
++ { "b", 1, STD_C89, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "", NULL },
++/* Kernel recursive format */
++ { ":", 1, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "", NULL },
++/* Kernel debugger auto-radix printing */
++ { "nrz", 0, STD_C89, { T89_I, T89_I, T89_I, T89_L, T9L_LL, TEX_LL, BADLEN, BADLEN, BADLEN }, "-wp0# +", "", NULL },
++ { NULL, 0, 0, NOLENGTHS, NULL, NULL, NULL }
++};
++
++static const format_char_info syslog_char_table[] =
++{
++ /* C89 conversion specifiers. */
++ { "di", 0, STD_C89, { T89_I, T99_SC, T89_S, T89_L, T9L_LL, TEX_LL, T99_SST, T99_PD, T99_IM }, "-wp0 +'I", "i", NULL },
++ { "oxX", 0, STD_C89, { T89_UI, T99_UC, T89_US, T89_UL, T9L_ULL, TEX_ULL, T99_ST, T99_UPD, T99_UIM }, "-wp0#", "i", NULL },
++ { "u", 0, STD_C89, { T89_UI, T99_UC, T89_US, T89_UL, T9L_ULL, TEX_ULL, T99_ST, T99_UPD, T99_UIM }, "-wp0'I", "i", NULL },
++ { "fgG", 0, STD_C89, { T89_D, BADLEN, BADLEN, T99_D, BADLEN, T89_LD, BADLEN, BADLEN, BADLEN }, "-wp0 +#'", "", NULL },
++ { "eE", 0, STD_C89, { T89_D, BADLEN, BADLEN, T99_D, BADLEN, T89_LD, BADLEN, BADLEN, BADLEN }, "-wp0 +#", "", NULL },
++ { "c", 0, STD_C89, { T89_I, BADLEN, BADLEN, T94_WI, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w", "", NULL },
++ { "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, T94_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "cR", NULL },
++ { "p", 1, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w", "c", NULL },
++ { "n", 1, STD_C89, { T89_I, T99_SC, T89_S, T89_L, T9L_LL, BADLEN, T99_SST, T99_PD, T99_IM }, "", "W", NULL },
++ /* C99 conversion specifiers. */
++ { "F", 0, STD_C99, { T99_D, BADLEN, BADLEN, T99_D, BADLEN, T99_LD, BADLEN, BADLEN, BADLEN }, "-wp0 +#'", "", NULL },
++ { "aA", 0, STD_C99, { T99_D, BADLEN, BADLEN, T99_D, BADLEN, T99_LD, BADLEN, BADLEN, BADLEN }, "-wp0 +#", "", NULL },
++ /* X/Open conversion specifiers. */
++ { "C", 0, STD_EXT, { TEX_WI, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w", "", NULL },
++ { "S", 1, STD_EXT, { TEX_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "R", NULL },
++ { "m", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "", NULL },
++ { NULL, 0, 0, NOLENGTHS, NULL, NULL, NULL }
++};
++
+ static const format_char_info gcc_diag_char_table[] =
+ {
+ /* C89 conversion specifiers. */
+@@ -839,6 +889,18 @@ static const format_kind_info format_types_orig[] =
+ FMT_FLAG_ARG_CONVERT|FMT_FLAG_EMPTY_PREC_OK,
+ 'w', 0, 'p', 0, 'L', 0,
+ NULL, NULL
++ },
++ { "kprintf", kprintf_length_specs, kprint_char_table, " +#0-'I", NULL,
++ printf_flag_specs, printf_flag_pairs,
++ FMT_FLAG_ARG_CONVERT|FMT_FLAG_DOLLAR_MULTIPLE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_EMPTY_PREC_OK,
++ 'w', 0, 'p', 0, 'L', 0,
++ &integer_type_node, &integer_type_node
++ },
++ { "syslog", printf_length_specs, syslog_char_table, " +#0-'I", NULL,
++ printf_flag_specs, printf_flag_pairs,
++ FMT_FLAG_ARG_CONVERT|FMT_FLAG_DOLLAR_MULTIPLE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_EMPTY_PREC_OK,
++ 'w', 0, 'p', 0, 'L', 0,
++ &integer_type_node, &integer_type_node
+ },
+ { "gcc_diag", gcc_diag_length_specs, gcc_diag_char_table, "q+#", NULL,
+ gcc_diag_flag_specs, gcc_diag_flag_pairs,
View
32 lang/gcc/4.6/patches/patch-gcc_config_alpha_alpha_c
@@ -0,0 +1,32 @@
+$OpenBSD$
+--- gcc/config/alpha/alpha.c.orig Sat Nov 12 13:09:38 2011
++++ gcc/config/alpha/alpha.c Sat Nov 12 13:22:02 2011
+@@ -227,6 +227,10 @@ alpha_handle_option (size_t code, const char *arg, int
+ target_flags |= MASK_IEEE_CONFORMANT;
+ break;
+
++ case OPT_mno_ieee:
++ target_flags &= ~(MASK_IEEE_WITH_INEXACT|MASK_IEEE_CONFORMANT);
++ break;
++
+ case OPT_mtls_size_:
+ if (value != 16 && value != 32 && value != 64)
+ error ("bad value %qs for -mtls-size switch", arg);
+@@ -487,11 +491,17 @@ alpha_option_override (void)
+ if (!global_options_set.x_g_switch_value)
+ g_switch_value = 8;
+
++#ifdef OPENBSD_NATIVE
++ /* Make -fpic behave as -fPIC unless -msmall-data is specified. */
++ if (flag_pic == 2 && TARGET_SMALL_DATA)
++ warning (0, "-fPIC used with -msmall-data");
++#else
+ /* Infer TARGET_SMALL_DATA from -fpic/-fPIC. */
+ if (flag_pic == 1)
+ target_flags |= MASK_SMALL_DATA;
+ else if (flag_pic == 2)
+ target_flags &= ~MASK_SMALL_DATA;
++#endif
+
+ /* Align labels and loops for optimal branching. */
+ /* ??? Kludge these by not doing anything if we don't optimize and also if
View
13 lang/gcc/4.6/patches/patch-gcc_config_alpha_alpha_md
@@ -0,0 +1,13 @@
+$OpenBSD$
+--- gcc/config/alpha/alpha.md.orig Sat Nov 12 13:22:18 2011
++++ gcc/config/alpha/alpha.md Sat Nov 12 13:25:32 2011
+@@ -6560,7 +6560,8 @@
+ if (CONST_INT_P (operands[1])
+ && INTVAL (operands[1]) < 32768)
+ {
+- if (INTVAL (operands[1]) >= 4096)
++ if (INTVAL (operands[1]) >= 4096
++ && (flag_stack_check || STACK_CHECK_BUILTIN))
+ {
+ /* We do this the same way as in the prologue and generate explicit
+ probes. Then we update the stack by the constant. */
View
17 lang/gcc/4.6/patches/patch-gcc_config_alpha_alpha_opt
@@ -0,0 +1,17 @@
+$OpenBSD$
+--- gcc/config/alpha/alpha.opt.orig Sat Nov 12 13:25:53 2011
++++ gcc/config/alpha/alpha.opt Sat Nov 12 13:27:07 2011
+@@ -42,8 +42,13 @@ mieee
+ Target Report RejectNegative Mask(IEEE)
+ Emit IEEE-conformant code, without inexact exceptions
+
++mno-ieee
++Target Report RejectNegative InverseMask(IEEE)
++Emit non-IEEE-conformant code
++
+ mieee-with-inexact
+ Target Report RejectNegative Mask(IEEE_WITH_INEXACT)
++Emit IEEE-conformant code, with inexact exceptions
+
+ mbuild-constants
+ Target Report Mask(BUILD_CONSTANTS)
View
60 lang/gcc/4.6/patches/patch-gcc_config_alpha_openbsd_h
@@ -0,0 +1,60 @@
+$OpenBSD$
+--- gcc/config/alpha/openbsd.h.orig Sat Nov 12 13:28:07 2011
++++ gcc/config/alpha/openbsd.h Sat Nov 12 13:32:57 2011
+@@ -19,6 +19,27 @@ along with GCC; see the file COPYING3. If not see
+
+ /* Controlling the compilation driver. */
+
++#undef TARGET_DEFAULT
++#define TARGET_DEFAULT \
++ (MASK_FPREGS | MASK_IEEE | MASK_IEEE_CONFORMANT | MASK_GAS)
++
++ #define LINK_SPEC \
++ "%{!shared:%{!nostdlib:%{!r*:%{!e*:-e __start}}}} \
++ %{shared:-shared} %{R*} \
++ %{static:-Bstatic} \
++ %{!static:-Bdynamic} \
++ %{assert*} \
++ %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so}"
++
++/* As an elf system, we need crtbegin/crtend stuff. */
++#undef STARTFILE_SPEC
++#define STARTFILE_SPEC "\
++ %{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} %{!p:crt0%O%s}} \
++ crtbegin%O%s} %{shared:crtbeginS%O%s}"
++#undef ENDFILE_SPEC
++#define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
++
++
+ /* run-time target specifications */
+ #define TARGET_OS_CPP_BUILTINS() \
+ do { \
+@@ -28,18 +49,27 @@ along with GCC; see the file COPYING3. If not see
+
+ /* Layout of source language data types. */
+
+-/* This must agree with <machine/ansi.h> */
++/* This must agree with <machine/_types.h> */
+ #undef SIZE_TYPE
+ #define SIZE_TYPE "long unsigned int"
+
+ #undef PTRDIFF_TYPE
+ #define PTRDIFF_TYPE "long int"
+
++#undef INTMAX_TYPE
++#define INTMAX_TYPE "long long int"
++
++#undef UINTMAX_TYPE
++#define UINTMAX_TYPE "long long unsigned int"
++
+ #undef WCHAR_TYPE
+ #define WCHAR_TYPE "int"
+
+ #undef WCHAR_TYPE_SIZE
+ #define WCHAR_TYPE_SIZE 32
++
++#undef WINT_TYPE
++#define WINT_TYPE "int"
+
+
+ #define LOCAL_LABEL_PREFIX "."
View
44 lang/gcc/4.6/patches/patch-gcc_config_exec-stack_h
@@ -0,0 +1,44 @@
+$OpenBSD: patch-gcc_config_exec-stack_h,v 1.1 2006/10/20 13:43:18 espie Exp $
+--- gcc/config/exec-stack.h.orig Wed Oct 18 13:49:09 2006
++++ gcc/config/exec-stack.h Wed Oct 18 13:49:04 2006
+@@ -0,0 +1,40 @@
++/* Enable stack execute around trampoline address.
++ Copyright (C) 2002 Free Software Foundation, Inc.
++
++This file is part of GNU CC.
++
++GNU CC is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 2, or (at your option)
++any later version.
++
++GNU CC is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with GNU CC; see the file COPYING. If not, write to
++the Free Software Foundation, 59 Temple Place - Suite 330,
++Boston, MA 02111-1307, USA. */
++
++#undef FINALIZE_TRAMPOLINE
++#define FINALIZE_TRAMPOLINE(TRAMP) \
++ emit_library_call(gen_rtx_SYMBOL_REF (Pmode, "__enable_execute_stack"), \
++ 0, VOIDmode, 1, memory_address (SImode, (TRAMP)), Pmode)
++
++#undef TRANSFER_FROM_TRAMPOLINE
++#define TRANSFER_FROM_TRAMPOLINE \
++extern void __enable_execute_stack (void *); \
++void \
++__enable_execute_stack (addr) \
++ void *addr; \
++{ \
++ long size = getpagesize (); \
++ long mask = ~(size-1); \
++ char *page = (char *) (((long) addr) & mask); \
++ char *end = (char *) ((((long) (addr + TRAMPOLINE_SIZE)) & mask) + size); \
++ \
++ if (mprotect (page, end - page, PROT_READ | PROT_WRITE | PROT_EXEC) < 0) \
++ perror ("mprotect of trampoline code"); \
++}
View
31 lang/gcc/4.6/patches/patch-gcc_config_gcc
@@ -0,0 +1,31 @@
+$OpenBSD$
+--- gcc/config.gcc.orig Tue Nov 1 14:44:27 2011
++++ gcc/config.gcc Tue Nov 1 14:51:59 2011
+@@ -1250,6 +1250,11 @@ i[34567]86-*-openbsd*)
+ gas=yes
+ gnu_ld=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-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i[34567]86-*-gnu* | i[34567]86-*-kopensolaris*-gnu)
+ # Intel 80386's running GNU/*
+ # with ELF format using glibc 2
+@@ -2057,10 +2062,11 @@ picochip-*)
+ tmake_file="picochip/t-picochip t-pnt16-warn"
+ ;;
+ # port not yet contributed
+-#powerpc-*-openbsd*)
+-# tmake_file="${tmake_file} rs6000/t-fprules rs6000/t-fprules-fpbit "
+-# extra_headers=
+-# ;;
++powerpc-*-openbsd*)
++ tm_file="${tm_file} dbxelf.h elfos.h openbsd.h openbsd-libpthread.h freebsd-spec.h rs6000/sysv4.h rs6000/openbsd.h"
++ tmake_file="${tmake_file} rs6000/t-openbsd"
++ extra_options="${extra_options} rs6000/sysv4.opt"
++ ;;
+ powerpc-*-darwin*)
+ extra_options="${extra_options} rs6000/darwin.opt"
+ extra_parts="crt2.o"
View
13 lang/gcc/4.6/patches/patch-gcc_config_host
@@ -0,0 +1,13 @@
+$OpenBSD$
+--- gcc/config.host.orig Sat Nov 12 13:34:15 2011
++++ gcc/config.host Sat Nov 12 13:35:28 2011
+@@ -268,6 +268,9 @@ case ${host} in
+ out_host_hook_obj=host-solaris.o
+ host_xmake_file="${host_xmake_file} x-solaris"
+ ;;
++ *-*-openbsd*)
++ out_host_hook_obj=host-openbsd.o
++ host_xmake_file="${host_xmake_file} x-openbsd"
+ *-*-linux*)
+ out_host_hook_obj=host-linux.o
+ host_xmake_file="${host_xmake_file} x-linux"
View
111 lang/gcc/4.6/patches/patch-gcc_config_host-openbsd_c
@@ -0,0 +1,111 @@
+$OpenBSD: patch-gcc_config_host-openbsd_c,v 1.2 2008/06/12 01:14:06 kurt Exp $
+--- gcc/config/host-openbsd.c.orig Wed Apr 23 07:42:45 2008
++++ gcc/config/host-openbsd.c Wed Apr 23 17:57:19 2008
+@@ -0,0 +1,107 @@
++/* OpenBSD host-specific hook definitions.
++ Copyright (C) 2005 Free Software Foundation, Inc.
++
++ This file is part of GCC.
++
++ GCC is free software; you can redistribute it and/or modify it
++ under the terms of the GNU General Public License as published
++ by the Free Software Foundation; either version 2, or (at your
++ option) any later version.
++
++ GCC is distributed in the hope that it will be useful, but WITHOUT
++ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
++ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
++ License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with GCC; see the file COPYING. If not, write to the
++ Free Software Foundation, 59 Temple Place - Suite 330, Boston,
++ MA 02111-1307, USA. */
++
++#include <limits.h>
++#include <unistd.h>
++
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "hosthooks.h"
++#include "hosthooks-def.h"
++
++#undef HOST_HOOKS_GT_PCH_GET_ADDRESS
++#define HOST_HOOKS_GT_PCH_GET_ADDRESS openbsd_gt_pch_get_address
++
++#undef HOST_HOOKS_GT_PCH_USE_ADDRESS
++#define HOST_HOOKS_GT_PCH_USE_ADDRESS openbsd_gt_pch_use_address
++
++/* Return the address of the PCH address space, if the PCH will fit in it. */
++
++void *
++openbsd_gt_pch_get_address (size_t size, int fd ATTRIBUTE_UNUSED)
++{
++ void *base, *addr;
++ size_t pgsz;
++
++ if (size > INT_MAX)
++ return NULL;
++
++ pgsz = sysconf(_SC_PAGESIZE);
++ if (pgsz == (size_t)-1)
++ return NULL;
++
++ base = sbrk(0);
++
++ /* round up to nearest page */
++ base = (void *)(((long)base + (pgsz - 1)) & ~(pgsz - 1));
++ if (brk(base) != 0)
++ return NULL;
++
++ /* attempt to allocate size */
++ addr = sbrk(size);
++ if (addr == (void *)-1)
++ return NULL;
++
++ /* deallocate the memory */
++ if (brk(base) != 0)
++ return NULL;
++
++ /* confirm addr is as expected */
++ if (addr != base)
++ return NULL;
++
++ return base;
++}
++
++/* Return 0 if we can reserve the PCH address space. */
++
++int
++openbsd_gt_pch_use_address (void *base, size_t size, int fd ATTRIBUTE_UNUSED, size_t off ATTRIBUTE_UNUSED)
++{
++ void *addr;
++
++ if (size == 0)
++ return -1;
++
++ /* sanity check base address */
++ addr = sbrk(0);
++ if (addr == (void *)-1 || base < addr)
++ return -1;
++
++ /* set base for sbrk */
++ if (brk(base) != 0)
++ return -1;
++
++ /* attempt to get the memory */
++ addr = sbrk(size);
++ if (addr == (void *)-1)
++ return -1;
++
++ /* sanity check the result */
++ if (addr != base) {
++ brk(base);
++ return -1;
++ }
++
++ return 0;
++}
++
++const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER;
View
125 lang/gcc/4.6/patches/patch-gcc_config_i386_openbsd64_h
@@ -0,0 +1,125 @@
+$OpenBSD: patch-gcc_config_i386_openbsd64_h,v 1.2 2011/02/08 09:37:51 espie Exp $
+--- gcc/config/i386/openbsd64.h.orig Tue Nov 1 15:32:54 2011
++++ gcc/config/i386/openbsd64.h Tue Nov 1 15:33:56 2011
+@@ -0,0 +1,121 @@
++/* Configuration for an OpenBSD x86-64 target.
++
++ Copyright (C) 2003 Free Software Foundation, Inc.
++
++This file is part of GNU CC.
++
++GNU CC is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 2, or (at your option)
++any later version.
++
++GNU CC is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with GNU CC; see the file COPYING. If not, write to
++the Free Software Foundation, 59 Temple Place - Suite 330,
++Boston, MA 02111-1307, USA. */
++
++#undef TARGET_VERSION
++#define TARGET_VERSION fprintf (stderr, " (OpenBSD/x86-64 ELF)")
++
++/* This gets defined in tm.h->linux.h->svr4.h, and keeps us from using
++ libraries compiled with the native cc, so undef it. */
++#undef NO_DOLLAR_IN_LABEL
++
++/* Override the default comment-starter of "/". */
++#undef ASM_COMMENT_START
++#define ASM_COMMENT_START "#"
++
++/* Run-time target specifications */
++
++#define TARGET_OS_CPP_BUILTINS() \
++ do \
++ { \
++ OPENBSD_OS_CPP_BUILTINS_ELF(); \
++ if (TARGET_64BIT) \
++ OPENBSD_OS_CPP_BUILTINS_LP64(); \
++ } \
++ while (0)
++
++/* As an elf system, we need crtbegin/crtend stuff. */
++#undef STARTFILE_SPEC
++#define STARTFILE_SPEC "\
++ %{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} %{!p:crt0%O%s}} \
++ crtbegin%O%s} %{shared:crtbeginS%O%s}"
++#undef ENDFILE_SPEC
++#define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
++
++/* Layout of source language data types. */
++
++/* This must agree with <machine/_types.h> */
++#undef SIZE_TYPE
++#define SIZE_TYPE "long unsigned int"
++
++#undef PTRDIFF_TYPE
++#define PTRDIFF_TYPE "long int"
++
++#undef WCHAR_TYPE
++#define WCHAR_TYPE "int"
++
++#undef WCHAR_TYPE_SIZE
++#define WCHAR_TYPE_SIZE 32
++
++/* Assembler format: overall framework. */
++
++#undef ASM_APP_ON
++#define ASM_APP_ON "#APP\n"
++
++#undef ASM_APP_OFF
++#define ASM_APP_OFF "#NO_APP\n"
++
++#undef SET_ASM_OP
++#define SET_ASM_OP "\t.set\t"
++
++/* The following macros were originally stolen from i386v4.h.
++ These have to be defined to get PIC code correct. */
++
++/* Assembler format: dispatch tables. */
++
++/* Assembler format: sections. */
++
++/* Stack & calling: aggregate returns. */
++
++/* Don't default to pcc-struct-return, because gcc is the only compiler, and
++ we want to retain compatibility with older gcc versions. */
++#define DEFAULT_PCC_STRUCT_RETURN 0
++
++/* Assembler format: alignment output. */
++
++/* Stack & calling: profiling. */
++
++/* OpenBSD's profiler recovers all information from the stack pointer.
++ The icky part is not here, but in machine/profile.h. */
++#undef FUNCTION_PROFILER
++#define FUNCTION_PROFILER(FILE, LABELNO) \
++ fputs (flag_pic ? "\tcall __mcount@PLT\n": "\tcall __mcount\n", FILE);
++
++/* Assembler format: exception region output. */
++
++/* Assembler format: alignment output. */
++
++/* Note that we pick up ASM_OUTPUT_MAX_SKIP_ALIGN from i386/gas.h */
++
++/* Note that we pick up ASM_OUTPUT_MI_THUNK from unix.h. */
++
++#undef LINK_SPEC
++#define LINK_SPEC \
++ "%{!shared:%{!nostdlib:%{!r*:%{!e*:-e __start}}}} \
++ %{shared:-shared} %{R*} \
++ %{static:-Bstatic} \
++ %{!static:-Bdynamic} \
++ %{assert*} \
++ %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so}"
++
++#define OBSD_HAS_CORRECT_SPECS
++
++#undef JUMP_TABLES_IN_TEXT_SECTION
++#define JUMP_TABLES_IN_TEXT_SECTION (flag_pic)
View
25 lang/gcc/4.6/patches/patch-gcc_config_i386_openbsd_h
@@ -0,0 +1,25 @@
+$OpenBSD$
+--- gcc/config/i386/openbsd.h.orig Sat Nov 12 13:36:52 2011
++++ gcc/config/i386/openbsd.h Sat Nov 12 13:37:45 2011
+@@ -40,16 +40,19 @@ along with GCC; see the file COPYING3. If not see
+
+ /* This must agree with <machine/ansi.h> */
+ #undef SIZE_TYPE
+-#define SIZE_TYPE "unsigned int"
++#define SIZE_TYPE "long unsigned int"
+
+ #undef PTRDIFF_TYPE
+-#define PTRDIFF_TYPE "int"
++#define PTRDIFF_TYPE "long int"
+
+ #undef WCHAR_TYPE
+ #define WCHAR_TYPE "int"
+
+ #undef WCHAR_TYPE_SIZE
+ #define WCHAR_TYPE_SIZE 32
++
++#undef WINT_TYPE
++#define WINT_TYPE "int"
+
+ /* Assembler format: overall framework. */
+
View
13 lang/gcc/4.6/patches/patch-gcc_config_i386_openbsdelf_h
@@ -0,0 +1,13 @@
+$OpenBSD$
+--- gcc/config/i386/openbsdelf.h.orig Sat Nov 12 13:37:59 2011
++++ gcc/config/i386/openbsdelf.h Sat Nov 12 13:40:14 2011
+@@ -113,9 +113,6 @@ along with GCC; see the file COPYING3. If not see
+
+ /* Assembler format: exception region output. */
+
+-/* our configuration still doesn't handle dwarf2 correctly */
+-#define DWARF2_UNWIND_INFO 0
+-
+ /* Assembler format: alignment output. */
+
+ /* Note that we pick up ASM_OUTPUT_MAX_SKIP_ALIGN from i386/gas.h */
View
33 lang/gcc/4.6/patches/patch-gcc_config_openbsd-libpthread_h
@@ -0,0 +1,33 @@
+$OpenBSD: patch-gcc_config_openbsd-libpthread_h,v 1.1 2006/10/20 13:43:18 espie Exp $
+--- gcc/config/openbsd-libpthread.h.orig Sun Sep 27 15:20:23 2009
++++ gcc/config/openbsd-libpthread.h Sat Nov 12 14:22:54 2011
+@@ -2,6 +2,29 @@
+ specified on the command line. */
+ /* Copyright (C) 2004 Free Software Foundation, Inc.
+
++This file is part of GNU CC.
++
++GNU CC is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 2, or (at your option)
++any later version.
++
++GNU CC is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with GNU CC; see the file COPYING. If not, write to
++the Free Software Foundation, 59 Temple Place - Suite 330,
++Boston, MA 02111-1307, USA. */
++
++#define OBSD_LIB_SPEC "%{!shared:%{pthread:-lpthread} -lc}"
++
++/* LIB_SPEC appropriate for OpenBSD. Include -lpthread if -pthread is
++ specified on the command line. */
++/* Copyright (C) 2004 Free Software Foundation, Inc.
++
+ This file is part of GCC.
+
+ GCC is free software; you can redistribute it and/or modify it
View
28 lang/gcc/4.6/patches/patch-gcc_config_rs6000_openbsd1_h
@@ -0,0 +1,28 @@
+$OpenBSD: patch-gcc_config_rs6000_openbsd1_h,v 1.1 2007/06/19 21:23:38 ajacoutot Exp $
+--- gcc/config/rs6000/openbsd1.h.orig Tue Jun 12 14:05:16 2007
++++ gcc/config/rs6000/openbsd1.h Tue Jun 12 14:05:16 2007
+@@ -0,0 +1,24 @@
++/* Configuration file for an rs6000 OpenBSD target.
++ Copyright (C) 1999 Free Software Foundation, Inc.
++
++This file is part of GNU CC.
++
++GNU CC is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 2, or (at your option)
++any later version.
++
++GNU CC is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with GNU CC; see the file COPYING. If not, write to
++the Free Software Foundation, 59 Temple Place - Suite 330,
++Boston, MA 02111-1307, USA. */
++
++#define OBSD_HAS_CORRECT_SPECS
++#define OBSD_HAS_DECLARE_FUNCTION_NAME
++#define OBSD_HAS_DECLARE_FUNCTION_SIZE
++#define OBSD_HAS_DECLARE_OBJECT
View
136 lang/gcc/4.6/patches/patch-gcc_config_rs6000_openbsd_h
@@ -0,0 +1,136 @@
+$OpenBSD: patch-gcc_config_rs6000_openbsd_h,v 1.1 2007/06/19 21:23:38 ajacoutot Exp $
+--- gcc/config/rs6000/openbsd.h.orig Sat Jun 9 17:11:08 2007
++++ gcc/config/rs6000/openbsd.h Sat Jun 9 18:24:52 2007
+@@ -0,0 +1,132 @@
++/* Configuration file for an rs6000 OpenBSD target.
++ Copyright (C) 1999 Free Software Foundation, Inc.
++
++This file is part of GNU CC.
++
++GNU CC is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 2, or (at your option)
++any later version.
++
++GNU CC is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with GNU CC; see the file COPYING. If not, write to
++the Free Software Foundation, 59 Temple Place - Suite 330,
++Boston, MA 02111-1307, USA. */
++
++/* XXX need to check ASM_WEAKEN_LABEL/ASM_GLOBALIZE_LABEL. */
++
++/* Run-time target specifications. */
++#undef TARGET_OS_CPP_BUILTINS /* FIXME: sysv4.h should not define this! */
++#define TARGET_OS_CPP_BUILTINS() \
++ do \
++ { \
++ OPENBSD_OS_CPP_BUILTINS_ELF(); \
++ builtin_define ("__PPC"); \
++ builtin_define ("__PPC__"); \
++ builtin_define ("__powerpc"); \
++ builtin_define ("__powerpc__"); \
++ builtin_assert ("cpu=powerpc"); \
++ builtin_assert ("machine=powerpc"); \
++ } \
++ while (0)
++
++/* Override the default from rs6000.h to avoid conflicts with macros
++ defined in OpenBSD header files. */
++
++#undef RS6000_CPU_CPP_ENDIAN_BUILTINS
++#define RS6000_CPU_CPP_ENDIAN_BUILTINS() \
++ do \
++ { \
++ if (BYTES_BIG_ENDIAN) \
++ { \
++ builtin_define ("__BIG_ENDIAN__"); \
++ builtin_assert ("machine=bigendian"); \
++ } \
++ else \
++ { \
++ builtin_define ("__LITTLE_ENDIAN__"); \
++ builtin_assert ("machine=littleendian"); \
++ } \
++ } \
++ while (0)
++
++#undef CPP_OS_DEFAULT_SPEC
++#define CPP_OS_DEFAULT_SPEC "%(cpp_os_openbsd)"
++
++#undef LINKER_NAME
++#define LINKER_NAME "ld"
++
++#undef LINK_SPEC
++#define LINK_SPEC "%{shared:-shared} \
++ %{!shared: \
++ %{!static: \
++ %{rdynamic:-export-dynamic} \
++ %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so}} \
++ %{static:-static}}"
++
++#undef LIB_DEFAULT_SPEC
++#define LIB_DEFAULT_SPEC "%(lib_openbsd)"
++
++#undef STARTFILE_DEFAULT_SPEC
++#define STARTFILE_DEFAULT_SPEC "%(startfile_openbsd)"
++
++#undef ENDFILE_DEFAULT_SPEC
++#define ENDFILE_DEFAULT_SPEC "%(endfile_openbsd)"
++
++#undef LINK_START_DEFAULT_SPEC
++#define LINK_START_DEFAULT_SPEC "%(link_start_openbsd)"
++
++#undef LINK_OS_DEFAULT_SPEC
++#define LINK_OS_DEFAULT_SPEC "%(link_os_openbsd)"
++
++#undef TARGET_VERSION
++#define TARGET_VERSION fprintf (stderr, " (PowerPC OpenBSD)");
++
++/* Default ABI to use */
++#undef RS6000_ABI_NAME
++#define RS6000_ABI_NAME "openbsd"
++
++/* Define this macro as a C expression for the initializer of an
++ array of string to tell the driver program which options are
++ defaults for this target and thus do not need to be handled
++ specially when using `MULTILIB_OPTIONS'.
++
++ Do not define this macro if `MULTILIB_OPTIONS' is not defined in
++ the target makefile fragment or if none of the options listed in
++ `MULTILIB_OPTIONS' are set by default. *Note Target Fragment::. */
++
++#undef MULTILIB_DEFAULTS
++#define MULTILIB_DEFAULTS { "mbig", "mcall-openbsd" }
++
++/* collect2 support (Macros for initialization). */
++
++
++/* Don't tell collect2 we use COFF as we don't have (yet ?) a dynamic ld
++ library with the proper functions to handle this -> collect2 will
++ default to using nm. */
++#undef OBJECT_FORMAT_COFF
++
++/* Some code gets optimized incorrectly by move_movables() in loop.c */
++#define BROKEN_MOVE_MOVABLES_P
++
++/* This must agree with <machine/_types.h> */
++#undef SIZE_TYPE
++#define SIZE_TYPE "long unsigned int"
++
++#undef PTRDIFF_TYPE
++#define PTRDIFF_TYPE "long int"
++
++#undef WCHAR_TYPE
++#define WCHAR_TYPE "int"
++
++#undef WCHAR_TYPE_SIZE
++#define WCHAR_TYPE_SIZE 32
++
++#undef TRAMPOLINE_SIZE
++#define TRAMPOLINE_SIZE 40
++
View
59 lang/gcc/4.6/patches/patch-gcc_config_rs6000_t-openbsd
@@ -0,0 +1,59 @@
+$OpenBSD: patch-gcc_config_rs6000_t-openbsd,v 1.1 2007/06/19 21:23:38 ajacoutot Exp $
+--- gcc/config/rs6000/t-openbsd.orig Tue Jun 12 12:23:22 2007
++++ gcc/config/rs6000/t-openbsd Tue Jun 12 12:18:16 2007
+@@ -0,0 +1,55 @@
++# include t-rs6000 too
++# this is taken from t-ppccomm
++# but crt* removed.
++
++
++LIB2FUNCS_EXTRA = tramp.S
++
++# This one can't end up in shared libgcc
++LIB2FUNCS_STATIC_EXTRA = eabi.S
++
++# We want fine grained libraries, so use the new code to build the
++# floating point emulation libraries.
++FPBIT = fp-bit.c
++DPBIT = dp-bit.c
++
++
++dp-bit.c: $(srcdir)/config/fp-bit.c
++ cat $(srcdir)/config/fp-bit.c > dp-bit.c
++
++fp-bit.c: $(srcdir)/config/fp-bit.c
++ echo '#define FLOAT' > fp-bit.c
++ cat $(srcdir)/config/fp-bit.c >> fp-bit.c
++
++eabi.S: $(srcdir)/config/rs6000/eabi.asm
++ cat $(srcdir)/config/rs6000/eabi.asm > eabi.S
++
++tramp.S: $(srcdir)/config/rs6000/tramp.asm
++ cat $(srcdir)/config/rs6000/tramp.asm > tramp.S
++
++# Switch synonyms
++MULTILIB_MATCHES_FLOAT = msoft-float=mcpu?401 \
++ msoft-float=mcpu?403 \
++ msoft-float=mcpu?ec603e \
++ msoft-float=mcpu?801 \
++ msoft-float=mcpu?821 \
++ msoft-float=mcpu?823 \
++ msoft-float=mcpu?860
++MULTILIB_MATCHES_ENDIAN = mlittle=mlittle-endian mbig=mbig-endian
++MULTILIB_MATCHES_SYSV = mcall-sysv=mcall-sysv-eabi mcall-sysv=mcall-sysv-noeabi mcall-sysv=mcall-linux mcall-sysv=mcall-netbsd
++
++LIBGCC = stmp-multilib
++INSTALL_LIBGCC = install-multilib
++EXTRA_MULTILIB_PARTS = crtsavres$(objext)
++
++crtsavres.S: $(srcdir)/config/rs6000/crtsavres.asm
++ cat $(srcdir)/config/rs6000/crtsavres.asm >crtsavres.S
++
++$(T)crtsavres$(objext): crtsavres.S
++ $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c crtsavres.S -o $(T)crtsavres$(objext)
++
++# It is important that crtbegin.o, etc., aren't surprised by stuff in .sdata.
++CRTSTUFF_T_CFLAGS = -msdata=none
++# Make sure crt*.o are built with -fPIC even if configured with
++# --enable-shared --disable-multilib
++CRTSTUFF_T_CFLAGS_S = -fPIC -msdata=none
View
12 lang/gcc/4.6/patches/patch-gcc_config_t-openbsd
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- gcc/config/t-openbsd.orig Sat Nov 12 13:45:14 2011
++++ gcc/config/t-openbsd Sat Nov 12 13:45:45 2011
+@@ -1,2 +1,7 @@
+ # We don't need GCC's own include files.
+-USER_H =
++USER_H = $(EXTRA_HEADERS)
++# Use unwind-dw2-fde-glibc
++LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde-openbsd.c \
++ $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
++LIB2ADDEHDEP = unwind.inc unwind-dw2-fde.h unwind-dw2-fde.c \
++ unwind-dw2-fde-glibc.c
View
8 lang/gcc/4.6/patches/patch-gcc_config_x-openbsd
@@ -0,0 +1,8 @@
+$OpenBSD: patch-gcc_config_x-openbsd,v 1.1.1.1 2006/07/31 09:50:53 espie Exp $
+--- gcc/config/x-openbsd.orig Mon Jan 31 14:50:47 2005
++++ gcc/config/x-openbsd Mon Jan 31 14:51:13 2005
+@@ -0,0 +1,4 @@
++host-openbsd.o : $(srcdir)/config/host-openbsd.c $(CONFIG_H) $(SYSTEM_H) \
++ coretypes.h hosthooks.h hosthooks-def.h $(HOOKS_H)
++ $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
++ $(srcdir)/config/host-openbsd.c
View
12 lang/gcc/4.6/patches/patch-gcc_cp_g++spec_c
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- gcc/cp/g++spec.c.orig Sat Nov 12 13:47:34 2011
++++ gcc/cp/g++spec.c Sat Nov 12 13:47:58 2011
+@@ -42,7 +42,7 @@ along with GCC; see the file COPYING3. If not see
+ #endif
+
+ #ifndef LIBSTDCXX
+-#define LIBSTDCXX "stdc++"
++#define LIBSTDCXX "estdc++"
+ #endif
+ #ifndef LIBSTDCXX_PROFILE
+ #define LIBSTDCXX_PROFILE LIBSTDCXX
View
17 lang/gcc/4.6/patches/patch-gcc_testsuite_gcc_dg_format_format_h
@@ -0,0 +1,17 @@
+$OpenBSD$
+--- gcc/testsuite/gcc.dg/format/format.h.orig Sat Nov 12 13:49:12 2011
++++ gcc/testsuite/gcc.dg/format/format.h Sat Nov 12 13:49:42 2011
+@@ -35,11 +35,13 @@
+ #include <stdarg.h>
+ #include <stddef.h>
+
++#ifndef _WINT_T_DEFINED_
+ #ifndef _WINT_T
+ #ifndef __WINT_TYPE__
+ #define __WINT_TYPE__ unsigned int
+ #endif
+ typedef __WINT_TYPE__ wint_t;
++#endif
+ #endif
+
+ #ifdef _WIN64
View
12 lang/gcc/4.6/patches/patch-gcc_unwind-dw2-fde-glibc_c
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- gcc/unwind-dw2-fde-glibc.c.orig Sat Nov 12 14:39:41 2011
++++ gcc/unwind-dw2-fde-glibc.c Sat Nov 12 14:40:21 2011
+@@ -33,7 +33,7 @@
+
+ #include "tconfig.h"
+ #include "tsystem.h"
+-#ifndef inhibit_libc
++#if !defined(inhibit_libc) && !defined(__OpenBSD__)
+ #include <elf.h> /* Get DT_CONFIG. */
+ #endif
+ #include "coretypes.h"
View
14 lang/gcc/4.6/patches/patch-gcc_unwind-dw2-fde-openbsd_c
@@ -0,0 +1,14 @@
+$OpenBSD: patch-gcc_unwind-dw2-fde-openbsd_c,v 1.1 2009/04/16 18:36:48 espie Exp $
+--- gcc/unwind-dw2-fde-openbsd.c.orig Sat Apr 11 14:24:23 2009
++++ gcc/unwind-dw2-fde-openbsd.c Sat Apr 11 14:24:02 2009
+@@ -0,0 +1,10 @@
++/* XXX This file provides a few defines such that we can compile the
++ source from unwind-dw2-fde-glibc.c on OpenBSD. Hopefully we can
++ integrate these defines in that file and rename it to something
++ like unwind-de2-fde-phdr.c in the up-stream sources. */
++
++#define ElfW(type) Elf_##type
++
++#define __GLIBC__ 3 /* Fool unwind-dw2-fde-glibc.c. */
++#include "unwind-dw2-fde-glibc.c"
++
View
51 lang/gcc/4.6/patches/patch-gcc_unwind-dw2_c
@@ -0,0 +1,51 @@
+$OpenBSD$
+--- gcc/unwind-dw2.c.orig Sat Nov 12 13:51:04 2011
++++ gcc/unwind-dw2.c Sat Nov 12 13:52:44 2011
+@@ -145,6 +145,25 @@ _Unwind_IsExtendedContext (struct _Unwind_Context *con
+ {
+ return context->flags & EXTENDED_CONTEXT_BIT;
+ }
++
++#ifdef __sparc64__
++
++/* Figure out StackGhost cookie. */
++_Unwind_Word uw_get_wcookie(void);
++
++asm(".text\n"
++ "uw_get_wcookie:\n"
++ " add %o7, %g0, %g4\n"
++ " save %sp, -176, %sp\n"
++ " save %sp, -176, %sp\n"
++ " flushw\n"
++ " restore\n"
++ " ldx [%sp + 2047 + 120], %g5\n"
++ " xor %g4, %g5, %i0\n"
++ " ret\n"
++ " restore\n");
++#endif
++
+
+ /* Get the value of register INDEX as saved in CONTEXT. */
+
+@@ -167,6 +186,13 @@ _Unwind_GetGR (struct _Unwind_Context *context, int in
+ if (_Unwind_IsExtendedContext (context) && context->by_value[index])
+ return (_Unwind_Word) (_Unwind_Internal_Ptr) ptr;
+
++#ifdef __sparc64__
++ /* _Unwind_Word and _Unwind_Ptr are the same size on sparc64 */
++ _Unwind_Word reg = * (_Unwind_Word *) ptr;
++ if (index == 15 || index == 31)
++ reg ^= uw_get_wcookie ();
++ return reg;
++#else
+ /* This will segfault if the register hasn't been saved. */
+ if (size == sizeof(_Unwind_Ptr))
+ return * (_Unwind_Ptr *) ptr;
+@@ -175,6 +201,7 @@ _Unwind_GetGR (struct _Unwind_Context *context, int in
+ gcc_assert (size == sizeof(_Unwind_Word));
+ return * (_Unwind_Word *) ptr;
+ }
++#endif
+ }
+
+ static inline void *
View
26 lang/gcc/4.6/patches/patch-libffi_Makefile_in
@@ -0,0 +1,26 @@
+$OpenBSD$
+--- libffi/Makefile.in.orig Sat Nov 12 13:53:18 2011
++++ libffi/Makefile.in Sat Nov 12 13:54:50 2011
+@@ -474,7 +474,8 @@ libffi_convenience_la_SOURCES = $(libffi_la_SOURCES)
+ nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES)
+ AM_CFLAGS = -Wall -g -fexceptions
+ LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
+-libffi_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) $(AM_LTLDFLAGS)
++include $(top_srcdir)/../libversions
++libffi_la_LDFLAGS = $(LIBffi_LTVERSION) $(LTLDFLAGS) $(AM_LTLDFLAGS)
+ AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src
+ AM_CCASFLAGS = $(AM_CPPFLAGS)
+ all: fficonfig.h
+@@ -1368,9 +1369,9 @@ installdirs-am:
+ for dir in "$(DESTDIR)$(toolexeclibdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+-install: install-recursive
+-install-exec: install-exec-recursive
+-install-data: install-data-recursive
++install:
++install-exec:
++install-data:
+ uninstall: uninstall-recursive
+
+ install-am: all-am
View
13 lang/gcc/4.6/patches/patch-libffi_configure
@@ -0,0 +1,13 @@
+$OpenBSD$
+--- libffi/configure.orig Sat Nov 12 13:54:59 2011
++++ libffi/configure Sat Nov 12 13:59:37 2011
+@@ -11410,6 +11410,9 @@ case "$host" in
+ powerpc64-*-freebsd*)
+ TARGET=POWERPC; TARGETDIR=powerpc
+ ;;
++ powerpc-*-openbsd*)
++ TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc
++ ;;
+ powerpc*-*-rtems*)
+ TARGET=POWERPC; TARGETDIR=powerpc
+ ;;
View
12 lang/gcc/4.6/patches/patch-libffi_include_Makefile_in
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- libffi/include/Makefile.in.orig Sat Nov 12 13:59:51 2011
++++ libffi/include/Makefile.in Sat Nov 12 14:00:05 2011
+@@ -413,7 +413,7 @@ info: info-am
+
+ info-am:
+
+-install-data-am: install-toollibffiHEADERS
++install-data-am:
+
+ install-dvi: install-dvi-am
+
View
12 lang/gcc/4.6/patches/patch-libgcc_config_host
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- libgcc/config.host.orig Tue Nov 1 15:59:48 2011
++++ libgcc/config.host Tue Nov 1 16:00:17 2011
+@@ -297,6 +297,8 @@ i[34567]86-*-openbsd2.*|i[34567]86-*openbsd3.[0123])
+ ;;
+ i[34567]86-*-openbsd*)
+ ;;
++x86_64-*-openbsd*)
++ ;;
+ i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i[34567]86-*-gnu*)
+ extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
+ tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm"
View
13 lang/gcc/4.6/patches/patch-libgfortran_Makefile_in
@@ -0,0 +1,13 @@
+$OpenBSD$
+--- libgfortran/Makefile.in.orig Sat Nov 12 14:00:34 2011
++++ libgfortran/Makefile.in Sat Nov 12 14:01:28 2011
+@@ -485,7 +485,8 @@ LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-
+ toolexeclib_LTLIBRARIES = libgfortran.la
+ toolexeclib_DATA = libgfortran.spec
+ libgfortran_la_LINK = $(LINK) $(libgfortran_la_LDFLAGS)
+-libgfortran_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) $(LIBQUADLIB) -lm $(extra_ldflags_libgfortran) $(version_arg)
++include $(top_srcdir)/../libversions
++libgfortran_la_LDFLAGS = $(LIBgfortran_LTVERSION) $(LTLDFLAGS) $(LIBQUADLIB) -lm $(extra_ldflags_libgfortran) $(version_arg)
+ libgfortran_la_DEPENDENCIES = $(version_dep) libgfortran.spec $(LIBQUADLIB_DEP)
+ myexeclib_LTLIBRARIES = libgfortranbegin.la
+ myexeclibdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)$(MULTISUBDIR)
View
55 lang/gcc/4.6/patches/patch-libjava_Makefile_in
@@ -0,0 +1,55 @@
+$OpenBSD$
+work around gcj-dbtool hanging during build
+--- libjava/Makefile.in.orig Wed Oct 26 11:30:24 2011
++++ libjava/Makefile.in Sun Nov 13 11:48:33 2011
+@@ -502,7 +502,7 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+-DATA = $(dbexec_DATA) $(jar_DATA) $(toolexecmainlib_DATA)
++DATA = $(jar_DATA) $(toolexecmainlib_DATA)
+ RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+@@ -1041,12 +1041,13 @@ AM_CPPFLAGS = -I$(top_srcdir) \
+ $(GCINCS) $(THREADINCS) $(INCLTDL) \
+ $(GCC_UNWIND_INCLUDE) $(ZINCS) $(LIBFFIINCS)
+
++include $(top_srcdir)/../libversions
+ BOOTCLASSPATH = $(srcdir)/classpath/lib
+ libgij_la_SOURCES = gij.cc
+ libgij_la_DEPENDENCIES = libgcj.la libgcj.spec $(am__append_10)
+ libgij_la_LIBADD = -L$(here)/.libs libgcj.la
+ libgij_la_LDFLAGS = -rpath $(toolexeclibdir) $(LIBJAVA_LDFLAGS_NOUNDEF) \
+- -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LIBGCJ_LD_SYMBOLIC)
++ $(LIBgij_LTVERSION) $(LIBGCJ_LD_SYMBOLIC)
+
+ libgij_la_LINK = $(CXXLINK) $(libgij_la_LDFLAGS)
+ @INTERPRETER_FALSE@libgcj_interpret_source_files =
+@@ -1065,7 +1066,7 @@ xlib_nat_files = $(xlib_nat_source_files:.cc=.lo)
+ # certain linuxthread functions get linked:
+ libgcj_la_LDFLAGS = -rpath $(toolexeclibdir) $(THREADLDFLAGS) $(extra_ldflags) $(THREADLIBS) \
+ $(LIBLTDL) $(SYS_ZLIBS) $(LIBJAVA_LDFLAGS_NOUNDEF) \
+- -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
++ $(LIBgcj_LTVERSION) \
+ $(LIBGCJ_LD_SYMBOLIC_FUNCTIONS)
+
+ libgcj_la_LIBADD = \
+@@ -1107,7 +1108,7 @@ libgcj_tools_la_GCJFLAGS = $(AM_GCJFLAGS) -findirect-d
+ -fsource-filename=$(here)/classpath/tools/all-classes.lst
+
+ libgcj_tools_la_LDFLAGS = -rpath $(toolexeclibdir) \
+- -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
++ $(LIBgcj_tools_LTVERSION) \
+ $(LIBGCJ_LD_SYMBOLIC_FUNCTIONS) $(LIBJAVA_LDFLAGS_NOUNDEF) \
+ $(LIBJAVA_LDFLAGS_LIBMATH)
+
+@@ -10459,7 +10460,7 @@ install-dvi: install-dvi-recursive
+ install-dvi-am:
+
+ install-exec-am: install-binPROGRAMS install-binSCRIPTS \
+- install-dbexecDATA install-dbexecLTLIBRARIES \
++ install-dbexecLTLIBRARIES \
+ install-libexecsubPROGRAMS install-multi \
+ install-toolexeclibLTLIBRARIES install-toolexecmainlibDATA
+ @$(NORMAL_INSTALL)
View
12 lang/gcc/4.6/patches/patch-libjava_configure
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- libjava/configure.orig Tue Nov 1 19:14:49 2011
++++ libjava/configure Tue Nov 1 19:15:31 2011
+@@ -20727,7 +20727,7 @@ case "$THREADS" in
+ # support for weak references to pthread_* functions ala gthr.h API.
+ THREADSPEC='%{!pthread: %{!shared: %eUnder this configuration, the user must provide -pthread when linking.}}'
+ ;;