Fix handling of AArch64 local GOT relocs.

Resolves: #1262091
This commit is contained in:
Nick Clifton 2015-09-11 18:59:36 +01:00
parent fe17c525e4
commit 29776bac49
2 changed files with 76 additions and 1 deletions

View File

@ -0,0 +1,70 @@
--- binutils-2.25.1.orif/bfd/elfnn-aarch64.c 2015-09-11 18:23:24.318028989 +0100
+++ binutils-2.25.1/bfd/elfnn-aarch64.c 2015-09-11 18:23:35.510092848 +0100
@@ -2207,9 +2207,11 @@ aarch64_type_of_stub (struct bfd_link_in
globals = elf_aarch64_hash_table (info);
via_plt_p = (globals->root.splt != NULL && hash != NULL
&& hash->root.plt.offset != (bfd_vma) - 1);
-
+ /* Make sure call to plt stub can fit into the branch range. */
if (via_plt_p)
- return stub_type;
+ destination = (globals->root.splt->output_section->vma
+ + globals->root.splt->output_offset
+ + hash->root.plt.offset);
/* Determine where the call point is. */
location = (input_sec->output_offset
@@ -4392,38 +4394,25 @@ elfNN_aarch64_final_link_relocate (reloc
/* If the call goes through a PLT entry, make sure to
check distance to the right destination address. */
if (via_plt_p)
- {
- value = (splt->output_section->vma
- + splt->output_offset + h->plt.offset);
- *unresolved_reloc_p = FALSE;
- }
+ value = (splt->output_section->vma
+ + splt->output_offset + h->plt.offset);
- /* If the target symbol is global and marked as a function the
- relocation applies a function call or a tail call. In this
- situation we can veneer out of range branches. The veneers
- use IP0 and IP1 hence cannot be used arbitrary out of range
- branches that occur within the body of a function. */
- if (h && h->type == STT_FUNC)
- {
- /* Check if a stub has to be inserted because the destination
- is too far away. */
- if (! aarch64_valid_branch_p (value, place))
- {
- /* The target is out of reach, so redirect the branch to
- the local stub for this function. */
- struct elf_aarch64_stub_hash_entry *stub_entry;
- stub_entry = elfNN_aarch64_get_stub_entry (input_section,
- sym_sec, h,
- rel, globals);
- if (stub_entry != NULL)
- value = (stub_entry->stub_offset
- + stub_entry->stub_sec->output_offset
- + stub_entry->stub_sec->output_section->vma);
- }
- }
+ /* Check if a stub has to be inserted because the destination
+ is too far away. */
+ struct elf_aarch64_stub_hash_entry *stub_entry = NULL;
+ if (! aarch64_valid_branch_p (value, place))
+ /* The target is out of reach, so redirect the branch to
+ the local stub for this function. */
+ stub_entry = elfNN_aarch64_get_stub_entry (input_section, sym_sec, h,
+ rel, globals);
+ if (stub_entry != NULL)
+ value = (stub_entry->stub_offset
+ + stub_entry->stub_sec->output_offset
+ + stub_entry->stub_sec->output_section->vma);
}
value = _bfd_aarch64_elf_resolve_relocation (bfd_r_type, place, value,
signed_addend, weak_undef_p);
+ *unresolved_reloc_p = FALSE;
break;
case BFD_RELOC_AARCH64_ADR_LO21_PCREL:

View File

@ -20,7 +20,7 @@
Summary: A GNU collection of binary utilities
Name: %{?cross}binutils%{?_with_debug:-debug}
Version: 2.25.1
Release: 5%{?dist}
Release: 6%{?dist}
License: GPLv3+
Group: Development/Tools
URL: http://sources.redhat.com/binutils
@ -58,6 +58,7 @@ Patch15: binutils-2.25.1-ihex-parsing.patch
# backport https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e9c1bdad269c0c3352eebcc9481ed65144001b0b
# Qt linked with gold crash on startup, BZ #1193044
Patch16: binutils-2.25.1-dynamic_list.patch
Patch17: binutils-2.25.1-aarch64-pr18668.patch
Provides: bundled(libiberty)
@ -182,6 +183,7 @@ using libelf instead of BFD.
%endif
%patch15 -p1 -b .ihex~
%patch16 -p1 -b .dynamic_list~
%patch17 -p1
# We cannot run autotools as there is an exact requirement of autoconf-2.59.
@ -497,6 +499,9 @@ exit 0
%endif # %{isnative}
%changelog
* Fri Sep 11 2015 Nick Clifton <nickc@redhat.com> 2.25.1-6
- Fix handling of AArch64 local GOT relocs. (#1262091)
* Thu Sep 10 2015 Nick Clifton <nickc@redhat.com> 2.25.1-5
- Do not enable deterministic archives by default (#1195883)