Commit Graph

1530 Commits

Author SHA1 Message Date
Ian Lance Taylor f135c69272 * coffcode.h (bfd_coff_backend_data): Add new field
_bfd_coff_adjust_symndx.
	(bfd_coff_adjust_symndx): Define.
	(coff_adjust_symndx): Define as NULL if not already defined.
	(bfd_coff_std_swap_table): Initialize new field to
	coff_adjust_symndx.
	* cofflink.c (coff_link_input_bfd): Call coff_adjust_symndx if it
	is defined.
	* coff-a29k.c (coff_a29k_adjust_symndx): New static function.
	(coff_adjust_symndx): Define before including coffcode.h.
	* libcoff.h: Rebuild.
1995-03-07 19:56:31 +00:00
Ian Lance Taylor 597e3d58ba * format.c (bfd_check_format_matches): Skip binary_vec when
searching through bfd_target_vector.
1995-03-07 19:32:39 +00:00
Ian Lance Taylor d211786089 * elfcode.h (elf_sort_hdrs): Check SHT_NOBITS before checking
sh_size.
1995-03-07 17:25:07 +00:00
David Edelsohn df168c35f9 * elfcode.h (elf_sort_hdrs): Keep SHT_NOBITS sections after
!SHT_NOBITS ones.
1995-03-07 07:34:21 +00:00
Jeff Law 0f4161ddd0 * cpu-hppa.c (arch_info_struct): Support both PA1.0 and PA1.1
machine types.
	(bfd_hppa_arch): Link in both PA1.0 and PA1.1 architecture info
	structures.
	* libhppa.h (enum pa_arch): New enumeration to describe the
	different variants of the PA architecture.
	* som.c (som_object_setup): Use new enumeration to set machine
	type.
	(som_finish_writing): If the machine type is PA1.1, then use the
	PA1.1 machine identifier in the output file.
