Commit Graph

2119 Commits

Author SHA1 Message Date
Ian Lance Taylor ea4849d5b7 * ecoff.c (_bfd_ecoff_new_section_hook): Default section alignment
power to 4, rather than using align_power_min.
1994-10-04 21:30:45 +00:00
Ian Lance Taylor 28d19d0321 * coffcode.h (coff_new_section_hook): Don't use align_power_min;
use COFF_DEFAULT_SECTION_ALIGNMENT_POWER instead.  Force the .stab
	and .stabstr sections to be aligned to no more than 2.  Remove
	COFF_SPARC special cases.
	* coff-a29k.c: Define COFF_DEFAULT_SECTION_ALIGNMENT_POWER.
	* coff-apollo.c, coff-go32.c, coff-h8300.c: Likewise.
	* coff-h8500.c, coff-i386.c, coff-i960.c, coff-m68k.c: Likewise.
	* coff-m88k.c, coff-rs6000.c, coff-sh.c, coff-sparc.c: Likewise.
	* coff-we32k.c, coff-z8k.c: Likewise.
PR 5706.
1994-10-04 21:13:51 +00:00
Ian Lance Taylor 995b0d3ff3 * configure.in: Use ${config_shell} when running config.bfd. 1994-10-04 16:18:19 +00:00
Ian Lance Taylor a297d42c27 * cofflink.c (coff_link_input_bfd): Don't try to convert a long
filename if the offset field is zero.
1994-10-04 15:54:27 +00:00
Ian Lance Taylor dfaf9ef608 * elfcode.h (swap_out_syms): If the alignment of a common symbol
was not set, use a sensible default rather than zero.
PR 5751.
1994-10-04 15:25:02 +00:00
Peter Schauer 7a6c910ea1 * rs6000-core.c (rs6000coff_core_p): Set SEC_HAS_CONTENTS flag
for .stack and .ldinfo sections. Cast coredata.c_tab to a
	file_ptr to avoid warnings from gcc.
1994-10-03 11:47:38 +00:00
Ian Lance Taylor fb562be02f * elfcode.h (elf_bfd_final_link): Remove assertion when a non
SEC_IN_MEMORY section is found in dynobj.  This can happen when
	linking PIC compiled code.
1994-09-30 17:13:08 +00:00
Ken Raeburn 12cf5d98c7 fix typu 1994-09-29 20:51:57 +00:00
Ken Raeburn 85f340909d * reloc.c (bfd_install_relocation): Change type of data to bfd_byte *, to go
along with yesterday's change.
1994-09-29 20:39:27 +00:00
Ken Raeburn 64e21e0fd7 * elf.c (bfd_elf_print_symbol): Moved here from elf_print_symbol in elfcode.h.
(case bfd_print_symbol_all): Print symbol's size field, except for common
symbols; print their alignment.
* elfcode.h (elf_print_symbol): Deleted.
* libelf.h (bfd_elf_print_symbol): Declare.
(bfd_elf{32,64}_print_symbol): Replace declarations with macros.
1994-09-29 20:36:24 +00:00
Ken Raeburn 9afa408e4f * syms.c (bfd_print_symbol_vandf): Show BSF_LOCAL and BSF_GLOBAL in one column.
Use the column freed up to show BSF_FUNCTION and BSF_FILE.
1994-09-29 20:29:54 +00:00
Ian Lance Taylor ec591fcf45 * syms.c (stt): Add .rdata and .rodata.
PR 5714.
1994-09-29 16:30:12 +00:00
Ian Lance Taylor 094e8be303 * reloc.c (bfd_install_relocation): Cast data_start to bfd_byte *
before trying to add values to it.
1994-09-28 17:36:42 +00:00
Ian Lance Taylor 5ea9089194 * elfcode.h (assign_file_positions_except_relocs): Align the
section VMA and the file position even if D_PAGED is not set.
1994-09-26 15:40:12 +00:00
Ian Lance Taylor d80ebaacea * bfd-in.h (bfd_seek): Change declaration to not mark fp const.
* bfd-in2.h: Rebuild.
	* libbfd.c (bfd_seek): Don't mark parameters const, to avoid
	conflicts with declaration.
1994-09-26 15:01:59 +00:00
Ian Lance Taylor 0d9e139762 tipo 1994-09-26 02:48:36 +00:00
Ian Lance Taylor 57b400818d * elfcode.h (map_program_segments): Don't abort if we allocated
too much space for the program header, only if we allocated too
	little.
1994-09-23 19:19:41 +00:00
J.T. Conklin 237402b49b * libaout.h: Fix comment.
* ns32knbsd.h: Changed M_NS32K_NETBSD to M_532_NETBSD to match
  libaout.h.
1994-09-20 20:20:12 +00:00
Ian Lance Taylor f90a2cdcb0 * coff-sh.c (rtype2howto): Remove; unused.
(coff_sh_relocate_section): Remove unused local variable rstat.
	(reloc_processing): Comment out; unused.
1994-09-20 19:24:50 +00:00
Ian Lance Taylor fb9a219279 * aoutx.h (aout_link_write_other_symbol): If h->indx is -2, then
always write it out even if it would normally be stripped.
	(aout_link_input_section_std): If we find a reloc against a
	stripped global symbol, force it to be written out rather than
	merely calling unattached_reloc.
	(aout_link_input_section_ext): Likewise.
	(aout_link_reloc_link_order): Likewise.
1994-09-16 16:14:51 +00:00
Ian Lance Taylor ab0434c26d * aoutx.h (aout_link_write_symbols): Rename skip_indirect to
skip_next.  If we find an N_WARNING symbol which has already been
	written out, set skip_next.
PR 5634.
1994-09-14 23:28:25 +00:00
Jeff Law a8d0866480 * som.h (struct somdata): New field sorted_syms.
(obj_som_sorted_syms): Accessor macro.
	* som.c (som_object_setup): Initialize sorted_syms to NULL.
	(som_prep_for_fixups): Sort a copy of the BFD's symbol table;
	store the sorted symbol table in sorted_syms.
	(som_write_fixups): Initalize tmp_reloc to NULL to make GCC happy.
	(som_begin_writing): Similarly for exec_header.  Pass the sorted
	symbol table to som_write_symbol_strings.
	(som_build_and_write_symbol_table): Use the sorted symbols rather
	than the canonical symbol table.
1994-09-14 22:24:56 +00:00
Jeff Law 8a2cdc6278 * som.h (som_symbol_type): Add "stringtab_offset" field.
* som.c (som_write_symbol_strings): Use "stringtab_offset"
	rather than destroying the "name" field in the BFD symbol.
	(som_build_and_write_symbol_table): Likewise.
1994-09-14 21:44:35 +00:00
J.T. Conklin 1c1d90f1fe Updated for recent NetBSD changes 1994-09-14 20:26:54 +00:00
Ian Lance Taylor 060ea29053 Rebuilt dependencies. 1994-09-14 20:26:40 +00:00
Ian Lance Taylor 9be909aef7 * libecoff.h (struct ecoff_tdata): Add field find_buffer.
* ecoff.c: Include aout/stab_gnu.h.
	(ecoff_find_nearest_line): Handle stabs debugging information.
PR 3954.
1994-09-14 20:19:09 +00:00
Ian Lance Taylor 8c62064a26 * elfcode.h (elf_link_output_extsym): Keep a symbol marked as weak
even if it is referenced by another object.
1994-09-14 19:08:26 +00:00
Jeff Law ae880afc1b * som.c (som_fixup_formats): Case R_ENTRY (0xb3), set both
'T' and 'U' to grab all the unwind information.
	(som_set_reloc_info): Make 'U' unwind bits persist across
	multiple SOM relocations.  Set the addend field of an R_ENTRY
	relocation to the value in 'T'; set the addend field on an
	R_EXIT relocation to the value in 'U'.
1994-09-14 03:03:15 +00:00
Jeff Law e10639db44 * som.h (som_symbol_type): Delete unwind field.
* som.c (som_write_fixups): For R_ENTRY fixups, get 32bits of
	unwind information from the addend field of the R_ENTRY, get the
	other 32bits from the addend field of the R_EXIT.
	(bfd_som_attach_unwind_info): Delete function and all references.
1994-09-14 02:28:52 +00:00
Jeff Law 39836432f8 * som.h (som_symbol_type): Delete unused a.out-related fields.
* som.c (bfd_section_from_som_symbol): Use bfd_abs_section_ptr
	instead of &bfd_abs_section.
