source: patches/binutils-2.19-branch_update-2.patch@ 7a5bf42

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 7a5bf42 was afebdc9, checked in by Jim Gifford <clfs@…>, 16 years ago

Update Binutils to -2 Patch

  • Property mode set to 100644
File size: 43.0 KB
RevLine 
[c3f01f3]1Submitted By: Jim Gifford (jim at linuxfromscratch dot org)
[afebdc9]2Date: 12-30-2008
[c3f01f3]3Initial Package Version: 2.19
4Origin: Upstream
5Upstream Status: Applied
6Description: This is a branch update for binutils-2.19, and should be
7 rechecked periodically.
8
9diff -Naur binutils-2.19.orig/bfd/ChangeLog binutils-2.19/bfd/ChangeLog
10--- binutils-2.19.orig/bfd/ChangeLog 2008-10-16 06:20:48.000000000 -0700
[afebdc9]11+++ binutils-2.19/bfd/ChangeLog 2008-12-23 02:06:46.000000000 -0800
12@@ -1,3 +1,31 @@
13+2008-12-23 Nick Clifton <nickc@redhat.com>
14+
15+ * Import this patch from the mainline:
16+ 2008-11-10 Andreas Schwab <schwab@suse.de>
17+
18+ PR 7011
19+ * elf.c (assign_file_positions_for_non_load_sections): Handle
20+ PT_GNU_RELRO specially.
21+
[c3f01f3]22+2008-11-20 Alan Modra <amodra@bigpond.net.au>
23+
24+ * elf32-ppc.c (allocate_dynrelocs): Always use tlsld_got for
25+ TLS_LD even when symbol is used with other TLS reloc types.
26+ (ppc_elf_relocate_section): Bypass symbol checks when using tlsld_got.
27+ Leave addend zero on LD DTPMOD dynamic reloc.
28+
29+2008-11-17 Eric B. Weddington <eric.weddington@atmel.com>
30+
31+ PR 7022
32+ * elf32-avr.c (bfd_elf_avr_final_write_processing):
33+ Add missing break statements.
34+
35+2008-10-28 Tristan Gingold <gingold@adacore.com>
36+
37+ * configure.in: Bump version to 2.19.0
38+ * Makefile.am (RELEASE): Unset.
39+ * configure, Makefile.in: Regenerated.
40+
41 2008-10-16 Tristan Gingold <gingold@adacore.com>
42
43 * configure.in: Bump version to 2.19
44diff -Naur binutils-2.19.orig/bfd/Makefile.in binutils-2.19/bfd/Makefile.in
45--- binutils-2.19.orig/bfd/Makefile.in 2008-10-16 06:20:48.000000000 -0700
[afebdc9]46+++ binutils-2.19/bfd/Makefile.in 2008-12-30 16:34:28.000000000 -0800
[c3f01f3]47@@ -271,7 +271,7 @@
48 ACLOCAL_AMFLAGS = -I . -I .. -I ../config
49
50 # Uncomment the following line when doing a release.
51-RELEASE = y
52+RELEASE=y
53 INCDIR = $(srcdir)/../include
54 CSEARCH = -I. -I$(srcdir) -I$(INCDIR)
55 MKDEP = gcc -MM
56diff -Naur binutils-2.19.orig/bfd/configure binutils-2.19/bfd/configure
57--- binutils-2.19.orig/bfd/configure 2008-10-16 06:20:42.000000000 -0700
58+++ binutils-2.19/bfd/configure 2008-10-28 03:42:15.000000000 -0700
59@@ -3032,7 +3032,7 @@
60
61 # Define the identity of the package.
62 PACKAGE=bfd
63- VERSION=2.19
64+ VERSION=2.19.0
65
66
67 cat >>confdefs.h <<_ACEOF
68diff -Naur binutils-2.19.orig/bfd/configure.in binutils-2.19/bfd/configure.in
69--- binutils-2.19.orig/bfd/configure.in 2008-10-16 06:20:34.000000000 -0700
70+++ binutils-2.19/bfd/configure.in 2008-10-28 03:42:15.000000000 -0700
71@@ -8,7 +8,7 @@
72 AC_CANONICAL_TARGET
73 AC_ISC_POSIX
74
75-AM_INIT_AUTOMAKE(bfd, 2.19)
76+AM_INIT_AUTOMAKE(bfd, 2.19.0)
77
78 dnl These must be called before LT_INIT, because it may want
79 dnl to call AC_CHECK_PROG.
[afebdc9]80diff -Naur binutils-2.19.orig/bfd/elf.c binutils-2.19/bfd/elf.c
81--- binutils-2.19.orig/bfd/elf.c 2008-10-09 05:18:23.000000000 -0700
82+++ binutils-2.19/bfd/elf.c 2008-12-23 02:06:46.000000000 -0800
83@@ -4606,7 +4606,61 @@
84 m != NULL;
85 m = m->next, p++)
86 {
87- if (m->count != 0)
88+ if (p->p_type == PT_GNU_RELRO)
89+ {
90+ const Elf_Internal_Phdr *lp;
91+
92+ BFD_ASSERT (!m->includes_filehdr && !m->includes_phdrs);
93+
94+ if (link_info != NULL)
95+ {
96+ /* During linking the range of the RELRO segment is passed
97+ in link_info. */
98+ for (lp = phdrs; lp < phdrs + count; ++lp)
99+ {
100+ if (lp->p_type == PT_LOAD
101+ && lp->p_vaddr >= link_info->relro_start
102+ && lp->p_vaddr < link_info->relro_end
103+ && lp->p_vaddr + lp->p_filesz >= link_info->relro_end)
104+ break;
105+ }
106+ }
107+ else
108+ {
109+ /* Otherwise we are copying an executable or shared
110+ library, but we need to use the same linker logic. */
111+ for (lp = phdrs; lp < phdrs + count; ++lp)
112+ {
113+ if (lp->p_type == PT_LOAD
114+ && lp->p_paddr == p->p_paddr)
115+ break;
116+ }
117+ }
118+
119+ if (lp < phdrs + count)
120+ {
121+ p->p_vaddr = lp->p_vaddr;
122+ p->p_paddr = lp->p_paddr;
123+ p->p_offset = lp->p_offset;
124+ if (link_info != NULL)
125+ p->p_filesz = link_info->relro_end - lp->p_vaddr;
126+ else if (m->p_size_valid)
127+ p->p_filesz = m->p_size;
128+ else
129+ abort ();
130+ p->p_memsz = p->p_filesz;
131+ p->p_align = 1;
132+ p->p_flags = (lp->p_flags & ~PF_W);
133+ }
134+ else if (link_info != NULL)
135+ {
136+ memset (p, 0, sizeof *p);
137+ p->p_type = PT_NULL;
138+ }
139+ else
140+ abort ();
141+ }
142+ else if (m->count != 0)
143 {
144 if (p->p_type != PT_LOAD
145 && (p->p_type != PT_NOTE
146@@ -4622,87 +4676,20 @@
147 p->p_filesz = sect->filepos - m->sections[0]->filepos;
148 if (hdr->sh_type != SHT_NOBITS)
149 p->p_filesz += hdr->sh_size;
150-
151- if (p->p_type == PT_GNU_RELRO)
152- {
153- /* When we get here, we are copying executable
154- or shared library. But we need to use the same
155- linker logic. */
156- Elf_Internal_Phdr *lp;
157-
158- for (lp = phdrs; lp < phdrs + count; ++lp)
159- {
160- if (lp->p_type == PT_LOAD
161- && lp->p_paddr == p->p_paddr)
162- break;
163- }
164-
165- if (lp < phdrs + count)
166- {
167- /* We should use p_size if it is valid since it
168- may contain the first few bytes of the next
169- SEC_ALLOC section. */
170- if (m->p_size_valid)
171- p->p_filesz = m->p_size;
172- else
173- abort ();
174- p->p_vaddr = lp->p_vaddr;
175- p->p_offset = lp->p_offset;
176- p->p_memsz = p->p_filesz;
177- p->p_align = 1;
178- }
179- else
180- abort ();
181- }
182- else
183- p->p_offset = m->sections[0]->filepos;
184+ p->p_offset = m->sections[0]->filepos;
185 }
186 }
187- else
188+ else if (m->includes_filehdr)
189 {
190- if (m->includes_filehdr)
191- {
192- p->p_vaddr = filehdr_vaddr;
193- if (! m->p_paddr_valid)
194- p->p_paddr = filehdr_paddr;
195- }
196- else if (m->includes_phdrs)
197- {
198- p->p_vaddr = phdrs_vaddr;
199- if (! m->p_paddr_valid)
200- p->p_paddr = phdrs_paddr;
201- }
202- else if (p->p_type == PT_GNU_RELRO)
203- {
204- Elf_Internal_Phdr *lp;
205-
206- for (lp = phdrs; lp < phdrs + count; ++lp)
207- {
208- if (lp->p_type == PT_LOAD
209- && lp->p_vaddr <= link_info->relro_end
210- && lp->p_vaddr >= link_info->relro_start
211- && (lp->p_vaddr + lp->p_filesz
212- >= link_info->relro_end))
213- break;
214- }
215-
216- if (lp < phdrs + count
217- && link_info->relro_end > lp->p_vaddr)
218- {
219- p->p_vaddr = lp->p_vaddr;
220- p->p_paddr = lp->p_paddr;
221- p->p_offset = lp->p_offset;
222- p->p_filesz = link_info->relro_end - lp->p_vaddr;
223- p->p_memsz = p->p_filesz;
224- p->p_align = 1;
225- p->p_flags = (lp->p_flags & ~PF_W);
226- }
227- else
228- {
229- memset (p, 0, sizeof *p);
230- p->p_type = PT_NULL;
231- }
232- }
233+ p->p_vaddr = filehdr_vaddr;
234+ if (! m->p_paddr_valid)
235+ p->p_paddr = filehdr_paddr;
236+ }
237+ else if (m->includes_phdrs)
238+ {
239+ p->p_vaddr = phdrs_vaddr;
240+ if (! m->p_paddr_valid)
241+ p->p_paddr = phdrs_paddr;
242 }
243 }
244
[c3f01f3]245diff -Naur binutils-2.19.orig/bfd/elf32-avr.c binutils-2.19/bfd/elf32-avr.c
246--- binutils-2.19.orig/bfd/elf32-avr.c 2008-08-08 22:35:12.000000000 -0700
247+++ binutils-2.19/bfd/elf32-avr.c 2008-11-17 07:26:01.000000000 -0800
248@@ -1298,6 +1298,7 @@
249
250 case bfd_mach_avr25:
251 val = E_AVR_MACH_AVR25;
252+ break;
253
254 case bfd_mach_avr3:
255 val = E_AVR_MACH_AVR3;
256@@ -1305,9 +1306,11 @@
257
258 case bfd_mach_avr31:
259 val = E_AVR_MACH_AVR31;
260+ break;
261
262 case bfd_mach_avr35:
263 val = E_AVR_MACH_AVR35;
264+ break;
265
266 case bfd_mach_avr4:
267 val = E_AVR_MACH_AVR4;
268diff -Naur binutils-2.19.orig/bfd/elf32-ppc.c binutils-2.19/bfd/elf32-ppc.c
269--- binutils-2.19.orig/bfd/elf32-ppc.c 2008-10-02 01:07:16.000000000 -0700
270+++ binutils-2.19/bfd/elf32-ppc.c 2008-11-20 03:50:22.000000000 -0800
271@@ -4997,6 +4997,9 @@
272 eh = (struct ppc_elf_link_hash_entry *) h;
273 if (eh->elf.got.refcount > 0)
274 {
275+ bfd_boolean dyn;
276+ unsigned int need;
277+
278 /* Make sure this symbol is output as a dynamic symbol. */
279 if (eh->elf.dynindx == -1
280 && !eh->elf.forced_local
281@@ -5006,30 +5009,32 @@
282 return FALSE;
283 }
284
285- if (eh->tls_mask == (TLS_TLS | TLS_LD)
286- && !eh->elf.def_dynamic)
287- {
288- /* If just an LD reloc, we'll just use htab->tlsld_got.offset. */
289- htab->tlsld_got.refcount += 1;
290- eh->elf.got.offset = (bfd_vma) -1;
291- }
292- else
293+ need = 0;
294+ if ((eh->tls_mask & TLS_TLS) != 0)
295 {
296- bfd_boolean dyn;
297- unsigned int need = 0;
298- if ((eh->tls_mask & TLS_TLS) != 0)
299+ if ((eh->tls_mask & TLS_LD) != 0)
300 {
301- if ((eh->tls_mask & TLS_LD) != 0)
302- need += 8;
303- if ((eh->tls_mask & TLS_GD) != 0)
304+ if (!eh->elf.def_dynamic)
305+ /* We'll just use htab->tlsld_got.offset. This should
306+ always be the case. It's a little odd if we have
307+ a local dynamic reloc against a non-local symbol. */
308+ htab->tlsld_got.refcount += 1;
309+ else
310 need += 8;
311- if ((eh->tls_mask & (TLS_TPREL | TLS_TPRELGD)) != 0)
312- need += 4;
313- if ((eh->tls_mask & TLS_DTPREL) != 0)
314- need += 4;
315 }
316- else
317+ if ((eh->tls_mask & TLS_GD) != 0)
318+ need += 8;
319+ if ((eh->tls_mask & (TLS_TPREL | TLS_TPRELGD)) != 0)
320+ need += 4;
321+ if ((eh->tls_mask & TLS_DTPREL) != 0)
322 need += 4;
323+ }
324+ else
325+ need += 4;
326+ if (need == 0)
327+ eh->elf.got.offset = (bfd_vma) -1;
328+ else
329+ {
330 eh->elf.got.offset = allocate_got (htab, need);
331 dyn = htab->elf.dynamic_sections_created;
332 if ((info->shared
333@@ -5039,7 +5044,8 @@
334 {
335 /* All the entries we allocated need relocs.
336 Except LD only needs one. */
337- if ((eh->tls_mask & TLS_LD) != 0)
338+ if ((eh->tls_mask & TLS_LD) != 0
339+ && eh->elf.def_dynamic)
340 need -= 4;
341 htab->relgot->size += need * (sizeof (Elf32_External_Rela) / 4);
342 }
343@@ -5275,27 +5281,24 @@
344 for (; local_got < end_local_got; ++local_got, ++lgot_masks)
345 if (*local_got > 0)
346 {
347- if (*lgot_masks == (TLS_TLS | TLS_LD))
348+ unsigned int need = 0;
349+ if ((*lgot_masks & TLS_TLS) != 0)
350 {
351- /* If just an LD reloc, we'll just use
352- htab->tlsld_got.offset. */
353- htab->tlsld_got.refcount += 1;
354- *local_got = (bfd_vma) -1;
355+ if ((*lgot_masks & TLS_GD) != 0)
356+ need += 8;
357+ if ((*lgot_masks & TLS_LD) != 0)
358+ htab->tlsld_got.refcount += 1;
359+ if ((*lgot_masks & (TLS_TPREL | TLS_TPRELGD)) != 0)
360+ need += 4;
361+ if ((*lgot_masks & TLS_DTPREL) != 0)
362+ need += 4;
363 }
364 else
365+ need += 4;
366+ if (need == 0)
367+ *local_got = (bfd_vma) -1;
368+ else
369 {
370- unsigned int need = 0;
371- if ((*lgot_masks & TLS_TLS) != 0)
372- {
373- if ((*lgot_masks & TLS_GD) != 0)
374- need += 8;
375- if ((*lgot_masks & (TLS_TPREL | TLS_TPRELGD)) != 0)
376- need += 4;
377- if ((*lgot_masks & TLS_DTPREL) != 0)
378- need += 4;
379- }
380- else
381- need += 4;
382 *local_got = allocate_got (htab, need);
383 if (info->shared)
384 htab->relgot->size += (need
385@@ -6560,7 +6563,8 @@
386
387 /* Generate relocs for the dynamic linker. */
388 if ((info->shared || indx != 0)
389- && (h == NULL
390+ && (offp == &htab->tlsld_got.offset
391+ || h == NULL
392 || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
393 || h->root.type != bfd_link_hash_undefweak))
394 {
395@@ -6591,7 +6595,7 @@
396 outrel.r_info = ELF32_R_INFO (indx, R_PPC_RELATIVE);
397 else
398 outrel.r_info = ELF32_R_INFO (indx, R_PPC_GLOB_DAT);
399- if (indx == 0)
400+ if (indx == 0 && tls_ty != (TLS_TLS | TLS_LD))
401 {
402 outrel.r_addend += relocation;
403 if (tls_ty & (TLS_GD | TLS_DTPREL | TLS_TPREL))
404diff -Naur binutils-2.19.orig/bfd/version.h binutils-2.19/bfd/version.h
405--- binutils-2.19.orig/bfd/version.h 2008-10-16 05:51:57.000000000 -0700
[afebdc9]406+++ binutils-2.19/bfd/version.h 2008-12-30 16:00:14.000000000 -0800
[c3f01f3]407@@ -1,4 +1,4 @@
408-#define BFD_VERSION_DATE 20081016
[afebdc9]409+#define BFD_VERSION_DATE 20081231
[c3f01f3]410 #define BFD_VERSION @bfd_version@
411 #define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@
412 #define REPORT_BUGS_TO @report_bugs_to@
413diff -Naur binutils-2.19.orig/binutils/ChangeLog binutils-2.19/binutils/ChangeLog
414--- binutils-2.19.orig/binutils/ChangeLog 2008-10-02 01:07:16.000000000 -0700
[afebdc9]415+++ binutils-2.19/binutils/ChangeLog 2008-12-23 03:49:58.000000000 -0800
416@@ -1,3 +1,16 @@
417+2008-12-23 Nick Clifton <nickc@redhat.com>
418+
419+ * windmc.c (main): Use correct type for file length.
420+ * dlltool.c (gen_exp_file): Likewise.
421+
[c3f01f3]422+2008-12-01 Nick Clifton <nickc@redhat.com>
423+
424+ PR 7044
425+ * dlltool.c (run): Use formatting string to avoid compile time
426+ warning.
427+ (gen_exp_file): Check return value from fread.
428+ * windmc.c (main): Check return value from fread.
429+
430 2008-09-25 Richard Henderson <rth@redhat.com>
431
432 * dwarf.c (size_of_encoded_value, get_encoded_value): Move up.
433diff -Naur binutils-2.19.orig/binutils/dlltool.c binutils-2.19/binutils/dlltool.c
434--- binutils-2.19.orig/binutils/dlltool.c 2008-07-29 21:34:56.000000000 -0700
[afebdc9]435+++ binutils-2.19/binutils/dlltool.c 2008-12-23 03:49:58.000000000 -0800
[c3f01f3]436@@ -1206,7 +1206,7 @@
437
438 if (pid == -1)
439 {
440- inform (strerror (errno));
441+ inform ("%s", strerror (errno));
442
443 fatal (errmsg_fmt, errmsg_arg);
444 }
[afebdc9]445@@ -1980,7 +1980,7 @@
446 int addr;
447 long need[PAGE_SIZE];
448 long page_addr;
449- int numbytes;
450+ bfd_size_type numbytes;
451 int num_entries;
452 long *copy;
453 int j;
[c3f01f3]454@@ -1992,10 +1992,10 @@
455 numbytes = ftell (base_file);
456 fseek (base_file, 0, SEEK_SET);
457 copy = xmalloc (numbytes);
458- fread (copy, 1, numbytes, base_file);
459+ if (fread (copy, 1, numbytes, base_file) < numbytes)
460+ fatal (_("failed to read the number of entries from base file"));
461 num_entries = numbytes / sizeof (long);
462
463-
464 fprintf (f, "\t.section\t.reloc\n");
465 if (num_entries)
466 {
467diff -Naur binutils-2.19.orig/binutils/windmc.c binutils-2.19/binutils/windmc.c
468--- binutils-2.19.orig/binutils/windmc.c 2008-07-29 21:34:56.000000000 -0700
[afebdc9]469+++ binutils-2.19/binutils/windmc.c 2008-12-23 03:49:58.000000000 -0800
470@@ -1144,7 +1144,7 @@
471 unichar *u;
472 rc_uint_type ul;
473 char *buff;
474- long flen;
475+ bfd_size_type flen;
476 FILE *fp = fopen (input_filename, "rb");
477
478 if (!fp)
[c3f01f3]479@@ -1155,7 +1155,8 @@
480 fseek (fp, 0, SEEK_SET);
481 buff = malloc (flen + 3);
482 memset (buff, 0, flen + 3);
483- fread (buff, 1, flen, fp);
484+ if (fread (buff, 1, flen, fp) < flen)
485+ fatal (_("unable to read contents of %s"), input_filename);
486 fclose (fp);
487 if (mcset_text_in_is_unicode != 1)
488 {
489diff -Naur binutils-2.19.orig/configure.ac binutils-2.19/configure.ac
490--- binutils-2.19.orig/configure.ac 2008-10-16 06:45:42.000000000 -0700
491+++ binutils-2.19/configure.ac 2008-09-03 19:18:16.000000000 -0700
492@@ -166,7 +166,7 @@
493 # binutils, gas and ld appear in that order because it makes sense to run
494 # "make check" in that particular order.
495 # If --enable-gold is used, "gold" will replace "ld".
496-host_tools="byacc flex bison binutils gas ld fixincludes gcc sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils gettext zip fastjar gnattools"
497+host_tools="texinfo byacc flex bison binutils gas ld fixincludes gcc sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils gettext zip fastjar gnattools"
498
499 # libgcj represents the runtime libraries only used by gcj.
500 libgcj="target-libffi \
501diff -Naur binutils-2.19.orig/ld/ChangeLog binutils-2.19/ld/ChangeLog
502--- binutils-2.19.orig/ld/ChangeLog 2008-10-09 05:18:31.000000000 -0700
[afebdc9]503+++ binutils-2.19/ld/ChangeLog 2008-12-23 05:56:10.000000000 -0800
504@@ -1,3 +1,13 @@
505+2008-12-23 Tristan Gingold <gingold@adacore.com>
506+
507+ * Makefile.am (EXTRA_DIST): Add deffilep.c and deffilep.h
508+ * Makefile.in: Regenerate.
509+
[c3f01f3]510+2008-11-14 Alan Modra <amodra@bigpond.net.au>
511+
512+ * Makefile.am (spu_ovl.o_c): Add missing line continuations.
513+ * Makefile.in: Regenerate.
514+
515 2008-10-05 Alan Modra <amodra@bigpond.net.au>
516
517 PR 6943
518diff -Naur binutils-2.19.orig/ld/Makefile.am binutils-2.19/ld/Makefile.am
519--- binutils-2.19.orig/ld/Makefile.am 2008-09-09 01:02:19.000000000 -0700
[afebdc9]520+++ binutils-2.19/ld/Makefile.am 2008-12-23 05:56:10.000000000 -0800
[c3f01f3]521@@ -758,9 +758,9 @@
522 $(srcdir)/emultempl/spu_ovl.o_c: @MAINT@ $(srcdir)/emultempl/spu_ovl.S
523 if ../gas/as-new --version \
524 | grep 'target.*spu' >/dev/null 2>/dev/null; then \
525- cpp -DOVLY_IRQ_SAVE $(srcdir)/emultempl/spu_ovl.S spu_ovl.s
526+ cpp -DOVLY_IRQ_SAVE $(srcdir)/emultempl/spu_ovl.S spu_ovl.s; \
527 ../gas/as-new -o spu_ovl.o spu_ovl.s; \
528- ../binutils/bin2c <spu_ovl.o >$@
529+ ../binutils/bin2c <spu_ovl.o >$@; \
530 fi
531 eelf32_i860.c: $(srcdir)/emulparams/elf32_i860.sh \
532 $(ELF_GEN_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
[afebdc9]533@@ -1914,7 +1914,8 @@
534
535 # Stuff that should be included in a distribution. The diststuff
536 # target is run by the taz target in ../Makefile.in.
537-EXTRA_DIST = ldgram.c ldgram.h ldlex.c emultempl/spu_ovl.o_c $(man_MANS)
538+EXTRA_DIST = ldgram.c ldgram.h ldlex.c emultempl/spu_ovl.o_c \
539+ deffilep.c deffilep.h $(man_MANS)
540 diststuff: info $(EXTRA_DIST)
541 all: info ld.1
542
[c3f01f3]543diff -Naur binutils-2.19.orig/ld/Makefile.in binutils-2.19/ld/Makefile.in
544--- binutils-2.19.orig/ld/Makefile.in 2008-09-09 01:02:19.000000000 -0700
[afebdc9]545+++ binutils-2.19/ld/Makefile.in 2008-12-23 05:56:10.000000000 -0800
546@@ -730,7 +730,9 @@
547
548 # Stuff that should be included in a distribution. The diststuff
549 # target is run by the taz target in ../Makefile.in.
550-EXTRA_DIST = ldgram.c ldgram.h ldlex.c emultempl/spu_ovl.o_c $(man_MANS)
551+EXTRA_DIST = ldgram.c ldgram.h ldlex.c emultempl/spu_ovl.o_c \
552+ deffilep.c deffilep.h $(man_MANS)
553+
554 DISTCLEANFILES = tdirs site.exp site.bak stringify.sed $(am__append_1)
555 all: config.h
556 $(MAKE) $(AM_MAKEFLAGS) all-recursive
557@@ -1588,9 +1590,9 @@
[c3f01f3]558 $(srcdir)/emultempl/spu_ovl.o_c: @MAINT@ $(srcdir)/emultempl/spu_ovl.S
559 if ../gas/as-new --version \
560 | grep 'target.*spu' >/dev/null 2>/dev/null; then \
561- cpp -DOVLY_IRQ_SAVE $(srcdir)/emultempl/spu_ovl.S spu_ovl.s
562+ cpp -DOVLY_IRQ_SAVE $(srcdir)/emultempl/spu_ovl.S spu_ovl.s; \
563 ../gas/as-new -o spu_ovl.o spu_ovl.s; \
564- ../binutils/bin2c <spu_ovl.o >$@
565+ ../binutils/bin2c <spu_ovl.o >$@; \
566 fi
567 eelf32_i860.c: $(srcdir)/emulparams/elf32_i860.sh \
568 $(ELF_GEN_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
569diff -Naur binutils-2.19.orig/opcodes/ChangeLog binutils-2.19/opcodes/ChangeLog
570--- binutils-2.19.orig/opcodes/ChangeLog 2008-10-02 01:07:19.000000000 -0700
571+++ binutils-2.19/opcodes/ChangeLog 2008-11-27 02:51:53.000000000 -0800
572@@ -1,3 +1,20 @@
573+2008-11-27 Alan Modra <amodra@bigpond.net.au>
574+
575+ * ppc-opc.c (extract_sprg): Correct operand range check.
576+
577+2008-11-26 Andreas Schwab <schwab@suse.de>
578+
579+ * m68k-dis.c (NEXTBYTE, NEXTWORD, NEXTLONG, NEXTULONG, NEXTSINGLE)
580+ (NEXTDOUBLE, NEXTEXTEND, NEXTPACKED): Fix error handling.
581+ (save_printer, save_print_address): Remove.
582+ (fetch_data): Don't use them.
583+ (match_insn_m68k): Always restore printing functions.
584+ (print_insn_m68k): Don't save/restore printing functions.
585+
586+2008-11-25 Nick Clifton <nickc@redhat.com>
587+
588+ * m68k-dis.c: Rewrite to remove use of setjmp/longjmp.
589+
590 2008-09-29 Nick Clifton <nickc@redhat.com>
591
592 * po/vi.po: Updated Vietnamese translation.
593diff -Naur binutils-2.19.orig/opcodes/m68k-dis.c binutils-2.19/opcodes/m68k-dis.c
594--- binutils-2.19.orig/opcodes/m68k-dis.c 2007-09-27 04:14:10.000000000 -0700
595+++ binutils-2.19/opcodes/m68k-dis.c 2008-11-26 02:45:27.000000000 -0800
596@@ -60,46 +60,103 @@
597 #endif
598
599 /* Get a 1 byte signed integer. */
600-#define NEXTBYTE(p) (p += 2, FETCH_DATA (info, p), COERCE_SIGNED_CHAR(p[-1]))
601+#define NEXTBYTE(p, val) \
602+ do \
603+ { \
604+ p += 2; \
605+ if (!FETCH_DATA (info, p)) \
606+ return -3; \
607+ val = COERCE_SIGNED_CHAR (p[-1]); \
608+ } \
609+ while (0)
610
611 /* Get a 2 byte signed integer. */
612 #define COERCE16(x) ((int) (((x) ^ 0x8000) - 0x8000))
613-#define NEXTWORD(p) \
614- (p += 2, FETCH_DATA (info, p), \
615- COERCE16 ((p[-2] << 8) + p[-1]))
616+
617+#define NEXTWORD(p, val, ret_val) \
618+ do \
619+ { \
620+ p += 2; \
621+ if (!FETCH_DATA (info, p)) \
622+ return ret_val; \
623+ val = COERCE16 ((p[-2] << 8) + p[-1]); \
624+ } \
625+ while (0)
626
627 /* Get a 4 byte signed integer. */
628 #define COERCE32(x) ((bfd_signed_vma) ((x) ^ 0x80000000) - 0x80000000)
629-#define NEXTLONG(p) \
630- (p += 4, FETCH_DATA (info, p), \
631- (COERCE32 ((((((p[-4] << 8) + p[-3]) << 8) + p[-2]) << 8) + p[-1])))
632+
633+#define NEXTLONG(p, val, ret_val) \
634+ do \
635+ { \
636+ p += 4; \
637+ if (!FETCH_DATA (info, p)) \
638+ return ret_val; \
639+ val = COERCE32 ((((((p[-4] << 8) + p[-3]) << 8) + p[-2]) << 8) + p[-1]); \
640+ } \
641+ while (0)
642
643 /* Get a 4 byte unsigned integer. */
644-#define NEXTULONG(p) \
645- (p += 4, FETCH_DATA (info, p), \
646- (unsigned int) ((((((p[-4] << 8) + p[-3]) << 8) + p[-2]) << 8) + p[-1]))
647+#define NEXTULONG(p, val) \
648+ do \
649+ { \
650+ p += 4; \
651+ if (!FETCH_DATA (info, p)) \
652+ return -3; \
653+ val = (unsigned int) ((((((p[-4] << 8) + p[-3]) << 8) + p[-2]) << 8) + p[-1]); \
654+ } \
655+ while (0)
656
657 /* Get a single precision float. */
658-#define NEXTSINGLE(val, p) \
659- (p += 4, FETCH_DATA (info, p), \
660- floatformat_to_double (&floatformat_ieee_single_big, (char *) p - 4, &val))
661+#define NEXTSINGLE(val, p) \
662+ do \
663+ { \
664+ p += 4; \
665+ if (!FETCH_DATA (info, p)) \
666+ return -3; \
667+ floatformat_to_double (& floatformat_ieee_single_big, \
668+ (char *) p - 4, & val); \
669+ } \
670+ while (0)
671
672 /* Get a double precision float. */
673-#define NEXTDOUBLE(val, p) \
674- (p += 8, FETCH_DATA (info, p), \
675- floatformat_to_double (&floatformat_ieee_double_big, (char *) p - 8, &val))
676+#define NEXTDOUBLE(val, p) \
677+ do \
678+ { \
679+ p += 8; \
680+ if (!FETCH_DATA (info, p)) \
681+ return -3; \
682+ floatformat_to_double (& floatformat_ieee_double_big, \
683+ (char *) p - 8, & val); \
684+ } \
685+ while (0)
686
687 /* Get an extended precision float. */
688-#define NEXTEXTEND(val, p) \
689- (p += 12, FETCH_DATA (info, p), \
690- floatformat_to_double (&floatformat_m68881_ext, (char *) p - 12, &val))
691+#define NEXTEXTEND(val, p) \
692+ do \
693+ { \
694+ p += 12; \
695+ if (!FETCH_DATA (info, p)) \
696+ return -3; \
697+ floatformat_to_double (& floatformat_m68881_ext, \
698+ (char *) p - 12, & val); \
699+ } \
700+ while (0)
701
702 /* Need a function to convert from packed to double
703 precision. Actually, it's easier to print a
704 packed number than a double anyway, so maybe
705 there should be a special case to handle this... */
706-#define NEXTPACKED(p) \
707- (p += 12, FETCH_DATA (info, p), 0.0)
708+#define NEXTPACKED(p, val) \
709+ do \
710+ { \
711+ p += 12; \
712+ if (!FETCH_DATA (info, p)) \
713+ return -3; \
714+ val = 0.0; \
715+ } \
716+ while (0)
717+
718
719
720 /* Maximum length of an instruction. */
721 #define MAXLEN 22
722@@ -112,12 +169,10 @@
723 bfd_byte *max_fetched;
724 bfd_byte the_buffer[MAXLEN];
725 bfd_vma insn_start;
726- jmp_buf bailout;
727 };
728
729 /* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive)
730- to ADDR (exclusive) are valid. Returns 1 for success, longjmps
731- on error. */
732+ to ADDR (exclusive) are valid. Returns 1 for success, 0 on error. */
733 #define FETCH_DATA(info, addr) \
734 ((addr) <= ((struct private *) (info->private_data))->max_fetched \
735 ? 1 : fetch_data ((info), (addr)))
736@@ -136,7 +191,7 @@
737 if (status != 0)
738 {
739 (*info->memory_error_func) (status, start, info);
740- longjmp (priv->bailout, 1);
741+ return 0;
742 }
743 else
744 priv->max_fetched = addr;
745@@ -161,7 +216,8 @@
746 /* Fetch BITS bits from a position in the instruction specified by CODE.
747 CODE is a "place to put an argument", or 'x' for a destination
748 that is a general address (mode and register).
749- BUFFER contains the instruction. */
750+ BUFFER contains the instruction.
751+ Returns -1 on failure. */
752
753 static int
754 fetch_arg (unsigned char *buffer,
755@@ -216,64 +272,75 @@
756 break;
757
758 case 'k':
759- FETCH_DATA (info, buffer + 3);
760+ if (! FETCH_DATA (info, buffer + 3))
761+ return -1;
762 val = (buffer[3] >> 4);
763 break;
764
765 case 'C':
766- FETCH_DATA (info, buffer + 3);
767+ if (! FETCH_DATA (info, buffer + 3))
768+ return -1;
769 val = buffer[3];
770 break;
771
772 case '1':
773- FETCH_DATA (info, buffer + 3);
774+ if (! FETCH_DATA (info, buffer + 3))
775+ return -1;
776 val = (buffer[2] << 8) + buffer[3];
777 val >>= 12;
778 break;
779
780 case '2':
781- FETCH_DATA (info, buffer + 3);
782+ if (! FETCH_DATA (info, buffer + 3))
783+ return -1;
784 val = (buffer[2] << 8) + buffer[3];
785 val >>= 6;
786 break;
787
788 case '3':
789 case 'j':
790- FETCH_DATA (info, buffer + 3);
791+ if (! FETCH_DATA (info, buffer + 3))
792+ return -1;
793 val = (buffer[2] << 8) + buffer[3];
794 break;
795
796 case '4':
797- FETCH_DATA (info, buffer + 5);
798+ if (! FETCH_DATA (info, buffer + 5))
799+ return -1;
800 val = (buffer[4] << 8) + buffer[5];
801 val >>= 12;
802 break;
803
804 case '5':
805- FETCH_DATA (info, buffer + 5);
806+ if (! FETCH_DATA (info, buffer + 5))
807+ return -1;
808 val = (buffer[4] << 8) + buffer[5];
809 val >>= 6;
810 break;
811
812 case '6':
813- FETCH_DATA (info, buffer + 5);
814+ if (! FETCH_DATA (info, buffer + 5))
815+ return -1;
816 val = (buffer[4] << 8) + buffer[5];
817 break;
818
819 case '7':
820- FETCH_DATA (info, buffer + 3);
821+ if (! FETCH_DATA (info, buffer + 3))
822+ return -1;
823 val = (buffer[2] << 8) + buffer[3];
824 val >>= 7;
825 break;
826
827 case '8':
828- FETCH_DATA (info, buffer + 3);
829+ if (! FETCH_DATA (info, buffer + 3))
830+ return -1;
831 val = (buffer[2] << 8) + buffer[3];
832 val >>= 10;
833 break;
834
835 case '9':
836- FETCH_DATA (info, buffer + 3);
837+ if (! FETCH_DATA (info, buffer + 3))
838+ return -1;
839 val = (buffer[2] << 8) + buffer[3];
840 val >>= 5;
841 break;
842@@ -283,7 +350,8 @@
843 break;
844
845 case 'E':
846- FETCH_DATA (info, buffer + 3);
847+ if (! FETCH_DATA (info, buffer + 3))
848+ return -1;
849 val = (buffer[2] >> 1);
850 break;
851
852@@ -450,7 +518,8 @@
853
854 /* Print an indexed argument. The base register is BASEREG (-1 for pc).
855 P points to extension word, in buffer.
856- ADDR is the nominal core address of that extension word. */
857+ ADDR is the nominal core address of that extension word.
858+ Returns NULL upon error. */
859
860 static unsigned char *
861 print_indexed (int basereg,
862@@ -465,7 +534,7 @@
863 char buf[40];
864 char vmabuf[50];
865
866- word = NEXTWORD (p);
867+ NEXTWORD (p, word, NULL);
868
869 /* Generate the text for the index register.
870 Where this will be output is not yet determined. */
871@@ -503,10 +572,10 @@
872 switch ((word >> 4) & 3)
873 {
874 case 2:
875- base_disp = NEXTWORD (p);
876+ NEXTWORD (p, base_disp, NULL);
877 break;
878 case 3:
879- base_disp = NEXTLONG (p);
880+ NEXTLONG (p, base_disp, NULL);
881 }
882 if (basereg == -1)
883 base_disp += addr;
884@@ -526,10 +595,10 @@
885 switch (word & 3)
886 {
887 case 2:
888- outer_disp = NEXTWORD (p);
889+ NEXTWORD (p, outer_disp, NULL);
890 break;
891 case 3:
892- outer_disp = NEXTLONG (p);
893+ NEXTLONG (p, outer_disp, NULL);
894 }
895
896 print_base (basereg, base_disp, info);
897@@ -547,9 +616,18 @@
898 return p;
899 }
900
901+#define FETCH_ARG(size, val) \
902+ do \
903+ { \
904+ val = fetch_arg (buffer, place, size, info); \
905+ if (val < 0) \
906+ return -3; \
907+ } \
908+ while (0)
909+
910 /* Returns number of bytes "eaten" by the operand, or
911 return -1 if an invalid operand was found, or -2 if
912- an opcode tabe error was found.
913+ an opcode tabe error was found or -3 to simply abort.
914 ADDR is the pc for this arg to be relative to. */
915
916 static int
917@@ -575,23 +653,21 @@
918 case 'c': /* Cache identifier. */
919 {
920 static char *const cacheFieldName[] = { "nc", "dc", "ic", "bc" };
921- val = fetch_arg (buffer, place, 2, info);
922- (*info->fprintf_func) (info->stream, cacheFieldName[val]);
923+ FETCH_ARG (2, val);
924+ (*info->fprintf_func) (info->stream, cacheFieldName[val]);
925 break;
926 }
927
928 case 'a': /* Address register indirect only. Cf. case '+'. */
929 {
930- (*info->fprintf_func)
931- (info->stream,
932- "%s@",
933- reg_names[fetch_arg (buffer, place, 3, info) + 8]);
934+ FETCH_ARG (3, val);
935+ (*info->fprintf_func) (info->stream, "%s@", reg_names[val + 8]);
936 break;
937 }
938
939 case '_': /* 32-bit absolute address for move16. */
940 {
941- uval = NEXTULONG (p);
942+ NEXTULONG (p, uval);
943 (*info->print_address_func) (uval, info);
944 break;
945 }
946@@ -643,7 +719,7 @@
947 /* Fido added these. */
948 {"%cac", 0xffe}, {"%mbo", 0xfff}};
949
950- val = fetch_arg (buffer, place, 12, info);
951+ FETCH_ARG (12, val);
952 for (regno = sizeof names / sizeof names[0] - 1; regno >= 0; regno--)
953 if (names[regno].value == val)
954 {
955@@ -656,7 +732,7 @@
956 break;
957
958 case 'Q':
959- val = fetch_arg (buffer, place, 3, info);
960+ FETCH_ARG (3, val);
961 /* 0 means 8, except for the bkpt instruction... */
962 if (val == 0 && d[1] != 's')
963 val = 8;
964@@ -664,7 +740,7 @@
965 break;
966
967 case 'x':
968- val = fetch_arg (buffer, place, 3, info);
969+ FETCH_ARG (3, val);
970 /* 0 means -1. */
971 if (val == 0)
972 val = -1;
973@@ -672,12 +748,12 @@
974 break;
975
976 case 'j':
977- val = fetch_arg (buffer, place, 3, info);
978+ FETCH_ARG (3, val);
979 (*info->fprintf_func) (info->stream, "#%d", val+1);
980 break;
981
982 case 'K':
983- val = fetch_arg (buffer, place, 9, info);
984+ FETCH_ARG (9, val);
985 (*info->fprintf_func) (info->stream, "#%d", val);
986 break;
987
988@@ -685,12 +761,13 @@
989 if (place == 'h')
990 {
991 static char *const scalefactor_name[] = { "<<", ">>" };
992- val = fetch_arg (buffer, place, 1, info);
993+
994+ FETCH_ARG (1, val);
995 (*info->fprintf_func) (info->stream, scalefactor_name[val]);
996 }
997 else
998 {
999- val = fetch_arg (buffer, place, 8, info);
1000+ FETCH_ARG (8, val);
1001 if (val & 0x80)
1002 val = val - 0x100;
1003 (*info->fprintf_func) (info->stream, "#%d", val);
1004@@ -698,29 +775,27 @@
1005 break;
1006
1007 case 'T':
1008- val = fetch_arg (buffer, place, 4, info);
1009+ FETCH_ARG (4, val);
1010 (*info->fprintf_func) (info->stream, "#%d", val);
1011 break;
1012
1013 case 'D':
1014- (*info->fprintf_func) (info->stream, "%s",
1015- reg_names[fetch_arg (buffer, place, 3, info)]);
1016+ FETCH_ARG (3, val);
1017+ (*info->fprintf_func) (info->stream, "%s", reg_names[val]);
1018 break;
1019
1020 case 'A':
1021- (*info->fprintf_func)
1022- (info->stream, "%s",
1023- reg_names[fetch_arg (buffer, place, 3, info) + 010]);
1024+ FETCH_ARG (3, val);
1025+ (*info->fprintf_func) (info->stream, "%s", reg_names[val + 010]);
1026 break;
1027
1028 case 'R':
1029- (*info->fprintf_func)
1030- (info->stream, "%s",
1031- reg_names[fetch_arg (buffer, place, 4, info)]);
1032+ FETCH_ARG (4, val);
1033+ (*info->fprintf_func) (info->stream, "%s", reg_names[val]);
1034 break;
1035
1036 case 'r':
1037- regno = fetch_arg (buffer, place, 4, info);
1038+ FETCH_ARG (4, regno);
1039 if (regno > 7)
1040 (*info->fprintf_func) (info->stream, "%s@", reg_names[regno]);
1041 else
1042@@ -728,13 +803,12 @@
1043 break;
1044
1045 case 'F':
1046- (*info->fprintf_func)
1047- (info->stream, "%%fp%d",
1048- fetch_arg (buffer, place, 3, info));
1049+ FETCH_ARG (3, val);
1050+ (*info->fprintf_func) (info->stream, "%%fp%d", val);
1051 break;
1052
1053 case 'O':
1054- val = fetch_arg (buffer, place, 6, info);
1055+ FETCH_ARG (6, val);
1056 if (val & 0x20)
1057 (*info->fprintf_func) (info->stream, "%s", reg_names[val & 7]);
1058 else
1059@@ -742,78 +816,78 @@
1060 break;
1061
1062 case '+':
1063- (*info->fprintf_func)
1064- (info->stream, "%s@+",
1065- reg_names[fetch_arg (buffer, place, 3, info) + 8]);
1066+ FETCH_ARG (3, val);
1067+ (*info->fprintf_func) (info->stream, "%s@+", reg_names[val + 8]);
1068 break;
1069
1070 case '-':
1071- (*info->fprintf_func)
1072- (info->stream, "%s@-",
1073- reg_names[fetch_arg (buffer, place, 3, info) + 8]);
1074+ FETCH_ARG (3, val);
1075+ (*info->fprintf_func) (info->stream, "%s@-", reg_names[val + 8]);
1076 break;
1077
1078 case 'k':
1079 if (place == 'k')
1080- (*info->fprintf_func)
1081- (info->stream, "{%s}",
1082- reg_names[fetch_arg (buffer, place, 3, info)]);
1083+ {
1084+ FETCH_ARG (3, val);
1085+ (*info->fprintf_func) (info->stream, "{%s}", reg_names[val]);
1086+ }
1087 else if (place == 'C')
1088 {
1089- val = fetch_arg (buffer, place, 7, info);
1090+ FETCH_ARG (7, val);
1091 if (val > 63) /* This is a signed constant. */
1092 val -= 128;
1093 (*info->fprintf_func) (info->stream, "{#%d}", val);
1094 }
1095 else
1096- return -2;
1097+ return -1;
1098 break;
1099
1100 case '#':
1101 case '^':
1102 p1 = buffer + (*d == '#' ? 2 : 4);
1103 if (place == 's')
1104- val = fetch_arg (buffer, place, 4, info);
1105+ FETCH_ARG (4, val);
1106 else if (place == 'C')
1107- val = fetch_arg (buffer, place, 7, info);
1108+ FETCH_ARG (7, val);
1109 else if (place == '8')
1110- val = fetch_arg (buffer, place, 3, info);
1111+ FETCH_ARG (3, val);
1112 else if (place == '3')
1113- val = fetch_arg (buffer, place, 8, info);
1114+ FETCH_ARG (8, val);
1115 else if (place == 'b')
1116- val = NEXTBYTE (p1);
1117+ NEXTBYTE (p1, val);
1118 else if (place == 'w' || place == 'W')
1119- val = NEXTWORD (p1);
1120+ NEXTWORD (p1, val, -3);
1121 else if (place == 'l')
1122- val = NEXTLONG (p1);
1123+ NEXTLONG (p1, val, -3);
1124 else
1125 return -2;
1126+
1127 (*info->fprintf_func) (info->stream, "#%d", val);
1128 break;
1129
1130 case 'B':
1131 if (place == 'b')
1132- disp = NEXTBYTE (p);
1133+ NEXTBYTE (p, disp);
1134 else if (place == 'B')
1135 disp = COERCE_SIGNED_CHAR (buffer[1]);
1136 else if (place == 'w' || place == 'W')
1137- disp = NEXTWORD (p);
1138+ NEXTWORD (p, disp, -3);
1139 else if (place == 'l' || place == 'L' || place == 'C')
1140- disp = NEXTLONG (p);
1141+ NEXTLONG (p, disp, -3);
1142 else if (place == 'g')
1143 {
1144- disp = NEXTBYTE (buffer);
1145+ NEXTBYTE (buffer, disp);
1146 if (disp == 0)
1147- disp = NEXTWORD (p);
1148+ NEXTWORD (p, disp, -3);
1149 else if (disp == -1)
1150- disp = NEXTLONG (p);
1151+ NEXTLONG (p, disp, -3);
1152 }
1153 else if (place == 'c')
1154 {
1155 if (buffer[1] & 0x40) /* If bit six is one, long offset. */
1156- disp = NEXTLONG (p);
1157+ NEXTLONG (p, disp, -3);
1158 else
1159- disp = NEXTWORD (p);
1160+ NEXTWORD (p, disp, -3);
1161 }
1162 else
1163 return -2;
1164@@ -822,29 +896,32 @@
1165 break;
1166
1167 case 'd':
1168- val = NEXTWORD (p);
1169- (*info->fprintf_func)
1170- (info->stream, "%s@(%d)",
1171- reg_names[fetch_arg (buffer, place, 3, info) + 8], val);
1172- break;
1173+ {
1174+ int val1;
1175+
1176+ NEXTWORD (p, val, -3);
1177+ FETCH_ARG (3, val1);
1178+ (*info->fprintf_func) (info->stream, "%s@(%d)", reg_names[val1 + 8], val);
1179+ break;
1180+ }
1181
1182 case 's':
1183- (*info->fprintf_func) (info->stream, "%s",
1184- fpcr_names[fetch_arg (buffer, place, 3, info)]);
1185+ FETCH_ARG (3, val);
1186+ (*info->fprintf_func) (info->stream, "%s", fpcr_names[val]);
1187 break;
1188
1189 case 'e':
1190- val = fetch_arg(buffer, place, 2, info);
1191+ FETCH_ARG (2, val);
1192 (*info->fprintf_func) (info->stream, "%%acc%d", val);
1193 break;
1194
1195 case 'g':
1196- val = fetch_arg(buffer, place, 1, info);
1197- (*info->fprintf_func) (info->stream, "%%accext%s", val==0 ? "01" : "23");
1198+ FETCH_ARG (1, val);
1199+ (*info->fprintf_func) (info->stream, "%%accext%s", val == 0 ? "01" : "23");
1200 break;
1201
1202 case 'i':
1203- val = fetch_arg(buffer, place, 2, info);
1204+ FETCH_ARG (2, val);
1205 if (val == 1)
1206 (*info->fprintf_func) (info->stream, "<<");
1207 else if (val == 3)
1208@@ -856,7 +933,8 @@
1209 case 'I':
1210 /* Get coprocessor ID... */
1211 val = fetch_arg (buffer, 'd', 3, info);
1212-
1213+ if (val < 0)
1214+ return -3;
1215 if (val != 1) /* Unusual coprocessor ID? */
1216 (*info->fprintf_func) (info->stream, "(cpid=%d) ", val);
1217 break;
1218@@ -888,10 +966,16 @@
1219 if (place == 'd')
1220 {
1221 val = fetch_arg (buffer, 'x', 6, info);
1222+ if (val < 0)
1223+ return -3;
1224 val = ((val & 7) << 3) + ((val >> 3) & 7);
1225 }
1226 else
1227- val = fetch_arg (buffer, 's', 6, info);
1228+ {
1229+ val = fetch_arg (buffer, 's', 6, info);
1230+ if (val < 0)
1231+ return -3;
1232+ }
1233
1234 /* If the <ea> is invalid for *d, then reject this match. */
1235 if (!m68k_valid_ea (*d, val))
1236@@ -923,29 +1007,31 @@
1237 break;
1238
1239 case 5:
1240- val = NEXTWORD (p);
1241+ NEXTWORD (p, val, -3);
1242 (*info->fprintf_func) (info->stream, "%s@(%d)", regname, val);
1243 break;
1244
1245 case 6:
1246 p = print_indexed (regno, p, addr, info);
1247+ if (p == NULL)
1248+ return -3;
1249 break;
1250
1251 case 7:
1252 switch (val & 7)
1253 {
1254 case 0:
1255- val = NEXTWORD (p);
1256+ NEXTWORD (p, val, -3);
1257 (*info->print_address_func) (val, info);
1258 break;
1259
1260 case 1:
1261- uval = NEXTULONG (p);
1262+ NEXTULONG (p, uval);
1263 (*info->print_address_func) (uval, info);
1264 break;
1265
1266 case 2:
1267- val = NEXTWORD (p);
1268+ NEXTWORD (p, val, -3);
1269 (*info->fprintf_func) (info->stream, "%%pc@(");
1270 (*info->print_address_func) (addr + val, info);
1271 (*info->fprintf_func) (info->stream, ")");
1272@@ -953,6 +1039,8 @@
1273
1274 case 3:
1275 p = print_indexed (-1, p, addr, info);
1276+ if (p == NULL)
1277+ return -3;
1278 break;
1279
1280 case 4:
1281@@ -960,17 +1048,17 @@
1282 switch (place)
1283 {
1284 case 'b':
1285- val = NEXTBYTE (p);
1286+ NEXTBYTE (p, val);
1287 flt_p = 0;
1288 break;
1289
1290 case 'w':
1291- val = NEXTWORD (p);
1292+ NEXTWORD (p, val, -3);
1293 flt_p = 0;
1294 break;
1295
1296 case 'l':
1297- val = NEXTLONG (p);
1298+ NEXTLONG (p, val, -3);
1299 flt_p = 0;
1300 break;
1301
1302@@ -987,7 +1075,7 @@
1303 break;
1304
1305 case 'p':
1306- flval = NEXTPACKED (p);
1307+ NEXTPACKED (p, flval);
1308 break;
1309
1310 default:
1311@@ -1009,7 +1097,7 @@
1312 mask bit and if set, add a '&' to the arg. */
1313 if (place == '/')
1314 {
1315- val = fetch_arg (buffer, place, 1, info);
1316+ FETCH_ARG (1, val);
1317 if (val)
1318 info->fprintf_func (info->stream, "&");
1319 }
1320@@ -1021,7 +1109,7 @@
1321 {
1322 char doneany;
1323 p1 = buffer + 2;
1324- val = NEXTWORD (p1);
1325+ NEXTWORD (p1, val, -3);
1326 /* Move the pointer ahead if this point is farther ahead
1327 than the last. */
1328 p = p1 > p ? p1 : p;
1329@@ -1062,7 +1150,8 @@
1330 {
1331 /* `fmovem' insn. */
1332 char doneany;
1333- val = fetch_arg (buffer, place, 8, info);
1334+
1335+ FETCH_ARG (8, val);
1336 if (val == 0)
1337 {
1338 (*info->fprintf_func) (info->stream, "#0");
1339@@ -1096,10 +1185,9 @@
1340 }
1341 else if (place == '8')
1342 {
1343+ FETCH_ARG (3, val);
1344 /* fmoveml for FP status registers. */
1345- (*info->fprintf_func) (info->stream, "%s",
1346- fpcr_names[fetch_arg (buffer, place, 3,
1347- info)]);
1348+ (*info->fprintf_func) (info->stream, "%s", fpcr_names[val]);
1349 }
1350 else
1351 return -2;
1352@@ -1115,9 +1203,10 @@
1353 case '2':
1354 case '3':
1355 {
1356- int val = fetch_arg (buffer, place, 5, info);
1357+ int val;
1358 char *name = 0;
1359
1360+ FETCH_ARG (5, val);
1361 switch (val)
1362 {
1363 case 2: name = "%tt0"; break;
1364@@ -1152,8 +1241,9 @@
1365
1366 case 'f':
1367 {
1368- int fc = fetch_arg (buffer, place, 5, info);
1369+ int fc;
1370
1371+ FETCH_ARG (5, fc);
1372 if (fc == 1)
1373 (*info->fprintf_func) (info->stream, "%%dfc");
1374 else if (fc == 0)
1375@@ -1170,8 +1260,9 @@
1376
1377 case 't':
1378 {
1379- int level = fetch_arg (buffer, place, 3, info);
1380+ int level;
1381
1382+ FETCH_ARG (3, level);
1383 (*info->fprintf_func) (info->stream, "%d", level);
1384 }
1385 break;
1386@@ -1179,8 +1270,9 @@
1387 case 'u':
1388 {
1389 short is_upper = 0;
1390- int reg = fetch_arg (buffer, place, 5, info);
1391+ int reg;
1392
1393+ FETCH_ARG (5, reg);
1394 if (reg & 0x10)
1395 {
1396 is_upper = 1;
1397@@ -1303,7 +1395,7 @@
1398
1399 if (eaten >= 0)
1400 p += eaten;
1401- else if (eaten == -1)
1402+ else if (eaten == -1 || eaten == -3)
1403 {
1404 info->fprintf_func = save_printer;
1405 info->print_address_func = save_print_address;
1406@@ -1318,7 +1410,7 @@
1407 info->fprintf_func (info->stream,
1408 /* xgettext:c-format */
1409 _("<internal error in opcode table: %s %s>\n"),
1410- best->name, best->args);
1411+ best->name, best->args);
1412 return 2;
1413 }
1414 }
1415@@ -1439,6 +1531,8 @@
1416 if (d[0] == 's' && d[1] == '8')
1417 {
1418 val = fetch_arg (buffer, d[1], 3, info);
1419+ if (val < 0)
1420+ return 0;
1421 if ((val & (val - 1)) != 0)
1422 break;
1423 }
1424@@ -1479,13 +1573,7 @@
1425
1426 bfd_byte *buffer = priv.the_buffer;
1427
1428- /* Save these printing functions in case we need to restore them
1429- later. */
1430- fprintf_ftype save_printer = info->fprintf_func;
1431- void (* save_print_address) (bfd_vma, struct disassemble_info *)
1432- = info->print_address_func;
1433-
1434- info->private_data = (PTR) &priv;
1435+ info->private_data = & priv;
1436 /* Tell objdump to use two bytes per chunk
1437 and six bytes per line for displaying raw data. */
1438 info->bytes_per_chunk = 2;
1439@@ -1494,49 +1582,23 @@
1440 priv.max_fetched = priv.the_buffer;
1441 priv.insn_start = memaddr;
1442
1443- if (setjmp (priv.bailout) != 0)
1444- {
1445- /* longjmp may be called while these printing functions are
1446- temporarily replaced with dummy functions. Restore them
1447- before we leave.
1448-
1449- Admittedly, this save-and-restore operation is somewhat ugly
1450- in that we are exposing the fact that match_insn_m68k
1451- temporarily replaces insn->fprintf_func and
1452- insn->print_address_func. Perhaps, a real fix is to report a
1453- FETCH_DATA failure with a return value of some sort, without
1454- using setjmp/longjmp. A better fix may be to teach the m68k
1455- disassembler do its job without temporarily replacing
1456- insn->fprintf_func and insn->print_address_func, but that's a
1457- task for another day. */
1458- info->fprintf_func = save_printer;
1459- info->print_address_func = save_print_address;
1460-
1461- /* Error return. */
1462- return -1;
1463- }
1464-
1465 arch_mask = bfd_m68k_mach_to_features (info->mach);
1466 if (!arch_mask)
1467 {
1468 /* First try printing an m680x0 instruction. Try printing a Coldfire
1469 one if that fails. */
1470 val = m68k_scan_mask (memaddr, info, m68k_mask);
1471- if (val)
1472- return val;
1473-
1474- val = m68k_scan_mask (memaddr, info, mcf_mask);
1475- if (val)
1476- return val;
1477+ if (val == 0)
1478+ val = m68k_scan_mask (memaddr, info, mcf_mask);
1479 }
1480 else
1481 {
1482 val = m68k_scan_mask (memaddr, info, arch_mask);
1483- if (val)
1484- return val;
1485 }
1486
1487- /* Handle undefined instructions. */
1488- info->fprintf_func (info->stream, "0%o", (buffer[0] << 8) + buffer[1]);
1489- return 2;
1490+ if (val == 0)
1491+ /* Handle undefined instructions. */
1492+ info->fprintf_func (info->stream, "0%o", (buffer[0] << 8) + buffer[1]);
1493+
1494+ return val ? val : 2;
1495 }
1496diff -Naur binutils-2.19.orig/opcodes/ppc-opc.c binutils-2.19/opcodes/ppc-opc.c
1497--- binutils-2.19.orig/opcodes/ppc-opc.c 2008-08-14 06:56:00.000000000 -0700
1498+++ binutils-2.19/opcodes/ppc-opc.c 2008-11-27 02:51:53.000000000 -0800
1499@@ -1281,10 +1281,10 @@
1500
1501 /* mfsprg can use 260..263 and 272..279. mtsprg only uses spr 272..279
1502 If not BOOKE or 405, then both use only 272..275. */
1503- if (val <= 3
1504- || (val < 0x10 && (insn & 0x100) != 0)
1505- || (val - 0x10 > 3
1506- && (dialect & (PPC_OPCODE_BOOKE | PPC_OPCODE_403)) == 0))
1507+ if ((val - 0x10 > 3 && (dialect & (PPC_OPCODE_BOOKE | PPC_OPCODE_405)) == 0)
1508+ || (val - 0x10 > 7 && (insn & 0x100) != 0)
1509+ || val <= 3
1510+ || (val & 8) != 0)
1511 *invalid = 1;
1512 return val & 7;
1513 }
Note: See TracBrowser for help on using the repository browser.