1995-03-06 17:00:18 +00:00
Ian Lance Taylor 773033d2d2 * aoutx.h (NAME(aout,set_section_contents)): Double check that the
caller is writing to a valid section.
PR 5996 cleanup.
1995-03-02 21:00:39 +00:00
Ian Lance Taylor c9f92c114b Thu Mar 2 14:37:57 1995 Bryan Ford <baford@cs.utah.edu>
* binary.c: Add support for reading binary files.  Loads the raw
	contents of the file into a data section and wraps some symbols
	around it.  The symbols `_binary_<filename>_start' and
	`_binary_<filename>_end' indicate the start and end of the data,
	while `_binary_<filename>_size' is an absolute symbol whose value
	is the size of the data.  <filename> is the name of the binary
	input file, with all non-alphanumeric characters converted to
	underscores.

	* archures.c (bfd_arch_get_compatible): Assume users knows what
	they're doing if one of the architectures is bfd_arch_unknown.
1995-03-02 20:04:07 +00:00
Michael Meissner 3598343227 Warn if GOT16 overflows. 1995-03-01 22:34:34 +00:00
Jason Molenda 8760f77caf Wed Mar 1 11:52:55 1995 Jason Molenda <crash@phydeaux.cygnus.com>
* configure.host: Recognize powerpc-*-aix*.

for sludge.cygnus.com.
1995-03-01 19:55:05 +00:00
Ian Lance Taylor 46cde09506 * coff-i960.c (COFF_PAGE_SIZE): Define. 1995-03-01 18:06:13 +00:00
Ian Lance Taylor d842ea0b17 * configure.in: Rewrite output of TDEFAULTS to avoid relying on
semantics of single quotes in parameter substitution.
1995-03-01 16:58:57 +00:00
Ian Lance Taylor afbc1a16b3 * elfcode.h (elf_sort_hdrs): Sort empty sections before non-empty
sections, if they have the same VMA.
1995-02-28 19:33:51 +00:00
Ian Lance Taylor c47c90f441 * config.bfd (i[345]86-*-linuxelf*): New target. Use i386-lelf.
(i[345]86-*-gnuelf*): New target.  Use i386-gelf.
	* config/i386-lelf.mt: New file.
	* config/i386-gelf.mt: New file.
1995-02-28 17:54:37 +00:00
Kung Hsu 490d89a787 * config.bfd: add a29k-*-vxworks configuration. 1995-02-27 20:59:54 +00:00
Ian Lance Taylor 19a681380e * bout.c (b_out_slurp_reloc_table): Don't return an error if asked
for relocations for the .bss section.
PR 6377.
1995-02-22 02:20:51 +00:00
Jeff Law ee4d24c613 * som.c (som_bfd_ar_write_symbol_stuff): Handle objects with odd
lengths.
1995-02-21 22:15:19 +00:00
Jeff Law 312eb91b73 Add missed log entry for som.c. 1995-02-21 05:12:58 +00:00
Ian Lance Taylor ebb6075d2a * hosts/sysv4.h: Include <unistd.h>, <stdlib.h>, and <time.h>.
Only define SEEK_SET and SEEK_CUR if they are not already defined.
	Remove all external function declarations.
1995-02-17 18:35:40 +00:00
Michael Meissner eaba51690a Make GOT relocs offset by 32768, which allows the table to double in size. 1995-02-17 17:41:08 +00:00
Ian Lance Taylor cd0456a208 * syms.c (bfd_decode_symclass): Return 'W' for a weak symbol. 1995-02-17 17:26:48 +00:00
Ian Lance Taylor 6936966a62 * coffgen.c (coff_real_object_p): Set start address and flags
before calling coff_mkobject_hook.  Restore them on failure.
	* ecoff.c (_bfd_ecoff_mkobject_hook): If not ECOFF_AOUT_ZMAGIC,
	clear D_PAGED.
PR 6341.
1995-02-17 16:57:18 +00:00
Ian Lance Taylor 6dc6a81a7c * coffgen.c: Reindented. 1995-02-17 16:46:52 +00:00
David Edelsohn b596295f13 * reloc.c (bfd_perform_relocation): Don't use bitpos in overflow calculations.
(bfd_install_relocation): Likewise.
1995-02-16 22:40:19 +00:00
Ian Lance Taylor fe46552d89 * hosts/std-host.h: Remove all function declarations which return
int or void, except the one for free.
1995-02-16 18:23:57 +00:00
Michael Meissner bcbe2c719c Fix powerpc PC relative reloc & add some 16 bit relocs. 1995-02-15 19:57:56 +00:00
Michael Meissner 8c9bfee312 Reconize old versions of the PowerPC machine code (EM_PPC_OLD and EM_CYGNUS_POWERPC). 1995-02-14 19:20:16 +00:00
Ian Lance Taylor aed592693f * aoutf1.h (MACHTYPE_OK): Don't define if already defined. Don't
accept M_SPARC if bfd_arch_sparc is not in the list of supported
	architectures, and don't accept a 680x0 machine type if
	bfd_arch_m68k is not in the list of supported architectures.
	* aout0.c (MACHTYPE_OK): Define.
1995-02-14 17:49:30 +00:00
Ian Lance Taylor 1f9327360d * aoutx.h (NAME(aout,swap_ext_reloc_in)): Don't return a pointer
to garbage if the symbol index is out of range.
	(NAME(aout,swap_std_reloc_in)): Likewise.
1995-02-14 04:27:39 +00:00
Ian Lance Taylor 405affccae Revert this patch, since it breaks linking PIC code with no dynamic
objects:
	* elfcode.h (elf_bfd_final_link): Add assertion to make sure that
	dynamic and dynobj are in synch.
1995-02-13 19:04:05 +00:00
David Edelsohn 866da18e1f * archures (bfd_mach_arc_base): #define.
(bfd_mach_arc_host, bfd_mach_arc_graphics, bfd_mach_arc_audio): Ditto.
	* cpu-arc.c (arch_info_struct): Define entries for each cpu variant.
	(bfd_arc_arch): Link each one in.
	(arc_get_mach): New function.
	* elf32-arc.c (arc_info_to_howto_rel): Renamed from arc_info_to_howto.
	(elf_info_to_howto_rel): Update.
	(arc_elf_object_p, arc_elf_final_write_processing): New functions.
	(elf_backend_object_p): Define.
	(elf_backend_final_write_processing): Define.
	(USE_REL): Define.
1995-02-10 01:40:36 +00:00
Ken Raeburn 10bf6ddf08 * Makefile.in (BFD32_BACKENDS): Add i386msdos.o. 1995-02-10 00:17:32 +00:00
Ian Lance Taylor c93e959c81 * i386linux.c (NEEDS_SHRLIB): Define.
(linux_tally_symbols): Crash if a NEEDS_SHRLIB symbol is
	undefined.  From hjl@nynexst.com (H.J. Lu).
1995-02-09 17:19:53 +00:00
Ian Lance Taylor 62e5acdce9 * elfcode.h (elf_bfd_final_link): Add assertion to make sure that
dynamic and dynobj are in synch.
1995-02-09 17:03:47 +00:00
Ian Lance Taylor 6581a70a9a * linker.c (generic_link_check_archive_element): Allocate common
symbol information structure.  Don't bother to check for common
	symbol size overflow.
	(_bfd_generic_link_add_one_symbol): Likewise.
	* aoutx.h (aout_link_check_ar_symbols): Likewise.
	* linker.c (generic_link_check_archive_element): Adjust references
	to common symbol information for new structure.
	(_bfd_generic_link_add_one_symbol): Likewise.
	* aoutx.h (aout_link_check_ar_symbols): Likewise.
	(aout_link_add_symbols): Likewise.
	* ecoff.c (ecoff_link_add_externals): Likewise.
	* elfcode.h (elf_link_add_object_symbols): Likewise.
	(elf_link_output_extsym): Likewise.
	* sunos.c (sunos_add_one_symbol): Likewise.
1995-02-08 22:57:48 +00:00
David Edelsohn 121a846514 elfcode.h (elf_sort_hdrs): Put SHT_NOBITS sections after !SHT_NOBITS. 1995-02-08 20:58:01 +00:00
Jeff Law 28860f46fa * som.c (som_bfd_find_nearest_line): Just return false, don't
abort.
1995-02-07 23:29:08 +00:00
Ken Raeburn 2559e01429 clean up mechanics of mosberger-tang's changes 1995-02-07 20:06:28 +00:00
Ian Lance Taylor 95b0f14bce * ecoffswap.h (ecoff_swap_pdr_in): Zero out intern before setting
any of the fields.
1995-02-07 19:22:43 +00:00
Ken Raeburn 97d5a14949 ecoff gprof related fixes & improvements from David Mosberger-Tang 1995-02-07 01:06:25 +00:00
Ian Lance Taylor 5947417403 * libelf.h (struct elf_link_hash_table): Add saw_needed field.
* elfcode.h (elf_link_add_object_symbols): Set saw_needed if
	DT_NEEDED seen in .dynamic section.
	(elf_link_output_extsym): Warn if an undefined symbol is
	only referenced from a dynamic object, and not making a shared
	object, and saw_needed is false.
	* elf.c (_bfd_elf_link_hash_table_init): Initialize saw_needed.
1995-02-06 23:23:37 +00:00
Ian Lance Taylor 0bef7f7266 * libelf.h (ELF_LINK_HASH_DEFINED_WEAK): Don't define.
* elfcode.h (elf_link_add_object_symbols): Don't clear or set
	ELF_LINK_HASH_DEFINED_WEAK.
	(elf_link_output_extsym): Don't check ELF_LINK_HASH_DEFINED_WEAK.
1995-02-06 21:34:44 +00:00
Ian Lance Taylor 6c97aedf26 Distinguish a weak defined symbol from a regular defined symbol.
* linker.c (enum link_action): Add DEFW.
	(link_action): Add bfd_link_hash_defweak column.
	(_bfd_generic_link_add_one_symbol): Add DEFW case.  Handle
	bfd_link_hash_defweak in a few other cases.
	* Many files (bfd_link_hash_undefweak): Renamed from
	bfd_link_hash_weak.
	* aoutx.h (aout_link_write_symbols): Handle bfd_link_hash_defweak.
	(aout_link_write_other_symbol): Likewise.
	(aout_link_input_section_std): Likewise.
	(aout_link_input_section_ext): Likewise.
	* bout.c (get_value): Likewise.
	* coff-a29k.c (coff_a29k_relocate_section): Likewise.
	* coff-alpha.c (alpha_convert_external_reloc): Likewise.
	(alpha_relocate_section): Likewise.
	* coff-mips.c (mips_relocate_section): Likewise.
	(mips_relax_section): Likewise.
	(bfd_mips_ecoff_create_embedded_relocs): Likewise.
	* cofflink.c (coff_write_global_sym): Likewise.
	(_bfd_coff_generic_relocate_section): Likewise.
	* ecoff.c (ecoff_link_add_externals): Likewise.
	(ecoff_link_write_external): LIkewise.
	* elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
	(elf32_hppa_size_stubs): Likewise.
	* elf32-i386.c (elf_i386_adjust_dynamic_symbol): Likewise.
	(elf_i386_relocate_section): Likewise.
	(elf_i386_finish_dynamic_symbol): Likewise.
	* elf32-mips.c (mips_elf_output_extsym): Likewise.
	(mips_elf_relocate_section): Likewise.
	* elf32-sparc.c (elf32_sparc_adjust_dynamic_symbol): Likewise.
	(elf32_sparc_relocate_section): Likewise.
	* elfcode.h (elf_link_add_object_symbols): Likewise.
	(elf_adjust_dynamic_symbol): Likewise.
	(elf_bfd_final_link): Likewise.
	(elf_link_output_extsym): Likewise.
	* i386linux.c (linux_add_one_symbol): Likewise.
	(linux_tally_symbols): Likewise.
	(linux_finish_dynamic_link): Likewise.
	* linker.c (_bfd_generic_link_output_symbols): Likewise.
	(set_symbol_from_hash): Likewise.
	* reloc16.c (bfd_coff_reloc16_get_value): Likewise.
	(bfd_perform_slip): Likewise.
	* sunos.c (sunos_add_one_symbol): Likewise.
	(sunos_scan_std_relocs): Likewise.
	(sunos_scan_ext_relocs): Likewise.
	(sunos_scan_dynamic_symbol): Likewise.
	(sunos_write_dynamic_symbol): Likewise.
1995-02-06 20:01:08 +00:00
Ken Raeburn 5dc8db4897 msdos .exe file support from bryan ford 1995-02-06 08:31:27 +00:00
Jeff Law 9ea5de84ab * som.c (som_object_setup): More heruistics to detect the
braindamaged HP OSF1 linker.
	(setup_sections): Don't forget to free subspace_sections if we get
	an error.
	(som_slurp_string_table): Allocate strings on this bfd's obstack
	rather than directly out of the heap.
	(som_slurp_symbol_table): Likewise for the saved copy of the
	canonical symbols.
	(som_slurp_reloc_table): Likewise for the saved copy of the
	canonical relocations.  Free the native relocations when we're
	done with them.
1995-02-01 08:35:40 +00:00
David Edelsohn ef6fb95dea * libelf.h (struct elf_obj_tdata): New member program_header_size.
* elfcode.h (get_program_header_size): New parameters sorted_hdrs,
	count, and maxpagesize.  All callers updated.
	If sorted_hdrs is non-NULL, use it to compute the number of segments.
	Save result in case called again.
	(assign_file_positions_except_relocs): Sort headers before calling
	get_program_header_size.
1995-02-01 05:56:53 +00:00
Ian Lance Taylor 5945db2997 * elfcode.h (map_program_segments): Add sorted_hdrs parameter.
Search through it rather than through unsorted section headers.
	(assign_file_positions_except_relocs): Pass sorted_hdrs to
	map_program_segments.
1995-01-31 20:55:25 +00:00
Ken Raeburn 3e46110757 * ecoff.c (_bfd_ecoff_find_nearest_line): Fix problems in range checking.
Expect argument OFFSET to be section-relative.  From David Mosberger-Tang,
davidm@piston.cs.arizona.edu.
1995-01-31 03:57:31 +00:00
Jeff Law 8bc3e02c9d * som.c (compare_subspaces): New function to sort subspaces by
their location in the object file.
	(setup_sections): When computing the index for each subspace,
	handle case where setup_sections reads the subspaces in a
	different order that they appear in the object file.
	(som_is_space): Also examine the output section for the containing
	section.
	(som_is_subspace, som_is_container): Likewise.
	(som_begin_writing): Don't prepare or write fixups here.  When
	writing the symbol strings, use the unsorted symbol table.
	(som_write_object_contents): Don't write the symbol table here.
	(som_finish_writing): Prepare and write the fixups here.  Likewise
	for the symbol table.
	(som_bfd_derive_misc_symbol_info): Undefined symbols always have
	type SS_UNSAT regardless of BSF_EXPORT.
	(som_set_reloc_info): Unpack and attach argument location
	information for R_PCREL_CALL and R_ABS_CALL relocations.
1995-01-29 06:37:35 +00:00
Jeff Law fede999213 * som.c (som_object_setup): New heuristic to determine if the
entry and flags fields are switched in the exec header.
1995-01-28 19:50:52 +00:00
Ian Lance Taylor cd9dba7b37 * elfcode.h (elf_link_add_object_symbols): Use *sym_hash instead
of h if we might not be doing an ELF link.
1995-01-28 05:17:04 +00:00
Ian Lance Taylor cea133af7f * elf32-mips.c (mips_elf_final_link): If the size of an input
.reginfo section is zero, force it to the correct size, since the
	linker emulation code may have clobbered it.
1995-01-27 21:27:33 +00:00
Ian Lance Taylor 6977046f0f * elfcode.h (elf_sort_hdrs): Correct SHF_ALLOC test.
(assign_file_positions_except_relocs): Free sorted_hdrs.
1995-01-27 21:24:28 +00:00
Steve Chamberlain 7896128dfa * srec.c (srec_set_section_contents): Fix off by
one end address calculation.
1995-01-27 16:41:11 +00:00
Ian Lance Taylor 4b412ed189 * elfcode.h (elf_link_add_object_symbols): Only examine weakdef if
we are using an ELF hash table.
1995-01-26 21:48:14 +00:00
Steve Chamberlain 61a914c923 * config.bfd: (m68*-est-coff): New configuration. 1995-01-26 17:37:31 +00:00
Ian Lance Taylor e83e94effd * aoutx.h (NAME(aout,some_aout_object_p)): Always set EXEC_P if
the start address is in the .text section, even if STAT_FOR_EXEC
	is set.  Just use STAT_FOR_EXEC as an additional test.
1995-01-26 16:43:54 +00:00
Michael Meissner c6d729b375 Add new relocs for PowerPC Elf support.
Add eabi support.
1995-01-26 16:31:24 +00:00
Ian Lance Taylor e079cfe890 * coff-sh.c (CALC_ADDEND): Don't define.
(coff_sh_relocate_section): Remove.
	(coff_relocate_section): Use _bfd_coff_generic_relocate_section.
1995-01-26 04:27:50 +00:00
Ian Lance Taylor 16fe8950ad * elf32-mips.c (mips_elf_output_extsym): Set the value of the
ECOFF symbol from the hash table entry.
1995-01-24 19:27:35 +00:00
Steve Chamberlain c525c3afcb Mon Jan 23 14:53:35 1995 Steve Chamberlain <sac@splat>
* coff-sh.c (coff_sh_relocate_section):  Don't subtract
	vma twice.
1995-01-23 22:57:30 +00:00
Ian Lance Taylor 6e3acf74d0 * coff-sh.c (sh_reloc): Don't ignore the previous contents of an
R_SH_IMM32 reloc.
PR 6215.
1995-01-23 22:32:18 +00:00
Ian Lance Taylor 6e7f3f077b x 1995-01-23 19:01:41 +00:00
Ian Lance Taylor 123bfaa5ec * opncls.c (bfd_openstreamr): Call bfd_cache_init. 1995-01-23 18:35:07 +00:00
Ian Lance Taylor 04dc16b76b * sunos.c (sunos_add_one_symbol): Only set the sunos specific
fields if we are doing a sunos link.
1995-01-20 16:57:34 +00:00
Ian Lance Taylor d01a0278a0 * bfd-in.h (bfd_byte, reloc_howto_type): Define here, not...
* reloc.c (bfd_byte, reloc_howto_type): here.
	* Changed all occurrences of ``const struct reloc_howto_struct''
	to be ``reloc_howto_type'' instead.
	* bfd-in2.h, libbfd.h, libcoff.h: Rebuilt.
Avoids problems with the native Irix 5 compiler.
1995-01-17 21:16:53 +00:00
Ian Lance Taylor 8a51b06cf6 * opncls.c (bfd_openstreamr): New function.
* bfd-in2.h: Rebuilt.
1995-01-17 19:26:56 +00:00
Ian Lance Taylor 6a5848cd10 * elf32-mips.c (enum reloc_type): Define new relocs used on Irix.
(elf_mips_howto_table): Add entries for new relocs.
	(mips_elf_section_from_shdr): Handle SHT_MIPS_MSYM,
	SHT_MIPS_DWARF, and SHT_MIPS_EVENTS.
	(mips_elf_fake_sections): Handle sections named .msym, .debug_*
	and .MIPS.events.*.
1995-01-17 15:55:55 +00:00
Steve Chamberlain c21b376fc6 * archures.c, Makefile.in, targets.c, bfd-in2.h, coffcode.h,
config.bfd, configure.in, config/w65.mt: Initial support for the W65.
1995-01-16 05:39:06 +00:00
Steve Chamberlain 9560e662d0 Sun Jan 15 13:57:45 1995 Steve Chamberlain <sac@splat>
* opncls.c (bfd_fdopenr): Configure for WIN32.
1995-01-15 22:04:02 +00:00
Ken Raeburn c3fcc07805 Makefile changes for arc, rce, diststuff.
Const fixes and hex_value changes to various files.
1995-01-12 21:46:17 +00:00
Peter Schauer b69fe36371 * hosts/symmetry.h: Redefine `shared' to enable compilation
with the native Dynix cc compiler.
	* i386dynix.c:  Include aoutx.h instead of using routines
	from aout32.c.
