Commit Graph

1054 Commits

Author SHA1 Message Date
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
Ian Lance Taylor
35fee729f2 * libaout.h (struct aout_link_hash_entry): New field written.
* 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-06 18:42:38 +00:00
Ian Lance Taylor
469984d1f6 * libecoff.h (ecoff_data_type): Add linker field.
* ecoff.c (ecoff_write_object_contents): Check new tdata linker
	field, rather than outsymbols being non-NULL, to decide whether to
	output the symbols and relocs.
	(ecoff_bfd_final_link): Set new tdata linker field to true.
1994-06-06 17:44:34 +00:00
Ian Lance Taylor
30f34d07c7 * ecoff.c (ecoff_bfd_copy_private_bfd_data): Don't try to copy
data to a non-ECOFF file.
1994-06-06 16:49:09 +00:00
Ian Lance Taylor
d8d67d6624 * libbfd-in.h: Add warning that libbfd.h is a generated file.
* libbfd.h: Rebuilt.
1994-06-06 14:59:20 +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
a04e14b672 * elf.c (_bfd_elf_make_section_from_shdr): Only set SEC_DATA if
SEC_LOAD is set, rather than checking SEC_ALLOC.
1994-06-05 19:04:50 +00:00
Ian Lance Taylor
8a7aea07b2 Remove a couple of myteriously duplicated entries. 1994-06-05 18:43:42 +00:00
Jeff Law
99fa551078 * som.c (som_write_object_contents): Don't compute the file header's
checksum here.
	(som_write_headers): Instead do it here.
1994-06-03 18:14:59 +00:00
Jeff Law
4ee3b9beb1 * libbfd.h (bfd_realloc): Change last arg to "size_t size". 1994-06-03 17:01:17 +00:00
Ian Lance Taylor
2855b89fe2 * hosts/sun3.h: Include <stdlib.h>. Don't declare free, exit or
getenv.
1994-06-02 22:39:31 +00:00
Ian Lance Taylor
e85e8bfe62 Add linker support for SunOS shared libraries.
* 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-06-02 22:07:27 +00:00
Ian Lance Taylor
220642fd47 * hosts/sun3.h: Don't declare qsort, malloc or realloc. 1994-06-01 18:39:43 +00:00
Ken Raeburn
c06e55d99a changes from gas-2.3/binutils-2.4 dist (details in branch log msgs, changelogs) 1994-05-27 16:58:05 +00:00
Jeff Law
ada45a2a82 * som.c (som_prep_headers): Do not set the system_id here, private
bfd data has not been copied yet.
	(som_write_headers): Instead do it here.
