Commit Graph

1190 Commits

Author SHA1 Message Date
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
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
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
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
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