1995-01-12 18:33:52 +00:00
Ken Raeburn 9c84b228d8 Forgot an entry in last checkin:
* ecoff.c (ecoff_type_to_string): Local variable `buffer1' doesn't
	need to be static.
1995-01-12 02:44:45 +00:00
Ken Raeburn 82b1edf7b9 Change "reloc_howto_type" typedef to be "const", since all uses of it are (or
should be) anyways.
1995-01-12 02:41:04 +00:00
Ian Lance Taylor 788d94361f * sunos.c (sunos_add_one_symbol): Don't core dump if a multiple
definition of an absolute symbol is encountered.
1995-01-11 19:42:28 +00:00
Ian Lance Taylor 040c913e18 * linker.c (_bfd_generic_link_add_one_symbol): Ignore
redefinitions of an absolute symbol to the same value.
PR 6159.
1995-01-11 19:38:06 +00:00
Ian Lance Taylor f78b396350 * elfcode.h (elf_link_add_object_symbols): It's reasonable for no
flags to be set, so don't insist otherwise.
1995-01-09 20:52:59 +00:00
Ian Lance Taylor 42cf6d7950 * elfcode.h (elf_slurp_symbol_table): Don't set BSF_GLOBAL for an
undefined or common symbol.
	(elf_link_add_object_symbols): Likewise.
1995-01-06 21:50:28 +00:00
Jeff Law eb57c77670 * som.c (bfd_section_from_som_symbol): Only return sections which
correspond to subspaces.
1995-01-05 00:34:07 +00:00
Jeff Law 1b56797098 * som.c (som_begin_writing): Don't forget to bump the
total_subspaces when writing the unloadable subspaces.
1995-01-04 21:15:42 +00:00
Jeff Law c3a1888801 * som.c (som_write_fixups): Use SEC_HAS_CONTENTS to identify
bss-like sections.
	(som_get_section_contents): Likewise.
	(som_set_section_contents): Likewise.
1994-12-29 03:56:20 +00:00
Ken Raeburn 8675437ee1 coffgen.c changes checked in last tuesday -- forgot to check in the log entry 1994-12-27 21:41:33 +00:00
Jeff Law 5faa346b63 * som.c (setup_sections): Turn off SEC_HAS_CONTENTS for bss-like
sections.
1994-12-27 21:05:10 +00:00
Ian Lance Taylor f10d31aa32 * i386linux.c (linux_add_one_symbol): Don't do anything Linux
specific if this is not a Linux hash table.  From Eric Youngdale
	<eric@aib.com>.
1994-12-21 00:46:03 +00:00
Ian Lance Taylor 182b9e9f52 Patches from kkojima@mix.or.jp (Kazumoto Kojima):
* mipsbsd.c (mips_howto_table_ext): Change sizes of memory relocs
	apply to from two bytes to four bytes.
	* MY(reloc_howto_type_lookup): Handle BFD_RELOC_CTOR.
1994-12-21 00:36:26 +00:00
Ken Raeburn 85200ebce9 * elfcode.h (assign_file_positions_except_relocs): In assertion, force all
values to the same type.
1994-12-20 20:31:36 +00:00
Steve Chamberlain e7d9ee909c * coff-h8300.c (howto_table): All relocs get a special function.
(special): Never do anything when linking -r.
1994-12-20 19:13:55 +00:00
Ian Lance Taylor 9b09a01580 * elf32-i386.c (elf_i386_relocate_section): Correct and expand the
list of cases for which relocation need not be computed.
	* elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
1994-12-20 19:07:11 +00:00
Jeff Law 5874427fb9 * elf32-hppa.c (elf32_hppa_read_symext_info): Delete do_locals and
do_globals arguments, always read symbol extension information for
	globals and locals.  All callers changed.
	(elf32_hppa_size_stubs): Rework to only read symbol extension
	information once for each input bfd.  Another 10% improvement in
	linker performance.
1994-12-20 06:17:09 +00:00
Ian Lance Taylor 963747b358 * elfcode.h (elf_section_from_bfd_section): Check
bfd_is_abs_section, etc., only after checking for the section in
	the BFD and after calling the backend routine.
1994-12-16 17:30:08 +00:00
Ian Lance Taylor 2f19e36d97 * elfcode.h (elf_map_symbols): Only use section symbols whose
value is the start of the section, checking output_offset when
	using output_section.  When creating a new symbol, set the value
	to 0, since BFD symbol values are section relative.
1994-12-15 04:41:39 +00:00
Ian Lance Taylor f5202354c3 * elfcode.h (elf_map_symbols): Only use section symbols whose
value is the start of the section.
1994-12-15 01:23:40 +00:00
Ian Lance Taylor 1088e1483c * cpu-z8k.c (arch_info_struct): Make z8002 the default
architecture.
1994-12-13 18:33:05 +00:00
Ian Lance Taylor a0020ea1a4 * aoutx.h (NAME(aout,link_add_symbols)): Similar change if the
first object is not an a.out object.
1994-12-09 22:18:49 +00:00
Ian Lance Taylor 4c124191db * elfcode.h (elf_bfd_link_add_symbols): If the first object in the
archive is not an ELF object, pass the archive to the add_symbols
	entry point appropriate for the first object.  From Eric Youngdale
	<eric@aib.com>.
1994-12-09 17:57:47 +00:00
Ian Lance Taylor aeec67f08c * elf32-i386.c (elf_i386_relocate_section): Don't compute
relocation in cases where we won't use it.
	* elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
1994-12-09 17:44:45 +00:00
Ken Raeburn f8368802df * pc532-mach.c (NAME): Define to use ns32kaout prefix.
* ns32knetbsd.c (NAME): Ditto.
(ns32kaout_32_get_section_contents): Define to standard aout-32 version.
1994-12-08 20:47:46 +00:00
Ian Lance Taylor 729850916c * coff-sh.c: Use _bfd_dummy_target instead of no_archive. 1994-11-30 19:14:23 +00:00
David Edelsohn 20e5867807 * config/arc-elf.mt: New file. 1994-11-30 01:35:40 +00:00
David Edelsohn 05cedcf6c1 Initial ARC support. 1994-11-30 01:29:26 +00:00
J.T. Conklin 5b0f1ab5f1 * config.bfd (i[345]86-*-freebsd*): Use i386-bsd as bfd_name.
* configure.host (i[345]86-*-freebsd*): Use i386bsd as my_host.
CVSn:
1994-11-29 22:24:39 +00:00
J.T. Conklin 382229dc12 * config/m68k-nbsd.mt (DEFAULT_VECTOR): set to m68knetbsd_vec.
* Makefile.in: Rebuilt dependancies.
  (CFILES): Added m68knetbsd.c.
  (HFILES): Added netbsd.h.
1994-11-28 23:43:02 +00:00
Steve Chamberlain 7a1d45675e * coff-sh.c (shlcoff_vec): New target vector.
(no_archive): New function.
	* coffcode.h (coff_set_arch_mach_hook, coff_set_flags): Handle
	little endian SH.
	* configure.in: Handle shl.
	* targets.c (bfd_target_vector): Add shlcoff_vec.
	* config/sh-coff.mt (SELECT_VECS): Handle shl_coff_vec.
1994-11-24 03:33:48 +00:00
Jeff Law 150bd9910b * elf32-hppa.c (elf32_hppa_bfd_final_link_relocate): Do not add
input_section->vma to the relocation's offset.
1994-11-23 06:36:43 +00:00
Ian Lance Taylor ba3eb9c013 * srec.c (srec_get_reloc_upper_bound): Define.
(srec_canonicalize_reloc): Define.
	(srec_bfd_reloc_type_lookup): Define.
	(srec_vec, symbolsrec_vec): Use BFD_JUMP_TABLE_RELOCS (srec).
PR 5975.
1994-11-21 17:42:04 +00:00
Peter Schauer ae4471f628 * configure.host (i[345]86-*-solaris*): Use solaris2 to
enable extraction of procfs info from core file for GDB.
1994-11-19 11:14:01 +00:00
Ken Raeburn fca2b81b88 * reloc.c (bfd_reloc_code_type): Add new value BFD_RELOC_12_PCREL.
* bfd-in2.h, libbfd.h: Rebuilt.
1994-11-17 22:46:22 +00:00
Jeff Law b68a74d193 * bfd/elf32-hppa.c (elf32_hppa_bfd_final_link_relocated): Use the
vma from the output_section containing $global$ when computing
        global_vlaue.
1994-11-17 20:14:19 +00:00
Ian Lance Taylor cf9557f5ea * archive.c (_bfd_write_archive_contents): Round up the archive
header size of the extended name table to an even number.
1994-11-17 19:32:06 +00:00
Ken Raeburn f6f350fe5b * coff-sh.c: Deleted some code that was commented out or inside "#if 0".
(COFF_LONG_FILENAMES): Define.

* cpu-sh.c (arch_info_struct): Convert name to lowercase, for consistency with
other architectures.
1994-11-16 22:28:22 +00:00
Ian Lance Taylor e6fb0df7c0 * elfcode.h (elf_export_symbol): Also export symbols which are
referenced by a regular file.
1994-11-13 04:51:53 +00:00
Ian Lance Taylor 11bb5591d6 * elfcode.h (NAME(bfd_elf,size_dynamic_sections)): Add
export_dynamic argument, and handle it.
	(elf_export_symbol): New function.
	* bfd-in.h (bfd_elf32_size_dynamic_sections): Update declaration.
	(bfd_elf64_size_dynamic_sections): Update declaration.
	* bfd-in2.h: Rebuild.
1994-11-12 20:55:33 +00:00
Jeff Law 63ba709f37 * hpux-core.c (hpux_core_struct): Delete handles for the
data, reg and stack sections.  They're never used.  Delete
	accessor macros.
	(make_bfd_asection): Use bfd_make_section_anyway since debugging
	cores from dynamic executables may have several sections with the
	same logical name.
	(hpux_core_core_file_p): Don't save handles to data, reg and
	stack sections.  Handle CORE_TEXT, CORE_MMF and CORE_SHM.
1994-11-11 17:40:27 +00:00
Ian Lance Taylor 0631def34c * bout.c (callj_callback): Add new argument shrinking. Change all
callers.  Handle relocs against section symbols correctly.  If not
	shrinking, don't subtract out dstidx; the subtraction is already
	in the object file.
PR 5883.
1994-11-08 18:05:43 +00:00
Ken Raeburn 30d1f88c98 configure.in: fix ns32knetbsd_vec -> pc532netbsd_vec 1994-11-04 00:02:18 +00:00
Ken Raeburn 9e6473f52a aoutx.h fixes from net 1994-11-03 23:52:52 +00:00
Ken Raeburn 72f2e98420 go32 patches from dj 1994-11-03 23:50:48 +00:00
Ken Raeburn 1ef625b778 Makefile.in (ALL_MACHINES): Include m68knetbsd.o. 1994-11-03 23:49:17 +00:00
Ken Raeburn 2c5cdec23d i386linux.mh: include -lm in EXTRALIBS 1994-11-03 23:21:32 +00:00
Ian Lance Taylor 9cb8eb5c28 * archive.c (normalize): Change to take a BFD as an argument.
Change VMS version to use bfd_alloc rather than malloc, so that we
	don't lose the memory forever.
	(_bfd_construct_extended_name_table): Check the name of an archive
	entry which is not being extended, and correct it if it is wrong.
	This is necessary in case the archive was constructed by another
	program which put an entry in the extended name table which we
	don't plan to put in ourselves.  From jjc@jclark.com (James
	Clark).
	(bfd_dont_truncate_arname): Check return value of normalize.
1994-11-02 20:29:18 +00:00
Ian Lance Taylor b531cfe94e * elf32-hppa.c (ELF32_PARISC_SX_SIZE): Define.
(ELF32_PARISC_SX_GET, ELF32_PARISC_SX_PUT): Define.
	(symextn_entry): Don't define.
	(symext_chain_size): Change type to bfd_size_type.
	(symextn_contents): Change type to bfd_byte *.
	(elf32_hppa_backend_begin_write_processing): Use
	ELF32_PARISC_SX_SIZE instead of sizeof (symext_entryS).
	(elf32_hppa_size_symext): Likewise.  Also, change type of sizep to
	bfd_size_type *.
	(elf_hppa_tc_make_sections): Cast symextn_contents assignment to
	bfd_byte *.  Use ELF32_PARISC_SX_PUT instead of direct assignment.
	(elf32_hppa_backend_symbol_table_processing): Use
	ELF32_PARISC_SX_SIZE instead of sizeof (symext_entryS).  Use
	ELF32_PARISC_SX_GET insetad of direct assignment.
	(elf32_hppa_read_symext_info): Change type of contents, and its
	assignment cast, to bfd_byte *.  Use ELF32_PARISC_SX_SIZE instead
	of sizeof (symextn_entry).  Use symext_entryS instead of
	symextn_entry.  Use ELF32_PARISC_SX_GET instead of direct
	assignment.
1994-11-01 04:46:07 +00:00
Ian Lance Taylor da6c4a8b3c * archive.c (bfd_dont_truncate_arname): Add the ar padding
character, if there is room for it, even if the name is the
	maximum length.
PR 5859.
1994-10-31 20:23:47 +00:00
Ian Lance Taylor 2d2d08ed7b * elfcode.h (assign_file_positions_except_relocs): Sort the ELF
headers by section address when assigning file positions.
	(elf_sort_hdrs): New static function.
1994-10-31 19:21:40 +00:00
Ian Lance Taylor 197e30e560 * elfcode.h (NAME(bfd_elf,size_dynamic_sections)): Create DT_INIT
and DT_FINI dynamic entries based on the existence of _init and
	_fini symbols, not on the .init and .fini sections.  This is
	compatible with some SVR4 linkers.
	(elf_bfd_final_link): Corresponding change.
1994-10-31 00:04:03 +00:00
Ian Lance Taylor dd4219176d * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Don't move a
symbol with a PLT entry into the .plt section if it is defined in
	a regular file.
	* elf32-sparc.c (elf32_sparc_adjust_dynamic_symbol): Likewise.
1994-10-30 03:41:50 +00:00
Ian Lance Taylor 54f16fc4bb * linker.c (_bfd_generic_link_add_archive_symbols): It's not an
error if an empty archive has no symbol table.
	* ecoff.c (ecoff_link_add_archive_symbols): Likewise.
	* elfcode.h (elf_link_add_archive_symbols): Likewise.
1994-10-29 16:20:41 +00:00
J.T. Conklin ec35a1c2f3 NetBSD/m68k support, based on work by mikeb@snow.datametrics.com:
* config.bfd (m68*-*-netbsd*): Use m68k-nbsd as bfd_name.
* configure.in (m68knetbsd_vec): Added.
* targets.c (bfd_m68knetbsd_vec): Added.
* hosts/m68knbsd.h, config/m68k-nbsd.mt, m68knetbsd.c: New files.
* Makefile.in (BFD32_BACKENDS, CFILES): Add m68knetbsd.c.

miscellaneous cleanup required by all netbsd targets, based on work
by Andrew Cagney <cagney@highland.com.au>:
* netbsd.h (N_MAGIC, N_SET_MAGIC, N_GETMAGIC, N_GETMAGIC2, N_TXTADDR,
  N_TXTOFF, N_ALIGN, N_DATADDR, N_DATOFF): Removed.  Generic a.out
  definitions work.
* i386nbsd.c, ns32knbsd.c, sparcnbsd.c (__LDPGSZ): Removed.
  (MY(write_object_contents)): Use NetBSD's magic numbers
1994-10-28 18:11:15 +00:00
Ian Lance Taylor 14cac507a8 * libelf.h (struct bfd_elf_section_data): Add field dynindx.
* elfcode.h (NAME(bfd_elf,size_dynamic_sections)): Don't finalize
	the .dynsym, .dynstr or .hash sections until after the backend
	size_dynamic_sections routine, so that it can add dynamic symbols
	if it wants to.
	* elf32-i386.c (elf_i386_adjust_dynamic_symbol): Don't define the
	symbol to be in the .plt section when generating a shared library
	if it is a defined symbol.
	* elf32-sparc.c (elf32_sparc_adjust_dynamic_symbol): Likewise.
	(elf32_sparc_size_dynamic_sections): When generating a shared
	library, allocate space for a dynamic symbol for each output
	section, storing the index in the dynindx field of the ELF section
	data.  Adjust the other dynindx fields to account for this.
	(elf32_sparc_adjust_dynindx): New static function.
	(elf32_sparc_relocate_section): When copying a reloc into a shared
	library, use the original addend as appropriate.  Convert an
	R_SPARC_32 reloc into an R_SPARC_RELATIVE reloc.  Use the dynamic
	symbol index of the output section, not the normal symbol index.
	(elf32_sparc_finish_dynamic_sections): Don't die if a section does
	not exist when setting the value of the dynamic tags.  Write out
	a dynamic symbol for each output section.
1994-10-27 21:25:31 +00:00
Ian Lance Taylor 875e471661 * aoutx.h (aout_link_input_section): Don't bother to read or write
the relocs if there aren't any.
1994-10-26 05:17:08 +00:00
Ian Lance Taylor 9c26be63fd * linker.c (enum link_action): Add CIND.
(link_action): Change COMMON_ROW\indr from MDEF to CREF.  Change
	INDR_ROW\common from MDEF to CIND.
	(_bfd_generic_link_add_one_symbol): In CREF case, handle an
	existing symbol which is indirect rather than defined.  Add new
	CIND case.
1994-10-25 15:47:59 +00:00
Ian Lance Taylor fd9a6abc83 Change S-record backend to use multiple sections to handle gaps in
file.
	* srec.c (srec_data_list_struct): Move field next from last place
	to first.  Change type of data to bfd_byte *.
	(struct srec_symbol): Define.
	(tdata_type): Remove done_symbol_read, count, strings, symbol_idx,
	string_size, string_idx.  Change type of symbols to struct
	srec_symbol *.  Add symtail and csymbols.
	(low, high): Remove.
	(size_symbols, fillup_symbols, size_srec, fillup): Remove.
	(white, skipwhite, pass_over, object_p): Remove.
	(srec_mkobject): Call srec_init.  Adjust tdata initialization for
	field changes.
	(srec_get_byte, srec_bad_byte): New static functions.
	(srec_new_symbol, srec_scan): New static functions.
	(srec_object_p): Change type of b to bfd_byte.  Explicitly set
	wrong_format error.  Call srec_mkobject and srec_scan instead of
	object_p.
	(symbolsrec_object_p): Likewise.  Also, change b to be only two
	bytes.
	(srec_read_section): New static function.
	(srec_get_section_contents): Call srec_read_section rather than
	pass_over.  Handle zero length section correctly.
	(set_set_arch_mach): Change from function to macro.
	(srec_set_section_contents): Change data to bfd_byte *.
	(srec_write_record): Change data, end and src to bfd_byte *.
	(srec_write_header): Change buffer and dst to bfd_byte *.
	(srec_write_section): Change location to bfd_byte *.
	(srec_write_terminator): Change buffer to bfd_byte *.
	(srec_get_symtab_upper_bound): Don't call
	srec_get_section_contents.
	(srec_get_symtab): Rewrite.
1994-10-24 20:08:33 +00:00
Ian Lance Taylor a56f23aeb9 * ecoff.c (ecoff_set_symbol_info): Set udata.i to 0, not NULL. 1994-10-24 19:37:18 +00:00
J.T. Conklin 32399d323e * libaout.h (machine_type): added M_68K_NETBSD and M_SPARC_NETBSD.
* i386netbsd.c, ns32knetbsd.c, sparcnetbsd.c: removed RCS Id's.
  changed how PAGE_SIZE and SEGMENT_SIZE are defined so they are
  consistant with each other.
* netbsd.h (N_HEADER_IN_TEXT, TEXT_START_ADDR): NetBSD fits its
  header into the start of its text segment.
1994-10-21 23:55:30 +00:00
Ian Lance Taylor cd9782e8fd * targets.c (BFD_JUMP_TABLE_ARCHIVE): Add case for
_construct_extended_name_table.
	(bfd_target): Add _bfd_construct_extended_name_table.
	* archive.c (_bfd_archive_bsd_construct_extended_name_table): New
	function.
	(_bfd_archive_coff_construct_extended_name_table): New function.
	(_bfd_construct_extended_name_table): Renamed by adding a leading
	underscore, and made externally visible.  Added trailing_slash
	argument, and used it instead of elf_style.  Changed type of
	tablen to bfd_size_type *.
	(_bfd_write_archive_contents): Use BFD_SEND to call
	construct_extended_name_table.  Use the returned name.
	* libbfd-in.h (_bfd_construct_extended_name_table): Declare.
	(_bfd_noarchive_construct_extended_name_table): Define.
	(_bfd_archive_bsd_construct_extended_name_table): Declare.
	(_bfd_archive_coff_construct_extended_name_table): Declare.
	* bfd-in2.h: Rebuild.
	* libbfd.h: Rebuild.
	* som.c (som_construct_extended_name_table): New static function.
	* aout-target.h (MY_construct_extended_name_table): Define.
	* coff-rs6000.c (rs6000coff_construct_extended_name_table):
	Define.
	* ieee.c (ieee_construct_extended_name_table): Define.
	* libecoff.h (_bfd_ecoff_construct_extended_name_table): Define.
	* oasys.c (oasys_construct_extended_name_table): Define.
1994-10-21 23:43:29 +00:00
Ian Lance Taylor 12662be4fe Fix the ELF linker to not require an interpreter if no dynamic
objects were seen, even when linking PIC code.
	* libelf.h (ELF_LINK_HASH_NEEDS_PLT): Define.
	(struct elf_link_hash_table): Add field dynamic_sections_created.
	* elfcode.h (elf_link_record_dynamic_symbol): Create dynstr if it
	doesn't already exist.
	(elf_link_add_object_symbols): Create dynamic sections based on
	dynamic_sections_created field, not dynobj field.  Don't bother to
	set dynobj.
	(elf_link_create_dynamic_sections): If dynamic sections were
	already created, don't do anything.  If dynobj is already set, use
	it; otherwise, set it to the bfd argument.  Don't initialize
	dynsymcount.  Only create dynstr if it does not exist.  Set
	dynamic_sections_created to true.
	(NAME(bfd_elf,size_dynamic_sections)): Skip most of this function
	if no dynamic objects were seen.
	(elf_adjust_dynamic_symbol): If a symbol has the
	ELF_LINK_HASH_NEEDS_PLT flag set, let the backend adjust it.
	(elf_bfd_final_link): Change most decisions based on dynobj to
	check dynamic_sections_created instead.
	(elf_link_output_extsym): Only handle dynamic symbols if a dynamic
	object was seen.
	* elf.c (_bfd_elf_link_hash_table_init): Initialize new field
	dynamic_sections_created.  Set dynsymcount to 1, not 0.
	* elf32-i386.c (elf_i386_create_dynamic_sections): Call
	elf_i386_create_got_section rather than creating the .got and
	.got.plt sections.
	(elf_i386_create_got_section): New static function.
	(elf_i386_check_relocs): Just call elf_i386_create_got_section if
	a GOT table is needed, not bfd_elf32_link_create_dynamic_sections.
	Only create the .rel.got section, and only make space for a reloc,
	for a global symbol or when generating a shared object.  For a
	R_386_PLT32 reloc, just set the	ELF_LINK_HASH_NEEDS_PLT flag.
	(elf_i386_adjust_dynamic_symbol): Rework initial assertion to
	permit ELF_LINK_HASH_NEEDS_PLT non dynamic symbols.  Create a
	procedure linkage table entry for such symbols.  But, if no
	dynamic objects were seen, never create a PLT entry.
	(elf_i386_size_dynamic_sections): If no dynamic objects were seen,
	skip most of this function, and force the size of the .rel.got
	section to zero.
	(elf_i386_relocate_section): For a R_386_GOT32 reloc against a global
	symbol when no dynamic object was seen, initialize the contents of
	the .got section.  For a R_386_GOT32 against a local symbol, only
	create a R_386_RELATIVE reloc when generating a shared object.
	Treat a R_386_PLT32 reloc against a symbol for which we did not
	create a PLT entry as a R_386_PC32 reloc.
	(elf_i386_finish_dynamic_sections): Only fiddle with the dynamic
	entries and the PLT if we saw a dynamic object.
	* elf32-sparc.c (elf_sparc_howto_table): Fix R_SPARC_PC22 by
	setting rightshift to 10.  Fix R_SPARC_WPLT20 by setting
	rightshift to 2, size to 2, bitsize to 30, and dst_mask to
	0x3fffffff.
	(elf32_sparc_create_dynamic_sections): Don't set the size of the
	.plt section.  Call elf32_sparc_create_got_section rather than
	creating the .got section.
	(elf32_sparc_check_relocs): Call elf32_sparc_create_got_section if
	a GOT table is needed, not bfd_elf32_link_create_dynamic_sections.
	Only create the .rela.got section, and only make space for a
	reloc, for a global symbol or when generating a shared object.
	Set the alignment of the .rela.got section to 2.  For a
	R_SPARC_WPLT30 reloc, just set the ELF_LINK_HASH_NEEDS_PLT flag.
	(elf32_sparc_adjust_dynamic_symbol): Rework initial assertion to
	permit ELF_LINK_HASH_NEDS_PLT non dynamic symbols.  Create a
	procedure linkage table for such symbols.  But, if no dynamic
	objects were seen, never create a PLT entry.  Initialize the size
	of the .plt section.
	(elf32_sparc_size_dynamic_sections): If no dynamic objects were
	seen, skip most of this function, and force the size of the
	.rela.got section to zero.  Strip empty reloc sections, and strip
	an empty .plt section.
	(elf32_sparc_relocate_section): For a GOT reloc against a global
	symbol when no dynamic object was seen, initialize the contents of
	the .got section.  For a GOT reloc against a local symbol, only
	create a R_SPARC_RELATIVE reloc when generating a shared object.
	Treat a R_SPARC_WPLT30 reloc against a symbol for which we did not
	create a PLT entry as a R_SPARC_WDISP30 reloc.
	(elf32_sparc_finish_dynamic_sections): Only fiddle with the
	dynamic entries and the PLT if we saw a dynamic object.
1994-10-21 22:00:18 +00:00
Ian Lance Taylor e4a4da62ab * elfcode.h (elf_map_symbols): Don't worry about section symbols
in a section not owned by any BFD.
	(elf_section_from_bfd_section): Separate out loop which calls
	backend routine.  Check bfd_section and call the backend routine
	even for a section not owned by any BFD.
	* elf32-mips.c (mips_elf_section_from_bfd_section): Handle
	.acommon section.
1994-10-20 17:32:33 +00:00
Jim Kingdon dab0844122 * coffgen.c (coff_print_symbol): Make names for section number and
storage class slightly more verbose.  It's not clear how many
	characters I can justify using up, but before this change they
	both were abbreviated "sc" which is (IMHO) clearly unacceptable.
1994-10-19 20:49:03 +00:00
Ian Lance Taylor 8b65c39307 * binary.c (binary_set_section_contents): Set the base file
position from the lowest section VMA, not the start address.
1994-10-19 18:08:42 +00:00
Ian Lance Taylor 7494246592 * aoutx.h (NAME(aout,slurp_symbol_table)): Don't return an error
if there are no symbols.
	* coffgen.c (coff_get_normalized_symtab): Likewise.
	* hp300hpux.c (MY(slurp_symbol_table)): Likewise.
1994-10-19 05:30:15 +00:00
Ian Lance Taylor c768bd3f2d * binary.c: New file for raw binary output format.
* Makefile.in (BFD_LIBS): Add binary.o.
	(CFILES): Add binary.c.
	* targets.c (binary_vec): Declare.
	(bfd_target_vector): Include binary_vec.
1994-10-18 18:51:01 +00:00
Ian Lance Taylor d4d166835f * srec.c (tdata_type): Add field tail.
(srec_mkobject): Initialize tail.
	(srec_set_section_contents): Sort S record list by address.
1994-10-18 16:58:24 +00:00
Ian Lance Taylor b7881f82ee * oasys.c (oasys_slurp_symbol_table): Use udata.p rather than just
udata.
1994-10-17 23:59:36 +00:00
Ian Lance Taylor eb4267a3f9 Use a hash table when writing out ELF symbol names.
* elfcode.h (elf_stringtab_init): New static function.
	(bfd_new_strtab, bfd_add_to_strtab, bfd_add_2_to_strtab): Remove.
	Change all callers to use elf_stringtab_init or
	_bfd_stringtab_add, and get stringtab lengths using
	_bfd_stringtab_size.
	(elf_fake_sections): Change ignored argument to pointer to
	boolean, and set the boolean to true if an error occurs.  If an
	error has already occurred, don't do anything.
	(assign_section_numbers): Just set sh_size, not contents.
	(elf_compute_section_file_positions): Pass the address of a
	boolean to elf_fake_sections.  Pass the address of a
	bfd_strtab_hash to swap_out_syms.  Write out the .strtab section.
	(prep_headers): Change shstrtab to bfd_strtab_hash.
	(swap_out_syms): Take a pointer to a bfd_strtab_hash as an
	argument.  Set it to the symbol names.
	(NAME(bfd_elf,write_object_contents)): Write out the section
	header names using _bfd_stringtab_emit.
	(elf_debug_section): Remove first argument; get the section name
	via the bfd_section pointer.  Change caller.
	(elf_bfd_final_link): Write out the symbol names using
	_bfd_stringtab_emit.  Likewise for the .dynstr section contents.
	Free the symbol names at the end of the function.
	(elf_link_input_bfd): Remove the last argument, output_names,
	from relocate_section.  Save the old symbol contents before
	calling elf_link_output_sym, and restore them afterward.
	* libelf.h (struct elf_link_hash_table): Change dynstr field to
	struct bfd_strtab_hash.
	(struct elf_backend_data): Remove last argument, output_names,
	from elf_backend_relocate_section field.
	(struct strtab): Don't define.
	(struct elf_obj_tdata): Change strtab_ptr field to struct
	bfd_strtab_hash.
	* elf32-hppa.c (elf32_hppa_relocate_section): Remove last
	argument, output_names.
	* elf32-i386.c (elf_i386_relocate_section): Likewise.
	* elf32-mips.c (mips_elf_relocate_section): Likewise.
	* elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
1994-10-17 22:03:14 +00:00
Jim Kingdon a3377a658c Fix thinko in ian's ChangeLog entry 1994-10-17 21:41:20 +00:00
Ian Lance Taylor cb066aa98a * libbfd-in.h (DEFAULT_STRING_SPACE_SIZE): Don't define.
(bfd_add_to_string_table): Don't declare.
	* libbfd.h: Rebuild.
	* libbfd.c (bfd_add_to_string_table): Remove.
1994-10-17 19:31:23 +00:00
Ian Lance Taylor 24f13b0331 * elfcode.h (elf_swap_shdr_in): Use rawdata, not bfd_section.
Clear contents field.
	(bfd_section_from_shdr): In SHT_STRTAB case, check bfd_section,
	not rawdata.  Don't set rawdata if e_shstrndx.  Use bfd_section
	rather than rawdata in commented out code.  In SHT_REL[A] case,
	don't bother to check elf_section_data of section returned by
	section_from_elf_index.
	(elf_fake_sections): Set bfd_section, not rawdata.  Don't set
	size.
	(elf_map_symbols): Don't set elf_num_section_syms.  Don't create
	section symbols that already exist.
	(assign_file_position_for_section): Use bfd_section, not rawdata.
	(section_from_elf_index): Just check bfd_section field.
	(elf_section_from_bfd_section): Likewise.
	(elf_debug_section): Don't print rawdata, contents, or size.
	(elf_link_add_object_symbols): Don't error out if
	section_from_elf_index returns NULL.
	(elf_bfd_final_link): Check return value from
	section_from_elf_index against NULL, not bfd_is_abs_section.
	(elf_link_input_bfd): Don't check section_from_elf_index return
	value.
	* libelf.h (struct elf_obj_tdata): Remove num_section_syms field.
	(elf_num_section_syms): Don't define.
	* elf.c (elf_get_str_section): Store section contents in contents
	field rather than rawdata field.
	(elf_string_from_elf_section): Likewise.
	(_bfd_elf_make_section_from_shdr): Store BFD section pointer in
	bfd_section field rather than rawdata field.
	* elf32-hppa.c (elf32_hppa_read_symext_info): Use bfd_section
	rather than rawdata.
	(elf32_hppa_size_stubs): Likewise.
	* elf32-mips.c (mips_elf_final_write_processing): Use bfd_section
	rathern than rawdata.
	(mips_elf_section_from_shdr): Likewise.
	(mips_elf_section_processing): Likewise.
	(mips_elf_section_from_bfd_section): Remove rawdata check.
1994-10-17 18:27:40 +00:00
Ian Lance Taylor 5e643795a3 * srec.c (pass_over): Set the start address for S7, S8 or S9. 1994-10-17 15:39:37 +00:00
Ken Raeburn f10abb42eb update to version 2.5 1994-10-14 23:17:15 +00:00
Ian Lance Taylor 61c94e5e64 * bfd.c (bfd_scan_vma): Cast end to be non const before passing it
to strtoul.
1994-10-14 15:09:07 +00:00
Ian Lance Taylor 82735983df * bfd.c (bfd_scan_vma): Pass end argument on to strtoul. 1994-10-13 18:41:39 +00:00
Ian Lance Taylor 7b18561f3b * ecoff.c (ecoff_set_symbol_info): Mark local stProc or stLabel
symbols as BSF_DEBUGGING.
PR 5769.
1994-10-12 21:51:04 +00:00
Ken Raeburn ef4b8f6687 * opncls.c (bfd_realloc): Deleted, since it's broken and fixing it would make
it slow.  Besides, it isn't used much.
* elfcode.h (elf_map_symbols): Always allocate new storage for the symbol table.
1994-10-12 21:39:54 +00:00
Ian Lance Taylor 17d9e20376 * rs6000-core.c (rs6000coff_core_file_matches_executable_p): Make
str1 and str2 const pointers.
1994-10-12 16:19:33 +00:00
Ian Lance Taylor bf42caf32c * Makefile.in (INSTALL): Use top level install.sh script.
* config/README (INSTALL): Remove.
	* config/delta88.mh (INSTALL): Remove.
	* config/i386v4.mh (INSTALL): Remove.
	* config/irix4.mh (INSTALL): Remove.
	* config/irix5.mh (INSTALL): Remove.
	* config/ncrt3000.mh (INSTALL): Remove.
1994-10-12 15:57:28 +00:00
Ian Lance Taylor b2bcf39ca2 Tue Oct 11 13:57:56 1994 Eric Youngdale (eric@andante.aib.com)
* elf32-i386.c (elf_i386_check_relocs): Make sure that a symbol
	with a global offset table entry or a procedure linkage table
	entry is added to the dynamic symbol table.
	* elf32-sparc.c (elf32_sparc_check_relocs): Likewise.
	* elf32-i386.c (elf_i386_adjust_dynamic_symbol): If a symbol has
	already gotten a procedure linkage table entry, change the
	definition to the PLT entry.
	* elf32-sparc.c (elf32_sparc_adjust_dynamic_symbol): Likewise.
1994-10-11 21:40:54 +00:00
Ian Lance Taylor 9a406d86e9 * lynx-core.c (lynx_core_file_p): SPARC Lynx appears to start
dumping the .data section in a core file at a page boundary.
1994-10-11 21:13:45 +00:00
Ken Raeburn 4c0322704f * cofflink.c (_bfd_coff_final_link): Cast argument to bfd_h_put_32 to correct
type.
(coff_read_string_table): Cast argument to bfd_h_get_32 to correct type.
* elfcode.h (elf_link_output_extsym): Cast argument to bfd_elf_hash to correct
type.
1994-10-10 20:38:06 +00:00
Ken Raeburn 4fbc96adc8 * elf32-sparc.c (elf_sparc_howto_table): The PC10, PC22, and WPLT30 relocations
are PC-relative.
1994-10-10 20:30:32 +00:00
Ian Lance Taylor 66e4e64904 * archive.c (bfd_construct_extended_name_table): SVR4 uses slash
newline at the end of the file name, not just newline.
1994-10-05 18:43:30 +00:00
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 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
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
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