bfd/elfnn-aarch64.c: use correct offsets in final_link_relocate

Resolves: BZ #1126199
This commit is contained in:
Kyle McMartin 2014-08-21 22:14:57 -04:00
parent eaa735511a
commit 404956d0f6
2 changed files with 61 additions and 1 deletions

View File

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

View File

@ -19,7 +19,7 @@
Summary: A GNU collection of binary utilities Summary: A GNU collection of binary utilities
Name: %{?cross}binutils%{?_with_debug:-debug} Name: %{?cross}binutils%{?_with_debug:-debug}
Version: 2.24 Version: 2.24
Release: 21%{?dist} Release: 22%{?dist}
License: GPLv3+ License: GPLv3+
Group: Development/Tools Group: Development/Tools
URL: http://sources.redhat.com/binutils URL: http://sources.redhat.com/binutils
@ -67,6 +67,7 @@ Patch22: binutils-2.24-symbol-warning.patch
Patch23: binutils-2.24-aarch64-ld-shared-non-PIC-xfail.patch Patch23: binutils-2.24-aarch64-ld-shared-non-PIC-xfail.patch
Patch24: binutils-2.24-weak-sym-merge.patch Patch24: binutils-2.24-weak-sym-merge.patch
Patch25: binutils-2.24-indirect-chain.patch Patch25: binutils-2.24-indirect-chain.patch
Patch26: binutils-2.24-aarch64-fix-final_link_relocate.patch
Provides: bundled(libiberty) Provides: bundled(libiberty)
@ -196,6 +197,7 @@ using libelf instead of BFD.
%patch23 -p1 -b .ld-aarch64-xfails~ %patch23 -p1 -b .ld-aarch64-xfails~
%patch24 -p0 -b .weak-sym-merge~ %patch24 -p0 -b .weak-sym-merge~
%patch25 -p0 -b .indirect-chain~ %patch25 -p0 -b .indirect-chain~
%patch26 -p1 -b .aa64-final-link~
# We cannot run autotools as there is an exact requirement of autoconf-2.59. # We cannot run autotools as there is an exact requirement of autoconf-2.59.
@ -509,6 +511,10 @@ exit 0
%endif # %{isnative} %endif # %{isnative}
%changelog %changelog
* Thu Aug 21 2014 Kyle McMartin <kmcmarti@redhat.com> - 2.24-22
- bfd/elfnn-aarch64.c: use correct offsets in final_link_relocate
Resolves: BZ #1126199
* Thu Aug 21 2014 Nick Clifton <nickc@redhat.com> - 2.24-21 * Thu Aug 21 2014 Nick Clifton <nickc@redhat.com> - 2.24-21
- Import patch from mainline to fix indirect symbol resolution. - Import patch from mainline to fix indirect symbol resolution.
Resolves: BZ #1123714 Resolves: BZ #1123714