From 3fe22b980bdb54195528c580ac5267e29d27914d Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 13 Jul 1995 18:14:45 +0000 Subject: [PATCH] * aoutx.h (NAME(aout,slurp_reloc_table)): Cast argument to size_t for malloc. * coff-mips.c (mips_relocate_section): Likewise, for memmove. (mips_relax_section): Likewise, for malloc. * cofflink.c (process_embedded_commands): Likewise. (_bfd_coff_final_link): Likewise. * ecoff.c (_bfd_ecoff_write_object_contents): Likewise. (ecoff_final_link_debug_accumulate): Likewise. (ecoff_indirect_link_order): Likewise, for memcpy and malloc. (ecoff_reloc_link_order): Likewise, for malloc. * ecofflink.c (ecoff_align_debug): Likewise, for memset. (ecoff_write_symhdr): Likewise, for malloc. * elf32-hppa.c (elf32_hppa_read_symext_info): Likewise. * elf.c (assign_file_positions_except_relocs): Likewise, for qsort. * elf32-mips.c (mips_elf_read_ecoff_info): Likewise, for malloc. * elfcode.h (elf_slurp_reloc_table): Likewise. * elfcore.h (elf_corefile_note): Likewise. * elflink.h (elf_link_add_object_symbols): Likewise. (elf_link_read_relocs): Likewise. (NAME(bfd_elf,size_dynamic_sections)): Likewise, for memset. * i386linux.c (bfd_linux_size_dynamic_sections): Likewise. * ieee.c (do_with_relocs): Likewise. * linker.c (default_indirect_link_order): Likewise, for malloc. * nlmcode.h (nlm_object_p): Likewise. (nlm_write_object_contents): Likewise. * oasys.c (oasys_set_section_contents): Likewise, for memcpy. * reloc.c (bfd_generic_get_relocated_section_contents): Likewise, for malloc. * section.c (bfd_get_section_contents): Likewise, for memcpy. * srec.c (srec_get_section_contents): Likewise. (srec_set_section_contents): Likewise. * sunos.c (bfd_sunos_size_dynamic_sections): Likewise, for realloc and memset. (sunos_scan_relocs): Likewise, for malloc. (sunos_scan_dynamic_symbol): Likewise, for realloc. * syms.c (_bfd_generic_read_minisymbols): Likewise, for malloc. * versados.c (versados_get_section_contents): Likewise, for memcpy. --- bfd/ChangeLog | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ bfd/aoutx.h | 2 +- bfd/elf32-mips.c | 6 +++--- bfd/elflink.h | 6 +++--- bfd/syms.c | 2 +- 5 files changed, 61 insertions(+), 8 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 7d20576f55d..0f4d89f88b6 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,58 @@ Thu Jul 13 10:33:25 1995 Ian Lance Taylor + * aoutx.h (NAME(aout,slurp_reloc_table)): Cast argument to size_t + for malloc. + * coff-mips.c (mips_relocate_section): Likewise, for memmove. + (mips_relax_section): Likewise, for malloc. + * cofflink.c (process_embedded_commands): Likewise. + (_bfd_coff_final_link): Likewise. + * ecoff.c (_bfd_ecoff_write_object_contents): Likewise. + (ecoff_final_link_debug_accumulate): Likewise. + (ecoff_indirect_link_order): Likewise, for memcpy and malloc. + (ecoff_reloc_link_order): Likewise, for malloc. + * ecofflink.c (ecoff_align_debug): Likewise, for memset. + (ecoff_write_symhdr): Likewise, for malloc. + * elf32-hppa.c (elf32_hppa_read_symext_info): Likewise. + * elf.c (assign_file_positions_except_relocs): Likewise, for + qsort. + * elf32-mips.c (mips_elf_read_ecoff_info): Likewise, for malloc. + * elfcode.h (elf_slurp_reloc_table): Likewise. + * elfcore.h (elf_corefile_note): Likewise. + * elflink.h (elf_link_add_object_symbols): Likewise. + (elf_link_read_relocs): Likewise. + (NAME(bfd_elf,size_dynamic_sections)): Likewise, for memset. + * i386linux.c (bfd_linux_size_dynamic_sections): Likewise. + * ieee.c (do_with_relocs): Likewise. + * linker.c (default_indirect_link_order): Likewise, for malloc. + * nlmcode.h (nlm_object_p): Likewise. + (nlm_write_object_contents): Likewise. + * oasys.c (oasys_set_section_contents): Likewise, for memcpy. + * reloc.c (bfd_generic_get_relocated_section_contents): Likewise, + for malloc. + * section.c (bfd_get_section_contents): Likewise, for memcpy. + * srec.c (srec_get_section_contents): Likewise. + (srec_set_section_contents): Likewise. + * sunos.c (bfd_sunos_size_dynamic_sections): Likewise, for + realloc and memset. + (sunos_scan_relocs): Likewise, for malloc. + (sunos_scan_dynamic_symbol): Likewise, for realloc. + * syms.c (_bfd_generic_read_minisymbols): Likewise, for malloc. + * versados.c (versados_get_section_contents): Likewise, for + memcpy. + + * libbfd.c (real_read): Add prototype. Change argument types from + int to size_t. + (bfd_read): Cast real_read argument to size_t, not int. + (bfd_write): Cast fwrite argument to size_t, not int. + + * elf64-gen.c (elf_info_to_howto): Fix definition for recent elf.c + changes. + + * configure.in: Fix typo: change {$enableval} to ${enableval}. + * configure: Rebuild. + + * Makefile.in (BFD32_BACKENDS): Add elflink.o. + * targets.c (bfd_target): Add fields _read_minisymbols and _minisymbol_to_symbol. (BFD_JUMP_TABLE_SYMBOLS): Add _read_minisymbols and diff --git a/bfd/aoutx.h b/bfd/aoutx.h index 8d2385ec581..506d5eec431 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -2287,7 +2287,7 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols) } memset (reloc_cache, 0, count * sizeof (arelent)); - relocs = malloc (reloc_size); + relocs = malloc ((size_t) reloc_size); if (relocs == NULL && reloc_size != 0) { free (reloc_cache); diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c index 61c01382479..09f144fee9b 100644 --- a/bfd/elf32-mips.c +++ b/bfd/elf32-mips.c @@ -18,7 +18,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" @@ -1409,7 +1409,7 @@ mips_elf_read_ecoff_info (abfd, section, debug) swap = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap; - ext_hdr = (char *) malloc (swap->external_hdr_size); + ext_hdr = (char *) malloc ((size_t) swap->external_hdr_size); if (ext_hdr == NULL && swap->external_hdr_size != 0) { bfd_set_error (bfd_error_no_memory); @@ -1431,7 +1431,7 @@ mips_elf_read_ecoff_info (abfd, section, debug) debug->ptr = NULL; \ else \ { \ - debug->ptr = (type) malloc (size * symhdr->count); \ + debug->ptr = (type) malloc ((size_t) (size * symhdr->count)); \ if (debug->ptr == NULL) \ { \ bfd_set_error (bfd_error_no_memory); \ diff --git a/bfd/elflink.h b/bfd/elflink.h index 2efbdda6f18..ecacfbbddd6 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -362,7 +362,7 @@ elf_link_add_object_symbols (abfd, info) int elfsec; unsigned long link; - dynbuf = (Elf_External_Dyn *) malloc (s->_raw_size); + dynbuf = (Elf_External_Dyn *) malloc ((size_t) s->_raw_size); if (dynbuf == NULL) { bfd_set_error (bfd_error_no_memory); @@ -1057,7 +1057,7 @@ elf_link_read_relocs (abfd, o, external_relocs, internal_relocs, keep_memory) if (external_relocs == NULL) { - alloc1 = (PTR) malloc (rel_hdr->sh_size); + alloc1 = (PTR) malloc ((size_t) rel_hdr->sh_size); if (alloc1 == NULL) { bfd_set_error (bfd_error_no_memory); @@ -1365,7 +1365,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath, bfd_set_error (bfd_error_no_memory); return false; } - memset (s->contents, 0, s->_raw_size); + memset (s->contents, 0, (size_t) s->_raw_size); put_word (output_bfd, bucketcount, s->contents); put_word (output_bfd, dynsymcount, s->contents + (ARCH_SIZE / 8)); diff --git a/bfd/syms.c b/bfd/syms.c index 402d7666351..2365c24e2e2 100644 --- a/bfd/syms.c +++ b/bfd/syms.c @@ -634,7 +634,7 @@ _bfd_generic_read_minisymbols (abfd, dynamic, minisymsp, sizep) if (storage < 0) goto error_return; - syms = (asymbol **) malloc (storage); + syms = (asymbol **) malloc ((size_t) storage); if (syms == NULL) { bfd_set_error (bfd_error_no_memory); -- 2.30.2