1994-09-14 00:51:33 +00:00
Jeff Law a0b4aa6265 * som.c (som_object_setup): Handle exec_entry and exec_flags being
switched in executables created by the OSF1 linker.
	(som_write_fixups): Handle R_EXIT just like the R_{F,L,R}SEL
	fixups.  Support R_ALT_ENTRY (handle just like R_EXIT).
1994-09-14 00:29:11 +00:00
Steve Chamberlain cf345e3687 Tue Sep 13 16:04:07 1994 Steve Chamberlain (sac@jonny.cygnus.com)
* cofflink.c (coff_link_input_bfd): syment_base is unsigned
	so can't compare -ve numbers with it.

Mon Sep 12 20:31:17 1994  Steve Chamberlain  (sac@jonny.cygnus.com)

	* configure.in (shcoff_vec): Use cofflink.o now.
	* coff-sh.c: Rewritten to use new fast coff backend.
1994-09-14 00:10:42 +00:00
Ian Lance Taylor 204ba9e37e * aoutx.h (NAME(aout,final_link)): Don't assume that all the input
files are a.out.
1994-09-13 20:25:46 +00:00
J.T. Conklin a3f7a777c6 * configure.host (sparc-*-netbsd): use sparcnbsd.
(ns32k-*-netbsd): use ns32knbsd.

* hosts/{nbsd,i386nbsd,ns32knbsd,sparcnbsd}.h: New files, NetBSD
  host support.

* sparcnetbsd.c: New file, adds support for NetBSD/sparc.
* config/sparc-nbsd.mt: Likewise.

* netbsd.h: New file, definitions common to all netbsd ports.
* i386netbsd.c: Use it.
* ns32knetbsd.c: Use it.

* Makefile.in, configure.in, targets.c, config/i386-nbsd.mt,
  config/ns32k-nbsd.mt: canonicalize netbsd targets to conform to
  file/variable naming conventions.
* i386netbsd.c: New file, renamed from netbsd386.c.
* ns32knetbsd.c: New file, renamed from netbsd532.c.
1994-09-13 18:39:47 +00:00
Jeff Law c7ca67cb67 * som.c (som_reloc_skip): Correct off-by-one error for 4-byte
R_NO_RELOCATION fixups.
	(bfd_section_from_som_symbol): Return the absolute section if the
	symbol isn't contained in any section in the output file.
	(som_slurp_symbol_table): ST_PRI_PROG and ST_SEC_PROG symbols are
	not function symbols (they are magic code labels which *can* be the
	targets of cross space branches).  $START$ is not a section symbol.
1994-09-13 04:06:07 +00:00
Stan Shebs 5e766076dc * mpw-make.in (ctor.c): Remove references.
* hosts/mpw.h [BFD_TRUE_FALSE]: Remove macro redefinitions of true
	and false.
1994-09-12 23:54:12 +00:00
Ian Lance Taylor 3c9832f89f * elfcode.h (swap_out_syms): Set the type of an undefined symbol
to STT_FUNC if the BSF_FUNCTION flag is set.
1994-09-12 22:16:27 +00:00
Ian Lance Taylor 2a89559527 * cofflink.c (coff_link_input_bfd): If r_symndx is -1, don't
change it.
	(_bfd_coff_generic_relocate_section): If r_symndx is -1, it is an
	absolute reloc.  Don't dump core using r_symndx as an array index.
	* cf-m68klynx.c (coff_bfd_link_add_symbols): Define.
	(lynx_link_add_symbols): New static function (copy of function in
	coff-i386.c).
	(coff_m68k_lynxrtype_to_howto): sym argument may be NULL.
	* coff-i386.c (coff_i386_rtype_to_howto): Likewise.
	* coff-a29k.c (coff_a29k_relocate_section): Handle an r_symndx
	value of -1, meaning an absolute reloc.
1994-09-12 21:01:19 +00:00
Ian Lance Taylor 3cd942de1e * ctor.c: Remove; obsolete.
* Makefile.in: Rebuild dependencies.
	(BFD_LIBS): Remove ctor.o.
	(CFILES): Remove ctor.c.
	* libbfd.h: Rebuild.
