Commit Graph

934 Commits

Author SHA1 Message Date
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
Ken Raeburn ff9785703d * aoutx.h (reloc_type_lookup): Handle BFD_RELOC_CTOR on a 64-bit
machine.  Handle BFD_RELOC_SPARC13 and BFD_RELOC_SPARC_BASE13.
1994-03-19 01:39:36 +00:00
Ken Raeburn 5a66538bcb * bfd-in.h (BFD_VERSION): Use @VERSION@.
* Makefile.in (bfd.h): Replace it with contents of VERSION file.
* bfd-in2.h: Regenerated.
1994-03-17 23:47:00 +00:00
Ken Raeburn 6f4aac6cb9 (trad_unix_bfd_is_local_label): Fixed typo where
this was also named trad_unix_bfd_copy_private_bfd_data.
1994-03-17 23:38:36 +00:00
Ian Lance Taylor 7838792b0c * osf-core.c (osf_core_bfd_copy_private_bfd_data): Remove
duplicate definition.
	(osf_core_bfd_is_local_label): Define.
1994-03-17 23:26:03 +00:00
Jim Kingdon 8eb5d4be69 * aoutx.h, elfcode.h, coff-alpha.c, bout.c, ecoff.c, ecofflink.c,
elf32-hppa.c, elf32-mips.c, linker.c, som.c, sunos.c: If malloc(0)
	returns NULL, it is not an error.  It's possible that some of
	these checks are not necessary (because the size can never be
	zero), but putting in the checks is the conservative thing to do
	in light of the fact that some of these malloc calls replaced
	unchecked alloca calls, in which a zero argument would work fine.
1994-03-17 18:54:48 +00:00
Ian Lance Taylor 4bbf7a4924 * reloc.c (bfd_generic_get_relocated_section_contents): Don't fail
if malloc (0) fails.  bfd_canonicalize_reloc returning 0 is not a
	failure indication, it merely means there are no relocs.
1994-03-17 17:29:15 +00:00
Ian Lance Taylor 1c6042ee10 * elfcode.h (NAME(bfd_elf,write_object_contents)): Don't use space
after NAME, since SunOS /bin/cc can't handle it.
1994-03-17 16:47:01 +00:00
David MacKenzie ae6710bc98 * netbsd386.c (N_SET_FLAGS): Don't nuke the machine id field.
From sukes@glue.umd.edu (Tasuki Hirata).
1994-03-17 00:45:26 +00:00
Jeff Law 35ac8aacf9 * som.c (som_prep_for_fixups): Detect section symbols based
on either the lack of private data or the symbol flags.  Do not
        munge section symbol names anymore -- they no longer confuse GDB.
        (som_begin_writing): Leave space for an exec header if writing
        an executable.
        (som_slurp_symbol_table): Recognize both forms of section symbol
        names "L$0\002" and "$<FOO>$".  Change the name of "L$0\002"
        section symbols to be the name of the section they represent.
        Debugging  symbols begin with "L$0\001", not just "L$".
1994-03-16 08:03:46 +00:00
Jeff Law 5b3577cb7a * bfd-in2.h, libbfd.h, libcoff.h: Rebuilt.
* bfd-in.h (JUMP_TABLE): Add new entries to the jump table
	for bfd_copy_private_section_data, bfd_copy_private_bfd_data,
	and bfd_is_local_label.

	* targets.c: Add new entries to the bfd_target structure.

	* bfd.c (bfd_copy_private_bfd_data): New definition.

	* section.c (bfd_copy_private_section_data): New definition.

	* syms.c (bfd_is_local_label): New definition.

	* libbfd-in.h (bfd_generic_is_local_label): Declare.

	* libbfd.c (bfd_generic_is_local_label): New function.

	* *-core.c: Provide default definitions for new functions in
	the target vector which all point to bfd_false.

	* aout-target.h, coffcode.h, elf32-target.h elf64-target.h, ieee.c
	libaout.h, libecoff.h, nlm-target.h, oasys.c, srec.c, tekhex.c
	Default new vectors for copying private backend data to bfd_true.
	Default new vector for determining if a symbol is a local label
	to bfd_generic_is_local_label.

	* som.c (som_bfd_copy_private_section_data): New function.
	(som_bfd_is_local_label): New function.
	(som_bfd_copy_private_bfd_data): For now default to bfd_true.

	* elf32-hppa.c (hppa_elf_is_local_label): New function.
