View | Details | Raw Unified | Return to bug 15835 | Differences between
and this patch

Collapse All | Expand All

(-)a/bfd/elf-bfd.h (-3 / +11 lines)
Lines 1575-1580 struct output_elf_obj_tdata Link Here
1575
  bfd_boolean flags_init;
1575
  bfd_boolean flags_init;
1576
};
1576
};
1577
1577
1578
typedef struct elf_section_list
1579
{
1580
  Elf_Internal_Shdr          hdr;
1581
  unsigned int               ndx;
1582
  struct elf_section_list *  next;
1583
} elf_section_list;
1584
  
1585
    
1578
/* Some private data is stashed away for future use using the tdata pointer
1586
/* Some private data is stashed away for future use using the tdata pointer
1579
   in the bfd structure.  */
1587
   in the bfd structure.  */
1580
1588
Lines 1591-1597 struct elf_obj_tdata Link Here
1591
  Elf_Internal_Shdr dynversym_hdr;
1599
  Elf_Internal_Shdr dynversym_hdr;
1592
  Elf_Internal_Shdr dynverref_hdr;
1600
  Elf_Internal_Shdr dynverref_hdr;
1593
  Elf_Internal_Shdr dynverdef_hdr;
1601
  Elf_Internal_Shdr dynverdef_hdr;
1594
  Elf_Internal_Shdr symtab_shndx_hdr;
1602
  elf_section_list * symtab_shndx_list;
1595
  bfd_vma gp;				/* The gp value */
1603
  bfd_vma gp;				/* The gp value */
1596
  unsigned int gp_size;			/* The gp size */
1604
  unsigned int gp_size;			/* The gp size */
1597
  unsigned int num_elf_sections;	/* elf_sect_ptr size */
1605
  unsigned int num_elf_sections;	/* elf_sect_ptr size */
Lines 1669-1675 struct elf_obj_tdata Link Here
1669
  Elf_Internal_Shdr **group_sect_ptr;
1677
  Elf_Internal_Shdr **group_sect_ptr;
1670
  int num_group;
1678
  int num_group;
1671
1679
1672
  unsigned int symtab_section, symtab_shndx_section, dynsymtab_section;
1680
  unsigned int symtab_section, dynsymtab_section;
1673
  unsigned int dynversym_section, dynverdef_section, dynverref_section;
1681
  unsigned int dynversym_section, dynverdef_section, dynverref_section;
1674
1682
1675
  /* An identifier used to distinguish different target
1683
  /* An identifier used to distinguish different target
Lines 1714-1720 struct elf_obj_tdata Link Here
1714
#define elf_stack_flags(bfd)	(elf_tdata(bfd) -> o->stack_flags)
1722
#define elf_stack_flags(bfd)	(elf_tdata(bfd) -> o->stack_flags)
1715
#define elf_shstrtab(bfd)	(elf_tdata(bfd) -> o->strtab_ptr)
1723
#define elf_shstrtab(bfd)	(elf_tdata(bfd) -> o->strtab_ptr)
1716
#define elf_onesymtab(bfd)	(elf_tdata(bfd) -> symtab_section)
1724
#define elf_onesymtab(bfd)	(elf_tdata(bfd) -> symtab_section)
1717
#define elf_symtab_shndx(bfd)	(elf_tdata(bfd) -> symtab_shndx_section)
1725
#define elf_symtab_shndx_list(bfd)	(elf_tdata(bfd) -> symtab_shndx_list)
1718
#define elf_strtab_sec(bfd)	(elf_tdata(bfd) -> o->strtab_section)
1726
#define elf_strtab_sec(bfd)	(elf_tdata(bfd) -> o->strtab_section)
1719
#define elf_shstrtab_sec(bfd)	(elf_tdata(bfd) -> o->shstrtab_section)
1727
#define elf_shstrtab_sec(bfd)	(elf_tdata(bfd) -> o->shstrtab_section)
1720
#define elf_symtab_hdr(bfd)	(elf_tdata(bfd) -> symtab_hdr)
1728
#define elf_symtab_hdr(bfd)	(elf_tdata(bfd) -> symtab_hdr)
(-)a/bfd/elf.c (-55 / +122 lines)
Lines 400-407 bfd_elf_get_elf_syms (bfd *ibfd, Link Here
400
400
401
  /* Normal syms might have section extension entries.  */
401
  /* Normal syms might have section extension entries.  */
402
  shndx_hdr = NULL;
402
  shndx_hdr = NULL;
403
  if (symtab_hdr == &elf_tdata (ibfd)->symtab_hdr)
403
  if (elf_symtab_shndx_list (ibfd) != NULL)
404
    shndx_hdr = &elf_tdata (ibfd)->symtab_shndx_hdr;
404
    {
405
      elf_section_list * entry;
406
      Elf_Internal_Shdr **sections = elf_elfsections (ibfd);
407
408
      /* Find an index section that is linked to this symtab section.  */
409
      for (entry = elf_symtab_shndx_list (ibfd); entry != NULL; entry = entry->next)
410
	if (sections[entry->hdr.sh_link] == symtab_hdr)
411
	  {
412
	    shndx_hdr = & entry->hdr;
413
	    break;
414
	  };
415
416
      if (shndx_hdr == NULL)
417
	{
418
	  if (symtab_hdr == & elf_symtab_hdr (ibfd))
419
	    /* Not really accurate, but this was how the old code used to work.  */
420
	    shndx_hdr = & elf_symtab_shndx_list (ibfd)->hdr;
421
	  /* Otherwise we do nothing.  The assumption is that
422
	     the index table will not be needed.  */
423
	}
424
    }
405
425
406
  /* Read the symbols.  */
426
  /* Read the symbols.  */
407
  alloc_ext = NULL;
427
  alloc_ext = NULL;
Lines 1730-1737 bfd_section_from_shdr (bfd *abfd, unsigned int shindex) Link Here
1730
1750
1731
      BFD_ASSERT (elf_onesymtab (abfd) == 0);
1751
      BFD_ASSERT (elf_onesymtab (abfd) == 0);
1732
      elf_onesymtab (abfd) = shindex;
1752
      elf_onesymtab (abfd) = shindex;
1733
      elf_tdata (abfd)->symtab_hdr = *hdr;
1753
      elf_symtab_hdr (abfd) = *hdr;
1734
      elf_elfsections (abfd)[shindex] = hdr = &elf_tdata (abfd)->symtab_hdr;
1754
      elf_elfsections (abfd)[shindex] = hdr = & elf_symtab_hdr (abfd);
1735
      abfd->flags |= HAS_SYMS;
1755
      abfd->flags |= HAS_SYMS;
