Commit Graph

31 Commits

Author SHA1 Message Date
Jeff Law ff5a090fb4 * Support code for enabling the new style linker for PA ELF.
* elfcode.h (swap_symbol_in, swap_symbol_out): Externalize.
	(elf_compute_section_file_positions): Pass link_info to
	the begin_write_processing hook.
	(bfd_elf_write_object_contents): Pass NULL for new link_info
	argument to final_write_processing hook.
	(elf_link_output_sym): Accept new "input_section" argument for
	the symbols's input section.  All callers changed.  Call the
	link_output_symbol_hook if it's defined.
	(elf_bfd_final_link): Call the final_write_processing hook if
	it's defined.
	* libelf.h (elf_backend_link_output_symbol_hook): Declare.
	(elf_backend_begin_write_processing): Add new "info" argument.
	(elf_backend_final_write_processing): Likewise.
	* elf32-target.h (elf_backend_link_output_symbol_hook): Provide
	a default definition.
	(elf32_bed): Add elf_backend_link_output_symbol_hook.
	* elf64-target.h: Likewise.

	* Major rework of the PA ELF code.  Uses the new style BFD
	linker, major cleanups.
	* hppa_stubs.h: Rewrite from scratch.  Much smaller and simpler.
	* elf32-hppa.h: Delete all symbol extension related code.
	(hppa_look_for_stubs_in_section): Delete decl.
	(elf32_hppa_size_stubs, elf32_hppa_build_stubs): New decls.
	* elf32-hppa.c: Symbol extension stuff moved form elf32-hppa.h
	into elf32-hppa.c.  Do not include aout64.h.
	(typdef hppa_stub_type): Delete.
	(elf32_hppa_stub_name_list_struct): Delete.
	(elf32_hppa_stub_description_struct): Delete.
	(arg_reloc_type): Use simpler enumerations.  All references changed.
	(arg_location, arg_reloc_relocation): Likewise.
	(elf32_hppa_symextn_map_struct): Delete.
	(get_symbol_value): Delete.
	(elf32_hppa_get_sym_extn): Delete.
	(find_stubs, new_stubs, type_of_mismatch): Delete.
	(find_stub_by_name, add_stub_by_name): Delete.
	(hppa_elf_stub_finish, hppa_elf_stub_reloc): Delete.
	(hppa_elf_arg_reloc_needed): Renamed.  Simplify.
	(hppa_elf_build_linker_stub, hppa_elf_create_stub_sec): Delete.
	(hppa_elf_long_branch_needed_p): Delete.
	(hppa_look_for_stubs_in_section): Delete.
	(hppa_elf_get_section_contents): Delete.
	(elf32_hppa_backend_symbol_processing): Delete.
	(elf32_hppa_backend_section_processing): Delete.
	(elf32_hppa_backend_section_from_shdr): Delete.
	(elf32_hppa_backend_fake_sections): Delete.
	(elf32_hppa_backend_section_from_bfd_section): Delete.
	(NEW_INSTRUCTION): Delete.
	(CURRENT_STUB_OFFSET): Delete.
	(elf32_hppa_relocate_section): New function.
	(elf32_hppa_bfd_final_link_relocate): New function.
	(elf32_hppa_size_symext): New function.
	(elf32_hppa_link_output_symbol_hook): New function.
	(elf32_hppa_read_symext_info): New function.
	(elf32_hppa_add_symbol_hook): New function.
	(elf32_hppa_name_of_stub): New function.
	(elf32_hppa_size_of_stub): New function.
	(elf32_hppa_build_one_sub): New function.
	(elf32_hppa_build_stubs): New function.
	(elf32_hppa_size_stubs): New function.
	(linker, stub and argument hash tables): Add appropriate
	structures, definitions and functions to implement all three
	hash tables.
	(hppa_elf_relocate_insn): Don't need argument location information
	in this function.
	(add_entry_to_symext_chain): Accept a symbol's argument location
	information rather than the symbol itself.  All callers changed.
	(hppa_elf_gen_reloc_type): Simplify.
	(hppa_elf_set_section_contents): Stub section is no longer special.
	(hppa_elf_reloc): Greatly simplify.
	(elf32_hppa_begin_write_processing): Accept link_info argument.
	Handle being called from the BFD backend linker.
	(elf32_hppa_final_write_processing): Likewise.
	(elf_hppa_tc_make_sections): No longer call stub_finish.