1994-03-16 07:02:05 +00:00
Ian Lance Taylor 0069bd06b3 * cf-m68klynx.c (CALC_ADDEND): Use _bfd_m68klynx_howto_table. 1994-03-16 04:57:11 +00:00
David MacKenzie 57a1867e6c * Most files:
Replace DEFUN and DEFUN_VOID with K&R-style function definition.
	Indent some of them to GNU standards.

	* aout32.c, archures.c, core.c, cpu-h8300.c, cpu-i960.c,
	cpu-m68k.c, cpu-m88k.c, cpu-mips.c, cpu-vax.c, ctor.c, demo64.c,
	elf32-hppa.h, gen-aout.c, host-aout.c, init.c, libhppa.h,
	libieee.h, liboasys.h, newsos3.c, som.h, stab-syms.c, sunos.c:
	Update copyright years.
1994-03-15 15:13:13 +00:00
Jeff Law baef2065d0 * som.c (som_prep_for_fixups): A relocation involving the section
symbol for the *ABS* section is really a relocation involving
        no symbol.
        (som_slurp_symbol_table): Do not set BSF_GLOBAL or BSF_EXPORT for
        undefined symbols.  Correctly distinguish between debugger symbols
        and section symbols.
1994-03-15 05:21:51 +00:00
Jeff Law b486fb13be * som (setup_sections): Set SEC_DEBUGGING and the section attributes
for spaces and subspaces.
1994-03-15 04:40:51 +00:00
Jeff Law 4c9db344d2 * som.c (som_bfd_count_ar_symbols): Fix typo. 1994-03-14 21:53:29 +00:00
Jeff Law ec743ceff2 * som.c (som_object_setup): Set EXEC_P, D_PAGED, WP_TEXT, and
HAS_RELOC based on the object's magic number.
        (make_unique_section): Delete function.  BFD and its users are
        prepared to handle multiple sections with the same name.
        (setup_sections): Allocate space on the BFD's obstack to hold
        section names.  Use bfd_make_setion_anyway rather than the
        obsolete make_unique_section.
        (som_prep_headers): Choose the correct SOM magic number based
        on the BFD's flags.
        (som_bfd_fill_in_ar_symbols): Return false, not NULL on error.
1994-03-14 19:43:01 +00:00
Ian Lance Taylor 45ccfd58d2 * elf32-ppc.c: Renamed from elf32-powerpc.c.
start-sanitize-powerpc-netware
	* nlm32-ppc.c: Renamed from nlm32-powerpc.c.
 	end-sanitize-powerpc-netware
	* Makefile.in, configure.in: Corresponding changes.
1994-03-12 17:48:16 +00:00
Ian Lance Taylor 92177c5242 * elf32-powerpc.c: Extensive changes to update to preliminary ABI.
Many changes to nlm32-powerpc.c as well, but I'm not bothering to make
a ChangeLog entry to avoid sanitization headaches.
1994-03-12 03:30:52 +00:00
Peter Schauer 3e0b555420 * sunos.c (sunos_read_dynamic_info): Assume that dynamic info
is always located at the start of the data section to allow
	recovery of the dynamic info from a stripped executable.
	* ecoff.c (ecoff_styp_to_sec_flags):  Handle STYP_PDATA, STYP_XDATA
	and STYP_COMMENT.
