Commit Graph

90 Commits

Author SHA1 Message Date
Jeff Law d643978558 * som.c (som_get_symtab_upper_bound): Use "sizeof (asymbol *)"
not "sizeof (som_symbol_type *)".

        * elfcode.h (elf_get_symtab_upper_bound): Use "sizeof (asymbol *)"
        not "sizeof (asymbol").  Opps.
1994-02-26 00:39:03 +00:00
Jeff Law 4f42757e38 * som.c (som_prep_headers): Use CPU_PA_RISC1_0 for magic
number rather than HP9000S800_ID.  Note som.c is careful
        to make sure CPU_PA_RISC1_0 is always defined.
1994-02-24 02:31:01 +00:00
Ian Lance Taylor 2ab0b7f3e3 * som.c (som_bfd_count_ar_symbols): Use a pointer and alloca
rather than an array of variable size.
	(som_bfd_fill_in_ar_symbols): Likewise.
	(som_bfd_ar_write_symbol_stuff): Likewise.
1994-02-22 00:01:34 +00:00
David MacKenzie d1ad85a6e6 * bfd.c (bfd_get_error, bfd_set_error): New functions.
(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-17 18:08:41 +00:00
Jeff Law 7430a99137 * som.c: Remove FIXMEs for things which have been dealt with. 1994-02-16 06:28:25 +00:00
Jeff Law c6cdb69ae4 * som.c (som_bfd_prep_for_ar_write): Iterate through the SOM
symbols, not the BFD symbols.
        (som_bfd_ar_write_symbol_stuff): Likewise.
1994-02-15 17:01:39 +00:00
Jeff Law 24a1f6a05f * som.c (som_slurp_symbol_table): Do not die if a BFD doesn't
have any symbols.
1994-02-15 07:48:56 +00:00
Jeff Law 6e033f8639 * Finish basic read-write support for SOM archive libraries. Bugs
surely remain as this hasn't been tested all that much.
	* som.c (SOM_LST_HASH_SIZE, SOM_LST_MODULE_LIMIT): Define.
	(struct som_misc_symbol_info): New structure to hold info necessary
	to build both normal and library symbol tables.
	(som_derive_misc_symbol_info): New function to derive info necessary
	to build both normal and library symbol tables.
	(som_build_and_write_symbol_table): Use new function to derive misc
	symbol information.
	(som_slurp_symbol_table): Update backend private data for symbols
	appropriately.
	(som_bfd_prep_for_ar_write): New function.
	(som_bfd_ar_symbol_hash): New function.
	(som_bfd_ar_write_symbol_stuff): New function.
	(som_write_armap): Flesh out.
	(som_vec): Fix ar padding character.

	* som.c: Consistently use memset rather than bzero.
1994-02-15 07:05:04 +00:00
Jeff Law 50c5c4ad12 * som.h (som_symbol_data): Safely access backend private data
for BFD symbols.  All callers changed.
1994-02-14 06:15:00 +00:00
Jeff Law 3c37f9ca0c * som.c (som_bfd_count_ar_symbols): New helper function.
(som_bfd_fill_in_ar_symbols): New helper function.
        (som_slurp_armap): New function to read a SOM LST.
1994-02-13 23:34:52 +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
Jeff Law a62dd44f9c * som.c: Cast return values from BFD memory allocation routines to
avoid warnings from the HP compiler.
1994-02-10 05:36:41 +00:00
Jeff Law 6941fd4d64 * som.c: This file is also used for HOST_HPPAOSF.
* targets.c (bfd_target_vector): Enable som_vec for HOST_HPPAOSF.
1994-02-08 05:09:34 +00:00
Jeff Law 3996115456 * som.c (hppa_som_reloc): Add new "error message" argument. 1994-01-13 20:34:25 +00:00
Jeff Law a36b6f1d05 * elf32-hppa.c (hppa_elf_gen_reloc_type): Handle 'T' field
selectors for PIC code.

        * som.c (hppa_som_gen_reloc_type): Handle 'T' field selectors.
        (som_write_fixups): Handle R_DLT_REL, R_FSEL, R_RSEL, R_LSEL
        relocations needed by PIC.
1993-12-14 07:36:15 +00:00
Jeff Law f6c2300b0a * som.c (som_begin_writing): Flesh out code for handling simple
auxiliary headers.
        (bfd_som_attach_aux_hdr): New function.

        * som.h (struct somdata): Add fields for attaching version and
        copyright headers.  Add accessor macros.
1993-12-06 08:53:53 +00:00
Jeff Law 744069b8ab * som.c (R_DLT_REL, R_AUX_UNWIND, R_SEC_STMT): Add protected
definitions for old versions of HPUX which fail to define them.
        (som_hppa_howto_talbe): Add R_DLT_REL, R_AUX_UNWIND, and R_SEC_STMT
        now that they're safe.  Delete bogus R_STATEMENT relocations.
1993-12-06 06:55:48 +00:00
Jeff Law 017a52d7a9 * som.c (som_hppa_howto_table): Add missing R_END_TRY. Delete
extra R_DATA_OVERRIDE.
        (hppa_som_gen_reloc_type): Generate a relocation for the rounding
        mode selector if needed.
        (som_write_fixups): Handle requests for a change in the default
        rounding mode.  Rounding modes do not consume input bytes, but
        are just markers much like R_ENTRY and R_EXIT.
1993-12-06 03:33:06 +00:00
Jeff Law 36456a67f8 * Minimal support for reading SOM fixup streams. Allows
objdump -r to do something reasonable.
        * som.c (som_get_reloc_upper_bound): Implement.
        (som_canonicalize_reloc): Implement.
        (som_set_reloc_info, som_slurp_reloc_table): New functions.
1993-11-22 10:37:02 +00:00
Jeff Law 91c0bcbbd0 * som.c (som_bfd_reloc_type_lookup): Add missing prototype. Returns
a pointer to constant data.  Delete bogus #define which made the
        function useless.
1993-11-14 01:32:09 +00:00
Jeff Law 6eb644081a * som.c (som_begin_writing): New function. 1993-11-14 00:56:58 +00:00
Jeff Law 0b35f7ec59 * som.c (som_write_space_strings): New function.
(som_write_symbol_strings): New function.
1993-11-14 00:33:00 +00:00
Jeff Law 9d0dea6fca * som.c (som_write_fixups): New function. 1993-11-14 00:00:05 +00:00
Jeff Law aff9779048 * som.c (som_prep_for_fixups): New function. 1993-11-13 23:28:34 +00:00
Jeff Law 980bac6418 * som.c (som_write_object_contents): Do not abort. Flesh out.
(som_set_section_contents): Do not abort.  Flesh out.
1993-11-13 08:57:07 +00:00
Jeff Law 713de7ec97 * som.c (som_build_and_write_symbol_table): New function. 1993-11-13 08:37:14 +00:00
Jeff Law efc0df7cff * som.c (som_write_headers): New function. 1993-11-13 08:02:43 +00:00
Jeff Law 7057b78fb8 * som.c (som_reloc_call): New function. 1993-11-13 07:22:06 +00:00
Jeff Law 2212ff9277 * som.c (som_sizeof_headers): Add missing prototype.
(som_set_arch_mach): Do not abort.
1993-11-13 06:52:07 +00:00
Jeff Law 0ffa24b979 * som.c (som_prep_headers): New function. 1993-11-13 06:44:29 +00:00
Jeff Law 5532fc5af1 * som.c (som_count_spaces): New function.
(som_count_subspaces): New function.
        (compare_syms): New function.
        (som_compute_checksum): New function.
1993-11-13 00:39:20 +00:00
Jeff Law 32619c583f * som.c (hppa_som_gen_reloc_type): New function.
(som_bfd_reloc_type_lookup): New function.
1993-11-13 00:28:06 +00:00
Jeff Law 54bbfd3762 * som.c (try_prev_fixup): New function.
(som_reloc_skip): New function.
	(som_reloc_addend): New function.
1993-11-13 00:16:17 +00:00
Jeff Law d125665cbb * som.c (som_initialize_reloc_queue): New function.
(som_reloc_queue_insert): Likewise.
	(som_reloc_queue_fix): Likewise.
	(som_reloc_queue_find): Likewise.
1993-11-13 00:07:20 +00:00
Jeff Law fcb0c84690 * som.c (som_hppa_howto_table): SOM howto relocation table.
(hppa_som_reloc): New function.
1993-11-12 23:49:58 +00:00
Jeff Law 4fdb66cd50 * som.c (struct reloc_queue): New structure to keep track of
the last four multibyte relocations emitted.
	(enum pa_symbol_type): Type to fully describe the symbol types
	associated with .import/.export assembler directives.
1993-11-12 23:43:24 +00:00
Jeff Law 70f1d7387e * som.c: Include libhppa.h 1993-11-12 23:39:35 +00:00
Jeff Law 40249bfb73 * som.c (bfd_som_set_section_attributes): New function.
(bfd_som_set_subsection_attributes): Likewise.
	(bfd_som_set_symboL_type): Likewise.
	(bfd_som_attach_unwind_info): Likewise.
	* som.h: Declare new exported functions.
1993-11-12 23:36:04 +00:00
Stu Grossman 9e16fcf124 * som.c (hppa_object_setup): Set SEC_CODE for .text section so
that GDB can figure out text_start and text_end.
1993-10-26 09:42:15 +00:00
Ken Raeburn d9ad93bce5 More patches from Jeff Law, plus a little cleanup of my own.
These changes separate PA-SOM support from PA-ELF support.
A sun4-x-hppaosf assembler can now be built.

* elf32-hppa.c (elf_hppa_howto_table): Now static.
(symext_rootP, symext_lastP, global_value, GOT_value, global_symbol,
global_sym_defined, symextn_contents, symextn_contents_real_size,
elf_hppa_stub_rootP, elf32_hppa_symextn_map, elf32_hppa_symextn_map_size): Rely
on default initialization.
(hppa_elf_gen_reloc_type): Macro "UNDEFINED" doesn't need a trailing semicolon.
(hppa_look_for_stubs_in_section): Introduce temporaries to make code more
readable in 80 columns.

* libhppa.h (all functions): Now inline under GNU C.

* elf32-hppa.c (AR_WARN): Give argument which caused the invalid argument
relocation.
(AR_UNIMP): Delete unused macro.
(hppa_elf_set_section_contents): Always return a value.
(elf32_hppa_backend_table_processing): Likewise.
(elf32_hppa_backend_section_processing: Likewise.

* som.c: New file containing SOM specific code extracted from hppa.c

* som.h: New file containing SOM specific code extracted from libhppa.h

* hppa.c: Deleted.

* libhppa.h: Delete SOM specific code.  Add generic PA code which can be shared
by both SOM and ELF backends.

* Makefile.in: Replace hppa.c with som.c.  elf32-hppa.o depends on libhppa.h
now.

* configure.in (hppa_vec): Needs som.o module instead of hppa.o.

* elf32-hppa.c: Include libhppa.h.  Do not define BYTES_IN_WORD.

* elf32-hppa.h (hppa_reloc_field_selector_type): Delete now lives in libhppa.h.
(hppa_reloc_field_selector_type_alt): Likewise.

* elf32-hppa.c (hppa_elf_relocate_unwind_table): Delete unused variables.
(elf_hppa_reloc_type_lookup): Likewise.
(elf_hppa_tc_make_sections): Likewise.
(hppa_elf_arg_reloc_needed_p): Likewise.
(hppa_elf_build_long_branch_stub): Likewise.
(elf_reloc_map): Delete, no longer used.
(elf_hppa_reloc_map): Likewise.
(elf32_hppa_symextn_map_max_size): Likewise.
(elf32_hppa_get_sym_extn): Abort if type is bogus.

* elf32-hppa.c (elf32_hppa_backend_fake_sections): Add processing
of the .hppa_unwind section.
1993-08-28 00:10:54 +00:00