Commit graph

1916 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
f88c900883 Comment change. 1994-06-06 22:31:58 +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
2944131cd2 * libbfd-in.h (bfd_realloc): Change last arg to "size_t size".
(Move libbfd.h change over to source file).
1994-06-05 19:03:08 +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
cd779d0139 Get the address of Sun3 dynamic relocs right. 1994-06-02 23:51:26 +00:00
Ian Lance Taylor
a1ade84e47 Add casts to pacify SunOS linker. 1994-06-02 22:44:54 +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
6731b89c4b Make map_program_segments tend to call abort rather than trash the
stack in unhandled cases.  Still covered by previous ChangeLog entry.
1994-05-19 21:58:45 +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
85579659a5 Fix typo in last check-in. 1994-05-16 16:35:36 +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
Ian Lance Taylor
420e63c685 Typo. 1994-05-10 02:04:58 +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
Ian Lance Taylor
e3361fc35c * cf-m68klynx.c (CALC_ADDEND): Check for PC relative relocs by
enumerating them, since the reloc type can not serve as an index
	into the m68k COFF howto_table.
1994-04-29 19:09:51 +00:00
Steve Chamberlain
dbf13547b7 * config.bfd (*-go32): Changed to coff.
* coff-h8300.c (JMPL1): Get HOWTO right for 24bit branches.
	* srec.c (srec_write_symbols): Write out the correct number of
	symbols and don't stick in extra nulls.
1994-04-29 16:48:25 +00:00
Steve Chamberlain
7c6ba20141 * coff-h8300.c (JMPL1): Get HOWTO right for 24bit branches. 1994-04-29 16:44:48 +00:00
Stan Shebs
380c60b19a Tue Apr 26 15:07:24 1994 Stan Shebs (shebs@andros.cygnus.com)
* cf-sparclynx.c (LYNXOS, COFF_LONG_FILENAMES): Define.
	* coff-sparc.c (BADMAG): Recognize LYNXCOFFMAGIC.
	(COFF_SPARC): Define.
	* coffcode.h (coff_new_section_hook): If COFF_SPARC, set alignment
	power of data and bss sections to 3.
	* hosts/lynx.h (__LYNXOS): Define.

Brought over from 94Q1.
1994-04-26 22:10:10 +00:00
Jeff Law
6c101bcf78 * elf32-hppa.c (hppa_elf_reloc): Adjust the addend of relocations
against section symbols to avoid losing during ld -r.
1994-04-26 22:06:13 +00:00
Ian Lance Taylor
ba436e33cd * elfcode.h (write_relocs): Undo patch of Apr 10; breaks Solaris. 1994-04-25 19:52:15 +00:00
Ian Lance Taylor
2e03ce1861 * elfcode.h (bfd_section_from_shdr): Use bfd_make_section_anyway
to create sections.  Check return value of recursive calls.
	(bfd_section_from_phdr): Check return value of bfd_make_section.
	(elf_symbol_from_bfd_symbol): Likewise.
	(elf_object_p): Check return value of bfd_section_from_shdr.
	(section_from_elf_index): Likewise.
	(elf_slurp_symbol_table): Check return value of
	section_from_elf_index.
	(bfd_prstatus): Return boolean value.  Check return value of
	bfd_make_section.
	(bfd_fpregset): Likewise.
	(bfd_prpsinfo): Return boolean value.
	(elf_corefile_note): Check return values of bfd_prstatus,
	bfd_fpregset, and bfd_prpsinfo.
	(elf_core_file_p): Check return value of elf_corefile_note.
1994-04-25 19:36:51 +00:00
Ian Lance Taylor
cc71e155b6 Get rid of the ECOFF .reginfo section hack.
* ecoff.c (ecoff_mkobject_hook): Don't create a .reginfo section.
	(ecoff_new_section_hook): Don't handle the .reginfo section.
	(ecoff_sizeof_headers): Likewise.
	(ecoff_get_section_contents): Likewise.
	(ecoff_compute_section_file_positions): Likewise.
	(ecoff_compute_reloc_file_positions): Likewise.
	(ecoff_set_section_contents): Likewise.
	(ecoff_write_object_contents): Likewise.
	(ecoff_bfd_final_link): Likewise.
	(ecoff_bfd_copy_private_bfd_data): Copy the GP value and the
	register masks.
	(bfd_ecoff_get_gp_value): New function.
	(bfd_ecoff_set_gp_value): New function.
	(bfd_ecoff_set_regmasks): New function.
	* bfd-in.h (bfd_ecoff_get_gp_value): Declare.
	(bfd_ecoff_set_gp_value): Declare.
	(bfd_ecoff_set_regmasks): Declare.
	* bfd-in2.h: Rebuilt.
1994-04-22 22:09:25 +00:00
Ian Lance Taylor
1bb42b1f2b Fix ECOFF objcopy to actually copy debugging information.
* ecoff.c (ecoff_bfd_copy_private_bfd_data): New function.
	(ecoff_get_extr): Assume that any ECOFF symbol with local clear is
	an external symbol, rather than checking the symbol flags.  Only
	check the flags for non-ECOFF symbols.
	* ecofflink.c (bfd_ecoff_debug_externals): Don't crash if the
	output_section field of the symbol section is NULL.
	* libecoff.h (ecoff_bfd_copy_private_bfd_data): Declare as
	function rather than defining as macro.
1994-04-22 20:32:51 +00:00
Ian Lance Taylor
d290d8da0e * targets.c (bfd_target_vector): Add bfd_elf32_powerpc_vec. 1994-04-22 17:38:20 +00:00
Ian Lance Taylor
80a903c960 * aout-adobe.c (aout_adobe_set_arch_mach): Check return value of
bfd_default_set_arch_mach.  Accept bfd_arch_m68k as well as
	bfd_arch_unknown.
	* elfcode.h (elf_set_arch_mach): Don't check a list of ELF
	architectures, just see if the desired architecture matches what
	the ELF backend permits.
