Commit Graph

2499 Commits

Author SHA1 Message Date
Ian Lance Taylor 28a0c10399 * xcofflink.c: Extensive changes to support linking shared objects
and generating a .loader section.
	* libcoff-in.h (struct xcoff_tdata): Add import_file_id field.
	(struct xcoff_section_tdata): Add first_symndx, last_symndx,
	and ldrel_count fields.
	* libcoff.h: Rebuild.
	* coff-rs6000.c (xcoff_howto_table): Correct reloc names.
	* coffcode.h (styp_to_sec_flags): Don't set any flags if STYP_PAD
	is set.
	* bfd-in.h (bfd_xcoff_import_symbol): Declare.
	(bfd_xcoff_export_symbol): Declare.
	(bfd_xcoff_size_dynamic_sections): Declare.
	* bfd-in2.h: Rebuild.
1995-10-25 15:37:47 +00:00
Stan Shebs aadf04f736 * configure.in: Add xcofflink.o to pmac_xcoff_vec.
* configure: Rebuild.
	* mpw-config.in: Add xcofflink.c.o to powerpc-apple-macos.
	* coff-pmac.c: Include coff-rs6000.c instead of duplicating its
	contents.
	(pmac_xcoff_vec): Update to use new xcoff support.
	* coff-rs6000.c (xcoff_generic_stat_arch_elt): Make static.
	(xcoff_write_armap): Declare buf as unsigned char.
	* xcofflink.c (xcoff_link_add_symbols): Declare a local as PTR.

	* mpw-make.sed: Generalize subdir_do edit.
1995-10-25 00:54:55 +00:00
Jeff Law ddf4639bc8 * hppabsd-core.c (make_bfd_asection): Initialize asect->filepos
correctly.  Don't initialize asect->vma.
1995-10-24 16:27:25 +00:00
Ken Raeburn e7bedf65ef * opncls.c (_bfd_new_bfd): If _bfd_chunksize wasn't preset, use something a
little less than the page size.
1995-10-20 17:25:27 +00:00
Steve Chamberlain 3a70e2988d Wed Oct 18 16:20:08 1995 steve chamberlain <sac@slash.cygnus.com>
* coff-i386.c (coff_i386_reloc_type_lookup): New.
	* coffcode.h (coff_write_object_contents): If .bss is before
	.data us that as data_start.
	* cofflink.c (_bfd_coff_generic_relocate_section): Get reloc
	calc correct.
	* peicode.h (add_data_entry): Use _cooked_size of data directory.
	(coff_swap_outhdr_out): Hardwire in version number.
1995-10-18 23:26:12 +00:00
Ken Raeburn 3c3a526818 * sunos.c (sunos_add_dynamic_symbols): Rename local variables major and minor
to *_vno, since the former are also macros in SunOS header files.  Cast result
of bfd_alloc to appropriate type.
1995-10-18 21:32:53 +00:00
Ken Raeburn 5a2846e3dd * coffgen.c (coff_find_nearest_line): Cast used_by_bfd value before assigning
to sec_data.
1995-10-18 20:53:24 +00:00
Ian Lance Taylor 0f6c885ef0 * ecoff.c (_bfd_ecoff_find_nearest_line): The offset argument is
now relative to the section, not absolute.
	* ecofflink.c (_bfd_ecoff_locate_line): Use the right symbol to
	get the file name when there is a N_SO directory name.  When
	handling stabs, remember that section->vma was added to the
	offset.
PR 8223.
1995-10-18 17:29:38 +00:00
Ian Lance Taylor 11fa66365b * sunos.c (struct sunos_link_hash_table): Add needed field.
(sunos_link_hash_table_create): Call bfd_release, not free.
	(sunos_link_hash_table_create): Initialize needed field.
	(sunos_add_dynamic_symbols): Record needed objects.
	(bfd_sunos_get_needed_list): New function.
	* bfd-in.h (bfd_sunos_get_needed_list): Declare.
	* bfd-in2.h: Rebuild.
