Commit Graph

1100 Commits

Author SHA1 Message Date
Stan Shebs 11676adc14 Mach 3 support.
* 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-07-05 21:50:43 +00:00
Ian Lance Taylor 71edd06df7 * elfcode.h (swap_out_syms): Get alignment of common symbol from
st_value field of saved ELF symbol information, if there is any.
1994-07-05 18:05:03 +00:00
Jeff Law edf7c1e4fe * som.h (R_HPPA_COMPLEX): Define.
* elf32-hppa.h (R_HPPA_COMPLEX): Define.
	(elf32_hppa_reloc_type): Delete R_PARISC_STUB_CALL_17.
1994-07-05 01:19:31 +00:00
Steve Chamberlain eeaed1957a * section.c (bfd_get_section_contents): Put in parens to get
precedence right.
1994-06-28 01:09:50 +00:00
Peter Schauer 5e16521ab7 Add Solaris BCP (the part of Solaris which allows it to run
SunOS4 a.out files) core file handling.
	* aoutf1.h (external_solaris_bcp_core, swapcore_solaris_bcp):
	New structure and its swap in function.
	(internal_sunos_core):  New member c_data_addr, to receive the
	start address of the data section in the core file.
	(swapcore_sun3, swapcore_sparc, sunos4_core_file_p):  Use it.
	(sunos4_core_file_p):  Recognize Solaris BCP core file.
	(sunos4_core_file_matches_executable_p):  Always indicate match
	for Solaris BCP core files.
1994-06-24 16:18:35 +00:00
Ian Lance Taylor 8af74670df Preliminary support for generating shared libraries, from Eric
Youngdale <ericy@cais.cais.com>.
	* elfcode.h (prep_headers): If DYNAMIC, set e_type to ET_DYN.
	(elf_link_add_object_symbols): If generating a shared library,
	create dynamic sections for first input BFD with the right format.
	(elf_link_create_dynamic_sections): Don't create .interp section
	if creating a shared library.
	(elf_link_input_bfd): Skip dynamic sections in input file.
	(elf_bfd_final_link): If creating a shared library, it's OK for
	dynobj to have sections which are not SEC_IN_MEMORY.
	* elf32-i386.c (elf_i386_size_dynamic_sections): Only set .interp
	section if not creating a shared library.
	* elf32-sparc.c (elf_sparc_size_dynamic_sections): Likewise.
1994-06-23 21:36:03 +00:00
Ian Lance Taylor 51fc377bab * elfcode.h (elf_object_p): Don't set DYNAMIC just because there
is an SHT_DYNAMIC section.
1994-06-23 20:14:58 +00:00
David MacKenzie 1f8b3b5746 Change --with-targets to --enable-targets, per GNU coding standards. 1994-06-23 20:08:57 +00:00
Ian Lance Taylor 135a68152c * linker.c (_bfd_generic_link_add_archive_symbols): Initialize
pass from abfd->archive_pass, and save it there as well.
1994-06-23 00:36:38 +00:00
Ken Raeburn 2e66a62730 linker.c (FAIL): Undefine macro before defining as enum. 1994-06-23 00:10:06 +00:00
Ken Raeburn 3bf36e67e2 config.bfd (powerpc-*-elf*): New target, like powerpc-*-sysv4*. 1994-06-22 23:40:17 +00:00
Ian Lance Taylor a537cb21bb * hash.c (bfd_hash_allocate): Don't call bfd_set_error if
obstack_alloc returns NULL unless the size is non-zero.

	* linker.c (archive_hash_allocate): Define.
	(_bfd_generic_link_add_archive_symbols): Use archive_hash_allocate
	rather than obstack_alloc, for clarity.
