# HG changeset patch # User "Yann E. MORIN" # Date 1217276268 0 # Node ID e445c00d134dc90f15fed72192c49966af707cff # Parent 4bf8448536d5ede8e812a6697fa7523884642486 REname binutils patches to not include 'binutils' nor the version in the patch names. diff -r 4bf8448536d5 -r e445c00d134d patches/binutils/2.14/100-binutils-sh-relocs.patch --- a/patches/binutils/2.14/100-binutils-sh-relocs.patch Mon Jul 28 20:10:34 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -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 - -Dan Kegel 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 -r 4bf8448536d5 -r e445c00d134d patches/binutils/2.14/100-sh-relocs.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/binutils/2.14/100-sh-relocs.patch Mon Jul 28 20:17:48 2008 +0000 @@ -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 + +Dan Kegel 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 -r 4bf8448536d5 -r e445c00d134d patches/binutils/2.15/710-allow-gcc-4.0.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/binutils/2.15/710-allow-gcc-4.0.patch Mon Jul 28 20:17:48 2008 +0000 @@ -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 -r 4bf8448536d5 -r e445c00d134d patches/binutils/2.15/710-binutils-2.15-allow-gcc-4.0.patch --- a/patches/binutils/2.15/710-binutils-2.15-allow-gcc-4.0.patch Mon Jul 28 20:10:34 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -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 -r 4bf8448536d5 -r e445c00d134d patches/binutils/2.15/720-binutils-2.15-psignal.patch --- a/patches/binutils/2.15/720-binutils-2.15-psignal.patch Mon Jul 28 20:10:34 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -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 -r 4bf8448536d5 -r e445c00d134d patches/binutils/2.15/720-psignal.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/binutils/2.15/720-psignal.patch Mon Jul 28 20:17:48 2008 +0000 @@ -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 -r 4bf8448536d5 -r e445c00d134d patches/binutils/2.15/730-binutils-2.15-solaris-qsort.patch --- a/patches/binutils/2.15/730-binutils-2.15-solaris-qsort.patch Mon Jul 28 20:10:34 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -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 -r 4bf8448536d5 -r e445c00d134d patches/binutils/2.15/730-solaris-qsort.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/binutils/2.15/730-solaris-qsort.patch Mon Jul 28 20:17:48 2008 +0000 @@ -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 -r 4bf8448536d5 -r e445c00d134d patches/binutils/2.15/740-binutils-2.15-vmx.patch --- a/patches/binutils/2.15/740-binutils-2.15-vmx.patch Mon Jul 28 20:10:34 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -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 -r 4bf8448536d5 -r e445c00d134d patches/binutils/2.15/740-vmx.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/binutils/2.15/740-vmx.patch Mon Jul 28 20:17:48 2008 +0000 @@ -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 -r 4bf8448536d5 -r e445c00d134d patches/binutils/2.15/750-arm-undef-imm.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/binutils/2.15/750-arm-undef-imm.patch Mon Jul 28 20:17:48 2008 +0000 @@ -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 -r 4bf8448536d5 -r e445c00d134d patches/binutils/2.15/750-binutils-arm-undef-imm.patch --- a/patches/binutils/2.15/750-binutils-arm-undef-imm.patch Mon Jul 28 20:10:34 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -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 -r 4bf8448536d5 -r e445c00d134d patches/binutils/2.15/760-binutils-skip-comments.patch --- a/patches/binutils/2.15/760-binutils-skip-comments.patch Mon Jul 28 20:10:34 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,101 +0,0 @@ -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 -To: Nathan Sidwell -Cc: Ian Lance Taylor , 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 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 - - * 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Ãe 5, 90409 NÃrnberg, Germany -Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 -"And now for something completely different." diff -r 4bf8448536d5 -r e445c00d134d patches/binutils/2.15/760-skip-comments.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/binutils/2.15/760-skip-comments.patch Mon Jul 28 20:17:48 2008 +0000 @@ -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 +To: Nathan Sidwell +Cc: Ian Lance Taylor , 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 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 + + * 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Ãe 5, 90409 NÃrnberg, Germany +Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 +"And now for something completely different." diff -r 4bf8448536d5 -r e445c00d134d patches/binutils/2.15/790-ld-2.15-callahan.patch --- a/patches/binutils/2.15/790-ld-2.15-callahan.patch Mon Jul 28 20:10:34 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,677 +0,0 @@ -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 - - * 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 - - * 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 <>. -+ -+*/ -+ -+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 -r 4bf8448536d5 -r e445c00d134d patches/binutils/2.15/790-ld-callahan.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/binutils/2.15/790-ld-callahan.patch Mon Jul 28 20:17:48 2008 +0000 @@ -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 + + * 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 + + * 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 <>. ++ ++*/ ++ ++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 -r 4bf8448536d5 -r e445c00d134d patches/binutils/2.15/800-ld-2.15-stabs-tweak.patch --- a/patches/binutils/2.15/800-ld-2.15-stabs-tweak.patch Mon Jul 28 20:10:34 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -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 -r 4bf8448536d5 -r e445c00d134d patches/binutils/2.15/800-ld-stabs-tweak.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/binutils/2.15/800-ld-stabs-tweak.patch Mon Jul 28 20:17:48 2008 +0000 @@ -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 -r 4bf8448536d5 -r e445c00d134d patches/binutils/2.16.1/110-binutils-2.15-psignal.patch --- a/patches/binutils/2.16.1/110-binutils-2.15-psignal.patch Mon Jul 28 20:10:34 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -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 -r 4bf8448536d5 -r e445c00d134d patches/binutils/2.16.1/110-psignal.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/binutils/2.16.1/110-psignal.patch Mon Jul 28 20:17:48 2008 +0000 @@ -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 -r 4bf8448536d5 -r e445c00d134d patches/binutils/2.16.1/120-binutils-skip-comments.patch --- a/patches/binutils/2.16.1/120-binutils-skip-comments.patch Mon Jul 28 20:10:34 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -[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 -To: Nathan Sidwell -Cc: Ian Lance Taylor , 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 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 - - * 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Ãe 5, 90409 NÃrnberg, Germany -Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 -"And now for something completely different." diff -r 4bf8448536d5 -r e445c00d134d patches/binutils/2.16.1/120-skip-comments.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/binutils/2.16.1/120-skip-comments.patch Mon Jul 28 20:17:48 2008 +0000 @@ -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 +To: Nathan Sidwell +Cc: Ian Lance Taylor , 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 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 + + * 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Ãe 5, 90409 NÃrnberg, Germany +Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 +"And now for something completely different." diff -r 4bf8448536d5 -r e445c00d134d patches/binutils/2.17/300-001_ld_makefile_patch.patch --- a/patches/binutils/2.17/300-001_ld_makefile_patch.patch Mon Jul 28 20:10:34 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -diff -dur binutils-2.17.old/ld/Makefile.am binutils-2.17/ld/Makefile.am ---- binutils-2.17.old/ld/Makefile.am 2006-06-03 06:45:50.000000000 +0200 -+++ binutils-2.17/ld/Makefile.am 2007-05-01 18:26:09.000000000 +0200 -@@ -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@ -diff -dur binutils-2.17.old/ld/Makefile.in binutils-2.17/ld/Makefile.in ---- binutils-2.17.old/ld/Makefile.in 2006-06-03 06:45:50.000000000 +0200 -+++ binutils-2.17/ld/Makefile.in 2007-05-01 18:26:09.000000000 +0200 -@@ -269,7 +269,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 -r 4bf8448536d5 -r e445c00d134d patches/binutils/2.17/300-006_better_file_error.patch --- a/patches/binutils/2.17/300-006_better_file_error.patch Mon Jul 28 20:10:34 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -diff -dur binutils-2.17.old/bfd/opncls.c binutils-2.17/bfd/opncls.c ---- binutils-2.17.old/bfd/opncls.c 2006-03-16 13:20:16.000000000 +0100 -+++ binutils-2.17/bfd/opncls.c 2007-05-01 18:26:11.000000000 +0200 -@@ -158,6 +158,13 @@ - { - bfd *nbfd; - const bfd_target *target_vec; -+ struct stat s; -+ -+ if (stat (filename, &s) == 0) -+ if (S_ISDIR(s.st_mode)) { -+ bfd_set_error (bfd_error_file_not_recognized); -+ return NULL; -+ } - - nbfd = _bfd_new_bfd (); - if (nbfd == NULL) diff -r 4bf8448536d5 -r e445c00d134d patches/binutils/2.17/300-012_check_ldrunpath_length.patch --- a/patches/binutils/2.17/300-012_check_ldrunpath_length.patch Mon Jul 28 20:10:34 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -diff -dur binutils-2.17.old/ld/emultempl/elf32.em binutils-2.17/ld/emultempl/elf32.em ---- binutils-2.17.old/ld/emultempl/elf32.em 2006-06-12 15:05:04.000000000 +0200 -+++ binutils-2.17/ld/emultempl/elf32.em 2007-05-01 18:26:13.000000000 +0200 -@@ -970,6 +970,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; -@@ -1154,6 +1156,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 -r 4bf8448536d5 -r e445c00d134d patches/binutils/2.17/300-ld_makefile_patch.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/binutils/2.17/300-ld_makefile_patch.patch Mon Jul 28 20:17:48 2008 +0000 @@ -0,0 +1,24 @@ +diff -dur binutils-2.17.old/ld/Makefile.am binutils-2.17/ld/Makefile.am +--- binutils-2.17.old/ld/Makefile.am 2006-06-03 06:45:50.000000000 +0200 ++++ binutils-2.17/ld/Makefile.am 2007-05-01 18:26:09.000000000 +0200 +@@ -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@ +diff -dur binutils-2.17.old/ld/Makefile.in binutils-2.17/ld/Makefile.in +--- binutils-2.17.old/ld/Makefile.in 2006-06-03 06:45:50.000000000 +0200 ++++ binutils-2.17/ld/Makefile.in 2007-05-01 18:26:09.000000000 +0200 +@@ -269,7 +269,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 -r 4bf8448536d5 -r e445c00d134d patches/binutils/2.17/301-better_file_error.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/binutils/2.17/301-better_file_error.patch Mon Jul 28 20:17:48 2008 +0000 @@ -0,0 +1,17 @@ +diff -dur binutils-2.17.old/bfd/opncls.c binutils-2.17/bfd/opncls.c +--- binutils-2.17.old/bfd/opncls.c 2006-03-16 13:20:16.000000000 +0100 ++++ binutils-2.17/bfd/opncls.c 2007-05-01 18:26:11.000000000 +0200 +@@ -158,6 +158,13 @@ + { + bfd *nbfd; + const bfd_target *target_vec; ++ struct stat s; ++ ++ if (stat (filename, &s) == 0) ++ if (S_ISDIR(s.st_mode)) { ++ bfd_set_error (bfd_error_file_not_recognized); ++ return NULL; ++ } + + nbfd = _bfd_new_bfd (); + if (nbfd == NULL) diff -r 4bf8448536d5 -r e445c00d134d patches/binutils/2.17/302-check_ldrunpath_length.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/binutils/2.17/302-check_ldrunpath_length.patch Mon Jul 28 20:17:48 2008 +0000 @@ -0,0 +1,21 @@ +diff -dur binutils-2.17.old/ld/emultempl/elf32.em binutils-2.17/ld/emultempl/elf32.em +--- binutils-2.17.old/ld/emultempl/elf32.em 2006-06-12 15:05:04.000000000 +0200 ++++ binutils-2.17/ld/emultempl/elf32.em 2007-05-01 18:26:13.000000000 +0200 +@@ -970,6 +970,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; +@@ -1154,6 +1156,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 -r 4bf8448536d5 -r e445c00d134d patches/binutils/2.17/501-binutils-2.15-psignal.patch --- a/patches/binutils/2.17/501-binutils-2.15-psignal.patch Mon Jul 28 20:10:34 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -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.17/libiberty/strsignal.c.old 2005-04-18 13:57:40.000000000 -0700 -+++ binutils-2.17/libiberty/strsignal.c 2005-04-18 13:59:09.000000000 -0700 -@@ -536,7 +536,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}, diff -r 4bf8448536d5 -r e445c00d134d patches/binutils/2.17/501-psignal.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/binutils/2.17/501-psignal.patch Mon Jul 28 20:17:48 2008 +0000 @@ -0,0 +1,29 @@ +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.17/libiberty/strsignal.c.old 2005-04-18 13:57:40.000000000 -0700 ++++ binutils-2.17/libiberty/strsignal.c 2005-04-18 13:59:09.000000000 -0700 +@@ -536,7 +536,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}, diff -r 4bf8448536d5 -r e445c00d134d patches/binutils/2.17/502-binutils-skip-comments.patch --- a/patches/binutils/2.17/502-binutils-skip-comments.patch Mon Jul 28 20:10:34 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -[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 -To: Nathan Sidwell -Cc: Ian Lance Taylor , 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 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 - - * 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 -@@ -1008,10 +1008,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); -@@ -1110,7 +1110,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Ãe 5, 90409 NÃrnberg, Germany -Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 -"And now for something completely different." diff -r 4bf8448536d5 -r e445c00d134d patches/binutils/2.17/502-skip-comments.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/binutils/2.17/502-skip-comments.patch Mon Jul 28 20:17:48 2008 +0000 @@ -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 +To: Nathan Sidwell +Cc: Ian Lance Taylor , 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 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 + + * 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 +@@ -1008,10 +1008,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); +@@ -1110,7 +1110,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Ãe 5, 90409 NÃrnberg, Germany +Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 +"And now for something completely different."