summaryrefslogtreecommitdiffstats
path: root/meta/packages/binutils/binutils-2.16
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2006-07-21 10:10:31 +0000
committerRichard Purdie <richard@openedhand.com>2006-07-21 10:10:31 +0000
commitb2f192faabe412adce79534e22efe9fb69ee40e2 (patch)
tree7076c49d4286f8a1733650bd8fbc7161af200d57 /meta/packages/binutils/binutils-2.16
parent2cf0eadf9f730027833af802d7e6c90b44248f80 (diff)
downloadpoky-b2f192faabe412adce79534e22efe9fb69ee40e2.tar.gz
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')
-rw-r--r--meta/packages/binutils/binutils-2.16/binutils-100_cflags_for_build.patch28
-rw-r--r--meta/packages/binutils/binutils-2.16/binutils-2.16-linux-uclibc.patch700
-rw-r--r--meta/packages/binutils/binutils-2.16/binutils-2.16-objcopy-rename-errorcode.patch29
-rw-r--r--meta/packages/binutils/binutils-2.16/binutils-2.16-thumb-glue.patch76
-rw-r--r--meta/packages/binutils/binutils-2.16/binutils-2.16-thumb-trampoline.patch292
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 @@
1--- binutils-2.16/binutils/Makefile.am.old 2005-06-05 16:59:47.000000000 +0100
2+++ binutils-2.16/binutils/Makefile.am 2005-06-05 17:00:39.000000000 +0100
3@@ -219,20 +219,20 @@
4 ./sysinfo$(EXEEXT_FOR_BUILD) -d <$(srcdir)/sysroff.info >sysroff.h
5
6 sysinfo$(EXEEXT_FOR_BUILD): sysinfo.o syslex.o
7- $(CC_FOR_BUILD) $(CFLAGS) $(LDFLAGS) -o $@ sysinfo.o syslex.o
8+ $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ sysinfo.o syslex.o
9
10 syslex.o:
11 if [ -r syslex.c ]; then \
12- $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS) syslex.c ; \
13+ $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) syslex.c ; \
14 else \
15- $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS) $(srcdir)/syslex.c ;\
16+ $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/syslex.c ;\
17 fi
18
19 sysinfo.o:
20 if [ -r sysinfo.c ]; then \
21- $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS) sysinfo.c ; \
22+ $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) sysinfo.c ; \
23 else \
24- $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS) $(srcdir)/sysinfo.c ; \
25+ $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/sysinfo.c ; \
26 fi
27
28 # 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 @@
1# This patch adds 'linux-uclibc' to all cases which otherwise only
2# fire for 'linux' - most of the time the 'linux-gnu*' cases. This
3# ensures that by default *-*-linux-uclibc is handled in the same way
4# as *-*-linux-gnu
5#
6--- binutils-2.16/bfd/config.bfd.orig 2005-09-06 19:58:39.153670708 -0700
7+++ binutils-2.16/bfd/config.bfd 2005-09-06 20:03:14.959026045 -0700
8@@ -140,7 +140,7 @@
9 targ_defvec=ecoffalpha_little_vec
10 targ_selvecs=bfd_elf64_alpha_vec
11 ;;
12- alpha*-*-linux-gnu* | alpha*-*-elf*)
13+ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc* | alpha*-*-elf*)
14 targ_defvec=bfd_elf64_alpha_vec
15 targ_selvecs=ecoffalpha_little_vec
16 ;;
17@@ -150,7 +150,7 @@
18 alpha*-*-*)
19 targ_defvec=ecoffalpha_little_vec
20 ;;
21- ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-gnu* | ia64*-*-elf* | ia64*-*-kfreebsd*-gnu)
22+ ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-gnu* | ia64*-*-linux-uclibc* | ia64*-*-elf* | ia64*-*-kfreebsd*-gnu)
23 targ_defvec=bfd_elf64_ia64_little_vec
24 targ_selvecs="bfd_elf64_ia64_big_vec bfd_efi_app_ia64_vec"
25 ;;
26@@ -227,7 +227,7 @@
27 targ_defvec=bfd_elf32_littlearm_vec
28 targ_selvecs=bfd_elf32_bigarm_vec
29 ;;
30- armeb-*-elf | arm*b-*-linux-gnu*)
31+ armeb-*-elf | arm*b-*-linux-gnu* | arm*b-*-linux-uclibc*)
32 targ_defvec=bfd_elf32_bigarm_vec
33 targ_selvecs=bfd_elf32_littlearm_vec
34 ;;
35@@ -235,7 +235,7 @@
36 targ_defvec=bfd_elf32_littlearm_vec
37 targ_selvecs=bfd_elf32_bigarm_vec
38 ;;
39- arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-conix* | \
40+ arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-linux-uclibc* | arm*-*-conix* | \
41 arm*-*-uclinux* | arm-*-kfreebsd*-gnu | \
42 arm*-*-eabi* )
43 targ_defvec=bfd_elf32_littlearm_vec
44@@ -385,7 +385,7 @@
45 ;;
46
47 #ifdef BFD64
48- hppa*64*-*-linux-gnu*)
49+ hppa*64*-*-linux-gnu* | hppa*64*-*-linux-uclibc*)
50 targ_defvec=bfd_elf64_hppa_linux_vec
51 targ_selvecs=bfd_elf64_hppa_vec
52 ;;
53@@ -396,7 +396,7 @@
54 ;;
55 #endif
56
57- hppa*-*-linux-gnu*)
58+ hppa*-*-linux-gnu* | hppa*-*-linux-uclibc*)
59 targ_defvec=bfd_elf32_hppa_linux_vec
60 targ_selvecs=bfd_elf32_hppa_vec
61 ;;
62@@ -529,7 +529,7 @@
63 targ_selvecs=bfd_elf32_i386_vec
64 targ_underscore=yes
65 ;;
66- i[3-7]86-*-linux-gnu*)
67+ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*)
68 targ_defvec=bfd_elf32_i386_vec
69 targ_selvecs="i386linux_vec bfd_efi_app_ia32_vec"
70 targ64_selvecs=bfd_elf64_x86_64_vec
71@@ -543,7 +543,7 @@
72 targ_defvec=bfd_elf64_x86_64_vec
73 targ_selvecs="bfd_elf32_i386_vec i386netbsd_vec i386coff_vec bfd_efi_app_ia32_vec"
74 ;;
75- x86_64-*-linux-gnu*)
76+ x86_64-*-linux-gnu* | x86_64-*-linux-uclibc*)
77 targ_defvec=bfd_elf64_x86_64_vec
78 targ_selvecs="bfd_elf32_i386_vec i386linux_vec bfd_efi_app_ia32_vec"
79 ;;
80@@ -719,7 +719,7 @@
81 targ_selvecs=bfd_elf32_m68k_vec
82 targ_underscore=yes
83 ;;
84- m68*-*-linux-gnu*)
85+ m68*-*-linux-gnu* | m68*-*-linux-uclibc*)
86 targ_defvec=bfd_elf32_m68k_vec
87 targ_selvecs=m68klinux_vec
88 ;;
89@@ -1005,7 +1005,7 @@
90 ;;
91 #endif
92 powerpc-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \
93- powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-rtems* | \
94+ powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-linux-uclibc* | powerpc-*-rtems* | \
95 powerpc-*-chorus* | powerpc-*-vxworks* | powerpc-*-windiss*)
96 targ_defvec=bfd_elf32_powerpc_vec
97 targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_vec"
98@@ -1042,7 +1042,7 @@
99 targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec"
100 ;;
101 powerpcle-*-elf* | powerpcle-*-sysv4* | powerpcle-*-eabi* | \
102- powerpcle-*-solaris2* | powerpcle-*-linux-gnu* | powerpcle-*-vxworks* |\
103+ powerpcle-*-solaris2* | powerpcle-*-linux-gnu* | powerpcle-*-linux-uclibc* | powerpcle-*-vxworks* |\
104 powerpcle-*-rtems*)
105 targ_defvec=bfd_elf32_powerpcle_vec
106 targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec"
107@@ -1213,7 +1213,7 @@
108 targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec"
109 targ_underscore=yes
110 ;;
111- sparc-*-linux-gnu*)
112+ sparc-*-linux-gnu* | sparc-*-linux-uclibc*)
113 targ_defvec=bfd_elf32_sparc_vec
114 targ_selvecs="sparclinux_vec bfd_elf64_sparc_vec sunos_big_vec"
115 ;;
116@@ -1260,7 +1260,7 @@
117 targ_defvec=sunos_big_vec
118 targ_underscore=yes
119 ;;
120- sparc64-*-linux-gnu*)
121+ sparc64-*-linux-gnu* | sparc64-*-linux-uclibc*)
122 targ_defvec=bfd_elf64_sparc_vec
123 targ_selvecs="bfd_elf32_sparc_vec sparclinux_vec sunos_big_vec"
124 ;;
125@@ -1329,7 +1329,7 @@
126 targ_underscore=yes
127 ;;
128
129- vax-*-linux-gnu*)
130+ vax-*-linux-gnu* | vax-*-linux-uclibc*)
131 targ_defvec=bfd_elf32_vax_vec
132 ;;
133
134--- binutils-2.16/bfd/configure.in.orig 2005-09-06 20:25:48.848220921 -0700
135+++ binutils-2.16/bfd/configure.in 2005-09-06 20:26:58.628611924 -0700
136@@ -163,7 +163,7 @@
137 alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
138 COREFILE=''
139 ;;
140- alpha*-*-linux-gnu*)
141+ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc*)
142 COREFILE=trad-core.lo
143 TRAD_HEADER='"hosts/alphalinux.h"'
144 ;;
145@@ -248,7 +248,7 @@
146 TRAD_HEADER='"hosts/i386mach3.h"'
147 ;;
148 changequote(,)dnl
149- i[3-7]86-*-linux-gnu*)
150+ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*)
151 changequote([,])dnl
152 COREFILE=trad-core.lo
153 TRAD_HEADER='"hosts/i386linux.h"'
154@@ -289,7 +289,7 @@
155 COREFILE=trad-core.lo
156 TRAD_HEADER='"hosts/hp300bsd.h"'
157 ;;
158- m68*-*-linux-gnu*)
159+ m68*-*-linux-gnu* | m68*-*-linux-uclibc*)
160 COREFILE=trad-core.lo
161 TRAD_HEADER='"hosts/m68klinux.h"'
162 ;;
163@@ -375,7 +375,7 @@
164 COREFILE=trad-core.lo
165 TRAD_HEADER='"hosts/vaxult2.h"'
166 ;;
167- vax-*-linux-gnu*)
168+ vax-*-linux-gnu* | vax-*-linux-uclibc*)
169 COREFILE=trad-core.lo
170 TRAD_HEADER='"hosts/vaxlinux.h"'
171 ;;
172--- binutils-2.16/bfd/configure.orig 2005-09-06 20:03:14.991028059 -0700
173+++ binutils-2.16/bfd/configure 2005-09-06 20:04:48.512913020 -0700
174@@ -3572,7 +3572,7 @@
175 ;;
176
177 # This must be Linux ELF.
178-linux-gnu*)
179+linux-gnu* | linux-uclibc*)
180 case $host_cpu in
181 alpha* | mips* | hppa* | i*86 | powerpc* | sparc* | ia64* )
182 lt_cv_deplibs_check_method=pass_all ;;
183@@ -9918,7 +9918,7 @@
184 alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
185 COREFILE=''
186 ;;
187- alpha*-*-linux-gnu*)
188+ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc*)
189 COREFILE=trad-core.lo
190 TRAD_HEADER='"hosts/alphalinux.h"'
191 ;;
192@@ -9982,7 +9982,7 @@
193 COREFILE=trad-core.lo
194 TRAD_HEADER='"hosts/i386mach3.h"'
195 ;;
196- i[3-7]86-*-linux-gnu*)
197+ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*)
198 COREFILE=trad-core.lo
199 TRAD_HEADER='"hosts/i386linux.h"'
200 ;;
201@@ -10020,7 +10020,7 @@
202 COREFILE=trad-core.lo
203 TRAD_HEADER='"hosts/hp300bsd.h"'
204 ;;
205- m68*-*-linux-gnu*)
206+ m68*-*-linux-gnu* | m68*-*-linux-uclibc*)
207 COREFILE=trad-core.lo
208 TRAD_HEADER='"hosts/m68klinux.h"'
209 ;;
210@@ -10154,7 +10154,7 @@
211 COREFILE=trad-core.lo
212 TRAD_HEADER='"hosts/vaxult2.h"'
213 ;;
214- vax-*-linux-gnu*)
215+ vax-*-linux-gnu* | vax-*-linux-uclibc*)
216 COREFILE=trad-core.lo
217 TRAD_HEADER='"hosts/vaxlinux.h"'
218 ;;
219--- binutils-2.16/binutils/configure.orig 2005-09-06 20:26:58.676614945 -0700
220+++ binutils-2.16/binutils/configure 2005-09-06 20:27:21.230034142 -0700
221@@ -1564,7 +1564,7 @@
222 ;;
223
224 # This must be Linux ELF.
225-linux-gnu*)
226+linux-gnu* | linux-uclibc*)
227 case $host_cpu in
228 alpha* | mips* | hppa* | i*86 | powerpc* | sparc* | ia64* )
229 lt_cv_deplibs_check_method=pass_all ;;
230--- binutils-2.16/configure.in.orig 2005-09-06 20:31:11.872547560 -0700
231+++ binutils-2.16/configure.in 2005-09-06 20:31:47.322778302 -0700
232@@ -346,7 +346,7 @@
233 ;;
234 "")
235 case "${target}" in
236- *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu)
237+ *-*-linux*-gnu | *-*-linux*-uclibc | *-*-gnu* | *-*-k*bsd*-gnu)
238 # Enable libmudflap by default in GNU and friends.
239 ;;
240 *-*-freebsd*)
241--- binutils-2.16/configure.orig 2005-09-06 20:30:00.120032459 -0700
242+++ binutils-2.16/configure 2005-09-06 20:31:11.832545043 -0700
243@@ -1142,7 +1142,7 @@
244 ;;
245 "")
246 case "${target}" in
247- *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu)
248+ *-*-linux*-gnu | *-*-linux*-uclibc | *-*-gnu* | *-*-k*bsd*-gnu)
249 # Enable libmudflap by default in GNU and friends.
250 ;;
251 *-*-freebsd*)
252--- binutils-2.16/gas/configure.in.orig 2005-09-06 20:32:36.993903909 -0700
253+++ binutils-2.16/gas/configure.in 2005-09-06 20:32:55.667078938 -0700
254@@ -161,7 +161,7 @@
255 AC_DEFINE(AIX_WEAK_SUPPORT, 1,
256 [Define if using AIX 5.2 value for C_WEAKEXT.])
257 ;;
258- ppc-*-linux-gnu*)
259+ ppc-*-linux-gnu* | ppc-*-linux-uclibc*)
260 case "$endian" in
261 big) ;;
262 *) AC_MSG_ERROR(GNU/Linux must be configured big endian) ;;
263--- binutils-2.16/gas/configure.orig 2005-09-06 20:31:55.247276960 -0700
264+++ binutils-2.16/gas/configure 2005-09-06 20:32:36.961901896 -0700
265@@ -3409,7 +3409,7 @@
266 ;;
267
268 # This must be Linux ELF.
269-linux-gnu*)
270+linux-gnu* | linux-uclibc*)
271 case $host_cpu in
272 alpha* | mips* | hppa* | i*86 | powerpc* | sparc* | ia64* )
273 lt_cv_deplibs_check_method=pass_all ;;
274@@ -4462,7 +4462,7 @@
275 _ACEOF
276
277 ;;
278- ppc-*-linux-gnu*)
279+ ppc-*-linux-gnu* | ppc-*-linux-uclibc*)
280 case "$endian" in
281 big) ;;
282 *) { { echo "$as_me:$LINENO: error: GNU/Linux must be configured big endian" >&5
283--- binutils-2.16/gas/configure.tgt.orig 2005-09-06 20:32:55.695080700 -0700
284+++ binutils-2.16/gas/configure.tgt 2005-09-06 20:35:59.482645723 -0700
285@@ -100,7 +100,7 @@
286 alpha-*-*vms*) fmt=evax ;;
287 alpha-*-osf*) fmt=ecoff ;;
288 alpha-*-linuxecoff*) fmt=ecoff ;;
289- alpha-*-linux-gnu*) fmt=elf em=linux ;;
290+ alpha-*-linux-gnu* | alpha-*-linux-uclibc*) fmt=elf em=linux ;;
291 alpha-*-netbsd*) fmt=elf em=nbsd ;;
292 alpha-*-openbsd*) fmt=elf em=obsd ;;
293
294@@ -116,7 +116,7 @@
295 arm-*-conix*) fmt=elf ;;
296 arm-*-linux*aout*) fmt=aout em=linux ;;
297 arm-*-linux-gnueabi*) fmt=elf em=armlinuxeabi ;;
298- arm-*-linux-gnu*) fmt=elf em=linux ;;
299+ arm-*-linux-gnu* | arm-*-linux-uclibc*) fmt=elf em=linux ;;
300 arm-*-uclinux*) fmt=elf em=linux ;;
301 arm-*-netbsdelf*) fmt=elf em=nbsd ;;
302 arm-*-*n*bsd*) fmt=aout em=nbsd ;;
303@@ -128,7 +128,7 @@
304
305 avr-*-*) fmt=elf ;;
306
307- cris-*-linux-gnu* | crisv32-*-linux-gnu*)
308+ cris-*-linux-gnu* | crisv32-*-linux-gnu* | cris-*-linux-uclibc* | crisv32-*-linux-uclibc*)
309 fmt=multi bfd_gas=yes em=linux ;;
310 cris-*-* | crisv32-*-*) fmt=multi bfd_gas=yes ;;
311
312@@ -192,7 +192,7 @@
313 i386-*-linux*aout*) fmt=aout em=linux ;;
314 i386-*-linux*oldld) fmt=aout em=linux ;;
315 i386-*-linux*coff*) fmt=coff em=linux ;;
316- i386-*-linux-gnu*) fmt=elf em=linux ;;
317+ i386-*-linux-gnu* | i386-*-linux-uclibc*) fmt=elf em=linux ;;
318 i386-*-lynxos*) fmt=elf em=lynx bfd_gas=yes ;;
319 i386-*-sysv[45]*) fmt=elf ;;
320 i386-*-solaris*) fmt=elf ;;
321@@ -238,7 +238,7 @@
322
323 ia64-*-elf*) fmt=elf ;;
324 ia64-*-aix*) fmt=elf em=ia64aix ;;
325- ia64-*-linux-gnu*) fmt=elf em=linux ;;
326+ ia64-*-linux-gnu* | ia64-*-linux-uclibc*) fmt=elf em=linux ;;
327 ia64-*-hpux*) fmt=elf em=hpux ;;
328 ia64-*-netbsd*) fmt=elf em=nbsd ;;
329
330@@ -265,7 +265,7 @@
331 m68k-*-rtems*) fmt=elf ;;
332 m68k-*-hpux*) fmt=hp300 em=hp300 ;;
333 m68k-*-linux*aout*) fmt=aout em=linux ;;
334- m68k-*-linux-gnu*) fmt=elf em=linux ;;
335+ m68k-*-linux-gnu* | m68k-*-linux-uclibc*) fmt=elf em=linux ;;
336 m68k-*-uclinux*) fmt=elf ;;
337 m68k-*-gnu*) fmt=elf ;;
338 m68k-*-netbsdelf*) fmt=elf em=nbsd ;;
339@@ -332,7 +332,7 @@
340 ppc-*-beos*) fmt=coff ;;
341 ppc-*-*n*bsd* | ppc-*-elf*) fmt=elf ;;
342 ppc-*-eabi* | ppc-*-sysv4*) fmt=elf ;;
343- ppc-*-linux-gnu*) fmt=elf em=linux ;;
344+ ppc-*-linux-gnu* | ppc-*-linux-uclibc*) fmt=elf em=linux ;;
345 ppc-*-solaris*) fmt=elf ;;
346 ppc-*-rtems*) fmt=elf ;;
347 ppc-*-macos*) fmt=coff em=macos ;;
348@@ -340,7 +340,7 @@
349 ppc-*-kaos*) fmt=elf ;;
350 ppc-*-lynxos*) fmt=elf em=lynx bfd_gas=yes ;;
351
352- s390-*-linux-gnu*) fmt=elf em=linux ;;
353+ s390-*-linux-gnu* | s390-*-linux-uclibc*) fmt=elf em=linux ;;
354 s390-*-tpf*) fmt=elf ;;
355
356 sh*-*-linux*) fmt=elf em=linux
357@@ -369,7 +369,7 @@
358 sparc-*-aout | sparc*-*-vxworks*) fmt=aout em=sparcaout ;;
359 sparc-*-coff) fmt=coff ;;
360 sparc-*-linux*aout*) fmt=aout em=linux ;;
361- sparc-*-linux-gnu*) fmt=elf em=linux ;;
362+ sparc-*-linux-gnu* | sparc-*-linux-uclibc*) fmt=elf em=linux ;;
363 sparc-fujitsu-none) fmt=aout ;;
364 sparc-*-elf) fmt=elf ;;
365 sparc-*-sysv4*) fmt=elf ;;
366@@ -398,7 +398,7 @@
367 vax-*-netbsdelf*) fmt=elf em=nbsd ;;
368 vax-*-netbsd*) fmt=aout em=nbsd ;;
369 vax-*-bsd* | vax-*-ultrix*) fmt=aout ;;
370- vax-*-linux-gnu*) fmt=elf em=linux bfd_gas=yes ;;
371+ vax-*-linux-gnu* | vax-*-linux-uclibc*) fmt=elf em=linux bfd_gas=yes ;;
372
373 w65-*-*) fmt=coff ;;
374
375--- binutils-2.16/gprof/configure.orig 2005-09-06 20:36:04.850983531 -0700
376+++ binutils-2.16/gprof/configure 2005-09-06 20:36:26.344336022 -0700
377@@ -3407,7 +3407,7 @@
378 ;;
379
380 # This must be Linux ELF.
381-linux-gnu*)
382+linux-gnu* | linux-uclibc*)
383 case $host_cpu in
384 alpha* | mips* | hppa* | i*86 | powerpc* | sparc* | ia64* )
385 lt_cv_deplibs_check_method=pass_all ;;
386--- binutils-2.16/ld/configure.host.orig 2005-09-06 20:37:46.085353808 -0700
387+++ binutils-2.16/ld/configure.host 2005-09-06 20:40:03.381993341 -0700
388@@ -83,7 +83,7 @@
389 HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,ld\[^ \]\*,ld-linux,g"`
390 ;;
391
392-arm*-*-linux-gnu*)
393+arm*-*-linux-gnu* | arm*-*-linux-uclibc*)
394 HOSTING_CRT0='-p '`echo "$HOSTING_CRT0" | sed -e "s,ld\[^ \]\*,ld-linux,g"`
395 ;;
396
397@@ -141,7 +141,7 @@
398 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`'
399 ;;
400
401-ia64-*-linux-gnu*)
402+ia64-*-linux-gnu* | ia64-*-linux-uclibc*)
403 HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,ld\[^ \]*\*,ld-linux-ia64,g"`
404 ;;
405
406@@ -155,11 +155,11 @@
407 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'
408 ;;
409
410-mips*-*-linux-gnu*)
411+mips*-*-linux-gnu* | mips*-*-linux-uclibc*)
412 HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`specs.*\"\\\`,/lib/ld.so.1,"`
413 ;;
414
415-m68*-*-linux-gnu*)
416+m68*-*-linux-gnu* | m68*-*-linux-uclibc*)
417 HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`specs.*\"\\\`,/lib/ld.so.1,"`
418 ;;
419
420@@ -183,19 +183,19 @@
421 HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi`'
422 ;;
423
424-powerpc64*-*-linux-gnu*)
425+powerpc64*-*-linux-gnu* | powerpc64*-*-linux-uclibc*)
426 HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`specs.*\"\\\`,/lib64/ld64.so.1,"`
427 ;;
428
429-powerpc*-*-linux-gnu*)
430+powerpc*-*-linux-gnu* | powerpc*-*-linux-uclibc*)
431 HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`specs.*\"\\\`,/lib/ld.so.1,"`
432 ;;
433
434-s390x-*-linux-gnu*)
435+s390x-*-linux-gnu* | s390x-*-linux-uclibc*)
436 HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`specs.*\"\\\`,/lib/ld64.so.1,"`
437 ;;
438
439-s390-*-linux-gnu*)
440+s390-*-linux-gnu* | s390-*-linux-uclibc*)
441 HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`specs.*\"\\\`,/lib/ld.so.1,"`
442 ;;
443
444@@ -209,15 +209,15 @@
445 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`'
446 ;;
447
448-sparc-*-linux-gnu*)
449+sparc-*-linux-gnu* | sparc-*-linux-uclibc*)
450 HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`specs.*\"\\\`,/lib/ld-linux.so.2,"`
451 ;;
452
453-sparc64-*-linux-gnu*)
454+sparc64-*-linux-gnu* | sparc64-*-linux-uclibc*)
455 HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`specs.*\"\\\`,/lib64/ld-linux.so.2,"`
456 ;;
457
458-x86_64-*-linux-gnu*)
459+x86_64-*-linux-gnu* | x86_64-*-linux-uclibc*)
460 HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`specs.*\"\\\`,/lib64/ld-linux-x86-64.so.2,"`
461 ;;
462
463--- binutils-2.16/ld/configure.orig 2005-09-06 20:37:34.700637413 -0700
464+++ binutils-2.16/ld/configure 2005-09-06 20:37:46.013349277 -0700
465@@ -1568,7 +1568,7 @@
466 ;;
467
468 # This must be Linux ELF.
469-linux-gnu*)
470+linux-gnu* | linux-uclibc*)
471 case $host_cpu in
472 alpha* | mips* | hppa* | i*86 | powerpc* | sparc* | ia64* )
473 lt_cv_deplibs_check_method=pass_all ;;
474--- binutils-2.16/ld/configure.tgt.orig 2005-09-06 20:40:03.413995355 -0700
475+++ binutils-2.16/ld/configure.tgt 2005-09-06 20:45:48.111685813 -0700
476@@ -30,7 +30,7 @@
477 cris-*-*aout*) targ_emul=crisaout
478 targ_extra_emuls="criself crislinux"
479 targ_extra_libpath=$targ_extra_emuls ;;
480-cris-*-linux-gnu* | cris-*-linux-gnu*)
481+cris-*-linux-gnu* | cris-*-linux-gnu* | cris-*-linux-uclibc* | cris-*-linux-uclibc*)
482 targ_emul=crislinux ;;
483 cris-*-* | crisv32-*-*) targ_emul=criself
484 targ_extra_emuls="crisaout crislinux"
485@@ -62,14 +62,14 @@
486 tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/aout//'`
487 tdir_sun4=sparc-sun-sunos4
488 ;;
489-sparc64-*-linux-gnu*) targ_emul=elf64_sparc
490+sparc64-*-linux-gnu* | sparc64-*-linux-uclibc*) targ_emul=elf64_sparc
491 targ_extra_emuls="elf32_sparc sparclinux sun4"
492 targ_extra_libpath=elf32_sparc
493 tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/64//'`
494 tdir_sparclinux=${tdir_elf32_sparc}aout
495 tdir_sun4=sparc-sun-sunos4
496 ;;
497-sparc*-*-linux-gnu*) targ_emul=elf32_sparc
498+sparc*-*-linux-gnu* | sparc*-*-linux-uclibc*) targ_emul=elf32_sparc
499 targ_extra_emuls="sparclinux elf64_sparc sun4"
500 targ_extra_libpath=elf64_sparc
501 tdir_sparclinux=${targ_alias}aout
502@@ -119,8 +119,8 @@
503 ia64-*-aix*) targ_emul=elf64_aix ;;
504 m32r*le-*-elf*) targ_emul=m32rlelf ;;
505 m32r*-*-elf*) targ_emul=m32relf ;;
506-m32r*le-*-linux-gnu*) targ_emul=m32rlelf_linux ;;
507-m32r*-*-linux-gnu*) targ_emul=m32relf_linux ;;
508+m32r*le-*-linux-gnu* | m32r*le-*-linux-uclibc*) targ_emul=m32rlelf_linux ;;
509+m32r*-*-linux-gnu* | m32r*-*-linux-uclibc*) targ_emul=m32relf_linux ;;
510 m68hc11-*-*|m6811-*-*) targ_emul=m68hc11elf
511 targ_extra_emuls="m68hc11elfb m68hc12elf m68hc12elfb" ;;
512 m68hc12-*-*|m6812-*-*) targ_emul=m68hc12elf
513@@ -131,7 +131,7 @@
514 m68*-apple-aux*) targ_emul=m68kaux ;;
515 maxq-*-coff) targ_emul=maxqcoff;;
516 *-tandem-none) targ_emul=st2000 ;;
517-i370-*-elf* | i370-*-linux-gnu*) targ_emul=elf32i370 ;;
518+i370-*-elf* | i370-*-linux-gnu* | i370-*-linux-uclibc*) targ_emul=elf32i370 ;;
519 i[3-7]86-*-nto-qnx*) targ_emul=i386nto ;;
520 i[3-7]86-*-vsta) targ_emul=vsta ;;
521 i[3-7]86-go32-rtems*) targ_emul=i386go32 ;;
522@@ -155,14 +155,14 @@
523 tdir_elf_i386=`echo ${targ_alias} | sed -e 's/aout//'`
524 ;;
525 i[3-7]86-*-linux*oldld) targ_emul=i386linux; targ_extra_emuls=elf_i386 ;;
526-i[3-7]86-*-linux-gnu*) targ_emul=elf_i386
527+i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*) targ_emul=elf_i386
528 targ_extra_emuls=i386linux
529 if test x${want64} = xtrue; then
530 targ_extra_emuls="$targ_extra_emuls elf_x86_64"
531 fi
532 tdir_i386linux=${targ_alias}aout
533 ;;
534-x86_64-*-linux-gnu*) targ_emul=elf_x86_64
535+x86_64-*-linux-gnu* | x86_64-*-linux-uclibc*) targ_emul=elf_x86_64
536 targ_extra_emuls="elf_i386 i386linux"
537 targ_extra_libpath=elf_i386
538 tdir_i386linux=`echo ${targ_alias}aout | sed -e 's/x86_64/i386/'`
539@@ -262,13 +262,14 @@
540 arm-*-kaos*) targ_emul=armelf ;;
541 arm9e-*-elf) targ_emul=armelf ;;
542 arm*b-*-linux-gnueabi) targ_emul=armelfb_linux_eabi ;;
543-arm*b-*-linux-gnu*) targ_emul=armelfb_linux; targ_extra_emuls=armelfb ;;
544+arm*b-*-linux-gnu* | arm*b-*-linux-uclibc*) targ_emul=armelfb_linux; targ_extra_emuls=armelfb ;;
545 arm*-*-linux-gnueabi) targ_emul=armelf_linux_eabi ;;
546-arm*-*-linux-gnu*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;;
547+arm*-*-linux-gnu* | arm*-*-linux-uclibc*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;;
548 arm*-*-uclinux*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;;
549 arm-*-vxworks) targ_emul=armelf_vxworks ;;
550 arm*-*-conix*) targ_emul=armelf ;;
551-thumb-*-linux-gnu* | thumb-*-uclinux*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;;
552+thumb-*-linux-gnu* | thumb-*-linux-uclibc* | thumb-*-uclinux*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;;
553+thumbb-*-linux-gnu* | thumbb-*-linux-uclibc* | thumbb-*-uclinux*) targ_emul=armelfb_linux; targ_extra_emuls=armelfb ;;
554 strongarm-*-coff) targ_emul=armcoff ;;
555 strongarm-*-elf) targ_emul=armelf ;;
556 strongarm-*-kaos*) targ_emul=armelf ;;
557@@ -372,7 +373,7 @@
558 targ_extra_emuls=m68kelf
559 tdir_m68kelf=`echo ${targ_alias} | sed -e 's/aout//'`
560 ;;
561-m68k-*-linux-gnu*) targ_emul=m68kelf
562+m68k-*-linux-gnu* | m68k-*-linux-uclibc*) targ_emul=m68kelf
563 targ_extra_emuls=m68klinux
564 tdir_m68klinux=`echo ${targ_alias} | sed -e 's/linux/linuxaout/'`
565 ;;
566@@ -388,9 +389,9 @@
567 m68*-*-psos*) targ_emul=m68kpsos ;;
568 m68*-*-rtemscoff*) targ_emul=m68kcoff ;;
569 m68*-*-rtems*) targ_emul=m68kelf ;;
570-hppa*64*-*-linux-gnu*) targ_emul=hppa64linux ;;
571+hppa*64*-*-linux-gnu* | hppa*64*-*-linux-uclibc*) targ_emul=hppa64linux ;;
572 hppa*64*-*) targ_emul=elf64hppa ;;
573-hppa*-*-linux-gnu*) targ_emul=hppalinux ;;
574+hppa*-*-linux-gnu* | hppa*-*-linux-uclibc*) targ_emul=hppalinux ;;
575 hppa*-*-*elf*) targ_emul=hppaelf ;;
576 hppa*-*-lites*) targ_emul=hppaelf ;;
577 hppa*-*-netbsd*) targ_emul=hppanbsd ;;
578@@ -402,7 +403,7 @@
579 vax-*-netbsdaout* | vax-*-netbsd*)
580 targ_emul=vaxnbsd
581 targ_extra_emuls=elf32vax ;;
582-vax-*-linux-gnu*) targ_emul=elf32vax ;;
583+vax-*-linux-gnu* | vax-*-linux-uclibc*) targ_emul=elf32vax ;;
584 mips*-*-pe) targ_emul=mipspe ;
585 targ_extra_ofiles="deffilep.o pe-dll.o" ;;
586 mips*-dec-ultrix*) targ_emul=mipslit ;;
587@@ -436,18 +437,18 @@
588 mips*-*-vxworks*) targ_emul=elf32ebmip
589 targ_extra_emuls="elf32elmip" ;;
590 mips*-*-windiss) targ_emul=elf32mipswindiss ;;
591-mips64*el-*-linux-gnu*) targ_emul=elf32ltsmipn32
592+mips64*el-*-linux-gnu* | mips64*el-*-linux-uclibc*) targ_emul=elf32ltsmipn32
593 targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip"
594 targ_extra_libpath="elf32ltsmip elf64ltsmip"
595 ;;
596-mips64*-*-linux-gnu*) targ_emul=elf32btsmipn32
597+mips64*-*-linux-gnu* | mips64*-*-linux-uclibc*) targ_emul=elf32btsmipn32
598 targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip"
599 targ_extra_libpath="elf32btsmip elf64btsmip"
600 ;;
601-mips*el-*-linux-gnu*) targ_emul=elf32ltsmip
602+mips*el-*-linux-gnu* | mips*el-*-linux-uclibc*) targ_emul=elf32ltsmip
603 targ_extra_emuls="elf32btsmip elf32ltsmipn32 elf64ltsmip elf32btsmipn32 elf64btsmip"
604 ;;
605-mips*-*-linux-gnu*) targ_emul=elf32btsmip
606+mips*-*-linux-gnu* | mips*-*-linux-uclibc*) targ_emul=elf32btsmip
607 targ_extra_emuls="elf32ltsmip elf32btsmipn32 elf64btsmip elf32ltsmipn32 elf64ltsmip"
608 ;;
609 mips*-*-lnews*) targ_emul=mipslnews ;;
610@@ -467,7 +468,7 @@
611 alpha*-*-linuxecoff*) targ_emul=alpha targ_extra_emuls=elf64alpha
612 tdir_elf64alpha=`echo ${targ_alias} | sed -e 's/ecoff//'`
613 ;;
614-alpha*-*-linux-gnu*) targ_emul=elf64alpha targ_extra_emuls=alpha
615+alpha*-*-linux-gnu* | alpha*-*-linux-uclibc*) targ_emul=elf64alpha targ_extra_emuls=alpha
616 tdir_alpha=`echo ${targ_alias} | sed -e 's/linux/linuxecoff/'`
617 ;;
618 alpha*-*-osf*) targ_emul=alpha ;;
619--- binutils-2.16/ld/emultempl/elf32.em.orig 2005-09-06 20:45:48.247694371 -0700
620+++ binutils-2.16/ld/emultempl/elf32.em 2005-09-06 20:46:39.158898011 -0700
621@@ -65,7 +65,7 @@
622
623 if [ "x${USE_LIBPATH}" = xyes ] ; then
624 case ${target} in
625- *-*-linux-gnu*)
626+ *-*-linux-gnu* | *-*-linux-uclibc*)
627 cat >>e${EMULATION_NAME}.c <<EOF
628 #ifdef HAVE_GLOB
629 #include <glob.h>
630@@ -350,7 +350,7 @@
631
632 EOF
633 case ${target} in
634- *-*-linux-gnu*)
635+ *-*-linux-gnu* | *-*-linux-uclibc*)
636 cat >>e${EMULATION_NAME}.c <<EOF
637 {
638 struct bfd_link_needed_list *l;
639@@ -522,7 +522,7 @@
640
641 EOF
642 case ${target} in
643- *-*-linux-gnu*)
644+ *-*-linux-gnu* | *-*-linux-uclibc*)
645 cat >>e${EMULATION_NAME}.c <<EOF
646 /* For a native linker, check the file /etc/ld.so.conf for directories
647 in which we may find shared libraries. /etc/ld.so.conf is really
648@@ -932,7 +932,7 @@
649 EOF
650 if [ "x${USE_LIBPATH}" = xyes ] ; then
651 case ${target} in
652- *-*-linux-gnu*)
653+ *-*-linux-gnu* | *-*-linux-uclibc*)
654 cat >>e${EMULATION_NAME}.c <<EOF
655 if (gld${EMULATION_NAME}_check_ld_so_conf (l->name, force))
656 break;
657--- binutils-2.16/libtool.m4.orig 2005-09-06 20:46:55.131903129 -0700
658+++ binutils-2.16/libtool.m4 2005-09-06 20:47:07.364672889 -0700
659@@ -634,7 +634,7 @@
660 ;;
661
662 # This must be Linux ELF.
663-linux-gnu*)
664+linux-gnu* | linux-uclibc*)
665 case $host_cpu in
666 alpha* | mips* | hppa* | i*86 | powerpc* | sparc* | ia64* )
667 lt_cv_deplibs_check_method=pass_all ;;
668--- binutils-2.16/ltconfig.orig 2005-09-06 20:47:13.965088227 -0700
669+++ binutils-2.16/ltconfig 2005-09-06 20:49:12.944575134 -0700
670@@ -1247,7 +1247,7 @@
671 ;;
672
673 # This must be Linux ELF.
674-linux-gnu*)
675+linux-gnu* | linux-uclibc*)
676 version_type=linux
677 need_lib_prefix=no
678 need_version=no
679--- binutils-2.16/ltmain.sh.orig 2005-09-06 20:49:12.980577399 -0700
680+++ binutils-2.16/ltmain.sh 2005-09-06 20:50:15.180491393 -0700
681@@ -2600,7 +2600,7 @@
682 versuffix="$major.$revision"
683 ;;
684
685- linux)
686+ linux | linux-uclibc)
687 major=.`expr $current - $age`
688 versuffix="$major.$age.$revision"
689 ;;
690--- binutils-2.16/opcodes/configure.orig 2005-09-06 20:50:15.220493910 -0700
691+++ binutils-2.16/opcodes/configure 2005-09-06 20:50:38.053930728 -0700
692@@ -3576,7 +3576,7 @@
693 ;;
694
695 # This must be Linux ELF.
696-linux-gnu*)
697+linux-gnu* | linux-uclibc*)
698 case $host_cpu in
699 alpha* | mips* | hppa* | i*86 | powerpc* | sparc* | ia64* )
700 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 @@
1# strip (and objcopy) fail to set the error code if there is no
2# output file name and the rename of the stripped (or copied) file
3# fails, yet the command fails to do anything. This fixes both
4# objcopy and strip.
5#
6#Signed-off-by: John Bowler <jbowler@acm.org>
7
8--- binutils-2.16/binutils/objcopy.c.orig 2006-01-31 11:15:38.797318519 -0800
9+++ binutils-2.16/binutils/objcopy.c 2006-01-31 11:15:40.463318516 -0800
10@@ -2434,7 +2434,8 @@ strip_main (int argc, char *argv[])
11 if (preserve_dates)
12 set_times (tmpname, &statbuf);
13 if (output_file == NULL)
14- smart_rename (tmpname, argv[i], preserve_dates);
15+ if (smart_rename (tmpname, argv[i], preserve_dates))
16+ hold_status = 1;
17 status = hold_status;
18 }
19 else
20@@ -3013,7 +3014,8 @@ copy_main (int argc, char *argv[])
21 {
22 if (preserve_dates)
23 set_times (tmpname, &statbuf);
24- smart_rename (tmpname, input_filename, preserve_dates);
25+ if (smart_rename (tmpname, input_filename, preserve_dates))
26+ status = 1;
27 }
28 else
29 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 @@
1# The ARM->Thumb glue uses an ldr of the target function address, this
2# simply doesn't work for PIC code, changed to use 4 word PIC glue
3#
4--- binutils-2.16/.pc/binutils-2.16-thumb-glue.patch/bfd/elf32-arm.c 2005-09-18 03:52:15.465165051 -0700
5+++ binutils-2.16/bfd/elf32-arm.c 2005-09-18 03:52:33.546302825 -0700
6@@ -1493,19 +1493,20 @@
7 return myh;
8 }
9
10-/* ARM->Thumb glue:
11+/* ARM->Thumb glue (PIC version):
12
13 .arm
14 __func_from_arm:
15 ldr r12, __func_addr
16+ add r12, r12, pc @ pc is __func_addr, so r12 is func
17 bx r12
18 __func_addr:
19- .word func @ behave as if you saw a ARM_32 reloc. */
20+ .word func-.+1 @ offset to actual function, low bit set */
21
22-#define ARM2THUMB_GLUE_SIZE 12
23-static const insn32 a2t1_ldr_insn = 0xe59fc000;
24-static const insn32 a2t2_bx_r12_insn = 0xe12fff1c;
25-static const insn32 a2t3_func_addr_insn = 0x00000001;
26+#define ARM2THUMB_GLUE_SIZE 16
27+static const insn32 a2t1_ldr_insn = 0xe59fc004;
28+static const insn32 a2t2_add_r12_insn = 0xe08fc00c;
29+static const insn32 a2t3_bx_r12_insn = 0xe12fff1c;
30
31 /* Thumb->ARM: Thumb->(non-interworking aware) ARM
32
33@@ -2187,6 +2188,8 @@
34
35 if ((my_offset & 0x01) == 0x01)
36 {
37+ long int ret_offset;
38+
39 if (sym_sec != NULL
40 && sym_sec->owner != NULL
41 && !INTERWORK_FLAG (sym_sec->owner))
42@@ -2203,12 +2206,31 @@
43 bfd_put_32 (output_bfd, (bfd_vma) a2t1_ldr_insn,
44 s->contents + my_offset);
45
46- bfd_put_32 (output_bfd, (bfd_vma) a2t2_bx_r12_insn,
47+ bfd_put_32 (output_bfd, (bfd_vma) a2t2_add_r12_insn,
48 s->contents + my_offset + 4);
49
50- /* It's a thumb address. Add the low order bit. */
51- bfd_put_32 (output_bfd, val | a2t3_func_addr_insn,
52+ bfd_put_32 (output_bfd, (bfd_vma) a2t3_bx_r12_insn,
53 s->contents + my_offset + 8);
54+
55+ /* Calculate the offset to the actual function. */
56+ ret_offset =
57+ /* Address of destination of the stub. */
58+ ((bfd_signed_vma) val)
59+ - ((bfd_signed_vma)
60+ /* Offset from the start of the current section
61+ to the start of the stubs. */
62+ (s->output_offset
63+ /* Offset of the start of this stub from the start of the stubs. */
64+ + my_offset
65+ /* Address of the start of the current section. */
66+ + s->output_section->vma)
67+ /* The word is 12 bytes into the stub. */
68+ + 12
69+ /* The destination is a thumb function so the bottom bit must be set. */
70+ - 1);
71+
72+ bfd_put_32 (output_bfd, (bfd_vma) ret_offset,
73+ s->contents + my_offset + 12);
74 }
75
76 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 @@
1--- binutils-2.16/.pc/binutils-2.16-thumb-trampoline.patch/bfd/elf32-arm.c 2005-05-02 12:43:06.000000000 -0700
2+++ binutils-2.16/bfd/elf32-arm.c 2005-09-19 22:58:49.834931044 -0700
3@@ -24,6 +24,8 @@
4 #include "libbfd.h"
5 #include "elf-bfd.h"
6
7+#define NOTE_DEBUG 0
8+
9 #ifndef NUM_ELEM
10 #define NUM_ELEM(a) (sizeof (a) / (sizeof (a)[0]))
11 #endif
12@@ -1127,6 +1129,10 @@
13 used, we need to record the index into .got.plt instead of
14 recomputing it from the PLT offset. */
15 bfd_signed_vma plt_got_offset;
16+
17+ /* This is used to sanity check that the Thumb trampoline space
18+ really was allocated. */
19+ int accomodate_trampoline;
20 };
21
22 /* Traverse an arm ELF linker hash table. */
23@@ -1219,9 +1225,15 @@
24 table, string));
25 if (ret != NULL)
26 {
27+#if NOTE_DEBUG
28+ _bfd_error_handler(
29+ _("NOTE: %x(%s): New hash entry (plt refcount %d)"),
30+ ret, string, ret->root.plt.refcount);
31+#endif
32 ret->relocs_copied = NULL;
33 ret->plt_thumb_refcount = 0;
34 ret->plt_got_offset = -1;
35+ ret->accomodate_trampoline = 0;
36 }
37
38 return (struct bfd_hash_entry *) ret;
39@@ -1335,16 +1347,38 @@
40 eind->relocs_copied = NULL;
41 }
42
43- /* If the direct symbol already has an associated PLT entry, the
44- indirect symbol should not. If it doesn't, swap refcount information
45- from the indirect symbol. */
46- if (edir->plt_thumb_refcount == 0)
47+ if (ind->root.type == bfd_link_hash_indirect)
48 {
49- edir->plt_thumb_refcount = eind->plt_thumb_refcount;
50- eind->plt_thumb_refcount = 0;
51+ bfd_signed_vma tmp;
52+ bfd_signed_vma lowest_valid = bed->can_refcount;
53+
54+ /* If the direct symbol already has an associated PLT entry, the
55+ indirect symbol should not. If it doesn't, swap refcount information
56+ from the indirect symbol. */
57+#if NOTE_DEBUG
58+ _bfd_error_handler(_("NOTE: %x(%s,%d,%d) <== %x(%s,%d,%d)"),
59+ dir, dir->root.root.string, dir->plt.refcount, edir->plt_thumb_refcount,
60+ ind, ind->root.root.string, ind->plt.refcount, eind->plt_thumb_refcount);
61+#endif
62+
63+ /* Copy over the global and procedure linkage table refcount entries.
64+ These may have been already set up by a check_relocs routine. This
65+ code duplicates that for the plt refcount in elf.c
66+ _bfd_elf_link_hash_copy_indirect */
67+ tmp = dir->plt.refcount;
68+ /* this obfuscated test evaluates to bed->can_refcount && plt.refcount == 0
69+ * || plt.refcount < 0.
70+ */
71+ if (tmp < lowest_valid)
72+ {
73+ tmp = edir->plt_thumb_refcount;
74+ edir->plt_thumb_refcount = eind->plt_thumb_refcount;
75+ eind->plt_thumb_refcount = tmp;
76+ BFD_ASSERT(eind->accomodate_trampoline == 0);
77+ }
78+ else
79+ BFD_ASSERT (eind->plt_thumb_refcount == 0);
80 }
81- else
82- BFD_ASSERT (eind->plt_thumb_refcount == 0);
83
84 _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
85 }
86@@ -2060,7 +2094,7 @@
87 (*_bfd_error_handler)
88 (_("%B(%s): warning: interworking not enabled.\n"
89 " first occurrence: %B: thumb call to arm"),
90- sym_sec->owner, input_bfd, name);
91+ sym_sec->owner, name, input_bfd);
92
93 return FALSE;
94 }
95@@ -2165,7 +2199,7 @@
96 (*_bfd_error_handler)
97 (_("%B(%s): warning: interworking not enabled.\n"
98 " first occurrence: %B: arm call to thumb"),
99- sym_sec->owner, input_bfd, name);
100+ sym_sec->owner, name, input_bfd);
101 }
102
103 --my_offset;
104@@ -2481,7 +2515,7 @@
105 instruction instead ? */
106 if (sym_flags != STT_ARM_TFUNC)
107 (*_bfd_error_handler)
108- (_("\%B: Warning: Arm BLX instruction targets Arm function '%s'."),
109+ (_("%B: Warning: Arm BLX instruction targets Arm function '%s'."),
110 input_bfd,
111 h ? h->root.root.string : "(local)");
112 }
113@@ -2697,6 +2731,20 @@
114 /* Handle calls via the PLT. */
115 if (h != NULL && splt != NULL && h->plt.offset != (bfd_vma) -1)
116 {
117+ struct elf32_arm_link_hash_entry *eh;
118+ eh = (struct elf32_arm_link_hash_entry *) h;
119+ if (!eh->accomodate_trampoline)
120+ {
121+ /* %B of output_bfd crashes here, so %x is used instead */
122+ _bfd_error_handler(
123+ _("ERROR: %B: %x(%s): missing thumb trampoline, refcount(thumb %d, plt %d) in %x at %x+%x+%x"),
124+ input_bfd, h, h->root.root.string, eh->plt_thumb_refcount,
125+ h->plt.refcount, output_bfd, splt->output_section->vma,
126+ splt->output_offset, h->plt.offset);
127+ /* The relocation would point to garbage, it gets skipped... */
128+ return bfd_reloc_dangerous;
129+ }
130+
131 value = (splt->output_section->vma
132 + splt->output_offset
133 + h->plt.offset);
134@@ -3525,8 +3573,9 @@
135 {
136 _bfd_error_handler
137 (_("ERROR: Source object %B has EABI version %d, but target %B has EABI version %d"),
138- ibfd, obfd,
139+ ibfd,
140 (in_flags & EF_ARM_EABIMASK) >> 24,
141+ obfd,
142 (out_flags & EF_ARM_EABIMASK) >> 24);
143 return FALSE;
144 }
145@@ -3538,8 +3587,9 @@
146 {
147 _bfd_error_handler
148 (_("ERROR: %B is compiled for APCS-%d, whereas target %B uses APCS-%d"),
149- ibfd, obfd,
150+ ibfd,
151 in_flags & EF_ARM_APCS_26 ? 26 : 32,
152+ obfd,
153 out_flags & EF_ARM_APCS_26 ? 26 : 32);
154 flags_compatible = FALSE;
155 }
156@@ -3903,10 +3953,18 @@
157 eh = (struct elf32_arm_link_hash_entry *) h;
158
159 if (h->plt.refcount > 0)
160+ h->plt.refcount -= 1;
161+
162+ if (ELF32_R_TYPE (rel->r_info) == R_ARM_THM_PC22)
163 {
164- h->plt.refcount -= 1;
165- if (ELF32_R_TYPE (rel->r_info) == R_ARM_THM_PC22)
166- eh->plt_thumb_refcount--;
167+ BFD_ASSERT (eh->plt_thumb_refcount > 0);
168+ eh->plt_thumb_refcount--;
169+ BFD_ASSERT (eh->accomodate_trampoline == 0);
170+#if NOTE_DEBUG
171+ _bfd_error_handler(
172+ _("NOTE: %B: %x(%s): Thumb refcount decremented to %d (plt refcount %d)"),
173+ abfd, h, h->root.root.string, eh->plt_thumb_refcount, h->plt.refcount);
174+#endif
175 }
176
177 if (r_type == R_ARM_ABS32
178@@ -3994,6 +4052,10 @@
179 h = sym_hashes[r_symndx - symtab_hdr->sh_info];
180
181 eh = (struct elf32_arm_link_hash_entry *) h;
182+#if NOTE_DEBUG
183+ if (h != NULL)
184+ _bfd_error_handler(_("NOTE: %B: %x(%s): verify relocation"), abfd, h, h->root.root.string);
185+#endif
186
187 switch (r_type)
188 {
189@@ -4078,10 +4140,30 @@
190
191 /* If we create a PLT entry, this relocation will reference
192 it, even if it's an ABS32 relocation. */
193- h->plt.refcount += 1;
194+ if (h->plt.refcount >= 0)
195+ h->plt.refcount += 1;
196+ else
197+ {
198+ /* This happens, I suspect it happens with glue code because,
199+ * somehow, the backend data had can_refcount==0. Expert required...
200+ */
201+ _bfd_error_handler(
202+ _("WARNING: %B: %x(%s): PLT refcount was %d (set to 1)"),
203+ abfd, h, h->root.root.string, h->plt.refcount);
204+ h->plt.refcount = 1;
205+ }
206
207 if (r_type == R_ARM_THM_PC22)
208- eh->plt_thumb_refcount += 1;
209+ {
210+ eh->plt_thumb_refcount += 1;
211+ BFD_ASSERT (eh->plt_thumb_refcount <= h->plt.refcount);
212+ BFD_ASSERT (eh->accomodate_trampoline == 0);
213+#if NOTE_DEBUG
214+ _bfd_error_handler(
215+ _("NOTE: %B: %x(%s): Thumb refcount incremented to %d (plt refcount %d)"),
216+ abfd, h, h->root.root.string, eh->plt_thumb_refcount, h->plt.refcount);
217+#endif
218+ }
219 }
220
221 /* If we are creating a shared library or relocatable executable,
222@@ -4376,8 +4458,15 @@
223 object, or if all references were garbage collected. In
224 such a case, we don't actually need to build a procedure
225 linkage table, and we can just do a PC24 reloc instead. */
226+#if NOTE_DEBUG
227+ _bfd_error_handler(
228+ _("NOTE: %x(%s): Thumb refcount zeroed (plt refcount %d, thumb %d) (%s)"),
229+ h, h->root.root.string, h->plt.refcount, eh->plt_thumb_refcount,
230+ SYMBOL_CALLS_LOCAL (info, h) ? "local call" : "invisible");
231+#endif
232 h->plt.offset = (bfd_vma) -1;
233 eh->plt_thumb_refcount = 0;
234+ BFD_ASSERT (eh->accomodate_trampoline == 0);
235 h->needs_plt = 0;
236 }
237
238@@ -4390,8 +4479,14 @@
239 in check_relocs. We can't decide accurately between function
240 and non-function syms in check-relocs; Objects loaded later in
241 the link may change h->type. So fix it now. */
242+#if NOTE_DEBUG
243+ _bfd_error_handler(
244+ _("NOTE: %x(%s): Thumb refcount zeroed (%d, plt refcount %d)"),
245+ h, h->root.root.string, eh->plt_thumb_refcount, h->plt.refcount);
246+#endif
247 h->plt.offset = (bfd_vma) -1;
248 eh->plt_thumb_refcount = 0;
249+ BFD_ASSERT (eh->accomodate_trampoline == 0);
250 }
251
252 /* If this is a weak symbol, and there is a real definition, the
253@@ -4521,8 +4616,14 @@
254 for it. */
255 if (!htab->symbian_p && eh->plt_thumb_refcount > 0)
256 {
257+#if NOTE_DEBUG
258+ _bfd_error_handler(_("NOTE: %x(%s): Thumb trampoline created at %x"),
259+ h, h->root.root.string, h->plt.offset);
260+#endif
261 h->plt.offset += PLT_THUMB_STUB_SIZE;
262 s->size += PLT_THUMB_STUB_SIZE;
263+ BFD_ASSERT (eh->accomodate_trampoline == 0);
264+ eh->accomodate_trampoline = 1;
265 }
266
267 /* If this symbol is not defined in a regular file, and we are
268@@ -5014,10 +5115,20 @@
269
270 if (eh->plt_thumb_refcount > 0)
271 {
272- bfd_put_16 (output_bfd, elf32_arm_plt_thumb_stub[0],
273- splt->contents + h->plt.offset - 4);
274- bfd_put_16 (output_bfd, elf32_arm_plt_thumb_stub[1],
275- splt->contents + h->plt.offset - 2);
276+ if (eh->accomodate_trampoline == 1)
277+ {
278+ bfd_put_16 (output_bfd, elf32_arm_plt_thumb_stub[0],
279+ splt->contents + h->plt.offset - 4);
280+ bfd_put_16 (output_bfd, elf32_arm_plt_thumb_stub[1],
281+ splt->contents + h->plt.offset - 2);
282+ }
283+ else
284+ {
285+ (*_bfd_error_handler) (
286+ _("%B: no space for THUMB trampoline at %x[%x]"),
287+ output_bfd, h->plt.offset, got_offset);
288+ return FALSE;
289+ }
290 }
291
292 bfd_put_32 (output_bfd, elf32_arm_plt_entry[0] | ((got_displacement & 0x0ff00000) >> 20),