1994-04-22 17:11:37 +00:00
Ian Lance Taylor
79167def08 Follow convention in which each NLM header has an 8 byte stamp
followed by a four byte length.
	* libnlm.h (struct nlm_obj_tdata): Rename nlm_cygnus_section_hdr
	to nlm_cygnus_ext_header, and change type to
	Nlm_Internal_Cygnus_Ext_Header.
	(nlm_cygnus_ext_header): Rename from nlm_cygnus_section_header.
	* nlmcode.h (nlm_swap_auxiliary_headers_in): Use CyGnUsEx instead
	of CyGnUsSeCs.  Rename from cygnus_section to cygnus_ext.  Require
	length word to be 8.
	(nlm_swap_auxiliary_headers_out): Rename from cygnus_section to
	cygnus_ext.  Set length word to 8.
	(nlm_compute_section_file_positions): Rename from cygnus_section
	to cygnus_ext.
1994-04-22 15:16:34 +00:00
Stu Grossman
7f772644c7 * nlmcode.h (nlm_swap_auxiliary_headers_in): Keep section table
(from CyGnUsSeCs) in more permanent memory to keep section names
	from getting trashed.
1994-04-22 05:59:24 +00:00
Ian Lance Taylor
1eff2af3ba Clean up uses of _bfd_dummy_target (from Peter Schauer).
* libbfd.c (_bfd_dummy_target): Set bfd_error_wrong_format.
	* nlm-target.h (nlm_core_file_p): Define as _bfd_dummy_target, not
	NULL.
	* srec.c (srec_vec): Use _bfd_dummy_target, not NULL, in
	_bfd_check_format.
	(symbolsrec_vec): Likewise.
	* tekhex.c (tekhex_vec): Likewise.
1994-04-21 18:19:22 +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
Ian Lance Taylor
6c534df0c9 * libnlm.h (struct nlm_obj_tdata): Add nlm_cygnus_section_hdr
field.
	(nlm_cygnus_section_header): New accessor macro.
	* nlmcode.h (nlm_object_p): Free new tdata structure if failure.
	Add fixed sections before swapping in auxiliary headers.  After
	adding sections, treat errors as real, not as wrong format.
	(nlm_swap_auxiliary_headers_in): Swap in the sections header; add
	sections to the BFD for each section it describes.
	(nlm_swap_auxiliary_headers_out): Swap out the sections header.
	(nlm_compute_section_file_positions): Account for the size of the
	sections header.
1994-04-21 16:13:01 +00:00
Ken Raeburn
4a5bfdbc73 * coff-sparc.c (sparccoff_vec): Change minimum alignment power to 2, so that
stab sections can be multiples of 4 bytes only.
1994-04-20 22:44:52 +00:00
Ken Raeburn
71363c410e * hosts/i386aix.h: Changes to avoid prototypes conflicts with the ones defined
in stdlib.h.  (From Minh Tran-Le.)
1994-04-20 22:42:57 +00:00
Ian Lance Taylor
476d01f08a start-sanitize-powerpc-netware
* nlm32-ppc.c: Complete rewrite for new version of PowerPC
	NetWare.  Old code still present, but ifdeffed out.
end-sanitize-powerpc-netware

	* nlmcode.h (nlm_swap_auxiliary_headers_in): Don't assume a
	particular format for the customer header.  Allocate a block of
	memory and read it into that.
	(nlm_swap_auxiliary_headers_out): Write out the block of memory.
	(nlm_compute_section_file_positions): Include length of customer
	header when computing its size.
1994-04-20 18:38:22 +00:00
Jeff Law
694787005c * som.c (som_prep_headers): Get the space's number from the
backend private section data rather than target_index.
        (bfd_som_set_section_attributes): Store the space's number
        in the backend private section data rather than target_index.

        * som.h (som_copyable_section_data_struct): Add space_number.
1994-04-18 21:28:01 +00:00
Ian Lance Taylor
09ed366671 * coff-a29k.c (reloc_processing): Always set the address of a
R_IHCONST reloc to that of the immediately preceding R_IHIHALF.
	gas does this anyhow, but some other assemblers seem to leave
	garbage in the R_IHCONST address field.
1994-04-15 22:22:07 +00:00
Ian Lance Taylor
97ea252ef8 * bfd/archive.c: Consistently use ARFMAG; from
schwab@issan.informatik.uni-dortmund.de (Andreas Schwab).
	(_bfd_write_archive_contents): Use ARFMAG rather than '`' and
	'\012'.
	(bsd_write_armap): Likewise.
	(coff_write_armap): Likewise.
1994-04-15 19:30:09 +00:00
Ian Lance Taylor
ef79dba3c3 * coff-mips.c (mips_relocate_section): When relaxing, adjust local
relocs against the .text section as required.
	* ecofflink.c (bfd_ecoff_debug_accumulate): When relaxing, adjust
	PDR addresses as required.
1994-04-15 18:35:32 +00:00
Ian Lance Taylor
2ec2e6a90a * ecoff.c (ecoff_emit_aggregate): Take fdr argument. Map fdr
index through rfd map if it exists.  Check for a couple of cases
	which gdb handles specially.  Change all callers.
	(ecoff_type_to_string): Take fdr argument rather than aux_ptr and
	bigendian argument.  Change all callers.
	(ecoff_print_symbol): Handle stStruct, stUnion and stEnum.
