The following enables __cxa_atexit support in gcc 3.3 and 4.2 (the only
two gcc's hooked up to the ports build right now). __cxa_atexit support
has been in base since just after 4.2 was released.
Also for 4.2 I implemented precompiled header support using brk/sbrk
(idea from drahn@). For this you need -current includes from today
(signal.h/unistd.h).
Tested on i386 and macppc so far.
Index: 3.3/Makefile
===================================================================
RCS file: /cvs/ports/lang/gcc/3.3/Makefile,v
retrieving revision 1.29
diff -u -p -r1.29 Makefile
--- 3.3/Makefile 23 Feb 2008 00:26:07 -0000 1.29
+++ 3.3/Makefile 29 Apr 2008 20:55:26 -0000
@@ -8,12 +8,12 @@ FULL_PKGVERSION=3.3.6
PKGNAME-main= gcc-${FULL_PKGVERSION}p9
PKGNAME-c++ = g++-${FULL_PKGVERSION}p8
-PKGNAME-estdc= libstdc++-${FULL_PKGVERSION}p3
+PKGNAME-estdc= libstdc++-${FULL_PKGVERSION}p4
PKGNAME-g77= g77-${FULL_PKGVERSION}p8
PKGNAME-java= gcj-${FULL_PKGVERSION}p5
PKGNAME-objc= gobjc-${FULL_PKGVERSION}p9
PKGNAME-ada= gnat-${FULL_PKGVERSION}p7
-SHARED_LIBS= estdc++ 6.0 \
+SHARED_LIBS= estdc++ 7.0 \
g2c 1.0 \
-org-w3c-dom 1.0 \
-org-xml-sax 1.0 \
@@ -126,6 +126,7 @@ CONFIGURE_ARGS= \
--program-transform-name=s,^,e, \
--disable-nls \
--with-system-zlib \
+ --enable-__cxa_atexit \
--enable-languages=${LANGS}
# This is needed, as internal cpp is no longer compatible with the
Index: 4.2/Makefile
===================================================================
RCS file: /cvs/ports/lang/gcc/4.2/Makefile,v
retrieving revision 1.20
diff -u -p -r1.20 Makefile
--- 4.2/Makefile 23 Feb 2008 00:26:07 -0000 1.20
+++ 4.2/Makefile 29 Apr 2008 20:55:26 -0000
@@ -8,15 +8,15 @@ DATE=20070307
FULL_VERSION=4.2-${DATE}
FULL_PKGVERSION=4.2.${DATE}
-PKGNAME-main= gcc-${FULL_PKGVERSION}p5
-PKGNAME-c++ = g++-${FULL_PKGVERSION}p5
-PKGNAME-estdc= libstdc++-${FULL_PKGVERSION}p3
-PKGNAME-g77= g77-${FULL_PKGVERSION}p3
-PKGNAME-f95= g95-${FULL_PKGVERSION}p5
+PKGNAME-main= gcc-${FULL_PKGVERSION}p6
+PKGNAME-c++ = g++-${FULL_PKGVERSION}p6
+PKGNAME-estdc= libstdc++-${FULL_PKGVERSION}p4
+PKGNAME-g77= g77-${FULL_PKGVERSION}p4
+PKGNAME-f95= g95-${FULL_PKGVERSION}p6
PKGNAME-java= gcj-${FULL_PKGVERSION}p3
-PKGNAME-objc= gobjc-${FULL_PKGVERSION}p5
-PKGNAME-ada= gnat-${FULL_PKGVERSION}p4
-SHARED_LIBS= estdc++ 7.0 \
+PKGNAME-objc= gobjc-${FULL_PKGVERSION}p6
+PKGNAME-ada= gnat-${FULL_PKGVERSION}p5
+SHARED_LIBS= estdc++ 8.0 \
gfortran 2.0 \
-org-w3c-dom 1.0 \
-org-xml-sax 1.0 \
Index: 4.2/patches/patch-gcc_config_gcc
===================================================================
RCS file: /cvs/ports/lang/gcc/4.2/patches/patch-gcc_config_gcc,v
retrieving revision 1.5
diff -u -p -r1.5 patch-gcc_config_gcc
--- 4.2/patches/patch-gcc_config_gcc 19 Jun 2007 21:23:38 -0000 1.5
+++ 4.2/patches/patch-gcc_config_gcc 29 Apr 2008 20:55:26 -0000
@@ -1,6 +1,18 @@
---- gcc/config.gcc.orig Sat Feb 3 06:25:20 2007
-+++ gcc/config.gcc Wed Jun 13 20:34:15 2007
-@@ -618,7 +618,7 @@ alpha*-*-netbsd*)
+--- gcc/config.gcc.orig Sat Feb 3 00:25:20 2007
++++ gcc/config.gcc Thu Apr 10 09:14:05 2008
+@@ -552,6 +552,11 @@ case ${target} in
+ *-*-openbsd2.*|*-*-openbsd3.[012])
+ tm_defines="${tm_defines} HAS_LIBC_R=1" ;;
+ esac
++ case ${target} in
++ *-*-openbsd[1-3].*|*-*-openbsd4.[012]) ;;
++ *)
++ default_use_cxa_atexit=yes ;;
++ esac
+ ;;
+ *-*-rtems*)
+ case ${enable_threads} in
+@@ -618,7 +623,7 @@ alpha*-*-netbsd*)
;;
alpha*-*-openbsd*)
tm_defines="${tm_defines} OBSD_NO_DYNAMIC_LIBRARIES
OBSD_HAS_DECLARE_FUNCTION_NAME OBSD_HAS_DECLARE_FUNCTION_SIZE
OBSD_HAS_DECLARE_OBJECT"
@@ -9,7 +21,7 @@
# default x-alpha is only appropriate for dec-osf.
target_cpu_default="MASK_GAS"
tmake_file="alpha/t-alpha alpha/t-ieee"
-@@ -1080,10 +1080,15 @@ i[34567]86-*-openbsd2.*|i[34567]86-*openbsd3.[0123])
+@@ -1080,10 +1085,15 @@ i[34567]86-*-openbsd2.*|i[34567]86-*openbsd3.[0123])
;;
i[34567]86-*-openbsd*)
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h"
@@ -26,7 +38,7 @@
i[34567]86-*-coff*)
tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h
i386/i386-coff.h"
use_fixproto=yes
-@@ -1474,7 +1479,7 @@ m68010-*-netbsdelf* | m68k*-*-netbsdelf*)
+@@ -1474,7 +1484,7 @@ m68010-*-netbsdelf* | m68k*-*-netbsdelf*)
m68k*-*-openbsd*)
# needed to unconfuse gdb
tm_defines="${tm_defines} OBSD_OLD_GAS
TARGET_DEFAULT=(MASK_68020|MASK_68881|MASK_BITFIELD)"
@@ -35,7 +47,7 @@
tmake_file="t-libc-ok t-openbsd m68k/t-openbsd"
# we need collect2 until our bug is fixed...
use_collect2=yes
-@@ -1564,7 +1569,7 @@ mips*-*-linux*) # Linux MIPS,
either endian.
+@@ -1564,7 +1574,7 @@ mips*-*-linux*) # Linux MIPS,
either endian.
mips*-*-openbsd*)
tm_defines="${tm_defines} OBSD_HAS_DECLARE_FUNCTION_NAME
OBSD_HAS_DECLARE_OBJECT OBSD_HAS_CORRECT_SPECS"
target_cpu_default="MASK_ABICALLS"
@@ -44,7 +56,7 @@
case ${target} in
mips*el-*-openbsd*)
tm_defines="${tm_defines} TARGET_ENDIAN_DEFAULT=0";;
-@@ -1682,11 +1687,11 @@ pdp11-*-bsd)
+@@ -1682,11 +1692,11 @@ pdp11-*-bsd)
pdp11-*-*)
use_fixproto=yes
;;
@@ -61,7 +73,7 @@
powerpc64-*-linux*)
tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h
rs6000/sysv4.h"
test x$with_cpu != x || cpu_is_64bit=yes
-@@ -2150,7 +2155,7 @@ sparc-*-netbsdelf*)
+@@ -2150,7 +2160,7 @@ sparc-*-netbsdelf*)
extra_options="${extra_options} sparc/long-double-switch.opt"
;;
sparc64-*-openbsd*)
@@ -70,7 +82,7 @@
extra_options="${extra_options} sparc/little-endian.opt"
gas=yes gnu_ld=yes
with_cpu=ultrasparc
-@@ -2395,7 +2400,7 @@ vax-*-netbsd*)
+@@ -2395,7 +2405,7 @@ vax-*-netbsd*)
use_collect2=yes
;;
vax-*-openbsd*)
Index: 4.2/patches/patch-gcc_config_host-openbsd_c
===================================================================
RCS file: /cvs/ports/lang/gcc/4.2/patches/patch-gcc_config_host-openbsd_c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 patch-gcc_config_host-openbsd_c
--- 4.2/patches/patch-gcc_config_host-openbsd_c 31 Jul 2006 09:50:53 -0000
1.1.1.1
+++ 4.2/patches/patch-gcc_config_host-openbsd_c 29 Apr 2008 20:55:26 -0000
@@ -1,7 +1,7 @@
-$OpenBSD: patch-gcc_config_host-openbsd_c,v 1.1.1.1 2006/07/31 09:50:53 espie
Exp $
---- gcc/config/host-openbsd.c.orig Mon Jan 31 15:01:58 2005
-+++ gcc/config/host-openbsd.c Mon Jan 31 16:12:04 2005
-@@ -0,0 +1,41 @@
+$OpenBSD: patch-gcc_config_host-openbsd_c,v 1.1.1.1 2007/03/17 22:35:25 espie
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.
+
@@ -22,24 +22,90 @@ $OpenBSD: patch-gcc_config_host-openbsd_
+ 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 <sys/mman.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
+
-+static int
-+openbsd_gt_pch_use_address (void *base ATTRIBUTE_UNUSED,
-+ size_t size ATTRIBUTE_UNUSED, int fd ATTRIBUTE_UNUSED,
-+ size_t offset ATTRIBUTE_UNUSED)
++/* 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)
+{
-+ return -1;
++ 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;
Index: 4.2/pkg/PLIST-c++
===================================================================
RCS file: /cvs/ports/lang/gcc/4.2/pkg/PLIST-c++,v
retrieving revision 1.5
diff -u -p -r1.5 PLIST-c++
--- 4.2/pkg/PLIST-c++ 20 Mar 2007 10:48:52 -0000 1.5
+++ 4.2/pkg/PLIST-c++ 29 Apr 2008 20:55:26 -0000
@@ -505,6 +505,13 @@ include/c++/${V}/${CONFIG}/bits/gthr-tpf
include/c++/${V}/${CONFIG}/bits/gthr.h
include/c++/${V}/${CONFIG}/bits/messages_members.h
include/c++/${V}/${CONFIG}/bits/os_defines.h
+include/c++/${V}/${CONFIG}/bits/stdc++.h
+include/c++/${V}/${CONFIG}/bits/stdc++.h.gch/
+include/c++/${V}/${CONFIG}/bits/stdc++.h.gch/O0g.gch
+include/c++/${V}/${CONFIG}/bits/stdc++.h.gch/O2g.gch
+include/c++/${V}/${CONFIG}/bits/stdtr1c++.h
+include/c++/${V}/${CONFIG}/bits/stdtr1c++.h.gch/
+include/c++/${V}/${CONFIG}/bits/stdtr1c++.h.gch/O2g.gch
include/c++/${V}/${CONFIG}/bits/time_members.h
include/c++/${V}/iomanip
include/c++/${V}/ios
@@ -574,10 +581,10 @@ include/c++/${V}/tr1/stdio.h
include/c++/${V}/tr1/stdlib.h
include/c++/${V}/tr1/tgmath.h
include/c++/${V}/tr1/tuple
+include/c++/${V}/tr1/tuple_defs.h
include/c++/${V}/tr1/tuple_iterate.h
include/c++/${V}/tr1/type_traits
include/c++/${V}/tr1/type_traits_fwd.h
-include/c++/${V}/tr1/tuple_defs.h
include/c++/${V}/tr1/unordered_map
include/c++/${V}/tr1/unordered_set
include/c++/${V}/tr1/utility