1736
1756
1737
      /* Sometimes a shared object will map in the symbol table.  If
1757
      /* Sometimes a shared object will map in the symbol table.  If
Lines 1749-1778 bfd_section_from_shdr (bfd *abfd, unsigned int shindex) Link Here
1749
      /* Go looking for SHT_SYMTAB_SHNDX too, since if there is one we
1769
      /* Go looking for SHT_SYMTAB_SHNDX too, since if there is one we
1750
	 can't read symbols without that section loaded as well.  It
1770
	 can't read symbols without that section loaded as well.  It
1751
	 is most likely specified by the next section header.  */
1771
	 is most likely specified by the next section header.  */
1752
      if (elf_elfsections (abfd)[elf_symtab_shndx (abfd)]->sh_link != shindex)
1772
      {
1753
	{
1773
	elf_section_list * entry;
1754
	  unsigned int i, num_sec;
1774
	unsigned int i, num_sec;
1755
1775
1756
	  num_sec = elf_numsections (abfd);
1776
	for (entry = elf_symtab_shndx_list (abfd); entry != NULL; entry = entry->next)
1757
	  for (i = shindex + 1; i < num_sec; i++)
1777
	  if (entry->hdr.sh_link == shindex)
1778
	    goto success;
1779
1780
	num_sec = elf_numsections (abfd);
1781
	for (i = shindex + 1; i < num_sec; i++)
1782
	  {
1783
	    Elf_Internal_Shdr *hdr2 = elf_elfsections (abfd)[i];
1784
1785
	    if (hdr2->sh_type == SHT_SYMTAB_SHNDX
1786
		&& hdr2->sh_link == shindex)
1787
	      break;
1788
	  }
1789
1790
	if (i == num_sec)
1791
	  for (i = 1; i < shindex; i++)
1758
	    {
1792
	    {
1759
	      Elf_Internal_Shdr *hdr2 = elf_elfsections (abfd)[i];
1793
	      Elf_Internal_Shdr *hdr2 = elf_elfsections (abfd)[i];
1794
1760
	      if (hdr2->sh_type == SHT_SYMTAB_SHNDX
1795
	      if (hdr2->sh_type == SHT_SYMTAB_SHNDX
1761
		  && hdr2->sh_link == shindex)
1796
		  && hdr2->sh_link == shindex)
1762
		break;
1797
		break;
1763
	    }
1798
	    }
1764
	  if (i == num_sec)
1799
1765
	    for (i = 1; i < shindex; i++)
1800
	if (i != shindex)
1766
	      {
1801
	  ret = bfd_section_from_shdr (abfd, i);
1767
		Elf_Internal_Shdr *hdr2 = elf_elfsections (abfd)[i];
1802
	/* else FIXME: we have failed to find the symbol table - should we issue an error ? */
1768
		if (hdr2->sh_type == SHT_SYMTAB_SHNDX
1803
	goto success;
1769
		    && hdr2->sh_link == shindex)
1804
      }
1770
		  break;
1771
	      }
1772
	  if (i != shindex)
1773
	    ret = bfd_section_from_shdr (abfd, i);
1774
	}
1775
      goto success;
1776
1805
1777
    case SHT_DYNSYM:		/* A dynamic symbol table.  */
1806
    case SHT_DYNSYM:		/* A dynamic symbol table.  */
1778
      if (elf_dynsymtab (abfd) == shindex)
1807
      if (elf_dynsymtab (abfd) == shindex)
Lines 1805-1818 bfd_section_from_shdr (bfd *abfd, unsigned int shindex) Link Here
1805
      goto success;
1834
      goto success;
1806
1835
1807
    case SHT_SYMTAB_SHNDX:	/* Symbol section indices when >64k sections.  */
1836
    case SHT_SYMTAB_SHNDX:	/* Symbol section indices when >64k sections.  */
1808
      if (elf_symtab_shndx (abfd) == shindex)
1837
      {
1809
	goto success;
1838
	elf_section_list * entry;
1810
1839
1811
      BFD_ASSERT (elf_symtab_shndx (abfd) == 0);
1840
	for (entry = elf_symtab_shndx_list (abfd); entry != NULL; entry = entry->next)
1812
      elf_symtab_shndx (abfd) = shindex;
1841
	  if (entry->ndx == shindex)
1813
      elf_tdata (abfd)->symtab_shndx_hdr = *hdr;
1842
	    goto success;
1814
      elf_elfsections (abfd)[shindex] = &elf_tdata (abfd)->symtab_shndx_hdr;
1843
	
1815
      goto success;
1844
	entry = bfd_alloc (abfd, sizeof * entry);
1845
	if (entry == NULL)
1846
	  goto fail;
1847
	entry->ndx = shindex;
1848
	entry->hdr = * hdr;
1849
	entry->next = elf_symtab_shndx_list (abfd);
1850
	elf_symtab_shndx_list (abfd) = entry;
1851
	elf_elfsections (abfd)[shindex] = & entry->hdr;
1852
	goto success;
1853
      }
1816
1854
1817
    case SHT_STRTAB:		/* A string table.  */
1855
    case SHT_STRTAB:		/* A string table.  */
1818
      if (hdr->bfd_section != NULL)
1856
      if (hdr->bfd_section != NULL)
Lines 3128-3138 assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info) Link Here
3128
      _bfd_elf_strtab_addref (elf_shstrtab (abfd), t->symtab_hdr.sh_name);
3166
      _bfd_elf_strtab_addref (elf_shstrtab (abfd), t->symtab_hdr.sh_name);
3129
      if (section_number > ((SHN_LORESERVE - 2) & 0xFFFF))
3167
      if (section_number > ((SHN_LORESERVE - 2) & 0xFFFF))
3130
	{
3168
	{
3131
	  elf_symtab_shndx (abfd) = section_number++;
3169
	  elf_section_list * entry;
3132
	  t->symtab_shndx_hdr.sh_name
3170
3171
	  BFD_ASSERT (elf_symtab_shndx_list (abfd) == NULL);
3172
3173
	  entry = bfd_zalloc (abfd, sizeof * entry);
3174
	  entry->ndx = section_number++;
3175
	  elf_symtab_shndx_list (abfd) = entry;
3176
	  entry->hdr.sh_name
3133
	    = (unsigned int) _bfd_elf_strtab_add (elf_shstrtab (abfd),
3177
	    = (unsigned int) _bfd_elf_strtab_add (elf_shstrtab (abfd),
3134
						  ".symtab_shndx", FALSE);
3178
						  ".symtab_shndx", FALSE);
3135
	  if (t->symtab_shndx_hdr.sh_name == (unsigned int) -1)
3179
	  if (entry->hdr.sh_name == (unsigned int) -1)
3136
	    return FALSE;
3180
	    return FALSE;
3137
	}
3181
	}
3138
      elf_strtab_sec (abfd) = section_number++;
3182
      elf_strtab_sec (abfd) = section_number++;
Lines 3175-3182 assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info) Link Here
3175
      i_shdrp[elf_onesymtab (abfd)] = &t->symtab_hdr;