1994-05-26 16:13:47 +00:00
Ian Lance Taylor
5315c42827 Make MIPS ELF use new ELF backend linker. No shared library
support yet.
	* elf32-mips.c (bfd_mips_elf32_swap_gptab_in): New function.
	(bfd_mips_elf32_swap_gptab_out): New function.
	(mips_elf_object_p): If last symbol is LOCAL, set elf_bad_symtab.
	(mips_elf_final_write_processing): Set sh_info field for .gptab.*
	sections.
	(mips_elf_fake_sections): Set sh_entsize for .gptab.* sections.
	(mips_elf_read_ecoff_info): Read and free external symbols last,
	not first, for clarity.
	(struct mips_elf_link_hash_entry): Define new structure.
	(struct mips_elf_link_hash_table): Define new structure.
	(mips_elf_link_hash_lookup): Define new macro.
	(mips_elf_link_hash_traverse): Define new macro.
	(mips_elf_hash_table): Define new macro.
	(mips_elf_link_hash_newfunc): New static function.
	(mips_elf_link_hash_table_create): New static function.
	(mips_elf_add_symbol_hook): New static function.
	(struct extsym_info): Define new structure.
	(mips_elf_get_extr, mips_elf_set_index): Remove.
	(mips_elf_output_extsym): New static function.
	(gptab_compare): New static function.
	(mips_elf_final_link): Rewrite to use ELF backend linker, and to
	merge gptab information in input files.
	(mips_elf_relocate_hi16): New static function.
	(mips_elf_relocate_section): New static function.
	(bfd_elf32_bfd_link_hash_table_create): Define as macro before
	including elf32-target.h.
	(elf_backend_relocate_section): Likewise.
	(elf_backend_add_symbol_hook): Likewise.
	* elf.c (_bfd_elf_link_hash_newfunc): Rename from
	elf_link_hash_newfunc and make globally visible.  Change caller.
	(_bfd_elf_link_hash_table_init): New function, broken out of
	_bfd_elf_link_hash_table_create.
	(_bfd_elf_link_hash_table_create): Use
	_bfd_elf_link_hash_table_init.
	* libelf.h (struct elf_obj_tdata): Add new field bad_symtab.
	(elf_bad_symtab): Define new accessor macro.
	(_bfd_elf_link_hash_newfunc): Declare.
	(_bew_elf_link_hash_table_init): Declare.
	* elfcode.h (elf_object_p): Call backend object_p hook after
	swapping in all the section headers.
	(map_program_segments): Correct typo: Internal for External.
	(elf_link_add_object_symbols): If elf_bad_symtab is set, read all
	the symbols.  Skip STB_LOCAL symbols rather than giving an error.
	(elf_bfd_final_link): If elf_bad_symtab is set, allocate space for
	all symbols, not just locals.
	(elf_link_output_extsym): Only skip a symbol not mentioned by a
	regular file if it is mentioned by a dynamic object.
	(elf_link_input_bfd): If elf_bad_symtab is set, read all the
	symbols.
1994-05-24 20:44:50 +00:00
Ian Lance Taylor
c8588f2f74 * coff-mips.c (mips_relocate_section): Add MIPS_R_JMPADDR overflow
checking.
1994-05-20 20:17:50 +00:00
Jeff Law
88bbe402bb * som.c (som_set_reloc_info): Do not set any relocation info
for SOM fixups which are never passed to BFD.
1994-05-20 19:43:18 +00:00
Ian Lance Taylor
7ce8b9d18d Removed sanitization of PowerPC NetWare. Also rebuilt Makefile
dependencies.
1994-05-20 18:22:45 +00:00
Ian Lance Taylor
95b77361ab * elf32-i386.c (elf_i386_size_dynamic_sections): Add DT_DEBUG to
the dynamic linking information for the benefit of the debugger.
	From Peter Schauer.
	* elf32-sparc.c (elf32_sparc_size_dynamic_sections): Likewise.
1994-05-20 16:14:35 +00:00
Ian Lance Taylor
497c543457 * elf.c (_bfd_elf_make_section_from_shdr): New function, based on
code repeated three times in bfd_section_from_shdr in elfcode.h.
	* libelf.h (_bfd_elf_make_section_from_shdr): Declare.
	* elfcode.h (bfd_section_from_shdr): Use new function
	_bfd_elf_make_section_from_shdr to create BFD sections.  If a
	reloc section does not use the main symbol table, or it is part of
	the process image, treat it as a normal section, not relocs.
	* elf32-mips.c (mips_elf_section_from_shdr): Use new function
	_bfd_elf_make_section_from_shdr.
1994-05-20 16:04:59 +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
82492ca110 * som.c: Don't include <sys/dir.h> or <sys/user.h>.
(som_reloc_queue_find): Call memcmp instead of bcmp.
	(som_bfd_reloc_type_lookup): Change first argument to bfd *.
	(compare_syms): Change types of arguments to const void *.
	(bfd_section_from_som_symbol): Removed unused local found.
	(som_write_armap): Add elength, map, orl_count and int arguments.
	(som_write_armap): Use %ld and cast to long for getuid result.
1994-05-18 15:32:15 +00:00
Jeff Law
673acecaa5 * elf32-hppa.h (R_HPPA_ABS_CALL): Define.
* elf32-hppa.c (hppa_elf_gen_reloc_type): Handle absolute calls.

	* som.h (R_HPPA_ABS_CALL): Define.
	* som.c (hppa_som_gen_reloc_type): Delete complex relocation types.