1994-06-22 22:37:54 +00:00
Ian Lance Taylor 66f2c66f93 * elfcode.h (elf_get_reloc_upper_bound): Correct. 1994-06-22 20:00:05 +00:00
Ian Lance Taylor d81843e864 * aout64.c (BMAGIC, QMAGIC): Define if not already defined. From
Peter Schauer <pes@regent.e-technik.tu-muenchen.de>.
1994-06-22 19:38:57 +00:00
Ian Lance Taylor 0630aba528 Linux ZMAGIC support from Eric Youngdale <ericy@cais.cais.com>.
* 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 19:13:55 +00:00
Ian Lance Taylor 4587b57831 * aoutx.h (aout_link_check_ar_symbols): Just skip N_STAB and N_FN
symbols; don't look them up in the hash table.  From
        ralphc@pyramid.com (Ralph Campbell).
1994-06-22 14:55:58 +00:00
Ian Lance Taylor badd23e323 * section.c (bfd_abs_section): Make const.
(bfd_abs_section_ptr, bfd_is_abs_section): Define.
	(bfd_und_section): Make const.
	(bfd_und_section_ptr, bfd_is_und_section): Define.
	(bfd_com_section): Make const.
	(bfd_com_section_ptr): Define.
	(bfd_ind_section): Make const.
	(bfd_ind_section_ptr, bfd_is_ind_section): Define.
	(bfd_abs_symbol, bfd_com_symbol): Make const.
	(bfd_und_symbol, bfd_ind_symbol): Likewise.
	(global_syms): Cast initialization of section field.
	(STD_SECTION): Define as const, and cast initializations.
	* bfd-in2.h: Rebuilt.
	* Many files: Change uses of bfd_abs_section, etc., to use
	bfd_abs_section_ptr or bfd_is_abs_section, etc.
1994-06-21 16:47:07 +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 75f3ef7a63 * ecoff.c, libecoff.h, ecoffswap.h, coff-alpha.c, coff-mips.c,
elf32-mips.c: Renamed all externally visible ECOFF routines which
	are local to BFD to start with _bfd_ecoff instead of just ecoff.
1994-06-20 19:39:15 +00:00
Ian Lance Taylor aac6b32f31 * ecoff.c (ecoff_swap_tir_in): Change input argument to const.
(ecoff_swap_tir_out): Likewise.
	(ecoff_swap_rndx_in, ecoff_swap_rndx_out): Likewise.
	(ecoff_slurp_symbolic_info): Add new arguments to correspond to
	read_debug_info entry point in ecoff_debug_swap structure.
	Change all calls.
	* libecoff.h (ecoff_slurp_symbolic_info): Change declaration.
	* ecoffswap.h (ecoff_swap_tir_in, ecoff_swap_tir_out): Declare.
	(ecoff_swap_rndx_in, ecoff_swap_rndx_out): Declare.
	* coff-alpha.c (alpha_ecoff_backend_data): Initialize new
	ecoff_debug_swap fields.
	* coff-mips.c (mips_ecoff_backend_data): Likewise.
	* elf32-mips.c (mips_elf_read_ecoff_info): Undefine READ.
	(mips_elf_ecoff_debug_swap): Initialize new ecoff_debug_swap
	fields.
	* configure.in (bfd_elf32_bigmips_vec): Use ecoff.o and
	ecofflink.o.
	(bfd_elf32_littlemips_vec): Likewise.
	(ecoff_big_vec, ecoff_little_vec): Likewise.
	(ecoffalpha_little_vec): Likewise.
	* Makefile.in (BFD_LIBS): Remove ecoff.o and ecofflink.o.
	(BFD32_BACKENDS): Add ecoff.o and ecofflink.o.
1994-06-20 18:26:55 +00:00
Ian Lance Taylor 6c8fa8e62c * aoutx.h (NAME(aout,final_link)): Check flavour of sub, not abfd,
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-20 15:51:28 +00:00
Ian Lance Taylor 6fea065949 * mipsbsd.c (MY_final_link_callback): Define to avoid warning. 1994-06-20 15:25:58 +00:00
Ian Lance Taylor 263a3f176a * hp300hpux.c (MY_final_link_callback): Define to avoid warning.
(BMAGIC, QMAGIC): Define; used by aoutx.h.
	(MY(slurp_symbol_table)): Change translate_from_native_sym_flags
	calls to use new parameters.