3219
      i_shdrp[elf_onesymtab (abfd)] = &t->symtab_hdr;
3176
      if (elf_numsections (abfd) > (SHN_LORESERVE & 0xFFFF))
3220
      if (elf_numsections (abfd) > (SHN_LORESERVE & 0xFFFF))
3177
	{
3221
	{
3178
	  i_shdrp[elf_symtab_shndx (abfd)] = &t->symtab_shndx_hdr;
3222
	  elf_section_list * entry = elf_symtab_shndx_list (abfd);
3179
	  t->symtab_shndx_hdr.sh_link = elf_onesymtab (abfd);
3223
	  BFD_ASSERT (entry != NULL);
3224
	  i_shdrp[entry->ndx] = & entry->hdr;
3225
	  entry->hdr.sh_link = elf_onesymtab (abfd);
3180
	}
3226
	}
3181
      i_shdrp[elf_strtab_sec (abfd)] = &t->strtab_hdr;
3227
      i_shdrp[elf_strtab_sec (abfd)] = &t->strtab_hdr;
3182
      t->symtab_hdr.sh_link = elf_strtab_sec (abfd);
3228
      t->symtab_hdr.sh_link = elf_strtab_sec (abfd);
Lines 3646-3657 _bfd_elf_compute_section_file_positions (bfd *abfd, Link Here
3646
3692
3647
      off = elf_next_file_pos (abfd);
3693
      off = elf_next_file_pos (abfd);
3648
3694
3649
      hdr = &elf_tdata (abfd)->symtab_hdr;
3695
      hdr = & elf_symtab_hdr (abfd);
3650
      off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE);
3696
      off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE);
3651
3697
3652
      hdr = &elf_tdata (abfd)->symtab_shndx_hdr;
3698
      if (elf_symtab_shndx_list (abfd) != NULL)
3653
      if (hdr->sh_size != 0)
3699
	{
3654
	off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE);
3700
	  hdr = & elf_symtab_shndx_list (abfd)->hdr;
3701
	  if (hdr->sh_size != 0)
3702
	    off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE);
3703
	  /* FIXME: What about other symtab_shndx sections in the list ?  */
3704
	}
3655
3705
3656
      hdr = &elf_tdata (abfd)->strtab_hdr;
3706
      hdr = &elf_tdata (abfd)->strtab_hdr;
3657
      off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE);
3707
      off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE);
Lines 5041-5047 assign_file_positions_for_non_load_sections (bfd *abfd, Link Here
5041
      else if (((hdr->sh_type == SHT_REL || hdr->sh_type == SHT_RELA)
5091
      else if (((hdr->sh_type == SHT_REL || hdr->sh_type == SHT_RELA)
5042
		&& hdr->bfd_section == NULL)
5092
		&& hdr->bfd_section == NULL)
5043
	       || hdr == i_shdrpp[elf_onesymtab (abfd)]
5093
	       || hdr == i_shdrpp[elf_onesymtab (abfd)]
5044
	       || hdr == i_shdrpp[elf_symtab_shndx (abfd)]
5094
	       || (elf_symtab_shndx_list (abfd) != NULL
5095
		   && hdr == i_shdrpp[elf_symtab_shndx_list (abfd)->ndx])
5045
	       || hdr == i_shdrpp[elf_strtab_sec (abfd)])
5096
	       || hdr == i_shdrpp[elf_strtab_sec (abfd)])
5046
	hdr->sh_offset = -1;
5097
	hdr->sh_offset = -1;
5047
      else
5098
      else
Lines 5245-5250 assign_file_positions_for_non_load_sections (bfd *abfd, Link Here
5245
  return TRUE;
5296
  return TRUE;
5246
}
5297
}
5247
5298
5299
static elf_section_list *
5300
find_section_in_list (unsigned int i, elf_section_list * list)
5301
{
5302
  for (;list != NULL; list = list->next)
5303
    if (list->ndx == i)
5304
      break;
5305
  return list;
5306
}
5307
5248
/* Work out the file positions of all the sections.  This is called by
5308
/* Work out the file positions of all the sections.  This is called by
5249
   _bfd_elf_compute_section_file_positions.  All the section sizes and
5309
   _bfd_elf_compute_section_file_positions.  All the section sizes and
5250
   VMAs must be known before this is called.
5310
   VMAs must be known before this is called.
Lines 5290-5296 assign_file_positions_except_relocs (bfd *abfd, Link Here
5290
	  if (((hdr->sh_type == SHT_REL || hdr->sh_type == SHT_RELA)
5350
	  if (((hdr->sh_type == SHT_REL || hdr->sh_type == SHT_RELA)
5291
	       && hdr->bfd_section == NULL)
5351
	       && hdr->bfd_section == NULL)
5292
	      || i == elf_onesymtab (abfd)
5352
	      || i == elf_onesymtab (abfd)
5293
	      || i == elf_symtab_shndx (abfd)
5353
	      || (elf_symtab_shndx_list (abfd) != NULL
5354
		  && hdr == i_shdrpp[elf_symtab_shndx_list (abfd)->ndx])
5294
	      || i == elf_strtab_sec (abfd))
5355
	      || i == elf_strtab_sec (abfd))
5295
	    {
5356
	    {
5296
	      hdr->sh_offset = -1;
5357
	      hdr->sh_offset = -1;
Lines 6807-6813 _bfd_elf_copy_private_symbol_data (bfd *ibfd, Link Here
6807
	shndx = MAP_STRTAB;
6868
	shndx = MAP_STRTAB;
6808
      else if (shndx == elf_shstrtab_sec (ibfd))
6869
      else if (shndx == elf_shstrtab_sec (ibfd))
6809
	shndx = MAP_SHSTRTAB;
6870
	shndx = MAP_SHSTRTAB;
6810
      else if (shndx == elf_symtab_shndx (ibfd))
6871
      else if (find_section_in_list (shndx, elf_symtab_shndx_list (ibfd)))
6811
	shndx = MAP_SYM_SHNDX;
6872
	shndx = MAP_SYM_SHNDX;
6812
      osym->internal_elf_sym.st_shndx = shndx;
6873
      osym->internal_elf_sym.st_shndx = shndx;
6813
    }
6874
    }
Lines 6866-6888 swap_out_syms (bfd *abfd, Link Here
6866
  symtab_hdr->contents = outbound_syms;
6927
  symtab_hdr->contents = outbound_syms;
6867
6928
6868
  outbound_shndx = NULL;
6929
  outbound_shndx = NULL;
6869
  symtab_shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr;
6930
6870
  if (symtab_shndx_hdr->sh_name != 0)
6931
  if (elf_symtab_shndx_list (abfd))
6871
    {
6932
    {
6872
      amt = (bfd_size_type) (1 + symcount) * sizeof (Elf_External_Sym_Shndx);
6933
      symtab_shndx_hdr = & elf_symtab_shndx_list (abfd)->hdr;
6873
      outbound_shndx =  (bfd_byte *)
6934
      if (symtab_shndx_hdr->sh_name != 0)
6874
          bfd_zalloc2 (abfd, 1 + symcount, sizeof (Elf_External_Sym_Shndx));
6875
      if (outbound_shndx == NULL)
6876
	{
6935
	{
6877
	  _bfd_stringtab_free (stt);
6936
	  amt = (bfd_size_type) (1 + symcount) * sizeof (Elf_External_Sym_Shndx);
6878
	  return FALSE;
6937
	  outbound_shndx =  (bfd_byte *)
6879
	}
6938
	    bfd_zalloc2 (abfd, 1 + symcount, sizeof (Elf_External_Sym_Shndx));
6939
	  if (outbound_shndx == NULL)
6940
	    {
6941
	      _bfd_stringtab_free (stt);
6942
	      return FALSE;
6943
	    }
6880
6944
6881
      symtab_shndx_hdr->contents = outbound_shndx;
6945
	  symtab_shndx_hdr->contents = outbound_shndx;
6882
      symtab_shndx_hdr->sh_type = SHT_SYMTAB_SHNDX;
6946
	  symtab_shndx_hdr->sh_type = SHT_SYMTAB_SHNDX;
6883
      symtab_shndx_hdr->sh_size = amt;
6947
	  symtab_shndx_hdr->sh_size = amt;
6884
      symtab_shndx_hdr->sh_addralign = sizeof (Elf_External_Sym_Shndx);
6948
	  symtab_shndx_hdr->sh_addralign = sizeof (Elf_External_Sym_Shndx);
6885
      symtab_shndx_hdr->sh_entsize = sizeof (Elf_External_Sym_Shndx);
6949
	  symtab_shndx_hdr->sh_entsize = sizeof (Elf_External_Sym_Shndx);
6950
	}
6951
      /* FIXME: What about any other headers in the list ?  */
