Commit Graph

20 Commits

Author SHA1 Message Date
Ian Lance Taylor 64d5f5d061 Tue Jan 9 15:22:53 1996 David Mosberger-Tang <davidm@azstarnet.com>
* coff-alpha.c (alpha_relocate_section): During final link, allow
 	output .lita section to be bigger than 64k by adjusting gp value
 	on a per-input section basis.
	* libecoff.h (struct ecoff_tdata): Add issued_multiple_gp_warning
	field.
	(struct ecoff_section_tdata): Add gp field.

Tue Jan  9 12:00:36 1996  Ian Lance Taylor  <ian@cygnus.com>

	Handle Alpha ECOFF changes in OSF/1 3.2.
	* libecoff.h (struct ecoff_backend_data): Add get_elt_at_filepos
	field.
	* coff-alpha.c: Include "aout/ar.h".
	(alpha_ecoff_get_relocated_section_contents): Don't require an
	ALPHA_R_IGNORE reloc after an ALPHA_R_GPDISP reloc, since OSF/1
	3.2 doesn't generate one.
	(alpha_relocate_section): Likewise.
	(alpha_ecoff_slurp_armap): Define.
	(alpha_ecoff_slurp_extended_name_table): Define.
	(alpha_ecoff_construct_extended_name_table): Define.
	(alpha_ecoff_truncate_arname): Define.
	(alpha_ecoff_write_armap): Define.
	(alpha_ecoff_generic_stat_arch_elt): Define.
	(alpha_ecoff_update_armap_timestamp): Define.
	(ARFZMAG): Define.
	(alpha_ecoff_read_ar_hdr): New static function.
	(alpha_ecoff_get_elt_at_filepos): New static function.
	(alpha_ecoff_openr_next_archived_file): New static function.
	(alpha_ecoff_get_elt_at_index): New static function.
	(alpha_ecoff_backend_data): Initialize get_elt_at_filepos field.
	(ecoffalpha_little_vec): Change BFD_JUMP_TABLE_ARCHIVE from
	_bfd_ecoff to alpha_ecoff.
	* ecoff.c (ecoff_link_add_archive_symbols): Use get_elt_at_filepos
	field from backend structure, rather than always calling
	_bfd_get_elt_at_filepos.
	* coff-mips.c (mips_ecoff_backend_data): Initialize
	get_elt_at_filepos field.
	* archive.c (_bfd_generic_read_ar_hdr_mag): New function, copied
	from _bfd_generic_read_ar_hdr with minor changes.
	(_bfd_generic_read_ar_hdr): Use _bfd_generic_read_ar_hdr_mag.
	* libbfd-in.h (_bfd_generic_read_ar_hdr_mag): Declare.
	* libbfd.h: Rebuild.

	* bfd-in.h (BFD_IN_MEMORY): Define.
	* libbfd-in.h (struct bfd_in_memory): Define.
	* libbfd.c (bfd_read): Handle BFD_IN_MEMORY flag.
	(bfd_get_file_window): Don't try to map a BFD_IN_MEMORY file.
	(bfd_write, bfd_stat): Abort if BFD_IN_MEMORY is set.
	(bfd_tell, bfd_flush, bfd_seek): Handle BFD_IN_MEMORY flag.
	* bfd.c (struct _bfd): Change iostream field from char * to PTR.
	(bfd_get_size): Handle BFD_IN_MEMORY flag.
	* cache.c (bfd_cache_close): Ignore BFD_IN_MEMORY files.
	(bfd_open_file): Cast to PTR, not char *, when setting iostream.
	(bfd_cache_lookup_worker): Abort if BFD_IN_MEMORY is set.
	* opncls.c (bfd_fdopenr): Cast to PTR, not char *, when setting
	iostream.
	(bfd_openstreamr): Likewise.
	* aoutx.h (NAME(aout,some_aout_object_p)): Only fstat iostream if
	BFD_IN_MEMORY is not set.
	* riscix.c (riscix_some_aout_object_p): Likewise.
	* bfd-in2.h, libbfd.h: Rebuild.

	* targets.c (bfd_target): Add _bfd_get_elt_at_index field.
	(BFD_JUMP_TABLE_ARCHIVE): Add _get_elt_at_index.
	(bfd_get_elt_at_index): Define.
	* archive.c (_bfd_generic_get_elt_at_index): Rename from
	bfd_get_elt_at_index.  Change index parameter from int to
	symindex.
	* libbfd-in.h (_bfd_generic_get_elt_at_index): Declare.
	(_bfd_noarchive_get_elt_at_index): Define.
	(_bfd_archive_bsd_get_elt_at_index): Define.
	(_bfd_archive_coff_get_elt_at_index): Define.
	* bfd-in2.h, libbfd.h: Rebuild.
	* aout-target.h (MY_get_elt_at_index): Define if not defined.
	* coff-rs6000.c (xcoff_get_elt_at_index): Define.
	* ieee.c (ieee_get_elt_at_index): Define.
	* libecoff.h (_bfd_ecoff_get_elt_at_index): Define.
	* oasys.c (oasys_get_elt_at_index): Define.
	* som.c (som_get_elt_at_index): Define.
