diff options
author | Richard Purdie <richard@openedhand.com> | 2006-07-21 10:10:31 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2006-07-21 10:10:31 +0000 |
commit | b2f192faabe412adce79534e22efe9fb69ee40e2 (patch) | |
tree | 7076c49d4286f8a1733650bd8fbc7161af200d57 /meta/packages/binutils/binutils-2.16 | |
parent | 2cf0eadf9f730027833af802d7e6c90b44248f80 (diff) | |
download | openembedded-core-b2f192faabe412adce79534e22efe9fb69ee40e2.tar.gz openembedded-core-b2f192faabe412adce79534e22efe9fb69ee40e2.tar.bz2 openembedded-core-b2f192faabe412adce79534e22efe9fb69ee40e2.zip |
Rename /openembedded/ -> /meta/
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@530 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/packages/binutils/binutils-2.16')
5 files changed, 1125 insertions, 0 deletions
diff --git a/meta/packages/binutils/binutils-2.16/binutils-100_cflags_for_build.patch b/meta/packages/binutils/binutils-2.16/binutils-100_cflags_for_build.patch new file mode 100644 index 0000000000..08e7049945 --- /dev/null +++ b/meta/packages/binutils/binutils-2.16/binutils-100_cflags_for_build.patch @@ -0,0 +1,28 @@ +--- binutils-2.16/binutils/Makefile.am.old 2005-06-05 16:59:47.000000000 +0100 ++++ binutils-2.16/binutils/Makefile.am 2005-06-05 17:00:39.000000000 +0100 +@@ -219,20 +219,20 @@ + ./sysinfo$(EXEEXT_FOR_BUILD) -d <$(srcdir)/sysroff.info >sysroff.h + + sysinfo$(EXEEXT_FOR_BUILD): sysinfo.o syslex.o +- $(CC_FOR_BUILD) $(CFLAGS) $(LDFLAGS) -o $@ sysinfo.o syslex.o ++ $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ sysinfo.o syslex.o + + syslex.o: + if [ -r syslex.c ]; then \ +- $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS) syslex.c ; \ ++ $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) syslex.c ; \ + else \ +- $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS) $(srcdir)/syslex.c ;\ ++ $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/syslex.c ;\ + fi + + sysinfo.o: + if [ -r sysinfo.c ]; then \ +- $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS) sysinfo.c ; \ ++ $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) sysinfo.c ; \ + else \ +- $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS) $(srcdir)/sysinfo.c ; \ ++ $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/sysinfo.c ; \ + fi + + # We need these for parallel make. diff --git a/meta/packages/binutils/binutils-2.16/binutils-2.16-linux-uclibc.patch b/meta/packages/binutils/binutils-2.16/binutils-2.16-linux-uclibc.patch new file mode 100644 index 0000000000..2f727a5b5a --- /dev/null +++ b/meta/packages/binutils/binutils-2.16/binutils-2.16-linux-uclibc.patch @@ -0,0 +1,700 @@ +# This patch adds 'linux-uclibc' to all cases which otherwise only +# fire for 'linux' - most of the time the 'linux-gnu*' cases. This +# ensures that by default *-*-linux-uclibc is handled in the same way +# as *-*-linux-gnu +# +--- binutils-2.16/bfd/config.bfd.orig 2005-09-06 19:58:39.153670708 -0700 ++++ binutils-2.16/bfd/config.bfd 2005-09-06 20:03:14.959026045 -0700 +@@ -140,7 +140,7 @@ + targ_defvec=ecoffalpha_little_vec + targ_selvecs=bfd_elf64_alpha_vec + ;; +- alpha*-*-linux-gnu* | alpha*-*-elf*) ++ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc* | alpha*-*-elf*) + targ_defvec=bfd_elf64_alpha_vec + targ_selvecs=ecoffalpha_little_vec + ;; +@@ -150,7 +150,7 @@ + alpha*-*-*) + targ_defvec=ecoffalpha_little_vec + ;; +- ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-gnu* | ia64*-*-elf* | ia64*-*-kfreebsd*-gnu) ++ ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-gnu* | ia64*-*-linux-uclibc* | ia64*-*-elf* | ia64*-*-kfreebsd*-gnu) + targ_defvec=bfd_elf64_ia64_little_vec + targ_selvecs="bfd_elf64_ia64_big_vec bfd_efi_app_ia64_vec" + ;; +@@ -227,7 +227,7 @@ + targ_defvec=bfd_elf32_littlearm_vec + targ_selvecs=bfd_elf32_bigarm_vec + ;; +- armeb-*-elf | arm*b-*-linux-gnu*) ++ armeb-*-elf | arm*b-*-linux-gnu* | arm*b-*-linux-uclibc*) + targ_defvec=bfd_elf32_bigarm_vec + targ_selvecs=bfd_elf32_littlearm_vec + ;; +@@ -235,7 +235,7 @@ + targ_defvec=bfd_elf32_littlearm_vec + targ_selvecs=bfd_elf32_bigarm_vec + ;; +- arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-conix* | \ ++ arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-linux-uclibc* | arm*-*-conix* | \ + arm*-*-uclinux* | arm-*-kfreebsd*-gnu | \ + arm*-*-eabi* ) + targ_defvec=bfd_elf32_littlearm_vec +@@ -385,7 +385,7 @@ + ;; + + #ifdef BFD64 +- hppa*64*-*-linux-gnu*) ++ hppa*64*-*-linux-gnu* | hppa*64*-*-linux-uclibc*) + targ_defvec=bfd_elf64_hppa_linux_vec + targ_selvecs=bfd_elf64_hppa_vec + ;; +@@ -396,7 +396,7 @@ + ;; + #endif + +- hppa*-*-linux-gnu*) ++ hppa*-*-linux-gnu* | hppa*-*-linux-uclibc*) + targ_defvec=bfd_elf32_hppa_linux_vec + targ_selvecs=bfd_elf32_hppa_vec + ;; +@@ -529,7 +529,7 @@ + targ_selvecs=bfd_elf32_i386_vec + targ_underscore=yes + ;; +- i[3-7]86-*-linux-gnu*) ++ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*) + targ_defvec=bfd_elf32_i386_vec + targ_selvecs="i386linux_vec bfd_efi_app_ia32_vec" + targ64_selvecs=bfd_elf64_x86_64_vec +@@ -543,7 +543,7 @@ + targ_defvec=bfd_elf64_x86_64_vec + targ_selvecs="bfd_elf32_i386_vec i386netbsd_vec i386coff_vec bfd_efi_app_ia32_vec" + ;; +- x86_64-*-linux-gnu*) ++ x86_64-*-linux-gnu* | x86_64-*-linux-uclibc*) + targ_defvec=bfd_elf64_x86_64_vec + targ_selvecs="bfd_elf32_i386_vec i386linux_vec bfd_efi_app_ia32_vec" + ;; +@@ -719,7 +719,7 @@ + targ_selvecs=bfd_elf32_m68k_vec + targ_underscore=yes + ;; +- m68*-*-linux-gnu*) ++ m68*-*-linux-gnu* | m68*-*-linux-uclibc*) + targ_defvec=bfd_elf32_m68k_vec + targ_selvecs=m68klinux_vec + ;; +@@ -1005,7 +1005,7 @@ + ;; + #endif + powerpc-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \ +- powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-rtems* | \ ++ powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-linux-uclibc* | powerpc-*-rtems* | \ + powerpc-*-chorus* | powerpc-*-vxworks* | powerpc-*-windiss*) + targ_defvec=bfd_elf32_powerpc_vec + targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_vec" +@@ -1042,7 +1042,7 @@ + targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec" + ;; + powerpcle-*-elf* | powerpcle-*-sysv4* | powerpcle-*-eabi* | \ +- powerpcle-*-solaris2* | powerpcle-*-linux-gnu* | powerpcle-*-vxworks* |\ ++ powerpcle-*-solaris2* | powerpcle-*-linux-gnu* | powerpcle-*-linux-uclibc* | powerpcle-*-vxworks* |\ + powerpcle-*-rtems*) + targ_defvec=bfd_elf32_powerpcle_vec + targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec" +@@ -1213,7 +1213,7 @@ + targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec" + targ_underscore=yes + ;; +- sparc-*-linux-gnu*) ++ sparc-*-linux-gnu* | sparc-*-linux-uclibc*) + targ_defvec=bfd_elf32_sparc_vec + targ_selvecs="sparclinux_vec bfd_elf64_sparc_vec sunos_big_vec" + ;; +@@ -1260,7 +1260,7 @@ + targ_defvec=sunos_big_vec + targ_underscore=yes + ;; +- sparc64-*-linux-gnu*) ++ sparc64-*-linux-gnu* | sparc64-*-linux-uclibc*) + targ_defvec=bfd_elf64_sparc_vec + targ_selvecs="bfd_elf32_sparc_vec sparclinux_vec sunos_big_vec" + ;; +@@ -1329,7 +1329,7 @@ + targ_underscore=yes + ;; + +- vax-*-linux-gnu*) ++ vax-*-linux-gnu* | vax-*-linux-uclibc*) + targ_defvec=bfd_elf32_vax_vec + ;; + +--- binutils-2.16/bfd/configure.in.orig 2005-09-06 20:25:48.848220921 -0700 ++++ binutils-2.16/bfd/configure.in 2005-09-06 20:26:58.628611924 -0700 +@@ -163,7 +163,7 @@ + alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu) + COREFILE='' + ;; +- alpha*-*-linux-gnu*) ++ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc*) + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/alphalinux.h"' + ;; +@@ -248,7 +248,7 @@ + TRAD_HEADER='"hosts/i386mach3.h"' + ;; + changequote(,)dnl +- i[3-7]86-*-linux-gnu*) ++ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*) + changequote([,])dnl + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/i386linux.h"' +@@ -289,7 +289,7 @@ + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/hp300bsd.h"' + ;; +- m68*-*-linux-gnu*) ++ m68*-*-linux-gnu* | m68*-*-linux-uclibc*) + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/m68klinux.h"' + ;; +@@ -375,7 +375,7 @@ + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/vaxult2.h"' + ;; +- vax-*-linux-gnu*) ++ vax-*-linux-gnu* | vax-*-linux-uclibc*) + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/vaxlinux.h"' + ;; +--- binutils-2.16/bfd/configure.orig 2005-09-06 20:03:14.991028059 -0700 ++++ binutils-2.16/bfd/configure 2005-09-06 20:04:48.512913020 -0700 +@@ -3572,7 +3572,7 @@ + ;; + + # This must be Linux ELF. +-linux-gnu*) ++linux-gnu* | linux-uclibc*) + case $host_cpu in + alpha* | mips* | hppa* | i*86 | powerpc* | sparc* | ia64* ) + lt_cv_deplibs_check_method=pass_all ;; +@@ -9918,7 +9918,7 @@ + alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu) + COREFILE='' + ;; +- alpha*-*-linux-gnu*) ++ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc*) + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/alphalinux.h"' + ;; +@@ -9982,7 +9982,7 @@ + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/i386mach3.h"' + ;; +- i[3-7]86-*-linux-gnu*) ++ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*) + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/i386linux.h"' + ;; +@@ -10020,7 +10020,7 @@ + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/hp300bsd.h"' + ;; +- m68*-*-linux-gnu*) ++ m68*-*-linux-gnu* | m68*-*-linux-uclibc*) + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/m68klinux.h"' + ;; +@@ -10154,7 +10154,7 @@ + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/vaxult2.h"' + ;; +- vax-*-linux-gnu*) ++ vax-*-linux-gnu* | vax-*-linux-uclibc*) + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/vaxlinux.h"' + ;; +--- binutils-2.16/binutils/configure.orig 2005-09-06 20:26:58.676614945 -0700 ++++ binutils-2.16/binutils/configure 2005-09-06 20:27:21.230034142 -0700 +@@ -1564,7 +1564,7 @@ + ;; + + # This must be Linux ELF. +-linux-gnu*) ++linux-gnu* | linux-uclibc*) + case $host_cpu in + alpha* | mips* | hppa* | i*86 | powerpc* | sparc* | ia64* ) + lt_cv_deplibs_check_method=pass_all ;; +--- binutils-2.16/configure.in.orig 2005-09-06 20:31:11.872547560 -0700 ++++ binutils-2.16/configure.in 2005-09-06 20:31:47.322778302 -0700 +@@ -346,7 +346,7 @@ + ;; + "") + case "${target}" in +- *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu) ++ *-*-linux*-gnu | *-*-linux*-uclibc | *-*-gnu* | *-*-k*bsd*-gnu) + # Enable libmudflap by default in GNU and friends. + ;; + *-*-freebsd*) +--- binutils-2.16/configure.orig 2005-09-06 20:30:00.120032459 -0700 ++++ binutils-2.16/configure 2005-09-06 20:31:11.832545043 -0700 +@@ -1142,7 +1142,7 @@ + ;; + "") + case "${target}" in +- *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu) ++ *-*-linux*-gnu | *-*-linux*-uclibc | *-*-gnu* | *-*-k*bsd*-gnu) + # Enable libmudflap by default in GNU and friends. + ;; + *-*-freebsd*) +--- binutils-2.16/gas/configure.in.orig 2005-09-06 20:32:36.993903909 -0700 ++++ binutils-2.16/gas/configure.in 2005-09-06 20:32:55.667078938 -0700 +@@ -161,7 +161,7 @@ + AC_DEFINE(AIX_WEAK_SUPPORT, 1, + [Define if using AIX 5.2 value for C_WEAKEXT.]) + ;; +- ppc-*-linux-gnu*) ++ ppc-*-linux-gnu* | ppc-*-linux-uclibc*) + case "$endian" in + big) ;; + *) AC_MSG_ERROR(GNU/Linux must be configured big endian) ;; +--- binutils-2.16/gas/configure.orig 2005-09-06 20:31:55.247276960 -0700 ++++ binutils-2.16/gas/configure 2005-09-06 20:32:36.961901896 -0700 +@@ -3409,7 +3409,7 @@ + ;; + + # This must be Linux ELF. +-linux-gnu*) ++linux-gnu* | linux-uclibc*) + case $host_cpu in + alpha* | mips* | hppa* | i*86 | powerpc* | sparc* | ia64* ) + lt_cv_deplibs_check_method=pass_all ;; +@@ -4462,7 +4462,7 @@ + _ACEOF + + ;; +- ppc-*-linux-gnu*) ++ ppc-*-linux-gnu* | ppc-*-linux-uclibc*) + case "$endian" in + big) ;; + *) { { echo "$as_me:$LINENO: error: GNU/Linux must be configured big endian" >&5 +--- binutils-2.16/gas/configure.tgt.orig 2005-09-06 20:32:55.695080700 -0700 ++++ binutils-2.16/gas/configure.tgt 2005-09-06 20:35:59.482645723 -0700 +@@ -100,7 +100,7 @@ + alpha-*-*vms*) fmt=evax ;; + alpha-*-osf*) fmt=ecoff ;; + alpha-*-linuxecoff*) fmt=ecoff ;; +- alpha-*-linux-gnu*) fmt=elf em=linux ;; ++ alpha-*-linux-gnu* | alpha-*-linux-uclibc*) fmt=elf em=linux ;; + alpha-*-netbsd*) fmt=elf em=nbsd ;; + alpha-*-openbsd*) fmt=elf em=obsd ;; + +@@ -116,7 +116,7 @@ + arm-*-conix*) fmt=elf ;; + arm-*-linux*aout*) fmt=aout em=linux ;; + arm-*-linux-gnueabi*) fmt=elf em=armlinuxeabi ;; +- arm-*-linux-gnu*) fmt=elf em=linux ;; ++ arm-*-linux-gnu* | arm-*-linux-uclibc*) fmt=elf em=linux ;; + arm-*-uclinux*) fmt=elf em=linux ;; + arm-*-netbsdelf*) fmt=elf em=nbsd ;; + arm-*-*n*bsd*) fmt=aout em=nbsd ;; +@@ -128,7 +128,7 @@ + + avr-*-*) fmt=elf ;; + +- cris-*-linux-gnu* | crisv32-*-linux-gnu*) ++ cris-*-linux-gnu* | crisv32-*-linux-gnu* | cris-*-linux-uclibc* | crisv32-*-linux-uclibc*) + fmt=multi bfd_gas=yes em=linux ;; + cris-*-* | crisv32-*-*) fmt=multi bfd_gas=yes ;; + +@@ -192,7 +192,7 @@ + i386-*-linux*aout*) fmt=aout em=linux ;; + i386-*-linux*oldld) fmt=aout em=linux ;; + i386-*-linux*coff*) fmt=coff em=linux ;; +- i386-*-linux-gnu*) fmt=elf em=linux ;; ++ i386-*-linux-gnu* | i386-*-linux-uclibc*) fmt=elf em=linux ;; + i386-*-lynxos*) fmt=elf em=lynx bfd_gas=yes ;; + i386-*-sysv[45]*) fmt=elf ;; + i386-*-solaris*) fmt=elf ;; +@@ -238,7 +238,7 @@ + + ia64-*-elf*) fmt=elf ;; + ia64-*-aix*) fmt=elf em=ia64aix ;; +- ia64-*-linux-gnu*) fmt=elf em=linux ;; ++ ia64-*-linux-gnu* | ia64-*-linux-uclibc*) fmt=elf em=linux ;; + ia64-*-hpux*) fmt=elf em=hpux ;; + ia64-*-netbsd*) fmt=elf em=nbsd ;; + +@@ -265,7 +265,7 @@ + m68k-*-rtems*) fmt=elf ;; + m68k-*-hpux*) fmt=hp300 em=hp300 ;; + m68k-*-linux*aout*) fmt=aout em=linux ;; +- m68k-*-linux-gnu*) fmt=elf em=linux ;; ++ m68k-*-linux-gnu* | m68k-*-linux-uclibc*) fmt=elf em=linux ;; + m68k-*-uclinux*) fmt=elf ;; + m68k-*-gnu*) fmt=elf ;; + m68k-*-netbsdelf*) fmt=elf em=nbsd ;; +@@ -332,7 +332,7 @@ + ppc-*-beos*) fmt=coff ;; + ppc-*-*n*bsd* | ppc-*-elf*) fmt=elf ;; + ppc-*-eabi* | ppc-*-sysv4*) fmt=elf ;; +- ppc-*-linux-gnu*) fmt=elf em=linux ;; ++ ppc-*-linux-gnu* | ppc-*-linux-uclibc*) fmt=elf em=linux ;; + ppc-*-solaris*) fmt=elf ;; + ppc-*-rtems*) fmt=elf ;; + ppc-*-macos*) fmt=coff em=macos ;; +@@ -340,7 +340,7 @@ + ppc-*-kaos*) fmt=elf ;; + ppc-*-lynxos*) fmt=elf em=lynx bfd_gas=yes ;; + +- s390-*-linux-gnu*) fmt=elf em=linux ;; ++ s390-*-linux-gnu* | s390-*-linux-uclibc*) fmt=elf em=linux ;; + s390-*-tpf*) fmt=elf ;; + + sh*-*-linux*) fmt=elf em=linux +@@ -369,7 +369,7 @@ + sparc-*-aout | sparc*-*-vxworks*) fmt=aout em=sparcaout ;; + sparc-*-coff) fmt=coff ;; + sparc-*-linux*aout*) fmt=aout em=linux ;; +- sparc-*-linux-gnu*) fmt=elf em=linux ;; ++ sparc-*-linux-gnu* | sparc-*-linux-uclibc*) fmt=elf em=linux ;; + sparc-fujitsu-none) fmt=aout ;; + sparc-*-elf) fmt=elf ;; + sparc-*-sysv4*) fmt=elf ;; +@@ -398,7 +398,7 @@ + vax-*-netbsdelf*) fmt=elf em=nbsd ;; + vax-*-netbsd*) fmt=aout em=nbsd ;; + vax-*-bsd* | vax-*-ultrix*) fmt=aout ;; +- vax-*-linux-gnu*) fmt=elf em=linux bfd_gas=yes ;; ++ vax-*-linux-gnu* | vax-*-linux-uclibc*) fmt=elf em=linux bfd_gas=yes ;; + + w65-*-*) fmt=coff ;; + +--- binutils-2.16/gprof/configure.orig 2005-09-06 20:36:04.850983531 -0700 ++++ binutils-2.16/gprof/configure 2005-09-06 20:36:26.344336022 -0700 +@@ -3407,7 +3407,7 @@ + ;; + + # This must be Linux ELF. +-linux-gnu*) ++linux-gnu* | linux-uclibc*) + case $host_cpu in + alpha* | mips* | hppa* | i*86 | powerpc* | sparc* | ia64* ) + lt_cv_deplibs_check_method=pass_all ;; +--- binutils-2.16/ld/configure.host.orig 2005-09-06 20:37:46.085353808 -0700 ++++ binutils-2.16/ld/configure.host 2005-09-06 20:40:03.381993341 -0700 +@@ -83,7 +83,7 @@ + HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,ld\[^ \]\*,ld-linux,g"` + ;; + +-arm*-*-linux-gnu*) ++arm*-*-linux-gnu* | arm*-*-linux-uclibc*) + HOSTING_CRT0='-p '`echo "$HOSTING_CRT0" | sed -e "s,ld\[^ \]\*,ld-linux,g"` + ;; + +@@ -141,7 +141,7 @@ + HOSTING_LIBS="$HOSTING_LIBS"' -lcygwin -L/usr/lib/w32api -luser32 -lkernel32 -ladvapi32 -lshell32 `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi`' + ;; + +-ia64-*-linux-gnu*) ++ia64-*-linux-gnu* | ia64-*-linux-uclibc*) + HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,ld\[^ \]*\*,ld-linux-ia64,g"` + ;; + +@@ -155,11 +155,11 @@ + HOSTING_LIBS='-L/usr/lib32 '"$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o ; else ${CC} -print-file-name=crtend.o; fi` /usr/lib32/crtn.o -init __do_global_ctors -fini __do_global_dtors' + ;; + +-mips*-*-linux-gnu*) ++mips*-*-linux-gnu* | mips*-*-linux-uclibc*) + HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`specs.*\"\\\`,/lib/ld.so.1,"` + ;; + +-m68*-*-linux-gnu*) ++m68*-*-linux-gnu* | m68*-*-linux-uclibc*) + HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`specs.*\"\\\`,/lib/ld.so.1,"` + ;; + +@@ -183,19 +183,19 @@ + HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi`' + ;; + +-powerpc64*-*-linux-gnu*) ++powerpc64*-*-linux-gnu* | powerpc64*-*-linux-uclibc*) + HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`specs.*\"\\\`,/lib64/ld64.so.1,"` + ;; + +-powerpc*-*-linux-gnu*) ++powerpc*-*-linux-gnu* | powerpc*-*-linux-uclibc*) + HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`specs.*\"\\\`,/lib/ld.so.1,"` + ;; + +-s390x-*-linux-gnu*) ++s390x-*-linux-gnu* | s390x-*-linux-uclibc*) + HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`specs.*\"\\\`,/lib/ld64.so.1,"` + ;; + +-s390-*-linux-gnu*) ++s390-*-linux-gnu* | s390-*-linux-uclibc*) + HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`specs.*\"\\\`,/lib/ld.so.1,"` + ;; + +@@ -209,15 +209,15 @@ + HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` `if [ -f ../gcc/crtn.o ]; then echo ../gcc/crtn.o; else ${CC} -print-file-name=crtn.o; fi`' + ;; + +-sparc-*-linux-gnu*) ++sparc-*-linux-gnu* | sparc-*-linux-uclibc*) + HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`specs.*\"\\\`,/lib/ld-linux.so.2,"` + ;; + +-sparc64-*-linux-gnu*) ++sparc64-*-linux-gnu* | sparc64-*-linux-uclibc*) + HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`specs.*\"\\\`,/lib64/ld-linux.so.2,"` + ;; + +-x86_64-*-linux-gnu*) ++x86_64-*-linux-gnu* | x86_64-*-linux-uclibc*) + HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`specs.*\"\\\`,/lib64/ld-linux-x86-64.so.2,"` + ;; + +--- binutils-2.16/ld/configure.orig 2005-09-06 20:37:34.700637413 -0700 ++++ binutils-2.16/ld/configure 2005-09-06 20:37:46.013349277 -0700 +@@ -1568,7 +1568,7 @@ + ;; + + # This must be Linux ELF. +-linux-gnu*) ++linux-gnu* | linux-uclibc*) + case $host_cpu in + alpha* | mips* | hppa* | i*86 | powerpc* | sparc* | ia64* ) + lt_cv_deplibs_check_method=pass_all ;; +--- binutils-2.16/ld/configure.tgt.orig 2005-09-06 20:40:03.413995355 -0700 ++++ binutils-2.16/ld/configure.tgt 2005-09-06 20:45:48.111685813 -0700 +@@ -30,7 +30,7 @@ + cris-*-*aout*) targ_emul=crisaout + targ_extra_emuls="criself crislinux" + targ_extra_libpath=$targ_extra_emuls ;; +-cris-*-linux-gnu* | cris-*-linux-gnu*) ++cris-*-linux-gnu* | cris-*-linux-gnu* | cris-*-linux-uclibc* | cris-*-linux-uclibc*) + targ_emul=crislinux ;; + cris-*-* | crisv32-*-*) targ_emul=criself + targ_extra_emuls="crisaout crislinux" +@@ -62,14 +62,14 @@ + tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/aout//'` + tdir_sun4=sparc-sun-sunos4 + ;; +-sparc64-*-linux-gnu*) targ_emul=elf64_sparc ++sparc64-*-linux-gnu* | sparc64-*-linux-uclibc*) targ_emul=elf64_sparc + targ_extra_emuls="elf32_sparc sparclinux sun4" + targ_extra_libpath=elf32_sparc + tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/64//'` + tdir_sparclinux=${tdir_elf32_sparc}aout + tdir_sun4=sparc-sun-sunos4 + ;; +-sparc*-*-linux-gnu*) targ_emul=elf32_sparc ++sparc*-*-linux-gnu* | sparc*-*-linux-uclibc*) targ_emul=elf32_sparc + targ_extra_emuls="sparclinux elf64_sparc sun4" + targ_extra_libpath=elf64_sparc + tdir_sparclinux=${targ_alias}aout +@@ -119,8 +119,8 @@ + ia64-*-aix*) targ_emul=elf64_aix ;; + m32r*le-*-elf*) targ_emul=m32rlelf ;; + m32r*-*-elf*) targ_emul=m32relf ;; +-m32r*le-*-linux-gnu*) targ_emul=m32rlelf_linux ;; +-m32r*-*-linux-gnu*) targ_emul=m32relf_linux ;; ++m32r*le-*-linux-gnu* | m32r*le-*-linux-uclibc*) targ_emul=m32rlelf_linux ;; ++m32r*-*-linux-gnu* | m32r*-*-linux-uclibc*) targ_emul=m32relf_linux ;; + m68hc11-*-*|m6811-*-*) targ_emul=m68hc11elf + targ_extra_emuls="m68hc11elfb m68hc12elf m68hc12elfb" ;; + m68hc12-*-*|m6812-*-*) targ_emul=m68hc12elf +@@ -131,7 +131,7 @@ + m68*-apple-aux*) targ_emul=m68kaux ;; + maxq-*-coff) targ_emul=maxqcoff;; + *-tandem-none) targ_emul=st2000 ;; +-i370-*-elf* | i370-*-linux-gnu*) targ_emul=elf32i370 ;; ++i370-*-elf* | i370-*-linux-gnu* | i370-*-linux-uclibc*) targ_emul=elf32i370 ;; + i[3-7]86-*-nto-qnx*) targ_emul=i386nto ;; + i[3-7]86-*-vsta) targ_emul=vsta ;; + i[3-7]86-go32-rtems*) targ_emul=i386go32 ;; +@@ -155,14 +155,14 @@ + tdir_elf_i386=`echo ${targ_alias} | sed -e 's/aout//'` + ;; + i[3-7]86-*-linux*oldld) targ_emul=i386linux; targ_extra_emuls=elf_i386 ;; +-i[3-7]86-*-linux-gnu*) targ_emul=elf_i386 ++i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*) targ_emul=elf_i386 + targ_extra_emuls=i386linux + if test x${want64} = xtrue; then + targ_extra_emuls="$targ_extra_emuls elf_x86_64" + fi + tdir_i386linux=${targ_alias}aout + ;; +-x86_64-*-linux-gnu*) targ_emul=elf_x86_64 ++x86_64-*-linux-gnu* | x86_64-*-linux-uclibc*) targ_emul=elf_x86_64 + targ_extra_emuls="elf_i386 i386linux" + targ_extra_libpath=elf_i386 + tdir_i386linux=`echo ${targ_alias}aout | sed -e 's/x86_64/i386/'` +@@ -262,13 +262,14 @@ + arm-*-kaos*) targ_emul=armelf ;; + arm9e-*-elf) targ_emul=armelf ;; + arm*b-*-linux-gnueabi) targ_emul=armelfb_linux_eabi ;; +-arm*b-*-linux-gnu*) targ_emul=armelfb_linux; targ_extra_emuls=armelfb ;; ++arm*b-*-linux-gnu* | arm*b-*-linux-uclibc*) targ_emul=armelfb_linux; targ_extra_emuls=armelfb ;; + arm*-*-linux-gnueabi) targ_emul=armelf_linux_eabi ;; +-arm*-*-linux-gnu*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;; ++arm*-*-linux-gnu* | arm*-*-linux-uclibc*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;; + arm*-*-uclinux*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;; + arm-*-vxworks) targ_emul=armelf_vxworks ;; + arm*-*-conix*) targ_emul=armelf ;; +-thumb-*-linux-gnu* | thumb-*-uclinux*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;; ++thumb-*-linux-gnu* | thumb-*-linux-uclibc* | thumb-*-uclinux*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;; ++thumbb-*-linux-gnu* | thumbb-*-linux-uclibc* | thumbb-*-uclinux*) targ_emul=armelfb_linux; targ_extra_emuls=armelfb ;; + strongarm-*-coff) targ_emul=armcoff ;; + strongarm-*-elf) targ_emul=armelf ;; + strongarm-*-kaos*) targ_emul=armelf ;; +@@ -372,7 +373,7 @@ + targ_extra_emuls=m68kelf + tdir_m68kelf=`echo ${targ_alias} | sed -e 's/aout//'` + ;; +-m68k-*-linux-gnu*) targ_emul=m68kelf ++m68k-*-linux-gnu* | m68k-*-linux-uclibc*) targ_emul=m68kelf + targ_extra_emuls=m68klinux + tdir_m68klinux=`echo ${targ_alias} | sed -e 's/linux/linuxaout/'` + ;; +@@ -388,9 +389,9 @@ + m68*-*-psos*) targ_emul=m68kpsos ;; + m68*-*-rtemscoff*) targ_emul=m68kcoff ;; + m68*-*-rtems*) targ_emul=m68kelf ;; +-hppa*64*-*-linux-gnu*) targ_emul=hppa64linux ;; ++hppa*64*-*-linux-gnu* | hppa*64*-*-linux-uclibc*) targ_emul=hppa64linux ;; + hppa*64*-*) targ_emul=elf64hppa ;; +-hppa*-*-linux-gnu*) targ_emul=hppalinux ;; ++hppa*-*-linux-gnu* | hppa*-*-linux-uclibc*) targ_emul=hppalinux ;; + hppa*-*-*elf*) targ_emul=hppaelf ;; + hppa*-*-lites*) targ_emul=hppaelf ;; + hppa*-*-netbsd*) targ_emul=hppanbsd ;; +@@ -402,7 +403,7 @@ + vax-*-netbsdaout* | vax-*-netbsd*) + targ_emul=vaxnbsd + targ_extra_emuls=elf32vax ;; +-vax-*-linux-gnu*) targ_emul=elf32vax ;; ++vax-*-linux-gnu* | vax-*-linux-uclibc*) targ_emul=elf32vax ;; + mips*-*-pe) targ_emul=mipspe ; + targ_extra_ofiles="deffilep.o pe-dll.o" ;; + mips*-dec-ultrix*) targ_emul=mipslit ;; +@@ -436,18 +437,18 @@ + mips*-*-vxworks*) targ_emul=elf32ebmip + targ_extra_emuls="elf32elmip" ;; + mips*-*-windiss) targ_emul=elf32mipswindiss ;; +-mips64*el-*-linux-gnu*) targ_emul=elf32ltsmipn32 ++mips64*el-*-linux-gnu* | mips64*el-*-linux-uclibc*) targ_emul=elf32ltsmipn32 + targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip" + targ_extra_libpath="elf32ltsmip elf64ltsmip" + ;; +-mips64*-*-linux-gnu*) targ_emul=elf32btsmipn32 ++mips64*-*-linux-gnu* | mips64*-*-linux-uclibc*) targ_emul=elf32btsmipn32 + targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip" + targ_extra_libpath="elf32btsmip elf64btsmip" + ;; +-mips*el-*-linux-gnu*) targ_emul=elf32ltsmip ++mips*el-*-linux-gnu* | mips*el-*-linux-uclibc*) targ_emul=elf32ltsmip + targ_extra_emuls="elf32btsmip elf32ltsmipn32 elf64ltsmip elf32btsmipn32 elf64btsmip" + ;; +-mips*-*-linux-gnu*) targ_emul=elf32btsmip ++mips*-*-linux-gnu* | mips*-*-linux-uclibc*) targ_emul=elf32btsmip + targ_extra_emuls="elf32ltsmip elf32btsmipn32 elf64btsmip elf32ltsmipn32 elf64ltsmip" + ;; + mips*-*-lnews*) targ_emul=mipslnews ;; +@@ -467,7 +468,7 @@ + alpha*-*-linuxecoff*) targ_emul=alpha targ_extra_emuls=elf64alpha + tdir_elf64alpha=`echo ${targ_alias} | sed -e 's/ecoff//'` + ;; +-alpha*-*-linux-gnu*) targ_emul=elf64alpha targ_extra_emuls=alpha ++alpha*-*-linux-gnu* | alpha*-*-linux-uclibc*) targ_emul=elf64alpha targ_extra_emuls=alpha + tdir_alpha=`echo ${targ_alias} | sed -e 's/linux/linuxecoff/'` + ;; + alpha*-*-osf*) targ_emul=alpha ;; +--- binutils-2.16/ld/emultempl/elf32.em.orig 2005-09-06 20:45:48.247694371 -0700 ++++ binutils-2.16/ld/emultempl/elf32.em 2005-09-06 20:46:39.158898011 -0700 +@@ -65,7 +65,7 @@ + + if [ "x${USE_LIBPATH}" = xyes ] ; then + case ${target} in +- *-*-linux-gnu*) ++ *-*-linux-gnu* | *-*-linux-uclibc*) + cat >>e${EMULATION_NAME}.c <<EOF + #ifdef HAVE_GLOB + #include <glob.h> +@@ -350,7 +350,7 @@ + + EOF + case ${target} in +- *-*-linux-gnu*) ++ *-*-linux-gnu* | *-*-linux-uclibc*) + cat >>e${EMULATION_NAME}.c <<EOF + { + struct bfd_link_needed_list *l; +@@ -522,7 +522,7 @@ + + EOF + case ${target} in +- *-*-linux-gnu*) ++ *-*-linux-gnu* | *-*-linux-uclibc*) + cat >>e${EMULATION_NAME}.c <<EOF + /* For a native linker, check the file /etc/ld.so.conf for directories + in which we may find shared libraries. /etc/ld.so.conf is really +@@ -932,7 +932,7 @@ + EOF + if [ "x${USE_LIBPATH}" = xyes ] ; then + case ${target} in +- *-*-linux-gnu*) ++ *-*-linux-gnu* | *-*-linux-uclibc*) + cat >>e${EMULATION_NAME}.c <<EOF + if (gld${EMULATION_NAME}_check_ld_so_conf (l->name, force)) + break; +--- binutils-2.16/libtool.m4.orig 2005-09-06 20:46:55.131903129 -0700 ++++ binutils-2.16/libtool.m4 2005-09-06 20:47:07.364672889 -0700 +@@ -634,7 +634,7 @@ + ;; + + # This must be Linux ELF. +-linux-gnu*) ++linux-gnu* | linux-uclibc*) + case $host_cpu in + alpha* | mips* | hppa* | i*86 | powerpc* | sparc* | ia64* ) + lt_cv_deplibs_check_method=pass_all ;; +--- binutils-2.16/ltconfig.orig 2005-09-06 20:47:13.965088227 -0700 ++++ binutils-2.16/ltconfig 2005-09-06 20:49:12.944575134 -0700 +@@ -1247,7 +1247,7 @@ + ;; + + # This must be Linux ELF. +-linux-gnu*) ++linux-gnu* | linux-uclibc*) + version_type=linux + need_lib_prefix=no + need_version=no +--- binutils-2.16/ltmain.sh.orig 2005-09-06 20:49:12.980577399 -0700 ++++ binutils-2.16/ltmain.sh 2005-09-06 20:50:15.180491393 -0700 +@@ -2600,7 +2600,7 @@ + versuffix="$major.$revision" + ;; + +- linux) ++ linux | linux-uclibc) + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + ;; +--- binutils-2.16/opcodes/configure.orig 2005-09-06 20:50:15.220493910 -0700 ++++ binutils-2.16/opcodes/configure 2005-09-06 20:50:38.053930728 -0700 +@@ -3576,7 +3576,7 @@ + ;; + + # This must be Linux ELF. +-linux-gnu*) ++linux-gnu* | linux-uclibc*) + case $host_cpu in + alpha* | mips* | hppa* | i*86 | powerpc* | sparc* | ia64* ) + lt_cv_deplibs_check_method=pass_all ;; diff --git a/meta/packages/binutils/binutils-2.16/binutils-2.16-objcopy-rename-errorcode.patch b/meta/packages/binutils/binutils-2.16/binutils-2.16-objcopy-rename-errorcode.patch new file mode 100644 index 0000000000..e4372de88f --- /dev/null +++ b/meta/packages/binutils/binutils-2.16/binutils-2.16-objcopy-rename-errorcode.patch @@ -0,0 +1,29 @@ +# strip (and objcopy) fail to set the error code if there is no +# output file name and the rename of the stripped (or copied) file +# fails, yet the command fails to do anything. This fixes both +# objcopy and strip. +# +#Signed-off-by: John Bowler <jbowler@acm.org> + +--- binutils-2.16/binutils/objcopy.c.orig 2006-01-31 11:15:38.797318519 -0800 ++++ binutils-2.16/binutils/objcopy.c 2006-01-31 11:15:40.463318516 -0800 +@@ -2434,7 +2434,8 @@ strip_main (int argc, char *argv[]) + if (preserve_dates) + set_times (tmpname, &statbuf); + if (output_file == NULL) +- smart_rename (tmpname, argv[i], preserve_dates); ++ if (smart_rename (tmpname, argv[i], preserve_dates)) ++ hold_status = 1; + status = hold_status; + } + else +@@ -3013,7 +3014,8 @@ copy_main (int argc, char *argv[]) + { + if (preserve_dates) + set_times (tmpname, &statbuf); +- smart_rename (tmpname, input_filename, preserve_dates); ++ if (smart_rename (tmpname, input_filename, preserve_dates)) ++ status = 1; + } + else + unlink (tmpname); diff --git a/meta/packages/binutils/binutils-2.16/binutils-2.16-thumb-glue.patch b/meta/packages/binutils/binutils-2.16/binutils-2.16-thumb-glue.patch new file mode 100644 index 0000000000..59d8035f7d --- /dev/null +++ b/meta/packages/binutils/binutils-2.16/binutils-2.16-thumb-glue.patch @@ -0,0 +1,76 @@ +# The ARM->Thumb glue uses an ldr of the target function address, this +# simply doesn't work for PIC code, changed to use 4 word PIC glue +# +--- binutils-2.16/.pc/binutils-2.16-thumb-glue.patch/bfd/elf32-arm.c 2005-09-18 03:52:15.465165051 -0700 ++++ binutils-2.16/bfd/elf32-arm.c 2005-09-18 03:52:33.546302825 -0700 +@@ -1493,19 +1493,20 @@ + return myh; + } + +-/* ARM->Thumb glue: ++/* ARM->Thumb glue (PIC version): + + .arm + __func_from_arm: + ldr r12, __func_addr ++ add r12, r12, pc @ pc is __func_addr, so r12 is func + bx r12 + __func_addr: +- .word func @ behave as if you saw a ARM_32 reloc. */ ++ .word func-.+1 @ offset to actual function, low bit set */ + +-#define ARM2THUMB_GLUE_SIZE 12 +-static const insn32 a2t1_ldr_insn = 0xe59fc000; +-static const insn32 a2t2_bx_r12_insn = 0xe12fff1c; +-static const insn32 a2t3_func_addr_insn = 0x00000001; ++#define ARM2THUMB_GLUE_SIZE 16 ++static const insn32 a2t1_ldr_insn = 0xe59fc004; ++static const insn32 a2t2_add_r12_insn = 0xe08fc00c; ++static const insn32 a2t3_bx_r12_insn = 0xe12fff1c; + + /* Thumb->ARM: Thumb->(non-interworking aware) ARM + +@@ -2187,6 +2188,8 @@ + + if ((my_offset & 0x01) == 0x01) + { ++ long int ret_offset; ++ + if (sym_sec != NULL + && sym_sec->owner != NULL + && !INTERWORK_FLAG (sym_sec->owner)) +@@ -2203,12 +2206,31 @@ + bfd_put_32 (output_bfd, (bfd_vma) a2t1_ldr_insn, + s->contents + my_offset); + +- bfd_put_32 (output_bfd, (bfd_vma) a2t2_bx_r12_insn, ++ bfd_put_32 (output_bfd, (bfd_vma) a2t2_add_r12_insn, + s->contents + my_offset + 4); + +- /* It's a thumb address. Add the low order bit. */ +- bfd_put_32 (output_bfd, val | a2t3_func_addr_insn, ++ bfd_put_32 (output_bfd, (bfd_vma) a2t3_bx_r12_insn, + s->contents + my_offset + 8); ++ ++ /* Calculate the offset to the actual function. */ ++ ret_offset = ++ /* Address of destination of the stub. */ ++ ((bfd_signed_vma) val) ++ - ((bfd_signed_vma) ++ /* Offset from the start of the current section ++ to the start of the stubs. */ ++ (s->output_offset ++ /* Offset of the start of this stub from the start of the stubs. */ ++ + my_offset ++ /* Address of the start of the current section. */ ++ + s->output_section->vma) ++ /* The word is 12 bytes into the stub. */ ++ + 12 ++ /* The destination is a thumb function so the bottom bit must be set. */ ++ - 1); ++ ++ bfd_put_32 (output_bfd, (bfd_vma) ret_offset, ++ s->contents + my_offset + 12); + } + + BFD_ASSERT (my_offset <= globals->arm_glue_size); diff --git a/meta/packages/binutils/binutils-2.16/binutils-2.16-thumb-trampoline.patch b/meta/packages/binutils/binutils-2.16/binutils-2.16-thumb-trampoline.patch new file mode 100644 index 0000000000..a4f90a7254 --- /dev/null +++ b/meta/packages/binutils/binutils-2.16/binutils-2.16-thumb-trampoline.patch @@ -0,0 +1,292 @@ +--- binutils-2.16/.pc/binutils-2.16-thumb-trampoline.patch/bfd/elf32-arm.c 2005-05-02 12:43:06.000000000 -0700 ++++ binutils-2.16/bfd/elf32-arm.c 2005-09-19 22:58:49.834931044 -0700 +@@ -24,6 +24,8 @@ + #include "libbfd.h" + #include "elf-bfd.h" + ++#define NOTE_DEBUG 0 ++ + #ifndef NUM_ELEM + #define NUM_ELEM(a) (sizeof (a) / (sizeof (a)[0])) + #endif +@@ -1127,6 +1129,10 @@ + used, we need to record the index into .got.plt instead of + recomputing it from the PLT offset. */ + bfd_signed_vma plt_got_offset; ++ ++ /* This is used to sanity check that the Thumb trampoline space ++ really was allocated. */ ++ int accomodate_trampoline; + }; + + /* Traverse an arm ELF linker hash table. */ +@@ -1219,9 +1225,15 @@ + table, string)); + if (ret != NULL) + { ++#if NOTE_DEBUG ++ _bfd_error_handler( ++ _("NOTE: %x(%s): New hash entry (plt refcount %d)"), ++ ret, string, ret->root.plt.refcount); ++#endif + ret->relocs_copied = NULL; + ret->plt_thumb_refcount = 0; + ret->plt_got_offset = -1; ++ ret->accomodate_trampoline = 0; + } + + return (struct bfd_hash_entry *) ret; +@@ -1335,16 +1347,38 @@ + eind->relocs_copied = NULL; + } + +- /* If the direct symbol already has an associated PLT entry, the +- indirect symbol should not. If it doesn't, swap refcount information +- from the indirect symbol. */ +- if (edir->plt_thumb_refcount == 0) ++ if (ind->root.type == bfd_link_hash_indirect) + { +- edir->plt_thumb_refcount = eind->plt_thumb_refcount; +- eind->plt_thumb_refcount = 0; ++ bfd_signed_vma tmp; ++ bfd_signed_vma lowest_valid = bed->can_refcount; ++ ++ /* If the direct symbol already has an associated PLT entry, the ++ indirect symbol should not. If it doesn't, swap refcount information ++ from the indirect symbol. */ ++#if NOTE_DEBUG ++ _bfd_error_handler(_("NOTE: %x(%s,%d,%d) <== %x(%s,%d,%d)"), ++ dir, dir->root.root.string, dir->plt.refcount, edir->plt_thumb_refcount, ++ ind, ind->root.root.string, ind->plt.refcount, eind->plt_thumb_refcount); ++#endif ++ ++ /* Copy over the global and procedure linkage table refcount entries. ++ These may have been already set up by a check_relocs routine. This ++ code duplicates that for the plt refcount in elf.c ++ _bfd_elf_link_hash_copy_indirect */ ++ tmp = dir->plt.refcount; ++ /* this obfuscated test evaluates to bed->can_refcount && plt.refcount == 0 ++ * || plt.refcount < 0. ++ */ ++ if (tmp < lowest_valid) ++ { ++ tmp = edir->plt_thumb_refcount; ++ edir->plt_thumb_refcount = eind->plt_thumb_refcount; ++ eind->plt_thumb_refcount = tmp; ++ BFD_ASSERT(eind->accomodate_trampoline == 0); ++ } ++ else ++ BFD_ASSERT (eind->plt_thumb_refcount == 0); + } +- else +- BFD_ASSERT (eind->plt_thumb_refcount == 0); + + _bfd_elf_link_hash_copy_indirect (bed, dir, ind); + } +@@ -2060,7 +2094,7 @@ + (*_bfd_error_handler) + (_("%B(%s): warning: interworking not enabled.\n" + " first occurrence: %B: thumb call to arm"), +- sym_sec->owner, input_bfd, name); ++ sym_sec->owner, name, input_bfd); + + return FALSE; + } +@@ -2165,7 +2199,7 @@ + (*_bfd_error_handler) + (_("%B(%s): warning: interworking not enabled.\n" + " first occurrence: %B: arm call to thumb"), +- sym_sec->owner, input_bfd, name); ++ sym_sec->owner, name, input_bfd); + } + + --my_offset; +@@ -2481,7 +2515,7 @@ + instruction instead ? */ + if (sym_flags != STT_ARM_TFUNC) + (*_bfd_error_handler) +- (_("\%B: Warning: Arm BLX instruction targets Arm function '%s'."), ++ (_("%B: Warning: Arm BLX instruction targets Arm function '%s'."), + input_bfd, + h ? h->root.root.string : "(local)"); + } +@@ -2697,6 +2731,20 @@ + /* Handle calls via the PLT. */ + if (h != NULL && splt != NULL && h->plt.offset != (bfd_vma) -1) + { ++ struct elf32_arm_link_hash_entry *eh; ++ eh = (struct elf32_arm_link_hash_entry *) h; ++ if (!eh->accomodate_trampoline) ++ { ++ /* %B of output_bfd crashes here, so %x is used instead */ ++ _bfd_error_handler( ++ _("ERROR: %B: %x(%s): missing thumb trampoline, refcount(thumb %d, plt %d) in %x at %x+%x+%x"), ++ input_bfd, h, h->root.root.string, eh->plt_thumb_refcount, ++ h->plt.refcount, output_bfd, splt->output_section->vma, ++ splt->output_offset, h->plt.offset); ++ /* The relocation would point to garbage, it gets skipped... */ ++ return bfd_reloc_dangerous; ++ } ++ + value = (splt->output_section->vma + + splt->output_offset + + h->plt.offset); +@@ -3525,8 +3573,9 @@ + { + _bfd_error_handler + (_("ERROR: Source object %B has EABI version %d, but target %B has EABI version %d"), +- ibfd, obfd, ++ ibfd, + (in_flags & EF_ARM_EABIMASK) >> 24, ++ obfd, + (out_flags & EF_ARM_EABIMASK) >> 24); + return FALSE; + } +@@ -3538,8 +3587,9 @@ + { + _bfd_error_handler + (_("ERROR: %B is compiled for APCS-%d, whereas target %B uses APCS-%d"), +- ibfd, obfd, ++ ibfd, + in_flags & EF_ARM_APCS_26 ? 26 : 32, ++ obfd, + out_flags & EF_ARM_APCS_26 ? 26 : 32); + flags_compatible = FALSE; + } +@@ -3903,10 +3953,18 @@ + eh = (struct elf32_arm_link_hash_entry *) h; + + if (h->plt.refcount > 0) ++ h->plt.refcount -= 1; ++ ++ if (ELF32_R_TYPE (rel->r_info) == R_ARM_THM_PC22) + { +- h->plt.refcount -= 1; +- if (ELF32_R_TYPE (rel->r_info) == R_ARM_THM_PC22) +- eh->plt_thumb_refcount--; ++ BFD_ASSERT (eh->plt_thumb_refcount > 0); ++ eh->plt_thumb_refcount--; ++ BFD_ASSERT (eh->accomodate_trampoline == 0); ++#if NOTE_DEBUG ++ _bfd_error_handler( ++ _("NOTE: %B: %x(%s): Thumb refcount decremented to %d (plt refcount %d)"), ++ abfd, h, h->root.root.string, eh->plt_thumb_refcount, h->plt.refcount); ++#endif + } + + if (r_type == R_ARM_ABS32 +@@ -3994,6 +4052,10 @@ + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + + eh = (struct elf32_arm_link_hash_entry *) h; ++#if NOTE_DEBUG ++ if (h != NULL) ++ _bfd_error_handler(_("NOTE: %B: %x(%s): verify relocation"), abfd, h, h->root.root.string); ++#endif + + switch (r_type) + { +@@ -4078,10 +4140,30 @@ + + /* If we create a PLT entry, this relocation will reference + it, even if it's an ABS32 relocation. */ +- h->plt.refcount += 1; ++ if (h->plt.refcount >= 0) ++ h->plt.refcount += 1; ++ else ++ { ++ /* This happens, I suspect it happens with glue code because, ++ * somehow, the backend data had can_refcount==0. Expert required... ++ */ ++ _bfd_error_handler( ++ _("WARNING: %B: %x(%s): PLT refcount was %d (set to 1)"), ++ abfd, h, h->root.root.string, h->plt.refcount); ++ h->plt.refcount = 1; ++ } + + if (r_type == R_ARM_THM_PC22) +- eh->plt_thumb_refcount += 1; ++ { ++ eh->plt_thumb_refcount += 1; ++ BFD_ASSERT (eh->plt_thumb_refcount <= h->plt.refcount); ++ BFD_ASSERT (eh->accomodate_trampoline == 0); ++#if NOTE_DEBUG ++ _bfd_error_handler( ++ _("NOTE: %B: %x(%s): Thumb refcount incremented to %d (plt refcount %d)"), ++ abfd, h, h->root.root.string, eh->plt_thumb_refcount, h->plt.refcount); ++#endif ++ } + } + + /* If we are creating a shared library or relocatable executable, +@@ -4376,8 +4458,15 @@ + object, or if all references were garbage collected. In + such a case, we don't actually need to build a procedure + linkage table, and we can just do a PC24 reloc instead. */ ++#if NOTE_DEBUG ++ _bfd_error_handler( ++ _("NOTE: %x(%s): Thumb refcount zeroed (plt refcount %d, thumb %d) (%s)"), ++ h, h->root.root.string, h->plt.refcount, eh->plt_thumb_refcount, ++ SYMBOL_CALLS_LOCAL (info, h) ? "local call" : "invisible"); ++#endif + h->plt.offset = (bfd_vma) -1; + eh->plt_thumb_refcount = 0; ++ BFD_ASSERT (eh->accomodate_trampoline == 0); + h->needs_plt = 0; + } + +@@ -4390,8 +4479,14 @@ + in check_relocs. We can't decide accurately between function + and non-function syms in check-relocs; Objects loaded later in + the link may change h->type. So fix it now. */ ++#if NOTE_DEBUG ++ _bfd_error_handler( ++ _("NOTE: %x(%s): Thumb refcount zeroed (%d, plt refcount %d)"), ++ h, h->root.root.string, eh->plt_thumb_refcount, h->plt.refcount); ++#endif + h->plt.offset = (bfd_vma) -1; + eh->plt_thumb_refcount = 0; ++ BFD_ASSERT (eh->accomodate_trampoline == 0); + } + + /* If this is a weak symbol, and there is a real definition, the +@@ -4521,8 +4616,14 @@ + for it. */ + if (!htab->symbian_p && eh->plt_thumb_refcount > 0) + { ++#if NOTE_DEBUG ++ _bfd_error_handler(_("NOTE: %x(%s): Thumb trampoline created at %x"), ++ h, h->root.root.string, h->plt.offset); ++#endif + h->plt.offset += PLT_THUMB_STUB_SIZE; + s->size += PLT_THUMB_STUB_SIZE; ++ BFD_ASSERT (eh->accomodate_trampoline == 0); ++ eh->accomodate_trampoline = 1; + } + + /* If this symbol is not defined in a regular file, and we are +@@ -5014,10 +5115,20 @@ + + if (eh->plt_thumb_refcount > 0) + { +- bfd_put_16 (output_bfd, elf32_arm_plt_thumb_stub[0], +- splt->contents + h->plt.offset - 4); +- bfd_put_16 (output_bfd, elf32_arm_plt_thumb_stub[1], +- splt->contents + h->plt.offset - 2); ++ if (eh->accomodate_trampoline == 1) ++ { ++ bfd_put_16 (output_bfd, elf32_arm_plt_thumb_stub[0], ++ splt->contents + h->plt.offset - 4); ++ bfd_put_16 (output_bfd, elf32_arm_plt_thumb_stub[1], ++ splt->contents + h->plt.offset - 2); ++ } ++ else ++ { ++ (*_bfd_error_handler) ( ++ _("%B: no space for THUMB trampoline at %x[%x]"), ++ output_bfd, h->plt.offset, got_offset); ++ return FALSE; ++ } + } + + bfd_put_32 (output_bfd, elf32_arm_plt_entry[0] | ((got_displacement & 0x0ff00000) >> 20), |