Package: gcc-3.5
Version: 3.5ds1-0pre1
Severity: wishlist
Tags: patch
Hi!
I'm attaching two patches that fix configuration for GNU/k*BSD:
- kbsd-gnu.dpatch: This is an update for debian/patches/kbsd-gnu.dpatch
- gcc-3.5.diff: These are the fixes to the Debian package itself.
The summary of changes for gcc-3.5.diff follows. It includes a rationale for
every change as footnotes. Let me know if any of these requires further
explanation (All them are necessary for proper portability support, and I
have checked that the generated debian/control contains correct dpkg tags).
Summary of changes:
* control.m4:
- s/locale_no_archs !hurd-i386/locale_no_archs/g
(This is now handled in rules.defs. [1])
- s/procps [check_no_archs]/procps [linux-gnu_archs]/g [2]
- Add type-handling to build-deps. [3]
* rules.conf:
- Don't require (>= $(libc_ver)) for libc0.1-dev. [4]
- Generate *_no_archs variables with type-handling and use them for
for m4's -D parameters. [3]
* rules.defs:
- use filter instead of findstring [1].
- s/netbsd-elf-gnu/netbsdelf-gnu/g [5].
- enable java for kfreebsd-gnu [6]
- enable ffi for kfreebsd-gnu and knetbsd-gnu [6]
- enable libgc for kfreebsd-gnu [6]
- enable checks for kfreebsd-gnu and knetbsd-gnu [7]
- enable locales for kfreebsd-gnu and gnu [1] [8].
Rationales:
[1] When using $(findstring foo,bar), we had the problem that 'gnu'
matched the strings for other systems, like 'kfreebsd-gnu'.
Apparently, 'gnu' was excluded from locale_no_systems to avoid that,
and instead hardcoded in control.m4 as !hurd-i386.
By using $(filter foo,bar) instead of findstring, whitespace terminations
are checked, and therefore it's no longer a problem if 'gnu' matches
'kfreebsd-gnu' or such.
I've replaced all findstring checks for CPUs or systems with equivalent
filter checks. This will avoid future problems (e.g. 'mips' matching
'mipsel').
[2] procps is Linux-specific. Since only linux-based systems had the check
option enabled so far, this wasn't a problem. Now that we're enabling
checks for k*bsd-gnu, we have to make procps a requirement only for
linux-gnu systems.
[3] type-handling is used to generate the list of architectures dpkg can
understand, using the cpu and system variables one can sanely work with
(i.e. without gratuitously referring to CPU for system checks, and
without gratuitously referring to system for CPU checks).
[4] We don't have an up-to-date version of libc0.1-dev on GNU/k*BSD (yet).
[5] This fixes a wrong string that was added in one of my previous patches.
Sorry.
[6] Java and ffi were ported in upstream. libgc is ported in kbsd-gnu.dpatch.
[7] Checks always worked on these systems, so no reason to disable them.
[8] We have locales on kfreebsd-gnu now.
-- System Information:
Debian Release: testing/unstable
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: kfreebsd-i386 (i386)
Kernel: GNU/kFreeBSD 5.2.1-5
Locale: LANG=C, LC_CTYPE=C (ignored: LC_ALL set to C)
diff -ur gcc-3.5-3.5ds1.old/debian/control.m4 gcc-3.5-3.5ds1/debian/control.m4
--- gcc-3.5-3.5ds1.old/debian/control.m4 2004-08-06 01:16:08.000000000 +0200
+++ gcc-3.5-3.5ds1/debian/control.m4 2004-08-06 21:13:10.000000000 +0200
@@ -39,7 +39,7 @@
ifdef(`TARGET',`dnl cross
Build-Depends: LIBC_BUILD_DEP, m4, autoconf2.13, automake1.7, libtool, autotools-dev, gawk, dpkg-cross (>= 1.14.5), binutils`'TS
',`dnl native
-Build-Depends: LIBC_BUILD_DEP, libc6-dev-sparc64 [sparc], libc6-dev-s390x [s390], m4, autoconf, autoconf2.13, automake1.8, libtool, gawk, dejagnu (>= 1.4.3) [check_no_archs], expect (>= 5.38.0) [check_no_archs], bzip2, BINUTILS_BUILD_DEP, binutils-hppa64 [hppa], debhelper (>= 4.1), gperf (>= 2.7-3), bison (>= 1:1.875a-1), flex, gettext, texinfo (>= 4.3), zlib1g-dev, libgc-dev [libgc_no_archs], xlibs-dev, gnat-3.3 [ada_no_archs] | gnat-3.4 [ada_no_archs], libncurses5-dev [pascal_no_archs], libgmp3-dev, tetex-bin [pascal_no_archs], locales [locale_no_archs !hurd-i386], procps [check_no_archs], help2man [pascal_no_archs], sharutils, libgtk2.0-dev [java_no_archs], libart-2.0-dev [java_no_archs], g++-3.3, gobjc-3.3
+Build-Depends: LIBC_BUILD_DEP, libc6-dev-sparc64 [sparc], libc6-dev-s390x [s390], m4, autoconf, autoconf2.13, automake1.8, libtool, gawk, dejagnu (>= 1.4.3) [check_no_archs], expect (>= 5.38.0) [check_no_archs], bzip2, BINUTILS_BUILD_DEP, binutils-hppa64 [hppa], debhelper (>= 4.1), gperf (>= 2.7-3), bison (>= 1:1.875a-1), flex, gettext, texinfo (>= 4.3), zlib1g-dev, libgc-dev [libgc_no_archs], xlibs-dev, gnat-3.3 [ada_no_archs] | gnat-3.4 [ada_no_archs], libncurses5-dev [pascal_no_archs], libgmp3-dev, tetex-bin [pascal_no_archs], locales [locale_no_archs], procps [linux-gnu_archs], help2man [pascal_no_archs], sharutils, libgtk2.0-dev [java_no_archs], libart-2.0-dev [java_no_archs], g++-3.3, gobjc-3.3, type-handling (>= 0.2.1)
Build-Depends-Indep: doxygen (>= 1.3.7)
')dnl
diff -ur gcc-3.5-3.5ds1.old/debian/rules.conf gcc-3.5-3.5ds1/debian/rules.conf
--- gcc-3.5-3.5ds1.old/debian/rules.conf 2004-08-06 01:16:08.000000000 +0200
+++ gcc-3.5-3.5ds1/debian/rules.conf 2004-08-06 01:42:31.000000000 +0200
@@ -34,7 +34,7 @@
ifeq ($(DEB_TARGET_GNU_SYSTEM),netbsd-elf-gnu)
LIBC_DEP = libc12-dev
endif
-LIBC_BUILD_DEP = libc6.1-dev (>= $(libc_ver)) [alpha ia64] | libc0.3-dev (>= $(libc_ver)) | libc0.1-dev (>= $(libc_ver)) | libc12-dev (>= $(libc_ver)) | libc6-dev (>= $(libc_ver))
+LIBC_BUILD_DEP = libc6.1-dev (>= $(libc_ver)) [alpha ia64] | libc0.3-dev (>= $(libc_ver)) | libc0.1-dev | libc12-dev (>= $(libc_ver)) | libc6-dev (>= $(libc_ver))
SOURCE_VERSION := $(shell dpkg-parsechangelog | awk '/^Version:/ {print $$NF}')
DEB_VERSION := $(shell echo $(SOURCE_VERSION) \
@@ -169,6 +169,27 @@
lib64objc lib64g2c libnof objcdev proto
endif
+ada_no_archs := `type-handling -n \`echo $(ada_no_cpus) \
+ | sed "s/ /,/g"\` any` `type-handling -n any \`echo $(ada_no_systems) \
+ | sed "s/ /,/g"\``
+java_no_archs := `type-handling -n \`echo $(java_no_cpus) \
+ | sed "s/ /,/g"\` any` `type-handling -n any \`echo $(java_no_systems) \
+ | sed "s/ /,/g"\``
+pascal_no_archs := `type-handling -n \`echo $(pascal_no_cpus) \
+ | sed "s/ /,/g"\` any` `type-handling -n any \`echo $(pascal_no_systems) \
+ | sed "s/ /,/g"\``
+libgc_no_archs := `type-handling -n \`echo $(libgc_no_cpus) \
+ | sed "s/ /,/g"\` any` `type-handling -n any \`echo $(libgc_no_systems) \
+ | sed "s/ /,/g"\``
+check_no_archs := `type-handling -n \`echo $(check_no_cpus) \
+ | sed "s/ /,/g"\` any` `type-handling -n any \`echo $(check_no_systems) \
+ | sed "s/ /,/g"\``
+locale_no_archs := `type-handling -n \`echo $(locale_no_cpus) \
+ | sed "s/ /,/g"\` any` `type-handling -n any \`echo $(locale_no_systems) \
+ | sed "s/ /,/g"\``
+
+linux-gnu_archs := `type-handling any linux-gnu`
+
control-file:
echo "addons: $(addons)"; \
m4 $(ctrl_flags) \
@@ -185,12 +206,13 @@
-DFFI_SO=$(FFI_SONAME) \
-DMF_SO=$(MUDFLAP_SONAME) \
-Denabled_languages="$(languages) $(addons)" \
- -Dada_no_archs="$(foreach arch,$(ada_no_cpus) $(ada_no_systems),!$(arch))" \
- -Djava_no_archs="$(foreach arch,$(java_no_cpus) $(java_no_systems),!$(arch))" \
- -Dpascal_no_archs="$(foreach arch,$(pascal_no_cpus) $(pascal_no_systems),!$(arch))" \
- -Dlibgc_no_archs="$(foreach arch,$(libgc_no_cpus) $(libgc_no_systems),!$(arch))" \
- -Dcheck_no_archs="$(foreach arch,$(check_no_cpus) $(check_no_systems),!$(arch))" \
- -Dlocale_no_archs="$(foreach arch,$(locale_no_cpus) $(locale_no_systems),!$(arch))" \
+ -Dada_no_archs="$(ada_no_archs)" \
+ -Djava_no_archs="$(java_no_archs)" \
+ -Dpascal_no_archs="$(pascal_no_archs)" \
+ -Dlibgc_no_archs="$(libgc_no_archs)" \
+ -Dcheck_no_archs="$(check_no_archs)" \
+ -Dlocale_no_archs="$(locale_no_archs)" \
+ -Dlinux-gnu_archs="$(linux-gnu_archs)" \
debian/control.m4 > debian/control.tmp2
uniq debian/control.tmp2 > debian/control.tmp
rm -f debian/control.tmp2
diff -ur gcc-3.5-3.5ds1.old/debian/rules.defs gcc-3.5-3.5ds1/debian/rules.defs
--- gcc-3.5-3.5ds1.old/debian/rules.defs 2004-08-06 01:16:08.000000000 +0200
+++ gcc-3.5-3.5ds1/debian/rules.defs 2004-08-06 04:40:58.000000000 +0200
@@ -97,7 +97,7 @@
with_common_libs := yes
#no_common_libs := s390
-#ifeq ($(DEB_TARGET_GNU_CPU), $(findstring $(DEB_TARGET_GNU_CPU),$(no_common_libs)))
+#ifneq (, $(filter $(DEB_TARGET_GNU_CPU),$(no_common_libs)))
# with_common_libs := no
#endif
@@ -105,7 +105,7 @@
#no_dummy_cpus := ia64 i386 hppa s390 sparc
#with_base_only := yes
-#ifeq ($(DEB_TARGET_GNU_CPU), $(findstring $(DEB_TARGET_GNU_CPU),$(no_dummy_cpus)))
+#ifneq (, $(filter $(DEB_TARGET_GNU_CPU),$(no_dummy_cpus)))
# with_base_only := no
# with_common_libs := yes
# with_common_pkgs := yes
@@ -138,7 +138,7 @@
with_cxx := yes
endif
no_cxx_cpus := avr
-ifeq ($(DEB_TARGET_GNU_CPU), $(findstring $(DEB_TARGET_GNU_CPU),$(no_cxx_cpus)))
+ifneq (, $(filter $(DEB_TARGET_GNU_CPU),$(no_cxx_cpus)))
with_cxx := disabled for architecture $(DEB_TARGET_GNU_CPU)
endif
ifeq (c++, $(findstring c++,$(WITHOUT_LANG)))
@@ -171,7 +171,7 @@
with_debug := no
endif
debug_no_cpus :=
-ifeq ($(DEB_TARGET_GNU_CPU), $(findstring $(DEB_TARGET_GNU_CPU),$(debug_no_cpus)))
+ifneq (, $(filter $(DEB_TARGET_GNU_CPU),$(debug_no_cpus)))
with_debug := disabled for architecure $(DEB_TARGET_GNU_CPU)
endif
@@ -180,8 +180,8 @@
# The __cxa_atexit API does not exist in some libc version (NetBSD)
with_cxa_atexit := yes
-no_cxa_systems := netbsd-elf-gnu
-ifeq ($(DEB_TARGET_GNU_SYSTEM), $(findstring $(DEB_TARGET_GNU_SYSTEM),$(no_cxa_systems)))
+no_cxa_systems := netbsdelf-gnu
+ifneq (, $(filter $(DEB_TARGET_GNU_SYSTEM),$(no_cxa_systems)))
with_cxa_atexit := disabled for $(DEB_TARGET_GNU_SYSTEM)
endif
@@ -193,8 +193,8 @@
with_java := yes
endif
-java_no_systems := gnu kfreebsd-gnu knetbsd-gnu netbsd-elf-gnu
-ifeq ($(DEB_TARGET_GNU_SYSTEM), $(findstring $(DEB_TARGET_GNU_SYSTEM),$(java_no_systems)))
+java_no_systems := gnu knetbsd-gnu netbsdelf-gnu
+ifneq (, $(filter $(DEB_TARGET_GNU_SYSTEM),$(java_no_systems)))
with_java := disabled for $(DEB_TARGET_GNU_SYSTEM)
endif
ifdef DEB_CROSS
@@ -241,12 +241,12 @@
ifeq ($(with_common_libs),yes)
with_libffi := yes
no_ffi_cpus :=
- no_ffi_systems := gnu kfreebsd-gnu knetbsd-gnu netbsd-elf-gnu
+ no_ffi_systems := gnu netbsdelf-gnu
ifneq ($(with_java),yes)
- ifeq ($(DEB_TARGET_GNU_CPU), $(findstring $(DEB_TARGET_GNU_CPU),$(no_ffi_cpus)))
+ ifneq (, $(filter $(DEB_TARGET_GNU_CPU),$(no_ffi_cpus)))
with_libffi := disabled for architecure $(DEB_TARGET_GNU_CPU)
endif
- ifeq ($(DEB_TARGET_GNU_SYSTEM), $(findstring $(DEB_TARGET_GNU_SYSTEM),$(no_ffi_systems)))
+ ifneq (, $(filter $(DEB_TARGET_GNU_SYSTEM),$(no_ffi_systems)))
with_libffi := disabled for $(DEB_TARGET_GNU_SYSTEM)
endif
endif
@@ -278,7 +278,7 @@
endif
ifeq ($(with_common_libs)-$(with_f77),yes-yes)
- ifeq ($(DEB_TARGET_GNU_CPU),$(findstring $(DEB_TARGET_GNU_CPU),mipsel))
+ ifneq (, $(filter $(DEB_TARGET_GNU_CPU),mipsel))
with_libg2c := disable on mipsel for gcc-3.4
else
with_libg2c := yes
@@ -352,12 +352,12 @@
with_pascal := no
endif
-pascal_no_systems := netbsd-elf-gnu
-ifeq ($(DEB_TARGET_GNU_SYSTEM),$(findstring $(DEB_TARGET_GNU_SYSTEM),$(pascal_no_systems)))
+pascal_no_systems := netbsdelf-gnu
+ifneq (, $(filter $(DEB_TARGET_GNU_SYSTEM),$(pascal_no_systems)))
with_pascal := disabled for $(DEB_TARGET_GNU_SYSTEM)
endif
with_gpidump := yes
-ifeq ($(DEB_TARGET_GNU_CPU),$(findstring $(DEB_TARGET_GNU_CPU),mips mipsel))
+ifneq (, $(filter $(DEB_TARGET_GNU_CPU),mips mipsel))
with_gpidump := disabled for architecture $(DEB_TARGET_GNU_CPU)
endif
pascal_version := 20030830
@@ -383,11 +383,11 @@
# disable ObjC garbage collection library (needs libgc)
libgc_no_cpus := avr
-libgc_no_systems := kfreebsd-gnu knetbsd-gnu
-ifeq ($(DEB_TARGET_GNU_CPU),$(findstring $(DEB_TARGET_GNU_CPU),$(libgc_no_cpus)))
+libgc_no_systems := knetbsd-gnu
+ifneq (, $(filter $(DEB_TARGET_GNU_CPU),$(libgc_no_cpus)))
with_objc_gc := disabled for architecture $(DEB_TARGET_GNU_CPU)
endif
-ifeq ($(DEB_TARGET_GNU_SYSTEM),$(findstring $(DEB_TARGET_GNU_SYSTEM),$(libgc_no_systems)))
+ifneq (, $(filter $(DEB_TARGET_GNU_SYSTEM),$(libgc_no_systems)))
with_objc_gc := disabled for $(DEB_TARGET_GNU_SYSTEM)
endif
with_objc_gc := disabled for gcc-3.4
@@ -426,11 +426,11 @@
with_libgnat := yes
ada_no_cpus := arm m68k
-ada_no_systems := gnu kfreebsd-gnu knetbsd-gnu netbsd-elf-gnu
-ifeq ($(DEB_TARGET_GNU_CPU), $(findstring $(DEB_TARGET_GNU_CPU),$(ada_no_cpus)))
+ada_no_systems := gnu kfreebsd-gnu knetbsd-gnu netbsdelf-gnu
+ifneq (, $(filter $(DEB_TARGET_GNU_CPU),$(ada_no_cpus)))
with_ada := disabled for architecure $(DEB_TARGET_GNU_CPU)
endif
-ifeq ($(DEB_TARGET_GNU_SYSTEM), $(findstring $(DEB_TARGET_GNU_SYSTEM),$(ada_no_systems)))
+ifneq (, $(filter $(DEB_TARGET_GNU_SYSTEM),$(ada_no_systems)))
with_ada := disabled for $(DEB_TARGET_GNU_SYSTEM)
endif
ifeq (ada, $(findstring ada,$(WITHOUT_LANG)))
@@ -443,14 +443,14 @@
with_ada := disabled for gcc-3.5
# needed for 3.4 on alpha, but not for release tarballs
-ifeq ($(DEB_HOST_GNU_CPU),$(findstring $(DEB_HOST_GNU_CPU),alpha))
+ifneq (, $(filter $(DEB_HOST_GNU_CPU),alpha))
with_ada_bootstrap_workaround := yes
endif
ifeq ($(with_ada),yes)
enabled_languages += ada
libada_no_cpus := alpha mips mipsel powerpc s390 sparc
- ifeq ($(DEB_TARGET_GNU_CPU), $(findstring $(DEB_TARGET_GNU_CPU),$(libada_no_cpus)))
+ ifneq (, $(filter $(DEB_TARGET_GNU_CPU),$(libada_no_cpus)))
with_libgnat := disabled for architecure $(DEB_TARGET_GNU_CPU)
endif
else
@@ -468,7 +468,7 @@
endif
endif
tl_no_cpus := powerpc
-ifeq ($(DEB_TARGET_GNU_CPU), $(findstring $(DEB_TARGET_GNU_CPU),$(tl_no_cpus)))
+ifneq (, $(filter $(DEB_TARGET_GNU_CPU),$(tl_no_cpus)))
with_treelang := disabled for architecure $(DEB_TARGET_GNU_CPU)
endif
ifdef DEB_CROSS
@@ -503,8 +503,8 @@
ifdef DEB_CROSS
with_check := disabled for cross compiler package
endif
-check_no_systems := gnu kfreebsd-gnu knetbsd-gnu
-ifeq ($(DEB_TARGET_GNU_SYSTEM), $(findstring $(DEB_TARGET_GNU_SYSTEM),$(check_no_systems)))
+check_no_systems := gnu
+ifneq (, $(filter $(DEB_TARGET_GNU_SYSTEM),$(check_no_systems)))
with_check := disabled for $(DEB_TARGET_GNU_SYSTEM)
endif
ifneq ($(WITHOUT_CHECK),)
@@ -564,8 +564,8 @@
# GNU locales
force_gnu_locales := yes
-locale_no_systems := kfreebsd-gnu knetbsd-gnu netbsd-elf-gnu
-ifeq ($(DEB_TARGET_GNU_SYSTEM), $(findstring $(DEB_TARGET_GNU_SYSTEM),$(locale_no_systems)))
+locale_no_systems := gnu knetbsd-gnu netbsdelf-gnu
+ifneq (, $(filter $(DEB_TARGET_GNU_SYSTEM),$(locale_no_systems)))
force_gnu_locales := disabled for $(DEB_TARGET_GNU_SYSTEM)
endif
#! /bin/sh -e
# DP: GNU/k*BSD support
# Author: Robert Millan <robertmh@gnu.org>
# Status: pending
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
;;
-unpatch)
patch $pdir -f --no-backup-if-mismatch -R -p1 < $0
;;
*)
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
esac
exit 0
# append the patch here and adjust the -p? flag in the patch calls.
diff -Nur gcc-20040724.old/boehm-gc/configure gcc-20040724/boehm-gc/configure
--- gcc-20040724.old/boehm-gc/configure 2004-06-17 21:32:41.000000000 +0200
+++ gcc-20040724/boehm-gc/configure 2004-08-06 01:53:05.000000000 +0200
@@ -5337,6 +5337,12 @@
_ACEOF
;;
+ *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu)
+ cat >>confdefs.h <<\_ACEOF
+#define _REENTRANT 1
+_ACEOF
+
+ ;;
*-*-aix*)
cat >>confdefs.h <<\_ACEOF
#define GC_AIX_THREADS 1
diff -Nur gcc-20040724.old/boehm-gc/configure.ac gcc-20040724/boehm-gc/configure.ac
--- gcc-20040724.old/boehm-gc/configure.ac 2004-06-16 09:34:42.000000000 +0200
+++ gcc-20040724/boehm-gc/configure.ac 2004-08-06 01:53:05.000000000 +0200
@@ -138,6 +138,9 @@
AC_DEFINE(GC_LINUX_THREADS)
AC_DEFINE(_REENTRANT)
;;
+ *-*-gnu* | *-*-k*bsd*-gnu)
+ AC_DEFINE(_REENTRANT)
+ ;;
*-*-aix*)
AC_DEFINE(GC_AIX_THREADS)
AC_DEFINE(_REENTRANT)
diff -Nur gcc-20040724.old/boehm-gc/dbg_mlc.c gcc-20040724/boehm-gc/dbg_mlc.c
--- gcc-20040724.old/boehm-gc/dbg_mlc.c 2003-07-28 06:18:20.000000000 +0200
+++ gcc-20040724/boehm-gc/dbg_mlc.c 2004-08-06 01:53:05.000000000 +0200
@@ -59,7 +59,7 @@
# include <stdlib.h>
-# if defined(LINUX) || defined(SUNOS4) || defined(SUNOS5) \
+# if defined(LINUX) || defined(GLIBC) || defined(SUNOS4) || defined(SUNOS5) \
|| defined(HPUX) || defined(IRIX5) || defined(OSF1)
# define RANDOM() random()
# else
diff -Nur gcc-20040724.old/boehm-gc/dyn_load.c gcc-20040724/boehm-gc/dyn_load.c
--- gcc-20040724.old/boehm-gc/dyn_load.c 2003-07-30 19:42:28.000000000 +0200
+++ gcc-20040724/boehm-gc/dyn_load.c 2004-08-06 01:53:05.000000000 +0200
@@ -26,7 +26,8 @@
* 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__) || defined(__GLIBC__)) \
+ && !defined(_GNU_SOURCE)
/* Can't test LINUX, since this must be define before other includes */
# define _GNU_SOURCE
#endif
@@ -56,7 +57,7 @@
!(defined(ALPHA) && defined(OSF1)) && \
!defined(HPUX) && !(defined(LINUX) && defined(__ELF__)) && \
!defined(RS6000) && !defined(SCO_ELF) && !defined(DGUX) && \
- !(defined(FREEBSD) && defined(__ELF__)) && \
+ !(defined(KFREEBSD) && defined(__ELF__)) && \
!(defined(NETBSD) && defined(__ELF__)) && !defined(HURD) && \
!defined(DARWIN)
--> We only know how to find data segments of dynamic libraries for the
@@ -81,7 +82,7 @@
#endif
#if defined(LINUX) && defined(__ELF__) || defined(SCO_ELF) || \
- (defined(FREEBSD) && defined(__ELF__)) || defined(DGUX) || \
+ (defined(KFREEBSD) && defined(__ELF__)) || defined(DGUX) || \
(defined(NETBSD) && defined(__ELF__)) || defined(HURD)
# include <stddef.h>
# include <elf.h>
@@ -265,7 +266,7 @@
# endif /* SUNOS */
#if defined(LINUX) && defined(__ELF__) || defined(SCO_ELF) || \
- (defined(FREEBSD) && defined(__ELF__)) || defined(DGUX) || \
+ (defined(KFREEBSD) && defined(__ELF__)) || defined(DGUX) || \
(defined(NETBSD) && defined(__ELF__)) || defined(HURD)
@@ -360,7 +361,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(GLIBC) \
&& (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
|| (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
@@ -434,7 +435,7 @@
#define HAVE_REGISTER_MAIN_STATIC_DATA
-# else /* !LINUX || version(glibc) < 2.2.4 */
+# else /* !GLIBC || 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 -Nur gcc-20040724.old/boehm-gc/include/gc.h gcc-20040724/boehm-gc/include/gc.h
--- gcc-20040724.old/boehm-gc/include/gc.h 2003-07-31 06:52:36.000000000 +0200
+++ gcc-20040724/boehm-gc/include/gc.h 2004-08-06 01:53:05.000000000 +0200
@@ -466,7 +466,7 @@
# define GC_RETURN_ADDR (GC_word)__return_address
#endif
-#ifdef __linux__
+#if defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)
# include <features.h>
# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
&& !defined(__ia64__)
@@ -490,7 +490,8 @@
/* This may also be desirable if it is possible but expensive to */
/* retrieve the call chain. */
#if (defined(__linux__) || defined(__NetBSD__) || defined(__OpenBSD__) \
- || defined(__FreeBSD__)) & !defined(GC_CAN_SAVE_CALL_STACKS)
+ || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) \
+ ) & !defined(GC_CAN_SAVE_CALL_STACKS)
# define GC_ADD_CALLER
# if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
/* gcc knows how to retrieve return address, but we don't know */
diff -Nur gcc-20040724.old/boehm-gc/include/private/gcconfig.h gcc-20040724/boehm-gc/include/private/gcconfig.h
--- gcc-20040724.old/boehm-gc/include/private/gcconfig.h 2004-04-06 20:05:05.000000000 +0200
+++ gcc-20040724/boehm-gc/include/private/gcconfig.h 2004-08-06 01:53:05.000000000 +0200
@@ -44,6 +44,14 @@
# endif
# endif
+/* And one for Glibc: */
+#if defined(LINUX) || defined(__GNU__) || defined(__GLIBC__)
+# include <features.h>
+#endif
+#ifdef __GLIBC__
+# define GLIBC
+#endif
+
/* And one for NetBSD: */
# if defined(__NetBSD__)
# define NETBSD
@@ -58,6 +66,9 @@
# if defined(__FreeBSD__)
# define FREEBSD
# endif
+# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+# define KFREEBSD
+# endif
/* Determine the machine type: */
# if defined(__arm__) || defined(__thumb__)
@@ -299,7 +310,7 @@
# define OPENBSD
# define mach_type_known
# endif
-# if defined(FREEBSD) && (defined(i386) || defined(__i386__))
+# if defined(KFREEBSD) && (defined(i386) || defined(__i386__))
# define I386
# define mach_type_known
# endif
@@ -1162,13 +1173,25 @@
# endif
# define SIG_SUSPEND SIGUSR1
# define SIG_THR_RESTART SIGUSR2
+ extern char etext[];
+ extern char * GC_FreeBSDGetDataStart();
+# define DATASTART GC_FreeBSDGetDataStart(0x1000, &etext)
+# endif
+# if defined(GLIBC) && defined(KFREEBSD)
+# define OS_TYPE "GNU/kFreeBSD"
+# 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 SEARCH_FOR_DATA_START
+# define DATAEND (sbrk (0))
+# endif
+# ifdef KFREEBSD
# define FREEBSD_STACKBOTTOM
# ifdef __ELF__
# define DYNAMIC_LOADING
# endif
- extern char etext[];
- extern char * GC_FreeBSDGetDataStart();
-# define DATASTART GC_FreeBSDGetDataStart(0x1000, &etext)
# endif
# ifdef NETBSD
# define OS_TYPE "NETBSD"
diff -Nur gcc-20040724.old/boehm-gc/os_dep.c gcc-20040724/boehm-gc/os_dep.c
--- gcc-20040724.old/boehm-gc/os_dep.c 2004-07-07 06:31:15.000000000 +0200
+++ gcc-20040724/boehm-gc/os_dep.c 2004-08-06 01:53:05.000000000 +0200
@@ -80,7 +80,7 @@
# define NEED_FIND_LIMIT
# endif
-#if defined(FREEBSD) && defined(I386)
+#if defined(KFREEBSD) && defined(I386)
# include <machine/trap.h>
# if !defined(PCR)
# define NEED_FIND_LIMIT
@@ -121,7 +121,7 @@
# include <fcntl.h>
#endif
-#if defined(SUNOS5SIGS) || defined (HURD) || defined(LINUX)
+#if defined(SUNOS5SIGS) || defined(LINUX) || defined(GLIBC)
# ifdef SUNOS5SIGS
# include <sys/siginfo.h>
# endif
@@ -311,7 +311,7 @@
/* for recent Linux versions. This seems to be the easiest way to */
/* cover all versions. */
-# ifdef LINUX
+# if defined(LINUX) || defined(GLIBC)
/* Some Linux distributions arrange to define __data_start. Some */
/* define data_start as a weak symbol. The latter is technically */
/* broken, since the user program may define data_start, in which */
@@ -321,7 +321,7 @@
extern int __data_start[];
# pragma weak data_start
extern int data_start[];
-# endif /* LINUX */
+# endif /* LINUX || GLIBC */
extern int _end[];
ptr_t GC_data_start;
@@ -330,7 +330,7 @@
{
extern ptr_t GC_find_limit();
-# ifdef LINUX
+# if defined(LINUX) || defined(GLIBC)
/* Try the easy approaches first: */
if ((ptr_t)__data_start != 0) {
GC_data_start = (ptr_t)(__data_start);
@@ -340,7 +340,7 @@
GC_data_start = (ptr_t)(data_start);
return;
}
-# endif /* LINUX */
+# endif /* LINUX || GLIBC */
GC_data_start = GC_find_limit((ptr_t)(_end), FALSE);
}
#endif
@@ -2175,13 +2175,13 @@
#endif /* SUNOS4 || FREEBSD */
#if defined(SUNOS5SIGS) || defined(OSF1) || defined(LINUX) \
- || defined(HURD)
+ || defined(GLIBC)
# ifdef __STDC__
typedef void (* SIG_PF)(int);
# else
typedef void (* SIG_PF)();
# endif
-#endif /* SUNOS5SIGS || OSF1 || LINUX || HURD */
+#endif /* SUNOS5SIGS || OSF1 || LINUX || GLIBC */
#if defined(MSWIN32)
typedef LPTOP_LEVEL_EXCEPTION_FILTER SIG_PF;
@@ -2301,7 +2301,7 @@
/*ARGSUSED*/
#if !defined(DARWIN)
-# if defined (SUNOS4) || defined(FREEBSD)
+# if defined (SUNOS4) || defined(KFREEBSD)
void GC_write_fault_handler(sig, code, scp, addr)
int sig, code;
struct sigcontext *scp;
@@ -2312,11 +2312,11 @@
|| (FC_CODE(code) == FC_OBJERR \
&& FC_ERRNO(code) == FC_PROT))
# endif
-# ifdef FREEBSD
+# ifdef KFREEBSD
# define SIG_OK (sig == SIGBUS)
# define CODE_OK (code == BUS_PAGE_FAULT)
# endif
-# endif /* SUNOS4 || FREEBSD */
+# endif /* SUNOS4 || KFREEBSD */
# if defined(IRIX5) || defined(OSF1) || defined(HURD)
# include <errno.h>
@@ -3831,7 +3831,7 @@
/* 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)) && defined(SAVE_CALL_CHAIN)
# include <features.h>
struct frame {
@@ -3842,7 +3842,7 @@
#endif
#if defined(SPARC)
-# if defined(LINUX)
+# if defined(LINUX) || defined(GLIBC)
# include <features.h>
struct frame {
Attachment:
signature.asc
Description: Digital signature