From c05cfd7b3ea0ccdf56139b676d2947c724a8251c Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Wed, 14 Mar 2018 10:42:46 +0000 Subject: [PATCH] Do not discard debugobj files created by GCC v8 LTO wrapper. Resolves: #1543912 --- binutils-debug-section-marking.patch | 39 ++++++++++++++++++++++++++++ binutils.spec | 11 +++++++- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 binutils-debug-section-marking.patch diff --git a/binutils-debug-section-marking.patch b/binutils-debug-section-marking.patch new file mode 100644 index 0000000..d1dfdc5 --- /dev/null +++ b/binutils-debug-section-marking.patch @@ -0,0 +1,39 @@ +--- binutils.orig/bfd/elflink.c 2018-03-14 10:14:49.729271271 +0000 ++++ binutils-2.30/bfd/elflink.c 2018-03-14 10:15:15.748967793 +0000 +@@ -12785,7 +12785,7 @@ _bfd_elf_gc_mark_hook (asection *sec, + return NULL; + } + +-/* Return the global debug definition section. */ ++/* Return the debug definition section. */ + + static asection * + elf_gc_mark_debug_section (asection *sec ATTRIBUTE_UNUSED, +@@ -12794,11 +12794,22 @@ elf_gc_mark_debug_section (asection *sec + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym ATTRIBUTE_UNUSED) + { +- if (h != NULL +- && (h->root.type == bfd_link_hash_defined +- || h->root.type == bfd_link_hash_defweak) +- && (h->root.u.def.section->flags & SEC_DEBUGGING) != 0) +- return h->root.u.def.section; ++ if (h != NULL) ++ { ++ /* Return the global debug definition section. */ ++ if ((h->root.type == bfd_link_hash_defined ++ || h->root.type == bfd_link_hash_defweak) ++ && (h->root.u.def.section->flags & SEC_DEBUGGING) != 0) ++ return h->root.u.def.section; ++ } ++ else ++ { ++ /* Return the local debug definition section. */ ++ asection *isec = bfd_section_from_elf_index (sec->owner, ++ sym->st_shndx); ++ if ((isec->flags & SEC_DEBUGGING) != 0) ++ return isec; ++ } + + return NULL; + } diff --git a/binutils.spec b/binutils.spec index 2d5f6d3..0af8520 100644 --- a/binutils.spec +++ b/binutils.spec @@ -62,7 +62,7 @@ Summary: A GNU collection of binary utilities Name: %{?cross}binutils%{?_with_debug:-debug} Version: 2.30 -Release: 12%{?dist} +Release: 13%{?dist} License: GPLv3+ Group: Development/Tools URL: https://sourceware.org/binutils @@ -184,6 +184,11 @@ Patch16: binutils-2.28-ignore-gold-duplicates.patch # Lifetime: Fixed in 2.31. Patch17: binutils-ifunc-relocs-in-notes.patch +# Purpose: Do not discard debug only object files created by GCC v8's +# LTO wrapper. +# Lifetime: Fixed in 2.31. +Patch18: binutils-debug-section-marking.patch + #---------------------------------------------------------------------------- Provides: bundled(libiberty) @@ -326,6 +331,7 @@ using libelf instead of BFD. %patch15 -p1 %patch16 -p1 %patch17 -p1 +%patch18 -p1 # We cannot run autotools as there is an exact requirement of autoconf-2.59. @@ -734,6 +740,9 @@ exit 0 #---------------------------------------------------------------------------- %changelog +* Wed Mar 14 2018 Nick Clifton 2.30-13 +- Do not discard debugobj files created by GCC v8 LTO wrapper. (#1543912 and RHBZ 84847 and PR 20882) + * Fri Mar 09 2018 Nick Clifton 2.30-12 - Treat relocs against s390x IFUNC symbols in note sections as relocs against the FUNC symbol instead. - Combined previous patches into one which covers all ifunc supporting architectures.