1994-05-18 15:13:27 +00:00
Ken Raeburn
0f62bdc03b * coff-i960.c (icoff_little_vec, icoff_big_vec): Indicate leading underscore,
for compatibility with Intel tool chain (gnu960v2).
1994-05-17 23:43:48 +00:00
Jeff Law
459ae909b9 * bfd-in2.h: Rebuilt.
* elf32-hppa.c: Change .hppa_linker_stubs to .PARISC.stubs,
	likewise for other PA specific sections.
	(hppa_elf_relocate_unwind_table): Delete unused
	function.
	(elf_hppa_howto_table): Completely new table based on 94-02-02
	draft PA ELF spec.  Change relocation tags appropriately
	throughout elf32-hppa.c
	(hppa_elf_gen_reloc_type): Rewrite and simplify based on 94-02-02
	spec.
	(hppa_elf_reloc): Likewise.
	(hppa_look_for_stubs_in_section): Likewise
	(ELF_MACHINE_CODE): Change to EM_PARISC.
	* elf32-hppa.h: Include "elf/hppa.h".  Change relocation tags
	appropriately throughout elf32-hppa.h.
	(elf32_hppa_reloc_type): New table based on 94-02-02 draft PA ELF
	spec.
	(R_HPPA_ABS_CALL, R_HPPA_COMPLEX*, R_HPPA_UNWIND): Delete definitions.
	* elfcode.h (prep_headers): Use EM_PARISC instead of EM_HPPA.
	* reloc.c (bfd_reloc_code_real): Delete unused HPPA relocations.
	* som.h (R_HPPA_ABS_CALL, R_HPPA_COMPLEX): Delete definitions.

	* libhppa.h (hppa_field_adjust): Avoid adding constant_value into
	the final value twice for LR and RR field selectors.
1994-05-16 19:34:13 +00:00
Jeff Law
c3cb04b440 * libhppa.h (hppa_field_adjust): Avoid adding constant_value into
the final value twice for LR and RR field selectors.
1994-05-16 16:13:34 +00:00
Jim Kingdon
cb9461ffc2 * aoutx.h (add_to_stringtab): Use BFD_ASSERT not assert. This
avoids __eprintf troubles.
1994-05-14 16:19:58 +00:00
Ian Lance Taylor
0d898d0338 * bout.c (b_out_bfd_reloc_type_lookup): Handle BFD_RELOC_CTOR. 1994-05-14 03:16:13 +00:00
Ian Lance Taylor
55a90acef6 Rewrite history. 1994-05-13 18:51:52 +00:00
Jim Kingdon
1bbf43eec5 Fix typo in last entry 1994-05-13 18:47:34 +00:00
Bill Cox
f3e72e3771 * Makefile.in (sysdep.h): Copy Ian's version of this from
progressive/bfd/Makefile.in.
1994-05-13 18:15:46 +00:00
Bill Cox
f666bb79ca * Makefile.in (stmp-bfd.h): Add an 'if' to mask a harmless
grep error.  Already in progressive/bfd/Makefile.in.
1994-05-13 17:52:46 +00:00
Ian Lance Taylor
8db528c845 * config/mipsbelf.mt (SELECT_VECS): Add ecoff_big_vec and
ecoff_little_vec since Irix 5 supports ECOFF executables.
1994-05-13 14:53:07 +00:00
Jim Kingdon
291c622da4 Remove CVS conflict markers from file 1994-05-12 18:13:17 +00:00
Ian Lance Taylor
4fa4476bf8 * ecoff.c (ecoff_find_nearest_line): Handle fdr.adr != pdr.adr
correctly.
1994-05-11 16:46:04 +00:00
Ian Lance Taylor
666f5925d2 * Makefile.in (stmp-bfd.h): Use || instead of ; to force SunOS
make to invoke the shell.
1994-05-11 04:32:52 +00:00
Ian Lance Taylor
c16313f06c * section.c (SEC_COFF_SHARED_LIBRARY): Renamed from
SEC_SHARED_LIBRARY for clarity.  Changed all uses.
	* bfd-in2.h: Rebuilt.
	* coffcode.h (sec_to_styp_flags): If SEC_COFF_SHARED_LIBRARY is
	set, set STYP_NOLOAD.
	* coffgen.c (coff_section_from_bfd_index): Don't get an assertion
	failure because of a bad shared library.
