config BINUTILS_VERSION_2_18
bool "binutils 2.18"
+ depends !avr32
endchoice
--- /dev/null
+Index: binutils-2.18/configure
+===================================================================
+--- binutils-2.18.orig/configure 2007-06-28 09:19:34.903930248 +0200
++++ binutils-2.18/configure 2007-06-28 09:19:35.030910944 +0200
+@@ -2206,7 +2206,7 @@
+ am33_2.0-*-linux*)
+ noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
+ ;;
+- sh-*-linux*)
++ sh*-*-linux*)
+ noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
+ ;;
+ sh*-*-pe|mips*-*-pe|*arm-wince-pe)
+@@ -2504,7 +2504,7 @@
+ romp-*-*)
+ noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
+ ;;
+- sh-*-* | sh64-*-*)
++ sh*-*-* | sh64-*-*)
+ case "${host}" in
+ i[3456789]86-*-vsta) ;; # don't add gprof back in
+ i[3456789]86-*-go32*) ;; # don't add gprof back in
--- /dev/null
+Index: binutils-2.18/configure
+===================================================================
+--- binutils-2.18.orig/configure 2007-06-28 09:19:35.030910944 +0200
++++ binutils-2.18/configure 2007-06-28 09:19:35.592825520 +0200
+@@ -2235,7 +2235,7 @@
+ arm-*-elf* | strongarm-*-elf* | xscale-*-elf* | arm*-*-eabi* )
+ noconfigdirs="$noconfigdirs target-libffi target-qthreads"
+ ;;
+- arm*-*-linux-gnueabi)
++ arm*-*-linux-gnueabi | arm*-*-linux-uclibcgnueabi)
+ noconfigdirs="$noconfigdirs target-libffi target-qthreads"
+ noconfigdirs="$noconfigdirs target-libjava target-libobjc"
+ case ${with_newlib} in
--- /dev/null
+#!/bin/sh -e
+## 001_ld_makefile_patch.dpatch
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Description: correct where ld scripts are installed
+## DP: Author: Chris Chimelis <chris@debian.org>
+## DP: Upstream status: N/A
+## DP: Date: ??
+
+if [ $# -ne 1 ]; then
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+fi
+
+[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
+patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
+
+case "$1" in
+ -patch) patch $patch_opts -p1 < $0;;
+ -unpatch) patch $patch_opts -p1 -R < $0;;
+ *)
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1;;
+esac
+
+exit 0
+
+@DPATCH@
+Index: binutils-2.18/ld/Makefile.am
+===================================================================
+--- binutils-2.18.orig/ld/Makefile.am 2007-06-28 09:19:34.837940280 +0200
++++ binutils-2.18/ld/Makefile.am 2007-06-28 09:19:35.795794664 +0200
+@@ -18,7 +18,7 @@
+ # We put the scripts in the directory $(scriptdir)/ldscripts.
+ # We can't put the scripts in $(datadir) because the SEARCH_DIR
+ # directives need to be different for native and cross linkers.
+-scriptdir = $(tooldir)/lib
++scriptdir = $(libdir)
+
+ EMUL = @EMUL@
+ EMULATION_OFILES = @EMULATION_OFILES@
+Index: binutils-2.18/ld/Makefile.in
+===================================================================
+--- binutils-2.18.orig/ld/Makefile.in 2007-06-28 09:19:34.844939216 +0200
++++ binutils-2.18/ld/Makefile.in 2007-06-28 09:19:35.796794512 +0200
+@@ -287,7 +287,7 @@
+ # We put the scripts in the directory $(scriptdir)/ldscripts.
+ # We can't put the scripts in $(datadir) because the SEARCH_DIR
+ # directives need to be different for native and cross linkers.
+-scriptdir = $(tooldir)/lib
++scriptdir = $(libdir)
+ BASEDIR = $(srcdir)/..
+ BFDDIR = $(BASEDIR)/bfd
+ INCDIR = $(BASEDIR)/include
--- /dev/null
+#!/bin/sh -e
+## 006_better_file_error.dpatch by David Kimdon <dwhedon@gordian.com>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Specify which filename is causing an error if the filename is a
+## DP: directory. (#45832)
+
+if [ $# -ne 1 ]; then
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+fi
+
+[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
+patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
+
+case "$1" in
+ -patch) patch $patch_opts -p1 < $0;;
+ -unpatch) patch $patch_opts -p1 -R < $0;;
+ *)
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1;;
+esac
+
+exit 0
+
+@DPATCH@
+Index: binutils-2.18/bfd/opncls.c
+===================================================================
+--- binutils-2.18.orig/bfd/opncls.c 2007-06-28 09:19:34.818943168 +0200
++++ binutils-2.18/bfd/opncls.c 2007-06-28 09:19:35.993764568 +0200
+@@ -183,6 +183,13 @@
+ {
+ bfd *nbfd;
+ const bfd_target *target_vec;
++ struct stat s;
++
++ if (stat (filename, &s) == 0)
++ if (S_ISDIR(s.st_mode)) {
++ bfd_set_error (bfd_error_file_not_recognized);
++ return NULL;
++ }
+
+ nbfd = _bfd_new_bfd ();
+ if (nbfd == NULL)
--- /dev/null
+#!/bin/sh -e
+## 012_check_ldrunpath_length.dpatch by Chris Chimelis <chris@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Only generate an RPATH entry if LD_RUN_PATH is not empty, for
+## DP: cases where -rpath isn't specified. (#151024)
+
+if [ $# -ne 1 ]; then
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+fi
+
+[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
+patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
+
+case "$1" in
+ -patch) patch $patch_opts -p1 < $0;;
+ -unpatch) patch $patch_opts -p1 -R < $0;;
+ *)
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1;;
+esac
+
+exit 0
+
+@DPATCH@
+Index: binutils-2.18/ld/emultempl/elf32.em
+===================================================================
+--- binutils-2.18.orig/ld/emultempl/elf32.em 2007-06-28 09:19:34.796946512 +0200
++++ binutils-2.18/ld/emultempl/elf32.em 2007-06-28 09:19:36.178736448 +0200
+@@ -1216,6 +1216,8 @@
+ && command_line.rpath == NULL)
+ {
+ lib_path = (const char *) getenv ("LD_RUN_PATH");
++ if ((lib_path) && (strlen (lib_path) == 0))
++ lib_path = NULL;
+ if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
+ force))
+ break;
+@@ -1400,6 +1402,8 @@
+ rpath = command_line.rpath;
+ if (rpath == NULL)
+ rpath = (const char *) getenv ("LD_RUN_PATH");
++ if ((rpath) && (strlen (rpath) == 0))
++ rpath = NULL;
+ if (! (bfd_elf_size_dynamic_sections
+ (output_bfd, command_line.soname, rpath,
+ command_line.filter_shlib,
--- /dev/null
+Index: binutils-2.18/bfd/elf32-cris.c
+===================================================================
+--- binutils-2.18.orig/bfd/elf32-cris.c 2007-06-28 09:19:34.053059600 +0200
++++ binutils-2.18/bfd/elf32-cris.c 2007-06-28 09:19:39.058298688 +0200
+@@ -2694,12 +2694,12 @@
+ && (sec->flags & SEC_READONLY) != 0)
+ {
+ /* FIXME: How do we make this optionally a warning only? */
+- (*_bfd_error_handler)
+- (_("%B, section %A:\n relocation %s should not"
+- " be used in a shared object; recompile with -fPIC"),
+- abfd,
+- sec,
+- cris_elf_howto_table[r_type].name);
++ // (*_bfd_error_handler)
++ //(_("%B, section %A:\n relocation %s should not"
++ // " be used in a shared object; recompile with -fPIC"),
++// abfd,
++// sec,
++// cris_elf_howto_table[r_type].name);
+ }
+ /* Fall through. */
+