Package: binutils
Version: 2.16-0
Severity: important

Please find attached a patch to support GNU/kFreeBSD. Both of the
patches in the debian/ directory are also in the upstream BTS.

Thanks for your cooperation.


-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: kfreebsd-i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: GNU/kFreeBSD 5.3-10
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)

Versions of packages binutils depends on:
ii  libc0.1                    2.3-1+kbsd.10 GNU C Library: Shared libraries an

binutils recommends no packages.

-- no debconf information
diff -u binutils-2.16/debian/patches/00list binutils-2.16/debian/patches/00list
--- binutils-2.16/debian/patches/00list
+++ binutils-2.16/debian/patches/00list
@@ -9,0 +10,2 @@
+123_kfreebsd_ld_so_conf.dpatch
+124_kfreebsd_ld_so_executable_shared.dpatch
diff -u binutils-2.16/debian/rules binutils-2.16/debian/rules
--- binutils-2.16/debian/rules
+++ binutils-2.16/debian/rules
@@ -139,7 +139,7 @@
 	mkdir builddir-multi
 	cd builddir-multi \
 	    && env CC="$(CC)" ../configure $(CONFARGS) \
-		--enable-targets=alpha-linux,arm-linux,hppa-linux,i386-gnu,i386-linux,ia64-linux,m68k-linux,m68k-rtems,mips-linux,mipsel-linux,mips64-linux,mips64el-linux,powerpc-linux,powerpc64-linux,s390-linux,s390x-linux,sh-linux,sparc-linux,sparc64-linux,x86_64-linux
+		--enable-targets=alpha-linux,arm-linux,hppa-linux,i386-gnu,i386-linux,i386-kfreebsd-gnu,ia64-linux,m68k-linux,m68k-rtems,mips-linux,mipsel-linux,mips64-linux,mips64el-linux,powerpc-linux,powerpc64-linux,s390-linux,s390x-linux,sh-linux,sparc-linux,sparc64-linux,x86_64-linux
 	$(MAKE) -C builddir-multi configure-host
 	touch configure-multi-stamp
 
