members of an archive for dynamic objects with no symbols, and
pass them directly to check_archive_element.
(xcoff_link_check_ar_symbols): Pass dynamic objects to
xcoff_link_check_dynamic_ar_symbols.
(xcoff_link_check_dynamic_ar_symbols): New static function.
The above is for PR 9520.
* coff-rs6000.c (rs6000coff_vec): Change BFD_JUMP_TABLE_DYNAMIC
from _bfd_nodynamic to _bfd_xcoff.
* libcoff-in.h (_bfd_xcoff_get_dynamic_symtab_upper_bound):
Declare.
(_bfd_xcoff_canonicalize_dynamic_symtab): Declare.
(_bfd_xcoff_get_dynamic_reloc_upper_bound): Declare.
(_bfd_xcoff_canonicalize_dynamic_reloc): Declare.
* libcoff.h: Rebuild.
* xcofflink.c (xcoff_swap_ldrel_in): New static function.
(xcoff_get_section_contents): New static function.
(_bfd_xcoff_get_dynamic_symtab_upper_bound): New function.
(_bfd_xcoff_canonicalize_dynamic_symtab): New function.
(_bfd_xcoff_get_dynamic_reloc_upper_bound): New function.
(xcoff_dynamic_reloc): New static variable.
(_bfd_xcoff_canonicalize_dynamic_reloc): New function.
(xcoff_link_add_dynamic_symbols): Use xcoff_get_section_contents.
Added some new interfaces, and a new entry in the target vector. Under the new
interfaces, mmap will be used if available, otherwise malloc/seek/read, as
before. Old interfaces all still intact.
Most configurations (including all used by "--enable-targets=all") simply
changed to call the default routine for that entry in the target vector. I
might've missed some targets only included in special configurations.
Support for a.out symbol and string table reading now goes through new
interfaces, and will use mmap when available.
Linker hooks (e.g., avoiding reallocation under malloc) not ready yet.
linker.
* libcoff-in.h (struct xcoff_tdata): Add full_aouthdr,
toc_section, and entry_section fields.
(struct xcoff_section_tdata): Remove ldrel_count field.
* libcoff.h: Rebuild.
* coffcode.h (coff_mkobject_hook): Initialize new xcoff_data
fields.
(coff_compute_section_file_positions): If RS6000COFF_C, generate
full a.out header if full_aouthdr is set in xcoff_data.
(coff_write_object_contents): Likewise. Set o_snentry and o_sntoc
based on sections stored in xcoff_data.
* coff-rs6000.c (xcoff_copy_private_bfd_data): Copy new xcoff_data
fields.
* coffgen.c (coff_get_symbol_info): If fix_value is set, fix the
value stored in ret rather than returning a pointer value.
(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.
(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.
_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.
_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.
function, and line_base fields.
* libcoff.h: Rebuild.
* coffgen.c (coff_find_nearest_line): Use section tdata to cache
information, rather than using static variables.
* coff-i960.c (coff_i960_relocate): Use a coff_section_data
structure to store the symbol being used.
(coff_i960_start_final_link): New static function.
(coff_i960_relocate_section): New static function.
(coff_i960_adjust_symndx): New static function.
(coff_start_final_link): Define.
(coff_relocate_section): Define.
(coff_adjust_symndx): Define.
* coffcode.h (bfd_coff_backend_data): Add new callback function
_bfd_coff_start_final_link.
(bfd_coff_start_final_link): Define.
(coff_start_final_link): Define if not defined.
(bfd_coff_std_swap_table): Add coff_start_final_link.
* cofflink.c (_bfd_coff_internal_syment_name): Make globally
visible.
(_bfd_coff_final_link): Call bfd_coff_start_final_link if the
function callback is not NULL.
* libcoff-in.h (struct coff_section_tdata): Add tdata field.
(_bfd_coff_internal_syment_name): Declare.
* libcoff.h: Rebuild.
* configure.in (icoff_big_vec): Add cofflink.o.
(icoff_little_vec): Likewise.
* configure: Rebuild.
* coffcode.h (coff_compute_section_file_positions): Keep the
raw size safe.
(coff_write_object_contents): Remember if it's a relocatable
file.
* libcoff-in.h (pe_data_type): New member 'has_reloc_section'
* peicode.h (coff_swap_filehdr_out): Clear not-reloc flag
if relocatable file. Swap out saved raw size.
* bfd-in.h (bfd_link_subsystem): Turn enum into #defines.
(bfd_link_pe_info_dval): New
(bfd_link_stack_heap): Renamed and massaged into bfd_link_pe_info.
* bfd-in2.h: rebuilt.
* bfd.c (NT_subsystem, NT_stack_heap): Deleted.
* coffcode.h (pe_value): New function.
(fill_pe_header_info): New function.
(coff_write_object_contents): Use new function.
* cofflink.c (coff_final_link_info): Remove pe randomness.
(dores_com): Update info in bfd_link_pe_info_dval.
(process_embedded_commands): Use the bfd_link_pe_info_dval.
(_bfd_coff_final_link): Remove PE stuff, initialize
coff_data->link_info.
* coffswap.h (coff_swap_[aout|filehdr]_out): Use indirect PE pointer.
(coff_swap_scnhdr_out): Use real imagebase.
* libcoff (coff_data_type.link_info): New field.
* 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.
are recognized, chose section flags based on the name.
(bfd_coff_backend_data): _bfd_styp_to_sec_flags_hook field: Add
name argument.
(bfd_coff_styp_to_sec_flags_hook): Add name argument.
(coff_compute_section_file_positions): Don't adjust the section
position by COFF_PAGE_SIZE unless SEC_ALLOC is set.
* libcoff.h: Rebuilt.
* coffgen.c (make_a_section_from_file): Pass section name to
bfd_coff_styp_to_sec_flags_hook.
* ecoff.c (_bfd_ecoff_styp_to_sec_flags): Add unused name
argument.
* libecoff.h (_bfd_ecoff_styp_to_sec_flags): Add name argument to
prototype.
fields to bitfields. Added fields fix_value and fix_scnlen.
(sec_to_styp_flags): If STYP_DEBUG is defined, use it rather than
STYP_INFO for the type of a section named .debug.
(coff_add_missing_symbols): Don't define if RS6000COFF_C.
(coff_write_object_contents): If RS6000COFF_C, don't call
coff_add_missing_symbols.
(coff_slurp_symbol_table): If RS6000COFF_C, then if the last aux
entry has type STY_LD change the x_scnlen into a pointer to a
symbol and set fix_scnlen. Also, for a C_BSTAT symbol, change the
value into a pointer to a symbol and set fix_value.
* libcoff.h: Rebuilt.
* coffgen.c (coff_mangle_symbols): Reindent. If fix_value is set,
get the symbol offset. Likewise for fix_scnlen.
(string_size): Change type to bfd_size_type.
(debug_string_size, debug_string_section): New static variables.
(coff_fix_symbol_name): If bfd_coff_symname_in_debug returns true,
write the symbol name into the .debug section; assume that the
section has already been created with the right size.
(coff_write_symbols): Initialize debug_string_size to 0. If
bfd_coff_symname_in_debug returns true, don't put symbol name in
usual string table. After writing out all symbols, if
debug_string_size is not 0, check that it matches the size of the
.debug section.
(coff_get_normalized_symtab): Clear new fix_value and fix_scnlen
fields. If the string offset is 0, always use an empty string as
the name.
(coff_make_empty_symbol): Zero out the symbol structure.
_bfd_coff_swap_aux_in and _bfd_coff_swap_aux_out: aux index number
and number of aux entries.
(bfd_coff_swap_aux_in, bfd_coff_swap_aux_out): Changed
accordingly.
* libcoff.h: Rebuilt.
* coffswap.h (coff_swap_aux_in, coff_swap_aux_out): Accept new
arguments. If RS6000COFF_C, only treat C_EXT and C_HIDEXT
specially if this is the last aux entry.
* coffgen.c (coff_write_symbol, coff_get_normalized_symtab): Pass
new arguments to swap_aux functions.
Somewhat more could be done.
Fri Jan 8 15:47:53 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
* coffcode.h: Moved many generic functions into coffgen.c. Moved
swapping functions into coffswap.h for ECOFF use. Moved
relocation functions, only used by h8300 and z8k, into reloc16.c.
Added hooks for coffgen.c functions to backend data structure, and
added hook functions. Still more could be done.
* coffswap.h: New file to hold COFF swapping routines.
* coffgen.c: New file to hold generic COFF functions.
* reloc16.c: New file to hold h8300 and z8k specific relocation
functions.
* libcoff-in.h: Added declarations for functions in coffgen.c.
* libcoff.h: Rebuilt to incorporate changes.
* coff-h8300.c: Function name changes.
* coff-z8k.c: Function name changes. Use coff_reloc16_extra_cases
hook rather than defining EXTRA_CASES.
* Makefile.in: Build new files coffgen and reloc16. Added
dependencies of coff-*.o on coffswap.h and seclet.h.
application. Some of the linker flags ought to get moved to this field
someday.
archures.c (bfd_default_scan): Recognize a few more numbers: 80486, 80960,
and 960.
bfd-in.h, bfd.c, targets.c, coffcode.h, coff-mips.c, other targets: Moved COFF
swap table to backend data.
hosts/i386linux.h: Include unistd.h.
aoutx.h, libaout.h, stab-syms.c: stab names are now in constant storage.
trad-core.c: Fixed some `PARAMS' uses that were missing parentheses.
aoutx.h, archive.c, archures.c, coffcode.h, ctor.c, reloc.c, syms.c: Doc fixes.
"done_lineno" so that a symbol which appears twice in the symbol
table only gets it's linenumbers relocated once. Modifed
(coff_write_native_symbol) and (coff_make_empty_symbol) to make
* configure.in: now h8 is a coff target
* cpu-h8300.c: fix various disassembly problems
* libcoff.h: took out some code which has been #0ed for a long
time.
* targets.c: added h8 coff
* coff-a29k.c, coff-i386.c, coff-i960.c, coff-m68k.c, coff-m88k.c
added new macro RTYPE2HOWTO to take a load of #ifdefs out of
coffcode.h
* coffcode.h: Started to change the way machine dependencies are
handled, from the nest of #ifdefs to macros defined in the
including coff-<foo>.c
* aoutx.h, archive.c, archures.c, bfd.c, bfd.texinfo, cache.c,
coffcode.h, core.c, format.c, libbfd.c, libbfd.h, libcoff.h,
opncls.c, reloc.c, section.c, syms.c, targets.c (documentation
segments): used BFD (caps) more consistently as a name in
discourse, fixed a few other minor typos and uses of fonts
Install header comments and attribute most modules to their
authors. BFD's name is now officially "Binary File Descriptor",
so remove any conflicting perjoratives.
alignments of structures on disk and structures in memory. #ifed out
all the code in coffswap.c, since it should be done using the target
swap routines now.
Remove obstack.h to ../include and obstack.c to ../libiberty.
Move COFF symbol swapping code to coffswap.c where GDB can call it but it
won't be duplicated if we have N different COFF targets.
Add support for traditional Unix core files (with a upage). This support
is from an Ultrix port, but is probably slightly broken now.
Improve bfd_release's of obstack'd items on error returns.
gcc -Wall fixes.
Handle section alignment slightly better in coff, and comment where it
needs more work (on page-aligning virtual vs file addresses for DPAGED).
Use set_tdata everywhere that tdata is set, to avoid "cast to the left
of assignment" problems with some compilers.
Move bfd_alloc, bfd_zalloc, bfd_realloc, and bfd_release into libbfd.h
(from bfd.h) since they are internal routines.
Remove the redundant suffix "_struct" from struct tags.
Set symbol count early in file reading, before slurping in the syms,
for GDB's use.