and _bfd_elfcore_strndup.
(struct elf_backend_data): Add elf_backend_grok_prstatus
and elf_backend_grok_psinfo.
* elf.c (_bfd_elfcore_make_pseudosection): New function.
(elfcore_grok_prstatus): Use it.
(elfcore_make_note_pseudosection): Likewise.
(elfcore_strndup): Rename to...
(_bfd_elfcore_strndup): Here, and make global.
(elfcore_grok_psinfo): Use _bfd_elfcore_strndup.
(elfcore_grok_note): Call elf_backend_grok_prstatus
and elf_backend_grok_psinfo if available.
* elf32-mips.c (_bfd_elf32_mips_grok_prstatus): New function.
(_bfd_elf32_mips_grok_psinfo): New function.
(elf_backend_grok_prstatus): Define.
(elf_backend_grok_psinfo): Define.
* elfxx-target.h (elf_backend_grok_prstatus): Default to NULL.
(elf_backend_grok_psinfo): Likewise.
(elfNN_bed): Include elf_backend_grok_prstatus and
elf_backend_grok_psinfo.
elf_backend_emit_relocs: New field: Function for emitting
relocs.
elf_backend_count_relocs: New field: Function for determining
the number of relocs to be emitted.
* elfxx-target.h: Provide default (NULL) values for
elf_backend_emit_relocs and elf_backend_count_relocs.
* elflink.h (elf_link_size_reloc_section): Make the hash table
big enough to hold the relocs counted by either reloc_count or
o->reloc_count.
(elf_bfd_final_link) emit_relocs: New boolean, set if relocs
should be emitted, either because of a command line option
stored in the info structure or because the target provides a
special reloc emitting function.
If the target provides a reloc counting function use it,
unless performing a relocatable link or emitting all relocs.
Also set the SEC_RELOC flag on any output section which will
contain relocs.
(elf_link_input_bfd): emit_relocs: New boolean, set if relocs
should be emitted, either because of a command line option
stored in the info structure or because the target provides a
special reloc emitting function.
If the target provides a reloc emitting function, use it,
unless performing a relocatable link or emitting all relocs.
* elf-bfd.h (elf_link_hash_table): Add runpath.
* bfd-in.h (bfd_elf_get_runpath_list): New prototype.
* bfd-in2.h: Rebuilt.
* elf.c (_bfd_elf_link_hash_table_init): Initialize the
"runpath" field to NULL.
(bfd_elf_get_runpath_list): New function.
* elflink.h (elf_link_add_object_symbols): Record DT_RPATH and
DT_RUNPATH entries.
* bfd-in.h (bfd_elf_set_dt_needed_soname): New.
* bfd-in2.h: Rebuild.
* elf-bfd.h (elf_obj_tdata): Add dt_soname.
(elf_dt_soname): New.
* elf.c (bfd_elf_set_dt_needed_soname): New.
* elflink.h (elf_link_add_object_symbols): Add the DT_NEEDED
entry if the shared object loaded by DT_NEEDED is used to
resolve the reference in a regular object.
* elf-bfd.h (struct elf_obj_tdata): Define per BFD Irix 5 virtual
sections elf_{text,data}_{section,symbol}.
* elf32-mips.c: mips_elf_{text,data}_{section,symbol}{,_ptr}: Remove.
(_bfd_mips_elf_hide_symbol): New function.
(elf_backend_hide_symbol): Map to the new function.
(_bfd_mips_elf_add_symbol_hook): Change to use new per BFD
definitions of mips_elf_{text,data}_{section,symbol}.
(mips_elf_local_relocation_p): Try to find the direct symbol
based on new check_forced argument.
(mips_elf_calculate_relocation): Use new version of
mips_elf_local_relocation_p.
(mips_elf_relocate_section): Likewise.
(_bfd_mips_elf_relocate_section): Likewise.
(mips_elf_sort_hash_table): Only assert that have enough GOT
space.
(mips_elf_got16_entry): Match all 32 bits to the existing GOT
entry if the relocation based on the new external argument.
(mips_elf_create_dynamic_relocation): Assert that we have a
section contents allocated where we can swap out the dynamic
relocations.
(mips_elf_calculate_relocation): Find the real hash-table entry
correctly by using h->root.root.type. Only create a dynamic
relocation entry if the symbol is defined in a shared library.
Create an external GOT entry for the GOT16 relocation if the
symbol was forced local.
(_bfd_mips_elf_finish_dynamic_symbol): Don't assert there is a
dynamic index if the symbol was forced local.
2000-06-20 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
* elf32-mips.c: Fix typos in comments.
bfd_elf32_slurp_reloc_table, bfd_elf64_write_relocs, and
bfd_elf64_slurp_reloc_table.
* elfcode.h (elf_write_relocs, elf_slurp_reloc_table): New
definitions to get external names.
(elf_write_relocs): Renamed from write_relocs and make global.
(elf_slurp_reloc_table): Make global.
(_bfd_elf,size_info): Use elf_write_relocs instead of write_relocs.
Reinstate bits of sh4 support that got accidentally deleted.
Add sh-dsp support.
bfd:
* archures.c (bfd_mach_sh2, bfd_mach_sh_dsp): New macros.
(bfd_mach_sh3_dsp): Likewise.
(bfd_mach_sh4): Reinstate.
(bfd_default_scan): Recognize 7410, 7708, 7729 and 7750.
* bfd-in2.h: Regenerate.
* coff-sh.c (struct sh_opcode): flags is no longer short.
(USESAS, USESAS_REG, USESR8, SETSAS, SETSAS_REG): New macros.
(sh_opcode41, sh_opcode42): Integrate as sh_opcode41.
(sh_opcode01, sh_opcode02, sh_opcode40): Add sh-dsp opcodes.
(sh_opcode41, sh_opcode4, sh_opcode80): Likewise.
(sh_opcodes): No longer const.
(sh_dsp_opcodef0, sh_dsp_opcodef): New arrays.
(sh_insn_uses_reg): Check for USESAS and USESR8.
(sh_insn_sets_reg, sh_insns_conflict): Check for SETSAS.
(_bfd_sh_align_load_span): Return early for SH4.
Modify sh_opcodes lookup table for sh-dsp / sh3-dsp.
Take into account that field b of a parallel processing insn
could be mistaken for a separate insn.
* cpu-sh.c (arch_info_struct): New array elements for
sh2, sh-dsp and sh3-dsp.
Reinstate element for sh4.
(SH2_NEXT, SH_DSP_NEXT, SH3_DSP_NEXT): New macros.
(SH4_NEXT): Reinstate.
(SH3_NEXT, SH3E_NEXT): Adjust.
* elf-bfd.h (_sh_elf_set_mach_from_flags): Declare.
* elf32-sh.c (sh_elf_set_private_flags): New function.
(sh_elf_copy_private_data, sh_elf_set_mach_from_flags): Likewise.
(sh_elf_merge_private_data): New function.
(elf_backend_object_p, bfd_elf32_bfd_set_private_bfd_flags): Define.
(bfd_elf32_bfd_copy_private_bfd_data): Define.
(bfd_elf32_bfd_merge_private_bfd_data): Change to
sh_elf_merge_private_data.
gas:
* config/tc-sh.c ("elf/sh.h"): Include.
(sh_dsp, valid_arch, reg_x, reg_y, reg_efg): New static variables.
(md.begin): Initialize target_arch.
Only include opcodes in has table that match selected architecture.
(parse_reg): Recognize register names for sh-dsp.
(parse_at): Recognize post-modify addressing.
(get_operands): The leading space is now optional.
(get_specific): Remove FDREG_N support. Add support for sh-dsp
arguments. Update valid_arch.
(build_Mytes): Add support for SDT_REG_N.
(find_cooked_opcode): New function, broken out of md_assemble.
(assemble_ppi, sh_elf_final_processing): New functions.
(md_assemble): Use find_cooked_opcode and assemble_ppi.
(md_longopts, md_parse_option): New option: -dsp.
* config/tc-sh.h (elf_tc_final_processing): Define.
(sh_elf_final_processing): Declare.
include/elf:
* sh.h: (EF_SH_MACH_MASK, EF_SH_UNKNOWN, EF_SH1, EF_SH2): New macros.
(EF_SH3, EF_SH_HAS_DSP, EF_SH_DSP, EF_SH3_DSP): Likewise.
(EF_SH_HAS_FP, EF_SH3E, EF_SH4, EF_SH_MERGE_MACH): Likewise.
opcodes:
* sh-dis.c (print_movxy, print_insn_ddt, print_dsp_reg): New functions.
(print_insn_ppi): Likewise.
(print_insn_shx): Use info->mach to select appropriate insn set.
Add support for sh-dsp. Remove FD_REG_N support.
* sh-opc.h (sh_nibble_type): Add new values for sh-dsp support.
(sh_arg_type): Likewise. Remove FD_REG_N.
(sh_dsp_reg_nums): New enum.
(arch_sh1, arch_sh2, arch_sh3, arch_sh3e, arch_sh4): New macros.
(arch_sh_dsp, arch_sh3_dsp, arch_sh1_up, arch_sh2_up): Likewise.
(arch_sh3_up, arch_sh3e_up, arch_sh4_up, arch_sh_dsp_up): Likewise.
(arch_sh3_dsp_up): Likewise.
(sh_opcode_info): New field: arch.
(sh_table): Split up insn with FD_REG_N into ones with F_REG_N and
D_REG_N. Fill in arch field. Add sh-dsp insns.
hide_symbol members.
(elf_link_hash_copy_indirect): New.
(elf_link_hash_hide_symbol): New.
* elflink.h (elf_link_add_object_symbols): Break out copy from
indirect new new symbol to elf.c.
(elf_link_assign_sym_version): Break out privatization of
non-exported symbol to elf.c.
* elf.c (_bfd_elf_link_hash_copy_indirect): New.
(_bfd_elf_link_hash_hide_symbol): New.
(_bfd_elf_link_hash_table_init): Init copy_indirect and hide_symbol.
* elflink.h (elf_adjust_dynamic_symbol): Copy REF_REGULAR_NONWEAK
and NON_GOT_REF from weak defined symbol to real symbol.
* elf32-i386.c (elf_i386_check_relocs): Set NON_GOT_REF.
(elf_i386_adjust_dynamic_symbol): If NON_GOT_REF is not set, don't
create a COPY reloc.
* elf32-sparc.c (elf32_sparc_check_relocs): Set NON_GOT_REF.
(elf32_sparc_adjust_dynamic_symbol): If NON_GOT_REF is not set,
don't create a COPY reloc.
* elf-bfd.h (struct elf_backend_data): Add
print_symbol_all and output_arch_syms backend methods.
* elfxx-target.h: Likewise.
* elf64-sparc.c (sparc64_elf_bfd_link_hash_table_create,
sparc64_elf_add_symbol_hook, sparc64_elf_output_arch_syms,
sparc64_elf_get_symbol_type, sparc64_elf_symbol_processing): New
functions.
(sparc64_elf_size_dynamic_sections): Leave space for STT_REGISTER
symbols in .dynsym, add their names into .dynstr. Put those symbols
into dynlocal.
(sparc64_elf_finish_dynamic_sections): Fix up DT_SPARC_REGISTER
pointers to STT_REGISTER symbols in dynsym section.
(sparc64_elf_print_symbol_all): New function.
* elf.c (bfd_elf_print_symbol): Allow special backend symbol
printing using the print_symbol_all hook.
* elflink.c (_bfd_elf_create_dynamic_sections): Only create
.dynbss and .rel[a].bss if want_dynbss.
* elfxx-target.h (elf_backend_want_dynbss): Provide default.
fields.
(_bfd_elf_init_reloc_shdr): New function.
* elf.c (_bfd_elf_new_section_hook): Use bfd_zalloc, rather than
bfd_alloc followed by memset.
(_bfd_elf_init_reloc_shdr): New function, split out from ...
(elf_fake_sections): Here.
(assign_section_numbers): Assign section numbers for the second
relocation section, if required.
* elflink.h (elf_link_output_relocs): New function.
(elf_link_size_reloc_section): Likewise.
(elf_bfd_final_link): Use elf_link_size_reloc_section.
(elf_link_input_bfd): Use elf_link_output_relocs.
* elf32-mips.c (_bfd_mips_elf_fake_sections): Use
_bfd_elf_init_reloc_shdr to initialize rel_hdr2.
* elflink.c (_bfd_elf_link_adjust_dynindx): Define it.
* elflink.h (elf_link_remove_section_and_adjust_dynindices): New
function.
(bfd_elf_size_dynamic_sections): Use it.
may_use_rel_p, may_use_rela_p, default_use_rela_p.
(bfd_elf_section_data): Add use_rela_p.
* elf.c (bfd_section_from_shdr): Set use_rela_p appropriately.
(_bfd_elf_new_section_hook): Likewise.
(elf_fake_sections): Use may_use_rela_p, etc., instead of
use_rela_p.
(_bfd_elf_copy_private_section_data): Copy use_rela_p.
* elfcode.h (write_relocs): Determine whether or not use rela
relocs based on the relocation section header.
* elflink.c (_bfd_elf_create_dynamic_sections): Use default_use_rela_p
instead of use_rela_p.
* elfxx-target.h (elf_backend_may_use_relp): New macro.
(elf_backend_may_use_rela_p): Likewise.
(elf_backend_default_use_rela_p): Likewise.
(elfNN_bed): Use them.