--- binutils-2.16.orig/debian/patches/123_kfreebsd_ld_so_conf.dpatch
+++ binutils-2.16/debian/patches/123_kfreebsd_ld_so_conf.dpatch
@@ -0,0 +1,72 @@
+#! /bin/sh -e
+## 123_kfreebsd_ld_so_conf.dpatch
+##
+## DP: Description: Enable ld.so.conf on GNU/k*BSD.
+## DP: Author: Aurelien Jarno <[EMAIL PROTECTED]>
+## DP: Upstream status: In upstream BTS (#1028)
+## DP: Date: 2005-06-20
+
+if [ $# -lt 1 ]; then
+    echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
+    exit 1
+fi
+
+[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
+patch_opts="${patch_opts:--f --no-backup-if-mismatch} ${2:+-d $2}"
+
+case "$1" in
+    -patch) patch -p1 ${patch_opts} < $0;;
+    -unpatch) patch -R -p1 ${patch_opts} < $0;;
+    *)
+        echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
+        exit 1;;
+esac
+
+exit 0
+
[EMAIL PROTECTED]@
+diff -Nur binutils-2.16.orig/ld/emultempl/elf32.em binutils-2.16/ld/emultempl/elf32.em
+--- binutils-2.16.orig/ld/emultempl/elf32.em	2005-04-13 19:59:07.000000000 +0200
++++ binutils-2.16/ld/emultempl/elf32.em	2005-06-21 09:43:41.000000000 +0200
+@@ -65,7 +65,7 @@
+ 
+ if [ "x${USE_LIBPATH}" = xyes ] ; then
+   case ${target} in
+-    *-*-linux-gnu*)
++    *-*-linux-gnu* | *-*-k*bsd*-gnu)
+   cat >>e${EMULATION_NAME}.c <<EOF
+ #ifdef HAVE_GLOB
+ #include <glob.h>
+@@ -350,7 +350,7 @@
+ 
+ EOF
+ case ${target} in
+-  *-*-linux-gnu*)
++  *-*-linux-gnu* | *-*-k*bsd*-gnu)
+     cat >>e${EMULATION_NAME}.c <<EOF
+ 	  {
+ 	    struct bfd_link_needed_list *l;
+@@ -522,11 +522,11 @@
+ 
+ EOF
+   case ${target} in
+-    *-*-linux-gnu*)
++    *-*-linux-gnu* | *-*-k*bsd*-gnu)
+       cat >>e${EMULATION_NAME}.c <<EOF
+ /* For a native linker, check the file /etc/ld.so.conf for directories
+    in which we may find shared libraries.  /etc/ld.so.conf is really
+-   only meaningful on Linux.  */
++   only meaningful on Linux or on k*BSD. */
+ 
+ struct gld${EMULATION_NAME}_ld_so_conf
+ {
+@@ -932,7 +932,7 @@
+ EOF
+ if [ "x${USE_LIBPATH}" = xyes ] ; then
+   case ${target} in
+-    *-*-linux-gnu*)
++    *-*-linux-gnu* | *-*-k*bsd*-gnu)
+       cat >>e${EMULATION_NAME}.c <<EOF
+ 	  if (gld${EMULATION_NAME}_check_ld_so_conf (l->name, force))
+ 	    break;
+
only in patch2:
unchanged:
--- binutils-2.16.orig/debian/patches/124_kfreebsd_ld_so_executable_shared.dpatch
+++ binutils-2.16/debian/patches/124_kfreebsd_ld_so_executable_shared.dpatch
@@ -0,0 +1,54 @@
+#! /bin/sh -e
+## 124_kfreebsd_ld_so_executable_shared.dpatch
+##
+## DP: Description: Determine whether ld.so is an executable or a shared object
+## DP: Author: Robert Millan <[EMAIL PROTECTED]>
+## DP: Upstream status: In upstream BTS (#1029)
+## DP: Date: 2005-06-20
+
+if [ $# -lt 1 ]; then
+    echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
+    exit 1
+fi
+
+[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
+patch_opts="${patch_opts:--f --no-backup-if-mismatch} ${2:+-d $2}"
+
+case "$1" in
+    -patch) patch -p1 ${patch_opts} < $0;;
+    -unpatch) patch -R -p1 ${patch_opts} < $0;;
+    *)
+        echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
+        exit 1;;
+esac
+
+exit 0
+
[EMAIL PROTECTED]@
+diff -Nur binutils-2.16.orig/bfd/elfcode.h binutils-2.16/bfd/elfcode.h
+--- binutils-2.16.orig/bfd/elfcode.h	2005-02-20 15:59:07.000000000 +0100
++++ binutils-2.16/bfd/elfcode.h	2005-06-21 09:43:41.000000000 +0200
+@@ -592,8 +592,22 @@
+ 	}
+     }
+ 
++  /* Determine whether the file is an executable or a shared object.
++     It can even be both: The dynamic loader "ld.so*" is declared as an
++     executable (so the kernel can exec it) but at the same time we
++     treat it as a shared object (for symbol versioning purposes).  */
+   if (i_ehdrp->e_type == ET_EXEC)
+-    abfd->flags |= EXEC_P;
++    {
++      const char *file_name = abfd->filename;
++      const char *last_slash = strrchr (file_name, '/');
++      const char *base_name = (last_slash ? last_slash + 1 : file_name);
++      if (strncmp (base_name, "ld.so", 5) == 0)
++	/* The dynamic loader.  */
++	abfd->flags |= DYNAMIC;
++      else
++	/* Normal executable.  */
++	abfd->flags |= EXEC_P;
++    }
+   else if (i_ehdrp->e_type == ET_DYN)
+     abfd->flags |= DYNAMIC;
+ 

Reply via email to