1995-10-17 22:30:42 +00:00
Ian Lance Taylor 54406786f0 * bfd-in.h (struct bfd_link_needed_list): Rename from
bfd_elf_link_needed_list.
	* bfd-in2.h: Rebuild.
	* elf.c, elflink.h, libelf.h: Corresponding changes.
1995-10-16 23:10:56 +00:00
Ian Lance Taylor dd98464413 Add start at AIX linker support; no shared libraries yet.
* xcofflink.c: New file.
	* configure.in (rs600coff_vec): Use xcofflink.o.
	* configure: Rebuild.
	* libcoff-in.h (struct xcoff_tdata): Add csects and debug_indices
	fields.
	(struct xcoff_section_tdata): Define.
	(xcoff_section_data): Define macro.
	(_bfd_xcoff_bfd_link_hash_table_create): Declare.
	(_bfd_xcoff_bfd_link_add_symbols): Declare.
	(_bfd_xcoff_bfd_final_link): Declare.
	(_bfd_ppc_xcoff_relocate_section): Declare.
	* libcoff.h: Rebuild.
	* coff-rs6000.c: Clean up a bit.
	(xcoff_mkobject): Default modtype to 1L, not RE.  Initialize
	cputype, csects, and debug_indices.
	(xcoff_copy_private_bfd_data): Copy cputype.
	(xcoff_howto_table): Rename from rs6000coff_howto_table.
	(xcoff_rtype2howto): Rename from rs6000coff_rtype2howto.
	(xcoff_reloc_type_lookup): Rename from
	rs6000coff_reloc_type_lookup.
	(coff_relocate_section): Define.
	(_bfd_xcoff_sizeof_headers): Define.
	(_bfd_xcoff_bfd_get_relocated_section_contents): Define.
	(_bfd_xcoff_bfd_relax_section): Define.
	(_bfd_xcoff_bfd_link_split_section): Define.
	(rs6000coff_vec): For BFD_JUMP_TABLE_LINK, use _bfd_xcoff, not
	coff.
	* coffcode.h (coff_compute_section_file_positions): If AIX,
	increment sofar by SMALL_AOUTSZ if not executable.
	(coff_write_object_contents): If AIX, always output an a.out
	header; if not executable, header size of SMALL_AOUTSZ.
	* hash.c (struct bfd_strtab_hash): Add xcoff field.
	(_bfd_stringtab_init): Initialize xcoff field.
	(_bfd_xcoff_stringtab_init): New function.
	(_bfd_stringtab_add): In XCOFF mode, leave two bytes for length.
	(_bfd_stringtab_emit): In XCOFF mode, write out length.
	* libbfd-in.h (_bfd_xcoff_stringtab_init): Declare.
	* libbfd.h: Rebuild.
	* Makefile.in: Rebuild dependencies.
	(BFD32_BACKENDS): Add xcofflink.o.
	(CFILES): Add xcofflink.c.
ld -r works on hello, world.
1995-10-16 21:54:48 +00:00
Steve Chamberlain c974e19ef4 * libcoff-in.h (pe_data_type.in_reloc_p): New. 1995-10-16 21:46:48 +00:00
Ian Lance Taylor 22a35f0b05 * elf32-mips.c (mips_elf_symbol_processing): Set SEC_ALLOC, not
SEC_NO_FLAGS, for .acommon section.  From Peter Schauer
	<Peter.Schauer@Regent.E-Technik.TU-Muenchen.DE>.
1995-10-16 14:54:17 +00:00
Michael Meissner fb417a2138 Add in_reloc_p, cloned from coff-i386.c 1995-10-15 01:37:23 +00:00
Ken Raeburn 106773f836 Use system page size for obstack chunk size instead of 128, permitting override
by application.

Include missing patch from Andreas Schwab's changes.

