]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
bfd: fix -std=gnu23 compatibility wrt _Bool
authorSam James <sam@gentoo.org>
Sat, 16 Nov 2024 05:01:58 +0000 (05:01 +0000)
committerSam James <sam@gentoo.org>
Mon, 18 Nov 2024 03:09:14 +0000 (03:09 +0000)
GCC trunk now defaults to -std=gnu23. We return false in a few places
which can't work when true/false are a proper type (_Bool). Return NULL
where appropriate instead of false. All callers handle this appropriately.

ChangeLog:
PR ld/32372

* elf32-ppc.c (ppc_elf_tls_setup): Return NULL.
        * elf32-xtensa.c (translate_reloc_bfd_fix): Ditto.
        (translate_reloc): Ditto.
        * elf64-ppc.c (update_local_sym_info): Ditto.
        * mach-o.c (bfd_mach_o_lookup_uuid_command): Ditto.
        * xsym.c (bfd_sym_read_name_table): Ditto.

bfd/elf32-ppc.c
bfd/elf32-xtensa.c
bfd/elf64-ppc.c
bfd/mach-o.c
bfd/xsym.c

index a5370a0624e8a7121e510d498e6e0f636a4e91b9..8c89ae1611fb3e3e1ce94bb0081575b2e1553c21 100644 (file)
@@ -4352,7 +4352,7 @@ ppc_elf_tls_setup (bfd *obfd, struct bfd_link_info *info)
                      _bfd_elf_strtab_delref (elf_hash_table (info)->dynstr,
                                              opt->dynstr_index);
                      if (!bfd_elf_link_record_dynamic_symbol (info, opt))
-                       return false;
+                       return NULL;
                    }
                  htab->tls_get_addr = opt;
                }
index eb7fef9331ec93e7b581b5d00f05b39b46934964..58f79e55529097a3b8febe533446689c60c417b6 100644 (file)
@@ -10070,7 +10070,7 @@ translate_reloc_bfd_fix (reloc_bfd_fix *fix)
      location.  Otherwise, the relocation should move within the
      section.  */
 
-  removed = false;
+  removed = NULL;
   if (is_operand_relocation (fix->src_type))
     {
       /* Check if the original relocation is against a literal being
@@ -10141,7 +10141,7 @@ translate_reloc (const r_reloc *orig_rel, r_reloc *new_rel, asection *sec)
 
   target_offset = orig_rel->target_offset;
 
-  removed = false;
+  removed = NULL;
   if (is_operand_relocation (ELF32_R_TYPE (orig_rel->rela.r_info)))
     {
       /* Check if the original relocation is against a literal being
index cd3aaacaeb352d6bd74d563b1dbb2b370f852cd1..9674fcdd6be76dc9deb2af7204424b724da871e3 100644 (file)
@@ -4664,7 +4664,7 @@ update_local_sym_info (bfd *abfd, Elf_Internal_Shdr *symtab_hdr,
          size_t amt = sizeof (*ent);
          ent = bfd_alloc (abfd, amt);
          if (ent == NULL)
-           return false;
+           return NULL;
          ent->next = local_got_ents[r_symndx];
          ent->addend = r_addend;
          ent->owner = abfd;
index 93224aaed00f95d78ca7161fe8c39e22b9c52581..974747caadd8b46ac98cd2b94521c51c11e36b68 100644 (file)
@@ -6037,7 +6037,7 @@ bfd_mach_o_lookup_uuid_command (bfd *abfd)
   bfd_mach_o_load_command *uuid_cmd = NULL;
   int ncmd = bfd_mach_o_lookup_command (abfd, BFD_MACH_O_LC_UUID, &uuid_cmd);
   if (ncmd != 1 || uuid_cmd == NULL)
-    return false;
+    return NULL;
   return &uuid_cmd->command.uuid;
 }
 
index 070ba4a231856875b5fa7a18c62e407443cfbb0c..fe14acc121fbff91340db3f22550ef999449c1bc 100644 (file)
@@ -130,7 +130,7 @@ bfd_sym_read_name_table (bfd *abfd, bfd_sym_header_block *dshb)
   size_t table_offset = dshb->dshb_nte.dti_first_page * dshb->dshb_page_size;
 
   if (bfd_seek (abfd, table_offset, SEEK_SET) != 0)
-    return false;
+    return NULL;
   return _bfd_alloc_and_read (abfd, table_size, table_size);
 }