6886
    }
6952
    }
6887
6953
6888
  /* Now generate the data (for "contents").  */
6954
  /* Now generate the data (for "contents").  */
Lines 6990-6996 swap_out_syms (bfd *abfd, Link Here
6990
		  shndx = elf_shstrtab_sec (abfd);
7056
		  shndx = elf_shstrtab_sec (abfd);
6991
		  break;
7057
		  break;
6992
		case MAP_SYM_SHNDX:
7058
		case MAP_SYM_SHNDX:
6993
		  shndx = elf_symtab_shndx (abfd);
7059
		  if (elf_symtab_shndx_list (abfd))
7060
		    shndx = elf_symtab_shndx_list (abfd)->ndx;
6994
		  break;
7061
		  break;
6995
		default:
7062
		default:
6996
		  shndx = SHN_ABS;
7063
		  shndx = SHN_ABS;
(-)a/bfd/elf32-m32c.c (-5 / +16 lines)
Lines 1473-1480 m32c_elf_relax_section Link Here
1473
      || (sec->flags & SEC_CODE) == 0)
1473
      || (sec->flags & SEC_CODE) == 0)
1474
    return TRUE;
1474
    return TRUE;
1475
1475
1476
  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
1476
  symtab_hdr = & elf_symtab_hdr (abfd);
1477
  shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr;
1477
  if (elf_symtab_shndx_list (abfd))
1478
    shndx_hdr = & elf_symtab_shndx_list (abfd)->hdr;
1479
  else
1480
    shndx_hdr = NULL;
1478
1481
1479
  /* Get the section contents.  */
1482
  /* Get the section contents.  */
1480
  if (elf_section_data (sec)->this_hdr.contents != NULL)
1483
  if (elf_section_data (sec)->this_hdr.contents != NULL)
Lines 1495-1501 m32c_elf_relax_section Link Here
1495
      symtab_hdr->contents = (bfd_byte *) intsyms;
1498
      symtab_hdr->contents = (bfd_byte *) intsyms;
1496
    }
1499
    }
1497
1500
1498
  if (shndx_hdr->sh_size != 0)
1501
  if (shndx_hdr && shndx_hdr->sh_size != 0)
1499
    {
1502
    {
1500
      bfd_size_type amt;
1503
      bfd_size_type amt;
1501
1504
Lines 2043-2050 m32c_elf_relax_delete_bytes Link Here
2043
  isymend = isym + symtab_hdr->sh_info;
2046
  isymend = isym + symtab_hdr->sh_info;
2044
2047
2045
  sec_shndx  = _bfd_elf_section_from_bfd_section (abfd, sec);
2048
  sec_shndx  = _bfd_elf_section_from_bfd_section (abfd, sec);
2046
  shndx_hdr  = & elf_tdata (abfd)->symtab_shndx_hdr;
2049
  if (elf_symtab_shndx_list (abfd))
2047
  shndx_buf  = (Elf_External_Sym_Shndx *) shndx_hdr->contents;
2050
    {
2051
      shndx_hdr = & elf_symtab_shndx_list (abfd)->hdr;
2052
      shndx_buf  = (Elf_External_Sym_Shndx *) shndx_hdr->contents;
2053
    }
2054
  else
2055
    {
2056
      shndx_hdr = NULL;
2057
      shndx_buf = NULL;
2058
    }
2048
  shndx = shndx_buf;
2059
  shndx = shndx_buf;
2049
2060
2050
  for (; isym < isymend; isym++, shndx = (shndx ? shndx + 1 : NULL))
2061
  for (; isym < isymend; isym++, shndx = (shndx ? shndx + 1 : NULL))
(-)a/bfd/elf32-rl78.c (-3 / +6 lines)
Lines 1997-2004 rl78_elf_relax_section Link Here
1997
      || (sec->flags & SEC_CODE) == 0)
1997
      || (sec->flags & SEC_CODE) == 0)
1998
    return TRUE;
1998
    return TRUE;
1999
1999
2000
  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
2000
  symtab_hdr = & elf_symtab_hdr (abfd);
2001
  shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr;
2001
  if (elf_symtab_shndx_list (abfd))
2002
    shndx_hdr = & elf_symtab_shndx_list (abfd)->hdr;
2003
  else
2004
    shndx = NULL;
2002
2005
2003
  /* Get the section contents.  */
2006
  /* Get the section contents.  */
2004
  if (elf_section_data (sec)->this_hdr.contents != NULL)
2007
  if (elf_section_data (sec)->this_hdr.contents != NULL)
Lines 2021-2027 rl78_elf_relax_section Link Here
2021
      symtab_hdr->contents = (bfd_byte *) intsyms;
2024
      symtab_hdr->contents = (bfd_byte *) intsyms;
2022
    }
2025
    }
2023
2026
2024
  if (shndx_hdr->sh_size != 0)
2027
  if (shndx_hdr && shndx_hdr->sh_size != 0)