1994-04-15 16:29:56 +00:00
Stan Shebs
1a000744e6 Wed Apr 13 11:50:07 1994 Stan Shebs (shebs@andros.cygnus.com)
* coff-sparc.c (sparccoff_vec): Set minimum alignment power to 3.
1994-04-14 18:09:12 +00:00
Ian Lance Taylor
4f996613fa * coff-mips.c (mips_howto_table): Add dummy entries to account for
numbering changes in include/coff/mips.h.  Add entries for
	MIPS_R_RELHI and MIPS_R_RELLO.
	(mips_ecoff_swap_reloc_in): Handle an extra bit for the reloc type
	when little endian.  Treat internal MIPS_R_RELLO or MIPS_R_RELHI
	relocs like MIPS_R_SWITCH, and convert r_offset from 24 to 32
	bits.
	(mips_ecoff_swap_reloc_out): Likewise.
	(mips_adjust_reloc_in): Handle internal MIPS_R_RELLO or
	MIPS_R_RELHI relocs like MIPS_R_SWITCH.
	(mips_adjust_reloc_out): Likewise.
	(mips_relhi_addr, mips_relhi_addend): New static variables.
	(mips_relhi_reloc, mips_rello_reloc): New functions.
	(mips_bfd_reloc_type_lookup): Turn BFD_RELOC_PCREL_HI16_S into
	MIPS_R_RELHI and turn BFD_RELOC_PCREL_LO16 into MIPS_R_RELLO.
	(mips_relocate_hi): Rename from mips_relocate_refhi, and add pcrel
	argument.  Changed all callers.
	(mips_relocate_section): Rename got_reflo to got_lo and
	reflo_int_rel to lo_int_rel.  Handle MIPS_R_RELLO and MIPS_R_RELHI
	relocs.
	(mips_relax_section): Adjust MIPS_R_RELHI/MIPS_R_RELLO pairs when
	expanding a PC relative call.
1994-04-14 17:33:22 +00:00
Ian Lance Taylor
7efb18503d * reloc.c (bfd_reloc_code_real_type): Add BFD_RELOC_PCREL_HI16_S
and BFD_RELOC_PCREL_LO16.
	* bfd-in2.h: Rebuilt.
1994-04-14 17:08:31 +00:00
Jeff Law
41194a4a59 * som.c (som_write_fixups): Always emit at least
one relocation for any non-bss section.
1994-04-12 20:37:33 +00:00
Ian Lance Taylor
bf08d1e266 * elfcode.h (assign_file_positions_except_relocs): Don't require
the file alignment to correspond to the page size when linking
	with -N.
1994-04-11 18:43:15 +00:00
Jeff Law
9a5334e590 * elfcode.h (write_relocs): For rela relocations, adjust the
addend for relocations involving section symbols to account
        for the lossage of 1:1 mapping from input section symbols to
        output section symbols.
1994-04-10 08:12:33 +00:00
Ian Lance Taylor
ec6b18c4fa * aoutx.h (NAME(aout,make_sections)): New function.
(NAME(aout,some_aout_object_p)): Call NAME(aout,make_sections)
	rather than making sections inline.
	(NAME(aout,mkobject)): Don't make any sections.
	(NAME(aout,adjust_sizes_and_vmas)): Call NAME(aout,make_sections).
	(NAME(aout,final_link)): Don't dereference obj_textsec (abfd) or
	obj_datasec (abfd) if they are NULL.
	* libaout.h (NAME(aout,make_sections)): Declare.
	* bout.c (b_out_mkobject): Don't make any sections.
	(b_out_write_object_contents): Call aout_32_make_sections.
	(b_out_set_section_contents): Likewise.
	* i386os9k.c (os9k_mkobject): Don't make any sections.
	(os9k_write_object_contents): Call aout_32_make_sections.
	(os9k_set_section_contents): Likewise.
1994-04-08 21:40:38 +00:00
Ian Lance Taylor
e48f985cd2 * aoutx.h (NAME(aout,new_section_hook)): Don't set N_EXT in target
index.
1994-04-08 16:24:01 +00:00
Peter Schauer
06863047a5 * config.bfd, configure.host: Add mips-*-sysv4* support. 1994-04-08 00:17:32 +00:00
Ian Lance Taylor
dabf906e9b * coff-mips.c (mips_howto_table): Add entry for MIPS_R_SWITCH.
(mips_ecoff_swap_reloc_in): For MIPS_R_SWTICH, copy r_symndx into
	r_offset and set r_symndx to RELOC_SECTION_TEXT.
	(mips_ecoff_swap_reloc_out): For MIPS_R_SWITCH, get the r_symndx
	value from the r_offset field.
	(mips_adjust_reloc_in): Maximum r_type value is now MIPS_R_SWITCH.
	For MIPS_R_SWITCH, copy the r_offset field into the addend field.
	(mips_adjust_reloc_out): For MIPS_R_SWITCH, copy the addend field
	into the r_offset field.
	(mips_switch_reloc): New function.
	(mips_bfd_reloc_type_lookup): Translate BFD_RELOC_GPREL32 into
	MIPS_R_SWITCH.
	(mips_relocate_section): Handle MIPS_R_SWITCH.
	(mips_relax_section): Adjust MIPS_R_SWITCH offset if necessary.
