Blame binutils-2.24-aarch64-fix-final_link_relocate.patch

111d830
commit f44a1f8e513b37bcc52ba9ea0c172c3e94852756
111d830
Author: Christophe Lyon <christophe.lyon@st.com>
111d830
Date:   Tue Jan 14 15:53:50 2014 +0100
111d830
111d830
    2014-01-14  Michael Hudson-Doyle  <michael.hudson@linaro.org>
111d830
    	    Kugan Vivekanandarajah  <kugan.vivekanandarajah@linaro.org>
111d830
    
111d830
    	bfd/
111d830
    	* elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Use correct
111d830
    	offset while calculating relocation address.
111d830
    	(elfNN_aarch64_create_small_pltn_entry): Likewise.
111d830
    	(elfNN_aarch64_init_small_plt0_entry): Likewise.
111d830
111d830
--- a/bfd/elfnn-aarch64.c
111d830
+++ b/bfd/elfnn-aarch64.c
111d830
@@ -3844,7 +3844,7 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
111d830
 
111d830
       value = (symbol_got_offset (input_bfd, h, r_symndx)
111d830
 	       + globals->root.sgot->output_section->vma
111d830
-	       + globals->root.sgot->output_section->output_offset);
111d830
+	       + globals->root.sgot->output_offset);
111d830
 
111d830
       value = _bfd_aarch64_elf_resolve_relocation (bfd_r_type, place, value,
111d830
 						   0, weak_undef_p);
111d830
@@ -3873,10 +3873,9 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
111d830
     case BFD_RELOC_AARCH64_TLSDESC_LDR:
111d830
       if (globals->root.sgot == NULL)
111d830
 	return bfd_reloc_notsupported;
111d830
-
111d830
       value = (symbol_tlsdesc_got_offset (input_bfd, h, r_symndx)
111d830
 	       + globals->root.sgotplt->output_section->vma
111d830
-	       + globals->root.sgotplt->output_section->output_offset
111d830
+	       + globals->root.sgotplt->output_offset
111d830
 	       + globals->sgotplt_jump_table_size);
111d830
 
111d830
       value = _bfd_aarch64_elf_resolve_relocation (bfd_r_type, place, value,
111d830
@@ -6627,7 +6626,7 @@ elfNN_aarch64_create_small_pltn_entry (struct elf_link_hash_entry *h,
111d830
 
111d830
   plt_entry = plt->contents + h->plt.offset;
111d830
   plt_entry_address = plt->output_section->vma
111d830
-    + plt->output_section->output_offset + h->plt.offset;
111d830
+    + plt->output_offset + h->plt.offset;
111d830
   gotplt_entry_address = gotplt->output_section->vma +
111d830
     gotplt->output_offset + got_offset;
111d830
 
111d830
@@ -6934,7 +6933,7 @@ elfNN_aarch64_init_small_plt0_entry (bfd *output_bfd ATTRIBUTE_UNUSED,
111d830
 		  + GOT_ENTRY_SIZE * 2);
111d830
 
111d830
   plt_base = htab->root.splt->output_section->vma +
111d830
-    htab->root.splt->output_section->output_offset;
111d830
+    htab->root.splt->output_offset;
111d830
 
111d830
   /* Fill in the top 21 bits for this: ADRP x16, PLT_GOT + n * 8.
111d830
      ADRP:   ((PG(S+A)-PG(P)) >> 12) & 0x1fffff */