source:
patches/binutils-2.19-branch_update-2.patch@
318408a
Last change on this file since 318408a was afebdc9, checked in by , 16 years ago | |
---|---|
|
|
File size: 43.0 KB |
-
bfd/ChangeLog
Submitted By: Jim Gifford (jim at linuxfromscratch dot org) Date: 12-30-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-12-23 Nick Clifton <nickc@redhat.com> 2 3 * Import this patch from the mainline: 4 2008-11-10 Andreas Schwab <schwab@suse.de> 5 6 PR 7011 7 * elf.c (assign_file_positions_for_non_load_sections): Handle 8 PT_GNU_RELRO specially. 9 10 2008-11-20 Alan Modra <amodra@bigpond.net.au> 11 12 * elf32-ppc.c (allocate_dynrelocs): Always use tlsld_got for 13 TLS_LD even when symbol is used with other TLS reloc types. 14 (ppc_elf_relocate_section): Bypass symbol checks when using tlsld_got. 15 Leave addend zero on LD DTPMOD dynamic reloc. 16 17 2008-11-17 Eric B. Weddington <eric.weddington@atmel.com> 18 19 PR 7022 20 * elf32-avr.c (bfd_elf_avr_final_write_processing): 21 Add missing break statements. 22 23 2008-10-28 Tristan Gingold <gingold@adacore.com> 24 25 * configure.in: Bump version to 2.19.0 26 * Makefile.am (RELEASE): Unset. 27 * configure, Makefile.in: Regenerated. 28 1 29 2008-10-16 Tristan Gingold <gingold@adacore.com> 2 30 3 31 * 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. -
binutils-2.19
diff -Naur binutils-2.19.orig/bfd/elf.c binutils-2.19/bfd/elf.c
old new 4606 4606 m != NULL; 4607 4607 m = m->next, p++) 4608 4608 { 4609 if (m->count != 0) 4609 if (p->p_type == PT_GNU_RELRO) 4610 { 4611 const Elf_Internal_Phdr *lp; 4612 4613 BFD_ASSERT (!m->includes_filehdr && !m->includes_phdrs); 4614 4615 if (link_info != NULL) 4616 { 4617 /* During linking the range of the RELRO segment is passed 4618 in link_info. */ 4619 for (lp = phdrs; lp < phdrs + count; ++lp) 4620 { 4621 if (lp->p_type == PT_LOAD 4622 && lp->p_vaddr >= link_info->relro_start 4623 && lp->p_vaddr < link_info->relro_end 4624 && lp->p_vaddr + lp->p_filesz >= link_info->relro_end) 4625 break; 4626 } 4627 } 4628 else 4629 { 4630 /* Otherwise we are copying an executable or shared 4631 library, but we need to use the same linker logic. */ 4632 for (lp = phdrs; lp < phdrs + count; ++lp) 4633 { 4634 if (lp->p_type == PT_LOAD 4635 && lp->p_paddr == p->p_paddr) 4636 break; 4637 } 4638 } 4639 4640 if (lp < phdrs + count) 4641 { 4642 p->p_vaddr = lp->p_vaddr; 4643 p->p_paddr = lp->p_paddr; 4644 p->p_offset = lp->p_offset; 4645 if (link_info != NULL) 4646 p->p_filesz = link_info->relro_end - lp->p_vaddr; 4647 else if (m->p_size_valid) 4648 p->p_filesz = m->p_size; 4649 else 4650 abort (); 4651 p->p_memsz = p->p_filesz; 4652 p->p_align = 1; 4653 p->p_flags = (lp->p_flags & ~PF_W); 4654 } 4655 else if (link_info != NULL) 4656 { 4657 memset (p, 0, sizeof *p); 4658 p->p_type = PT_NULL; 4659 } 4660 else 4661 abort (); 4662 } 4663 else if (m->count != 0) 4610 4664 { 4611 4665 if (p->p_type != PT_LOAD 4612 4666 && (p->p_type != PT_NOTE … … 4622 4676 p->p_filesz = sect->filepos - m->sections[0]->filepos; 4623 4677 if (hdr->sh_type != SHT_NOBITS) 4624 4678 p->p_filesz += hdr->sh_size; 4625 4626 if (p->p_type == PT_GNU_RELRO) 4627 { 4628 /* When we get here, we are copying executable 4629 or shared library. But we need to use the same 4630 linker logic. */ 4631 Elf_Internal_Phdr *lp; 4632 4633 for (lp = phdrs; lp < phdrs + count; ++lp) 4634 { 4635 if (lp->p_type == PT_LOAD 4636 && lp->p_paddr == p->p_paddr) 4637 break; 4638 } 4639 4640 if (lp < phdrs + count) 4641 { 4642 /* We should use p_size if it is valid since it 4643 may contain the first few bytes of the next 4644 SEC_ALLOC section. */ 4645 if (m->p_size_valid) 4646 p->p_filesz = m->p_size; 4647 else 4648 abort (); 4649 p->p_vaddr = lp->p_vaddr; 4650 p->p_offset = lp->p_offset; 4651 p->p_memsz = p->p_filesz; 4652 p->p_align = 1; 4653 } 4654 else 4655 abort (); 4656 } 4657 else 4658 p->p_offset = m->sections[0]->filepos; 4679 p->p_offset = m->sections[0]->filepos; 4659 4680 } 4660 4681 } 4661 else 4682 else if (m->includes_filehdr) 4662 4683 { 4663 if (m->includes_filehdr) 4664 { 4665 p->p_vaddr = filehdr_vaddr; 4666 if (! m->p_paddr_valid) 4667 p->p_paddr = filehdr_paddr; 4668 } 4669 else if (m->includes_phdrs) 4670 { 4671 p->p_vaddr = phdrs_vaddr; 4672 if (! m->p_paddr_valid) 4673 p->p_paddr = phdrs_paddr; 4674 } 4675 else if (p->p_type == PT_GNU_RELRO) 4676 { 4677 Elf_Internal_Phdr *lp; 4678 4679 for (lp = phdrs; lp < phdrs + count; ++lp) 4680 { 4681 if (lp->p_type == PT_LOAD 4682 && lp->p_vaddr <= link_info->relro_end 4683 && lp->p_vaddr >= link_info->relro_start 4684 && (lp->p_vaddr + lp->p_filesz 4685 >= link_info->relro_end)) 4686 break; 4687 } 4688 4689 if (lp < phdrs + count 4690 && link_info->relro_end > lp->p_vaddr) 4691 { 4692 p->p_vaddr = lp->p_vaddr; 4693 p->p_paddr = lp->p_paddr; 4694 p->p_offset = lp->p_offset; 4695 p->p_filesz = link_info->relro_end - lp->p_vaddr; 4696 p->p_memsz = p->p_filesz; 4697 p->p_align = 1; 4698 p->p_flags = (lp->p_flags & ~PF_W); 4699 } 4700 else 4701 { 4702 memset (p, 0, sizeof *p); 4703 p->p_type = PT_NULL; 4704 } 4705 } 4684 p->p_vaddr = filehdr_vaddr; 4685 if (! m->p_paddr_valid) 4686 p->p_paddr = filehdr_paddr; 4687 } 4688 else if (m->includes_phdrs) 4689 { 4690 p->p_vaddr = phdrs_vaddr; 4691 if (! m->p_paddr_valid) 4692 p->p_paddr = phdrs_paddr; 4706 4693 } 4707 4694 } 4708 4695 -
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 20081231 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-23 Nick Clifton <nickc@redhat.com> 2 3 * windmc.c (main): Use correct type for file length. 4 * dlltool.c (gen_exp_file): Likewise. 5 6 2008-12-01 Nick Clifton <nickc@redhat.com> 7 8 PR 7044 9 * dlltool.c (run): Use formatting string to avoid compile time 10 warning. 11 (gen_exp_file): Check return value from fread. 12 * windmc.c (main): Check return value from fread. 13 1 14 2008-09-25 Richard Henderson <rth@redhat.com> 2 15 3 16 * 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 } … … 1980 1980 int addr; 1981 1981 long need[PAGE_SIZE]; 1982 1982 long page_addr; 1983 intnumbytes;1983 bfd_size_type numbytes; 1984 1984 int num_entries; 1985 1985 long *copy; 1986 1986 int j; … … 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 1144 1144 unichar *u; 1145 1145 rc_uint_type ul; 1146 1146 char *buff; 1147 longflen;1147 bfd_size_type flen; 1148 1148 FILE *fp = fopen (input_filename, "rb"); 1149 1149 1150 1150 if (!fp) … … 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-12-23 Tristan Gingold <gingold@adacore.com> 2 3 * Makefile.am (EXTRA_DIST): Add deffilep.c and deffilep.h 4 * Makefile.in: Regenerate. 5 6 2008-11-14 Alan Modra <amodra@bigpond.net.au> 7 8 * Makefile.am (spu_ovl.o_c): Add missing line continuations. 9 * Makefile.in: Regenerate. 10 1 11 2008-10-05 Alan Modra <amodra@bigpond.net.au> 2 12 3 13 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} … … 1914 1914 1915 1915 # Stuff that should be included in a distribution. The diststuff 1916 1916 # target is run by the taz target in ../Makefile.in. 1917 EXTRA_DIST = ldgram.c ldgram.h ldlex.c emultempl/spu_ovl.o_c $(man_MANS) 1917 EXTRA_DIST = ldgram.c ldgram.h ldlex.c emultempl/spu_ovl.o_c \ 1918 deffilep.c deffilep.h $(man_MANS) 1918 1919 diststuff: info $(EXTRA_DIST) 1919 1920 all: info ld.1 1920 1921 -
ld/Makefile.in
diff -Naur binutils-2.19.orig/ld/Makefile.in binutils-2.19/ld/Makefile.in
old new 730 730 731 731 # Stuff that should be included in a distribution. The diststuff 732 732 # target is run by the taz target in ../Makefile.in. 733 EXTRA_DIST = ldgram.c ldgram.h ldlex.c emultempl/spu_ovl.o_c $(man_MANS) 733 EXTRA_DIST = ldgram.c ldgram.h ldlex.c emultempl/spu_ovl.o_c \ 734 deffilep.c deffilep.h $(man_MANS) 735 734 736 DISTCLEANFILES = tdirs site.exp site.bak stringify.sed $(am__append_1) 735 737 all: config.h 736 738 $(MAKE) $(AM_MAKEFLAGS) all-recursive … … 1588 1590 $(srcdir)/emultempl/spu_ovl.o_c: @MAINT@ $(srcdir)/emultempl/spu_ovl.S 1589 1591 if ../gas/as-new --version \ 1590 1592 | grep 'target.*spu' >/dev/null 2>/dev/null; then \ 1591 cpp -DOVLY_IRQ_SAVE $(srcdir)/emultempl/spu_ovl.S spu_ovl.s 1593 cpp -DOVLY_IRQ_SAVE $(srcdir)/emultempl/spu_ovl.S spu_ovl.s; \ 1592 1594 ../gas/as-new -o spu_ovl.o spu_ovl.s; \ 1593 ../binutils/bin2c <spu_ovl.o >$@ 1595 ../binutils/bin2c <spu_ovl.o >$@; \ 1594 1596 fi 1595 1597 eelf32_i860.c: $(srcdir)/emulparams/elf32_i860.sh \ 1596 1598 $(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.