cd595c0
diff -rcp ../binutils-2.19.51.0.2.15/bfd/elf32-lm32.c ./bfd/elf32-lm32.c
cd595c0
*** ../binutils-2.19.51.0.2.15/bfd/elf32-lm32.c	2009-03-02 14:05:10.000000000 +0000
cd595c0
--- ./bfd/elf32-lm32.c	2009-03-05 12:12:25.000000000 +0000
cd595c0
*************** lm32_elf_relocate_section (bfd *output_b
cd595c0
*** 888,898 ****
cd595c0
            /* It's a global symbol.  */
cd595c0
            bfd_boolean unresolved_reloc;
cd595c0
  	  bfd_boolean warned;
cd595c0
  
cd595c0
  	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
cd595c0
  				   r_symndx, symtab_hdr, sym_hashes,
cd595c0
  				   h, sec, relocation,
cd595c0
! 				   unresolved_reloc, warned);
cd595c0
  	  osec = sec;
cd595c0
  	  name = h->root.root.string;
cd595c0
          }
cd595c0
--- 888,899 ----
cd595c0
            /* It's a global symbol.  */
cd595c0
            bfd_boolean unresolved_reloc;
cd595c0
  	  bfd_boolean warned;
cd595c0
+ 	  bfd_boolean ignored;
cd595c0
  
cd595c0
  	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
cd595c0
  				   r_symndx, symtab_hdr, sym_hashes,
cd595c0
  				   h, sec, relocation,
cd595c0
! 				   unresolved_reloc, warned, ignored);
cd595c0
  	  osec = sec;
cd595c0
  	  name = h->root.root.string;
cd595c0
          }
cd595c0
diff -rcp ../binutils-2.19.51.0.2.15/bfd/elf32-ppc.c ./bfd/elf32-ppc.c
cd595c0
*** ../binutils-2.19.51.0.2.15/bfd/elf32-ppc.c	2009-03-02 14:05:10.000000000 +0000
cd595c0
--- ./bfd/elf32-ppc.c	2009-03-05 12:20:26.000000000 +0000
cd595c0
***************
cd595c0
*** 1,6 ****
cd595c0
  /* PowerPC-specific support for 32-bit ELF
cd595c0
     Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
cd595c0
!    2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
cd595c0
     Written by Ian Lance Taylor, Cygnus Support.
cd595c0
  
cd595c0
     This file is part of BFD, the Binary File Descriptor library.
cd595c0
--- 1,6 ----
cd595c0
  /* PowerPC-specific support for 32-bit ELF
cd595c0
     Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
cd595c0
!    2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
cd595c0
     Written by Ian Lance Taylor, Cygnus Support.
cd595c0
  
cd595c0
     This file is part of BFD, the Binary File Descriptor library.
cd595c0
*************** ppc_elf_gc_sweep_hook (bfd *abfd,
cd595c0
*** 4301,4307 ****
cd595c0
    return TRUE;
cd595c0
  }
cd595c0
  
cd595c0
! /* Set htab->tls_get_addr and call the generic ELF tls_setup function.  */
cd595c0
  
cd595c0
  asection *
cd595c0
  ppc_elf_tls_setup (bfd *obfd, struct bfd_link_info *info)
cd595c0
--- 4301,4308 ----
cd595c0
    return TRUE;
cd595c0
  }
cd595c0
  
cd595c0
! /* Set plt output section type, htab->tls_get_addr, and call the
cd595c0
!    generic ELF tls_setup function.  */
cd595c0
  
cd595c0
  asection *
cd595c0
  ppc_elf_tls_setup (bfd *obfd, struct bfd_link_info *info)
cd595c0
*************** ppc_elf_tls_setup (bfd *obfd, struct bfd
cd595c0
*** 4322,4327 ****
cd595c0
--- 4323,4365 ----
cd595c0
    return _bfd_elf_tls_setup (obfd, info);
cd595c0
  }
cd595c0
  
cd595c0
+ /* Return TRUE iff REL is a branch reloc with a global symbol matching
cd595c0
+    HASH.  */
cd595c0
+ 
cd595c0
+ static bfd_boolean
cd595c0
+ branch_reloc_hash_match (const bfd *ibfd,
cd595c0
+ 			 const Elf_Internal_Rela *rel,
cd595c0
+ 			 const struct elf_link_hash_entry *hash)
cd595c0
+ {
cd595c0
+   Elf_Internal_Shdr *symtab_hdr = &elf_symtab_hdr (ibfd);
cd595c0
+   enum elf_ppc_reloc_type r_type = ELF32_R_TYPE (rel->r_info);
cd595c0
+   unsigned int r_symndx = ELF32_R_SYM (rel->r_info);
cd595c0
+ 
cd595c0
+   if (r_symndx >= symtab_hdr->sh_info
cd595c0
+       && (r_type == R_PPC_PLTREL24
cd595c0
+ 	  || r_type == R_PPC_LOCAL24PC
cd595c0
+ 	  || r_type == R_PPC_REL14
cd595c0
+ 	  || r_type == R_PPC_REL14_BRTAKEN
cd595c0
+ 	  || r_type == R_PPC_REL14_BRNTAKEN
cd595c0
+ 	  || r_type == R_PPC_REL24
cd595c0
+ 	  || r_type == R_PPC_ADDR24
cd595c0
+ 	  || r_type == R_PPC_ADDR14
cd595c0
+ 	  || r_type == R_PPC_ADDR14_BRTAKEN
cd595c0
+ 	  || r_type == R_PPC_ADDR14_BRNTAKEN))
cd595c0
+     {
cd595c0
+       struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (ibfd);
cd595c0
+       struct elf_link_hash_entry *h;
cd595c0
+ 
cd595c0
+       h = sym_hashes[r_symndx - symtab_hdr->sh_info];
cd595c0
+       while (h->root.type == bfd_link_hash_indirect
cd595c0
+ 	     || h->root.type == bfd_link_hash_warning)
cd595c0
+ 	h = (struct elf_link_hash_entry *) h->root.u.i.link;
cd595c0
+       if (h == hash)
cd595c0
+ 	return TRUE;
cd595c0
+     }
cd595c0
+   return FALSE;
cd595c0
+ }
cd595c0
+ 
cd595c0
  /* Run through all the TLS relocs looking for optimization
cd595c0
     opportunities.  */
cd595c0
  
cd595c0
*************** ppc_elf_tls_optimize (bfd *obfd ATTRIBUT
cd595c0
*** 4449,4483 ****
cd595c0
  		      if (!expecting_tls_get_addr)
cd595c0
  			continue;
cd595c0
  
cd595c0
! 		      if (rel + 1 < relend)
cd595c0
! 			{
cd595c0
! 			  enum elf_ppc_reloc_type r_type2;
cd595c0
! 			  unsigned long r_symndx2;
cd595c0
! 			  struct elf_link_hash_entry *h2;
cd595c0
! 
cd595c0
! 			  /* The next instruction should be a call to
cd595c0
! 			     __tls_get_addr.  Peek at the reloc to be sure.  */
cd595c0
! 			  r_type2 = ELF32_R_TYPE (rel[1].r_info);
cd595c0
! 			  r_symndx2 = ELF32_R_SYM (rel[1].r_info);
cd595c0
! 			  if (r_symndx2 >= symtab_hdr->sh_info
cd595c0
! 			      && (r_type2 == R_PPC_REL14
cd595c0
! 				  || r_type2 == R_PPC_REL14_BRTAKEN
cd595c0
! 				  || r_type2 == R_PPC_REL14_BRNTAKEN
cd595c0
! 				  || r_type2 == R_PPC_REL24
cd595c0
! 				  || r_type2 == R_PPC_PLTREL24))
cd595c0
! 			    {
cd595c0
! 			      struct elf_link_hash_entry **sym_hashes;
cd595c0
! 
cd595c0
! 			      sym_hashes = elf_sym_hashes (ibfd);
cd595c0
! 			      h2 = sym_hashes[r_symndx2 - symtab_hdr->sh_info];
cd595c0
! 			      while (h2->root.type == bfd_link_hash_indirect
cd595c0
! 				     || h2->root.type == bfd_link_hash_warning)
cd595c0
! 				h2 = ((struct elf_link_hash_entry *)
cd595c0
! 				      h2->root.u.i.link);
cd595c0
! 			      if (h2 == htab->tls_get_addr)
cd595c0
! 				continue;
cd595c0
! 			    }
cd595c0
! 			}
cd595c0
  
cd595c0
  		      /* Uh oh, we didn't find the expected call.  We
cd595c0
  			 could just mark this symbol to exclude it
cd595c0
--- 4487,4496 ----
cd595c0
  		      if (!expecting_tls_get_addr)
cd595c0
  			continue;
cd595c0
  
cd595c0
! 		      if (rel + 1 < relend
cd595c0
! 			  && branch_reloc_hash_match (ibfd, rel + 1,
cd595c0
! 						      htab->tls_get_addr))
cd595c0
! 			continue;
cd595c0
  
cd595c0
  		      /* Uh oh, we didn't find the expected call.  We
cd595c0
  			 could just mark this symbol to exclude it
cd595c0
*************** ppc_elf_relocate_section (bfd *output_bf
cd595c0
*** 6346,6367 ****
cd595c0
  	case R_PPC_GOT_TLSLD16_LO:
cd595c0
  	  if (tls_mask != 0 && (tls_mask & TLS_LD) == 0)
cd595c0
  	    {
cd595c0
! 	      bfd_vma insn1, insn2;
cd595c0
  	      bfd_vma offset;
cd595c0
  
cd595c0
  	    tls_ldgd_opt:
cd595c0
  	      offset = rel[1].r_offset;
cd595c0
- 	      insn1 = bfd_get_32 (output_bfd,
cd595c0
- 				  contents + rel->r_offset - d_offset);
cd595c0
  	      if ((tls_mask & tls_gd) != 0)
cd595c0
  		{
cd595c0
  		  /* IE */
cd595c0
  		  insn1 &= (1 << 26) - 1;
cd595c0
  		  insn1 |= 32 << 26;	/* lwz */
cd595c0
  		  insn2 = 0x7c631214;	/* add 3,3,2 */
cd595c0
  		  rel[1].r_info
cd595c0
  		    = ELF32_R_INFO (ELF32_R_SYM (rel[1].r_info), R_PPC_NONE);
cd595c0
- 		  rel[1].r_addend = 0;
cd595c0
  		  r_type = (((r_type - (R_PPC_GOT_TLSGD16 & 3)) & 3)
cd595c0
  			    + R_PPC_GOT_TPREL16);
cd595c0
  		  rel->r_info = ELF32_R_INFO (r_symndx, r_type);
cd595c0
--- 6359,6379 ----
cd595c0
  	case R_PPC_GOT_TLSLD16_LO:
cd595c0
  	  if (tls_mask != 0 && (tls_mask & TLS_LD) == 0)
cd595c0
  	    {
cd595c0
! 	      unsigned int insn1, insn2;
cd595c0
  	      bfd_vma offset;
cd595c0
  
cd595c0
  	    tls_ldgd_opt:
cd595c0
  	      offset = rel[1].r_offset;
cd595c0
  	      if ((tls_mask & tls_gd) != 0)
cd595c0
  		{
cd595c0
  		  /* IE */
cd595c0
+ 		  insn1 = bfd_get_32 (output_bfd,
cd595c0
+ 				      contents + rel->r_offset - d_offset);
cd595c0
  		  insn1 &= (1 << 26) - 1;
cd595c0
  		  insn1 |= 32 << 26;	/* lwz */
cd595c0
  		  insn2 = 0x7c631214;	/* add 3,3,2 */
cd595c0
  		  rel[1].r_info
cd595c0
  		    = ELF32_R_INFO (ELF32_R_SYM (rel[1].r_info), R_PPC_NONE);
cd595c0
  		  r_type = (((r_type - (R_PPC_GOT_TLSGD16 & 3)) & 3)
cd595c0
  			    + R_PPC_GOT_TPREL16);
cd595c0
  		  rel->r_info = ELF32_R_INFO (r_symndx, r_type);
cd595c0
diff -rcp ../binutils-2.19.51.0.2.15/bfd/elf64-ppc.c ./bfd/elf64-ppc.c
cd595c0
*** ../binutils-2.19.51.0.2.15/bfd/elf64-ppc.c	2009-03-02 14:05:10.000000000 +0000
cd595c0
--- ./bfd/elf64-ppc.c	2009-03-05 12:20:26.000000000 +0000
cd595c0
***************
cd595c0
*** 1,6 ****
cd595c0
  /* PowerPC64-specific support for 64-bit ELF.
cd595c0
!    Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
cd595c0
!    Free Software Foundation, Inc.
cd595c0
     Written by Linus Nordberg, Swox AB <info@swox.com>,
cd595c0
     based on elf32-ppc.c by Ian Lance Taylor.
cd595c0
     Largely rewritten by Alan Modra <amodra@bigpond.net.au>
cd595c0
--- 1,6 ----
cd595c0
  /* PowerPC64-specific support for 64-bit ELF.
cd595c0
!    Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
cd595c0
!    2009 Free Software Foundation, Inc.
cd595c0
     Written by Linus Nordberg, Swox AB <info@swox.com>,
cd595c0
     based on elf32-ppc.c by Ian Lance Taylor.
cd595c0
     Largely rewritten by Alan Modra <amodra@bigpond.net.au>
cd595c0
*************** struct _ppc64_elf_section_data
cd595c0
*** 2608,2616 ****
cd595c0
        long *adjust;
cd595c0
      } opd;
cd595c0
  
cd595c0
!     /* An array for toc sections, indexed by offset/8.
cd595c0
!        Specifies the relocation symbol index used at a given toc offset.  */
cd595c0
!     unsigned *t_symndx;
cd595c0
    } u;
cd595c0
  
cd595c0
    enum _ppc64_sec_type sec_type:2;
cd595c0
--- 2608,2622 ----
cd595c0
        long *adjust;
cd595c0
      } opd;
cd595c0
  
cd595c0
!     /* An array for toc sections, indexed by offset/8.  */
cd595c0
!     struct _toc_sec_data
cd595c0
!     {
cd595c0
!       /* Specifies the relocation symbol index used at a given toc offset.  */
cd595c0
!       unsigned *symndx;
cd595c0
! 
cd595c0
!       /* And the relocation addend.  */
cd595c0
!       bfd_vma *add;
cd595c0
!     } toc;
cd595c0
    } u;
cd595c0
  
cd595c0
    enum _ppc64_sec_type sec_type:2;
