From f9311f0bfc70d61b57aca4e99fb9ac34993ea859 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Fri, 15 Sep 2017 10:40:04 +0100 Subject: [PATCH] Extend fix for PR 21884. Resolves: #1491023 --- binutils-2.29-non-elf-orphan-skip.patch | 30 +++++++++++++++++++++++++ binutils.spec | 6 ++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/binutils-2.29-non-elf-orphan-skip.patch b/binutils-2.29-non-elf-orphan-skip.patch index 30cf390..154d385 100644 --- a/binutils-2.29-non-elf-orphan-skip.patch +++ b/binutils-2.29-non-elf-orphan-skip.patch @@ -115,3 +115,33 @@ && (flags & SEC_LOAD) != 0) place = &hold[orphan_rel]; else if ((flags & SEC_CODE) == 0) +diff -rup binutils.orig/bfd/elf32-i386.c binutils-2.29/bfd/elf32-i386.c +--- binutils.orig/bfd/elf32-i386.c 2017-09-15 10:27:16.828950825 +0100 ++++ binutils-2.29/bfd/elf32-i386.c 2017-09-15 10:27:38.962692771 +0100 +@@ -6921,8 +6921,9 @@ elf_i386_link_setup_gnu_properties (stru + for (abfd = info->input_bfds; + abfd != NULL; + abfd = abfd->link.next) +- if ((abfd->flags +- & (DYNAMIC | BFD_LINKER_CREATED | BFD_PLUGIN)) == 0) ++ if (bfd_get_flavour (abfd) == bfd_target_elf_flavour ++ && (abfd->flags ++ & (DYNAMIC | BFD_LINKER_CREATED | BFD_PLUGIN)) == 0) + { + htab->elf.dynobj = abfd; + dynobj = abfd; +diff -rup binutils.orig/bfd/elf64-x86-64.c binutils-2.29/bfd/elf64-x86-64.c +--- binutils.orig/bfd/elf64-x86-64.c 2017-09-15 10:27:16.820950918 +0100 ++++ binutils-2.29/bfd/elf64-x86-64.c 2017-09-15 10:28:02.621416935 +0100 +@@ -7466,8 +7466,9 @@ error_alignment: + for (abfd = info->input_bfds; + abfd != NULL; + abfd = abfd->link.next) +- if ((abfd->flags +- & (DYNAMIC | BFD_LINKER_CREATED | BFD_PLUGIN)) == 0) ++ if (bfd_get_flavour (abfd) == bfd_target_elf_flavour ++ && (abfd->flags ++ & (DYNAMIC | BFD_LINKER_CREATED | BFD_PLUGIN)) == 0) + { + htab->elf.dynobj = abfd; + dynobj = abfd; diff --git a/binutils.spec b/binutils.spec index 9a70e12..e43e636 100644 --- a/binutils.spec +++ b/binutils.spec @@ -54,7 +54,7 @@ Summary: A GNU collection of binary utilities Name: %{?cross}binutils%{?_with_debug:-debug} Version: 2.29 -Release: 8%{?dist} +Release: 9%{?dist} License: GPLv3+ Group: Development/Tools URL: http://sources.redhat.com/binutils @@ -655,6 +655,10 @@ exit 0 #--------------------------------------------------------------------------------- %changelog +* Thu Sep 14 2017 Nick Clifton 2.29-10 +- Extend fix for PR 21884. + (#1491023) + * Thu Sep 14 2017 Nick Clifton 2.29-8 - Import fix for PR 21884 which stops a seg-fault in the linker when changing output format to binary during a final link. (#1491023)