Fix up minor configuration problems.
1995-10-13 22:03:11 +00:00
Steve Chamberlain b1e463692c Fri Oct 13 11:22:01 1995 steve chamberlain <sac@slash.cygnus.com>
* coff-arm.c (in_reloc_p): New.
	* coff-i386.c (in_reloc_p): New.
	* coffcode.h: Allways include peicode.h if COFF_WITH_PE.
	(coff_write_object_contents): Only set has_reloc_section
	if PE_IMAGE.
	* cofflink.c (_bfd_coff_generic_relocate_section): Call
	in_reloc_p to decide if reloc should be emitted.
	* libcoff.h (pe_data_type.in_reloc_p): New.
	* peicode.h (pe_mkobject): Initialize in_reloc_p.
1995-10-13 18:28:31 +00:00
Ian Lance Taylor ee9f09cd26 * elflink.h (elf_link_add_object_symbols): Correct conditions
under which type and size change warnings are issued.
1995-10-11 04:50:20 +00:00
Ian Lance Taylor 78b31b6bb8 x 1995-10-10 22:51:22 +00:00
Ian Lance Taylor d7731c7d2c * coffgen.c (coff_count_linenumbers): Don't count line numbers for
a symbol which is not in a real section.
	(coff_write_native_symbol): Corresponding change.