1996-01-09 20:40:39 +00:00
Niklas Hallqvist 34e9ffbccc Change PAGE_SIZE to TARGET_PAGE_SIZE 1995-10-28 00:26:12 +00:00
Ken Raeburn 2a01c351e3 NS32k changes from Ian Dall:
* aoutx.h (MY_final_link_relocate, MY_relocate_contents): New macros.
(aout_link_input_section_std, aout_link_input_section_ext,
aout_link_reloc_link_order): Call them instead of _bfd_* versions.
* aout-target.h (MY_exec_header_not_counted): New macro, defaults to zero.
(backend_data): Use it instead of hardcoded zero.

* aout-ns32k.c (CTOR_TABLE_RELOC_HOWTO): New macro.
(MY_swap_std_reloc_out): Use udata.i for KEEPIT, don't call stoi.

* ns32knetbsd.c: Include bfd.h.
(MY_text_includes_header, MY_bfd_reloc_type_lookup): New macros.
(MY_bfd_reloc_type_lookup): Declare function too.
* pc532-mach.c (set_sizes): Don't declare.
(MY_text_includes_header, MY_exec_header_not_counted): Define.
(backend_data, MY_backend_data): Don't define.

* config.bfd: Treat ns32k-pc532-ux* like ns32k-pc532-mach*, and ns32k-*-lites*
like ns32k-*-netbsd*.

* hosts/nbsd.h: Swap order of sys/vmparam.h and sys/param.h, to compile on
lites.
1995-10-04 20:25:21 +00:00
Ian Lance Taylor d7785845ff * aout-target.h (MY_bfd_copy_private_section_data): Only copy
subformat to another bfd_target_aout_flavour file.
1994-10-18 18:49:34 +00:00
Ian Lance Taylor a932d0ffb7 * aout-target.h (MY_zmagic_contiguous): Define as 0 if not already
defined.
	(MY(backend_data)): Use MY_zmagic_contiguous, not hardcoded 0.
	* i386linux.c (MY_zmagic_contiguous): Define.
1994-08-15 18:12:05 +00:00
Ian Lance Taylor aa91350c62 Comment change. 1994-06-20 15:30:56 +00:00
Ian Lance Taylor 785e2b52bc * aout-target.h (MY(callback)): Set the alignments of the text,
data and bss sections after determining the architecture.
1994-06-17 18:49:39 +00:00
Ian Lance Taylor f5419a5908 * libaout.h (struct aoutdata): Add q_magic_format to subformat
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-14 22:04:54 +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 4002f18a05 Made sure that every call to bfd_read, bfd_write, and bfd_seek
checks the return value and handled bfd_error correctly.  These
	changes are not itemised.
1994-04-04 22:49:04 +00:00
Ian Lance Taylor 5c8444f8f8 Add bfd_free_cached_info support to a.out backends.
* aoutx.h (aout_get_external_symbols): Renamed from
	aout_link_get_symbols.  Read strings even if symbols have been
	read.  Store string size in obj_aout_string_size.
	(NAME(aout,slurp_symbol_table)): Call aout_get_external_symbols to
	read the symbols.  Allocate the cached symbols with malloc, not
	bfd_alloc.
	(NAME(aout,slurp_reloc_table)): Allocate the cached relocs with
	malloc, not bfd_alloc.
	(NAME(aout,bfd_free_cached_info)): New function; free cached
	symbols and relocs.
	* libaout.h (struct aoutdata): Add external_string_size field.
	(obj_aout_external_string_size): New accessor macro.
	(NAME(aout,close_and_cleanup)): Don't declare.
	(NAME(aout,bfd_free_cached_info)): Declare.
	(aout_32_close_and_cleanup): Don't define.
	(aout_64_close_and_cleanup): Don't define.
	* aout-target.h (MY_bfd_free_cached_info): If not already defined,
	define as NAME(aout,free_cached_info).
	(MY_close_and_cleanup): If not already defined, define as
	MY_bfd_free_cached_info.
	* aout-adobe.c (aout_32_close_and_cleanup): Define.
	(aout_32_bfd_free_cached_info): Don't define.
	* bout.c (aout_32_close_and_cleanup): Define.
	(aout_32_bfd_free_cached_info): Don't define.
	* hp300hpux.c (MY_bfd_free_cached_info): Define as bfd_true.
	(MY_close_and_cleanup): Don't define.
	* i386lynx.c (NAME(lynx,slurp_reloc_table)): Allocate the cached
	relocs with malloc, not bfd_alloc.
	* i386os9k.c (aout_32_close_and_cleanup): Define.
	(aout_32_bfd_free_cached_info): Don't define.