1994-07-01 19:00:17 +00:00
Ian Lance Taylor 2f3508ad05 * Many files: change all bfd_target vectors to be const. Change
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 21:55:45 +00:00
Ian Lance Taylor fa15568ac1 Changes to support ELF strip and objcopy on dynamically linked
files.
	* elfcode.h (elf_fake_sections): Add prototype.
	(bfd_section_from_shdr): Make a BFD section from an SHT_HASH
	section, and from an SHT_DYNSYM section, and from the dynamic
	string table section.
	(elf_object_p): Set D_PAGED if there is a program header.
	(elf_make_sections): Remove.
	(fix_up_strtabs): Remove.
	(elf_fake_sections): Rewrite.  Now sets sh_entsize.
	(assign_section_numbers): Rewrite.  Now sets sh_link and sh_info
	for all sections.
	(elf_compute_section_file_positions):  Don't call obsolete
	functions elf_make_sections or fix_up_strtabs.
	(swap_out_syms): Set sh_addralign to FILE_ALIGN rather than 4.
	(NAME(bfd_elf,write_object_contents)): Permit writing DYNAMIC
	objects.
	(elf_section_from_bfd_section): Treat SHT_DYNSYM like other normal
	sections.  If an SHT_REL or SHT_RELA section is allocated or uses
	an unusual symbol table, permit a BFD section to map to it.
	Permit most SHT_STRTAB sections to have a BFD section mapped to
	them.
	(elf_bfd_final_link): Don't set sh_link, sh_info or sh_entsize
	fields of dynamic sections here; do it in assign_section_numbers.
	* elf32-target.h, elf64-target.h: Add D_PAGED to permitted object
	flags.
