aboutsummaryrefslogtreecommitdiff
path: root/bfd/aoutx.h
AgeCommit message (Collapse)AuthorFilesLines
1995-02-06 Distinguish a weak defined symbol from a regular defined symbol.Ian Lance Taylor1-41/+55
* linker.c (enum link_action): Add DEFW. (link_action): Add bfd_link_hash_defweak column. (_bfd_generic_link_add_one_symbol): Add DEFW case. Handle bfd_link_hash_defweak in a few other cases. * Many files (bfd_link_hash_undefweak): Renamed from bfd_link_hash_weak. * aoutx.h (aout_link_write_symbols): Handle bfd_link_hash_defweak. (aout_link_write_other_symbol): Likewise. (aout_link_input_section_std): Likewise. (aout_link_input_section_ext): Likewise. * bout.c (get_value): Likewise. * coff-a29k.c (coff_a29k_relocate_section): Likewise. * coff-alpha.c (alpha_convert_external_reloc): Likewise. (alpha_relocate_section): Likewise. * coff-mips.c (mips_relocate_section): Likewise. (mips_relax_section): Likewise. (bfd_mips_ecoff_create_embedded_relocs): Likewise. * cofflink.c (coff_write_global_sym): Likewise. (_bfd_coff_generic_relocate_section): Likewise. * ecoff.c (ecoff_link_add_externals): Likewise. (ecoff_link_write_external): LIkewise. * elf32-hppa.c (elf32_hppa_relocate_section): Likewise. (elf32_hppa_size_stubs): Likewise. * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. * elf32-mips.c (mips_elf_output_extsym): Likewise. (mips_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_adjust_dynamic_symbol): Likewise. (elf32_sparc_relocate_section): Likewise. * elfcode.h (elf_link_add_object_symbols): Likewise. (elf_adjust_dynamic_symbol): Likewise. (elf_bfd_final_link): Likewise. (elf_link_output_extsym): Likewise. * i386linux.c (linux_add_one_symbol): Likewise. (linux_tally_symbols): Likewise. (linux_finish_dynamic_link): Likewise. * linker.c (_bfd_generic_link_output_symbols): Likewise. (set_symbol_from_hash): Likewise. * reloc16.c (bfd_coff_reloc16_get_value): Likewise. (bfd_perform_slip): Likewise. * sunos.c (sunos_add_one_symbol): Likewise. (sunos_scan_std_relocs): Likewise. (sunos_scan_ext_relocs): Likewise. (sunos_scan_dynamic_symbol): Likewise. (sunos_write_dynamic_symbol): Likewise.
1995-01-24update copyright datesIan Lance Taylor1-4/+4
1995-01-12Change "reloc_howto_type" typedef to be "const", since all uses of it are (orKen Raeburn1-2/+29
should be) anyways.
1994-10-26 * aoutx.h (aout_link_input_section): Don't bother to read or writeIan Lance Taylor1-4/+7
the relocs if there aren't any.
1994-10-19 * aoutx.h (NAME(aout,slurp_symbol_table)): Don't return an errorIan Lance Taylor1-32/+86
if there are no symbols. * coffgen.c (coff_get_normalized_symtab): Likewise. * hp300hpux.c (MY(slurp_symbol_table)): Likewise.
1994-09-14 * aoutx.h (aout_link_write_symbols): Rename skip_indirect toIan Lance Taylor1-7/+8
skip_next. If we find an N_WARNING symbol which has already been written out, set skip_next. PR 5634.
1994-09-13 * aoutx.h (NAME(aout,final_link)): Don't assume that all the inputIan Lance Taylor1-18/+25
files are a.out.
1994-08-25 * aoutx.h (add_to_stringtab): Check for _bfd_stringtab_add errorIan Lance Taylor1-3/+11
before adding BYTES_IN_WORD.
1994-08-24 * aoutx.h (translate_to_native_sym_flags): Use the output_sectionIan Lance Taylor1-290/+192
(and output_offset) if there is one. * aoutx.h (aout_link_check_archive_element): Discard the symbols if the archive element was not needed. * aoutx.h (aout_get_external_symbols): Ensure that a zero string index yields an empty string. (aout_link_write_symbols): If info->keep_memory is false, use name from original hash table entry, not from entry in *sym_hash. * aoutx.h (struct aout_final_link_info): Add fields contents, relocs, symbol_map and output_syms. (NAME(aout,final_link)): Work out the largest section size, reloc size, and number of symbols. Use them to preallocate buffers that are large enough for all cases. (aout_link_input_bfd): Use preallocated symbol_map. (aout_link_write_symbols): Remove symbol_map argument; use preallocated symbol_map instead. Change all callers. Use preallocated output_syms. (aout_link_input_section): Remove symbol_map argument. Change all callers. Use preallocated contents and relocs. (aout_link_input_section_std): Remove symbol_map argument; use preallocated symbol_map instead. Change all callers. (aout_link_input_section_ext): Likewise.
1994-08-18 Get ld -x -r to handle a.out set symbols correctly.Ian Lance Taylor1-5/+51
* aoutx.h (adjust_o_magic): If the .bss VMA was set outside of BFD, pad the .data section up to the VMA of the .bss section. (aout_link_add_symbols): If a set symbol does not get modified, treat it as a local symbol. (aout_link_write_symbols): Set the value of set symbols correctly. Don't discard set symbols even if discarding local symbols. (aout_link_write_other_symbol): Don't abort on bfd_link_hash_new, since it can now happen for set symbols.
1994-08-10 * aoutx.h (adjust_z_magic): Make sure data section is padded toIan Lance Taylor1-11/+53
page boundary when the VMA is set by the calling program. From Eric Youngdale <ericy@cais.cais.com>.
1994-07-22 * aoutx.h (NAME(aout,some_aout_object_p)): Just checkIan Lance Taylor1-3/+3
STAT_FOR_EXEC, don't check MACH. * m88kmach3.c (MACH): Don't define. * config/i386-mach3.mt (TDEFINES): Define STAT_FOR_EXEC. * config/m88k-mach3.mt (TDEFINES): Likewise. * config/mips-mach3.mt (TDEFINES): Likewise.
1994-07-21 * reloc.c (struct reloc_howto_struct): Remove special_function1.Ian Lance Taylor1-19/+56
It's the wrong way to do things. (HOWTO): Change accordingly. (HOWTO2): Remove. (_bfd_final_link_relocate): Remove references to special_function1. * bfd-in2.h: Rebuilt. * aoutx.h (aout_link_input_section_std): Remove references to special_function1. (aout_link_reloc_link_order): Likewise.
1994-07-12 * aout-encap.c (ARCH): Don't define. Obsolete.Ian Lance Taylor1-1/+0
* aout0.c, aoutx.h, gen-aout.c, hp300bsd.c, hp300hpux.c: Likewise. * i386aout.c, i386bsd.c, i386dynix.c, i386linux.c: Likewise. * i386lynx.c, m68klynx.c, mipsbsd.c, netbsd386.c: Likewise. * newsos3.c, sparclynx.c, sunos.c: Likewise.
1994-07-10Sun Jul 10 09:12:02 1994 D. V. Henkel-Wallace (gumby@cygnus.com)David Henkel-Wallace1-7/+7
* aoutx.h (bfd_free_cached_info): Change name of FREE to BFCI_FREE in order not to collide with LynxOS's definition of FREE in /usr/include/sys/proc.h
1994-07-05 Mach 3 support.Stan Shebs1-5/+16
* config.bfd (m88*-*-mach3*, mips*-dec-mach3*, mips*-*-mach3*): New targets. * configure.host (i[34]86-*-mach3*, ns32k-*-mach3*): Recognize "mach3" instead of "mach". (m88*-*-mach3*, mips*-dec-mach3*, mips*-*-mach3*): New hosts. * targets.c (m88kmach3_vec): New target vector. (bfd_target_vector): Add i386mach3_vec and m88kmach3_vec, but inside #if 0. * aoutx.h (some_aout_object_p) [MACH]: Recognize executables by checking for execute permission, instead of looking at entry point. * i386mach3.c: Update, define MACH, N_TXTOFF, N_TXTADDR, N_SHARED_LIB, don't include aout/*.h files, etc. * m88kmach3.c: New file, m88k Mach 3 target. * config/m88k-mach3.mt, config/mips-mach3.mt: New files, target makefile fragments. * config/i386mach3.mh, config/m88kmach3.mh, config/mipsmach3.mh: New files, host makefile fragments. * hosts/m88kmach3.h, hosts/mipsmach3.h: New files, host definitions.
1994-06-22 Linux ZMAGIC support from Eric Youngdale <ericy@cais.cais.com>.Ian Lance Taylor1-4/+18
* libaout.h (struct aoutdata): Add field zmagic_disk_block_size. * aout-target.h (MY(callback)): Only set alignment according to architecture if the section sizes are aligned to that alignment, for backward compatibility. (MY(set_sizes)): Initialize zmagic_disk_block_size field. * aoutx.h (adjust_z_magic): Set ztih if using q_magic_format. Set text section filepos to zmagic_disk_block_size if not ztih. Use a different padding algorithm if not ztih. * i386linux.c (MY_text_includes_header): Don't define.
1994-06-22 * aoutx.h (aout_link_check_ar_symbols): Just skip N_STAB and N_FNIan Lance Taylor1-36/+38
symbols; don't look them up in the hash table. From ralphc@pyramid.com (Ralph Campbell).
1994-06-20 * Many files: change all bfd_target vectors to be const. ChangeIan Lance Taylor1-5/+5
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-06-20 * aoutx.h (NAME(aout,final_link)): Check flavour of sub, not abfd,Ian Lance Taylor1-1/+1
when computing reloc sizes. From Eric Youngdale <ericy@cais.cais.com>. * elfcode.h (elf_bfd_final_link): Don't try to compute maximum reloc count or size for a non-ELF file.
1994-06-16 * aoutx.h (NAME(aout,some_aout_object_p)): Accept BMAGIC objectsIan Lance Taylor1-1/+2
and treat them as OMAGIC.
1994-06-15 * aoutx.h (translate_from_native_sym_flags): Treat N_SETV symbolsIan Lance Taylor1-0/+10
as N_DATA symbols. (aout_link_add_symbols): Likewise.
1994-06-15Comment change.Ian Lance Taylor1-2/+2
1994-06-15 * aoutx.h: Rewrite symbol duplicate elimination to use BFD hashIan Lance Taylor1-372/+190
tables. (struct stringtab_entry, struct stringtab_data): Remove. (HASHMAXLEN, HASH_CHAR, hash, compare, log2, emit_strtab): Remove. (struct strtab_hash_entry, struct strtab_hash): Define. (strtab_hash_newfunc, strtab_hash_lookup): Define. (stringtab_free, emit_stringtab): Define. (stringtab_init, add_to_stringtab): Rewrite. (NAME(aout,write_syms)): Use new stringtab code. (struct aout_final_link_info, NAME(aout,final_link)): Likewise. (aout_link_write_symbols, aout_link_write_other_symbol): Likewise.
1994-06-14 * libaout.h (struct aoutdata): Add q_magic_format to subformatIan Lance Taylor1-10/+31
enum. * aout-target.h (MY_bfd_copy_private_bfd_data): Define as function if not already defined. Copy subformat information. (MY_text_includes_header): Define as 0 if not already defined. (MY(backend_data)): Use MY_text_includes_header rather than 0. (MY_final_link_callback): Rename from final_link_callback, and define only if MY_final_link_callback is not already defined. (MY_bfd_final_link): Rename use of final_link_callback to MY_final_link_callback. * aoutx.h (NAME(aout,some_aout_object_p)): Handle QMAGIC like ZMAGIC, but set the subformat to q_magic_format. Abort if the magic number if not recognized. (adjust_z_magic): Use QMAGIC if q_magic_format. * i386linux.c (MY_text_includes_header): Define as 1. (i386linux_bfd_final_link): New static function. (MY_bfd_final_link): Define as i386linux_bfd_final_link. * aoutx.h (translate_to_native_sym_flags): Check both section and output_section against sections of abfd.
1994-06-13 * aoutf1.h (aout_32_sunos4_write_object_contents): Handle aIan Lance Taylor1-5/+16
machine type of 68000. * aoutx.h (NAME(aout,machine_type)): Add new argument unknown. Set *unknown to true if machine type is really unknown, as opposed to M_UNKNOWN for the 68000. (NAME(aout,set_arch_mach)): Change NAME(aout,machine_type) call accordingly. * libaout.h (NAME(aout,machine_type)): Add new argument to prototype.
1994-06-11 Add weak symbols as an extension to a.out.Ian Lance Taylor1-290/+359
* aoutx.h (sym_in_text_section): Don't define. (sym_in_data_section, sym_in_bss_section): Likewise. (sym_is_undefined, sym_is_global_defn): Likewise. (sym_is_debugger_info, sym_is_fortrancommon): Likewise. (sym_is_absolute, sym_is_indirect): Likewise. (translate_from_native_sym_flags): Rewrite for clarity. Rearrange arguments and change caller. Handle weak symbols. (translate_to_native_sym_flags): Likewise. (aout_link_check_ar_symbols): Don't ignore weak symbols. Pull object in from archive if a weak defintion is found for an existing undefined symbol. (aout_link_add_symbols): Put all cases in switch. Set flags of an undefined symbol to 0. Handle weak symbols. (aout_link_write_symbols): Handle weak symbols. (aout_link_write_other_symbol): Likewise. (aout_link_input_section_std): Likewise. (aout_link_input_section_ext): Likewise. * sunos.c (sunos_write_dynamic_symbol): Likewise.
1994-06-10 * aoutx.h (NAME(aout,canonicalize_reloc)): Handle .bss section.Ian Lance Taylor1-4/+14
(NAME(aout,get_reloc_upper_bound)): Likewise.
1994-06-06Comment change.Ian Lance Taylor1-1/+7
1994-06-06 Better indirect and warning symbol handling inspired by StuartIan Lance Taylor1-5/+2
Quick <stuck@cs.man.ac.uk>. * linker.c (enum link_action): Add REF, MIND, CWARN, REFC. (link_action): Change UNDEF_ROW/def and UNDEFW_ROW/def from NOACT to REF. Change UNDEF_ROW/indr and UNDEFW_ROW/indr from CYCLE to REFC. Change DEF_ROW/indr and COMMON_ROW/indr from CYCLE to MDEF. Change DEFW_ROW/indr from CYCLE to NOACT. Change INDR_ROW/indr from MDEF to MIND. Change INDR_ROW/warn from WARNC to CYCLE. Change WARN_ROW/def and WARN_ROW/indr from MWARN to CWARN. Change WARN_ROW/com from MWARN to WARN. Change WARN_ROW/warn from NOACT to CYCLE. Change SET_ROW/warn from WARNC to CYCLE> (_bfd_generic_link_add_one_symbol): Handle REF, MIND, CWARN and REFC. If a new indirect symbol has been referenced, push the reference down to the symbol it points to. FIx handling of WARN. * aoutx.h (translate_from_native_sym_flags): If N_WARNING, don't clobber e_type of next symbol. (translate_to_native_sym_flags): Likewise. (aout_link_write_symbols): Loop on bfd_link_hash_warning as well as bfd_link_hash_indirect.
1994-06-06 * libaout.h (struct aout_link_hash_entry): New field written.Ian Lance Taylor1-7/+10
* aoutx.h (NAME(aout,link_hash_newfunc)): Initialize written. (aout_link_write_symbols): Use written, not root.written. (aout_link_write_other_symbol): Likewise. * sunos.c (sunos_scan_dynamic_symbol): Likewise. * libecoff.h (struct ecoff_link_hash_entry): New field written. * ecoff.c (ecoff_link_hash_newfunc): Initialize written. (ecoff_link_write_external): use written, not root.written. * genlink.h (struct generic_link_hash_entry): New field written. * linker.c (_bfd_link_hash_newfunc): Don't initialize written. (generic_link_hash_newfunc): Initialize written. (_bfd_generic_link_output_symbols): Use written, not root.written. (_bfd_generic_link_write_global_symbol): Likewise. (_bfd_generic_reloc_link_order): Likewise.
1994-06-02 Add linker support for SunOS shared libraries.Ian Lance Taylor1-63/+123
* sunos.c: Include bfdlink.h. Add many new functions and definitions for SunOS shared library support. * bfd-in.h (bfd_sunos_record_link_assignment): Declare. (bfd_sunos_size_dynamic_sections): Declare. * bfd-in2.h: Rebuilt. * aoutx.h (struct aout_link_hash_entry): Move to libaout.h. (struct aout_link_hash_table): Likewise. (aout_link_hash_lookup, aout_link_hash_traverse): Likewise. (aout_hash_table): Likewise. (NAME(aout,link_hash_newfunc)): Rename from aout_link_hash_newfunc and make externally visible. (NAME(aout,link_hash_table_init)): New function. (NAME(aout,link_hash_table_create)): Call NAME(aout,link_hash_table_init), not _bfd_link_hash_table_init. (aout_link_add_symbols): Don't fail if no symbols. If it exists, call add_dynamic_symbols backend entry point for dynamic objects. Use add_one_symbol backend entry point if it exists. (NAME(aout,final_link)): Call finish_dynamic_link backend entry point, if it exists. (aout_link_input_bfd): For a dynamic object, call link_dynamic_object backend entry point, if it exists. (aout_link_write_other_symbol): Call write_dynamic_symbol backend entry point, if it exists. (aout_link_input_section): Don't read the relocs if they have already been read. (aout_link_input_section_std): When doing a final link, for a reloc against an external symbol, call check_dynamic_reloc backend entry point, if it exists. (aout_link_input_section_ext): Likewise. * libaout.h: Protect against multiple inclusion. Include bfdlink.h. (struct aout_link_hash_entry): Move in from aoutx.h. (struct aout_link_hash_table): Likewise. (aout_link_hash_lookup, aout_link_hash_traverse): Likewise. (aout_hash_table): Likewise. (struct aout_backend_data): Add fields add_dynamic_symbols, add_one_symbol, link_dynamic_object, write_dynamic_symbol, check_dynamic_reloc, and finish_dynamic_link. (struct aout_section_data_struct): Define new structure. (aout_section_data): Define new accessor macro. (NAME(aout,link_hash_newfunc)): Declare. (NAME(aout,link_hash_table_init)): Declare. * aoutf1.h (sunos4_aout_backend): Initialize new aout_backend_data fields. * aout-target.h (MY(backend_data)): Likewise. * i386aout.c (MY(backend_data)): Likewise. * i386mach3.c (MY(backend_data)): Likewise. * mipsbsd.c (MY(backend_data)): Likewise. * sparclynx.c (sparclynx_aout_backend): Likewise.
1994-05-14 * aoutx.h (add_to_stringtab): Use BFD_ASSERT not assert. ThisJim Kingdon1-16/+34
avoids __eprintf troubles.
1994-04-08 * aoutx.h (NAME(aout,make_sections)): New function.Ian Lance Taylor1-31/+29
(NAME(aout,some_aout_object_p)): Call NAME(aout,make_sections) rather than making sections inline. (NAME(aout,mkobject)): Don't make any sections. (NAME(aout,adjust_sizes_and_vmas)): Call NAME(aout,make_sections). (NAME(aout,final_link)): Don't dereference obj_textsec (abfd) or obj_datasec (abfd) if they are NULL. * libaout.h (NAME(aout,make_sections)): Declare. * bout.c (b_out_mkobject): Don't make any sections. (b_out_write_object_contents): Call aout_32_make_sections. (b_out_set_section_contents): Likewise. * i386os9k.c (os9k_mkobject): Don't make any sections. (os9k_write_object_contents): Call aout_32_make_sections. (os9k_set_section_contents): Likewise.
1994-04-08 * aoutx.h (NAME(aout,new_section_hook)): Don't set N_EXT in targetIan Lance Taylor1-3/+3
index.
1994-04-07 * sunos.c (MY_read_dynamic_symbols): Don't define.Ian Lance Taylor1-110/+19
(MY_read_dynamic_relocs): Don't define. (MY_get_dynamic_symtab_upper_bound): Define. (MY_canonicalize_dynamic_symtab): Define. (MY_get_dynamic_reloc_upper_bound): Define. (MY_canonicalize_dynamic_reloc): Define. (struct sunos_dynamic_info): Change type of dynsym_count and dynrel_count to long. Add fields canonical_dynsym and canonical_dynrel. (sunos_read_dynamic_info): Check that BFD had DYNAMIC flag set. Clear info->canonical_dynsym and info->canonical_dynrel. (MY(read_dynamic_symbols)): Removed. (MY(read_dynamic_relocs)): Removed. (sunos_get_dynamic_symtab_upper_bound): New function. (sunos_canonicalize_dynamic_symtab): New function. (sunos_get_dynamic_reloc_upper_bound): New function. (sunos_canonicalize_dynamic_reloc): New function. * libaout.h: Declare struct reloc_ext_external and reloc_std_external to avoid prototype problems. (struct aout_backend_data): Remove fields read_dynamic_symbols and read_dynamic_relocs. (NAME(aout,translate_symbol_table)): Declare. (NAME(aout,swap_ext_reloc_in)): Declare. (NAME(aout,swap_std_reloc_in)): Declare. * aoutx.h (NAME(aout,translate_symbol_table)): Renamed from translate_symbol_table and made non-static. Changed all callers. (NAME(aout,slurp_symbol_table)): Don't read dynamic symbols. (NAME(aout,slurp_reloc_table)): Don't read dynamic relocs. (NAME(aout,get_reloc_upper_bound)): Don't count dynamic relocs. * aoutf1.h (aout_32_sunos4_write_object_contents): Don't bother to remove dynamic symbols and relocs. They will no longer be present. (MY_read_dynamic_symbols): Don't define. (MY_read_dynamic_relocs): Don't define. (sunos4_aout_backend): Don't initialize dynamic entry points. * aout-target.h (MY_read_dynamic_symbols): Don't define. (MY_read_dynamic_relocs): Don't define. (MY(backend_data)): Don't initialize dynamic entry points. (MY_get_dynamic_symtab_upper_bound): If not defined, define to _bfd_nodynamic version. (MY_canonicalize_dynamic_symtab): Likewise. (MY_get_dynamic_reloc_upper_bound): Likewise. (MY_canonicalize_dynamic_reloc): Likewise.
1994-04-05 * aoutx.h (NAME(aout,canonicalize_reloc)): Don't error out ifIan Lance Taylor1-1/+0
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-04 * aoutx.h (NAME(aout,bfd_free_cached_info)): Don't free anythingIan Lance Taylor1-0/+3
if we don't have a bfd_object.
1994-04-04 Made sure that every call to bfd_read, bfd_write, and bfd_seekIan Lance Taylor1-10/+14
checks the return value and handled bfd_error correctly. These changes are not itemised. Also: * aoutx.h (emit_strtab): Change return type to boolean, and return errors. (NAME(aout,write_syms)): Check emit_strtab return value. (NAME(aout,final_link)): Likewise.
1994-04-01 * aoutx.h (aout_link_write_symbols): If keep_memory is false, makeIan Lance Taylor1-1/+19
sure the symbol name is stored in permanent memory before adding it to the string table.
1994-04-01 Add bfd_free_cached_info support to a.out backends.Ian Lance Taylor1-141/+167
* 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-03-30Wed Mar 30 16:25:41 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)Ian Lance Taylor1-10/+12
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-28 * aoutx.h (translate_from_native_sym_flags): Set SEC_RELOC flagIan Lance Taylor1-1/+1
for generated constructor section.
1994-03-25Fix typo in comment.Ian Lance Taylor1-1/+1
1994-03-25 * aoutx.h (NAME(aout,find_nearest_line)): The caller expectsIan Lance Taylor1-2/+265
functionname_ptr to be set to a symbol name, so prepend symbol_leading_char.
1994-03-17 * aoutx.h, elfcode.h, coff-alpha.c, bout.c, ecoff.c, ecofflink.c,Jim Kingdon1-123/+119
elf32-hppa.c, elf32-mips.c, linker.c, som.c, sunos.c: If malloc(0) returns NULL, it is not an error. It's possible that some of these checks are not necessary (because the size can never be zero), but putting in the checks is the conservative thing to do in light of the fact that some of these malloc calls replaced unchecked alloca calls, in which a zero argument would work fine.
1994-03-10 * libbfd-in.h: Remove alloca cruft. It was missing some necessaryJim Kingdon1-26/+61
cruft (like the #pragma alloca for AIX). In addition to that problem, the C alloca calls xmalloc, which means checking for being out of memory can't work right. The following changes remove all uses of alloca from BFD. * hosts/solaris2.h: Remove alloca cruft. * som.c: Replace alloca with a fixed size auto array. * aoutx.h, elfcode.h, nlmcode.h, bout.c, coff-alpha.c, ecoff.c, ecofflink.c, elf32-hppa.c, elf32-mips.c, linker.c, reloc.c, som.c: Replace alloca with malloc and appropriate error checking and freeing. * linker.c: Replace alloca with obstack_alloc. * libbfd.h: Rebuilt.
1994-02-26 * aoutx.h, archive.c: Add casts to avoid warnings from SVR4 cc.Ian Lance Taylor1-25/+25
* ecoff.c, ecofflink.c, ecoffswap.h, srec.c: Likewise. * elf32-i386.c: Likewise. * elfcode.h (bfd_section_from_shdr): Make i unsigned; remove old #if 0 code. (elf_write_phdrs): Make i unsigned. (map_program_segments): Make i and n_left unsigned. (assign_file_positions_except_relocs): Make i unsigned. (write_shdrs_and_ehdr): Make count unsigned. (assign_file_positions_for_relocs): Make i unsigned. (NAME(bfd,elf_write_object_contents)): Make count unsigned. (section_from_elf_index): Make index argument unsigned.
1994-02-12 Make all callers of malloc or realloc (including via obstacks)David MacKenzie1-15/+71
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-05 * aoutx.h (aout_link_check_ar_symbols): Correct test for whetherIan Lance Taylor1-4/+17
object file defines symbol. Also, if skipping a symbol, skip the second symbol of a N_WARNING or N_INDR symbol as well.