1994-06-20 15:11:34 +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
Jeff Law 9fefc1befc * libhppa.h (bfd_hppa_insn2fmt, hppa_rebuild_insn): Make INLINE. 1994-06-17 18:11:17 +00:00
Jeff Law 83b69190b3 * elf32-hppa.h (elf_hppa_final_processing): Delete decl. 1994-06-17 17:18:25 +00:00
Jeff Law c46b8ed7e6 * elfcode.h (elf_link_input_bfd): Don't try to read local symbols
if there aren't any in the input file.
1994-06-17 05:39:55 +00:00
Ian Lance Taylor e3400040fa * config.bfd: If second argument is ``_'', then, instead of
echoing config file name, echo whether target uses leading
	underscores on symbol names.  Add appropriate settings to
	different cases.  Used by binutils/configure.in to set default for
	c++filt.
1994-06-16 21:58:48 +00:00
Ian Lance Taylor 0ff5d3a69a * elfcode.h (elf_bfd_final_link): If trying to generate a shared
object, warn and return false.
1994-06-16 19:30:49 +00:00
Ian Lance Taylor 04003b573d Thu Jun 16 14:25:22 1994 Eric Youngdale (ericy@cais.cais.com)
* i386linux.c: Many new functions and definitions for linker
	support for Linux shared libraries.
	* bfd-in.h (bfd_linux_size_dynamic_sections): Declare.
	* bfd-in2.h: Rebuild.
1994-06-16 18:29:21 +00:00
Ian Lance Taylor c1f84521bf * libelf.h (struct elf_obj_tdata): New field dt_needed_name.
(elf_dt_needed_name): New accessor macro.
	* elfcode.h (elf_link_add_object_symbols): If elf_dt_needed_name
	is set, use that instead of the filename for the DT_NEEDED dynamic
	entry.
	* elf.c (bfd_elf_set_dt_needed_name): New function.
	* bfd-in.h (bfd_elf_set_dt_needed_name): Declare.
	* bfd-in2.h: Rebuilt.
1994-06-16 00:01:32 +00:00
Ken Raeburn 485dc654e2 comment on v9 stuff 1994-06-15 23:27:54 +00:00
Ian Lance Taylor 7c726b6625 * elfcode.h (NAME(bfd_elf,size_dynamic_sections)): Add sinterpptr
argument, and set it to the .interp section.
	* bfd-in.h (bfd_elf32_size_dynamic_sections): Update prototype.
	(bfd_elf64_size_dynamic_sections): Likewise.
	* bfd-in2.h: Rebuilt.
1994-06-15 19:58:59 +00:00
Ian Lance Taylor f1d42c0476 * coff-sparc.c (SWAP_OUT_RELOC_EXTRA): Define to clear the r_spare
field of the reloc rather than letting it be garbage.
1994-06-15 19:54:15 +00:00
Ian Lance Taylor aeef32f01c * archive.c (bfd_slurp_armap): Recognize __.SYMDEF/ as well as
__.SYMDEF; the former was used in old Linux archives.  From
	jrs@world.std.com (Rick Sladkey).
1994-06-15 17:22:41 +00:00
Ian Lance Taylor f7d2fa4455 * i386linux.c (i386linux_write_object_contents): Define; like
MY(write_object_contents) in aout-target.h, but set MACHTYPE to
	M_386.  From jrs@world.std.com (Rick Sladkey).
	(MY_write_object_contents): Define.
1994-06-15 17:15:03 +00:00
Ian Lance Taylor 2cd086e387 * aoutx.h (translate_from_native_sym_flags): Treat N_SETV symbols
as N_DATA symbols.
	(aout_link_add_symbols): Likewise.
