]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Apply changes to allow compiling with -ansi
authorMatthew Malcomson <matthew.malcomson@arm.com>
Wed, 4 Aug 2021 11:04:38 +0000 (12:04 +0100)
committerJohn Baldwin <jhb@FreeBSD.org>
Thu, 1 Sep 2022 22:59:24 +0000 (15:59 -0700)
This is just to help anyone trying to build Morello binutils with a very
old system compiler.

At the time we branched, binutils wanted to be able to be build using C89.
These changes are what is needed to compile using the `-ansi` flag (i.e.
using that C89 flag).

bfd/elfnn-aarch64.c
gas/config/tc-aarch64.c
opcodes/aarch64-opc.c

index d3b53395d9310466e1db07839c88bf30cb3a2403..84286a7ee284daffe68eb100a0b49416d1a845d3 100644 (file)
@@ -4892,6 +4892,7 @@ elfNN_c64_resize_sections (bfd *output_bfd, struct bfd_link_info *info,
   asection *sec, *pcc_low_sec = NULL, *pcc_high_sec = NULL;
   struct elf_aarch64_link_hash_table *htab = elf_aarch64_hash_table (info);
   bfd_vma low = (bfd_vma) -1, high = 0;
+  bfd *input_bfd;
 
   htab->layout_sections_again = layout_sections_again;
 
@@ -4903,7 +4904,7 @@ elfNN_c64_resize_sections (bfd *output_bfd, struct bfd_link_info *info,
   /* First, walk through all the relocations to find those referring to linker
      defined and ldscript defined symbols since we set their range to their
      output sections.  */
-  for (bfd *input_bfd = info->input_bfds;
+  for (input_bfd = info->input_bfds;
        htab->c64_rel && input_bfd != NULL; input_bfd = input_bfd->link.next)
     {
       Elf_Internal_Shdr *symtab_hdr;
index 385276cf05928bd621006d02cd61799198369dec..19ff21db219ed53c7e30af36665ab672c88bd7b6 100644 (file)
@@ -2181,7 +2181,8 @@ s_aarch64_chericap (int ignored ATTRIBUTE_UNUSED)
                   BFD_RELOC_MORELLO_CAPINIT);
 
   mapping_state (MAP_DATA);
-  for (int i = 0; i < 4; i++)
+  int i;
+  for (i = 0; i < 4; i++)
     {
       /* The documentation of our md_number_to_chars says the greatest value
         size it can handle is 4 bytes.  */
@@ -8954,7 +8955,7 @@ tc_aarch64_fde_entry_init_extra(struct fde_entry *fde)
 bool
 tc_aarch64_cfi_startproc_exp (const char *arg)
 {
-  // Allow purecap only for C64 functions.
+  /* Allow purecap only for C64 functions.  */
   if (!strcmp ("purecap", arg) && IS_C64)
     return true;
 
index d9f8d71157c5262f112b2fcc125061297d9232b4..ae63531aade9ec27f136f461ba767dfdcb8143fe 100644 (file)
@@ -484,7 +484,8 @@ get_form_from_value (aarch64_insn value)
 const aarch64_form *
 get_form_from_str (const char *form, size_t len)
 {
-  for (unsigned i = 1; i < sizeof (aarch64_forms) / sizeof (aarch64_form); i++)
+  unsigned i;
+  for (i = 1; i < sizeof (aarch64_forms) / sizeof (aarch64_form); i++)
     if (!strncmp (form, aarch64_forms[i].name, len))
       return &aarch64_forms[i];
 
@@ -2814,6 +2815,7 @@ operand_general_constraint_met_p (aarch64_feature_set features,
              unsigned flags = 0;
              int regno_idx = idx == 0 ? 1 : 0;
              enum aarch64_opnd reg_type = opcode->operands[regno_idx];
+             size_t i;
 
              if (reg_type == AARCH64_OPND_Cat)
                flags = F_CAPREG;