#define DEFAULT_ARCH bfd_arch_m68k
#define MY_get_section_contents aout_32_get_section_contents
-#define MY_close_and_cleanup aout_32_close_and_cleanup
#define MY_slurp_armap bfd_slurp_bsd_armap_f2
/***********************************************/
#define MY_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define MY_bfd_final_link _bfd_generic_final_link
+/* Until and unless we convert the slurp_reloc and slurp_symtab
+ routines in this file, we can not use the default aout
+ free_cached_info routine which assumes that the relocs and symtabs
+ were allocated using malloc. */
+#define MY_bfd_free_cached_info bfd_true
+
#define hp300hpux_write_syms aout_32_write_syms
#define MY_callback MY(callback)
/* this is really the sym table size but we store it in drelocs */
bfd_h_put_32 (abfd, bfd_get_symcount (abfd) * 12, exec_bytes.e_drelocs);
- bfd_seek (abfd, 0L, false);
- bfd_write ((PTR) & exec_bytes, 1, EXEC_BYTES_SIZE, abfd);
+ if (bfd_seek (abfd, 0L, false) != 0
+ || (bfd_write ((PTR) & exec_bytes, 1, EXEC_BYTES_SIZE, abfd)
+ != EXEC_BYTES_SIZE))
+ return false;
/* Write out the symbols, and then the relocs. We must write out
the symbols first so that we know the symbol indices. */
if (bfd_get_symcount (abfd) != 0)
{
- bfd_seek (abfd, (long) (N_TRELOFF (*execp)), false);
-
+ if (bfd_seek (abfd, (long) (N_TRELOFF (*execp)), false) != 0)
+ return false;
if (!NAME (aout, squirt_out_relocs) (abfd, obj_textsec (abfd)))
return false;
- bfd_seek (abfd, (long) (N_DRELOFF (*execp)), false);
-
+ if (bfd_seek (abfd, (long) (N_DRELOFF (*execp)), false) != 0)
+ return false;
if (!NAME (aout, squirt_out_relocs) (abfd, obj_datasec (abfd)))
return false;
}
return false;
}
syms = (struct external_nlist *) (strings + SYM_EXTRA_BYTES);
- bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET);
- if (bfd_read ((PTR) syms, symbol_bytes, 1, abfd) != symbol_bytes)
+ if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0
+ || bfd_read ((PTR) syms, symbol_bytes, 1, abfd) != symbol_bytes)
{
bfd_release (abfd, syms);
return false;
return false;
doit:
- bfd_seek (abfd, asect->rel_filepos, SEEK_SET);
+ if (bfd_seek (abfd, asect->rel_filepos, SEEK_SET) != 0)
+ return false;
each_size = obj_reloc_entry_size (abfd);
count = reloc_size / each_size;
reloc_cache = (arelent *) bfd_zalloc (abfd, (size_t) (count * sizeof
(arelent)));
- if (!reloc_cache)
+ if (!reloc_cache && count != 0)
{
nomem:
bfd_set_error (bfd_error_no_memory);
}
relocs = (PTR) bfd_alloc (abfd, reloc_size);
- if (!relocs)
+ if (!relocs && reloc_size != 0)
{
bfd_release (abfd, reloc_cache);
goto nomem;
/* call aout_32 versions if the input file was generated by gcc */
/************************************************************************/
-unsigned int aout_32_get_symtab PARAMS ((bfd * abfd, asymbol ** location));
-unsigned int aout_32_get_symtab_upper_bound PARAMS ((bfd * abfd));
+long aout_32_get_symtab PARAMS ((bfd * abfd, asymbol ** location));
+long aout_32_get_symtab_upper_bound PARAMS ((bfd * abfd));
-unsigned int aout_32_canonicalize_reloc PARAMS ((bfd * abfd, sec_ptr section,
- arelent ** relptr,
- asymbol ** symbols));
+long aout_32_canonicalize_reloc PARAMS ((bfd * abfd, sec_ptr section,
+ arelent ** relptr,
+ asymbol ** symbols));
-unsigned int
+long
MY (get_symtab) (abfd, location)
bfd *abfd;
asymbol **location;
return aout_32_get_symtab (abfd, location);
if (!MY (slurp_symbol_table) (abfd))
- return 0;
+ return -1;
for (symbase = obj_aout_symbols (abfd); counter++ < bfd_get_symcount (abfd);)
*(location++) = (asymbol *) (symbase++);
return bfd_get_symcount (abfd);
}
-unsigned int
+long
MY (get_symtab_upper_bound) (abfd)
bfd *abfd;
{
if (obj_aout_subformat (abfd) == gnu_encap_format)
return aout_32_get_symtab_upper_bound (abfd);
if (!MY (slurp_symbol_table) (abfd))
- return 0;
+ return -1;
return (bfd_get_symcount (abfd) + 1) * (sizeof (aout_symbol_type *));
}
-unsigned int
+long
MY (canonicalize_reloc) (abfd, section, relptr, symbols)
bfd *abfd;
sec_ptr section;
return aout_32_canonicalize_reloc (abfd, section, relptr, symbols);
if (!(tblptr || MY (slurp_reloc_table) (abfd, section, symbols)))
- return 0;
+ return -1;
if (section->flags & SEC_CONSTRUCTOR)
{
else
{
tblptr = section->relocation;
- if (!tblptr)
- return 0;
for (count = 0; count++ < section->reloc_count;)
{