Compare commits

...

5 Commits
master ... f23

Author SHA1 Message Date
Nick Clifton 22f22bc705 Fix an internal error loading an object file that needs an incompatible plugin.
Resolves: #1311320
2016-03-01 08:35:51 +00:00
Nick Clifton 90851841a5 Fix an internal error linking object files with IFUNC relocations in debug sections.
Resolves: #1309763
2016-02-19 10:38:59 +00:00
Nick Clifton e420adc681 Ensure that the patch applies for native AArch64 builds.
Resolves: #1262091
2015-09-30 15:44:22 +01:00
Nick Clifton b17da75798 Fix handling of AArch64 local GOT relocs.
Resolves: #1262091
2015-09-14 12:25:31 +01:00
Rex Dieter 01a3d73c50 Qt linked with gold crash on startup (#1193044) 2015-08-24 09:38:01 -05:00
5 changed files with 256 additions and 3 deletions

View File

@ -0,0 +1,70 @@
--- binutils-2.25.orig/bfd/elfnn-aarch64.c 2015-09-14 12:05:10.010398108 +0100
+++ binutils-2.25/bfd/elfnn-aarch64.c 2015-09-14 12:12:40.730934194 +0100
@@ -2199,9 +2199,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_16_PCREL:

View File

@ -0,0 +1,70 @@
diff -up binutils-2.25.1/gold/layout.cc.dynamic_list~ binutils-2.25.1/gold/layout.cc
--- binutils-2.25.1/gold/layout.cc.dynamic_list~ 2014-10-14 02:32:04.000000000 -0500
+++ binutils-2.25.1/gold/layout.cc 2015-08-06 10:45:35.022531546 -0500
@@ -4857,7 +4857,8 @@ Layout::finish_dynamic_section(const Inp
flags |= elfcpp::DF_STATIC_TLS;
if (parameters->options().origin())
flags |= elfcpp::DF_ORIGIN;
- if (parameters->options().Bsymbolic())
+ if (parameters->options().Bsymbolic()
+ && !parameters->options().have_dynamic_list())
{
flags |= elfcpp::DF_SYMBOLIC;
// Add DT_SYMBOLIC for compatibility with older loaders.
diff -up binutils-2.25.1/gold/options.cc.dynamic_list~ binutils-2.25.1/gold/options.cc
--- binutils-2.25.1/gold/options.cc.dynamic_list~ 2014-10-14 02:32:04.000000000 -0500
+++ binutils-2.25.1/gold/options.cc 2015-08-06 10:45:35.023531554 -0500
@@ -1200,13 +1200,6 @@ General_options::finalize()
// in the path, as appropriate.
this->add_sysroot();
- // --dynamic-list overrides -Bsymbolic and -Bsymbolic-functions.
- if (this->have_dynamic_list())
- {
- this->set_Bsymbolic(false);
- this->set_Bsymbolic_functions(false);
- }
-
// Now that we've normalized the options, check for contradictory ones.
if (this->shared() && this->is_static())
gold_fatal(_("-shared and -static are incompatible"));
diff -up binutils-2.25.1/gold/symtab.h.dynamic_list~ binutils-2.25.1/gold/symtab.h
--- binutils-2.25.1/gold/symtab.h.dynamic_list~ 2014-10-14 02:32:04.000000000 -0500
+++ binutils-2.25.1/gold/symtab.h 2015-08-06 10:45:35.023531554 -0500
@@ -604,10 +604,8 @@ class Symbol
if (parameters->options().in_dynamic_list(this->name()))
return true;
- // If the user used -Bsymbolic or provided a --dynamic-list script,
- // then nothing (else) is preemptible.
- if (parameters->options().Bsymbolic()
- || parameters->options().have_dynamic_list())
+ // If the user used -Bsymbolic, then nothing (else) is preemptible.
+ if (parameters->options().Bsymbolic())
return false;
// If the user used -Bsymbolic-functions, then functions are not
diff -up binutils-2.25.1/gold/testsuite/Makefile.am.dynamic_list~ binutils-2.25.1/gold/testsuite/Makefile.am
--- binutils-2.25.1/gold/testsuite/Makefile.am.dynamic_list~ 2015-07-21 03:20:58.000000000 -0500
+++ binutils-2.25.1/gold/testsuite/Makefile.am 2015-08-06 10:45:35.024531563 -0500
@@ -1516,7 +1516,7 @@ dynamic_list_lib1.o: dynamic_list_lib1.c
$(CXXCOMPILE) -c -fpic -o $@ $<
dynamic_list_lib2.so: gcctestdir/ld dynamic_list_lib2.o $(srcdir)/dynamic_list_2.t
- $(CXXLINK) -Bgcctestdir/ -shared -Wl,--dynamic-list,$(srcdir)/dynamic_list_2.t dynamic_list_lib2.o
+ $(CXXLINK) -Bgcctestdir/ -shared -Wl,-Bsymbolic-functions -Wl,--dynamic-list,$(srcdir)/dynamic_list_2.t dynamic_list_lib2.o
dynamic_list_lib2.o: dynamic_list_lib2.cc
$(CXXCOMPILE) -c -fpic -o $@ $<
diff -up binutils-2.25.1/gold/testsuite/Makefile.in.dynamic_list~ binutils-2.25.1/gold/testsuite/Makefile.in
--- binutils-2.25.1/gold/testsuite/Makefile.in.dynamic_list~ 2015-07-21 03:20:58.000000000 -0500
+++ binutils-2.25.1/gold/testsuite/Makefile.in 2015-08-06 10:45:35.025531571 -0500
@@ -5277,7 +5277,7 @@ uninstall-am:
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -fpic -o $@ $<
@GCC_TRUE@@NATIVE_LINKER_TRUE@dynamic_list_lib2.so: gcctestdir/ld dynamic_list_lib2.o $(srcdir)/dynamic_list_2.t
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -shared -Wl,--dynamic-list,$(srcdir)/dynamic_list_2.t dynamic_list_lib2.o
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -shared -Wl,-Bsymbolic-functions -Wl,--dynamic-list,$(srcdir)/dynamic_list_2.t dynamic_list_lib2.o
@GCC_TRUE@@NATIVE_LINKER_TRUE@dynamic_list_lib2.o: dynamic_list_lib2.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -fpic -o $@ $<

42
binutils-rh1309763.patch Normal file
View File

@ -0,0 +1,42 @@
--- binutils-2.25.orig/bfd/elf64-x86-64.c 2016-02-19 10:22:44.932019197 +0000
+++ binutils-2.25/bfd/elf64-x86-64.c 2016-02-19 10:24:07.288484359 +0000
@@ -3569,8 +3569,16 @@ elf_x86_64_relocate_section (bfd *output
bfd_vma plt_index;
const char *name;
- if ((input_section->flags & SEC_ALLOC) == 0
- || h->plt.offset == (bfd_vma) -1)
+ if ((input_section->flags & SEC_ALLOC) == 0)
+ {
+ /* Dynamic relocs are not propagated for SEC_DEBUGGING
+ sections because such sections are not SEC_ALLOC and
+ thus ld.so will not process them. */
+ if ((input_section->flags & SEC_DEBUGGING) != 0)
+ continue;
+ abort ();
+ }
+ else if (h->plt.offset == (bfd_vma) -1)
abort ();
/* STT_GNU_IFUNC symbol must go through PLT. */
--- binutils-2.25.orig/bfd/elf32-i386.c 2016-02-19 10:22:44.899019010 +0000
+++ binutils-2.25/bfd/elf32-i386.c 2016-02-19 10:26:56.373436838 +0000
@@ -3336,8 +3336,16 @@ elf_i386_relocate_section (bfd *output_b
bfd_vma plt_index;
const char *name;
- if ((input_section->flags & SEC_ALLOC) == 0
- || h->plt.offset == (bfd_vma) -1)
+ if ((input_section->flags & SEC_ALLOC) == 0)
+ {
+ /* Dynamic relocs are not propagated for SEC_DEBUGGING
+ sections because such sections are not SEC_ALLOC and
+ thus ld.so will not process them. */
+ if ((input_section->flags & SEC_DEBUGGING) != 0)
+ continue;
+ abort ();
+ }
+ else if (h->plt.offset == (bfd_vma) -1)
abort ();
/* STT_GNU_IFUNC symbol must go through PLT. */

43
binutils-rh1311320.patch Normal file
View File

@ -0,0 +1,43 @@
diff -rup binutils-2.25.orig/bfd/hash.c binutils-2.25/bfd/hash.c
--- binutils-2.25.orig/bfd/hash.c 2016-03-01 08:08:16.065426095 +0000
+++ binutils-2.25/bfd/hash.c 2016-03-01 08:18:16.678210068 +0000
@@ -423,6 +423,8 @@ bfd_hash_table_init (struct bfd_hash_tab
void
bfd_hash_table_free (struct bfd_hash_table *table)
{
+ if (table->memory == NULL)
+ return;
objalloc_free ((struct objalloc *) table->memory);
table->memory = NULL;
}
diff -rup binutils-2.25.orig/bfd/plugin.c binutils-2.25/bfd/plugin.c
--- binutils-2.25.orig/bfd/plugin.c 2016-03-01 08:08:16.076426138 +0000
+++ binutils-2.25/bfd/plugin.c 2016-03-01 08:09:56.776828118 +0000
@@ -345,6 +345,10 @@ try_load_plugin (const char *pname, bfd
int i;
ld_plugin_onload onload;
enum ld_plugin_status status;
+ static bfd_boolean loading = FALSE;
+
+ if (loading)
+ goto err;
plugin_handle = dlopen (pname, RTLD_NOW);
if (!plugin_handle)
@@ -378,12 +382,16 @@ try_load_plugin (const char *pname, bfd
if (status != LDPS_OK)
goto err;
+ loading = TRUE;
+
if (!claim_file)
goto err;
if (!try_claim (abfd))
goto err;
+ loading = FALSE;
+
return 1;
err:

View File

@ -19,7 +19,7 @@
Summary: A GNU collection of binary utilities
Name: %{?cross}binutils%{?_with_debug:-debug}
Version: 2.25
Release: 12%{?dist}
Release: 17%{?dist}
License: GPLv3+
Group: Development/Tools
URL: http://sources.redhat.com/binutils
@ -56,6 +56,15 @@ Patch14: binutils-2.24-ldforcele.patch
Patch15: binutils-2.25-x86_64-pie-relocs.patch
# Issue an error message when attempting to resolve PC-relative dynamic relocs in non-PIC objects.
Patch16: binutils-2.25-aarch64-fPIC-error.patch
# backport https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e9c1bdad269c0c3352eebcc9481ed65144001b0b
# Qt linked with gold crash on startup, BZ #1193044
Patch17: binutils-2.25.1-dynamic_list.patch
# Fix creating GOT entries for AArch64 binaries.
Patch18: binutils-2.25-aarch64-pr18668.patch
# Fix internal linker error processing IFUNC relocations in debug sections.
Patch19: binutils-rh1309763.patch
# Fix seg-fault loading a binary that needs an incompatible plugin.
Patch20: binutils-rh1311320.patch
Provides: bundled(libiberty)
@ -180,9 +189,11 @@ using libelf instead of BFD.
%patch14 -p1 -b .ldforcele~
%endif
%patch15 -p1 -b .x86_64-pie~
%ifarch aarch64
%patch16 -p1 -b .aarch64-fpic~
%endif
%patch17 -p1 -b .dynamic_list~
%patch18 -p1
%patch19 -p1
%patch20 -p1
# We cannot run autotools as there is an exact requirement of autoconf-2.59.
@ -496,6 +507,23 @@ exit 0
%endif # %{isnative}
%changelog
* Tue Mar 01 2016 Nick Clifton <nickc@redhat.com> 2.25-17
- Fix an internal error loading an object file that needs an incompatible plugin.
(#1311320)
* Fri Feb 19 2016 Nick Clifton <nickc@redhat.com> 2.25-16
- Fix an internal error linking object files with IFUNC relocations in debug sections.
(#1309763)
* Wed Sep 30 2015 Nick Clifton <nickc@redhat.com> 2.25-15
- Ensure that the patch applies for native AArch64 builds. (#1262091)
* Mon Sep 14 2015 Nick Clifton <nickc@redhat.com> 2.25-14
- Fix handling of AArch64 local GOT relocs. (#1262091)
* Mon Aug 24 2015 Rex Dieter <rdieter@fedoraproject.org> 2.25-13
- Qt linked with gold crash on startup (#1193044)
* Thu Jul 02 2015 Nick Clifton <nickc@redhat.com> - 2.25-12
- For AArch64 issue an error message when attempting to resolve a
PC-relative dynamic reloc in a non-PIC object file.