diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c index 61dc05e805d..45b3f760f55 100644 --- a/bfd/coff-alpha.c +++ b/bfd/coff-alpha.c @@ -2174,6 +2174,7 @@ alpha_ecoff_get_elt_at_filepos (bfd *archive, file_ptr filepos, nbfd->iostream = bim; nbfd->iovec = &_bfd_memory_iovec; nbfd->origin = 0; + nbfd->size = 0; BFD_ASSERT (! nbfd->cacheable); return nbfd; diff --git a/bfd/opncls.c b/bfd/opncls.c index 6ae3af054e4..4dbd30d2fe9 100644 --- a/bfd/opncls.c +++ b/bfd/opncls.c @@ -987,6 +987,7 @@ bfd_make_readable (bfd *abfd) abfd->symcount = 0; abfd->outsymbols = 0; abfd->tdata.any = 0; + abfd->size = 0; bfd_section_list_clear (abfd); bfd_check_format (abfd, bfd_object); diff --git a/bfd/peicode.h b/bfd/peicode.h index 22ffec989f2..fef7d0dd69b 100644 --- a/bfd/peicode.h +++ b/bfd/peicode.h @@ -1105,6 +1105,7 @@ pe_ILF_build_a_bfd (bfd * abfd, abfd->iovec = &_bfd_memory_iovec; abfd->where = 0; abfd->origin = 0; + abfd->size = 0; obj_sym_filepos (abfd) = 0; /* Now create a symbol describing the imported value. */ diff --git a/binutils/objdump.c b/binutils/objdump.c index 9e76684c071..4292c23a9ab 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -994,45 +994,22 @@ dump_headers (bfd *abfd) static asymbol ** slurp_symtab (bfd *abfd) { - asymbol **sy = NULL; - long storage; - + symcount = 0; if (!(bfd_get_file_flags (abfd) & HAS_SYMS)) - { - symcount = 0; - return NULL; - } + return NULL; - storage = bfd_get_symtab_upper_bound (abfd); + long storage = bfd_get_symtab_upper_bound (abfd); if (storage < 0) { - non_fatal (_("failed to read symbol table from: %s"), bfd_get_filename (abfd)); + non_fatal (_("failed to read symbol table from: %s"), + bfd_get_filename (abfd)); bfd_fatal (_("error message was")); } - if (storage) - { - off_t filesize = bfd_get_file_size (abfd); - - /* qv PR 24707. */ - if (filesize > 0 - && filesize < storage - /* The MMO file format supports its own special compression - technique, so its sections can be larger than the file size. */ - && bfd_get_flavour (abfd) != bfd_target_mmo_flavour) - { - bfd_nonfatal_message (bfd_get_filename (abfd), abfd, NULL, - _("error: symbol table size (%#lx) " - "is larger than filesize (%#lx)"), - storage, (long) filesize); - exit_status = 1; - symcount = 0; - return NULL; - } - - sy = (asymbol **) xmalloc (storage); - } + if (storage == 0) + return NULL; + asymbol **sy = (asymbol **) xmalloc (storage); symcount = bfd_canonicalize_symtab (abfd, sy); if (symcount < 0) bfd_fatal (bfd_get_filename (abfd)); @@ -1044,26 +1021,24 @@ slurp_symtab (bfd *abfd) static asymbol ** slurp_dynamic_symtab (bfd *abfd) { - asymbol **sy = NULL; - long storage; - - storage = bfd_get_dynamic_symtab_upper_bound (abfd); + dynsymcount = 0; + long storage = bfd_get_dynamic_symtab_upper_bound (abfd); if (storage < 0) { if (!(bfd_get_file_flags (abfd) & DYNAMIC)) { non_fatal (_("%s: not a dynamic object"), bfd_get_filename (abfd)); exit_status = 1; - dynsymcount = 0; return NULL; } bfd_fatal (bfd_get_filename (abfd)); } - if (storage) - sy = (asymbol **) xmalloc (storage); + if (storage == 0) + return NULL; + asymbol **sy = (asymbol **) xmalloc (storage); dynsymcount = bfd_canonicalize_dynamic_symtab (abfd, sy); if (dynsymcount < 0) bfd_fatal (bfd_get_filename (abfd));