source: patches/binutils-2.19-branch_update-1.patch@ 9bf414b

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

Updated to Binutils 2.19

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