1994-04-07 18:29:38 +00:00
Ian Lance Taylor
14bf9e4b42 Comment change. 1994-04-07 18:28:03 +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
fa77c7041c * sunos.c (MY_read_dynamic_symbols): Don't define.
(MY_read_dynamic_relocs): Don't define.
	(MY_get_dynamic_symtab_upper_bound): Define.
	(MY_canonicalize_dynamic_symtab): Define.
	(MY_get_dynamic_reloc_upper_bound): Define.
	(MY_canonicalize_dynamic_reloc): Define.
	(struct sunos_dynamic_info): Change type of dynsym_count and
	dynrel_count to long.  Add fields canonical_dynsym and
	canonical_dynrel.
	(sunos_read_dynamic_info): Check that BFD had DYNAMIC flag set.
	Clear info->canonical_dynsym and info->canonical_dynrel.
	(MY(read_dynamic_symbols)): Removed.
	(MY(read_dynamic_relocs)): Removed.
	(sunos_get_dynamic_symtab_upper_bound): New function.
	(sunos_canonicalize_dynamic_symtab): New function.
	(sunos_get_dynamic_reloc_upper_bound): New function.
	(sunos_canonicalize_dynamic_reloc): New function.
	* libaout.h: Declare struct reloc_ext_external and
	reloc_std_external to avoid prototype problems.
	(struct aout_backend_data): Remove fields read_dynamic_symbols and
	read_dynamic_relocs.
	(NAME(aout,translate_symbol_table)): Declare.
	(NAME(aout,swap_ext_reloc_in)): Declare.
	(NAME(aout,swap_std_reloc_in)): Declare.
	* aoutx.h (NAME(aout,translate_symbol_table)): Renamed from
	translate_symbol_table and made non-static.  Changed all callers.
	(NAME(aout,slurp_symbol_table)): Don't read dynamic symbols.
	(NAME(aout,slurp_reloc_table)): Don't read dynamic relocs.
	(NAME(aout,get_reloc_upper_bound)): Don't count dynamic relocs.
	* aoutf1.h (aout_32_sunos4_write_object_contents): Don't bother to
	remove dynamic symbols and relocs.  They will no longer be
	present.
	(MY_read_dynamic_symbols): Don't define.
	(MY_read_dynamic_relocs): Don't define.
	(sunos4_aout_backend): Don't initialize dynamic entry points.
	* aout-target.h (MY_read_dynamic_symbols): Don't define.
	(MY_read_dynamic_relocs): Don't define.
	(MY(backend_data)): Don't initialize dynamic entry points.
	(MY_get_dynamic_symtab_upper_bound): If not defined, define to
	_bfd_nodynamic version.
	(MY_canonicalize_dynamic_symtab): Likewise.
	(MY_get_dynamic_reloc_upper_bound): Likewise.
	(MY_canonicalize_dynamic_reloc): Likewise.
1994-04-07 01:50:10 +00:00
Ian Lance Taylor
ad46bd1d13 * targets.c (bfd_target): Add fields
_bfd_get_dynamic_symtab_upper_bound,
	_bfd_canonicalize_dynamic_symtab,
	_bfd_get_dynamic_reloc_upper_bound,
	_bfd_canonicalize_dynamic_reloc.
	(BFD_JUMP_TABLE_DYNAMIC): Define.
	* libbfd-in.h (_bfd_nodynamic_get_dynamic_symtab_upper_bound):
	Define.
	(_bfd_nodynamic_canonicalize_dynamic_symtab): Define.
	(_bfd_nodynamic_get_dynamic_reloc_upper_bound): Define.
	(_bfd_nodynamic_canonicalize_dynamic_reloc): Define.
	* bfd.c (bfd_get_dynamic_symtab_upper_bound): Define.
	(bfd_canonicalize_dynamic_symtab): Define.
	(bfd_get_dynamic_reloc_upper_bound): Define.
	(bfd_canonicalize_dynamic_reloc): Define.
	* bfd-in2.h: Rebuilt.
	* libbfd.h: Rebuilt.
1994-04-07 01:48:51 +00:00
Ian Lance Taylor
7e29158a44 * cf-m68klynx.c: Include sysdep.h. 1994-04-07 01:47:16 +00:00
Ian Lance Taylor
93a8fd8dec Updated copyright (bfd-in2.h check in coming soon). 1994-04-07 01:40: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
Jeff Law
65b1ef4963 * Crude support for examining dynamic libraries.
* som.c (som_object_setup): Set DYNAMIC flag for SHL_MAGIC and
        DL_MAGIC objects.
        (som_prep_headers): Preserve the system_id for DYNAMIC objects.
        Use SHL_MAGIC as the magic number of the DYNAMIC flag is set.
        Write exec headers for DYNAMIC objects.
        (som_begin_writing): DYNAMIC objects have the same alignment
        restrictions as D_PAGED objects.
        (bfd_section_from_som_symbol): Treat DYNAMIC objects like EXEC_P
        objects.
        (object_flags): Add DYNAMIC.
1994-04-06 05:11:31 +00:00
Stan Shebs
117dbbc609 Tue Apr 5 17:54:07 1994 Stan Shebs (shebs@andros.cygnus.com)
* hosts/mpw.h (CLOSE_BEFORE_UNLINK): Define.
1994-04-06 00:55:51 +00:00
Stan Shebs
08a431621f Tue Apr 5 17:48:52 1994 Stan Shebs (shebs@andros.cygnus.com)
* i386lynx.c, sparclynx.c (NAME): Remove embedded whitespace in
	macro uses, confuses some non-ANSI compilers.
1994-04-06 00:53:20 +00:00
Jeff Law
b2452d3918 * som.c (som_bfd_free_cached_info): Add missing PARAMS decl.
Don't free anything if we don't have a bfd_object.
        (som_close_and_cleanup): Call som_bfd_free_cached_info.
1994-04-05 22:50:42 +00:00
Ian Lance Taylor
856613c4fe * elf32-mips.c (mips_elf_final_link): Don't remove empty sections.
It turns out not to be required on Irix 5, and it causes problems
	if the sections happen to contain symbols.
1994-04-05 16:29:00 +00:00
Ian Lance Taylor
d909628bb7 * elfcode.h (write_shdrs_and_ehdr): Correct bfd_write check. 1994-04-05 16:27:36 +00:00
Ian Lance Taylor
b3cee0a981 * aoutx.h (NAME(aout,canonicalize_reloc)): Don't error out if
section->relocation is NULL; malloc might have returned NULL when
	given a zero size if there were no relocations.
	* bout.c (b_out_canonicalize_reloc): Likewise.
	* coffcode.h (coff_canonicalize_reloc): Likewise.
	* ecoff.c (ecoff_canonicalize_reloc): Likewise.
	* elfcode.h (elf_canonicalize_reloc): Likewise.
	* mipsbsd.c (MY(canonicalize_reloc)): Likewise.
	* i386lynx.c (NAME(lynx,canonicalize_reloc)): Likewise.
	* nlmcode.h (nlm_canonicalize_reloc): Likewise.
	* som.c (som_canonicalize_reloc): Likewise.
	* hp300hpux.c (MY(slurp_reloc_table)): Likewise.  Also, if malloc
	returns NULL, don't report an error if we asked for zero bytes.
	* i386lynx.c (NAME(lynx,slurp_reloc_table)): If malloc returns
	NULL, don't report an error if we asked for zero bytes.
	* nlmcode.h (nlm_slurp_reloc_fixups): Likewise.
1994-04-05 15:32:49 +00:00
Ian Lance Taylor
c4dd531f11 * aoutx.h (NAME(aout,bfd_free_cached_info)): Don't free anything
if we don't have a bfd_object.
1994-04-04 23:44:13 +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
6d4f771502 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.  Also:
	* srec.c (srec_write_record): Change return type to boolean.
	(srec_write_header): Likewise.  Also, check srec_write_record
	return value.
	(srec_write_section, srec_write_terminator): Likewise.
	(srec_write_symbols): Change return type to boolean.
	(internal_srec_write_object_contents): Check return value of
	srec_write_symbols, srec_write_header, srec_write_section, and
	srec_write_terminator.
