Ian Lance Taylor
1ff0461b4e
* hp300hpux.c (MY(callback)): Set lma as well as vma.
1995-11-27 20:11:40 +00:00
Ian Lance Taylor
7a7fbffb25
* aout-adobe.c (aout_adobe_callback): Use _bfd_error_handler
...
rather than a direct fprintf.
* archive.c (_bfd_write_archive_contents): Likewise.
* coffcode.h (coff_slurp_symbol_table): Likewise.
* elf32-ppc.c (ppc_elf_merge_private_bfd_data): Likewise.
(ppc_elf_unsupported_reloc): Likewise.
(ppc_elf_relocate_section): Likewise.
* i386linux.c (linux_tally_symbols): Likewise.
(linux_finish_dynamic_link): Likewise.
* osf-core.c (osf_core_core_file_p): Likewise.
* rs6000-core.c (rs6000coff_get_section_contents): Likewise.
* som.c (som_sizeof_headers): Likewise.
* srec.c (srec_bad_byte): Likewise.
* bfd.c (bfd_assert): Likewise. Also change file to be const.
* libbfd-in.h (bfd_assert): Declare first parameter const.
* libbfd.h: Rebuild.
* coff-a29k.c (a29k_reloc): Don't bother to fprintf; returning
bfd_reloc_overflow is enough.
* coff-h8300.c (rtype2howto): Don't bother to fprintf; just abort.
* coff-h8500.c (rtype2howto): Likewise.
* coff-z8k.c (rtype2howto): Likewise.
* coffcode.h (dummy_reloc16_extra_cases): Likewise.
* elf.c (_bfd_elf_get_lineno): Likewise.
(_bfd_elf_no_info_to_howto): Likewise.
(_bfd_elf_no_info_to_howto_rel): Likewise.
* hp300hpux.c (convert_sym_type): Likewise.
(MY(swap_std_reloc_in)): Likewise.
* elf.c (bfd_section_from_shdr): Remove #if 0 sections.
1995-09-25 21:31:29 +00:00
Ian Lance Taylor
263a3f176a
* hp300hpux.c (MY_final_link_callback): Define to avoid warning.
...
(BMAGIC, QMAGIC): Define; used by aoutx.h.
(MY(slurp_symbol_table)): Change translate_from_native_sym_flags
calls to use new parameters.
1994-06-20 15:11:34 +00:00
Ian Lance Taylor
b3cee0a981
* aoutx.h (NAME(aout,canonicalize_reloc)): Don't error out if
...
section->relocation is NULL; malloc might have returned NULL when
given a zero size if there were no relocations.
* bout.c (b_out_canonicalize_reloc): Likewise.
* coffcode.h (coff_canonicalize_reloc): Likewise.
* ecoff.c (ecoff_canonicalize_reloc): Likewise.
* elfcode.h (elf_canonicalize_reloc): Likewise.
* mipsbsd.c (MY(canonicalize_reloc)): Likewise.
* i386lynx.c (NAME(lynx,canonicalize_reloc)): Likewise.
* nlmcode.h (nlm_canonicalize_reloc): Likewise.
* som.c (som_canonicalize_reloc): Likewise.
* hp300hpux.c (MY(slurp_reloc_table)): Likewise. Also, if malloc
returns NULL, don't report an error if we asked for zero bytes.
* i386lynx.c (NAME(lynx,slurp_reloc_table)): If malloc returns
NULL, don't report an error if we asked for zero bytes.
* nlmcode.h (nlm_slurp_reloc_fixups): Likewise.
1994-04-05 15:32:49 +00:00
Ian Lance Taylor
4002f18a05
Made sure that every call to bfd_read, bfd_write, and bfd_seek
...
checks the return value and handled bfd_error correctly. These
changes are not itemised.
1994-04-04 22:49:04 +00:00
Ian Lance Taylor
5c8444f8f8
Add bfd_free_cached_info support to a.out backends.
...
* aoutx.h (aout_get_external_symbols): Renamed from
aout_link_get_symbols. Read strings even if symbols have been
read. Store string size in obj_aout_string_size.
(NAME(aout,slurp_symbol_table)): Call aout_get_external_symbols to
read the symbols. Allocate the cached symbols with malloc, not
bfd_alloc.
(NAME(aout,slurp_reloc_table)): Allocate the cached relocs with
malloc, not bfd_alloc.
(NAME(aout,bfd_free_cached_info)): New function; free cached
symbols and relocs.
* libaout.h (struct aoutdata): Add external_string_size field.
(obj_aout_external_string_size): New accessor macro.
(NAME(aout,close_and_cleanup)): Don't declare.
(NAME(aout,bfd_free_cached_info)): Declare.
(aout_32_close_and_cleanup): Don't define.
(aout_64_close_and_cleanup): Don't define.
* aout-target.h (MY_bfd_free_cached_info): If not already defined,
define as NAME(aout,free_cached_info).
(MY_close_and_cleanup): If not already defined, define as
MY_bfd_free_cached_info.
* aout-adobe.c (aout_32_close_and_cleanup): Define.
(aout_32_bfd_free_cached_info): Don't define.
* bout.c (aout_32_close_and_cleanup): Define.
(aout_32_bfd_free_cached_info): Don't define.
* hp300hpux.c (MY_bfd_free_cached_info): Define as bfd_true.
(MY_close_and_cleanup): Don't define.
* i386lynx.c (NAME(lynx,slurp_reloc_table)): Allocate the cached
relocs with malloc, not bfd_alloc.
* i386os9k.c (aout_32_close_and_cleanup): Define.
(aout_32_bfd_free_cached_info): Don't define.
1994-04-01 22:08:38 +00:00
Ian Lance Taylor
326e32d7ce
Wed Mar 30 16:25:41 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
...
Changes to let BFD return an error indication from
get_symtab_upper_bound, bfd_canonicalize_symtab,
bfd_get_reloc_upper_bound, and bfd_canonicalize_reloc. They now
return long instead of unsigned int, and use -1 to indicate an
error. Along the way, rename get_symtab_upper_bound to
bfd_get_symtab_upper_bound.
* bfd.c (bfd_get_reloc_upper_bound): Return long, and -1 on
errors.
(bfd_canonicalize_reloc): Likewise.
* syms.c (bfd_get_symtab_upper_bound): Renamed from
get_symtab_upper_bound.
* targets.c (bfd_target): Renamed _get_symtab_upper_bound to
_bfd_get_symtab_upper_bound, and changed it and
_bfd_canonicalize_symtab and _get_reloc_upper_bound and
_bfd_canonicalize_reloc to all return long.
* aoutx.h (NAME(aout,get_symtab)): Return long, and -1 on errors.
(NAME(aout,canonicalize_reloc)): Likewise.
(NAME(aout,get_reloc_upper_bound)): Likewise.
(NAME(aout,get_symtab_upper_bound)): Likewise.
* bout.c (b_out_canonicalize_reloc): Likewise.
(b_out_get_reloc_upper_bound): Likewise.
* coffcode.h (coff_canonicalize_reloc): Likewise.
* coffgen.c (coff_get_symtab_upper_bound): Likewise.
(coff_get_symtab): Likewise.
(coff_get_reloc_upper_bound): Likewise.
* ecoff.c (ecoff_get_symtab_upper_bound): Likewise.
(ecoff_get_symtab): Likewise.
(ecoff_canonicalize_reloc): Likewise.
* elfcode.h (elf_get_symtab_upper_bound): Likewise.
(elf_get_reloc_upper_bound): Likewise.
(elf_canonicalize_reloc): Likewise.
(elf_get_symtab): Likewise.
* hp300hpux.c (MY(get_symtab)): Likewise.
(MY(get_symtab_upper_bound)): Likewise.
(MY(canonicalize_reloc)): Likewise.
* i386lynx.c (NAME(lynx,canonicalize_reloc)): Likewise.
* ieee.c (ieee_slurp_external_symbols): Change return type to
boolean. Check for errors from get_symbol.
(ieee_slurp_symbol_table): Change return type to boolean. Check
for errors from ieee_slurp_external_symbols.
(ieee_get_symtab_upper_bound): Return long, and -1 on errors.
(ieee_get_symtab): Likewise.
(ieee_get_reloc_upper_bound): Likewise.
(ieee_canonicalize_reloc): Likewise.
* mipsbsd.c (MY(canonicalize_reloc)): Likewise.
* nlmcode.h (nlm_get_symtab_upper_bound): Likewise.
(nlm_get_symtab): Likewise.
(nlm_get_reloc_upper_bound): Likewise.
(nlm_canonicalize_reloc): Likewise.
* oasys.c (oasys_get_symtab_upper_bound): Likewise.
(oasys_get_symtab): Likewise.
(oasys_get_reloc_upper_bound): Likewise.
(oasys_canonicalize_reloc): Likewise.
* som.c (som_get_symtab_upper_bound): Likewise.
(som_get_symtab): Likewise.
(som_get_reloc_upper_bound): Likewise.
(som_canonicalize_reloc): Likewise.
* srec.c (srec_get_symtab_upper_bound): Likewise.
(srec_get_symtab): Likewise.
(srec_get_reloc_upper_bound): Define as bfd_0l.
(srec_canonicalize_reloc): Likewise.
* tekhex.c (tekhex_get_symtab): Return long, and -1 on errors.
(tekhex_get_symtab_upper_bound): Likewise.
(tekhex_get_reloc_upper_bound): Define as bfd_0l.
(tekhex_canonicalize_reloc): Likewise.
* libaout.h (NAME(aout,get_symtab_upper_bound)): Change
declaration to return long.
(NAME(aout,get_symtab)): Likewise.
(NAME(aout,canonicalize_reloc)): Likewise.
(NAME(aout,get_reloc_upper_bound)): Likewise.
* libcoff-in.h (coff_get_symtab_upper_bound): Likewise.
(coff_get_symtab): Likewise.
(coff_get_reloc_upper_bound): Likewise.
* libecoff.h (ecoff_get_symtab_upper_bound): Likewise.
(ecoff_get_symtab): Likewise.
(ecoff_canonicalize_reloc): Likewise.
* libelf.h (bfd_elf32_get_symtab_upper_bound): Likewise.
(bfd_elf32_get_symtab): Likewise.
(bfd_elf32_get_reloc_upper_bound): Likewise.
(bfd_elf32_canonicalize_reloc): Likewise.
(bfd_elf64_get_symtab_upper_bound): Likewise.
(bfd_elf64_get_symtab): Likewise.
(bfd_elf64_get_reloc_upper_bound): Likewise.
(bfd_elf64_canonicalize_reloc): Likewise.
* libnlm.h (nlmNAME(get_symtab_upper_bound)): Likewise.
(nlmNAME(get_symtab)): Likewise.
(nlmNAME(get_reloc_upper_bound)): Likewise.
(nlmNAME(canonicalize_reloc)): Likewise.
* archive.c (compute_and_write_armap): Use error_return and
no_memory_return labels rather than freeing information in various
places. Change storage, symcount and src_count to long. Check
errors from bfd_get_symtab_upper_bound and
bfd_canonicalize_symtab.
* bout.c (b_out_relax_section): Change reloc_size to long. Check
for errors from bfd_get_reloc_upper_bound and
bfd_canonicalize_reloc.
(b_out_get_relocated_section_contents): Likewise.
* coff-alpha.c (alpha_ecoff_get_relocated_section_contents):
Likewise.
* elf32-mips.c: Likewise.
* elf32-hppa.c (hppa_elf_stub_finish): Likewise.
(hppa_look_for_stubs_in_section): Check for errors from
bfd_get_symtab_upper_bound, bfd_canonicalize_symtab, and
bfd_canonicalize_reloc.
* ecofflink.c (bfd_ecoff_debug_accumulate_other): Check for errors
from bfd_get_symtab_upper_bound and bfd_canonicalize_symtab.
* linker.c (generic_link_read_symbols): Likewise.
(_bfd_generic_final_link): Check for errors from
bfd_get_reloc_upper_bound and bfd_canonicalize_reloc.
* reloc.c (bfd_generic_get_relocated_section_contents): Likewise.
* reloc16.c (bfd_coff_reloc16_relax_section): Likewise.
(bfd_coff_reloc16_get_relocated_section_contents): Likewise.
* libbfd.c (bfd_0l): New function.
* libbfd-in.h (bfd_0l): Declare.
* aix386-core.c: Change get_symtab_upper_bound, get_symtab,
get_reloc_upper_bound, and canonicalize_reloc to use bfd_0l rather
than bfd_0u.
* cisco-core.c, hppabsd-core.c, hpux-core.c: Likewise.
* irix-core.c, osf-core.c, ptrace-core.c, trad-core.c: Likewise.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
* libcoff.h: Rebuilt.
* nlm32-sparc.c (nlm_sparc_read_reloc): Remove unused variables
temp and name.
1994-03-30 22:15:07 +00:00
Jeff Law
250578363e
* libbfd.c (bfd_read): Set bfd_error as appropriate for a short
...
read. (bfd_error_system_call or bfd_error_file_truncated).
* som.c: Do not blindly set bfd_error_system_call after a
failing bfd_read, bfd_write, or bfd_seek. In a few places
(like som_object_p) override the error status set by bfd_read.
* aix386-core.c, aout-encap,c archive.c, bout.c: Likewise.
* coff-rs6000.c, coffgen.c ecoff.c, elf.c: Likewise.
* elf32-hppa.c, elfcode.h, hp300hpux.c, i386lynx.c: Likewise.
* nlm32-alpha.c, nlm32-i386.c, nlm32-sparc.c: Likewise.
* som.c: Check return values from several bfd_{seek,read,write}
calls that we just assumed were not failing.
1994-03-26 18:28:29 +00:00
David MacKenzie
9783e04a64
Make all callers of malloc or realloc (including via obstacks)
...
check the result for NULL. Most set bfd_error to no_memory and
return in that case; a few are harder to fix, and are marked
with "FIXME <return type>".
* elf32-hppa.c (hppa_elf_build_arg_reloc_stub
hppa_elf_build_long_branch_stub): Check bfd_make_empty_symbol return.
* linker.c (_bfd_generic_link_output_symbols
_bfd_generic_link_write_global_symbol): Ditto
* section.c (bfd_make_section_anyway): Ditto.
* tekhex.c (find_chunk tekhex_mkobject): Check bfd_alloc.
(first_phase): Ditto. FIXME void
(tekhex_make_empty_symbol): Check bfd_zalloc.
* sunos.c (sunos_read_dynamic_info): Check bfd_zalloc.
(MY(read_dynamic_symbols) MY(read_dynamic_relocs)): Check bfd_alloc.
* stringhash.c (_bfd_stringtab_hash_newfunc): Check bfd_hash_allocate.
* srec.c: Indent.
(fillup_symbols): Check bfd_alloc. FIXME void
(srec_mkobject srec_get_section_contents
srec_set_section_contents): Check bfd_alloc.
(srec_make_empty_symbol): Check bfd_zalloc.
* som.c (hppa_som_gen_reloc_type): Check bfd_alloc_by_size_t.
(make_unique_section): Check bfd_alloc.
(som_new_section_hook): Check bfd_zalloc.
(bfd_som_attach_aux_hdr): Ditto. FIXME void
* rs6000-core.c (rs6000coff_core_p): Check bfd_zalloc.
* osf-core.c (osf_core_make_empty_symbol): Check bfd_zalloc.
(osf_core_core_file_p): Check bfd_alloc.
* oasys.c (oasys_slurp_symbol_table oasys_archive_p
oasys_mkobject oasys_object_p oasys_new_section_hook
oasys_set_section_contents): Check bfd_alloc.
(oasys_slurp_section_data): Check bfd_zalloc and bfd_alloc.
(oasys_make_empty_symbol): Check bfd_zalloc.
* nlmcode.h (nlm_make_empty_symbol): Check bfd_zalloc.
(nlm_slurp_symbol_table): Check bfd_zalloc and bfd_alloc.
* nlm32-sparc.c (nlm_sparc_read_import): Check bfd_alloc.
* nlm32-i386.c (nlm_i386_read_import): Check bfd_alloc.
* nlm32-alpha.c (nlm_alpha_read_import): Check bfd_alloc.
* linker.c (_bfd_link_hash_newfunc
(generic_link_hash_newfunc
(archive_hash_newfunc
(_bfd_generic_link_add_one_symbol): Check bfd_hash_allocate.
(_bfd_generic_final_link
(_bfd_generic_link_output_symbols
(default_indirect_link_order): Check bfd_alloc.
(bfd_new_link_order): Check bfd_alloc_by_size_t.
* irix-core.c (irix_core_make_empty_symbol): Check bfd_zalloc.
* ieee.c: Indent.
(read_id get_symbol get_section_entry ieee_archive_p ieee_object_p
ieee_slurp_section_data ieee_new_section_hook): Check bfd_alloc.
(do_one): Check bfd_alloc. Return a boolean.
(ieee_slurp_section_data): Check it.
(init_for_output): Check bfd_alloc. Return a boolean.
(ieee_set_section_contents): Check it.
(do_with_relocs): Check bfd_alloc. Return a boolean.
(ieee_bfd_debug_info_accumulate): Ditto. FIXME void.
(ieee_mkobject): Check bfd_zalloc.
(ieee_make_empty_symbol): Check bfd_zmalloc.
* hpux-core.c (hpux_core_make_empty_symbol): Check
bfd_zalloc.
* hppabsd-core.c (hppabsd_core_make_empty_symbol): Check
bfd_zalloc.
(hppabsd_core_core_file_p): Check bfd_zalloc.
* hp300hpux.c (MY(slurp_symbol_table)): Check bfd_alloc.
* elfcode.h (elf_new_section_hook): Check bfd_alloc.
(bfd_section_from_phdr): Ditto.
(write_relocs): Ditto. FIXME void
(elf_map_symbols assign_section_numbers map_program_segments):
Ditto. Return a boolean.
(swap_out_syms): Ditto. Check elf_map_symbols.
(elf_slurp_symbol_table): Check bfd_zalloc.
(elf_slurp_reloca_table): Check bfd_alloc.
(elf_slurp_reloc_table): Ditto.
(elf_compute_section_file_positions): Check assign_section_numbers.
(assign_file_positions_except_relocs): Return a boolean.
Check map_program_segments.
(elf_compute_section_file_positions): Check it.
* elf32-mips.c (mips_elf_final_link): Check bfd_alloc.
* elf32-hppa.c (hppa_elf_stub_branch_reloc): Check bfd_zmalloc and
realloc.
(hppa_elf_stub_reloc): Ditto.
(hppa_elf_build_arg_reloc_stub): Check bfd_zalloc.
(hppa_elf_build_long_branch_stub): Ditto.
(elf32_hppa_backend_symbol_table_processing): Ditto.
* ecoff.c (ecoff_set_symbol_info): Check bfd_alloc. Return a boolean.
(ecoff_slurp_symbol_table): Check it.
(ecoff_slurp_armap): Check bfd_alloc.
(ecoff_write_armap): Check bfd_zalloc.
(ecoff_link_hash_newfunc): Check bfd_hash_allocate and
_bfd_link_hash_newfunc.
(ecoff_link_add_externals): Check bfd_alloc.
* ctor.c (bfd_constructor_entry): Check bfd_alloc.
* coffgen.c (coff_real_object_p): Check bfd_alloc.
(coff_renumber_symbols): Check bfd_alloc_by_size_t. Return a boolean.
(coff_write_symbol): Check bfd_alloc. FIXME int
(coff_write_linenumbers): Check bfd_alloc. Return a boolean.
(coff_section_symbol): Check bfd_alloc_by_size_t.
(coff_get_normalized_symtab): Check bfd_alloc.
(coff_bfd_make_debug_symbol): Check bfd_zalloc.
* libcoff-in.h: Change decls of coff_renumber_symbols,
coff_write_linenumbers.
* libcoff.h: Rebuilt.
* coffcode.h (coff_write_object_contents): Check
coff_renumber_symbols, coff_write_linenumbers.
* coffcode.h: Indent.
(coff_add_missing_symbols): Check bfd_alloc_by_size_t. Return a
boolean.
(coff_write_object_contents): Check it.
* coff-alpha.c (alpha_relocate_section): Check bfd_alloc.
* coff-mips.c (mips_relocate_section): Ditto.
* archive.c (bfd_slurp_bsd_armap_f2): Check bfd_alloc value.
(do_slurp_bsd_armap): Ditto.
(compute_and_write_armap): Check bfd_realloc value.
* aoutx.h (translate_from_native_sym_flags): Check bfd_alloc
return value. Return boolean value.
(NAME(aout,make_empty_symbol)): Check bfd_zalloc return value.
(NAME(aout,slurp_symbol_table)): Check bf_alloc and bfd_zalloc
return value.
(add_to_stringtab): Ditto. FIXME void
(aout_link_hash_newfunc): Check bfd_hash_allocate return value.
(aout_link_add_symbols): Check bfd_alloc value.
(translate_symbol_table): Check translate_from_native_sym_flags.
* hp300hpux.c (MY(slurp_symbol_table)): Ditto.
* aoutx.h (aout_link_hash_newfunc): Check _bfd_link_hash_newfunc.
* opncls.c (bfd_zalloc bfd_realloc): Check result of bfd_alloc.
* opncls.c (obstack_chunk_alloc): Define as malloc, not
bfd_xmalloc_by_size_t.
(_bfd_new_bfd): Check obstack_begin for 0 return.
* ieee.c (obstack_chunk_alloc): Define as malloc, not
bfd_xmalloc_by_size_t.
(ieee_archive_p): Check obstack_begin for 0 return and
obstack_finish for NULL return.
* hash.c (obstack_chunk_alloc): Define as malloc, not
bfd_xmalloc_by_size_t.
(bfd_hash_table_init_n): Check obstack_begin for 0 return and
obstack_finish for NULL return.
(bfd_hash_lookup): Check obstack_alloc for NULL return.
* ecofflink.c (obstack_chunk_alloc): Define as malloc, not
bfd_xmalloc_by_size_t.
bfd_ecoff_debug_accumulate
bfd_ecoff_debug_accumulate_other): Check obstack_alloc.
(add_file_shuffle add_memory_shuffle): Check obstack_alloc for
NULL return. Return boolean, not void.
(bfd_ecoff_debug_init): Check obstack_begin for 0 return.
(bfd_ecoff_debug_accumulate): Check add_file_shuffle
and add_memory_shuffle return.
(string_hash_newfunc): Check bfd_hash_allocate and bfd_hash_newfunc.
(bfd_ecoff_debug_accumulate): Check bfd_alloc.
(ecoff_add_string): Check add_memory_shuffle return.
* libbfd-in.h (xmalloc, bfd_xmalloc, bfd_xmalloc_by_size_t):
Remove decls.
* libbfd.h: Rebuilt.
1994-02-12 00:45:54 +00:00
Ian Lance Taylor
ebd2413529
* aoutx.h (translate_from_native_sym_flags): Removed statep
...
argument. Just let an indirect symbol point to the next symbol
without forcing the next symbol to be undefined. Changed all
callers.
* hp300hpux.c (slurp_symbol_table): Changed call to
translate_from_native_sym_flags.
* targets.c: Added hp300hpux_vec.
* Makefile.in (hp300hpux.o): Added dependencies.
1993-07-07 18:05:06 +00:00
John Gilmore
34dd8ba311
Eliminate "int8_type", "int16_type", "int32_type", and their
...
variants from the BFD universe. Leave the 64-bit types for now,
since they are in flux.
* aoutx.h, hp300hpux.c: Eliminate needless (int32_type) casts.
* libaout.h (GET_SWORD): Convert (int32_type) to (int).
* ieee.c: Convert uint8e_type => unsigned char.
* oasys.c: Extensive changes to eliminate obsolete types.
These depend on changes in ../include/oasys.h as well.
1993-06-18 10:26:55 +00:00
Ken Raeburn
bafe0602a0
checkpoint hp300hpux code from HP; needs cleanup before using
1993-04-28 22:56:31 +00:00