From 986f078366b193ed9f5bd02af965f3af958ba859 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 19 Feb 2020 13:12:00 +1030 Subject: [PATCH] bfd_size_type to size_t bfd_size_type was invented a long time ago in the K&R days. Many places in binutils ought to be using size_t instead (and there are lots of places that use long or unsigned long that really ought to use size_t too). Note that you can't change everything over to size_t: A 32-bit host needs a larger type than size_t to support reading and processing of 64-bit ELF object files. This patch just tidies some of the more obvious uses of bfd_size_type that could be size_t. There no doubt are more lurking in the source. Incidentally, practically all functions used for output of object files can use size_t and don't need to worry about overflow of size expressions. If you have something like symcount * sizeof (void *) when symcount is counting symbols already in memory then you know that this expression can't overflow since the size of a symbol in memory is larger by far than that of a pointer. * aix386-core.c (aix386_core_file_p): Use size_t for "amt". * aout-target.h (object_p): Likewise. * aout-tic30.c (tic30_aout_object_p): Likewise. * aoutx.h (some_aout_object_p, mkobject, make_empty_symbol), (emit_stringtab, write_syms, link_hash_table_create), (aout_link_write_other_symbol): Likewise. * archive.c (_bfd_generic_mkarchive, bfd_generic_archive_p), (bfd_ar_hdr_from_filesystem, _bfd_write_archive_contents), (_bfd_compute_and_write_armap): Likewise. * archures.c (bfd_arch_list): Likewise. * bfd.c (bfd_record_phdr): Likewise. * binary.c (binary_canonicalize_symtab): Likewise. * cisco-core.c (cisco_core_file_validate): Likewise. * coff-arm.c (coff_arm_link_hash_table_create, find_thumb_glue), (find_arm_glue, record_arm_to_thumb_glue), (record_thumb_to_arm_glue): Likewise. * coff-ppc.c (ppc_coff_link_hash_table_create, record_toc), (ppc_allocate_toc_section): Likewise. * coff-rs6000.c (_bfd_xcoff_mkobject, _bfd_xcoff_archive_p): Likewise. * coff-sh.c (sh_relax_section): Likewise. * coff64-rs6000.c (xcoff64_archive_p): Likewise. * coffcode.h (handle_COMDAT, coff_new_section_hook), (coff_set_alignment_hook, coff_mkobject), (coff_compute_section_file_positions): Likewise. * coffgen.c (coff_make_empty_symbol, coff_bfd_make_debug_symbol), (coff_find_nearest_line_with_names), ( bfd_coff_set_symbol_class): Likewise. * cofflink.c (_bfd_coff_link_hash_table_create), (_bfd_coff_link_input_bfd): Likewise. * dwarf1.c (alloc_dwarf1_unit, alloc_dwarf1_func): Likewise. * dwarf2.c (read_abbrevs, read_attribute_value, add_line_info), (build_line_info_table, sort_line_sequences), (line_info_add_include_dir, line_info_add_file_name), (decode_line_info, scan_unit_for_symbols, parse_comp_unit), (place_sections, _bfd_dwarf2_slurp_debug_info): Likewise. * ecoff.c (_bfd_ecoff_mkobject, _bfd_ecoff_make_empty_symbol), (_bfd_ecoff_find_nearest_line), (_bfd_ecoff_bfd_link_hash_table_create): Likewise. * ecofflink.c (bfd_ecoff_debug_init): Likewise. * elf-hppa.h (_bfd_elf_hppa_gen_reloc_type): Likewise. * elf-m10300.c (mn10300_elf_relax_section), (elf32_mn10300_link_hash_table_create): Likewise. * elf-strtab.c (_bfd_elf_strtab_init): Likewise. * elf.c (make_mapping, copy_elf_program_header): Likewise. * elf32-arm.c (elf32_arm_link_hash_table_create), (elf32_arm_setup_section_lists, elf32_arm_check_relocs), (elf32_arm_new_section_hook): Likewise. * elf32-avr.c (elf_avr_new_section_hook), (elf32_avr_link_hash_table_create, get_local_syms), (elf32_avr_setup_section_lists): Likewise. * elf32-bfin.c (bfinfdpic_elf_link_hash_table_create), (bfin_link_hash_table_create): Likewise. * elf32-cr16.c (elf32_cr16_link_hash_table_create): Likewise. * elf32-cris.c (elf_cris_link_hash_table_create): Likewise. * elf32-csky.c (csky_elf_link_hash_table_create), (csky_elf_check_relocs, elf32_csky_setup_section_lists): Likewise. * elf32-frv.c (frvfdpic_elf_link_hash_table_create): Likewise. * elf32-hppa.c (elf32_hppa_link_hash_table_create), (elf32_hppa_setup_section_lists, get_local_syms): Likewise. * elf32-i386.c (elf_i386_check_relocs): Likewise. * elf32-lm32.c (lm32_elf_link_hash_table_create): Likewise. * elf32-m32r.c (m32r_elf_link_hash_table_create), (m32r_elf_check_relocs): Likewise. * elf32-m68hc1x.c (m68hc11_elf_hash_table_create), (elf32_m68hc11_setup_section_lists), (elf32_m68hc11_size_stubs): Likewise. * elf32-m68k.c (elf_m68k_link_hash_table_create): Likewise. * elf32-metag.c (elf_metag_link_hash_table_create), (elf_metag_setup_section_lists): Likewise. * elf32-microblaze.c (microblaze_elf_link_hash_table_create), (microblaze_elf_check_relocs): Likewise. * elf32-nds32.c (nds32_elf_link_hash_table_create), (nds32_elf_check_relocs): Likewise. * elf32-nios2.c (nios2_elf32_setup_section_lists), (get_local_syms, nios2_elf32_check_relocs), (nios2_elf32_link_hash_table_create): Likewise. * elf32-or1k.c (or1k_elf_link_hash_table_create), (or1k_elf_check_relocs): Likewise. * elf32-ppc.c (ppc_elf_modify_segment_map, update_plt_info): Likewise. * elf32-pru.c (pru_elf32_link_hash_table_create): Likewise. * elf32-s390.c (elf_s390_link_hash_table_create), (elf_s390_check_relocs): Likewise. * elf32-score.c (score_elf_create_got_section), (s3_elf32_score_new_section_hook), (elf32_score_link_hash_table_create): Likewise. * elf32-score7.c (score_elf_create_got_section), (s7_elf32_score_new_section_hook): Likewise. * elf32-sh.c (sh_elf_link_hash_table_create), (sh_elf_check_relocs): Likewise. * elf32-tic6x.c (elf32_tic6x_link_hash_table_create), (elf32_tic6x_new_section_hook, elf32_tic6x_check_relocs): Likewise. * elf32-tilepro.c (tilepro_elf_link_hash_table_create), (tilepro_elf_check_relocs): Likewise. * elf32-v850.c (remember_hi16s_reloc): Likewise. * elf32-vax.c (elf_vax_link_hash_table_create): Likewise. * elf32-xtensa.c (elf_xtensa_link_hash_table_create), (elf_xtensa_new_section_hook): Likewise. * elf64-alpha.c (elf64_alpha_bfd_link_hash_table_create), (get_got_entry, elf64_alpha_check_relocs): Likewise. * elf64-hppa.c (elf64_hppa_hash_table_create): Likewise. * elf64-ia64-vms.c (elf64_ia64_object_p): Likewise. * elf64-mmix.c (mmix_elf_new_section_hook): Likewise. * elf64-ppc.c (ppc64_elf_new_section_hook), (ppc64_elf_link_hash_table_create, update_local_sym_info), (update_plt_info, ppc64_elf_check_relocs): Likewise. * elf64-s390.c (elf_s390_link_hash_table_create), (elf_s390_check_relocs): Likewise. * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise. * elflink.c (bfd_elf_link_record_local_dynamic_symbol), (_bfd_elf_link_find_version_dependencies, elf_link_add_object_symbols), (elf_link_add_archive_symbols, compute_bucket_count), (bfd_elf_size_dynsym_hash_dynstr, _bfd_elf_link_hash_table_create), (bfd_elf_get_bfd_needed_list, elf_link_swap_symbols_out), (bfd_elf_final_link): Likewise. * elfnn-aarch64.c (elfNN_aarch64_link_hash_table_create), (elfNN_aarch64_setup_section_lists, elfNN_aarch64_check_relocs), (elfNN_aarch64_new_section_hook): Likewise. * elfnn-ia64.c (elfNN_ia64_object_p): Likewise. * elfnn-riscv.c (riscv_elf_link_hash_table_create), (riscv_elf_check_relocs): Likewise. * elfxx-mips.c (_bfd_mips_elf_new_section_hook), (_bfd_mips_elf_add_symbol_hook, _bfd_mips_elf_check_relocs), (_bfd_mips_elf_modify_segment_map, _bfd_mips_elf_set_section_contents), (_bfd_mips_elf_link_hash_table_create): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_link_hash_table_create), (_bfd_sparc_elf_check_relocs), (_bfd_sparc_elf_new_section_hook): Likewise. * elfxx-tilegx.c (tilegx_elf_link_hash_table_create), (tilegx_elf_check_relocs): Likewise. * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Likewise. * format.c (bfd_check_format_matches): Likewise. * hash.c (_bfd_stringtab_init): Likewise. * ihex.c (ihex_scan): Likewise. * irix-core.c (irix_core_core_file_p): Likewise. * linker.c (bfd_wrapped_link_hash_lookup), (_bfd_generic_link_hash_table_create), (_bfd_generic_reloc_link_order): Likewise. * lynx-core.c (lynx_core_file_p): Likewise. * netbsd-core.c (netbsd_core_file_p): Likewise. * osf-core.c (osf_core_core_file_p): Likewise. * pdp11.c (some_aout_object_p, mkobject, make_empty_symbol), (link_hash_table_create, aout_link_write_other_symbol): Likewise. * peXXigen.c (_bfd_XX_bfd_copy_private_section_data): Likewise. * peicode.h (pe_mkobject): Likewise. * ppcboot.c (ppcboot_mkobject, ppcboot_canonicalize_symtab): Likewise. * ptrace-core.c (ptrace_unix_core_file_p): Likewise. * sco5-core.c (read_uarea): Likewise. * som.c (hppa_som_gen_reloc_type, som_object_p, som_prep_headers), (som_write_fixups, som_write_space_strings, som_write_symbol_strings), (som_finish_writing, som_canonicalize_symtab, som_new_section_hook), (som_bfd_copy_private_section_data, bfd_som_set_section_attributes), (bfd_som_attach_aux_hdr, som_write_armap): Likewise. * srec.c (srec_scan): Likewise. * syms.c (_bfd_generic_make_empty_symbol): Likewise. * targets.c (bfd_target_list): Likewise. * tekhex.c (first_phase, tekhex_sizeof_headers): Likewise. * trad-core.c (trad_unix_core_file_p): Likewise. * vms-alpha.c (vms_initialize, alpha_vms_bfd_link_hash_table_create), (vms_new_section_hook): Likewise. * wasm-module.c (wasm_make_empty_symbol): Likewise. * xcofflink.c (xcoff_get_section_contents), (_bfd_xcoff_bfd_link_hash_table_create, xcoff_set_import_path), (xcoff_find_function, bfd_xcoff_link_record_set, xcoff_build_ldsym), (bfd_xcoff_size_dynamic_sections, xcoff_link_input_bfd): Likewise. --- bfd/ChangeLog | 167 +++++++++++++++++++++++++++++++++++++++++ bfd/aix386-core.c | 2 +- bfd/aout-target.h | 2 +- bfd/aout-tic30.c | 2 +- bfd/aoutx.h | 16 ++-- bfd/archive.c | 10 +-- bfd/archures.c | 2 +- bfd/bfd.c | 2 +- bfd/binary.c | 2 +- bfd/cisco-core.c | 2 +- bfd/coff-arm.c | 10 +-- bfd/coff-ppc.c | 8 +- bfd/coff-rs6000.c | 4 +- bfd/coff-sh.c | 2 +- bfd/coff64-rs6000.c | 2 +- bfd/coffcode.h | 12 +-- bfd/coffgen.c | 8 +- bfd/cofflink.c | 4 +- bfd/dwarf1.c | 4 +- bfd/dwarf2.c | 44 +++++------ bfd/ecoff.c | 8 +- bfd/ecofflink.c | 2 +- bfd/elf-hppa.h | 2 +- bfd/elf-m10300.c | 8 +- bfd/elf-strtab.c | 2 +- bfd/elf.c | 6 +- bfd/elf32-arm.c | 8 +- bfd/elf32-avr.c | 8 +- bfd/elf32-bfin.c | 4 +- bfd/elf32-cr16.c | 2 +- bfd/elf32-cris.c | 2 +- bfd/elf32-csky.c | 6 +- bfd/elf32-frv.c | 2 +- bfd/elf32-hppa.c | 6 +- bfd/elf32-i386.c | 2 +- bfd/elf32-lm32.c | 2 +- bfd/elf32-m32r.c | 4 +- bfd/elf32-m68hc1x.c | 6 +- bfd/elf32-m68k.c | 2 +- bfd/elf32-metag.c | 6 +- bfd/elf32-microblaze.c | 4 +- bfd/elf32-nds32.c | 4 +- bfd/elf32-nios2.c | 8 +- bfd/elf32-or1k.c | 4 +- bfd/elf32-ppc.c | 4 +- bfd/elf32-pru.c | 2 +- bfd/elf32-s390.c | 4 +- bfd/elf32-score.c | 6 +- bfd/elf32-score7.c | 4 +- bfd/elf32-sh.c | 4 +- bfd/elf32-tic6x.c | 6 +- bfd/elf32-tilepro.c | 4 +- bfd/elf32-v850.c | 2 +- bfd/elf32-vax.c | 2 +- bfd/elf32-xtensa.c | 4 +- bfd/elf64-alpha.c | 7 +- bfd/elf64-hppa.c | 2 +- bfd/elf64-ia64-vms.c | 2 +- bfd/elf64-mmix.c | 2 +- bfd/elf64-ppc.c | 12 +-- bfd/elf64-s390.c | 4 +- bfd/elf64-x86-64.c | 2 +- bfd/elflink.c | 42 +++++------ bfd/elfnn-aarch64.c | 8 +- bfd/elfnn-ia64.c | 2 +- bfd/elfnn-riscv.c | 4 +- bfd/elfxx-mips.c | 14 ++-- bfd/elfxx-sparc.c | 6 +- bfd/elfxx-tilegx.c | 4 +- bfd/elfxx-x86.c | 2 +- bfd/format.c | 2 +- bfd/hash.c | 2 +- bfd/ihex.c | 2 +- bfd/irix-core.c | 2 +- bfd/linker.c | 6 +- bfd/lynx-core.c | 2 +- bfd/netbsd-core.c | 2 +- bfd/osf-core.c | 2 +- bfd/pdp11.c | 10 +-- bfd/peXXigen.c | 4 +- bfd/peicode.h | 2 +- bfd/ppcboot.c | 4 +- bfd/ptrace-core.c | 2 +- bfd/sco5-core.c | 2 +- bfd/som.c | 32 ++++---- bfd/srec.c | 2 +- bfd/syms.c | 2 +- bfd/targets.c | 2 +- bfd/tekhex.c | 4 +- bfd/trad-core.c | 2 +- bfd/vms-alpha.c | 6 +- bfd/wasm-module.c | 2 +- bfd/xcofflink.c | 16 ++-- 93 files changed, 420 insertions(+), 260 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 9e3190d0bd..4b2d8249b1 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,170 @@ +2020-02-19 Alan Modra + + * aix386-core.c (aix386_core_file_p): Use size_t for "amt". + * aout-target.h (object_p): Likewise. + * aout-tic30.c (tic30_aout_object_p): Likewise. + * aoutx.h (some_aout_object_p, mkobject, make_empty_symbol), + (emit_stringtab, write_syms, link_hash_table_create), + (aout_link_write_other_symbol): Likewise. + * archive.c (_bfd_generic_mkarchive, bfd_generic_archive_p), + (bfd_ar_hdr_from_filesystem, _bfd_write_archive_contents), + (_bfd_compute_and_write_armap): Likewise. + * archures.c (bfd_arch_list): Likewise. + * bfd.c (bfd_record_phdr): Likewise. + * binary.c (binary_canonicalize_symtab): Likewise. + * cisco-core.c (cisco_core_file_validate): Likewise. + * coff-arm.c (coff_arm_link_hash_table_create, find_thumb_glue), + (find_arm_glue, record_arm_to_thumb_glue), + (record_thumb_to_arm_glue): Likewise. + * coff-ppc.c (ppc_coff_link_hash_table_create, record_toc), + (ppc_allocate_toc_section): Likewise. + * coff-rs6000.c (_bfd_xcoff_mkobject, _bfd_xcoff_archive_p): Likewise. + * coff-sh.c (sh_relax_section): Likewise. + * coff64-rs6000.c (xcoff64_archive_p): Likewise. + * coffcode.h (handle_COMDAT, coff_new_section_hook), + (coff_set_alignment_hook, coff_mkobject), + (coff_compute_section_file_positions): Likewise. + * coffgen.c (coff_make_empty_symbol, coff_bfd_make_debug_symbol), + (coff_find_nearest_line_with_names), + ( bfd_coff_set_symbol_class): Likewise. + * cofflink.c (_bfd_coff_link_hash_table_create), + (_bfd_coff_link_input_bfd): Likewise. + * dwarf1.c (alloc_dwarf1_unit, alloc_dwarf1_func): Likewise. + * dwarf2.c (read_abbrevs, read_attribute_value, add_line_info), + (build_line_info_table, sort_line_sequences), + (line_info_add_include_dir, line_info_add_file_name), + (decode_line_info, scan_unit_for_symbols, parse_comp_unit), + (place_sections, _bfd_dwarf2_slurp_debug_info): Likewise. + * ecoff.c (_bfd_ecoff_mkobject, _bfd_ecoff_make_empty_symbol), + (_bfd_ecoff_find_nearest_line), + (_bfd_ecoff_bfd_link_hash_table_create): Likewise. + * ecofflink.c (bfd_ecoff_debug_init): Likewise. + * elf-hppa.h (_bfd_elf_hppa_gen_reloc_type): Likewise. + * elf-m10300.c (mn10300_elf_relax_section), + (elf32_mn10300_link_hash_table_create): Likewise. + * elf-strtab.c (_bfd_elf_strtab_init): Likewise. + * elf.c (make_mapping, copy_elf_program_header): Likewise. + * elf32-arm.c (elf32_arm_link_hash_table_create), + (elf32_arm_setup_section_lists, elf32_arm_check_relocs), + (elf32_arm_new_section_hook): Likewise. + * elf32-avr.c (elf_avr_new_section_hook), + (elf32_avr_link_hash_table_create, get_local_syms), + (elf32_avr_setup_section_lists): Likewise. + * elf32-bfin.c (bfinfdpic_elf_link_hash_table_create), + (bfin_link_hash_table_create): Likewise. + * elf32-cr16.c (elf32_cr16_link_hash_table_create): Likewise. + * elf32-cris.c (elf_cris_link_hash_table_create): Likewise. + * elf32-csky.c (csky_elf_link_hash_table_create), + (csky_elf_check_relocs, elf32_csky_setup_section_lists): Likewise. + * elf32-frv.c (frvfdpic_elf_link_hash_table_create): Likewise. + * elf32-hppa.c (elf32_hppa_link_hash_table_create), + (elf32_hppa_setup_section_lists, get_local_syms): Likewise. + * elf32-i386.c (elf_i386_check_relocs): Likewise. + * elf32-lm32.c (lm32_elf_link_hash_table_create): Likewise. + * elf32-m32r.c (m32r_elf_link_hash_table_create), + (m32r_elf_check_relocs): Likewise. + * elf32-m68hc1x.c (m68hc11_elf_hash_table_create), + (elf32_m68hc11_setup_section_lists), + (elf32_m68hc11_size_stubs): Likewise. + * elf32-m68k.c (elf_m68k_link_hash_table_create): Likewise. + * elf32-metag.c (elf_metag_link_hash_table_create), + (elf_metag_setup_section_lists): Likewise. + * elf32-microblaze.c (microblaze_elf_link_hash_table_create), + (microblaze_elf_check_relocs): Likewise. + * elf32-nds32.c (nds32_elf_link_hash_table_create), + (nds32_elf_check_relocs): Likewise. + * elf32-nios2.c (nios2_elf32_setup_section_lists), + (get_local_syms, nios2_elf32_check_relocs), + (nios2_elf32_link_hash_table_create): Likewise. + * elf32-or1k.c (or1k_elf_link_hash_table_create), + (or1k_elf_check_relocs): Likewise. + * elf32-ppc.c (ppc_elf_modify_segment_map, update_plt_info): Likewise. + * elf32-pru.c (pru_elf32_link_hash_table_create): Likewise. + * elf32-s390.c (elf_s390_link_hash_table_create), + (elf_s390_check_relocs): Likewise. + * elf32-score.c (score_elf_create_got_section), + (s3_elf32_score_new_section_hook), + (elf32_score_link_hash_table_create): Likewise. + * elf32-score7.c (score_elf_create_got_section), + (s7_elf32_score_new_section_hook): Likewise. + * elf32-sh.c (sh_elf_link_hash_table_create), + (sh_elf_check_relocs): Likewise. + * elf32-tic6x.c (elf32_tic6x_link_hash_table_create), + (elf32_tic6x_new_section_hook, elf32_tic6x_check_relocs): Likewise. + * elf32-tilepro.c (tilepro_elf_link_hash_table_create), + (tilepro_elf_check_relocs): Likewise. + * elf32-v850.c (remember_hi16s_reloc): Likewise. + * elf32-vax.c (elf_vax_link_hash_table_create): Likewise. + * elf32-xtensa.c (elf_xtensa_link_hash_table_create), + (elf_xtensa_new_section_hook): Likewise. + * elf64-alpha.c (elf64_alpha_bfd_link_hash_table_create), + (get_got_entry, elf64_alpha_check_relocs): Likewise. + * elf64-hppa.c (elf64_hppa_hash_table_create): Likewise. + * elf64-ia64-vms.c (elf64_ia64_object_p): Likewise. + * elf64-mmix.c (mmix_elf_new_section_hook): Likewise. + * elf64-ppc.c (ppc64_elf_new_section_hook), + (ppc64_elf_link_hash_table_create, update_local_sym_info), + (update_plt_info, ppc64_elf_check_relocs): Likewise. + * elf64-s390.c (elf_s390_link_hash_table_create), + (elf_s390_check_relocs): Likewise. + * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise. + * elflink.c (bfd_elf_link_record_local_dynamic_symbol), + (_bfd_elf_link_find_version_dependencies, elf_link_add_object_symbols), + (elf_link_add_archive_symbols, compute_bucket_count), + (bfd_elf_size_dynsym_hash_dynstr, _bfd_elf_link_hash_table_create), + (bfd_elf_get_bfd_needed_list, elf_link_swap_symbols_out), + (bfd_elf_final_link): Likewise. + * elfnn-aarch64.c (elfNN_aarch64_link_hash_table_create), + (elfNN_aarch64_setup_section_lists, elfNN_aarch64_check_relocs), + (elfNN_aarch64_new_section_hook): Likewise. + * elfnn-ia64.c (elfNN_ia64_object_p): Likewise. + * elfnn-riscv.c (riscv_elf_link_hash_table_create), + (riscv_elf_check_relocs): Likewise. + * elfxx-mips.c (_bfd_mips_elf_new_section_hook), + (_bfd_mips_elf_add_symbol_hook, _bfd_mips_elf_check_relocs), + (_bfd_mips_elf_modify_segment_map, _bfd_mips_elf_set_section_contents), + (_bfd_mips_elf_link_hash_table_create): Likewise. + * elfxx-sparc.c (_bfd_sparc_elf_link_hash_table_create), + (_bfd_sparc_elf_check_relocs), + (_bfd_sparc_elf_new_section_hook): Likewise. + * elfxx-tilegx.c (tilegx_elf_link_hash_table_create), + (tilegx_elf_check_relocs): Likewise. + * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Likewise. + * format.c (bfd_check_format_matches): Likewise. + * hash.c (_bfd_stringtab_init): Likewise. + * ihex.c (ihex_scan): Likewise. + * irix-core.c (irix_core_core_file_p): Likewise. + * linker.c (bfd_wrapped_link_hash_lookup), + (_bfd_generic_link_hash_table_create), + (_bfd_generic_reloc_link_order): Likewise. + * lynx-core.c (lynx_core_file_p): Likewise. + * netbsd-core.c (netbsd_core_file_p): Likewise. + * osf-core.c (osf_core_core_file_p): Likewise. + * pdp11.c (some_aout_object_p, mkobject, make_empty_symbol), + (link_hash_table_create, aout_link_write_other_symbol): Likewise. + * peXXigen.c (_bfd_XX_bfd_copy_private_section_data): Likewise. + * peicode.h (pe_mkobject): Likewise. + * ppcboot.c (ppcboot_mkobject, ppcboot_canonicalize_symtab): Likewise. + * ptrace-core.c (ptrace_unix_core_file_p): Likewise. + * sco5-core.c (read_uarea): Likewise. + * som.c (hppa_som_gen_reloc_type, som_object_p, som_prep_headers), + (som_write_fixups, som_write_space_strings, som_write_symbol_strings), + (som_finish_writing, som_canonicalize_symtab, som_new_section_hook), + (som_bfd_copy_private_section_data, bfd_som_set_section_attributes), + (bfd_som_attach_aux_hdr, som_write_armap): Likewise. + * srec.c (srec_scan): Likewise. + * syms.c (_bfd_generic_make_empty_symbol): Likewise. + * targets.c (bfd_target_list): Likewise. + * tekhex.c (first_phase, tekhex_sizeof_headers): Likewise. + * trad-core.c (trad_unix_core_file_p): Likewise. + * vms-alpha.c (vms_initialize, alpha_vms_bfd_link_hash_table_create), + (vms_new_section_hook): Likewise. + * wasm-module.c (wasm_make_empty_symbol): Likewise. + * xcofflink.c (xcoff_get_section_contents), + (_bfd_xcoff_bfd_link_hash_table_create, xcoff_set_import_path), + (xcoff_find_function, bfd_xcoff_link_record_set, xcoff_build_ldsym), + (bfd_xcoff_size_dynamic_sections, xcoff_link_input_bfd): Likewise. + 2020-02-19 Alan Modra * elfxx-riscv.c (riscv_multi_letter_ext_valid_p): Don't use C99. diff --git a/bfd/aix386-core.c b/bfd/aix386-core.c index 1883d9843b..c9ec756c4a 100644 --- a/bfd/aix386-core.c +++ b/bfd/aix386-core.c @@ -71,7 +71,7 @@ aix386_core_file_p (bfd *abfd) int i, n; unsigned char longbuf[4]; /* Raw bytes of various header fields */ bfd_size_type core_size = sizeof (struct corehdr); - bfd_size_type amt; + size_t amt; struct corehdr *core; struct mergem { diff --git a/bfd/aout-target.h b/bfd/aout-target.h index bf74df7b80..00024e6be2 100644 --- a/bfd/aout-target.h +++ b/bfd/aout-target.h @@ -134,7 +134,7 @@ MY (object_p) (bfd *abfd) struct external_exec exec_bytes; /* Raw exec header from file. */ struct internal_exec exec; /* Cleaned-up exec header. */ const bfd_target *target; - bfd_size_type amt = EXEC_BYTES_SIZE; + size_t amt = EXEC_BYTES_SIZE; if (bfd_bread ((void *) &exec_bytes, amt, abfd) != amt) { diff --git a/bfd/aout-tic30.c b/bfd/aout-tic30.c index ab89bb5490..06f401cc7e 100644 --- a/bfd/aout-tic30.c +++ b/bfd/aout-tic30.c @@ -553,7 +553,7 @@ tic30_aout_object_p (bfd *abfd) struct external_exec exec_bytes; /* Raw exec header from file. */ struct internal_exec exec; /* Cleaned-up exec header. */ const bfd_target *target; - bfd_size_type amt = EXEC_BYTES_SIZE; + size_t amt = EXEC_BYTES_SIZE; if (bfd_bread (& exec_bytes, amt, abfd) != amt) { diff --git a/bfd/aoutx.h b/bfd/aoutx.h index fa3a9746b6..df04ab2644 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -459,7 +459,7 @@ NAME (aout, some_aout_object_p) (bfd *abfd, { struct aout_data_struct *rawptr, *oldrawptr; const bfd_target *result; - bfd_size_type amt = sizeof (* rawptr); + size_t amt = sizeof (* rawptr); rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, amt); if (rawptr == NULL) @@ -671,7 +671,7 @@ bfd_boolean NAME (aout, mkobject) (bfd *abfd) { struct aout_data_struct *rawptr; - bfd_size_type amt = sizeof (* rawptr); + size_t amt = sizeof (* rawptr); bfd_set_error (bfd_error_system_call); @@ -1675,7 +1675,7 @@ translate_to_native_sym_flags (bfd *abfd, asymbol * NAME (aout, make_empty_symbol) (bfd *abfd) { - bfd_size_type amt = sizeof (aout_symbol_type); + size_t amt = sizeof (aout_symbol_type); aout_symbol_type *new_symbol = (aout_symbol_type *) bfd_zalloc (abfd, amt); if (!new_symbol) @@ -1852,7 +1852,7 @@ static bfd_boolean emit_stringtab (bfd *abfd, struct bfd_strtab_hash *tab) { bfd_byte buffer[BYTES_IN_WORD]; - bfd_size_type amt = BYTES_IN_WORD; + size_t amt = BYTES_IN_WORD; /* The string table starts with the size. */ PUT_WORD (abfd, _bfd_stringtab_size (tab) + BYTES_IN_WORD, buffer); @@ -1878,7 +1878,7 @@ NAME (aout, write_syms) (bfd *abfd) asymbol *g = generic[count]; bfd_size_type indx; struct external_nlist nsp; - bfd_size_type amt; + size_t amt; indx = add_to_stringtab (abfd, strtab, g->name, FALSE); if (indx == (bfd_size_type) -1) @@ -2980,7 +2980,7 @@ struct bfd_link_hash_table * NAME (aout, link_hash_table_create) (bfd *abfd) { struct aout_link_hash_table *ret; - bfd_size_type amt = sizeof (* ret); + size_t amt = sizeof (* ret); ret = (struct aout_link_hash_table *) bfd_malloc (amt); if (ret == NULL) @@ -3634,7 +3634,7 @@ aout_link_write_other_symbol (struct bfd_hash_entry *bh, void *data) bfd_vma val; struct external_nlist outsym; bfd_size_type indx; - bfd_size_type amt; + size_t amt; if (h->root.type == bfd_link_hash_warning) { @@ -3759,7 +3759,7 @@ aout_link_reloc_link_order (struct aout_final_link_info *flaginfo, struct reloc_std_external srel; struct reloc_ext_external erel; void * rel_ptr; - bfd_size_type amt; + size_t amt; pr = p->u.reloc.p; diff --git a/bfd/archive.c b/bfd/archive.c index 3d5635a9f2..67d1c9e153 100644 --- a/bfd/archive.c +++ b/bfd/archive.c @@ -212,7 +212,7 @@ _bfd_ar_sizepad (char *p, size_t n, bfd_size_type size) bfd_boolean _bfd_generic_mkarchive (bfd *abfd) { - bfd_size_type amt = sizeof (struct artdata); + size_t amt = sizeof (struct artdata); abfd->tdata.aout_ar_data = (struct artdata *) bfd_zalloc (abfd, amt); if (bfd_ardata (abfd) == NULL) @@ -847,7 +847,7 @@ bfd_generic_archive_p (bfd *abfd) { struct artdata *tdata_hold; char armag[SARMAG + 1]; - bfd_size_type amt; + size_t amt; if (bfd_bread (armag, SARMAG, abfd) != SARMAG) { @@ -1837,7 +1837,7 @@ bfd_ar_hdr_from_filesystem (bfd *abfd, const char *filename, bfd *member) struct stat status; struct areltdata *ared; struct ar_hdr *hdr; - bfd_size_type amt; + size_t amt; if (member && (member->flags & BFD_IN_MEMORY) != 0) { @@ -2187,7 +2187,7 @@ _bfd_write_archive_contents (bfd *arch) while (remaining) { - unsigned int amt = DEFAULT_BUFFERSIZE; + size_t amt = DEFAULT_BUFFERSIZE; if (amt > remaining) amt = remaining; @@ -2251,7 +2251,7 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength) asymbol **syms = NULL; long syms_max = 0; bfd_boolean ret; - bfd_size_type amt; + size_t amt; static bfd_boolean report_plugin_err = TRUE; /* Dunno if this is the best place for this info... */ diff --git a/bfd/archures.c b/bfd/archures.c index 885b027e43..1544b7b483 100644 --- a/bfd/archures.c +++ b/bfd/archures.c @@ -853,7 +853,7 @@ bfd_arch_list (void) const char **name_ptr; const char **name_list; const bfd_arch_info_type * const *app; - bfd_size_type amt; + size_t amt; /* Determine the number of architectures. */ vec_length = 0; diff --git a/bfd/bfd.c b/bfd/bfd.c index b1050626b6..574cebd8de 100644 --- a/bfd/bfd.c +++ b/bfd/bfd.c @@ -2169,7 +2169,7 @@ bfd_record_phdr (bfd *abfd, asection **secs) { struct elf_segment_map *m, **pm; - bfd_size_type amt; + size_t amt; if (bfd_get_flavour (abfd) != bfd_target_elf_flavour) return TRUE; diff --git a/bfd/binary.c b/bfd/binary.c index 3e4b0d91cf..0683e414d6 100644 --- a/bfd/binary.c +++ b/bfd/binary.c @@ -151,7 +151,7 @@ binary_canonicalize_symtab (bfd *abfd, asymbol **alocation) asection *sec = (asection *) abfd->tdata.any; asymbol *syms; unsigned int i; - bfd_size_type amt = BIN_SYMS * sizeof (asymbol); + size_t amt = BIN_SYMS * sizeof (asymbol); syms = (asymbol *) bfd_alloc (abfd, amt); if (syms == NULL) diff --git a/bfd/cisco-core.c b/bfd/cisco-core.c index 0a5bc4a213..da18d2edbf 100644 --- a/bfd/cisco-core.c +++ b/bfd/cisco-core.c @@ -92,7 +92,7 @@ cisco_core_file_validate (bfd *abfd, int crash_info_loc) unsigned int rambase; sec_ptr asect; struct stat statbuf; - bfd_size_type amt; + size_t amt; flagword flags; if (bfd_seek (abfd, (file_ptr) crash_info_loc, SEEK_SET) != 0) diff --git a/bfd/coff-arm.c b/bfd/coff-arm.c index c2623d2f29..b7ebe96a59 100644 --- a/bfd/coff-arm.c +++ b/bfd/coff-arm.c @@ -924,7 +924,7 @@ static struct bfd_link_hash_table * coff_arm_link_hash_table_create (bfd * abfd) { struct coff_arm_link_hash_table * ret; - bfd_size_type amt = sizeof (struct coff_arm_link_hash_table); + size_t amt = sizeof (struct coff_arm_link_hash_table); ret = bfd_zmalloc (amt); if (ret == NULL) @@ -1026,7 +1026,7 @@ find_thumb_glue (struct bfd_link_info *info, { char *tmp_name; struct coff_link_hash_entry *myh; - bfd_size_type amt = strlen (name) + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1; + size_t amt = strlen (name) + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1; tmp_name = bfd_malloc (amt); @@ -1055,7 +1055,7 @@ find_arm_glue (struct bfd_link_info *info, { char *tmp_name; struct coff_link_hash_entry * myh; - bfd_size_type amt = strlen (name) + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1; + size_t amt = strlen (name) + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1; tmp_name = bfd_malloc (amt); @@ -1840,7 +1840,7 @@ record_arm_to_thumb_glue (struct bfd_link_info * info, struct bfd_link_hash_entry * bh; struct coff_arm_link_hash_table * globals; bfd_vma val; - bfd_size_type amt; + size_t amt; globals = coff_arm_hash_table (info); @@ -1896,7 +1896,7 @@ record_thumb_to_arm_glue (struct bfd_link_info * info, struct bfd_link_hash_entry * bh; struct coff_arm_link_hash_table * globals; bfd_vma val; - bfd_size_type amt; + size_t amt; globals = coff_arm_hash_table (info); diff --git a/bfd/coff-ppc.c b/bfd/coff-ppc.c index 3efa89de5a..bc7118fe05 100644 --- a/bfd/coff-ppc.c +++ b/bfd/coff-ppc.c @@ -179,7 +179,7 @@ static struct bfd_link_hash_table * ppc_coff_link_hash_table_create (bfd *abfd) { struct ppc_coff_link_hash_table *ret; - bfd_size_type amt = sizeof (struct ppc_coff_link_hash_table); + size_t amt = sizeof (struct ppc_coff_link_hash_table); ret = (struct ppc_coff_link_hash_table *) bfd_malloc (amt); if (ret == NULL) @@ -771,7 +771,7 @@ record_toc (asection *toc_section, const char *name) { /* Add this entry to our toc addr-offset-name list. */ - bfd_size_type amt = sizeof (struct list_ele); + size_t amt = sizeof (struct list_ele); struct list_ele *t = (struct list_ele *) bfd_malloc (amt); if (t == NULL) @@ -1513,7 +1513,6 @@ ppc_allocate_toc_section (struct bfd_link_info *info ATTRIBUTE_UNUSED) { asection *s; bfd_byte *foo; - bfd_size_type amt; static char test_char = '1'; if ( global_toc_size == 0 ) /* FIXME: does this get me in trouble? */ @@ -1528,8 +1527,7 @@ ppc_allocate_toc_section (struct bfd_link_info *info ATTRIBUTE_UNUSED) /* No toc section? Something is very wrong. */ abort (); - amt = global_toc_size; - foo = (bfd_byte *) bfd_alloc (bfd_of_toc_owner, amt); + foo = (bfd_byte *) bfd_alloc (bfd_of_toc_owner, global_toc_size); memset(foo, test_char, (size_t) global_toc_size); s->size = global_toc_size; diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index e14db6f489..86b4763a10 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -323,7 +323,7 @@ bfd_boolean _bfd_xcoff_mkobject (bfd *abfd) { coff_data_type *coff; - bfd_size_type amt = sizeof (struct xcoff_tdata); + size_t amt = sizeof (struct xcoff_tdata); abfd->tdata.xcoff_obj_data = (struct xcoff_tdata *) bfd_zalloc (abfd, amt); if (abfd->tdata.xcoff_obj_data == NULL) @@ -1389,7 +1389,7 @@ _bfd_xcoff_archive_p (bfd *abfd) { struct artdata *tdata_hold; char magic[SXCOFFARMAG]; - bfd_size_type amt = SXCOFFARMAG; + size_t amt = SXCOFFARMAG; if (bfd_bread (magic, amt, abfd) != amt) { diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c index 2236884138..986cd4d1d0 100644 --- a/bfd/coff-sh.c +++ b/bfd/coff-sh.c @@ -722,7 +722,7 @@ sh_relax_section (bfd *abfd, if (coff_section_data (abfd, sec) == NULL) { - bfd_size_type amt = sizeof (struct coff_section_tdata); + size_t amt = sizeof (struct coff_section_tdata); sec->used_by_bfd = bfd_zalloc (abfd, amt); if (sec->used_by_bfd == NULL) return FALSE; diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c index 0588567f07..d39fe4c590 100644 --- a/bfd/coff64-rs6000.c +++ b/bfd/coff64-rs6000.c @@ -2000,7 +2000,7 @@ xcoff64_archive_p (bfd *abfd) char magic[SXCOFFARMAG]; /* This is the new format. */ struct xcoff_ar_file_hdr_big hdr; - bfd_size_type amt = SXCOFFARMAG; + size_t amt = SXCOFFARMAG; if (bfd_bread (magic, amt, abfd) != amt) { diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 96a7f20d3c..3311b9f813 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -1109,7 +1109,7 @@ handle_COMDAT (bfd * abfd, drop through from the above). */ { char *newname; - bfd_size_type amt; + size_t amt; /* This must the second symbol with the section #. It is the actual symbol name. @@ -1752,7 +1752,7 @@ static bfd_boolean coff_new_section_hook (bfd * abfd, asection * section) { combined_entry_type *native; - bfd_size_type amt; + size_t amt; unsigned char sclass = C_STAT; section->alignment_power = COFF_DEFAULT_SECTION_ALIGNMENT_POWER; @@ -1843,7 +1843,7 @@ coff_set_alignment_hook (bfd * abfd ATTRIBUTE_UNUSED, void * scnhdr) { struct internal_scnhdr *hdr = (struct internal_scnhdr *) scnhdr; - bfd_size_type amt; + size_t amt; unsigned int alignment_power_const = hdr->s_flags & IMAGE_SCN_ALIGN_POWER_BIT_MASK; @@ -1972,7 +1972,7 @@ static bfd_boolean coff_mkobject (bfd * abfd) { coff_data_type *coff; - bfd_size_type amt = sizeof (coff_data_type); + size_t amt = sizeof (coff_data_type); abfd->tdata.coff_obj_data = bfd_zalloc (abfd, amt); if (abfd->tdata.coff_obj_data == NULL) @@ -3088,7 +3088,7 @@ coff_compute_section_file_positions (bfd * abfd) page size too, and remember both sizes. */ if (coff_section_data (abfd, current) == NULL) { - bfd_size_type amt = sizeof (struct coff_section_tdata); + size_t amt = sizeof (struct coff_section_tdata); current->used_by_bfd = bfd_zalloc (abfd, amt); if (current->used_by_bfd == NULL) @@ -3096,7 +3096,7 @@ coff_compute_section_file_positions (bfd * abfd) } if (pei_section_data (abfd, current) == NULL) { - bfd_size_type amt = sizeof (struct pei_section_tdata); + size_t amt = sizeof (struct pei_section_tdata); coff_section_data (abfd, current)->tdata = bfd_zalloc (abfd, amt); if (coff_section_data (abfd, current)->tdata == NULL) diff --git a/bfd/coffgen.c b/bfd/coffgen.c index 31e6fa7a08..cf115d48c8 100644 --- a/bfd/coffgen.c +++ b/bfd/coffgen.c @@ -2025,7 +2025,7 @@ coff_get_reloc_upper_bound (bfd *abfd, sec_ptr asect) asymbol * coff_make_empty_symbol (bfd *abfd) { - bfd_size_type amt = sizeof (coff_symbol_type); + size_t amt = sizeof (coff_symbol_type); coff_symbol_type *new_symbol = (coff_symbol_type *) bfd_zalloc (abfd, amt); if (new_symbol == NULL) @@ -2046,7 +2046,7 @@ coff_bfd_make_debug_symbol (bfd *abfd, void * ptr ATTRIBUTE_UNUSED, unsigned long sz ATTRIBUTE_UNUSED) { - bfd_size_type amt = sizeof (coff_symbol_type); + size_t amt = sizeof (coff_symbol_type); coff_symbol_type *new_symbol = (coff_symbol_type *) bfd_alloc (abfd, amt); if (new_symbol == NULL) @@ -2271,7 +2271,7 @@ coff_find_nearest_line_with_names (bfd *abfd, combined_entry_type *pend; alent *l; struct coff_section_tdata *sec_data; - bfd_size_type amt; + size_t amt; /* Before looking through the symbol table, try to use a .stab section to find the information. */ @@ -2594,7 +2594,7 @@ bfd_coff_set_symbol_class (bfd * abfd, coff_write_alien_symbol(). */ combined_entry_type * native; - bfd_size_type amt = sizeof (* native); + size_t amt = sizeof (* native); native = (combined_entry_type *) bfd_zalloc (abfd, amt); if (native == NULL) diff --git a/bfd/cofflink.c b/bfd/cofflink.c index b2b64db950..e52f543ee6 100644 --- a/bfd/cofflink.c +++ b/bfd/cofflink.c @@ -109,7 +109,7 @@ struct bfd_link_hash_table * _bfd_coff_link_hash_table_create (bfd *abfd) { struct coff_link_hash_table *ret; - bfd_size_type amt = sizeof (struct coff_link_hash_table); + size_t amt = sizeof (struct coff_link_hash_table); ret = (struct coff_link_hash_table *) bfd_malloc (amt); if (ret == NULL) @@ -1647,7 +1647,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *flaginfo, bfd *input_bfd) struct coff_debug_merge_element **epp; bfd_byte *esl, *eslend; struct internal_syment *islp; - bfd_size_type amt; + size_t amt; name = _bfd_coff_internal_syment_name (input_bfd, &isym, buf); if (name == NULL) diff --git a/bfd/dwarf1.c b/bfd/dwarf1.c index 468188713e..7ff80f336a 100644 --- a/bfd/dwarf1.c +++ b/bfd/dwarf1.c @@ -140,7 +140,7 @@ struct linenumber static struct dwarf1_unit* alloc_dwarf1_unit (struct dwarf1_debug* stash) { - bfd_size_type amt = sizeof (struct dwarf1_unit); + size_t amt = sizeof (struct dwarf1_unit); struct dwarf1_unit* x = (struct dwarf1_unit *) bfd_zalloc (stash->abfd, amt); if (x) @@ -158,7 +158,7 @@ alloc_dwarf1_unit (struct dwarf1_debug* stash) static struct dwarf1_func * alloc_dwarf1_func (struct dwarf1_debug* stash, struct dwarf1_unit* aUnit) { - bfd_size_type amt = sizeof (struct dwarf1_func); + size_t amt = sizeof (struct dwarf1_func); struct dwarf1_func* x = (struct dwarf1_func *) bfd_zalloc (stash->abfd, amt); if (x) diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index dd3568a853..cd7aa286eb 100644 --- a/bfd/dwarf2.c +++ b/bfd/dwarf2.c @@ -995,7 +995,7 @@ read_abbrevs (bfd *abfd, bfd_uint64_t offset, struct dwarf2_debug *stash, struct abbrev_info *cur_abbrev; unsigned int abbrev_number, bytes_read, abbrev_name; unsigned int abbrev_form, hash_number; - bfd_size_type amt; + size_t amt; void **slot; struct abbrev_offset_entry ent = { offset, NULL }; @@ -1158,7 +1158,7 @@ read_attribute_value (struct attribute * attr, bfd *abfd = unit->abfd; unsigned int bytes_read; struct dwarf_block *blk; - bfd_size_type amt; + size_t amt; if (info_ptr >= info_ptr_end && form != DW_FORM_flag_present) { @@ -1513,7 +1513,7 @@ add_line_info (struct line_info_table *table, unsigned int discriminator, int end_sequence) { - bfd_size_type amt = sizeof (struct line_info); + size_t amt = sizeof (struct line_info); struct line_sequence* seq = table->sequences; struct line_info* info = (struct line_info *) bfd_alloc (table->abfd, amt); @@ -1782,11 +1782,11 @@ static bfd_boolean build_line_info_table (struct line_info_table * table, struct line_sequence * seq) { - bfd_size_type amt; - struct line_info** line_info_lookup; - struct line_info* each_line; - unsigned int num_lines; - unsigned int line_index; + size_t amt; + struct line_info **line_info_lookup; + struct line_info *each_line; + unsigned int num_lines; + unsigned int line_index; if (seq->line_info_lookup != NULL) return TRUE; @@ -1824,12 +1824,12 @@ build_line_info_table (struct line_info_table * table, static bfd_boolean sort_line_sequences (struct line_info_table* table) { - bfd_size_type amt; - struct line_sequence* sequences; - struct line_sequence* seq; - unsigned int n = 0; - unsigned int num_sequences = table->num_sequences; - bfd_vma last_high_pc; + size_t amt; + struct line_sequence *sequences; + struct line_sequence *seq; + unsigned int n = 0; + unsigned int num_sequences = table->num_sequences; + bfd_vma last_high_pc; if (num_sequences == 0) return TRUE; @@ -1897,7 +1897,7 @@ line_info_add_include_dir (struct line_info_table *table, char *cur_dir) if ((table->num_dirs % DIR_ALLOC_CHUNK) == 0) { char **tmp; - bfd_size_type amt; + size_t amt; amt = table->num_dirs + DIR_ALLOC_CHUNK; amt *= sizeof (char *); @@ -1931,7 +1931,7 @@ line_info_add_file_name (struct line_info_table *table, char *cur_file, if ((table->num_files % FILE_ALLOC_CHUNK) == 0) { struct fileinfo *tmp; - bfd_size_type amt; + size_t amt; amt = table->num_files + FILE_ALLOC_CHUNK; amt *= sizeof (struct fileinfo); @@ -2091,7 +2091,7 @@ decode_line_info (struct comp_unit *unit) char *cur_file, *cur_dir; unsigned char op_code, extended_op, adj_opcode; unsigned int exop_len; - bfd_size_type amt; + size_t amt; if (unit->line_offset == 0 && file->line_table) return file->line_table; @@ -3226,7 +3226,7 @@ scan_unit_for_symbols (struct comp_unit *unit) || abbrev->tag == DW_TAG_entry_point || abbrev->tag == DW_TAG_inlined_subroutine) { - bfd_size_type amt = sizeof (struct funcinfo); + size_t amt = sizeof (struct funcinfo); func = (struct funcinfo *) bfd_zalloc (abfd, amt); if (func == NULL) goto fail; @@ -3250,7 +3250,7 @@ scan_unit_for_symbols (struct comp_unit *unit) func = NULL; if (abbrev->tag == DW_TAG_variable) { - bfd_size_type amt = sizeof (struct varinfo); + size_t amt = sizeof (struct varinfo); var = (struct varinfo *) bfd_zalloc (abfd, amt); if (var == NULL) goto fail; @@ -3469,7 +3469,7 @@ parse_comp_unit (struct dwarf2_debug *stash, struct abbrev_info *abbrev; struct attribute attr; bfd_byte *end_ptr = info_ptr + unit_length; - bfd_size_type amt; + size_t amt; bfd_vma low_pc = 0; bfd_vma high_pc = 0; bfd *abfd = file->bfd_ptr; @@ -4084,7 +4084,7 @@ place_sections (bfd *orig_bfd, struct dwarf2_debug *stash) else { bfd_vma last_vma = 0, last_dwarf = 0; - bfd_size_type amt = i * sizeof (struct adjusted_section); + size_t amt = i * sizeof (struct adjusted_section); p = (struct adjusted_section *) bfd_malloc (amt); if (p == NULL) @@ -4452,7 +4452,7 @@ _bfd_dwarf2_slurp_debug_info (bfd *abfd, bfd *debug_bfd, void **pinfo, bfd_boolean do_place) { - bfd_size_type amt = sizeof (struct dwarf2_debug); + size_t amt = sizeof (struct dwarf2_debug); bfd_size_type total_size; asection *msec; struct dwarf2_debug *stash = (struct dwarf2_debug *) *pinfo; diff --git a/bfd/ecoff.c b/bfd/ecoff.c index 050fd7b508..e8ccbd45df 100644 --- a/bfd/ecoff.c +++ b/bfd/ecoff.c @@ -87,7 +87,7 @@ static asection bfd_debug_section = bfd_boolean _bfd_ecoff_mkobject (bfd *abfd) { - bfd_size_type amt = sizeof (ecoff_data_type); + size_t amt = sizeof (ecoff_data_type); abfd->tdata.ecoff_obj_data = (struct ecoff_tdata *) bfd_zalloc (abfd, amt); if (abfd->tdata.ecoff_obj_data == NULL) @@ -650,7 +650,7 @@ asymbol * _bfd_ecoff_make_empty_symbol (bfd *abfd) { ecoff_symbol_type *new_symbol; - bfd_size_type amt = sizeof (ecoff_symbol_type); + size_t amt = sizeof (ecoff_symbol_type); new_symbol = (ecoff_symbol_type *) bfd_zalloc (abfd, amt); if (new_symbol == NULL) @@ -1762,7 +1762,7 @@ _bfd_ecoff_find_nearest_line (bfd *abfd, if (ecoff_data (abfd)->find_line_info == NULL) { - bfd_size_type amt = sizeof (struct ecoff_find_line); + size_t amt = sizeof (struct ecoff_find_line); ecoff_data (abfd)->find_line_info = (struct ecoff_find_line *) bfd_zalloc (abfd, amt); @@ -3230,7 +3230,7 @@ struct bfd_link_hash_table * _bfd_ecoff_bfd_link_hash_table_create (bfd *abfd) { struct ecoff_link_hash_table *ret; - bfd_size_type amt = sizeof (struct ecoff_link_hash_table); + size_t amt = sizeof (struct ecoff_link_hash_table); ret = (struct ecoff_link_hash_table *) bfd_malloc (amt); if (ret == NULL) diff --git a/bfd/ecofflink.c b/bfd/ecofflink.c index 5fc96e671b..ba2bbbc868 100644 --- a/bfd/ecofflink.c +++ b/bfd/ecofflink.c @@ -467,7 +467,7 @@ bfd_ecoff_debug_init (bfd *output_bfd ATTRIBUTE_UNUSED, struct bfd_link_info *info) { struct accumulate *ainfo; - bfd_size_type amt = sizeof (struct accumulate); + size_t amt = sizeof (struct accumulate); ainfo = (struct accumulate *) bfd_malloc (amt); if (!ainfo) diff --git a/bfd/elf-hppa.h b/bfd/elf-hppa.h index 7875e63ff7..1e10c5c851 100644 --- a/bfd/elf-hppa.h +++ b/bfd/elf-hppa.h @@ -754,7 +754,7 @@ _bfd_elf_hppa_gen_reloc_type (bfd *abfd, { elf_hppa_reloc_type *finaltype; elf_hppa_reloc_type **final_types; - bfd_size_type amt = sizeof (elf_hppa_reloc_type *) * 2; + size_t amt = sizeof (elf_hppa_reloc_type *) * 2; /* Allocate slots for the BFD relocation. */ final_types = bfd_alloc (abfd, amt); diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index 88b4d5e3ac..b15af60b97 100644 --- a/bfd/elf-m10300.c +++ b/bfd/elf-m10300.c @@ -2743,7 +2743,7 @@ mn10300_elf_relax_section (bfd *abfd, /* A local symbol. */ Elf_Internal_Sym *isym; struct elf_link_hash_table *elftab; - bfd_size_type amt; + size_t amt; isym = isymbuf + r_index; if (isym->st_shndx == SHN_UNDEF) @@ -2844,7 +2844,7 @@ mn10300_elf_relax_section (bfd *abfd, && ELF_ST_TYPE (isym->st_info) == STT_FUNC) { struct elf_link_hash_table *elftab; - bfd_size_type amt; + size_t amt; struct elf_link_hash_entry **lhashes = hashes; /* Skip a local symbol if it aliases a @@ -3069,7 +3069,7 @@ mn10300_elf_relax_section (bfd *abfd, const char *sym_name; char *new_name; struct elf_link_hash_table *elftab; - bfd_size_type amt; + size_t amt; if (isym->st_shndx != sec_shndx) continue; @@ -4602,7 +4602,7 @@ static struct bfd_link_hash_table * elf32_mn10300_link_hash_table_create (bfd *abfd) { struct elf32_mn10300_link_hash_table *ret; - bfd_size_type amt = sizeof (* ret); + size_t amt = sizeof (* ret); ret = bfd_zmalloc (amt); if (ret == NULL) diff --git a/bfd/elf-strtab.c b/bfd/elf-strtab.c index 04a746ef31..d3e50c76cf 100644 --- a/bfd/elf-strtab.c +++ b/bfd/elf-strtab.c @@ -95,7 +95,7 @@ struct elf_strtab_hash * _bfd_elf_strtab_init (void) { struct elf_strtab_hash *table; - bfd_size_type amt = sizeof (struct elf_strtab_hash); + size_t amt = sizeof (struct elf_strtab_hash); table = (struct elf_strtab_hash *) bfd_malloc (amt); if (table == NULL) diff --git a/bfd/elf.c b/bfd/elf.c index c85face630..2e045a7f25 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -4551,7 +4551,7 @@ make_mapping (bfd *abfd, struct elf_segment_map *m; unsigned int i; asection **hdrpp; - bfd_size_type amt; + size_t amt; amt = sizeof (struct elf_segment_map) - sizeof (asection *); amt += (to - from) * sizeof (asection *); @@ -7485,7 +7485,7 @@ copy_elf_program_header (bfd *ibfd, bfd *obfd) { asection *section; unsigned int section_count; - bfd_size_type amt; + size_t amt; Elf_Internal_Shdr *this_hdr; asection *first_section = NULL; asection *lowest_section; @@ -7507,7 +7507,7 @@ copy_elf_program_header (bfd *ibfd, bfd *obfd) /* Allocate a segment map big enough to contain all of the sections we have selected. */ amt = sizeof (struct elf_segment_map) - sizeof (asection *); - amt += (bfd_size_type) section_count * sizeof (asection *); + amt += section_count * sizeof (asection *); map = (struct elf_segment_map *) bfd_zalloc (obfd, amt); if (map == NULL) return FALSE; diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index faf8376f20..a35dc9958d 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -4110,7 +4110,7 @@ static struct bfd_link_hash_table * elf32_arm_link_hash_table_create (bfd *abfd) { struct elf32_arm_link_hash_table *ret; - bfd_size_type amt = sizeof (struct elf32_arm_link_hash_table); + size_t amt = sizeof (struct elf32_arm_link_hash_table); ret = (struct elf32_arm_link_hash_table *) bfd_zmalloc (amt); if (ret == NULL) @@ -5304,7 +5304,7 @@ elf32_arm_setup_section_lists (bfd *output_bfd, unsigned int top_id, top_index; asection *section; asection **input_list, **list; - bfd_size_type amt; + size_t amt; struct elf32_arm_link_hash_table *htab = elf32_arm_hash_table (info); if (htab == NULL) @@ -15721,7 +15721,7 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info, p = *head; if (p == NULL || p->sec != sec) { - bfd_size_type amt = sizeof *p; + size_t amt = sizeof *p; p = (struct elf_dyn_relocs *) bfd_alloc (htab->root.dynobj, amt); if (p == NULL) @@ -18577,7 +18577,7 @@ elf32_arm_new_section_hook (bfd *abfd, asection *sec) if (!sec->used_by_bfd) { _arm_elf_section_data *sdata; - bfd_size_type amt = sizeof (*sdata); + size_t amt = sizeof (*sdata); sdata = (_arm_elf_section_data *) bfd_zalloc (abfd, amt); if (sdata == NULL) diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c index e2d4de6211..2a6e743512 100644 --- a/bfd/elf32-avr.c +++ b/bfd/elf32-avr.c @@ -767,7 +767,7 @@ elf_avr_new_section_hook (bfd *abfd, asection *sec) if (!sec->used_by_bfd) { struct elf_avr_section_data *sdata; - bfd_size_type amt = sizeof (*sdata); + size_t amt = sizeof (*sdata); sdata = bfd_zalloc (abfd, amt); if (sdata == NULL) @@ -875,7 +875,7 @@ static struct bfd_link_hash_table * elf32_avr_link_hash_table_create (bfd *abfd) { struct elf32_avr_link_hash_table *htab; - bfd_size_type amt = sizeof (*htab); + size_t amt = sizeof (*htab); htab = bfd_zmalloc (amt); if (htab == NULL) @@ -3494,7 +3494,7 @@ elf32_avr_setup_section_lists (bfd *output_bfd, unsigned int top_id, top_index; asection *section; asection **input_list, **list; - bfd_size_type amt; + size_t amt; struct elf32_avr_link_hash_table *htab = avr_link_hash_table (info); if (htab == NULL || htab->no_stubs) @@ -3558,7 +3558,7 @@ get_local_syms (bfd *input_bfd, struct bfd_link_info *info) unsigned int bfd_indx; Elf_Internal_Sym *local_syms, **all_local_syms; struct elf32_avr_link_hash_table *htab = avr_link_hash_table (info); - bfd_size_type amt; + size_t amt; if (htab == NULL) return -1; diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c index 1631ef91d6..7ebd9192b6 100644 --- a/bfd/elf32-bfin.c +++ b/bfd/elf32-bfin.c @@ -1728,7 +1728,7 @@ static struct bfd_link_hash_table * bfinfdpic_elf_link_hash_table_create (bfd *abfd) { struct bfinfdpic_elf_link_hash_table *ret; - bfd_size_type amt = sizeof (struct bfinfdpic_elf_link_hash_table); + size_t amt = sizeof (struct bfinfdpic_elf_link_hash_table); ret = bfd_zmalloc (amt); if (ret == NULL) @@ -4842,7 +4842,7 @@ static struct bfd_link_hash_table * bfin_link_hash_table_create (bfd * abfd) { struct bfin_link_hash_table *ret; - bfd_size_type amt = sizeof (struct bfin_link_hash_table); + size_t amt = sizeof (struct bfin_link_hash_table); ret = bfd_zmalloc (amt); if (ret == NULL) diff --git a/bfd/elf32-cr16.c b/bfd/elf32-cr16.c index cefd69ed3a..6d1e66935c 100644 --- a/bfd/elf32-cr16.c +++ b/bfd/elf32-cr16.c @@ -1641,7 +1641,7 @@ static struct bfd_link_hash_table * elf32_cr16_link_hash_table_create (bfd *abfd) { struct elf_link_hash_table *ret; - bfd_size_type amt = sizeof (struct elf_link_hash_table); + size_t amt = sizeof (struct elf_link_hash_table); ret = (struct elf_link_hash_table *) bfd_zmalloc (amt); if (ret == (struct elf_link_hash_table *) NULL) diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c index ad3830901e..bee7108684 100644 --- a/bfd/elf32-cris.c +++ b/bfd/elf32-cris.c @@ -889,7 +889,7 @@ static struct bfd_link_hash_table * elf_cris_link_hash_table_create (bfd *abfd) { struct elf_cris_link_hash_table *ret; - bfd_size_type amt = sizeof (struct elf_cris_link_hash_table); + size_t amt = sizeof (struct elf_cris_link_hash_table); ret = ((struct elf_cris_link_hash_table *) bfd_zmalloc (amt)); if (ret == (struct elf_cris_link_hash_table *) NULL) diff --git a/bfd/elf32-csky.c b/bfd/elf32-csky.c index 04214f28ea..f91d05bd60 100644 --- a/bfd/elf32-csky.c +++ b/bfd/elf32-csky.c @@ -1500,7 +1500,7 @@ static struct bfd_link_hash_table * csky_elf_link_hash_table_create (bfd *abfd) { struct csky_elf_link_hash_table *ret; - bfd_size_type amt = sizeof (struct csky_elf_link_hash_table); + size_t amt = sizeof (struct csky_elf_link_hash_table); ret = (struct csky_elf_link_hash_table*) bfd_zmalloc (amt); if (ret == NULL) @@ -2712,7 +2712,7 @@ csky_elf_check_relocs (bfd * abfd, p = *head; if (p == NULL || p->sec != sec) { - bfd_size_type amt = sizeof *p; + size_t amt = sizeof *p; p = ((struct elf_dyn_relocs *) bfd_alloc (htab->elf.dynobj, amt)); if (p == NULL) @@ -3770,7 +3770,7 @@ elf32_csky_setup_section_lists (bfd *output_bfd, unsigned int top_id, top_index; asection *section; asection **input_list, **list; - bfd_size_type amt; + size_t amt; struct csky_elf_link_hash_table *htab = csky_elf_hash_table (info); if (!htab) diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c index 4934ba6f10..056cc93055 100644 --- a/bfd/elf32-frv.c +++ b/bfd/elf32-frv.c @@ -942,7 +942,7 @@ static struct bfd_link_hash_table * frvfdpic_elf_link_hash_table_create (bfd *abfd) { struct frvfdpic_elf_link_hash_table *ret; - bfd_size_type amt = sizeof (struct frvfdpic_elf_link_hash_table); + size_t amt = sizeof (struct frvfdpic_elf_link_hash_table); ret = bfd_zmalloc (amt); if (ret == NULL) diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index 2e653083ce..b1b0f8284c 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -418,7 +418,7 @@ static struct bfd_link_hash_table * elf32_hppa_link_hash_table_create (bfd *abfd) { struct elf32_hppa_link_hash_table *htab; - bfd_size_type amt = sizeof (*htab); + size_t amt = sizeof (*htab); htab = bfd_zmalloc (amt); if (htab == NULL) @@ -2407,7 +2407,7 @@ elf32_hppa_setup_section_lists (bfd *output_bfd, struct bfd_link_info *info) unsigned int top_id, top_index; asection *section; asection **input_list, **list; - bfd_size_type amt; + size_t amt; struct elf32_hppa_link_hash_table *htab = hppa_link_hash_table (info); if (htab == NULL) @@ -2596,7 +2596,7 @@ get_local_syms (bfd *output_bfd, bfd *input_bfd, struct bfd_link_info *info) /* We want to read in symbol extension records only once. To do this we need to read in the local symbols in parallel and save them for later use; so hold pointers to the local symbols in an array. */ - bfd_size_type amt = sizeof (Elf_Internal_Sym *) * htab->bfd_count; + size_t amt = sizeof (Elf_Internal_Sym *) * htab->bfd_count; all_local_syms = bfd_zmalloc (amt); htab->all_local_syms = all_local_syms; if (all_local_syms == NULL) diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 2f994bf969..88076b5a03 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -1875,7 +1875,7 @@ do_size: p = *head; if (p == NULL || p->sec != sec) { - bfd_size_type amt = sizeof *p; + size_t amt = sizeof *p; p = (struct elf_dyn_relocs *) bfd_alloc (htab->elf.dynobj, amt); if (p == NULL) diff --git a/bfd/elf32-lm32.c b/bfd/elf32-lm32.c index c329af9500..82c4fa0eef 100644 --- a/bfd/elf32-lm32.c +++ b/bfd/elf32-lm32.c @@ -132,7 +132,7 @@ static struct bfd_link_hash_table * lm32_elf_link_hash_table_create (bfd *abfd) { struct elf_lm32_link_hash_table *ret; - bfd_size_type amt = sizeof (struct elf_lm32_link_hash_table); + size_t amt = sizeof (struct elf_lm32_link_hash_table); ret = bfd_zmalloc (amt); if (ret == NULL) diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index 75a5650549..edc95b5d63 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -1575,7 +1575,7 @@ static struct bfd_link_hash_table * m32r_elf_link_hash_table_create (bfd *abfd) { struct elf_m32r_link_hash_table *ret; - bfd_size_type amt = sizeof (struct elf_m32r_link_hash_table); + size_t amt = sizeof (struct elf_m32r_link_hash_table); ret = bfd_zmalloc (amt); if (ret == NULL) @@ -3775,7 +3775,7 @@ m32r_elf_check_relocs (bfd *abfd, p = *head; if (p == NULL || p->sec != sec) { - bfd_size_type amt = sizeof (*p); + size_t amt = sizeof (*p); p = bfd_alloc (dynobj, amt); if (p == NULL) diff --git a/bfd/elf32-m68hc1x.c b/bfd/elf32-m68hc1x.c index 7e0fd64f06..56c5129577 100644 --- a/bfd/elf32-m68hc1x.c +++ b/bfd/elf32-m68hc1x.c @@ -77,7 +77,7 @@ struct m68hc11_elf_link_hash_table* m68hc11_elf_hash_table_create (bfd *abfd) { struct m68hc11_elf_link_hash_table *ret; - bfd_size_type amt = sizeof (struct m68hc11_elf_link_hash_table); + size_t amt = sizeof (struct m68hc11_elf_link_hash_table); ret = (struct m68hc11_elf_link_hash_table *) bfd_zmalloc (amt); if (ret == (struct m68hc11_elf_link_hash_table *) NULL) @@ -241,7 +241,7 @@ elf32_m68hc11_setup_section_lists (bfd *output_bfd, struct bfd_link_info *info) unsigned int top_id, top_index; asection *section; asection **input_list, **list; - bfd_size_type amt; + size_t amt; asection *text_section; struct m68hc11_elf_link_hash_table *htab; @@ -334,7 +334,7 @@ elf32_m68hc11_size_stubs (bfd *output_bfd, bfd *stub_bfd, asection *section; Elf_Internal_Sym *local_syms, **all_local_syms; unsigned int bfd_indx, bfd_count; - bfd_size_type amt; + size_t amt; asection *stub_sec; struct m68hc11_elf_link_hash_table *htab = m68hc11_elf_hash_table (info); diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index b0d32ae4e0..5ffede1982 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -971,7 +971,7 @@ static struct bfd_link_hash_table * elf_m68k_link_hash_table_create (bfd *abfd) { struct elf_m68k_link_hash_table *ret; - bfd_size_type amt = sizeof (struct elf_m68k_link_hash_table); + size_t amt = sizeof (struct elf_m68k_link_hash_table); ret = (struct elf_m68k_link_hash_table *) bfd_zmalloc (amt); if (ret == (struct elf_m68k_link_hash_table *) NULL) diff --git a/bfd/elf32-metag.c b/bfd/elf32-metag.c index 08eb70bded..07e9856fa9 100644 --- a/bfd/elf32-metag.c +++ b/bfd/elf32-metag.c @@ -1021,7 +1021,7 @@ static struct bfd_link_hash_table * elf_metag_link_hash_table_create (bfd *abfd) { struct elf_metag_link_hash_table *htab; - bfd_size_type amt = sizeof (*htab); + size_t amt = sizeof (*htab); htab = bfd_zmalloc (amt); if (htab == NULL) @@ -3562,7 +3562,7 @@ elf_metag_setup_section_lists (bfd *output_bfd, struct bfd_link_info *info) unsigned int top_id, top_index; asection *section; asection **input_list, **list; - bfd_size_type amt; + size_t amt; struct elf_metag_link_hash_table *htab = metag_link_hash_table (info); /* Count the number of input BFDs and find the top input section id. */ @@ -3741,7 +3741,7 @@ get_local_syms (bfd *output_bfd ATTRIBUTE_UNUSED, bfd *input_bfd, /* We want to read in symbol extension records only once. To do this we need to read in the local symbols in parallel and save them for later use; so hold pointers to the local symbols in an array. */ - bfd_size_type amt = sizeof (Elf_Internal_Sym *) * htab->bfd_count; + size_t amt = sizeof (Elf_Internal_Sym *) * htab->bfd_count; all_local_syms = bfd_zmalloc (amt); htab->all_local_syms = all_local_syms; if (all_local_syms == NULL) diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c index 7b839f8c9a..bccb0afcf4 100644 --- a/bfd/elf32-microblaze.c +++ b/bfd/elf32-microblaze.c @@ -803,7 +803,7 @@ static struct bfd_link_hash_table * microblaze_elf_link_hash_table_create (bfd *abfd) { struct elf32_mb_link_hash_table *ret; - bfd_size_type amt = sizeof (struct elf32_mb_link_hash_table); + size_t amt = sizeof (struct elf32_mb_link_hash_table); ret = (struct elf32_mb_link_hash_table *) bfd_zmalloc (amt); if (ret == NULL) @@ -2551,7 +2551,7 @@ microblaze_elf_check_relocs (bfd * abfd, p = *head; if (p == NULL || p->sec != sec) { - bfd_size_type amt = sizeof *p; + size_t amt = sizeof *p; p = ((struct elf_dyn_relocs *) bfd_alloc (htab->elf.dynobj, amt)); if (p == NULL) diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c index 3168587560..2eaf012915 100644 --- a/bfd/elf32-nds32.c +++ b/bfd/elf32-nds32.c @@ -3684,7 +3684,7 @@ nds32_elf_link_hash_table_create (bfd *abfd) { struct elf_nds32_link_hash_table *ret; - bfd_size_type amt = sizeof (struct elf_nds32_link_hash_table); + size_t amt = sizeof (struct elf_nds32_link_hash_table); ret = (struct elf_nds32_link_hash_table *) bfd_zmalloc (amt); if (ret == NULL) @@ -7442,7 +7442,7 @@ nds32_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, p = *head; if (p == NULL || p->sec != sec) { - bfd_size_type amt = sizeof (*p); + size_t amt = sizeof (*p); p = (struct elf_dyn_relocs *) bfd_alloc (dynobj, amt); if (p == NULL) return FALSE; diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c index 947eaeba76..fd05fb0936 100644 --- a/bfd/elf32-nios2.c +++ b/bfd/elf32-nios2.c @@ -2228,7 +2228,7 @@ nios2_elf32_setup_section_lists (bfd *output_bfd, struct bfd_link_info *info) unsigned int top_id, top_index; asection *section; asection **input_list, **list; - bfd_size_type amt; + size_t amt; struct elf32_nios2_link_hash_table *htab = elf32_nios2_hash_table (info); /* Count the number of input BFDs and find the top input section id. */ @@ -2560,7 +2560,7 @@ get_local_syms (bfd *output_bfd ATTRIBUTE_UNUSED, bfd *input_bfd, /* We want to read in symbol extension records only once. To do this we need to read in the local symbols in parallel and save them for later use; so hold pointers to the local symbols in an array. */ - bfd_size_type amt = sizeof (Elf_Internal_Sym *) * htab->bfd_count; + size_t amt = sizeof (Elf_Internal_Sym *) * htab->bfd_count; all_local_syms = bfd_zmalloc (amt); htab->all_local_syms = all_local_syms; if (all_local_syms == NULL) @@ -4943,7 +4943,7 @@ nios2_elf32_check_relocs (bfd *abfd, struct bfd_link_info *info, p = *head; if (p == NULL || p->sec != sec) { - bfd_size_type amt = sizeof *p; + size_t amt = sizeof *p; p = ((struct elf_dyn_relocs *) bfd_alloc (htab->root.dynobj, amt)); if (p == NULL) @@ -5961,7 +5961,7 @@ static struct bfd_link_hash_table * nios2_elf32_link_hash_table_create (bfd *abfd) { struct elf32_nios2_link_hash_table *ret; - bfd_size_type amt = sizeof (struct elf32_nios2_link_hash_table); + size_t amt = sizeof (struct elf32_nios2_link_hash_table); ret = bfd_zmalloc (amt); if (ret == NULL) diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c index 31ef758a92..41e61ac7e2 100644 --- a/bfd/elf32-or1k.c +++ b/bfd/elf32-or1k.c @@ -970,7 +970,7 @@ static struct bfd_link_hash_table * or1k_elf_link_hash_table_create (bfd *abfd) { struct elf_or1k_link_hash_table *ret; - bfd_size_type amt = sizeof (struct elf_or1k_link_hash_table); + size_t amt = sizeof (struct elf_or1k_link_hash_table); ret = bfd_zmalloc (amt); if (ret == NULL) @@ -2118,7 +2118,7 @@ or1k_elf_check_relocs (bfd *abfd, p = *head; if (p == NULL || p->sec != sec) { - bfd_size_type amt = sizeof *p; + size_t amt = sizeof *p; p = ((struct elf_dyn_relocs *) bfd_alloc (htab->root.dynobj, amt)); if (p == NULL) diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 839d5ff142..3a42a4e105 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -1394,7 +1394,7 @@ ppc_elf_modify_segment_map (bfd *abfd, for (m = elf_seg_map (abfd); m != NULL; m = m->next) { struct elf_segment_map *n; - bfd_size_type amt; + size_t amt; unsigned int j, k; unsigned int p_flags; @@ -2802,7 +2802,7 @@ update_plt_info (bfd *abfd, struct plt_entry **plist, break; if (ent == NULL) { - bfd_size_type amt = sizeof (*ent); + size_t amt = sizeof (*ent); ent = bfd_alloc (abfd, amt); if (ent == NULL) return FALSE; diff --git a/bfd/elf32-pru.c b/bfd/elf32-pru.c index dd2e92d3bd..fdb28e71ec 100644 --- a/bfd/elf32-pru.c +++ b/bfd/elf32-pru.c @@ -1554,7 +1554,7 @@ static struct bfd_link_hash_table * pru_elf32_link_hash_table_create (bfd *abfd) { struct elf_link_hash_table *ret; - bfd_size_type amt = sizeof (struct elf_link_hash_table); + size_t amt = sizeof (struct elf_link_hash_table); ret = bfd_zmalloc (amt); if (ret == NULL) diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index 7990996bad..9490b67b00 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -803,7 +803,7 @@ static struct bfd_link_hash_table * elf_s390_link_hash_table_create (bfd *abfd) { struct elf_s390_link_hash_table *ret; - bfd_size_type amt = sizeof (struct elf_s390_link_hash_table); + size_t amt = sizeof (struct elf_s390_link_hash_table); ret = (struct elf_s390_link_hash_table *) bfd_zmalloc (amt); if (ret == NULL) @@ -1332,7 +1332,7 @@ elf_s390_check_relocs (bfd *abfd, p = *head; if (p == NULL || p->sec != sec) { - bfd_size_type amt = sizeof *p; + size_t amt = sizeof *p; p = ((struct elf_dyn_relocs *) bfd_alloc (htab->elf.dynobj, amt)); diff --git a/bfd/elf32-score.c b/bfd/elf32-score.c index 1e76c00b6d..8c2e3042ae 100644 --- a/bfd/elf32-score.c +++ b/bfd/elf32-score.c @@ -1410,7 +1410,7 @@ score_elf_create_got_section (bfd *abfd, struct elf_link_hash_entry *h; struct bfd_link_hash_entry *bh; struct score_got_info *g; - bfd_size_type amt; + size_t amt; /* This function may be called more than once. */ s = score_elf_got_section (abfd, TRUE); @@ -4057,7 +4057,7 @@ static bfd_boolean s3_elf32_score_new_section_hook (bfd *abfd, asection *sec) { struct _score_elf_section_data *sdata; - bfd_size_type amt = sizeof (*sdata); + size_t amt = sizeof (*sdata); sdata = bfd_zalloc (abfd, amt); if (sdata == NULL) @@ -4359,7 +4359,7 @@ static struct bfd_link_hash_table * elf32_score_link_hash_table_create (bfd *abfd) { struct elf_link_hash_table *ret; - bfd_size_type amt = sizeof (struct elf_link_hash_table); + size_t amt = sizeof (struct elf_link_hash_table); ret = (struct elf_link_hash_table *) bfd_zmalloc (amt); if (ret == NULL) diff --git a/bfd/elf32-score7.c b/bfd/elf32-score7.c index 6f37e9f89a..752796c45b 100644 --- a/bfd/elf32-score7.c +++ b/bfd/elf32-score7.c @@ -1268,7 +1268,7 @@ score_elf_create_got_section (bfd *abfd, struct elf_link_hash_entry *h; struct bfd_link_hash_entry *bh; struct score_got_info *g; - bfd_size_type amt; + size_t amt; /* This function may be called more than once. */ s = score_elf_got_section (abfd, TRUE); @@ -3862,7 +3862,7 @@ bfd_boolean s7_elf32_score_new_section_hook (bfd *abfd, asection *sec) { struct _score_elf_section_data *sdata; - bfd_size_type amt = sizeof (*sdata); + size_t amt = sizeof (*sdata); sdata = bfd_zalloc (abfd, amt); if (sdata == NULL) diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index 9200e6a192..9a00bde1d9 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -2256,7 +2256,7 @@ static struct bfd_link_hash_table * sh_elf_link_hash_table_create (bfd *abfd) { struct elf_sh_link_hash_table *ret; - bfd_size_type amt = sizeof (struct elf_sh_link_hash_table); + size_t amt = sizeof (struct elf_sh_link_hash_table); ret = (struct elf_sh_link_hash_table *) bfd_zmalloc (amt); if (ret == (struct elf_sh_link_hash_table *) NULL) @@ -5863,7 +5863,7 @@ sh_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, p = *head; if (p == NULL || p->sec != sec) { - bfd_size_type amt = sizeof (*p); + size_t amt = sizeof (*p); p = bfd_alloc (htab->root.dynobj, amt); if (p == NULL) return FALSE; diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c index 39ca699200..95814d3abf 100644 --- a/bfd/elf32-tic6x.c +++ b/bfd/elf32-tic6x.c @@ -1595,7 +1595,7 @@ static struct bfd_link_hash_table * elf32_tic6x_link_hash_table_create (bfd *abfd) { struct elf32_tic6x_link_hash_table *ret; - bfd_size_type amt = sizeof (struct elf32_tic6x_link_hash_table); + size_t amt = sizeof (struct elf32_tic6x_link_hash_table); ret = bfd_zmalloc (amt); if (ret == NULL) @@ -2147,7 +2147,7 @@ elf32_tic6x_new_section_hook (bfd *abfd, asection *sec) if (!sec->used_by_bfd) { _tic6x_elf_section_data *sdata; - bfd_size_type amt = sizeof (*sdata); + size_t amt = sizeof (*sdata); sdata = (_tic6x_elf_section_data *) bfd_zalloc (abfd, amt); if (sdata == NULL) @@ -2945,7 +2945,7 @@ elf32_tic6x_check_relocs (bfd *abfd, struct bfd_link_info *info, p = *head; if (p == NULL || p->sec != sec) { - bfd_size_type amt = sizeof *p; + size_t amt = sizeof *p; p = bfd_alloc (htab->elf.dynobj, amt); if (p == NULL) return FALSE; diff --git a/bfd/elf32-tilepro.c b/bfd/elf32-tilepro.c index f821389e92..f16f5851cf 100644 --- a/bfd/elf32-tilepro.c +++ b/bfd/elf32-tilepro.c @@ -1189,7 +1189,7 @@ static struct bfd_link_hash_table * tilepro_elf_link_hash_table_create (bfd *abfd) { struct tilepro_elf_link_hash_table *ret; - bfd_size_type amt = sizeof (struct tilepro_elf_link_hash_table); + size_t amt = sizeof (struct tilepro_elf_link_hash_table); ret = (struct tilepro_elf_link_hash_table *) bfd_zmalloc (amt); if (ret == NULL) @@ -1788,7 +1788,7 @@ tilepro_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, p = *head; if (p == NULL || p->sec != sec) { - bfd_size_type amt = sizeof *p; + size_t amt = sizeof *p; p = ((struct elf_dyn_relocs *) bfd_alloc (htab->elf.dynobj, amt)); if (p == NULL) diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c index 21cd4f2937..afebb2ab86 100644 --- a/bfd/elf32-v850.c +++ b/bfd/elf32-v850.c @@ -230,7 +230,7 @@ static void remember_hi16s_reloc (bfd *abfd, bfd_vma addend, bfd_byte *address) { hi16s_location * entry = NULL; - bfd_size_type amt = sizeof (* free_hi16s); + size_t amt = sizeof (* free_hi16s); /* Find a free structure. */ if (free_hi16s == NULL) diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c index f32097d703..fa84e0be19 100644 --- a/bfd/elf32-vax.c +++ b/bfd/elf32-vax.c @@ -470,7 +470,7 @@ static struct bfd_link_hash_table * elf_vax_link_hash_table_create (bfd *abfd) { struct elf_link_hash_table *ret; - bfd_size_type amt = sizeof (struct elf_link_hash_table); + size_t amt = sizeof (struct elf_link_hash_table); ret = bfd_zmalloc (amt); if (ret == NULL) diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c index 12ff9f772a..58927d620f 100644 --- a/bfd/elf32-xtensa.c +++ b/bfd/elf32-xtensa.c @@ -686,7 +686,7 @@ elf_xtensa_link_hash_table_create (bfd *abfd) { struct elf_link_hash_entry *tlsbase; struct elf_xtensa_link_hash_table *ret; - bfd_size_type amt = sizeof (struct elf_xtensa_link_hash_table); + size_t amt = sizeof (struct elf_xtensa_link_hash_table); ret = bfd_zmalloc (amt); if (ret == NULL) @@ -6039,7 +6039,7 @@ elf_xtensa_new_section_hook (bfd *abfd, asection *sec) if (!sec->used_by_bfd) { struct elf_xtensa_section_data *sdata; - bfd_size_type amt = sizeof (*sdata); + size_t amt = sizeof (*sdata); sdata = bfd_zalloc (abfd, amt); if (sdata == NULL) diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index 94642ab515..96ce158b55 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -280,7 +280,7 @@ static struct bfd_link_hash_table * elf64_alpha_bfd_link_hash_table_create (bfd *abfd) { struct alpha_elf_link_hash_table *ret; - bfd_size_type amt = sizeof (struct alpha_elf_link_hash_table); + size_t amt = sizeof (struct alpha_elf_link_hash_table); ret = (struct alpha_elf_link_hash_table *) bfd_zmalloc (amt); if (ret == (struct alpha_elf_link_hash_table *) NULL) @@ -1724,7 +1724,7 @@ get_got_entry (bfd *abfd, struct alpha_elf_link_hash_entry *h, if (!gotent) { int entry_size; - bfd_size_type amt; + size_t amt; amt = sizeof (struct alpha_elf_got_entry); gotent = (struct alpha_elf_got_entry *) bfd_alloc (abfd, amt); @@ -1787,7 +1787,6 @@ elf64_alpha_check_relocs (bfd *abfd, struct bfd_link_info *info, Elf_Internal_Shdr *symtab_hdr; struct alpha_elf_link_hash_entry **sym_hashes; const Elf_Internal_Rela *rel, *relend; - bfd_size_type amt; if (bfd_link_relocatable (info)) return TRUE; @@ -1990,7 +1989,7 @@ elf64_alpha_check_relocs (bfd *abfd, struct bfd_link_info *info, if (!rent) { - amt = sizeof (struct alpha_elf_reloc_entry); + size_t amt = sizeof (struct alpha_elf_reloc_entry); rent = (struct alpha_elf_reloc_entry *) bfd_alloc (abfd, amt); if (!rent) return FALSE; diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c index 66b82d88e4..f035443894 100644 --- a/bfd/elf64-hppa.c +++ b/bfd/elf64-hppa.c @@ -289,7 +289,7 @@ static struct bfd_link_hash_table* elf64_hppa_hash_table_create (bfd *abfd) { struct elf64_hppa_link_hash_table *htab; - bfd_size_type amt = sizeof (*htab); + size_t amt = sizeof (*htab); htab = bfd_zmalloc (amt); if (htab == NULL) diff --git a/bfd/elf64-ia64-vms.c b/bfd/elf64-ia64-vms.c index ffdd84c52f..bdb038b23a 100644 --- a/bfd/elf64-ia64-vms.c +++ b/bfd/elf64-ia64-vms.c @@ -4374,7 +4374,7 @@ elf64_ia64_object_p (bfd *abfd) flagword flags; const char *name; char *unwi_name, *unw_name; - bfd_size_type amt; + size_t amt; if (abfd->flags & DYNAMIC) return TRUE; diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c index 371d69847a..2c936badf5 100644 --- a/bfd/elf64-mmix.c +++ b/bfd/elf64-mmix.c @@ -831,7 +831,7 @@ mmix_elf_new_section_hook (bfd *abfd, asection *sec) if (!sec->used_by_bfd) { struct _mmix_elf_section_data *sdata; - bfd_size_type amt = sizeof (*sdata); + size_t amt = sizeof (*sdata); sdata = bfd_zalloc (abfd, amt); if (sdata == NULL) diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 2bc0f9da10..1ea4c402e0 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -2000,7 +2000,7 @@ ppc64_elf_new_section_hook (bfd *abfd, asection *sec) if (!sec->used_by_bfd) { struct _ppc64_elf_section_data *sdata; - bfd_size_type amt = sizeof (*sdata); + size_t amt = sizeof (*sdata); sdata = bfd_zalloc (abfd, amt); if (sdata == NULL) @@ -3435,7 +3435,7 @@ static struct bfd_link_hash_table * ppc64_elf_link_hash_table_create (bfd *abfd) { struct ppc_link_hash_table *htab; - bfd_size_type amt = sizeof (struct ppc_link_hash_table); + size_t amt = sizeof (struct ppc_link_hash_table); htab = bfd_zmalloc (amt); if (htab == NULL) @@ -4431,7 +4431,7 @@ update_local_sym_info (bfd *abfd, Elf_Internal_Shdr *symtab_hdr, break; if (ent == NULL) { - bfd_size_type amt = sizeof (*ent); + size_t amt = sizeof (*ent); ent = bfd_alloc (abfd, amt); if (ent == NULL) return FALSE; @@ -4463,7 +4463,7 @@ update_plt_info (bfd *abfd, struct plt_entry **plist, bfd_vma addend) break; if (ent == NULL) { - bfd_size_type amt = sizeof (*ent); + size_t amt = sizeof (*ent); ent = bfd_alloc (abfd, amt); if (ent == NULL) return FALSE; @@ -4741,7 +4741,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, break; if (ent == NULL) { - bfd_size_type amt = sizeof (*ent); + size_t amt = sizeof (*ent); ent = bfd_alloc (abfd, amt); if (ent == NULL) return FALSE; @@ -12216,7 +12216,7 @@ int ppc64_elf_setup_section_lists (struct bfd_link_info *info) { unsigned int id; - bfd_size_type amt; + size_t amt; struct ppc_link_hash_table *htab = ppc_hash_table (info); if (htab == NULL) diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index 60c4a3bd90..70fb68a0a2 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -722,7 +722,7 @@ static struct bfd_link_hash_table * elf_s390_link_hash_table_create (bfd *abfd) { struct elf_s390_link_hash_table *ret; - bfd_size_type amt = sizeof (struct elf_s390_link_hash_table); + size_t amt = sizeof (struct elf_s390_link_hash_table); ret = (struct elf_s390_link_hash_table *) bfd_zmalloc (amt); if (ret == NULL) @@ -1267,7 +1267,7 @@ elf_s390_check_relocs (bfd *abfd, p = *head; if (p == NULL || p->sec != sec) { - bfd_size_type amt = sizeof *p; + size_t amt = sizeof *p; p = ((struct elf_dyn_relocs *) bfd_alloc (htab->elf.dynobj, amt)); if (p == NULL) diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 014bea1475..7776d0ec8a 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -2294,7 +2294,7 @@ do_size: p = *head; if (p == NULL || p->sec != sec) { - bfd_size_type amt = sizeof *p; + size_t amt = sizeof *p; p = ((struct elf_dyn_relocs *) bfd_alloc (htab->elf.dynobj, amt)); diff --git a/bfd/elflink.c b/bfd/elflink.c index 3add9f18bd..f7b867ca7b 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -747,7 +747,7 @@ bfd_elf_link_record_local_dynamic_symbol (struct bfd_link_info *info, bfd *input_bfd, long input_indx) { - bfd_size_type amt; + size_t amt; struct elf_link_local_dynamic_entry *entry; struct elf_link_hash_table *eht; struct elf_strtab_hash *dynstr; @@ -2155,7 +2155,7 @@ _bfd_elf_link_find_version_dependencies (struct elf_link_hash_entry *h, struct elf_find_verdep_info *rinfo = (struct elf_find_verdep_info *) data; Elf_Internal_Verneed *t; Elf_Internal_Vernaux *a; - bfd_size_type amt; + size_t amt; /* We only care about symbols defined in shared objects with version information. */ @@ -3919,7 +3919,6 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) const struct elf_backend_data *bed; bfd_boolean add_needed; struct elf_link_hash_table *htab; - bfd_size_type amt; void *alloc_mark = NULL; struct bfd_hash_entry **old_table = NULL; unsigned int old_size = 0; @@ -4127,8 +4126,8 @@ error_free_dyn: struct bfd_link_needed_list *n, **pn; char *fnm, *anm; unsigned int tagv = dyn.d_un.d_val; + size_t amt = sizeof (struct bfd_link_needed_list); - amt = sizeof (struct bfd_link_needed_list); n = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt); fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv); if (n == NULL || fnm == NULL) @@ -4150,8 +4149,8 @@ error_free_dyn: struct bfd_link_needed_list *n, **pn; char *fnm, *anm; unsigned int tagv = dyn.d_un.d_val; + size_t amt = sizeof (struct bfd_link_needed_list); - amt = sizeof (struct bfd_link_needed_list); n = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt); fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv); if (n == NULL || fnm == NULL) @@ -4176,8 +4175,8 @@ error_free_dyn: struct bfd_link_needed_list *n, **pn; char *fnm, *anm; unsigned int tagv = dyn.d_un.d_val; + size_t amt = sizeof (struct bfd_link_needed_list); - amt = sizeof (struct bfd_link_needed_list); n = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt); fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv); if (n == NULL || fnm == NULL) @@ -4311,8 +4310,7 @@ error_free_dyn: { /* We store a pointer to the hash table entry for each external symbol. */ - amt = extsymcount; - amt *= sizeof (struct elf_link_hash_entry *); + size_t amt = extsymcount * sizeof (struct elf_link_hash_entry *); sym_hash = (struct elf_link_hash_entry **) bfd_zalloc (abfd, amt); if (sym_hash == NULL) goto error_free_sym; @@ -4331,17 +4329,16 @@ error_free_dyn: to internal format. */ if (elf_dynversym (abfd) != 0) { - Elf_Internal_Shdr *versymhdr; + Elf_Internal_Shdr *versymhdr = &elf_tdata (abfd)->dynversym_hdr; + bfd_size_type amt = versymhdr->sh_size; - versymhdr = &elf_tdata (abfd)->dynversym_hdr; - amt = versymhdr->sh_size; extversym = (Elf_External_Versym *) bfd_malloc (amt); if (extversym == NULL) goto error_free_sym; if (bfd_seek (abfd, versymhdr->sh_offset, SEEK_SET) != 0 || bfd_bread (extversym, amt, abfd) != amt) goto error_free_vers; - extversym_end = extversym + (amt / sizeof (* extversym)); + extversym_end = extversym + amt / sizeof (*extversym); } } @@ -5056,8 +5053,8 @@ error_free_dyn: aliases can be checked. */ if (!nondeflt_vers) { - amt = ((isymend - isym + 1) - * sizeof (struct elf_link_hash_entry *)); + size_t amt = ((isymend - isym + 1) + * sizeof (struct elf_link_hash_entry *)); nondeflt_vers = (struct elf_link_hash_entry **) bfd_malloc (amt); if (!nondeflt_vers) @@ -5312,6 +5309,7 @@ error_free_dyn: { struct elf_link_hash_entry *h = nondeflt_vers[cnt], *hi; char *shortname, *p; + size_t amt; p = strchr (h->root.root.string, ELF_VER_CHR); if (p == NULL @@ -5372,13 +5370,12 @@ error_free_dyn: struct elf_link_hash_entry **hppend; struct elf_link_hash_entry **sorted_sym_hash; struct elf_link_hash_entry *h; - size_t sym_count; + size_t sym_count, amt; /* Since we have to search the whole symbol list for each weak defined symbol, search time for N weak defined symbols will be O(N^2). Binary search will cut it down to O(NlogN). */ - amt = extsymcount; - amt *= sizeof (*sorted_sym_hash); + amt = extsymcount * sizeof (*sorted_sym_hash); sorted_sym_hash = bfd_malloc (amt); if (sorted_sym_hash == NULL) goto error_return; @@ -5653,7 +5650,7 @@ elf_link_add_archive_symbols (bfd *abfd, struct bfd_link_info *info) unsigned char *included = NULL; carsym *symdefs; bfd_boolean loop; - bfd_size_type amt; + size_t amt; const struct elf_backend_data *bed; struct elf_link_hash_entry * (*archive_symbol_lookup) (bfd *, struct bfd_link_info *, const char *); @@ -5673,8 +5670,7 @@ elf_link_add_archive_symbols (bfd *abfd, struct bfd_link_info *info) c = bfd_ardata (abfd)->symdef_count; if (c == 0) return TRUE; - amt = c; - amt *= sizeof (*included); + amt = c * sizeof (*included); included = (unsigned char *) bfd_zmalloc (amt); if (included == NULL) return FALSE; @@ -7692,7 +7688,7 @@ struct bfd_link_hash_table * _bfd_elf_link_hash_table_create (bfd *abfd) { struct elf_link_hash_table *ret; - bfd_size_type amt = sizeof (struct elf_link_hash_table); + size_t amt = sizeof (struct elf_link_hash_table); ret = (struct elf_link_hash_table *) bfd_zmalloc (amt); if (ret == NULL) @@ -7846,7 +7842,7 @@ bfd_elf_get_bfd_needed_list (bfd *abfd, const char *string; struct bfd_link_needed_list *l; unsigned int tagv = dyn.d_un.d_val; - bfd_size_type amt; + size_t amt; string = bfd_elf_string_from_elf_section (abfd, shlink, tagv); if (string == NULL) @@ -9548,7 +9544,7 @@ static bfd_boolean elf_link_swap_symbols_out (struct elf_final_link_info *flinfo) { struct elf_link_hash_table *hash_table = elf_hash_table (flinfo->info); - bfd_size_type amt; + size_t amt; size_t i; const struct elf_backend_data *bed; bfd_byte *symbuf; diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index 5fabcd8f64..2191b5d470 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -2947,7 +2947,7 @@ static struct bfd_link_hash_table * elfNN_aarch64_link_hash_table_create (bfd *abfd) { struct elf_aarch64_link_hash_table *ret; - bfd_size_type amt = sizeof (struct elf_aarch64_link_hash_table); + size_t amt = sizeof (struct elf_aarch64_link_hash_table); ret = bfd_zmalloc (amt); if (ret == NULL) @@ -3456,7 +3456,7 @@ elfNN_aarch64_setup_section_lists (bfd *output_bfd, unsigned int top_id, top_index; asection *section; asection **input_list, **list; - bfd_size_type amt; + size_t amt; struct elf_aarch64_link_hash_table *htab = elf_aarch64_hash_table (info); @@ -7853,7 +7853,7 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info, p = *head; if (p == NULL || p->sec != sec) { - bfd_size_type amt = sizeof *p; + size_t amt = sizeof *p; p = ((struct elf_dyn_relocs *) bfd_zalloc (htab->root.dynobj, amt)); if (p == NULL) @@ -8419,7 +8419,7 @@ elfNN_aarch64_new_section_hook (bfd *abfd, asection *sec) if (!sec->used_by_bfd) { _aarch64_elf_section_data *sdata; - bfd_size_type amt = sizeof (*sdata); + size_t amt = sizeof (*sdata); sdata = bfd_zalloc (abfd, amt); if (sdata == NULL) diff --git a/bfd/elfnn-ia64.c b/bfd/elfnn-ia64.c index 2ba9608e34..559889d877 100644 --- a/bfd/elfnn-ia64.c +++ b/bfd/elfnn-ia64.c @@ -4883,7 +4883,7 @@ elfNN_ia64_object_p (bfd *abfd) flagword flags; const char *name; char *unwi_name, *unw_name; - bfd_size_type amt; + size_t amt; if (abfd->flags & DYNAMIC) return TRUE; diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c index 40d01a8e36..d639501fc5 100644 --- a/bfd/elfnn-riscv.c +++ b/bfd/elfnn-riscv.c @@ -269,7 +269,7 @@ static struct bfd_link_hash_table * riscv_elf_link_hash_table_create (bfd *abfd) { struct riscv_elf_link_hash_table *ret; - bfd_size_type amt = sizeof (struct riscv_elf_link_hash_table); + size_t amt = sizeof (struct riscv_elf_link_hash_table); ret = (struct riscv_elf_link_hash_table *) bfd_zmalloc (amt); if (ret == NULL) @@ -724,7 +724,7 @@ riscv_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, p = *head; if (p == NULL || p->sec != sec) { - bfd_size_type amt = sizeof *p; + size_t amt = sizeof *p; p = ((struct elf_dyn_relocs *) bfd_alloc (htab->elf.dynobj, amt)); if (p == NULL) diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index d7e3aed3b6..a05c67154c 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -1374,7 +1374,7 @@ _bfd_mips_elf_new_section_hook (bfd *abfd, asection *sec) if (!sec->used_by_bfd) { struct _mips_elf_section_data *sdata; - bfd_size_type amt = sizeof (*sdata); + size_t amt = sizeof (*sdata); sdata = bfd_zalloc (abfd, amt); if (sdata == NULL) @@ -7830,7 +7830,7 @@ _bfd_mips_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, { asymbol *elf_text_symbol; asection *elf_text_section; - bfd_size_type amt = sizeof (asection); + size_t amt = sizeof (asection); elf_text_section = bfd_zalloc (abfd, amt); if (elf_text_section == NULL) @@ -7871,7 +7871,7 @@ _bfd_mips_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, { asymbol *elf_data_symbol; asection *elf_data_section; - bfd_size_type amt = sizeof (asection); + size_t amt = sizeof (asection); elf_data_section = bfd_zalloc (abfd, amt); if (elf_data_section == NULL) @@ -12549,7 +12549,7 @@ _bfd_mips_elf_modify_segment_map (bfd *abfd, { asection *s; struct elf_segment_map *m, **pm; - bfd_size_type amt; + size_t amt; /* If there is a .reginfo section, we need a PT_MIPS_REGINFO segment. */ @@ -12752,7 +12752,7 @@ _bfd_mips_elf_modify_segment_map (bfd *abfd, && s->vma + s->size <= high) ++c; - amt = sizeof *n + (bfd_size_type) (c - 1) * sizeof (asection *); + amt = sizeof *n - sizeof (asection *) + c * sizeof (asection *); n = bfd_zalloc (abfd, amt); if (n == NULL) return FALSE; @@ -13203,7 +13203,7 @@ _bfd_mips_elf_set_section_contents (bfd *abfd, sec_ptr section, if (elf_section_data (section) == NULL) { - bfd_size_type amt = sizeof (struct bfd_elf_section_data); + size_t amt = sizeof (struct bfd_elf_section_data); section->used_by_bfd = bfd_zalloc (abfd, amt); if (elf_section_data (section) == NULL) return FALSE; @@ -14285,7 +14285,7 @@ struct bfd_link_hash_table * _bfd_mips_elf_link_hash_table_create (bfd *abfd) { struct mips_elf_link_hash_table *ret; - bfd_size_type amt = sizeof (struct mips_elf_link_hash_table); + size_t amt = sizeof (struct mips_elf_link_hash_table); ret = bfd_zmalloc (amt); if (ret == NULL) diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c index e1e34a56e2..510e77cb66 100644 --- a/bfd/elfxx-sparc.c +++ b/bfd/elfxx-sparc.c @@ -1136,7 +1136,7 @@ struct bfd_link_hash_table * _bfd_sparc_elf_link_hash_table_create (bfd *abfd) { struct _bfd_sparc_elf_link_hash_table *ret; - bfd_size_type amt = sizeof (struct _bfd_sparc_elf_link_hash_table); + size_t amt = sizeof (struct _bfd_sparc_elf_link_hash_table); ret = (struct _bfd_sparc_elf_link_hash_table *) bfd_zmalloc (amt); if (ret == NULL) @@ -1811,7 +1811,7 @@ _bfd_sparc_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, p = *head; if (p == NULL || p->sec != sec) { - bfd_size_type amt = sizeof *p; + size_t amt = sizeof *p; p = ((struct elf_dyn_relocs *) bfd_alloc (htab->elf.dynobj, amt)); if (p == NULL) @@ -2770,7 +2770,7 @@ _bfd_sparc_elf_new_section_hook (bfd *abfd, asection *sec) if (!sec->used_by_bfd) { struct _bfd_sparc_elf_section_data *sdata; - bfd_size_type amt = sizeof (*sdata); + size_t amt = sizeof (*sdata); sdata = bfd_zalloc (abfd, amt); if (sdata == NULL) diff --git a/bfd/elfxx-tilegx.c b/bfd/elfxx-tilegx.c index 7887fef200..3f063d0929 100644 --- a/bfd/elfxx-tilegx.c +++ b/bfd/elfxx-tilegx.c @@ -1369,7 +1369,7 @@ struct bfd_link_hash_table * tilegx_elf_link_hash_table_create (bfd *abfd) { struct tilegx_elf_link_hash_table *ret; - bfd_size_type amt = sizeof (struct tilegx_elf_link_hash_table); + size_t amt = sizeof (struct tilegx_elf_link_hash_table); ret = (struct tilegx_elf_link_hash_table *) bfd_zmalloc (amt); if (ret == NULL) @@ -2031,7 +2031,7 @@ tilegx_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, p = *head; if (p == NULL || p->sec != sec) { - bfd_size_type amt = sizeof *p; + size_t amt = sizeof *p; p = ((struct elf_dyn_relocs *) bfd_alloc (htab->elf.dynobj, amt)); if (p == NULL) diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c index fc783b0e98..988e55747e 100644 --- a/bfd/elfxx-x86.c +++ b/bfd/elfxx-x86.c @@ -756,7 +756,7 @@ _bfd_x86_elf_link_hash_table_create (bfd *abfd) { struct elf_x86_link_hash_table *ret; const struct elf_backend_data *bed; - bfd_size_type amt = sizeof (struct elf_x86_link_hash_table); + size_t amt = sizeof (struct elf_x86_link_hash_table); ret = (struct elf_x86_link_hash_table *) bfd_zmalloc (amt); if (ret == NULL) diff --git a/bfd/format.c b/bfd/format.c index a80a175b8a..659d407018 100644 --- a/bfd/format.c +++ b/bfd/format.c @@ -236,7 +236,7 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching) if (matching != NULL || *bfd_associated_vector != NULL) { - bfd_size_type amt; + size_t amt; amt = sizeof (*matching_vector) * 2 * _bfd_target_vector_entries; matching_vector = (const bfd_target **) bfd_malloc (amt); diff --git a/bfd/hash.c b/bfd/hash.c index 8dd130aaff..56d18ac317 100644 --- a/bfd/hash.c +++ b/bfd/hash.c @@ -762,7 +762,7 @@ struct bfd_strtab_hash * _bfd_stringtab_init (void) { struct bfd_strtab_hash *table; - bfd_size_type amt = sizeof (* table); + size_t amt = sizeof (* table); table = (struct bfd_strtab_hash *) bfd_malloc (amt); if (table == NULL) diff --git a/bfd/ihex.c b/bfd/ihex.c index 4c8c249032..958a84b507 100644 --- a/bfd/ihex.c +++ b/bfd/ihex.c @@ -357,7 +357,7 @@ ihex_scan (bfd *abfd) { char secbuf[20]; char *secname; - bfd_size_type amt; + size_t amt; flagword flags; sprintf (secbuf, ".sec%d", bfd_count_sections (abfd) + 1); diff --git a/bfd/irix-core.c b/bfd/irix-core.c index 80cd5f83a2..7b214e0a0a 100644 --- a/bfd/irix-core.c +++ b/bfd/irix-core.c @@ -172,7 +172,7 @@ irix_core_core_file_p (bfd *abfd) int val; struct coreout coreout; struct idesc *idg, *idf, *ids; - bfd_size_type amt; + size_t amt; val = bfd_bread (&coreout, (bfd_size_type) sizeof coreout, abfd); if (val != sizeof coreout) diff --git a/bfd/linker.c b/bfd/linker.c index d8703179e5..c523f8b5c6 100644 --- a/bfd/linker.c +++ b/bfd/linker.c @@ -536,7 +536,7 @@ bfd_wrapped_link_hash_lookup (bfd *abfd, bfd_boolean copy, bfd_boolean follow) { - bfd_size_type amt; + size_t amt; if (info->wrap_hash != NULL) { @@ -764,7 +764,7 @@ struct bfd_link_hash_table * _bfd_generic_link_hash_table_create (bfd *abfd) { struct generic_link_hash_table *ret; - bfd_size_type amt = sizeof (struct generic_link_hash_table); + size_t amt = sizeof (struct generic_link_hash_table); ret = (struct generic_link_hash_table *) bfd_malloc (amt); if (ret == NULL) @@ -2422,7 +2422,7 @@ _bfd_generic_reloc_link_order (bfd *abfd, struct bfd_link_order * bfd_new_link_order (bfd *abfd, asection *section) { - bfd_size_type amt = sizeof (struct bfd_link_order); + size_t amt = sizeof (struct bfd_link_order); struct bfd_link_order *new_lo; new_lo = (struct bfd_link_order *) bfd_zalloc (abfd, amt); diff --git a/bfd/lynx-core.c b/bfd/lynx-core.c index 57cd89748e..ef47c8359c 100644 --- a/bfd/lynx-core.c +++ b/bfd/lynx-core.c @@ -94,7 +94,7 @@ lynx_core_file_p (bfd *abfd) core_st_t *threadp; int pagesize; asection *newsect; - bfd_size_type amt; + size_t amt; pagesize = getpagesize (); /* Serious cross-target issue here... This really needs to come from a system-specific diff --git a/bfd/netbsd-core.c b/bfd/netbsd-core.c index c0fb4c86f1..ae88fd6f74 100644 --- a/bfd/netbsd-core.c +++ b/bfd/netbsd-core.c @@ -60,7 +60,7 @@ netbsd_core_file_p (bfd *abfd) asection *asect; struct core core; struct coreseg coreseg; - bfd_size_type amt = sizeof core; + size_t amt = sizeof core; val = bfd_bread (&core, amt, abfd); if (val != sizeof core) diff --git a/bfd/osf-core.c b/bfd/osf-core.c index 87cebc625d..19cd4f2b75 100644 --- a/bfd/osf-core.c +++ b/bfd/osf-core.c @@ -77,7 +77,7 @@ osf_core_core_file_p (bfd *abfd) int i; char *secname; struct core_filehdr core_header; - bfd_size_type amt; + size_t amt; amt = sizeof core_header; val = bfd_bread (& core_header, amt, abfd); diff --git a/bfd/pdp11.c b/bfd/pdp11.c index 1ab3033363..cd14e87b96 100644 --- a/bfd/pdp11.c +++ b/bfd/pdp11.c @@ -459,7 +459,7 @@ NAME (aout, some_aout_object_p) (bfd *abfd, { struct aout_data_struct *rawptr, *oldrawptr; const bfd_target *result; - bfd_size_type amt = sizeof (struct aout_data_struct); + size_t amt = sizeof (struct aout_data_struct); rawptr = bfd_zalloc (abfd, amt); if (rawptr == NULL) @@ -647,7 +647,7 @@ bfd_boolean NAME (aout, mkobject) (bfd *abfd) { struct aout_data_struct *rawptr; - bfd_size_type amt = sizeof (struct aout_data_struct); + size_t amt = sizeof (struct aout_data_struct); bfd_set_error (bfd_error_system_call); @@ -1413,7 +1413,7 @@ translate_to_native_sym_flags (bfd *abfd, asymbol * NAME (aout, make_empty_symbol) (bfd *abfd) { - bfd_size_type amt = sizeof (aout_symbol_type); + size_t amt = sizeof (aout_symbol_type); aout_symbol_type *new_symbol_type = bfd_zalloc (abfd, amt); if (!new_symbol_type) @@ -2443,7 +2443,7 @@ struct bfd_link_hash_table * NAME (aout, link_hash_table_create) (bfd *abfd) { struct aout_link_hash_table *ret; - bfd_size_type amt = sizeof (struct aout_link_hash_table); + size_t amt = sizeof (struct aout_link_hash_table); ret = bfd_malloc (amt); if (ret == NULL) @@ -2889,7 +2889,7 @@ aout_link_write_other_symbol (struct bfd_hash_entry *bh, void *data) bfd_vma val; struct external_nlist outsym; bfd_size_type indx; - bfd_size_type amt; + size_t amt; if (h->root.type == bfd_link_hash_warning) { diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c index d9bf0e4623..e42d646552 100644 --- a/bfd/peXXigen.c +++ b/bfd/peXXigen.c @@ -3138,7 +3138,7 @@ _bfd_XX_bfd_copy_private_section_data (bfd *ibfd, { if (coff_section_data (obfd, osec) == NULL) { - bfd_size_type amt = sizeof (struct coff_section_tdata); + size_t amt = sizeof (struct coff_section_tdata); osec->used_by_bfd = bfd_zalloc (obfd, amt); if (osec->used_by_bfd == NULL) return FALSE; @@ -3146,7 +3146,7 @@ _bfd_XX_bfd_copy_private_section_data (bfd *ibfd, if (pei_section_data (obfd, osec) == NULL) { - bfd_size_type amt = sizeof (struct pei_section_tdata); + size_t amt = sizeof (struct pei_section_tdata); coff_section_data (obfd, osec)->tdata = bfd_zalloc (obfd, amt); if (coff_section_data (obfd, osec)->tdata == NULL) return FALSE; diff --git a/bfd/peicode.h b/bfd/peicode.h index ed0c544d85..c1bc81b169 100644 --- a/bfd/peicode.h +++ b/bfd/peicode.h @@ -257,7 +257,7 @@ static bfd_boolean pe_mkobject (bfd * abfd) { pe_data_type *pe; - bfd_size_type amt = sizeof (pe_data_type); + size_t amt = sizeof (pe_data_type); abfd->tdata.pe_obj_data = (struct pe_tdata *) bfd_zalloc (abfd, amt); diff --git a/bfd/ppcboot.c b/bfd/ppcboot.c index e1fa7041fd..24f3e0655e 100644 --- a/bfd/ppcboot.c +++ b/bfd/ppcboot.c @@ -102,7 +102,7 @@ ppcboot_mkobject (bfd *abfd) { if (!ppcboot_get_tdata (abfd)) { - bfd_size_type amt = sizeof (ppcboot_data_t); + size_t amt = sizeof (ppcboot_data_t); ppcboot_set_tdata (abfd, bfd_zalloc (abfd, amt)); } @@ -276,7 +276,7 @@ ppcboot_canonicalize_symtab (bfd *abfd, asymbol **alocation) asection *sec = ppcboot_get_tdata (abfd)->sec; asymbol *syms; unsigned int i; - bfd_size_type amt = PPCBOOT_SYMS * sizeof (asymbol); + size_t amt = PPCBOOT_SYMS * sizeof (asymbol); syms = (asymbol *) bfd_alloc (abfd, amt); if (syms == NULL) diff --git a/bfd/ptrace-core.c b/bfd/ptrace-core.c index ae8d747c2b..48a9b1c669 100644 --- a/bfd/ptrace-core.c +++ b/bfd/ptrace-core.c @@ -61,7 +61,7 @@ ptrace_unix_core_file_p (bfd *abfd) int val; struct ptrace_user u; struct trad_core_struct *rawptr; - bfd_size_type amt; + size_t amt; flagword flags; val = bfd_bread ((void *)&u, (bfd_size_type) sizeof u, abfd); diff --git a/bfd/sco5-core.c b/bfd/sco5-core.c index 766bbca09b..a9afbbacd9 100644 --- a/bfd/sco5-core.c +++ b/bfd/sco5-core.c @@ -71,7 +71,7 @@ static struct user * read_uarea (bfd *abfd, int filepos) { struct sco5_core_struct *rawptr; - bfd_size_type amt = sizeof (struct sco5_core_struct); + size_t amt = sizeof (struct sco5_core_struct); rawptr = (struct sco5_core_struct *) bfd_zmalloc (amt); if (rawptr == NULL) diff --git a/bfd/som.c b/bfd/som.c index 8e8960ed83..cbe970f59a 100644 --- a/bfd/som.c +++ b/bfd/som.c @@ -1425,7 +1425,7 @@ hppa_som_gen_reloc_type (bfd *abfd, /* The difference of two symbols needs *very* special handling. */ if (sym_diff) { - bfd_size_type amt = sizeof (int); + size_t amt = sizeof (int); final_types[0] = bfd_alloc (abfd, amt); final_types[1] = bfd_alloc (abfd, amt); @@ -1509,7 +1509,7 @@ hppa_som_gen_reloc_type (bfd *abfd, /* The difference of two symbols needs *very* special handling. */ if (sym_diff) { - bfd_size_type amt = sizeof (int); + size_t amt = sizeof (int); final_types[0] = bfd_alloc (abfd, amt); final_types[1] = bfd_alloc (abfd, amt); @@ -1548,7 +1548,7 @@ hppa_som_gen_reloc_type (bfd *abfd, /* If we have short and long pcrel modes, then generate the proper mode selector, then the pcrel relocation. Redundant selectors will be eliminated as the relocs are sized and emitted. */ - bfd_size_type amt = sizeof (int); + size_t amt = sizeof (int); final_types[0] = bfd_alloc (abfd, amt); if (!final_types[0]) @@ -2393,7 +2393,7 @@ som_object_p (bfd *abfd) unsigned long current_offset = 0; struct som_external_lst_header ext_lst_header; struct som_external_som_entry ext_som_entry; - bfd_size_type amt; + size_t amt; unsigned int loc; #define ENTRY_SIZE sizeof (struct som_external_som_entry) @@ -2548,7 +2548,7 @@ som_prep_headers (bfd *abfd) { struct som_header *file_hdr; asection *section; - bfd_size_type amt = sizeof (struct som_header); + size_t amt = sizeof (struct som_header); /* Make and attach a file header to the BFD. */ file_hdr = bfd_zalloc (abfd, amt); @@ -2907,7 +2907,7 @@ som_write_fixups (bfd *abfd, unsigned int subspace_reloc_size = 0; unsigned int num_spaces = obj_som_file_hdr (abfd)->space_total; asection *section = abfd->sections; - bfd_size_type amt; + size_t amt; memset (tmp_space, 0, SOM_TMP_BUFSIZE); p = tmp_space; @@ -3313,7 +3313,7 @@ som_write_space_strings (bfd *abfd, char *p = tmp_space; unsigned int strings_size = 0; asection *section; - bfd_size_type amt; + size_t amt; bfd_size_type res; if (tmp_space == NULL) @@ -3425,7 +3425,7 @@ som_write_symbol_strings (bfd *abfd, char *tmp_space = bfd_malloc (tmp_space_size); char *p = tmp_space; unsigned int strings_size = 0; - bfd_size_type amt; + size_t amt; bfd_size_type res; if (tmp_space == NULL) @@ -3955,7 +3955,7 @@ som_finish_writing (bfd *abfd) asection *section; unsigned long current_offset; unsigned int strings_size, total_reloc_size; - bfd_size_type amt; + size_t amt; struct som_external_header ext_header; /* We must set up the version identifier here as objcopy/strip copy @@ -4841,7 +4841,7 @@ som_canonicalize_symtab (bfd *abfd, asymbol **location) static asymbol * som_make_empty_symbol (bfd *abfd) { - bfd_size_type amt = sizeof (som_symbol_type); + size_t amt = sizeof (som_symbol_type); som_symbol_type *new_symbol_type = bfd_zalloc (abfd, amt); if (new_symbol_type == NULL) @@ -5371,7 +5371,7 @@ som_new_section_hook (bfd *abfd, asection *newsect) { if (!newsect->used_by_bfd) { - bfd_size_type amt = sizeof (struct som_section_data_struct); + size_t amt = sizeof (struct som_section_data_struct); newsect->used_by_bfd = bfd_zalloc (abfd, amt); if (!newsect->used_by_bfd) @@ -5417,7 +5417,7 @@ som_bfd_copy_private_section_data (bfd *ibfd, bfd *obfd, asection *osection) { - bfd_size_type amt; + size_t amt; /* One day we may try to grok other private data. */ if (ibfd->xvec->flavour != bfd_target_som_flavour @@ -5525,7 +5525,7 @@ bfd_som_set_section_attributes (asection *section, /* Allocate memory to hold the magic information. */ if (som_section_data (section)->copy_data == NULL) { - bfd_size_type amt = sizeof (struct som_copyable_section_data_struct); + size_t amt = sizeof (struct som_copyable_section_data_struct); som_section_data (section)->copy_data = bfd_zalloc (section->owner, amt); if (som_section_data (section)->copy_data == NULL) @@ -5555,7 +5555,7 @@ bfd_som_set_subsection_attributes (asection *section, /* Allocate memory to hold the magic information. */ if (som_section_data (section)->copy_data == NULL) { - bfd_size_type amt = sizeof (struct som_copyable_section_data_struct); + size_t amt = sizeof (struct som_copyable_section_data_struct); som_section_data (section)->copy_data = bfd_zalloc (section->owner, amt); if (som_section_data (section)->copy_data == NULL) @@ -5589,7 +5589,7 @@ bfd_som_set_symbol_type (asymbol *symbol, unsigned int type) bfd_boolean bfd_som_attach_aux_hdr (bfd *abfd, int type, char *string) { - bfd_size_type amt; + size_t amt; if (type == VERSION_AUX_ID) { @@ -6602,7 +6602,7 @@ som_write_armap (bfd *abfd, struct ar_hdr hdr; struct som_external_lst_header lst; unsigned char *p; - bfd_size_type amt; + size_t amt; unsigned int csum; unsigned int module_count; diff --git a/bfd/srec.c b/bfd/srec.c index a370b775bc..266c2b19eb 100644 --- a/bfd/srec.c +++ b/bfd/srec.c @@ -550,7 +550,7 @@ srec_scan (bfd *abfd) { char secbuf[20]; char *secname; - bfd_size_type amt; + size_t amt; flagword flags; sprintf (secbuf, ".sec%d", bfd_count_sections (abfd) + 1); diff --git a/bfd/syms.c b/bfd/syms.c index 128cf19145..8a5c89767a 100644 --- a/bfd/syms.c +++ b/bfd/syms.c @@ -538,7 +538,7 @@ DESCRIPTION asymbol * _bfd_generic_make_empty_symbol (bfd *abfd) { - bfd_size_type amt = sizeof (asymbol); + size_t amt = sizeof (asymbol); asymbol *new_symbol = (asymbol *) bfd_zalloc (abfd, amt); if (new_symbol) new_symbol->the_bfd = abfd; diff --git a/bfd/targets.c b/bfd/targets.c index 1b7e29d1e6..e7cd9a810c 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -1711,7 +1711,7 @@ const char ** bfd_target_list (void) { int vec_length = 0; - bfd_size_type amt; + size_t amt; const bfd_target * const *target; const char **name_list, **name_ptr; diff --git a/bfd/tekhex.c b/bfd/tekhex.c index d7243c4d29..aaaffa05c2 100644 --- a/bfd/tekhex.c +++ b/bfd/tekhex.c @@ -428,7 +428,7 @@ first_phase (bfd *abfd, int type, char *src, char * src_end) case '8': /* Symbols, add to section. */ { - bfd_size_type amt = sizeof (tekhex_symbol_type); + size_t amt = sizeof (tekhex_symbol_type); tekhex_symbol_type *new_symbol = (tekhex_symbol_type *) bfd_alloc (abfd, amt); char stype = (*src); @@ -912,7 +912,7 @@ tekhex_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, static asymbol * tekhex_make_empty_symbol (bfd *abfd) { - bfd_size_type amt = sizeof (struct tekhex_symbol_struct); + size_t amt = sizeof (struct tekhex_symbol_struct); tekhex_symbol_type *new_symbol = (tekhex_symbol_type *) bfd_zalloc (abfd, amt); diff --git a/bfd/trad-core.c b/bfd/trad-core.c index 9ae1e53582..10ab252134 100644 --- a/bfd/trad-core.c +++ b/bfd/trad-core.c @@ -77,7 +77,7 @@ trad_unix_core_file_p (bfd *abfd) int val; struct user u; struct trad_core_struct *rawptr; - bfd_size_type amt; + size_t amt; flagword flags; #ifdef TRAD_CORE_USER_OFFSET diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c index 586a157cb1..b967243beb 100644 --- a/bfd/vms-alpha.c +++ b/bfd/vms-alpha.c @@ -2656,7 +2656,7 @@ _bfd_vms_slurp_object_records (bfd * abfd) static bfd_boolean vms_initialize (bfd * abfd) { - bfd_size_type amt; + size_t amt; amt = sizeof (struct vms_private_data_struct); abfd->tdata.any = bfd_zalloc (abfd, amt); @@ -8457,7 +8457,7 @@ static struct bfd_link_hash_table * alpha_vms_bfd_link_hash_table_create (bfd *abfd) { struct alpha_vms_link_hash_table *ret; - bfd_size_type amt = sizeof (struct alpha_vms_link_hash_table); + size_t amt = sizeof (struct alpha_vms_link_hash_table); ret = (struct alpha_vms_link_hash_table *) bfd_malloc (amt); if (ret == NULL) @@ -9424,7 +9424,7 @@ vms_close_and_cleanup (bfd * abfd) static bfd_boolean vms_new_section_hook (bfd * abfd, asection *section) { - bfd_size_type amt; + size_t amt; vms_debug2 ((1, "vms_new_section_hook (%p, [%u]%s)\n", abfd, section->index, section->name)); diff --git a/bfd/wasm-module.c b/bfd/wasm-module.c index e62f842e12..dfd3d873b2 100644 --- a/bfd/wasm-module.c +++ b/bfd/wasm-module.c @@ -688,7 +688,7 @@ wasm_canonicalize_symtab (bfd *abfd, asymbol **alocation) static asymbol * wasm_make_empty_symbol (bfd *abfd) { - bfd_size_type amt = sizeof (asymbol); + size_t amt = sizeof (asymbol); asymbol *new_symbol = (asymbol *) bfd_zalloc (abfd, amt); if (! new_symbol) diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c index 2a431dbecf..ff4b483703 100644 --- a/bfd/xcofflink.c +++ b/bfd/xcofflink.c @@ -214,7 +214,7 @@ xcoff_get_section_contents (bfd *abfd, asection *sec) { if (coff_section_data (abfd, sec) == NULL) { - bfd_size_type amt = sizeof (struct coff_section_tdata); + size_t amt = sizeof (struct coff_section_tdata); sec->used_by_bfd = bfd_zalloc (abfd, amt); if (sec->used_by_bfd == NULL) @@ -593,7 +593,7 @@ struct bfd_link_hash_table * _bfd_xcoff_bfd_link_hash_table_create (bfd *abfd) { struct xcoff_link_hash_table *ret; - bfd_size_type amt = sizeof (* ret); + size_t amt = sizeof (* ret); ret = bfd_zmalloc (amt); if (ret == NULL) @@ -764,7 +764,7 @@ xcoff_set_import_path (struct bfd_link_info *info, if (*pp == NULL) { struct xcoff_import_file *n; - bfd_size_type amt = sizeof (* n); + size_t amt = sizeof (*n); n = bfd_alloc (info->output_bfd, amt); if (n == NULL) @@ -2520,7 +2520,7 @@ xcoff_find_function (struct bfd_link_info *info, { char *fnname; struct xcoff_link_hash_entry *hfn; - bfd_size_type amt; + size_t amt; amt = strlen (h->root.root.string) + 2; fnname = bfd_malloc (amt); @@ -3044,7 +3044,7 @@ bfd_xcoff_link_record_set (bfd *output_bfd, { struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg; struct xcoff_link_size_list *n; - bfd_size_type amt; + size_t amt; if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour) return TRUE; @@ -3292,7 +3292,7 @@ static bfd_boolean xcoff_build_ldsym (struct xcoff_loader_info *ldinfo, struct xcoff_link_hash_entry *h) { - bfd_size_type amt; + size_t amt; /* Warn if this symbol is exported but not defined. */ if ((h->flags & XCOFF_EXPORT) != 0 @@ -3640,7 +3640,7 @@ bfd_xcoff_size_dynamic_sections (bfd *output_bfd, bfd *sub; struct bfd_strtab_hash *debug_strtab; bfd_byte *debug_contents = NULL; - bfd_size_type amt; + size_t amt; if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour) { @@ -4861,7 +4861,7 @@ xcoff_link_input_bfd (struct xcoff_final_link_info *flinfo, { struct xcoff_toc_rel_hash *n; struct xcoff_link_section_info *si; - bfd_size_type amt; + size_t amt; amt = sizeof (* n); n = bfd_alloc (flinfo->output_bfd, amt); -- 2.34.1