bfd: Change num_group to unsigned int
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 24 Mar 2020 11:52:39 +0000 (04:52 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 24 Mar 2020 11:52:39 +0000 (04:52 -0700)
elf.c failed with to with GCC 10 as of

commit 906b3eb9df6c577d3f6e9c3ea5c9d7e4d1e90536
Author: Martin Liska <mliska@suse.cz>
Date:   Tue Mar 24 11:40:10 2020 +0100

    Improve endianess detection.

            PR lto/94249
            * plugin-api.h: Add more robust endianess detection.

binutils-gdb/bfd/elf.c: In function ‘setup_group’:
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]
  740 |     elf_tdata (abfd)->num_group = num_group = -1;
      |                                   ^~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [Makefile:1608: elf.lo] Error 1

Change num_group in elf_obj_tdata to unsigned int to compile with GCC 10.

PR binutils/25717
* elf-bfd.h (elf_obj_tdata): Change num_group to unsigned int.

bfd/ChangeLog
bfd/elf-bfd.h

index 7cc34c1bb9b13a481ced670300eddf854dfa9474..8ec3782d9ff6369caa5c539ff1c2a6ea3ba1550f 100644 (file)
@@ -1,3 +1,8 @@
+2020-03-24  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR binutils/25717
+       * elf-bfd.h (elf_obj_tdata): Change num_group to unsigned int.
+
 2020-03-24  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR binutils/25708
index c546b583b87cf6a3639afa4566969b26268bdd9e..5f3a5cc04b17aa825098f3567426f36b67d290dc 100644 (file)
@@ -1953,7 +1953,7 @@ struct elf_obj_tdata
   struct sdt_note *sdt_note_head;
 
   Elf_Internal_Shdr **group_sect_ptr;
-  int num_group;
+  unsigned int num_group;
 
   /* Index into group_sect_ptr, updated by setup_group when finding a
      section's group.  Used to optimize subsequent group searches.  */
This page took 0.027837 seconds and 4 git commands to generate.