Commit Graph

965 Commits

Author SHA1 Message Date
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 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 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 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 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
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 09a2820705 * coffcode.h (coff_set_flags): Handle bfd_arch_powerpc like
bfd_arch_rs6000.
1994-03-28 23:20:38 +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 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 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
Ian Lance Taylor 456961d1bc Clean up the relaxing code for the new linker.
* targets.c (_bfd_relax_section): Take boolean *again argument
	rather than asymbol list.
	* bfd.c (bfd_relax_section): Change name of fourth argument from
	symbols to again.
	* reloc.c (bfd_generic_relax_section): Take boolean *again
	argument rather than asymbol list.  Always return true.
	* bout.c: Include genlink.h.
	(aligncode, perform_slip): Declare.
	(perform_slip): Take BFD argument rather than asymbol list.
	Changed all callers.  Get the symbols from the BFD.  Change the
	hash table entry value as well as the symbol value.
	(abs32code): Take BFD argument rather than asymbol list.  Changed
	all callers.
	(aligncode): Likewise.
	(b_out_relax_section): Take boolean *again argument rather than
	asymbol list.  Only return false if an error occurred.  Set *again
	to false.  Get symbols from BFD.
	* reloc16.c: Include genlink.h.
	(bfd_perform_slip): Take BFD argument rather than asymbol list.
	Get the symbols from the BFD.  Change the hash table entry value
	as well as the symbol value.
	(bfd_coff_reloc16_relax_section): Take boolean *again argument
	rather than asymbol list.  Only return false if an error occurred.
	Set *again to false.  Get symbols from BFD.
	* coffcode.h (bfd_coff_backend_data): Change
	_bfd_coff_reloc16_estimate to take BFD argument rather than
	asymbol list.
	(bfd_coff_reloc16_estimate): Corresponding change.
	(dummy_reloc16_estimate): Corresponding change.
	* libcoff-in.h (bfd_coff_reloc16_relax_section): Change
	declaration to take boolean * rather than asymbol list.
	(bfd_perform_slip): Change declaration to take BFD rather than
	asymbol list.
	* coff-h8300.c (h300_reloc16_estimate): Take BFD argument rather
	than asymbol list.  Changed calls to bfd_perform_slip.
	* bfd-in2.h: Rebuilt.
	* libbfd.h: Rebuilt.
	* libcoff.h: Rebuilt.
	* Makefile.in: Rebuilt dependencies.
1994-03-23 20:21:06 +00:00
Ian Lance Taylor c031ba0b95 * coff-mips.c (mips_howto_table): Add entry for new MIPS_R_PCREL16
reloc, used in embedded PIC code.
	(mips_adjust_reloc_in): Change sanity check to permit new reloc.
	(mips_bfd_reloc_type_lookup): Turn BFD_RELOC_16_PCREL_S2 into
	MIPS_R_PCREL16.
1994-03-22 20:13:37 +00:00
Ian Lance Taylor 4335ce642d * linker.c (_bfd_generic_final_link): Set reloc_count to 0 before
counting relocs.  Set SEC_RELOC flag for any section which has
	relocs.

	* linker.c (_bfd_default_link_order): Handle bfd_data_link_order.

	* linker.c (_bfd_generic_link_add_symbols): Just call
	generic_link_add_symbols.
	(_bfd_generic_link_add_symbols_collect): New function, like
	_bfd_generic_link_add_symbols but also collect constructors and
	destructors by name as collect2 does.
	(generic_link_add_symbols): New function, like old
	_bfd_generic_link_add_symbols but with collect argument.
	(generic_link_add_object_symbols): Take collect argument.
	(generic_link_check_archive_element_no_collect): New function.
	(generic_link_check_archive_element_collect): New function.
	(generic_link_check_archive_element): Take collect argument.
	(generic_link_add_symbol_list): Take collect argument.
	(_bfd_generic_link_add_one_symbol): Rename constructor argument to
	collect.
	* libbfd-in.h (_bfd_generic_link_add_symbols_collect): Declare.
	* libbfd.h: Rebuilt.
