but with an added LITERALSLEAZY entry.
(alpha_adjust_reloc_in): Add handling of LITERALSLEAZY relocs. Use
info on the howto_table gotten from the ecoff_backend data.
(alpha_ecoff_get_relocated_section_contents): Ditto.
(alpha_bfd_reloc_type_lookup): Ditto.
(alpha_relocate_section): Ditto. Also remove an assertion
causing failures on *BSD/alpha systems.
(alpha_ecoff_backend_data): Addition of fields to handle different
howto tables as well as a has_literalseazy flag.
(bsd_alpha_ecoff_backend_data): New backend data structure for *BSD.
(bsd_ecoffalpha_little_vec): Define.
* coff-mips.c (MIPS_HOWTO_COUNT): Removed, it's unused.
(mips_adjust_reloc_in): Use new ecoff_backend data to get at the howto
table.
(mips_bfd_reloc_type_lookup): Ditto.
(mips_relocate_section): Ditto.
(mips_ecoff_backend_data): Addition of fields to handle different
howto tables as well as a has_literalseazy flag.
* config.bfd: (alpha-*-openbsd*): New target.
* configure.in (alpha*-*-openbsd*): New target.
(bsd_ecoffalpha_little_vec): New vector for *BSD/Alpha ECOFF.
* ecoff.c (_bfd_ecoff_set_arch_mach_hook): Handle new magic.
(ecoff_get_magic): Ditto.
* libecoff.h (ecoff_backend_data): Addition of fields to handle
different howto tables as well as a has_literalseazy flag.
* reloc.c: BFD_RELOC_ALPHA_LITERALSLEAZY): New reloc.
* targets.c (bsd_ecoffalpha_little_vec): Declare.
(bfd_target_vector): Include the bsd_ecoffalpha_little_vec target.
* configure, bfd-in2.h, libbfd.h: Rebuild.
(bfd_zmalloc): Return PTR, not char *. Take size_t, not
bfd_size_type.
* libbfd-in.h (bfd_malloc, bfd_realloc): Declare.
(bfd_zmalloc): Change declaration.
* libbfd.h: Rebuild.
* Many files: Use bfd_malloc and bfd_realloc rather than malloc
and realloc. Don't set bfd_error_no_memory if they fail.
obstack_alloc fails.
(bfd_alloc_finish): Set bfd_error_no_memory if obstack_finish
fails.
* libbfd.c (bfd_zmalloc): Set bfd_error_no_memory if malloc fails.
* Many files: don't set bfd_error_no_memory if one of the above
routines fails.
_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.
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.
* 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.
* libecoff.h (struct ecoff_link_hash_entry): Change type of
written from boolean to char. Add new field small.
* ecoff.c (ecoff_link_hash_newfunc): Initialize written to 0
rather than false. Initialize small to 0.
(ecoff_link_add_externals): If ECOFF type is scSUndefined, set
small. If small is set, and hash table type is common, force the
symbol into a section named SCOMMON and change the ECOFF type from
scCommon to scSCommon.
(ecoff_link_write_external): Set written to 1 rather than true.
* coff-mips.c (mips_relocate_section): Correct JMPADDR reloc
overflow check to consider section VMA of input file.
numbering changes in include/coff/mips.h. Add entries for
MIPS_R_RELHI and MIPS_R_RELLO.
(mips_ecoff_swap_reloc_in): Handle an extra bit for the reloc type
when little endian. Treat internal MIPS_R_RELLO or MIPS_R_RELHI
relocs like MIPS_R_SWITCH, and convert r_offset from 24 to 32
bits.
(mips_ecoff_swap_reloc_out): Likewise.
(mips_adjust_reloc_in): Handle internal MIPS_R_RELLO or
MIPS_R_RELHI relocs like MIPS_R_SWITCH.
(mips_adjust_reloc_out): Likewise.
(mips_relhi_addr, mips_relhi_addend): New static variables.
(mips_relhi_reloc, mips_rello_reloc): New functions.
(mips_bfd_reloc_type_lookup): Turn BFD_RELOC_PCREL_HI16_S into
MIPS_R_RELHI and turn BFD_RELOC_PCREL_LO16 into MIPS_R_RELLO.
(mips_relocate_hi): Rename from mips_relocate_refhi, and add pcrel
argument. Changed all callers.
(mips_relocate_section): Rename got_reflo to got_lo and
reflo_int_rel to lo_int_rel. Handle MIPS_R_RELLO and MIPS_R_RELHI
relocs.
(mips_relax_section): Adjust MIPS_R_RELHI/MIPS_R_RELLO pairs when
expanding a PC relative call.
(mips_ecoff_swap_reloc_in): For MIPS_R_SWTICH, copy r_symndx into
r_offset and set r_symndx to RELOC_SECTION_TEXT.
(mips_ecoff_swap_reloc_out): For MIPS_R_SWITCH, get the r_symndx
value from the r_offset field.
(mips_adjust_reloc_in): Maximum r_type value is now MIPS_R_SWITCH.
For MIPS_R_SWITCH, copy the r_offset field into the addend field.
(mips_adjust_reloc_out): For MIPS_R_SWITCH, copy the addend field
into the r_offset field.
(mips_switch_reloc): New function.
(mips_bfd_reloc_type_lookup): Translate BFD_RELOC_GPREL32 into
MIPS_R_SWITCH.
(mips_relocate_section): Handle MIPS_R_SWITCH.
(mips_relax_section): Adjust MIPS_R_SWITCH offset if necessary.
Removed _bfd_debug_info_start, _bfd_debug_info_end and
_bfd_debug_info_accumulate, which were never used.
(BFD_JUMP_TABLE_GENERIC, BFD_JUMP_TABLE_COPY): Defined.
(BFD_JUMP_TABLE_CORE, BFD_JUMP_TABLE_ARCHIVE): Defined.
(BFD_JUMP_TABLE_SYMBOLS, BFD_JUMP_TABLE_RELOCS): Defined.
(BFD_JUMP_TABLE_WRITE, BFD_JUMP_TABLE_LINK): Defined.
* All backends: Changed to use the new BFD_JUMP_TABLE_* macros
rather than the single JUMP_TABLE macro. Removed many of the
weird macro definitions needed to support the monolithic
JUMP_TABLE.
* bfd-in.h (JUMP_TABLE): Removed.
* libbfd-in.h: Define a bunch of macros, and declare a few
functions, for use with the new BFD_JUMP_TABLE_* macros.
* libbfd.c (_bfd_dummy_new_section_hook): Removed.
(bfd_false): Set bfd_error_invalid_operation.
(bfd_nullvoidptr): Likewise.
(bfd_n1): New function.
(_bfd_nocore_core_file_matches_executable_p): Renamed from
_bfd_dummy_core_file_matches_executable_p.
(_bfd_nocore_core_file_failing_command): Similar rename. Set
bfd_error_invalid_operation.
(_bfd_nocore_core_file_failing_signal): Likewise.
(_bfd_generic_get_section_contents): Renamed from
bfd_generic_get_section_contents. Changed all callers.
(_bfd_generic_set_section_contents): Similar rename.
* ieee.c: #if 0 out ieee_bfd_debug_info_start,
ieee_bfd_debug_info_end, ieee_bfd_debug_info_accumulate. They
were never called.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
use a five instruction sequence for funtion calls which are out of
range of the bal instruction.
* libecoff.h (struct ecoff_section_tdata): Define.
(ecoff_section_data): Define.
(ecoff_bfd_relax_section): Don't define.
* ecoff.c (ecoff_final_link_debug_accumulate): Don't read or free
the debugging information if it has already been read.
(ecoff_indirect_link_order): Handle _cooked_size being different
from _raw_size. Don't reread the contents or the relocs if they
have already been read in.
* coff-mips.c (mips_howto_table): Change bitsize of PCREL16 from
18 to 16.
(PCREL16_EXPANSION_ADJUSTMENT): Define.
(mips_relocate_refhi): Take adjust argument.
(mips_relocate_section): Handle reloc offsets stored in section
used_by_bfd field. Call mips_relax_pcrel16 to handle details of
expanding an out of range PCREL16. Keep trace of adjustments
required by expansions. Set s and unset h when converting a reloc
from undefined to section. Change handling of PC relative relocs:
if against a section, they are correct in the object file, if
against an external symbol they are pcrel_offset.
(mips_relax_section): New function.
(mips_relax_pcrel16): New function.
(ecoff_bfd_relax_section): Define.
* coff-alpha.c (ecoff_bfd_relax_section): Define.
* ecofflink.c (bfd_ecoff_debug_accumulate): Handle adjustments
built by mips_relax_section when writing out addresses.
* elf32-mips.c (mips_elf_read_ecoff_info): Clear adjust field.
support -Ur in the linker.
* linker.c (generic_link_add_symbol_list): Remove bitsize argument
from call to _bfd_generic_link_add_one_symbol.
(_bfd_generic_link_add_one_symbol): Remove bitsize argument.
Don't pass bitsize to constructor call back. Pass BFD_RELOC_CTOR
instead of bitsize to add_to_set call back.
(_bfd_generic_final_link): Account for link_order relocs when
allocating space for relocations. Handle them in link_order loop.
(_bfd_generic_reloc_link_order): New function.
(_bfd_default_link_order): If a reloc_link_order is seen here,
abort.
(_bfd_count_link_order_relocs): New function.
* libbfd-in.h (_bfd_generic_link_add_one_symbol): Remove bitsize
argument from declaration.
(_bfd_generic_reloc_link_order): Declare.
(_bfd_count_link_order_relocs): Declare.
* libbfd.h: Rebuilt.
* aoutx.h (aout_link_add_symbols): Remove bitsize argument from
call to _bfd_generic_link_add_one_symbol.
(NAME(aout,final_link)): Account for link_order relocs when
allocating space for relocations. Handle them after handling all
input BFDs.
(aout_link_reloc_link_order): New function.
* ecoff.c (ecoff_link_add_externals): Remove bitsize argument from
call to _bfd_generic_link_add_one_symbol.
(ecoff_bfd_final_link): Account for link_order relocs when
allocating space for relocations. Handle them in link_order loop.
(ecoff_link_write_external): Set the storage class of a defined
linker created symbol based on the section it is in. Correct
bfd_link_hash_weak case to use .sc rather than .st.
(ecoff_reloc_link_order): New function.
* coff-alpha.c (alpha_bfd_reloc_type_lookup): Handle
BFD_RELOC_CTOR.
* coff-mips.c (mips_bfd_reloc_type_lookup): Likewise.
various other related changes.
* libecoff.h (ecoff_backend_data): Added rdata_in_text field.
Renamed finish_reloc to adjust_reloc_in. Added adjust_reloc_out
field.
(ecoff_bfd_get_relocated_section_contents): Don't define.
* ecoff.c (ecoff_sec_to_styp_flags, ecoff_styp_to_sec_flags):
Handle .lita section.
(ecoff_slurp_reloc_table): Handle RELOC_SECTION_FINI.
finish_reloc backend field renamed to adjust_reloc_in.
(ecoff_bfd_seclet_link): Adjust number of aux entries to
debug_align boundary.
(ecoff_compute_section_file_positions): If rdata_in_text put
.rdata section in text segment, not data segment. Put .pdata
section in text segment.
(ecoff_write_object_contents): Likewise. Also, call
adjust_reloc_out, and handle .lita, .xdata, .pdata, .fini and
absolute sections when writing out relocs.
* coffswap.h (coff_swap_aouthdr_out): For ALPHAECOFF, output 2 for
bldrev field, as on Alpha OSF/1. Padding field is now 2 bytes.
* coff-mips.c (mips_ecoff_swap_reloc_out): Added assertion.
(mips_adjust_reloc_in): Renamed from mips_finish_reloc.
(mips_adjust_reloc_out): New function (does nothing).
(mips_ecoff_backend_data): Initialize new fields.
(ecoff_bfd_get_relocation_section_contents): Define to be
bfd_generic_get_relocated_section_contents.
* reloc.c (bfd_perform_relocation): Added casts to avoid Alpha
OSF/1 cc bug.
* bfd-in.h: Added swapping routine declarations, and renamed them
from _do_* to bfd_*.
* libbfd.c: Renamed swapping routines from _do_* to _bfd_*.
* Changed all callers.
* libbfd.h, bfd-in2.h: Rebuilt.
* ecoffswap.h: New file for ECOFF swapping functions which differ
only slightly for different targets.
* libecoff.h: Added prototypes for ecoff.c functions.
(ecoff_backend_data): New structure.
(ecoff_tdata): Added backend_data field. Changed external data
pointers to be PTR rather than to a particular struct.
(ecoff_symbol_struct): Moved in from coff-mips.c.
* coff-alpha.c, coff-mips.c: Moved common functions into ecoff.c.
Added ECOFF backend structures. Include ecoffswap.h.
* coff-msym.c: Removed; superseded by ecoffswap.h.
* bfd.c: Include coff/internal.h.
* Makefile.in (BFD_LIBS): Removed coff-mips.o and coff-msym.o.
Added ecoff.o.
(BFD64_BACKENDS): Added coff-alpha.o.
(CFILES): Removed coff-msym.c. Added ecoff.c.
(bfd.o): Added dependency on $(INCDIR)/coff/sym.h.
(coff-mips.o): Added dependency on ecoffswap.h and coff/ecoff.h.
(ecoff.o, coff-alpha.o): New targets.
(coff-msym.o): Removed target.
(ecoff_write_object_contents): If not D_PAGED, don't add the
section headers to text_size. If not D_PAGED, set the magic
number to OMAGIC rather than ZMAGIC. If creating a D_PAGED
executable, the executable must fully occupy an even number of
pages.
(ecoff_set_symbol_info, make_bfd_asection, ecoff_little_vec,
ecoff_big_vec): Consistently set section alignment power to 4,
since ECOFF sections should be multiples of 16 bytes.
(ecoff_little_vec, ecoff_big_vec): Added D_PAGED to object_flags.
Made ar_pad_char and ar_max_namelen agree for both.
systems.
* coffcode.h (styp_to_sec_flags): Set SEC_SHARED_LIBRARY for a
STYP_NOLOAD | STYP_BSS section. Don't set SEC_NEVER_LOAD for a
STYP_INFO section.
(coff_compute_section_file_positions): Force vma and lma of _LIB
section to be zero.
(coff_set_section_contents): Count number of entries in new lma
field, not in vma.
* coffgen.c (make_a_section_from_file): Force lineno_count of
SEC_SHARED_LIBRARY section to be zero, since it is non-zero on the
SCO 3.2v4 shared library.
* seclet.c (rel): Copy over any section with contents, not just
loadable sections.
* coff-mips.c (ecoff_make_empty_symbol): Zero out newly allocated
symbol.
(ecoff_write_object_contents): Added BFD_ASSERT calls to ensure
relocs are reasonable.
* coff-msym.c: Eliminated uses of DEFUN.
(ecoff_swap_tir_out): New function.
debugging symbols.
(ecoff_get_debug): Offset the fdr adr by the adr of the first pdr,
for compatibility with tools from MIPS.
* config/bigmips.mt: New file; default vector is ecoff_big_vec.
* config/irix3.mt, config/irix4.mt: Removed.
* configure.in (mips-*-ecoff): New target; uses bigmips.mt.
(mips-sgi-*, mips-big-*): Use bigmips rather than irix3.
something to attach small common symbols to. Then avoid writing out
the (empty) .scommon section for the output BFD.
Tue Feb 2 11:41:06 1993 Ian Lance Taylor (ian@cygnus.com)
* coff-mips.c: Completed support for linker and binutils.
* section.c (SEC_IS_COMMON): New section flag, needed for MIPS
ECOFF which has two common sections.
(bfd_com_section): Set SEC_IS_COMMON flag.
* bfd-in.h (bfd_is_com_section): New macro to test SEC_IS_COMMON.
* aoutx.h, archive.c, bout.c, coff-a29k.c, coff-m88k.c,
coff-mips.c, coffgen.c, ieee.c, oasys.c, reloc.c, syms.: Use
bfd_is_com_section macro rather than checking for equality to
bfd_com_section.
Fri Jan 15 18:13:17 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
* coff-msym.c (ecoff_swap_hdr_out, ecoff_swap_fdr_out,
ecoff_swap_pdr_out, ecoff_swap_sym_out, ecoff_swap_ext_out,
ecoff_swap_rndx_out, ecoff_swap_rfd_out, ecoff_swap_opt_in,
ecoff_swap_opt_out, ecoff_swap_dnr_in, ecoff_swap_dnr_out): New
functions.
* coffswap.h: If NO_COFF_RELOCS is defined, don't define
bfd_swap_reloc_in or coff_swap_reloc_out.
* coff-mips.c: Added code to link and write out symbolic debugging
information, and to swap relocs in and out.
Fri Jan 8 15:47:53 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
* bfd.c (struct _bfd): Added ecoff_tdata to tdata union.
* targets.c (enum target_flavour): Added bfd_target_ecoff_flavour.
* coff-msym.c: Use DEFUN for function definitons.
* coff-mips.c: Added code to read and print symbols, and to find
line numbers.
Eliminate all PROTO calls, replace with PARAMS for readability.
* aoutx.h: Add type to callback parameter.
* coff-mips.c: Don't call trad-core.h, not needed.
* trad-core.c: Incorporate trad-core.h declarations. Fix comments.
* trad-core.h: Eliminate, unused.
Thu Oct 8 08:52:48 1992 Steve Chamberlain (sac@thepub.cygnus.com)
Now a bfd knows whether underscores are normally prepended
to symbols in its file format. Helps with error messages.
* aout-adobe.c, aout-target.h, bout.c, coff-a29k.c, coff-h8300.c,
coff-z8k.c: targets set so they have leading underscore
* coff-i386.c, coff-i960.c, coff-m68k.c, coff-mips.c, coff-m88k.c,
coff-rs6000.c, coff-we32k.c, elf.c, ieee.c, srec.c: targets set
without leading underscore flag
* targets.c: add symbol leading char to xvec description
* bfd-in.h (bfd_get_symbol_leading_char): new macro.
* ecoff.c: If compiling for DEC3100, use trad_unix core files,
else dummy out the core file support.
* trad-core.c (trad_unix_core_file_p): If HOST_DATA_START_ADDR is
specified, use it to locate the data section.
* coffcode.h (coff_write_symbols): Declare buffer as bfd_bytes
rather than as chars (lint).
bfd.texinfo oasys.c opncls.c reloc.c srec.c: More documentation on
lint fixes.
* amdcoff.c bfd.texinfo Makefile.in : Folded in changes for amd
29k coff by David Wood (wood@lab.ultra.nyu.edu).