1994-09-12 15:47:52 +00:00
Jeff Law 27ebd9525d * elf32-hppa.c (elf32_hppa_relocate_section): If there was a link
error of some sort (for example, undefined symbols), then do not
	apply any relocs, just notify the user of the errors.
	(elf32_hppa_backend_begin_write_processing): Do not build a symbol
	extension section for an executable (it's useless).
	(elf32_hppa_link_output_symbol_hook): Do nothing if there was a
	link error of some sort (for example, undefined symbols).
	(elf32_hppa_read_symext_info): Kludge.  Turn off SEC_HAS_CONTENTS
	for all the input symbol extension sections to keep the generic
	BFD code happy.  Temporarily turn it on to read the contents of
	the symbol extension section.
1994-09-12 08:07:13 +00:00
Jeff Law 29f1ccee6d Revert last change (never should have been checked in to begin with). 1994-09-12 04:06:07 +00:00
Jeff Law 95bc714ee8 * config/hppaosf.mh (RANLIB): Do not set.
* config/hppabsd.mh (RANLIB): Likewise.
1994-09-12 04:04:09 +00:00
Ian Lance Taylor 5b89e1a00c Get the new COFF linker code working for i386-lynx.
* cf-i386lynx.c: Remove #if 0 code.
	(i386_lynxos_coff_object_p): Remove unused function.
	(coff_bfd_link_add_symbols): Define.
	(lynx_link_add_symbols): New static function.
	* coffcode.h (coff_bfd_link_hash_table_create): If
	coff_relocate_section is defined, only define this if not already
	defined.
	(coff_bfd_link_add_symbols, coff_bfd_final_link): Likewise.

	* linker.c (_bfd_generic_final_link): Handle
	bfd_indirect_link_order explicitly, rather than via
	_bfd_default_link_order.
	(set_symbol_from_hash): New static function, broken out of
	_bfd_generic_link_write_global_symbol.
	(_bfd_generic_link_write_global_symbol): Symbol setting code moved
	to set_symbol_from_hash; call it.
	(default_indirect_link_order): Add generic_linker argument.
	Change all callers.  If false, set the generic symbols based on
	the hash table entries.
1994-09-12 02:57:23 +00:00
Ian Lance Taylor 67ff4a5616 * coffgen.c (coff_get_symtab): Reindented. Removed commented out
call to bfd_constructor_entry.
1994-09-09 20:38:37 +00:00
Ken Raeburn 6c3bc2b8f6 keep arm files 1994-09-09 18:35:11 +00:00
Ian Lance Taylor bd23b552ef Convert m68k COFF to use new COFF backend linker.
* coff-m68k.c (coff_relocate_section): Define.
	* cf-m68klynx.c (coff_rtype_to_howto): Define.
	(coff_m68k_lynx_rtype_to_howto): New static function.
	* configure.in (m68kcoff_vec): Build cofflink.o.
	(m68kcoffun_vec, m68klynx_coff_vec): Likewise.
1994-09-09 15:54:45 +00:00
Steve Chamberlain 2546fb27f0 * coff-h8300.c (h8300_reloc16_extra_cases, case RELBYTE): Flag overflows
correctly.
1994-09-08 23:27:56 +00:00
Ian Lance Taylor 1208625d33 * libelf.h (struct elf_backend_data): Change second argument of
elf_backend_final_write_processing hook to boolean.
	(struct elf_obj_tdata): Add linker field.
	* elfcode.h (NAME(bfd_elf,write_object_contents)): Pass value of
	tdata linker field to final_write_processing, rather than NULL.
	(elf_bfd_final_link): Don't call final_write_processing hook.  Set
	tdata linker field to true.
	* elf32-mips.c (mips_elf_final_write_processing): Change type of
	second argument to boolean.
	* elf32-hppa.c (elf32_hppa_backend_final_write_processing):
	Likewise.
1994-09-07 23:41:58 +00:00
Ian Lance Taylor dc5fff10dd * coff-go32.c (RTYPE2HOWTO): Fully parenthesize arguments.
* coff-i960.c (RTYPE2HOWTO): Likewise.
	* coff-m88k.c (RTYPE2HOWTO): Likewise.
	* coff-we32k.c (RTYPE2HOWTO): Likewise.

	Make i386 COFF use new COFF backend linker.
	* coff-i386.c (RTYPE2HOWTO): Fully parenthesize arguments.
	(coff_relocate_section): Define.
	(coff_i386_rtype_to_howto): New function.
	* configure.in (i386coff_vec): Use cofflink.o.
	(i386lynx_coff_vec): Likewise.

	* coffcode.h (bfd_coff_backend_data): Add new field
	_bfd_coff_rtype_to_howto.
	(bfd_coff_rtype_to_howto): Define.
	(coff_rtype_to_howto): Define to use RTYPE2HOWTO, if not already
	defined.
	(bfd_coff_std_swap_table): Initialize new field.
	* cofflink.c (_bfd_coff_final_link): Allocate section_count + 1
	section_info structures, since the target_index is 1 based.
	(coff_link_input_bfd): Set *secpp to bfd_com_section_ptr for a
	common symbol.  Adjust rel_hash by the output reloc count.
	(_bfd_coff_generic_relocate_section): New function.
	* libcoff-in.h (_bfd_coff_generic_relocate_section): Declare.
	* libcoff.h: Rebuild.
	* coff-alpha.c (alpha_ecoff_backend_data): Initialize new field.
	* coff-mips.c (mips_ecoff_backend_data): Likewise.
1994-09-07 23:16:23 +00:00
Jeff Law 3b50c9009c * som.c (som_bfd_derive_misc_symbol_info): Treat undefined code
symbols and undefined symbols which no type in the same manner
	if the associated BFD symbol has BSF_FUNCTION set.  For a defined
	symbol which no type, select a SOM type based on the flags of the
	section containing the symbol.
	(som_slurp_symbol_type): Set BSF_FUNCTION for undefined ST_STUB
	or ST_CODE symbols (importing a non-function code symbol is
	meaningless in SOM).
	(som_set_reloc_info): Don't set "offset" to the section's vma; it
	should always start at zero.
1994-09-07 05:39:13 +00:00
Ian Lance Taylor 6ceff8e7d2 Minor tweaks to make COFF code support both new and old style linker. 1994-09-06 20:40:37 +00:00
Ian Lance Taylor 69645d10fb Add new style linker support to COFF backend. a29k only for now.
* cofflink.c: New file.
	* libcoff-in.h: Include bfdlink.h.
	(obj_coff_external_syms, obj_coff_strings): Define accessor macro.
	(obj_coff_sym_hashes): Define accessor macro.
	(struct coff_tdata): Add fields external_syms, strings, and
	sym_hashes.
	(struct coff_link_hash_entry): Define.
	(struct coff_link_hash_table): Define.
	(coff_link_hash_lookup, coff_link_hash_traverse): Define.
	(coff_hash_table): Define.
	(_bfd_coff_link_hash_table_create): Declare.
	(_bfd_coff_link_add_symbols, _bfd_coff_final_link): Declare.
	* coffcode.h (bfd_coff_backend_data): Add fields _bfd_relsz,
	_bfd_coff_swap_reloc_in, _bfd_coff_sym_is_global,
	_bfd_coff_compute_section_file_positions,
	_bfd_coff_relocate_section.
	(bfd_coff_relsz, bfd_coff_swap_reloc_in): Define.
	(bfd_coff_sym_is_global): Define.
	(bfd_coff_compute_section_file_positions): Define.
	(bfd_coff_relocate_section): Define.
	(coff_mkobject_hook): Initialize obj_raw_syment_count and
	obj_conv_table_size.
	(coff_compute_section_file_positions): Set target_index of all
	sections.  Set output_has_begun field.
	(coff_write_object_contents): Don't set target_index; now done by
	coff_compute_section_file_positions.  Remove obsolete handling of
	scn_base and data_base.  Don't bother to check that target_index
	is positive, since it always is.  Remove use of pad, which is
	always zero.  Check obj_raw_syment_count, not bfd_get_symcount,
	for the number of symbols, but only write them out if
	bfd_get_symcount is non-zero.
	(coff_slurp_symbol_table): Use obj_raw_syment_count, not
	bfd_get_symcount for the number of symbols.  Don't set
	obj_conv_table_size.
	(coff_sym_is_global): New static function or macro.
	(coff_slurp_reloc_table): Call coff_swap_reloc_in, not
	bfd_swap_reloc_in.
	(coff_bfd_link_hash_table_create): If coff_relocate_section is
	defined, define as _bfd_coff_link_hash_table_create.
	(coff_bfd_link_add_symbols): Similar change.
	(coff_bfd_final_link): Similar change.
	(coff_relocate_section): Define as NULL if not defined.
	(bfd_coff_std_swap_table): Initialize new fields.
	* coffgen.c (coff_real_object_p): Don't set obj_raw_syment_count
	and obj_conv_table_size here.
	(coff_count_linenumbers): Reindent.  If bfd_get_symcount is zero,
	add up the line numbers from the sections.
	(coff_write_symbols): Don't set bfd_get_symcount.
	(coff_pointerize_aux): Don't pointerize a nonpositive x_endndx
	field.
	(coff_get_normalized_symtab): Use obj_raw_syment_count, not
	bfd_get_symcount.
	(coff_print_symbol): If auxp->fix_end, print x_endndx value.
	* coffswap.h (coff_swap_reloc_in): Rename from bfd_swap_reloc_in.
	Reindent.  Change argument type to  PTR.
	* coff-a29k.c (coff_a29k_relocate_section): New static function.
	(coff_relocate_section): Define.
	* configure.in (a29kcoff_big_vec): Compile cofflink.o.
	* coff-alpha.c (alpha_ecoff_backend_data): Initialize new fields.
	* coff-mips.c (mips_ecoff_backend_data): Likewise.
	* libcoff.h: Rebuilt.
	* Makefile.in: Rebuilt dependencies.
	(BFD32_BACKENDS): Add cofflink.o.
	(CFILES): Add cofflink.c.
1994-09-06 19:28:55 +00:00
Ken Raeburn de733a0edf * coffgen.c (coff_print_symbol, case bfd_symbol_print_all): Check for section
symbol, and print its aux fields with appropriate labels.
1994-09-06 18:30:06 +00:00
Ken Raeburn 358710a7eb Makefile.in (ALL_MACHINES): ADded cpu-arm.o. 1994-09-06 18:03:03 +00:00
Ian Lance Taylor e1728bee60 Tipos 1994-09-05 19:14:24 +00:00
Ken Raeburn 318b02b6b9 ARM Acorn/RISCiX target and host patches from Richard Earnshaw 1994-09-05 10:53:00 +00:00
Ken Raeburn 0443af3189 * reloc.c (enum bfd_reloc_code_real): Rewrote definition to use new "chew"
commands for simultaneous definition of enumerator and enumerator name table.
(bfd_get_reloc_code_name): New function, for retrieving a symbolic name
associated with an enumerator.

* libbfd.h, bfd-in2.h: Regenerated.
1994-09-02 18:21:41 +00:00
Jeff Law b905bde1a9 * som.c (som_write_fixups, case R_ENTRY): Handle case where no
unwind descriptor information is available.
1994-08-31 03:30:39 +00:00
Ian Lance Taylor 0822b56d66 * elfcode.h (NAME(bfd_elf,size_dynamic_sections)): Add soname
argument, and use it to set DT_SONAME dynamic entry.
	* bfd-in.h (bfd_elf32_size_dynamic_sections): Update prototype.
	(bfd_elf64_size_dynamic_sections): Update prototype.
	* bfd-in2.h: Rebuilt.
1994-08-30 16:04:40 +00:00
Ian Lance Taylor b8520cf360 * coffgen.c (coff_real_object_p): Set obj_raw_syment_count.
(coff_get_normalized_symtab): Verify obj_raw_syment_count, rather
	than setting it.
1994-08-26 20:01:21 +00:00
Ian Lance Taylor fc10f31e8b * archive.c (bsd_write_armap): Remove host dependencies. 1994-08-25 19:50:26 +00:00
Ian Lance Taylor 435b470ec3 * aoutx.h (add_to_stringtab): Check for _bfd_stringtab_add error
before adding BYTES_IN_WORD.
1994-08-25 18:56:11 +00:00
Ian Lance Taylor 6d04c6d475 * coffgen.c (coff_find_nearest_line): Look for the best C_FILE,
not merely the first.
1994-08-25 15:58:43 +00:00
Ian Lance Taylor 715cde57f8 * coffgen.c (coff_write_alien_symbol): If we are not using the
symbol, clear the name so that it is not put in the string table.
	From Antti.Miettinen@ntc.nokia.com.
1994-08-25 14:46:10 +00:00
Ian Lance Taylor 5a53b1c178 * coffgen.c (coff_print_symbol): Cast pointer different to long
and use %ld to print it.
	* osf-core.c (osf_core_core_file_p): Remove unused variable
	dseccnt.
	* ecoffswap.h (ecoff_swap_ext_out): If ECOFF_64, clear remaining
	bytes in bits2.
1994-08-24 21:17:40 +00:00
Ian Lance Taylor 073e795f5e * configure.host, config.bfd: Change i[34]86 to i[345]86. 1994-08-24 16:41:48 +00:00
Ian Lance Taylor a74d15178f * coffgen.c (coff_real_object_p): Set obj_conv_table_size here,
rather than waiting until coff_slurp_symbol_table.
	(coff_write_alien_symbol): Just ignore BSF_DEBUGGING symbols.
	From Antti.Miettinen@ntc.nokia.com.
1994-08-24 16:32:40 +00:00
Ian Lance Taylor d37002222d * section.c (bfd_make_section_anyway): Fix failure check of
bfd_make_empty_symbol.  From Antti.Miettinen@ntc.nokia.com.
1994-08-24 16:29:17 +00:00
Ian Lance Taylor 1afd2380ea * aoutx.h (translate_to_native_sym_flags): Use the output_section
(and output_offset) if there is one.

	* aoutx.h (aout_link_check_archive_element): Discard the symbols
	if the archive element was not needed.

	* aoutx.h (aout_get_external_symbols): Ensure that a zero string
	index yields an empty string.
	(aout_link_write_symbols): If info->keep_memory is false, use name
	from original hash table entry, not from entry in *sym_hash.

	* aoutx.h (struct aout_final_link_info): Add fields contents,
	relocs, symbol_map and output_syms.
	(NAME(aout,final_link)): Work out the largest section size, reloc
	size, and number of symbols.  Use them to preallocate buffers that
	are large enough for all cases.
	(aout_link_input_bfd): Use preallocated symbol_map.
	(aout_link_write_symbols): Remove symbol_map argument; use
	preallocated symbol_map instead.  Change all callers.  Use
	preallocated output_syms.
	(aout_link_input_section): Remove symbol_map argument.  Change all
	callers.  Use preallocated contents and relocs.
	(aout_link_input_section_std): Remove symbol_map argument; use
	preallocated symbol_map instead.  Change all callers.
	(aout_link_input_section_ext): Likewise.
1994-08-24 15:59:40 +00:00
Ian Lance Taylor 81eb52b34d * targets.c (BFD_JUMP_TABLE_ARCHIVE): Add _update_armap_timestamp.
(bfd_target): Add field _bfd_update_armap_timestamp.
	* bfd.c (bfd_update_armap_timestamp): Define.
	* bfd-in2.h: Rebuilt.
	* libbfd-in.h (_bfd_noarchive_update_armap_timestamp): Define.
	(_bfd_archive_bsd_update_armap_timestamp): Declare.
	(_bfd_archive_coff_update_armap_timestamp): Define.
	* libbfd.h: Rebuilt.
	* archive.c (_bfd_write_archive_contents): Call
	bfd_update_armap_timestamp instead of checking for a BSD archive
	and calling bsd_update_armap_timestamp.
	(_bfd_archive_bsd_update_armap_timestamp): Rename from
	_bsd_update_armap_timestamp.  Don't assume that armap_datepos is
	already set.
	* aout-target.h (MY_update_armap_timestamp): Define if not already
	defined.
	* coff-rs6000.c (rs6000coff_update_armap_timestamp): Define.
	* ieee.c (ieee_update_armap_timestamp): Define.
	* libecoff.h (_bfd_ecoff_update_armap_timestamp): Define.
	* oasys.c (oasys_update_armap_timestamp): Define.
	* som.c (som_update_armap_timestamp): Define.
1994-08-22 21:20:12 +00:00
Ian Lance Taylor e914ed5219 * hash.c: Copy string hash functions from aoutx.h.
* aoutx.h: String hash functions moved to hash.c.  Retain
	simplified versions of add_to_stringtab and emit_stringtab.
	Change all callers to use new function and structure names.
	* libbfd-in.h (_bfd_stringtab_init, _bfd_stringtab_free): Declare.
	(_bfd_stringtab_size, _bfd_stringtab_add): Declare.
	(_bfd_stringtab_emit): Declare.
	* libbfd.h: Rebuilt.
1994-08-22 16:36:52 +00:00
Ian Lance Taylor 0ff4ca1eef Mon Aug 22 10:49:37 1994 Eric Youngdale (ericy@cais.cais.com)
* i386linux.c (linux_add_one_symbol): Create a fixup for any
	defined absolute symbol, not just GOT or PLT symbols.
	(linux_tally_symbols): Correct handling of references to defined
	symbols.
1994-08-22 15:00:26 +00:00
Ian Lance Taylor f494527192 Get ld -x -r to handle a.out set symbols correctly.
* aoutx.h (adjust_o_magic): If the .bss VMA was set outside of
	BFD, pad the .data section up to the VMA of the .bss section.
	(aout_link_add_symbols): If a set symbol does not get modified,
	treat it as a local symbol.
	(aout_link_write_symbols): Set the value of set symbols
	correctly.  Don't discard set symbols even if discarding local
	symbols.
	(aout_link_write_other_symbol): Don't abort on bfd_link_hash_new,
	since it can now happen for set symbols.
1994-08-18 21:48:23 +00:00
Ian Lance Taylor 32c765539c * elfcode.h (elf_fake_sections): Just check for ".rela" and
".rel", not ".rela." and ".rel."; make this work by checking
	use_rela_p.
	* elf32-i386.c (elf_i386_check_relocs): Just check for ".rel", not
	".rel."
	(elf_i386_size_dynamic_sections): Likewise.
	(elf_i386_relocate_section): Likewise.
	* elf32-sparc.c (elf32_sparc_check_relocs): Just check for
	".rela", not ".rela."
	(elf32_sparc_size_dynamic_sections): Likewise.
	(elf32_sparc_relocate_section): Likewise.
1994-08-18 21:33:07 +00:00
Ian Lance Taylor 7cc5cc22bb * linker.c (_bfd_generic_link_add_archive_symbols): Initialize
PASS to the old value + 1.
1994-08-17 20:58:47 +00:00
Ian Lance Taylor d83689d4de * coffgen.c (coff_get_normalized_symtab): If a C_FILE symbol has
no aux entries, use the symbol name as the file name.
	(coff_find_nearest_line): Look for the right C_FILE symbol, rather
	than always using the first one.  If there is a debugging symbol
	after a function symbol, skip it.  Add the section VMA to the line
	offset, since it was subtracted out in coff_slurp_line_table.
PR 5010.
1994-08-17 17:44:17 +00:00
Jeff Law fde543b5ff * som.c (som_prep_headers): If writing some form of an executable,
allocate and attach an exec header to the BFD private data.
	(som_begin_writing): Don't fill fields of the exec header based
	on BFD private data here (like the exec flags).  Do not write
	the exec header here.
	(som_write_headers): Instead do it here.
	* som.h (struct somdata): New field "exec_hdr" for the executable
	file header.
	(obj_som_exec_hdr): New accessor macro.
1994-08-16 23:11:59 +00:00
Ian Lance Taylor 969ceea035 * i386linux.c (linux_link_create_dynamic_sections): Create section
named .linux-dynamic, not .dynamic.
	(linux_add_one_symbol): Use .linux-dynamic, not .dynamic.
	(bfd_linux_size_dynamic_sections): Likewise.
	(linux_finish_dynamic_link): Likewise.
1994-08-16 04:15:50 +00:00
Ian Lance Taylor 9fbe895ae7 * coffgen.c (STRING_SIZE_SIZE): Define.
(coff_fix_symbol_name): Use STRING_SIZE_SIZE, not 4.
	(coff_write_symbols, build_string_table): Likewise.
	(coff_get_normalized_symtab): Likewise.
1994-08-15 22:07:29 +00:00
Ian Lance Taylor f07bb971a0 * libcoff-in.h (obj_symbol_slew): Don't define.
(struct coff_tdata): Remove unused fields index_slew, raw_linenos,
	and flags.
	* libcoff.h: Rebuilt.
	* coffcode.h (coff_mkobject): Don't initialize raw_linenos.
	(coff_mkobject_hook): Don't initialize flags.
1994-08-15 21:02:05 +00:00
Ian Lance Taylor a932d0ffb7 * aout-target.h (MY_zmagic_contiguous): Define as 0 if not already
defined.
	(MY(backend_data)): Use MY_zmagic_contiguous, not hardcoded 0.
	* i386linux.c (MY_zmagic_contiguous): Define.
1994-08-15 18:12:05 +00:00
Ian Lance Taylor 823609fe90 * elfcode.h (bfd_section_from_shdr): If a SHT_SYMTAB section in a
shared object has SHF_ALLOC set, create a BFD section for it.
	(elf_section_from_bfd_section): There may be a BFD section for a
	SHT_SYMTAB section.
1994-08-15 18:08:13 +00:00
Ian Lance Taylor e8fbe6d924 * coffcode.h (styp_to_sec_flags): Add name argument. If no flags
are recognized, chose section flags based on the name.
	(bfd_coff_backend_data): _bfd_styp_to_sec_flags_hook field: Add
	name argument.
	(bfd_coff_styp_to_sec_flags_hook): Add name argument.
	(coff_compute_section_file_positions): Don't adjust the section
	position by COFF_PAGE_SIZE unless SEC_ALLOC is set.
	* libcoff.h: Rebuilt.
	* coffgen.c (make_a_section_from_file): Pass section name to
	bfd_coff_styp_to_sec_flags_hook.
	* ecoff.c (_bfd_ecoff_styp_to_sec_flags): Add unused name
	argument.
	* libecoff.h (_bfd_ecoff_styp_to_sec_flags): Add name argument to
	prototype.
1994-08-15 16:26:06 +00:00
Ian Lance Taylor e9227b4255 * elfcode.h (section_from_elf_index): Correct check for invalid
section index.
1994-08-12 23:25:23 +00:00
Ian Lance Taylor 1c640609d8 * elfcode.h (elf_link_add_object_symbols): If there is no symbol
table, try using the dynamic symbol table.  From Eric Youngdale
	<ericy@cais.cais.com>.
1994-08-12 15:51:09 +00:00
Ian Lance Taylor 098e8a89ec * configure.host (sparc-*-solaris2*): Use solaris2, not sysv4.
The linker depends upon configuring for solaris2.
	* hosts/solaris2.h: New file; include hosts/sysv4.h.
	* config/solaris2.mh: New file; copy of config/sysv4.mh.
1994-08-12 15:28:19 +00:00
Ian Lance Taylor af76a6e052 Remove aout-ns32k.h. 1994-08-11 04:39:16 +00:00
Ian Lance Taylor e1f99f6068 * aoutx.h (adjust_z_magic): Make sure data section is padded to
page boundary when the VMA is set by the calling program.  From
	Eric Youngdale <ericy@cais.cais.com>.
1994-08-10 17:15:05 +00:00
Stan Shebs fb49a80173 Update to ns32k support, from Ian Dall (dall@hfrd.dsto.gov.au).
* aout-ns32k.c: Add declarations that were in aout-ns32k.h, change
	declarations to traditional form.
	(MY_reloc_howto, MY_put_reloc): Change from macro to function.
	(ns32k_relocate_contents): New function.
	* aout-ns32k.h: Remove.
	* cpu-ns32k.c: Add declarations that were in aout-ns32k.h, change
	declarations to traditional form.
	(ns32k_final_link_relocate): Call ns32k_relocate_contents.
	* netbsd532.c: Reformat to standards, add copyright notice.
	(ARCH): Don't define.
	(aout-ns32k.h): Don't include.
	* pc532-mach.c: Ditto.
1994-08-09 01:06:29 +00:00
Peter Schauer f20860cdbc * irix-core.c (irix_core_core_file_p): Ignore sections that
are not contained in the core file.
1994-08-07 13:26:46 +00:00
Jean Marie Diaz 7432993954 Fix up namespace handling in last patch. 1994-08-04 19:59:27 +00:00
Jean Marie Diaz 8337ee9d51 * coff-m68k.c (_bfd_coff_m68k_reloc_type_lookup): New function.
(coff_bfd_reloc_type_lookup): Define.
1994-08-04 16:38:05 +00:00
Jean Marie Diaz 203778cee1 * elfcode.h (elf_bfd_final_link): Force the vma of sections which
do not have SEC_ALLOC set to be 0.  This is needed to handle
	relocs against debugging sections.
1994-08-04 16:10:23 +00:00
Jean Marie Diaz 1b8a11d430 * coff-i960.c (coff_i960_relocate): Rewrote to change relocs
against locally defined symbols into relocs against section
	symbols, for VxWorks 5.1.
1994-08-03 20:51:59 +00:00
Jean Marie Diaz e696f6a9b9 Wed Aug 3 10:34:37 1994 Eric Youngdale (ericy@cais.cais.com)
* i386linux.c (linux_add_one_symbol): Only handle
	SHARABLE_CONFLICTS specially if BSF_CONSTRUCTOR is set.  Set hashp
	for a GOT or PLT symbol.  Set jump field of fixup for a PLT symbol.
	(linux_tally_symbols): Check section of real symbol.  When looking
	for a builtin fixup, check builtin and jump flags.  Create no more
	than one fixup, and always create one if the real symbol is in the
	absolute section.  Only strip absolute symbols.
1994-08-03 14:43:42 +00:00
David Henkel-Wallace 756b40d520 LynxOS changes 1994-08-03 13:45:11 +00:00
Jean Marie Diaz b2ea35c7ab * hp300hpux.c (BMAGIC): Define as HPUX_DOT_O_MAGIC, to make test
in aoutx.h work correctly.
1994-08-02 19:16:36 +00:00
Jean Marie Diaz 5e694c29a5 * coff-i960.c (coff_i960_relocate): New function.
(howto_rellong, howto_iprmed): Use it as special_function.
1994-08-02 15:26:26 +00:00
Jean Marie Diaz e0566e19aa * libbfd-in.h: Move declarations of bfd_read, bfd_write, bfd_seek,
bfd_tell, bfd_flush, and bfd_stat from here...
	* bfd-in.h: ...to here, to make them visible to programs which
	know more about the object file format than BFD does.
	* libbfd.h, bfd-in2.h: Rebuilt.
1994-08-02 14:48:21 +00:00
Jean Marie Diaz e21679173e Forgot to check this in. 1994-08-01 23:45:51 +00:00
Jean Marie Diaz df9e066f4b * elfcode.h (map_program_segments): Check DYNAMIC as well as EXEC_P.
(assign_file_positions_except_relocs): Likewise.
1994-08-01 23:37:22 +00:00
Jean Marie Diaz 4ab1f94712 * elf64-sparc.c (ELF_MAXPAGESIZE): Define. 1994-08-01 23:29:31 +00:00
Jean Marie Diaz 99dd775492 ELF linker patches from Eric Youngdale <ericy@cais.cais.com>.
* elfcode.h (elf_link_create_dynamic_sections): Set type of
	_DYNAMIC to STT_OBJECT.
	(NAME(bfd_elf,record_link_assignment)): Always create hash table
	entry.  Set type to STT_OBJECT.
	(elf_link_output_extsym): Don't set type of weak defined symbol to
	STB_WEAK if symbol was referenced.
	* elf32-i386.c (elf_i386_create_dynamic_sections): Set type of
	_GLOBAL_OFFSET_TABLE to STT_OBJECT.
	(elf_i386_check_relocs): Ignore local PLT32 relocs.
	(elf_i386_relocate_section): Treat local PLT32 relocs as PC32.
1994-08-01 23:11:18 +00:00
Jean Marie Diaz 287e3ce228 Mon Aug 1 17:55:53 1994 Fred Fish (fnf@cygnus.com)
* ptrace-core.c (ptrace_unix_core_file_p):  Convert zalloc usage
	to bfd_zalloc.
1994-08-01 22:00:19 +00:00
Ian Lance Taylor 30e5ad97e9 * elfcode.h (elf_adjust_dynamic_symbol): Correct weak symbol
handling again.
1994-08-01 20:53:48 +00:00
Ian Lance Taylor f3817a52e5 * configure.host (sparc-*-solaris2*): Use sysv4, not solaris2.
* hosts/solaris2.h: Remove.
	* config/solaris2.mh: Remove.
1994-08-01 16:35:40 +00:00
Ian Lance Taylor d510fd893a * elfcode.h (elf_slurp_reloc_table): Don't try to read the relocs
if there aren't any.
1994-08-01 16:34:09 +00:00
Ian Lance Taylor abc61566c0 * configure.host (sparc-*-solaris2*): Use sysv4, not solaris2.
* hosts/solaris2.h: Remove.
	* config/solaris2.mh: Remove.
1994-08-01 16:16:47 +00:00
Jeff Law 58bbba79a2 * elf32-hppa.c, elf32-hppa.h: Update comment reflecting which
HPPA ELF spec the code implements.
1994-07-31 20:29:19 +00:00
Ken Raeburn b5b056fc38 i960xl changes (sanitized) 1994-07-27 00:21:43 +00:00
Ken Raeburn ffeef0bbcb (howto_rellong, howto_iprmed, howto_optcall): Use HOWTO macro. 1994-07-27 00:11:56 +00:00
Ken Raeburn e26e4fbc0b i960xl sanitization; keep some more ns32k related files 1994-07-27 00:10:18 +00:00
Ian Lance Taylor 9a402d7ac5 * elfcode.h (elf_adjust_dynamic_symbol): When handling a weak
symbol, correct check to see whether the equivalent normal symbol
	was referenced.
1994-07-26 19:34:14 +00:00
Ian Lance Taylor 374d2ef905 Add support for creating shared libraries under i386 ELF and SPARC
ELF.  Based on patches by Eric Youngdale <ericy@cais.cais.com>.
	* libelf.h (struct elf_link_hash_entry): Remove copy_offset field.
	Add got_offset and plt_offset fields.
	(ELF_LINK_HASH_REF_DYNAMIC_MULTIPLE): Don't define.
	(ELF_LINK_HASH_DEF_DYNAMIC_MULTIPLE): Don't define.
	(ELF_LINK_HASH_NEEDS_COPY): Define.
	(struct elf_backend_data): Add check_relocs field.
	(struct bfd_elf_section_data): Change relocs from PTR to
	Elf_Internal_Rela *.
	(struct elf_obj_tdata): Add local_got_offsets field.
	(elf_local_got_offsets): Define accessor macro.
	(bfd_elf32_link_create_dynamic_sections): Declare.
	(bfd_elf32_link_record_dynamic_symbol): Declare.
	(bfd_elf64_link_create_dynamic_sections): Declare.
	(bfd_elf64_link_record_dynamic_symbol): Declare.
	* elfcode.h (elf_slurp_reloc_table): Don't use the section data
	relocs field.
	(elf_link_record_dynamic_symbol): Make globally visible.  Use
	macro to rename to NAME(bfd_elf,link_record_dynamic_symbol).
	(elf_link_add_object_symbols): If creating a shared library, put
	make all local symbols dynamic.  Don't bother with the
	DYNAMIC_MULTIPLE flags.  Call the check_relocs backend function if
	it is defined.
	(elf_link_create_dynamic_sections): Make globally visible.  Use
	macro to rename to NAME(bfd_elf,link_create_dynamic_sections).  If
	creating a shared library, make sure that _DYNAMIC is added as a
	dynamic symbol.
	(elf_link_read_relocs): New function.
	(NAME(bfd_elf,record_link_assignment)): If creating a shared
	library, always create symbols, and always make them dynamic.
	(elf_bfd_final_link): Permit creation of shared libraries.
	(elf_link_input_bfd): Use elf_link_read_relocs to get the relocs.
	* elf.c (_bfd_elf_link_hash_newfunc): Don't initialize
	copy_offset.  Initialize got_offset and plt_offset.
	* elf32-target.h (elf_backend_check_relocs): Define as 0 if not
	defined.
	(elf32_bed): Initialize check_relocs field.
	* elf64-target.h (elf_backend_check_relocs): Define as 0 if not
	defined.
	(elf64_bed): Initialize check_relocs field.
	* elf32-i386.c (elf_howto_table): Change R_386_PLT32 and
	R_386_GOTPC to be pc_relative and pcrel_offset.
	(elf_i386_pic_plt0_entry): Define.
	(elf_i386_pic_plt_entry): Define.
	(elf_i386_create_dynamic_sections): Create a .got.plt section, and
	define _GLOBAL_OFFSET_TABLE_ at the start of it.  If creating a
	shared library, make sure that _GLOBAL_OFFSET_TABLE_ is added as a
	dynamic symbol.  Don't create .rel.bss if creating a shared
	library.
	(elf_i386_check_relocs): New function.
	(elf_i386_adjust_dynamic_symbol): Don't make a PLT entry if the
	symbol already has one.  When making a PLT entry, set plt_offset.
	Don't create a copy reloc when creating a shared library.  Don't
	set copy_offset, just set ELF_LINK_HASH_NEEDS_COPY.
	(elf_i386_allocate_dynamic_section): Remove.
	(elf_i386_size_dynamic_sections): Look through all the sections
	rather than assuming we know their names.  Remove any empty reloc
	or plt sections.  Only add a DT_DEBUG entry if not creating a
	shared library.  Only add a DT_PLTGOT entry if there is a PLT.
	Add a DT_TEXTREL entry if required.
	(elf_i386_relocate_section): Permit undefined symbols when
	creating a shared library.  Handle the special relocation types
	specially.
	(elf_i386_finish_dynamic_symbol): Create a PLT entry if plt_offset
	is set.  If creating a shared library, produce a PIC PLT entry.
	Only mark a PLT symbol as undefined if it was not defined by a
	regular object file.  Create a GOT entry if got_offset is set.
	Create a copy reloc if ELF_LINK_HASH_NEEDS_COPY is set.
	(elf_i386_finish_dynamic_sections): Change the handling of
	DT_RELSZ to simply subtract out the size of .rel.plt.  If creating
	a shared library, produce PIC PLT code.
	(elf_backend_check_relocs): Define.
	* elf32-sparc.c (elf_sparc_howto_table): Change R_SPARC_GOT10,
	R_SPARC_GOT22, and R_SPARC_PC10 to not warn about reloc overflow.
	(elf32_sparc_create_dynamic_sections): If creating a shared
	library, make sure that _GLOBAL_OFFSET_TABLE_ is added as a
        dynamic symbol, and set the type to STT_OBJECT.  Likewise for
        _PROCEDURE_LINKAGE_TABLE_.  Don't create .rel.bss if creating a
        shared library.
	(elf32_sparc_check_relocs): New function.
	(elf32_sparc_adjust_dynamic_symbol): Don't make a PLT entry if the
	symbol already has one.  When making a PLT entry, set plt_offset.
	Don't create a copy reloc when creating a shared library.  Don't
	set copy_offset, just set ELF_LINK_HASH_NEEDS_COPY.
	(elf32_sparc_allocate_dynamic_section): Remove.
	(elf32_sparc_size_dynamic_sections): Look through all the sections
	rather than assuming we know their names.  Only add a DT_DEBUG
	entry if not creating a shared library.  Add a DT_TEXTREL entry if
	required.
	(elf32_sparc_relocate_section): Permit undefined symbols when
	creating a shared library.  Handle the special relocation types
	specially.
	(elf32_sparc_finish_dynamic_symbol): Create a PLT entry if plt_offset
	is set.  Only mark a PLT symbol as undefined if it was not defined
	by a regular object file.  Create a GOT entry if got_offset is
	set.  Create a copy reloc if ELF_LINK_HASH_NEEDS_COPY is set.
	(elf32_sparc_finish_dynamic_sections): Store dynobj in a local
	variable.
	(elf_backend_check_relocs): Define.
1994-07-26 17:18:37 +00:00
Stan Shebs 56fbe88919 Update to reflect comings and goings of ns32k and mach-related files 1994-07-25 20:04:11 +00:00
Stan Shebs caede51576 * configure.in (pc532mach_vec): Change to pc532machaout_vec.
* config.bfd (ns32k-*-netbsd*): Use ns32k-nbsd as bfd_name.
	* Makefile.in (ALL_MACHINES): Add cpu-ns32k.o.
	(BFD32_BACKENDS): Add aout-ns32k.o, netbsd532.o, m88kmach3.o,
	pc532-mach.o.
	* targets.c (pc532machaout_vec): Use instead of pc532mach_vec.
	* config/pc532-mach.mt (DEFAULT_VECTOR): Ditto.
	(SELECT_VECS): Remove.
	* config/ns32k-nbsd.mt: New file, was ns32k-netbsd.mt.
	* config/ns32k-netbsd.mt: Remove, name too long.
1994-07-25 20:00:10 +00:00
Ian Lance Taylor f2c2e75ce0 Forgot to save my buffer before last check in. 1994-07-22 23:50:35 +00:00
Ian Lance Taylor 7c6da9cade * aoutx.h (aout_link_check_ar_symbols): When changing a symbol to
common, set the alignment.
	(aout_link_add_symbols): Restrict the alignment of a common symbol
	to the alignment power given by the architecture.
	* elf.c (_bfd_elf_link_hash_newfunc): Don't initialize align.  Do
	initialize copy_offset.
	* elf32-i386.c (elf_i386_adjust_dynamic_symbol): Use copy_offset
	field rather than align field.  Get alignment using bfd_log2
	rather than switch.
	* elf32-sparc.c (elf32_sparc_adjust_dynamic_symbol): Likewise.
	* elf32-i386.c (elf_i386_finish_dynamic_symbol): Use copy_offset,
	not align.
	* elf32-sparc.c (elf32_sparc_finish_dynamic_symbol): Likewise.
1994-07-22 18:53:23 +00:00
Ian Lance Taylor 2aaaab7ceb * aoutx.h (NAME(aout,some_aout_object_p)): Just check
STAT_FOR_EXEC, don't check MACH.
	* m88kmach3.c (MACH): Don't define.
	* config/i386-mach3.mt (TDEFINES): Define STAT_FOR_EXEC.
	* config/m88k-mach3.mt (TDEFINES): Likewise.
	* config/mips-mach3.mt (TDEFINES): Likewise.
1994-07-22 15:13:33 +00:00
Stan Shebs bb99a7328c * i386mach3.c: Reverted to version from before Jul 5 1994 changes.
Un-break gas/binutils/ld for FSF.
1994-07-22 00:28:17 +00:00
Ian Lance Taylor f42fe1599a * reloc.c (struct reloc_howto_struct): Remove special_function1.
It's the wrong way to do things.
	(HOWTO): Change accordingly.
	(HOWTO2): Remove.
	(_bfd_final_link_relocate): Remove references to
	special_function1.
	* bfd-in2.h: Rebuilt.
	* aoutx.h (aout_link_input_section_std): Remove references to
	special_function1.
	(aout_link_reloc_link_order): Likewise.
1994-07-21 16:34:59 +00:00
Ian Lance Taylor f9779aad5a * elfcode.h (NAME(bfd_elf,size_dynamic_sections)): Add rpath
argument.  If it is not NULL, use it to set DT_RPATH.
	* bfd-in.h (bfd_elf32_size_dynamic_sections): Update prototype.
	(bfd_elf64_size_dynamic_sections): Likewise.
	* bfd-in2.h: Rebuilt.
1994-07-20 19:51:18 +00:00
Ian Lance Taylor bf73e4f3fe * libelf.h (ELF_LINK_HASH_DEFINED_WEAK): Define.
* elfcode.h (elf_link_add_object_symbols): If symbol is defined as
	weak, set ELF_LINK_HASH_DEFINED_WEAK.
	(elf_link_output_extsym): If symbol is defined as weak, mark it
	STB_WEAK.
1994-07-17 02:15:24 +00:00
Ian Lance Taylor ea61717495 * libelf.h (struct bfd_elf_section_data): Add relocs field.
(shdr_name): Remove; unused.
	* elfcode.h (elf_slurp_reloc_table): Rewrote to handle both REL
	and RELA relocs.  Free up the unswapped relocs.  Permit the relocs
	to be cached in the section_data.  Correct the reloc address.
	(elf_slurp_reloca_table): Remove.
	(elf_canonicalize_reloc): Rewrote.
	(elf_link_input_bfd): Permit the relocs to be cached in the
	section data.
1994-07-17 01:15:42 +00:00
Stan Shebs d9840ab79e * config.bfd (m88*-harris-cxux*): Recognize.
* hosts/harris.h (POSIX_UTIME, HAVE_PROCFS): Define.
1994-07-16 21:08:41 +00:00
Stan Shebs ef8b133d8c * configure.host (m68*-atari-sysv4*): New host.
(m68*-cbm-sysv4*): Use m68kv4 instead of amix.
	* hosts/amix.h: Remove.
	* hosts/m68kv4.h: New file, was amix.h.
1994-07-16 21:02:53 +00:00
Ken Raeburn 1fb83be62b NS32K changes from Ian Dall.
Note: Some of the ns32k-specific files do require gcc to compile at present.
This will be fixed.
1994-07-14 21:35:54 +00:00
Stan Shebs a307efdfac * coff-sparc.c (sparccoff_vec): Have leading underscores. 1994-07-14 18:50:22 +00:00
Peter Schauer 57a814a93e * aix386-core.c, aoutf1.h, cisco-core.c, elfcode.h, hppabsd-core.c,
hpux-core.c, irix-core.c, lynx-core.c, osf-core.c, ptrace-core.c,
	rs6000-core.c, trad-core.c:  Remove SEC_ALLOC flag from .reg
	sections, .reg sections are not allocated and contain debug
	information only.
	* osf-core.c (make_bfd_asection, osf_core_core_file_p):  Use
	bfd_make_section_anyway instead of building unique section names.
1994-07-12 19:14:09 +00:00
Ian Lance Taylor 840846dac5 * libelf.h (bfd_elf32_swap_symbol_in): Declare.
(bfd_elf32_swap_symbol_out): Declare.
	(bfd_elf64_swap_symbol_in, bfd_elf64_swap_symbol_out): Declare.
	* elf32-hppa.c (elf32_hppa_args_hash_table_init): Correct cast.
1994-07-12 16:13:05 +00:00
Ian Lance Taylor 42ec46c361 * aout-encap.c (ARCH): Don't define. Obsolete.
* aout0.c, aoutx.h, gen-aout.c, hp300bsd.c, hp300hpux.c: Likewise.
	* i386aout.c, i386bsd.c, i386dynix.c, i386linux.c: Likewise.
	* i386lynx.c, m68klynx.c, mipsbsd.c, netbsd386.c: Likewise.
	* newsos3.c, sparclynx.c, sunos.c: Likewise.
1994-07-12 15:46:32 +00:00
Ian Lance Taylor 18938e4d3e * section.c (STD_SECTION): Make the sixth argument boolean, not
the seventh.  From gary@tuva.pacsemi.oz.au (gary kopff).
1994-07-12 00:12:19 +00:00
David Henkel-Wallace 4852416e2a Sun Jul 10 09:12:02 1994 D. V. Henkel-Wallace (gumby@cygnus.com)
* aoutx.h (bfd_free_cached_info): Change name of FREE to BFCI_FREE
        in order not to collide with LynxOS's definition of FREE in
        /usr/include/sys/proc.h
1994-07-10 16:15:07 +00:00
Peter Schauer fd4913f196 * aoutx.h (howto_table_std): Add entry for GOT relocations
which are present in sun3 shared libraries, to avoid assertions
	when reading the dynamic relocations.
1994-07-07 17:11:58 +00:00
Jeff Law 48530c25d3 * som.h (R_HPPA_COMPLEX): Fix dumb typo. 1994-07-07 16:22:01 +00:00
Ian Lance Taylor 874a43273c * elfcode.h (elf_link_output_sym): Don't call output_symbol_hook
if it is NULL.
1994-07-06 23:33:02 +00:00
Ian Lance Taylor 7a769b7ffa * hosts/sysv4.h (qsort, strtol): Don't declare. 1994-07-06 23:28:31 +00:00
Peter Schauer 5fb54939a9 * coff-alpha.c (alpha_ecoff_mkobject_hook): New hook to
additionally copy object type information from the alpha file
	header to the BFD flags.
	(alpha_ecoff_backend_data):  Use it.
	(ecoffalpha_little_vec):  Add DYNAMIC to object_flags.
	* aout64.c:  Fix typo in conditional QMAGIC definition.
1994-07-06 07:53:31 +00:00
Jeff Law 2c0f3abc50 * hppabsd-core.c (hppabsd_core_core_file_p): Sanity check the
value of clicksz to help weed out non HPPA BSD core files.
1994-07-06 06:17:06 +00:00
Stan Shebs 11676adc14 Mach 3 support.
* config.bfd (m88*-*-mach3*, mips*-dec-mach3*, mips*-*-mach3*):
	New targets.
	* configure.host (i[34]86-*-mach3*, ns32k-*-mach3*): Recognize
	"mach3" instead of "mach".
	(m88*-*-mach3*, mips*-dec-mach3*, mips*-*-mach3*): New hosts.
	* targets.c (m88kmach3_vec): New target vector.
	(bfd_target_vector): Add i386mach3_vec and m88kmach3_vec, but
	inside #if 0.
	* aoutx.h (some_aout_object_p) [MACH]: Recognize executables by
	checking for execute permission, instead of looking at entry
	point.
	* i386mach3.c: Update, define MACH, N_TXTOFF, N_TXTADDR,
	N_SHARED_LIB, don't include aout/*.h files, etc.
	* m88kmach3.c: New file, m88k Mach 3 target.
	* config/m88k-mach3.mt,	config/mips-mach3.mt: New files, target
	makefile fragments.
	* config/i386mach3.mh, config/m88kmach3.mh, config/mipsmach3.mh:
	New files, host	makefile fragments.
	* hosts/m88kmach3.h, hosts/mipsmach3.h: New files, host definitions.
1994-07-05 21:50:43 +00:00
Ian Lance Taylor 71edd06df7 * elfcode.h (swap_out_syms): Get alignment of common symbol from
st_value field of saved ELF symbol information, if there is any.
1994-07-05 18:05:03 +00:00
Jeff Law edf7c1e4fe * som.h (R_HPPA_COMPLEX): Define.
* elf32-hppa.h (R_HPPA_COMPLEX): Define.
	(elf32_hppa_reloc_type): Delete R_PARISC_STUB_CALL_17.
1994-07-05 01:19:31 +00:00
Jeff Law ff5a090fb4 * Support code for enabling the new style linker for PA ELF.
* elfcode.h (swap_symbol_in, swap_symbol_out): Externalize.
	(elf_compute_section_file_positions): Pass link_info to
	the begin_write_processing hook.
	(bfd_elf_write_object_contents): Pass NULL for new link_info
	argument to final_write_processing hook.
	(elf_link_output_sym): Accept new "input_section" argument for
	the symbols's input section.  All callers changed.  Call the
	link_output_symbol_hook if it's defined.
	(elf_bfd_final_link): Call the final_write_processing hook if
	it's defined.
	* libelf.h (elf_backend_link_output_symbol_hook): Declare.
	(elf_backend_begin_write_processing): Add new "info" argument.
	(elf_backend_final_write_processing): Likewise.
	* elf32-target.h (elf_backend_link_output_symbol_hook): Provide
	a default definition.
	(elf32_bed): Add elf_backend_link_output_symbol_hook.
	* elf64-target.h: Likewise.

	* Major rework of the PA ELF code.  Uses the new style BFD
	linker, major cleanups.
	* hppa_stubs.h: Rewrite from scratch.  Much smaller and simpler.
	* elf32-hppa.h: Delete all symbol extension related code.
	(hppa_look_for_stubs_in_section): Delete decl.
	(elf32_hppa_size_stubs, elf32_hppa_build_stubs): New decls.
	* elf32-hppa.c: Symbol extension stuff moved form elf32-hppa.h
	into elf32-hppa.c.  Do not include aout64.h.
	(typdef hppa_stub_type): Delete.
	(elf32_hppa_stub_name_list_struct): Delete.
	(elf32_hppa_stub_description_struct): Delete.
	(arg_reloc_type): Use simpler enumerations.  All references changed.
	(arg_location, arg_reloc_relocation): Likewise.
	(elf32_hppa_symextn_map_struct): Delete.
	(get_symbol_value): Delete.
	(elf32_hppa_get_sym_extn): Delete.
	(find_stubs, new_stubs, type_of_mismatch): Delete.
	(find_stub_by_name, add_stub_by_name): Delete.
	(hppa_elf_stub_finish, hppa_elf_stub_reloc): Delete.
	(hppa_elf_arg_reloc_needed): Renamed.  Simplify.
	(hppa_elf_build_linker_stub, hppa_elf_create_stub_sec): Delete.
	(hppa_elf_long_branch_needed_p): Delete.
	(hppa_look_for_stubs_in_section): Delete.
	(hppa_elf_get_section_contents): Delete.
	(elf32_hppa_backend_symbol_processing): Delete.
	(elf32_hppa_backend_section_processing): Delete.
	(elf32_hppa_backend_section_from_shdr): Delete.
	(elf32_hppa_backend_fake_sections): Delete.
	(elf32_hppa_backend_section_from_bfd_section): Delete.
	(NEW_INSTRUCTION): Delete.
	(CURRENT_STUB_OFFSET): Delete.
	(elf32_hppa_relocate_section): New function.
	(elf32_hppa_bfd_final_link_relocate): New function.
	(elf32_hppa_size_symext): New function.
	(elf32_hppa_link_output_symbol_hook): New function.
	(elf32_hppa_read_symext_info): New function.
	(elf32_hppa_add_symbol_hook): New function.
	(elf32_hppa_name_of_stub): New function.
	(elf32_hppa_size_of_stub): New function.
	(elf32_hppa_build_one_sub): New function.
	(elf32_hppa_build_stubs): New function.
	(elf32_hppa_size_stubs): New function.
	(linker, stub and argument hash tables): Add appropriate
	structures, definitions and functions to implement all three
	hash tables.
	(hppa_elf_relocate_insn): Don't need argument location information
	in this function.
	(add_entry_to_symext_chain): Accept a symbol's argument location
	information rather than the symbol itself.  All callers changed.
	(hppa_elf_gen_reloc_type): Simplify.
	(hppa_elf_set_section_contents): Stub section is no longer special.
	(hppa_elf_reloc): Greatly simplify.
	(elf32_hppa_begin_write_processing): Accept link_info argument.
	Handle being called from the BFD backend linker.
	(elf32_hppa_final_write_processing): Likewise.
	(elf_hppa_tc_make_sections): No longer call stub_finish.
1994-07-01 19:00:17 +00:00
Stan Shebs 6989f6778e * ecoffswap.h (ecoff_swap_pdr_in, ecoff_swap_pdr_in) [MPW_C]:
Alternate versions without ECOFF_64 that chokes MPW C.
1994-06-30 00:20:40 +00:00
Stan Shebs 75c8a303bb Remove more GM-specific stuff. 1994-06-28 02:12:13 +00:00
Steve Chamberlain eeaed1957a * section.c (bfd_get_section_contents): Put in parens to get
precedence right.
1994-06-28 01:09:50 +00:00
Jeff Law 6dde66d569 * libelf.h (relocate_section): New argument "output_names" added
to prototype.
	* elfcode.h (elf_link_input_bfd): New argument "output_names"
	added to prototype of relocate_section.  Pass the output symbol
	names to relocate_section.
	* elf32-i386.c (elf_i386_relocate_section): Use "output_names" to
	determine the name of a local symbol.
	* elf32-mips.c (mips_elf_relocate_section): Likewise.
	* elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
1994-06-27 00:17:41 +00:00
Stan Shebs c71f57835c * mpw-config.in: Use sed instead of StreamEdit, add definitions
for mips target.
	* mpw-make.in: Remove mips targets definitions, add rule to
	compile with GCC, remove ecoff.c.o and ecofflink.c.o from list of
	required object files.
1994-06-26 23:00:20 +00:00
Peter Schauer 5e16521ab7 Add Solaris BCP (the part of Solaris which allows it to run
SunOS4 a.out files) core file handling.
	* aoutf1.h (external_solaris_bcp_core, swapcore_solaris_bcp):
	New structure and its swap in function.
	(internal_sunos_core):  New member c_data_addr, to receive the
	start address of the data section in the core file.
	(swapcore_sun3, swapcore_sparc, sunos4_core_file_p):  Use it.
	(sunos4_core_file_p):  Recognize Solaris BCP core file.
	(sunos4_core_file_matches_executable_p):  Always indicate match
	for Solaris BCP core files.
1994-06-24 16:18:35 +00:00
Ian Lance Taylor 8af74670df Preliminary support for generating shared libraries, from Eric
Youngdale <ericy@cais.cais.com>.
	* elfcode.h (prep_headers): If DYNAMIC, set e_type to ET_DYN.
	(elf_link_add_object_symbols): If generating a shared library,
	create dynamic sections for first input BFD with the right format.
	(elf_link_create_dynamic_sections): Don't create .interp section
	if creating a shared library.
	(elf_link_input_bfd): Skip dynamic sections in input file.
	(elf_bfd_final_link): If creating a shared library, it's OK for
	dynobj to have sections which are not SEC_IN_MEMORY.
	* elf32-i386.c (elf_i386_size_dynamic_sections): Only set .interp
	section if not creating a shared library.
	* elf32-sparc.c (elf_sparc_size_dynamic_sections): Likewise.
1994-06-23 21:36:03 +00:00