1994-04-04 22:43:30 +00:00
Ian Lance Taylor
5f322b5eb0 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.  Also:
	* oasys.c (oasys_read_record): Change return type to boolean.
	(oasys_slurp_symbol_table: Check oasys_read_record return value.
	(oasys_object_p, oasys_slurp_section_data): Likewise.
	(oasys_write_record): Change return type to boolean.
	(oasys_write_syms): Likewise.  Also, check oasys_write_record
	return value.
	(oasys_write_sections): Check oasys_write_record return value.
	(oasys_write_header): Change return type to boolean.  Check
	oasys_write_record return value.
	(oasys_write_end, oasys_write_data): Likewise.
	(oasys_write_object_contents): Check return values of
	oasys_write_header, oasys_write_syms, oasys_write_data, and
	oasys_write_end.
1994-04-04 22:42:45 +00:00
Ian Lance Taylor
2baa7d54a6 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.  Also:
	* i386os9k.c (os9k_swap_exec_header_in): Change return type to
	boolean.
	(os9k_object_p): Check os9k_swap_exec_header_in return value.
1994-04-04 22:41:53 +00:00
Ian Lance Taylor
791a3db4a6 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.  Also:
	* coffcode.h (coff_write_relocs): Change return type to boolean,
	and return errors.
	(coff_write_object_contents): Check coff_write_relocs return
	value.
1994-04-04 22:41:21 +00:00
Ian Lance Taylor
29e626eb97 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.  Also:
	* aoutx.h (emit_strtab): Change return type to boolean, and return
	errors.
	(NAME(aout,write_syms)): Check emit_strtab return value.
	(NAME(aout,final_link)): Likewise.
1994-04-04 22:40:09 +00:00
Ian Lance Taylor
f3a14a9ee2 * Makefile.in: Rebuilt dependencies. 1994-04-04 20:04:52 +00:00
Peter Schauer
3e2993b648 * aix386-core.c (aix386_bfd_is_local_label): Correct cast from
asection to asymbol.
	* ptrace-core.c (ptrace_unix_bfd_is_local_label):  Correct cast from
	bfd to asymbol.
	* trad-core.c (trad_unix_bfd_is_local_label):  Correct cast from
	asection to asymbol.
1994-04-04 17:59:36 +00:00
Jeff Law
1f46bba327 * som.c (som_slurp_string_table): Use malloc to allocate space
for the cached copy of the native string table.
        (som_slurp_symbol_table): Likewise for the native symbol table.
        (som_slurp_reloc_table): Likewise for the native and generic
        relocation tables.
        (som_bfd_free_cached_info): Free the cached native strings,
        symbols, and relocations.  Also free the canonical cached relocations.
1994-04-04 01:28:51 +00:00
Ian Lance Taylor
d6d6b18ab2 * aoutx.h (aout_link_write_symbols): If keep_memory is false, make
sure the symbol name is stored in permanent memory before adding
	it to the string table.
1994-04-01 23:01:53 +00:00
Ian Lance Taylor
dfe09c4926 * archive.c (_bfd_write_archive_contents): Once we've found an
object, don't bother to look for more when deciding whether to
	build a map.
	(compute_and_write_armap): After adding the symbols for a BFD,
	call bfd_free_cached_info on it.
1994-04-01 22:12:00 +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
Ian Lance Taylor
7ed5e9704b * elf32-hppa.c (elf_hppa_reloc_type_lookup): Correct type of
first, unused, argument.
	(hppa_elf_is_local_label): Declare instead of
	som_bfd_is_local_label.
1994-04-01 17:51:03 +00:00
Ian Lance Taylor
69a010f69c * coff-a29k.c (a29k_reloc): Add reloc_entry->address to value of
absolute R_IREL reloc.
1994-04-01 17:44:29 +00:00
Ian Lance Taylor
f8ee1ebba0 Added some support for Irix 4 shared libraries.
* ecoff.c (ecoff_new_section_hook): Set SEC_SHARED_LIBRARY for a
	.lib section.
	(ecoff_sec_to_styp_flags): Set SEC_SHARED_LIBRARY if
	STYP_ECOFF_LIB bit is set.
	(ecoff_compute_section_file_positions): Round the contents of a
	.lib section up to the next page boundary.
	(ecoff_set_section_contents): If we see a .lib section, increment
	the vma by one to count the number of shared libraries we have.
	(ecoff_write_object_contents): Don't crash if we see a
	STYP_ECOFF_LIB section, and don't adjust text_start or data_start
	or bss_size either.
1994-03-31 21:38:23 +00:00
Ian Lance Taylor
492d52cc58 * coffcode.h (CALC_ADDEND): Change to fetch original symbol value
from original BFD, rather than using value of current BFD symbol.
	Needed for new linker.
	* coff-sparc.c (CALC_ADDEND): Likewise.
1994-03-31 21:05:21 +00:00
Ian Lance Taylor
1788b1bd01 * ecoff.c (ecoff_write_object_contents): Set the text_start and
data_start entries in the optional header correctly even if a text
	or data section starts at location zero.
1994-03-31 19:44:10 +00:00
Ian Lance Taylor
e9c6595dd4 Added missing ChangeLog entry for Sean's check in, and rebuilt
bfd-in2.h.
1994-03-31 19:08:22 +00:00
Ian Lance Taylor
3af0f479d0 * nlm32-i386.c (nlm_i386_read_import): Null terminate the symbol
name.
	* nlm32-alpha.c (nlm_alpha_read_import): Likewise.
	* nlm32-sparc.c (nlm_sparc_read_import): Likewise.
1994-03-31 19:05:03 +00:00
Sean Eric Fagan
e770a59413 Missing BFD_RELOC_26. 1994-03-31 18:43:42 +00:00
Ian Lance Taylor
bfe8224f3e * coffgen.c (coff_write_symbol): Reindented. Changed to return
boolean, and changed written to unsigned int *.  Check error
	returns from called functions.
	(coff_write_alien_symbol): Likewise.
	(coff_write_native_symbol): Likewise.
	(coff_write_symbols): Likewise.  Reworked checks on whether to
	write symbol name to string table for clarity and to avoid core
	dumping when given a non COFF symbol.
	* libcoff-in.h (coff_write_symbols): Declare as returning boolean.
	* libcoff.h: Rebuilt.
	* coffcode.h (coff_write_object_contents): Check return value of
	coff_write_symbols.
1994-03-31 16:58:23 +00:00
Jeff Law
06e6eb0e53 * som.c (som_begin_writing): New approach at dealing with holes
in executables left by the HP linker.  Does not rely on subspace
        alignments as subspaces are *NOT* guaranteed to be properly
        aligned in an executable (can you believe that!).
1994-03-31 06:50:42 +00:00
Ian Lance Taylor
326e32d7ce Wed Mar 30 16:25:41 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
Changes to let BFD return an error indication from
	get_symtab_upper_bound, bfd_canonicalize_symtab,
	bfd_get_reloc_upper_bound, and bfd_canonicalize_reloc.  They now
	return long instead of unsigned int, and use -1 to indicate an
	error.  Along the way, rename get_symtab_upper_bound to
	bfd_get_symtab_upper_bound.
	* bfd.c (bfd_get_reloc_upper_bound): Return long, and -1 on
	errors.
	(bfd_canonicalize_reloc): Likewise.
	* syms.c (bfd_get_symtab_upper_bound): Renamed from
	get_symtab_upper_bound.
	* targets.c (bfd_target): Renamed _get_symtab_upper_bound to
	_bfd_get_symtab_upper_bound, and changed it and
	_bfd_canonicalize_symtab and _get_reloc_upper_bound and
	_bfd_canonicalize_reloc to all return long.
	* aoutx.h (NAME(aout,get_symtab)): Return long, and -1 on errors.
	(NAME(aout,canonicalize_reloc)): Likewise.
	(NAME(aout,get_reloc_upper_bound)): Likewise.
	(NAME(aout,get_symtab_upper_bound)): Likewise.
	* bout.c (b_out_canonicalize_reloc): Likewise.
	(b_out_get_reloc_upper_bound): Likewise.
	* coffcode.h (coff_canonicalize_reloc): Likewise.
	* coffgen.c (coff_get_symtab_upper_bound): Likewise.
	(coff_get_symtab): Likewise.
	(coff_get_reloc_upper_bound): Likewise.
	* ecoff.c (ecoff_get_symtab_upper_bound): Likewise.
	(ecoff_get_symtab): Likewise.
	(ecoff_canonicalize_reloc): Likewise.
	* elfcode.h (elf_get_symtab_upper_bound): Likewise.
	(elf_get_reloc_upper_bound): Likewise.
	(elf_canonicalize_reloc): Likewise.
	(elf_get_symtab): Likewise.
	* hp300hpux.c (MY(get_symtab)): Likewise.
	(MY(get_symtab_upper_bound)): Likewise.
	(MY(canonicalize_reloc)): Likewise.
	* i386lynx.c (NAME(lynx,canonicalize_reloc)): Likewise.
	* ieee.c (ieee_slurp_external_symbols): Change return type to
	boolean.  Check for errors from get_symbol.
	(ieee_slurp_symbol_table): Change return type to boolean.  Check
	for errors from ieee_slurp_external_symbols.
	(ieee_get_symtab_upper_bound): Return long, and -1 on errors.
	(ieee_get_symtab): Likewise.
	(ieee_get_reloc_upper_bound): Likewise.
	(ieee_canonicalize_reloc): Likewise.
	* mipsbsd.c (MY(canonicalize_reloc)): Likewise.
	* nlmcode.h (nlm_get_symtab_upper_bound): Likewise.
	(nlm_get_symtab): Likewise.
	(nlm_get_reloc_upper_bound): Likewise.
	(nlm_canonicalize_reloc): Likewise.
	* oasys.c (oasys_get_symtab_upper_bound): Likewise.
	(oasys_get_symtab): Likewise.
	(oasys_get_reloc_upper_bound): Likewise.
	(oasys_canonicalize_reloc): Likewise.
	* som.c (som_get_symtab_upper_bound): Likewise.
	(som_get_symtab): Likewise.
	(som_get_reloc_upper_bound): Likewise.
	(som_canonicalize_reloc): Likewise.
	* srec.c (srec_get_symtab_upper_bound): Likewise.
	(srec_get_symtab): Likewise.
	(srec_get_reloc_upper_bound): Define as bfd_0l.
	(srec_canonicalize_reloc): Likewise.
	* tekhex.c (tekhex_get_symtab): Return long, and -1 on errors.
	(tekhex_get_symtab_upper_bound): Likewise.
	(tekhex_get_reloc_upper_bound): Define as bfd_0l.
	(tekhex_canonicalize_reloc): Likewise.
	* libaout.h (NAME(aout,get_symtab_upper_bound)): Change
	declaration to return long.
	(NAME(aout,get_symtab)): Likewise.
	(NAME(aout,canonicalize_reloc)): Likewise.
	(NAME(aout,get_reloc_upper_bound)): Likewise.
	* libcoff-in.h (coff_get_symtab_upper_bound): Likewise.
	(coff_get_symtab): Likewise.
	(coff_get_reloc_upper_bound): Likewise.
	* libecoff.h (ecoff_get_symtab_upper_bound): Likewise.
	(ecoff_get_symtab): Likewise.
	(ecoff_canonicalize_reloc): Likewise.
	* libelf.h (bfd_elf32_get_symtab_upper_bound): Likewise.
	(bfd_elf32_get_symtab): Likewise.
	(bfd_elf32_get_reloc_upper_bound): Likewise.
	(bfd_elf32_canonicalize_reloc): Likewise.
	(bfd_elf64_get_symtab_upper_bound): Likewise.
	(bfd_elf64_get_symtab): Likewise.
	(bfd_elf64_get_reloc_upper_bound): Likewise.
	(bfd_elf64_canonicalize_reloc): Likewise.
	* libnlm.h (nlmNAME(get_symtab_upper_bound)): Likewise.
	(nlmNAME(get_symtab)): Likewise.
	(nlmNAME(get_reloc_upper_bound)): Likewise.
	(nlmNAME(canonicalize_reloc)): Likewise.
	* archive.c (compute_and_write_armap): Use error_return and
	no_memory_return labels rather than freeing information in various
	places.  Change storage, symcount and src_count to long.  Check
	errors from bfd_get_symtab_upper_bound and
	bfd_canonicalize_symtab.
	* bout.c (b_out_relax_section): Change reloc_size to long.  Check
	for errors from bfd_get_reloc_upper_bound and
	bfd_canonicalize_reloc.
	(b_out_get_relocated_section_contents): Likewise.
	* coff-alpha.c (alpha_ecoff_get_relocated_section_contents):
	Likewise.
	* elf32-mips.c: Likewise.
	* elf32-hppa.c (hppa_elf_stub_finish): Likewise.
	(hppa_look_for_stubs_in_section): Check for errors from
	bfd_get_symtab_upper_bound, bfd_canonicalize_symtab, and
	bfd_canonicalize_reloc.
	* ecofflink.c (bfd_ecoff_debug_accumulate_other): Check for errors
	from bfd_get_symtab_upper_bound and bfd_canonicalize_symtab.
	* linker.c (generic_link_read_symbols): Likewise.
	(_bfd_generic_final_link): Check for errors from
	bfd_get_reloc_upper_bound and bfd_canonicalize_reloc.
	* reloc.c (bfd_generic_get_relocated_section_contents): Likewise.
	* reloc16.c (bfd_coff_reloc16_relax_section): Likewise.
	(bfd_coff_reloc16_get_relocated_section_contents): Likewise.
	* libbfd.c (bfd_0l): New function.
	* libbfd-in.h (bfd_0l): Declare.
	* aix386-core.c: Change get_symtab_upper_bound, get_symtab,
	get_reloc_upper_bound, and canonicalize_reloc to use bfd_0l rather
	than bfd_0u.
	* cisco-core.c, hppabsd-core.c, hpux-core.c: Likewise.
	* irix-core.c, osf-core.c, ptrace-core.c, trad-core.c: Likewise.
	* bfd-in2.h: Rebuilt.
	* libbfd.h: Rebuilt.
	* libcoff.h: Rebuilt.

	* nlm32-sparc.c (nlm_sparc_read_reloc): Remove unused variables
	temp and name.
1994-03-30 22:15:07 +00:00
Jim Kingdon
c2c818bc35 * hosts/dpx2.h: Define POSIX_UTIME. 1994-03-30 16:33:45 +00:00
Peter Schauer
bdf1b51158 * i386dynix.c, config/i386-dynix.mt: New files, handling Dynix
variant of a.out.
	* configure.in, config.bfd:  Use them for Dynix.
	* Makefile.in:  Add dependencies for i386dynix.o.
	* targets.c:  Add definition for i386dynix_vec.
1994-03-30 08:53:45 +00:00
Ian Lance Taylor
9f37f56aac Entry for last check in. 1994-03-28 23:44:43 +00:00
Ian Lance Taylor
6cac89c5c6 * Makefile.in (BFD32_BACKENDS): Add coff-sparc.o. 1994-03-28 23:35:20 +00:00
Ian Lance Taylor
09a2820705 * coffcode.h (coff_set_flags): Handle bfd_arch_powerpc like
bfd_arch_rs6000.
1994-03-28 23:20:38 +00:00
Sean Eric Fagan
f888e93cca An annoying typo (faflse instead of false). Oopsie. 1994-03-28 23:03:21 +00:00
Ian Lance Taylor
ce8f1f60b7 * config.bfd (powerpc-*-aix*): New target; use rs6000.mt. 1994-03-28 18:02:05 +00:00
Ian Lance Taylor
34632537e0 * configure.in (powerpc-*-aix*): New target; use rs6000.mt.
* config/rs6000.mt (SELECT_ARCHITECTURES): Add bfd_powerpc_arch.
1994-03-28 18:00:09 +00:00
Ian Lance Taylor
a8a916c86f * aoutx.h (translate_from_native_sym_flags): Set SEC_RELOC flag
for generated constructor section.
1994-03-28 17:57:34 +00:00
Jeff Law
120f5bd93c Arg. Forgot this in yesterday's cvs commit. 1994-03-27 21:29:37 +00:00
Jeff Law
f977e865cb * som.c (som_get_section_contents): New function. Do not try
to actually read data from a section that doesn't have either
        SEC_LOAD or SEC_DEBUGGING set (eg $BSS$) just return true.
1994-03-26 20:25:48 +00:00
Jeff Law
250578363e * libbfd.c (bfd_read): Set bfd_error as appropriate for a short
read. (bfd_error_system_call or bfd_error_file_truncated).

        * som.c: Do not blindly set bfd_error_system_call after a
        failing bfd_read, bfd_write, or bfd_seek.  In a few places
        (like som_object_p) override the error status set by bfd_read.

        * aix386-core.c, aout-encap,c archive.c, bout.c: Likewise.
        * coff-rs6000.c, coffgen.c ecoff.c, elf.c: Likewise.
        * elf32-hppa.c, elfcode.h, hp300hpux.c, i386lynx.c: Likewise.
        * nlm32-alpha.c, nlm32-i386.c, nlm32-sparc.c: Likewise.

        * som.c: Check return values from several bfd_{seek,read,write}
        calls that we just assumed were not failing.
1994-03-26 18:28:29 +00:00
Jim Kingdon
471c3c3f74 * hosts/sysv4.h (HAVE_PROCFS): Add comments about ptx4.
* config/sysv4.mh: Add comment.
	* config/symmetry.mh: Change comment.
	* configure.host: Use sysv4, not symmetry, for i[34]86-sequent-sysv4*.
1994-03-26 01:12:53 +00:00
Ian Lance Taylor
a3a33af390 Changes to support linker relaxing of embedded MIPS PIC code to
use a five instruction sequence for funtion calls which are out of
	range of the bal instruction.
	* libecoff.h (struct ecoff_section_tdata): Define.
	(ecoff_section_data): Define.
	(ecoff_bfd_relax_section): Don't define.
	* ecoff.c (ecoff_final_link_debug_accumulate): Don't read or free
	the debugging information if it has already been read.
	(ecoff_indirect_link_order): Handle _cooked_size being different
	from _raw_size.  Don't reread the contents or the relocs if they
	have already been read in.
	* coff-mips.c (mips_howto_table): Change bitsize of PCREL16 from
	18 to 16.
	(PCREL16_EXPANSION_ADJUSTMENT): Define.
	(mips_relocate_refhi): Take adjust argument.
	(mips_relocate_section): Handle reloc offsets stored in section
	used_by_bfd field.  Call mips_relax_pcrel16 to handle details of
	expanding an out of range PCREL16.  Keep trace of adjustments
	required by expansions.  Set s and unset h when converting a reloc
	from undefined to section.  Change handling of PC relative relocs:
	if against a section, they are correct in the object file, if
	against an external symbol they are pcrel_offset.
	(mips_relax_section): New function.
	(mips_relax_pcrel16): New function.
	(ecoff_bfd_relax_section): Define.
	* coff-alpha.c (ecoff_bfd_relax_section): Define.
	* ecofflink.c (bfd_ecoff_debug_accumulate): Handle adjustments
	built by mips_relax_section when writing out addresses.
	* elf32-mips.c (mips_elf_read_ecoff_info): Clear adjust field.
1994-03-25 22:37:55 +00:00
Ian Lance Taylor
91f300d635 Fix typo in comment. 1994-03-25 22:14:48 +00:00
Ian Lance Taylor
ec099b4b25 * aoutx.h (NAME(aout,find_nearest_line)): The caller expects
functionname_ptr to be set to a symbol name, so prepend
	symbol_leading_char.
1994-03-25 22:13:02 +00:00
Steve Chamberlain
47e70c5417 Thu Mar 24 11:33:46 1994 Steve Chamberlain (sac@jonny.cygnus.com)
* coff-h8300.c (h8300_reloc16_extra_cases): Add relaxing info
	for 16bit relative branches.
	* coff-h8500.c (r_high8, r_low16, r_high16): Don't complain on
	overflow.
1994-03-24 19:45:23 +00:00
Jeff Law
9d7f682f8c * som.c (som_bfd_prep_for_ar_write): Ignore non-SOM objects.
(som_bfd_ar_write_symbol_stuff, som_write_armap): Likewise.
1994-03-24 17:21:50 +00:00
David MacKenzie
1f1ed32d6d * netbsd386.c (N_SET_FLAGS): Delete the old definition. 1994-03-23 22:30:14 +00:00