c3e0b25
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
c3e0b25
From: Kevin Buettner <kevinb@redhat.com>
c3e0b25
Date: Wed, 8 Apr 2020 16:15:52 -0400
c3e0b25
Subject: gdb-rhbz1818011-bfd-gcc10-error.patch
c3e0b25
MIME-Version: 1.0
c3e0b25
Content-Type: text/plain; charset=UTF-8
c3e0b25
Content-Transfer-Encoding: 8bit
c3e0b25
c3e0b25
;; Fix int conversion error from bfd/elf.c when compiling with gcc 10
c3e0b25
c3e0b25
Original commit message from H.J. Lu <hjl.tools@gmail.com> is below:
c3e0b25
c3e0b25
bfd: Change num_group to unsigned int
c3e0b25
c3e0b25
elf.c failed with to with GCC 10 as of
c3e0b25
c3e0b25
commit 906b3eb9df6c577d3f6e9c3ea5c9d7e4d1e90536
c3e0b25
Author: Martin Liska <mliska@suse.cz>
c3e0b25
Date:   Tue Mar 24 11:40:10 2020 +0100
c3e0b25
c3e0b25
    Improve endianess detection.
c3e0b25
c3e0b25
            PR lto/94249
c3e0b25
            * plugin-api.h: Add more robust endianess detection.
c3e0b25
c3e0b25
binutils-gdb/bfd/elf.c: In function ‘setup_group’:
c3e0b25
binutils-gdb/bfd/elf.c:740:35: error: overflow in conversion from ‘unsigned int’ to ‘int’ changes value from ‘num_group = 4294967295’ to ‘-1’ [-Werror=overflow]
c3e0b25
  740 |     elf_tdata (abfd)->num_group = num_group = -1;
c3e0b25
      |                                   ^~~~~~~~~
c3e0b25
cc1: all warnings being treated as errors
c3e0b25
make[2]: *** [Makefile:1608: elf.lo] Error 1
c3e0b25
c3e0b25
Change num_group in elf_obj_tdata to unsigned int to compile with GCC 10.
c3e0b25
c3e0b25
	PR binutils/25717
c3e0b25
	* elf-bfd.h (elf_obj_tdata): Change num_group to unsigned int.
c3e0b25
c3e0b25
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
c3e0b25
--- a/bfd/elf-bfd.h
c3e0b25
+++ b/bfd/elf-bfd.h
c3e0b25
@@ -1937,7 +1937,7 @@ struct elf_obj_tdata
c3e0b25
   struct sdt_note *sdt_note_head;
c3e0b25
 
c3e0b25
   Elf_Internal_Shdr **group_sect_ptr;
c3e0b25
-  int num_group;
c3e0b25
+  unsigned int num_group;
c3e0b25
 
c3e0b25
   /* Index into group_sect_ptr, updated by setup_group when finding a
c3e0b25
      section's group.  Used to optimize subsequent group searches.  */