1994-06-05 20:00:42 +00:00
Ian Lance Taylor 7a0c782d39 * elf32-target.h, elf64-target.h: Change ar_max_namelen value from
15 to 14 to match SVR4 ar.
1994-05-19 21:39:15 +00:00
Ian Lance Taylor 013dec1ad9 Add support for ELF shared libraries. Loosely based on work by
Eric Youngdale <ericy@cais.com>.
	* libelf.h (struct elf_backend_data): Add new fields for dynamic
	linking: elf_backend_create_dynamic_sections,
	elf_backend_adjust_dynamic_symbol,
	elf_backend_size_dynamic_sections,
	elf_backend_finish_dynamic_symbol,
	elf_backend_finish_dynamic_sections.
	(struct elf_link_hash_entry): Change type of align field to
	bfd_size_type.  Add fields dynindx, dynstr_index, weakdef,
	elf_link_hash_flags.
	(struct elf_link_hash_table): Add fields dynobj, dynsymcount,
	dynstr, bucketcount.
	(bfd_elf32_swap_reloc_in, bfd_elf32_swap_reloc_out): Declare.
	(bfd_elf32_swap_reloca_in, bfd_elf32_swap_reloca_out): Declare.
	(bfd_elf32_swap_dyn_in, bfd_elf32_swap_dyn_out): Declare.
	(bfd_elf32_add_dynamic_entry): Declare.
	(bfd_elf64_swap_reloc_in, bfd_elf64_swap_reloc_out): Declare.
	(bfd_elf64_swap_reloca_in, bfd_elf64_swap_reloca_out): Declare.
	(bfd_elf64_swap_dyn_in, bfd_elf64_swap_dyn_out): Declare.
	(bfd_elf64_add_dynamic_entry): Declare.
	* elfcode.h (Elf_External_Dyn): Define.
	(elf_swap_reloc_in): Define as macro using NAME.  Make externally
	visible.
	(elf_swap_reloc_out): Likewise.
	(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
	(elf_swap_dyn_in, elf_swap_dyn_out): Define as macro using NAME
	and as new externally visible function.
	(elf_fake_sections): Set section type of dynamic sections based on
	section names.
	(elf_write_phdrs): Remove.
	(assign_file_position_for_section): Add new align argument.
	Change all callers.
	(get_program_header_size): New static function.
	(struct seg_info): Remove.
	(map_program_segments): Completely rewrite.
	(assign_file_positions_except_relocs): Completely rewrite.
	(assign_file_positions_for_relocs): Don't set a file position for
	sections which already have one.  Don't bother to align the file
	position here.
	(section_from_elf_index): Handle SHT_HASH and SHT_DYNAMIC
	section types.
	(elf_section_from_bfd_section): Likewise.
	(elf_slurp_symbol_table): If section_from_elf_index fails, just
	use bfd_abs_section rather than returning an error.
	(elf_sizeof_headers): Make useful.
	(elf_link_record_dynamic_symbol): New static function.
	(elf_link_add_object_symbols): Handle dynamic objects.
	(elf_link_create_dynamic_sections): New static function.
	(elf_add_dynamic_entry): Define as macro using NAME and as new
	externally visible function.
	(NAME(bfd_elf,record_link_assignment)): New function.
	(elf_buckets): New static variable.
	(NAME(bfd_elf,size_dynamic_sections)): New function.
	(struct elf_final_link_info): Add dynsym_sec and hash_sec fields.
	(elf_bfd_final_link): Handle dynamic linking.  Create a section
	symbol for all ELF sections, not all BFD sections.  Store section
	symbol index in target_index field, not index field.  Traverse
	over global symbols even if stripping.
	(elf_link_output_extsym): Output dynamic symbols.  Mark symbols
	defined by dynamic objects as undefined.
	(elf_link_input_bfd): Ignore dynamic objects.  Use target_index
	field for section relocs, and make sure it is set.
	(elf_reloc_link_order): Use target_index field for section relocs,
	and make sure it is set.
	* elf.c (elf_link_hash_newfunc): Initialize dynindx, dynstr_index,
	weakdef and elf_link_hash_flags fields.
	(_bfd_elf_link_hash_table_create): Initialize dynobj, dynsymcount,
	dynstr and bucketcount fields.
	* elf32-target.h: Initialize new dynamic linking fields.
	* elf64-target.h: Likewise.
	* elf32-i386.c: New functions for dynamic linking support.
	* elf32-sparc.c: Likewise.
	* bfd-in.h (bfd_elf32_record_link_assignment): Declare.
	(bfd_elf64_record_link_assignment): Declare.
	(bfd_elf32_size_dynamic_sections): Declare.
	(bfd_elf64_size_dynamic_sections): Declare.
	* bfd-in2.h: Rebuilt.
1994-05-19 18:23:40 +00:00
Ian Lance Taylor 6ec3bb6a75 * elfcode.h: Include bfdlink.h. Added several new functions to do
linking.
	(ELF_R_TYPE): Define.
	(bfd_add_to_strtab): Return unsigned long.  Change check for
	realloc failure.
	(elf_fake_sections): Check return value of bfd_add_to_strtab.
	(elf_compute_section_file_positions): Add link_info argument.
	Call elf_backend_begin_write_processing hook and prep_headers
	here.  Only call swap_out_syms if link_info is NULL.  Set up
	.shstrtab section here.  Pass dosyms argument to
	assign_file_positions_except_relocs.  Set output_has_begun flag.
	(assign_file_positions_for_symtab_and_strtabs): Add dosyms
	argument, and use it to control setting .symtab and .strtab file
	positions.
	(assign_file_positions_except_relocs): Add dosyms argument, and
	pass it on.
	(prep_headers): Check return value of bfd_add_to_strtab.
	(swap_out_syms): Likewise.  Also, don't set up .shstrtab here.
	(NAME(bfd_elf,write_object_contents)): Some calls moved into
	elf_compute_section_file_positions.
	(elf_set_section_contents): Likewise.
	(elf_slurp_symbol_table): SHN_LORESERV corrected to SHN_LORESERVE.
	* libelf.h: Include bfdlink.h.
	(struct elf_backend_data): Add fields collect,
	elf_add_symbol_hook, elf_backend_relocate_section.
	(struct bfd_elf_section_data): Add field rel_hashes.
	(struct elf_obj_tdata): Remove fields internal_syms and symbols.
	Add field sym_hashes.
	(obj_symbols, obj_internal_syms): Remove definitions.
	(elf_sym_hashes): Define.
	(struct elf_link_hash_entry): Define.
	(struct elf_link_hash_table): Define.
	(elf_link_hash_lookup): Define.
	(elf_link_hash_traverse): Define.
	(elf_hash_table): Define.
	(_bfd_elf_link_hash_table_create): Declare.
	(bfd_elf32_bfd_link_add_symbols): Declare.
	(bfd_elf32_bfd_final_link): Declare.
	(bfd_elf64_bfd_link_add_symbols): Declare.
	(bfd_elf64_bfd_final_link): Declare.
	* elf.c: Include bfdlink.h.
	(elf_link_hash_newfunc): New function.
	(_bfd_elf_link_hash_table_create): New function.
	* elf32-target.h (elf_backend_relocate_section): If not defined,
	define as 0 and use generic linker.  Otherwise, use ELF backend
	linker.
	(elf_backend_collect): If not defined, define as false.
	(elf_backend_add_symbol_hook): If not defined, define as 0.
	(elf32_bed): Initialize new fields.
	* elf64-target.h: Same changes as elf32-target.h.
	* elf32-i386.c: Include bfdlink.h.
	(elf_i386_relocate_section): New function.
	(elf_backend_relocate_section): Define.
	* elf32-sparc.c: Include bfdlink.h.
	(elf_info_to_howto): Change type of dst from Elf32_Internal_Rela
	to Elf_Internal_Rela (they're the same type anyhow).
	(elf_sparc_relocate_section): New function.
	(elf_backend_relocate_section): Define.
	* elf32-mips.c (elf_backend_collect): Define.
1994-05-09 16:58:36 +00:00
Peter Schauer cb71adf12b * libelf.h (elf_obj_tdata): Add members for dynamic symbol table
handling.
	* elfcode.h (bfd_section_from_shdr):  Handle dynamic symbol table.
	* elfcode.h (elf_slurp_symbol_table):  Take additional parameter
	to select static or dynamic symbol table and return number of
	symbols slurped or -1 on error.
	* elfcode.h (elf_get_symtab):  Set bfd symcount from
	elf_slurp_symbol_table result.
	* elfcode.h (elf_get_dynamic_symtab_upper_bound,
	elf_canonicalize_dynamic_symtab):  New functions to handle dynamic
	symbol table.
	* elf32-target.h, elf64-target.h (BFD_JUMP_TABLE_DYNAMIC):
	Change to handle dynamic symbol table, provide default definitions
	for dynamic relocs.
	* aoutx.h (howto_table_std, NAME(aout,swap_std_reloc_out),
	NAME(aout,swap_std_reloc_in), aout_link_input_section_std,
	aout_link_reloc_link_order):  Handle r_jmptable and r_relative
	relocations.
1994-04-21 17:01:12 +00:00
Jeff Law 99a6c7613c * elfcode.h (elf_set_section_contents): Support calling the backend
function elf_backend_begin_write_processing when just beginning to
	write an object file.

	* libelf.h (elf_backend_begin_write_processing): Declare.

	* elf{32,64}-target.h (elf_backend_begin_write_processing): Provide
	a default definition.
	(elf{32,64}_bed): Add elf_backend_begin_write_processing.

	* elf32-hppa.h (elf_hppa_tc_symbol): Delete extern declaration.
	(elf_hppa_tc_make_sections): Likewise.

	* elf32-hppa.c (symext_chain_built): Delete.
	(symext_chain_size): Renamed from symextn_contents_real_size.
	(elf32_hppa_backend_{begin,final}_write_processing): New functions.
	(add_entry_to_symext_chain): New function.
	(hppa_elf_set_section_contents): Ignore writes to the symbol extension
	section until it's been rebuilt internally.
	(hppa_elf_get_section_contents): Symbol extension section is no
	longer special.
	(elf_backend_{begin,final}_write_processing): Define.
	(elf_hppa_tc_make_sections): Simplify now that much code has
	migrated into elf32_hppa_backend_{being,final}_write_processing.
1994-04-07 18:12:25 +00:00
Ian Lance Taylor dfc1c00613 * All backends: Added BFD_JUMP_TABLE_DYNAMIC to target vector. 1994-04-07 01:58:27 +00:00
Ian Lance Taylor 6812b6077e * targets.c (bfd_target): Rearranged fields in target vector.
Removed _bfd_debug_info_start, _bfd_debug_info_end and
	_bfd_debug_info_accumulate, which were never used.
	(BFD_JUMP_TABLE_GENERIC, BFD_JUMP_TABLE_COPY): Defined.
	(BFD_JUMP_TABLE_CORE, BFD_JUMP_TABLE_ARCHIVE): Defined.
	(BFD_JUMP_TABLE_SYMBOLS, BFD_JUMP_TABLE_RELOCS): Defined.
	(BFD_JUMP_TABLE_WRITE, BFD_JUMP_TABLE_LINK): Defined.
	* All backends: Changed to use the new BFD_JUMP_TABLE_* macros
	rather than the single JUMP_TABLE macro.  Removed many of the
	weird macro definitions needed to support the monolithic
	JUMP_TABLE.
	* bfd-in.h (JUMP_TABLE): Removed.
	* libbfd-in.h: Define a bunch of macros, and declare a few
	functions, for use with the new BFD_JUMP_TABLE_* macros.
	* libbfd.c (_bfd_dummy_new_section_hook): Removed.
	(bfd_false): Set bfd_error_invalid_operation.
	(bfd_nullvoidptr): Likewise.
	(bfd_n1): New function.
	(_bfd_nocore_core_file_matches_executable_p): Renamed from
	_bfd_dummy_core_file_matches_executable_p.
	(_bfd_nocore_core_file_failing_command): Similar rename.  Set
	bfd_error_invalid_operation.
	(_bfd_nocore_core_file_failing_signal): Likewise.
	(_bfd_generic_get_section_contents): Renamed from
	bfd_generic_get_section_contents.  Changed all callers.
	(_bfd_generic_set_section_contents): Similar rename.
	* ieee.c: #if 0 out ieee_bfd_debug_info_start,
	ieee_bfd_debug_info_end, ieee_bfd_debug_info_accumulate.  They
	were never called.
	* bfd-in2.h: Rebuilt.
	* libbfd.h: Rebuilt.
1994-04-06 22:00:40 +00:00
Ian Lance Taylor 9deaaaf1b3 * targets.c (bfd_target): Add _bfd_free_cached_info field.
* bfd.c (bfd_free_cached_info): Define.
	* bfd-in.h (JUMP_TABLE): Add _bfd_free_cached_info.
	* bfd-in2.h: Rebuilt.
	* All backends: Initialize bfd_free_cached_info entry point to
	bfd_true.
1994-04-01 17:55:47 +00:00
Jeff Law 5b3577cb7a * bfd-in2.h, libbfd.h, libcoff.h: Rebuilt.
* bfd-in.h (JUMP_TABLE): Add new entries to the jump table
	for bfd_copy_private_section_data, bfd_copy_private_bfd_data,
	and bfd_is_local_label.

	* targets.c: Add new entries to the bfd_target structure.

	* bfd.c (bfd_copy_private_bfd_data): New definition.

	* section.c (bfd_copy_private_section_data): New definition.

	* syms.c (bfd_is_local_label): New definition.

	* libbfd-in.h (bfd_generic_is_local_label): Declare.

	* libbfd.c (bfd_generic_is_local_label): New function.

	* *-core.c: Provide default definitions for new functions in
	the target vector which all point to bfd_false.

	* aout-target.h, coffcode.h, elf32-target.h elf64-target.h, ieee.c
	libaout.h, libecoff.h, nlm-target.h, oasys.c, srec.c, tekhex.c
	Default new vectors for copying private backend data to bfd_true.
	Default new vector for determining if a symbol is a local label
	to bfd_generic_is_local_label.

	* som.c (som_bfd_copy_private_section_data): New function.
	(som_bfd_is_local_label): New function.
	(som_bfd_copy_private_bfd_data): For now default to bfd_true.

	* elf32-hppa.c (hppa_elf_is_local_label): New function.
1994-03-16 07:02:05 +00:00
Ian Lance Taylor 4c3721d514 Extensive changes to move the bulk of the linker into BFD so that
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-12-30 19:56:50 +00:00
Ian Lance Taylor 643e9fc768 * libelf.h (struct elf_backend_data): Added fields
elf_backend_sym_is_global and elf_backend_final_write_processing.
	* elf32-target.h (elf32_bed): Added corresponding initializers.
	* elf64-target.h (elf64_bed): Likewise.
1993-11-18 17:10:42 +00:00
Ian Lance Taylor a5ccdad1fc * elfcode.h (elf_object_p): Rather than looking through an array
of architectures, get the ELF EM_xxx code from the backend
	information.  Let the generic ELF target match any EM_xxx code not
	matched by another ELF target.  Call elf_backend_object_p to let
	the backend do more checks and set global information.
	* libelf.h (struct elf_backend_data): Added elf_machine_code and
	elf_backend_object_p fields.
	(struct bfd_elf_arch_map): Removed.
	(bfd_elf_arch_map, bfd_elf_arch_map_size): Don't declare.
	* elf32-target.h, elf64-target.h: Initialize elf_machine_code
	field with ELF_MACHINE_CODE.  Initialize elf_backend_object_p
	field with elf_backend_object_p (if it is defined).
	* elf32-gen.c, elf32-hppa.c, elf32-i386.c, elf32-i860.c,
	elf32-m68k.c, elf32-m88k.c, elf32-mips.c, elf32-sparc.c,
	elf64-gen.c (ELF_MACHINE_CODE): Defined.
	* elf32-mips.c: Include ecoffswap.h to get ECOFF swapping
	routines.
	(mips_elf_object_p): Set the right machine number.
	(mips_elf_ecoff_debug_swap): Defined.
	(elf_backend_object_p): Defined to be mips_elf_object_p.
	(elf_backend_ecoff_debug_swap): Defined to be
	mips_elf_ecoff_debug_swap.
	* elf.c (bfd_elf_arch_map, bfd_elf_arch_map_size): Removed.

	* elf32-mips.c (elf_mips_howto_table): Don't complain on overflow
	for R_MIPS_26.  Correct overflow detection requires matching the
	upper four bits of the destination against the PC.  From Ted Lemon
	<mellon@pepper.ncd.com>.

	* elf32-hppa.c (elf_hppa_reloc_type_lookup): Return type
	should point to const data.
1993-11-09 21:08:58 +00:00
Ian Lance Taylor 95469b0290 * libelf.h: Added some comments.
(struct elf_backend_data): Added elf_backend_ecoff_debug_swap
	field.  Removed unused write_relocs field.
	* elf32-target.h: Adjusted elf_backend_data initialization
	accordingly.
	* elf64-target.h: Corrected elf_backend_data initialization to
	fill in all fields and to set elf_64_p to 1.
1993-11-09 16:33:28 +00:00
Ian Lance Taylor 632f2cc779 * elf32-mips.c: Include "seclet.h".
(mips_elf_fake_sections): Force size of .reginfo section to sizeof
	Elf32_External_RegInfo.
	(mips_elf_seclet_link): New function.  Link the .reginfo section
	specially, and pass everything else to the generic routine.
	(bfd_elf32_bfd_seclet_link): Define macro.
	* elf32-target.h: If bfd_elf32_bfd_seclet_link is already defined,
	don't override it.
1993-10-21 17:13:38 +00:00
Ian Lance Taylor d6e5f95000 * section.c (SEC_DEBUGGING): New section flag.
* elfcode.h (bfd_section_from_shdr): If section is SHT_PROGBITS,
	and the name starts with .debug, .line or .stab, set
	SEC_DEBUGGING.
	* elf32-target.h (TARGET_BIG_SYM, TARGET_LITTLE_SYM): Added
	SEC_DEBUGGING to section_flags.
	* elf64-target.h (TARGET_BIG_SYM, TARGET_LITTLE_SYM): Added
	SEC_DEBUGGING and SEC_CODE to section_flags.
	* bfd-in2.h: Updated.
1993-09-23 15:14:12 +00:00
Ian Lance Taylor 207f85b54b * elf32-i386.c (elf_howto_table): Add bfd_elf_generic_reloc
special function for all reloc entries.
	* elf32-target.h (TARGET_LITTLE_SYM): Add SEC_CODE to
	section_flags.
	* libelf.h (elf_symbol_type): Remove desc, type and other fields.
	* Makefile.in (elf32-*.o): These depend upon elf32-target.h.
1993-09-14 22:29:26 +00:00
Ian Lance Taylor 23f44e6f1a * libbfd-in.h: Removed swapping routines declarations.
* bfd-in.h: Added swapping routine declarations, and renamed them
	from _do_* to bfd_*.
	* libbfd.c: Renamed swapping routines from _do_* to _bfd_*.
	* Changed all callers.
	* libbfd.h, bfd-in2.h: Rebuilt.
1993-09-07 18:32:33 +00:00
Ken Raeburn e2a422b84c Merged in changes from Jeff Law and Pete Hoogenboom at Utah for PA ELF
support.  Compiles, not particularly well tested.  See ChangeLog for details.
1993-08-25 01:15:07 +00:00
Ken Raeburn b3024965a0 (elfXX_bed): Initialize maxpagesize from ELF_MAXPAGESIZE.
(ELF_MAXPAGESIZE): Default to 1.
1993-07-26 18:46:37 +00:00
Ken Raeburn 32090b8e4f * elf.c, elfcode.h, libelf.h: Serious reorganization.
Deleted `thunk' structure, merged into tdata, duplicate data eliminated.
Rearranged functions, grouping by function.
Broke up many functions in elfcode.h, re-ordered many parts of file writing
to handle unpredictable state of section relocation table as provided by
various applications.
Still needs cleanup: Merge functions back together, split out data structure
with only data that is used only when writing out object file.

* elf.c (bfd_elf_generic_reloc): New function, taken from coff-mips.c.
* elf32-sparc.c (elf_sparc_howto_table): Use it, to work around
bfd_perform_relocation lossage.
1993-07-19 19:12:59 +00:00
Ken Raeburn 998ce1e0c7 Thu Jun 24 17:25:51 1993 Ken Raeburn (raeburn@poseidon.cygnus.com)
* elfcode.h (elf_new_section_hook): Do nothing for now.
	(elf_write_object_contents): Output common symbols the way ELF
	wants them.

Wed Jun 23 16:20:07 1993  Ken Raeburn  (raeburn@poseidon.cygnus.com)

	* libelf.h (struct elf_obj_tdata and associated macros): Moved
	here from elfcode.h.  A couple of size-specific structure pointers
	were changed to PTR; uses fixed appropriately.
	(elf32_symbol_type, elf64_symbol_type): Separated definitions.
	(bfd_elf_mkobject): Renamed from bfd_elf32_mkobject.
	(bfd_elf32_mkobject, bfd_elf64_mkobject, elf_mkobject): New
	temporary macros to ease name change.
	* elf.c (elf_read, elf_mkobject, elf_get_str_section,
	elf_string_from_elf_section, bfd_elf_find_section): Moved here
	from elfcode.h.
	* doc/Makefile.in (libbfd.h): Process elf.c too.
	* Makefile.in (elf.o): Note new dependencies.

	* elfcode.h: Lots of stuff moved elsewhere.  Deleted some unused
	code, tweaked some debug hooks.
	(elf_slurp_reloca_table): Translate ELF section symbols into BFD
	section symbols.
1993-06-24 21:30:26 +00:00
Ken Raeburn 268f94aca3 Use new size-independent versions of elf internal data structures. 1993-06-22 03:06:29 +00:00
Ken Raeburn ada315eae4 No longer use dummy new-section-hook. 1993-06-21 00:36:35 +00:00
Ken Raeburn 7050286db6 elfcode.h 1993-06-02 21:24:35 +00:00
Ken Raeburn 9942e68438 Updated for new macro, type, and structure names.
Cleaned up some namespace pollution; renamed elf vectors.
1993-05-25 20:11:26 +00:00
Ken Raeburn ae06054e4b allow overrides of armap defaults 1993-04-28 22:49:48 +00:00
Jim Kingdon 14e3c2e47d * libbfd.c: Add signed versions of bfd_{h_,}{get,put}_signed_<size>.
libbfd.c, libbfd-in.h: Add _do*signed*.
	targets.c, all targets: Add bfd*signed*.
	bfd-in.h: Add bfd_signed_vma.  Add comments.
1993-04-17 00:39:36 +00:00
Ken Raeburn 81187b5475 revised elf support 1993-02-27 07:05:09 +00:00