2025
    {
2028
    {
2026
      bfd_size_type amt;
2029
      bfd_size_type amt;
2027
2030
(-)a/bfd/elf32-rx.c (-3 / +6 lines)
Lines 1997-2004 elf32_rx_relax_section (bfd * abfd, Link Here
1997
      || (sec->flags & SEC_CODE) == 0)
1997
      || (sec->flags & SEC_CODE) == 0)
1998
    return TRUE;
1998
    return TRUE;
1999
1999
2000
  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
2000
  symtab_hdr = & elf_symtab_hdr (abfd);
2001
  shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr;
2001
  if (elf_symtab_shndx_list (abfd))
2002
    shndx_hdr = & elf_symtab_shndx_list (abfd)->hdr;
2003
  else
2004
    shndx_hdr = NULL;
2002
2005
2003
  sec_start = sec->output_section->vma + sec->output_offset;
2006
  sec_start = sec->output_section->vma + sec->output_offset;
2004
2007
Lines 2023-2029 elf32_rx_relax_section (bfd * abfd, Link Here
2023
      symtab_hdr->contents = (bfd_byte *) intsyms;
2026
      symtab_hdr->contents = (bfd_byte *) intsyms;
2024
    }
2027
    }
2025
2028
2026
  if (shndx_hdr->sh_size != 0)
2029
  if (shndx_hdr && shndx_hdr->sh_size != 0)
2027
    {
2030
    {
2028
      bfd_size_type amt;
2031
      bfd_size_type amt;
2029
2032
(-)a/bfd/elf32-v850.c (-3 / +11 lines)
Lines 2883-2889 v850_elf_relax_delete_bytes (bfd *abfd, Link Here
2883
  Elf_Internal_Rela *irel;
2883
  Elf_Internal_Rela *irel;
2884
  Elf_Internal_Rela *irelend;
2884
  Elf_Internal_Rela *irelend;
2885
  struct elf_link_hash_entry *sym_hash;
2885
  struct elf_link_hash_entry *sym_hash;
2886
  Elf_Internal_Shdr *shndx_hdr;
2887
  Elf_External_Sym_Shndx *shndx;
2886
  Elf_External_Sym_Shndx *shndx;
2888
2887
2889
  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
2888
  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
Lines 2908-2915 v850_elf_relax_delete_bytes (bfd *abfd, Link Here
2908
  /* Adjust all the relocs.  */
2907
  /* Adjust all the relocs.  */
2909
  irel = elf_section_data (sec)->relocs;
2908
  irel = elf_section_data (sec)->relocs;
2910
  irelend = irel + sec->reloc_count;
2909
  irelend = irel + sec->reloc_count;
2911
  shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr;
2910
  if (elf_symtab_shndx_list (abfd))
2912
  shndx = (Elf_External_Sym_Shndx *) shndx_hdr->contents;
2911
    {
2912
      Elf_Internal_Shdr *shndx_hdr;
2913
2914
      shndx_hdr = & elf_symtab_shndx_list (abfd)->hdr;
2915
      shndx = (Elf_External_Sym_Shndx *) shndx_hdr->contents;
2916
    }
2917
  else
2918
    {
2919
      shndx = NULL;
2920
    }
2913
2921
2914
  for (; irel < irelend; irel++)
2922
  for (; irel < irelend; irel++)
2915
    {
2923
    {
(-)a/bfd/elflink.c (-3 / +3 lines)
Lines 10798-10804 bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) Link Here
10798
		    max_sym_count = sym_count;
10798
		    max_sym_count = sym_count;
10799
10799
10800
		  if (sym_count > max_sym_shndx_count
10800
		  if (sym_count > max_sym_shndx_count
10801
		      && elf_symtab_shndx (sec->owner) != 0)
10801
		      && elf_symtab_shndx_list (sec->owner) != NULL)
10802
		    max_sym_shndx_count = sym_count;
10802
		    max_sym_shndx_count = sym_count;
10803
10803
10804
		  if ((sec->flags & SEC_RELOC) != 0)
10804
		  if ((sec->flags & SEC_RELOC) != 0)
Lines 11322-11329 bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) Link Here
11322
      Elf_Internal_Shdr *symstrtab_hdr;
11322
      Elf_Internal_Shdr *symstrtab_hdr;
11323
      file_ptr off = symtab_hdr->sh_offset + symtab_hdr->sh_size;
11323
      file_ptr off = symtab_hdr->sh_offset + symtab_hdr->sh_size;
11324
11324
11325
      symtab_shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr;
11325
      symtab_shndx_hdr = & elf_symtab_shndx_list (abfd)->hdr;
11326
      if (symtab_shndx_hdr->sh_name != 0)
11326
      if (symtab_shndx_hdr != NULL && symtab_shndx_hdr->sh_name != 0)
11327
	{
11327
	{
11328
	  symtab_shndx_hdr->sh_type = SHT_SYMTAB_SHNDX;
11328
	  symtab_shndx_hdr->sh_type = SHT_SYMTAB_SHNDX;
11329
	  symtab_shndx_hdr->sh_entsize = sizeof (Elf_External_Sym_Shndx);
11329
	  symtab_shndx_hdr->sh_entsize = sizeof (Elf_External_Sym_Shndx);
(-)a/binutils/readelf.c (-46 / +58 lines)
Lines 164-169 Link Here
164
#define offsetof(TYPE, MEMBER) ((size_t) &(((TYPE *) 0)->MEMBER))
164
#define offsetof(TYPE, MEMBER) ((size_t) &(((TYPE *) 0)->MEMBER))
165
#endif
165
#endif
166
166
167
typedef struct elf_section_list
168
{
169
  Elf_Internal_Shdr * hdr;
170
  struct elf_section_list * next;
171
} elf_section_list;
172
167
char * program_name = "readelf";
173
char * program_name = "readelf";
168
static unsigned long archive_file_offset;
174
static unsigned long archive_file_offset;
169
static unsigned long archive_file_size;
175
static unsigned long archive_file_size;
Lines 188-194 static Elf_Internal_Ehdr elf_header; Link Here
188
static Elf_Internal_Shdr * section_headers;
194
static Elf_Internal_Shdr * section_headers;
189
static Elf_Internal_Phdr * program_headers;
195
static Elf_Internal_Phdr * program_headers;
190
static Elf_Internal_Dyn *  dynamic_section;
196
static Elf_Internal_Dyn *  dynamic_section;
191
static Elf_Internal_Shdr * symtab_shndx_hdr;
197
static elf_section_list * symtab_shndx_list;
192
static int show_name;
198
static int show_name;
193
static int do_dynamic;
199
static int do_dynamic;
194
static int do_syms;
200
static int do_syms;
Lines 4794-4820 get_32bit_elf_symbols (FILE * file, Link Here
4794
  if (esyms == NULL)
4800
  if (esyms == NULL)
4795
    goto exit_point;
4801
    goto exit_point;
4796
4802
4797
  shndx = NULL;
4803
  {
4798
  if (symtab_shndx_hdr != NULL
4804
    elf_section_list * entry;
4799
      && (symtab_shndx_hdr->sh_link
4805
4800
	  == (unsigned long) (section - section_headers)))
4806
    shndx = NULL;
4801
    {
4807
    for (entry = symtab_shndx_list; entry != NULL; entry = entry->next)
4802
      shndx = (Elf_External_Sym_Shndx *) get_data (NULL, file,
4808
      if (entry->hdr->sh_link == (unsigned long) (section - section_headers))
4803
                                                   symtab_shndx_hdr->sh_offset,
4809
	{
4804
                                                   1, symtab_shndx_hdr->sh_size,
4810
	  shndx = (Elf_External_Sym_Shndx *) get_data (NULL, file,
4805
                                                   _("symbol table section indicies"));
4811
						       entry->hdr->sh_offset,
4806
      if (shndx == NULL)
4812
						       1, entry->hdr->sh_size,
4807
	goto exit_point;
4813
						       _("symbol table section indicies"));
4808
      /* PR17531: file: heap-buffer-overflow */
4814
	  if (shndx == NULL)
4809
      else if (symtab_shndx_hdr->sh_size / sizeof (Elf_External_Sym_Shndx) < number)
4815
	    goto exit_point;
4810
	{
4816
	  /* PR17531: file: heap-buffer-overflow */
4811
	  error (_("Index section %s has an sh_size of 0x%lx - expected 0x%lx\n"),
4817
	  else if (entry->hdr->sh_size / sizeof (Elf_External_Sym_Shndx) < number)
4812
		 printable_section_name (symtab_shndx_hdr),
4818
	    {
4813
		 (unsigned long) symtab_shndx_hdr->sh_size,
4819
	      error (_("Index section %s has an sh_size of 0x%lx - expected 0x%lx\n"),
4814
		 (unsigned long) section->sh_size);
4820
		     printable_section_name (entry->hdr),
4815
	  goto exit_point;
4821
		     (unsigned long) entry->hdr->sh_size,
4822
		     (unsigned long) section->sh_size);
4823
	      goto exit_point;
4824
	    }
4816
	}
4825
	}
4817
    }
4826
  }
4818
4827
4819
  isyms = (Elf_Internal_Sym *) cmalloc (number, sizeof (Elf_Internal_Sym));
4828
  isyms = (Elf_Internal_Sym *) cmalloc (number, sizeof (Elf_Internal_Sym));
4820
4829
Lines 4904-4928 get_64bit_elf_symbols (FILE * file, Link Here
4904
  if (!esyms)
4913
  if (!esyms)
4905
    goto exit_point;
4914
    goto exit_point;
4906
4915
4907
  if (symtab_shndx_hdr != NULL
4916
  {
4908
      && (symtab_shndx_hdr->sh_link
4917
    elf_section_list * entry;
4909
	  == (unsigned long) (section - section_headers)))
4918
4910
    {
4919
    shndx = NULL;
4911
      shndx = (Elf_External_Sym_Shndx *) get_data (NULL, file,
4920
    for (entry = symtab_shndx_list; entry != NULL; entry = entry->next)
4912
                                                   symtab_shndx_hdr->sh_offset,
4921
      if (entry->hdr->sh_link == (unsigned long) (section - section_headers))
4913
                                                   1, symtab_shndx_hdr->sh_size,
4922
	{
4914
                                                   _("symbol table section indicies"));
4923
	  shndx = (Elf_External_Sym_Shndx *) get_data (NULL, file,
4915
      if (shndx == NULL)
4924
						       entry->hdr->sh_offset,
4916
	goto exit_point;
4925
						       1, entry->hdr->sh_size,
4917
      else if (symtab_shndx_hdr->sh_size / sizeof (Elf_External_Sym_Shndx) < number)
4926
						       _("symbol table section indicies"));
4918
	{
4927
	  if (shndx == NULL)
4919
	  error (_("Index section %s has an sh_size of 0x%lx - expected 0x%lx\n"),
4928
	    goto exit_point;
4920
		 printable_section_name (symtab_shndx_hdr),
4929
	  /* PR17531: file: heap-buffer-overflow */
4921
		 (unsigned long) symtab_shndx_hdr->sh_size,
4930
	  else if (entry->hdr->sh_size / sizeof (Elf_External_Sym_Shndx) < number)
4922
		 (unsigned long) section->sh_size);
4931
	    {
4923
	  goto exit_point;
4932
	      error (_("Index section %s has an sh_size of 0x%lx - expected 0x%lx\n"),
4933
		     printable_section_name (entry->hdr),
4934
		     (unsigned long) entry->hdr->sh_size,
4935
		     (unsigned long) section->sh_size);
4936
	      goto exit_point;
4937
	    }
4924
	}
4938
	}
4925
    }
4939
  }
4926
4940
4927
  isyms = (Elf_Internal_Sym *) cmalloc (number, sizeof (Elf_Internal_Sym));
4941
  isyms = (Elf_Internal_Sym *) cmalloc (number, sizeof (Elf_Internal_Sym));
4928
4942
Lines 5256-5262 process_section_headers (FILE * file) Link Here
5256
  dynamic_symbols = NULL;
5270
  dynamic_symbols = NULL;
5257
  dynamic_strings = NULL;
5271
  dynamic_strings = NULL;
5258
  dynamic_syminfo = NULL;
5272
  dynamic_syminfo = NULL;
5259
  symtab_shndx_hdr = NULL;
5273
  symtab_shndx_list = NULL;
5260
5274
5261
  eh_addr_size = is_32bit_elf ? 4 : 8;
5275
  eh_addr_size = is_32bit_elf ? 4 : 8;
5262
  switch (elf_header.e_machine)
5276
  switch (elf_header.e_machine)
Lines 5361-5372 process_section_headers (FILE * file) Link Here
5361
	}
5375
	}
5362
      else if (section->sh_type == SHT_SYMTAB_SHNDX)
5376
      else if (section->sh_type == SHT_SYMTAB_SHNDX)
5363
	{
5377
	{
5364
	  if (symtab_shndx_hdr != NULL)
5378
	  elf_section_list * entry = xmalloc (sizeof * entry);
5365
	    {
5379
	  entry->hdr = section;
5366
	      error (_("File contains multiple symtab shndx tables\n"));
5380
	  entry->next = symtab_shndx_list;
5367
	      continue;
5381
	  symtab_shndx_list = entry;
5368
	    }
5369
	  symtab_shndx_hdr = section;
5370
	}
5382
	}
5371
      else if (section->sh_type == SHT_SYMTAB)
5383
      else if (section->sh_type == SHT_SYMTAB)
5372
	CHECK_ENTSIZE (section, i, Sym);
5384
	CHECK_ENTSIZE (section, i, Sym);
(-)a/sim/common/dv-sockser.c (+4 lines)
Lines 53-58 along with this program. If not, see <http://www.gnu.org/licenses/>. */ Link Here
53
#include "sim-assert.h"
53
#include "sim-assert.h"
54
#include "sim-options.h"
54
#include "sim-options.h"
55
55
56
#ifndef HAVE_DV_SOCKSER
57
#define HAVE_DV_SOCKSER
58
#endif
59
56
#include "dv-sockser.h"
60
#include "dv-sockser.h"
57
61
58
#ifndef HAVE_SOCKLEN_T
62
#ifndef HAVE_SOCKLEN_T
(-)a/sim/configure (+9 lines)
Lines 3625-3630 sim_common=yes Link Here
3625
sim_igen=no
3625
sim_igen=no
3626
sim_arch=
3626
sim_arch=
3627
case "${target}" in
3627
case "${target}" in
3628
   aarch64*-*-*)
3629
3630
  sim_arch=aarch64
3631
3632
3633
subdirs="$subdirs aarch64"
3634
3635
3636
       ;;
3628
   arm*-*-*)
3637
   arm*-*-*)
3629
3638
3630
  sim_arch=arm
3639
  sim_arch=arm
(-)a/sim/configure.tgt (+3 lines)
Lines 16-21 sim_common=yes Link Here
16
sim_igen=no
16
sim_igen=no
17
sim_arch=
17
sim_arch=
18
case "${target}" in
18
case "${target}" in
19
   aarch64*-*-*)
20
       SIM_ARCH(aarch64)
21
       ;;
19
   arm*-*-*)
22
   arm*-*-*)
20
       SIM_ARCH(arm)
23
       SIM_ARCH(arm)
21
       sim_testsuite=yes
24
       sim_testsuite=yes
(-)a/sim/lm32/sem-switch.c (+2 lines)
Lines 31-36 This file is part of the GNU simulators. Link Here
31
    int index;
31
    int index;
32
    void *label;
32
    void *label;
33
  } labels[] = {
33
  } labels[] = {
34
#if 0
34
    { LM32BF_INSN_X_INVALID, && case_sem_INSN_X_INVALID },
35
    { LM32BF_INSN_X_INVALID, && case_sem_INSN_X_INVALID },
35
    { LM32BF_INSN_X_AFTER, && case_sem_INSN_X_AFTER },
36
    { LM32BF_INSN_X_AFTER, && case_sem_INSN_X_AFTER },
36
    { LM32BF_INSN_X_BEFORE, && case_sem_INSN_X_BEFORE },
37
    { LM32BF_INSN_X_BEFORE, && case_sem_INSN_X_BEFORE },
Lines 99-104 This file is part of the GNU simulators. Link Here
99
    { LM32BF_INSN_XNORI, && case_sem_INSN_XNORI },
100
    { LM32BF_INSN_XNORI, && case_sem_INSN_XNORI },
100
    { LM32BF_INSN_BREAK, && case_sem_INSN_BREAK },
101
    { LM32BF_INSN_BREAK, && case_sem_INSN_BREAK },
101
    { LM32BF_INSN_SCALL, && case_sem_INSN_SCALL },
102
    { LM32BF_INSN_SCALL, && case_sem_INSN_SCALL },
103
#endif
102
    { 0, 0 }
104
    { 0, 0 }
103
  };
105
  };
104
  int i;
106
  int i;
(-)a/sim/msp430/msp430-sim.c (-10 / +55 lines)
Lines 396-405 get_op (SIM_DESC sd, MSP430_Opcode_Decoded *opc, int n) Link Here
396
      if (addr == 0x5dd)
396
      if (addr == 0x5dd)
397
	rv = 2;
397
	rv = 2;
398
#endif
398
#endif
399
      if (addr >= 0x130 && addr <= 0x15B)
399
      if ((addr >= 0x130 && addr <= 0x15B)
400
	  || (addr >= 0x4C0 && addr <= 0x4EB))
