]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
readelf.c gcc-4.9 compile error
authorAlan Modra <amodra@gmail.com>
Wed, 15 Jul 2026 21:57:58 +0000 (07:27 +0930)
committerAlan Modra <amodra@gmail.com>
Wed, 15 Jul 2026 22:04:30 +0000 (07:34 +0930)
gcc-4.9 doesn't like an empty initialiser.

binutils/readelf.c: In function ‘process_relocs’:
binutils/readelf.c:10229:5: error: missing initializer for field ‘sh_name’ of ‘Elf_Internal_Shdr’ [-Werror=missing-field-initializers]
     Elf_Internal_Shdr section = {};

* readelf.c (process_relocs): Avoid gcc-4.9 compile error.

binutils/readelf.c

index f18fbfbe8b9506e87284c053f99b5a786d481413..a52fe2b8d6375ee6a14476109dd2531ad955d38e 100644 (file)
@@ -10226,12 +10226,12 @@ process_relocs (Filedata * filedata)
                     is passed to readelf.  */
                  uint64_t num_reloc;
                  uint64_t *relrs = NULL;
-                 Elf_Internal_Shdr section = {};
-                 section.sh_offset
-                   = filedata->dynamic_info[DT_RELR];
-                 section.sh_size = rel_size;
-                 section.sh_entsize = rel_entsz;
-                 section.sh_type = SHT_RELR;
+                 Elf_Internal_Shdr section = {
+                   .sh_type = SHT_RELR,
+                   .sh_offset = filedata->dynamic_info[DT_RELR],
+                   .sh_size = rel_size,
+                   .sh_entsize = rel_entsz
+                 };
                  validate_section_info (&section, NULL, 0, filedata);
                  num_reloc = count_relr_relocations (filedata,
                                                      &section,