cd595c0
*************** ppc64_elf_check_relocs (bfd *abfd, struc
cd595c0
*** 4578,4583 ****
cd595c0
--- 4584,4590 ----
cd595c0
    const Elf_Internal_Rela *rel_end;
cd595c0
    asection *sreloc;
cd595c0
    asection **opd_sym_map;
cd595c0
+   struct elf_link_hash_entry *tga, *dottga;
cd595c0
  
cd595c0
    if (info->relocatable)
cd595c0
      return TRUE;
cd595c0
*************** ppc64_elf_check_relocs (bfd *abfd, struc
cd595c0
*** 4594,4599 ****
cd595c0
--- 4601,4610 ----
cd595c0
    BFD_ASSERT (is_ppc64_elf (abfd));
cd595c0
  
cd595c0
    htab = ppc_hash_table (info);
cd595c0
+   tga = elf_link_hash_lookup (&htab->elf, "__tls_get_addr",
cd595c0
+ 			      FALSE, FALSE, TRUE);
cd595c0
+   dottga = elf_link_hash_lookup (&htab->elf, ".__tls_get_addr",
cd595c0
+ 				 FALSE, FALSE, TRUE);
cd595c0
    symtab_hdr = &elf_symtab_hdr (abfd);
cd595c0
  
cd595c0
    sym_hashes = elf_sym_hashes (abfd);
cd595c0
*************** ppc64_elf_check_relocs (bfd *abfd, struc
cd595c0
*** 4829,4853 ****
cd595c0
  	      if (!update_plt_info (abfd, (struct ppc_link_hash_entry *) h,
cd595c0
  				    rel->r_addend))
cd595c0
  		return FALSE;
cd595c0
! 	      if (h == &htab->tls_get_addr->elf
cd595c0
! 		  || h == &htab->tls_get_addr_fd->elf)
cd595c0
  		sec->has_tls_reloc = 1;
cd595c0
- 	      else if (htab->tls_get_addr == NULL
cd595c0
- 		       && CONST_STRNEQ (h->root.root.string, ".__tls_get_addr")
cd595c0
- 		       && (h->root.root.string[15] == 0
cd595c0
- 			   || h->root.root.string[15] == '@'))
cd595c0
- 		{
cd595c0
- 		  htab->tls_get_addr = (struct ppc_link_hash_entry *) h;
cd595c0
- 		  sec->has_tls_reloc = 1;
cd595c0
- 		}
cd595c0
- 	      else if (htab->tls_get_addr_fd == NULL
cd595c0
- 		       && CONST_STRNEQ (h->root.root.string, "__tls_get_addr")
cd595c0
- 		       && (h->root.root.string[14] == 0
cd595c0
- 			   || h->root.root.string[14] == '@'))
cd595c0
- 		{
cd595c0
- 		  htab->tls_get_addr_fd = (struct ppc_link_hash_entry *) h;
cd595c0
- 		  sec->has_tls_reloc = 1;
cd595c0
- 		}
cd595c0
  	    }
cd595c0
  	  break;
cd595c0
  
cd595c0
--- 4840,4847 ----
cd595c0
  	      if (!update_plt_info (abfd, (struct ppc_link_hash_entry *) h,
cd595c0
  				    rel->r_addend))
cd595c0
  		return FALSE;
cd595c0
! 	      if (h == tga || h == dottga)
cd595c0
  		sec->has_tls_reloc = 1;
cd595c0
  	    }
cd595c0
  	  break;
cd595c0
  
cd595c0
*************** ppc64_elf_check_relocs (bfd *abfd, struc
cd595c0
*** 4891,4913 ****
cd595c0
  	  ppc64_sec = ppc64_elf_section_data (sec);
cd595c0
  	  if (ppc64_sec->sec_type != sec_toc)
cd595c0
  	    {
cd595c0
  	      /* One extra to simplify get_tls_mask.  */
cd595c0
! 	      bfd_size_type amt = sec->size * sizeof (unsigned) / 8 + 1;
cd595c0
! 	      ppc64_sec->u.t_symndx = bfd_zalloc (abfd, amt);
cd595c0
! 	      if (ppc64_sec->u.t_symndx == NULL)
cd595c0
  		return FALSE;
cd595c0
  	      BFD_ASSERT (ppc64_sec->sec_type == sec_normal);
cd595c0
  	      ppc64_sec->sec_type = sec_toc;
cd595c0
  	    }
cd595c0
  	  BFD_ASSERT (rel->r_offset % 8 == 0);
cd595c0
! 	  ppc64_sec->u.t_symndx[rel->r_offset / 8] = r_symndx;
cd595c0
  
cd595c0
  	  /* Mark the second slot of a GD or LD entry.
cd595c0
  	     -1 to indicate GD and -2 to indicate LD.  */
cd595c0
  	  if (tls_type == (TLS_EXPLICIT | TLS_TLS | TLS_GD))
cd595c0
! 	    ppc64_sec->u.t_symndx[rel->r_offset / 8 + 1] = -1;
cd595c0
  	  else if (tls_type == (TLS_EXPLICIT | TLS_TLS | TLS_LD))
cd595c0
! 	    ppc64_sec->u.t_symndx[rel->r_offset / 8 + 1] = -2;
cd595c0
  	  goto dodyn;
cd595c0
  
cd595c0
  	case R_PPC64_TPREL16:
cd595c0
--- 4885,4914 ----
cd595c0
  	  ppc64_sec = ppc64_elf_section_data (sec);
cd595c0
  	  if (ppc64_sec->sec_type != sec_toc)
cd595c0
  	    {
cd595c0
+ 	      bfd_size_type amt;
cd595c0
+ 
cd595c0
  	      /* One extra to simplify get_tls_mask.  */
cd595c0
! 	      amt = sec->size * sizeof (unsigned) / 8 + sizeof (unsigned);
cd595c0
! 	      ppc64_sec->u.toc.symndx = bfd_zalloc (abfd, amt);
cd595c0
! 	      if (ppc64_sec->u.toc.symndx == NULL)
cd595c0
! 		return FALSE;
cd595c0
! 	      amt = sec->size * sizeof (bfd_vma) / 8;
cd595c0
! 	      ppc64_sec->u.toc.add = bfd_zalloc (abfd, amt);
cd595c0
! 	      if (ppc64_sec->u.toc.add == NULL)
cd595c0
  		return FALSE;
cd595c0
  	      BFD_ASSERT (ppc64_sec->sec_type == sec_normal);
cd595c0
  	      ppc64_sec->sec_type = sec_toc;
cd595c0
  	    }
cd595c0
  	  BFD_ASSERT (rel->r_offset % 8 == 0);
cd595c0
! 	  ppc64_sec->u.toc.symndx[rel->r_offset / 8] = r_symndx;
cd595c0
! 	  ppc64_sec->u.toc.add[rel->r_offset / 8] = rel->r_addend;
cd595c0
  
cd595c0
  	  /* Mark the second slot of a GD or LD entry.
cd595c0
  	     -1 to indicate GD and -2 to indicate LD.  */
cd595c0
  	  if (tls_type == (TLS_EXPLICIT | TLS_TLS | TLS_GD))
cd595c0
! 	    ppc64_sec->u.toc.symndx[rel->r_offset / 8 + 1] = -1;
cd595c0
  	  else if (tls_type == (TLS_EXPLICIT | TLS_TLS | TLS_LD))
cd595c0
! 	    ppc64_sec->u.toc.symndx[rel->r_offset / 8 + 1] = -2;
cd595c0
  	  goto dodyn;
cd595c0
  
cd595c0
  	case R_PPC64_TPREL16:
cd595c0
*************** get_sym_h (struct elf_link_hash_entry **
cd595c0
*** 6226,6234 ****
cd595c0
     type suitable for optimization, and 1 otherwise.  */
cd595c0
  
cd595c0
  static int
cd595c0
! get_tls_mask (char **tls_maskp, unsigned long *toc_symndx,
cd595c0
  	      Elf_Internal_Sym **locsymsp,
cd595c0
! 	      const Elf_Internal_Rela *rel, bfd *ibfd)
cd595c0
  {
cd595c0
    unsigned long r_symndx;
cd595c0
    int next_r;
cd595c0
--- 6227,6238 ----
cd595c0
     type suitable for optimization, and 1 otherwise.  */
cd595c0
  
cd595c0
  static int
cd595c0
! get_tls_mask (char **tls_maskp,
cd595c0
! 	      unsigned long *toc_symndx,
cd595c0
! 	      bfd_vma *toc_addend,
cd595c0
  	      Elf_Internal_Sym **locsymsp,
cd595c0
! 	      const Elf_Internal_Rela *rel,
cd595c0
! 	      bfd *ibfd)
cd595c0
  {
cd595c0
    unsigned long r_symndx;
cd595c0
    int next_r;
cd595c0
*************** get_tls_mask (char **tls_maskp, unsigned
cd595c0
*** 6256,6267 ****
cd595c0
      off = sym->st_value;
cd595c0
    off += rel->r_addend;
cd595c0
    BFD_ASSERT (off % 8 == 0);
cd595c0
!   r_symndx = ppc64_elf_section_data (sec)->u.t_symndx[off / 8];
cd595c0
!   next_r = ppc64_elf_section_data (sec)->u.t_symndx[off / 8 + 1];
cd595c0
!   if (!get_sym_h (&h, &sym, &sec, tls_maskp, locsymsp, r_symndx, ibfd))
cd595c0
!     return 0;
cd595c0
    if (toc_symndx != NULL)
cd595c0
      *toc_symndx = r_symndx;
cd595c0
    if ((h == NULL
cd595c0
         || ((h->root.type == bfd_link_hash_defined
cd595c0
  	    || h->root.type == bfd_link_hash_defweak)
cd595c0
--- 6260,6273 ----
cd595c0
      off = sym->st_value;
cd595c0
    off += rel->r_addend;
cd595c0
    BFD_ASSERT (off % 8 == 0);
cd595c0
!   r_symndx = ppc64_elf_section_data (sec)->u.toc.symndx[off / 8];
cd595c0
!   next_r = ppc64_elf_section_data (sec)->u.toc.symndx[off / 8 + 1];
cd595c0
    if (toc_symndx != NULL)
cd595c0
      *toc_symndx = r_symndx;
cd595c0
+   if (toc_addend != NULL)
cd595c0
+     *toc_addend = ppc64_elf_section_data (sec)->u.toc.add[off / 8];
cd595c0
+   if (!get_sym_h (&h, &sym, &sec, tls_maskp, locsymsp, r_symndx, ibfd))
cd595c0
+     return 0;
cd595c0
    if ((h == NULL
cd595c0
         || ((h->root.type == bfd_link_hash_defined
cd595c0
  	    || h->root.type == bfd_link_hash_defweak)
cd595c0
*************** ppc64_elf_tls_setup (bfd *obfd, struct b
cd595c0
*** 6866,6901 ****
cd595c0
    struct ppc_link_hash_table *htab;
cd595c0
  
cd595c0
    htab = ppc_hash_table (info);
cd595c0
!   if (htab->tls_get_addr != NULL)
cd595c0
!     {
cd595c0
!       struct ppc_link_hash_entry *h = htab->tls_get_addr;
cd595c0
! 
cd595c0
!       while (h->elf.root.type == bfd_link_hash_indirect
cd595c0
! 	     || h->elf.root.type == bfd_link_hash_warning)
cd595c0
! 	h = (struct ppc_link_hash_entry *) h->elf.root.u.i.link;
cd595c0
  
cd595c0
!       htab->tls_get_addr = h;
cd595c0
  
cd595c0
!       if (htab->tls_get_addr_fd == NULL
cd595c0
! 	  && h->oh != NULL
cd595c0
! 	  && h->oh->is_func_descriptor
cd595c0
! 	  && (h->oh->elf.root.type == bfd_link_hash_defined
cd595c0
! 	      || h->oh->elf.root.type == bfd_link_hash_defweak))
cd595c0
! 	htab->tls_get_addr_fd = h->oh;
cd595c0
!     }
cd595c0
  
cd595c0
!   if (htab->tls_get_addr_fd != NULL)
cd595c0
      {
cd595c0
!       struct ppc_link_hash_entry *h = htab->tls_get_addr_fd;
cd595c0
! 
cd595c0
!       while (h->elf.root.type == bfd_link_hash_indirect
cd595c0
! 	     || h->elf.root.type == bfd_link_hash_warning)
cd595c0
! 	h = (struct ppc_link_hash_entry *) h->elf.root.u.i.link;
cd595c0
  
cd595c0
!       htab->tls_get_addr_fd = h;
cd595c0
      }
cd595c0
! 
cd595c0
!   return _bfd_elf_tls_setup (obfd, info);
cd595c0
  }
cd595c0
  
cd595c0
  /* Run through all the TLS relocs looking for optimization
cd595c0
--- 6872,6920 ----
cd595c0
    struct ppc_link_hash_table *htab;
cd595c0
  
cd595c0
    htab = ppc_hash_table (info);
cd595c0
!   htab->tls_get_addr = ((struct ppc_link_hash_entry *)
cd595c0
! 			elf_link_hash_lookup (&htab->elf, ".__tls_get_addr",
cd595c0
! 					      FALSE, FALSE, TRUE));
cd595c0
!   htab->tls_get_addr_fd = ((struct ppc_link_hash_entry *)
cd595c0
! 			   elf_link_hash_lookup (&htab->elf, "__tls_get_addr",
cd595c0
! 						 FALSE, FALSE, TRUE));
cd595c0
!   return _bfd_elf_tls_setup (obfd, info);
cd595c0
! }
cd595c0
  
cd595c0
! /* Return TRUE iff REL is a branch reloc with a global symbol matching
cd595c0
!    HASH1 or HASH2.  */
cd595c0
  
cd595c0
! static bfd_boolean
cd595c0
! branch_reloc_hash_match (const bfd *ibfd,
cd595c0
! 			 const Elf_Internal_Rela *rel,
cd595c0
! 			 const struct ppc_link_hash_entry *hash1,
cd595c0
! 			 const struct ppc_link_hash_entry *hash2)
cd595c0
! {
cd595c0
!   Elf_Internal_Shdr *symtab_hdr = &elf_symtab_hdr (ibfd);
cd595c0
!   enum elf_ppc64_reloc_type r_type = ELF64_R_TYPE (rel->r_info);
cd595c0
!   unsigned int r_symndx = ELF64_R_SYM (rel->r_info);
cd595c0
  
cd595c0
!   if (r_symndx >= symtab_hdr->sh_info
cd595c0
!       && (r_type == R_PPC64_REL24
cd595c0
! 	  || r_type == R_PPC64_REL14
cd595c0
! 	  || r_type == R_PPC64_REL14_BRTAKEN
cd595c0
! 	  || r_type == R_PPC64_REL14_BRNTAKEN
cd595c0
! 	  || r_type == R_PPC64_ADDR24
cd595c0
! 	  || r_type == R_PPC64_ADDR14
cd595c0
! 	  || r_type == R_PPC64_ADDR14_BRTAKEN
cd595c0
! 	  || r_type == R_PPC64_ADDR14_BRNTAKEN))
cd595c0
      {
cd595c0
!       struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (ibfd);
cd595c0
!       struct elf_link_hash_entry *h;
cd595c0
  
cd595c0
!       h = sym_hashes[r_symndx - symtab_hdr->sh_info];
cd595c0
!       while (h->root.type == bfd_link_hash_indirect
cd595c0
! 	     || h->root.type == bfd_link_hash_warning)
cd595c0
! 	h = (struct elf_link_hash_entry *) h->root.u.i.link;
cd595c0
!       if (h == &hash1->elf || h == &hash2->elf)
cd595c0
! 	return TRUE;
cd595c0
      }
cd595c0
!   return FALSE;
cd595c0
  }
cd595c0
  
cd595c0
  /* Run through all the TLS relocs looking for optimization
cd595c0
*************** ppc64_elf_tls_optimize (bfd *obfd ATTRIB
cd595c0
*** 7141,7195 ****
cd595c0
  		      if (!expecting_tls_get_addr)
cd595c0
  			continue;
cd595c0
  
cd595c0
! 		      if (rel + 1 < relend)
cd595c0
  			{
cd595c0
! 			  Elf_Internal_Shdr *symtab_hdr;
cd595c0
! 			  enum elf_ppc64_reloc_type r_type2;
cd595c0
! 			  unsigned long r_symndx2;
cd595c0
! 			  struct elf_link_hash_entry *h2;
cd595c0
! 
cd595c0
! 			  symtab_hdr = &elf_symtab_hdr (ibfd);
cd595c0
! 
cd595c0
! 			  /* The next instruction should be a call to
cd595c0
! 			     __tls_get_addr.  Peek at the reloc to be sure.  */
cd595c0
! 			  r_type2 = ELF64_R_TYPE (rel[1].r_info);
cd595c0
! 			  r_symndx2 = ELF64_R_SYM (rel[1].r_info);
cd595c0
! 			  if (r_symndx2 >= symtab_hdr->sh_info
cd595c0
! 			      && (r_type2 == R_PPC64_REL14
cd595c0
! 				  || r_type2 == R_PPC64_REL14_BRTAKEN
cd595c0
! 				  || r_type2 == R_PPC64_REL14_BRNTAKEN
cd595c0
! 				  || r_type2 == R_PPC64_REL24))
cd595c0
  			    {
cd595c0
! 			      struct elf_link_hash_entry **sym_hashes;
cd595c0
! 
cd595c0
! 			      sym_hashes = elf_sym_hashes (ibfd);
cd595c0
! 
cd595c0
! 			      h2 = sym_hashes[r_symndx2 - symtab_hdr->sh_info];
cd595c0
! 			      while (h2->root.type == bfd_link_hash_indirect
cd595c0
! 				     || h2->root.type == bfd_link_hash_warning)
cd595c0
! 				h2 = ((struct elf_link_hash_entry *)
cd595c0
! 				      h2->root.u.i.link);
cd595c0
! 			      if (h2 != NULL
cd595c0
! 				  && (h2 == &htab->tls_get_addr->elf
cd595c0
! 				      || h2 == &htab->tls_get_addr_fd->elf))
cd595c0
! 				{
cd595c0
! 				  if (expecting_tls_get_addr == 2)
cd595c0
! 				    {
cd595c0
! 				      /* Check for toc tls entries.  */
cd595c0
! 				      char *toc_tls;
cd595c0
! 				      int retval;
cd595c0
! 
cd595c0
! 				      retval = get_tls_mask (&toc_tls, NULL,
cd595c0
! 							     &locsyms,
cd595c0
! 							     rel, ibfd);
cd595c0
! 				      if (retval == 0)
cd595c0
! 					goto err_free_rel;
cd595c0
! 				      if (retval > 1 && toc_tls != NULL)
cd595c0
! 					toc_ref[toc_ref_index] = 1;
cd595c0
! 				    }
cd595c0
! 				  continue;
cd595c0
! 				}
cd595c0
  			    }
cd595c0
  			}
cd595c0
  
cd595c0
  		      if (expecting_tls_get_addr != 1)
cd595c0
--- 7160,7185 ----
cd595c0
  		      if (!expecting_tls_get_addr)
cd595c0
  			continue;
cd595c0
  
cd595c0
! 		      if (rel + 1 < relend
cd595c0
! 			  && branch_reloc_hash_match (ibfd, rel + 1,
cd595c0
! 						      htab->tls_get_addr,
cd595c0
! 						      htab->tls_get_addr_fd))
cd595c0
  			{
cd595c0
! 			  if (expecting_tls_get_addr == 2)
cd595c0
  			    {
cd595c0
! 			      /* Check for toc tls entries.  */
cd595c0
! 			      char *toc_tls;
cd595c0
! 			      int retval;
cd595c0
! 
cd595c0
! 			      retval = get_tls_mask (&toc_tls, NULL, NULL,
cd595c0
! 						     &locsyms,
cd595c0
! 						     rel, ibfd);
cd595c0
! 			      if (retval == 0)
cd595c0
! 				goto err_free_rel;
cd595c0
! 			      if (retval > 1 && toc_tls != NULL)
cd595c0
! 				toc_ref[toc_ref_index] = 1;
cd595c0
  			    }
cd595c0
+ 			  continue;
cd595c0
  			}
cd595c0
  
cd595c0
  		      if (expecting_tls_get_addr != 1)
cd595c0
*************** ppc64_elf_size_stubs (bfd *output_bfd,
cd595c0
*** 9712,9718 ****
cd595c0
  		      /* Get tls info.  */
cd595c0
  		      char *tls_mask;
cd595c0
  
cd595c0
! 		      if (!get_tls_mask (&tls_mask, NULL, &local_syms,
cd595c0
  					 irela - 1, input_bfd))
cd595c0
  			goto error_ret_free_internal;
cd595c0
  		      if (*tls_mask != 0)
cd595c0
--- 9702,9708 ----
cd595c0
  		      /* Get tls info.  */
cd595c0
  		      char *tls_mask;
cd595c0
  
cd595c0
! 		      if (!get_tls_mask (&tls_mask, NULL, NULL, &local_syms,
cd595c0
  					 irela - 1, input_bfd))
cd595c0
  			goto error_ret_free_internal;
cd595c0
  		      if (*tls_mask != 0)
cd595c0
*************** ppc64_elf_relocate_section (bfd *output_
cd595c0
*** 10204,10209 ****
cd595c0
--- 10194,10200 ----
cd595c0
        struct ppc_link_hash_entry *fdh;
cd595c0
        const char *sym_name;
cd595c0
        unsigned long r_symndx, toc_symndx;
cd595c0
+       bfd_vma toc_addend;
cd595c0
        char tls_mask, tls_gd, tls_type;
cd595c0
        char sym_type;
cd595c0
        bfd_vma relocation;
cd595c0
*************** ppc64_elf_relocate_section (bfd *output_
cd595c0
*** 10314,10321 ****
cd595c0
  	      /* Check for toc tls entries.  */
cd595c0
  	      char *toc_tls;
cd595c0
  
cd595c0
! 	      if (!get_tls_mask (&toc_tls, &toc_symndx, &local_syms,
cd595c0
! 				 rel, input_bfd))
cd595c0
  		return FALSE;
cd595c0
  
cd595c0
  	      if (toc_tls)
cd595c0
--- 10305,10312 ----
cd595c0
  	      /* Check for toc tls entries.  */
cd595c0
  	      char *toc_tls;
cd595c0
  
cd595c0
! 	      if (!get_tls_mask (&toc_tls, &toc_symndx, &toc_addend,
cd595c0
! 				 &local_syms, rel, input_bfd))
cd595c0
  		return FALSE;
cd595c0
  
cd595c0
  	      if (toc_tls)
cd595c0
*************** ppc64_elf_relocate_section (bfd *output_
cd595c0
*** 10377,10384 ****
cd595c0
  	    char *toc_tls;
cd595c0
  	    int retval;
cd595c0
  
cd595c0
! 	    retval = get_tls_mask (&toc_tls, &toc_symndx, &local_syms,
cd595c0
! 				   rel, input_bfd);
cd595c0
  	    if (retval == 0)
cd595c0
  	      return FALSE;
cd595c0
  
cd595c0
--- 10368,10375 ----
cd595c0
  	    char *toc_tls;
cd595c0
  	    int retval;
cd595c0
  
cd595c0
! 	    retval = get_tls_mask (&toc_tls, &toc_symndx, &toc_addend,
cd595c0
! 				   &local_syms, rel, input_bfd);
cd595c0
  	    if (retval == 0)
cd595c0
  	      return FALSE;
cd595c0
  
cd595c0
*************** ppc64_elf_relocate_section (bfd *output_
cd595c0
*** 10426,10431 ****
cd595c0
--- 10417,10423 ----
cd595c0
  	      if (toc_symndx != 0)
cd595c0
  		{
cd595c0
  		  rel->r_info = ELF64_R_INFO (toc_symndx, r_type);
cd595c0
+ 		  rel->r_addend = toc_addend;
cd595c0
  		  /* We changed the symbol.  Start over in order to
cd595c0
  		     get h, sym, sec etc. right.  */
cd595c0
  		  rel--;
cd595c0
*************** ppc64_elf_relocate_section (bfd *output_
cd595c0
*** 10479,10484 ****
cd595c0
--- 10471,10477 ----
cd595c0
  	      if (toc_symndx != 0)
cd595c0
  		{
cd595c0
  		  rel->r_info = ELF64_R_INFO (toc_symndx, r_type);
cd595c0
+ 		  rel->r_addend = toc_addend;
cd595c0
  		  /* We changed the symbol.  Start over in order to
cd595c0
  		     get h, sym, sec etc. right.  */
cd595c0
  		  rel--;
cd595c0
*************** ppc64_elf_relocate_section (bfd *output_
cd595c0
*** 10525,10544 ****
cd595c0
  	case R_PPC64_GOT_TLSLD16_LO:
cd595c0
  	  if (tls_mask != 0 && (tls_mask & TLS_LD) == 0)
cd595c0
  	    {
cd595c0
! 	      bfd_vma insn1, insn2, insn3;
cd595c0
  	      bfd_vma offset;
cd595c0
  
cd595c0
  	    tls_ldgd_opt:
cd595c0
  	      /* We know that the next reloc is on a tls_get_addr
cd595c0
  		 call, since ppc64_elf_tls_optimize checks this.  */
cd595c0
  	      offset = rel[1].r_offset;
cd595c0
- 	      insn1 = bfd_get_32 (output_bfd,
cd595c0
- 				  contents + rel->r_offset - d_offset);
cd595c0
- 	      insn3 = bfd_get_32 (output_bfd,
cd595c0
- 				  contents + offset + 4);
cd595c0
  	      if ((tls_mask & tls_gd) != 0)
cd595c0
  		{
cd595c0
  		  /* IE */
cd595c0
  		  insn1 &= (1 << 26) - (1 << 2);
cd595c0
  		  insn1 |= 58 << 26;	/* ld */
cd595c0
  		  insn2 = 0x7c636a14;	/* add 3,3,13 */
cd595c0
--- 10518,10535 ----
cd595c0
  	case R_PPC64_GOT_TLSLD16_LO:
cd595c0
  	  if (tls_mask != 0 && (tls_mask & TLS_LD) == 0)
cd595c0
  	    {
cd595c0
! 	      unsigned int insn1, insn2, insn3;
cd595c0
  	      bfd_vma offset;
cd595c0
  
cd595c0
  	    tls_ldgd_opt:
cd595c0
  	      /* We know that the next reloc is on a tls_get_addr
cd595c0
  		 call, since ppc64_elf_tls_optimize checks this.  */
cd595c0
  	      offset = rel[1].r_offset;
cd595c0
  	      if ((tls_mask & tls_gd) != 0)
cd595c0
  		{
cd595c0
  		  /* IE */
cd595c0
+ 		  insn1 = bfd_get_32 (output_bfd,
cd595c0
+ 				      contents + rel->r_offset - d_offset);
cd595c0
  		  insn1 &= (1 << 26) - (1 << 2);
cd595c0
  		  insn1 |= 58 << 26;	/* ld */
cd595c0
  		  insn2 = 0x7c636a14;	/* add 3,3,13 */
cd595c0
*************** ppc64_elf_relocate_section (bfd *output_
cd595c0
*** 10573,10600 ****
cd595c0
  			rel->r_addend -= (local_syms[r_symndx].st_value
cd595c0
  					  + sec->output_offset
cd595c0
  					  + sec->output_section->vma);
cd595c0
- 		      rel[1].r_addend = rel->r_addend;
cd595c0
  		    }
cd595c0
  		  else if (toc_symndx != 0)
cd595c0
! 		    r_symndx = toc_symndx;
cd595c0
  		  r_type = R_PPC64_TPREL16_HA;
cd595c0
  		  rel->r_info = ELF64_R_INFO (r_symndx, r_type);
cd595c0
  		  rel[1].r_info = ELF64_R_INFO (r_symndx,
cd595c0
  						R_PPC64_TPREL16_LO);
cd595c0
  		  rel[1].r_offset += d_offset;
cd595c0
  		}
cd595c0
  	      if (insn3 == NOP
cd595c0
  		  || insn3 == CROR_151515 || insn3 == CROR_313131)
cd595c0
  		{
cd595c0
- 		  insn3 = insn2;
cd595c0
- 		  insn2 = NOP;
cd595c0
  		  rel[1].r_offset += 4;
cd595c0
  		}
cd595c0
- 	      bfd_put_32 (output_bfd, insn1,
cd595c0
- 			  contents + rel->r_offset - d_offset);
cd595c0
  	      bfd_put_32 (output_bfd, insn2, contents + offset);
cd595c0
! 	      bfd_put_32 (output_bfd, insn3, contents + offset + 4);
cd595c0
! 	      if (tls_gd == 0 || toc_symndx != 0)
cd595c0
  		{
cd595c0
  		  /* We changed the symbol.  Start over in order
cd595c0
  		     to get h, sym, sec etc. right.  */
cd595c0
--- 10564,10596 ----
cd595c0
  			rel->r_addend -= (local_syms[r_symndx].st_value
cd595c0
  					  + sec->output_offset
cd595c0
  					  + sec->output_section->vma);
cd595c0
  		    }
cd595c0
  		  else if (toc_symndx != 0)
cd595c0
! 		    {
cd595c0
! 		      r_symndx = toc_symndx;
cd595c0
! 		      rel->r_addend = toc_addend;
cd595c0
! 		    }
cd595c0
  		  r_type = R_PPC64_TPREL16_HA;
cd595c0
  		  rel->r_info = ELF64_R_INFO (r_symndx, r_type);
cd595c0
  		  rel[1].r_info = ELF64_R_INFO (r_symndx,
cd595c0
  						R_PPC64_TPREL16_LO);
cd595c0
  		  rel[1].r_offset += d_offset;
cd595c0
+ 		  rel[1].r_addend = rel->r_addend;
cd595c0
  		}
cd595c0
+ 	      bfd_put_32 (output_bfd, insn1,
cd595c0
+ 			  contents + rel->r_offset - d_offset);
cd595c0
+ 	      insn3 = bfd_get_32 (output_bfd,
cd595c0
+ 				  contents + offset + 4);
cd595c0
  	      if (insn3 == NOP
cd595c0
  		  || insn3 == CROR_151515 || insn3 == CROR_313131)
cd595c0
  		{
cd595c0
  		  rel[1].r_offset += 4;
cd595c0
+ 		  bfd_put_32 (output_bfd, insn2, contents + offset + 4);
cd595c0
+ 		  insn2 = NOP;
cd595c0
  		}
cd595c0
  	      bfd_put_32 (output_bfd, insn2, contents + offset);
cd595c0
! 	      if ((tls_mask & tls_gd) == 0
cd595c0
! 		  && (tls_gd == 0 || toc_symndx != 0))
cd595c0
  		{
cd595c0
  		  /* We changed the symbol.  Start over in order
cd595c0
  		     to get h, sym, sec etc. right.  */
cd595c0
*************** ppc64_elf_relocate_section (bfd *output_
cd595c0
*** 10971,10977 ****
cd595c0
  
cd595c0
  		*offp = off | 1;
cd595c0
  		if ((info->shared || indx != 0)
cd595c0
! 		    && (h == NULL
cd595c0
  			|| ELF_ST_VISIBILITY (h->elf.other) == STV_DEFAULT
cd595c0
  			|| h->elf.root.type != bfd_link_hash_undefweak))
cd595c0
  		  {
cd595c0
--- 10967,10974 ----
cd595c0
  
cd595c0
  		*offp = off | 1;
cd595c0
  		if ((info->shared || indx != 0)
cd595c0
! 		    && (offp == &ppc64_tlsld_got (input_bfd)->offset
cd595c0
! 			|| h == NULL
cd595c0
  			|| ELF_ST_VISIBILITY (h->elf.other) == STV_DEFAULT
cd595c0
  			|| h->elf.root.type != bfd_link_hash_undefweak))
cd595c0
  		  {
cd595c0
diff -rcp ../binutils-2.19.51.0.2.15/gas/config/tc-ppc.c ./gas/config/tc-ppc.c
cd595c0
*** ../binutils-2.19.51.0.2.15/gas/config/tc-ppc.c	2009-03-02 14:05:00.000000000 +0000
cd595c0
--- ./gas/config/tc-ppc.c	2009-03-05 12:20:26.000000000 +0000
cd595c0
*************** static const struct pd_reg pre_defined_r
cd595c0
*** 358,366 ****
cd595c0
--- 358,399 ----
cd595c0
    { "f.3", 3 },
cd595c0
    { "f.30", 30 },
cd595c0
    { "f.31", 31 },
cd595c0
+ 
cd595c0
+   { "f.32", 32 },    /* Extended floating point scalar registers (ISA 2.06).  */
cd595c0
+   { "f.33", 33 },
cd595c0
+   { "f.34", 34 },
cd595c0
+   { "f.35", 35 },
cd595c0
+   { "f.36", 36 },
cd595c0
+   { "f.37", 37 },
cd595c0
+   { "f.38", 38 },
cd595c0
+   { "f.39", 39 },
cd595c0
    { "f.4", 4 },
cd595c0
+   { "f.40", 40 },
cd595c0
+   { "f.41", 41 },
cd595c0
+   { "f.42", 42 },
cd595c0
+   { "f.43", 43 },
cd595c0
+   { "f.44", 44 },
cd595c0
+   { "f.45", 45 },
cd595c0
+   { "f.46", 46 },
cd595c0
+   { "f.47", 47 },
cd595c0
+   { "f.48", 48 },
cd595c0
+   { "f.49", 49 },
cd595c0
    { "f.5", 5 },
cd595c0
+   { "f.50", 50 },
cd595c0
+   { "f.51", 51 },
cd595c0
+   { "f.52", 52 },
cd595c0
+   { "f.53", 53 },
cd595c0
+   { "f.54", 54 },
cd595c0
+   { "f.55", 55 },
cd595c0
+   { "f.56", 56 },
cd595c0
+   { "f.57", 57 },
cd595c0
+   { "f.58", 58 },
cd595c0
+   { "f.59", 59 },
cd595c0
    { "f.6", 6 },
cd595c0
+   { "f.60", 60 },
cd595c0
+   { "f.61", 61 },
cd595c0
+   { "f.62", 62 },
cd595c0
+   { "f.63", 63 },
cd595c0
    { "f.7", 7 },
cd595c0
    { "f.8", 8 },
cd595c0
    { "f.9", 9 },
cd595c0
*************** static const struct pd_reg pre_defined_r
cd595c0
*** 391,399 ****
cd595c0
--- 424,465 ----
cd595c0
    { "f3", 3 },
cd595c0
    { "f30", 30 },
cd595c0
    { "f31", 31 },
cd595c0
+ 
cd595c0
+   { "f32", 32 },    /* Extended floating point scalar registers (ISA 2.06).  */
cd595c0
+   { "f33", 33 },
cd595c0
+   { "f34", 34 },
cd595c0
+   { "f35", 35 },
cd595c0
+   { "f36", 36 },
cd595c0
+   { "f37", 37 },
cd595c0
+   { "f38", 38 },
cd595c0
+   { "f39", 39 },
cd595c0
    { "f4", 4 },
cd595c0
+   { "f40", 40 },
cd595c0
+   { "f41", 41 },
cd595c0
+   { "f42", 42 },
cd595c0
+   { "f43", 43 },
cd595c0
+   { "f44", 44 },
cd595c0
+   { "f45", 45 },
cd595c0
+   { "f46", 46 },
cd595c0
+   { "f47", 47 },
cd595c0
+   { "f48", 48 },
cd595c0
+   { "f49", 49 },
cd595c0
    { "f5", 5 },
cd595c0
+   { "f50", 50 },
cd595c0
+   { "f51", 51 },
cd595c0
+   { "f52", 52 },
cd595c0
+   { "f53", 53 },
cd595c0
+   { "f54", 54 },
cd595c0
+   { "f55", 55 },
cd595c0
+   { "f56", 56 },
cd595c0
+   { "f57", 57 },
cd595c0
+   { "f58", 58 },
cd595c0
+   { "f59", 59 },
cd595c0
    { "f6", 6 },
cd595c0
+   { "f60", 60 },
cd595c0
+   { "f61", 61 },
cd595c0
+   { "f62", 62 },
cd595c0
+   { "f63", 63 },
cd595c0
    { "f7", 7 },
cd595c0
    { "f8", 8 },
cd595c0
    { "f9", 9 },
cd595c0
*************** static const struct pd_reg pre_defined_r
cd595c0
*** 501,507 ****
cd595c0
    { "srr0", 26 }, /* Machine Status Save/Restore Register 0 */
cd595c0
    { "srr1", 27 }, /* Machine Status Save/Restore Register 1 */
cd595c0
  
cd595c0
!   { "v.0", 0 },     /* Vector registers */
cd595c0
    { "v.1", 1 },
cd595c0
    { "v.10", 10 },
cd595c0
    { "v.11", 11 },
cd595c0
--- 567,573 ----
cd595c0
    { "srr0", 26 }, /* Machine Status Save/Restore Register 0 */
cd595c0
    { "srr1", 27 }, /* Machine Status Save/Restore Register 1 */
cd595c0
  
cd595c0
!   { "v.0", 0 },     /* Vector (Altivec/VMX) registers */
cd595c0
    { "v.1", 1 },
cd595c0
    { "v.10", 10 },
cd595c0
    { "v.11", 11 },
cd595c0
*************** static const struct pd_reg pre_defined_r
cd595c0
*** 567,572 ****
cd595c0
--- 633,768 ----
cd595c0
    { "v8", 8 },
cd595c0
    { "v9", 9 },
cd595c0
  
cd595c0
+   { "vs.0", 0 },     /* Vector Scalar (VSX) registers (ISA 2.06).  */
cd595c0
+   { "vs.1", 1 },
cd595c0
+   { "vs.10", 10 },
cd595c0
+   { "vs.11", 11 },
cd595c0
+   { "vs.12", 12 },
cd595c0
+   { "vs.13", 13 },
cd595c0
+   { "vs.14", 14 },
cd595c0
+   { "vs.15", 15 },
cd595c0
+   { "vs.16", 16 },
cd595c0
+   { "vs.17", 17 },
cd595c0
+   { "vs.18", 18 },
cd595c0
+   { "vs.19", 19 },
cd595c0
+   { "vs.2", 2 },
cd595c0
+   { "vs.20", 20 },
cd595c0
+   { "vs.21", 21 },
cd595c0
+   { "vs.22", 22 },
cd595c0
+   { "vs.23", 23 },
cd595c0
+   { "vs.24", 24 },
cd595c0
+   { "vs.25", 25 },
cd595c0
+   { "vs.26", 26 },
cd595c0
+   { "vs.27", 27 },
cd595c0
+   { "vs.28", 28 },
cd595c0
+   { "vs.29", 29 },
cd595c0
+   { "vs.3", 3 },
cd595c0
+   { "vs.30", 30 },
cd595c0
+   { "vs.31", 31 },
cd595c0
+   { "vs.32", 32 },
cd595c0
+   { "vs.33", 33 },
cd595c0
+   { "vs.34", 34 },
cd595c0
+   { "vs.35", 35 },
cd595c0
+   { "vs.36", 36 },
cd595c0
+   { "vs.37", 37 },
cd595c0
+   { "vs.38", 38 },
cd595c0
+   { "vs.39", 39 },
cd595c0
+   { "vs.4", 4 },
cd595c0
+   { "vs.40", 40 },
cd595c0
+   { "vs.41", 41 },
cd595c0
+   { "vs.42", 42 },
cd595c0
+   { "vs.43", 43 },
cd595c0
+   { "vs.44", 44 },
cd595c0
+   { "vs.45", 45 },
cd595c0
+   { "vs.46", 46 },
cd595c0
+   { "vs.47", 47 },
cd595c0
+   { "vs.48", 48 },
cd595c0
+   { "vs.49", 49 },
cd595c0
+   { "vs.5", 5 },
cd595c0
+   { "vs.50", 50 },
cd595c0
+   { "vs.51", 51 },
cd595c0
+   { "vs.52", 52 },
cd595c0
+   { "vs.53", 53 },
cd595c0
+   { "vs.54", 54 },
cd595c0
+   { "vs.55", 55 },
cd595c0
+   { "vs.56", 56 },
cd595c0
+   { "vs.57", 57 },
cd595c0
+   { "vs.58", 58 },
cd595c0
+   { "vs.59", 59 },
cd595c0
+   { "vs.6", 6 },
cd595c0
+   { "vs.60", 60 },
cd595c0
+   { "vs.61", 61 },
cd595c0
+   { "vs.62", 62 },
cd595c0
+   { "vs.63", 63 },
cd595c0
+   { "vs.7", 7 },
cd595c0
+   { "vs.8", 8 },
cd595c0
+   { "vs.9", 9 },
cd595c0
+ 
cd595c0
+   { "vs0", 0 },
cd595c0
+   { "vs1", 1 },
cd595c0
+   { "vs10", 10 },
cd595c0
+   { "vs11", 11 },
cd595c0
+   { "vs12", 12 },
cd595c0
+   { "vs13", 13 },
cd595c0
+   { "vs14", 14 },
cd595c0
+   { "vs15", 15 },
cd595c0
+   { "vs16", 16 },
cd595c0
+   { "vs17", 17 },
cd595c0
+   { "vs18", 18 },
cd595c0
+   { "vs19", 19 },
cd595c0
+   { "vs2", 2 },
cd595c0
+   { "vs20", 20 },
cd595c0
+   { "vs21", 21 },
cd595c0
+   { "vs22", 22 },
cd595c0
+   { "vs23", 23 },
cd595c0
+   { "vs24", 24 },
cd595c0
+   { "vs25", 25 },
cd595c0
+   { "vs26", 26 },
cd595c0
+   { "vs27", 27 },
cd595c0
+   { "vs28", 28 },
cd595c0
+   { "vs29", 29 },
cd595c0
+   { "vs3", 3 },
cd595c0
+   { "vs30", 30 },
cd595c0
+   { "vs31", 31 },
cd595c0
+   { "vs32", 32 },
cd595c0
+   { "vs33", 33 },
cd595c0
+   { "vs34", 34 },
cd595c0
+   { "vs35", 35 },
cd595c0
+   { "vs36", 36 },
cd595c0
+   { "vs37", 37 },
cd595c0
+   { "vs38", 38 },
cd595c0
+   { "vs39", 39 },
cd595c0
+   { "vs4", 4 },
cd595c0
+   { "vs40", 40 },
cd595c0
+   { "vs41", 41 },
cd595c0
+   { "vs42", 42 },
cd595c0
+   { "vs43", 43 },
cd595c0
+   { "vs44", 44 },
cd595c0
+   { "vs45", 45 },
cd595c0
+   { "vs46", 46 },
cd595c0
+   { "vs47", 47 },
cd595c0
+   { "vs48", 48 },
cd595c0
+   { "vs49", 49 },
cd595c0
+   { "vs5", 5 },
cd595c0
+   { "vs50", 50 },
cd595c0
+   { "vs51", 51 },
cd595c0
+   { "vs52", 52 },
cd595c0
+   { "vs53", 53 },
cd595c0
+   { "vs54", 54 },
cd595c0
+   { "vs55", 55 },
cd595c0
+   { "vs56", 56 },
cd595c0
+   { "vs57", 57 },
cd595c0
+   { "vs58", 58 },
cd595c0
+   { "vs59", 59 },
cd595c0
+   { "vs6", 6 },
cd595c0
+   { "vs60", 60 },
cd595c0
+   { "vs61", 61 },
cd595c0
+   { "vs62", 62 },
cd595c0
+   { "vs63", 63 },
cd595c0
+   { "vs7", 7 },
cd595c0
+   { "vs8", 8 },
cd595c0
+   { "vs9", 9 },
cd595c0
+ 
cd595c0
    { "xer", 1 },
cd595c0
  
cd595c0
  };
cd595c0
*************** parse_cpu (const char *arg)
cd595c0
*** 940,947 ****
cd595c0
    else if (strcmp (arg, "power7") == 0)
cd595c0
      {
cd595c0
        ppc_cpu = (PPC_OPCODE_PPC | PPC_OPCODE_CLASSIC
cd595c0
! 		 | PPC_OPCODE_64 | PPC_OPCODE_POWER4
cd595c0
! 		 | PPC_OPCODE_POWER5 | PPC_OPCODE_POWER6
cd595c0
  		 | PPC_OPCODE_ALTIVEC | PPC_OPCODE_VSX);
cd595c0
      }
cd595c0
    else if (strcmp (arg, "cell") == 0)
cd595c0
--- 1136,1144 ----
cd595c0
    else if (strcmp (arg, "power7") == 0)
cd595c0
      {
cd595c0
        ppc_cpu = (PPC_OPCODE_PPC | PPC_OPCODE_CLASSIC
cd595c0
! 		 | PPC_OPCODE_ISEL | PPC_OPCODE_64
cd595c0
! 		 | PPC_OPCODE_POWER4 | PPC_OPCODE_POWER5
cd595c0
! 		 | PPC_OPCODE_POWER6 | PPC_OPCODE_POWER7
cd595c0
  		 | PPC_OPCODE_ALTIVEC | PPC_OPCODE_VSX);
cd595c0
      }
cd595c0
    else if (strcmp (arg, "cell") == 0)
cd595c0
*************** md_assemble (char *str)
cd595c0
*** 2768,2777 ****
cd595c0
  
cd595c0
  #ifdef OBJ_ELF
cd595c0
    /* Do we need/want a APUinfo section? */
cd595c0
!   if (ppc_cpu & (PPC_OPCODE_SPE
cd595c0
!    	       | PPC_OPCODE_ISEL | PPC_OPCODE_EFS
cd595c0
! 	       | PPC_OPCODE_BRLOCK | PPC_OPCODE_PMR | PPC_OPCODE_CACHELCK
cd595c0
! 	       | PPC_OPCODE_RFMCI))
cd595c0
      {
cd595c0
        /* These are all version "1".  */
cd595c0
        if (opcode->flags & PPC_OPCODE_SPE)
cd595c0
--- 2965,2971 ----
cd595c0
  
cd595c0
  #ifdef OBJ_ELF
cd595c0
    /* Do we need/want a APUinfo section? */
cd595c0
!   if ((ppc_cpu & PPC_OPCODE_E500MC) != 0)
cd595c0
      {
cd595c0
        /* These are all version "1".  */
cd595c0
        if (opcode->flags & PPC_OPCODE_SPE)
cd595c0
diff -rcp ../binutils-2.19.51.0.2.15/gas/testsuite/gas/ppc/booke.d ./gas/testsuite/gas/ppc/booke.d
cd595c0
*** ../binutils-2.19.51.0.2.15/gas/testsuite/gas/ppc/booke.d	2009-03-02 14:05:01.000000000 +0000
cd595c0
--- ./gas/testsuite/gas/ppc/booke.d	2009-03-05 12:20:26.000000000 +0000
cd595c0
*************** Disassembly of section \.text:
cd595c0
*** 38,40 ****
cd595c0
--- 38,43 ----
cd595c0
    68:	7c 07 42 a6 	mfsprg  r0,7
cd595c0
    6c:	7c 17 43 a6 	mtsprg  7,r0
cd595c0
    70:	7c 17 43 a6 	mtsprg  7,r0
cd595c0
+   74:	7c 05 32 2c 	dcbt    r5,r6
cd595c0
+   78:	7c 05 32 2c 	dcbt    r5,r6
cd595c0
+   7c:	7d 05 32 2c 	dcbt    8,r5,r6
cd595c0
diff -rcp ../binutils-2.19.51.0.2.15/gas/testsuite/gas/ppc/booke.s ./gas/testsuite/gas/ppc/booke.s
cd595c0
*** ../binutils-2.19.51.0.2.15/gas/testsuite/gas/ppc/booke.s	2009-03-02 14:05:01.000000000 +0000
cd595c0
--- ./gas/testsuite/gas/ppc/booke.s	2009-03-05 12:20:26.000000000 +0000
cd595c0
*************** branch_target_2:	
cd595c0
*** 36,38 ****
cd595c0
--- 36,42 ----
cd595c0
  	mfsprg7 0
cd595c0
  	mtsprg 7, 0
cd595c0
  	mtsprg7 0
cd595c0
+ 
cd595c0
+ 	dcbt 5,6
cd595c0
+ 	dcbt 0,5,6
cd595c0
+ 	dcbt 8,5,6
cd595c0
diff -rcp ../binutils-2.19.51.0.2.15/gas/testsuite/gas/ppc/e500mc.d ./gas/testsuite/gas/ppc/e500mc.d
cd595c0
*** ../binutils-2.19.51.0.2.15/gas/testsuite/gas/ppc/e500mc.d	2009-03-02 14:05:01.000000000 +0000
cd595c0
--- ./gas/testsuite/gas/ppc/e500mc.d	2009-03-05 12:20:26.000000000 +0000
cd595c0
***************
cd595c0
*** 6,12 ****
cd595c0
  
cd595c0
  Disassembly of section \.text:
cd595c0
  
cd595c0
! 0+0000000 <start>:
cd595c0
     0:	4c 00 00 4e 	rfdi
cd595c0
     4:	4c 00 00 cc 	rfgi
cd595c0
     8:	4c 1f f9 8c 	dnh     0,1023
cd595c0
--- 6,12 ----
cd595c0
  
cd595c0
  Disassembly of section \.text:
cd595c0
  
cd595c0
! 0+00 <start>:
cd595c0
     0:	4c 00 00 4e 	rfdi
cd595c0
     4:	4c 00 00 cc 	rfgi
cd595c0
     8:	4c 1f f9 8c 	dnh     0,1023
cd595c0
*************** Disassembly of section \.text:
cd595c0
*** 14,51 ****
cd595c0
    10:	7c 09 57 be 	icbiep  r9,r10
cd595c0
    14:	7c 00 69 dc 	msgclr  r13
cd595c0
    18:	7c 00 71 9c 	msgsnd  r14
cd595c0
!   1c:	7c 00 00 7c 	wait
cd595c0
!   20:	7f 9c e3 78 	mdors
cd595c0
!   24:	7c 00 02 1c 	ehpriv
cd595c0
!   28:	7c 18 cb c6 	dsn     r24,r25
cd595c0
!   2c:	7c 22 18 be 	lbepx   r1,r2,r3
cd595c0
!   30:	7c 85 32 3e 	lhepx   r4,r5,r6
cd595c0
!   34:	7c e8 48 3e 	lwepx   r7,r8,r9
cd595c0
!   38:	7d 4b 60 3a 	ldepx   r10,r11,r12
cd595c0
!   3c:	7d ae 7c be 	lfdepx  r13,r14,r15
cd595c0
!   40:	7e 11 91 be 	stbepx  r16,r17,r18
cd595c0
!   44:	7e 74 ab 3e 	sthepx  r19,r20,r21
cd595c0
!   48:	7e d7 c1 3e 	stwepx  r22,r23,r24
cd595c0
!   4c:	7f 3a d9 3a 	stdepx  r25,r26,r27
cd595c0
!   50:	7f 9d f5 be 	stfdepx r28,r29,r30
cd595c0
!   54:	7c 01 14 06 	lbdx    r0,r1,r2
cd595c0
!   58:	7d 8d 74 46 	lhdx    r12,r13,r14
cd595c0
!   5c:	7c 64 2c 86 	lwdx    r3,r4,r5
cd595c0
!   60:	7f 5b e6 46 	lfddx   f26,r27,r28
cd595c0
!   64:	7d f0 8c c6 	lddx    r15,r16,r17
cd595c0
!   68:	7c c7 45 06 	stbdx   r6,r7,r8
cd595c0
!   6c:	7e 53 a5 46 	sthdx   r18,r19,r20
cd595c0
!   70:	7d 2a 5d 86 	stwdx   r9,r10,r11
cd595c0
!   74:	7f be ff 46 	stfddx  f29,r30,r31
cd595c0
!   78:	7e b6 bd c6 	stddx   r21,r22,r23
cd595c0
!   7c:	7c 20 0d ec 	dcbal   r0,r1
cd595c0
!   80:	7c 26 3f ec 	dcbzl   r6,r7
cd595c0
!   84:	7c 1f 00 7e 	dcbstep r31,r0
cd595c0
!   88:	7c 01 10 fe 	dcbfep  r1,r2
cd595c0
!   8c:	7c 64 29 fe 	dcbtstep r3,r4,r5
cd595c0
!   90:	7c c7 42 7e 	dcbtep  r6,r7,r8
cd595c0
!   94:	7c 0b 67 fe 	dcbzep  r11,r12
cd595c0
!   98:	7c 00 06 26 	tlbilx  0,0,r0
cd595c0
!   9c:	7c 20 06 26 	tlbilx  1,0,r0
cd595c0
!   a0:	7c 62 1e 26 	tlbilx  3,r2,r3
cd595c0
!   a4:	7c 64 2e 26 	tlbilx  3,r4,r5
cd595c0
--- 14,56 ----
cd595c0
    10:	7c 09 57 be 	icbiep  r9,r10
cd595c0
    14:	7c 00 69 dc 	msgclr  r13
cd595c0
    18:	7c 00 71 9c 	msgsnd  r14
cd595c0
!   1c:	7c 00 00 7c 	wait    
cd595c0
!   20:	7c 00 00 7c 	wait    
cd595c0
!   24:	7c 20 00 7c 	waitrsv
cd595c0
!   28:	7c 20 00 7c 	waitrsv
cd595c0
!   2c:	7c 40 00 7c 	waitimpl
cd595c0
!   30:	7c 40 00 7c 	waitimpl
cd595c0
!   34:	7f 9c e3 78 	mdors
cd595c0
!   38:	7c 00 02 1c 	ehpriv
cd595c0
!   3c:	7c 18 cb c6 	dsn     r24,r25
cd595c0
!   40:	7c 22 18 be 	lbepx   r1,r2,r3
cd595c0
!   44:	7c 85 32 3e 	lhepx   r4,r5,r6
cd595c0
!   48:	7c e8 48 3e 	lwepx   r7,r8,r9
cd595c0
!   4c:	7d 4b 60 3a 	ldepx   r10,r11,r12
cd595c0
!   50:	7d ae 7c be 	lfdepx  f13,r14,r15
cd595c0
!   54:	7e 11 91 be 	stbepx  r16,r17,r18
cd595c0
!   58:	7e 74 ab 3e 	sthepx  r19,r20,r21
cd595c0
!   5c:	7e d7 c1 3e 	stwepx  r22,r23,r24
cd595c0
!   60:	7f 3a d9 3a 	stdepx  r25,r26,r27
cd595c0
!   64:	7f 9d f5 be 	stfdepx f28,r29,r30
cd595c0
!   68:	7c 01 14 06 	lbdx    r0,r1,r2
cd595c0
!   6c:	7d 8d 74 46 	lhdx    r12,r13,r14
cd595c0
!   70:	7c 64 2c 86 	lwdx    r3,r4,r5
cd595c0
!   74:	7f 5b e6 46 	lfddx   f26,r27,r28
cd595c0
!   78:	7d f0 8c c6 	lddx    r15,r16,r17
cd595c0
!   7c:	7c c7 45 06 	stbdx   r6,r7,r8
cd595c0
!   80:	7e 53 a5 46 	sthdx   r18,r19,r20
cd595c0
!   84:	7d 2a 5d 86 	stwdx   r9,r10,r11
cd595c0
!   88:	7f be ff 46 	stfddx  f29,r30,r31
cd595c0
!   8c:	7e b6 bd c6 	stddx   r21,r22,r23
cd595c0
!   90:	7c 20 0d ec 	dcbal   r0,r1
cd595c0
!   94:	7c 26 3f ec 	dcbzl   r6,r7
cd595c0
!   98:	7c 1f 00 7e 	dcbstep r31,r0
cd595c0
!   9c:	7c 01 10 fe 	dcbfep  r1,r2
cd595c0
!   a0:	7c 64 29 fe 	dcbtstep r3,r4,r5
cd595c0
!   a4:	7c c7 42 7e 	dcbtep  r6,r7,r8
cd595c0
!   a8:	7c 0b 67 fe 	dcbzep  r11,r12
cd595c0
!   ac:	7c 00 06 26 	tlbilx  0,0,r0
cd595c0
!   b0:	7c 20 06 26 	tlbilx  1,0,r0
cd595c0
!   b4:	7c 62 1e 26 	tlbilx  3,r2,r3
cd595c0
!   b8:	7c 64 2e 26 	tlbilx  3,r4,r5
cd595c0
diff -rcp ../binutils-2.19.51.0.2.15/gas/testsuite/gas/ppc/e500mc.s ./gas/testsuite/gas/ppc/e500mc.s
cd595c0
*** ../binutils-2.19.51.0.2.15/gas/testsuite/gas/ppc/e500mc.s	2009-03-02 14:05:01.000000000 +0000
cd595c0
--- ./gas/testsuite/gas/ppc/e500mc.s	2009-03-05 12:20:26.000000000 +0000
cd595c0
*************** start:
cd595c0
*** 9,14 ****
cd595c0
--- 9,19 ----
cd595c0
  	msgclr	13
cd595c0
  	msgsnd	14
cd595c0
  	wait
cd595c0
+ 	wait 0
cd595c0
+ 	waitrsv
cd595c0
+ 	wait 1
cd595c0
+ 	waitimpl
cd595c0
+ 	wait 2
cd595c0
  	mdors
cd595c0
  	ehpriv
cd595c0
  	dsn	24, 25
cd595c0
diff -rcp ../binutils-2.19.51.0.2.15/gas/testsuite/gas/ppc/power4_32.d ./gas/testsuite/gas/ppc/power4_32.d
cd595c0
*** ../binutils-2.19.51.0.2.15/gas/testsuite/gas/ppc/power4_32.d	2009-03-02 14:05:01.000000000 +0000
cd595c0
--- ./gas/testsuite/gas/ppc/power4_32.d	2009-03-05 12:20:26.000000000 +0000
cd595c0
*************** Disassembly of section \.text:
cd595c0
*** 41,43 ****
cd595c0
--- 41,46 ----
cd595c0
    7c:	7c 01 17 ec 	dcbz    r1,r2
cd595c0
    80:	7c 23 27 ec 	dcbzl   r3,r4
cd595c0
    84:	7c 05 37 ec 	dcbz    r5,r6
cd595c0
+   88:	7c 05 32 2c 	dcbt    r5,r6
cd595c0
+   8c:	7c 05 32 2c 	dcbt    r5,r6
cd595c0
+   90:	7d 05 32 2c 	dcbt    r5,r6,8
cd595c0
diff -rcp ../binutils-2.19.51.0.2.15/gas/testsuite/gas/ppc/power4_32.s ./gas/testsuite/gas/ppc/power4_32.s
cd595c0
*** ../binutils-2.19.51.0.2.15/gas/testsuite/gas/ppc/power4_32.s	2009-03-02 14:05:01.000000000 +0000
cd595c0
--- ./gas/testsuite/gas/ppc/power4_32.s	2009-03-05 12:20:26.000000000 +0000
cd595c0
*************** start:
cd595c0
*** 34,36 ****
cd595c0
--- 34,39 ----
cd595c0
  	dcbz    1, 2
cd595c0
  	dcbzl   3, 4
cd595c0
  	dcbz    5, 6
cd595c0
+ 	dcbt    5,6
cd595c0
+ 	dcbt    5,6,0
cd595c0
+ 	dcbt    5,6,8
cd595c0
diff -rcp ../binutils-2.19.51.0.2.15/gas/testsuite/gas/ppc/power6.d ./gas/testsuite/gas/ppc/power6.d
cd595c0
*** ../binutils-2.19.51.0.2.15/gas/testsuite/gas/ppc/power6.d	2009-03-02 14:05:01.000000000 +0000
cd595c0
--- ./gas/testsuite/gas/ppc/power6.d	2009-03-05 12:20:26.000000000 +0000
cd595c0
*************** Disassembly of section \.text:
cd595c0
*** 66,68 ****
cd595c0
--- 66,71 ----
cd595c0
    e0:	ff 00 f1 0d 	mtfsfi. 6,15
cd595c0
    e4:	ff 01 01 0c 	mtfsfi  6,0,1
cd595c0
    e8:	ff 01 f1 0d 	mtfsfi. 6,15,1
cd595c0
+   ec:	7d 6a 02 74 	cbcdtd  r10,r11
cd595c0
+   f0:	7d 6a 02 34 	cdtbcd  r10,r11
cd595c0
+   f4:	7d 4b 60 94 	addg6s  r10,r11,r12
cd595c0
diff -rcp ../binutils-2.19.51.0.2.15/gas/testsuite/gas/ppc/power6.s ./gas/testsuite/gas/ppc/power6.s
cd595c0
*** ../binutils-2.19.51.0.2.15/gas/testsuite/gas/ppc/power6.s	2009-03-02 14:05:01.000000000 +0000
cd595c0
--- ./gas/testsuite/gas/ppc/power6.s	2009-03-05 12:20:26.000000000 +0000
cd595c0
*************** start:
cd595c0
*** 61,63 ****
cd595c0
--- 61,66 ----
cd595c0
  	mtfsfi. 6,15,0
cd595c0
  	mtfsfi  6,0,1
cd595c0
  	mtfsfi. 6,15,1
cd595c0
+ 	cbcdtd  10,11
cd595c0
+ 	cdtbcd  10,11
cd595c0
+ 	addg6s  10,11,12
cd595c0
diff -rcp ../binutils-2.19.51.0.2.15/gas/testsuite/gas/ppc/power7.d ./gas/testsuite/gas/ppc/power7.d
cd595c0
*** ../binutils-2.19.51.0.2.15/gas/testsuite/gas/ppc/power7.d	2009-03-02 14:05:01.000000000 +0000
cd595c0
--- ./gas/testsuite/gas/ppc/power7.d	2009-03-05 12:20:26.000000000 +0000
cd595c0
***************
cd595c0
*** 1,8 ****
cd595c0
! #as: -a32 -mpower7
cd595c0
  #objdump: -dr -Mpower7
cd595c0
  #name: POWER7 tests (includes DFP, Altivec and VSX)
cd595c0
  
cd595c0
! .*: +file format elf32-powerpc.*
cd595c0
  
cd595c0
  Disassembly of section \.text:
cd595c0
  
cd595c0
--- 1,8 ----
cd595c0
! #as: -mpower7
cd595c0
  #objdump: -dr -Mpower7
cd595c0
  #name: POWER7 tests (includes DFP, Altivec and VSX)
cd595c0
  
cd595c0
! .*: +file format elf(32)?(64)?-powerpc.*
cd595c0
  
cd595c0
  Disassembly of section \.text:
cd595c0
  
cd595c0
*************** Disassembly of section \.text:
cd595c0
*** 33,57 ****
cd595c0
    5c:	f1 6c 67 87 	xvmovdp vs43,vs44
cd595c0
    60:	f0 64 2f 80 	xvcpsgndp vs3,vs4,vs5
cd595c0
    64:	f1 6c 6f 87 	xvcpsgndp vs43,vs44,vs45
cd595c0
!   68:	4c 00 03 24 	doze
cd595c0
!   6c:	4c 00 03 64 	nap
cd595c0
!   70:	4c 00 03 a4 	sleep
cd595c0
!   74:	4c 00 03 e4 	rvwinkle
cd595c0
!   78:	7c 83 01 34 	prtyw   r3,r4
cd595c0
!   7c:	7d cd 01 74 	prtyd   r13,r14
cd595c0
!   80:	7d 5c 02 a6 	mfcfar  r10
cd595c0
!   84:	7d 7c 03 a6 	mtcfar  r11
cd595c0
!   88:	7c 83 2b f8 	cmpb    r3,r4,r5
cd595c0
!   8c:	7c c0 3c be 	mffgpr  f6,r7
cd595c0
!   90:	7d 00 4d be 	mftgpr  r8,f9
cd595c0
!   94:	7d 4b 66 2a 	lwzcix  r10,r11,r12
cd595c0
!   98:	7d ae 7e 2e 	lfdpx   f13,r14,r15
cd595c0
!   9c:	ee 11 90 04 	dadd    f16,f17,f18
cd595c0
!   a0:	fe 96 c0 04 	daddq   f20,f22,f24
cd595c0
!   a4:	7c 60 06 6c 	dss     3
cd595c0
!   a8:	7e 00 06 6c 	dssall
cd595c0
!   ac:	7c 25 22 ac 	dst     r5,r4,1
cd595c0
!   b0:	7e 08 3a ac 	dstt    r8,r7,0
cd595c0
!   b4:	7c 65 32 ec 	dstst   r5,r6,3
cd595c0
!   b8:	7e 44 2a ec 	dststt  r4,r5,2
cd595c0
!   bc:	4e 80 00 20 	blr
cd595c0
--- 33,113 ----
cd595c0
    5c:	f1 6c 67 87 	xvmovdp vs43,vs44
cd595c0
    60:	f0 64 2f 80 	xvcpsgndp vs3,vs4,vs5
cd595c0
    64:	f1 6c 6f 87 	xvcpsgndp vs43,vs44,vs45
cd595c0
!   68:	7c 00 00 7c 	wait    
cd595c0
!   6c:	7c 00 00 7c 	wait    
cd595c0
!   70:	7c 20 00 7c 	waitrsv
cd595c0
!   74:	7c 20 00 7c 	waitrsv
cd595c0
!   78:	7c 40 00 7c 	waitimpl
cd595c0
!   7c:	7c 40 00 7c 	waitimpl
cd595c0
!   80:	4c 00 03 24 	doze
cd595c0
!   84:	4c 00 03 64 	nap
cd595c0
!   88:	4c 00 03 a4 	sleep
cd595c0
!   8c:	4c 00 03 e4 	rvwinkle
cd595c0
!   90:	7c 83 01 34 	prtyw   r3,r4
cd595c0
!   94:	7d cd 01 74 	prtyd   r13,r14
cd595c0
!   98:	7d 5c 02 a6 	mfcfar  r10
cd595c0
!   9c:	7d 7c 03 a6 	mtcfar  r11
cd595c0
!   a0:	7c 83 2b f8 	cmpb    r3,r4,r5
cd595c0
!   a4:	7d 4b 66 2a 	lwzcix  r10,r11,r12
cd595c0
!   a8:	ee 11 90 04 	dadd    f16,f17,f18
cd595c0
!   ac:	fe 96 c0 04 	daddq   f20,f22,f24
cd595c0
!   b0:	7c 60 06 6c 	dss     3
cd595c0
!   b4:	7e 00 06 6c 	dssall
cd595c0
!   b8:	7c 25 22 ac 	dst     r5,r4,1
cd595c0
!   bc:	7e 08 3a ac 	dstt    r8,r7,0
cd595c0
!   c0:	7c 65 32 ec 	dstst   r5,r6,3
cd595c0
!   c4:	7e 44 2a ec 	dststt  r4,r5,2
cd595c0
!   c8:	7d 4b 63 56 	divwe   r10,r11,r12
cd595c0
!   cc:	7d 6c 6b 57 	divwe\.  r11,r12,r13
cd595c0
!   d0:	7d 8d 77 56 	divweo  r12,r13,r14
cd595c0
!   d4:	7d ae 7f 57 	divweo\. r13,r14,r15
cd595c0
!   d8:	7d 4b 63 16 	divweu  r10,r11,r12
cd595c0
!   dc:	7d 6c 6b 17 	divweu\. r11,r12,r13
cd595c0
!   e0:	7d 8d 77 16 	divweuo r12,r13,r14
cd595c0
!   e4:	7d ae 7f 17 	divweuo\. r13,r14,r15
cd595c0
!   e8:	7e 27 d9 f8 	bpermd  r7,r17,r27
cd595c0
!   ec:	7e 8a 02 f4 	popcntw r10,r20
cd595c0
!   f0:	7e 8a 03 f4 	popcntd r10,r20
cd595c0
!   f4:	7e 95 b4 28 	ldbrx   r20,r21,r22
cd595c0
!   f8:	7e 95 b5 28 	stdbrx  r20,r21,r22
cd595c0
!   fc:	7d 40 56 ee 	lfiwzx  f10,0,r10
cd595c0
!  100:	7d 49 56 ee 	lfiwzx  f10,r9,r10
cd595c0
!  104:	ec 80 2e 9c 	fcfids  f4,f5
cd595c0
!  108:	ec 80 2e 9d 	fcfids\. f4,f5
cd595c0
!  10c:	ec 80 2f 9c 	fcfidus f4,f5
cd595c0
!  110:	ec 80 2f 9d 	fcfidus\. f4,f5
cd595c0
!  114:	fc 80 29 1c 	fctiwu  f4,f5
cd595c0
!  118:	fc 80 29 1d 	fctiwu\. f4,f5
cd595c0
!  11c:	fc 80 29 1e 	fctiwuz f4,f5
cd595c0
!  120:	fc 80 29 1f 	fctiwuz\. f4,f5
cd595c0
!  124:	fc 80 2f 5c 	fctidu  f4,f5
cd595c0
!  128:	fc 80 2f 5d 	fctidu\. f4,f5
cd595c0
!  12c:	fc 80 2f 5e 	fctiduz f4,f5
cd595c0
!  130:	fc 80 2f 5f 	fctiduz\. f4,f5
cd595c0
!  134:	fc 80 2f 9c 	fcfidu  f4,f5
cd595c0
!  138:	fc 80 2f 9d 	fcfidu\. f4,f5
cd595c0
!  13c:	fc 0a 59 00 	ftdiv   cr0,f10,f11
cd595c0
!  140:	ff 8a 59 00 	ftdiv   cr7,f10,f11
cd595c0
!  144:	fc 00 51 40 	ftsqrt  cr0,f10
cd595c0
!  148:	ff 80 51 40 	ftsqrt  cr7,f10
cd595c0
!  14c:	7e 08 4a 2c 	dcbtt   r8,r9
cd595c0
!  150:	7e 08 49 ec 	dcbtstt r8,r9
cd595c0
!  154:	ed 40 66 44 	dcffix  f10,f12
cd595c0
!  158:	ee 80 b6 45 	dcffix\. f20,f22
cd595c0
!  15c:	7d 4b 60 68 	lbarx   r10,r11,r12
cd595c0
!  160:	7d 4b 60 68 	lbarx   r10,r11,r12
cd595c0
!  164:	7d 4b 60 69 	lbarx   r10,r11,r12,1
cd595c0
!  168:	7e 95 b0 e8 	lharx   r20,r21,r22
cd595c0
!  16c:	7e 95 b0 e8 	lharx   r20,r21,r22
cd595c0
!  170:	7e 95 b0 e9 	lharx   r20,r21,r22,1
cd595c0
!  174:	7d 4b 65 6d 	stbcx\.  r10,r11,r12
cd595c0
!  178:	7d 4b 65 ad 	sthcx\.  r10,r11,r12
cd595c0
!  17c:	fd c0 78 30 	fre     f14,f15
cd595c0
!  180:	fd c0 78 31 	fre\.    f14,f15
cd595c0
!  184:	ed c0 78 30 	fres    f14,f15
cd595c0
!  188:	ed c0 78 31 	fres\.   f14,f15
cd595c0
!  18c:	fd c0 78 34 	frsqrte f14,f15
cd595c0
!  190:	fd c0 78 35 	frsqrte\. f14,f15
cd595c0
!  194:	ed c0 78 34 	frsqrtes f14,f15
cd595c0
!  198:	ed c0 78 35 	frsqrtes\. f14,f15
cd595c0
!  19c:	7c 43 27 1e 	isel    r2,r3,r4,28
cd595c0
diff -rcp ../binutils-2.19.51.0.2.15/gas/testsuite/gas/ppc/power7.s ./gas/testsuite/gas/ppc/power7.s
cd595c0
*** ../binutils-2.19.51.0.2.15/gas/testsuite/gas/ppc/power7.s	2009-03-02 14:05:01.000000000 +0000
cd595c0
--- ./gas/testsuite/gas/ppc/power7.s	2009-03-05 12:20:26.000000000 +0000
cd595c0
***************
cd595c0
*** 1,9 ****
cd595c0
- 	.file	"power7.c"
cd595c0
  	.section	".text"
cd595c0
- 	.align 2
cd595c0
- 	.p2align 4,,15
cd595c0
- 	.globl power7
cd595c0
- 	.type	power7, @function
cd595c0
  power7:
cd595c0
  	lxvd2x    3,4,5
cd595c0
  	lxvd2ux   3,4,5
cd595c0
--- 1,4 ----
cd595c0
*************** power7:
cd595c0
*** 31,36 ****
cd595c0
--- 26,37 ----
cd595c0
  	xvcpsgndp 43,44,44
cd595c0
  	xvcpsgndp 3,4,5
cd595c0
  	xvcpsgndp 43,44,45
cd595c0
+ 	wait
cd595c0
+ 	wait 0
cd595c0
+ 	waitrsv
cd595c0
+ 	wait 1
cd595c0
+ 	waitimpl
cd595c0
+ 	wait 2
cd595c0
  	doze
cd595c0
  	nap
cd595c0
  	sleep
cd595c0
*************** power7:
cd595c0
*** 40,49 ****
cd595c0
  	mfcfar    10
cd595c0
  	mtcfar    11
cd595c0
  	cmpb      3,4,5
cd595c0
- 	mffgpr    6,7
cd595c0
- 	mftgpr    8,9
cd595c0
  	lwzcix    10,11,12
cd595c0
- 	lfdpx     13,14,15
cd595c0
  	dadd      16,17,18
cd595c0
  	daddq     20,22,24
cd595c0
  	dss       3
cd595c0
--- 41,47 ----
cd595c0
*************** power7:
cd595c0
*** 52,58 ****
cd595c0
  	dstt      8,7,0
cd595c0
  	dstst     5,6,3
cd595c0
  	dststt    4,5,2
cd595c0
! 	blr
cd595c0
! 	.size	power7,.-power7
cd595c0
! 	.ident	"GCC: (GNU) 4.1.2 20070115 (prerelease) (SUSE Linux)"
cd595c0
! 	.section	.note.GNU-stack,"",@progbits
cd595c0
--- 50,106 ----
cd595c0
  	dstt      8,7,0
cd595c0
  	dstst     5,6,3
cd595c0
  	dststt    4,5,2
cd595c0
! 	divwe	  10,11,12
cd595c0
! 	divwe.	  11,12,13
cd595c0
! 	divweo	  12,13,14
cd595c0
! 	divweo.	  13,14,15
cd595c0
! 	divweu	  10,11,12
cd595c0
! 	divweu.	  11,12,13
cd595c0
! 	divweuo	  12,13,14
cd595c0
! 	divweuo.  13,14,15
cd595c0
! 	bpermd    7,17,27
cd595c0
! 	popcntw   10,20
cd595c0
! 	popcntd   10,20
cd595c0
! 	ldbrx     20,21,22
cd595c0
! 	stdbrx    20,21,22
cd595c0
! 	lfiwzx	  10,0,10
cd595c0
! 	lfiwzx	  10,9,10
cd595c0
! 	fcfids    4,5
cd595c0
! 	fcfids.   4,5
cd595c0
! 	fcfidus   4,5
cd595c0
! 	fcfidus.  4,5
cd595c0
! 	fctiwu    4,5
cd595c0
! 	fctiwu.   4,5
cd595c0
! 	fctiwuz   4,5
cd595c0
! 	fctiwuz.  4,5
cd595c0
! 	fctidu    4,5
cd595c0
! 	fctidu.   4,5
cd595c0
! 	fctiduz   4,5
cd595c0
! 	fctiduz.  4,5
cd595c0
! 	fcfidu    4,5
cd595c0
! 	fcfidu.   4,5
cd595c0
! 	ftdiv     0,10,11
cd595c0
! 	ftdiv     7,10,11
cd595c0
! 	ftsqrt    0,10
cd595c0
! 	ftsqrt    7,10
cd595c0
! 	dcbtt     8,9
cd595c0
! 	dcbtstt   8,9
cd595c0
! 	dcffix    10,12
cd595c0
! 	dcffix.   20,22
cd595c0
! 	lbarx     10,11,12
cd595c0
! 	lbarx     10,11,12,0
cd595c0
! 	lbarx     10,11,12,1
cd595c0
! 	lharx     20,21,22
cd595c0
! 	lharx     20,21,22,0
cd595c0
! 	lharx     20,21,22,1
cd595c0
! 	stbcx.    10,11,12
cd595c0
! 	sthcx.    10,11,12
cd595c0
! 	fre       14,15
cd595c0
! 	fre.      14,15
cd595c0
! 	fres      14,15
cd595c0
! 	fres.     14,15
cd595c0
! 	frsqrte   14,15
cd595c0
! 	frsqrte.  14,15
cd595c0
! 	frsqrtes  14,15
cd595c0
! 	frsqrtes. 14,15
cd595c0
! 	isel	  2,3,4,28
cd595c0
diff -rcp ../binutils-2.19.51.0.2.15/gas/testsuite/gas/ppc/ppc.exp ./gas/testsuite/gas/ppc/ppc.exp
cd595c0
*** ../binutils-2.19.51.0.2.15/gas/testsuite/gas/ppc/ppc.exp	2009-03-02 14:05:01.000000000 +0000
cd595c0
--- ./gas/testsuite/gas/ppc/ppc.exp	2009-03-05 12:20:26.000000000 +0000
cd595c0
*************** if { [istarget powerpc*-*-*] } then {
cd595c0
*** 47,51 ****
cd595c0
--- 47,52 ----
cd595c0
  	run_dump_test "power4_32"
cd595c0
  	run_dump_test "power6"
cd595c0
  	run_dump_test "power7"
cd595c0
+ 	run_dump_test "vsx"
cd595c0
      }
cd595c0
  }
cd595c0
Only in ./gas/testsuite/gas/ppc: vsx.d
cd595c0
Only in ./gas/testsuite/gas/ppc: vsx.s
cd595c0
diff -rcp ../binutils-2.19.51.0.2.15/include/opcode/ppc.h ./include/opcode/ppc.h
cd595c0
*** ../binutils-2.19.51.0.2.15/include/opcode/ppc.h	2009-03-02 14:04:52.000000000 +0000
cd595c0
--- ./include/opcode/ppc.h	2009-03-05 12:20:26.000000000 +0000
cd595c0
*************** extern const int powerpc_num_opcodes;
cd595c0
*** 114,119 ****
cd595c0
--- 114,122 ----
cd595c0
  /* Opcode is only supported by Power4 architecture.  */
cd595c0
  #define PPC_OPCODE_POWER4	    0x4000
cd595c0
  
cd595c0
+ /* Opcode is only supported by Power7 architecture.  */
cd595c0
+ #define PPC_OPCODE_POWER7	    0x8000
cd595c0
+ 
cd595c0
  /* Opcode is only supported by POWERPC Classic architecture.  */
cd595c0
  #define PPC_OPCODE_CLASSIC	   0x10000
cd595c0
  
cd595c0
diff -rcp ../binutils-2.19.51.0.2.15/ld/emultempl/beos.em ./ld/emultempl/beos.em
cd595c0
*** ../binutils-2.19.51.0.2.15/ld/emultempl/beos.em	2009-03-02 14:04:53.000000000 +0000
cd595c0
--- ./ld/emultempl/beos.em	2009-03-05 12:20:26.000000000 +0000
cd595c0
*************** fi
cd595c0
*** 8,14 ****
cd595c0
  fragment <
cd595c0
  /* This file is part of GLD, the Gnu Linker.
cd595c0
     Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
cd595c0
!    2005, 2006, 2007, 2008 Free Software Foundation, Inc.
cd595c0
  
cd595c0
     This file is part of the GNU Binutils.
cd595c0
  
cd595c0
--- 8,14 ----
cd595c0
  fragment <
cd595c0
  /* This file is part of GLD, the Gnu Linker.
cd595c0
     Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
cd595c0
!    2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
cd595c0
  
cd595c0
     This file is part of the GNU Binutils.
cd595c0
  
cd595c0
*************** gld_${EMULATION_NAME}_set_symbols (void)
cd595c0
*** 330,336 ****
cd595c0
    /* Run through and invent symbols for all the
cd595c0
       names and insert the defaults. */
cd595c0
    int j;
cd595c0
-   lang_statement_list_type *save;
cd595c0
  
cd595c0
    if (!init[IMAGEBASEOFF].inited)
cd595c0
      {
cd595c0
--- 330,335 ----
cd595c0
*************** gld_${EMULATION_NAME}_set_symbols (void)
cd595c0
*** 347,355 ****
cd595c0
      return;
cd595c0
  
cd595c0
    /* Glue the assignments into the abs section */
cd595c0
!   save = stat_ptr;
cd595c0
! 
cd595c0
!   stat_ptr = &(abs_output_section->children);
cd595c0
  
cd595c0
    for (j = 0; init[j].ptr; j++)
cd595c0
      {
cd595c0
--- 346,352 ----
cd595c0
      return;
cd595c0
  
cd595c0
    /* Glue the assignments into the abs section */
cd595c0
!   push_stat_ptr (&abs_output_section->children);
cd595c0
  
cd595c0
    for (j = 0; init[j].ptr; j++)
cd595c0
      {
cd595c0
*************** gld_${EMULATION_NAME}_set_symbols (void)
cd595c0
*** 367,373 ****
cd595c0
        else	abort();
cd595c0
      }
cd595c0
    /* Restore the pointer. */
cd595c0
!   stat_ptr = save;
cd595c0
  
cd595c0
    if (pe.FileAlignment >
cd595c0
        pe.SectionAlignment)
cd595c0
--- 364,370 ----
cd595c0
        else	abort();
cd595c0
      }
cd595c0
    /* Restore the pointer. */
cd595c0
!   pop_stat_ptr ();
cd595c0
  
cd595c0
    if (pe.FileAlignment >
cd595c0
        pe.SectionAlignment)
cd595c0
*************** sort_sections (lang_statement_union_type
cd595c0
*** 609,616 ****
cd595c0
  static void
cd595c0
  gld_${EMULATION_NAME}_before_allocation (void)
cd595c0
  {
cd595c0
-   extern lang_statement_list_type *stat_ptr;
cd595c0
- 
cd595c0
  #ifdef TARGET_IS_ppcpe
cd595c0
    /* Here we rummage through the found bfds to collect toc information */
cd595c0
    {
cd595c0
--- 606,611 ----
cd595c0
diff -rcp ../binutils-2.19.51.0.2.15/ld/emultempl/pe.em ./ld/emultempl/pe.em
cd595c0
*** ../binutils-2.19.51.0.2.15/ld/emultempl/pe.em	2009-03-02 14:04:53.000000000 +0000
cd595c0
--- ./ld/emultempl/pe.em	2009-03-05 12:20:26.000000000 +0000
cd595c0
*************** rm -f e${EMULATION_NAME}.c
cd595c0
*** 10,16 ****
cd595c0
  (echo;echo;echo;echo;echo)>e${EMULATION_NAME}.c # there, now line numbers match ;-)
cd595c0
  fragment <
cd595c0
  /* Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
cd595c0
!    2005, 2006, 2007, 2008 Free Software Foundation, Inc.
cd595c0
  
cd595c0
     This file is part of the GNU Binutils.
cd595c0
  
cd595c0
--- 10,16 ----
cd595c0
  (echo;echo;echo;echo;echo)>e${EMULATION_NAME}.c # there, now line numbers match ;-)
cd595c0
  fragment <
cd595c0
  /* Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
cd595c0
!    2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
cd595c0
  
cd595c0
     This file is part of the GNU Binutils.
cd595c0
  
cd595c0
*************** gld_${EMULATION_NAME}_set_symbols (void)
cd595c0
*** 725,731 ****
cd595c0
    /* Run through and invent symbols for all the
cd595c0
       names and insert the defaults.  */
cd595c0
    int j;
cd595c0
-   lang_statement_list_type *save;
cd595c0
  
cd595c0
    if (!init[IMAGEBASEOFF].inited)
cd595c0
      {
cd595c0
--- 725,730 ----
cd595c0
*************** gld_${EMULATION_NAME}_set_symbols (void)
cd595c0
*** 748,756 ****
cd595c0
      return;
cd595c0
  
cd595c0
    /* Glue the assignments into the abs section.  */
cd595c0
!   save = stat_ptr;
cd595c0
! 
cd595c0
!   stat_ptr = &(abs_output_section->children);
cd595c0
  
cd595c0
    for (j = 0; init[j].ptr; j++)
cd595c0
      {
cd595c0
--- 747,753 ----
cd595c0
      return;
cd595c0
  
cd595c0
    /* Glue the assignments into the abs section.  */
cd595c0
!   push_stat_ptr (&abs_output_section->children);
cd595c0
  
cd595c0
    for (j = 0; init[j].ptr; j++)
cd595c0
      {
cd595c0
*************** gld_${EMULATION_NAME}_set_symbols (void)
cd595c0
*** 772,778 ****
cd595c0
  	image_base_statement = rv;
cd595c0
      }
cd595c0
    /* Restore the pointer.  */
cd595c0
!   stat_ptr = save;
cd595c0
  
cd595c0
    if (pe.FileAlignment >
cd595c0
        pe.SectionAlignment)
cd595c0
--- 769,775 ----
cd595c0
  	image_base_statement = rv;
cd595c0
      }
cd595c0
    /* Restore the pointer.  */
cd595c0
!   pop_stat_ptr ();
cd595c0
  
cd595c0
    if (pe.FileAlignment >
cd595c0
        pe.SectionAlignment)
cd595c0
diff -rcp ../binutils-2.19.51.0.2.15/ld/emultempl/pep.em ./ld/emultempl/pep.em
cd595c0
*** ../binutils-2.19.51.0.2.15/ld/emultempl/pep.em	2009-03-02 14:04:53.000000000 +0000
cd595c0
--- ./ld/emultempl/pep.em	2009-03-05 12:20:26.000000000 +0000
cd595c0
*************** fi
cd595c0
*** 9,15 ****
cd595c0
  rm -f e${EMULATION_NAME}.c
cd595c0
  (echo;echo;echo;echo;echo)>e${EMULATION_NAME}.c # there, now line numbers match ;-)
cd595c0
  fragment <
cd595c0
! /* Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
cd595c0
     Written by Kai Tietz, OneVision Software GmbH&CoKg.
cd595c0
  
cd595c0
     This file is part of the GNU Binutils.
cd595c0
--- 9,15 ----
cd595c0
  rm -f e${EMULATION_NAME}.c
cd595c0
  (echo;echo;echo;echo;echo)>e${EMULATION_NAME}.c # there, now line numbers match ;-)
cd595c0
  fragment <
cd595c0
! /* Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
cd595c0
     Written by Kai Tietz, OneVision Software GmbH&CoKg.
cd595c0
  
cd595c0
     This file is part of the GNU Binutils.
cd595c0
*************** gld_${EMULATION_NAME}_set_symbols (void)
cd595c0
*** 681,687 ****
cd595c0
    /* Run through and invent symbols for all the
cd595c0
       names and insert the defaults.  */
cd595c0
    int j;
cd595c0
-   lang_statement_list_type *save;
cd595c0
  
cd595c0
    if (!init[IMAGEBASEOFF].inited)
cd595c0
      {
cd595c0
--- 681,686 ----
cd595c0
*************** gld_${EMULATION_NAME}_set_symbols (void)
cd595c0
*** 704,712 ****
cd595c0
      return;
cd595c0
  
cd595c0
    /* Glue the assignments into the abs section.  */
cd595c0
!   save = stat_ptr;
cd595c0
! 
cd595c0
!   stat_ptr = &(abs_output_section->children);
cd595c0
  
cd595c0
    for (j = 0; init[j].ptr; j++)
cd595c0
      {
cd595c0
--- 703,709 ----
cd595c0
      return;
cd595c0
  
cd595c0
    /* Glue the assignments into the abs section.  */
cd595c0
!   push_stat_ptr (&abs_output_section->children);
cd595c0
  
cd595c0
    for (j = 0; init[j].ptr; j++)
cd595c0
      {
cd595c0
*************** gld_${EMULATION_NAME}_set_symbols (void)
cd595c0
*** 728,734 ****
cd595c0
  	image_base_statement = rv;
cd595c0
      }
cd595c0
    /* Restore the pointer.  */
cd595c0
!   stat_ptr = save;
cd595c0
  
cd595c0
    if (pep.FileAlignment > pep.SectionAlignment)
cd595c0
      {
cd595c0
--- 725,731 ----
cd595c0
  	image_base_statement = rv;
cd595c0
      }
cd595c0
    /* Restore the pointer.  */
cd595c0
!   pop_stat_ptr ();
cd595c0
  
cd595c0
    if (pep.FileAlignment > pep.SectionAlignment)
cd595c0
      {
cd595c0
diff -rcp ../binutils-2.19.51.0.2.15/ld/emultempl/xtensaelf.em ./ld/emultempl/xtensaelf.em
cd595c0
*** ../binutils-2.19.51.0.2.15/ld/emultempl/xtensaelf.em	2009-03-02 14:04:53.000000000 +0000
cd595c0
--- ./ld/emultempl/xtensaelf.em	2009-03-05 12:20:26.000000000 +0000
cd595c0
***************
cd595c0
*** 1,5 ****
cd595c0
  # This shell script emits a C file. -*- C -*-
cd595c0
! #   Copyright 2003, 2004, 2005, 2006, 2007, 2008
cd595c0
  #   Free Software Foundation, Inc.
cd595c0
  #
cd595c0
  # This file is part of the GNU Binutils.
cd595c0
--- 1,5 ----
cd595c0
  # This shell script emits a C file. -*- C -*-
cd595c0
! #   Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009
cd595c0
  #   Free Software Foundation, Inc.
cd595c0
  #
cd595c0
  # This file is part of the GNU Binutils.
cd595c0
*************** ld_xtensa_insert_page_offsets (bfd_vma d
cd595c0
*** 1951,1970 ****
cd595c0
  		lang_assignment_statement_type *assign_stmt;
cd595c0
  		lang_statement_union_type *assign_union;
cd595c0
  		lang_statement_list_type tmplist;
cd595c0
- 		lang_statement_list_type *old_stat_ptr = stat_ptr;
cd595c0
  
cd595c0
  		/* There is hidden state in "lang_add_assignment".  It
cd595c0
  		   appends the new assignment statement to the stat_ptr
cd595c0
  		   list.  Thus, we swap it before and after the call.  */
cd595c0
  
cd595c0
! 		tmplist.head = NULL;
cd595c0
! 		tmplist.tail = &tmplist.head;
cd595c0
! 
cd595c0
! 		stat_ptr = &tmplist;
cd595c0
  		/* Warning: side effect; statement appended to stat_ptr.  */
cd595c0
  		assign_stmt = lang_add_assignment (assign_op);
cd595c0
  		assign_union = (lang_statement_union_type *) assign_stmt;
cd595c0
! 		stat_ptr = old_stat_ptr;
cd595c0
  
cd595c0
  		assign_union->header.next = l;
cd595c0
  		*(*stack_p)->iterloc.loc = assign_union;
cd595c0
--- 1951,1967 ----
cd595c0
  		lang_assignment_statement_type *assign_stmt;
cd595c0
  		lang_statement_union_type *assign_union;
cd595c0
  		lang_statement_list_type tmplist;
cd595c0
  
cd595c0
  		/* There is hidden state in "lang_add_assignment".  It
cd595c0
  		   appends the new assignment statement to the stat_ptr
cd595c0
  		   list.  Thus, we swap it before and after the call.  */
cd595c0
  
cd595c0
! 		lang_list_init (&tmplist);
cd595c0
! 		push_stat_ptr (&tmplist);
cd595c0
  		/* Warning: side effect; statement appended to stat_ptr.  */
cd595c0
  		assign_stmt = lang_add_assignment (assign_op);
cd595c0
  		assign_union = (lang_statement_union_type *) assign_stmt;
cd595c0
! 		pop_stat_ptr ();
cd595c0
  
cd595c0
  		assign_union->header.next = l;
cd595c0
  		*(*stack_p)->iterloc.loc = assign_union;
cd595c0
diff -rcp ../binutils-2.19.51.0.2.15/ld/ldctor.c ./ld/ldctor.c
cd595c0
*** ../binutils-2.19.51.0.2.15/ld/ldctor.c	2009-03-02 14:04:56.000000000 +0000
cd595c0
--- ./ld/ldctor.c	2009-03-05 12:20:26.000000000 +0000
cd595c0
***************
cd595c0
*** 1,6 ****
cd595c0
  /* ldctor.c -- constructor support routines
cd595c0
     Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
cd595c0
!    2002, 2003, 2004, 2006, 2007, 2008 Free Software Foundation, Inc.
cd595c0
     By Steve Chamberlain <sac@cygnus.com>
cd595c0
  
cd595c0
     This file is part of the GNU Binutils.
cd595c0
--- 1,7 ----
cd595c0
  /* ldctor.c -- constructor support routines
cd595c0
     Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
cd595c0
!    2002, 2003, 2004, 2006, 2007, 2008, 2009
cd595c0
!    Free Software Foundation, Inc.
cd595c0
     By Steve Chamberlain <sac@cygnus.com>
cd595c0
  
cd595c0
     This file is part of the GNU Binutils.
cd595c0
*************** void
cd595c0
*** 198,204 ****
cd595c0
  ldctor_build_sets (void)
cd595c0
  {
cd595c0
    static bfd_boolean called;
cd595c0
-   lang_statement_list_type *old;
cd595c0
    bfd_boolean header_printed;
cd595c0
    struct set_info *p;
cd595c0
  
cd595c0
--- 199,204 ----
cd595c0
*************** ldctor_build_sets (void)
cd595c0
*** 244,253 ****
cd595c0
  	}
cd595c0
      }
cd595c0
  
cd595c0
!   old = stat_ptr;
cd595c0
!   stat_ptr = &constructor_list;
cd595c0
! 
cd595c0
!   lang_list_init (stat_ptr);
cd595c0
  
cd595c0
    header_printed = FALSE;
cd595c0
    for (p = sets; p != NULL; p = p->next)
cd595c0
--- 244,251 ----
cd595c0
  	}
cd595c0
      }
cd595c0
  
cd595c0
!   lang_list_init (&constructor_list);
cd595c0
!   push_stat_ptr (&constructor_list);
cd595c0
  
cd595c0
    header_printed = FALSE;
cd595c0
    for (p = sets; p != NULL; p = p->next)
cd595c0
*************** ldctor_build_sets (void)
cd595c0
*** 372,376 ****
cd595c0
        lang_add_data (size, exp_intop (0));
cd595c0
      }
cd595c0
  
cd595c0
!   stat_ptr = old;
cd595c0
  }
cd595c0
--- 370,374 ----
cd595c0
        lang_add_data (size, exp_intop (0));
cd595c0
      }
cd595c0
  
cd595c0
!   pop_stat_ptr ();
cd595c0
  }
cd595c0
diff -rcp ../binutils-2.19.51.0.2.15/ld/ldlang.c ./ld/ldlang.c
cd595c0
*** ../binutils-2.19.51.0.2.15/ld/ldlang.c	2009-03-02 14:04:56.000000000 +0000
cd595c0
--- ./ld/ldlang.c	2009-03-05 12:20:26.000000000 +0000
cd595c0
***************
cd595c0
*** 1,6 ****
cd595c0
  /* Linker command language support.
cd595c0
     Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
cd595c0
!    2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
cd595c0
     Free Software Foundation, Inc.
cd595c0
  
cd595c0
     This file is part of the GNU Binutils.
cd595c0
--- 1,6 ----
cd595c0
  /* Linker command language support.
cd595c0
     Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
cd595c0
!    2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
cd595c0
     Free Software Foundation, Inc.
cd595c0
  
cd595c0
     This file is part of the GNU Binutils.
cd595c0
*************** static const char *current_target;
cd595c0
*** 64,69 ****
cd595c0
--- 64,71 ----
cd595c0
  static const char *output_target;
cd595c0
  static lang_statement_list_type statement_list;
cd595c0
  static struct bfd_hash_table lang_definedness_table;
cd595c0
+ static lang_statement_list_type *stat_save[10];
cd595c0
+ static lang_statement_list_type **stat_save_ptr = &stat_save[0];
cd595c0
  
cd595c0
  /* Forward declarations.  */
cd595c0
  static void exp_init_os (etree_type *);
cd595c0
*************** lang_list_init (lang_statement_list_type
cd595c0
*** 925,930 ****
cd595c0
--- 927,949 ----
cd595c0
    list->tail = &list->head;
cd595c0
  }
cd595c0
  
cd595c0
+ void
cd595c0
+ push_stat_ptr (lang_statement_list_type *new_ptr)
cd595c0
+ {
cd595c0
+   if (stat_save_ptr >= stat_save + sizeof (stat_save) / sizeof (stat_save[0]))
cd595c0
+     abort ();
cd595c0
+   *stat_save_ptr++ = stat_ptr;
cd595c0
+   stat_ptr = new_ptr;
cd595c0
+ }
cd595c0
+ 
cd595c0
+ void
cd595c0
+ pop_stat_ptr (void)
cd595c0
+ {
cd595c0
+   if (stat_save_ptr <= stat_save)
cd595c0
+     abort ();
cd595c0
+   stat_ptr = *--stat_save_ptr;
cd595c0
+ }
cd595c0
+ 
cd595c0
  /* Build a new statement node for the parse tree.  */
cd595c0
  
cd595c0
  static lang_statement_union_type *
cd595c0
*************** lang_insert_orphan (asection *s,
cd595c0
*** 1586,1608 ****
cd595c0
  		    etree_type *address,
cd595c0
  		    lang_statement_list_type *add_child)
cd595c0
  {
cd595c0
-   lang_statement_list_type *old;
cd595c0
    lang_statement_list_type add;
cd595c0
    const char *ps;
cd595c0
    lang_output_section_statement_type *os;
cd595c0
    lang_output_section_statement_type **os_tail;
cd595c0
  
cd595c0
-   /* Start building a list of statements for this section.
cd595c0
-      First save the current statement pointer.  */
cd595c0
-   old = stat_ptr;
cd595c0
- 
cd595c0
    /* If we have found an appropriate place for the output section
cd595c0
       statements for this orphan, add them to our own private list,
cd595c0
       inserting them later into the global statement list.  */
cd595c0
    if (after != NULL)
cd595c0
      {
cd595c0
!       stat_ptr = &ad;;
cd595c0
!       lang_list_init (stat_ptr);
cd595c0
      }
cd595c0
  
cd595c0
    ps = NULL;
cd595c0
--- 1605,1622 ----
cd595c0
  		    etree_type *address,
cd595c0
  		    lang_statement_list_type *add_child)
cd595c0
  {
cd595c0
    lang_statement_list_type add;
cd595c0
    const char *ps;
cd595c0
    lang_output_section_statement_type *os;
cd595c0
    lang_output_section_statement_type **os_tail;
cd595c0
  
cd595c0
    /* If we have found an appropriate place for the output section
cd595c0
       statements for this orphan, add them to our own private list,
cd595c0
       inserting them later into the global statement list.  */
cd595c0
    if (after != NULL)
cd595c0
      {
cd595c0
!       lang_list_init (&add);
cd595c0
!       push_stat_ptr (&add);
cd595c0
      }
cd595c0
  
cd595c0
    ps = NULL;
cd595c0
*************** lang_insert_orphan (asection *s,
cd595c0
*** 1648,1658 ****
cd595c0
      {
cd595c0
        char *symname;
cd595c0
  
cd595c0
-       /* lang_leave_ouput_section_statement resets stat_ptr.
cd595c0
- 	 Put stat_ptr back where we want it.  */
cd595c0
-       if (after != NULL)
cd595c0
- 	stat_ptr = &ad;;
cd595c0
- 
cd595c0
        symname = (char *) xmalloc (ps - secname + sizeof "__stop_" + 1);
cd595c0
        symname[0] = bfd_get_symbol_leading_char (link_info.output_bfd);
cd595c0
        sprintf (symname + (symname[0] != 0), "__stop_%s", secname);
cd595c0
--- 1662,1667 ----
cd595c0
*************** lang_insert_orphan (asection *s,
cd595c0
*** 1663,1669 ****
cd595c0
  
cd595c0
    /* Restore the global list pointer.  */
cd595c0
    if (after != NULL)
cd595c0
!     stat_ptr = old;
cd595c0
  
cd595c0
    if (after != NULL && os->bfd_section != NULL)
cd595c0
      {
cd595c0
--- 1672,1678 ----
cd595c0
  
cd595c0
    /* Restore the global list pointer.  */
cd595c0
    if (after != NULL)
cd595c0
!     pop_stat_ptr ();
cd595c0
  
cd595c0
    if (after != NULL && os->bfd_section != NULL)
cd595c0
      {
cd595c0
*************** lang_insert_orphan (asection *s,
cd595c0
*** 1749,1756 ****
cd595c0
  
cd595c0
  	  /* Fix the global list pointer if we happened to tack our
cd595c0
  	     new list at the tail.  */
cd595c0
! 	  if (*old->tail == add.head)
cd595c0
! 	    old->tail = add.tail;
cd595c0
  
cd595c0
  	  /* Save the end of this list.  */
cd595c0
  	  place->stmt = add.tail;
cd595c0
--- 1758,1765 ----
cd595c0
  
cd595c0
  	  /* Fix the global list pointer if we happened to tack our
cd595c0
  	     new list at the tail.  */
cd595c0
! 	  if (*stat_ptr->tail == add.head)
cd595c0
! 	    stat_ptr->tail = add.tail;
cd595c0
  
cd595c0
  	  /* Save the end of this list.  */
cd595c0
  	  place->stmt = add.tail;
cd595c0
*************** load_symbols (lang_input_statement_type 
cd595c0
*** 2481,2488 ****
cd595c0
        && ! bfd_check_format_matches (entry->the_bfd, bfd_object, &matching))
cd595c0
      {
cd595c0
        bfd_error_type err;
cd595c0
-       lang_statement_list_type *hold;
cd595c0
-       bfd_boolean bad_load = TRUE;
cd595c0
        bfd_boolean save_ldlang_sysrooted_script;
cd595c0
        bfd_boolean save_as_needed, save_add_needed;
cd595c0
  
cd595c0
--- 2490,2495 ----
cd595c0
*************** load_symbols (lang_input_statement_type 
cd595c0
*** 2505,2512 ****
cd595c0
        else if (err != bfd_error_file_not_recognized
cd595c0
  	       || place == NULL)
cd595c0
  	einfo (_("%F%B: file not recognized: %E\n"), entry->the_bfd);
cd595c0
-       else
cd595c0
- 	bad_load = FALSE;
cd595c0
  
cd595c0
        bfd_close (entry->the_bfd);
cd595c0
        entry->the_bfd = NULL;
cd595c0
--- 2512,2517 ----
cd595c0
*************** load_symbols (lang_input_statement_type 
cd595c0
*** 2514,2521 ****
cd595c0
        /* Try to interpret the file as a linker script.  */
cd595c0
        ldfile_open_command_file (entry->filename);
cd595c0
  
cd595c0
!       hold = stat_ptr;
cd595c0
!       stat_ptr = place;
cd595c0
        save_ldlang_sysrooted_script = ldlang_sysrooted_script;
cd595c0
        ldlang_sysrooted_script = entry->sysrooted;
cd595c0
        save_as_needed = as_needed;
cd595c0
--- 2519,2525 ----