Bug#163883: gcc-3.2: support for i386-freebsd-gnu (Debian freebsd-i386 port)
Package: gcc-3.2
Version: 1:3.2.1-0pre2
Severity: important
Tags: patch
The attached patch adds support for i386-*-freebsd-gnu and
alpha-*-freebsd-gnu. This is freebsd with glibc, used by freebsd-i386
port.
The patch is against 1:3.2.1ds2-0pre3, not what it says below.
-- System Information
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux hotrod 2.4.18 #1 SMP Thu May 30 01:10:09 EDT 2002 i686
Locale: LANG=C, LC_CTYPE=C
Versions of packages gcc-3.2 depends on:
ii binutils 2.13.90.0.4-1 The GNU assembler, linker and bina
ii cpp-3.2 1:3.2.1-0pre2 The GNU C preprocessor.
ii gcc-3.2-base 1:3.2.1-0pre2 The GNU Compiler Collection (base
ii libc6 2.2.5-14.3 GNU C Library: Shared libraries an
ii libgcc1 1:3.2.1-0pre2 GCC support library.
diff -urN gcc-3.2-3.2.1ds2/debian/patches/freebsd-gnu.dpatch gcc-3.2-3.2.1ds2-bak/debian/patches/freebsd-gnu.dpatch
--- gcc-3.2-3.2.1ds2/debian/patches/freebsd-gnu.dpatch 1969-12-31 19:00:00.000000000 -0500
+++ gcc-3.2-3.2.1ds2-bak/debian/patches/freebsd-gnu.dpatch 2002-10-08 20:27:31.000000000 -0400
@@ -0,0 +1,863 @@
+#! /bin/sh -e
+
+# All lines beginning with `# DPATCH:' are a description of the patch.
+# DP: GNU/FreeBSD support
+
+dir=
+if [ $# -eq 3 -a "$2" = '-d' ]; then
+ pdir="-d $3"
+ dir="$3/"
+elif [ $# -ne 1 ]; then
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+fi
+case "$1" in
+ -patch)
+ patch $pdir -f --no-backup-if-mismatch -p1 < $0
+ #cd ${dir}gcc && autoconf
+ ;;
+ -unpatch)
+ patch $pdir -f --no-backup-if-mismatch -R -p1 < $0
+ #rm ${dir}gcc/configure
+ ;;
+ *)
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+esac
+exit 0
+
+
+diff -urN src/boehm-gc/configure newsrc/boehm-gc/configure
+--- src/boehm-gc/configure 2002-05-08 02:15:14.000000000 -0400
++++ newsrc/boehm-gc/configure 2002-10-03 13:23:34.000000000 -0400
+@@ -2709,6 +2709,16 @@
+
+ THREADLIBS="-lpthread -lrt"
+ ;;
++ *-*-freebsd*-gnu*)
++ cat >> confdefs.h <<\EOF
++#define GC_LINUX_THREADS 1
++EOF
++
++ cat >> confdefs.h <<\EOF
++#define _REENTRANT 1
++EOF
++
++ ;;
+ *-*-freebsd*)
+ echo "configure: warning: "FreeBSD does not yet fully support threads with Boehm GC."" 1>&2
+ cat >> confdefs.h <<\EOF
+diff -urN src/boehm-gc/configure.in newsrc/boehm-gc/configure.in
+--- src/boehm-gc/configure.in 2002-05-08 01:48:18.000000000 -0400
++++ newsrc/boehm-gc/configure.in 2002-10-03 13:23:34.000000000 -0400
+@@ -95,6 +95,10 @@
+ AC_DEFINE(THREAD_LOCAL_ALLOC)
+ THREADLIBS="-lpthread -lrt"
+ ;;
++ *-*-freebsd*-gnu*)
++ AC_DEFINE(GC_LINUX_THREADS)
++ AC_DEFINE(_REENTRANT)
++ ;;
+ *-*-freebsd*)
+ AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
+ AC_DEFINE(GC_FREEBSD_THREADS)
+diff -urN src/boehm-gc/dbg_mlc.c newsrc/boehm-gc/dbg_mlc.c
+--- src/boehm-gc/dbg_mlc.c 2002-03-01 18:37:23.000000000 -0500
++++ newsrc/boehm-gc/dbg_mlc.c 2002-10-03 13:23:34.000000000 -0400
+@@ -60,7 +60,8 @@
+ # include <stdlib.h>
+
+ # if defined(LINUX) || defined(SUNOS4) || defined(SUNOS5) \
+- || defined(HPUX) || defined(IRIX) || defined(OSF1)
++ || defined(HPUX) || defined(IRIX) || defined(OSF1) \
++ || defined(GLIBC_FREEBSD)
+ # define RANDOM() random()
+ # else
+ # define RANDOM() (long)rand()
+@@ -819,7 +820,7 @@
+ void GC_check_heap_proc()
+ {
+ # ifndef SMALL_CONFIG
+- if (sizeof(oh) & (2 * sizeof(word) - 1) != 0) {
++ if ((sizeof(oh) & (2 * sizeof(word) - 1)) != 0) {
+ ABORT("Alignment problem: object header has inappropriate size\n");
+ }
+ # endif
+diff -urN src/boehm-gc/dyn_load.c newsrc/boehm-gc/dyn_load.c
+--- src/boehm-gc/dyn_load.c 2002-04-13 03:36:30.000000000 -0400
++++ newsrc/boehm-gc/dyn_load.c 2002-10-03 13:23:34.000000000 -0400
+@@ -26,7 +26,7 @@
+ * None of this is safe with dlclose and incremental collection.
+ * But then not much of anything is safe in the presence of dlclose.
+ */
+-#if defined(__linux__) && !defined(_GNU_SOURCE)
++#if (defined(__linux__) || defined(__gnu_freebsd__)) && !defined(_GNU_SOURCE)
+ /* Can't test LINUX, since this must be define before other includes */
+ # define _GNU_SOURCE
+ #endif
+@@ -446,7 +446,7 @@
+ /* For glibc 2.2.4+. Unfortunately, it doesn't work for older */
+ /* versions. Thanks to Jakub Jelinek for most of the code. */
+
+-# if defined(LINUX) /* Are others OK here, too? */ \
++# if (defined(LINUX) || defined(GLIBC_FREEBSD)) /* Are others OK here, too? */ \
+ && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
+ || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
+
+@@ -510,7 +510,7 @@
+ }
+ }
+
+-# else /* !LINUX || version(glibc) < 2.2.4 */
++# else /* !(LINUX || GLIBC_FREEBSD) || version(glibc) < 2.2.4 */
+
+ /* Dynamic loading code for Linux running ELF. Somewhat tested on
+ * Linux/x86, untested but hopefully should work on Linux/Alpha.
+diff -urN src/boehm-gc/include/private/gcconfig.h newsrc/boehm-gc/include/private/gcconfig.h
+--- src/boehm-gc/include/private/gcconfig.h 2002-04-22 02:27:51.000000000 -0400
++++ newsrc/boehm-gc/include/private/gcconfig.h 2002-10-03 13:23:34.000000000 -0400
+@@ -1051,25 +1051,40 @@
+ # endif
+ # ifdef FREEBSD
+ # define OS_TYPE "FREEBSD"
+-# ifndef GC_FREEBSD_THREADS
+-# define MPROTECT_VDB
+-# endif
+-# define SIG_SUSPEND SIGUSR1
+-# define SIG_THR_RESTART SIGUSR2
+ # define FREEBSD_STACKBOTTOM
+ # ifdef __ELF__
+ # define DYNAMIC_LOADING
+ # endif
++# ifdef __gnu_freebsd__
++ /* FreeBSD with glibc. Implies __ELF__. */
++# define GLIBC_FREEBSD
++# if !defined(GC_LINUX_THREADS) || !defined(REDIRECT_MALLOC)
++# define MPROTECT_VDB
++# endif
++# define SIG_SUSPEND 57 /* arbitrary signal number <= 128 */
++# define SIG_THR_RESTART 58 /* arbitrary signal number <= 128 */
++# define LINUX_DATA_START
++ extern int _end[];
++# define DATAEND (_end)
++# define USE_MMAP /* brk(0) doesn't return a meaningful value */
++# else
++ /* FreeBSD with BSD libc. */
++# ifndef GC_FREEBSD_THREADS
++# define MPROTECT_VDB
++# endif
++# define SIG_SUSPEND SIGUSR1
++# define SIG_THR_RESTART SIGUSR2
+ /* Handle unmapped hole i386*-*-freebsd[45]* may put between etext and edata. */
+- extern char etext[];
+- extern char edata[];
+- extern char end[];
+-# define NEED_FIND_LIMIT
+-# define DATASTART ((ptr_t)(etext))
+-# define MIN(x,y) ((x) < (y) ? (x) : (y))
+-# define DATAEND (MIN (GC_find_limit (DATASTART, TRUE), DATASTART2))
+-# define DATASTART2 ((ptr_t)(edata))
+-# define DATAEND2 ((ptr_t)(end))
++ extern char etext[];
++ extern char edata[];
++ extern char end[];
++# define NEED_FIND_LIMIT
++# define DATASTART ((ptr_t)(etext))
++# define MIN(x,y) ((x) < (y) ? (x) : (y))
++# define DATAEND (MIN (GC_find_limit (DATASTART, TRUE), DATASTART2))
++# define DATASTART2 ((ptr_t)(edata))
++# define DATAEND2 ((ptr_t)(end))
++# endif
+ # endif
+ # ifdef NETBSD
+ # define OS_TYPE "NETBSD"
+@@ -1764,7 +1779,7 @@
+ # if defined(GC_IRIX_THREADS) && !defined(IRIX5)
+ --> inconsistent configuration
+ # endif
+-# if defined(GC_LINUX_THREADS) && !defined(LINUX)
++# if defined(GC_LINUX_THREADS) && !(defined(LINUX) || defined(FREEBSD))
+ --> inconsistent configuration
+ # endif
+ # if defined(GC_SOLARIS_THREADS) && !defined(SUNOS5)
+@@ -1807,7 +1822,7 @@
+ /* build time, though we feel free to adjust it slightly. */
+ /* Define NEED_CALLINFO if we either save the call stack or */
+ /* GC_ADD_CALLER is defined. */
+-#ifdef LINUX
++#if defined(LINUX) || defined(GLIBC_FREEBSD)
+ # include <features.h>
+ # if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2
+ # define HAVE_BUILTIN_BACKTRACE
+@@ -1818,7 +1833,7 @@
+ # define CAN_SAVE_CALL_STACKS
+ # define CAN_SAVE_CALL_ARGS
+ #endif
+-#if defined(I386) && defined(LINUX)
++#if defined(I386) && (defined(LINUX) || defined(GLIBC_FREEBSD))
+ /* SAVE_CALL_CHAIN is supported if the code is compiled to save */
+ /* frame pointers by default, i.e. no -fomit-frame-pointer flag. */
+ # define CAN_SAVE_CALL_STACKS
+diff -urN src/boehm-gc/linux_threads.c newsrc/boehm-gc/linux_threads.c
+--- src/boehm-gc/linux_threads.c 2002-03-30 05:41:57.000000000 -0500
++++ newsrc/boehm-gc/linux_threads.c 2002-10-03 13:23:34.000000000 -0400
+@@ -992,6 +992,7 @@
+
+ #ifdef GC_LINUX_THREADS
+ /* Return the number of processors, or i<= 0 if it can't be determined. */
++# ifdef LINUX
+ int GC_get_nprocs()
+ {
+ /* Should be "return sysconf(_SC_NPROCESSORS_ONLN);" but that */
+@@ -1027,6 +1028,21 @@
+ }
+ return result;
+ }
++# endif /* LINUX */
++# ifdef FREEBSD
++#include <sys/sysctl.h>
++int GC_get_nprocs()
++{
++ int request[] = { CTL_HW, HW_NCPU };
++ int result;
++ size_t result_len = sizeof (result);
++
++ if (sysctl(request, 2, &result, &result_len, NULL, 0) < 0)
++ /* Dummy result. */
++ result = 1;
++ return result;
++}
++# endif /* FREEBSD */
+ #endif /* GC_LINUX_THREADS */
+
+ /* We hold the allocation lock. */
+@@ -1193,7 +1209,7 @@
+ UNLOCK();
+ }
+
+-GC_end_blocking(void) {
++void GC_end_blocking(void) {
+ GC_thread me;
+ LOCK(); /* This will block if the world is stopped. */
+ me = GC_lookup_thread(pthread_self());
+diff -urN src/boehm-gc/ltconfig newsrc/boehm-gc/ltconfig
+--- src/boehm-gc/ltconfig 2002-01-07 00:57:00.000000000 -0500
++++ newsrc/boehm-gc/ltconfig 2002-10-03 13:23:34.000000000 -0400
+@@ -1867,7 +1867,21 @@
+ freebsd1*)
+ dynamic_linker=no
+ ;;
+-
++
++freebsd*-gnu*)
++ version_type=linux
++ need_lib_prefix=no
++ need_version=no
++ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
++ soname_spec='${libname}${release}.so$major'
++ shlibpath_var=LD_LIBRARY_PATH
++ shlibpath_overrides_runpath=no
++ hardcode_into_libs=yes
++ dynamic_linker='GNU ld.so'
++ # Don't assume a particular installation location.
++ sys_lib_search_path_spec=""
++ ;;
++
+ freebsd*)
+ objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+ version_type=freebsd-$objformat
+diff -urN src/boehm-gc/os_dep.c newsrc/boehm-gc/os_dep.c
+--- src/boehm-gc/os_dep.c 2002-04-13 03:36:32.000000000 -0400
++++ newsrc/boehm-gc/os_dep.c 2002-10-03 13:23:34.000000000 -0400
+@@ -118,7 +118,8 @@
+ # include <fcntl.h>
+ #endif
+
+-#if defined(SUNOS5SIGS) || defined (HURD) || defined(LINUX)
++#if defined(SUNOS5SIGS) || defined (HURD) || defined(LINUX) \
++ || defined(GLIBC_FREEBSD)
+ # ifdef SUNOS5SIGS
+ # include <sys/siginfo.h>
+ # endif
+@@ -153,12 +154,12 @@
+ /* for recent Linux versions. This seems to be the easiest way to */
+ /* cover all versions. */
+
+-# ifdef LINUX
++# if defined(LINUX) || defined(GLIBC_FREEBSD)
+ # pragma weak __data_start
+ extern int __data_start[];
+ # pragma weak data_start
+ extern int data_start[];
+-# endif /* LINUX */
++# endif /* LINUX || GLIBC_FREEBSD */
+ extern int _end[];
+
+ ptr_t GC_data_start;
+@@ -167,7 +168,7 @@
+ {
+ extern ptr_t GC_find_limit();
+
+-# ifdef LINUX
++# if defined(LINUX) || defined(GLIBC_FREEBSD)
+ /* Try the easy approaches first: */
+ if (__data_start != 0) {
+ GC_data_start = (ptr_t)__data_start;
+@@ -177,7 +178,7 @@
+ GC_data_start = (ptr_t)data_start;
+ return;
+ }
+-# endif /* LINUX */
++# endif /* LINUX || GLIBC_FREEBSD */
+ GC_data_start = GC_find_limit((ptr_t)_end, FALSE);
+ }
+ #endif
+@@ -3060,7 +3061,8 @@
+ /* I suspect the following works for most X86 *nix variants, so */
+ /* long as the frame pointer is explicitly stored. In the case of gcc, */
+ /* compiler flags (e.g. -fomit-frame-pointer) determine whether it is. */
+-#if defined(I386) && defined(LINUX) && defined(SAVE_CALL_CHAIN)
++#if defined(I386) && (defined(LINUX) || defined(GLIBC_FREEBSD)) \
++ && defined(SAVE_CALL_CHAIN)
+ # include <features.h>
+
+ struct frame {
+@@ -3109,7 +3111,7 @@
+ /* Fill in the pc and argument information for up to NFRAMES of my */
+ /* callers. Ignore my frame and my callers frame. */
+
+-#ifdef LINUX
++#if defined(LINUX) || defined(GLIBC_FREEBSD)
+ # include <features.h>
+ # if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2
+ # define HAVE_BUILTIN_BACKTRACE
+diff -urN src/config.guess newsrc/config.guess
+--- src/config.guess 2002-04-16 18:03:36.000000000 -0400
++++ newsrc/config.guess 2002-10-03 13:23:34.000000000 -0400
+@@ -726,7 +726,19 @@
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ *:FreeBSD:*:*)
+- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
++ # Determine whether the default compiler uses glibc.
++ eval $set_cc_for_build
++ sed 's/^ //' << EOF >$dummy.c
++ #include <features.h>
++ #if __GLIBC__ >= 2
++ LIBC=gnu
++ #else
++ LIBC=
++ #endif
++EOF
++ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
++ rm -f $dummy.c
++ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
+ exit 0 ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin
+diff -urN src/config.sub newsrc/config.sub
+--- src/config.sub 2002-03-01 18:37:07.000000000 -0500
++++ newsrc/config.sub 2002-10-03 13:23:34.000000000 -0400
+@@ -118,7 +118,7 @@
+ # Here we must recognize all the valid KERNEL-OS combinations.
+ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+ case $maybe_os in
+- nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*)
++ nto-qnx* | linux-gnu* | freebsd*-gnu* | storm-chaos* | os2-emx* | windows32-*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+diff -urN src/configure.in newsrc/configure.in
+--- src/configure.in 2002-07-09 02:54:56.000000000 -0400
++++ newsrc/configure.in 2002-10-03 13:23:34.000000000 -0400
+@@ -363,7 +363,7 @@
+ alpha*-*-*)
+ target_makefile_frag="${target_makefile_frag} config/mt-alphaieee"
+ ;;
+- *-*-linux*)
++ *-*-linux* | *-*-freebsd*-gnu*)
+ target_makefile_frag="${target_makefile_frag} config/mt-linux"
+ ;;
+ *-*-aix4.[3456789]* | *-*-aix[56789].*)
+diff -urN src/gcc/config/alpha/freebsdgnu.h newsrc/gcc/config/alpha/freebsdgnu.h
+--- src/gcc/config/alpha/freebsdgnu.h 1969-12-31 19:00:00.000000000 -0500
++++ newsrc/gcc/config/alpha/freebsdgnu.h 2002-10-03 13:23:34.000000000 -0400
+@@ -0,0 +1,39 @@
++/* Definitions for Alpha running FreeBSD-based GNU systems with ELF format.
++ Copyright (C) 2002 Free Software Foundation, Inc.
++ Contributed by Bruno Haible.
++
++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, " (Alpha FreeBSD/ELF)");
++
++/* FIXME: Is a FreeBSD-specific fallback mechanism necessary? */
++#undef MD_FALLBACK_FRAME_STATE_FOR
++
++#undef ELF_DYNAMIC_LINKER
++#define ELF_DYNAMIC_LINKER "/lib/ld.so.1"
++
++#undef LINK_SPEC
++#define LINK_SPEC "-m elf64alpha_fbsd %{G*} %{relax:-relax} \
++ %{O*:-O3} %{!O*:-O1} \
++ %{shared:-shared} \
++ %{!shared: \
++ %{!static: \
++ %{rdynamic:-export-dynamic} \
++ %{!dynamic-linker:-dynamic-linker %(elf_dynamic_linker)}} \
++ %{static:-static}}"
+diff -urN src/gcc/config/freebsdgnu.h newsrc/gcc/config/freebsdgnu.h
+--- src/gcc/config/freebsdgnu.h 1969-12-31 19:00:00.000000000 -0500
++++ newsrc/gcc/config/freebsdgnu.h 2002-10-03 13:23:34.000000000 -0400
+@@ -0,0 +1,26 @@
++/* Definitions for FreeBSD-based GNU systems with ELF format.
++ Copyright (C) 2002 Free Software Foundation, Inc.
++ Contributed by Bruno Haible.
++
++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 WCHAR_TYPE
++#define WCHAR_TYPE "int"
++
++#undef CPP_PREDEFINES
++#define CPP_PREDEFINES "-D__FreeBSD__=4 -D__ELF__ -Dunix -D__gnu_freebsd__ -Asystem=posix"
+diff -urN src/gcc/config/i386/freebsdgnu.h newsrc/gcc/config/i386/freebsdgnu.h
+--- src/gcc/config/i386/freebsdgnu.h 1969-12-31 19:00:00.000000000 -0500
++++ newsrc/gcc/config/i386/freebsdgnu.h 2002-10-03 13:23:34.000000000 -0400
+@@ -0,0 +1,35 @@
++/* Definitions for Intel 386 running FreeBSD-based GNU systems with ELF format.
++ Copyright (C) 2002 Free Software Foundation, Inc.
++ Contributed by Bruno Haible.
++
++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, " (i386 FreeBSD/ELF)");
++
++/* FIXME: Is a FreeBSD-specific fallback mechanism necessary? */
++#undef MD_FALLBACK_FRAME_STATE_FOR
++
++#undef LINK_SPEC
++#define LINK_SPEC "-m elf_i386_fbsd %{shared:-shared} \
++ %{!shared: \
++ %{!ibcs: \
++ %{!static: \
++ %{rdynamic:-export-dynamic} \
++ %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
++ %{static:-static}}}"
+diff -urN src/gcc/config/t-freebsd-gnu newsrc/gcc/config/t-freebsd-gnu
+--- src/gcc/config/t-freebsd-gnu 1969-12-31 19:00:00.000000000 -0500
++++ newsrc/gcc/config/t-freebsd-gnu 2002-10-03 13:23:34.000000000 -0400
+@@ -0,0 +1,19 @@
++# Don't run fixproto
++STMP_FIXPROTO =
++
++# glibc provides a limits.h, which must be combined with gcc's limits.h.
++LIMITS_H_TEST = true
++
++# Compile crtbeginS.o and crtendS.o with pic.
++CRTSTUFF_T_CFLAGS_S = -fPIC
++# Compile libgcc2.a with pic.
++TARGET_LIBGCC2_CFLAGS = -fPIC
++
++# Override t-slibgcc-elf-ver to export some libgcc symbols with
++# the symbol versions that glibc used.
++SHLIB_MAPFILES += $(srcdir)/config/libgcc-glibc.ver
++
++# Use unwind-dw2-fde-glibc
++LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde-glibc.c \
++ $(srcdir)/unwind-sjlj.c
++LIB2ADDEHDEP = unwind.inc unwind-dw2-fde.h unwind-dw2-fde.c
+diff -urN src/gcc/config.gcc newsrc/gcc/config.gcc
+--- src/gcc/config.gcc 2002-08-06 16:50:05.000000000 -0400
++++ newsrc/gcc/config.gcc 2002-10-03 13:23:34.000000000 -0400
+@@ -361,7 +361,8 @@
+ ;;
+ esac
+
+-# Common parts for GNU/Linux, GNU/Hurd, OpenBSD, NetBSD, and FreeBSD systems.
++# Common parts for GNU/Linux, GNU/Hurd, GNU/FreeBSD, OpenBSD, NetBSD, and
++# FreeBSD systems.
+ case $machine in
+ *-*-linux*)
+ xm_defines=POSIX
+@@ -376,6 +377,14 @@
+ ;;
+ esac
+ ;;
++*-*-freebsd*-gnu*)
++ xm_defines=POSIX
++ # GNU/FreeBSD uses ELF.
++ elf=yes
++ # GNU tools are the only tools.
++ gnu_ld=yes
++ gas=yes
++ ;;
+ *-*-gnu*)
+ # On the Hurd, the setup is just about the same on
+ # each different CPU. The specific machines that we
+@@ -569,6 +578,16 @@
+ extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o"
+ gas=yes gnu_ld=yes
+ ;;
++alpha*-*-freebsd*-gnu*)
++ tm_file="${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h freebsdgnu.h alpha/freebsdgnu.h"
++ target_cpu_default="MASK_GAS"
++ tmake_file="t-slibgcc-elf-ver t-freebsd-gnu alpha/t-crtfm alpha/t-alpha alpha/t-ieee"
++ extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o"
++ gas=yes gnu_ld=yes
++ if test x$enable_threads = xyes; then
++ thread_file='posix'
++ fi
++ ;;
+ alpha*-*-freebsd*)
+ tm_file="${tm_file} ${fbsd_tm_file} alpha/elf.h alpha/freebsd.h"
+ target_cpu_default="MASK_GAS"
+@@ -1236,6 +1255,15 @@
+ # Next line turned off because both 386BSD and BSD/386 use GNU ld.
+ # use_collect2=yes
+ ;;
++i[34567]86-*-freebsd*-gnu*) # i386 running FreeBSD with ELF format using glibc2
++ tm_file="${tm_file} i386/att.h dbxelf.h elfos.h svr4.h linux.h i386/linux.h freebsdgnu.h i386/freebsdgnu.h"
++ tmake_file="t-slibgcc-elf-ver t-freebsd-gnu i386/t-crtstuff"
++ extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
++ float_format=i386
++ if test x$enable_threads = xyes; then
++ thread_file='posix'
++ fi
++ ;;
+ i[34567]86-*-freebsd[12] | i[34567]86-*-freebsd[12].* | i[34567]86-*-freebsd*aout*)
+ tm_file=i386/freebsd-aout.h
+ tmake_file=t-freebsd
+diff -urN src/gcc/cppfiles.c newsrc/gcc/cppfiles.c
+--- src/gcc/cppfiles.c 2002-08-15 17:34:17.000000000 -0400
++++ newsrc/gcc/cppfiles.c 2002-10-03 13:23:34.000000000 -0400
+@@ -193,11 +193,13 @@
+ cpp_reader *pfile;
+ const char *fname;
+ {
++ int saved_errno;
+ splay_tree_node node;
+ struct include_file *file;
+ char *name = xstrdup (fname);
+
+ _cpp_simplify_pathname (name);
++ saved_errno = errno;
+ node = splay_tree_lookup (pfile->all_include_files, (splay_tree_key) name);
+ if (node)
+ free (name);
+@@ -205,7 +207,7 @@
+ {
+ file = xcnew (struct include_file);
+ file->name = name;
+- file->err_no = errno;
++ file->err_no = saved_errno;
+ node = splay_tree_insert (pfile->all_include_files,
+ (splay_tree_key) file->name,
+ (splay_tree_value) file);
+diff -urN src/gcc/ginclude/stddef.h newsrc/gcc/ginclude/stddef.h
+--- src/gcc/ginclude/stddef.h 2002-03-01 18:39:03.000000000 -0500
++++ newsrc/gcc/ginclude/stddef.h 2002-10-03 13:23:34.000000000 -0400
+@@ -1,4 +1,4 @@
+-/* Copyright (C) 1989, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
++/* Copyright (C) 1989, 1997-1999, 2000, 2002 Free Software Foundation, Inc.
+
+ This file is part of GNU CC.
+
+@@ -53,7 +53,7 @@
+
+ /* On 4.3bsd-net2, make sure ansi.h is included, so we have
+ one less case to deal with in the following. */
+-#if defined (__BSD_NET2__) || defined (____386BSD____) || defined (__FreeBSD__) || defined(__NetBSD__)
++#if defined (__BSD_NET2__) || defined (____386BSD____) || (defined (__FreeBSD__) && !defined (__gnu_freebsd__)) || defined(__NetBSD__)
+ #include <machine/ansi.h>
+ #endif
+
+diff -urN src/libjava/configure newsrc/libjava/configure
+--- src/libjava/configure 2002-05-08 02:15:14.000000000 -0400
++++ newsrc/libjava/configure 2002-10-03 13:23:34.000000000 -0400
+@@ -3218,6 +3218,11 @@
+ *-*-cygwin*)
+ # Don't set THREADLIBS here. Cygwin doesn't have -lpthread.
+ ;;
++ *-*-freebsd*-gnu*)
++ # FreeBSD with glibc has -lpthread.
++ THREADLIBS=-lpthread
++ THREADSPEC=-lpthread
++ ;;
+
+ *-*-freebsd[1234]*)
+
+diff -urN src/libjava/configure.in newsrc/libjava/configure.in
+--- src/libjava/configure.in 2002-05-08 02:06:06.000000000 -0400
++++ newsrc/libjava/configure.in 2002-10-03 13:23:34.000000000 -0400
+@@ -375,6 +375,11 @@
+ *-*-cygwin*)
+ # Don't set THREADLIBS here. Cygwin doesn't have -lpthread.
+ ;;
++ *-*-freebsd*-gnu*)
++ # FreeBSD with glibc has -lpthread.
++ THREADLIBS=-lpthread
++ THREADSPEC=-lpthread
++ ;;
+ changequote(<<,>>)
+ *-*-freebsd[1234]*)
+ changequote([,])
+diff -urN src/libstdc++-v3/acinclude.m4 newsrc/libstdc++-v3/acinclude.m4
+--- src/libstdc++-v3/acinclude.m4 2002-09-13 01:24:39.000000000 -0400
++++ newsrc/libstdc++-v3/acinclude.m4 2002-10-03 13:23:34.000000000 -0400
+@@ -1118,7 +1118,7 @@
+ dnl Default to "generic"
+ if test x$enable_clocale_flag = xno; then
+ case x${target_os} in
+- xlinux* | xgnu*)
++ xlinux* | xgnu* | xfreebsd*-gnu*)
+ AC_EGREP_CPP([_GLIBCPP_ok], [
+ #include <features.h>
+ #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
+@@ -1306,7 +1306,7 @@
+ # compile most of libio for linux systems.
+ if test x$has_libio = x"yes"; then
+ case "$target" in
+- *-*-linux*)
++ *-*-linux* | *-*-freebsd*-gnu*)
+ AC_MSG_CHECKING([for glibc version >= 2.2])
+ AC_EGREP_CPP([ok], [
+ #include <features.h>
+diff -urN src/libstdc++-v3/aclocal.m4 newsrc/libstdc++-v3/aclocal.m4
+--- src/libstdc++-v3/aclocal.m4 2002-09-13 01:24:39.000000000 -0400
++++ newsrc/libstdc++-v3/aclocal.m4 2002-10-03 13:23:34.000000000 -0400
+@@ -1130,7 +1130,7 @@
+ dnl Default to "generic"
+ if test x$enable_clocale_flag = xno; then
+ case x${target_os} in
+- xlinux* | xgnu*)
++ xlinux* | xgnu* | xfreebsd*-gnu*)
+ AC_EGREP_CPP([_GLIBCPP_ok], [
+ #include <features.h>
+ #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
+@@ -1318,7 +1318,7 @@
+ # compile most of libio for linux systems.
+ if test x$has_libio = x"yes"; then
+ case "$target" in
+- *-*-linux*)
++ *-*-linux* | *-*-freebsd*-gnu*)
+ AC_MSG_CHECKING([for glibc version >= 2.2])
+ AC_EGREP_CPP([ok], [
+ #include <features.h>
+diff -urN src/libstdc++-v3/config/locale/gnu/c_locale.cc newsrc/libstdc++-v3/config/locale/gnu/c_locale.cc
+--- src/libstdc++-v3/config/locale/gnu/c_locale.cc 2002-09-05 17:37:09.000000000 -0400
++++ newsrc/libstdc++-v3/config/locale/gnu/c_locale.cc 2002-10-03 13:23:34.000000000 -0400
+@@ -40,6 +40,17 @@
+
+ namespace std
+ {
++ extern "C" __typeof (strtol_l) __strtol_l;
++ extern "C" __typeof (strtoul_l) __strtoul_l;
++ extern "C" __typeof (strtoll_l) __strtoll_l;
++ extern "C" __typeof (strtoull_l) __strtoull_l;
++ extern "C" __typeof (strtof_l) __strtof_l;
++ extern "C" __typeof (strtod_l) __strtod_l;
++ extern "C" __typeof (strtold_l) __strtold_l;
++ extern "C" __typeof (newlocale) __newlocale;
++ extern "C" __typeof (freelocale) __freelocale;
++ extern "C" __typeof (duplocale) __duplocale;
++
+ template<>
+ void
+ __convert_to_v(const char* __s, long& __v, ios_base::iostate& __err,
+diff -urN src/libstdc++-v3/config/locale/gnu/collate_members.cc newsrc/libstdc++-v3/config/locale/gnu/collate_members.cc
+--- src/libstdc++-v3/config/locale/gnu/collate_members.cc 2002-09-05 17:37:09.000000000 -0400
++++ newsrc/libstdc++-v3/config/locale/gnu/collate_members.cc 2002-10-03 13:23:34.000000000 -0400
+@@ -38,6 +38,11 @@
+
+ namespace std
+ {
++ extern "C" __typeof (strcoll_l) __strcoll_l;
++ extern "C" __typeof (strxfrm_l) __strxfrm_l;
++ extern "C" __typeof (wcscoll_l) __wcscoll_l;
++ extern "C" __typeof (wcsxfrm_l) __wcsxfrm_l;
++
+ // These are basically extensions to char_traits, and perhaps should
+ // be put there instead of here.
+ template<>
+diff -urN src/libstdc++-v3/config/locale/gnu/ctype_members.cc newsrc/libstdc++-v3/config/locale/gnu/ctype_members.cc
+--- src/libstdc++-v3/config/locale/gnu/ctype_members.cc 2002-09-05 17:37:09.000000000 -0400
++++ newsrc/libstdc++-v3/config/locale/gnu/ctype_members.cc 2002-10-03 13:23:34.000000000 -0400
+@@ -38,6 +38,11 @@
+
+ namespace std
+ {
++ extern "C" __typeof (wctype_l) __wctype_l;
++ extern "C" __typeof (towupper_l) __towupper_l;
++ extern "C" __typeof (towlower_l) __towlower_l;
++ extern "C" __typeof (iswctype_l) __iswctype_l;
++
+ // NB: The other ctype<char> specializations are in src/locale.cc and
+ // various /config/os/* files.
+ template<>
+diff -urN src/libstdc++-v3/config/locale/gnu/messages_members.cc newsrc/libstdc++-v3/config/locale/gnu/messages_members.cc
+--- src/libstdc++-v3/config/locale/gnu/messages_members.cc 2002-09-05 17:37:09.000000000 -0400
++++ newsrc/libstdc++-v3/config/locale/gnu/messages_members.cc 2002-10-03 13:23:34.000000000 -0400
+@@ -38,6 +38,7 @@
+
+ namespace std
+ {
++ extern "C" __typeof (uselocale) __uselocale;
+ // Specializations.
+ template<>
+ string
+diff -urN src/libstdc++-v3/config/locale/gnu/messages_members.h newsrc/libstdc++-v3/config/locale/gnu/messages_members.h
+--- src/libstdc++-v3/config/locale/gnu/messages_members.h 2002-09-05 17:37:09.000000000 -0400
++++ newsrc/libstdc++-v3/config/locale/gnu/messages_members.h 2002-10-03 13:23:34.000000000 -0400
+@@ -33,6 +33,8 @@
+
+ // Written by Benjamin Kosnik <bkoz@redhat.com>
+
++ extern "C" __typeof (uselocale) __uselocale;
++
+ // Non-virtual member functions.
+ template<typename _CharT>
+ typename messages<_CharT>::catalog
+diff -urN src/libstdc++-v3/config/locale/gnu/monetary_members.cc newsrc/libstdc++-v3/config/locale/gnu/monetary_members.cc
+--- src/libstdc++-v3/config/locale/gnu/monetary_members.cc 2002-09-05 17:37:09.000000000 -0400
++++ newsrc/libstdc++-v3/config/locale/gnu/monetary_members.cc 2002-10-03 13:23:34.000000000 -0400
+@@ -38,6 +38,8 @@
+
+ namespace std
+ {
++ extern "C" __typeof (nl_langinfo_l) __nl_langinfo_l;
++
+ // Construct and return valid pattern consisting of some combination of:
+ // space none symbol sign value
+ money_base::pattern
+diff -urN src/libstdc++-v3/config/locale/gnu/numeric_members.cc newsrc/libstdc++-v3/config/locale/gnu/numeric_members.cc
+--- src/libstdc++-v3/config/locale/gnu/numeric_members.cc 2002-09-05 17:37:10.000000000 -0400
++++ newsrc/libstdc++-v3/config/locale/gnu/numeric_members.cc 2002-10-03 13:23:34.000000000 -0400
+@@ -38,6 +38,8 @@
+
+ namespace std
+ {
++ extern "C" __typeof (nl_langinfo_l) __nl_langinfo_l;
++
+ template<>
+ void
+ numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
+diff -urN src/libstdc++-v3/config/locale/gnu/time_members.cc newsrc/libstdc++-v3/config/locale/gnu/time_members.cc
+--- src/libstdc++-v3/config/locale/gnu/time_members.cc 2002-09-05 17:37:10.000000000 -0400
++++ newsrc/libstdc++-v3/config/locale/gnu/time_members.cc 2002-10-03 13:23:34.000000000 -0400
+@@ -39,6 +39,10 @@
+
+ namespace std
+ {
++ extern "C" __typeof (strftime_l) __strftime_l;
++ extern "C" __typeof (wcsftime_l) __wcsftime_l;
++ extern "C" __typeof (nl_langinfo_l) __nl_langinfo_l;
++
+ template<>
+ __timepunct<char>::~__timepunct()
+ {
+diff -urN src/libstdc++-v3/configure newsrc/libstdc++-v3/configure
+--- src/libstdc++-v3/configure 2002-09-13 01:25:17.000000000 -0400
++++ newsrc/libstdc++-v3/configure 2002-10-03 13:23:34.000000000 -0400
+@@ -2793,7 +2793,7 @@
+ # compile most of libio for linux systems.
+ if test x$has_libio = x"yes"; then
+ case "$target" in
+- *-*-linux*)
++ *-*-linux* | *-*-freebsd*-gnu*)
+ echo $ac_n "checking for glibc version >= 2.2""... $ac_c" 1>&6
+ echo "configure:2799: checking for glibc version >= 2.2" >&5
+ cat > conftest.$ac_ext <<EOF
+@@ -2927,7 +2927,7 @@
+
+ if test x$enable_clocale_flag = xno; then
+ case x${target_os} in
+- xlinux* | xgnu*)
++ xlinux* | xgnu* | xfreebsd*-gnu*)
+ cat > conftest.$ac_ext <<EOF
+ #line 2933 "configure"
+ #include "confdefs.h"
+diff -urN src/libstdc++-v3/configure.target newsrc/libstdc++-v3/configure.target
+--- src/libstdc++-v3/configure.target 2002-09-06 17:36:37.000000000 -0400
++++ newsrc/libstdc++-v3/configure.target 2002-10-03 13:23:34.000000000 -0400
+@@ -80,6 +80,9 @@
+ os_include_dir="config/os/aix"
+ OPT_LDFLAGS="-Wl,-G"
+ ;;
++ freebsd*-gnu*)
++ os_include_dir="config/os/gnu-linux"
++ ;;
+ bsd* | freebsd* )
+ os_include_dir="config/os/bsd/freebsd"
+ ;;
+diff -urN src/ltconfig newsrc/ltconfig
+--- src/ltconfig 2001-10-02 15:40:10.000000000 -0400
++++ newsrc/ltconfig 2002-10-03 13:23:34.000000000 -0400
+@@ -1115,6 +1115,20 @@
+ dynamic_linker=no
+ ;;
+
++freebsd*-gnu*)
++ version_type=linux
++ need_lib_prefix=no
++ need_version=no
++ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
++ soname_spec='${libname}${release}.so$major'
++ shlibpath_var=LD_LIBRARY_PATH
++ shlibpath_overrides_runpath=no
++ hardcode_into_libs=yes
++ dynamic_linker='GNU ld.so'
++ # Don't assume a particular installation location.
++ sys_lib_search_path_spec=""
++ ;;
++
+ freebsd*)
+ objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+ version_type=freebsd-$objformat
diff -urN gcc-3.2-3.2.1ds2/debian/rules.conf gcc-3.2-3.2.1ds2-bak/debian/rules.conf
--- gcc-3.2-3.2.1ds2/debian/rules.conf 2002-10-08 20:18:19.000000000 -0400
+++ gcc-3.2-3.2.1ds2-bak/debian/rules.conf 2002-10-08 20:26:34.000000000 -0400
@@ -77,10 +77,14 @@
ifeq ($(DEB_HOST_GNU_SYSTEM),gnu)
ctrl_flags += -DLIBC_DEV=libc0.3-dev
else
- ctrl_flags += -DLIBC_DEV="libc6-dev (>= $(libc_ver))"
+ ifeq ($(DEB_HOST_GNU_SYSTEM),freebsd)
+ ctrl_flags += -DLIBC_DEV=libc1-dev
+ else
+ ctrl_flags += -DLIBC_DEV="libc6-dev (>= $(libc_ver))"
+ endif
endif
endif
-ctrl_flags += -DLIBC_BUILD_DEP="libc6.1-dev (>= $(libc_ver)) | libc6-dev (>= $(libc_ver)) | libc0.3-dev"
+ctrl_flags += -DLIBC_BUILD_DEP="libc6.1-dev (>= $(libc_ver)) | libc6-dev (>= $(libc_ver)) | libc0.3-dev | libc1-dev"
ifneq ($(GCC_TARGET),)
ctrl_flags += \
diff -urN gcc-3.2-3.2.1ds2/debian/rules.defs gcc-3.2-3.2.1ds2-bak/debian/rules.defs
--- gcc-3.2-3.2.1ds2/debian/rules.defs 2002-10-08 20:18:19.000000000 -0400
+++ gcc-3.2-3.2.1ds2-bak/debian/rules.defs 2002-10-08 20:28:22.000000000 -0400
@@ -109,7 +109,7 @@
# Java --------------------
# java converted for V3 C++ ABI for some archs
with_java := yes
-no_java_archs := hppa hurd-i386 mips mipsel
+no_java_archs := hppa hurd-i386 mips mipsel freebsd-i386
ifneq ($(DEB_HOST_ARCH),i386)
ifeq ($(DEB_HOST_ARCH), $(findstring $(DEB_HOST_ARCH),$(no_java_archs)))
with_java := disabled for architecure $(DEB_HOST_ARCH)
@@ -132,7 +132,7 @@
# libffi -------------------
ifeq ($(with_31pkgs),yes)
with_ffi := yes
- no_ffi_archs := hppa mips mipsel hurd-i386
+ no_ffi_archs := hppa mips mipsel hurd-i386 freebsd-i386
ifneq ($(with_java),yes)
ifeq ($(DEB_HOST_ARCH), $(findstring $(DEB_HOST_ARCH),$(no_ffi_archs)))
with_ffi := disabled for architecure $(DEB_HOST_ARCH)
@@ -196,7 +196,7 @@
# the ObjC runtime with garbage collection enabled needs the Boehm GC
with_objc_gc := yes
# disable ObjC garbage collection library (needs libgc6)
-libgc6_no_archs := avr
+libgc6_no_archs := avr freebsd-i386
ifneq ($(DEB_HOST_ARCH),i386)
ifeq ($(DEB_HOST_ARCH),$(findstring $(DEB_HOST_ARCH),$(libgc6_no_archs)))
with_objc_gc := disabled for architecture $(DEB_HOST_ARCH)
@@ -217,7 +217,7 @@
# Ada --------------------
with_ada := yes
with_shared_adalib := no
-ada_no_archs := arm hurd-i386 m68k
+ada_no_archs := arm hurd-i386 m68k freebsd-i386
ifneq ($(DEB_HOST_ARCH),i386)
ifeq ($(DEB_HOST_ARCH), $(findstring $(DEB_HOST_ARCH),$(ada_no_archs)))
with_ada := disabled for architecure $(DEB_HOST_ARCH)
diff -urN gcc-3.2-3.2.1ds2/debian/rules.patch gcc-3.2-3.2.1ds2-bak/debian/rules.patch
--- gcc-3.2-3.2.1ds2/debian/rules.patch 2002-10-08 20:18:19.000000000 -0400
+++ gcc-3.2-3.2.1ds2-bak/debian/rules.patch 2002-10-03 13:47:03.000000000 -0400
@@ -78,6 +78,10 @@
debian_patches += sparc64-build
endif
+ifeq ($(DEB_HOST_ARCH),freebsd-i386)
+ debian_patches += freebsd-gnu
+endif
+
debian_patches += reporting # applied after gcc-cvs-updates
patch: $(patch_stamp)
Reply to: