summaryrefslogtreecommitdiff
path: root/patches/binutils
diff options
context:
space:
mode:
authorYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2007-02-24 11:00:05 (GMT)
committerYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2007-02-24 11:00:05 (GMT)
commit1906cf93f86d8d66f45f90380a8d3da25c087ee5 (patch)
tree90916c99abe1f1ec26709ee420e6c349eda4670a /patches/binutils
parent2609573aede4ce198b3462976725b25eb1637d2e (diff)
Add the full crosstool-NG sources to the new repository of its own.
You might just say: 'Yeah! crosstool-NG's got its own repo!". Unfortunately, that's because the previous repo got damaged beyond repair and I had no backup. That means I'm putting backups in place in the afternoon. That also means we've lost history... :-(
Diffstat (limited to 'patches/binutils')
-rw-r--r--patches/binutils/2.11.2/gcc-pr3106.patch28
-rw-r--r--patches/binutils/2.13.90.0.2/README6
-rw-r--r--patches/binutils/2.13.90.0.2/rh62-binutils-2.11.93.0.2-sparc-nonpic.patch96
-rw-r--r--patches/binutils/2.13.90.0.2/rh62-binutils-2.13.90.0.2-glibc21.patch58
-rw-r--r--patches/binutils/2.13.90.0.2/rh62-binutils-2.13.90.0.2-gotpc.patch372
-rw-r--r--patches/binutils/2.13.90.0.2/rh62-binutils-2.13.90.0.2-tpoff32.patch27
-rw-r--r--patches/binutils/2.14.90.0.5/binutils-cross-demangler.patch11
-rw-r--r--patches/binutils/2.14.90.0.5/binutils-sh-relocs.patch38
-rw-r--r--patches/binutils/2.14.90.0.7/binutils-cross-demangler.patch11
-rw-r--r--patches/binutils/2.14.92/binutils-skip-comments.patch101
-rw-r--r--patches/binutils/2.14.92/gccpr15247-fix.patch192
-rw-r--r--patches/binutils/2.14/binutils-sh-relocs.patch38
-rw-r--r--patches/binutils/2.15.90.0.3/binutils-20040817-linkonce.patch118
-rw-r--r--patches/binutils/2.15.90.0.3/binutils-20040820-duplicates.patch74
-rw-r--r--patches/binutils/2.15.90.0.3/binutils-skip-comments.patch101
-rw-r--r--patches/binutils/2.15.90.0.3/gccpr15247-fix.patch192
-rw-r--r--patches/binutils/2.15.91.0.2/binutils-20040817-linkonce.patch118
-rw-r--r--patches/binutils/2.15.91.0.2/binutils-dup-sections.patch68
-rw-r--r--patches/binutils/2.15.91.0.2/binutils-skip-comments.patch101
-rw-r--r--patches/binutils/2.15/002-uclibc.patch144
-rw-r--r--patches/binutils/2.15/100-uclibc-conf.patch692
-rw-r--r--patches/binutils/2.15/210-cflags.patch32
-rw-r--r--patches/binutils/2.15/400-mips-ELF_MAXPAGESIZE-4K.patch26
-rw-r--r--patches/binutils/2.15/600-arm-textrel.patch63
-rw-r--r--patches/binutils/2.15/bfd-hash-tweak.patch24
-rw-r--r--patches/binutils/2.15/binutils-2.15-allow-gcc-4.0.patch75
-rw-r--r--patches/binutils/2.15/binutils-2.15-psignal.patch40
-rw-r--r--patches/binutils/2.15/binutils-2.15-solaris-qsort.patch22
-rw-r--r--patches/binutils/2.15/binutils-2.15-vmx.patch45
-rw-r--r--patches/binutils/2.15/binutils-arm-undef-imm.patch51
-rw-r--r--patches/binutils/2.15/binutils-skip-comments.patch101
-rw-r--r--patches/binutils/2.15/cross-gprof.patch22
-rw-r--r--patches/binutils/2.15/gccpr15247-fix.patch192
-rw-r--r--patches/binutils/2.15/ld-2.15-callahan.patch677
-rw-r--r--patches/binutils/2.15/ld-2.15-stabs-tweak.patch33
-rw-r--r--patches/binutils/2.15/s390-invalid-insn-format.patch42
-rw-r--r--patches/binutils/2.16.1/bfd-hash-tweak.patch23
-rw-r--r--patches/binutils/2.16.1/binutils-2.15-psignal.patch40
-rw-r--r--patches/binutils/2.16.1/binutils-skip-comments.patch95
-rw-r--r--patches/binutils/2.16.1/callahan.patch693
-rw-r--r--patches/binutils/2.16.1/cross-gprof.patch22
-rw-r--r--patches/binutils/2.16.1/stabs-tweak.patch28
-rw-r--r--patches/binutils/2.17.50.0.10/100-uclibc-conf.patch139
-rw-r--r--patches/binutils/2.17.50.0.10/110-arm-eabi-conf.patch24
-rw-r--r--patches/binutils/2.17.50.0.10/300-001_ld_makefile_patch.patch50
-rw-r--r--patches/binutils/2.17.50.0.10/300-012_check_ldrunpath_length.patch47
-rw-r--r--patches/binutils/2.17.50.0.8/100-uclibc-conf.patch139
-rw-r--r--patches/binutils/2.17.50.0.8/110-arm-eabi-conf.patch24
-rw-r--r--patches/binutils/2.17.50.0.8/300-001_ld_makefile_patch.patch50
-rw-r--r--patches/binutils/2.17.50.0.8/300-012_check_ldrunpath_length.patch47
-rw-r--r--patches/binutils/2.17.50.0.9/100-uclibc-conf.patch139
-rw-r--r--patches/binutils/2.17.50.0.9/110-arm-eabi-conf.patch24
-rw-r--r--patches/binutils/2.17.50.0.9/300-001_ld_makefile_patch.patch50
-rw-r--r--patches/binutils/2.17.50.0.9/300-012_check_ldrunpath_length.patch47
54 files changed, 5712 insertions, 0 deletions
diff --git a/patches/binutils/2.11.2/gcc-pr3106.patch b/patches/binutils/2.11.2/gcc-pr3106.patch
new file mode 100644
index 0000000..c3a0264
--- /dev/null
+++ b/patches/binutils/2.11.2/gcc-pr3106.patch
@@ -0,0 +1,28 @@
+See http://gcc.gnu.org/PR3106
+Backported from gcc-3.0.x
+
+Fixes error
+ .../binutils-2.11.2/libiberty/strerror.c:468: error: conflicting types for `sys_nerr'
+ /usr/include/stdio.h:258: error: previous declaration of `sys_nerr'
+ make[1]: *** [strerror.o] Error 1
+ make: *** [all-libiberty] Error 2
+on Mac OS X.
+
+--- binutils-2.11.2/libiberty/strerror.c.old 2004-03-24 16:23:19.000000000 -0800
++++ binutils-2.11.2/libiberty/strerror.c 2004-03-24 16:23:48.000000000 -0800
+@@ -13,6 +13,7 @@
+ incompatible with our later declaration, perhaps by using const
+ attributes. So we hide the declaration in errno.h (if any) using a
+ macro. */
++#define sys_nerr sys_nerr__
+ #define sys_errlist sys_errlist__
+ #endif
+
+@@ -20,6 +21,7 @@
+ #include <errno.h>
+
+ #ifdef HAVE_SYS_ERRLIST
++#undef sys_nerr
+ #undef sys_errlist
+ #endif
+
diff --git a/patches/binutils/2.13.90.0.2/README b/patches/binutils/2.13.90.0.2/README
new file mode 100644
index 0000000..521e669
--- /dev/null
+++ b/patches/binutils/2.13.90.0.2/README
@@ -0,0 +1,6 @@
+The files rh62*.patch are from the Red Hat 6.2 file
+binutils-2.13.90.0.2-2.src.rpm
+
+I am trusting here that Red Hat's patches are appropriate for all CPU
+types. If I'm wrong, just remove the offending patch...
+- Dan Kegel
diff --git a/patches/binutils/2.13.90.0.2/rh62-binutils-2.11.93.0.2-sparc-nonpic.patch b/patches/binutils/2.13.90.0.2/rh62-binutils-2.11.93.0.2-sparc-nonpic.patch
new file mode 100644
index 0000000..f8719a5
--- /dev/null
+++ b/patches/binutils/2.13.90.0.2/rh62-binutils-2.11.93.0.2-sparc-nonpic.patch
@@ -0,0 +1,96 @@
+2002-04-20 Jakub Jelinek <jakub@redhat.com>
+
+ * elf32-sparc.c (elf32_sparc_relocate_section): Find real output
+ section with SEC_MERGE.
+ * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
+
+--- binutils/bfd/elf32-sparc.c.jj Sat Apr 20 22:11:57 2002
++++ binutils/bfd/elf32-sparc.c Sat Apr 20 23:06:33 2002
+@@ -1144,7 +1144,7 @@ elf32_sparc_relocate_section (output_bfd
+ struct elf_link_hash_entry *h;
+ Elf_Internal_Sym *sym;
+ asection *sec;
+- bfd_vma relocation, off;
++ bfd_vma relocation, off, orig_addend = 0;
+ bfd_reloc_status_type r;
+ boolean is_plt = false;
+ boolean unresolved_reloc;
+@@ -1192,6 +1192,7 @@ elf32_sparc_relocate_section (output_bfd
+ {
+ sym = local_syms + r_symndx;
+ sec = local_sections[r_symndx];
++ orig_addend = rel->r_addend;
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ }
+ else
+@@ -1527,6 +1528,25 @@ elf32_sparc_relocate_section (output_bfd
+ asection *osec;
+
+ osec = sec->output_section;
++ /* FIXME: As soon as making sections zero size
++ is possible, this if can go away. */
++ if (bfd_is_abs_section (osec)
++ && h == NULL
++ && (sec->flags & SEC_MERGE)
++ && ELF_ST_TYPE (sym->st_info) == STT_SECTION
++ && (elf_section_data (sec)->sec_info_type
++ == ELF_INFO_TYPE_MERGE))
++ {
++ asection *msec;
++
++ msec = sec;
++ _bfd_merged_section_offset (output_bfd, &msec,
++ elf_section_data (sec)->sec_info,
++ sym->st_value + orig_addend,
++ (bfd_vma) 0);
++ osec = msec->output_section;
++ }
++
+ indx = elf_section_data (osec)->dynindx;
+
+ /* FIXME: we really should be able to link non-pic
+--- binutils/bfd/elf64-sparc.c.jj Sat Apr 20 22:11:57 2002
++++ binutils/bfd/elf64-sparc.c Sat Apr 20 23:12:18 2002
+@@ -1939,7 +1939,7 @@ sparc64_elf_relocate_section (output_bfd
+ struct elf_link_hash_entry *h;
+ Elf_Internal_Sym *sym;
+ asection *sec;
+- bfd_vma relocation, off;
++ bfd_vma relocation, off, orig_addend = 0;
+ bfd_reloc_status_type r;
+ boolean is_plt = false;
+ boolean unresolved_reloc;
+@@ -1982,6 +1982,7 @@ sparc64_elf_relocate_section (output_bfd
+ {
+ sym = local_syms + r_symndx;
+ sec = local_sections[r_symndx];
++ orig_addend = rel->r_addend;
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ }
+ else
+@@ -2211,6 +2212,25 @@ sparc64_elf_relocate_section (output_bfd
+ asection *osec;
+
+ osec = sec->output_section;
++ /* FIXME: As soon as making sections zero size
++ is possible, this if can go away. */
++ if (bfd_is_abs_section (osec)
++ && h == NULL
++ && (sec->flags & SEC_MERGE)
++ && ELF_ST_TYPE (sym->st_info) == STT_SECTION
++ && (elf_section_data (sec)->sec_info_type
++ == ELF_INFO_TYPE_MERGE))
++ {
++ asection *msec;
++
++ msec = sec;
++ _bfd_merged_section_offset (output_bfd, &msec,
++ elf_section_data (sec)->sec_info,
++ sym->st_value + orig_addend,
++ (bfd_vma) 0);
++ osec = msec->output_section;
++ }
++
+ indx = elf_section_data (osec)->dynindx;
+
+ /* FIXME: we really should be able to link non-pic
diff --git a/patches/binutils/2.13.90.0.2/rh62-binutils-2.13.90.0.2-glibc21.patch b/patches/binutils/2.13.90.0.2/rh62-binutils-2.13.90.0.2-glibc21.patch
new file mode 100644
index 0000000..a35b8f8
--- /dev/null
+++ b/patches/binutils/2.13.90.0.2/rh62-binutils-2.13.90.0.2-glibc21.patch
@@ -0,0 +1,58 @@
+--- binutils/ld/emulparams/elf_i386_glibc21.sh.jj Sat Aug 3 17:04:41 2002
++++ binutils/ld/emulparams/elf_i386_glibc21.sh Sat Aug 3 17:04:41 2002
+@@ -0,0 +1,11 @@
++SCRIPT_NAME=elf
++OUTPUT_FORMAT="elf32-i386"
++TEXT_START_ADDR=0x08048000
++MAXPAGESIZE=0x1000
++NONPAGED_TEXT_START_ADDR=0x08048000
++ARCH=i386
++MACHINE=
++NOP=0x9090
++TEMPLATE_NAME=elf32
++GENERATE_SHLIB_SCRIPT=yes
++LIB_PATH=/usr/i386-glibc21-linux/lib:/usr/local/lib
+--- binutils/ld/configure.tgt.jj Thu Aug 1 20:49:32 2002
++++ binutils/ld/configure.tgt Sat Aug 3 17:06:18 2002
+@@ -143,7 +143,8 @@ i[3456]86-*-linux*aout*) targ_emul=i386l
+ ;;
+ i[3456]86-*-linux*oldld) targ_emul=i386linux; targ_extra_emuls=elf_i386 ;;
+ i[3456]86-*-linux-gnu*) targ_emul=elf_i386
+- targ_extra_emuls=i386linux
++ targ_extra_emuls="i386linux elf_i386_glibc21"
++ targ_extra_libpath=elf_i386_glibc21
+ if test x${want64} = xtrue; then
+ targ_extra_emuls="$targ_extra_emuls elf_x86_64"
+ fi
+--- binutils/ld/Makefile.am.jj Thu Aug 1 20:49:32 2002
++++ binutils/ld/Makefile.am Sat Aug 3 17:04:41 2002
+@@ -181,6 +181,7 @@ ALL_EMULATIONS = \
+ eelf_i386.o \
+ eelf_i386_be.o \
+ eelf_i386_chaos.o \
++ eelf_i386_glibc21.o \
+ eelf_i386_fbsd.o \
+ eelf_i386_ldso.o \
+ eelf_s390.o \
+@@ -718,6 +719,9 @@ eelf_i386_be.c: $(srcdir)/emulparams/elf
+ eelf_i386_chaos.c: $(srcdir)/emulparams/elf_i386_chaos.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf_chaos.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf_i386_chaos "$(tdir_elf_i386_chaos)"
++eelf_i386_glibc21.c: $(srcdir)/emulparams/elf_i386_glibc21.sh \
++ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
++ ${GENSCRIPTS} elf_i386_glibc21 "$(tdir_elf_i386_glibc21)"
+ eelf_i386_fbsd.c: $(srcdir)/emulparams/elf_i386_fbsd.sh \
+ $(srcdir)/emulparams/elf_i386.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+--- binutils/ld/Makefile.in.jj Thu Aug 1 20:49:32 2002
++++ binutils/ld/Makefile.in Sat Aug 3 17:07:34 2002
+@@ -1197,6 +1197,9 @@ eelf_i386_be.c: $(srcdir)/emulparams/elf
+ eelf_i386_chaos.c: $(srcdir)/emulparams/elf_i386_chaos.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf_chaos.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf_i386_chaos "$(tdir_elf_i386_chaos)"
++eelf_i386_glibc21.c: $(srcdir)/emulparams/elf_i386_glibc21.sh \
++ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
++ ${GENSCRIPTS} elf_i386_glibc21 "$(tdir_elf_i386_glibc21)"
+ eelf_i386_fbsd.c: $(srcdir)/emulparams/elf_i386_fbsd.sh \
+ $(srcdir)/emulparams/elf_i386.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
diff --git a/patches/binutils/2.13.90.0.2/rh62-binutils-2.13.90.0.2-gotpc.patch b/patches/binutils/2.13.90.0.2/rh62-binutils-2.13.90.0.2-gotpc.patch
new file mode 100644
index 0000000..030dfa9
--- /dev/null
+++ b/patches/binutils/2.13.90.0.2/rh62-binutils-2.13.90.0.2-gotpc.patch
@@ -0,0 +1,372 @@
+2002-08-03 Jakub Jelinek <jakub@redhat.com>
+
+ * config/tc-i386.c (output_insn): Save frag_now and frag_now_fix ()
+ at start of insn, pass it to output_disp and output_imm.
+ (output_disp): Added arguments. If _GLOBAL_OFFSET_TABLE_ is seen
+ in displacement for R_386_32 reloc, use R_386_GOTPC and compute
+ properly addend.
+ (output_imm): Added arguments. Compute properly addend for
+ R_386_GOTPC.
+ (md_apply_fix3): Remove R_386_GOTPC handling.
+ * testsuite/gas/i386/gotpc.s: New.
+ * testsuite/gas/i386/gotpc.d: New.
+ * testsuite/gas/i386/i386.exp: Add gotpc test.
+
+--- binutils/gas/config/tc-i386.c.jj 2002-07-18 11:35:39.000000000 +0200
++++ binutils/gas/config/tc-i386.c 2002-08-02 21:13:18.000000000 +0200
+@@ -104,8 +104,10 @@ static void output_insn PARAMS ((void));
+ static void output_branch PARAMS ((void));
+ static void output_jump PARAMS ((void));
+ static void output_interseg_jump PARAMS ((void));
+-static void output_imm PARAMS ((void));
+-static void output_disp PARAMS ((void));
++static void output_imm PARAMS ((fragS *insn_start_frag,
++ offsetT insn_start_off));
++static void output_disp PARAMS ((fragS *insn_start_frag,
++ offsetT insn_start_off));
+ #ifndef I386COFF
+ static void s_bss PARAMS ((int));
+ #endif
+@@ -3101,14 +3103,21 @@ output_interseg_jump ()
+ md_number_to_chars (p + size, (valueT) i.op[0].imms->X_add_number, 2);
+ }
+
++
+ static void
+ output_insn ()
+ {
++ fragS *insn_start_frag;
++ offsetT insn_start_off;
++
+ /* Tie dwarf2 debug info to the address at the start of the insn.
+ We can't do this after the insn has been output as the current
+ frag may have been closed off. eg. by frag_var. */
+ dwarf2_emit_insn (0);
+
++ insn_start_frag = frag_now;
++ insn_start_off = frag_now_fix ();
++
+ /* Output jumps. */
+ if (i.tm.opcode_modifier & Jump)
+ output_branch ();
+@@ -3179,10 +3188,10 @@ output_insn ()
+ }
+
+ if (i.disp_operands)
+- output_disp ();
++ output_disp (insn_start_frag, insn_start_off);
+
+ if (i.imm_operands)
+- output_imm ();
++ output_imm (insn_start_frag, insn_start_off);
+ }
+
+ #ifdef DEBUG386
+@@ -3194,7 +3203,9 @@ output_insn ()
+ }
+
+ static void
+-output_disp ()
++output_disp (insn_start_frag, insn_start_off)
++ fragS *insn_start_frag;
++ offsetT insn_start_off;
+ {
+ char *p;
+ unsigned int n;
+@@ -3224,6 +3235,7 @@ output_disp ()
+ }
+ else
+ {
++ RELOC_ENUM reloc_type;
+ int size = 4;
+ int sign = 0;
+ int pcrel = (i.flags[n] & Operand_PCrel) != 0;
+@@ -3266,16 +3278,50 @@ output_disp ()
+ }
+
+ p = frag_more (size);
++ reloc_type = reloc (size, pcrel, sign, i.reloc[n]);
++#ifdef BFD_ASSEMBLER
++ if (reloc_type == BFD_RELOC_32
++ && GOT_symbol
++ && GOT_symbol == i.op[n].disps->X_add_symbol
++ && (i.op[n].disps->X_op == O_symbol
++ || (i.op[n].disps->X_op == O_add
++ && ((symbol_get_value_expression
++ (i.op[n].disps->X_op_symbol)->X_op)
++ == O_subtract))))
++ {
++ offsetT add;
++
++ if (insn_start_frag == frag_now)
++ add = (p - frag_now->fr_literal) - insn_start_off;
++ else
++ {
++ fragS *fr;
++
++ add = insn_start_frag->fr_fix - insn_start_off;
++ for (fr = insn_start_frag->fr_next;
++ fr && fr != frag_now; fr = fr->fr_next)
++ add += fr->fr_fix;
++ add += p - frag_now->fr_literal;
++ }
++
++ /* We don't support dynamic linking on x86-64 yet. */
++ if (flag_code == CODE_64BIT)
++ abort ();
++ reloc_type = BFD_RELOC_386_GOTPC;
++ i.op[n].disps->X_add_number += add;
++ }
++#endif
+ fix_new_exp (frag_now, p - frag_now->fr_literal, size,
+- i.op[n].disps, pcrel,
+- reloc (size, pcrel, sign, i.reloc[n]));
++ i.op[n].disps, pcrel, reloc_type);
+ }
+ }
+ }
+ }
+
+ static void
+-output_imm ()
++output_imm (insn_start_frag, insn_start_off)
++ fragS *insn_start_frag;
++ offsetT insn_start_off;
+ {
+ char *p;
+ unsigned int n;
+@@ -3328,6 +3374,48 @@ output_imm ()
+ p = frag_more (size);
+ reloc_type = reloc (size, 0, sign, i.reloc[n]);
+ #ifdef BFD_ASSEMBLER
++ /* This is tough to explain. We end up with this one if we
++ * have operands that look like
++ * "_GLOBAL_OFFSET_TABLE_+[.-.L284]". The goal here is to
++ * obtain the absolute address of the GOT, and it is strongly
++ * preferable from a performance point of view to avoid using
++ * a runtime relocation for this. The actual sequence of
++ * instructions often look something like:
++ *
++ * call .L66
++ * .L66:
++ * popl %ebx
++ * addl $_GLOBAL_OFFSET_TABLE_+[.-.L66],%ebx
++ *
++ * The call and pop essentially return the absolute address
++ * of the label .L66 and store it in %ebx. The linker itself
++ * will ultimately change the first operand of the addl so
++ * that %ebx points to the GOT, but to keep things simple, the
++ * .o file must have this operand set so that it generates not
++ * the absolute address of .L66, but the absolute address of
++ * itself. This allows the linker itself simply treat a GOTPC
++ * relocation as asking for a pcrel offset to the GOT to be
++ * added in, and the addend of the relocation is stored in the
++ * operand field for the instruction itself.
++ *
++ * Our job here is to fix the operand so that it would add
++ * the correct offset so that %ebx would point to itself. The
++ * thing that is tricky is that .-.L66 will point to the
++ * beginning of the instruction, so we need to further modify
++ * the operand so that it will point to itself. There are
++ * other cases where you have something like:
++ *
++ * .long $_GLOBAL_OFFSET_TABLE_+[.-.L66]
++ *
++ * and here no correction would be required. Internally in
++ * the assembler we treat operands of this form as not being
++ * pcrel since the '.' is explicitly mentioned, and I wonder
++ * whether it would simplify matters to do it this way. Who
++ * knows. In earlier versions of the PIC patches, the
++ * pcrel_adjust field was used to store the correction, but
++ * since the expression is not pcrel, I felt it would be
++ * confusing to do it this way. */
++
+ if (reloc_type == BFD_RELOC_32
+ && GOT_symbol
+ && GOT_symbol == i.op[n].imms->X_add_symbol
+@@ -3337,11 +3425,26 @@ output_imm ()
+ (i.op[n].imms->X_op_symbol)->X_op)
+ == O_subtract))))
+ {
++ offsetT add;
++
++ if (insn_start_frag == frag_now)
++ add = (p - frag_now->fr_literal) - insn_start_off;
++ else
++ {
++ fragS *fr;
++
++ add = insn_start_frag->fr_fix - insn_start_off;
++ for (fr = insn_start_frag->fr_next;
++ fr && fr != frag_now; fr = fr->fr_next)
++ add += fr->fr_fix;
++ add += p - frag_now->fr_literal;
++ }
++
+ /* We don't support dynamic linking on x86-64 yet. */
+ if (flag_code == CODE_64BIT)
+ abort ();
+ reloc_type = BFD_RELOC_386_GOTPC;
+- i.op[n].imms->X_add_number += 3;
++ i.op[n].imms->X_add_number += add;
+ }
+ #endif
+ fix_new_exp (frag_now, p - frag_now->fr_literal, size,
+@@ -4542,48 +4645,6 @@ md_apply_fix3 (fixP, valP, seg)
+ runtime we merely add the offset to the actual PLT entry. */
+ value = -4;
+ break;
+- case BFD_RELOC_386_GOTPC:
+-
+-/* This is tough to explain. We end up with this one if we have
+- * operands that look like "_GLOBAL_OFFSET_TABLE_+[.-.L284]". The goal
+- * here is to obtain the absolute address of the GOT, and it is strongly
+- * preferable from a performance point of view to avoid using a runtime
+- * relocation for this. The actual sequence of instructions often look
+- * something like:
+- *
+- * call .L66
+- * .L66:
+- * popl %ebx
+- * addl $_GLOBAL_OFFSET_TABLE_+[.-.L66],%ebx
+- *
+- * The call and pop essentially return the absolute address of
+- * the label .L66 and store it in %ebx. The linker itself will
+- * ultimately change the first operand of the addl so that %ebx points to
+- * the GOT, but to keep things simple, the .o file must have this operand
+- * set so that it generates not the absolute address of .L66, but the
+- * absolute address of itself. This allows the linker itself simply
+- * treat a GOTPC relocation as asking for a pcrel offset to the GOT to be
+- * added in, and the addend of the relocation is stored in the operand
+- * field for the instruction itself.
+- *
+- * Our job here is to fix the operand so that it would add the correct
+- * offset so that %ebx would point to itself. The thing that is tricky is
+- * that .-.L66 will point to the beginning of the instruction, so we need
+- * to further modify the operand so that it will point to itself.
+- * There are other cases where you have something like:
+- *
+- * .long $_GLOBAL_OFFSET_TABLE_+[.-.L66]
+- *
+- * and here no correction would be required. Internally in the assembler
+- * we treat operands of this form as not being pcrel since the '.' is
+- * explicitly mentioned, and I wonder whether it would simplify matters
+- * to do it this way. Who knows. In earlier versions of the PIC patches,
+- * the pcrel_adjust field was used to store the correction, but since the
+- * expression is not pcrel, I felt it would be confusing to do it this
+- * way. */
+-
+- value -= 1;
+- break;
+ case BFD_RELOC_386_GOT32:
+ case BFD_RELOC_386_TLS_GD:
+ case BFD_RELOC_386_TLS_LDM:
+--- binutils/gas/testsuite/gas/i386/gotpc.s.jj 2002-08-02 21:17:57.000000000 +0200
++++ binutils/gas/testsuite/gas/i386/gotpc.s 2002-08-03 22:55:47.000000000 +0200
+@@ -0,0 +1,40 @@
++ .text
++test:
++ addl $_GLOBAL_OFFSET_TABLE_+[.-test], %eax
++ addl $_GLOBAL_OFFSET_TABLE_+[.-test], %ebx
++ addl $_GLOBAL_OFFSET_TABLE_, %eax
++ addl $_GLOBAL_OFFSET_TABLE_, %ebx
++ leal _GLOBAL_OFFSET_TABLE+[.-test](%eax), %ebx
++ leal _GLOBAL_OFFSET_TABLE+[.-test](%ebx), %eax
++ leal _GLOBAL_OFFSET_TABLE+[.-test](%eax), %eax
++ leal _GLOBAL_OFFSET_TABLE+[.-test](%ebx), %ebx
++ subl $_GLOBAL_OFFSET_TABLE_+[.-test], %eax
++ subl $_GLOBAL_OFFSET_TABLE_+[.-test], %ebx
++ subl $_GLOBAL_OFFSET_TABLE_, %eax
++ subl $_GLOBAL_OFFSET_TABLE_, %ebx
++ orl $_GLOBAL_OFFSET_TABLE_+[.-test], %eax
++ orl $_GLOBAL_OFFSET_TABLE_+[.-test], %ebx
++ orl $_GLOBAL_OFFSET_TABLE_, %eax
++ orl $_GLOBAL_OFFSET_TABLE_, %ebx
++ movl $_GLOBAL_OFFSET_TABLE_+[.-test], %eax
++ movl $_GLOBAL_OFFSET_TABLE_+[.-test], %ebx
++ movl $_GLOBAL_OFFSET_TABLE_, %eax
++ movl $_GLOBAL_OFFSET_TABLE_, %ebx
++ movl $_GLOBAL_OFFSET_TABLE_+[.-test], foo
++ movl $_GLOBAL_OFFSET_TABLE_+[.-test], %gs:foo
++ gs; movl $_GLOBAL_OFFSET_TABLE_+[.-test], foo
++ movl $_GLOBAL_OFFSET_TABLE_+[.-test], _GLOBAL_OFFSET_TABLE_
++ movl _GLOBAL_OFFSET_TABLE_+[.-test], %eax
++ movl _GLOBAL_OFFSET_TABLE_+[.-test], %ebx
++ movl %eax, _GLOBAL_OFFSET_TABLE_+[.-test]
++ movl %ebx, _GLOBAL_OFFSET_TABLE_+[.-test]
++ movl %eax, %gs:_GLOBAL_OFFSET_TABLE_+[.-test]
++ movl %ebx, %gs:_GLOBAL_OFFSET_TABLE_+[.-test]
++ gs; movl %eax, _GLOBAL_OFFSET_TABLE_+[.-test]
++ gs; movl %ebx, _GLOBAL_OFFSET_TABLE_+[.-test]
++ leal _GLOBAL_OFFSET_TABLE_@GOTOFF(%ebx), %eax
++ leal _GLOBAL_OFFSET_TABLE_@GOTOFF(%ebx), %ebx
++ movl _GLOBAL_OFFSET_TABLE_@GOTOFF(%ebx), %eax
++ movl _GLOBAL_OFFSET_TABLE_@GOTOFF(%ebx), %ebx
++ .long _GLOBAL_OFFSET_TABLE_+[.-test]
++ .long _GLOBAL_OFFSET_TABLE_@GOTOFF
+--- binutils/gas/testsuite/gas/i386/gotpc.d.jj 2002-08-02 21:18:43.000000000 +0200
++++ binutils/gas/testsuite/gas/i386/gotpc.d 2002-08-03 23:05:43.000000000 +0200
+@@ -0,0 +1,52 @@
++#objdump: -drw
++#name: i386 gotpc
++
++.*: +file format .*
++
++Disassembly of section .text:
++
++0+000 <test>:
++ 0: 05 01 00 00 00 [ ]*add \$0x1,%eax 1: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
++ 5: 81 c3 07 00 00 00 [ ]*add \$0x7,%ebx 7: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
++ b: 05 01 00 00 00 [ ]*add \$0x1,%eax c: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
++ 10: 81 c3 02 00 00 00 [ ]*add \$0x2,%ebx 12: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
++ 16: 8d 98 16 00 00 00 [ ]*lea 0x16\(%eax\),%ebx 18: (R_386_)?(dir)?32 _GLOBAL_OFFSET_TABLE
++ 1c: 8d 83 1c 00 00 00 [ ]*lea 0x1c\(%ebx\),%eax 1e: (R_386_)?(dir)?32 _GLOBAL_OFFSET_TABLE
++ 22: 8d 80 22 00 00 00 [ ]*lea 0x22\(%eax\),%eax 24: (R_386_)?(dir)?32 _GLOBAL_OFFSET_TABLE
++ 28: 8d 9b 28 00 00 00 [ ]*lea 0x28\(%ebx\),%ebx 2a: (R_386_)?(dir)?32 _GLOBAL_OFFSET_TABLE
++ 2e: 2d 2f 00 00 00 [ ]*sub \$0x2f,%eax 2f: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
++ 33: 81 eb 35 00 00 00 [ ]*sub \$0x35,%ebx 35: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
++ 39: 2d 01 00 00 00 [ ]*sub \$0x1,%eax 3a: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
++ 3e: 81 eb 02 00 00 00 [ ]*sub \$0x2,%ebx 40: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
++ 44: 0d 45 00 00 00 [ ]*or \$0x45,%eax 45: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
++ 49: 81 cb 4b 00 00 00 [ ]*or \$0x4b,%ebx 4b: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
++ 4f: 0d 01 00 00 00 [ ]*or \$0x1,%eax 50: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
++ 54: 81 cb 02 00 00 00 [ ]*or \$0x2,%ebx 56: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
++ 5a: b8 5b 00 00 00 [ ]*mov \$0x5b,%eax 5b: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
++ 5f: bb 60 00 00 00 [ ]*mov \$0x60,%ebx 60: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
++ 64: b8 01 00 00 00 [ ]*mov \$0x1,%eax 65: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
++ 69: bb 01 00 00 00 [ ]*mov \$0x1,%ebx 6a: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
++ 6e: c7 05 00 00 00 00 74 00 00 00 [ ]*movl \$0x74,0x0 70: (R_386_)?(dir)?32 foo
++[ ]*74: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
++ 78: 65 c7 05 00 00 00 00 7f 00 00 00 [ ]*movl \$0x7f,%gs:0x0 7b: (R_386_)?(dir)?32 foo
++[ ]*7f: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
++ 83: 65 c7 05 00 00 00 00 8a 00 00 00 [ ]*movl \$0x8a,%gs:0x0 86: (R_386_)?(dir)?32 foo
++[ ]*8a: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
++ 8e: c7 05 02 00 00 00 94 00 00 00 [ ]*movl \$0x94,0x2 90: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
++[ ]*94: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
++ 98: a1 99 00 00 00 [ ]*mov 0x99,%eax 99: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
++ 9d: 8b 1d 9f 00 00 00 [ ]*mov 0x9f,%ebx 9f: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
++ a3: a3 a4 00 00 00 [ ]*mov %eax,0xa4 a4: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
++ a8: 89 1d aa 00 00 00 [ ]*mov %ebx,0xaa aa: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
++ ae: 65 a3 b0 00 00 00 [ ]*mov %eax,%gs:0xb0 b0: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
++ b4: 65 89 1d b7 00 00 00 [ ]*mov %ebx,%gs:0xb7 b7: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
++ bb: 65 a3 bd 00 00 00 [ ]*mov %eax,%gs:0xbd bd: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
++ c1: 65 89 1d c4 00 00 00 [ ]*mov %ebx,%gs:0xc4 c4: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
++ c8: 8d 83 00 00 00 00 [ ]*lea 0x0\(%ebx\),%eax ca: (R_386_)?GOTOFF _GLOBAL_OFFSET_TABLE_
++ ce: 8d 9b 00 00 00 00 [ ]*lea 0x0\(%ebx\),%ebx d0: (R_386_)?GOTOFF _GLOBAL_OFFSET_TABLE_
++ d4: 8b 83 00 00 00 00 [ ]*mov 0x0\(%ebx\),%eax d6: (R_386_)?GOTOFF _GLOBAL_OFFSET_TABLE_
++ da: 8b 9b 00 00 00 00 [ ]*mov 0x0\(%ebx\),%ebx dc: (R_386_)?GOTOFF _GLOBAL_OFFSET_TABLE_
++ e0: e0 00 [ ]*loopne e2 <test\+0xe2> e0: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
++ e2: 00 00 [ ]*add %al,\(%eax\)
++ e4: 00 00 [ ]*add %al,\(%eax\) e4: (R_386_)?GOTOFF _GLOBAL_OFFSET_TABLE_
++ ...
+--- binutils/gas/testsuite/gas/i386/i386.exp.jj 2002-07-18 11:35:39.000000000 +0200
++++ binutils/gas/testsuite/gas/i386/i386.exp 2002-08-02 21:57:46.000000000 +0200
+@@ -53,6 +53,7 @@ if [expr ([istarget "i*86-*-*"] || [ist
+ run_dump_test "jump"
+ run_dump_test "ssemmx2"
+ run_dump_test "sse2"
++ run_dump_test "gotpc"
+
+ # PIC is only supported on ELF targets.
+ if { ([istarget "*-*-elf*"] || [istarget "*-*-linux*"] )
+
diff --git a/patches/binutils/2.13.90.0.2/rh62-binutils-2.13.90.0.2-tpoff32.patch b/patches/binutils/2.13.90.0.2/rh62-binutils-2.13.90.0.2-tpoff32.patch
new file mode 100644
index 0000000..511a11e
--- /dev/null
+++ b/patches/binutils/2.13.90.0.2/rh62-binutils-2.13.90.0.2-tpoff32.patch
@@ -0,0 +1,27 @@
+2002-08-07 Jakub Jelinek <jakub@redhat.com>
+
+ * elf32-i386.c (elf_i386_relocate_section): Fill in proper addend
+ for R_386_TLS_TPOFF32 relocs against symndx 0.
+
+--- binutils/bfd/elf32-i386.c.jj 2002-07-30 16:14:55.000000000 +0200
++++ binutils/bfd/elf32-i386.c 2002-08-07 23:41:48.000000000 +0200
+@@ -2561,13 +2567,17 @@ elf_i386_relocate_section (output_bfd, i
+ outrel.r_offset = (htab->sgot->output_section->vma
+ + htab->sgot->output_offset + off);
+
+- bfd_put_32 (output_bfd, 0,
+- htab->sgot->contents + off);
+ indx = h && h->dynindx != -1 ? h->dynindx : 0;
+ if (r_type == R_386_TLS_GD)
+ dr_type = R_386_TLS_DTPMOD32;
+ else
+ dr_type = R_386_TLS_TPOFF32;
++ if (dr_type == R_386_TLS_TPOFF32 && indx == 0)
++ bfd_put_32 (output_bfd, relocation - dtpoff_base (info),
++ htab->sgot->contents + off);
++ else
++ bfd_put_32 (output_bfd, 0,
++ htab->sgot->contents + off);
+ outrel.r_info = ELF32_R_INFO (indx, dr_type);
+ loc = (Elf32_External_Rel *) htab->srelgot->contents;
+ loc += htab->srelgot->reloc_count++;
diff --git a/patches/binutils/2.14.90.0.5/binutils-cross-demangler.patch b/patches/binutils/2.14.90.0.5/binutils-cross-demangler.patch
new file mode 100644
index 0000000..ec701ce
--- /dev/null
+++ b/patches/binutils/2.14.90.0.5/binutils-cross-demangler.patch
@@ -0,0 +1,11 @@
+--- orig/Makefile.in 2004-05-12 18:22:30.000000000 -0700
++++ binutils-2.14.90.0.5/Makefile.in 2004-05-12 18:26:19.000000000 -0700
+@@ -24384,6 +24384,8 @@
+ # Demangler depends on libiberty.
+ configure-demangler: maybe-configure-libiberty
+ all-demangler: maybe-all-libiberty
++configure-build-demangler: maybe-configure-build-libiberty
++all-build-demangler: maybe-all-build-libiberty
+
+ # The new demangler, which is included in libiberty, is written in C++.
+ # A working C++ compiler is required. For the target demangler, it may
diff --git a/patches/binutils/2.14.90.0.5/binutils-sh-relocs.patch b/patches/binutils/2.14.90.0.5/binutils-sh-relocs.patch
new file mode 100644
index 0000000..ca0f2ac
--- /dev/null
+++ b/patches/binutils/2.14.90.0.5/binutils-sh-relocs.patch
@@ -0,0 +1,38 @@
+Message-Id: <200307311239.h6VCdNe27056@r-rr.iij4u.or.jp>
+To: dank@kegel.com
+Cc: kkojima@rr.iij4u.or.jp
+Subject: Re: Writing PIC version of __udivsi3_i4? (was: Re: "make tests" fails
+ with "libc.so: text relocations used" in glibc-2.3.2 for sh4)
+In-Reply-To: Your message of "Wed, 30 Jul 2003 21:55:54 -0700"
+ <3F28A15A.5010400@kegel.com>
+References: <3F28A15A.5010400@kegel.com>
+Date: Thu, 31 Jul 2003 21:47:38 +0900
+From: kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+Dan Kegel <dank@kegel.com> wrote:
+>> I'll give binutils-2.14.90.0.5 a shot, then.
+>
+> No joy - same problem. Guess I'll take this up on binutils and/or libc-alpha.
+
+Please try the patch below, though it's a diff against the current
+binutils CVS.
+
+Regards,
+ kaz
+--
+diff -u3p ORIG/src/bfd/elf32-sh.c LOCAL/src/bfd/elf32-sh.c
+--- src/bfd/elf32-sh.c.old Fri Jul 25 14:46:58 2003
++++ src/bfd/elf32-sh.c Thu Jul 31 21:09:38 2003
+@@ -6497,8 +6497,10 @@ sh_elf_check_relocs (bfd *abfd, struct b
+ sreloc, 2))
+ return FALSE;
+ }
++#if 0
+ if (sec->flags & SEC_READONLY)
+ info->flags |= DF_TEXTREL;
++#endif
+ elf_section_data (sec)->sreloc = sreloc;
+ }
+
+
+
diff --git a/patches/binutils/2.14.90.0.7/binutils-cross-demangler.patch b/patches/binutils/2.14.90.0.7/binutils-cross-demangler.patch
new file mode 100644
index 0000000..ec701ce
--- /dev/null
+++ b/patches/binutils/2.14.90.0.7/binutils-cross-demangler.patch
@@ -0,0 +1,11 @@
+--- orig/Makefile.in 2004-05-12 18:22:30.000000000 -0700
++++ binutils-2.14.90.0.5/Makefile.in 2004-05-12 18:26:19.000000000 -0700
+@@ -24384,6 +24384,8 @@
+ # Demangler depends on libiberty.
+ configure-demangler: maybe-configure-libiberty
+ all-demangler: maybe-all-libiberty
++configure-build-demangler: maybe-configure-build-libiberty
++all-build-demangler: maybe-all-build-libiberty
+
+ # The new demangler, which is included in libiberty, is written in C++.
+ # A working C++ compiler is required. For the target demangler, it may
diff --git a/patches/binutils/2.14.92/binutils-skip-comments.patch b/patches/binutils/2.14.92/binutils-skip-comments.patch
new file mode 100644
index 0000000..804a17e
--- /dev/null
+++ b/patches/binutils/2.14.92/binutils-skip-comments.patch
@@ -0,0 +1,101 @@
+Retrieved from http://sources.redhat.com/ml/binutils/2004-04/msg00646.html
+Fixes
+localealias.s:544: Error: junk at end of line, first unrecognized character is `,'
+when building glibc-2.3.2 with gcc-3.4.0 and binutils-2.15.90.0.3
+
+Paths adjusted to match crosstool's patcher.
+
+Message-Id: m3n052qw2g.fsf@whitebox.m5r.de
+From: Andreas Schwab <schwab at suse dot de>
+To: Nathan Sidwell <nathan at codesourcery dot com>
+Cc: Ian Lance Taylor <ian at wasabisystems dot com>, binutils at sources dot redhat dot com
+Date: Fri, 23 Apr 2004 22:27:19 +0200
+Subject: Re: demand_empty_rest_of_line and ignore_rest_of_line
+
+Nathan Sidwell <nathan@codesourcery.com> writes:
+
+> Index: read.c
+> ===================================================================
+> RCS file: /cvs/src/src/gas/read.c,v
+> retrieving revision 1.76
+> diff -c -3 -p -r1.76 read.c
+> *** read.c 12 Mar 2004 17:48:12 -0000 1.76
+> --- read.c 18 Mar 2004 09:56:05 -0000
+> *************** read_a_source_file (char *name)
+> *** 1053,1059 ****
+> #endif
+> input_line_pointer--;
+> /* Report unknown char as ignored. */
+> ! ignore_rest_of_line ();
+> }
+>
+> #ifdef md_after_pass_hook
+> --- 1053,1059 ----
+> #endif
+> input_line_pointer--;
+> /* Report unknown char as ignored. */
+> ! demand_empty_rest_of_line ();
+> }
+>
+> #ifdef md_after_pass_hook
+
+This means that the unknown character is no longer ignored, despite the
+comment. As a side effect a line starting with a line comment character
+not followed by APP in NO_APP mode now triggers an error instead of just a
+warning, breaking builds of glibc on m68k-linux. Earlier in
+read_a_source_file where #APP is handled there is another comment that
+claims that unknown comments are ignored, when in fact they aren't (only
+the initial line comment character is skipped).
+
+Note that the presence of #APP will mess up the line counters, but
+that appears to be difficult to fix.
+
+Andreas.
+
+2004-04-23 Andreas Schwab <schwab@suse.de>
+
+ * read.c (read_a_source_file): Ignore unknown text after line
+ comment character. Fix misleading comment.
+
+--- binutils/gas/read.c.~1.78.~ 2004-04-23 08:58:23.000000000 +0200
++++ binutils/gas/read.c 2004-04-23 21:49:01.000000000 +0200
+@@ -1,6 +1,6 @@
+ /* read.c - read a source file -
+ Copyright 1986, 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
+- 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
++ 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+
+ This file is part of GAS, the GNU Assembler.
+
+@@ -950,10 +950,14 @@ read_a_source_file (char *name)
+ unsigned int new_length;
+ char *tmp_buf = 0;
+
+- bump_line_counters ();
+ s = input_line_pointer;
+ if (strncmp (s, "APP\n", 4))
+- continue; /* We ignore it */
++ {
++ /* We ignore it */
++ ignore_rest_of_line ();
++ continue;
++ }
++ bump_line_counters ();
+ s += 4;
+
+ sb_new (&sbuf);
+@@ -1052,7 +1056,7 @@ read_a_source_file (char *name)
+ continue;
+ #endif
+ input_line_pointer--;
+- /* Report unknown char as ignored. */
++ /* Report unknown char as error. */
+ demand_empty_rest_of_line ();
+ }
+
+
+--
+Andreas Schwab, SuSE Labs, schwab@suse.de
+SuSE Linux AG, Maxfeldstra&#xC3;e 5, 90409 N&#xC3;rnberg, Germany
+Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
+"And now for something completely different."
diff --git a/patches/binutils/2.14.92/gccpr15247-fix.patch b/patches/binutils/2.14.92/gccpr15247-fix.patch
new file mode 100644
index 0000000..967bf7f
--- /dev/null
+++ b/patches/binutils/2.14.92/gccpr15247-fix.patch
@@ -0,0 +1,192 @@
+See
+http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15247
+
+Fixes spurious error
+/tmp/ccvNi4ou.s: Assembler messages:
+/tmp/ccvNi4ou.s:2310: Error: Illegal operands: There are only 32 single precision f registers; [0-31]
+make[2]: *** [/home/dank/wk/crosstool-0.28-rc10/build/sparc64-unknown-linux-gnu/gcc-3.4.0-glibc-2.3.2/build-glibc/math/dosincos.o] Error 1
+
+when compiling glibc's dosincos.c with gcc-3.4.0
+
+===================================================================
+RCS file: /cvs/src/src/opcodes/sparc-opc.c,v
+retrieving revision 1.9
+retrieving revision 1.10
+diff -u -r1.9 -r1.10
+--- src/opcodes/sparc-opc.c 2004/01/18 23:46:32 1.9
++++ src/opcodes/sparc-opc.c 2004/04/20 10:23:51 1.10
+@@ -1273,110 +1273,72 @@
+ #define FM_DF 2 /* v9 */
+ #define FM_QF 3 /* v9 */
+
+-#define fmovicc(opcode, fpsize, cond, flags) /* v9 */ \
+-{ opcode, F3F(2, 0x35, 0x100+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x100+fpsize))|MCOND(~cond,~0), "z,f,g", flags, v9 }, \
+-{ opcode, F3F(2, 0x35, 0x180+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x180+fpsize))|MCOND(~cond,~0), "Z,f,g", flags, v9 }
+-
+-#define fmovfcc(opcode, fpsize, fcond, flags) /* v9 */ \
+-{ opcode, F3F(2, 0x35, 0x000+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x000+fpsize))|MCOND(~fcond,~0), "6,f,g", flags, v9 }, \
+-{ opcode, F3F(2, 0x35, 0x040+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x040+fpsize))|MCOND(~fcond,~0), "7,f,g", flags, v9 }, \
+-{ opcode, F3F(2, 0x35, 0x080+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x080+fpsize))|MCOND(~fcond,~0), "8,f,g", flags, v9 }, \
+-{ opcode, F3F(2, 0x35, 0x0c0+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x0c0+fpsize))|MCOND(~fcond,~0), "9,f,g", flags, v9 }
++#define fmoviccx(opcode, fpsize, args, cond, flags) /* v9 */ \
++{ opcode, F3F(2, 0x35, 0x100+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x100+fpsize))|MCOND(~cond,~0), "z," args, flags, v9 }, \
++{ opcode, F3F(2, 0x35, 0x180+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x180+fpsize))|MCOND(~cond,~0), "Z," args, flags, v9 }
++
++#define fmovfccx(opcode, fpsize, args, fcond, flags) /* v9 */ \
++{ opcode, F3F(2, 0x35, 0x000+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x000+fpsize))|MCOND(~fcond,~0), "6," args, flags, v9 }, \
++{ opcode, F3F(2, 0x35, 0x040+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x040+fpsize))|MCOND(~fcond,~0), "7," args, flags, v9 }, \
++{ opcode, F3F(2, 0x35, 0x080+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x080+fpsize))|MCOND(~fcond,~0), "8," args, flags, v9 }, \
++{ opcode, F3F(2, 0x35, 0x0c0+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x0c0+fpsize))|MCOND(~fcond,~0), "9," args, flags, v9 }
+
+ /* FIXME: use fmovicc/fmovfcc? */ /* v9 */
+-#define fmovcc(opcode, fpsize, cond, fcond, flags) /* v9 */ \
+-{ opcode, F3F(2, 0x35, 0x100+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x100+fpsize))|MCOND(~cond,~0), "z,f,g", flags | F_FLOAT, v9 }, \
+-{ opcode, F3F(2, 0x35, 0x000+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x000+fpsize))|MCOND(~fcond,~0), "6,f,g", flags | F_FLOAT, v9 }, \
+-{ opcode, F3F(2, 0x35, 0x180+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x180+fpsize))|MCOND(~cond,~0), "Z,f,g", flags | F_FLOAT, v9 }, \
+-{ opcode, F3F(2, 0x35, 0x040+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x040+fpsize))|MCOND(~fcond,~0), "7,f,g", flags | F_FLOAT, v9 }, \
+-{ opcode, F3F(2, 0x35, 0x080+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x080+fpsize))|MCOND(~fcond,~0), "8,f,g", flags | F_FLOAT, v9 }, \
+-{ opcode, F3F(2, 0x35, 0x0c0+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x0c0+fpsize))|MCOND(~fcond,~0), "9,f,g", flags | F_FLOAT, v9 }
+-
+-/* v9 */ fmovcc ("fmovda", FM_DF, CONDA, FCONDA, 0),
+-/* v9 */ fmovcc ("fmovqa", FM_QF, CONDA, FCONDA, 0),
+-/* v9 */ fmovcc ("fmovsa", FM_SF, CONDA, FCONDA, 0),
+-/* v9 */ fmovicc ("fmovdcc", FM_DF, CONDCC, 0),
+-/* v9 */ fmovicc ("fmovqcc", FM_QF, CONDCC, 0),
+-/* v9 */ fmovicc ("fmovscc", FM_SF, CONDCC, 0),
+-/* v9 */ fmovicc ("fmovdcs", FM_DF, CONDCS, 0),
+-/* v9 */ fmovicc ("fmovqcs", FM_QF, CONDCS, 0),
+-/* v9 */ fmovicc ("fmovscs", FM_SF, CONDCS, 0),
+-/* v9 */ fmovcc ("fmovde", FM_DF, CONDE, FCONDE, 0),
+-/* v9 */ fmovcc ("fmovqe", FM_QF, CONDE, FCONDE, 0),
+-/* v9 */ fmovcc ("fmovse", FM_SF, CONDE, FCONDE, 0),
+-/* v9 */ fmovcc ("fmovdg", FM_DF, CONDG, FCONDG, 0),
+-/* v9 */ fmovcc ("fmovqg", FM_QF, CONDG, FCONDG, 0),
+-/* v9 */ fmovcc ("fmovsg", FM_SF, CONDG, FCONDG, 0),
+-/* v9 */ fmovcc ("fmovdge", FM_DF, CONDGE, FCONDGE, 0),
+-/* v9 */ fmovcc ("fmovqge", FM_QF, CONDGE, FCONDGE, 0),
+-/* v9 */ fmovcc ("fmovsge", FM_SF, CONDGE, FCONDGE, 0),
+-/* v9 */ fmovicc ("fmovdgeu", FM_DF, CONDGEU, F_ALIAS),
+-/* v9 */ fmovicc ("fmovqgeu", FM_QF, CONDGEU, F_ALIAS),
+-/* v9 */ fmovicc ("fmovsgeu", FM_SF, CONDGEU, F_ALIAS),
+-/* v9 */ fmovicc ("fmovdgu", FM_DF, CONDGU, 0),
+-/* v9 */ fmovicc ("fmovqgu", FM_QF, CONDGU, 0),
+-/* v9 */ fmovicc ("fmovsgu", FM_SF, CONDGU, 0),
+-/* v9 */ fmovcc ("fmovdl", FM_DF, CONDL, FCONDL, 0),
+-/* v9 */ fmovcc ("fmovql", FM_QF, CONDL, FCONDL, 0),
+-/* v9 */ fmovcc ("fmovsl", FM_SF, CONDL, FCONDL, 0),
+-/* v9 */ fmovcc ("fmovdle", FM_DF, CONDLE, FCONDLE, 0),
+-/* v9 */ fmovcc ("fmovqle", FM_QF, CONDLE, FCONDLE, 0),
+-/* v9 */ fmovcc ("fmovsle", FM_SF, CONDLE, FCONDLE, 0),
+-/* v9 */ fmovicc ("fmovdleu", FM_DF, CONDLEU, 0),
+-/* v9 */ fmovicc ("fmovqleu", FM_QF, CONDLEU, 0),
+-/* v9 */ fmovicc ("fmovsleu", FM_SF, CONDLEU, 0),
+-/* v9 */ fmovfcc ("fmovdlg", FM_DF, FCONDLG, 0),
+-/* v9 */ fmovfcc ("fmovqlg", FM_QF, FCONDLG, 0),
+-/* v9 */ fmovfcc ("fmovslg", FM_SF, FCONDLG, 0),
+-/* v9 */ fmovicc ("fmovdlu", FM_DF, CONDLU, F_ALIAS),
+-/* v9 */ fmovicc ("fmovqlu", FM_QF, CONDLU, F_ALIAS),
+-/* v9 */ fmovicc ("fmovslu", FM_SF, CONDLU, F_ALIAS),
+-/* v9 */ fmovcc ("fmovdn", FM_DF, CONDN, FCONDN, 0),
+-/* v9 */ fmovcc ("fmovqn", FM_QF, CONDN, FCONDN, 0),
+-/* v9 */ fmovcc ("fmovsn", FM_SF, CONDN, FCONDN, 0),
+-/* v9 */ fmovcc ("fmovdne", FM_DF, CONDNE, FCONDNE, 0),
+-/* v9 */ fmovcc ("fmovqne", FM_QF, CONDNE, FCONDNE, 0),
+-/* v9 */ fmovcc ("fmovsne", FM_SF, CONDNE, FCONDNE, 0),
+-/* v9 */ fmovicc ("fmovdneg", FM_DF, CONDNEG, 0),
+-/* v9 */ fmovicc ("fmovqneg", FM_QF, CONDNEG, 0),
+-/* v9 */ fmovicc ("fmovsneg", FM_SF, CONDNEG, 0),
+-/* v9 */ fmovcc ("fmovdnz", FM_DF, CONDNZ, FCONDNZ, F_ALIAS),
+-/* v9 */ fmovcc ("fmovqnz", FM_QF, CONDNZ, FCONDNZ, F_ALIAS),
+-/* v9 */ fmovcc ("fmovsnz", FM_SF, CONDNZ, FCONDNZ, F_ALIAS),
+-/* v9 */ fmovfcc ("fmovdo", FM_DF, FCONDO, 0),
+-/* v9 */ fmovfcc ("fmovqo", FM_QF, FCONDO, 0),
+-/* v9 */ fmovfcc ("fmovso", FM_SF, FCONDO, 0),
+-/* v9 */ fmovicc ("fmovdpos", FM_DF, CONDPOS, 0),
+-/* v9 */ fmovicc ("fmovqpos", FM_QF, CONDPOS, 0),
+-/* v9 */ fmovicc ("fmovspos", FM_SF, CONDPOS, 0),
+-/* v9 */ fmovfcc ("fmovdu", FM_DF, FCONDU, 0),
+-/* v9 */ fmovfcc ("fmovqu", FM_QF, FCONDU, 0),
+-/* v9 */ fmovfcc ("fmovsu", FM_SF, FCONDU, 0),
+-/* v9 */ fmovfcc ("fmovdue", FM_DF, FCONDUE, 0),
+-/* v9 */ fmovfcc ("fmovque", FM_QF, FCONDUE, 0),
+-/* v9 */ fmovfcc ("fmovsue", FM_SF, FCONDUE, 0),
+-/* v9 */ fmovfcc ("fmovdug", FM_DF, FCONDUG, 0),
+-/* v9 */ fmovfcc ("fmovqug", FM_QF, FCONDUG, 0),
+-/* v9 */ fmovfcc ("fmovsug", FM_SF, FCONDUG, 0),
+-/* v9 */ fmovfcc ("fmovduge", FM_DF, FCONDUGE, 0),
+-/* v9 */ fmovfcc ("fmovquge", FM_QF, FCONDUGE, 0),
+-/* v9 */ fmovfcc ("fmovsuge", FM_SF, FCONDUGE, 0),
+-/* v9 */ fmovfcc ("fmovdul", FM_DF, FCONDUL, 0),
+-/* v9 */ fmovfcc ("fmovqul", FM_QF, FCONDUL, 0),
+-/* v9 */ fmovfcc ("fmovsul", FM_SF, FCONDUL, 0),
+-/* v9 */ fmovfcc ("fmovdule", FM_DF, FCONDULE, 0),
+-/* v9 */ fmovfcc ("fmovqule", FM_QF, FCONDULE, 0),
+-/* v9 */ fmovfcc ("fmovsule", FM_SF, FCONDULE, 0),
+-/* v9 */ fmovicc ("fmovdvc", FM_DF, CONDVC, 0),
+-/* v9 */ fmovicc ("fmovqvc", FM_QF, CONDVC, 0),
+-/* v9 */ fmovicc ("fmovsvc", FM_SF, CONDVC, 0),
+-/* v9 */ fmovicc ("fmovdvs", FM_DF, CONDVS, 0),
+-/* v9 */ fmovicc ("fmovqvs", FM_QF, CONDVS, 0),
+-/* v9 */ fmovicc ("fmovsvs", FM_SF, CONDVS, 0),
+-/* v9 */ fmovcc ("fmovdz", FM_DF, CONDZ, FCONDZ, F_ALIAS),
+-/* v9 */ fmovcc ("fmovqz", FM_QF, CONDZ, FCONDZ, F_ALIAS),
+-/* v9 */ fmovcc ("fmovsz", FM_SF, CONDZ, FCONDZ, F_ALIAS),
+-
++#define fmovccx(opcode, fpsize, args, cond, fcond, flags) /* v9 */ \
++{ opcode, F3F(2, 0x35, 0x100+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x100+fpsize))|MCOND(~cond,~0), "z," args, flags | F_FLOAT, v9 }, \
++{ opcode, F3F(2, 0x35, 0x000+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x000+fpsize))|MCOND(~fcond,~0), "6," args, flags | F_FLOAT, v9 }, \
++{ opcode, F3F(2, 0x35, 0x180+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x180+fpsize))|MCOND(~cond,~0), "Z," args, flags | F_FLOAT, v9 }, \
++{ opcode, F3F(2, 0x35, 0x040+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x040+fpsize))|MCOND(~fcond,~0), "7," args, flags | F_FLOAT, v9 }, \
++{ opcode, F3F(2, 0x35, 0x080+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x080+fpsize))|MCOND(~fcond,~0), "8," args, flags | F_FLOAT, v9 }, \
++{ opcode, F3F(2, 0x35, 0x0c0+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x0c0+fpsize))|MCOND(~fcond,~0), "9," args, flags | F_FLOAT, v9 }
++
++#define fmovicc(suffix, cond, flags) /* v9 */ \
++fmoviccx("fmovd" suffix, FM_DF, "B,H", cond, flags), \
++fmoviccx("fmovq" suffix, FM_QF, "R,J", cond, flags), \
++fmoviccx("fmovs" suffix, FM_SF, "f,g", cond, flags)
++
++#define fmovfcc(suffix, fcond, flags) /* v9 */ \
++fmovfccx("fmovd" suffix, FM_DF, "B,H", fcond, flags), \
++fmovfccx("fmovq" suffix, FM_QF, "R,J", fcond, flags), \
++fmovfccx("fmovs" suffix, FM_SF, "f,g", fcond, flags)
++
++#define fmovcc(suffix, cond, fcond, flags) /* v9 */ \
++fmovccx("fmovd" suffix, FM_DF, "B,H", cond, fcond, flags), \
++fmovccx("fmovq" suffix, FM_QF, "R,J", cond, fcond, flags), \
++fmovccx("fmovs" suffix, FM_SF, "f,g", cond, fcond, flags)
++
++/* v9 */ fmovcc ("a", CONDA, FCONDA, 0),
++/* v9 */ fmovicc ("cc", CONDCC, 0),
++/* v9 */ fmovicc ("cs", CONDCS, 0),
++/* v9 */ fmovcc ("e", CONDE, FCONDE, 0),
++/* v9 */ fmovcc ("g", CONDG, FCONDG, 0),
++/* v9 */ fmovcc ("ge", CONDGE, FCONDGE, 0),
++/* v9 */ fmovicc ("geu", CONDGEU, F_ALIAS),
++/* v9 */ fmovicc ("gu", CONDGU, 0),
++/* v9 */ fmovcc ("l", CONDL, FCONDL, 0),
++/* v9 */ fmovcc ("le", CONDLE, FCONDLE, 0),
++/* v9 */ fmovicc ("leu", CONDLEU, 0),
++/* v9 */ fmovfcc ("lg", FCONDLG, 0),
++/* v9 */ fmovicc ("lu", CONDLU, F_ALIAS),
++/* v9 */ fmovcc ("n", CONDN, FCONDN, 0),
++/* v9 */ fmovcc ("ne", CONDNE, FCONDNE, 0),
++/* v9 */ fmovicc ("neg", CONDNEG, 0),
++/* v9 */ fmovcc ("nz", CONDNZ, FCONDNZ, F_ALIAS),
++/* v9 */ fmovfcc ("o", FCONDO, 0),
++/* v9 */ fmovicc ("pos", CONDPOS, 0),
++/* v9 */ fmovfcc ("u", FCONDU, 0),
++/* v9 */ fmovfcc ("ue", FCONDUE, 0),
++/* v9 */ fmovfcc ("ug", FCONDUG, 0),
++/* v9 */ fmovfcc ("uge", FCONDUGE, 0),
++/* v9 */ fmovfcc ("ul", FCONDUL, 0),
++/* v9 */ fmovfcc ("ule", FCONDULE, 0),
++/* v9 */ fmovicc ("vc", CONDVC, 0),
++/* v9 */ fmovicc ("vs", CONDVS, 0),
++/* v9 */ fmovcc ("z", CONDZ, FCONDZ, F_ALIAS),
++
++#undef fmoviccx /* v9 */
++#undef fmovfccx /* v9 */
++#undef fmovccx /* v9 */
+ #undef fmovicc /* v9 */
+ #undef fmovfcc /* v9 */
+ #undef fmovcc /* v9 */
diff --git a/patches/binutils/2.14/binutils-sh-relocs.patch b/patches/binutils/2.14/binutils-sh-relocs.patch
new file mode 100644
index 0000000..ca0f2ac
--- /dev/null
+++ b/patches/binutils/2.14/binutils-sh-relocs.patch
@@ -0,0 +1,38 @@
+Message-Id: <200307311239.h6VCdNe27056@r-rr.iij4u.or.jp>
+To: dank@kegel.com
+Cc: kkojima@rr.iij4u.or.jp
+Subject: Re: Writing PIC version of __udivsi3_i4? (was: Re: "make tests" fails
+ with "libc.so: text relocations used" in glibc-2.3.2 for sh4)
+In-Reply-To: Your message of "Wed, 30 Jul 2003 21:55:54 -0700"
+ <3F28A15A.5010400@kegel.com>
+References: <3F28A15A.5010400@kegel.com>
+Date: Thu, 31 Jul 2003 21:47:38 +0900
+From: kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+Dan Kegel <dank@kegel.com> wrote:
+>> I'll give binutils-2.14.90.0.5 a shot, then.
+>
+> No joy - same problem. Guess I'll take this up on binutils and/or libc-alpha.
+
+Please try the patch below, though it's a diff against the current
+binutils CVS.
+
+Regards,
+ kaz
+--
+diff -u3p ORIG/src/bfd/elf32-sh.c LOCAL/src/bfd/elf32-sh.c
+--- src/bfd/elf32-sh.c.old Fri Jul 25 14:46:58 2003
++++ src/bfd/elf32-sh.c Thu Jul 31 21:09:38 2003
+@@ -6497,8 +6497,10 @@ sh_elf_check_relocs (bfd *abfd, struct b
+ sreloc, 2))
+ return FALSE;
+ }
++#if 0
+ if (sec->flags & SEC_READONLY)
+ info->flags |= DF_TEXTREL;
++#endif
+ elf_section_data (sec)->sreloc = sreloc;
+ }
+
+
+
diff --git a/patches/binutils/2.15.90.0.3/binutils-20040817-linkonce.patch b/patches/binutils/2.15.90.0.3/binutils-20040817-linkonce.patch
new file mode 100644
index 0000000..97fa6ee
--- /dev/null
+++ b/patches/binutils/2.15.90.0.3/binutils-20040817-linkonce.patch
@@ -0,0 +1,118 @@
+From http://sources.redhat.com/ml/binutils/2004-08/msg00190.html
+
+Date: Tue, 17 Aug 2004 12:04:29 +0200
+From: Jakub Jelinek <jakub at redhat dot com>
+To: binutils at sources dot redhat dot com
+Subject: [PATCH] Fix `defined in discarded section' errors when building ia64 gcc
+Message-ID: <20040817100429.GL30497@sunsite.ms.mff.cuni.cz>
+Reply-To: Jakub Jelinek <jakub at redhat dot com>
+References: <20040817090201.GK30497@sunsite.ms.mff.cuni.cz>
+In-Reply-To: <20040817090201 dot GK30497 at sunsite dot ms dot mff dot cuni dot cz>
+
+On Tue, Aug 17, 2004 at 11:02:01AM +0200, Jakub Jelinek wrote:
+> Current gcc 3.4.x (at least gcc-3_4-rhl-branch) doesn't build with CVS
+> binutils (nor 2.15.91.0.2).
+> The problem is that libstdc++.so linking fails with:
+> `.gnu.linkonce.t._ZNSdD2Ev' referenced in section `.gnu.linkonce.ia64unw._ZNSdD2Ev' of .libs/sstream-inst.o: defined in discarded section `.gnu.linkonce.t._ZNSdD2Ev' of .libs/sstream-inst.o
+> The problem is that both io-inst.s and sstream-inst.s have
+> .gnu.linkonce.t._ZNSdD2Ev definition, but because io-inst.cc
+> also instantiates some templates sstream-inst.cc doesn't instantiate,
+> the inliner can do a better job in io-inst.cc.
+> The result is that _ZNSdD2Ev in io-inst.cc is a leaf routine, while
+> it is not in sstream-inst.cc (in assembly,
+> _ZNSdD2Ev in io-inst.s starts with .prologue and no .save directives,
+> while _ZNSdD2Ev] in sstream-inst.s has .prologue 12, 35 and some
+> .save directives.
+> IA-64 ABI allows leaf routines to have no unwind section at all,
+> which means .gnu.linkonce.ia64unw._ZNSdD2Ev is not created in
+> io-inst.o at all and as .gnu.linkonce.t._ZNSdD2Ev comes first
+> and wins, .gnu.linkonce.ia64unw._ZNSdD2Ev in sstream.o suddenly
+> references a discarded section.
+>
+> Not sure what should be done here, but certainly the compiler
+> isn't at fault here, it is a binutils problem.
+> One fix could be to create empty .gnu.linkonce.ia64unw.* section
+> in assembler, another special case ia64 unwind sections in the linker.
+
+Here is a patch for the first possibility.
+It certainly makes libstdc++.so to link and even the unwind info looks
+good on brief skimming.
+
+2004-08-17 Jakub Jelinek <jakub@redhat.com>
+
+ * config/tc-ia64.c (start_unwind_section): Add linkonce_empty
+ argument, don't do anything if current section is not
+ .gnu.linkonce.t.* and linkonce_empty is set.
+ (generate_unwind_image, dot_endp): Adjust callers, call
+ start_unwind_section (*, 1) if nothing will be put into the
+ section.
+
+--- binutils/gas/config/tc-ia64.c.jj 2004-07-30 11:42:24.000000000 +0200
++++ binutils/gas/config/tc-ia64.c 2004-08-17 13:45:04.288173205 +0200
+@@ -1,5 +1,6 @@
+ /* tc-ia64.c -- Assembler for the HP/Intel IA-64 architecture.
+- Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
++ Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004
++ Free Software Foundation, Inc.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ This file is part of GAS, the GNU Assembler.
+@@ -3297,7 +3298,7 @@ static char *special_linkonce_name[] =
+ };
+
+ static void
+-start_unwind_section (const segT text_seg, int sec_index)
++start_unwind_section (const segT text_seg, int sec_index, int linkonce_empty)
+ {
+ /*
+ Use a slightly ugly scheme to derive the unwind section names from
+@@ -3359,6 +3360,8 @@ start_unwind_section (const segT text_se
+ prefix = special_linkonce_name [sec_index - SPECIAL_SECTION_UNWIND];
+ suffix += sizeof (".gnu.linkonce.t.") - 1;
+ }
++ else if (linkonce_empty)
++ return;
+
+ prefix_len = strlen (prefix);
+ suffix_len = strlen (suffix);
+@@ -3444,7 +3447,7 @@ generate_unwind_image (const segT text_s
+ expressionS exp;
+ bfd_reloc_code_real_type reloc;
+
+- start_unwind_section (text_seg, SPECIAL_SECTION_UNWIND_INFO);
++ start_unwind_section (text_seg, SPECIAL_SECTION_UNWIND_INFO, 0);
+
+ /* Make sure the section has 4 byte alignment for ILP32 and
+ 8 byte alignment for LP64. */
+@@ -3485,6 +3488,8 @@ generate_unwind_image (const segT text_s
+ unwind.personality_routine = 0;
+ }
+ }
++ else
++ start_unwind_section (text_seg, SPECIAL_SECTION_UNWIND_INFO, 1);
+
+ free_saved_prologue_counts ();
+ unwind.list = unwind.tail = unwind.current_entry = NULL;
+@@ -4164,7 +4169,7 @@ dot_endp (dummy)
+ subseg_set (md.last_text_seg, 0);
+ unwind.proc_end = expr_build_dot ();
+
+- start_unwind_section (saved_seg, SPECIAL_SECTION_UNWIND);
++ start_unwind_section (saved_seg, SPECIAL_SECTION_UNWIND, 0);
+
+ /* Make sure that section has 4 byte alignment for ILP32 and
+ 8 byte alignment for LP64. */
+@@ -4204,6 +4209,9 @@ dot_endp (dummy)
+ bytes_per_address);
+
+ }
++ else
++ start_unwind_section (saved_seg, SPECIAL_SECTION_UNWIND, 1);
++
+ subseg_set (saved_seg, saved_subseg);
+
+ /* Parse names of main and alternate entry points and set symbol sizes. */
+
+
+ Jakub
+
diff --git a/patches/binutils/2.15.90.0.3/binutils-20040820-duplicates.patch b/patches/binutils/2.15.90.0.3/binutils-20040820-duplicates.patch
new file mode 100644
index 0000000..03f6453
--- /dev/null
+++ b/patches/binutils/2.15.90.0.3/binutils-20040820-duplicates.patch
@@ -0,0 +1,74 @@
+See http://sources.redhat.com/ml/binutils/2004-08/msg00256.html
+
+Date: Fri, 20 Aug 2004 21:13:43 -0400
+From: Daniel Jacobowitz <drow at false dot org>
+To: binutils at sources dot redhat dot com
+Subject: Re: Handle SEC_LINK_DUPLICATES_SAME_CONTENTS for arm-linux
+Message-ID: <20040821011342.GA30319@nevyn.them.org>
+Mail-Followup-To: binutils at sources dot redhat dot com
+References: <20040818145518.GA9774@nevyn.them.org> <20040819055040.GA11820@lucon.org> <20040819080034.GE21716@bubble.modra.org> <20040820173240.GA17678@nevyn.them.org> <20040821003737.GB16016@bubble.modra.org>
+In-Reply-To: <20040821003737 dot GB16016 at bubble dot modra dot org>
+
+On Sat, Aug 21, 2004 at 10:07:38AM +0930, Alan Modra wrote:
+> On Fri, Aug 20, 2004 at 01:32:40PM -0400, Daniel Jacobowitz wrote:
+> > Thanks. How's this?
+>
+> As you might have guessed from my rather slack review of your previous
+> patch, I trust you enough to give the OK without proper review. But
+> since you asked... :)
+
+Checked in as so.
+
+--
+Daniel Jacobowitz
+
+2004-08-20 Daniel Jacobowitz <dan@debian.org>
+
+ * elflink.c (_bfd_elf_section_already_linked): Handle
+ SEC_LINK_DUPLICATES_SAME_CONTENTS.
+
+Index: elflink.c
+===================================================================
+RCS file: /big/fsf/rsync/src-cvs/src/bfd/elflink.c,v
+retrieving revision 1.97
+diff -u -p -r1.97 elflink.c
+--- binutils/bfd/elflink.c 18 Aug 2004 02:45:42 -0000 1.97
++++ binutils/bfd/elflink.c 21 Aug 2004 00:59:08 -0000
+@@ -9366,6 +9366,36 @@ _bfd_elf_section_already_linked (bfd *ab
+ (_("%B: duplicate section `%A' has different size\n"),
+ abfd, sec);
+ break;
++
++ case SEC_LINK_DUPLICATES_SAME_CONTENTS:
++ if (sec->size != l->sec->size)
++ (*_bfd_error_handler)
++ (_("%B: duplicate section `%A' has different size\n"),
++ abfd, sec);
++ else if (sec->size != 0)
++ {
++ bfd_byte *sec_contents, *l_sec_contents;
++
++ if (!bfd_malloc_and_get_section (abfd, sec, &sec_contents))
++ (*_bfd_error_handler)
++ (_("%B: warning: could not read contents of section `%A'\n"),
++ abfd, sec);
++ else if (!bfd_malloc_and_get_section (l->sec->owner, l->sec,
++ &l_sec_contents))
++ (*_bfd_error_handler)
++ (_("%B: warning: could not read contents of section `%A'\n"),
++ l->sec->owner, l->sec);
++ else if (memcmp (sec_contents, l_sec_contents, sec->size) != 0)
++ (*_bfd_error_handler)
++ (_("%B: warning: duplicate section `%A' has different contents\n"),
++ abfd, sec);
++
++ if (sec_contents)
++ free (sec_contents);
++ if (l_sec_contents)
++ free (l_sec_contents);
++ }
++ break;
+ }
+
+ /* Set the output_section field so that lang_add_section
+
diff --git a/patches/binutils/2.15.90.0.3/binutils-skip-comments.patch b/patches/binutils/2.15.90.0.3/binutils-skip-comments.patch
new file mode 100644
index 0000000..804a17e
--- /dev/null
+++ b/patches/binutils/2.15.90.0.3/binutils-skip-comments.patch
@@ -0,0 +1,101 @@
+Retrieved from http://sources.redhat.com/ml/binutils/2004-04/msg00646.html
+Fixes
+localealias.s:544: Error: junk at end of line, first unrecognized character is `,'
+when building glibc-2.3.2 with gcc-3.4.0 and binutils-2.15.90.0.3
+
+Paths adjusted to match crosstool's patcher.
+
+Message-Id: m3n052qw2g.fsf@whitebox.m5r.de
+From: Andreas Schwab <schwab at suse dot de>
+To: Nathan Sidwell <nathan at codesourcery dot com>
+Cc: Ian Lance Taylor <ian at wasabisystems dot com>, binutils at sources dot redhat dot com
+Date: Fri, 23 Apr 2004 22:27:19 +0200
+Subject: Re: demand_empty_rest_of_line and ignore_rest_of_line
+
+Nathan Sidwell <nathan@codesourcery.com> writes:
+
+> Index: read.c
+> ===================================================================
+> RCS file: /cvs/src/src/gas/read.c,v
+> retrieving revision 1.76
+> diff -c -3 -p -r1.76 read.c
+> *** read.c 12 Mar 2004 17:48:12 -0000 1.76
+> --- read.c 18 Mar 2004 09:56:05 -0000
+> *************** read_a_source_file (char *name)
+> *** 1053,1059 ****
+> #endif
+> input_line_pointer--;
+> /* Report unknown char as ignored. */
+> ! ignore_rest_of_line ();
+> }
+>
+> #ifdef md_after_pass_hook
+> --- 1053,1059 ----
+> #endif
+> input_line_pointer--;
+> /* Report unknown char as ignored. */
+> ! demand_empty_rest_of_line ();
+> }
+>
+> #ifdef md_after_pass_hook
+
+This means that the unknown character is no longer ignored, despite the
+comment. As a side effect a line starting with a line comment character
+not followed by APP in NO_APP mode now triggers an error instead of just a
+warning, breaking builds of glibc on m68k-linux. Earlier in
+read_a_source_file where #APP is handled there is another comment that
+claims that unknown comments are ignored, when in fact they aren't (only
+the initial line comment character is skipped).
+
+Note that the presence of #APP will mess up the line counters, but
+that appears to be difficult to fix.
+
+Andreas.
+
+2004-04-23 Andreas Schwab <schwab@suse.de>
+
+ * read.c (read_a_source_file): Ignore unknown text after line
+ comment character. Fix misleading comment.
+
+--- binutils/gas/read.c.~1.78.~ 2004-04-23 08:58:23.000000000 +0200
++++ binutils/gas/read.c 2004-04-23 21:49:01.000000000 +0200
+@@ -1,6 +1,6 @@
+ /* read.c - read a source file -
+ Copyright 1986, 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
+- 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
++ 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+
+ This file is part of GAS, the GNU Assembler.
+
+@@ -950,10 +950,14 @@ read_a_source_file (char *name)
+ unsigned int new_length;
+ char *tmp_buf = 0;
+
+- bump_line_counters ();
+ s = input_line_pointer;
+ if (strncmp (s, "APP\n", 4))
+- continue; /* We ignore it */
++ {
++ /* We ignore it */
++ ignore_rest_of_line ();
++ continue;
++ }
++ bump_line_counters ();
+ s += 4;
+
+ sb_new (&sbuf);
+@@ -1052,7 +1056,7 @@ read_a_source_file (char *name)
+ continue;
+ #endif
+ input_line_pointer--;
+- /* Report unknown char as ignored. */
++ /* Report unknown char as error. */
+ demand_empty_rest_of_line ();
+ }
+
+
+--
+Andreas Schwab, SuSE Labs, schwab@suse.de
+SuSE Linux AG, Maxfeldstra&#xC3;e 5, 90409 N&#xC3;rnberg, Germany
+Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
+"And now for something completely different."
diff --git a/patches/binutils/2.15.90.0.3/gccpr15247-fix.patch b/patches/binutils/2.15.90.0.3/gccpr15247-fix.patch
new file mode 100644
index 0000000..967bf7f
--- /dev/null
+++ b/patches/binutils/2.15.90.0.3/gccpr15247-fix.patch
@@ -0,0 +1,192 @@
+See
+http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15247
+
+Fixes spurious error
+/tmp/ccvNi4ou.s: Assembler messages:
+/tmp/ccvNi4ou.s:2310: Error: Illegal operands: There are only 32 single precision f registers; [0-31]
+make[2]: *** [/home/dank/wk/crosstool-0.28-rc10/build/sparc64-unknown-linux-gnu/gcc-3.4.0-glibc-2.3.2/build-glibc/math/dosincos.o] Error 1
+
+when compiling glibc's dosincos.c with gcc-3.4.0
+
+===================================================================
+RCS file: /cvs/src/src/opcodes/sparc-opc.c,v
+retrieving revision 1.9
+retrieving revision 1.10
+diff -u -r1.9 -r1.10
+--- src/opcodes/sparc-opc.c 2004/01/18 23:46:32 1.9
++++ src/opcodes/sparc-opc.c 2004/04/20 10:23:51 1.10
+@@ -1273,110 +1273,72 @@
+ #define FM_DF 2 /* v9 */
+ #define FM_QF 3 /* v9 */
+
+-#define fmovicc(opcode, fpsize, cond, flags) /* v9 */ \
+-{ opcode, F3F(2, 0x35, 0x100+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x100+fpsize))|MCOND(~cond,~0), "z,f,g", flags, v9 }, \
+-{ opcode, F3F(2, 0x35, 0x180+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x180+fpsize))|MCOND(~cond,~0), "Z,f,g", flags, v9 }
+-
+-#define fmovfcc(opcode, fpsize, fcond, flags) /* v9 */ \
+-{ opcode, F3F(2, 0x35, 0x000+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x000+fpsize))|MCOND(~fcond,~0), "6,f,g", flags, v9 }, \
+-{ opcode, F3F(2, 0x35, 0x040+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x040+fpsize))|MCOND(~fcond,~0), "7,f,g", flags, v9 }, \
+-{ opcode, F3F(2, 0x35, 0x080+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x080+fpsize))|MCOND(~fcond,~0), "8,f,g", flags, v9 }, \
+-{ opcode, F3F(2, 0x35, 0x0c0+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x0c0+fpsize))|MCOND(~fcond,~0), "9,f,g", flags, v9 }
++#define fmoviccx(opcode, fpsize, args, cond, flags) /* v9 */ \
++{ opcode, F3F(2, 0x35, 0x100+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x100+fpsize))|MCOND(~cond,~0), "z," args, flags, v9 }, \
++{ opcode, F3F(2, 0x35, 0x180+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x180+fpsize))|MCOND(~cond,~0), "Z," args, flags, v9 }
++
++#define fmovfccx(opcode, fpsize, args, fcond, flags) /* v9 */ \
++{ opcode, F3F(2, 0x35, 0x000+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x000+fpsize))|MCOND(~fcond,~0), "6," args, flags, v9 }, \
++{ opcode, F3F(2, 0x35, 0x040+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x040+fpsize))|MCOND(~fcond,~0), "7," args, flags, v9 }, \
++{ opcode, F3F(2, 0x35, 0x080+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x080+fpsize))|MCOND(~fcond,~0), "8," args, flags, v9 }, \
++{ opcode, F3F(2, 0x35, 0x0c0+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x0c0+fpsize))|MCOND(~fcond,~0), "9," args, flags, v9 }
+
+ /* FIXME: use fmovicc/fmovfcc? */ /* v9 */
+-#define fmovcc(opcode, fpsize, cond, fcond, flags) /* v9 */ \
+-{ opcode, F3F(2, 0x35, 0x100+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x100+fpsize))|MCOND(~cond,~0), "z,f,g", flags | F_FLOAT, v9 }, \
+-{ opcode, F3F(2, 0x35, 0x000+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x000+fpsize))|MCOND(~fcond,~0), "6,f,g", flags | F_FLOAT, v9 }, \
+-{ opcode, F3F(2, 0x35, 0x180+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x180+fpsize))|MCOND(~cond,~0), "Z,f,g", flags | F_FLOAT, v9 }, \
+-{ opcode, F3F(2, 0x35, 0x040+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x040+fpsize))|MCOND(~fcond,~0), "7,f,g", flags | F_FLOAT, v9 }, \
+-{ opcode, F3F(2, 0x35, 0x080+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x080+fpsize))|MCOND(~fcond,~0), "8,f,g", flags | F_FLOAT, v9 }, \
+-{ opcode, F3F(2, 0x35, 0x0c0+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x0c0+fpsize))|MCOND(~fcond,~0), "9,f,g", flags | F_FLOAT, v9 }
+-
+-/* v9 */ fmovcc ("fmovda", FM_DF, CONDA, FCONDA, 0),
+-/* v9 */ fmovcc ("fmovqa", FM_QF, CONDA, FCONDA, 0),
+-/* v9 */ fmovcc ("fmovsa", FM_SF, CONDA, FCONDA, 0),
+-/* v9 */ fmovicc ("fmovdcc", FM_DF, CONDCC, 0),
+-/* v9 */ fmovicc ("fmovqcc", FM_QF, CONDCC, 0),
+-/* v9 */ fmovicc ("fmovscc", FM_SF, CONDCC, 0),
+-/* v9 */ fmovicc ("fmovdcs", FM_DF, CONDCS, 0),
+-/* v9 */ fmovicc ("fmovqcs", FM_QF, CONDCS, 0),
+-/* v9 */ fmovicc ("fmovscs", FM_SF, CONDCS, 0),
+-/* v9 */ fmovcc ("fmovde", FM_DF, CONDE, FCONDE, 0),
+-/* v9 */ fmovcc ("fmovqe", FM_QF, CONDE, FCONDE, 0),
+-/* v9 */ fmovcc ("fmovse", FM_SF, CONDE, FCONDE, 0),
+-/* v9 */ fmovcc ("fmovdg", FM_DF, CONDG, FCONDG, 0),
+-/* v9 */ fmovcc ("fmovqg", FM_QF, CONDG, FCONDG, 0),
+-/* v9 */ fmovcc ("fmovsg", FM_SF, CONDG, FCONDG, 0),
+-/* v9 */ fmovcc ("fmovdge", FM_DF, CONDGE, FCONDGE, 0),
+-/* v9 */ fmovcc ("fmovqge", FM_QF, CONDGE, FCONDGE, 0),
+-/* v9 */ fmovcc ("fmovsge", FM_SF, CONDGE, FCONDGE, 0),
+-/* v9 */ fmovicc ("fmovdgeu", FM_DF, CONDGEU, F_ALIAS),
+-/* v9 */ fmovicc ("fmovqgeu", FM_QF, CONDGEU, F_ALIAS),
+-/* v9 */ fmovicc ("fmovsgeu", FM_SF, CONDGEU, F_ALIAS),
+-/* v9 */ fmovicc ("fmovdgu", FM_DF, CONDGU, 0),
+-/* v9 */ fmovicc ("fmovqgu", FM_QF, CONDGU, 0),
+-/* v9 */ fmovicc ("fmovsgu", FM_SF, CONDGU, 0),
+-/* v9 */ fmovcc ("fmovdl", FM_DF, CONDL, FCONDL, 0),
+-/* v9 */ fmovcc ("fmovql", FM_QF, CONDL, FCONDL, 0),
+-/* v9 */ fmovcc ("fmovsl", FM_SF, CONDL, FCONDL, 0),
+-/* v9 */ fmovcc ("fmovdle", FM_DF, CONDLE, FCONDLE, 0),
+-/* v9 */ fmovcc ("fmovqle", FM_QF, CONDLE, FCONDLE, 0),
+-/* v9 */ fmovcc ("fmovsle", FM_SF, CONDLE, FCONDLE, 0),
+-/* v9 */ fmovicc ("fmovdleu", FM_DF, CONDLEU, 0),
+-/* v9 */ fmovicc ("fmovqleu", FM_QF, CONDLEU, 0),
+-/* v9 */ fmovicc ("fmovsleu", FM_SF, CONDLEU, 0),
+-/* v9 */ fmovfcc ("fmovdlg", FM_DF, FCONDLG, 0),
+-/* v9 */ fmovfcc ("fmovqlg", FM_QF, FCONDLG, 0),
+-/* v9 */ fmovfcc ("fmovslg", FM_SF, FCONDLG, 0),
+-/* v9 */ fmovicc ("fmovdlu", FM_DF, CONDLU, F_ALIAS),
+-/* v9 */ fmovicc ("fmovqlu", FM_QF, CONDLU, F_ALIAS),
+-/* v9 */ fmovicc ("fmovslu", FM_SF, CONDLU, F_ALIAS),
+-/* v9 */ fmovcc ("fmovdn", FM_DF, CONDN, FCONDN, 0),
+-/* v9 */ fmovcc ("fmovqn", FM_QF, CONDN, FCONDN, 0),
+-/* v9 */ fmovcc ("fmovsn", FM_SF, CONDN, FCONDN, 0),
+-/* v9 */ fmovcc ("fmovdne", FM_DF, CONDNE, FCONDNE, 0),
+-/* v9 */ fmovcc ("fmovqne", FM_QF, CONDNE, FCONDNE, 0),
+-/* v9 */ fmovcc ("fmovsne", FM_SF, CONDNE, FCONDNE, 0),
+-/* v9 */ fmovicc ("fmovdneg", FM_DF, CONDNEG, 0),
+-/* v9 */ fmovicc ("fmovqneg", FM_QF, CONDNEG, 0),
+-/* v9 */ fmovicc ("fmovsneg", FM_SF, CONDNEG, 0),
+-/* v9 */ fmovcc ("fmovdnz", FM_DF, CONDNZ, FCONDNZ, F_ALIAS),
+-/* v9 */ fmovcc ("fmovqnz", FM_QF, CONDNZ, FCONDNZ, F_ALIAS),
+-/* v9 */ fmovcc ("fmovsnz", FM_SF, CONDNZ, FCONDNZ, F_ALIAS),
+-/* v9 */ fmovfcc ("fmovdo", FM_DF, FCONDO, 0),
+-/* v9 */ fmovfcc ("fmovqo", FM_QF, FCONDO, 0),
+-/* v9 */ fmovfcc ("fmovso", FM_SF, FCONDO, 0),
+-/* v9 */ fmovicc ("fmovdpos", FM_DF, CONDPOS, 0),
+-/* v9 */ fmovicc ("fmovqpos", FM_QF, CONDPOS, 0),
+-/* v9 */ fmovicc ("fmovspos", FM_SF, CONDPOS, 0),
+-/* v9 */ fmovfcc ("fmovdu", FM_DF, FCONDU, 0),
+-/* v9 */ fmovfcc ("fmovqu", FM_QF, FCONDU, 0),
+-/* v9 */ fmovfcc ("fmovsu", FM_SF, FCONDU, 0),
+-/* v9 */ fmovfcc ("fmovdue", FM_DF, FCONDUE, 0),
+-/* v9 */ fmovfcc ("fmovque", FM_QF, FCONDUE, 0),
+-/* v9 */ fmovfcc ("fmovsue", FM_SF, FCONDUE, 0),
+-/* v9 */ fmovfcc ("fmovdug", FM_DF, FCONDUG, 0),
+-/* v9 */ fmovfcc ("fmovqug", FM_QF, FCONDUG, 0),
+-/* v9 */ fmovfcc ("fmovsug", FM_SF, FCONDUG, 0),
+-/* v9 */ fmovfcc ("fmovduge", FM_DF, FCONDUGE, 0),
+-/* v9 */ fmovfcc ("fmovquge", FM_QF, FCONDUGE, 0),
+-/* v9 */ fmovfcc ("fmovsuge", FM_SF, FCONDUGE, 0),
+-/* v9 */ fmovfcc ("fmovdul", FM_DF, FCONDUL, 0),
+-/* v9 */ fmovfcc ("fmovqul", FM_QF, FCONDUL, 0),
+-/* v9 */ fmovfcc ("fmovsul", FM_SF, FCONDUL, 0),
+-/* v9 */ fmovfcc ("fmovdule", FM_DF, FCONDULE, 0),
+-/* v9 */ fmovfcc ("fmovqule", FM_QF, FCONDULE, 0),
+-/* v9 */ fmovfcc ("fmovsule", FM_SF, FCONDULE, 0),
+-/* v9 */ fmovicc ("fmovdvc", FM_DF, CONDVC, 0),
+-/* v9 */ fmovicc ("fmovqvc", FM_QF, CONDVC, 0),
+-/* v9 */ fmovicc ("fmovsvc", FM_SF, CONDVC, 0),
+-/* v9 */ fmovicc ("fmovdvs", FM_DF, CONDVS, 0),
+-/* v9 */ fmovicc ("fmovqvs", FM_QF, CONDVS, 0),
+-/* v9 */ fmovicc ("fmovsvs", FM_SF, CONDVS, 0),
+-/* v9 */ fmovcc ("fmovdz", FM_DF, CONDZ, FCONDZ, F_ALIAS),
+-/* v9 */ fmovcc ("fmovqz", FM_QF, CONDZ, FCONDZ, F_ALIAS),
+-/* v9 */ fmovcc ("fmovsz", FM_SF, CONDZ, FCONDZ, F_ALIAS),
+-
++#define fmovccx(opcode, fpsize, args, cond, fcond, flags) /* v9 */ \
++{ opcode, F3F(2, 0x35, 0x100+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x100+fpsize))|MCOND(~cond,~0), "z," args, flags | F_FLOAT, v9 }, \
++{ opcode, F3F(2, 0x35, 0x000+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x000+fpsize))|MCOND(~fcond,~0), "6," args, flags | F_FLOAT, v9 }, \
++{ opcode, F3F(2, 0x35, 0x180+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x180+fpsize))|MCOND(~cond,~0), "Z," args, flags | F_FLOAT, v9 }, \
++{ opcode, F3F(2, 0x35, 0x040+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x040+fpsize))|MCOND(~fcond,~0), "7," args, flags | F_FLOAT, v9 }, \
++{ opcode, F3F(2, 0x35, 0x080+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x080+fpsize))|MCOND(~fcond,~0), "8," args, flags | F_FLOAT, v9 }, \
++{ opcode, F3F(2, 0x35, 0x0c0+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x0c0+fpsize))|MCOND(~fcond,~0), "9," args, flags | F_FLOAT, v9 }
++
++#define fmovicc(suffix, cond, flags) /* v9 */ \
++fmoviccx("fmovd" suffix, FM_DF, "B,H", cond, flags), \
++fmoviccx("fmovq" suffix, FM_QF, "R,J", cond, flags), \
++fmoviccx("fmovs" suffix, FM_SF, "f,g", cond, flags)
++
++#define fmovfcc(suffix, fcond, flags) /* v9 */ \
++fmovfccx("fmovd" suffix, FM_DF, "B,H", fcond, flags), \
++fmovfccx("fmovq" suffix, FM_QF, "R,J", fcond, flags), \
++fmovfccx("fmovs" suffix, FM_SF, "f,g", fcond, flags)
++
++#define fmovcc(suffix, cond, fcond, flags) /* v9 */ \
++fmovccx("fmovd" suffix, FM_DF, "B,H", cond, fcond, flags), \
++fmovccx("fmovq" suffix, FM_QF, "R,J", cond, fcond, flags), \
++fmovccx("fmovs" suffix, FM_SF, "f,g", cond, fcond, flags)
++
++/* v9 */ fmovcc ("a", CONDA, FCONDA, 0),
++/* v9 */ fmovicc ("cc", CONDCC, 0),
++/* v9 */ fmovicc ("cs", CONDCS, 0),
++/* v9 */ fmovcc ("e", CONDE, FCONDE, 0),
++/* v9 */ fmovcc ("g", CONDG, FCONDG, 0),
++/* v9 */ fmovcc ("ge", CONDGE, FCONDGE, 0),
++/* v9 */ fmovicc ("geu", CONDGEU, F_ALIAS),
++/* v9 */ fmovicc ("gu", CONDGU, 0),
++/* v9 */ fmovcc ("l", CONDL, FCONDL, 0),
++/* v9 */ fmovcc ("le", CONDLE, FCONDLE, 0),
++/* v9 */ fmovicc ("leu", CONDLEU, 0),
++/* v9 */ fmovfcc ("lg", FCONDLG, 0),
++/* v9 */ fmovicc ("lu", CONDLU, F_ALIAS),
++/* v9 */ fmovcc ("n", CONDN, FCONDN, 0),
++/* v9 */ fmovcc ("ne", CONDNE, FCONDNE, 0),
++/* v9 */ fmovicc ("neg", CONDNEG, 0),
++/* v9 */ fmovcc ("nz", CONDNZ, FCONDNZ, F_ALIAS),
++/* v9 */ fmovfcc ("o", FCONDO, 0),
++/* v9 */ fmovicc ("pos", CONDPOS, 0),
++/* v9 */ fmovfcc ("u", FCONDU, 0),
++/* v9 */ fmovfcc ("ue", FCONDUE, 0),
++/* v9 */ fmovfcc ("ug", FCONDUG, 0),
++/* v9 */ fmovfcc ("uge", FCONDUGE, 0),
++/* v9 */ fmovfcc ("ul", FCONDUL, 0),
++/* v9 */ fmovfcc ("ule", FCONDULE, 0),
++/* v9 */ fmovicc ("vc", CONDVC, 0),
++/* v9 */ fmovicc ("vs", CONDVS, 0),
++/* v9 */ fmovcc ("z", CONDZ, FCONDZ, F_ALIAS),
++
++#undef fmoviccx /* v9 */
++#undef fmovfccx /* v9 */
++#undef fmovccx /* v9 */
+ #undef fmovicc /* v9 */
+ #undef fmovfcc /* v9 */
+ #undef fmovcc /* v9 */
diff --git a/patches/binutils/2.15.91.0.2/binutils-20040817-linkonce.patch b/patches/binutils/2.15.91.0.2/binutils-20040817-linkonce.patch
new file mode 100644
index 0000000..97fa6ee
--- /dev/null
+++ b/patches/binutils/2.15.91.0.2/binutils-20040817-linkonce.patch
@@ -0,0 +1,118 @@
+From http://sources.redhat.com/ml/binutils/2004-08/msg00190.html
+
+Date: Tue, 17 Aug 2004 12:04:29 +0200
+From: Jakub Jelinek <jakub at redhat dot com>
+To: binutils at sources dot redhat dot com
+Subject: [PATCH] Fix `defined in discarded section' errors when building ia64 gcc
+Message-ID: <20040817100429.GL30497@sunsite.ms.mff.cuni.cz>
+Reply-To: Jakub Jelinek <jakub at redhat dot com>
+References: <20040817090201.GK30497@sunsite.ms.mff.cuni.cz>
+In-Reply-To: <20040817090201 dot GK30497 at sunsite dot ms dot mff dot cuni dot cz>
+
+On Tue, Aug 17, 2004 at 11:02:01AM +0200, Jakub Jelinek wrote:
+> Current gcc 3.4.x (at least gcc-3_4-rhl-branch) doesn't build with CVS
+> binutils (nor 2.15.91.0.2).
+> The problem is that libstdc++.so linking fails with:
+> `.gnu.linkonce.t._ZNSdD2Ev' referenced in section `.gnu.linkonce.ia64unw._ZNSdD2Ev' of .libs/sstream-inst.o: defined in discarded section `.gnu.linkonce.t._ZNSdD2Ev' of .libs/sstream-inst.o
+> The problem is that both io-inst.s and sstream-inst.s have
+> .gnu.linkonce.t._ZNSdD2Ev definition, but because io-inst.cc
+> also instantiates some templates sstream-inst.cc doesn't instantiate,
+> the inliner can do a better job in io-inst.cc.
+> The result is that _ZNSdD2Ev in io-inst.cc is a leaf routine, while
+> it is not in sstream-inst.cc (in assembly,
+> _ZNSdD2Ev in io-inst.s starts with .prologue and no .save directives,
+> while _ZNSdD2Ev] in sstream-inst.s has .prologue 12, 35 and some
+> .save directives.
+> IA-64 ABI allows leaf routines to have no unwind section at all,
+> which means .gnu.linkonce.ia64unw._ZNSdD2Ev is not created in
+> io-inst.o at all and as .gnu.linkonce.t._ZNSdD2Ev comes first
+> and wins, .gnu.linkonce.ia64unw._ZNSdD2Ev in sstream.o suddenly
+> references a discarded section.
+>
+> Not sure what should be done here, but certainly the compiler
+> isn't at fault here, it is a binutils problem.
+> One fix could be to create empty .gnu.linkonce.ia64unw.* section
+> in assembler, another special case ia64 unwind sections in the linker.
+
+Here is a patch for the first possibility.
+It certainly makes libstdc++.so to link and even the unwind info looks
+good on brief skimming.
+
+2004-08-17 Jakub Jelinek <jakub@redhat.com>
+
+ * config/tc-ia64.c (start_unwind_section): Add linkonce_empty
+ argument, don't do anything if current section is not
+ .gnu.linkonce.t.* and linkonce_empty is set.
+ (generate_unwind_image, dot_endp): Adjust callers, call
+ start_unwind_section (*, 1) if nothing will be put into the
+ section.
+
+--- binutils/gas/config/tc-ia64.c.jj 2004-07-30 11:42:24.000000000 +0200
++++ binutils/gas/config/tc-ia64.c 2004-08-17 13:45:04.288173205 +0200
+@@ -1,5 +1,6 @@
+ /* tc-ia64.c -- Assembler for the HP/Intel IA-64 architecture.
+- Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
++ Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004
++ Free Software Foundation, Inc.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ This file is part of GAS, the GNU Assembler.
+@@ -3297,7 +3298,7 @@ static char *special_linkonce_name[] =
+ };
+
+ static void
+-start_unwind_section (const segT text_seg, int sec_index)
++start_unwind_section (const segT text_seg, int sec_index, int linkonce_empty)
+ {
+ /*
+ Use a slightly ugly scheme to derive the unwind section names from
+@@ -3359,6 +3360,8 @@ start_unwind_section (const segT text_se
+ prefix = special_linkonce_name [sec_index - SPECIAL_SECTION_UNWIND];
+ suffix += sizeof (".gnu.linkonce.t.") - 1;
+ }
++ else if (linkonce_empty)
++ return;
+
+ prefix_len = strlen (prefix);
+ suffix_len = strlen (suffix);
+@@ -3444,7 +3447,7 @@ generate_unwind_image (const segT text_s
+ expressionS exp;
+ bfd_reloc_code_real_type reloc;
+
+- start_unwind_section (text_seg, SPECIAL_SECTION_UNWIND_INFO);
++ start_unwind_section (text_seg, SPECIAL_SECTION_UNWIND_INFO, 0);
+
+ /* Make sure the section has 4 byte alignment for ILP32 and
+ 8 byte alignment for LP64. */
+@@ -3485,6 +3488,8 @@ generate_unwind_image (const segT text_s
+ unwind.personality_routine = 0;
+ }
+ }
++ else
++ start_unwind_section (text_seg, SPECIAL_SECTION_UNWIND_INFO, 1);
+
+ free_saved_prologue_counts ();
+ unwind.list = unwind.tail = unwind.current_entry = NULL;
+@@ -4164,7 +4169,7 @@ dot_endp (dummy)
+ subseg_set (md.last_text_seg, 0);
+ unwind.proc_end = expr_build_dot ();
+
+- start_unwind_section (saved_seg, SPECIAL_SECTION_UNWIND);
++ start_unwind_section (saved_seg, SPECIAL_SECTION_UNWIND, 0);
+
+ /* Make sure that section has 4 byte alignment for ILP32 and
+ 8 byte alignment for LP64. */
+@@ -4204,6 +4209,9 @@ dot_endp (dummy)
+ bytes_per_address);
+
+ }
++ else
++ start_unwind_section (saved_seg, SPECIAL_SECTION_UNWIND, 1);
++
+ subseg_set (saved_seg, saved_subseg);
+
+ /* Parse names of main and alternate entry points and set symbol sizes. */
+
+
+ Jakub
+
diff --git a/patches/binutils/2.15.91.0.2/binutils-dup-sections.patch b/patches/binutils/2.15.91.0.2/binutils-dup-sections.patch
new file mode 100644
index 0000000..4e4934d
--- /dev/null
+++ b/patches/binutils/2.15.91.0.2/binutils-dup-sections.patch
@@ -0,0 +1,68 @@
+See http://sources.redhat.com/ml/binutils/2004-08/msg00256.html
+
+Date: Fri, 20 Aug 2004 21:13:43 -0400
+From: Daniel Jacobowitz <drow at false dot org>
+To: binutils at sources dot redhat dot com
+Subject: Re: Handle SEC_LINK_DUPLICATES_SAME_CONTENTS for arm-linux
+Message-ID: <20040821011342.GA30319@nevyn.them.org>
+Mail-Followup-To: binutils at sources dot redhat dot com
+References: <20040818145518.GA9774@nevyn.them.org> <20040819055040.GA11820@lucon.org> <20040819080034.GE21716@bubble.modra.org> <20040820173240.GA17678@nevyn.them.org> <20040821003737.GB16016@bubble.modra.org>
+In-Reply-To: <20040821003737 dot GB16016 at bubble dot modra dot org>
+
+On Sat, Aug 21, 2004 at 10:07:38AM +0930, Alan Modra wrote:
+> On Fri, Aug 20, 2004 at 01:32:40PM -0400, Daniel Jacobowitz wrote:
+> > Thanks. How's this?
+>
+> As you might have guessed from my rather slack review of your previous
+> patch, I trust you enough to give the OK without proper review. But
+> since you asked... :)
+
+Checked in as so.
+
+--
+Daniel Jacobowitz
+
+[ rediffed against binutils-2.15.91.0.2, with some elbow grease ]
+
+2004-08-20 Daniel Jacobowitz <dan@debian.org>
+
+ * elflink.c (_bfd_elf_section_already_linked): Handle
+ SEC_LINK_DUPLICATES_SAME_CONTENTS.
+--- binutils-2.15.91.0.2/bfd/elflink.c.old 2004-07-27 21:36:08.000000000 -0700
++++ binutils-2.15.91.0.2/bfd/elflink.c 2004-08-26 06:38:07.000000000 -0700
+@@ -9359,6 +9359,35 @@
+ (_("%s: %s: warning: duplicate section `%s' has different size\n"),
+ bfd_archive_filename (abfd), name);
+ break;
++ case SEC_LINK_DUPLICATES_SAME_CONTENTS:
++ if (sec->size != l->sec->size)
++ (*_bfd_error_handler)
++ (_("%B: duplicate section `%A' has different size\n"),
++ bfd_archive_filename (abfd), sec);
++ else if (sec->size != 0)
++ {
++ bfd_byte *sec_contents, *l_sec_contents;
++
++ if (!bfd_malloc_and_get_section (abfd, sec, &sec_contents))
++ (*_bfd_error_handler)
++ (_("%B: warning: could not read contents of section `%A'\n"),
++ bfd_archive_filename (abfd), sec);
++ else if (!bfd_malloc_and_get_section (l->sec->owner, l->sec,
++ &l_sec_contents))
++ (*_bfd_error_handler)
++ (_("%B: warning: could not read contents of section `%A'\n"),
++ bfd_archive_filename(l->sec->owner), l->sec);
++ else if (memcmp (sec_contents, l_sec_contents, sec->size) != 0)
++ (*_bfd_error_handler)
++ (_("%B: warning: duplicate section `%A' has different contents\n"),
++ bfd_archive_filename (abfd), sec);
++
++ if (sec_contents)
++ free (sec_contents);
++ if (l_sec_contents)
++ free (l_sec_contents);
++ }
++ break;
+ }
+
+ /* Set the output_section field so that lang_add_section
diff --git a/patches/binutils/2.15.91.0.2/binutils-skip-comments.patch b/patches/binutils/2.15.91.0.2/binutils-skip-comments.patch
new file mode 100644
index 0000000..804a17e
--- /dev/null
+++ b/patches/binutils/2.15.91.0.2/binutils-skip-comments.patch
@@ -0,0 +1,101 @@
+Retrieved from http://sources.redhat.com/ml/binutils/2004-04/msg00646.html
+Fixes
+localealias.s:544: Error: junk at end of line, first unrecognized character is `,'
+when building glibc-2.3.2 with gcc-3.4.0 and binutils-2.15.90.0.3
+
+Paths adjusted to match crosstool's patcher.
+
+Message-Id: m3n052qw2g.fsf@whitebox.m5r.de
+From: Andreas Schwab <schwab at suse dot de>
+To: Nathan Sidwell <nathan at codesourcery dot com>
+Cc: Ian Lance Taylor <ian at wasabisystems dot com>, binutils at sources dot redhat dot com
+Date: Fri, 23 Apr 2004 22:27:19 +0200
+Subject: Re: demand_empty_rest_of_line and ignore_rest_of_line
+
+Nathan Sidwell <nathan@codesourcery.com> writes:
+
+> Index: read.c
+> ===================================================================
+> RCS file: /cvs/src/src/gas/read.c,v
+> retrieving revision 1.76
+> diff -c -3 -p -r1.76 read.c
+> *** read.c 12 Mar 2004 17:48:12 -0000 1.76
+> --- read.c 18 Mar 2004 09:56:05 -0000
+> *************** read_a_source_file (char *name)
+> *** 1053,1059 ****
+> #endif
+> input_line_pointer--;
+> /* Report unknown char as ignored. */
+> ! ignore_rest_of_line ();
+> }
+>
+> #ifdef md_after_pass_hook
+> --- 1053,1059 ----
+> #endif
+> input_line_pointer--;
+> /* Report unknown char as ignored. */
+> ! demand_empty_rest_of_line ();
+> }
+>
+> #ifdef md_after_pass_hook
+
+This means that the unknown character is no longer ignored, despite the
+comment. As a side effect a line starting with a line comment character
+not followed by APP in NO_APP mode now triggers an error instead of just a
+warning, breaking builds of glibc on m68k-linux. Earlier in
+read_a_source_file where #APP is handled there is another comment that
+claims that unknown comments are ignored, when in fact they aren't (only
+the initial line comment character is skipped).
+
+Note that the presence of #APP will mess up the line counters, but
+that appears to be difficult to fix.
+
+Andreas.
+
+2004-04-23 Andreas Schwab <schwab@suse.de>
+
+ * read.c (read_a_source_file): Ignore unknown text after line
+ comment character. Fix misleading comment.
+
+--- binutils/gas/read.c.~1.78.~ 2004-04-23 08:58:23.000000000 +0200
++++ binutils/gas/read.c 2004-04-23 21:49:01.000000000 +0200
+@@ -1,6 +1,6 @@
+ /* read.c - read a source file -
+ Copyright 1986, 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
+- 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
++ 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+
+ This file is part of GAS, the GNU Assembler.
+
+@@ -950,10 +950,14 @@ read_a_source_file (char *name)
+ unsigned int new_length;
+ char *tmp_buf = 0;
+
+- bump_line_counters ();
+ s = input_line_pointer;
+ if (strncmp (s, "APP\n", 4))
+- continue; /* We ignore it */
++ {
++ /* We ignore it */
++ ignore_rest_of_line ();
++ continue;
++ }
++ bump_line_counters ();
+ s += 4;
+
+ sb_new (&sbuf);
+@@ -1052,7 +1056,7 @@ read_a_source_file (char *name)
+ continue;
+ #endif
+ input_line_pointer--;
+- /* Report unknown char as ignored. */
++ /* Report unknown char as error. */
+ demand_empty_rest_of_line ();
+ }
+
+
+--
+Andreas Schwab, SuSE Labs, schwab@suse.de
+SuSE Linux AG, Maxfeldstra&#xC3;e 5, 90409 N&#xC3;rnberg, Germany
+Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
+"And now for something completely different."
diff --git a/patches/binutils/2.15/002-uclibc.patch b/patches/binutils/2.15/002-uclibc.patch
new file mode 100644
index 0000000..c64e74f
--- /dev/null
+++ b/patches/binutils/2.15/002-uclibc.patch
@@ -0,0 +1,144 @@
+diff -uNr binutils-2.15-pristine/bfd/configure binutils-2.15/bfd/configure
+--- binutils-2.15-pristine/bfd/configure 2004-05-17 12:35:57.000000000 -0700
++++ binutils-2.15/bfd/configure 2004-07-19 16:36:19.000000000 -0700
+@@ -1009,7 +1009,7 @@
+ bfd_version_string="\"${VERSION}\""
+ if test x${is_release} = x; then
+ bfd_version_date=`sed -n -e 's/.*DATE //p' < ${srcdir}/version.h`
+- bfd_version_string="\"${VERSION} ${bfd_version_date}\""
++ bfd_version_string="\"${VERSION} ${bfd_version_date} uClibc\""
+ fi
+
+
+diff -uNr binutils-2.15-pristine/bfd/elf32-arm.h binutils-2.15/bfd/elf32-arm.h
+--- binutils-2.15-pristine/bfd/elf32-arm.h 2004-05-17 12:35:58.000000000 -0700
++++ binutils-2.15/bfd/elf32-arm.h 2004-07-19 16:37:06.000000000 -0700
+@@ -124,7 +124,7 @@
+
+ /* The name of the dynamic interpreter. This is put in the .interp
+ section. */
+-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
++#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0"
+
+ #ifdef FOUR_WORD_PLT
+
+diff -uNr binutils-2.15-pristine/bfd/elf32-cris.c binutils-2.15/bfd/elf32-cris.c
+--- binutils-2.15-pristine/bfd/elf32-cris.c 2004-05-17 12:35:58.000000000 -0700
++++ binutils-2.15/bfd/elf32-cris.c 2004-07-19 16:49:59.000000000 -0700
+@@ -536,7 +536,7 @@
+ /* The name of the dynamic interpreter. This is put in the .interp
+ section. */
+
+-#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so.1"
++#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0"
+
+ /* The size in bytes of an entry in the procedure linkage table. */
+
+diff -uNr binutils-2.15-pristine/bfd/elf32-frv.c binutils-2.15/bfd/elf32-frv.c
+--- binutils-2.15-pristine/bfd/elf32-frv.c 2004-05-17 12:35:58.000000000 -0700
++++ binutils-2.15/bfd/elf32-frv.c 2004-07-19 16:49:59.000000000 -0700
+@@ -2913,7 +2913,7 @@
+ /* The name of the dynamic interpreter. This is put in the .interp
+ section. */
+
+-#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so.1"
++#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0"
+
+ #define DEFAULT_STACK_SIZE 0x20000
+
+diff -uNr binutils-2.15-pristine/bfd/elf32-hppa.c binutils-2.15/bfd/elf32-hppa.c
+--- binutils-2.15-pristine/bfd/elf32-hppa.c 2004-05-17 12:35:58.000000000 -0700
++++ binutils-2.15/bfd/elf32-hppa.c 2004-07-19 16:49:59.000000000 -0700
+@@ -115,7 +115,7 @@
+
+ #define PLT_ENTRY_SIZE 8
+ #define GOT_ENTRY_SIZE 4
+-#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so.1"
++#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0"
+
+ static const bfd_byte plt_stub[] =
+ {
+diff -uNr binutils-2.15-pristine/bfd/elf32-ppc.c binutils-2.15/bfd/elf32-ppc.c
+--- binutils-2.15-pristine/bfd/elf32-ppc.c 2004-05-17 12:35:59.000000000 -0700
++++ binutils-2.15/bfd/elf32-ppc.c 2004-07-19 16:49:59.000000000 -0700
+@@ -49,7 +49,7 @@
+
+ /* The name of the dynamic interpreter. This is put in the .interp
+ section. */
+-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
++#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0"
+
+ /* The size in bytes of an entry in the procedure linkage table. */
+ #define PLT_ENTRY_SIZE 12
+diff -uNr binutils-2.15-pristine/bfd/elf32-s390.c binutils-2.15/bfd/elf32-s390.c
+--- binutils-2.15-pristine/bfd/elf32-s390.c 2004-05-17 12:35:59.000000000 -0700
++++ binutils-2.15/bfd/elf32-s390.c 2004-07-19 16:49:59.000000000 -0700
+@@ -452,7 +452,7 @@
+ /* The name of the dynamic interpreter. This is put in the .interp
+ section. */
+
+-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
++#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0"
+
+ /* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid
+ copying dynamic variables from a shared lib into an app's dynbss
+diff -uNr binutils-2.15-pristine/bfd/elf32-sparc.c binutils-2.15/bfd/elf32-sparc.c
+--- binutils-2.15-pristine/bfd/elf32-sparc.c 2004-05-17 12:36:00.000000000 -0700
++++ binutils-2.15/bfd/elf32-sparc.c 2004-07-19 16:49:59.000000000 -0700
+@@ -536,7 +536,7 @@
+ /* The name of the dynamic interpreter. This is put in the .interp
+ section. */
+
+-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
++#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0"
+
+ /* The nop opcode we use. */
+
+diff -uNr binutils-2.15-pristine/bfd/elf64-ppc.c binutils-2.15/bfd/elf64-ppc.c
+--- binutils-2.15-pristine/bfd/elf64-ppc.c 2004-05-17 12:36:01.000000000 -0700
++++ binutils-2.15/bfd/elf64-ppc.c 2004-07-19 16:49:59.000000000 -0700
+@@ -99,7 +99,7 @@
+
+ /* The name of the dynamic interpreter. This is put in the .interp
+ section. */
+-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
++#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0"
+
+ /* The size in bytes of an entry in the procedure linkage table. */
+ #define PLT_ENTRY_SIZE 24
+diff -uNr binutils-2.15-pristine/bfd/elf64-s390.c binutils-2.15/bfd/elf64-s390.c
+--- binutils-2.15-pristine/bfd/elf64-s390.c 2004-05-17 12:36:01.000000000 -0700
++++ binutils-2.15/bfd/elf64-s390.c 2004-07-19 16:49:59.000000000 -0700
+@@ -473,7 +473,7 @@
+ /* The name of the dynamic interpreter. This is put in the .interp
+ section. */
+
+-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
++#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0"
+
+ /* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid
+ copying dynamic variables from a shared lib into an app's dynbss
+diff -uNr binutils-2.15-pristine/bfd/elf-m10300.c binutils-2.15/bfd/elf-m10300.c
+--- binutils-2.15-pristine/bfd/elf-m10300.c 2004-05-17 12:35:57.000000000 -0700
++++ binutils-2.15/bfd/elf-m10300.c 2004-07-19 16:49:59.000000000 -0700
+@@ -4026,7 +4026,7 @@
+ /* The name of the dynamic interpreter. This is put in the .interp
+ section. */
+
+-#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so.1"
++#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0"
+
+ /* Create dynamic sections when linking against a dynamic object. */
+
+diff -uNr binutils-2.15-pristine/bfd/elfxx-ia64.c binutils-2.15/bfd/elfxx-ia64.c
+--- binutils-2.15-pristine/bfd/elfxx-ia64.c 2004-05-17 12:36:02.000000000 -0700
++++ binutils-2.15/bfd/elfxx-ia64.c 2004-07-19 16:49:59.000000000 -0700
+@@ -643,7 +643,7 @@
+ 0x60, 0x00, 0x80, 0x00 /* br.few b6;; */
+ };
+
+-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
++#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0"
+
+ static const bfd_byte oor_brl[16] =
+ {
diff --git a/patches/binutils/2.15/100-uclibc-conf.patch b/patches/binutils/2.15/100-uclibc-conf.patch
new file mode 100644
index 0000000..1c7fa4a
--- /dev/null
+++ b/patches/binutils/2.15/100-uclibc-conf.patch
@@ -0,0 +1,692 @@
+diff -urN binutils-2.15-dist/bfd/config.bfd binutils-2.15/bfd/config.bfd
+--- binutils-2.15-dist/bfd/config.bfd 2004-05-17 14:35:56.000000000 -0500
++++ binutils-2.15/bfd/config.bfd 2004-08-04 12:01:44.000000000 -0500
+@@ -126,7 +126,7 @@
+ targ_defvec=ecoffalpha_little_vec
+ targ_selvecs=bfd_elf64_alpha_vec
+ ;;
+- alpha*-*-linux-gnu* | alpha*-*-elf*)
++ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc* | alpha*-*-elf*)
+ targ_defvec=bfd_elf64_alpha_vec
+ targ_selvecs=ecoffalpha_little_vec
+ ;;
+@@ -136,7 +136,7 @@
+ alpha*-*-*)
+ targ_defvec=ecoffalpha_little_vec
+ ;;
+- ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-gnu* | ia64*-*-elf* | ia64*-*-kfreebsd*-gnu)
++ ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-gnu* | ia64*-*-linux-uclibc* | ia64*-*-elf* | ia64*-*-kfreebsd*-gnu)
+ targ_defvec=bfd_elf64_ia64_little_vec
+ targ_selvecs="bfd_elf64_ia64_big_vec bfd_efi_app_ia64_vec"
+ ;;
+@@ -213,7 +213,7 @@
+ targ_defvec=bfd_elf32_littlearm_vec
+ targ_selvecs=bfd_elf32_bigarm_vec
+ ;;
+- armeb-*-elf | arm*b-*-linux-gnu*)
++ armeb-*-elf | arm*b-*-linux-gnu* | arm*b-*-linux-uclibc*)
+ targ_defvec=bfd_elf32_bigarm_vec
+ targ_selvecs=bfd_elf32_littlearm_vec
+ ;;
+@@ -221,7 +221,7 @@
+ targ_defvec=bfd_elf32_littlearm_vec
+ targ_selvecs=bfd_elf32_bigarm_vec
+ ;;
+- arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-conix* | \
++ arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-linux-uclibc* | arm*-*-conix* | \
+ arm*-*-uclinux* | arm-*-kfreebsd*-gnu | arm-*-vxworks)
+ targ_defvec=bfd_elf32_littlearm_vec
+ targ_selvecs=bfd_elf32_bigarm_vec
+@@ -360,7 +360,7 @@
+ ;;
+
+ #ifdef BFD64
+- hppa*64*-*-linux-gnu*)
++ hppa*64*-*-linux-gnu* | hppa*64*-*-linux-uclibc*)
+ targ_defvec=bfd_elf64_hppa_linux_vec
+ targ_selvecs=bfd_elf64_hppa_vec
+ ;;
+@@ -371,7 +371,7 @@
+ ;;
+ #endif
+
+- hppa*-*-linux-gnu* | hppa*-*-netbsd*)
++ hppa*-*-linux-gnu* | hppa*-*-linux-uclibc* | hppa*-*-netbsd*)
+ targ_defvec=bfd_elf32_hppa_linux_vec
+ targ_selvecs=bfd_elf32_hppa_vec
+ ;;
+@@ -494,7 +494,7 @@
+ targ_selvecs=bfd_elf32_i386_vec
+ targ_underscore=yes
+ ;;
+- i[3-7]86-*-linux-gnu*)
++ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*)
+ targ_defvec=bfd_elf32_i386_vec
+ targ_selvecs="i386linux_vec bfd_efi_app_ia32_vec"
+ targ64_selvecs=bfd_elf64_x86_64_vec
+@@ -508,7 +508,7 @@
+ targ_defvec=bfd_elf64_x86_64_vec
+ targ_selvecs="bfd_elf32_i386_vec i386netbsd_vec i386coff_vec bfd_efi_app_ia32_vec"
+ ;;
+- x86_64-*-linux-gnu*)
++ x86_64-*-linux-gnu* | x86_64-*-linux-uclibc*)
+ targ_defvec=bfd_elf64_x86_64_vec
+ targ_selvecs="bfd_elf32_i386_vec i386linux_vec bfd_efi_app_ia32_vec"
+ ;;
+@@ -683,7 +683,7 @@
+ targ_selvecs=bfd_elf32_m68k_vec
+ targ_underscore=yes
+ ;;
+- m68*-*-linux-gnu*)
++ m68*-*-linux-gnu* | m68*-*-linux-uclibc*)
+ targ_defvec=bfd_elf32_m68k_vec
+ targ_selvecs=m68klinux_vec
+ ;;
+@@ -955,7 +955,8 @@
+ ;;
+ #endif
+ powerpc-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \
+- powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-rtems* | \
++ powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-linux-uclibc* | \
++ powerpc-*-rtems* | \
+ powerpc-*-chorus* | powerpc-*-vxworks* | powerpc-*-windiss*)
+ targ_defvec=bfd_elf32_powerpc_vec
+ targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_vec"
+@@ -987,8 +988,8 @@
+ targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec"
+ ;;
+ powerpcle-*-elf* | powerpcle-*-sysv4* | powerpcle-*-eabi* | \
+- powerpcle-*-solaris2* | powerpcle-*-linux-gnu* | powerpcle-*-vxworks* |\
+- powerpcle-*-rtems*)
++ powerpcle-*-solaris2* | powerpcle-*-linux-gnu* | powerpcle-*-linux-uclibc* |\
++ powerpcle-*-vxworks* | powerpcle-*-rtems*)
+ targ_defvec=bfd_elf32_powerpcle_vec
+ targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec"
+ targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec"
+@@ -1149,7 +1150,7 @@
+ targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec"
+ targ_underscore=yes
+ ;;
+- sparc-*-linux-gnu*)
++ sparc-*-linux-gnu* | sparc-*-linux-uclibc*)
+ targ_defvec=bfd_elf32_sparc_vec
+ targ_selvecs="sparclinux_vec bfd_elf64_sparc_vec sunos_big_vec"
+ ;;
+@@ -1196,7 +1197,7 @@
+ targ_defvec=sunos_big_vec
+ targ_underscore=yes
+ ;;
+- sparc64-*-linux-gnu*)
++ sparc64-*-linux-gnu* | sparc64-*-linux-uclibc*)
+ targ_defvec=bfd_elf64_sparc_vec
+ targ_selvecs="bfd_elf32_sparc_vec sparclinux_vec sunos_big_vec"
+ ;;
+@@ -1265,7 +1266,7 @@
+ targ_underscore=yes
+ ;;
+
+- vax-*-linux-gnu*)
++ vax-*-linux-gnu* | vax-*-linux-uclibc*)
+ targ_defvec=bfd_elf32_vax_vec
+ ;;
+
+diff -urN binutils-2.15-dist/bfd/configure binutils-2.15/bfd/configure
+--- binutils-2.15-dist/bfd/configure 2004-05-17 14:35:57.000000000 -0500
++++ binutils-2.15/bfd/configure 2004-08-04 12:01:44.000000000 -0500
+@@ -1699,6 +1699,11 @@
+ lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
++ ;;
++
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
+@@ -5278,7 +5283,7 @@
+ alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
+ COREFILE=''
+ ;;
+- alpha*-*-linux-gnu*)
++ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc*)
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/alphalinux.h"'
+ ;;
+@@ -5338,7 +5343,7 @@
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/i386mach3.h"'
+ ;;
+- i[3-7]86-*-linux-gnu*)
++ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*)
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/i386linux.h"'
+ ;;
+@@ -5376,7 +5381,7 @@
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/hp300bsd.h"'
+ ;;
+- m68*-*-linux-gnu*)
++ m68*-*-linux-gnu* | m68*-*-linux-uclibc*)
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/m68klinux.h"'
+ ;;
+@@ -5477,7 +5482,7 @@
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/vaxult2.h"'
+ ;;
+- vax-*-linux-gnu*)
++ vax-*-linux-gnu* | vax-*-linux-uclibc*)
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/vaxlinux.h"'
+ ;;
+diff -urN binutils-2.15-dist/bfd/configure.in binutils-2.15/bfd/configure.in
+--- binutils-2.15-dist/bfd/configure.in 2004-05-17 14:35:57.000000000 -0500
++++ binutils-2.15/bfd/configure.in 2004-08-04 12:01:44.000000000 -0500
+@@ -178,7 +178,7 @@
+ alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
+ COREFILE=''
+ ;;
+- alpha*-*-linux-gnu*)
++ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc*)
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/alphalinux.h"'
+ ;;
+@@ -259,7 +259,7 @@
+ TRAD_HEADER='"hosts/i386mach3.h"'
+ ;;
+ changequote(,)dnl
+- i[3-7]86-*-linux-gnu*)
++ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*)
+ changequote([,])dnl
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/i386linux.h"'
+@@ -300,7 +300,7 @@
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/hp300bsd.h"'
+ ;;
+- m68*-*-linux-gnu*)
++ m68*-*-linux-gnu* | m68*-*-linux-uclibc*)
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/m68klinux.h"'
+ ;;
+@@ -385,7 +385,7 @@
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/vaxult2.h"'
+ ;;
+- vax-*-linux-gnu*)
++ vax-*-linux-gnu* | vax-*-linux-uclibc*)
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/vaxlinux.h"'
+ ;;
+diff -urN binutils-2.15-dist/binutils/configure binutils-2.15/binutils/configure
+--- binutils-2.15-dist/binutils/configure 2004-01-02 11:08:04.000000000 -0600
++++ binutils-2.15/binutils/configure 2004-08-04 12:01:44.000000000 -0500
+@@ -1585,6 +1585,11 @@
+ lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
++ ;;
++
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
+diff -urN binutils-2.15-dist/configure binutils-2.15/configure
+--- binutils-2.15-dist/configure 2004-05-17 14:36:20.000000000 -0500
++++ binutils-2.15/configure 2004-08-04 12:01:44.000000000 -0500
+@@ -1288,6 +1288,18 @@
+ i[3456789]86-*-freebsd* | i[3456789]86-*-kfreebsd*-gnu)
+ noconfigdirs="$noconfigdirs target-newlib target-libgloss"
+ ;;
++ i[3456789]86-*-linux-uclibc*)
++ # This section makes it possible to build newlib natively on linux.
++ # If we are using a cross compiler then don't configure newlib.
++ if test x${is_cross_compiler} != xno ; then
++ noconfigdirs="$noconfigdirs target-newlib"
++ fi
++ noconfigdirs="$noconfigdirs target-libgloss"
++ # If we are not using a cross compiler, do configure newlib.
++ # Note however, that newlib will only be configured in this situation
++ # if the --with-newlib option has been given, because otherwise
++ # 'target-newlib' will appear in skipdirs.
++ ;;
+ i[3456789]86-*-linux*)
+ # The GCC port for glibc1 has no MD_FALLBACK_FRAME_STATE_FOR, so let's
+ # not build java stuff by default.
+diff -urN binutils-2.15-dist/configure.in binutils-2.15/configure.in
+--- binutils-2.15-dist/configure.in 2004-05-17 14:40:54.000000000 -0500
++++ binutils-2.15/configure.in 2004-08-04 12:01:44.000000000 -0500
+@@ -521,6 +521,18 @@
+ i[[3456789]]86-*-freebsd* | i[[3456789]]86-*-kfreebsd*-gnu)
+ noconfigdirs="$noconfigdirs target-newlib target-libgloss"
+ ;;
++ i[[3456789]]86-*-linux-uclibc*)
++ # This section makes it possible to build newlib natively on linux.
++ # If we are using a cross compiler then don't configure newlib.
++ if test x${is_cross_compiler} != xno ; then
++ noconfigdirs="$noconfigdirs target-newlib"
++ fi
++ noconfigdirs="$noconfigdirs target-libgloss"
++ # If we are not using a cross compiler, do configure newlib.
++ # Note however, that newlib will only be configured in this situation
++ # if the --with-newlib option has been given, because otherwise
++ # 'target-newlib' will appear in skipdirs.
++ ;;
+ i[[3456789]]86-*-linux*)
+ # The GCC port for glibc1 has no MD_FALLBACK_FRAME_STATE_FOR, so let's
+ # not build java stuff by default.
+diff -urN binutils-2.15-dist/gas/configure binutils-2.15/gas/configure
+--- binutils-2.15-dist/gas/configure 2004-05-17 14:36:07.000000000 -0500
++++ binutils-2.15/gas/configure 2004-08-04 12:07:50.000000000 -0500
+@@ -3400,6 +3400,11 @@
+ lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
++ ;;
++
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
+@@ -4224,6 +4229,7 @@
+ alpha*-*-osf*) fmt=ecoff ;;
+ alpha*-*-linuxecoff*) fmt=ecoff ;;
+ alpha*-*-linux-gnu*) fmt=elf em=linux ;;
++ alpha*-*-linux-uclibc*) fmt=elf em=linux ;;
+ alpha*-*-netbsd*) fmt=elf em=nbsd ;;
+ alpha*-*-openbsd*) fmt=elf em=obsd ;;
+
+@@ -4240,6 +4246,7 @@
+ arm*-*-conix*) fmt=elf ;;
+ arm-*-linux*aout*) fmt=aout em=linux ;;
+ arm*-*-linux-gnu*) fmt=elf em=linux ;;
++ arm*-*-linux-uclibc*) fmt=elf em=linux ;;
+ arm*-*-uclinux*) fmt=elf em=linux ;;
+ arm-*-netbsdelf*) fmt=elf em=nbsd ;;
+ arm-*-*n*bsd*) fmt=aout em=nbsd ;;
+@@ -4253,6 +4260,7 @@
+ avr-*-*) fmt=elf ;;
+
+ cris-*-linux-gnu*) fmt=multi bfd_gas=yes em=linux ;;
++ cris-*-linux-uclibc*) fmt=multi bfd_gas=yes em=linux ;;
+ cris-*-*) fmt=multi bfd_gas=yes ;;
+
+ d10v-*-*) fmt=elf ;;
+@@ -4310,7 +4318,9 @@
+ i386-*-linux*oldld) fmt=aout em=linux ;;
+ i386-*-linux*coff*) fmt=coff em=linux ;;
+ i386-*-linux-gnu*) fmt=elf em=linux ;;
++ i386-*-linux-uclibc*) fmt=elf em=linux ;;
+ x86_64-*-linux-gnu*) fmt=elf em=linux ;;
++ x86_64-*-linux-uclibc*) fmt=elf em=linux ;;
+ i386-*-lynxos*) fmt=coff em=lynx ;;
+ i386-*-sysv[45]*) fmt=elf ;;
+ i386-*-solaris*) fmt=elf ;;
+@@ -4370,6 +4380,7 @@
+ ia64-*-elf*) fmt=elf ;;
+ ia64-*-aix*) fmt=elf em=ia64aix ;;
+ ia64-*-linux-gnu*) fmt=elf em=linux ;;
++ ia64-*-linux-uclibc*) fmt=elf em=linux ;;
+ ia64-*-hpux*) fmt=elf em=hpux ;;
+ ia64-*-netbsd*) fmt=elf em=nbsd ;;
+
+@@ -4397,6 +4408,7 @@
+ m68k-*-hpux*) fmt=hp300 em=hp300 ;;
+ m68k-*-linux*aout*) fmt=aout em=linux ;;
+ m68k-*-linux-gnu*) fmt=elf em=linux ;;
++ m68k-*-linux-uclibc*) fmt=elf em=linux ;;
+ m68k-*-uclinux*) fmt=elf ;;
+ m68k-*-gnu*) fmt=elf ;;
+ m68k-*-lynxos*) fmt=coff em=lynx ;;
+@@ -4459,6 +4471,7 @@
+ ppc-*-beos*) fmt=coff ;;
+ ppc-*-*n*bsd* | ppc-*-elf*) fmt=elf ;;
+ ppc-*-eabi* | ppc-*-sysv4*) fmt=elf ;;
++ ppc-*-linux-uclibc* | \
+ ppc-*-linux-gnu*) fmt=elf em=linux
+ case "$endian" in
+ big) ;;
+@@ -4486,7 +4499,9 @@
+ ppc-*-kaos*) fmt=elf ;;
+
+ s390x-*-linux-gnu*) fmt=elf em=linux ;;
++ s390x-*-linux-uclibc*) fmt=elf em=linux ;;
+ s390-*-linux-gnu*) fmt=elf em=linux ;;
++ s390-*-linux-uclibc*) fmt=elf em=linux ;;
+
+ sh*-*-linux*) fmt=elf em=linux
+ case ${cpu} in
+@@ -4519,6 +4534,7 @@
+ sparc-*-coff) fmt=coff ;;
+ sparc-*-linux*aout*) fmt=aout em=linux ;;
+ sparc-*-linux-gnu*) fmt=elf em=linux ;;
++ sparc-*-linux-uclibc*) fmt=elf em=linux ;;
+ sparc-*-lynxos*) fmt=coff em=lynx ;;
+ sparc-fujitsu-none) fmt=aout ;;
+ sparc-*-elf) fmt=elf ;;
+diff -urN binutils-2.15-dist/gas/configure.in binutils-2.15/gas/configure.in
+--- binutils-2.15-dist/gas/configure.in 2004-05-17 14:36:07.000000000 -0500
++++ binutils-2.15/gas/configure.in 2004-08-04 12:07:21.000000000 -0500
+@@ -194,6 +194,7 @@
+ alpha*-*-osf*) fmt=ecoff ;;
+ alpha*-*-linuxecoff*) fmt=ecoff ;;
+ alpha*-*-linux-gnu*) fmt=elf em=linux ;;
++ alpha*-*-linux-uclibc*) fmt=elf em=linux ;;
+ alpha*-*-netbsd*) fmt=elf em=nbsd ;;
+ alpha*-*-openbsd*) fmt=elf em=obsd ;;
+
+@@ -210,6 +211,7 @@
+ arm*-*-conix*) fmt=elf ;;
+ arm-*-linux*aout*) fmt=aout em=linux ;;
+ arm*-*-linux-gnu*) fmt=elf em=linux ;;
++ arm*-*-linux-uclibc*) fmt=elf em=linux ;;
+ arm*-*-uclinux*) fmt=elf em=linux ;;
+ arm-*-netbsdelf*) fmt=elf em=nbsd ;;
+ arm-*-*n*bsd*) fmt=aout em=nbsd ;;
+@@ -223,6 +225,7 @@
+ avr-*-*) fmt=elf ;;
+
+ cris-*-linux-gnu*) fmt=multi bfd_gas=yes em=linux ;;
++ cris-*-linux-uclibc*) fmt=multi bfd_gas=yes em=linux ;;
+ cris-*-*) fmt=multi bfd_gas=yes ;;
+
+ d10v-*-*) fmt=elf ;;
+@@ -280,7 +283,9 @@
+ i386-*-linux*oldld) fmt=aout em=linux ;;
+ i386-*-linux*coff*) fmt=coff em=linux ;;
+ i386-*-linux-gnu*) fmt=elf em=linux ;;
++ i386-*-linux-uclibc*) fmt=elf em=linux ;;
+ x86_64-*-linux-gnu*) fmt=elf em=linux ;;
++ x86_64-*-linux-uclibc*) fmt=elf em=linux ;;
+ i386-*-lynxos*) fmt=coff em=lynx ;;
+ changequote(,)dnl
+ i386-*-sysv[45]*) fmt=elf ;;
+@@ -333,6 +338,7 @@
+ ia64-*-elf*) fmt=elf ;;
+ ia64-*-aix*) fmt=elf em=ia64aix ;;
+ ia64-*-linux-gnu*) fmt=elf em=linux ;;
++ ia64-*-linux-uclibc*) fmt=elf em=linux ;;
+ ia64-*-hpux*) fmt=elf em=hpux ;;
+ ia64-*-netbsd*) fmt=elf em=nbsd ;;
+
+@@ -360,6 +366,7 @@
+ m68k-*-hpux*) fmt=hp300 em=hp300 ;;
+ m68k-*-linux*aout*) fmt=aout em=linux ;;
+ m68k-*-linux-gnu*) fmt=elf em=linux ;;
++ m68k-*-linux-uclibc*) fmt=elf em=linux ;;
+ m68k-*-uclinux*) fmt=elf ;;
+ m68k-*-gnu*) fmt=elf ;;
+ m68k-*-lynxos*) fmt=coff em=lynx ;;
+@@ -419,6 +426,7 @@
+ ppc-*-beos*) fmt=coff ;;
+ ppc-*-*n*bsd* | ppc-*-elf*) fmt=elf ;;
+ ppc-*-eabi* | ppc-*-sysv4*) fmt=elf ;;
++ ppc-*-linux-uclibc* | \
+ ppc-*-linux-gnu*) fmt=elf em=linux
+ case "$endian" in
+ big) ;;
+@@ -439,7 +447,9 @@
+ ppc-*-kaos*) fmt=elf ;;
+
+ s390x-*-linux-gnu*) fmt=elf em=linux ;;
++ s390x-*-linux-uclibc*) fmt=elf em=linux ;;
+ s390-*-linux-gnu*) fmt=elf em=linux ;;
++ s390-*-linux-uclibc*) fmt=elf em=linux ;;
+
+ sh*-*-linux*) fmt=elf em=linux
+ case ${cpu} in
+@@ -472,6 +482,7 @@
+ sparc-*-coff) fmt=coff ;;
+ sparc-*-linux*aout*) fmt=aout em=linux ;;
+ sparc-*-linux-gnu*) fmt=elf em=linux ;;
++ sparc-*-linux-uclibc*) fmt=elf em=linux ;;
+ sparc-*-lynxos*) fmt=coff em=lynx ;;
+ sparc-fujitsu-none) fmt=aout ;;
+ sparc-*-elf) fmt=elf ;;
+diff -urN binutils-2.15-dist/gprof/configure binutils-2.15/gprof/configure
+--- binutils-2.15-dist/gprof/configure 2003-08-26 12:19:19.000000000 -0500
++++ binutils-2.15/gprof/configure 2004-08-04 12:01:45.000000000 -0500
+@@ -1581,6 +1581,11 @@
+ lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
++ ;;
++
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
+diff -urN binutils-2.15-dist/ld/configure binutils-2.15/ld/configure
+--- binutils-2.15-dist/ld/configure 2003-04-24 07:36:07.000000000 -0500
++++ binutils-2.15/ld/configure 2004-08-04 12:01:45.000000000 -0500
+@@ -1589,6 +1589,11 @@
+ lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
++ ;;
++
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
+diff -urN binutils-2.15-dist/ld/configure.tgt binutils-2.15/ld/configure.tgt
+--- binutils-2.15-dist/ld/configure.tgt 2004-05-17 14:36:15.000000000 -0500
++++ binutils-2.15/ld/configure.tgt 2004-08-04 12:01:45.000000000 -0500
+@@ -30,6 +30,7 @@
+ targ_extra_emuls="criself crislinux"
+ targ_extra_libpath=$targ_extra_emuls ;;
+ cris-*-linux-gnu*) targ_emul=crislinux ;;
++cris-*-linux-uclibc*) targ_emul=crislinux ;;
+ cris-*-*) targ_emul=criself
+ targ_extra_emuls="crisaout crislinux"
+ targ_extra_libpath=$targ_extra_emuls ;;
+@@ -59,14 +60,16 @@
+ tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/aout//'`
+ tdir_sun4=sparc-sun-sunos4
+ ;;
+-sparc64-*-linux-gnu*) targ_emul=elf64_sparc
++sparc64-*-linux-gnu* | sparc64-*-linux-uclibc*) \
++ targ_emul=elf64_sparc
+ targ_extra_emuls="elf32_sparc sparclinux sun4"
+ targ_extra_libpath=elf32_sparc
+ tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/64//'`
+ tdir_sparclinux=${tdir_elf32_sparc}aout
+ tdir_sun4=sparc-sun-sunos4
+ ;;
+-sparc*-*-linux-gnu*) targ_emul=elf32_sparc
++sparc*-*-linux-gnu* | sparc*-*-linux-uclibc*) \
++ targ_emul=elf32_sparc
+ targ_extra_emuls="sparclinux elf64_sparc sun4"
+ targ_extra_libpath=elf64_sparc
+ tdir_sparclinux=${targ_alias}aout
+@@ -118,7 +121,9 @@
+ m32r*le-*-elf*) targ_emul=m32rlelf ;;
+ m32r*-*-elf*) targ_emul=m32relf ;;
+ m32r*le-*-linux-gnu*) targ_emul=m32rlelf_linux ;;
++m32r*le-*-linux-uclibc*) targ_emul=m32rlelf_linux ;;
+ m32r*-*-linux-gnu*) targ_emul=m32relf_linux ;;
++m32r*-*-linux-uclibc*) targ_emul=m32relf_linux ;;
+ m68hc11-*-*|m6811-*-*) targ_emul=m68hc11elf
+ targ_extra_emuls="m68hc11elfb m68hc12elf m68hc12elfb" ;;
+ m68hc12-*-*|m6812-*-*) targ_emul=m68hc12elf
+@@ -128,7 +133,7 @@
+ m68*-ericsson-ose) targ_emul=sun3 ;;
+ m68*-apple-aux*) targ_emul=m68kaux ;;
+ *-tandem-none) targ_emul=st2000 ;;
+-i370-*-elf* | i370-*-linux-gnu*) targ_emul=elf32i370 ;;
++i370-*-elf* | i370-*-linux-gnu* | i370-*-linux-uclibc*) targ_emul=elf32i370 ;;
+ i[3-7]86-*-nto-qnx*) targ_emul=i386nto ;;
+ i[3-7]86-*-vsta) targ_emul=vsta ;;
+ i[3-7]86-go32-rtems*) targ_emul=i386go32 ;;
+@@ -152,14 +157,16 @@
+ tdir_elf_i386=`echo ${targ_alias} | sed -e 's/aout//'`
+ ;;
+ i[3-7]86-*-linux*oldld) targ_emul=i386linux; targ_extra_emuls=elf_i386 ;;
+-i[3-7]86-*-linux-gnu*) targ_emul=elf_i386
++i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*) \
++ targ_emul=elf_i386
+ targ_extra_emuls=i386linux
+ if test x${want64} = xtrue; then
+ targ_extra_emuls="$targ_extra_emuls elf_x86_64"
+ fi
+ tdir_i386linux=${targ_alias}aout
+ ;;
+-x86_64-*-linux-gnu*) targ_emul=elf_x86_64
++x86_64-*-linux-gnu* | x86_64-*-linux-uclibc*) \
++ targ_emul=elf_x86_64
+ targ_extra_emuls="elf_i386 i386linux"
+ targ_extra_libpath=elf_i386
+ tdir_i386linux=`echo ${targ_alias}aout | sed -e 's/x86_64/i386/'`
+@@ -259,10 +266,13 @@
+ arm9e-*-elf) targ_emul=armelf ;;
+ arm-*-oabi) targ_emul=armelf_oabi ;;
+ arm*b-*-linux-gnu*) targ_emul=armelfb_linux; targ_extra_emuls=armelfb ;;
++arm*b-*-linux-uclibc*) targ_emul=armelfb_linux; targ_extra_emuls=armelfb ;;
+ arm*-*-linux-gnu*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;;
++arm*-*-linux-uclibc*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;;
+ arm*-*-uclinux*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;;
+ arm*-*-conix*) targ_emul=armelf ;;
+-thumb-*-linux-gnu* | thumb-*-uclinux*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;;
++thumb-*-linux-gnu* | thumb-*-linux-uclibc* | thumb-*-uclinux*) \
++ targ_emul=armelf_linux; targ_extra_emuls=armelf ;;
+ strongarm-*-coff) targ_emul=armcoff ;;
+ strongarm-*-elf) targ_emul=armelf ;;
+ strongarm-*-kaos*) targ_emul=armelf ;;
+@@ -364,7 +374,8 @@
+ targ_extra_emuls=m68kelf
+ tdir_m68kelf=`echo ${targ_alias} | sed -e 's/aout//'`
+ ;;
+-m68k-*-linux-gnu*) targ_emul=m68kelf
++m68k-*-linux-gnu* | m68k-*-linux-uclibc*) \
++ targ_emul=m68kelf
+ targ_extra_emuls=m68klinux
+ tdir_m68klinux=`echo ${targ_alias} | sed -e 's/linux/linuxaout/'`
+ ;;
+@@ -381,9 +392,9 @@
+ m68*-*-psos*) targ_emul=m68kpsos ;;
+ m68*-*-rtemscoff*) targ_emul=m68kcoff ;;
+ m68*-*-rtems*) targ_emul=m68kelf ;;
+-hppa*64*-*-linux-gnu*) targ_emul=hppa64linux ;;
++hppa*64*-*-linux-gnu* | hppa*64*-*-linux-uclibc*) targ_emul=hppa64linux ;;
+ hppa*64*-*) targ_emul=elf64hppa ;;
+-hppa*-*-linux-gnu*) targ_emul=hppalinux ;;
++hppa*-*-linux-gnu* | hppa*-*-linux-uclibc*) targ_emul=hppalinux ;;
+ hppa*-*-*elf*) targ_emul=hppaelf ;;
+ hppa*-*-lites*) targ_emul=hppaelf ;;
+ hppa*-*-netbsd*) targ_emul=hppanbsd ;;
+@@ -396,6 +407,7 @@
+ targ_emul=vaxnbsd
+ targ_extra_emuls=elf32vax ;;
+ vax-*-linux-gnu*) targ_emul=elf32vax ;;
++vax-*-linux-uclibc*) targ_emul=elf32vax ;;
+ mips*-*-pe) targ_emul=mipspe ;
+ targ_extra_ofiles="deffilep.o pe-dll.o" ;;
+ mips*-dec-ultrix*) targ_emul=mipslit ;;
+@@ -429,16 +441,16 @@
+ mips*-*-vxworks*) targ_emul=elf32ebmip
+ targ_extra_emuls="elf32elmip" ;;
+ mips*-*-windiss) targ_emul=elf32mipswindiss ;;
+-mips64*el-*-linux-gnu*) targ_emul=elf32ltsmipn32
++mips64*el-*-linux-gnu* | mips64*el-*-linux-uclibc*) targ_emul=elf32ltsmipn32
+ targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip"
+ ;;
+-mips64*-*-linux-gnu*) targ_emul=elf32btsmipn32
++mips64*-*-linux-gnu* | mips64*-*-linux-uclibc*) targ_emul=elf32btsmipn32
+ targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip"
+ ;;
+-mips*el-*-linux-gnu*) targ_emul=elf32ltsmip
++mips*el-*-linux-gnu* | mips*el-*-linux-uclibc*) targ_emul=elf32ltsmip
+ targ_extra_emuls="elf32btsmip elf32ltsmipn32 elf64ltsmip elf32btsmipn32 elf64btsmip"
+ ;;
+-mips*-*-linux-gnu*) targ_emul=elf32btsmip
++mips*-*-linux-gnu* | mips*-*-linux-uclibc*) targ_emul=elf32btsmip
+ targ_extra_emuls="elf32ltsmip elf32btsmipn32 elf64btsmip elf32ltsmipn32 elf64ltsmip"
+ ;;
+ mips*-*-lnews*) targ_emul=mipslnews ;;
+@@ -461,6 +473,10 @@
+ alpha*-*-linux-gnu*) targ_emul=elf64alpha targ_extra_emuls=alpha
+ tdir_alpha=`echo ${targ_alias} | sed -e 's/linux/linuxecoff/'`
+ ;;
++alpha*-*-linux-uclibc*) targ_emul=elf64alpha targ_extra_emuls=alpha
++ # The following needs to be checked...
++ tdir_alpha=`echo ${targ_alias} | sed -e 's/linux/linuxecoff/'`
++ ;;
+ alpha*-*-osf*) targ_emul=alpha ;;
+ alpha*-*-gnu*) targ_emul=elf64alpha ;;
+ alpha*-*-netware*) targ_emul=alpha ;;
+diff -urN binutils-2.15-dist/libtool.m4 binutils-2.15/libtool.m4
+--- binutils-2.15-dist/libtool.m4 2003-04-10 22:58:39.000000000 -0500
++++ binutils-2.15/libtool.m4 2004-08-04 12:01:45.000000000 -0500
+@@ -645,6 +645,11 @@
+ lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
++ ;;
++
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$']
+diff -urN binutils-2.15-dist/ltconfig binutils-2.15/ltconfig
+--- binutils-2.15-dist/ltconfig 2003-10-03 23:54:47.000000000 -0500
++++ binutils-2.15/ltconfig 2004-08-04 12:01:45.000000000 -0500
+@@ -603,6 +603,7 @@
+ # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+ case $host_os in
+ linux-gnu*) ;;
++linux-uclibc*) ;;
+ linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+ esac
+
+@@ -1259,6 +1260,24 @@
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
++linux-uclibc*)
++ version_type=linux
++ need_lib_prefix=no
++ need_version=no
++ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
++ soname_spec='${libname}${release}.so$major'
++ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
++ shlibpath_var=LD_LIBRARY_PATH
++ shlibpath_overrides_runpath=no
++ # This implies no fast_install, which is unacceptable.
++ # Some rework will be needed to allow for fast_install
++ # before this can be enabled.
++ # Note: copied from linux-gnu, and may not be appropriate.
++ hardcode_into_libs=yes
++ # Assume using the uClibc dynamic linker.
++ dynamic_linker="uClibc ld.so"
++ ;;
++
+ netbsd*)
+ need_lib_prefix=no
+ need_version=no
+diff -urN binutils-2.15-dist/opcodes/configure binutils-2.15/opcodes/configure
+--- binutils-2.15-dist/opcodes/configure 2003-08-05 04:39:31.000000000 -0500
++++ binutils-2.15/opcodes/configure 2004-08-04 12:01:45.000000000 -0500
+@@ -1700,6 +1700,11 @@
+ lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
++ ;;
++
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
diff --git a/patches/binutils/2.15/210-cflags.patch b/patches/binutils/2.15/210-cflags.patch
new file mode 100644
index 0000000..dc67d3c
--- /dev/null
+++ b/patches/binutils/2.15/210-cflags.patch
@@ -0,0 +1,32 @@
+diff -urN binutils-2.14.90.0.6/bfd/doc/Makefile.am binutils-2.14.90.0.6.new/bfd/doc/Makefile.am
+--- binutils-2.14.90.0.6/bfd/doc/Makefile.am 2003-07-23 10:08:09.000000000 -0500
++++ binutils-2.14.90.0.6.new/bfd/doc/Makefile.am 2004-03-01 16:05:16.000000000 -0600
+@@ -55,10 +55,10 @@
+ MKDOC = chew$(EXEEXT_FOR_BUILD)
+
+ $(MKDOC): chew.o
+- $(CC_FOR_BUILD) -o $(MKDOC) chew.o $(CFLAGS) $(LOADLIBES) $(LDFLAGS)
++ $(CC_FOR_BUILD) -o $(MKDOC) chew.o $(CFLAGS_FOR_BUILD) $(LOADLIBES) $(LDFLAGS)
+
+ chew.o: chew.c
+- $(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include -I$(srcdir)/../../intl -I../../intl $(H_CFLAGS) $(CFLAGS) $(srcdir)/chew.c
++ $(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include -I$(srcdir)/../../intl -I../../intl $(H_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/chew.c
+
+ protos: libbfd.h libcoff.h bfd.h
+
+diff -urN binutils-2.14.90.0.6/bfd/doc/Makefile.in binutils-2.14.90.0.6.new/bfd/doc/Makefile.in
+--- binutils-2.14.90.0.6/bfd/doc/Makefile.in 2003-07-23 10:08:09.000000000 -0500
++++ binutils-2.14.90.0.6.new/bfd/doc/Makefile.in 2004-03-01 16:05:03.000000000 -0600
+@@ -469,10 +469,10 @@
+
+
+ $(MKDOC): chew.o
+- $(CC_FOR_BUILD) -o $(MKDOC) chew.o $(CFLAGS) $(LOADLIBES) $(LDFLAGS)
++ $(CC_FOR_BUILD) -o $(MKDOC) chew.o $(CFLAGS_FOR_BUILD) $(LOADLIBES) $(LDFLAGS)
+
+ chew.o: chew.c
+- $(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include -I$(srcdir)/../../intl -I../../intl $(H_CFLAGS) $(CFLAGS) $(srcdir)/chew.c
++ $(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include -I$(srcdir)/../../intl -I../../intl $(H_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/chew.c
+
+ protos: libbfd.h libcoff.h bfd.h
+
diff --git a/patches/binutils/2.15/400-mips-ELF_MAXPAGESIZE-4K.patch b/patches/binutils/2.15/400-mips-ELF_MAXPAGESIZE-4K.patch
new file mode 100644
index 0000000..e07a7e8
--- /dev/null
+++ b/patches/binutils/2.15/400-mips-ELF_MAXPAGESIZE-4K.patch
@@ -0,0 +1,26 @@
+--- binutils/bfd/elf32-mips.c~
++++ binutils/bfd/elf32-mips.c
+@@ -1611,7 +1611,9 @@
+
+ /* The SVR4 MIPS ABI says that this should be 0x10000, and Linux uses
+ page sizes of up to that limit, so we need to respect it. */
+-#define ELF_MAXPAGESIZE 0x10000
++/*#define ELF_MAXPAGESIZE 0x10000*/
++/* Use 4K to shrink the elf header. NOT for general use! */
++#define ELF_MAXPAGESIZE 0x1000
+ #define elf32_bed elf32_tradbed
+
+ /* Include the target file again for this target. */
+--- binutils/bfd/elfn32-mips.c~
++++ binutils/bfd/elfn32-mips.c
+@@ -1976,7 +1976,9 @@
+
+ /* The SVR4 MIPS ABI says that this should be 0x10000, and Linux uses
+ page sizes of up to that limit, so we need to respect it. */
+-#define ELF_MAXPAGESIZE 0x10000
++/*#define ELF_MAXPAGESIZE 0x10000*/
++/* Use 4K to shrink the elf header. NOT for general use! */
++#define ELF_MAXPAGESIZE 0x1000
+ #define elf32_bed elf32_tradbed
+
+ /* Include the target file again for this target. */
diff --git a/patches/binutils/2.15/600-arm-textrel.patch b/patches/binutils/2.15/600-arm-textrel.patch
new file mode 100644
index 0000000..73d5b9d
--- /dev/null
+++ b/patches/binutils/2.15/600-arm-textrel.patch
@@ -0,0 +1,63 @@
+http://sources.redhat.com/ml/binutils/2004-06/msg00010.html
+--- binutils-2.15.90.0.3-old/bfd/elf32-arm.h 2004-04-12 14:56:33.000000000 -0500
++++ binutils-2.15.90.0.3/bfd/elf32-arm.h 2004-09-03 06:56:40.000000000 -0500
+@@ -87,6 +87,8 @@
+ #endif
+ static bfd_boolean allocate_dynrelocs
+ PARAMS ((struct elf_link_hash_entry *h, PTR inf));
++static bfd_boolean elf32_arm_readonly_dynrelocs
++ PARAMS ((struct elf_link_hash_entry *, PTR));
+ static bfd_boolean create_got_section
+ PARAMS ((bfd * dynobj, struct bfd_link_info * info));
+ static bfd_boolean elf32_arm_create_dynamic_sections
+@@ -3531,6 +3533,37 @@
+ return TRUE;
+ }
+
++/* Find any dynamic relocs that apply to read-only sections. */
++
++static bfd_boolean
++elf32_arm_readonly_dynrelocs (h, inf)
++ struct elf_link_hash_entry *h;
++ PTR inf;
++{
++ struct elf32_arm_link_hash_entry *eh;
++ struct elf32_arm_relocs_copied *p;
++
++ if (h->root.type == bfd_link_hash_warning)
++ h = (struct elf_link_hash_entry *) h->root.u.i.link;
++
++ eh = (struct elf32_arm_link_hash_entry *) h;
++ for (p = eh->relocs_copied; p != NULL; p = p->next)
++ {
++ asection *s = p->section;
++
++ if (s != NULL && (s->flags & SEC_READONLY) != 0)
++ {
++ struct bfd_link_info *info = (struct bfd_link_info *) inf;
++
++ info->flags |= DF_TEXTREL;
++
++ /* Not an error, just cut short the traversal. */
++ return FALSE;
++ }
++ }
++ return TRUE;
++}
++
+ /* Set the sizes of the dynamic sections. */
+
+ static bfd_boolean
+@@ -3740,6 +3773,12 @@
+ return FALSE;
+ }
+
++ /* If any dynamic relocs apply to a read-only section,
++ then we need a DT_TEXTREL entry. */
++ if ((info->flags & DF_TEXTREL) == 0)
++ elf_link_hash_traverse (&htab->root, elf32_arm_readonly_dynrelocs,
++ (PTR) info);
++
+ if ((info->flags & DF_TEXTREL) != 0)
+ {
+ if (!add_dynamic_entry (DT_TEXTREL, 0))
diff --git a/patches/binutils/2.15/bfd-hash-tweak.patch b/patches/binutils/2.15/bfd-hash-tweak.patch
new file mode 100644
index 0000000..6b8fc41
--- /dev/null
+++ b/patches/binutils/2.15/bfd-hash-tweak.patch
@@ -0,0 +1,24 @@
+Signed-off-by: dank@kegel.com
+
+Raising the size of the hash table is a noticable win when linking
+at least one large app.
+
+There was a patch,
+http://sources.redhat.com/ml/binutils/2004-06/msg00165.html
+to do this dynamically. No idea why that didn't make it in.
+So this tiny change to raise the default size is just
+a stopgap for now.
+
+
+--- binutils-2.15/bfd/hash.c.old 2003-12-01 01:33:01.000000000 -0500
++++ binutils-2.15/bfd/hash.c 2006-03-01 16:26:26.701991000 -0500
+@@ -295,7 +295,7 @@
+ */
+
+ /* The default number of entries to use when creating a hash table. */
+-#define DEFAULT_SIZE (4051)
++#define DEFAULT_SIZE (32749)
+
+ /* Create a new hash table, given a number of entries. */
+
+
diff --git a/patches/binutils/2.15/binutils-2.15-allow-gcc-4.0.patch b/patches/binutils/2.15/binutils-2.15-allow-gcc-4.0.patch
new file mode 100644
index 0000000..26e5a12
--- /dev/null
+++ b/patches/binutils/2.15/binutils-2.15-allow-gcc-4.0.patch
@@ -0,0 +1,75 @@
+Fix found here: http://www.freelists.org/archives/openbeos/11-2005/msg00090.html
+
+Fixes:
+In file included from ./targ-cpu.h:1,
+ from /home/dank/crosstool-new/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.2.2/binutils-2.15/gas/config/obj-elf.h:42,
+ from ./obj-format.h:1,
+ from /home/dank/crosstool-new/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.2.2/binutils-2.15/gas/config/te-linux.h:4,
+ from ./targ-env.h:1,
+ from /home/dank/crosstool-new/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.2.2/binutils-2.15/gas/as.h:626,
+ from /home/dank/crosstool-new/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.2.2/binutils-2.15/gas/app.c:30:
+/home/dank/crosstool-new/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.2.2/binutils-2.15/gas/config/tc-i386.h:451: error: array type has incomplete element type
+make[3]: *** [app.o] Error 1
+make[3]: Leaving directory `/home/dank/crosstool-new/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.2.2/build-binutils/gas'
+
+when building binutils-2.15 with gcc-4.0
+
+
+diff -ur binutils-2.15.old/gas/as.h binutils-2.15/gas/as.h
+--- binutils-2.15.old/gas/as.h 2003-11-22 18:14:21.000000000 -0800
++++ binutils-2.15/gas/as.h 2006-02-14 22:05:35.000000000 -0800
+@@ -605,7 +605,26 @@
+ struct expressionS;
+ struct fix;
+ typedef struct symbol symbolS;
+-struct relax_type;
++
++/* JF moved this here from as.h under the theory that nobody except MACHINE.c
++ and write.c care about it anyway. */
++/* [zooey]: the above no longer holds with gcc4, as it keeps bugging about
++ incomplete element types in arrays, if relax_type isn't defined
++ here. So I moved the definition back from tc.h to here. */
++struct relax_type
++{
++ /* Forward reach. Signed number. > 0. */
++ long rlx_forward;
++ /* Backward reach. Signed number. < 0. */
++ long rlx_backward;
++
++ /* Bytes length of this address. */
++ unsigned char rlx_length;
++
++ /* Next longer relax-state. 0 means there is no 'next' relax-state. */
++ relax_substateT rlx_more;
++};
++
+ typedef struct frag fragS;
+
+ #ifdef BFD_ASSEMBLER
+diff -ur binutils-2.15.old/gas/tc.h binutils-2.15/gas/tc.h
+--- binutils-2.15.old/gas/tc.h 2003-12-03 15:39:38.000000000 -0800
++++ binutils-2.15/gas/tc.h 2006-02-14 22:03:35.000000000 -0800
+@@ -24,23 +24,6 @@
+
+ extern const pseudo_typeS md_pseudo_table[];
+
+-/* JF moved this here from as.h under the theory that nobody except MACHINE.c
+- and write.c care about it anyway. */
+-
+-struct relax_type
+-{
+- /* Forward reach. Signed number. > 0. */
+- long rlx_forward;
+- /* Backward reach. Signed number. < 0. */
+- long rlx_backward;
+-
+- /* Bytes length of this address. */
+- unsigned char rlx_length;
+-
+- /* Next longer relax-state. 0 means there is no 'next' relax-state. */
+- relax_substateT rlx_more;
+-};
+-
+ typedef struct relax_type relax_typeS;
+
+ extern const int md_reloc_size; /* Size of a relocation record */
diff --git a/patches/binutils/2.15/binutils-2.15-psignal.patch b/patches/binutils/2.15/binutils-2.15-psignal.patch
new file mode 100644
index 0000000..98fa600
--- /dev/null
+++ b/patches/binutils/2.15/binutils-2.15-psignal.patch
@@ -0,0 +1,40 @@
+Make psignal prototype in libiberty match that in glibc.
+
+Fixes:
+
+gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c: In function `psignal':
+gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c:563: argument `signo' doesn't match prototype
+/usr/include/signal.h:131: prototype declaration
+gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c:563: argument `message' doesn't match prototype
+/usr/include/signal.h:131: prototype declaration
+gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c:568: warning: comparison between signed and unsigned
+mprotect... make[1]: *** [strsignal.o] Error 1
+make[1]: Leaving directory `/export/hda3/dkegel/queue/jobdir.produser_cpsm17/crosstool-0.32/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.1.3/build-binutils/libiberty'
+make: *** [all-libiberty] Error 2
+
+when building on red hat 7.1
+though it's a bit of a mystery why libiberty's psignal is being compiled at
+all, since red hat 7.1's glibc supports psignal (hence the error message)
+
+--- binutils-2.15/libiberty/strsignal.c.old 2005-04-18 13:57:40.000000000 -0700
++++ binutils-2.15/libiberty/strsignal.c 2005-04-18 13:59:09.000000000 -0700
+@@ -544,7 +544,7 @@
+
+ /*
+
+-@deftypefn Supplemental void psignal (unsigned @var{signo}, char *@var{message})
++@deftypefn Supplemental void psignal (int @var{signo}, const char *@var{message})
+
+ Print @var{message} to the standard error, followed by a colon,
+ followed by the description of the signal specified by @var{signo},
+@@ -557,9 +557,7 @@
+ #ifndef HAVE_PSIGNAL
+
+ void
+-psignal (signo, message)
+- unsigned signo;
+- char *message;
++psignal (int signo, const char *message)
+ {
+ if (signal_names == NULL)
+ {
diff --git a/patches/binutils/2.15/binutils-2.15-solaris-qsort.patch b/patches/binutils/2.15/binutils-2.15-solaris-qsort.patch
new file mode 100644
index 0000000..5fe3623
--- /dev/null
+++ b/patches/binutils/2.15/binutils-2.15-solaris-qsort.patch
@@ -0,0 +1,22 @@
+See http://sources.redhat.com/ml/binutils/2004-06/msg00114.html
+
+--- src/bfd/elflink.c.org 2004-07-05 09:11:42.920597000 -0400
++++ src/bfd/elflink.c 2004-07-05 09:12:59.240847000 -0400
+@@ -2700,7 +2700,7 @@
+ return vdiff > 0 ? 1 : -1;
+ else
+ {
+- long sdiff = h1->root.u.def.section - h2->root.u.def.section;
++ long sdiff = h1->root.u.def.section->id - h2->root.u.def.section->id;
+ if (sdiff != 0)
+ return sdiff > 0 ? 1 : -1;
+ }
+@@ -3954,7 +3954,7 @@
+ i = idx + 1;
+ else
+ {
+- long sdiff = slook - h->root.u.def.section;
++ long sdiff = slook->id - h->root.u.def.section->id;
+ if (sdiff < 0)
+ j = idx;
+ else if (sdiff > 0)
diff --git a/patches/binutils/2.15/binutils-2.15-vmx.patch b/patches/binutils/2.15/binutils-2.15-vmx.patch
new file mode 100644
index 0000000..5ae9efe
--- /dev/null
+++ b/patches/binutils/2.15/binutils-2.15-vmx.patch
@@ -0,0 +1,45 @@
+Grabbed with
+wget 'http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/opcodes/ppc-opc.c.diff?r1=1.70&r2=1.71&cvsroot=src'
+See
+http://mail.gnu.org/archive/html/bug-binutils/2004-05/msg00071.html
+and
+http://sources.redhat.com/ml/binutils-cvs/2004-05/msg00111.html
+
+This fixes problems like
+{standard input}: Assembler messages:
+{standard input}:1: Error: Unrecognized opcode: `dssall'
+which show up in binutils-2.15 when building the Linux kernel,
+or possibly failed compilations when building setjmp/longjmp in glibc.
+
+An alternative fix would be to pass -many to the assembler.
+A patch to do that for glibc is at
+wget 'http://sources.redhat.com/cgi-bin/get-raw-msg?listname=libc-alpha&date=2004-05&msgid=40B36E8C.9030609%40us.ibm.com'
+Yet another, better, fix would be for gcc to generate assembly
+that told the assembler which processor type to use.
+Presumably the Linux kernel sources would need a fix, too.
+Probably better to just fix binutils to accept sources that it used to.
+
+
+===================================================================
+RCS file: /cvs/src/src/opcodes/ppc-opc.c,v
+retrieving revision 1.70
+retrieving revision 1.71
+diff -u -r1.70 -r1.71
+--- src/opcodes/ppc-opc.c 2004/05/05 13:43:36 1.70
++++ src/opcodes/ppc-opc.c 2004/05/19 05:11:48 1.71
+@@ -1004,8 +1004,13 @@
+
+ /* If only one bit of the FXM field is set, we can use the new form
+ of the instruction, which is faster. Unlike the Power4 branch hint
+- encoding, this is not backward compatible. */
+- else if ((dialect & PPC_OPCODE_POWER4) != 0 && (value & -value) == value)
++ encoding, this is not backward compatible. Do not generate the
++ new form unless -mpower4 has been given, or -many and the two
++ operand form of mfcr was used. */
++ else if ((value & -value) == value
++ && ((dialect & PPC_OPCODE_POWER4) != 0
++ || ((dialect & PPC_OPCODE_ANY) != 0
++ && (insn & (0x3ff << 1)) == 19 << 1)))
+ insn |= 1 << 20;
+
+ /* Any other value on mfcr is an error. */
diff --git a/patches/binutils/2.15/binutils-arm-undef-imm.patch b/patches/binutils/2.15/binutils-arm-undef-imm.patch
new file mode 100644
index 0000000..6bf403c
--- /dev/null
+++ b/patches/binutils/2.15/binutils-arm-undef-imm.patch
@@ -0,0 +1,51 @@
+From http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/config/tc-arm.c.diff?r1=1.168&r2=1.169&cvsroot=src
+See also http://lists.arm.linux.org.uk/pipermail/linux-arm-kernel/2004-July/023128.html,
+"[CRITICAL PATCH] 2.6: fix silent build error]"
+
+Revision 1.169, Fri Jul 2 11:12:29 2004 UTC (19 hours, 4 minutes ago) by nickc
+Branch: MAIN
+CVS Tags: binutils_latest_snapshot, HEAD
+Changes since 1.168: +14 -1 lines
+
+(md_apply_fix3:BFD_RELOC_ARM_IMMEDIATE): Do not allow values which have come
+from undefined symbols.
+Always consider this fixup to have been processed as a reloc cannot be
+generated for it.
+
+
+===================================================================
+RCS file: /cvs/src/src/gas/config/tc-arm.c,v
+retrieving revision 1.168
+retrieving revision 1.169
+diff -u -r1.168 -r1.169
+--- src/gas/config/tc-arm.c 2004/04/30 10:51:12 1.168
++++ src/gas/config/tc-arm.c 2004/07/02 11:12:29 1.169
+@@ -12186,6 +12186,20 @@
+ switch (fixP->fx_r_type)
+ {
+ case BFD_RELOC_ARM_IMMEDIATE:
++ /* We claim that this fixup has been processed here,
++ even if in fact we generate an error because we do
++ not have a reloc for it, so tc_gen_reloc will reject it. */
++ fixP->fx_done = 1;
++
++ if (fixP->fx_addsy
++ && ! S_IS_DEFINED (fixP->fx_addsy))
++ {
++ as_bad_where (fixP->fx_file, fixP->fx_line,
++ _("undefined symbol %s used as an immediate value"),
++ S_GET_NAME (fixP->fx_addsy));
++ break;
++ }
++
+ newimm = validate_immediate (value);
+ temp = md_chars_to_number (buf, INSN_SIZE);
+
+@@ -12202,7 +12216,6 @@
+
+ newimm |= (temp & 0xfffff000);
+ md_number_to_chars (buf, (valueT) newimm, INSN_SIZE);
+- fixP->fx_done = 1;
+ break;
+
+ case BFD_RELOC_ARM_ADRL_IMMEDIATE:
diff --git a/patches/binutils/2.15/binutils-skip-comments.patch b/patches/binutils/2.15/binutils-skip-comments.patch
new file mode 100644
index 0000000..804a17e
--- /dev/null
+++ b/patches/binutils/2.15/binutils-skip-comments.patch
@@ -0,0 +1,101 @@
+Retrieved from http://sources.redhat.com/ml/binutils/2004-04/msg00646.html
+Fixes
+localealias.s:544: Error: junk at end of line, first unrecognized character is `,'
+when building glibc-2.3.2 with gcc-3.4.0 and binutils-2.15.90.0.3
+
+Paths adjusted to match crosstool's patcher.
+
+Message-Id: m3n052qw2g.fsf@whitebox.m5r.de
+From: Andreas Schwab <schwab at suse dot de>
+To: Nathan Sidwell <nathan at codesourcery dot com>
+Cc: Ian Lance Taylor <ian at wasabisystems dot com>, binutils at sources dot redhat dot com
+Date: Fri, 23 Apr 2004 22:27:19 +0200
+Subject: Re: demand_empty_rest_of_line and ignore_rest_of_line
+
+Nathan Sidwell <nathan@codesourcery.com> writes:
+
+> Index: read.c
+> ===================================================================
+> RCS file: /cvs/src/src/gas/read.c,v
+> retrieving revision 1.76
+> diff -c -3 -p -r1.76 read.c
+> *** read.c 12 Mar 2004 17:48:12 -0000 1.76
+> --- read.c 18 Mar 2004 09:56:05 -0000
+> *************** read_a_source_file (char *name)
+> *** 1053,1059 ****
+> #endif
+> input_line_pointer--;
+> /* Report unknown char as ignored. */
+> ! ignore_rest_of_line ();
+> }
+>
+> #ifdef md_after_pass_hook
+> --- 1053,1059 ----
+> #endif
+> input_line_pointer--;
+> /* Report unknown char as ignored. */
+> ! demand_empty_rest_of_line ();
+> }
+>
+> #ifdef md_after_pass_hook
+
+This means that the unknown character is no longer ignored, despite the
+comment. As a side effect a line starting with a line comment character
+not followed by APP in NO_APP mode now triggers an error instead of just a
+warning, breaking builds of glibc on m68k-linux. Earlier in
+read_a_source_file where #APP is handled there is another comment that
+claims that unknown comments are ignored, when in fact they aren't (only
+the initial line comment character is skipped).
+
+Note that the presence of #APP will mess up the line counters, but
+that appears to be difficult to fix.
+
+Andreas.
+
+2004-04-23 Andreas Schwab <schwab@suse.de>
+
+ * read.c (read_a_source_file): Ignore unknown text after line
+ comment character. Fix misleading comment.
+
+--- binutils/gas/read.c.~1.78.~ 2004-04-23 08:58:23.000000000 +0200
++++ binutils/gas/read.c 2004-04-23 21:49:01.000000000 +0200
+@@ -1,6 +1,6 @@
+ /* read.c - read a source file -
+ Copyright 1986, 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
+- 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
++ 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+
+ This file is part of GAS, the GNU Assembler.
+
+@@ -950,10 +950,14 @@ read_a_source_file (char *name)
+ unsigned int new_length;
+ char *tmp_buf = 0;
+
+- bump_line_counters ();
+ s = input_line_pointer;
+ if (strncmp (s, "APP\n", 4))
+- continue; /* We ignore it */
++ {
++ /* We ignore it */
++ ignore_rest_of_line ();
++ continue;
++ }
++ bump_line_counters ();
+ s += 4;
+
+ sb_new (&sbuf);
+@@ -1052,7 +1056,7 @@ read_a_source_file (char *name)
+ continue;
+ #endif
+ input_line_pointer--;
+- /* Report unknown char as ignored. */
++ /* Report unknown char as error. */
+ demand_empty_rest_of_line ();
+ }
+
+
+--
+Andreas Schwab, SuSE Labs, schwab@suse.de
+SuSE Linux AG, Maxfeldstra&#xC3;e 5, 90409 N&#xC3;rnberg, Germany
+Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
+"And now for something completely different."
diff --git a/patches/binutils/2.15/cross-gprof.patch b/patches/binutils/2.15/cross-gprof.patch
new file mode 100644
index 0000000..ea6c18f
--- /dev/null
+++ b/patches/binutils/2.15/cross-gprof.patch
@@ -0,0 +1,22 @@
+--- binutils-2.15/configure.old 2004-07-21 21:36:47.000000000 -0700
++++ binutils-2.15/configure 2004-07-21 21:37:08.000000000 -0700
+@@ -999,7 +999,7 @@
+
+ # Some tools are only suitable for building in a "native" situation.
+ # Remove these if host!=target.
+-native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf"
++native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf"
+
+ # Similarly, some are only suitable for cross toolchains.
+ # Remove these if host=target.
+--- binutils-2.15/configure.in.old 2004-07-21 21:37:19.000000000 -0700
++++ binutils-2.15/configure.in 2004-07-21 21:37:34.000000000 -0700
+@@ -236,7 +236,7 @@
+
+ # Some tools are only suitable for building in a "native" situation.
+ # Remove these if host!=target.
+-native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf"
++native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf"
+
+ # Similarly, some are only suitable for cross toolchains.
+ # Remove these if host=target.
diff --git a/patches/binutils/2.15/gccpr15247-fix.patch b/patches/binutils/2.15/gccpr15247-fix.patch
new file mode 100644
index 0000000..967bf7f
--- /dev/null
+++ b/patches/binutils/2.15/gccpr15247-fix.patch
@@ -0,0 +1,192 @@
+See
+http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15247
+
+Fixes spurious error
+/tmp/ccvNi4ou.s: Assembler messages:
+/tmp/ccvNi4ou.s:2310: Error: Illegal operands: There are only 32 single precision f registers; [0-31]
+make[2]: *** [/home/dank/wk/crosstool-0.28-rc10/build/sparc64-unknown-linux-gnu/gcc-3.4.0-glibc-2.3.2/build-glibc/math/dosincos.o] Error 1
+
+when compiling glibc's dosincos.c with gcc-3.4.0
+
+===================================================================
+RCS file: /cvs/src/src/opcodes/sparc-opc.c,v
+retrieving revision 1.9
+retrieving revision 1.10
+diff -u -r1.9 -r1.10
+--- src/opcodes/sparc-opc.c 2004/01/18 23:46:32 1.9
++++ src/opcodes/sparc-opc.c 2004/04/20 10:23:51 1.10
+@@ -1273,110 +1273,72 @@
+ #define FM_DF 2 /* v9 */
+ #define FM_QF 3 /* v9 */
+
+-#define fmovicc(opcode, fpsize, cond, flags) /* v9 */ \
+-{ opcode, F3F(2, 0x35, 0x100+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x100+fpsize))|MCOND(~cond,~0), "z,f,g", flags, v9 }, \
+-{ opcode, F3F(2, 0x35, 0x180+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x180+fpsize))|MCOND(~cond,~0), "Z,f,g", flags, v9 }
+-
+-#define fmovfcc(opcode, fpsize, fcond, flags) /* v9 */ \
+-{ opcode, F3F(2, 0x35, 0x000+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x000+fpsize))|MCOND(~fcond,~0), "6,f,g", flags, v9 }, \
+-{ opcode, F3F(2, 0x35, 0x040+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x040+fpsize))|MCOND(~fcond,~0), "7,f,g", flags, v9 }, \
+-{ opcode, F3F(2, 0x35, 0x080+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x080+fpsize))|MCOND(~fcond,~0), "8,f,g", flags, v9 }, \
+-{ opcode, F3F(2, 0x35, 0x0c0+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x0c0+fpsize))|MCOND(~fcond,~0), "9,f,g", flags, v9 }
++#define fmoviccx(opcode, fpsize, args, cond, flags) /* v9 */ \
++{ opcode, F3F(2, 0x35, 0x100+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x100+fpsize))|MCOND(~cond,~0), "z," args, flags, v9 }, \
++{ opcode, F3F(2, 0x35, 0x180+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x180+fpsize))|MCOND(~cond,~0), "Z," args, flags, v9 }
++
++#define fmovfccx(opcode, fpsize, args, fcond, flags) /* v9 */ \
++{ opcode, F3F(2, 0x35, 0x000+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x000+fpsize))|MCOND(~fcond,~0), "6," args, flags, v9 }, \
++{ opcode, F3F(2, 0x35, 0x040+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x040+fpsize))|MCOND(~fcond,~0), "7," args, flags, v9 }, \
++{ opcode, F3F(2, 0x35, 0x080+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x080+fpsize))|MCOND(~fcond,~0), "8," args, flags, v9 }, \
++{ opcode, F3F(2, 0x35, 0x0c0+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x0c0+fpsize))|MCOND(~fcond,~0), "9," args, flags, v9 }
+
+ /* FIXME: use fmovicc/fmovfcc? */ /* v9 */
+-#define fmovcc(opcode, fpsize, cond, fcond, flags) /* v9 */ \
+-{ opcode, F3F(2, 0x35, 0x100+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x100+fpsize))|MCOND(~cond,~0), "z,f,g", flags | F_FLOAT, v9 }, \
+-{ opcode, F3F(2, 0x35, 0x000+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x000+fpsize))|MCOND(~fcond,~0), "6,f,g", flags | F_FLOAT, v9 }, \
+-{ opcode, F3F(2, 0x35, 0x180+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x180+fpsize))|MCOND(~cond,~0), "Z,f,g", flags | F_FLOAT, v9 }, \
+-{ opcode, F3F(2, 0x35, 0x040+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x040+fpsize))|MCOND(~fcond,~0), "7,f,g", flags | F_FLOAT, v9 }, \
+-{ opcode, F3F(2, 0x35, 0x080+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x080+fpsize))|MCOND(~fcond,~0), "8,f,g", flags | F_FLOAT, v9 }, \
+-{ opcode, F3F(2, 0x35, 0x0c0+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x0c0+fpsize))|MCOND(~fcond,~0), "9,f,g", flags | F_FLOAT, v9 }
+-
+-/* v9 */ fmovcc ("fmovda", FM_DF, CONDA, FCONDA, 0),
+-/* v9 */ fmovcc ("fmovqa", FM_QF, CONDA, FCONDA, 0),
+-/* v9 */ fmovcc ("fmovsa", FM_SF, CONDA, FCONDA, 0),
+-/* v9 */ fmovicc ("fmovdcc", FM_DF, CONDCC, 0),
+-/* v9 */ fmovicc ("fmovqcc", FM_QF, CONDCC, 0),
+-/* v9 */ fmovicc ("fmovscc", FM_SF, CONDCC, 0),
+-/* v9 */ fmovicc ("fmovdcs", FM_DF, CONDCS, 0),
+-/* v9 */ fmovicc ("fmovqcs", FM_QF, CONDCS, 0),
+-/* v9 */ fmovicc ("fmovscs", FM_SF, CONDCS, 0),
+-/* v9 */ fmovcc ("fmovde", FM_DF, CONDE, FCONDE, 0),
+-/* v9 */ fmovcc ("fmovqe", FM_QF, CONDE, FCONDE, 0),
+-/* v9 */ fmovcc ("fmovse", FM_SF, CONDE, FCONDE, 0),
+-/* v9 */ fmovcc ("fmovdg", FM_DF, CONDG, FCONDG, 0),
+-/* v9 */ fmovcc ("fmovqg", FM_QF, CONDG, FCONDG, 0),
+-/* v9 */ fmovcc ("fmovsg", FM_SF, CONDG, FCONDG, 0),
+-/* v9 */ fmovcc ("fmovdge", FM_DF, CONDGE, FCONDGE, 0),
+-/* v9 */ fmovcc ("fmovqge", FM_QF, CONDGE, FCONDGE, 0),
+-/* v9 */ fmovcc ("fmovsge", FM_SF, CONDGE, FCONDGE, 0),
+-/* v9 */ fmovicc ("fmovdgeu", FM_DF, CONDGEU, F_ALIAS),
+-/* v9 */ fmovicc ("fmovqgeu", FM_QF, CONDGEU, F_ALIAS),
+-/* v9 */ fmovicc ("fmovsgeu", FM_SF, CONDGEU, F_ALIAS),
+-/* v9 */ fmovicc ("fmovdgu", FM_DF, CONDGU, 0),
+-/* v9 */ fmovicc ("fmovqgu", FM_QF, CONDGU, 0),
+-/* v9 */ fmovicc ("fmovsgu", FM_SF, CONDGU, 0),
+-/* v9 */ fmovcc ("fmovdl", FM_DF, CONDL, FCONDL, 0),
+-/* v9 */ fmovcc ("fmovql", FM_QF, CONDL, FCONDL, 0),
+-/* v9 */ fmovcc ("fmovsl", FM_SF, CONDL, FCONDL, 0),
+-/* v9 */ fmovcc ("fmovdle", FM_DF, CONDLE, FCONDLE, 0),
+-/* v9 */ fmovcc ("fmovqle", FM_QF, CONDLE, FCONDLE, 0),
+-/* v9 */ fmovcc ("fmovsle", FM_SF, CONDLE, FCONDLE, 0),
+-/* v9 */ fmovicc ("fmovdleu", FM_DF, CONDLEU, 0),
+-/* v9 */ fmovicc ("fmovqleu", FM_QF, CONDLEU, 0),
+-/* v9 */ fmovicc ("fmovsleu", FM_SF, CONDLEU, 0),
+-/* v9 */ fmovfcc ("fmovdlg", FM_DF, FCONDLG, 0),
+-/* v9 */ fmovfcc ("fmovqlg", FM_QF, FCONDLG, 0),
+-/* v9 */ fmovfcc ("fmovslg", FM_SF, FCONDLG, 0),
+-/* v9 */ fmovicc ("fmovdlu", FM_DF, CONDLU, F_ALIAS),
+-/* v9 */ fmovicc ("fmovqlu", FM_QF, CONDLU, F_ALIAS),
+-/* v9 */ fmovicc ("fmovslu", FM_SF, CONDLU, F_ALIAS),
+-/* v9 */ fmovcc ("fmovdn", FM_DF, CONDN, FCONDN, 0),
+-/* v9 */ fmovcc ("fmovqn", FM_QF, CONDN, FCONDN, 0),
+-/* v9 */ fmovcc ("fmovsn", FM_SF, CONDN, FCONDN, 0),
+-/* v9 */ fmovcc ("fmovdne", FM_DF, CONDNE, FCONDNE, 0),
+-/* v9 */ fmovcc ("fmovqne", FM_QF, CONDNE, FCONDNE, 0),
+-/* v9 */ fmovcc ("fmovsne", FM_SF, CONDNE, FCONDNE, 0),
+-/* v9 */ fmovicc ("fmovdneg", FM_DF, CONDNEG, 0),
+-/* v9 */ fmovicc ("fmovqneg", FM_QF, CONDNEG, 0),
+-/* v9 */ fmovicc ("fmovsneg", FM_SF, CONDNEG, 0),
+-/* v9 */ fmovcc ("fmovdnz", FM_DF, CONDNZ, FCONDNZ, F_ALIAS),
+-/* v9 */ fmovcc ("fmovqnz", FM_QF, CONDNZ, FCONDNZ, F_ALIAS),
+-/* v9 */ fmovcc ("fmovsnz", FM_SF, CONDNZ, FCONDNZ, F_ALIAS),
+-/* v9 */ fmovfcc ("fmovdo", FM_DF, FCONDO, 0),
+-/* v9 */ fmovfcc ("fmovqo", FM_QF, FCONDO, 0),
+-/* v9 */ fmovfcc ("fmovso", FM_SF, FCONDO, 0),
+-/* v9 */ fmovicc ("fmovdpos", FM_DF, CONDPOS, 0),
+-/* v9 */ fmovicc ("fmovqpos", FM_QF, CONDPOS, 0),
+-/* v9 */ fmovicc ("fmovspos", FM_SF, CONDPOS, 0),
+-/* v9 */ fmovfcc ("fmovdu", FM_DF, FCONDU, 0),
+-/* v9 */ fmovfcc ("fmovqu", FM_QF, FCONDU, 0),
+-/* v9 */ fmovfcc ("fmovsu", FM_SF, FCONDU, 0),
+-/* v9 */ fmovfcc ("fmovdue", FM_DF, FCONDUE, 0),
+-/* v9 */ fmovfcc ("fmovque", FM_QF, FCONDUE, 0),
+-/* v9 */ fmovfcc ("fmovsue", FM_SF, FCONDUE, 0),
+-/* v9 */ fmovfcc ("fmovdug", FM_DF, FCONDUG, 0),
+-/* v9 */ fmovfcc ("fmovqug", FM_QF, FCONDUG, 0),
+-/* v9 */ fmovfcc ("fmovsug", FM_SF, FCONDUG, 0),
+-/* v9 */ fmovfcc ("fmovduge", FM_DF, FCONDUGE, 0),
+-/* v9 */ fmovfcc ("fmovquge", FM_QF, FCONDUGE, 0),
+-/* v9 */ fmovfcc ("fmovsuge", FM_SF, FCONDUGE, 0),
+-/* v9 */ fmovfcc ("fmovdul", FM_DF, FCONDUL, 0),
+-/* v9 */ fmovfcc ("fmovqul", FM_QF, FCONDUL, 0),
+-/* v9 */ fmovfcc ("fmovsul", FM_SF, FCONDUL, 0),
+-/* v9 */ fmovfcc ("fmovdule", FM_DF, FCONDULE, 0),
+-/* v9 */ fmovfcc ("fmovqule", FM_QF, FCONDULE, 0),
+-/* v9 */ fmovfcc ("fmovsule", FM_SF, FCONDULE, 0),
+-/* v9 */ fmovicc ("fmovdvc", FM_DF, CONDVC, 0),
+-/* v9 */ fmovicc ("fmovqvc", FM_QF, CONDVC, 0),
+-/* v9 */ fmovicc ("fmovsvc", FM_SF, CONDVC, 0),
+-/* v9 */ fmovicc ("fmovdvs", FM_DF, CONDVS, 0),
+-/* v9 */ fmovicc ("fmovqvs", FM_QF, CONDVS, 0),
+-/* v9 */ fmovicc ("fmovsvs", FM_SF, CONDVS, 0),
+-/* v9 */ fmovcc ("fmovdz", FM_DF, CONDZ, FCONDZ, F_ALIAS),
+-/* v9 */ fmovcc ("fmovqz", FM_QF, CONDZ, FCONDZ, F_ALIAS),
+-/* v9 */ fmovcc ("fmovsz", FM_SF, CONDZ, FCONDZ, F_ALIAS),
+-
++#define fmovccx(opcode, fpsize, args, cond, fcond, flags) /* v9 */ \
++{ opcode, F3F(2, 0x35, 0x100+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x100+fpsize))|MCOND(~cond,~0), "z," args, flags | F_FLOAT, v9 }, \
++{ opcode, F3F(2, 0x35, 0x000+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x000+fpsize))|MCOND(~fcond,~0), "6," args, flags | F_FLOAT, v9 }, \
++{ opcode, F3F(2, 0x35, 0x180+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x180+fpsize))|MCOND(~cond,~0), "Z," args, flags | F_FLOAT, v9 }, \
++{ opcode, F3F(2, 0x35, 0x040+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x040+fpsize))|MCOND(~fcond,~0), "7," args, flags | F_FLOAT, v9 }, \
++{ opcode, F3F(2, 0x35, 0x080+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x080+fpsize))|MCOND(~fcond,~0), "8," args, flags | F_FLOAT, v9 }, \
++{ opcode, F3F(2, 0x35, 0x0c0+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x0c0+fpsize))|MCOND(~fcond,~0), "9," args, flags | F_FLOAT, v9 }
++
++#define fmovicc(suffix, cond, flags) /* v9 */ \
++fmoviccx("fmovd" suffix, FM_DF, "B,H", cond, flags), \
++fmoviccx("fmovq" suffix, FM_QF, "R,J", cond, flags), \
++fmoviccx("fmovs" suffix, FM_SF, "f,g", cond, flags)
++
++#define fmovfcc(suffix, fcond, flags) /* v9 */ \
++fmovfccx("fmovd" suffix, FM_DF, "B,H", fcond, flags), \
++fmovfccx("fmovq" suffix, FM_QF, "R,J", fcond, flags), \
++fmovfccx("fmovs" suffix, FM_SF, "f,g", fcond, flags)
++
++#define fmovcc(suffix, cond, fcond, flags) /* v9 */ \
++fmovccx("fmovd" suffix, FM_DF, "B,H", cond, fcond, flags), \
++fmovccx("fmovq" suffix, FM_QF, "R,J", cond, fcond, flags), \
++fmovccx("fmovs" suffix, FM_SF, "f,g", cond, fcond, flags)
++
++/* v9 */ fmovcc ("a", CONDA, FCONDA, 0),
++/* v9 */ fmovicc ("cc", CONDCC, 0),
++/* v9 */ fmovicc ("cs", CONDCS, 0),
++/* v9 */ fmovcc ("e", CONDE, FCONDE, 0),
++/* v9 */ fmovcc ("g", CONDG, FCONDG, 0),
++/* v9 */ fmovcc ("ge", CONDGE, FCONDGE, 0),
++/* v9 */ fmovicc ("geu", CONDGEU, F_ALIAS),
++/* v9 */ fmovicc ("gu", CONDGU, 0),
++/* v9 */ fmovcc ("l", CONDL, FCONDL, 0),
++/* v9 */ fmovcc ("le", CONDLE, FCONDLE, 0),
++/* v9 */ fmovicc ("leu", CONDLEU, 0),
++/* v9 */ fmovfcc ("lg", FCONDLG, 0),
++/* v9 */ fmovicc ("lu", CONDLU, F_ALIAS),
++/* v9 */ fmovcc ("n", CONDN, FCONDN, 0),
++/* v9 */ fmovcc ("ne", CONDNE, FCONDNE, 0),
++/* v9 */ fmovicc ("neg", CONDNEG, 0),
++/* v9 */ fmovcc ("nz", CONDNZ, FCONDNZ, F_ALIAS),
++/* v9 */ fmovfcc ("o", FCONDO, 0),
++/* v9 */ fmovicc ("pos", CONDPOS, 0),
++/* v9 */ fmovfcc ("u", FCONDU, 0),
++/* v9 */ fmovfcc ("ue", FCONDUE, 0),
++/* v9 */ fmovfcc ("ug", FCONDUG, 0),
++/* v9 */ fmovfcc ("uge", FCONDUGE, 0),
++/* v9 */ fmovfcc ("ul", FCONDUL, 0),
++/* v9 */ fmovfcc ("ule", FCONDULE, 0),
++/* v9 */ fmovicc ("vc", CONDVC, 0),
++/* v9 */ fmovicc ("vs", CONDVS, 0),
++/* v9 */ fmovcc ("z", CONDZ, FCONDZ, F_ALIAS),
++
++#undef fmoviccx /* v9 */
++#undef fmovfccx /* v9 */
++#undef fmovccx /* v9 */
+ #undef fmovicc /* v9 */
+ #undef fmovfcc /* v9 */
+ #undef fmovcc /* v9 */
diff --git a/patches/binutils/2.15/ld-2.15-callahan.patch b/patches/binutils/2.15/ld-2.15-callahan.patch
new file mode 100644
index 0000000..bb4a69c
--- /dev/null
+++ b/patches/binutils/2.15/ld-2.15-callahan.patch
@@ -0,0 +1,677 @@
+Signed-off-by: dank@kegel.com
+Fixes ld speed issue.
+See http://weblogs.mozillazine.org/roc/archives/2005/02/optimizing_gnu.html
+See thread "Re: optimizations for 3x speedup in ld",
+http://sources.redhat.com/ml/binutils/2005-03/msg00847.html
+
+Wildcard section matching enhancement, backported from the binutils CVS tree.
+Here's the CVS log comment from the original change to ldlang.c:
+
+revision 1.177
+date: 2005/04/06 15:33:02; author: jakub; state: Exp; lines: +438 -51
+2005-04-06 Jakub Jelinek <jakub@redhat.com>
+
+ * ldlang.c: Formatting.
+ (walk_wild_consider_section): Remember return value from wildcardp.
+ (is_simple_wild): Use strcspn instead of 2 strpbrk calls and strlen.
+ (wild_spec_can_overlap): Use strcspn instead of strpbrk and strlen.
+
+2005-04-06 Robert O'Callahan <rocallahan@novell.com>
+
+ * ld.h (lean_section_userdata_type): Remove.
+ (fat_section_userdata_type): Remove file field.
+ (SECTION_USERDATA_SIZE): Remove.
+ * ldlang.c (init_os): Eliminate initialization of unused
+ lean_section_userdata_type.
+
+ * ldlang.h (callback_t, walk_wild_section_handler_t): New
+ typedefs.
+ (struct lang_wild_statement_struct): Add walk_wild_section_handler
+ and handler_data fields.
+ * ldlang.c (callback_t): Removed.
+ (walk_wild_consider_section, walk_wild_section_general,
+ section_iterator_callback, find_section, is_simple_wild,
+ match_simple_wild, walk_wild_section_specs1_wild0,
+ walk_wild_section_specs1_wild1, walk_wild_section_specs2_wild1,
+ walk_wild_section_specs3_wild2, walk_wild_section_specs4_wild2,
+ wild_spec_can_overlap, analyze_walk_wild_section_handler): New
+ functions.
+ (lang_add_wild): Call analyze_walk_wild_section_handler.
+ (walk_wild_section): Renamed to walk_wild_section_general and
+ created a wrapper function.
+ (section_iterator_callback_data): New typedef.
+
+Note that bfd_get_section_by_name_if didn't exist in 2.15, so it was backported
+as well.
+
+--- binutils-2.15/bfd/bfd-in2.h.old 2004-05-17 15:35:56.000000000 -0400
++++ binutils-2.15/bfd/bfd-in2.h 2006-02-09 11:54:45.989940000 -0500
+@@ -1425,6 +1425,10 @@
+
+ asection *bfd_get_section_by_name (bfd *abfd, const char *name);
+
++asection *bfd_get_section_by_name_if (bfd *abfd, const char *name,
++ bfd_boolean (*operation) (bfd *, asection *, void *),
++ void *user_storage);
++
+ char *bfd_get_unique_section_name
+ (bfd *abfd, const char *templat, int *count);
+
+--- binutils-2.15/bfd/section.c.old 2003-12-01 01:33:01.000000000 -0500
++++ binutils-2.15/bfd/section.c 2006-01-23 14:16:54.768993000 -0500
+@@ -801,6 +801,57 @@
+
+ /*
+ FUNCTION
++ bfd_get_section_by_name_if
++
++SYNOPSIS
++ asection *bfd_get_section_by_name_if
++ (bfd *abfd,
++ const char *name,
++ bfd_boolean (*func) (bfd *abfd, asection *sect, void *obj),
++ void *obj);
++
++DESCRIPTION
++ Call the provided function @var{func} for each section
++ attached to the BFD @var{abfd} whose name matches @var{name},
++ passing @var{obj} as an argument. The function will be called
++ as if by
++
++| func (abfd, the_section, obj);
++
++ It returns the first section for which @var{func} returns true,
++ otherwise <<NULL>>.
++
++*/
++
++asection *
++bfd_get_section_by_name_if (bfd *abfd, const char *name,
++ bfd_boolean (*operation) (bfd *,
++ asection *,
++ void *),
++ void *user_storage)
++{
++ struct section_hash_entry *sh;
++ unsigned long hash;
++
++ sh = section_hash_lookup (&abfd->section_htab, name, FALSE, FALSE);
++ if (sh == NULL)
++ return NULL;
++
++ hash = sh->root.hash;
++ do
++ {
++ if ((*operation) (abfd, &sh->section, user_storage))
++ return &sh->section;
++ sh = (struct section_hash_entry *) sh->root.next;
++ }
++ while (sh != NULL && sh->root.hash == hash
++ && strcmp (sh->root.string, name) == 0);
++
++ return NULL;
++}
++
++/*
++FUNCTION
+ bfd_get_unique_section_name
+
+ SYNOPSIS
+--- binutils-2.15/ld/ldlang.c.old 2004-05-17 15:36:16.000000000 -0400
++++ binutils-2.15/ld/ldlang.c 2006-01-23 13:40:12.745499000 -0500
+@@ -81,9 +81,6 @@
+ static void lang_record_phdrs (void);
+ static void lang_do_version_exports_section (void);
+
+-typedef void (*callback_t) (lang_wild_statement_type *, struct wildcard_list *,
+- asection *, lang_input_statement_type *, void *);
+-
+ /* Exported variables. */
+ lang_output_section_statement_type *abs_output_section;
+ lang_statement_list_type lang_output_section_statement;
+@@ -138,21 +135,71 @@
+
+ /* Generic traversal routines for finding matching sections. */
+
++/* Try processing a section against a wildcard. This just calls
++ the callback unless the filename exclusion list is present
++ and excludes the file. It's hardly ever present so this
++ function is very fast. */
++
++static void
++walk_wild_consider_section (lang_wild_statement_type *ptr,
++ lang_input_statement_type *file,
++ asection *s,
++ struct wildcard_list *sec,
++ callback_t callback,
++ void *data)
++{
++ bfd_boolean skip = FALSE;
++ struct name_list *list_tmp;
++
++ /* Don't process sections from files which were
++ excluded. */
++ for (list_tmp = sec->spec.exclude_name_list;
++ list_tmp;
++ list_tmp = list_tmp->next)
++ {
++ bfd_boolean is_wildcard = wildcardp (list_tmp->name);
++ if (is_wildcard)
++ skip = fnmatch (list_tmp->name, file->filename, 0) == 0;
++ else
++ skip = strcmp (list_tmp->name, file->filename) == 0;
++
++ /* If this file is part of an archive, and the archive is
++ excluded, exclude this file. */
++ if (! skip && file->the_bfd != NULL
++ && file->the_bfd->my_archive != NULL
++ && file->the_bfd->my_archive->filename != NULL)
++ {
++ if (is_wildcard)
++ skip = fnmatch (list_tmp->name,
++ file->the_bfd->my_archive->filename,
++ 0) == 0;
++ else
++ skip = strcmp (list_tmp->name,
++ file->the_bfd->my_archive->filename) == 0;
++ }
++
++ if (skip)
++ break;
++ }
++
++ if (!skip)
++ (*callback) (ptr, sec, s, file, data);
++}
++
++/* Lowest common denominator routine that can handle everything correctly,
++ but slowly. */
++
+ static void
+-walk_wild_section (lang_wild_statement_type *ptr,
+- lang_input_statement_type *file,
+- callback_t callback,
+- void *data)
++walk_wild_section_general (lang_wild_statement_type *ptr,
++ lang_input_statement_type *file,
++ callback_t callback,
++ void *data)
+ {
+ asection *s;
+-
+- if (file->just_syms_flag)
+- return;
++ struct wildcard_list *sec;
+
+ for (s = file->the_bfd->sections; s != NULL; s = s->next)
+ {
+- struct wildcard_list *sec;
+-
+ sec = ptr->section_list;
+ if (sec == NULL)
+ (*callback) (ptr, sec, s, file, data);
+@@ -160,39 +207,8 @@
+ while (sec != NULL)
+ {
+ bfd_boolean skip = FALSE;
+- struct name_list *list_tmp;
+-
+- /* Don't process sections from files which were
+- excluded. */
+- for (list_tmp = sec->spec.exclude_name_list;
+- list_tmp;
+- list_tmp = list_tmp->next)
+- {
+- if (wildcardp (list_tmp->name))
+- skip = fnmatch (list_tmp->name, file->filename, 0) == 0;
+- else
+- skip = strcmp (list_tmp->name, file->filename) == 0;
+-
+- /* If this file is part of an archive, and the archive is
+- excluded, exclude this file. */
+- if (! skip && file->the_bfd != NULL
+- && file->the_bfd->my_archive != NULL
+- && file->the_bfd->my_archive->filename != NULL)
+- {
+- if (wildcardp (list_tmp->name))
+- skip = fnmatch (list_tmp->name,
+- file->the_bfd->my_archive->filename,
+- 0) == 0;
+- else
+- skip = strcmp (list_tmp->name,
+- file->the_bfd->my_archive->filename) == 0;
+- }
+-
+- if (skip)
+- break;
+- }
+
+- if (!skip && sec->spec.name != NULL)
++ if (sec->spec.name != NULL)
+ {
+ const char *sname = bfd_get_section_name (file->the_bfd, s);
+
+@@ -203,13 +219,381 @@
+ }
+
+ if (!skip)
+- (*callback) (ptr, sec, s, file, data);
++ walk_wild_consider_section (ptr, file, s, sec, callback, data);
+
+ sec = sec->next;
+ }
+ }
+ }
+
++/* Routines to find a single section given its name. If there's more
++ than one section with that name, we report that. */
++
++typedef struct
++{
++ asection *found_section;
++ bfd_boolean multiple_sections_found;
++} section_iterator_callback_data;
++
++static bfd_boolean
++section_iterator_callback (bfd *bfd ATTRIBUTE_UNUSED, asection *s, void *data)
++{
++ section_iterator_callback_data *d = data;
++
++ if (d->found_section != NULL)
++ {
++ d->multiple_sections_found = TRUE;
++ return TRUE;
++ }
++
++ d->found_section = s;
++ return FALSE;
++}
++
++static asection *
++find_section (lang_input_statement_type *file,
++ struct wildcard_list *sec,
++ bfd_boolean *multiple_sections_found)
++{
++ section_iterator_callback_data cb_data = { NULL, FALSE };
++
++ bfd_get_section_by_name_if (file->the_bfd, sec->spec.name,
++ section_iterator_callback, &cb_data);
++ *multiple_sections_found = cb_data.multiple_sections_found;
++ return cb_data.found_section;
++}
++
++/* Code for handling simple wildcards without going through fnmatch,
++ which can be expensive because of charset translations etc. */
++
++/* A simple wild is a literal string followed by a single '*',
++ where the literal part is at least 4 characters long. */
++
++static bfd_boolean
++is_simple_wild (const char *name)
++{
++ size_t len = strcspn (name, "*?[");
++ return len >= 4 && name[len] == '*' && name[len + 1] == '\0';
++}
++
++static bfd_boolean
++match_simple_wild (const char *pattern, const char *name)
++{
++ /* The first four characters of the pattern are guaranteed valid
++ non-wildcard characters. So we can go faster. */
++ if (pattern[0] != name[0] || pattern[1] != name[1]
++ || pattern[2] != name[2] || pattern[3] != name[3])
++ return FALSE;
++
++ pattern += 4;
++ name += 4;
++ while (*pattern != '*')
++ if (*name++ != *pattern++)
++ return FALSE;
++
++ return TRUE;
++}
++
++/* Specialized, optimized routines for handling different kinds of
++ wildcards */
++
++static void
++walk_wild_section_specs1_wild0 (lang_wild_statement_type *ptr,
++ lang_input_statement_type *file,
++ callback_t callback,
++ void *data)
++{
++ /* We can just do a hash lookup for the section with the right name.
++ But if that lookup discovers more than one section with the name
++ (should be rare), we fall back to the general algorithm because
++ we would otherwise have to sort the sections to make sure they
++ get processed in the bfd's order. */
++ bfd_boolean multiple_sections_found;
++ struct wildcard_list *sec0 = ptr->handler_data[0];
++ asection *s0 = find_section (file, sec0, &multiple_sections_found);
++
++ if (multiple_sections_found)
++ walk_wild_section_general (ptr, file, callback, data);
++ else if (s0)
++ walk_wild_consider_section (ptr, file, s0, sec0, callback, data);
++}
++
++static void
++walk_wild_section_specs1_wild1 (lang_wild_statement_type *ptr,
++ lang_input_statement_type *file,
++ callback_t callback,
++ void *data)
++{
++ asection *s;
++ struct wildcard_list *wildsec0 = ptr->handler_data[0];
++
++ for (s = file->the_bfd->sections; s != NULL; s = s->next)
++ {
++ const char *sname = bfd_get_section_name (file->the_bfd, s);
++ bfd_boolean skip = !match_simple_wild (wildsec0->spec.name, sname);
++
++ if (!skip)
++ walk_wild_consider_section (ptr, file, s, wildsec0, callback, data);
++ }
++}
++
++static void
++walk_wild_section_specs2_wild1 (lang_wild_statement_type *ptr,
++ lang_input_statement_type *file,
++ callback_t callback,
++ void *data)
++{
++ asection *s;
++ struct wildcard_list *sec0 = ptr->handler_data[0];
++ struct wildcard_list *wildsec1 = ptr->handler_data[1];
++ bfd_boolean multiple_sections_found;
++ asection *s0 = find_section (file, sec0, &multiple_sections_found);
++
++ if (multiple_sections_found)
++ {
++ walk_wild_section_general (ptr, file, callback, data);
++ return;
++ }
++
++ /* Note that if the section was not found, s0 is NULL and
++ we'll simply never succeed the s == s0 test below. */
++ for (s = file->the_bfd->sections; s != NULL; s = s->next)
++ {
++ /* Recall that in this code path, a section cannot satisfy more
++ than one spec, so if s == s0 then it cannot match
++ wildspec1. */
++ if (s == s0)
++ walk_wild_consider_section (ptr, file, s, sec0, callback, data);
++ else
++ {
++ const char *sname = bfd_get_section_name (file->the_bfd, s);
++ bfd_boolean skip = !match_simple_wild (wildsec1->spec.name, sname);
++
++ if (!skip)
++ walk_wild_consider_section (ptr, file, s, wildsec1, callback,
++ data);
++ }
++ }
++}
++
++static void
++walk_wild_section_specs3_wild2 (lang_wild_statement_type *ptr,
++ lang_input_statement_type *file,
++ callback_t callback,
++ void *data)
++{
++ asection *s;
++ struct wildcard_list *sec0 = ptr->handler_data[0];
++ struct wildcard_list *wildsec1 = ptr->handler_data[1];
++ struct wildcard_list *wildsec2 = ptr->handler_data[2];
++ bfd_boolean multiple_sections_found;
++ asection *s0 = find_section (file, sec0, &multiple_sections_found);
++
++ if (multiple_sections_found)
++ {
++ walk_wild_section_general (ptr, file, callback, data);
++ return;
++ }
++
++ for (s = file->the_bfd->sections; s != NULL; s = s->next)
++ {
++ if (s == s0)
++ walk_wild_consider_section (ptr, file, s, sec0, callback, data);
++ else
++ {
++ const char *sname = bfd_get_section_name (file->the_bfd, s);
++ bfd_boolean skip = !match_simple_wild (wildsec1->spec.name, sname);
++
++ if (!skip)
++ walk_wild_consider_section (ptr, file, s, wildsec1, callback, data);
++ else
++ {
++ skip = !match_simple_wild (wildsec2->spec.name, sname);
++ if (!skip)
++ walk_wild_consider_section (ptr, file, s, wildsec2, callback,
++ data);
++ }
++ }
++ }
++}
++
++static void
++walk_wild_section_specs4_wild2 (lang_wild_statement_type *ptr,
++ lang_input_statement_type *file,
++ callback_t callback,
++ void *data)
++{
++ asection *s;
++ struct wildcard_list *sec0 = ptr->handler_data[0];
++ struct wildcard_list *sec1 = ptr->handler_data[1];
++ struct wildcard_list *wildsec2 = ptr->handler_data[2];
++ struct wildcard_list *wildsec3 = ptr->handler_data[3];
++ bfd_boolean multiple_sections_found;
++ asection *s0 = find_section (file, sec0, &multiple_sections_found), *s1;
++
++ if (multiple_sections_found)
++ {
++ walk_wild_section_general (ptr, file, callback, data);
++ return;
++ }
++
++ s1 = find_section (file, sec1, &multiple_sections_found);
++ if (multiple_sections_found)
++ {
++ walk_wild_section_general (ptr, file, callback, data);
++ return;
++ }
++
++ for (s = file->the_bfd->sections; s != NULL; s = s->next)
++ {
++ if (s == s0)
++ walk_wild_consider_section (ptr, file, s, sec0, callback, data);
++ else
++ if (s == s1)
++ walk_wild_consider_section (ptr, file, s, sec1, callback, data);
++ else
++ {
++ const char *sname = bfd_get_section_name (file->the_bfd, s);
++ bfd_boolean skip = !match_simple_wild (wildsec2->spec.name,
++ sname);
++
++ if (!skip)
++ walk_wild_consider_section (ptr, file, s, wildsec2, callback,
++ data);
++ else
++ {
++ skip = !match_simple_wild (wildsec3->spec.name, sname);
++ if (!skip)
++ walk_wild_consider_section (ptr, file, s, wildsec3,
++ callback, data);
++ }
++ }
++ }
++}
++
++static void
++walk_wild_section (lang_wild_statement_type *ptr,
++ lang_input_statement_type *file,
++ callback_t callback,
++ void *data)
++{
++ if (file->just_syms_flag)
++ return;
++
++ (*ptr->walk_wild_section_handler) (ptr, file, callback, data);
++}
++
++/* Returns TRUE when name1 is a wildcard spec that might match
++ something name2 can match. We're conservative: we return FALSE
++ only if the prefixes of name1 and name2 are different up to the
++ first wildcard character. */
++
++static bfd_boolean
++wild_spec_can_overlap (const char *name1, const char *name2)
++{
++ size_t prefix1_len = strcspn (name1, "?*[");
++ size_t prefix2_len = strcspn (name2, "?*[");
++ size_t min_prefix_len;
++
++ /* Note that if there is no wildcard character, then we treat the
++ terminating 0 as part of the prefix. Thus ".text" won't match
++ ".text." or ".text.*", for example. */
++ if (name1[prefix1_len] == '\0')
++ prefix1_len++;
++ if (name2[prefix2_len] == '\0')
++ prefix2_len++;
++
++ min_prefix_len = prefix1_len < prefix2_len ? prefix1_len : prefix2_len;
++
++ return memcmp (name1, name2, min_prefix_len) == 0;
++}
++
++/* Select specialized code to handle various kinds of wildcard
++ statements. */
++
++static void
++analyze_walk_wild_section_handler (lang_wild_statement_type *ptr)
++{
++ int sec_count = 0;
++ int wild_name_count = 0;
++ struct wildcard_list *sec;
++ int signature;
++ int data_counter;
++
++ ptr->walk_wild_section_handler = walk_wild_section_general;
++
++ /* Count how many wildcard_specs there are, and how many of those
++ actually use wildcards in the name. Also, bail out if any of the
++ wildcard names are NULL. (Can this actually happen?
++ walk_wild_section used to test for it.) And bail out if any
++ of the wildcards are more complex than a simple string
++ ending in a single '*'. */
++ for (sec = ptr->section_list; sec != NULL; sec = sec->next)
++ {
++ ++sec_count;
++ if (sec->spec.name == NULL)
++ return;
++ if (wildcardp (sec->spec.name))
++ {
++ ++wild_name_count;
++ if (!is_simple_wild (sec->spec.name))
++ return;
++ }
++ }
++
++ /* The zero-spec case would be easy to optimize but it doesn't
++ happen in practice. Likewise, more than 4 specs doesn't
++ happen in practice. */
++ if (sec_count == 0 || sec_count > 4)
++ return;
++
++ /* Check that no two specs can match the same section. */
++ for (sec = ptr->section_list; sec != NULL; sec = sec->next)
++ {
++ struct wildcard_list *sec2;
++ for (sec2 = sec->next; sec2 != NULL; sec2 = sec2->next)
++ {
++ if (wild_spec_can_overlap (sec->spec.name, sec2->spec.name))
++ return;
++ }
++ }
++
++ signature = (sec_count << 8) + wild_name_count;
++ switch (signature)
++ {
++ case 0x0100:
++ ptr->walk_wild_section_handler = walk_wild_section_specs1_wild0;
++ break;
++ case 0x0101:
++ ptr->walk_wild_section_handler = walk_wild_section_specs1_wild1;
++ break;
++ case 0x0201:
++ ptr->walk_wild_section_handler = walk_wild_section_specs2_wild1;
++ break;
++ case 0x0302:
++ ptr->walk_wild_section_handler = walk_wild_section_specs3_wild2;
++ break;
++ case 0x0402:
++ ptr->walk_wild_section_handler = walk_wild_section_specs4_wild2;
++ break;
++ default:
++ return;
++ }
++
++ /* Now fill the data array with pointers to the specs, first the
++ specs with non-wildcard names, then the specs with wildcard
++ names. It's OK to process the specs in different order from the
++ given order, because we've already determined that no section
++ will match more than one spec. */
++ data_counter = 0;
++ for (sec = ptr->section_list; sec != NULL; sec = sec->next)
++ if (!wildcardp (sec->spec.name))
++ ptr->handler_data[data_counter++] = sec;
++ for (sec = ptr->section_list; sec != NULL; sec = sec->next)
++ if (wildcardp (sec->spec.name))
++ ptr->handler_data[data_counter++] = sec;
++}
++
+ /* Handle a wild statement for a single file F. */
+
+ static void
+@@ -4353,6 +4737,7 @@
+ new->section_list = section_list;
+ new->keep_sections = keep_sections;
+ lang_list_init (&new->children);
++ analyze_walk_wild_section_handler (new);
+ }
+
+ void
+--- binutils-2.15/ld/ldlang.h.old 2004-05-17 15:36:16.000000000 -0400
++++ binutils-2.15/ld/ldlang.h 2006-01-23 13:32:33.653292000 -0500
+@@ -295,7 +295,17 @@
+ union lang_statement_union *file;
+ } lang_afile_asection_pair_statement_type;
+
+-typedef struct lang_wild_statement_struct
++typedef struct lang_wild_statement_struct lang_wild_statement_type;
++
++typedef void (*callback_t) (lang_wild_statement_type *, struct wildcard_list *,
++ asection *, lang_input_statement_type *, void *);
++
++typedef void (*walk_wild_section_handler_t) (lang_wild_statement_type *,
++ lang_input_statement_type *,
++ callback_t callback,
++ void *data);
++
++struct lang_wild_statement_struct
+ {
+ lang_statement_header_type header;
+ const char *filename;
+@@ -303,7 +313,10 @@
+ struct wildcard_list *section_list;
+ bfd_boolean keep_sections;
+ lang_statement_list_type children;
+-} lang_wild_statement_type;
++
++ walk_wild_section_handler_t walk_wild_section_handler;
++ struct wildcard_list *handler_data[4];
++};
+
+ typedef struct lang_address_statement_struct
+ {
diff --git a/patches/binutils/2.15/ld-2.15-stabs-tweak.patch b/patches/binutils/2.15/ld-2.15-stabs-tweak.patch
new file mode 100644
index 0000000..bd6ae7a
--- /dev/null
+++ b/patches/binutils/2.15/ld-2.15-stabs-tweak.patch
@@ -0,0 +1,33 @@
+Signed-off-by: dank@kegel.com
+
+See http://sourceware.org/ml/binutils/2005-12/msg00270.html
+http://sourceware.org/ml/binutils-cvs/2005-12/msg00139.html
+
+STABS hash table size change, backported from the binutils CVS tree. Here's
+the CVS log comment for the original change:
+
+revision 1.25
+date: 2005/12/29 10:29:23; author: nickc; state: Exp; lines: +2 -3
+(_bfd_link_section_stabs): Use bfd_hash_table_init rather than
+bfd_hash_table_init_n(...,251) so that the size of the hash table can be
+controlled by the user.
+
+Note that tunable hash table size changes were added after 2.15. The effect
+of this change is to make bfd use its default hash table size for the stabs
+hash as well.
+
+
+--- binutils-2.15/bfd/stabs.c.old 2004-05-17 15:36:04.000000000 -0400
++++ binutils-2.15/bfd/stabs.c 2006-02-09 15:21:56.567014000 -0500
+@@ -241,9 +241,8 @@
+ goto error_return;
+ /* Make sure the first byte is zero. */
+ (void) _bfd_stringtab_add (sinfo->strings, "", TRUE, TRUE);
+- if (! bfd_hash_table_init_n (&sinfo->includes.root,
+- stab_link_includes_newfunc,
+- 251))
++ if (! bfd_hash_table_init (&sinfo->includes.root,
++ stab_link_includes_newfunc))
+ goto error_return;
+ sinfo->stabstr = bfd_make_section_anyway (abfd, ".stabstr");
+ sinfo->stabstr->flags |= SEC_HAS_CONTENTS | SEC_READONLY | SEC_DEBUGGING;
diff --git a/patches/binutils/2.15/s390-invalid-insn-format.patch b/patches/binutils/2.15/s390-invalid-insn-format.patch
new file mode 100644
index 0000000..3296201
--- /dev/null
+++ b/patches/binutils/2.15/s390-invalid-insn-format.patch
@@ -0,0 +1,42 @@
+Message-ID: <000801c48f60$cec16630$9103a8c0@ULOC5012>
+From: "Michael Geiger" <mcgege@gmx.de>
+To: <dank@kegel.com>
+Subject: Patch for cross compiling s/390 kernel on linux host
+Date: Tue, 31 Aug 2004 15:45:41 +0200
+
+Dear Dan,
+
+I had big problems compiling a kernel for s/390 on my linux host - I tried
+different chains from crosstool-0.28-rc34 and finally succeded with
+gcc-3.3.4-glibc-2.3.2 after applying another patch to binutils-2.15
+(attached).
+All compilations of the different kernel versions I tried stopped with
+"Invalid .insn format" somewhere. I checked the recent cvs version of
+binutils and applied the latest diff to gas/config/tc-s390.c and that solved
+it.
+
+Greetings
+
+Michael Geiger
+
+
+diff -u -r1.39 -r1.40
+--- src/gas/config/tc-s390.c 2004/05/06 11:01:48 1.39
++++ src/gas/config/tc-s390.c 2004/06/15 12:38:08 1.40
+@@ -1596,13 +1596,13 @@
+ if (exp.X_op == O_constant)
+ {
+ if ( ( opformat->oplen == 6
+- && exp.X_add_number >= 0
++ && (addressT) exp.X_add_number >= 0
+ && (addressT) exp.X_add_number < (1ULL << 48))
+ || ( opformat->oplen == 4
+- && exp.X_add_number >= 0
++ && (addressT) exp.X_add_number >= 0
+ && (addressT) exp.X_add_number < (1ULL << 32))
+ || ( opformat->oplen == 2
+- && exp.X_add_number >= 0
++ && (addressT) exp.X_add_number >= 0
+ && (addressT) exp.X_add_number < (1ULL << 16)))
+ md_number_to_chars (insn, exp.X_add_number, opformat->oplen);
+ else
diff --git a/patches/binutils/2.16.1/bfd-hash-tweak.patch b/patches/binutils/2.16.1/bfd-hash-tweak.patch
new file mode 100644
index 0000000..c6de93a
--- /dev/null
+++ b/patches/binutils/2.16.1/bfd-hash-tweak.patch
@@ -0,0 +1,23 @@
+Signed-off-by: dank@kegel.com
+
+Raising the size of the hash table is a noticable win when linking
+at least one large app.
+
+There was a patch,
+http://sources.redhat.com/ml/binutils/2004-06/msg00165.html
+to do this dynamically. No idea why that didn't make it in.
+So this tiny change to raise the default size is just
+a stopgap for now.
+
+
+--- binutils-2.16.1/bfd/hash.c.old 2006-03-02 23:01:39.000000000 -0800
++++ binutils-2.16.1/bfd/hash.c 2006-03-02 23:01:58.000000000 -0800
+@@ -300,7 +300,7 @@
+ */
+
+ /* The default number of entries to use when creating a hash table. */
+-#define DEFAULT_SIZE 4051
++#define DEFAULT_SIZE 32749
+ static size_t bfd_default_hash_table_size = DEFAULT_SIZE;
+
+ /* Create a new hash table, given a number of entries. */
diff --git a/patches/binutils/2.16.1/binutils-2.15-psignal.patch b/patches/binutils/2.16.1/binutils-2.15-psignal.patch
new file mode 100644
index 0000000..98fa600
--- /dev/null
+++ b/patches/binutils/2.16.1/binutils-2.15-psignal.patch
@@ -0,0 +1,40 @@
+Make psignal prototype in libiberty match that in glibc.
+
+Fixes:
+
+gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c: In function `psignal':
+gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c:563: argument `signo' doesn't match prototype
+/usr/include/signal.h:131: prototype declaration
+gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c:563: argument `message' doesn't match prototype
+/usr/include/signal.h:131: prototype declaration
+gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c:568: warning: comparison between signed and unsigned
+mprotect... make[1]: *** [strsignal.o] Error 1
+make[1]: Leaving directory `/export/hda3/dkegel/queue/jobdir.produser_cpsm17/crosstool-0.32/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.1.3/build-binutils/libiberty'
+make: *** [all-libiberty] Error 2
+
+when building on red hat 7.1
+though it's a bit of a mystery why libiberty's psignal is being compiled at
+all, since red hat 7.1's glibc supports psignal (hence the error message)
+
+--- binutils-2.15/libiberty/strsignal.c.old 2005-04-18 13:57:40.000000000 -0700
++++ binutils-2.15/libiberty/strsignal.c 2005-04-18 13:59:09.000000000 -0700
+@@ -544,7 +544,7 @@
+
+ /*
+
+-@deftypefn Supplemental void psignal (unsigned @var{signo}, char *@var{message})
++@deftypefn Supplemental void psignal (int @var{signo}, const char *@var{message})
+
+ Print @var{message} to the standard error, followed by a colon,
+ followed by the description of the signal specified by @var{signo},
+@@ -557,9 +557,7 @@
+ #ifndef HAVE_PSIGNAL
+
+ void
+-psignal (signo, message)
+- unsigned signo;
+- char *message;
++psignal (int signo, const char *message)
+ {
+ if (signal_names == NULL)
+ {
diff --git a/patches/binutils/2.16.1/binutils-skip-comments.patch b/patches/binutils/2.16.1/binutils-skip-comments.patch
new file mode 100644
index 0000000..0ca9a47
--- /dev/null
+++ b/patches/binutils/2.16.1/binutils-skip-comments.patch
@@ -0,0 +1,95 @@
+[removed first hunk so it would apply to 2.16.1 - copyright date already updated - dank]
+
+Retrieved from http://sources.redhat.com/ml/binutils/2004-04/msg00646.html
+Fixes
+localealias.s:544: Error: junk at end of line, first unrecognized character is `,'
+when building glibc-2.3.2 with gcc-3.4.0 and binutils-2.15.90.0.3
+
+Paths adjusted to match crosstool's patcher.
+
+Message-Id: m3n052qw2g.fsf@whitebox.m5r.de
+From: Andreas Schwab <schwab at suse dot de>
+To: Nathan Sidwell <nathan at codesourcery dot com>
+Cc: Ian Lance Taylor <ian at wasabisystems dot com>, binutils at sources dot redhat dot com
+Date: Fri, 23 Apr 2004 22:27:19 +0200
+Subject: Re: demand_empty_rest_of_line and ignore_rest_of_line
+
+Nathan Sidwell <nathan@codesourcery.com> writes:
+
+> Index: read.c
+> ===================================================================
+> RCS file: /cvs/src/src/gas/read.c,v
+> retrieving revision 1.76
+> diff -c -3 -p -r1.76 read.c
+> *** read.c 12 Mar 2004 17:48:12 -0000 1.76
+> --- read.c 18 Mar 2004 09:56:05 -0000
+> *************** read_a_source_file (char *name)
+> *** 1053,1059 ****
+> #endif
+> input_line_pointer--;
+> /* Report unknown char as ignored. */
+> ! ignore_rest_of_line ();
+> }
+>
+> #ifdef md_after_pass_hook
+> --- 1053,1059 ----
+> #endif
+> input_line_pointer--;
+> /* Report unknown char as ignored. */
+> ! demand_empty_rest_of_line ();
+> }
+>
+> #ifdef md_after_pass_hook
+
+This means that the unknown character is no longer ignored, despite the
+comment. As a side effect a line starting with a line comment character
+not followed by APP in NO_APP mode now triggers an error instead of just a
+warning, breaking builds of glibc on m68k-linux. Earlier in
+read_a_source_file where #APP is handled there is another comment that
+claims that unknown comments are ignored, when in fact they aren't (only
+the initial line comment character is skipped).
+
+Note that the presence of #APP will mess up the line counters, but
+that appears to be difficult to fix.
+
+Andreas.
+
+2004-04-23 Andreas Schwab <schwab@suse.de>
+
+ * read.c (read_a_source_file): Ignore unknown text after line
+ comment character. Fix misleading comment.
+
+--- binutils/gas/read.c.~1.78.~ 2004-04-23 08:58:23.000000000 +0200
++++ binutils/gas/read.c 2004-04-23 21:49:01.000000000 +0200
+@@ -950,10 +950,14 @@ read_a_source_file (char *name)
+ unsigned int new_length;
+ char *tmp_buf = 0;
+
+- bump_line_counters ();
+ s = input_line_pointer;
+ if (strncmp (s, "APP\n", 4))
+- continue; /* We ignore it */
++ {
++ /* We ignore it */
++ ignore_rest_of_line ();
++ continue;
++ }
++ bump_line_counters ();
+ s += 4;
+
+ sb_new (&sbuf);
+@@ -1052,7 +1056,7 @@ read_a_source_file (char *name)
+ continue;
+ #endif
+ input_line_pointer--;
+- /* Report unknown char as ignored. */
++ /* Report unknown char as error. */
+ demand_empty_rest_of_line ();
+ }
+
+
+--
+Andreas Schwab, SuSE Labs, schwab@suse.de
+SuSE Linux AG, Maxfeldstra&#xC3;e 5, 90409 N&#xC3;rnberg, Germany
+Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
+"And now for something completely different."
diff --git a/patches/binutils/2.16.1/callahan.patch b/patches/binutils/2.16.1/callahan.patch
new file mode 100644
index 0000000..a39050f
--- /dev/null
+++ b/patches/binutils/2.16.1/callahan.patch
@@ -0,0 +1,693 @@
+Signed-off-by: dank@kegel.com
+Fixes ld speed issue.
+See http://weblogs.mozillazine.org/roc/archives/2005/02/optimizing_gnu.html
+See thread "Re: optimizations for 3x speedup in ld",
+http://sources.redhat.com/ml/binutils/2005-03/msg00847.html
+
+Wildcard section matching enhancement, backported from the binutils CVS tree.
+Here's the CVS log comment from the original change to ldlang.c:
+
+revision 1.177
+date: 2005/04/06 15:33:02; author: jakub; state: Exp; lines: +438 -51
+2005-04-06 Jakub Jelinek <jakub@redhat.com>
+
+ * ldlang.c: Formatting.
+ (walk_wild_consider_section): Remember return value from wildcardp.
+ (is_simple_wild): Use strcspn instead of 2 strpbrk calls and strlen.
+ (wild_spec_can_overlap): Use strcspn instead of strpbrk and strlen.
+
+2005-04-06 Robert O'Callahan <rocallahan@novell.com>
+
+ * ld.h (lean_section_userdata_type): Remove.
+ (fat_section_userdata_type): Remove file field.
+ (SECTION_USERDATA_SIZE): Remove.
+ * ldlang.c (init_os): Eliminate initialization of unused
+ lean_section_userdata_type.
+
+ * ldlang.h (callback_t, walk_wild_section_handler_t): New
+ typedefs.
+ (struct lang_wild_statement_struct): Add walk_wild_section_handler
+ and handler_data fields.
+ * ldlang.c (callback_t): Removed.
+ (walk_wild_consider_section, walk_wild_section_general,
+ section_iterator_callback, find_section, is_simple_wild,
+ match_simple_wild, walk_wild_section_specs1_wild0,
+ walk_wild_section_specs1_wild1, walk_wild_section_specs2_wild1,
+ walk_wild_section_specs3_wild2, walk_wild_section_specs4_wild2,
+ wild_spec_can_overlap, analyze_walk_wild_section_handler): New
+ functions.
+ (lang_add_wild): Call analyze_walk_wild_section_handler.
+ (walk_wild_section): Renamed to walk_wild_section_general and
+ created a wrapper function.
+ (section_iterator_callback_data): New typedef.
+
+
+Index: src/ld/ld.h
+===================================================================
+RCS file: /cvs/src/src/ld/ld.h,v
+retrieving revision 1.26
+retrieving revision 1.27
+diff -u -r1.26 -r1.27
+--- binutils/ld/ld.h.old 16 Mar 2005 21:52:42 -0000 1.26
++++ binutils/ld/ld.h 6 Apr 2005 15:33:02 -0000 1.27
+@@ -1,6 +1,6 @@
+ /* ld.h -- general linker header file
+ Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+- 2001, 2002, 2003, 2004
++ 2001, 2002, 2003, 2004, 2005
+ Free Software Foundation, Inc.
+
+ This file is part of GLD, the Gnu Linker.
+@@ -89,28 +89,15 @@
+ struct map_symbol_def *next;
+ };
+
+-/* Extra information we hold on sections */
+-typedef struct lean_user_section_struct {
+- /* For output sections: pointer to the section where this data will go. */
+- struct lang_input_statement_struct *file;
+-} lean_section_userdata_type;
+-
+ /* The initial part of fat_user_section_struct has to be idential with
+ lean_user_section_struct. */
+ typedef struct fat_user_section_struct {
+- /* For output sections: pointer to the section where this data will go. */
+- struct lang_input_statement_struct *file;
+ /* For input sections, when writing a map file: head / tail of a linked
+ list of hash table entries for symbols defined in this section. */
+ struct map_symbol_def *map_symbol_def_head;
+ struct map_symbol_def **map_symbol_def_tail;
+ } fat_section_userdata_type;
+
+-#define SECTION_USERDATA_SIZE \
+- (command_line.reduce_memory_overheads \
+- ? sizeof (lean_section_userdata_type) \
+- : sizeof (fat_section_userdata_type))
+-
+ #define get_userdata(x) ((x)->userdata)
+
+ #define BYTE_SIZE (1)
+Index: src/ld/ldlang.c
+===================================================================
+RCS file: /cvs/src/src/ld/ldlang.c,v
+retrieving revision 1.176
+retrieving revision 1.177
+diff -u -r1.176 -r1.177
+--- binutils/ld/ldlang.c.old 18 Mar 2005 13:56:26 -0000 1.176
++++ binutils/ld/ldlang.c 6 Apr 2005 15:33:02 -0000 1.177
+@@ -84,9 +84,6 @@
+ static void lang_record_phdrs (void);
+ static void lang_do_version_exports_section (void);
+
+-typedef void (*callback_t) (lang_wild_statement_type *, struct wildcard_list *,
+- asection *, lang_input_statement_type *, void *);
+-
+ /* Exported variables. */
+ lang_output_section_statement_type *abs_output_section;
+ lang_statement_list_type lang_output_section_statement;
+@@ -155,21 +152,71 @@
+
+ /* Generic traversal routines for finding matching sections. */
+
++/* Try processing a section against a wildcard. This just calls
++ the callback unless the filename exclusion list is present
++ and excludes the file. It's hardly ever present so this
++ function is very fast. */
++
++static void
++walk_wild_consider_section (lang_wild_statement_type *ptr,
++ lang_input_statement_type *file,
++ asection *s,
++ struct wildcard_list *sec,
++ callback_t callback,
++ void *data)
++{
++ bfd_boolean skip = FALSE;
++ struct name_list *list_tmp;
++
++ /* Don't process sections from files which were
++ excluded. */
++ for (list_tmp = sec->spec.exclude_name_list;
++ list_tmp;
++ list_tmp = list_tmp->next)
++ {
++ bfd_boolean is_wildcard = wildcardp (list_tmp->name);
++ if (is_wildcard)
++ skip = fnmatch (list_tmp->name, file->filename, 0) == 0;
++ else
++ skip = strcmp (list_tmp->name, file->filename) == 0;
++
++ /* If this file is part of an archive, and the archive is
++ excluded, exclude this file. */
++ if (! skip && file->the_bfd != NULL
++ && file->the_bfd->my_archive != NULL
++ && file->the_bfd->my_archive->filename != NULL)
++ {
++ if (is_wildcard)
++ skip = fnmatch (list_tmp->name,
++ file->the_bfd->my_archive->filename,
++ 0) == 0;
++ else
++ skip = strcmp (list_tmp->name,
++ file->the_bfd->my_archive->filename) == 0;
++ }
++
++ if (skip)
++ break;
++ }
++
++ if (!skip)
++ (*callback) (ptr, sec, s, file, data);
++}
++
++/* Lowest common denominator routine that can handle everything correctly,
++ but slowly. */
++
+ static void
+-walk_wild_section (lang_wild_statement_type *ptr,
+- lang_input_statement_type *file,
+- callback_t callback,
+- void *data)
++walk_wild_section_general (lang_wild_statement_type *ptr,
++ lang_input_statement_type *file,
++ callback_t callback,
++ void *data)
+ {
+ asection *s;
+-
+- if (file->just_syms_flag)
+- return;
++ struct wildcard_list *sec;
+
+ for (s = file->the_bfd->sections; s != NULL; s = s->next)
+ {
+- struct wildcard_list *sec;
+-
+ sec = ptr->section_list;
+ if (sec == NULL)
+ (*callback) (ptr, sec, s, file, data);
+@@ -177,39 +224,8 @@
+ while (sec != NULL)
+ {
+ bfd_boolean skip = FALSE;
+- struct name_list *list_tmp;
+
+- /* Don't process sections from files which were
+- excluded. */
+- for (list_tmp = sec->spec.exclude_name_list;
+- list_tmp;
+- list_tmp = list_tmp->next)
+- {
+- if (wildcardp (list_tmp->name))
+- skip = fnmatch (list_tmp->name, file->filename, 0) == 0;
+- else
+- skip = strcmp (list_tmp->name, file->filename) == 0;
+-
+- /* If this file is part of an archive, and the archive is
+- excluded, exclude this file. */
+- if (! skip && file->the_bfd != NULL
+- && file->the_bfd->my_archive != NULL
+- && file->the_bfd->my_archive->filename != NULL)
+- {
+- if (wildcardp (list_tmp->name))
+- skip = fnmatch (list_tmp->name,
+- file->the_bfd->my_archive->filename,
+- 0) == 0;
+- else
+- skip = strcmp (list_tmp->name,
+- file->the_bfd->my_archive->filename) == 0;
+- }
+-
+- if (skip)
+- break;
+- }
+-
+- if (!skip && sec->spec.name != NULL)
++ if (sec->spec.name != NULL)
+ {
+ const char *sname = bfd_get_section_name (file->the_bfd, s);
+
+@@ -220,13 +236,381 @@
+ }
+
+ if (!skip)
+- (*callback) (ptr, sec, s, file, data);
++ walk_wild_consider_section (ptr, file, s, sec, callback, data);
+
+ sec = sec->next;
+ }
+ }
+ }
+
++/* Routines to find a single section given its name. If there's more
++ than one section with that name, we report that. */
++
++typedef struct
++{
++ asection *found_section;
++ bfd_boolean multiple_sections_found;
++} section_iterator_callback_data;
++
++static bfd_boolean
++section_iterator_callback (bfd *bfd ATTRIBUTE_UNUSED, asection *s, void *data)
++{
++ section_iterator_callback_data *d = data;
++
++ if (d->found_section != NULL)
++ {
++ d->multiple_sections_found = TRUE;
++ return TRUE;
++ }
++
++ d->found_section = s;
++ return FALSE;
++}
++
++static asection *
++find_section (lang_input_statement_type *file,
++ struct wildcard_list *sec,
++ bfd_boolean *multiple_sections_found)
++{
++ section_iterator_callback_data cb_data = { NULL, FALSE };
++
++ bfd_get_section_by_name_if (file->the_bfd, sec->spec.name,
++ section_iterator_callback, &cb_data);
++ *multiple_sections_found = cb_data.multiple_sections_found;
++ return cb_data.found_section;
++}
++
++/* Code for handling simple wildcards without going through fnmatch,
++ which can be expensive because of charset translations etc. */
++
++/* A simple wild is a literal string followed by a single '*',
++ where the literal part is at least 4 characters long. */
++
++static bfd_boolean
++is_simple_wild (const char *name)
++{
++ size_t len = strcspn (name, "*?[");
++ return len >= 4 && name[len] == '*' && name[len + 1] == '\0';
++}
++
++static bfd_boolean
++match_simple_wild (const char *pattern, const char *name)
++{
++ /* The first four characters of the pattern are guaranteed valid
++ non-wildcard characters. So we can go faster. */
++ if (pattern[0] != name[0] || pattern[1] != name[1]
++ || pattern[2] != name[2] || pattern[3] != name[3])
++ return FALSE;
++
++ pattern += 4;
++ name += 4;
++ while (*pattern != '*')
++ if (*name++ != *pattern++)
++ return FALSE;
++
++ return TRUE;
++}
++
++/* Specialized, optimized routines for handling different kinds of
++ wildcards */
++
++static void
++walk_wild_section_specs1_wild0 (lang_wild_statement_type *ptr,
++ lang_input_statement_type *file,
++ callback_t callback,
++ void *data)
++{
++ /* We can just do a hash lookup for the section with the right name.
++ But if that lookup discovers more than one section with the name
++ (should be rare), we fall back to the general algorithm because
++ we would otherwise have to sort the sections to make sure they
++ get processed in the bfd's order. */
++ bfd_boolean multiple_sections_found;
++ struct wildcard_list *sec0 = ptr->handler_data[0];
++ asection *s0 = find_section (file, sec0, &multiple_sections_found);
++
++ if (multiple_sections_found)
++ walk_wild_section_general (ptr, file, callback, data);
++ else if (s0)
++ walk_wild_consider_section (ptr, file, s0, sec0, callback, data);
++}
++
++static void
++walk_wild_section_specs1_wild1 (lang_wild_statement_type *ptr,
++ lang_input_statement_type *file,
++ callback_t callback,
++ void *data)
++{
++ asection *s;
++ struct wildcard_list *wildsec0 = ptr->handler_data[0];
++
++ for (s = file->the_bfd->sections; s != NULL; s = s->next)
++ {
++ const char *sname = bfd_get_section_name (file->the_bfd, s);
++ bfd_boolean skip = !match_simple_wild (wildsec0->spec.name, sname);
++
++ if (!skip)
++ walk_wild_consider_section (ptr, file, s, wildsec0, callback, data);
++ }
++}
++
++static void
++walk_wild_section_specs2_wild1 (lang_wild_statement_type *ptr,
++ lang_input_statement_type *file,
++ callback_t callback,
++ void *data)
++{
++ asection *s;
++ struct wildcard_list *sec0 = ptr->handler_data[0];
++ struct wildcard_list *wildsec1 = ptr->handler_data[1];
++ bfd_boolean multiple_sections_found;
++ asection *s0 = find_section (file, sec0, &multiple_sections_found);
++
++ if (multiple_sections_found)
++ {
++ walk_wild_section_general (ptr, file, callback, data);
++ return;
++ }
++
++ /* Note that if the section was not found, s0 is NULL and
++ we'll simply never succeed the s == s0 test below. */
++ for (s = file->the_bfd->sections; s != NULL; s = s->next)
++ {
++ /* Recall that in this code path, a section cannot satisfy more
++ than one spec, so if s == s0 then it cannot match
++ wildspec1. */
++ if (s == s0)
++ walk_wild_consider_section (ptr, file, s, sec0, callback, data);
++ else
++ {
++ const char *sname = bfd_get_section_name (file->the_bfd, s);
++ bfd_boolean skip = !match_simple_wild (wildsec1->spec.name, sname);
++
++ if (!skip)
++ walk_wild_consider_section (ptr, file, s, wildsec1, callback,
++ data);
++ }
++ }
++}
++
++static void
++walk_wild_section_specs3_wild2 (lang_wild_statement_type *ptr,
++ lang_input_statement_type *file,
++ callback_t callback,
++ void *data)
++{
++ asection *s;
++ struct wildcard_list *sec0 = ptr->handler_data[0];
++ struct wildcard_list *wildsec1 = ptr->handler_data[1];
++ struct wildcard_list *wildsec2 = ptr->handler_data[2];
++ bfd_boolean multiple_sections_found;
++ asection *s0 = find_section (file, sec0, &multiple_sections_found);
++
++ if (multiple_sections_found)
++ {
++ walk_wild_section_general (ptr, file, callback, data);
++ return;
++ }
++
++ for (s = file->the_bfd->sections; s != NULL; s = s->next)
++ {
++ if (s == s0)
++ walk_wild_consider_section (ptr, file, s, sec0, callback, data);
++ else
++ {
++ const char *sname = bfd_get_section_name (file->the_bfd, s);
++ bfd_boolean skip = !match_simple_wild (wildsec1->spec.name, sname);
++
++ if (!skip)
++ walk_wild_consider_section (ptr, file, s, wildsec1, callback, data);
++ else
++ {
++ skip = !match_simple_wild (wildsec2->spec.name, sname);
++ if (!skip)
++ walk_wild_consider_section (ptr, file, s, wildsec2, callback,
++ data);
++ }
++ }
++ }
++}
++
++static void
++walk_wild_section_specs4_wild2 (lang_wild_statement_type *ptr,
++ lang_input_statement_type *file,
++ callback_t callback,
++ void *data)
++{
++ asection *s;
++ struct wildcard_list *sec0 = ptr->handler_data[0];
++ struct wildcard_list *sec1 = ptr->handler_data[1];
++ struct wildcard_list *wildsec2 = ptr->handler_data[2];
++ struct wildcard_list *wildsec3 = ptr->handler_data[3];
++ bfd_boolean multiple_sections_found;
++ asection *s0 = find_section (file, sec0, &multiple_sections_found), *s1;
++
++ if (multiple_sections_found)
++ {
++ walk_wild_section_general (ptr, file, callback, data);
++ return;
++ }
++
++ s1 = find_section (file, sec1, &multiple_sections_found);
++ if (multiple_sections_found)
++ {
++ walk_wild_section_general (ptr, file, callback, data);
++ return;
++ }
++
++ for (s = file->the_bfd->sections; s != NULL; s = s->next)
++ {
++ if (s == s0)
++ walk_wild_consider_section (ptr, file, s, sec0, callback, data);
++ else
++ if (s == s1)
++ walk_wild_consider_section (ptr, file, s, sec1, callback, data);
++ else
++ {
++ const char *sname = bfd_get_section_name (file->the_bfd, s);
++ bfd_boolean skip = !match_simple_wild (wildsec2->spec.name,
++ sname);
++
++ if (!skip)
++ walk_wild_consider_section (ptr, file, s, wildsec2, callback,
++ data);
++ else
++ {
++ skip = !match_simple_wild (wildsec3->spec.name, sname);
++ if (!skip)
++ walk_wild_consider_section (ptr, file, s, wildsec3,
++ callback, data);
++ }
++ }
++ }
++}
++
++static void
++walk_wild_section (lang_wild_statement_type *ptr,
++ lang_input_statement_type *file,
++ callback_t callback,
++ void *data)
++{
++ if (file->just_syms_flag)
++ return;
++
++ (*ptr->walk_wild_section_handler) (ptr, file, callback, data);
++}
++
++/* Returns TRUE when name1 is a wildcard spec that might match
++ something name2 can match. We're conservative: we return FALSE
++ only if the prefixes of name1 and name2 are different up to the
++ first wildcard character. */
++
++static bfd_boolean
++wild_spec_can_overlap (const char *name1, const char *name2)
++{
++ size_t prefix1_len = strcspn (name1, "?*[");
++ size_t prefix2_len = strcspn (name2, "?*[");
++ size_t min_prefix_len;
++
++ /* Note that if there is no wildcard character, then we treat the
++ terminating 0 as part of the prefix. Thus ".text" won't match
++ ".text." or ".text.*", for example. */
++ if (name1[prefix1_len] == '\0')
++ prefix1_len++;
++ if (name2[prefix2_len] == '\0')
++ prefix2_len++;
++
++ min_prefix_len = prefix1_len < prefix2_len ? prefix1_len : prefix2_len;
++
++ return memcmp (name1, name2, min_prefix_len) == 0;
++}
++
++/* Select specialized code to handle various kinds of wildcard
++ statements. */
++
++static void
++analyze_walk_wild_section_handler (lang_wild_statement_type *ptr)
++{
++ int sec_count = 0;
++ int wild_name_count = 0;
++ struct wildcard_list *sec;
++ int signature;
++ int data_counter;
++
++ ptr->walk_wild_section_handler = walk_wild_section_general;
++
++ /* Count how many wildcard_specs there are, and how many of those
++ actually use wildcards in the name. Also, bail out if any of the
++ wildcard names are NULL. (Can this actually happen?
++ walk_wild_section used to test for it.) And bail out if any
++ of the wildcards are more complex than a simple string
++ ending in a single '*'. */
++ for (sec = ptr->section_list; sec != NULL; sec = sec->next)
++ {
++ ++sec_count;
++ if (sec->spec.name == NULL)
++ return;
++ if (wildcardp (sec->spec.name))
++ {
++ ++wild_name_count;
++ if (!is_simple_wild (sec->spec.name))
++ return;
++ }
++ }
++
++ /* The zero-spec case would be easy to optimize but it doesn't
++ happen in practice. Likewise, more than 4 specs doesn't
++ happen in practice. */
++ if (sec_count == 0 || sec_count > 4)
++ return;
++
++ /* Check that no two specs can match the same section. */
++ for (sec = ptr->section_list; sec != NULL; sec = sec->next)
++ {
++ struct wildcard_list *sec2;
++ for (sec2 = sec->next; sec2 != NULL; sec2 = sec2->next)
++ {
++ if (wild_spec_can_overlap (sec->spec.name, sec2->spec.name))
++ return;
++ }
++ }
++
++ signature = (sec_count << 8) + wild_name_count;
++ switch (signature)
++ {
++ case 0x0100:
++ ptr->walk_wild_section_handler = walk_wild_section_specs1_wild0;
++ break;
++ case 0x0101:
++ ptr->walk_wild_section_handler = walk_wild_section_specs1_wild1;
++ break;
++ case 0x0201:
++ ptr->walk_wild_section_handler = walk_wild_section_specs2_wild1;
++ break;
++ case 0x0302:
++ ptr->walk_wild_section_handler = walk_wild_section_specs3_wild2;
++ break;
++ case 0x0402:
++ ptr->walk_wild_section_handler = walk_wild_section_specs4_wild2;
++ break;
++ default:
++ return;
++ }
++
++ /* Now fill the data array with pointers to the specs, first the
++ specs with non-wildcard names, then the specs with wildcard
++ names. It's OK to process the specs in different order from the
++ given order, because we've already determined that no section
++ will match more than one spec. */
++ data_counter = 0;
++ for (sec = ptr->section_list; sec != NULL; sec = sec->next)
++ if (!wildcardp (sec->spec.name))
++ ptr->handler_data[data_counter++] = sec;
++ for (sec = ptr->section_list; sec != NULL; sec = sec->next)
++ if (wildcardp (sec->spec.name))
++ ptr->handler_data[data_counter++] = sec;
++}
++
+ /* Handle a wild statement for a single file F. */
+
+ static void
+@@ -1175,17 +1559,12 @@
+ static void
+ init_os (lang_output_section_statement_type *s)
+ {
+- lean_section_userdata_type *new;
+-
+ if (s->bfd_section != NULL)
+ return;
+
+ if (strcmp (s->name, DISCARD_SECTION_NAME) == 0)
+ einfo (_("%P%F: Illegal use of `%s' section\n"), DISCARD_SECTION_NAME);
+
+- new = stat_alloc (SECTION_USERDATA_SIZE);
+- memset (new, 0, SECTION_USERDATA_SIZE);
+-
+ s->bfd_section = bfd_get_section_by_name (output_bfd, s->name);
+ if (s->bfd_section == NULL)
+ s->bfd_section = bfd_make_section (output_bfd, s->name);
+@@ -1199,7 +1578,14 @@
+ /* We initialize an output sections output offset to minus its own
+ vma to allow us to output a section through itself. */
+ s->bfd_section->output_offset = 0;
+- get_userdata (s->bfd_section) = new;
++ if (!command_line.reduce_memory_overheads)
++ {
++ fat_section_userdata_type *new
++ = stat_alloc (sizeof (fat_section_userdata_type));
++ memset (new, 0, sizeof (fat_section_userdata_type));
++ get_userdata (s->bfd_section) = new;
++ }
++
+
+ /* If there is a base address, make sure that any sections it might
+ mention are initialized. */
+@@ -4939,6 +5325,7 @@
+ new->section_list = section_list;
+ new->keep_sections = keep_sections;
+ lang_list_init (&new->children);
++ analyze_walk_wild_section_handler (new);
+ }
+
+ void
+Index: src/ld/ldlang.h
+===================================================================
+RCS file: /cvs/src/src/ld/ldlang.h,v
+retrieving revision 1.44
+retrieving revision 1.45
+diff -u -r1.44 -r1.45
+--- binutils/ld/ldlang.h.old 3 Mar 2005 11:51:58 -0000 1.44
++++ binutils/ld/ldlang.h 6 Apr 2005 15:33:03 -0000 1.45
+@@ -298,7 +298,17 @@
+ union lang_statement_union *file;
+ } lang_afile_asection_pair_statement_type;
+
+-typedef struct lang_wild_statement_struct
++typedef struct lang_wild_statement_struct lang_wild_statement_type;
++
++typedef void (*callback_t) (lang_wild_statement_type *, struct wildcard_list *,
++ asection *, lang_input_statement_type *, void *);
++
++typedef void (*walk_wild_section_handler_t) (lang_wild_statement_type *,
++ lang_input_statement_type *,
++ callback_t callback,
++ void *data);
++
++struct lang_wild_statement_struct
+ {
+ lang_statement_header_type header;
+ const char *filename;
+@@ -306,7 +316,10 @@
+ struct wildcard_list *section_list;
+ bfd_boolean keep_sections;
+ lang_statement_list_type children;
+-} lang_wild_statement_type;
++
++ walk_wild_section_handler_t walk_wild_section_handler;
++ struct wildcard_list *handler_data[4];
++};
+
+ typedef struct lang_address_statement_struct
+ {
diff --git a/patches/binutils/2.16.1/cross-gprof.patch b/patches/binutils/2.16.1/cross-gprof.patch
new file mode 100644
index 0000000..ea6c18f
--- /dev/null
+++ b/patches/binutils/2.16.1/cross-gprof.patch
@@ -0,0 +1,22 @@
+--- binutils-2.15/configure.old 2004-07-21 21:36:47.000000000 -0700
++++ binutils-2.15/configure 2004-07-21 21:37:08.000000000 -0700
+@@ -999,7 +999,7 @@
+
+ # Some tools are only suitable for building in a "native" situation.
+ # Remove these if host!=target.
+-native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf"
++native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf"
+
+ # Similarly, some are only suitable for cross toolchains.
+ # Remove these if host=target.
+--- binutils-2.15/configure.in.old 2004-07-21 21:37:19.000000000 -0700
++++ binutils-2.15/configure.in 2004-07-21 21:37:34.000000000 -0700
+@@ -236,7 +236,7 @@
+
+ # Some tools are only suitable for building in a "native" situation.
+ # Remove these if host!=target.
+-native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf"
++native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf"
+
+ # Similarly, some are only suitable for cross toolchains.
+ # Remove these if host=target.
diff --git a/patches/binutils/2.16.1/stabs-tweak.patch b/patches/binutils/2.16.1/stabs-tweak.patch
new file mode 100644
index 0000000..86e3611
--- /dev/null
+++ b/patches/binutils/2.16.1/stabs-tweak.patch
@@ -0,0 +1,28 @@
+Signed-off-by: dank@kegel.com
+
+See http://sourceware.org/ml/binutils/2005-12/msg00270.html
+http://sourceware.org/ml/binutils-cvs/2005-12/msg00139.html
+
+STABS hash table size change, backported from the binutils CVS tree. Here's
+the CVS log comment for the original change:
+
+revision 1.25
+date: 2005/12/29 10:29:23; author: nickc; state: Exp; lines: +2 -3
+(_bfd_link_section_stabs): Use bfd_hash_table_init rather than
+bfd_hash_table_init_n(...,251) so that the size of the hash table can be
+controlled by the user.
+
+--- binutils/bfd/stabs.c.old 4 May 2005 15:53:39 -0000 1.24
++++ binutils/bfd/stabs.c 29 Dec 2005 10:29:23 -0000 1.25
+@@ -194,9 +194,8 @@
+ goto error_return;
+ /* Make sure the first byte is zero. */
+ (void) _bfd_stringtab_add (sinfo->strings, "", TRUE, TRUE);
+- if (! bfd_hash_table_init_n (&sinfo->includes,
+- stab_link_includes_newfunc,
+- 251))
++ if (! bfd_hash_table_init (&sinfo->includes,
++ stab_link_includes_newfunc))
+ goto error_return;
+ sinfo->stabstr = bfd_make_section_anyway (abfd, ".stabstr");
+ if (sinfo->stabstr == NULL)
diff --git a/patches/binutils/2.17.50.0.10/100-uclibc-conf.patch b/patches/binutils/2.17.50.0.10/100-uclibc-conf.patch
new file mode 100644
index 0000000..25222e5
--- /dev/null
+++ b/patches/binutils/2.17.50.0.10/100-uclibc-conf.patch
@@ -0,0 +1,139 @@
+--- binutils-2.16.91.0.7/bfd/configure
++++ binutils-2.16.91.0.7/bfd/configure
+@@ -3576,7 +3576,7 @@
+ ;;
+
+ # This must be Linux ELF.
+-linux-gnu*)
++linux-gnu*|linux-uclibc*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+--- binutils-2.16.91.0.7/binutils/configure
++++ binutils-2.16.91.0.7/binutils/configure
+@@ -3411,7 +3411,7 @@
+ ;;
+
+ # This must be Linux ELF.
+-linux-gnu*)
++linux-gnu*|linux-uclibc*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+--- binutils-2.16.91.0.7/configure
++++ binutils-2.16.91.0.7/configure
+@@ -1270,7 +1270,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)
+@@ -1578,7 +1578,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
+--- binutils-2.16.91.0.7/configure.in
++++ binutils-2.16.91.0.7/configure.in
+@@ -468,7 +468,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)
+@@ -776,7 +776,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
+--- binutils-2.16.91.0.7/gas/configure
++++ binutils-2.16.91.0.7/gas/configure
+@@ -3411,7 +3411,7 @@
+ ;;
+
+ # This must be Linux ELF.
+-linux-gnu*)
++linux-gnu*|linux-uclibc*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+--- binutils-2.16.91.0.7/gprof/configure
++++ binutils-2.16.91.0.7/gprof/configure
+@@ -3419,6 +3419,11 @@
+ lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
++ ;;
++
+ netbsd* | knetbsd*-gnu)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
+--- binutils-2.16.91.0.7/ld/configure
++++ binutils-2.16.91.0.7/ld/configure
+@@ -3413,7 +3413,7 @@
+ ;;
+
+ # This must be Linux ELF.
+-linux-gnu*)
++linux-gnu*|linux-uclibc*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+--- binutils-2.16.91.0.7/libtool.m4
++++ binutils-2.16.91.0.7/libtool.m4
+@@ -739,7 +739,7 @@
+ ;;
+
+ # This must be Linux ELF.
+-linux-gnu*)
++linux-gnu*|linux-uclibc*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+--- binutils-2.16.91.0.7/ltconfig
++++ binutils-2.16.91.0.7/ltconfig
+@@ -602,6 +602,7 @@
+
+ # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+ case $host_os in
++linux-uclibc*) ;;
+ linux-gnu*) ;;
+ linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+ esac
+@@ -1247,7 +1248,7 @@
+ ;;
+
+ # This must be Linux ELF.
+-linux-gnu*)
++linux-gnu*|linux-uclibc*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+--- binutils-2.16.91.0.7/opcodes/configure
++++ binutils-2.16.91.0.7/opcodes/configure
+@@ -3579,7 +3579,7 @@
+ ;;
+
+ # This must be Linux ELF.
+-linux-gnu*)
++linux-gnu*|linux-uclibc*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
diff --git a/patches/binutils/2.17.50.0.10/110-arm-eabi-conf.patch b/patches/binutils/2.17.50.0.10/110-arm-eabi-conf.patch
new file mode 100644
index 0000000..be85ceb
--- /dev/null
+++ b/patches/binutils/2.17.50.0.10/110-arm-eabi-conf.patch
@@ -0,0 +1,24 @@
+diff -urN binutils-2.16.91.0.7.orig/configure binutils-2.16.91.0.7/configure
+--- binutils-2.16.91.0.7.orig/configure 2006-05-31 14:54:24.000000000 +0300
++++ binutils-2.16.91.0.7/configure 2006-05-31 14:55:53.000000000 +0300
+@@ -1299,7 +1299,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"
+ ;;
+diff -urN binutils-2.16.91.0.7.orig/configure.in binutils-2.16.91.0.7/configure.in
+--- binutils-2.16.91.0.7.orig/configure.in 2006-05-31 14:54:24.000000000 +0300
++++ binutils-2.16.91.0.7/configure.in 2006-05-31 14:55:53.000000000 +0300
+@@ -497,7 +497,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"
+ ;;
diff --git a/patches/binutils/2.17.50.0.10/300-001_ld_makefile_patch.patch b/patches/binutils/2.17.50.0.10/300-001_ld_makefile_patch.patch
new file mode 100644
index 0000000..04a7e61
--- /dev/null
+++ b/patches/binutils/2.17.50.0.10/300-001_ld_makefile_patch.patch
@@ -0,0 +1,50 @@
+#!/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@
+--- binutils-2.16.91.0.1/ld/Makefile.am
++++ binutils-2.16.91.0.1/ld/Makefile.am
+@@ -20,7 +20,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@
+--- binutils-2.16.91.0.1/ld/Makefile.in
++++ binutils-2.16.91.0.1/ld/Makefile.in
+@@ -268,7 +268,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/patches/binutils/2.17.50.0.10/300-012_check_ldrunpath_length.patch b/patches/binutils/2.17.50.0.10/300-012_check_ldrunpath_length.patch
new file mode 100644
index 0000000..498651a
--- /dev/null
+++ b/patches/binutils/2.17.50.0.10/300-012_check_ldrunpath_length.patch
@@ -0,0 +1,47 @@
+#!/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@
+diff -urNad /home/james/debian/packages/binutils/new/binutils-2.15/ld/emultempl/elf32.em binutils-2.15/ld/emultempl/elf32.em
+--- /home/james/debian/packages/binutils/new/binutils-2.15/ld/emultempl/elf32.em 2004-05-21 23:12:58.000000000 +0100
++++ binutils-2.15/ld/emultempl/elf32.em 2004-05-21 23:12:59.000000000 +0100
+@@ -692,6 +692,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;
+@@ -871,6 +873,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/patches/binutils/2.17.50.0.8/100-uclibc-conf.patch b/patches/binutils/2.17.50.0.8/100-uclibc-conf.patch
new file mode 100644
index 0000000..25222e5
--- /dev/null
+++ b/patches/binutils/2.17.50.0.8/100-uclibc-conf.patch
@@ -0,0 +1,139 @@
+--- binutils-2.16.91.0.7/bfd/configure
++++ binutils-2.16.91.0.7/bfd/configure
+@@ -3576,7 +3576,7 @@
+ ;;
+
+ # This must be Linux ELF.
+-linux-gnu*)
++linux-gnu*|linux-uclibc*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+--- binutils-2.16.91.0.7/binutils/configure
++++ binutils-2.16.91.0.7/binutils/configure
+@@ -3411,7 +3411,7 @@
+ ;;
+
+ # This must be Linux ELF.
+-linux-gnu*)
++linux-gnu*|linux-uclibc*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+--- binutils-2.16.91.0.7/configure
++++ binutils-2.16.91.0.7/configure
+@@ -1270,7 +1270,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)
+@@ -1578,7 +1578,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
+--- binutils-2.16.91.0.7/configure.in
++++ binutils-2.16.91.0.7/configure.in
+@@ -468,7 +468,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)
+@@ -776,7 +776,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
+--- binutils-2.16.91.0.7/gas/configure
++++ binutils-2.16.91.0.7/gas/configure
+@@ -3411,7 +3411,7 @@
+ ;;
+
+ # This must be Linux ELF.
+-linux-gnu*)
++linux-gnu*|linux-uclibc*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+--- binutils-2.16.91.0.7/gprof/configure
++++ binutils-2.16.91.0.7/gprof/configure
+@@ -3419,6 +3419,11 @@
+ lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
++ ;;
++
+ netbsd* | knetbsd*-gnu)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
+--- binutils-2.16.91.0.7/ld/configure
++++ binutils-2.16.91.0.7/ld/configure
+@@ -3413,7 +3413,7 @@
+ ;;
+
+ # This must be Linux ELF.
+-linux-gnu*)
++linux-gnu*|linux-uclibc*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+--- binutils-2.16.91.0.7/libtool.m4
++++ binutils-2.16.91.0.7/libtool.m4
+@@ -739,7 +739,7 @@
+ ;;
+
+ # This must be Linux ELF.
+-linux-gnu*)
++linux-gnu*|linux-uclibc*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+--- binutils-2.16.91.0.7/ltconfig
++++ binutils-2.16.91.0.7/ltconfig
+@@ -602,6 +602,7 @@
+
+ # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+ case $host_os in
++linux-uclibc*) ;;
+ linux-gnu*) ;;
+ linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+ esac
+@@ -1247,7 +1248,7 @@
+ ;;
+
+ # This must be Linux ELF.
+-linux-gnu*)
++linux-gnu*|linux-uclibc*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+--- binutils-2.16.91.0.7/opcodes/configure
++++ binutils-2.16.91.0.7/opcodes/configure
+@@ -3579,7 +3579,7 @@
+ ;;
+
+ # This must be Linux ELF.
+-linux-gnu*)
++linux-gnu*|linux-uclibc*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
diff --git a/patches/binutils/2.17.50.0.8/110-arm-eabi-conf.patch b/patches/binutils/2.17.50.0.8/110-arm-eabi-conf.patch
new file mode 100644
index 0000000..be85ceb
--- /dev/null
+++ b/patches/binutils/2.17.50.0.8/110-arm-eabi-conf.patch
@@ -0,0 +1,24 @@
+diff -urN binutils-2.16.91.0.7.orig/configure binutils-2.16.91.0.7/configure
+--- binutils-2.16.91.0.7.orig/configure 2006-05-31 14:54:24.000000000 +0300
++++ binutils-2.16.91.0.7/configure 2006-05-31 14:55:53.000000000 +0300
+@@ -1299,7 +1299,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"
+ ;;
+diff -urN binutils-2.16.91.0.7.orig/configure.in binutils-2.16.91.0.7/configure.in
+--- binutils-2.16.91.0.7.orig/configure.in 2006-05-31 14:54:24.000000000 +0300
++++ binutils-2.16.91.0.7/configure.in 2006-05-31 14:55:53.000000000 +0300
+@@ -497,7 +497,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"
+ ;;
diff --git a/patches/binutils/2.17.50.0.8/300-001_ld_makefile_patch.patch b/patches/binutils/2.17.50.0.8/300-001_ld_makefile_patch.patch
new file mode 100644
index 0000000..04a7e61
--- /dev/null
+++ b/patches/binutils/2.17.50.0.8/300-001_ld_makefile_patch.patch
@@ -0,0 +1,50 @@
+#!/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@
+--- binutils-2.16.91.0.1/ld/Makefile.am
++++ binutils-2.16.91.0.1/ld/Makefile.am
+@@ -20,7 +20,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@
+--- binutils-2.16.91.0.1/ld/Makefile.in
++++ binutils-2.16.91.0.1/ld/Makefile.in
+@@ -268,7 +268,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/patches/binutils/2.17.50.0.8/300-012_check_ldrunpath_length.patch b/patches/binutils/2.17.50.0.8/300-012_check_ldrunpath_length.patch
new file mode 100644
index 0000000..498651a
--- /dev/null
+++ b/patches/binutils/2.17.50.0.8/300-012_check_ldrunpath_length.patch
@@ -0,0 +1,47 @@
+#!/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@
+diff -urNad /home/james/debian/packages/binutils/new/binutils-2.15/ld/emultempl/elf32.em binutils-2.15/ld/emultempl/elf32.em
+--- /home/james/debian/packages/binutils/new/binutils-2.15/ld/emultempl/elf32.em 2004-05-21 23:12:58.000000000 +0100
++++ binutils-2.15/ld/emultempl/elf32.em 2004-05-21 23:12:59.000000000 +0100
+@@ -692,6 +692,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;
+@@ -871,6 +873,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/patches/binutils/2.17.50.0.9/100-uclibc-conf.patch b/patches/binutils/2.17.50.0.9/100-uclibc-conf.patch
new file mode 100644
index 0000000..25222e5
--- /dev/null
+++ b/patches/binutils/2.17.50.0.9/100-uclibc-conf.patch
@@ -0,0 +1,139 @@
+--- binutils-2.16.91.0.7/bfd/configure
++++ binutils-2.16.91.0.7/bfd/configure
+@@ -3576,7 +3576,7 @@
+ ;;
+
+ # This must be Linux ELF.
+-linux-gnu*)
++linux-gnu*|linux-uclibc*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+--- binutils-2.16.91.0.7/binutils/configure
++++ binutils-2.16.91.0.7/binutils/configure
+@@ -3411,7 +3411,7 @@
+ ;;
+
+ # This must be Linux ELF.
+-linux-gnu*)
++linux-gnu*|linux-uclibc*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+--- binutils-2.16.91.0.7/configure
++++ binutils-2.16.91.0.7/configure
+@@ -1270,7 +1270,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)
+@@ -1578,7 +1578,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
+--- binutils-2.16.91.0.7/configure.in
++++ binutils-2.16.91.0.7/configure.in
+@@ -468,7 +468,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)
+@@ -776,7 +776,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
+--- binutils-2.16.91.0.7/gas/configure
++++ binutils-2.16.91.0.7/gas/configure
+@@ -3411,7 +3411,7 @@
+ ;;
+
+ # This must be Linux ELF.
+-linux-gnu*)
++linux-gnu*|linux-uclibc*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+--- binutils-2.16.91.0.7/gprof/configure
++++ binutils-2.16.91.0.7/gprof/configure
+@@ -3419,6 +3419,11 @@
+ lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
++ ;;
++
+ netbsd* | knetbsd*-gnu)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
+--- binutils-2.16.91.0.7/ld/configure
++++ binutils-2.16.91.0.7/ld/configure
+@@ -3413,7 +3413,7 @@
+ ;;
+
+ # This must be Linux ELF.
+-linux-gnu*)
++linux-gnu*|linux-uclibc*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+--- binutils-2.16.91.0.7/libtool.m4
++++ binutils-2.16.91.0.7/libtool.m4
+@@ -739,7 +739,7 @@
+ ;;
+
+ # This must be Linux ELF.
+-linux-gnu*)
++linux-gnu*|linux-uclibc*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+--- binutils-2.16.91.0.7/ltconfig
++++ binutils-2.16.91.0.7/ltconfig
+@@ -602,6 +602,7 @@
+
+ # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+ case $host_os in
++linux-uclibc*) ;;
+ linux-gnu*) ;;
+ linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+ esac
+@@ -1247,7 +1248,7 @@
+ ;;
+
+ # This must be Linux ELF.
+-linux-gnu*)
++linux-gnu*|linux-uclibc*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+--- binutils-2.16.91.0.7/opcodes/configure
++++ binutils-2.16.91.0.7/opcodes/configure
+@@ -3579,7 +3579,7 @@
+ ;;
+
+ # This must be Linux ELF.
+-linux-gnu*)
++linux-gnu*|linux-uclibc*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
diff --git a/patches/binutils/2.17.50.0.9/110-arm-eabi-conf.patch b/patches/binutils/2.17.50.0.9/110-arm-eabi-conf.patch
new file mode 100644
index 0000000..be85ceb
--- /dev/null
+++ b/patches/binutils/2.17.50.0.9/110-arm-eabi-conf.patch
@@ -0,0 +1,24 @@
+diff -urN binutils-2.16.91.0.7.orig/configure binutils-2.16.91.0.7/configure
+--- binutils-2.16.91.0.7.orig/configure 2006-05-31 14:54:24.000000000 +0300
++++ binutils-2.16.91.0.7/configure 2006-05-31 14:55:53.000000000 +0300
+@@ -1299,7 +1299,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"
+ ;;
+diff -urN binutils-2.16.91.0.7.orig/configure.in binutils-2.16.91.0.7/configure.in
+--- binutils-2.16.91.0.7.orig/configure.in 2006-05-31 14:54:24.000000000 +0300
++++ binutils-2.16.91.0.7/configure.in 2006-05-31 14:55:53.000000000 +0300
+@@ -497,7 +497,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"
+ ;;
diff --git a/patches/binutils/2.17.50.0.9/300-001_ld_makefile_patch.patch b/patches/binutils/2.17.50.0.9/300-001_ld_makefile_patch.patch
new file mode 100644
index 0000000..04a7e61
--- /dev/null
+++ b/patches/binutils/2.17.50.0.9/300-001_ld_makefile_patch.patch
@@ -0,0 +1,50 @@
+#!/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@
+--- binutils-2.16.91.0.1/ld/Makefile.am
++++ binutils-2.16.91.0.1/ld/Makefile.am
+@@ -20,7 +20,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@
+--- binutils-2.16.91.0.1/ld/Makefile.in
++++ binutils-2.16.91.0.1/ld/Makefile.in
+@@ -268,7 +268,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/patches/binutils/2.17.50.0.9/300-012_check_ldrunpath_length.patch b/patches/binutils/2.17.50.0.9/300-012_check_ldrunpath_length.patch
new file mode 100644
index 0000000..498651a
--- /dev/null
+++ b/patches/binutils/2.17.50.0.9/300-012_check_ldrunpath_length.patch
@@ -0,0 +1,47 @@
+#!/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@
+diff -urNad /home/james/debian/packages/binutils/new/binutils-2.15/ld/emultempl/elf32.em binutils-2.15/ld/emultempl/elf32.em
+--- /home/james/debian/packages/binutils/new/binutils-2.15/ld/emultempl/elf32.em 2004-05-21 23:12:58.000000000 +0100
++++ binutils-2.15/ld/emultempl/elf32.em 2004-05-21 23:12:59.000000000 +0100
+@@ -692,6 +692,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;
+@@ -871,6 +873,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,