1994-06-15 15:29:44 +00:00
Ian Lance Taylor d17fc4c990 * aoutx.h: Rewrite symbol duplicate elimination to use BFD hash
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-15 05:48:14 +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 ac9ed09667 For PR 4865.
* libecoff.h (struct ecoff_link_hash_entry): Change type of
	written from boolean to char.  Add new field small.
	* ecoff.c (ecoff_link_hash_newfunc): Initialize written to 0
	rather than false.  Initialize small to 0.
	(ecoff_link_add_externals): If ECOFF type is scSUndefined, set
	small.  If small is set, and hash table type is common, force the
	symbol into a section named SCOMMON and change the ECOFF type from
	scCommon to scSCommon.
	(ecoff_link_write_external): Set written to 1 rather than true.
	* coff-mips.c (mips_relocate_section): Correct JMPADDR reloc
	overflow check to consider section VMA of input file.
1994-06-14 17:06:08 +00:00
Ian Lance Taylor 9ae74960a8 * aoutf1.h (aout_32_sunos4_write_object_contents): Handle a
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-13 18:25:12 +00:00
Jeff Law 8117e1ea9a * som.c (EXEC_AUX_ID): Define based on availablity of HPUX_AUX_ID
or HIUX_AUX_ID.
	(som_begin_writing): Use EXEC_AUX_ID instead of HPUX_AUX_ID.
	(som_write_armap): Use CPU_PA_RISC1_0 as the magic number.  Note
	som.c is careful to always define CPU_PA_RISC1_0.
1994-06-13 02:31:43 +00:00
Ian Lance Taylor 4298e311fe Add weak symbols as an extension to a.out.
* 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-11 20:40:59 +00:00
Ian Lance Taylor 4f019d0445 * aoutx.h (NAME(aout,canonicalize_reloc)): Handle .bss section.
(NAME(aout,get_reloc_upper_bound)): Likewise.
1994-06-10 19:00:28 +00:00
Ian Lance Taylor 22aabad533 * coff-i960.c (coff_i960_reloc_type_lookup): Add BFD_RELOC_CTOR.
* linker.c (_bfd_generic_link_write_global_symbol): Don't assume
	the section of a common symbol is not NULL.
1994-06-10 17:27:22 +00:00
Ian Lance Taylor 1b88cd182c * aoutx.h (aout_get_external_symbols): Don't try to read the
strings if there are no symbols.
	(aout_link_write_other_symbol): Use the output section when
	working out the type.
1994-06-09 03:59:22 +00:00
Ian Lance Taylor b9ac0a53fd * elfcode.h (assign_section_numbers): Put shstrtab, symtab and
strtab sections at end of file.  Avoids bug in some versions of
	SVR4 strip.  From Eric Youngdale <eric@tantalus.nrl.navy.mil>.
1994-06-07 20:20:05 +00:00
Ian Lance Taylor d38eee518f * coffcode.h (styp_to_sec_flags): If COFF_PAGE_SIZE is defined,
set SEC_DEBUGGING for STYP_INFO sections.
	(coff_compute_section_file_positions): If COFF_PAGE_SIZE is
	defined, and D_PAGED is set, set the file position equal to the
	section VMA modulo COFF_PAGE_SIZE.
	* coffgen.c (coff_real_object_p): If F_EXEC is set, set D_PAGED.
	* coff-i386.c: Set D_PAGED in BFD target.
	(COFF_PAGE_SIZE): Define.
	* coff-m68k.c, coff-sparc.c: Likewise.
1994-06-07 17:48:00 +00:00
Ian Lance Taylor e6667b2bc3 * elfcode.h (bfd_section_from_shdr): Don't turn a reloc section
into a BFD section just because SHF_ALLOC is set; require that it
	not use the normal symbol table.
	(elf_section_from_bfd_section): Corresponding change.
1994-06-06 23:59:27 +00:00
Ian Lance Taylor 118e8d1c7d Better indirect and warning symbol handling inspired by Stuart
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 21:54:54 +00:00