[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#178328: NetBSD support patches



Package: gcc-3.2
Version: 3.2.2ds5
Severity: wishlist
Tags: patch

The following patches address two significant issues with
NetBSD-on-Debian builds:

1) netbsd-gcc-config moves the NetBSD portion of src/gcc/gcc.config above
the GNU (Hurd) portion, to prevent problems with misdetecting NetBSD as
GNU (due to the triplet i386-unknown-netbsdelf-gnu matching the pattern
*-*-gnu). I'm not sure what the best answer upstream is, but this solves it
well enough to get by, and is crucial for working builds on NetBSD.

2) netbsd-dynlinker, which changes the default dynamic linker location
from /usr/libexec/ld.elf_so to /lib/ld.elf_so; this makes it target the
default location of the dynamic linker provided by the libc12 package (this
was moved for FHS compliance, and links in /usr/libexec and /libexec are
provided for compatibility, but should not be used by natively compiled
Debian applications). This patch is NOT suitable for upstream, unless they
want to figure out how to make it apply only to netbsd(elf|)-gnu systems
and not netbsd(elf) systems.

Included are both patches, and a patch to debian/rules.patch to invoke
them.
-- 
Joel Baker <fenton@debian.org>
#! /bin/sh -e

# JB: config.gcc patches for netbsd.

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

diff -ur src.orig/gcc/config.gcc src/gcc/config.gcc
--- src.orig/gcc/config.gcc	2002-10-23 19:58:44.000000000 +0000
+++ src/gcc/config.gcc	2003-01-21 19:49:04.000000000 +0000
@@ -376,6 +376,12 @@
 		;;
 	esac
 	;;
+*-*-netbsd*)
+	tmake_file="t-slibgcc-elf-ver t-libc-ok t-netbsd"
+	xm_defines=POSIX
+	gas=yes
+	gnu_ld=yes
+	;;
 *-*-gnu*)
 	# On the Hurd, the setup is just about the same on
 	# each different CPU.  The specific machines that we
@@ -406,12 +412,6 @@
 		tmake_file="${tmake_file} t-openbsd-thread"
 	fi
 	;;
-*-*-netbsd*)
-	tmake_file="t-slibgcc-elf-ver t-libc-ok t-netbsd"
-	xm_defines=POSIX
-	gas=yes
-	gnu_ld=yes
-	;;
 *-*-freebsd[12] | *-*-freebsd[12].* | *-*-freebsd*aout*)
 	# This is the place-holder for the generic a.out configuration
 	# of FreeBSD.  No actual configuration resides here since
#! /bin/sh -e
 
# JB: Dynamic linker patches for netbsd.
 
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

diff -ur src.orig/gcc/config/i386/netbsd-elf.h src/gcc/config/i386/netbsd-elf.h
--- src.orig/gcc/config/i386/netbsd-elf.h	2002-03-01 23:38:15.000000000 +0000
+++ src/gcc/config/i386/netbsd-elf.h	2003-01-21 19:44:46.000000000 +0000
@@ -35,7 +35,7 @@
 	%{!e*:-e __start}}}						\
     %{!static:								\
       %{rdynamic:-export-dynamic}					\
-      %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}}	\
+      %{!dynamic-linker:-dynamic-linker /lib/ld.elf_so}}		\
     %{static:-static}}"
 
 /* Names to predefine in the preprocessor for this target machine.  */
diff -ur src.orig/gcc/config/netbsd-elf.h src/gcc/config/netbsd-elf.h
--- src.orig/gcc/config/netbsd-elf.h	2002-01-22 04:23:02.000000000 +0000
+++ src/gcc/config/netbsd-elf.h	2003-01-21 19:44:27.000000000 +0000
@@ -72,5 +72,5 @@
 	 %{!e*:-e __start}}}						\
      %{!static:								\
        %{rdynamic:-export-dynamic}					\
-       %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}}	\
+       %{!dynamic-linker:-dynamic-linker /lib/ld.elf_so}}		\
      %{static:-static}}"
--- debian/rules.patch.orig	2003-01-22 20:59:26.000000000 +0000
+++ debian/rules.patch	2003-01-22 21:00:15.000000000 +0000
@@ -13,6 +13,7 @@
 debian_patches = gcc-names gcc-version fastjar-doc \
 	libstdc++-incdir libstdc++-codecvt libstdc++-pic libstdc++-doclink
 
+
 ifeq ($(with_java),yes)
   debian_patches += gcj-debian-policy gcj-names gcj-without-rpath \
 	gcj-manpage gij-classpath backport-java-6865
@@ -82,6 +83,10 @@
   debian_patches += freebsd-gnu
 endif
 
+ifeq ($(DEB_HOST_ARCH),netbsd-i386)
+  debian_patches += netbsd-dynlinker netbsd-gcc-config
+endif
+
 debian_patches += reporting # applied after gcc-cvs-updates
 
 patch: $(patch_stamp)

Attachment: pgpigAqRyzdan.pgp
Description: PGP signature


Reply to: