Commit graph

1657 commits

Author SHA1 Message Date
Jeff Law
f3b477bec4 * elf32-hppa.c (mismatches, retval_mismatches): Fix mismatch
action in case where caller specified no argument relocation.
        (hppa_elf_build_linker_stub): Try again to get the sym_ptr_ptr
        right in the original relocation and the stub's relocation.
1994-02-28 04:25:14 +00:00
Jeff Law
6e58a4e5db * elf32-hppa.h (hppa_look_for_stub_in_section): Fix typo. Delete
unused symbols argument.

        * elf32-hppa.c (hppa_elf_stub_reloc): Accept asymbol ** rather
        than asymbol * for original target symbol.  All callers changed.
        Set reloc->sym_ptr_ptr appropriately.
        (hppa_elf_build_linker_stub): Set reloc->sym_ptr_ptr correctly.
        (hppa_elf_look_for_stubs_in_section): No longer need symbols
        argument.  Use the output symbols when canonicalizing the relocs,
        creating them if necessary.

        * linker.c (_bfd_generic_link_output_symbols): Do not rebuild/clobber
        the output symbols if they already exist.
1994-02-28 00:32:14 +00:00
Stan Shebs
d63840d016 Sun Feb 27 15:41:10 1994 Stan Shebs (shebs@andros.cygnus.com)
* mpw-make.in (DEBUG_BFD_SEND): Define in default compilation
	rule.
1994-02-27 23:46:59 +00:00
Stan Shebs
fdfe2d1466 Sun Feb 27 15:22:36 1994 Stan Shebs (shebs@andros.cygnus.com)
* targets.c (BFD_SEND, BFD_SEND_FMT): Add debugging versions that
	check all the pointer dereferences.  Enabled via DEBUG_BFD_SEND.
	* bfd-in2.h: Rebuilt.
1994-02-27 23:45:18 +00:00
Stan Shebs
4c8d6c9f4f Sun Feb 27 15:22:36 1994 Stan Shebs (shebs@andros.cygnus.com)
* srec.c (hex_value): Always set to a size of 256 bytes.
	(srec_init): Cosmetic changes.
1994-02-27 23:28:48 +00:00
Jeff Law
e08b9ad7a1 * elf32-hppa.c: Second half of major cleanup. More comments,
PARAMize and staticize rest of functions.  Delete unused
	functions.  Delete unused/unnecessary arguments to some functions.
	Group static vars together.  Abort for bad errors until we have
	error code propogation working.  Work on spacing and indention.
	Add FIXMEs for unresolved problems.  Use enums rather than
	#defines for lots of things.  Merge two functions which build
	linker stubs into a single function (so they can easily share a
	ton of common code).
1994-02-27 19:20:44 +00:00
Jeff Law
f6061456e0 Forgot to check these changes in yesterday. 1994-02-27 19:18:06 +00:00
Ian Lance Taylor
68241b2b3f * aoutx.h, archive.c: Add casts to avoid warnings from SVR4 cc.
* ecoff.c, ecofflink.c, ecoffswap.h, srec.c: Likewise.
	* elf32-i386.c: Likewise.
	* elfcode.h (bfd_section_from_shdr): Make i unsigned; remove old
	#if 0 code.
	(elf_write_phdrs): Make i unsigned.
	(map_program_segments): Make i and n_left unsigned.
	(assign_file_positions_except_relocs): Make i unsigned.
	(write_shdrs_and_ehdr): Make count unsigned.
	(assign_file_positions_for_relocs): Make i unsigned.
	(NAME(bfd,elf_write_object_contents)): Make count unsigned.
	(section_from_elf_index): Make index argument unsigned.
1994-02-26 18:25:23 +00:00
Ian Lance Taylor
3d51f02f4c * reloc.c (_bfd_relocate_contents): Adjust handling of overflow to
avoid depending upon right shifts of signed numbers, and to
	correct handling of src_mask with lower bits zero.
1994-02-26 18:24:10 +00:00
Ian Lance Taylor
96db31875e Various entries. 1994-02-26 05:38:11 +00:00
Ian Lance Taylor
ecff0ffe9c * linker.c (_bfd_generic_link_write_global_symbol): Add missing
break in switch.
1994-02-26 05:37:41 +00:00
Ian Lance Taylor
850584adbe * elfcode.h: Don't include assert.h.
(swap_out_syms): Use BFD_ASSERT rather than assert.
1994-02-26 05:37:24 +00:00
Ian Lance Taylor
86dbb1303f * hosts/i386v4.h (qsort, strtol): Remove incorrect and useless
declarations.
1994-02-26 05:35:43 +00:00
Jeff Law
f5bfdacd47 * libhppa.h (hppa_rebuild_insn): Moved here from elf32-hppa.c.
* elf32-hppa.h (elf_hppa_tc_symbol): Add new arguments.
        (elf_hppa_tc_make_sections): Likewise.
        (elf_hppa_final_processing): Add extern decl.

        * elf32-hppa.c: First half of major cleanup.  Add/cleanup lots of
        comments.  PARAMize some static functions.  Delete unused functions.
        Delete unused/unnecessary arguments to many functions.  Group
        static vars together.  Collapse common case statements together
        in many places.  Use default case when possible instead of listing
        each case separately.  Abort for bad errors until we get error
        code propogation working.  Work on spacing and indention problems.
        Add FIXMEs for some unresolved problems.  Delete hopelessly broken
        COMPLEX relocation support (it's never used anyway).
        (hppa_elf_rebuild_insn): Delete.  Moved into libhppa.h.
        (elf_hppa_tc_symbol): Accept and use new arguments (symext chains).
        (elf_hppa_tc_make_sections): Likewise.
1994-02-26 04:58:57 +00:00
Jeff Law
43ebdfcf4e * format.c (bfd_check_format_matches): Initialize matching_vector
to keep gcc -Wall quiet.

        * elfcode.h (elf_slurp_reloca_table): Fix typo.
1994-02-26 03:41:36 +00:00
Jeff Law
d643978558 * som.c (som_get_symtab_upper_bound): Use "sizeof (asymbol *)"
not "sizeof (som_symbol_type *)".

        * elfcode.h (elf_get_symtab_upper_bound): Use "sizeof (asymbol *)"
        not "sizeof (asymbol").  Opps.
1994-02-26 00:39:03 +00:00
Ian Lance Taylor
fbb8fe5c6e * bfd.c (bfd_get_gp_size): Can't return gp value on an archive.
(bfd_set_gp_size):  Can't set gp value on an archive.
1994-02-25 21:20:18 +00:00
Steve Chamberlain
5e80812667 * srec.c (pass_over): Don't skip too many characters when
end of line seen.
1994-02-25 21:09:09 +00:00
Ian Lance Taylor
d6074cddec Fix last patch. 1994-02-25 21:05:49 +00:00
Ian Lance Taylor
626f883f94 * ecoff.c (ecoff_sizeof_headers): Align result to 16 byte
boundary.
1994-02-25 19:42:43 +00:00
Peter Schauer
a69b39f0c5 * elfcode.h (elf_core_file_p): Check for core file e_machine match
like in elf_object_p.
1994-02-24 12:37:43 +00:00
Jeff Law
2e7b92cfa9 * elfcode.h (alloca): Delete declaration. 1994-02-24 04:00:30 +00:00
Jeff Law
4f42757e38 * som.c (som_prep_headers): Use CPU_PA_RISC1_0 for magic
number rather than HP9000S800_ID.  Note som.c is careful
        to make sure CPU_PA_RISC1_0 is always defined.
1994-02-24 02:31:01 +00:00
Stan Shebs
30d7f715a9 Wed Feb 23 16:52:51 1994 Stan Shebs (shebs@andros.cygnus.com)
* hosts/mpw.h (fstat): Declare.
	(mpw_fstat): Eliminate mentions.
1994-02-24 00:56:32 +00:00
Ian Lance Taylor
2f0deb19eb * ecofflink.c (ecoff_write_symhdr): Set symhdr->magic here.
* ecoff.c (ecoff_write_object_contents): Make sure .bss section
	ends on a page boundary if there is no symbol table.
	(ecoff_bfd_final_link): Don't set symhdr->magic here.
1994-02-22 04:25:43 +00:00
Ian Lance Taylor
aaca79a831 * hosts/hp300.h: Include <stdlib.h>; don't declare free. 1994-02-22 01:51:38 +00:00
Ian Lance Taylor
2ab0b7f3e3 * som.c (som_bfd_count_ar_symbols): Use a pointer and alloca
rather than an array of variable size.
	(som_bfd_fill_in_ar_symbols): Likewise.
	(som_bfd_ar_write_symbol_stuff): Likewise.
1994-02-22 00:01:34 +00:00
Stu Grossman
fdf08b0fff Oops... Forgot to check this in... 1994-02-21 19:05:44 +00:00
Stan Shebs
891dc727a1 Mon Feb 21 10:12:02 1994 Stan Shebs (shebs@andros.cygnus.com)
* Makefile.in (targets.o, archures.o): Use ALL_CFLAGS to supply
	flags to explicit compile actions.
1994-02-21 18:17:21 +00:00
Ian Lance Taylor
22a71fef07 * coff-alpha.c (alpha_relocate_section): Rewrite mask and shift
operation to avoid OSF 1.3 cc bug.
	* ecoff.c (ecoff_write_object_contents): Make text_size, data_size
	and bss_size bfd_size_type instead of unsigned long.  Make
	text_start and data_start bfd_vma instead of unsigned long.
	* ecofflink.c (ecoff_add_string): Remove incorrect cast of return
	value.
1994-02-21 17:56:38 +00:00
Ian Lance Taylor
037ce95adb * linker.c (_bfd_generic_link_add_archive_symbols): Consider
symbols in the order they appear in the archive map.
1994-02-21 00:18:57 +00:00
Peter Schauer
3a1de3cc03 * coff-alpha.c (reloc_nil): Add forward declaration, add missing
error_message argument.
	* coff-sparc.c (bfd_coff_generic_reloc):  Add forward declaration,
	add missing error_message argument.
	* mipsbsd.c (mips_fix_hi16_s):  Add forward declaration, add missing
	error_message argument.
1994-02-19 11:29:48 +00:00
Ian Lance Taylor
99ec1f66c1 start-sanitize-powerpc-netware
Support for PowerPC NetWare.
	* config.bfd (powerpc-*-netware*): New target; use ppc-nlm.
	* config/ppc-nlm.mt: New file.
	* configure.in (nlm32_powerpc_vec): New target vector; use
	nlm32-powerpc.o, nlm32.o, nlm.o.
	* targets.c (nlm32_powerpc_vec): Declare.
	* Makefile.in (BFD32_BACKENDS): Add nlm32-powerpc.o.
	(CFILES): Should add nlm32-powerpc.c, but didn't, because the
	dependencies can't be sanitized.
	end-sanitize-powerpc-netware

	Initial support for PowerPC ELF.  Done without an ABI, and
	probably to be changed when I get an ABI.
	* config.bfd (powerpc-*-sysv4*): New target; use ppc-elf.
	* config/ppc-elf.mt: New file.
	* configure.in (bfd_elf32_powerpc_vec): New target vector; use
	elf32-powerpc.o, elf32.o, elf.o.
	* elf32-powerpc.c: New file.
	* elfcode.h (prep_headers): Add bfd_arch_powerpc case.
	(elf_set_arch_mach): Likewise.
	* targets.c (bfd_elf32_powerpc_vec): Declare.
	* Makefile.in (BFD32_BACKENDS): Add elf32-powerpc.o.
	(CFILES): Add elf32-powerpc.c.
	Rebuilt dependencies.
1994-02-18 17:09:13 +00:00
Ian Lance Taylor
d03d5626e5 Support for PowerPC ELF and PowerPC NetWare. Sanitization to follow. 1994-02-18 15:37:20 +00:00
Ian Lance Taylor
a243926667 Use bfd_set_error in last patch. 1994-02-17 21:50:39 +00:00
Ian Lance Taylor
42f62ead47 Various entries. 1994-02-17 20:56:49 +00:00
Ian Lance Taylor
7d8aaf368f * elfcode.h (elf_slurp_symbol_table): Handle zero symbols
reasonably.  Allocate x_symp using alloca.

Also fixed up indentation a bit in elf_set_arch_mach.
1994-02-17 20:45:06 +00:00
Ian Lance Taylor
2f3189e737 * elfcode.h (map_program_segments): ELF program header entries
must be sorted by load address.  This used to generate the entries
	in reverse order.
1994-02-17 20:39:58 +00:00
David MacKenzie
d1ad85a6e6 * bfd.c (bfd_get_error, bfd_set_error): New functions.
(bfd_error): Make static.
	(bfd_error_type): Renamed from bfd_ec.  Prepend "bfd_error_" to
	all values.
	* bfd-in2.h: Regenerated.
	* aix386-core.c, aout-adobe.c, aout-encap.c, aout-target.h,
	aoutf1.h, aoutx.h, archive.c, archures.c,
	bfd.c, bout.c, cache.c, coff-alpha.c, coff-mips.c,
	coff-rs6000.c, coffcode.h, coffgen.c, core.c, ctor.c,
	ecoff.c, ecofflink.c, elf.c, elf32-hppa.c, elf32-mips.c,
	elfcode.h, format.c, hash.c, hp300hpux.c, hppabsd-core.c,
	i386lynx.c, ieee.c, libbfd.c, libelf.h, linker.c,
	lynx-core.c, nlm.c, nlm32-alpha.c, nlm32-i386.c,
	nlm32-sparc.c, nlmcode.h, oasys.c, opncls.c, osf-core.c,
	ptrace-core.c, reloc16.c, rs6000-core.c, section.c, som.c,
	srec.c, sunos.c, syms.c, targets.c, tekhex.c,
	trad-core.c: Change callers.
1994-02-17 18:08:41 +00:00
Jeff Law
7430a99137 * som.c: Remove FIXMEs for things which have been dealt with. 1994-02-16 06:28:25 +00:00
Ken Raeburn
54196ea170 i960-bout linker fixes, i960 coff config changes 1994-02-16 01:00:57 +00:00
Ken Raeburn
1e02dc457c Support i960 vxworks versions > 5.0 with coff, not bout. Default with no
version number is still bout.  Support explicit i960-coff target too.
1994-02-16 00:59:39 +00:00
Ken Raeburn
ca16370388 (b_out_get_reloc_upper_bound): For BSS section, just return 0.
(aligncode): When shrinking, the addend should be set to the current offset in
the section plus the number of bytes of padding that will actually be retained.
(b_out_relax_section): If a section contains no relocations, don't bother
processing them.
(b_out_get_relocated_section_contents): Set reloc_done.  Assert that
bfd_get_section_contents returns true.  Check that relocs are properly ordered.
(b_out_get_relocated_section_contents, case ALIGNDONE): Assert that reloc's
addend falls between the current source offset and the raw size of the input
section.

Changed some indentation, deleted trailing whitespace, fixed some comments,
removed some "#if 1" lines.
(output_addr): New macro.
(calljx_callback, callj_callback, get_value, abs32code, aligncode,
b_out_get_relocated_section_contents): Use it for readability.
1994-02-16 00:59:19 +00:00
Ken Raeburn
66d9f06f6d (default_indirect_link_order): In assertion, compare link_order size field
against cooked size, not raw size, of input section.
1994-02-16 00:57:48 +00:00
Ken Raeburn
aaa486c3d0 (bfd_get_section_contents): Since this function reads unrelocated contents, the
section's raw size is always the one to use for bounds checking.
1994-02-16 00:57:15 +00:00
Stan Shebs
848743c1b6 Tue Feb 15 12:44:30 1994 Stan Shebs (shebs@andros.cygnus.com)
* mpw-make.in (CSEARCH): Add include/mpw to search path.
	* hosts/mpw.h (stat): Remove incomplete definition, now in
	include/mpw/sys.
	(POSIX_UTIME): Define.
1994-02-15 20:48:53 +00:00
Jeff Law
c6cdb69ae4 * som.c (som_bfd_prep_for_ar_write): Iterate through the SOM
symbols, not the BFD symbols.
        (som_bfd_ar_write_symbol_stuff): Likewise.
1994-02-15 17:01:39 +00:00
Jeff Law
24a1f6a05f * som.c (som_slurp_symbol_table): Do not die if a BFD doesn't
have any symbols.
1994-02-15 07:48:56 +00:00
Jeff Law
6e033f8639 * Finish basic read-write support for SOM archive libraries. Bugs
surely remain as this hasn't been tested all that much.
	* som.c (SOM_LST_HASH_SIZE, SOM_LST_MODULE_LIMIT): Define.
	(struct som_misc_symbol_info): New structure to hold info necessary
	to build both normal and library symbol tables.
	(som_derive_misc_symbol_info): New function to derive info necessary
	to build both normal and library symbol tables.
	(som_build_and_write_symbol_table): Use new function to derive misc
	symbol information.
	(som_slurp_symbol_table): Update backend private data for symbols
	appropriately.
	(som_bfd_prep_for_ar_write): New function.
	(som_bfd_ar_symbol_hash): New function.
	(som_bfd_ar_write_symbol_stuff): New function.
	(som_write_armap): Flesh out.
	(som_vec): Fix ar padding character.

	* som.c: Consistently use memset rather than bzero.
1994-02-15 07:05:04 +00:00
Stu Grossman
7d8752123a * coff-rs6000.c: Add Lynx core file support, use HOST_AIX, where
appropriate.
	* rs6000-core.c:  Use HOST_AIX instead of COREFILES_PLEASE.
	* config/rs6000.mh:  Remove defs of ARCHIVES_PLEASE and
	COREFILES_PLEASE.
	* config/rs6000lynx.mh:  Turn on Lynx core file support.
	* hosts/rs6000.h:  #define HOST_AIX.
	* hosts/rs6000lynx.h:  Create this to enable Lynx host support.
1994-02-15 01:30:25 +00:00
Stu Grossman
5cf354ef0e * hosts/rs6000lynx.h: Create this to enable Lynx host support. 1994-02-15 01:29:26 +00:00
Stu Grossman
8b8ddedb93 * coff-rs6000.c: Add Lynx core file support, use HOST_AIX, where
appropriate.
	* rs6000-core.c:  Use HOST_AIX instead of COREFILES_PLEASE.
	* config/rs6000.mh:  Remove defs of ARCHIVES_PLEASE and
	COREFILES_PLEASE.
	* config/rs6000lynx.mh:  Turn on Lynx core file support.
	* hosts/rs6000.h:  #define HOST_AIX.
1994-02-15 01:28:16 +00:00
Jeff Law
50c5c4ad12 * som.h (som_symbol_data): Safely access backend private data
for BFD symbols.  All callers changed.
1994-02-14 06:15:00 +00:00
Jeff Law
3c37f9ca0c * som.c (som_bfd_count_ar_symbols): New helper function.
(som_bfd_fill_in_ar_symbols): New helper function.
        (som_slurp_armap): New function to read a SOM LST.
1994-02-13 23:34:52 +00:00
Jeff Law
6863eb4b74 * som.h: Include <lst.h> and <ar.h>. 1994-02-13 22:30:51 +00:00
Jeff Law
5e829a3440 * elfcode.h (elf_map_symbols): Fix typo.
(write_object_contents): Check return values from prep_headers and
        elf_compute_section_file_positions.
        (set_section_contents): Likewise.
1994-02-13 06:36:41 +00:00
David MacKenzie
a15691a56e * archive.c (normalize) [VMS]: Call malloc, not bfd_xmalloc.
(bfd_construct_extended_name_table): Check result of normalize.
1994-02-12 00:59:26 +00:00
David MacKenzie
9783e04a64 Make all callers of malloc or realloc (including via obstacks)
check the result for NULL.  Most set bfd_error to no_memory and
	return in that case; a few are harder to fix, and are marked
	with "FIXME <return type>".

	* elf32-hppa.c (hppa_elf_build_arg_reloc_stub
	hppa_elf_build_long_branch_stub):  Check bfd_make_empty_symbol return.
	* linker.c (_bfd_generic_link_output_symbols
	_bfd_generic_link_write_global_symbol): Ditto
	* section.c (bfd_make_section_anyway): Ditto.

	* tekhex.c (find_chunk tekhex_mkobject): Check bfd_alloc.
	(first_phase): Ditto.  FIXME void
	(tekhex_make_empty_symbol): Check bfd_zalloc.

	* sunos.c (sunos_read_dynamic_info): Check bfd_zalloc.
	(MY(read_dynamic_symbols) MY(read_dynamic_relocs)): Check bfd_alloc.

	* stringhash.c (_bfd_stringtab_hash_newfunc): Check bfd_hash_allocate.

	* srec.c: Indent.
	(fillup_symbols): Check bfd_alloc.  FIXME void
	(srec_mkobject srec_get_section_contents
	srec_set_section_contents): Check bfd_alloc.
	(srec_make_empty_symbol): Check bfd_zalloc.

	* som.c (hppa_som_gen_reloc_type): Check bfd_alloc_by_size_t.
	(make_unique_section): Check bfd_alloc.
	(som_new_section_hook): Check bfd_zalloc.
	(bfd_som_attach_aux_hdr): Ditto.  FIXME void

	* rs6000-core.c (rs6000coff_core_p): Check bfd_zalloc.

	* osf-core.c (osf_core_make_empty_symbol): Check bfd_zalloc.
	(osf_core_core_file_p): Check bfd_alloc.

	* oasys.c (oasys_slurp_symbol_table oasys_archive_p
	oasys_mkobject oasys_object_p oasys_new_section_hook
	oasys_set_section_contents): Check bfd_alloc.
	(oasys_slurp_section_data): Check bfd_zalloc and bfd_alloc.
	(oasys_make_empty_symbol): Check bfd_zalloc.

	* nlmcode.h (nlm_make_empty_symbol): Check bfd_zalloc.
	(nlm_slurp_symbol_table): Check bfd_zalloc and bfd_alloc.

	* nlm32-sparc.c (nlm_sparc_read_import): Check bfd_alloc.

	* nlm32-i386.c (nlm_i386_read_import): Check bfd_alloc.

	* nlm32-alpha.c (nlm_alpha_read_import): Check bfd_alloc.

	* linker.c (_bfd_link_hash_newfunc
	(generic_link_hash_newfunc
	(archive_hash_newfunc
	(_bfd_generic_link_add_one_symbol): Check bfd_hash_allocate.
	(_bfd_generic_final_link
	(_bfd_generic_link_output_symbols
	(default_indirect_link_order): Check bfd_alloc.
	(bfd_new_link_order): Check bfd_alloc_by_size_t.

	* irix-core.c (irix_core_make_empty_symbol): Check bfd_zalloc.

	* ieee.c: Indent.
	(read_id get_symbol get_section_entry ieee_archive_p ieee_object_p
	ieee_slurp_section_data ieee_new_section_hook): Check bfd_alloc.
	(do_one): Check bfd_alloc.  Return a boolean.
	(ieee_slurp_section_data): Check it.
	(init_for_output): Check bfd_alloc.  Return a boolean.
	(ieee_set_section_contents): Check it.
	(do_with_relocs):  Check bfd_alloc.  Return a boolean.
	(ieee_bfd_debug_info_accumulate): Ditto.  FIXME void.
	(ieee_mkobject): Check bfd_zalloc.
	(ieee_make_empty_symbol): Check bfd_zmalloc.

	* hpux-core.c (hpux_core_make_empty_symbol): Check
	bfd_zalloc.

	* hppabsd-core.c (hppabsd_core_make_empty_symbol): Check
	bfd_zalloc.
	(hppabsd_core_core_file_p): Check bfd_zalloc.

	* hp300hpux.c (MY(slurp_symbol_table)): Check bfd_alloc.

	* elfcode.h (elf_new_section_hook): Check bfd_alloc.
	(bfd_section_from_phdr): Ditto.
	(write_relocs): Ditto.  FIXME void
	(elf_map_symbols assign_section_numbers map_program_segments):
	Ditto.  Return a boolean.
	(swap_out_syms): Ditto.  Check elf_map_symbols.
	(elf_slurp_symbol_table): Check bfd_zalloc.
	(elf_slurp_reloca_table): Check bfd_alloc.
	(elf_slurp_reloc_table): Ditto.
	(elf_compute_section_file_positions): Check assign_section_numbers.
	(assign_file_positions_except_relocs): Return a boolean.
	Check map_program_segments.
	(elf_compute_section_file_positions): Check it.

	* elf32-mips.c (mips_elf_final_link): Check bfd_alloc.

	* elf32-hppa.c (hppa_elf_stub_branch_reloc): Check bfd_zmalloc and
	realloc.
	(hppa_elf_stub_reloc): Ditto.
	(hppa_elf_build_arg_reloc_stub): Check bfd_zalloc.
	(hppa_elf_build_long_branch_stub): Ditto.
	(elf32_hppa_backend_symbol_table_processing): Ditto.

	* ecoff.c (ecoff_set_symbol_info): Check bfd_alloc.  Return a boolean.
	(ecoff_slurp_symbol_table): Check it.
	(ecoff_slurp_armap): Check bfd_alloc.
	(ecoff_write_armap): Check bfd_zalloc.
	(ecoff_link_hash_newfunc): Check bfd_hash_allocate and
	_bfd_link_hash_newfunc.
	(ecoff_link_add_externals): Check bfd_alloc.

	* ctor.c (bfd_constructor_entry): Check bfd_alloc.

	* coffgen.c (coff_real_object_p): Check bfd_alloc.
	(coff_renumber_symbols): Check bfd_alloc_by_size_t.  Return a boolean.
	(coff_write_symbol): Check bfd_alloc.  FIXME int
	(coff_write_linenumbers): Check bfd_alloc.  Return a boolean.
	(coff_section_symbol): Check bfd_alloc_by_size_t.
	(coff_get_normalized_symtab): Check bfd_alloc.
	(coff_bfd_make_debug_symbol): Check bfd_zalloc.
	* libcoff-in.h: Change decls of coff_renumber_symbols,
	coff_write_linenumbers.
	* libcoff.h: Rebuilt.
	* coffcode.h (coff_write_object_contents): Check
	coff_renumber_symbols, coff_write_linenumbers.

	* coffcode.h: Indent.
	(coff_add_missing_symbols): Check bfd_alloc_by_size_t.  Return a
	boolean.
	(coff_write_object_contents): Check it.

	* coff-alpha.c (alpha_relocate_section): Check bfd_alloc.
	* coff-mips.c (mips_relocate_section): Ditto.

	* archive.c (bfd_slurp_bsd_armap_f2): Check bfd_alloc value.
	(do_slurp_bsd_armap): Ditto.
	(compute_and_write_armap): Check bfd_realloc value.

	* aoutx.h (translate_from_native_sym_flags): Check bfd_alloc
	return value.  Return boolean value.
	(NAME(aout,make_empty_symbol)): Check bfd_zalloc return value.
	(NAME(aout,slurp_symbol_table)): Check bf_alloc and bfd_zalloc
	return value.
	(add_to_stringtab): Ditto.  FIXME void
	(aout_link_hash_newfunc): Check bfd_hash_allocate return value.
	(aout_link_add_symbols): Check bfd_alloc value.
	(translate_symbol_table): Check translate_from_native_sym_flags.
	* hp300hpux.c (MY(slurp_symbol_table)): Ditto.
	* aoutx.h (aout_link_hash_newfunc): Check _bfd_link_hash_newfunc.

	* opncls.c (bfd_zalloc bfd_realloc): Check result of bfd_alloc.

	* opncls.c (obstack_chunk_alloc): Define as malloc, not
	bfd_xmalloc_by_size_t.
	(_bfd_new_bfd): Check obstack_begin for 0 return.

	* ieee.c (obstack_chunk_alloc): Define as malloc, not
	bfd_xmalloc_by_size_t.
	(ieee_archive_p): Check obstack_begin for 0 return and
	obstack_finish for NULL return.

	* hash.c (obstack_chunk_alloc): Define as malloc, not
	bfd_xmalloc_by_size_t.
	(bfd_hash_table_init_n): Check obstack_begin for 0 return and
	obstack_finish for NULL return.
	(bfd_hash_lookup): Check obstack_alloc for NULL return.

	* ecofflink.c (obstack_chunk_alloc): Define as malloc, not
	bfd_xmalloc_by_size_t.
	bfd_ecoff_debug_accumulate
	bfd_ecoff_debug_accumulate_other): Check obstack_alloc.
	(add_file_shuffle add_memory_shuffle): Check obstack_alloc for
	NULL return.  Return boolean, not void.
	(bfd_ecoff_debug_init): Check obstack_begin for 0 return.
	(bfd_ecoff_debug_accumulate): Check add_file_shuffle
	and add_memory_shuffle return.
	(string_hash_newfunc): Check bfd_hash_allocate and bfd_hash_newfunc.
	(bfd_ecoff_debug_accumulate): Check bfd_alloc.
	(ecoff_add_string): Check add_memory_shuffle return.

	* libbfd-in.h (xmalloc, bfd_xmalloc, bfd_xmalloc_by_size_t):
	Remove decls.
	* libbfd.h: Rebuilt.
1994-02-12 00:45:54 +00:00
Stu Grossman
30e441ca45 * configure.host: Add Lynx/rs6000 support.
* config/i386-nlm.mt:  Enable a.out file support.
	* config/rs6000lynx.mh:  Lynx/rs6000 host support.
1994-02-11 23:39:38 +00:00
Ian Lance Taylor
5ee3886b48 * archive.c (compute_and_write_armap): Rewrite somewhat to improve
memory usage.
1994-02-11 22:30:18 +00:00
Stan Shebs
9a793780e5 Fri Feb 11 13:10:42 1994 Stan Shebs (shebs@andros.cygnus.com)
* archive.c: Change all references to '\n' in archive magic
	to '\012', for greater portability.
	* ecoff.c (ecoff_write_armap): Ditto.
1994-02-11 21:18:16 +00:00
Jeff Law
a62dd44f9c * som.c: Cast return values from BFD memory allocation routines to
avoid warnings from the HP compiler.
1994-02-10 05:36:41 +00:00
Ian Lance Taylor
0d634116b2 * coff-alpha.c (alpha_relocate_section): Accept a LITERAL
reloc on an "ldl" instruction too.
1994-02-09 22:17:49 +00:00
Ian Lance Taylor
945f125b45 * coff-rs6000.c (rs6000coff_mkarchive): Return false.
(rs6000_coff_snarf_ar_hdr): Don't declare errno; it's not used.
	Also removed unused variable namelen.
	(rs6000coff_write_armap): Declare orl_count and stridx parameters.
1994-02-09 17:59:32 +00:00
Ken Raeburn
fa965415f5 * coff-alpha.c (reloc_nil): New function.
(alpha_howto_table): Use it as special_function to prevent certain relocs from
being adjusted by bfd_perform_relocation.  IGNORE reloc should be
partial_inplace.
(alpha_ecoff_get_relocated_section_contents): Accept a LITERAL reloc on an
"ldl" instruction too.
1994-02-08 20:58:20 +00:00
Peter Schauer
7c202d3775 * elf32-hppa.c (CURRENT_STUB_OFFSET, hppa_elf_build_arg_reloc_stub,
hppa_elf_build_long_branch_stub):  Cast to char * instead of int
	before performing pointer arithmetic.
1994-02-08 08:57:46 +00:00
Jeff Law
9ed21f0ebf * config.bfd (hppa*-*-osf*): Use bfd_name hppaosf for this
configuration.
        (hppa*-*-*elf*): This configuration used hppa-elf now.

        * som.c: This file is also used for HOST_HPPAOSF.

        * targets.c (bfd_target_vector): Enable som_vec for HOST_HPPAOSF.

        * hosts/hppaosf.h: New host configuration file.

        * config/hppabsd.mt (SELECT_VECS): Add bfd_elf32_hppa_vec as
        BSD handles both SOM and ELF object files.

        * config/hppaosf.mh (HDEFINES): Delete.  No longer needed.
        (RANLIB): Doesn't do anything, define it to be "echo".

        * config/hppaosf.mt: New target makefile fragment for a PA running
        OSF1.
1994-02-08 05:17:01 +00:00
Jeff Law
6941fd4d64 * som.c: This file is also used for HOST_HPPAOSF.
* targets.c (bfd_target_vector): Enable som_vec for HOST_HPPAOSF.
1994-02-08 05:09:34 +00:00
Jeff Law
1c8c89a8b2 New host configuration file. 1994-02-08 04:58:32 +00:00
Ian Lance Taylor
66f1cff54b * archures.c (enum bfd_architecture): Added bfd_arch_powerpc.
(archures_init_table): If SELECT_ARCHITECTURES is not defined,
	added bfd_powerpc_arch.
	* bfd-in2.h: Rebuilt.
	* cpu-powerpc.c: New file.
	* Makefile.in (ALL_MACHINES, CFILES): Added cpu-powerpc.c.
	Rebuilt dependencies.
1994-02-08 00:38:00 +00:00
Ian Lance Taylor
384c17918b PowerPC CPU support. 1994-02-08 00:35:31 +00:00
Ian Lance Taylor
bf96913525 * elfcode.h (bfd_section_from_shdr): Get vma and alignment_power
of an SHT_STRTAB section from sh_addr and sh_addralign, rather
	than just setting them to zero.
1994-02-07 20:04:46 +00:00
David MacKenzie
b9d5cdf003 * elfcode.h (prep_headers, swap_out_syms): Check for NULL return
from bfd_new_strtab.
	(elf_compute_section_file_positions): Check for false return from
	swap_out_syms.

	* linker.c (default_indirect_link_order): Check for NULL return
	from bfd_get_relocated_section_contents.

	* syms.c: Make example application in doc call xmalloc, not
	bfd_xmalloc.

	* aoutx.h (NAME(aout,slurp_symbol_table),
	aout_link_get_symbols, NAME(aout,link_hash_table_create)):
	* bout.c (b_out_slurp_reloc_table, b_out_squirt_out_relocs):
	* ecoff.c (ecoff_bfd_link_hash_table_create):
	* ecofflink.c (bfd_ecoff_debug_init):
	* format.c (bfd_check_format_matches):
	* linker.c (_bfd_generic_link_hash_table_create):
	(_bfd_generic_final_link):
	* reloc16.c (bfd_coff_reloc16_relax_section):
	(bfd_coff_reloc16_get_relocated_section_contents):
	* elf32-hppa.c (hppa_elf_build_arg_reloc_stub):
	* elf32-mips.c (mips_elf_final_link):
	* elfcode.h (bfd_new_strtab):
	(bfd_add_2_to_strtab):
	(elf_slurp_symbol_table):
	(elf_corefile_note):
	* libbfd.c (bfd_zmalloc):
	Use malloc and check the result, instead of bfd_xmalloc.
1994-02-07 05:17:21 +00:00
Jim Kingdon
6b054519ff * config.bfd: Put m68*-*-sysv* line after m68*-*-sysv4*. 1994-02-05 20:41:44 +00:00
Peter Schauer
bf430317a5 * srec.c (srec_write_record): Put CONST keyword for "src" before
"unsigned", some compilers don't like it after "unsigned".
	* libcoff.h, libcoff-in.h (bfd_perform_slip):  Rename "value" to
	"val" in prototype declaration because some compilers don't like
	arguments whose names are the same as types.
1994-02-05 13:38:52 +00:00
Ian Lance Taylor
9b39ed6bfa * aoutx.h (aout_link_check_ar_symbols): Correct test for whether
object file defines symbol.  Also, if skipping a symbol, skip the
	second symbol of a N_WARNING or N_INDR symbol as well.
1994-02-05 06:17:36 +00:00
Ian Lance Taylor
d352be4f43 * reloc.c (bfd_perform_relocation): Work around one gross hack
with another: actually look at the target name to avoid the broken
	COFF check.
	(bfd_reloc_code_real_type): Add BFD_RELOC_PPC_B26,
	BFD_RELOC_PPC_BA26 and BFD_RELOC_PPC_TOC16.
	* bfd-in2.h: Rebuilt.
1994-02-05 05:13:59 +00:00
Ian Lance Taylor
c8d672fe7a * coffcode.h (combined_entry_type): Changed fix_tag and fix_end
fields to bitfields.  Added fields fix_value and fix_scnlen.
	(sec_to_styp_flags): If STYP_DEBUG is defined, use it rather than
	STYP_INFO for the type of a section named .debug.
	(coff_add_missing_symbols): Don't define if RS6000COFF_C.
	(coff_write_object_contents): If RS6000COFF_C, don't call
	coff_add_missing_symbols.
	(coff_slurp_symbol_table): If RS6000COFF_C, then if the last aux
	entry has type STY_LD change the x_scnlen into a pointer to a
	symbol and set fix_scnlen.  Also, for a C_BSTAT symbol, change the
	value into a pointer to a symbol and set fix_value.
	* libcoff.h: Rebuilt.
	* coffgen.c (coff_mangle_symbols): Reindent.  If fix_value is set,
	get the symbol offset. Likewise for fix_scnlen.
	(string_size): Change type to bfd_size_type.
	(debug_string_size, debug_string_section): New static variables.
	(coff_fix_symbol_name): If bfd_coff_symname_in_debug returns true,
	write the symbol name into the .debug section; assume that the
	section has already been created with the right size.
	(coff_write_symbols): Initialize debug_string_size to 0.  If
	bfd_coff_symname_in_debug returns true, don't put symbol name in
	usual string table.  After writing out all symbols, if
	debug_string_size is not 0, check that it matches the size of the
	.debug section.
	(coff_get_normalized_symtab): Clear new fix_value and fix_scnlen
	fields.  If the string offset is 0, always use an empty string as
	the name.
	(coff_make_empty_symbol): Zero out the symbol structure.
1994-02-05 05:11:46 +00:00
David MacKenzie
6a5439a91f Eliminate arg from bfd_xmalloc_by_size_t macro, allowing
undoing of obstack parts of last change.
1994-02-05 03:02:32 +00:00
David MacKenzie
0ee3427297 * libbfd.c (bfd_zmalloc): Call bfd_xmalloc instead of malloc.
(bfd_xmalloc, bfd_xmalloc_by_size_t): Functions deleted.
	* libbfd-in.h: Define them as macros calling xmalloc and declare
	xmalloc.
	* libbfd.h: Rebuilt.
	* ecofflink.c hash.c ieee.c opncls.c (obstack_chunk_alloc): Define
	to be xmalloc, not bfd_xmalloc_by_size_t.
1994-02-05 02:46:12 +00:00
Ian Lance Taylor
cbc174e7ab * ecofflink.c (bfd_ecoff_debug_externals): If a small undefined
symbol has a value in the ECOFF symbol but not in the BFD symbol,
	keep the value in the ECOFF symbol.  This helps gas.
1994-02-04 04:18:28 +00:00
Ian Lance Taylor
5072b8e530 * linker.c (_bfd_generic_link_output_symbols,
_bfd_generic_link_write_global_symbol): Don't require that all
	references to a common symbol be themselves common symbols.
1994-02-03 23:01:49 +00:00
Ian Lance Taylor
fa2302b8ed * aoutx.h (aout_reloc_index_to_section): Handle N_UNDF. 1994-02-03 21:52:06 +00:00
Jim Kingdon
0324156c66 * bfd-in2.h: Rebuilt. 1994-02-03 04:03:11 +00:00
Jim Kingdon
78c3dc5cee * bfd-in2.h: Rebuilt. 1994-02-03 03:33:20 +00:00
Jim Kingdon
96ad107bcc * libbfd.c, bfd-in.h, hosts/alphaosf.h, hosts/sparc-ll.h, aoutf1.h,
sparclynx.c, Makefile.in: Change HOST_64_BIT to BFD_HOST_64_BIT.
1994-02-03 03:31:22 +00:00
Ian Lance Taylor
38e1f0cecd * coffswap.h (coff_swap_reloc_out): If RS6000COFF_C, handle type
and size correctly.
	(coff_swap_aux_in): If RS6000COFF_C, change x_csect.x_scnlen to
	x_csect.x_scnlen.l to match change in coff/internal.h.
	(coff_swap_aux_out): Likewise.
1994-02-02 19:35:14 +00:00
Ian Lance Taylor
ebf3b4cd68 * coff-mips.c (mips_ecoff_backend_data), coff-alpha.c
(alpha_ecoff_backend_data): Change casts of aux_in and aux_out
	fields to match yesterday's changes.
1994-02-02 17:40:46 +00:00
Ian Lance Taylor
192d8ee84b * coffcode.h (coff_write_relocs): If SELECT_RELOC is defined, pass
in the internal_reloc itself, not the type.
	* coff-apollo.c, coff-h8300.c, coff-h8500.c, coff-i386.c,
	coff-m68k.c, coff-sh.c, coff-we32k.c, coff-z8k.c: Changed
	definition of SELECT_RELOC accordingly.
1994-02-02 17:36:17 +00:00
Ian Lance Taylor
330595d00b * coffcode.h (bfd_coff_backend_data): Added new arguments to
_bfd_coff_swap_aux_in and _bfd_coff_swap_aux_out: aux index number
	and number of aux entries.
	(bfd_coff_swap_aux_in, bfd_coff_swap_aux_out): Changed
	accordingly.
	* libcoff.h: Rebuilt.
	* coffswap.h (coff_swap_aux_in, coff_swap_aux_out): Accept new
	arguments.  If RS6000COFF_C, only treat C_EXT and C_HIDEXT
	specially if this is the last aux entry.
	* coffgen.c (coff_write_symbol, coff_get_normalized_symtab): Pass
	new arguments to swap_aux functions.
1994-02-01 17:11:56 +00:00
Ken Raeburn
26b572e4d9 Makefile.in (check, installcheck): Identify directory in "no testsuites"
message.
1994-01-31 04:20:00 +00:00
Ken Raeburn
4e8108491b * gen-aout.c (main): Set DEFAULT_ARCH based on preprocessor macros
(only testing for m68k and vax at the moment); do verify that the
	preprocessor didn't trash the arch name inside the string version.
	Don't print out "pagesize =" line that prevents output from
	compiling.  Derive BYTES_IN_WORD and ARCH values from sizeof
	results.
	* Makefile.in (aout-params.h): Pass gen-aout a dummy target name.
1994-01-30 20:30:53 +00:00
Ian Lance Taylor
2edc8357de * aoutx.h (aout_link_write_symbols): Write out correct value for
object file symbol.
1994-01-30 18:29:26 +00:00
Ken Raeburn
098630a0e0 * hosts/vaxbsd.h (HOST_STACK_END_ADDR): Vax BSD doesn't define
KERNBASE, so hard-code 0x80000000 instead.
1994-01-28 23:42:25 +00:00
Ian Lance Taylor
c315696657 * linker.c (generic_link_add_symbol_list): If symbol is common,
set the BSF_OLD_COMMON flag.
1994-01-27 18:56:42 +00:00
David MacKenzie
d6d4e4c3d0 * format.c (bfd_check_format_matches): Put the new entry in the
correct element of matching_vector.
1994-01-26 21:53:55 +00:00
Ian Lance Taylor
8638431e66 * reloc.c (bfd_get_reloc_size): Size of type -2 is 4 bytes, not 2. 1994-01-25 20:48:48 +00:00
Ian Lance Taylor
3b490cdddb * hp300hpux.c (MY(write_object_contents)): Write out the symbols
before writing out the relocs, so that the right symbol indices
	are used.
1994-01-25 18:38:20 +00:00
Ian Lance Taylor
71d58b5976 * archive.c (do_slurp_bsd_armap, bfd_slurp_bsd_armap_f2): Do not
try to overlay the internal carsyms on the external symdefs.  That
	can not work if the size of a host pointer is larger than 4 bytes.
1994-01-25 18:20:50 +00:00
Ian Lance Taylor
751446f635 * format.c (bfd_check_format_matches): Cast result of
bfd_xmalloc_by_size_t.
	* opncls.c (_bfd_new_bfd): Avoid ANSI C prototype.
1994-01-25 18:14:25 +00:00