From: Felix Fietkau <nbd@openwrt.org>
Date: Sat, 2 Feb 2008 18:06:32 +0000 (+0000)
Subject: Add binutils-2.18 patches for all arches but AVR32.
X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=fba7cecc0921eb652348bd39c417af01329fdaec;p=openwrt%2Fstaging%2Fwigyori.git

Add binutils-2.18 patches for all arches but AVR32.

Re-diff the existing patches for binutils-2.17 for all architectures
but AVR32, and make the possible selection of binutils-2.18 dependent
on selecting any arch but that one for the time being.

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>

SVN-Revision: 10360
---

diff --git a/toolchain/binutils/Config.in b/toolchain/binutils/Config.in
index a73ca39b12..8fabf4c8c6 100644
--- a/toolchain/binutils/Config.in
+++ b/toolchain/binutils/Config.in
@@ -14,6 +14,7 @@ choice
 
 	config BINUTILS_VERSION_2_18
 		bool "binutils 2.18"
+		depends !avr32
 
 endchoice
 
diff --git a/toolchain/binutils/patches/2.18/100-uclibc-conf.patch b/toolchain/binutils/patches/2.18/100-uclibc-conf.patch
new file mode 100644
index 0000000000..71ad50cf9f
--- /dev/null
+++ b/toolchain/binutils/patches/2.18/100-uclibc-conf.patch
@@ -0,0 +1,22 @@
+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
diff --git a/toolchain/binutils/patches/2.18/110-arm-eabi-conf.patch b/toolchain/binutils/patches/2.18/110-arm-eabi-conf.patch
new file mode 100644
index 0000000000..3e0a25ae29
--- /dev/null
+++ b/toolchain/binutils/patches/2.18/110-arm-eabi-conf.patch
@@ -0,0 +1,13 @@
+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
diff --git a/toolchain/binutils/patches/2.18/300-001_ld_makefile_patch.patch b/toolchain/binutils/patches/2.18/300-001_ld_makefile_patch.patch
new file mode 100644
index 0000000000..4624f29a2c
--- /dev/null
+++ b/toolchain/binutils/patches/2.18/300-001_ld_makefile_patch.patch
@@ -0,0 +1,54 @@
+#!/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
diff --git a/toolchain/binutils/patches/2.18/300-006_better_file_error.patch b/toolchain/binutils/patches/2.18/300-006_better_file_error.patch
new file mode 100644
index 0000000000..30dfb10336
--- /dev/null
+++ b/toolchain/binutils/patches/2.18/300-006_better_file_error.patch
@@ -0,0 +1,44 @@
+#!/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)
diff --git a/toolchain/binutils/patches/2.18/300-012_check_ldrunpath_length.patch b/toolchain/binutils/patches/2.18/300-012_check_ldrunpath_length.patch
new file mode 100644
index 0000000000..2662596b42
--- /dev/null
+++ b/toolchain/binutils/patches/2.18/300-012_check_ldrunpath_length.patch
@@ -0,0 +1,48 @@
+#!/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,
diff --git a/toolchain/binutils/patches/2.18/601-cris-errormsg.patch b/toolchain/binutils/patches/2.18/601-cris-errormsg.patch
new file mode 100644
index 0000000000..4d1fb12d5f
--- /dev/null
+++ b/toolchain/binutils/patches/2.18/601-cris-errormsg.patch
@@ -0,0 +1,23 @@
+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.  */
+