]> 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)
committerMatthew Malcomson <matthew.malcomson@arm.com>
Wed, 4 Aug 2021 11:04:38 +0000 (12:04 +0100)
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 db04f8a0f8a0f05a108823541d38ae7d251f4ebf..94f5cbca3baf7415bc96365e592e98d905dac484 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 5735d127848bdf22685b436b541424f4af0ae636..4b66d542191263fbef4ff6f82957848c3fe2708f 100644 (file)
@@ -2206,7 +2206,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.  */
@@ -8031,7 +8032,7 @@ tc_aarch64_fde_entry_init_extra(struct fde_entry *fde)
 bfd_boolean
 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 c463d4ddaffa65d2c157a343ee3719c7b1b8628b..a13ff33ce4380479346ba1c10641583c69b334f9 100644 (file)
@@ -470,7 +470,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];
 
@@ -2799,11 +2800,12 @@ 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;
 
-             for (size_t i = 0; aarch64_sys_regs[i].name; ++i)
+             for (i = 0; aarch64_sys_regs[i].name; ++i)
                if (aarch64_sys_regs[i].value == opnd->sysreg.value)
                    {
                      part_match = TRUE;