1994-04-01 22:08:38 +00:00
Ian Lance Taylor 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
David MacKenzie 57a1867e6c * Most files:
Replace DEFUN and DEFUN_VOID with K&R-style function definition.
	Indent some of them to GNU standards.

	* aout32.c, archures.c, core.c, cpu-h8300.c, cpu-i960.c,
	cpu-m68k.c, cpu-m88k.c, cpu-mips.c, cpu-vax.c, ctor.c, demo64.c,
	elf32-hppa.h, gen-aout.c, host-aout.c, init.c, libhppa.h,
	libieee.h, liboasys.h, newsos3.c, som.h, stab-syms.c, sunos.c:
	Update copyright years.
1994-03-15 15:13:13 +00:00
Jim Kingdon 3f99570ec9 * aout-target.h, netbsd386.c: Replace NO_SWAP_MAGIC with SWAP_MAGIC,
and do the swapping here rather than calling ntohl from the N_*
	macros.  This cleans up assumptions about the size of a host long,
	the existence to ntohl, etc.
1994-01-03 16:16:01 +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
John Gilmore 1f29e30b1f * aout-target.h, aoutf1.h, trad-core.c, coffcode.h, libaout.h:
Eliminate all PROTO calls, replace with PARAMS for readability.

* aoutx.h:  Add type to callback parameter.
* coff-mips.c:  Don't call trad-core.h, not needed.
* trad-core.c:  Incorporate trad-core.h declarations.  Fix comments.
* trad-core.h:  Eliminate, unused.
1992-11-28 13:00:18 +00:00
Ken Raeburn 214f8f2392 * aout-target.h (callback): Don't define this function if it won't be used.
* aoutx.h (some_aout_object_p): Restore old aout_data value if this type
doesn't match.  Don't lose if file sections have already been created.
(set_arch_mach): Set reloc_entry_size.
(slurp_symbol_table): Use bfd_h_get_{16,8} for reaeding symbol data.

* hosts/i386bsd.h: New file.
* configure.in: Recognize i[34]86-*-bsd host.

* aout-target.h (callback, write_object_contents): Delete unused variables.

* aoutx.h (reloc_type_lookup): New function.
* aout-target.h (MY_reloc_howto_type_lookup): Use it as default.
* aoutf1.h (sunos4_reloc_type_lookup): Deleted.
(MY_reloc_howto_type_lookup): Don't define it.

* aoutx.h (adjust_sizes_and_vmas): Don't bother with padding for OMAGIC files.
(slurp_symbol_table): Use header byte order, not target byte order, for reading
symbol data.
1992-10-09 01:39:06 +00:00
Steve Chamberlain 294eaca479 Some of these are guesses, if you know different, just yell.
Thu Oct  8 08:52:48 1992  Steve Chamberlain  (sac@thepub.cygnus.com)

	 Now a bfd knows whether underscores are normally prepended
	 to symbols in its file format. Helps with error messages.

	* aout-adobe.c, aout-target.h, bout.c, coff-a29k.c, coff-h8300.c,
	coff-z8k.c: targets set so they have leading underscore
	* coff-i386.c, coff-i960.c, coff-m68k.c, coff-mips.c, coff-m88k.c,
	coff-rs6000.c, coff-we32k.c, elf.c, ieee.c, srec.c: targets set
	without leading underscore flag
	* targets.c: add symbol leading char to xvec description
	* bfd-in.h (bfd_get_symbol_leading_char): new macro.
1992-10-08 16:02:09 +00:00
Per Bothner 582bc90a63 * aout-target.h: Make _bfd_slurp_extended_name_table be
the default.  Given that we *write* the suckers (for long
	archive member names), we really ought to be able to read them!
	* trad-core.c:  Don't include <machine/reg.h>.  It doesn't
	seem to be needed, and many machines don't have it.
1992-08-15 02:27:58 +00:00
Steve Chamberlain e98e6ec111 Uses the new small reloc type now.
Currently self hosts on sun4 and sun3
1992-01-24 22:44:51 +00:00