source:
patches/binutils-2.19-branch_update-1.patch@
c2647c5
Last change on this file since c2647c5 was c3f01f3, checked in by , 16 years ago | |
---|---|
|
|
File size: 37.2 KB |
-
bfd/ChangeLog
Submitted By: Jim Gifford (jim at linuxfromscratch dot org) Date: 12-21-2008 Initial Package Version: 2.19 Origin: Upstream Upstream Status: Applied Description: This is a branch update for binutils-2.19, and should be rechecked periodically. diff -Naur binutils-2.19.orig/bfd/ChangeLog binutils-2.19/bfd/ChangeLog
old new 1 2008-11-20 Alan Modra <amodra@bigpond.net.au> 2 3 * elf32-ppc.c (allocate_dynrelocs): Always use tlsld_got for 4 TLS_LD even when symbol is used with other TLS reloc types. 5 (ppc_elf_relocate_section): Bypass symbol checks when using tlsld_got. 6 Leave addend zero on LD DTPMOD dynamic reloc. 7 8 2008-11-17 Eric B. Weddington <eric.weddington@atmel.com> 9 10 PR 7022 11 * elf32-avr.c (bfd_elf_avr_final_write_processing): 12 Add missing break statements. 13 14 2008-10-28 Tristan Gingold <gingold@adacore.com> 15 16 * configure.in: Bump version to 2.19.0 17 * Makefile.am (RELEASE): Unset. 18 * configure, Makefile.in: Regenerated. 19 1 20 2008-10-16 Tristan Gingold <gingold@adacore.com> 2 21 3 22 * configure.in: Bump version to 2.19 -
bfd/Makefile.in
diff -Naur binutils-2.19.orig/bfd/Makefile.in binutils-2.19/bfd/Makefile.in
old new 271 271 ACLOCAL_AMFLAGS = -I . -I .. -I ../config 272 272 273 273 # Uncomment the following line when doing a release. 274 RELEASE =y274 RELEASE=y 275 275 INCDIR = $(srcdir)/../include 276 276 CSEARCH = -I. -I$(srcdir) -I$(INCDIR) 277 277 MKDEP = gcc -MM -
bfd/configure
diff -Naur binutils-2.19.orig/bfd/configure binutils-2.19/bfd/configure
old new 3032 3032 3033 3033 # Define the identity of the package. 3034 3034 PACKAGE=bfd 3035 VERSION=2.19 3035 VERSION=2.19.0 3036 3036 3037 3037 3038 3038 cat >>confdefs.h <<_ACEOF -
bfd/configure.in
diff -Naur binutils-2.19.orig/bfd/configure.in binutils-2.19/bfd/configure.in
old new 8 8 AC_CANONICAL_TARGET 9 9 AC_ISC_POSIX 10 10 11 AM_INIT_AUTOMAKE(bfd, 2.19 )11 AM_INIT_AUTOMAKE(bfd, 2.19.0) 12 12 13 13 dnl These must be called before LT_INIT, because it may want 14 14 dnl to call AC_CHECK_PROG. -
bfd/elf32-avr.c
diff -Naur binutils-2.19.orig/bfd/elf32-avr.c binutils-2.19/bfd/elf32-avr.c
old new 1298 1298 1299 1299 case bfd_mach_avr25: 1300 1300 val = E_AVR_MACH_AVR25; 1301 break; 1301 1302 1302 1303 case bfd_mach_avr3: 1303 1304 val = E_AVR_MACH_AVR3; … … 1305 1306 1306 1307 case bfd_mach_avr31: 1307 1308 val = E_AVR_MACH_AVR31; 1309 break; 1308 1310 1309 1311 case bfd_mach_avr35: 1310 1312 val = E_AVR_MACH_AVR35; 1313 break; 1311 1314 1312 1315 case bfd_mach_avr4: 1313 1316 val = E_AVR_MACH_AVR4; -
bfd/elf32-ppc.c
diff -Naur binutils-2.19.orig/bfd/elf32-ppc.c binutils-2.19/bfd/elf32-ppc.c
old new 4997 4997 eh = (struct ppc_elf_link_hash_entry *) h; 4998 4998 if (eh->elf.got.refcount > 0) 4999 4999 { 5000 bfd_boolean dyn; 5001 unsigned int need; 5002 5000 5003 /* Make sure this symbol is output as a dynamic symbol. */ 5001 5004 if (eh->elf.dynindx == -1 5002 5005 && !eh->elf.forced_local … … 5006 5009 return FALSE; 5007 5010 } 5008 5011 5009 if (eh->tls_mask == (TLS_TLS | TLS_LD) 5010 && !eh->elf.def_dynamic) 5011 { 5012 /* If just an LD reloc, we'll just use htab->tlsld_got.offset. */ 5013 htab->tlsld_got.refcount += 1; 5014 eh->elf.got.offset = (bfd_vma) -1; 5015 } 5016 else 5012 need = 0; 5013 if ((eh->tls_mask & TLS_TLS) != 0) 5017 5014 { 5018 bfd_boolean dyn; 5019 unsigned int need = 0; 5020 if ((eh->tls_mask & TLS_TLS) != 0) 5015 if ((eh->tls_mask & TLS_LD) != 0) 5021 5016 { 5022 if ((eh->tls_mask & TLS_LD) != 0) 5023 need += 8; 5024 if ((eh->tls_mask & TLS_GD) != 0) 5017 if (!eh->elf.def_dynamic) 5018 /* We'll just use htab->tlsld_got.offset. This should 5019 always be the case. It's a little odd if we have 5020 a local dynamic reloc against a non-local symbol. */ 5021 htab->tlsld_got.refcount += 1; 5022 else 5025 5023 need += 8; 5026 if ((eh->tls_mask & (TLS_TPREL | TLS_TPRELGD)) != 0)5027 need += 4;5028 if ((eh->tls_mask & TLS_DTPREL) != 0)5029 need += 4;5030 5024 } 5031 else 5025 if ((eh->tls_mask & TLS_GD) != 0) 5026 need += 8; 5027 if ((eh->tls_mask & (TLS_TPREL | TLS_TPRELGD)) != 0) 5028 need += 4; 5029 if ((eh->tls_mask & TLS_DTPREL) != 0) 5032 5030 need += 4; 5031 } 5032 else 5033 need += 4; 5034 if (need == 0) 5035 eh->elf.got.offset = (bfd_vma) -1; 5036 else 5037 { 5033 5038 eh->elf.got.offset = allocate_got (htab, need); 5034 5039 dyn = htab->elf.dynamic_sections_created; 5035 5040 if ((info->shared … … 5039 5044 { 5040 5045 /* All the entries we allocated need relocs. 5041 5046 Except LD only needs one. */ 5042 if ((eh->tls_mask & TLS_LD) != 0) 5047 if ((eh->tls_mask & TLS_LD) != 0 5048 && eh->elf.def_dynamic) 5043 5049 need -= 4; 5044 5050 htab->relgot->size += need * (sizeof (Elf32_External_Rela) / 4); 5045 5051 } … … 5275 5281 for (; local_got < end_local_got; ++local_got, ++lgot_masks) 5276 5282 if (*local_got > 0) 5277 5283 { 5278 if (*lgot_masks == (TLS_TLS | TLS_LD)) 5284 unsigned int need = 0; 5285 if ((*lgot_masks & TLS_TLS) != 0) 5279 5286 { 5280 /* If just an LD reloc, we'll just use 5281 htab->tlsld_got.offset. */ 5282 htab->tlsld_got.refcount += 1; 5283 *local_got = (bfd_vma) -1; 5287 if ((*lgot_masks & TLS_GD) != 0) 5288 need += 8; 5289 if ((*lgot_masks & TLS_LD) != 0) 5290 htab->tlsld_got.refcount += 1; 5291 if ((*lgot_masks & (TLS_TPREL | TLS_TPRELGD)) != 0) 5292 need += 4; 5293 if ((*lgot_masks & TLS_DTPREL) != 0) 5294 need += 4; 5284 5295 } 5285 5296 else 5297 need += 4; 5298 if (need == 0) 5299 *local_got = (bfd_vma) -1; 5300 else 5286 5301 { 5287 unsigned int need = 0;5288 if ((*lgot_masks & TLS_TLS) != 0)5289 {5290 if ((*lgot_masks & TLS_GD) != 0)5291 need += 8;5292 if ((*lgot_masks & (TLS_TPREL | TLS_TPRELGD)) != 0)5293 need += 4;5294 if ((*lgot_masks & TLS_DTPREL) != 0)5295 need += 4;5296 }5297 else5298 need += 4;5299 5302 *local_got = allocate_got (htab, need); 5300 5303 if (info->shared) 5301 5304 htab->relgot->size += (need … … 6560 6563 6561 6564 /* Generate relocs for the dynamic linker. */ 6562 6565 if ((info->shared || indx != 0) 6563 && (h == NULL 6566 && (offp == &htab->tlsld_got.offset 6567 || h == NULL 6564 6568 || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT 6565 6569 || h->root.type != bfd_link_hash_undefweak)) 6566 6570 { … … 6591 6595 outrel.r_info = ELF32_R_INFO (indx, R_PPC_RELATIVE); 6592 6596 else 6593 6597 outrel.r_info = ELF32_R_INFO (indx, R_PPC_GLOB_DAT); 6594 if (indx == 0 )6598 if (indx == 0 && tls_ty != (TLS_TLS | TLS_LD)) 6595 6599 { 6596 6600 outrel.r_addend += relocation; 6597 6601 if (tls_ty & (TLS_GD | TLS_DTPREL | TLS_TPREL)) -
bfd/version.h
diff -Naur binutils-2.19.orig/bfd/version.h binutils-2.19/bfd/version.h
old new 1 #define BFD_VERSION_DATE 20081 0161 #define BFD_VERSION_DATE 20081220 2 2 #define BFD_VERSION @bfd_version@ 3 3 #define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@ 4 4 #define REPORT_BUGS_TO @report_bugs_to@ -
binutils/ChangeLog
diff -Naur binutils-2.19.orig/binutils/ChangeLog binutils-2.19/binutils/ChangeLog
old new 1 2008-12-01 Nick Clifton <nickc@redhat.com> 2 3 PR 7044 4 * dlltool.c (run): Use formatting string to avoid compile time 5 warning. 6 (gen_exp_file): Check return value from fread. 7 * windmc.c (main): Check return value from fread. 8 1 9 2008-09-25 Richard Henderson <rth@redhat.com> 2 10 3 11 * dwarf.c (size_of_encoded_value, get_encoded_value): Move up. -
binutils/dlltool.c
diff -Naur binutils-2.19.orig/binutils/dlltool.c binutils-2.19/binutils/dlltool.c
old new 1206 1206 1207 1207 if (pid == -1) 1208 1208 { 1209 inform ( strerror (errno));1209 inform ("%s", strerror (errno)); 1210 1210 1211 1211 fatal (errmsg_fmt, errmsg_arg); 1212 1212 } … … 1992 1992 numbytes = ftell (base_file); 1993 1993 fseek (base_file, 0, SEEK_SET); 1994 1994 copy = xmalloc (numbytes); 1995 fread (copy, 1, numbytes, base_file); 1995 if (fread (copy, 1, numbytes, base_file) < numbytes) 1996 fatal (_("failed to read the number of entries from base file")); 1996 1997 num_entries = numbytes / sizeof (long); 1997 1998 1998 1999 1999 fprintf (f, "\t.section\t.reloc\n"); 2000 2000 if (num_entries) 2001 2001 { -
binutils/windmc.c
diff -Naur binutils-2.19.orig/binutils/windmc.c binutils-2.19/binutils/windmc.c
old new 1155 1155 fseek (fp, 0, SEEK_SET); 1156 1156 buff = malloc (flen + 3); 1157 1157 memset (buff, 0, flen + 3); 1158 fread (buff, 1, flen, fp); 1158 if (fread (buff, 1, flen, fp) < flen) 1159 fatal (_("unable to read contents of %s"), input_filename); 1159 1160 fclose (fp); 1160 1161 if (mcset_text_in_is_unicode != 1) 1161 1162 { -
configure.ac
diff -Naur binutils-2.19.orig/configure.ac binutils-2.19/configure.ac
old new 166 166 # binutils, gas and ld appear in that order because it makes sense to run 167 167 # "make check" in that particular order. 168 168 # If --enable-gold is used, "gold" will replace "ld". 169 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"169 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" 170 170 171 171 # libgcj represents the runtime libraries only used by gcj. 172 172 libgcj="target-libffi \ -
ld/ChangeLog
diff -Naur binutils-2.19.orig/ld/ChangeLog binutils-2.19/ld/ChangeLog
old new 1 2008-11-14 Alan Modra <amodra@bigpond.net.au> 2 3 * Makefile.am (spu_ovl.o_c): Add missing line continuations. 4 * Makefile.in: Regenerate. 5 1 6 2008-10-05 Alan Modra <amodra@bigpond.net.au> 2 7 3 8 PR 6943 -
ld/Makefile.am
diff -Naur binutils-2.19.orig/ld/Makefile.am binutils-2.19/ld/Makefile.am
old new 758 758 $(srcdir)/emultempl/spu_ovl.o_c: @MAINT@ $(srcdir)/emultempl/spu_ovl.S 759 759 if ../gas/as-new --version \ 760 760 | grep 'target.*spu' >/dev/null 2>/dev/null; then \ 761 cpp -DOVLY_IRQ_SAVE $(srcdir)/emultempl/spu_ovl.S spu_ovl.s 761 cpp -DOVLY_IRQ_SAVE $(srcdir)/emultempl/spu_ovl.S spu_ovl.s; \ 762 762 ../gas/as-new -o spu_ovl.o spu_ovl.s; \ 763 ../binutils/bin2c <spu_ovl.o >$@ 763 ../binutils/bin2c <spu_ovl.o >$@; \ 764 764 fi 765 765 eelf32_i860.c: $(srcdir)/emulparams/elf32_i860.sh \ 766 766 $(ELF_GEN_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} -
ld/Makefile.in
diff -Naur binutils-2.19.orig/ld/Makefile.in binutils-2.19/ld/Makefile.in
old new 1588 1588 $(srcdir)/emultempl/spu_ovl.o_c: @MAINT@ $(srcdir)/emultempl/spu_ovl.S 1589 1589 if ../gas/as-new --version \ 1590 1590 | grep 'target.*spu' >/dev/null 2>/dev/null; then \ 1591 cpp -DOVLY_IRQ_SAVE $(srcdir)/emultempl/spu_ovl.S spu_ovl.s 1591 cpp -DOVLY_IRQ_SAVE $(srcdir)/emultempl/spu_ovl.S spu_ovl.s; \ 1592 1592 ../gas/as-new -o spu_ovl.o spu_ovl.s; \ 1593 ../binutils/bin2c <spu_ovl.o >$@ 1593 ../binutils/bin2c <spu_ovl.o >$@; \ 1594 1594 fi 1595 1595 eelf32_i860.c: $(srcdir)/emulparams/elf32_i860.sh \ 1596 1596 $(ELF_GEN_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} -
opcodes/ChangeLog
diff -Naur binutils-2.19.orig/opcodes/ChangeLog binutils-2.19/opcodes/ChangeLog
old new 1 2008-11-27 Alan Modra <amodra@bigpond.net.au> 2 3 * ppc-opc.c (extract_sprg): Correct operand range check. 4 5 2008-11-26 Andreas Schwab <schwab@suse.de> 6 7 * m68k-dis.c (NEXTBYTE, NEXTWORD, NEXTLONG, NEXTULONG, NEXTSINGLE) 8 (NEXTDOUBLE, NEXTEXTEND, NEXTPACKED): Fix error handling. 9 (save_printer, save_print_address): Remove. 10 (fetch_data): Don't use them. 11 (match_insn_m68k): Always restore printing functions. 12 (print_insn_m68k): Don't save/restore printing functions. 13 14 2008-11-25 Nick Clifton <nickc@redhat.com> 15 16 * m68k-dis.c: Rewrite to remove use of setjmp/longjmp. 17 1 18 2008-09-29 Nick Clifton <nickc@redhat.com> 2 19 3 20 * po/vi.po: Updated Vietnamese translation. -
opcodes/m68k-dis.c
diff -Naur binutils-2.19.orig/opcodes/m68k-dis.c binutils-2.19/opcodes/m68k-dis.c
old new 60 60 #endif 61 61 62 62 /* Get a 1 byte signed integer. */ 63 #define NEXTBYTE(p) (p += 2, FETCH_DATA (info, p), COERCE_SIGNED_CHAR(p[-1])) 63 #define NEXTBYTE(p, val) \ 64 do \ 65 { \ 66 p += 2; \ 67 if (!FETCH_DATA (info, p)) \ 68 return -3; \ 69 val = COERCE_SIGNED_CHAR (p[-1]); \ 70 } \ 71 while (0) 64 72 65 73 /* Get a 2 byte signed integer. */ 66 74 #define COERCE16(x) ((int) (((x) ^ 0x8000) - 0x8000)) 67 #define NEXTWORD(p) \ 68 (p += 2, FETCH_DATA (info, p), \ 69 COERCE16 ((p[-2] << 8) + p[-1])) 75 76 #define NEXTWORD(p, val, ret_val) \ 77 do \ 78 { \ 79 p += 2; \ 80 if (!FETCH_DATA (info, p)) \ 81 return ret_val; \ 82 val = COERCE16 ((p[-2] << 8) + p[-1]); \ 83 } \ 84 while (0) 70 85 71 86 /* Get a 4 byte signed integer. */ 72 87 #define COERCE32(x) ((bfd_signed_vma) ((x) ^ 0x80000000) - 0x80000000) 73 #define NEXTLONG(p) \ 74 (p += 4, FETCH_DATA (info, p), \ 75 (COERCE32 ((((((p[-4] << 8) + p[-3]) << 8) + p[-2]) << 8) + p[-1]))) 88 89 #define NEXTLONG(p, val, ret_val) \ 90 do \ 91 { \ 92 p += 4; \ 93 if (!FETCH_DATA (info, p)) \ 94 return ret_val; \ 95 val = COERCE32 ((((((p[-4] << 8) + p[-3]) << 8) + p[-2]) << 8) + p[-1]); \ 96 } \ 97 while (0) 76 98 77 99 /* Get a 4 byte unsigned integer. */ 78 #define NEXTULONG(p) \ 79 (p += 4, FETCH_DATA (info, p), \ 80 (unsigned int) ((((((p[-4] << 8) + p[-3]) << 8) + p[-2]) << 8) + p[-1])) 100 #define NEXTULONG(p, val) \ 101 do \ 102 { \ 103 p += 4; \ 104 if (!FETCH_DATA (info, p)) \ 105 return -3; \ 106 val = (unsigned int) ((((((p[-4] << 8) + p[-3]) << 8) + p[-2]) << 8) + p[-1]); \ 107 } \ 108 while (0) 81 109 82 110 /* Get a single precision float. */ 83 #define NEXTSINGLE(val, p) \ 84 (p += 4, FETCH_DATA (info, p), \ 85 floatformat_to_double (&floatformat_ieee_single_big, (char *) p - 4, &val)) 111 #define NEXTSINGLE(val, p) \ 112 do \ 113 { \ 114 p += 4; \ 115 if (!FETCH_DATA (info, p)) \ 116 return -3; \ 117 floatformat_to_double (& floatformat_ieee_single_big, \ 118 (char *) p - 4, & val); \ 119 } \ 120 while (0) 86 121 87 122 /* Get a double precision float. */ 88 #define NEXTDOUBLE(val, p) \ 89 (p += 8, FETCH_DATA (info, p), \ 90 floatformat_to_double (&floatformat_ieee_double_big, (char *) p - 8, &val)) 123 #define NEXTDOUBLE(val, p) \ 124 do \ 125 { \ 126 p += 8; \ 127 if (!FETCH_DATA (info, p)) \ 128 return -3; \ 129 floatformat_to_double (& floatformat_ieee_double_big, \ 130 (char *) p - 8, & val); \ 131 } \ 132 while (0) 91 133 92 134 /* Get an extended precision float. */ 93 #define NEXTEXTEND(val, p) \ 94 (p += 12, FETCH_DATA (info, p), \ 95 floatformat_to_double (&floatformat_m68881_ext, (char *) p - 12, &val)) 135 #define NEXTEXTEND(val, p) \ 136 do \ 137 { \ 138 p += 12; \ 139 if (!FETCH_DATA (info, p)) \ 140 return -3; \ 141 floatformat_to_double (& floatformat_m68881_ext, \ 142 (char *) p - 12, & val); \ 143 } \ 144 while (0) 96 145 97 146 /* Need a function to convert from packed to double 98 147 precision. Actually, it's easier to print a 99 148 packed number than a double anyway, so maybe 100 149 there should be a special case to handle this... */ 101 #define NEXTPACKED(p) \ 102 (p += 12, FETCH_DATA (info, p), 0.0) 150 #define NEXTPACKED(p, val) \ 151 do \ 152 { \ 153 p += 12; \ 154 if (!FETCH_DATA (info, p)) \ 155 return -3; \ 156 val = 0.0; \ 157 } \ 158 while (0) 159 103 160 104 161 105 162 /* Maximum length of an instruction. */ -
opcodes/ppc-opc.c
#define MAXLEN 22 @@ -112,12 +169,10 @@ bfd_byte *max_fetched; bfd_byte the_buffer[MAXLEN]; bfd_vma insn_start; - jmp_buf bailout; }; /* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive) - to ADDR (exclusive) are valid. Returns 1 for success, longjmps - on error. */ + to ADDR (exclusive) are valid. Returns 1 for success, 0 on error. */ #define FETCH_DATA(info, addr) \ ((addr) <= ((struct private *) (info->private_data))->max_fetched \ ? 1 : fetch_data ((info), (addr))) @@ -136,7 +191,7 @@ if (status != 0) { (*info->memory_error_func) (status, start, info); - longjmp (priv->bailout, 1); + return 0; } else priv->max_fetched = addr; @@ -161,7 +216,8 @@ /* Fetch BITS bits from a position in the instruction specified by CODE. CODE is a "place to put an argument", or 'x' for a destination that is a general address (mode and register). - BUFFER contains the instruction. */ + BUFFER contains the instruction. + Returns -1 on failure. */ static int fetch_arg (unsigned char *buffer, @@ -216,64 +272,75 @@ break; case 'k': - FETCH_DATA (info, buffer + 3); + if (! FETCH_DATA (info, buffer + 3)) + return -1; val = (buffer[3] >> 4); break; case 'C': - FETCH_DATA (info, buffer + 3); + if (! FETCH_DATA (info, buffer + 3)) + return -1; val = buffer[3]; break; case '1': - FETCH_DATA (info, buffer + 3); + if (! FETCH_DATA (info, buffer + 3)) + return -1; val = (buffer[2] << 8) + buffer[3]; val >>= 12; break; case '2': - FETCH_DATA (info, buffer + 3); + if (! FETCH_DATA (info, buffer + 3)) + return -1; val = (buffer[2] << 8) + buffer[3]; val >>= 6; break; case '3': case 'j': - FETCH_DATA (info, buffer + 3); + if (! FETCH_DATA (info, buffer + 3)) + return -1; val = (buffer[2] << 8) + buffer[3]; break; case '4': - FETCH_DATA (info, buffer + 5); + if (! FETCH_DATA (info, buffer + 5)) + return -1; val = (buffer[4] << 8) + buffer[5]; val >>= 12; break; case '5': - FETCH_DATA (info, buffer + 5); + if (! FETCH_DATA (info, buffer + 5)) + return -1; val = (buffer[4] << 8) + buffer[5]; val >>= 6; break; case '6': - FETCH_DATA (info, buffer + 5); + if (! FETCH_DATA (info, buffer + 5)) + return -1; val = (buffer[4] << 8) + buffer[5]; break; case '7': - FETCH_DATA (info, buffer + 3); + if (! FETCH_DATA (info, buffer + 3)) + return -1; val = (buffer[2] << 8) + buffer[3]; val >>= 7; break; case '8': - FETCH_DATA (info, buffer + 3); + if (! FETCH_DATA (info, buffer + 3)) + return -1; val = (buffer[2] << 8) + buffer[3]; val >>= 10; break; case '9': - FETCH_DATA (info, buffer + 3); + if (! FETCH_DATA (info, buffer + 3)) + return -1; val = (buffer[2] << 8) + buffer[3]; val >>= 5; break; @@ -283,7 +350,8 @@ break; case 'E': - FETCH_DATA (info, buffer + 3); + if (! FETCH_DATA (info, buffer + 3)) + return -1; val = (buffer[2] >> 1); break; @@ -450,7 +518,8 @@ /* Print an indexed argument. The base register is BASEREG (-1 for pc). P points to extension word, in buffer. - ADDR is the nominal core address of that extension word. */ + ADDR is the nominal core address of that extension word. + Returns NULL upon error. */ static unsigned char * print_indexed (int basereg, @@ -465,7 +534,7 @@ char buf[40]; char vmabuf[50]; - word = NEXTWORD (p); + NEXTWORD (p, word, NULL); /* Generate the text for the index register. Where this will be output is not yet determined. */ @@ -503,10 +572,10 @@ switch ((word >> 4) & 3) { case 2: - base_disp = NEXTWORD (p); + NEXTWORD (p, base_disp, NULL); break; case 3: - base_disp = NEXTLONG (p); + NEXTLONG (p, base_disp, NULL); } if (basereg == -1) base_disp += addr; @@ -526,10 +595,10 @@ switch (word & 3) { case 2: - outer_disp = NEXTWORD (p); + NEXTWORD (p, outer_disp, NULL); break; case 3: - outer_disp = NEXTLONG (p); + NEXTLONG (p, outer_disp, NULL); } print_base (basereg, base_disp, info); @@ -547,9 +616,18 @@ return p; } +#define FETCH_ARG(size, val) \ + do \ + { \ + val = fetch_arg (buffer, place, size, info); \ + if (val < 0) \ + return -3; \ + } \ + while (0) + /* Returns number of bytes "eaten" by the operand, or return -1 if an invalid operand was found, or -2 if - an opcode tabe error was found. + an opcode tabe error was found or -3 to simply abort. ADDR is the pc for this arg to be relative to. */ static int @@ -575,23 +653,21 @@ case 'c': /* Cache identifier. */ { static char *const cacheFieldName[] = { "nc", "dc", "ic", "bc" }; - val = fetch_arg (buffer, place, 2, info); - (*info->fprintf_func) (info->stream, cacheFieldName[val]); + FETCH_ARG (2, val); + (*info->fprintf_func) (info->stream, cacheFieldName[val]); break; } case 'a': /* Address register indirect only. Cf. case '+'. */ { - (*info->fprintf_func) - (info->stream, - "%s@", - reg_names[fetch_arg (buffer, place, 3, info) + 8]); + FETCH_ARG (3, val); + (*info->fprintf_func) (info->stream, "%s@", reg_names[val + 8]); break; } case '_': /* 32-bit absolute address for move16. */ { - uval = NEXTULONG (p); + NEXTULONG (p, uval); (*info->print_address_func) (uval, info); break; } @@ -643,7 +719,7 @@ /* Fido added these. */ {"%cac", 0xffe}, {"%mbo", 0xfff}}; - val = fetch_arg (buffer, place, 12, info); + FETCH_ARG (12, val); for (regno = sizeof names / sizeof names[0] - 1; regno >= 0; regno--) if (names[regno].value == val) { @@ -656,7 +732,7 @@ break; case 'Q': - val = fetch_arg (buffer, place, 3, info); + FETCH_ARG (3, val); /* 0 means 8, except for the bkpt instruction... */ if (val == 0 && d[1] != 's') val = 8; @@ -664,7 +740,7 @@ break; case 'x': - val = fetch_arg (buffer, place, 3, info); + FETCH_ARG (3, val); /* 0 means -1. */ if (val == 0) val = -1; @@ -672,12 +748,12 @@ break; case 'j': - val = fetch_arg (buffer, place, 3, info); + FETCH_ARG (3, val); (*info->fprintf_func) (info->stream, "#%d", val+1); break; case 'K': - val = fetch_arg (buffer, place, 9, info); + FETCH_ARG (9, val); (*info->fprintf_func) (info->stream, "#%d", val); break; @@ -685,12 +761,13 @@ if (place == 'h') { static char *const scalefactor_name[] = { "<<", ">>" }; - val = fetch_arg (buffer, place, 1, info); + + FETCH_ARG (1, val); (*info->fprintf_func) (info->stream, scalefactor_name[val]); } else { - val = fetch_arg (buffer, place, 8, info); + FETCH_ARG (8, val); if (val & 0x80) val = val - 0x100; (*info->fprintf_func) (info->stream, "#%d", val); @@ -698,29 +775,27 @@ break; case 'T': - val = fetch_arg (buffer, place, 4, info); + FETCH_ARG (4, val); (*info->fprintf_func) (info->stream, "#%d", val); break; case 'D': - (*info->fprintf_func) (info->stream, "%s", - reg_names[fetch_arg (buffer, place, 3, info)]); + FETCH_ARG (3, val); + (*info->fprintf_func) (info->stream, "%s", reg_names[val]); break; case 'A': - (*info->fprintf_func) - (info->stream, "%s", - reg_names[fetch_arg (buffer, place, 3, info) + 010]); + FETCH_ARG (3, val); + (*info->fprintf_func) (info->stream, "%s", reg_names[val + 010]); break; case 'R': - (*info->fprintf_func) - (info->stream, "%s", - reg_names[fetch_arg (buffer, place, 4, info)]); + FETCH_ARG (4, val); + (*info->fprintf_func) (info->stream, "%s", reg_names[val]); break; case 'r': - regno = fetch_arg (buffer, place, 4, info); + FETCH_ARG (4, regno); if (regno > 7) (*info->fprintf_func) (info->stream, "%s@", reg_names[regno]); else @@ -728,13 +803,12 @@ break; case 'F': - (*info->fprintf_func) - (info->stream, "%%fp%d", - fetch_arg (buffer, place, 3, info)); + FETCH_ARG (3, val); + (*info->fprintf_func) (info->stream, "%%fp%d", val); break; case 'O': - val = fetch_arg (buffer, place, 6, info); + FETCH_ARG (6, val); if (val & 0x20) (*info->fprintf_func) (info->stream, "%s", reg_names[val & 7]); else @@ -742,78 +816,78 @@ break; case '+': - (*info->fprintf_func) - (info->stream, "%s@+", - reg_names[fetch_arg (buffer, place, 3, info) + 8]); + FETCH_ARG (3, val); + (*info->fprintf_func) (info->stream, "%s@+", reg_names[val + 8]); break; case '-': - (*info->fprintf_func) - (info->stream, "%s@-", - reg_names[fetch_arg (buffer, place, 3, info) + 8]); + FETCH_ARG (3, val); + (*info->fprintf_func) (info->stream, "%s@-", reg_names[val + 8]); break; case 'k': if (place == 'k') - (*info->fprintf_func) - (info->stream, "{%s}", - reg_names[fetch_arg (buffer, place, 3, info)]); + { + FETCH_ARG (3, val); + (*info->fprintf_func) (info->stream, "{%s}", reg_names[val]); + } else if (place == 'C') { - val = fetch_arg (buffer, place, 7, info); + FETCH_ARG (7, val); if (val > 63) /* This is a signed constant. */ val -= 128; (*info->fprintf_func) (info->stream, "{#%d}", val); } else - return -2; + return -1; break; case '#': case '^': p1 = buffer + (*d == '#' ? 2 : 4); if (place == 's') - val = fetch_arg (buffer, place, 4, info); + FETCH_ARG (4, val); else if (place == 'C') - val = fetch_arg (buffer, place, 7, info); + FETCH_ARG (7, val); else if (place == '8') - val = fetch_arg (buffer, place, 3, info); + FETCH_ARG (3, val); else if (place == '3') - val = fetch_arg (buffer, place, 8, info); + FETCH_ARG (8, val); else if (place == 'b') - val = NEXTBYTE (p1); + NEXTBYTE (p1, val); else if (place == 'w' || place == 'W') - val = NEXTWORD (p1); + NEXTWORD (p1, val, -3); else if (place == 'l') - val = NEXTLONG (p1); + NEXTLONG (p1, val, -3); else return -2; + (*info->fprintf_func) (info->stream, "#%d", val); break; case 'B': if (place == 'b') - disp = NEXTBYTE (p); + NEXTBYTE (p, disp); else if (place == 'B') disp = COERCE_SIGNED_CHAR (buffer[1]); else if (place == 'w' || place == 'W') - disp = NEXTWORD (p); + NEXTWORD (p, disp, -3); else if (place == 'l' || place == 'L' || place == 'C') - disp = NEXTLONG (p); + NEXTLONG (p, disp, -3); else if (place == 'g') { - disp = NEXTBYTE (buffer); + NEXTBYTE (buffer, disp); if (disp == 0) - disp = NEXTWORD (p); + NEXTWORD (p, disp, -3); else if (disp == -1) - disp = NEXTLONG (p); + NEXTLONG (p, disp, -3); } else if (place == 'c') { if (buffer[1] & 0x40) /* If bit six is one, long offset. */ - disp = NEXTLONG (p); + NEXTLONG (p, disp, -3); else - disp = NEXTWORD (p); + NEXTWORD (p, disp, -3); } else return -2; @@ -822,29 +896,32 @@ break; case 'd': - val = NEXTWORD (p); - (*info->fprintf_func) - (info->stream, "%s@(%d)", - reg_names[fetch_arg (buffer, place, 3, info) + 8], val); - break; + { + int val1; + + NEXTWORD (p, val, -3); + FETCH_ARG (3, val1); + (*info->fprintf_func) (info->stream, "%s@(%d)", reg_names[val1 + 8], val); + break; + } case 's': - (*info->fprintf_func) (info->stream, "%s", - fpcr_names[fetch_arg (buffer, place, 3, info)]); + FETCH_ARG (3, val); + (*info->fprintf_func) (info->stream, "%s", fpcr_names[val]); break; case 'e': - val = fetch_arg(buffer, place, 2, info); + FETCH_ARG (2, val); (*info->fprintf_func) (info->stream, "%%acc%d", val); break; case 'g': - val = fetch_arg(buffer, place, 1, info); - (*info->fprintf_func) (info->stream, "%%accext%s", val==0 ? "01" : "23"); + FETCH_ARG (1, val); + (*info->fprintf_func) (info->stream, "%%accext%s", val == 0 ? "01" : "23"); break; case 'i': - val = fetch_arg(buffer, place, 2, info); + FETCH_ARG (2, val); if (val == 1) (*info->fprintf_func) (info->stream, "<<"); else if (val == 3) @@ -856,7 +933,8 @@ case 'I': /* Get coprocessor ID... */ val = fetch_arg (buffer, 'd', 3, info); - + if (val < 0) + return -3; if (val != 1) /* Unusual coprocessor ID? */ (*info->fprintf_func) (info->stream, "(cpid=%d) ", val); break; @@ -888,10 +966,16 @@ if (place == 'd') { val = fetch_arg (buffer, 'x', 6, info); + if (val < 0) + return -3; val = ((val & 7) << 3) + ((val >> 3) & 7); } else - val = fetch_arg (buffer, 's', 6, info); + { + val = fetch_arg (buffer, 's', 6, info); + if (val < 0) + return -3; + } /* If the <ea> is invalid for *d, then reject this match. */ if (!m68k_valid_ea (*d, val)) @@ -923,29 +1007,31 @@ break; case 5: - val = NEXTWORD (p); + NEXTWORD (p, val, -3); (*info->fprintf_func) (info->stream, "%s@(%d)", regname, val); break; case 6: p = print_indexed (regno, p, addr, info); + if (p == NULL) + return -3; break; case 7: switch (val & 7) { case 0: - val = NEXTWORD (p); + NEXTWORD (p, val, -3); (*info->print_address_func) (val, info); break; case 1: - uval = NEXTULONG (p); + NEXTULONG (p, uval); (*info->print_address_func) (uval, info); break; case 2: - val = NEXTWORD (p); + NEXTWORD (p, val, -3); (*info->fprintf_func) (info->stream, "%%pc@("); (*info->print_address_func) (addr + val, info); (*info->fprintf_func) (info->stream, ")"); @@ -953,6 +1039,8 @@ case 3: p = print_indexed (-1, p, addr, info); + if (p == NULL) + return -3; break; case 4: @@ -960,17 +1048,17 @@ switch (place) { case 'b': - val = NEXTBYTE (p); + NEXTBYTE (p, val); flt_p = 0; break; case 'w': - val = NEXTWORD (p); + NEXTWORD (p, val, -3); flt_p = 0; break; case 'l': - val = NEXTLONG (p); + NEXTLONG (p, val, -3); flt_p = 0; break; @@ -987,7 +1075,7 @@ break; case 'p': - flval = NEXTPACKED (p); + NEXTPACKED (p, flval); break; default: @@ -1009,7 +1097,7 @@ mask bit and if set, add a '&' to the arg. */ if (place == '/') { - val = fetch_arg (buffer, place, 1, info); + FETCH_ARG (1, val); if (val) info->fprintf_func (info->stream, "&"); } @@ -1021,7 +1109,7 @@ { char doneany; p1 = buffer + 2; - val = NEXTWORD (p1); + NEXTWORD (p1, val, -3); /* Move the pointer ahead if this point is farther ahead than the last. */ p = p1 > p ? p1 : p; @@ -1062,7 +1150,8 @@ { /* `fmovem' insn. */ char doneany; - val = fetch_arg (buffer, place, 8, info); + + FETCH_ARG (8, val); if (val == 0) { (*info->fprintf_func) (info->stream, "#0"); @@ -1096,10 +1185,9 @@ } else if (place == '8') { + FETCH_ARG (3, val); /* fmoveml for FP status registers. */ - (*info->fprintf_func) (info->stream, "%s", - fpcr_names[fetch_arg (buffer, place, 3, - info)]); + (*info->fprintf_func) (info->stream, "%s", fpcr_names[val]); } else return -2; @@ -1115,9 +1203,10 @@ case '2': case '3': { - int val = fetch_arg (buffer, place, 5, info); + int val; char *name = 0; + FETCH_ARG (5, val); switch (val) { case 2: name = "%tt0"; break; @@ -1152,8 +1241,9 @@ case 'f': { - int fc = fetch_arg (buffer, place, 5, info); + int fc; + FETCH_ARG (5, fc); if (fc == 1) (*info->fprintf_func) (info->stream, "%%dfc"); else if (fc == 0) @@ -1170,8 +1260,9 @@ case 't': { - int level = fetch_arg (buffer, place, 3, info); + int level; + FETCH_ARG (3, level); (*info->fprintf_func) (info->stream, "%d", level); } break; @@ -1179,8 +1270,9 @@ case 'u': { short is_upper = 0; - int reg = fetch_arg (buffer, place, 5, info); + int reg; + FETCH_ARG (5, reg); if (reg & 0x10) { is_upper = 1; @@ -1303,7 +1395,7 @@ if (eaten >= 0) p += eaten; - else if (eaten == -1) + else if (eaten == -1 || eaten == -3) { info->fprintf_func = save_printer; info->print_address_func = save_print_address; @@ -1318,7 +1410,7 @@ info->fprintf_func (info->stream, /* xgettext:c-format */ _("<internal error in opcode table: %s %s>\n"), - best->name, best->args); + best->name, best->args); return 2; } } @@ -1439,6 +1531,8 @@ if (d[0] == 's' && d[1] == '8') { val = fetch_arg (buffer, d[1], 3, info); + if (val < 0) + return 0; if ((val & (val - 1)) != 0) break; } @@ -1479,13 +1573,7 @@ bfd_byte *buffer = priv.the_buffer; - /* Save these printing functions in case we need to restore them - later. */ - fprintf_ftype save_printer = info->fprintf_func; - void (* save_print_address) (bfd_vma, struct disassemble_info *) - = info->print_address_func; - - info->private_data = (PTR) &priv; + info->private_data = & priv; /* Tell objdump to use two bytes per chunk and six bytes per line for displaying raw data. */ info->bytes_per_chunk = 2; @@ -1494,49 +1582,23 @@ priv.max_fetched = priv.the_buffer; priv.insn_start = memaddr; - if (setjmp (priv.bailout) != 0) - { - /* longjmp may be called while these printing functions are - temporarily replaced with dummy functions. Restore them - before we leave. - - Admittedly, this save-and-restore operation is somewhat ugly - in that we are exposing the fact that match_insn_m68k - temporarily replaces insn->fprintf_func and - insn->print_address_func. Perhaps, a real fix is to report a - FETCH_DATA failure with a return value of some sort, without - using setjmp/longjmp. A better fix may be to teach the m68k - disassembler do its job without temporarily replacing - insn->fprintf_func and insn->print_address_func, but that's a - task for another day. */ - info->fprintf_func = save_printer; - info->print_address_func = save_print_address; - - /* Error return. */ - return -1; - } - arch_mask = bfd_m68k_mach_to_features (info->mach); if (!arch_mask) { /* First try printing an m680x0 instruction. Try printing a Coldfire one if that fails. */ val = m68k_scan_mask (memaddr, info, m68k_mask); - if (val) - return val; - - val = m68k_scan_mask (memaddr, info, mcf_mask); - if (val) - return val; + if (val == 0) + val = m68k_scan_mask (memaddr, info, mcf_mask); } else { val = m68k_scan_mask (memaddr, info, arch_mask); - if (val) - return val; } - /* Handle undefined instructions. */ - info->fprintf_func (info->stream, "0%o", (buffer[0] << 8) + buffer[1]); - return 2; + if (val == 0) + /* Handle undefined instructions. */ + info->fprintf_func (info->stream, "0%o", (buffer[0] << 8) + buffer[1]); + + return val ? val : 2; } diff -Naur binutils-2.19.orig/opcodes/ppc-opc.c binutils-2.19/opcodes/ppc-opc.c
old new 1281 1281 1282 1282 /* mfsprg can use 260..263 and 272..279. mtsprg only uses spr 272..279 1283 1283 If not BOOKE or 405, then both use only 272..275. */ 1284 if ( val <= 31285 || (val < 0x10&& (insn & 0x100) != 0)1286 || (val - 0x10 >31287 && (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 1288 *invalid = 1; 1289 1289 return val & 7; 1290 1290 }
Note:
See TracBrowser
for help on using the repository browser.