assume that we can set the GP value and then get the same value,
since it won't be true if the output file is neither ELF nor
ECOFF.
* coff-mips.c (mips_adjust_reloc_in): Don't bother to use
_bfd_get_gp_value here.
(mips_gprel_reloc): Don't assume we can set and get the GP value.
* elf32-mips.c (mips_elf_hi16_reloc): Get gp value from
mips_elf_final_gp.
(mips_elf_lo16_reloc): Likewise.
(mips_elf_final_gp): Add pgp parameter. Set it to the GP value.
Don't require that the BFD be ELF.
(mips_elf_gprel16_reloc): Get gp value from mips_elf_final_gp.
(mips_elf_gprel32_reloc): Likewise.
(mips_elf_relocate_section): Don't assume we can set and get the
GP value.
(mips_elf_finish_dynamic_symbol): Don't bother to use
_bfd_get_gp_value here.
* elf32-mips.c (mips_elf_create_procedure_table): Initialize sv.
Don't change epdr between malloc and free. Be careful not to free
NULL pointers. Zero out the first RPDR.
(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.
r_symndx is RELOC_SECTION_NONE for an ALPHA_R_IGNORE reloc.
Change a RELOC_SECTION_LITA symndx to RELOC_SECTION_ABS.
(alpha_ecoff_swap_reloc_out): Change RELOC_SECTION_ABS to
RELOC_SECTION_LITA for ALPHA_R_IGNORE.
(alpha_adjust_reloc_out): For ALPHA_R_IGNORE, don't change
RELOC_SECTION_ABS to RELOC_SECTION_NONE.
_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.
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.
(alpha_howto_table): Use it as special_function to prevent certain relocs from
being adjusted by bfd_perform_relocation. IGNORE reloc should be
partial_inplace.
(alpha_ecoff_get_relocated_section_contents): Accept a LITERAL reloc on an
"ldl" instruction too.
.pdata section based on lnnoptr field, not section header.
(alpha_relocate_section): Don't bother to check if r_symndx >= 0,
since it is unsigned.
(ecoffalpha_little_vec): Use alpha_ecoff_object_p rather than
coff_object_p.
* ecoff.c (ecoff_new_section_hook): Set alignment_power field of
.pdata section to 3.
(ecoff_compute_section_file_positions): Save the size of the
.pdata section in the line_filepos field, and actually align the
.pdata section to an alignment power of 4.
(ecoff_compute_reloc_file_positions): Set output_has_begun after
calling ecoff_compute_section_file_positions.
(ecoff_write_object_contents): Set s_lnnoptr for the .pdata
section from the line_filepos field. Set vstamp for the optional
header from the vstamp of the symbolic header.
(ecoff_bfd_final_link): Set vstamp of the symbolic header to the
vstamp used by the first object file in the link.
* 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.