aboutsummaryrefslogtreecommitdiff
path: root/bfd/coffgen.c
AgeCommit message (Collapse)AuthorFilesLines
1994-09-06 Add new style linker support to COFF backend. a29k only for now.Ian Lance Taylor1-43/+59
* cofflink.c: New file. * libcoff-in.h: Include bfdlink.h. (obj_coff_external_syms, obj_coff_strings): Define accessor macro. (obj_coff_sym_hashes): Define accessor macro. (struct coff_tdata): Add fields external_syms, strings, and sym_hashes. (struct coff_link_hash_entry): Define. (struct coff_link_hash_table): Define. (coff_link_hash_lookup, coff_link_hash_traverse): Define. (coff_hash_table): Define. (_bfd_coff_link_hash_table_create): Declare. (_bfd_coff_link_add_symbols, _bfd_coff_final_link): Declare. * coffcode.h (bfd_coff_backend_data): Add fields _bfd_relsz, _bfd_coff_swap_reloc_in, _bfd_coff_sym_is_global, _bfd_coff_compute_section_file_positions, _bfd_coff_relocate_section. (bfd_coff_relsz, bfd_coff_swap_reloc_in): Define. (bfd_coff_sym_is_global): Define. (bfd_coff_compute_section_file_positions): Define. (bfd_coff_relocate_section): Define. (coff_mkobject_hook): Initialize obj_raw_syment_count and obj_conv_table_size. (coff_compute_section_file_positions): Set target_index of all sections. Set output_has_begun field. (coff_write_object_contents): Don't set target_index; now done by coff_compute_section_file_positions. Remove obsolete handling of scn_base and data_base. Don't bother to check that target_index is positive, since it always is. Remove use of pad, which is always zero. Check obj_raw_syment_count, not bfd_get_symcount, for the number of symbols, but only write them out if bfd_get_symcount is non-zero. (coff_slurp_symbol_table): Use obj_raw_syment_count, not bfd_get_symcount for the number of symbols. Don't set obj_conv_table_size. (coff_sym_is_global): New static function or macro. (coff_slurp_reloc_table): Call coff_swap_reloc_in, not bfd_swap_reloc_in. (coff_bfd_link_hash_table_create): If coff_relocate_section is defined, define as _bfd_coff_link_hash_table_create. (coff_bfd_link_add_symbols): Similar change. (coff_bfd_final_link): Similar change. (coff_relocate_section): Define as NULL if not defined. (bfd_coff_std_swap_table): Initialize new fields. * coffgen.c (coff_real_object_p): Don't set obj_raw_syment_count and obj_conv_table_size here. (coff_count_linenumbers): Reindent. If bfd_get_symcount is zero, add up the line numbers from the sections. (coff_write_symbols): Don't set bfd_get_symcount. (coff_pointerize_aux): Don't pointerize a nonpositive x_endndx field. (coff_get_normalized_symtab): Use obj_raw_syment_count, not bfd_get_symcount. (coff_print_symbol): If auxp->fix_end, print x_endndx value. * coffswap.h (coff_swap_reloc_in): Rename from bfd_swap_reloc_in. Reindent. Change argument type to PTR. * coff-a29k.c (coff_a29k_relocate_section): New static function. (coff_relocate_section): Define. * configure.in (a29kcoff_big_vec): Compile cofflink.o. * coff-alpha.c (alpha_ecoff_backend_data): Initialize new fields. * coff-mips.c (mips_ecoff_backend_data): Likewise. * libcoff.h: Rebuilt. * Makefile.in: Rebuilt dependencies. (BFD32_BACKENDS): Add cofflink.o. (CFILES): Add cofflink.c.
1994-09-06* coffgen.c (coff_print_symbol, case bfd_symbol_print_all): Check for sectionKen Raeburn1-1/+13
symbol, and print its aux fields with appropriate labels.
1994-08-26 * coffgen.c (coff_real_object_p): Set obj_raw_syment_count.Ian Lance Taylor1-2/+5
(coff_get_normalized_symtab): Verify obj_raw_syment_count, rather than setting it.
1994-08-25 * coffgen.c (coff_find_nearest_line): Look for the best C_FILE,Ian Lance Taylor1-19/+29
not merely the first.
1994-08-25 * coffgen.c (coff_write_alien_symbol): If we are not using theIan Lance Taylor1-1/+3
symbol, clear the name so that it is not put in the string table. From Antti.Miettinen@ntc.nokia.com.
1994-08-24 * coffgen.c (coff_print_symbol): Cast pointer different to longIan Lance Taylor1-1/+1
and use %ld to print it. * osf-core.c (osf_core_core_file_p): Remove unused variable dseccnt. * ecoffswap.h (ecoff_swap_ext_out): If ECOFF_64, clear remaining bytes in bits2.
1994-08-24 * coffgen.c (coff_real_object_p): Set obj_conv_table_size here,Ian Lance Taylor1-13/+58
rather than waiting until coff_slurp_symbol_table. (coff_write_alien_symbol): Just ignore BSF_DEBUGGING symbols. From Antti.Miettinen@ntc.nokia.com.
1994-08-15 * coffgen.c (STRING_SIZE_SIZE): Define.Ian Lance Taylor1-14/+34
(coff_fix_symbol_name): Use STRING_SIZE_SIZE, not 4. (coff_write_symbols, build_string_table): Likewise. (coff_get_normalized_symtab): Likewise.
1994-08-15 * coffcode.h (styp_to_sec_flags): Add name argument. If no flagsIan Lance Taylor1-11/+11
are recognized, chose section flags based on the name. (bfd_coff_backend_data): _bfd_styp_to_sec_flags_hook field: Add name argument. (bfd_coff_styp_to_sec_flags_hook): Add name argument. (coff_compute_section_file_positions): Don't adjust the section position by COFF_PAGE_SIZE unless SEC_ALLOC is set. * libcoff.h: Rebuilt. * coffgen.c (make_a_section_from_file): Pass section name to bfd_coff_styp_to_sec_flags_hook. * ecoff.c (_bfd_ecoff_styp_to_sec_flags): Add unused name argument. * libecoff.h (_bfd_ecoff_styp_to_sec_flags): Add name argument to prototype.
1994-06-20 * Many files: change all bfd_target vectors to be const. ChangeIan Lance Taylor1-4/+6
all uses of bfd_target * to be const bfd_target *. Change bfd_target_vector and bfd_default_vector arrays to be const bfd_target * const *.
1994-05-10 * section.c (SEC_COFF_SHARED_LIBRARY): Renamed fromIan Lance Taylor1-13/+21
SEC_SHARED_LIBRARY for clarity. Changed all uses. * bfd-in2.h: Rebuilt. * coffcode.h (sec_to_styp_flags): If SEC_COFF_SHARED_LIBRARY is set, set STYP_NOLOAD. * coffgen.c (coff_section_from_bfd_index): Don't get an assertion failure because of a bad shared library.
1994-03-31 * coffgen.c (coff_write_symbol): Reindented. Changed to returnIan Lance Taylor1-171/+228
boolean, and changed written to unsigned int *. Check error returns from called functions. (coff_write_alien_symbol): Likewise. (coff_write_native_symbol): Likewise. (coff_write_symbols): Likewise. Reworked checks on whether to write symbol name to string table for clarity and to avoid core dumping when given a non COFF symbol. * libcoff-in.h (coff_write_symbols): Declare as returning boolean. * libcoff.h: Rebuilt. * coffcode.h (coff_write_object_contents): Check return value of coff_write_symbols.
1994-03-30Wed Mar 30 16:25:41 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)Ian Lance Taylor1-6/+6
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-26 * libbfd.c (bfd_read): Set bfd_error as appropriate for a shortJeff Law1-105/+94
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-02-17 * bfd.c (bfd_get_error, bfd_set_error): New functions.David MacKenzie1-26/+26
(bfd_error): Make static. (bfd_error_type): Renamed from bfd_ec. Prepend "bfd_error_" to all values. * bfd-in2.h: Regenerated. * aix386-core.c, aout-adobe.c, aout-encap.c, aout-target.h, aoutf1.h, aoutx.h, archive.c, archures.c, bfd.c, bout.c, cache.c, coff-alpha.c, coff-mips.c, coff-rs6000.c, coffcode.h, coffgen.c, core.c, ctor.c, ecoff.c, ecofflink.c, elf.c, elf32-hppa.c, elf32-mips.c, elfcode.h, format.c, hash.c, hp300hpux.c, hppabsd-core.c, i386lynx.c, ieee.c, libbfd.c, libelf.h, linker.c, lynx-core.c, nlm.c, nlm32-alpha.c, nlm32-i386.c, nlm32-sparc.c, nlmcode.h, oasys.c, opncls.c, osf-core.c, ptrace-core.c, reloc16.c, rs6000-core.c, section.c, som.c, srec.c, sunos.c, syms.c, targets.c, tekhex.c, trad-core.c: Change callers.
1994-02-12 Make all callers of malloc or realloc (including via obstacks)David MacKenzie1-32/+143
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-01 * coffcode.h (bfd_coff_backend_data): Added new arguments toIan Lance Taylor1-0/+7
_bfd_coff_swap_aux_in and _bfd_coff_swap_aux_out: aux index number and number of aux entries. (bfd_coff_swap_aux_in, bfd_coff_swap_aux_out): Changed accordingly. * libcoff.h: Rebuilt. * coffswap.h (coff_swap_aux_in, coff_swap_aux_out): Accept new arguments. If RS6000COFF_C, only treat C_EXT and C_HIDEXT specially if this is the last aux entry. * coffgen.c (coff_write_symbol, coff_get_normalized_symtab): Pass new arguments to swap_aux functions.
1993-12-30 Extensive changes to move the bulk of the linker into BFD so thatIan Lance Taylor1-21/+23
more efficient backend code can be written for specific object files. Only existing efficient backend is a.out. * seclet.c, seclet.h: Removed. * hash.c, linker.c, genlink.h: New files. * bfd-in.h: Removed bfd_error_vector. Declared hash table structures and functions. (JUMP_TABLE): Removed bfd_seclet_link, added bfd_link_hash_table_create, bfd_link_add_symbols and bfd_final_link. * All backends: Changed accordingly. * bfd-in2.h: Rebuilt. * bfd.c (struct _bfd): Added link_next and archive_pass fields. Removed ld_symbols field. (bfd_nonrepresentable_section, bfd_undefined_symbol, bfd_reloc_value_truncated, bfd_reloc_is_dangerous, bfd_error_vector): Removed. (bfd_default_error_trap, bfd_error_trap, bfd_error_nonrepresentabltrap): Removed. (bfd_get_relocated_section_contents): Pass link_info. Pass link_order instead of seclet. Pass symbols. (bfd_relax_section): Pass link_info. (bfd_seclet_link): Removed. (bfd_link_hash_table_create, bfd_link_add_symbols, bfd_final_link): New macros. * libbfd-in.h: If __GNUC__ is defined and alloca is not, define alloca as __builtin_alloca. Declare internal linking functions. * libbfd.h: Rebuilt. * libbfd.c (bfd_seek): Comment out fseek assertion. It's worked for months. * reloc.c (reloc_howto_type): Added error_message argument to special_function field. Changed all callers and all definitions. (bfd_get_reloc_size): Make argument a const pointer. (bfd_perform_relocation): Add error_message argument to hold string set if return value if bfd_reloc_dangerous. Changed all callers. (_bfd_final_link_relocate, _bfd_relocate_contents): New functions. * section.c (asection): Renamed seclets_head and seclets_tail to link_order_head and link_order_tail. * targets.c (bfd_target): Replaced seclet argument with link_info and link_order and symbols arguments in bfd_get_relocated_section_contents. Added symbols argument to bfd_relax_section. Removed bfd_seclet_link. Added bfd_link_hash_table_create, bfd_link_add_symbols and bfd_final_link. * libaout.h (struct aoutdata): Added external_syms, external_sym_count, external_strings, sym_hashes fields. (obj_aout_external_syms, obj_aout_external_sym_count, obj_aout_external_strings, obj_aout_sym_hashes): New accessor macros. (WRITE_HEADERS): Only output symbols if outsymbols is not NULL. * aoutx.h: Wrote new back end linker routines. (translate_to_native_sym_flags): Return boolean value. Don't use bfd_error_vector. (NAME(aout,write_syms)): Return boolean value. Check return value of translate_to_native_sym_flags and bfd_write. * aout-target.h (final_link_callback): New function. (MY_bfd_final_link): New function. * aout-adobe.c (aout_adobe_write_object_contents): Check return value of aout_32_write_syms. * hp300hpux.c (MY(write_object_contents)): Likewise. * i386lynx.c (WRITE_HEADERS): Likewise. * libaout.h (WRITE_HEADERS): Likewise. * bout.c: Changed functions to use link_info->callbacks rather than bfd_error_vector, and link_orders rather than seclets. * coff-alpha.c: Likewise. * coff-h8300.c: Likewise. * coff-h8500.c: Likewise. * coff-sh.c: Likewise. * coff-z8k.c: Likewise. * elf32-hppa.c: Likewise. * reloc16.c: Likewise. * coff-alpha.c (alpha_ecoff_get_relocated_section_contents): Look up _gp in the hash table rather than in outsymbols. * coff-a29k.c (a29k_reloc): Pass errors back in new error_message argument rather than printing them. * coffcode.h (bfd_coff_reloc16_extra_cases): Take link_info and link_order arguments rather than seclet. Changed all uses and definitions. (bfd_coff_reloc16_estimate): Pass link_info arguments. Changed all uses and definitions. * libcoff.h: Rebuilt. * ecoff.c (ecoff_get_extr): If symbol is defined by linker, but not by ECOFF, make it scAbs. (ecoff_bfd_final_link): Renamed from ecoff_bfd_seclet_link and rewritten. * elf32-mips.c (mips_elf_final_link): Renamed from mips_elf_seclet_link and rewritten. * elf32-hppa.c (elf32_hppa_stub_description): Added link_info field. (new_stub, add_stub_by_name, hppa_elf_build_arg_reloc_stub, hppa_elf_build_long_branch_stub, hppa_look_for_stubs_in_section): Added link_info arguments. Changed all callers. * elfcode.h (elf_slurp_symbol_table): Don't quit if outsymbols is not NULL. * oasys.c (oasys_write_sections): Return boolean value rather than using bfd_error_vector. (oasys_write_object_contents): Check return value of oasys_write_sections. * hosts/std-host.h: Don't declare qsort or strtol. * Makefile.in: Rebuild dependencies. (BFD_LIBS): Removed seclet.o. Added hash.o and linker.o. (CFILES): Removed seclet.c. Added hash.c and linker.c. (HFILES): Removed seclet.h. Added genlink.h.
1993-08-04 * coff-h8500.c (rtype2howto): Do an fprintf to stderr rather thanIan Lance Taylor1-7/+7
using printf. * coff-z8k.c (rtype2howto): Likewise. * coffcode.h (dummy_reloc16_extra_cases): Likewise. * elf32-i386.c (TRACE): Likewise. * hp300hpux.c (convert_sym_type, swap_std_reloc_in): Likewise. * rs6000-core.c (rs6000coff_get_section_contents): Likewise. * coffgen.c (coff_print_symbol): Do an fprintf to the file argument rather than using printf.
1993-06-04Patch from minyard@bnr.ca: For empty symbol table, write out number "4" inKen Raeburn1-19/+25
correct byte order.
1993-02-23 * libcoff.h (obj_raw_syment_coun): New macro.Per Bothner1-8/+12
* coffgen.c (coff_get_normalized_symtab): Initialize raw_syment_count. * coffgen.c (coff_find_nearest_line): Numerous little fixes.
1993-02-12Fri Feb 12 14:23:07 1993 Ian Lance Taylor (ian@cygnus.com)Ian Lance Taylor1-94/+87
* coffgen.c (coff_print_symbol): Print correct tagndx value; cleaned up output formatting a bit.
1993-01-25Mon Jan 25 15:27:36 1993 Ian Lance Taylor (ian@cygnus.com)Ian Lance Taylor1-24/+36
* coffcode.h (_bfd_coff_mkobject_hook): Pass aouthdr argument. (coff_mkobject_hook): Accept aouthdr argument. * coffgen.c (coff_real_object_p): Pass aouthdr to mkobject_hook. Handle NULL aouthdr argument. (coff_object_p): If there is no aouthdr, pass it as NULL to coff_real_object_p. * libcoff.h: Rebuilt for mkobject_hook changes.
1993-01-10 * coffgen.c: #include seclet.h.Stu Grossman1-0/+1
1993-01-08These changes cut the size of libbfd.a on a Sun4 by about 11%.Ian Lance Taylor1-0/+1501
Somewhat more could be done. Fri Jan 8 15:47:53 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) * coffcode.h: Moved many generic functions into coffgen.c. Moved swapping functions into coffswap.h for ECOFF use. Moved relocation functions, only used by h8300 and z8k, into reloc16.c. Added hooks for coffgen.c functions to backend data structure, and added hook functions. Still more could be done. * coffswap.h: New file to hold COFF swapping routines. * coffgen.c: New file to hold generic COFF functions. * reloc16.c: New file to hold h8300 and z8k specific relocation functions. * libcoff-in.h: Added declarations for functions in coffgen.c. * libcoff.h: Rebuilt to incorporate changes. * coff-h8300.c: Function name changes. * coff-z8k.c: Function name changes. Use coff_reloc16_extra_cases hook rather than defining EXTRA_CASES. * Makefile.in: Build new files coffgen and reloc16. Added dependencies of coff-*.o on coffswap.h and seclet.h.