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

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

Update Binutils to -2 Patch

  • Property mode set to 100644
File size: 43.0 KB
  • 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  
     12008-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
     102008-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
     172008-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
     232008-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
    1292008-10-16  Tristan Gingold  <gingold@adacore.com>
    230
    331        * 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  
    271271ACLOCAL_AMFLAGS = -I . -I .. -I ../config
    272272
    273273# Uncomment the following line when doing a release.
    274 RELEASE = y
     274RELEASE=y
    275275INCDIR = $(srcdir)/../include
    276276CSEARCH = -I. -I$(srcdir) -I$(INCDIR)
    277277MKDEP = gcc -MM
  • bfd/configure

    diff -Naur binutils-2.19.orig/bfd/configure binutils-2.19/bfd/configure
    old new  
    30323032
    30333033# Define the identity of the package.
    30343034 PACKAGE=bfd
    3035  VERSION=2.19
     3035 VERSION=2.19.0
    30363036
    30373037
    30383038cat >>confdefs.h <<_ACEOF
  • bfd/configure.in

    diff -Naur binutils-2.19.orig/bfd/configure.in binutils-2.19/bfd/configure.in
    old new  
    88AC_CANONICAL_TARGET
    99AC_ISC_POSIX
    1010
    11 AM_INIT_AUTOMAKE(bfd, 2.19)
     11AM_INIT_AUTOMAKE(bfd, 2.19.0)
    1212
    1313dnl These must be called before LT_INIT, because it may want
    1414dnl 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  
    46064606       m != NULL;
    46074607       m = m->next, p++)
    46084608    {
    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)
    46104664        {
    46114665          if (p->p_type != PT_LOAD
    46124666              && (p->p_type != PT_NOTE
     
    46224676              p->p_filesz = sect->filepos - m->sections[0]->filepos;
    46234677              if (hdr->sh_type != SHT_NOBITS)
    46244678                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;
    46594680            }
    46604681        }
    4661       else
     4682      else if (m->includes_filehdr)
    46624683        {
    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;
    47064693        }
    47074694    }
    47084695
  • bfd/elf32-avr.c

    diff -Naur binutils-2.19.orig/bfd/elf32-avr.c binutils-2.19/bfd/elf32-avr.c
    old new  
    12981298
    12991299    case bfd_mach_avr25:
    13001300      val = E_AVR_MACH_AVR25;
     1301      break;
    13011302
    13021303    case bfd_mach_avr3:
    13031304      val = E_AVR_MACH_AVR3;
     
    13051306
    13061307    case bfd_mach_avr31:
    13071308      val = E_AVR_MACH_AVR31;
     1309      break;
    13081310
    13091311    case bfd_mach_avr35:
    13101312      val = E_AVR_MACH_AVR35;
     1313      break;
    13111314
    13121315    case bfd_mach_avr4:
    13131316      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  
    49974997  eh = (struct ppc_elf_link_hash_entry *) h;
    49984998  if (eh->elf.got.refcount > 0)
    49994999    {
     5000      bfd_boolean dyn;
     5001      unsigned int need;
     5002
    50005003      /* Make sure this symbol is output as a dynamic symbol.  */
    50015004      if (eh->elf.dynindx == -1
    50025005          && !eh->elf.forced_local
     
    50065009            return FALSE;
    50075010        }
    50085011
    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)
    50175014        {
    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)
    50215016            {
    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
    50255023                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;
    50305024            }
    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)
    50325030            need += 4;
     5031        }
     5032      else
     5033        need += 4;
     5034      if (need == 0)
     5035        eh->elf.got.offset = (bfd_vma) -1;
     5036      else
     5037        {
    50335038          eh->elf.got.offset = allocate_got (htab, need);
    50345039          dyn = htab->elf.dynamic_sections_created;
    50355040          if ((info->shared
     
    50395044            {
    50405045              /* All the entries we allocated need relocs.
    50415046                 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)
    50435049                need -= 4;
    50445050              htab->relgot->size += need * (sizeof (Elf32_External_Rela) / 4);
    50455051            }
     
    52755281      for (; local_got < end_local_got; ++local_got, ++lgot_masks)
    52765282        if (*local_got > 0)
    52775283          {
    5278             if (*lgot_masks == (TLS_TLS | TLS_LD))
     5284            unsigned int need = 0;
     5285            if ((*lgot_masks & TLS_TLS) != 0)
    52795286              {
    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;
    52845295              }
    52855296            else
     5297              need += 4;
     5298            if (need == 0)
     5299              *local_got = (bfd_vma) -1;
     5300            else
    52865301              {
    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                 else
    5298                   need += 4;
    52995302                *local_got = allocate_got (htab, need);
    53005303                if (info->shared)
    53015304                  htab->relgot->size += (need
     
    65606563
    65616564                    /* Generate relocs for the dynamic linker.  */
    65626565                    if ((info->shared || indx != 0)
    6563                         && (h == NULL
     6566                        && (offp == &htab->tlsld_got.offset
     6567                            || h == NULL
    65646568                            || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
    65656569                            || h->root.type != bfd_link_hash_undefweak))
    65666570                      {
     
    65916595                          outrel.r_info = ELF32_R_INFO (indx, R_PPC_RELATIVE);
    65926596                        else
    65936597                          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))
    65956599                          {
    65966600                            outrel.r_addend += relocation;
    65976601                            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 20081016
     1#define BFD_VERSION_DATE 20081231
    22#define BFD_VERSION @bfd_version@
    33#define BFD_VERSION_STRING  @bfd_version_package@ @bfd_version_string@
    44#define REPORT_BUGS_TO @report_bugs_to@
  • binutils/ChangeLog

    diff -Naur binutils-2.19.orig/binutils/ChangeLog binutils-2.19/binutils/ChangeLog
    old new  
     12008-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
     62008-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
    1142008-09-25  Richard Henderson  <rth@redhat.com>
    215
    316        * 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  
    12061206
    12071207  if (pid == -1)
    12081208    {
    1209       inform (strerror (errno));
     1209      inform ("%s", strerror (errno));
    12101210
    12111211      fatal (errmsg_fmt, errmsg_arg);
    12121212    }
     
    19801980      int addr;
    19811981      long need[PAGE_SIZE];
    19821982      long page_addr;
    1983       int numbytes;
     1983      bfd_size_type numbytes;
    19841984      int num_entries;
    19851985      long *copy;
    19861986      int j;
     
    19921992      numbytes = ftell (base_file);
    19931993      fseek (base_file, 0, SEEK_SET);
    19941994      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"));
    19961997      num_entries = numbytes / sizeof (long);
    19971998
    1998 
    19991999      fprintf (f, "\t.section\t.reloc\n");
    20002000      if (num_entries)
    20012001        {
  • binutils/windmc.c

    diff -Naur binutils-2.19.orig/binutils/windmc.c binutils-2.19/binutils/windmc.c
    old new  
    11441144    unichar *u;
    11451145    rc_uint_type ul;
    11461146    char *buff;
    1147     long flen;
     1147    bfd_size_type flen;
    11481148    FILE *fp = fopen (input_filename, "rb");
    11491149
    11501150    if (!fp)
     
    11551155    fseek (fp, 0, SEEK_SET);
    11561156    buff = malloc (flen + 3);
    11571157    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);
    11591160    fclose (fp);
    11601161    if (mcset_text_in_is_unicode != 1)
    11611162      {
  • configure.ac

    diff -Naur binutils-2.19.orig/configure.ac binutils-2.19/configure.ac
    old new  
    166166# binutils, gas and ld appear in that order because it makes sense to run
    167167# "make check" in that particular order.
    168168# 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"
     169host_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"
    170170
    171171# libgcj represents the runtime libraries only used by gcj.
    172172libgcj="target-libffi \
  • ld/ChangeLog

    diff -Naur binutils-2.19.orig/ld/ChangeLog binutils-2.19/ld/ChangeLog
    old new  
     12008-12-23  Tristan Gingold  <gingold@adacore.com>
     2
     3        * Makefile.am (EXTRA_DIST): Add deffilep.c and deffilep.h
     4        * Makefile.in: Regenerate.
     5
     62008-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
    1112008-10-05  Alan Modra  <amodra@bigpond.net.au>
    212
    313        PR 6943
  • ld/Makefile.am

    diff -Naur binutils-2.19.orig/ld/Makefile.am binutils-2.19/ld/Makefile.am
    old new  
    758758$(srcdir)/emultempl/spu_ovl.o_c: @MAINT@ $(srcdir)/emultempl/spu_ovl.S
    759759        if ../gas/as-new --version \
    760760                | 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; \
    762762          ../gas/as-new -o spu_ovl.o spu_ovl.s; \
    763           ../binutils/bin2c <spu_ovl.o >$@
     763          ../binutils/bin2c <spu_ovl.o >$@; \
    764764        fi
    765765eelf32_i860.c: $(srcdir)/emulparams/elf32_i860.sh \
    766766  $(ELF_GEN_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
     
    19141914
    19151915# Stuff that should be included in a distribution.  The diststuff
    19161916# 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)
     1917EXTRA_DIST = ldgram.c ldgram.h ldlex.c emultempl/spu_ovl.o_c \
     1918           deffilep.c deffilep.h $(man_MANS)
    19181919diststuff: info $(EXTRA_DIST)
    19191920all: info ld.1
    19201921
  • ld/Makefile.in

    diff -Naur binutils-2.19.orig/ld/Makefile.in binutils-2.19/ld/Makefile.in
    old new  
    730730
    731731# Stuff that should be included in a distribution.  The diststuff
    732732# 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)
     733EXTRA_DIST = ldgram.c ldgram.h ldlex.c emultempl/spu_ovl.o_c \
     734           deffilep.c deffilep.h $(man_MANS)
     735
    734736DISTCLEANFILES = tdirs site.exp site.bak stringify.sed $(am__append_1)
    735737all: config.h
    736738        $(MAKE) $(AM_MAKEFLAGS) all-recursive
     
    15881590$(srcdir)/emultempl/spu_ovl.o_c: @MAINT@ $(srcdir)/emultempl/spu_ovl.S
    15891591        if ../gas/as-new --version \
    15901592                | 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; \
    15921594          ../gas/as-new -o spu_ovl.o spu_ovl.s; \
    1593           ../binutils/bin2c <spu_ovl.o >$@
     1595          ../binutils/bin2c <spu_ovl.o >$@; \
    15941596        fi
    15951597eelf32_i860.c: $(srcdir)/emulparams/elf32_i860.sh \
    15961598  $(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  
     12008-11-27  Alan Modra  <amodra@bigpond.net.au>
     2
     3        * ppc-opc.c (extract_sprg): Correct operand range check.
     4
     52008-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
     142008-11-25  Nick Clifton  <nickc@redhat.com>
     15
     16        * m68k-dis.c: Rewrite to remove use of setjmp/longjmp.
     17
    1182008-09-29  Nick Clifton  <nickc@redhat.com>
    219
    320        * 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  
    6060#endif
    6161
    6262/* 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)
    6472
    6573/* Get a 2 byte signed integer.  */
    6674#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)                                             
    7085
    7186/* Get a 4 byte signed integer.  */
    7287#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)
    7698
    7799/* 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)
    81109
    82110/* 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)
    86121
    87122/* 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)
    91133
    92134/* 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)
    96145
    97146/* Need a function to convert from packed to double
    98147   precision.   Actually, it's easier to print a
    99148   packed number than a double anyway, so maybe
    100149   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
    103160
    104161
    105162/* 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  
    12811281
    12821282  /* mfsprg can use 260..263 and 272..279.  mtsprg only uses spr 272..279
    12831283     If not BOOKE or 405, then both use only 272..275.  */
    1284   if (val <= 3
    1285       || (val < 0x10 && (insn & 0x100) != 0)
    1286       || (val - 0x10 > 3
    1287           && (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)
    12881288    *invalid = 1;
    12891289  return val & 7;
    12901290}
Note: See TracBrowser for help on using the repository browser.