Blame SOURCES/binutils-2.24-elfnn-aarch64.patch

8101c5
*** ../binutils-2.24.orig/bfd/elfnn-aarch64.c	2013-12-17 11:16:28.723807381 +0000
8101c5
--- bfd/elfnn-aarch64.c	2013-12-17 11:18:13.517804067 +0000
8101c5
*************** _aarch64_elf_section_data;
8101c5
*** 1679,1686 ****
8101c5
  #define elf_aarch64_section_data(sec) \
8101c5
    ((_aarch64_elf_section_data *) elf_section_data (sec))
8101c5
  
8101c5
! /* The size of the thread control block.  */
8101c5
! #define TCB_SIZE	16
8101c5
  
8101c5
  struct elf_aarch64_local_symbol
8101c5
  {
8101c5
--- 1679,1686 ----
8101c5
  #define elf_aarch64_section_data(sec) \
8101c5
    ((_aarch64_elf_section_data *) elf_section_data (sec))
8101c5
  
8101c5
! /* The size of the thread control block which is defined to be two pointers.  */
8101c5
! #define TCB_SIZE	(ARCH_SIZE/8)*2
8101c5
  
8101c5
  struct elf_aarch64_local_symbol
8101c5
  {
8101c5
*************** elfNN_aarch64_final_link_relocate (reloc
8101c5
*** 3589,3595 ****
8101c5
  
8101c5
  	      if (globals->root.splt != NULL)
8101c5
  		{
8101c5
! 		  plt_index = h->plt.offset / globals->plt_entry_size - 1;
8101c5
  		  off = (plt_index + 3) * GOT_ENTRY_SIZE;
8101c5
  		  base_got = globals->root.sgotplt;
8101c5
  		}
8101c5
--- 3589,3596 ----
8101c5
  
8101c5
  	      if (globals->root.splt != NULL)
8101c5
  		{
8101c5
! 		  plt_index = ((h->plt.offset - globals->plt_header_size) /
8101c5
! 			       globals->plt_entry_size);
8101c5
  		  off = (plt_index + 3) * GOT_ENTRY_SIZE;
8101c5
  		  base_got = globals->root.sgotplt;
8101c5
  		}
8101c5
*************** elfNN_aarch64_finish_dynamic_symbol (bfd
8101c5
*** 6823,6829 ****
8101c5
  		       + htab->root.sgot->output_offset
8101c5
  		       + (h->got.offset & ~(bfd_vma) 1));
8101c5
  
8101c5
!       if (info->shared && SYMBOL_REFERENCES_LOCAL (info, h))
8101c5
  	{
8101c5
  	  if (!h->def_regular)
8101c5
  	    return FALSE;
8101c5
--- 6824,6857 ----
8101c5
  		       + htab->root.sgot->output_offset
8101c5
  		       + (h->got.offset & ~(bfd_vma) 1));
8101c5
  
8101c5
!       if (h->def_regular
8101c5
! 	  && h->type == STT_GNU_IFUNC)
8101c5
! 	{
8101c5
! 	  if (info->shared)
8101c5
! 	    {
8101c5
! 	      /* Generate R_AARCH64_GLOB_DAT.  */
8101c5
! 	      goto do_glob_dat;
8101c5
! 	    }
8101c5
! 	  else
8101c5
! 	    {
8101c5
! 	      asection *plt;
8101c5
! 
8101c5
! 	      if (!h->pointer_equality_needed)
8101c5
! 		abort ();
8101c5
! 
8101c5
! 	      /* For non-shared object, we can't use .got.plt, which
8101c5
! 		 contains the real function address if we need pointer
8101c5
! 		 equality.  We load the GOT entry with the PLT entry.  */
8101c5
! 	      plt = htab->root.splt ? htab->root.splt : htab->root.iplt;
8101c5
! 	      bfd_put_NN (output_bfd, (plt->output_section->vma
8101c5
! 				       + plt->output_offset
8101c5
! 				       + h->plt.offset),
8101c5
! 			  htab->root.sgot->contents
8101c5
! 			  + (h->got.offset & ~(bfd_vma) 1));
8101c5
! 	      return TRUE;
8101c5
! 	    }
8101c5
! 	}
8101c5
!       else if (info->shared && SYMBOL_REFERENCES_LOCAL (info, h))
8101c5
  	{
8101c5
  	  if (!h->def_regular)
8101c5
  	    return FALSE;
8101c5
*************** elfNN_aarch64_finish_dynamic_symbol (bfd
8101c5
*** 6836,6841 ****
8101c5
--- 6864,6870 ----
8101c5
  	}
8101c5
        else
8101c5
  	{
8101c5
+ do_glob_dat:
8101c5
  	  BFD_ASSERT ((h->got.offset & 1) == 0);
8101c5
  	  bfd_put_NN (output_bfd, (bfd_vma) 0,
8101c5
  		      htab->root.sgot->contents + h->got.offset);