1995-10-10 22:49:38 +00:00
Ian Lance Taylor 5c6725cf59 * cofflink.c (_bfd_coff_link_hash_newfunc): Rename from
coff_link_hash_newfunc and make non-static.
	(_bfd_coff_link_hash_table_init): New function, broken out of
	_bfd_coff_link_hash_table_create.
	(_bfd_coff_link_hash_table_create): Use it.
	(process_embedded_commands): Make static.
	* libcoff-in.h ((_bfd_coff_link_hash_newfunc): Declare.
	(_bfd_coff_link_hash_table_init): Declare.

	* libcoff-in.h (struct xcoff_tdata): Add cputype field.
	* libcoff.h: Rebuild.
1995-10-10 22:47:49 +00:00
Fred Fish 9dd7e56f74 * Makefile.in (FLAGS_TO_PASS): Remote BISON. 1995-10-10 19:23:54 +00:00
Ian Lance Taylor 8235c11240 * elflink.h (elf_link_add_object_symbols): Don't warn about
changing the size or type if the old definition was weak.
1995-10-10 05:30:17 +00:00
Ian Lance Taylor 49488f2b2d * coffcode.h (combined_entry_type): Add fix_line field.
(coff_slurp_line_table): Warn if we try to set the lineno field of
	a symbol twice.
	(coff_slurp_symbol_table): If RS6000COFF_C, handle C_BINCL and
	C_EINCL by setting fix_line.  Fix C_BSTAT symbol value.
	* coffgen.c (coff_mangle_symbols): Handle fix_line.
	(coff_write_symbol): Only use N_DEBUG if the symbol is in the
	absolute section.
	(coff_print_symbol): Print fix_value symbols in a useful fashion.
	* libcoff.h: Rebuild.
1995-10-09 23:32:22 +00:00
Ian Lance Taylor 5f710a3a89 * libcoff-in.h (struct xcoff_tdata): Define.
(xcoff_data): Define.
	* bfd.c (struct _bfd): Add xcoff_obj_data field to tdata union.
	* bfd-in2.h, libcoff.h: Rebuild.
	* coff-rs6000.c (xcoff_mkobject): New static function.
	(coff_mkobject): Define.
	(xcoff_copy_private_bfd_data): New static function.
	(coff_bfd_copy_private_bfd_data): Define.
	(rs6000coff_howto_table): Change R_TOC complain_on_overflow from
	signed to bitfield.
	(rs6000coff_vec): Add DYNAMIC to object_flags.
	* coffcode.h (sec_to_styp_flags): If RS6000COFF_C, handle .pad and
	.loader sections specially.
	(coff_new_section_hook): If RS6000COFF_C, get the .text and .data
	section alignment from the XCOFF tdata information.
	(coff_mkobject_hook): If RS6000COFF_C, set DYNAMIC based on
	F_SHROBJ, and copy the extra a.out header information into the
	XCOFF tdata structure.
	(coff_write_object_contents): If RS6000COFF_C, set F_SHROBJ,
	F_DYNLOAD and the extra a.out header information.
	(coff_slurp_symbol_table): Set BSF_NOT_AT_END for a C_EXT or
	C_HIDEXT symbol with attached csect information.
	* coffswap.h (coff_swap_aouthdr_in): If RS6000COFF_C, swap
	in the o_maxdata field.
	(coff_swap_aouthdr_out): If RS6000COFF_C, swap extra XCOFF fields.
	* coffgen.c (coff_renumber_symbols): Don't move any symbol to the
	end if BSF_NOT_AT_END is set.
1995-10-09 21:19:53 +00:00
Ian Lance Taylor 3f2c5b2d2f * coffcode.h (coff_slurp_symbol_table): Set BSF_NOT_AT_END for an
XCOFF XTY_LD symbol.
1995-10-09 15:40:38 +00:00
Ian Lance Taylor 0322af0d62 * targets.c (bfd_target): Rename _bfd_read_ar_hdr field to
_bfd_read_ar_hdr_fn.
	* libbfd-in.h (_bfd_read_ar_hdr): Update accordingly.
	* bfd-in2.h, libbfd.h: Rebuild.
	* archive.c (_bfd_get_elt_at_filepos): Cast _bfd_read_ar_hdr
	return value.
	(do_slurp_bsd_armap, do_slurp_coff_armap): Likewise.
	(bfd_slurp_bsd_armap_f2): Likewise.
	(_bfd_slurp_extended_name_table): Likewise.
1995-10-09 15:29:04 +00:00
Ian Lance Taylor 4372f33ffb * coffgen.c (coff_fix_symbol_name): Don't try to set up file
auxent if there isn't one.
	(coff_write_symbols): If there is no file auxent, use SYMNMLEN
	rather than FILNMLEN as the maximum name length.
1995-10-06 22:35:01 +00:00
Ken Raeburn 3266eaffb7 Mon Sep 25 22:49:32 1995 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* archive.c (bfd_get_next_mapent): Return BFD_NO_MORE_SYMBOLS when the symbol
table is empty.

* elf32-m68k.c (elf_m68k_size_dynamic_sections): Don't reserve space for
section symbols, since we don't output them either.
(elf_m68k_adjust_dynindx): Removed.

* ptrace-core.c (rawptr): Make it a local variable of ptrace_unix_core_file_p.
* trad-core.c (rawptr): Likewise, for trad_unix_core_file_p.
1995-10-06 21:30:51 +00:00
Ian Lance Taylor 0fc9ada91e * coffcode.h (bfd_coff_backend_data): Add new field
_bfd_coff_print_aux.
	(bfd_coff_print_aux): New static function.
	(coff_pointerize_aux_hook (RS6000COFF_C version)): Pointerize the
	scnlen field of an XTY_LD csect aux entry.
	(coff_print_aux): New static function.
	(coff_slurp_symbol_table): Don't pointerize scnlen field; now done
	in coff_pointerize_aux_hook.
	(bfd_coff_std_swap_table): Initialize new field.
	* coffgen.c (coff_print_symbol): Call bfd_coff_print_aux.
	* libcoff.h: Rebuild.
	* coff-alpha.c (alpha_ecoff_backend_data): Initialize new field.
	* coff-mips.c (mips_ecoff_backend_data): Likewise.
1995-10-06 20:36:26 +00:00
Ian Lance Taylor 7860fe3846 * coffcode.h (coff_write_object_contents): On AIX, clear F_RELFLG
if there are symbols, for native AIX ld compatibility.
1995-10-06 19:49:48 +00:00
Ian Lance Taylor c80cc8332c * coffcode.h (bfd_coff_backend_data): Add new field
_bfd_coff_pointerize_aux_hook.
	(coff_pointerize_aux_hook): Define as a function if RS6000COFF_C
	or I960, and as 0 otherwise.
	(bfd_coff_std_swap_table): Initialize new field.
	* libcoff.h: Rebuild.
	* coffgen.c (coff_pointerize_aux): Change parameters  to take
	symbol pointer instead of type and class, and to take aux index.
	Call _bfd_coff_pointerize_aux_hook if it is defined.
	(coff_get_normalized_symtab): Always call coff_pointerize_aux.
	* coff-alpha.c (alpha_ecoff_backend_data): Initialize all fields.
	* coff-mips.c (mips_ecoff_backend_data): Likewise.
1995-10-06 19:19:48 +00:00
Ian Lance Taylor d11e6b5276 * coffcode.h (OTHER_GLOBAL_CLASS): Do not define to be C_HIDEXT
if RS6000COFF_C.
1995-10-06 18:00:29 +00:00
Michael Meissner 45b5d2f039 Fix typo in last change 1995-10-06 16:37:31 +00:00
Michael Meissner 249479faf1 Add NT/MAC object file formats to powerpc eabi. 1995-10-06 16:25:45 +00:00
Ian Lance Taylor c53fac125a * targets.c (bfd_target): Add _bfd_read_ar_hdr field. Modify
BFD_JUMP_TABLE_ARCHIVE accordingly.
	* libbfd-in.h (_bfd_snarf_ar_hdr): Don't declare.
	(_bfd_compute_and_write_armap): Declare.
	(_bfd_generic_read_ar_hdr): Declare.
	(_bfd_read_ar_hdr): Define.
	(_bfd_noarchive_read_ar_hdr): Define.
	(_bfd_archive_bsd_read_ar_hdr): Define.
	(_bfd_archive_coff_read_ar_hdr): Define.
	* archive.c: Change all callers of _bfd_snarf_ar_hdr to call
	_bfd_read_ar_hdr instead.
	(_bfd_generic_read_ar_hdr): Rename from _bfd_snarf_ar_hdr.
	(_bfd_compute_and_write_armap): Rename from
	compute_and_write_armap.  Make non-static.  Change all callers.
	* ecoff.c (_bfd_ecoff_slurp_armap): Call _bfd_read_ar_hdr rather
	than _bfd_snarf_ar_hdr.
	* aout-target.h (MY_read_ar_hdr): Define if not defined.
	* ieee.c (ieee_read_ar_hdr): Define.
	* libecoff.h (_bfd_ecoff_read_ar_hdr): Define.
	* oasys.c (oasys_read_ar_hdr): Define.
	* som.c (som_read_ar_hdr): Define.
	* bfd-in2.h, libbfd.h: Rebuild.
1995-10-06 16:15:35 +00:00
Ian Lance Taylor bb2deaf25f * coff-rs6000.c: Add full support for AIX archives. Rewrite old
read-only/host-only support.
1995-10-06 16:12:59 +00:00
Ian Lance Taylor e7cac9dea9 * coffcode.h (coff_slurp_symbol_table): Set C_HIDEXT symbols to be
BSF_LOCAL.
1995-10-06 16:09:24 +00:00
Steve Chamberlain f8e47484d9 * peicode.c (coff_swap_filehdr_in): If symptr is
zero, there aren't any symbols, even if nsyms is set.
1995-10-05 21:07:24 +00:00
Ian Lance Taylor aca736871c * libecoff.h (struct ecoff_backend_data): Add adjust_headers
field.
	* ecoff.c (ecoff_sec_to_styp_flags): Check for various Alpha
	sections, and set styp correctly for them: .got, .hash, .dynamic,
	.liblist, .rel.dyn, .conflic, .dynstr, .dynsym, .comment.
	(_bfd_ecoff_styp_to_sec_flags): Check for various Alpha section
	types.
	(ecoff_sort_hdrs): New static function.
	(ecoff_compute_section_file_positions): Return boolean, not void.
	Sort the sections by VMA before looking through them.  Put the
	first non SEC_ALLOC section on a new page.  Put every SEC_ALLOC
	section on an appropriate boundary within the page.
	(ecoff_compute_reloc_file_positions): Check return value of
	ecoff_compute_section_file_positions.
	(_bfd_ecoff_set_section_contents): Likewise.
	(_bfd_ecoff_write_object_contents): Check for various Alpha
	section types when incrementing text_size and data_size.  Call
	adjust_headers backend function if it exists.
	* coff-alpha.c (alpha_adjust_headers): New static function.
	(alpha_ecoff_backend_data): Initialize adjust_headers field.
	* coff-mips.c (mips_ecoff_backend_data): Likewise.
PR 8141.
1995-10-05 17:48:32 +00:00
Ian Lance Taylor 2b874a2df4 * hosts/i386bsd.h: Restore file incorrectly deleted on Sep 6. 1995-10-05 15:46:40 +00:00
Jeff Law c780e5dbaf * rs6000-core.c (CORE_VERSION_1): Use CORE_VERSION_1 instead
of ALTERNATE_AIX_CORE_FORMAT.
	* configure.in (aix4): No longer need CORE_FLAGS.
	* configure: Updated.
1995-10-05 00:21:25 +00:00
Ken Raeburn 2a01c351e3 NS32k changes from Ian Dall:
* aoutx.h (MY_final_link_relocate, MY_relocate_contents): New macros.
(aout_link_input_section_std, aout_link_input_section_ext,
aout_link_reloc_link_order): Call them instead of _bfd_* versions.
* aout-target.h (MY_exec_header_not_counted): New macro, defaults to zero.
(backend_data): Use it instead of hardcoded zero.

* aout-ns32k.c (CTOR_TABLE_RELOC_HOWTO): New macro.
(MY_swap_std_reloc_out): Use udata.i for KEEPIT, don't call stoi.

* ns32knetbsd.c: Include bfd.h.
(MY_text_includes_header, MY_bfd_reloc_type_lookup): New macros.
(MY_bfd_reloc_type_lookup): Declare function too.
* pc532-mach.c (set_sizes): Don't declare.
(MY_text_includes_header, MY_exec_header_not_counted): Define.
(backend_data, MY_backend_data): Don't define.

* config.bfd: Treat ns32k-pc532-ux* like ns32k-pc532-mach*, and ns32k-*-lites*
like ns32k-*-netbsd*.

* hosts/nbsd.h: Swap order of sys/vmparam.h and sys/param.h, to compile on
lites.
1995-10-04 20:25:21 +00:00
Ken Raeburn 7f56bc26e4 * chew.c: Include <stdio.h>. 1995-10-04 19:52:10 +00:00
Ian Lance Taylor 5944d75b46 * coffcode.h (coff_write_object_contents): Restore setting
f_timdat to 0, deleted on August 22.
1995-10-04 18:20:08 +00:00
Steve Chamberlain db344f829d Tue Oct 3 16:28:32 1995 steve chamberlain <sac@slash.cygnus.com>
* coffcode.h (coff_bfd_copy_private_symbol_data,
	coff_bfd_copy_private_section_data,
	coff_bfd_copy_private_bfd_data): ifdef to allow overrides.
	* peicode.h (coff_bfd_copy_private_bfd_data): New
	(pe_bfd_copy_private_bfd_data): New.
	(coff_swap_scnhdr_in): Swap bss size into the right place.
	(pe_print_private_bfd_data): Add some newlines.
1995-10-03 23:44:34 +00:00
Jeff Law 704257cb1b Remove last (incorrect) change. 1995-10-03 19:26:36 +00:00
Jeff Law 97f1feda83 * som.c (setup_sections): Don't die if a space has no subspaces. 1995-10-03 18:48:38 +00:00
Jeff Law 3ad9d625eb Opps. Forgot to commit this with the elf.c changes... 1995-10-03 18:21:17 +00:00
Jeff Law 8cd2f4fe43 * elf.c (_bfd_elf_assign_file_position_for_section): Always
align to the section's alignment.  "align" argument removed;
	all callers changed.
Loosely based on a patch from dupuy@smarts.com; keeps dbx from losing
when debugging programs that have been objcopy'd.
1995-10-03 17:57:17 +00:00
Ian Lance Taylor 3d7c42c988 * elflink.h (elf_link_add_object_symbols): Don't let a weak
dynamic symbol override a common symbol.  Don't change the size or
	type if they have been set and the new symbol is not a definition.
	Warn if the size or type changes.
1995-10-02 18:11:12 +00:00