From: Matthew Malcomson Date: Wed, 4 Aug 2021 11:04:38 +0000 (+0100) Subject: Apply changes to allow compiling with -ansi X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b944cc65b572a82b97217b6bac6539cc64773fb0;p=thirdparty%2Fbinutils-gdb.git Apply changes to allow compiling with -ansi 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). --- diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index d3b53395d93..84286a7ee28 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -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; diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c index 385276cf059..19ff21db219 100644 --- a/gas/config/tc-aarch64.c +++ b/gas/config/tc-aarch64.c @@ -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; diff --git a/opcodes/aarch64-opc.c b/opcodes/aarch64-opc.c index d9f8d71157c..ae63531aade 100644 --- a/opcodes/aarch64-opc.c +++ b/opcodes/aarch64-opc.c @@ -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;