1994-05-10 18:29:19 +00:00
Bill Cox
eeb8c1873a * linker.c: Add missing comment terminator. 1994-05-10 01:58:35 +00:00
Ian Lance Taylor
8e5090ce3a * linker.c (_bfd_generic_link_add_one_symbol): If hashp and *hashp
are not NULL, assume the caller has already looked up the symbol
	in the hash table and has stored the entry in *hashp.
	(generic_link_add_symbol_list): Set h to NULL before calling
	_bfd_generic_link_add_one_symbol.
	* ecoff.c (ecoff_link_add_externals): Likewise.
1994-05-09 23:22:00 +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
Steve Chamberlain
d66da74230 * config/go32.mh: XX support.
From bill
	* Makefile.in: Build sysdep.h without causing worrying but
	harmless error message.
1994-05-06 18:53:44 +00:00
Ian Lance Taylor
973bfc476b * nlmcode.h (nlm_swap_auxiliary_headers_in): Rework custom header
handling for latest suggested format.
	(nlm_swap_auxiliary_headers_out): Likewise.
	(nlm_compute_section_file_positions): Likewise.
1994-05-06 17:37:39 +00:00
Ian Lance Taylor
77d1128466 For PR 1927.
Changed m68k-aout to set flags to 0; m68k-sunos still uses 1.
	* aout0.c: New file.
	* targets.c (aout0_big_vec): Declare.
	(bfd_target_vector): Add aout0_big_vec.
	* config.bfd (m68*-*-aout*): Use m68k-0aout, not m68k-aout.
	* config/m68k-aout.mt (SELECT_VECS): Removed.
	* config/m68k-0aout.mt: New file.
	* configure.in (aout0_big_vec): New target vector: use aout0.o,
	aout32.o and stab-syms.o.
	* Makefile.in: Rebuilt dependencies.
	(BFD32_BACKENDS): Add aout0.o.
	(CFILES): Add aout0.c.

	* libaout.h (struct aout_backend_data): Add field exec_hdr_flags.
	* aout-target.h (MY_exec_hdr_flags): If not defined, define as 0.
	MY(backend_data): Initialize exec_hdr_flags field.
	* aoutf1.h (sunos_32_set_arch_mach): Make static.
	(aout32_sunos4_write_object_contents): Set flags from backend
	info.
	(MY_exec_hdr_flags): If not defined, define as 1.
	(sunos4_aout_backend): Initialize exec_hdr_flags field.
	* aout-encap.c (encap_write_object_contents): Set flags from
	backend info.
	(MY_exec_hdr_flags): Define as N_FLAGS_COFF_ENCAPSULATE.
	* hp300hpux.c (MY_exec_hdr_flags): Define as 0x2.
	(MY(write_object_contents)): Set flags from backend info.
	* i386aout.c (MY(backend_data)): Initialize exec_hdr_flags field.
	* i386mach3.c (MY(backend_data)): Likewise.
	* mipsbsd.c (MY(backend_data)): Likewise.
	* sparclynx.c (NAME(aout,sparclynx_write_object_contents)): Set
	flags from backend info.
	(sparclynx_aout_backend): Initialize exec_hdr_flags field.
1994-05-04 19:37:36 +00:00
Ken Raeburn
127f8e91ee * config.bfd (i386-*-gnu*): Treat like i386-*-mach*.
(m68*-apollo-*): Treat all Apollo configs the same, don't handle BSD specially.
1994-05-04 17:31:36 +00:00
Ian Lance Taylor
92400edbcd * cache.c: Rewrote to work correctly.
* libbfd.h: Rebuilt.
	* opncls.c (bfd_cache_init, bfd_open_file): Don't declare.
	(bfd_fdopenr): Check return value of bfd_cache_init.
1994-05-03 23:58:06 +00:00