400
	{
401
	{
401
	  switch (addr)
402
	  switch (addr)
402
	    {
403
	    {
404
	    case 0x4CA:
403
	    case 0x13A:
405
	    case 0x13A:
404
	      switch (HWMULT (sd, hwmult_type))
406
	      switch (HWMULT (sd, hwmult_type))
405
		{
407
		{
Lines 414-419 get_op (SIM_DESC sd, MSP430_Opcode_Decoded *opc, int n) Link Here
414
		}
416
		}
415
	      break;
417
	      break;
416
418
419
	    case 0x4CC:
417
	    case 0x13C:
420
	    case 0x13C:
418
	      switch (HWMULT (sd, hwmult_type))
421
	      switch (HWMULT (sd, hwmult_type))
419
		{
422
		{
Lines 429-434 get_op (SIM_DESC sd, MSP430_Opcode_Decoded *opc, int n) Link Here
429
		}
432
		}
430
	      break;
433
	      break;
431
434
435
	    case 0x4CE:
432
	    case 0x13E:
436
	    case 0x13E:
433
	      switch (HWMULT (sd, hwmult_type))
437
	      switch (HWMULT (sd, hwmult_type))
434
		{
438
		{
Lines 447-469 get_op (SIM_DESC sd, MSP430_Opcode_Decoded *opc, int n) Link Here
447
		}
451
		}
448
	      break;
452
	      break;
449
453
454
	    case 0x4E4:
450
	    case 0x154:
455
	    case 0x154:
451
	      rv = zero_ext (HWMULT (sd, hw32mult_result), 16);
456
	      rv = zero_ext (HWMULT (sd, hw32mult_result), 16);
452
	      break;
457
	      break;
453
458
459
	    case 0x4E6:
454
	    case 0x156:
460
	    case 0x156:
455
	      rv = zero_ext (HWMULT (sd, hw32mult_result) >> 16, 16);
461
	      rv = zero_ext (HWMULT (sd, hw32mult_result) >> 16, 16);
456
	      break;
462
	      break;
457
463
464
	    case 0x4E8:
458
	    case 0x158:
465
	    case 0x158:
459
	      rv = zero_ext (HWMULT (sd, hw32mult_result) >> 32, 16);
466
	      rv = zero_ext (HWMULT (sd, hw32mult_result) >> 32, 16);
460
	      break;
467
	      break;
461
468
469
	    case 0x4EA:
462
	    case 0x15A:
470
	    case 0x15A:
463
	      switch (HWMULT (sd, hw32mult_type))
471
	      switch (HWMULT (sd, hw32mult_type))
464
		{
472
		{
465
		case UNSIGN_64: rv = zero_ext (HWMULT (sd, hw32mult_result) >> 48, 16); break;
473
		case UNSIGN_64:
466
		case   SIGN_64: rv = sign_ext (HWMULT (sd, hw32mult_result) >> 48, 16); break;
474
		  rv = zero_ext (HWMULT (sd, hw32mult_result) >> 48, 16);
475
		  break;
476
		case SIGN_64:
477
		  rv = sign_ext (HWMULT (sd, hw32mult_result) >> 48, 16);
478
		  break;
467
		}
479
		}
468
	      break;
480
	      break;
469
481
Lines 565-571 put_op (SIM_DESC sd, MSP430_Opcode_Decoded *opc, int n, int val) Link Here
565
      if (addr == 0x5ce)
577
      if (addr == 0x5ce)
566
	putchar (val);
578
	putchar (val);
567
#endif
579
#endif
568
      if (addr >= 0x130 && addr <= 0x15B)
580
      if ((addr >= 0x130 && addr <= 0x15B)
581
	  || (addr >= 0x4C0 && addr <= 0x4EB))
569
	{
582
	{
570
	  signed int a,b;
583
	  signed int a,b;
571
584
Lines 574-585 put_op (SIM_DESC sd, MSP430_Opcode_Decoded *opc, int n, int val) Link Here
574
587
575
	  switch (addr)
588
	  switch (addr)
576
	    {
589
	    {
577
	    case 0x130: HWMULT (sd, hwmult_op1) = val; HWMULT (sd, hwmult_type) = UNSIGN_32; break;
590
	    case 0x4C0:
578
	    case 0x132: HWMULT (sd, hwmult_op1) = val; HWMULT (sd, hwmult_type) = SIGN_32; break;
591
	    case 0x130:
579
	    case 0x134: HWMULT (sd, hwmult_op1) = val; HWMULT (sd, hwmult_type) = UNSIGN_MAC_32; break;
592
	      HWMULT (sd, hwmult_op1) = val;
580
	    case 0x136: HWMULT (sd, hwmult_op1) = val; HWMULT (sd, hwmult_type) = SIGN_MAC_32; break;
593
	      HWMULT (sd, hwmult_type) = UNSIGN_32;
594
	      break;
595
596
	    case 0x4C2:
597
	    case 0x132:
598
	      HWMULT (sd, hwmult_op1) = val;
599
	      HWMULT (sd, hwmult_type) = SIGN_32;
600
	      break;
601
602
	    case 0x4C4:
603
	    case 0x134:
604
	      HWMULT (sd, hwmult_op1) = val;
605
	      HWMULT (sd, hwmult_type) = UNSIGN_MAC_32;
606
	      break;
607
608
	    case 0x4C6:
609
	    case 0x136:
610
	      HWMULT (sd, hwmult_op1) = val;
611
	      HWMULT (sd, hwmult_type) = SIGN_MAC_32;
612
	      break;
581
613
582
	    case 0x138: HWMULT (sd, hwmult_op2) = val;
614
	    case 0x4C8:
615
	    case 0x138:
616
	      HWMULT (sd, hwmult_op2) = val;
583
	      switch (HWMULT (sd, hwmult_type))
617
	      switch (HWMULT (sd, hwmult_type))
584
		{
618
		{
585
		case UNSIGN_32:
619
		case UNSIGN_32:
Lines 614-620 put_op (SIM_DESC sd, MSP430_Opcode_Decoded *opc, int n, int val) Link Here
614
		}
648
		}
615
	      break;
649
	      break;
616
650
617
	    case 0x13a:
651
	    case 0x4CA:
652
	    case 0x13A:
618
	      /* Copy into LOW result...  */
653
	      /* Copy into LOW result...  */
619
	      switch (HWMULT (sd, hwmult_type))
654
	      switch (HWMULT (sd, hwmult_type))
620
		{
655
		{
Lines 631-654 put_op (SIM_DESC sd, MSP430_Opcode_Decoded *opc, int n, int val) Link Here
631
		}
666
		}
632
	      break;
667
	      break;
633
		
668
		
669
	    case 0x4D0:
634
	    case 0x140:
670
	    case 0x140:
635
	      HWMULT (sd, hw32mult_op1) = val;
671
	      HWMULT (sd, hw32mult_op1) = val;
636
	      HWMULT (sd, hw32mult_type) = UNSIGN_64;
672
	      HWMULT (sd, hw32mult_type) = UNSIGN_64;
637
	      break;
673
	      break;
674
675
	    case 0x4D2:
638
	    case 0x142:
676
	    case 0x142:
639
	      HWMULT (sd, hw32mult_op1) = (HWMULT (sd, hw32mult_op1) & 0xFFFF) | (val << 16);
677
	      HWMULT (sd, hw32mult_op1) = (HWMULT (sd, hw32mult_op1) & 0xFFFF) | (val << 16);
640
	      break;
678
	      break;
679
680
	    case 0x4D4:
641
	    case 0x144:
681
	    case 0x144:
642
	      HWMULT (sd, hw32mult_op1) = val;
682
	      HWMULT (sd, hw32mult_op1) = val;
643
	      HWMULT (sd, hw32mult_type) = SIGN_64;
683
	      HWMULT (sd, hw32mult_type) = SIGN_64;
644
	      break;
684
	      break;
685
686
	    case 0x4D6:
645
	    case 0x146:
687
	    case 0x146:
646
	      HWMULT (sd, hw32mult_op1) = (HWMULT (sd, hw32mult_op1) & 0xFFFF) | (val << 16);
688
	      HWMULT (sd, hw32mult_op1) = (HWMULT (sd, hw32mult_op1) & 0xFFFF) | (val << 16);
647
	      break;
689
	      break;
690
691
	    case 0x4E0:
648
	    case 0x150:
692
	    case 0x150:
649
	      HWMULT (sd, hw32mult_op2) = val;
693
	      HWMULT (sd, hw32mult_op2) = val;
650
	      break;
694
	      break;
651
695
696
	    case 0x4E2:
652
	    case 0x152:
697
	    case 0x152:
653
	      HWMULT (sd, hw32mult_op2) = (HWMULT (sd, hw32mult_op2) & 0xFFFF) | (val << 16);
698
	      HWMULT (sd, hw32mult_op2) = (HWMULT (sd, hw32mult_op2) & 0xFFFF) | (val << 16);
654
	      switch (HWMULT (sd, hw32mult_type))
699
	      switch (HWMULT (sd, hw32mult_type))
(-)a/sim/testsuite/configure (+3 lines)
Lines 1823-1828 sim_common=yes Link Here
1823
sim_igen=no
1823
sim_igen=no
1824
sim_arch=
1824
sim_arch=
1825
case "${target}" in
1825
case "${target}" in
1826
   aarch64*-*-*)
1827
       sim_arch=aarch64
1828
       ;;
1826
   arm*-*-*)
1829
   arm*-*-*)
1827
       sim_arch=arm
1830
       sim_arch=arm
1828
       sim_testsuite=yes
1831
       sim_testsuite=yes

Return to bug 15835