1994-03-11 09:03:07 +00:00
Jim Kingdon d7fb453182 * libbfd-in.h: Remove alloca cruft. It was missing some necessary
cruft (like the #pragma alloca for AIX).
	In addition to that problem, the C alloca calls xmalloc, which
	means checking for being out of memory can't work right.  The
	following changes remove all uses of alloca from BFD.
	* hosts/solaris2.h: Remove alloca cruft.
	* som.c: Replace alloca with a fixed size auto array.
	* aoutx.h, elfcode.h, nlmcode.h, bout.c, coff-alpha.c, ecoff.c,
	ecofflink.c, elf32-hppa.c, elf32-mips.c, linker.c, reloc.c, som.c,
	sunos.c: Replace alloca with malloc and appropriate error checking and
	freeing.
	* linker.c: Replace alloca with obstack_alloc.
	* libbfd.h: Rebuilt.
1994-03-10 02:33:01 +00:00
Jim Kingdon 80425e6c82 * libbfd-in.h: Remove alloca cruft. It was missing some necessary
cruft (like the #pragma alloca for AIX).
	In addition to that problem, the C alloca calls xmalloc, which
	means checking for being out of memory can't work right.  The
	following changes remove all uses of alloca from BFD.
	* hosts/solaris2.h: Remove alloca cruft.
	* som.c: Replace alloca with a fixed size auto array.
	* aoutx.h, elfcode.h, nlmcode.h, bout.c, coff-alpha.c, ecoff.c,
	ecofflink.c, elf32-hppa.c, elf32-mips.c, linker.c, reloc.c, som.c:
	Replace alloca with malloc and appropriate error checking and
	freeing.
	* linker.c: Replace alloca with obstack_alloc.
	* libbfd.h: Rebuilt.
1994-03-10 02:09:10 +00:00
Ian Lance Taylor 1404c3656d * coff-mips.c (mips_relocate_section): Handle MIPS_R_LITERAL like
MIPS_R_GPREL.
1994-03-08 20:11:44 +00:00
Peter Schauer 802f4fe2f7 Add lost lines to previous ChangeLog entry. 1994-03-07 21:38:41 +00:00
Peter Schauer 25677b5b30 * elf32-hppa.h, elfcode.h: Replace uses of Elf*_Half, Elf*_Word,
Elf*_Off typedefs by their expansion, the typedefs have been
	removed from include/elf/internal.h.
1994-03-05 22:41:41 +00:00
Jeff Law 7b5f6e48f1 * som.h (_PA_RISC_ID): Treat HOST_HPPAOSF just like HOST_HPPABSD. 1994-03-04 04:04:48 +00:00
Jim Kingdon baf200d479 * configure.host: Recognize i[34]86-sequent-*.
* trad-core.c (trad_unix_core_file_p): A non-zero, not zero,
	return from bfd_seek indicates an error.
	New macro TRAD_CORE_DSIZE_INCLUDES_TSIZE to replace
	TRAD_CORE_STACK_OFFSET.
	* hosts/symmetry.h: Define TRAD_CORE_DSIZE_INCLUDES_TSIZE and
	TRAD_CORE_USER_OFFSET but not HOST_STACK_OFFSET.
1994-03-03 02:38:24 +00:00
Jeff Law 4e64845ca5 * som.[ch]: Do not include libhppa.h in som.c, instead include
it in som.h.

        * elf32-hppa.[ch]: Do not include libhppa.h in elf32-hppa.c, instead
        include it in elf32-hppa.h.
1994-03-02 23:04:29 +00:00
Jeff Law 98ecc94548 * som.c (log2): Return -1 on error rather than aborting.
(setup_sections): Bubble up an error from log2.
1994-03-02 20:32:10 +00:00
Jeff Law 44fd66228a * som.c (hppa_som_gen_reloc_type): Use correct enum type for
field parameter.
        (bfd_som_set_section_attributes): Use unsigned int rather than
        unsigned char to avoid GNU-C extensions.
        (bfd_som_attach_aux_hdr): Return a boolean to indicate success
        or failure rather than aborting on failure.

        * som.h (bfd_som_set_section_attributes): Fix prototype to match
        som.c changes.
        (bfd_som_attach_aux_hdr): Add prototype.
        (hppa_som-gen_reloc_type): Likewise.

        * elf32-hppa.c: Add a couple casts to make HP compiler happy.
        (hppa_look_for_stubs_in_section): Do not return false on failure
        until rest of code is ready to handle it.  Abort for now.
1994-03-02 19:59:03 +00:00
Jim Kingdon d1f8b18147 * bfd-in2.h: Rebuilt. 1994-03-02 02:36:07 +00:00
Kung Hsu bb37e7161e Modified Files:
ChangeLog i386os9k.c Makefile.in

        * i386os9k.c: use new functions bfd_set_error and bfd_get_error.
        * Makefile.in: delete an extra blank.
1994-03-01 21:39:28 +00:00