1994-03-22 18:18:40 +00:00
Jeff Law 9d92fe0af4 * archive.c (bfd_construct_extended_name_table): Use ar_padchar
for first character in an extended name.
        (_bfd_write_archive_contents): If ar_padchar == '/', then use
        "//" as the name of the special archive member holding the
        extended name table.
1994-03-22 18:04:59 +00:00
Ian Lance Taylor f1cca64780 Support for link_order types which generate relocs in order to
support -Ur in the linker.
	* linker.c (generic_link_add_symbol_list): Remove bitsize argument
	from call to _bfd_generic_link_add_one_symbol.
	(_bfd_generic_link_add_one_symbol): Remove bitsize argument.
	Don't pass bitsize to constructor call back.  Pass BFD_RELOC_CTOR
	instead of bitsize to add_to_set call back.
	(_bfd_generic_final_link): Account for link_order relocs when
	allocating space for relocations.  Handle them in link_order loop.
	(_bfd_generic_reloc_link_order): New function.
	(_bfd_default_link_order): If a reloc_link_order is seen here,
	abort.
	(_bfd_count_link_order_relocs): New function.
	* libbfd-in.h (_bfd_generic_link_add_one_symbol): Remove bitsize
	argument from declaration.
	(_bfd_generic_reloc_link_order): Declare.
	(_bfd_count_link_order_relocs): Declare.
	* libbfd.h: Rebuilt.
	* aoutx.h (aout_link_add_symbols): Remove bitsize argument from
	call to _bfd_generic_link_add_one_symbol.
	(NAME(aout,final_link)): Account for link_order relocs when
	allocating space for relocations.  Handle them after handling all
	input BFDs.
	(aout_link_reloc_link_order): New function.
	* ecoff.c (ecoff_link_add_externals): Remove bitsize argument from
	call to _bfd_generic_link_add_one_symbol.
	(ecoff_bfd_final_link): Account for link_order relocs when
	allocating space for relocations.  Handle them in link_order loop.
	(ecoff_link_write_external): Set the storage class of a defined
	linker created symbol based on the section it is in.  Correct
	bfd_link_hash_weak case to use .sc rather than .st.
	(ecoff_reloc_link_order): New function.
	* coff-alpha.c (alpha_bfd_reloc_type_lookup): Handle
	BFD_RELOC_CTOR.
	* coff-mips.c (mips_bfd_reloc_type_lookup): Likewise.
1994-03-22 00:27:05 +00:00
Jeff Law 17e64ad39b * bfd/som.c (som_begin_writing): Fix thinko (off by one error). 1994-03-21 03:42:06 +00:00
Jeff Law c2e1207b3a * som.c (bfd_section_from_som_symbol): Only to do the value
comparison for function symbols within executables.
1994-03-21 02:08:37 +00:00
Jeff Law c05d2d43a0 * som.c (bfd_section_from_som_symbol): Renamed from
som_section_from_subspace_index.  Pass in a native SOM symbol.
        For executables, iterate through the sections to find out
        which contains the symbol's address rather than using the
        symbol_info field.  (symbol_info has a different meaning for
        dynamicly linked executables.)
1994-03-20 23:27:37 +00:00
Jeff Law 61bcbf40af * trad-core.c (trad_unix_core_file_p): Don't pass abfd to
bfd_zmalloc.
1994-03-20 21:39:35 +00:00
Jeff Law 517a6af632 * som.c (som_begin_writing): Fix braino (one call to align
space/subspace data was done unconditionally rather than
        just for executables.)
1994-03-20 19:22:04 +00:00
Jeff Law 142f59f4a9 * som.c (som_begin_writing): Align text in all executables to
make HPUX kernel happy.  Fixes strip/objcopy for shared
        executables.
1994-03-20 17:27:51 +00:00
Jim Kingdon 47dc9b52c2 * bfd.c (struct _bfd): Add cisco_core_struct to tdata union.
* libbfd.c (bfd_read, bfd_seek): Add comments regarding errors.
	* cisco-core.c: New file.
	* Makefile.in: Change accordingly.
	* configure.in: Recognize cisco_core_vec.
	* config/m68k-aout.mt (SELECT_VECS): Add cisco_core_vec.
	* targets.c: Add cisco_core_vec.
	* bfd-in2.h: Rebuilt.
1994-03-19 21:13:58 +00:00
Jeff Law 00806436cd * som.c (som_begin_writing): Account for alignment needs of
subspaces too when writing executables.  Never request a negative
        bss size.  Fixes some problems with demand paged executables,
        still having problems with pure executables and shared executables.
1994-03-19 15:08:12 +00:00
Jeff Law 1576691751 * som.h (som_copyable_section_data_struct): New structure
containing all the private section information which needs
	to be copied from input section to output section during
	objcopy or strip.
	(som_section_data_struct): Remove several fields now in
	som_copyable_section_data_struct.  Make the space and
	subspace dictionaries be pointers (to save space when
	only reading objects).

	* som.c (bfd_som_set_section_attributes): Now returns a boolean;
	some references changed.  Allocate a copyable data stucture if
	none exists.  Store info into the copyable data structure.
	(bfd_som_set_subsection_attributes): Likewise.
	(som_is_space, som_is_subspace, som_is_container): New functions.
	Use these instead of directly accessing private data.
	(som_prep_headers): Allocate space and subspace headers here.
	Fill in some fields in the space/subspace headers from the
	copyable data.
	(som_bfd_copy_private_section_data): Only copy the stuff
	that we really need to make objcopy and strip work.  Allocate
	the copy_data structure for the output bfd before copying.
1994-03-19 06:41:54 +00:00
Jim Kingdon f3f29240da * trad-core.c (trad_unix_core_file_p): Call bfd_zmalloc not
bfd_zalloc for rawptr, because later on we may call free, not
	bfd_release, on it.

	* bfd.c (struct _bfd): Add cisco_core_struct to tdata union.
	* libbfd.c (bfd_read, bfd_seek): Add comments regarding errors.
	* cisco-core.c: New file.
	* Makfile.in: Change accordingly.
	* bfd-in2.h: Rebuilt.
1994-03-19 06:17:08 +00:00
Jeff Law 4359a7ef33 * som.h (struct som_exec_data): New structure to hold exec
info that must be preserved when running objcopy/strip.
	(struct somdata): Add new "exec_data" field and accessor
	macro.  Add some comments on how the various fields are used.
	(som_section_data_struct): Make is_space and is_subspace bitfields.
	Delete unused subspace_index.  All references now use the
	target_index field within the section structure itself.

	* som.c (make_unique_section): Delete unused declaration.
	(som_bfd_copy_private_bfd_data): New function.
	(som_object_setup): Allocate space for and save exec information
	that needs to be copied during objcopy/strip.
	(som_mkobject): Do not allocate space for a file header here.
	It is not used when only reading SOM objects.
	(som_prep_headers): Allocate space for and attach a file header
	to the output bfd.  For executables, use the saved system_id
	value rather than trying to guess the right value.  Do not abort
	wwhen setting file_hdr->entry* for executables.
	(som_begin_writing): For executables, set the exec_entry and
	exec_flags fields.
	(som_copy_private_backend_section_data): Always return a value.
1994-03-19 05:06:54 +00:00
Jeff Law 08b3c4f997 * libhppa.h (PA_PAGESIZE): Define.
* som.c (SOM_ALIGN): Define.
        (som_begin_writing): If writing an executable, initialize all
        fields in the exec header to zero.  Update fields in the exec
        header as sizes of loadable subspaces are computed.  Carefully
        preserve alignments when building executables.  Actually write the
        exec after all the fields are filled in.
1994-03-19 03:54:49 +00:00
Jeff Law 3b4994959e * Better long-filename handling. Reads SOM ABI compliant extended
names, but doesn't quite write compliant extended names yet.
        * som.c (som_slurp_extended_name_table): Delete function.  The
        generic code will handle things correctly.
        (som_slurp_armap): Seek to the beginning of the next member.
        (normalize): New function.
        (som_bfd_ar_write_symbol_stuff): Take the size of the extended
        name table into account when computing the file offsets in the
        SOM dictionary.  Make sure to align to an even boundary.
        (som_write_armap): Initialize the checksum to zero.
        (ar_maxchars): Fix.  Opps.
1994-03-19 02:17:15 +00:00