diff options
Diffstat (limited to 'bfd')
166 files changed, 5417 insertions, 3194 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index a2f8f86..2fd5efe 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,873 @@ +2003-11-11 Nick Clifton <nickc@redhat.com> + + * elf-m10300.c (bfd_mn10300_elf_size_dynamic_sections): Use + info->executable not info->shared to decide if a .interp section + should be present. + * elf32-arm.h (elf32_arm_size_dynamic_sections): Likewise. + * elf32-cris.c (elf_cris_size_dynamic_sections): Likewise. + * elf32-hppa.c (elf32_hppa_size_dynamic_sections): Likewise. + * elf32-i370.c (i370_elf_size_dynamic_sections): Likewise. + * elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise. + * elf32-vax.c (elf_vax_size_dynamic_sections): Likewise. + * elf32-xtensa.c (elf_xtensa_size_dynamic_sections): Likewise. + * elf64-hppa.c (elf64_hppa_size_dynamic_sections): Likewise. + * elfxx-mips.c (_bfd_mips_size_dynamic_sections): Likewise. + * elflink.h (size_dynamic_sections): Likewise. + +2003-11-10 Jonathan Wilson <jonwil@tpgi.com.au> + + * peXXigen.c (_bfd_XXi_swap_aouthdr_out): Swap out tls pointer. + (_bfd_XXi_final_link_postscript): Look for __tks_used symbol. If + found initialise the tls data directory entry. + +2003-11-07 Alan Modra <amodra@bigpond.net.au> + + * elf32-ppc.c (ppc_elf_install_value): Delete. + (shared_stub_entry, stub_entry): Make them arrays of ints. + Remove initial branch. + (ppc_elf_relax_section): Write one branch around all trampolines + instead. Correct bogus R_PPC_PLTREL24 handling. Correct + branch range check. Only use shared_stub_entry when shared. + Test that branches can reach stubs. Write trampolines out at + end so that just one realloc is used. Handle little-endian + mode. Move relevant code from ppc_elf_install_value to here. + (ppc_elf_relocate_section): Move code handling RELAX32 from + ppc_elf_install_value to here. + +2003-11-06 Alan Modra <amodra@bigpond.net.au> + + * elf32-ppc.c (ppc_elf_howto_raw); Add entry for R_PPC_RELAX32PC. + (ppc_elf_install_value): Handle R_PPC_RELAX32PC. Merge duplicate + cases. + (shared_stub_entry): Correct opcode. + (ppc_elf_relax_section): Generate R_PPC_RELAX32PC relocs. + (ppc_elf_relocate_section): Handle them. + +2003-11-05 Alan Modra <amodra@bigpond.net.au> + + * elf.c (_bfd_elf_rela_local_sym): Accept asection **, and return + updated section in case of merged section. + * elf-bfd.h (_bfd_elf_rela_local_sym): Update declaration. + * elf-hppa.h (elf_hppa_relocate_section): Adjust call. + * elf-m10200.c (mn10200_elf_relocate_section): Likewise. + * elf-m10300.c (mn10300_elf_relocate_section): Likewise. + * elf32-arm.h (elf32_arm_relocate_section): Likewise. + * elf32-avr.c (elf32_avr_relocate_section): Likewise. + * elf32-cris.c (cris_elf_relocate_section): Likewise. + * elf32-fr30.c (fr30_elf_relocate_section): Likewise. + * elf32-frv.c (elf32_frv_relocate_section): Likewise. + * elf32-h8300.c (elf32_h8_relocate_section): Likewise. + * elf32-hppa.c (elf32_hppa_relocate_section): Likewise. + * elf32-i370.c (i370_elf_relocate_section): Likewise. + * elf32-i860.c (elf32_i860_relocate_section): Likewise. + * elf32-m32r.c (m32r_elf_relocate_section): Likewise. + * elf32-m68k.c (elf_m68k_relocate_section): Likewise. + * elf32-mcore.c (mcore_elf_relocate_section): Likewise. + * elf32-msp430.c (elf32_msp430_relocate_section): Likewise. + * elf32-openrisc.c (openrisc_elf_relocate_section): Likewise. + * elf32-ppc.c (ppc_elf_relocate_section): Likewise. + * elf32-s390.c (elf_s390_relocate_section): Likewise. + * elf32-sh.c (sh_elf_relocate_section): Likewise. + * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. + * elf32-v850.c (v850_elf_relocate_section) Likewise. + * elf32-vax.c (elf_vax_relocate_section): Likewise. + * elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise. + * elf32-xtensa.c (elf_xtensa_relocate_section): Likewise. + * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. + * elf64-mmix.c (mmix_elf_relocate_section): Likewise. + * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. + * elf64-s390.c (elf_s390_relocate_section): Likewise. + * elf64-sh64.c (sh_elf64_relocate_section): Likewise. + * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. + * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. + * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. + + * elf32-cris.c (cris_elf_relocate_section): Don't recalculate symbol + section for reloc output. + * elf32-i370.c (i370_elf_relocate_section): Likewise. + * elf32-m68k.c (elf_m68k_relocate_section): Likewise. + * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. + * elf32-vax.c (elf_vax_relocate_section): Likewise. + * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. + * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. + + * elf32-ppc.c (ppc_elf_relocate_section): Don't recalculate everything + for R_PPC_RELAX32 reloc. Don't bother checking ppc_elf_install_value + return value. + * elf64-ppc.c (ppc64_elf_relocate_section <R_PPC64_TOC>): Sanity check + sec->id. + +2003-11-05 Alan Modra <amodra@bigpond.net.au> + + * elf32-d10v.c (extract_rel_addend, insert_rel_addend): New functions. + (elf32_d10v_relocate_section): Use them to handle -r reloc + adjustments, and in place of _bfd_elf_rela_local_sym. + + * cpu-iq2000.c (arch_info_struct): Warning fix. + +2003-11-05 Alan Modra <amodra@bigpond.net.au> + + * elf32-hppa.c (ELIMINATE_COPY_RELOCS): Define. + (elf32_hppa_copy_indirect_symbol): Don't copy NON_GOT_REF on + weakdefs. + (elf32_hppa_check_relocs): Use ELIMINATE_COPY_RELOCS. + (elf32_hppa_adjust_dynamic_symbol): Likewise. Copy weakdef + NON_GOT_REF. + (allocate_dynrelocs): Use ELIMINATE_COPY_RELOCS and + SYMBOL_CALLS_LOCAL. Discard relocs for undef weak syms with + non-default visibility. + (elf32_hppa_relocate_section): Use ELIMINATE_COPY_RELOCS and + SYMBOL_CALLS_LOCAL. + +2003-11-04 Alan Modra <amodra@bigpond.net.au> + + * aout-target.h, aoutf1.h, bfdio.c, bfdwin.c: Update copyright date. + * coff-apollo.c, coff-sparc.c, coff-w65.c, coff-we32k.c: Ditto. + * coff-z8k.c, coffgen.c, cpu-frv.c, cpu-h8500.c, cpu-hppa.c: Ditto. + * cpu-ia64-opc.c, cpu-m10300.c, cpu-mips.c, cpu-msp430.c: Ditto. + * cpu-rs6000.c, cpu-z8k.c, efi-app-ia32.c, elf32-am33lin.c: Ditto. + * gen-aout.c, hash.c, hp300hpux.c, init.c, mach-o.c: Ditto. + * nlm-target.h, nlm.c, som.h, stabs.c, sysdep.h, xsym.h: Ditto. + + * elf-m10300.c (_bfd_mn10300_elf_create_got_section): Fix + "dereferencing type-punned pointer" warnings. + + * aout-adobe.c (aout_adobe_set_section_contents): Constify location. + * aoutx.h (NAME(aout,set_section_contents)): Ditto. + * bfd-in2.h: Regenerate. + * binary.c (binary_set_section_contents): Ditto. + * bout.c (b_out_set_section_contents): Ditto. + * coff-tic54x.c (tic54x_set_section_contents): Ditto. + * coffcode.h (coff_set_section_contents): Ditto. + * ecoff.c (_bfd_ecoff_set_section_contents): Ditto. + * elf-bfd.h (_bfd_elf_set_section_contents): Ditto. + * elf.c (_bfd_elf_set_section_contents): Ditto. + * elfxx-mips.c (_bfd_mips_elf_set_section_contents): Ditto. + * elfxx-mips.h (_bfd_mips_elf_set_section_contents): Ditto. + * i386msdos.c (msdos_set_section_contents): Ditto. + * ieee.c (ieee_set_section_contents): Ditto. + * ihex.c (ihex_set_section_contents): Ditto. + * libaout.h (NAME(aout,set_section_contents)): Ditto. + * libbfd-in.h (_bfd_nowrite_set_section_contents): Ditto. + (_bfd_generic_set_section_contents): Ditto. + * libbfd.h: Regenerate. + * libbfd.c (_bfd_generic_set_section_contents): Ditto. + * libecoff.h (_bfd_ecoff_set_section_contents): Ditto. + * libnlm.h (nlmNAME(set_section_contents)): Ditto. + (struct nlm_backend_data <nlm_mangle_relocs>): Ditto. + * mmo.c (mmo_set_section_contents): Ditto. + * nlm32-alpha.c (nlm_alpha_mangle_relocs): Ditto. + * nlm32-i386.c (nlm_i386_mangle_relocs): Ditto. + * nlm32-ppc.c (nlm_powerpc_mangle_relocs): Ditto. + * nlm32-sparc.c (nlm_sparc_mangle_relocs): Ditto. + * nlmcode.h (nlm_set_section_contents): Ditto. + * oasys.c (oasys_set_section_contents): Ditto. + * pdp11.c (NAME(aout,set_section_contents)): Ditto. + * ppcboot.c (ppcboot_set_section_contents): Ditto. + * srec.c (srec_set_section_contents): Ditto. + * targets.c (BFD_JUMP_TABLE_WRITE <_bfd_set_section_contents>): Ditto. + * tekhex.c (tekhex_set_section_contents): Ditto. + (move_section_contents): Ditto. + * versados.c (versados_set_section_contents): Ditto. + * vms-misc.c (_bfd_save_vms_section): Ditto. + * vms.c (vms_set_section_contents): Ditto. + * vms.h (_bfd_save_vms_section): Ditto. + +2003-11-04 Alan Modra <amodra@bigpond.net.au> + + * elf64-ppc.c (ppc_size_one_stub): Size relbrlt. Accept info arg + rather than htab. + (ppc64_elf_size_stubs): Adjust ppc_size_one_stub traversal. Zero + relbrlt size. + (ppc64_elf_build_stubs): Allocate space for relbrlt. + +2003-11-04 Alan Modra <amodra@bigpond.net.au> + + * bfd-in.h (_bfd_elf_tls_setup): Declare. + * bfd-in2.h: Regenerate. + * elf-bfd.h (struct elf_link_tls_segment): Delete. + (struct elf_link_hash_table): Add tls_sec and tls_size. + * elf.c (_bfd_elf_link_hash_table_init): Init tls_sec and tls_size. + * elflink.c (_bfd_elf_tls_setup): New function. + * elflink.h (struct elf_final_link_info): Remove first_tls_sec. + (elf_bfd_final_link): Don't set first_tls_sec here. Update code + saving tls segment info, round segment size up. + (elf_link_output_extsym): Adjust code using tls segment info. + (elf_link_input_bfd): Likewise. + * elf32-i386.c (dtpoff_base, tpoff): Likewise. + * elf32-s390.c (dtpoff_base, tpoff): Likewise. + * elf32-sh.c (dtpoff_base, tpoff): Likewise. + * elf32-sparc.c (dtpoff_base, tpoff): Likewise. + * elf64-s390.c (dtpoff_base, tpoff): Likewise. + * elf64-x86-64.c (dtpoff_base, tpoff): Likewise. + * elfxx-ia64.c (elfNN_ia64_tprel_base): Likewise. + (elfNN_ia64_dtprel_base): Likewise. + * elf64-alpha.c (alpha_get_dtprel_base): Likewise. + (alpha_get_tprel_base): Likewise. + (struct alpha_relax_info): Remove tls_segment. + (elf64_alpha_relax_got_load): Adjust invocation of + alpha_get_dtprel_base and alpha_get_tprel_base. + (elf64_alpha_relax_tls_get_addr): Likewise. + (elf64_alpha_relax_section): Likewise. + (elf64_alpha_relocate_section): Likewise. + (elf64_alpha_relax_find_tls_segment): Delete. + * elf32-ppc.c (struct ppc_elf_link_hash_table): Remove tls_sec. + (ppc_elf_tls_setup): Call _bfd_elf_tls_setup. Return section. + (ppc_elf_relocate_section): Adjust to use elf.tls_sec. + * elf32-ppc.h (ppc_elf_tls_setup): Update. + * elf64-ppc.c (struct ppc_link_hash_table): Remove tls_sec. + (ppc64_elf_tls_setup): Call _bfd_elf_tls_setup. Return section. + (ppc64_elf_tls_optimize): Adjust to use elf.tls_sec. + (ppc64_elf_relocate_section): Likewise. + * elf64-ppc.h (ppc64_elf_tls_setup): Update. + +2003-11-03 Daniel Jacobowitz <drow@mvista.com> + + * elf-bfd.h (struct elf_backend_data): Remove plt_header_size. + * elf-m10300.c (elf_backend_plt_header_size): Don't define. + * elf32-arm.h (elf_backend_plt_header_size): Don't define. + * elf32-cris.c (elf_backend_plt_header_size): Don't define. + * elf32-i386.c (elf_backend_plt_header_size): Don't define. + * elf32-mips.c (elf_backend_plt_header_size): Don't define. + * elf32-ppc.c (elf_backend_plt_header_size): Don't define. + * elf32-s390.c (elf_backend_plt_header_size): Don't define. + * elf32-sh.c (elf_backend_plt_header_size): Don't define. + * elf32-sparc.c (elf_backend_plt_header_size): Don't define. + * elf64-alpha.c (elf_backend_plt_header_size): Don't define. + * elf64-hppa.c (elf_backend_plt_header_size): Don't define. + * elf64-mips.c (elf_backend_plt_header_size): Don't define. + * elf64-ppc.c (elf_backend_plt_header_size): Don't define. + * elf64-s390.c (elf_backend_plt_header_size): Don't define. + * elf64-sh64.c (elf_backend_plt_header_size): Don't define. + * elf64-sparc.c (elf_backend_plt_header_size): Don't define. + * elf64-x86-64.c (elf_backend_plt_header_size): Don't define. + * elfn32-mips.c (elf_backend_plt_header_size): Don't define. + * elfxx-ia64.c (elf_backend_plt_header_size): Don't define. + * elfxx-target.h (elf_backend_plt_header_size): Don't define + or include in target initializer. + +2003-11-03 Andrew Cagney <cagney@redhat.com> + + * section.c (bfd_set_section_contents): Make the "location" buffer + constant. + * bfd-in2.h: Re-generate. + +2003-10-30 Andrew Cagney <cagney@redhat.com> + + * syms.c: Replace "struct symbol_cache_entry" with "struct + bfd_symbol". + * vms.h, targets.c, section.c, reloc.c, peicode.h: Ditto. + * mipsbsd.c, elf.c, linker.c, elf-bfd.h, ecoff.c: Ditto. + * cpu-z8k.c, cpu-ns32k.c, cpu-h8500.c, bfd.c, bfd-in.h: Ditto. + * bfd-in2.h: Re-generate. + +2003-10-30 Jakub Jelinek <jakub@redhat.com> + + * elfxx-ia64.c: Include objalloc.h, hashtab.h. + (struct elfNN_ia64_local_hash_entry): Remove root. Add id and r_sym + fields. + (struct elfNN_ia64_local_hash_table): Remove. + (struct elfNN_ia64_link_hash_table): Change loc_hash_table's type + to htab_t. Add loc_hash_memory field. + (elfNN_ia64_local_hash_table_init, elfNN_ia64_new_loc_hash_entry): + Removed. + (elfNN_ia64_local_htab_hash, elfNN_ia64_local_htab_eq): New + functions. + (elfNN_ia64_hash_table_create): Use hashtab.h hashtable for + loc_hash_table. Initialize loc_hash_memory. + (elfNN_ia64_hash_table_free): New function. + (elfNN_ia64_local_hash_lookup): Remove. + (elfNN_ia64_local_dyn_sym_thunk): Change into htab_traverse + callback. + (elfNN_ia64_dyn_sym_traverse): Use htab_traverse. + (get_local_sym_hash): Use hashtab.h hashtable for loc_hash_table. + (bfd_elfNN_bfd_link_hash_table_free): Define. + +2003-10-30 Alan Modra <amodra@bigpond.net.au> + + * elflink.c (_bfd_elf_link_record_dynamic_symbol): Modify versioned + symbol string in place. + +2003-10-30 Jim Blandy <jimb@redhat.com> + + * cpu-rs6000.c (rs6000_compatible): Check the correct arch_info + object's mach field: all PowerPC machines are supersets of the + original rs6000, but not later rs6000 machines. + +2003-10-30 Alan Modra <amodra@bigpond.net.au> + + * dwarf2.c (struct attribute): Delete "unsnd", "snd" and "addr". + Add "val" and "sval" fields. + (DW_STRING, DW_UNSND, DW_BLOCK, DW_SND, DW_ADDR): Delete. + (read_attribute_value): Expand and adjust DW_* occurrences. + (scan_unit_for_functions, parse_comp_unit): Likewise. + +2003-10-30 Phil Edwards <phil@codesourcery.com> + + * config.bfd (arm-*-vxworks): Remove separate stanza; merge with + other common ELF triples. + (i[3-7]86-*-vxworks): Change to ELF format. + (mips*-*-windiss): New triple, add to common MIPS/ELF stanza. + (sh-*-vxworks): New stanza. + +2003-10-30 Lars Knoll <lars@trolltech.com> + Michael Matz <matz@suse.de> + Jakub Jelinek <jakub@redhat.com> + Alan Modra <amodra@bigpond.net.au> + + * merge.c (struct sec_merge_sec_info): Update comment. + (struct sec_merge_hash_entry): Remove entsize. + (sec_merge_hash_lookup): Only adjust alignment when creating. + (sec_merge_emit): Remove register keyword. + (cmplengthentry, last4_eq, last_eq): Delete. + (strrevcmp, strrevcmp_align, is_suffix): New. + (merge_strings): Use them to implement fast suffix merging. + * elf-strtab.c (struct elf_strtab_hash_entry): Update comments. + Make "len" signed. + (_bfd_elf_strtab_add): Lose on >2G strings. + (_bfd_elf_strtab_emit): Don't emit strings with len < 0. + (cmplengthentry, last4_eq): Delete. + (strrevcmp, is_suffix): New. + (_bfd_elf_strtab_finalize): Rework to implement fast suffix merging. + +2003-10-29 Daniel Jacobowitz <drow@mvista.com> + + * elf32-arm.h (elf32_arm_final_link_relocate): Move check for + SEC_ALLOC. + +2003-10-29 Philip Blundell <philb@gnu.org> + + * elf32-arm.h (elf32_arm_plt0_entry, elf32_arm_plt_entry): New + code sequence. + (PLT_HEADER_SIZE): New. + (struct elf32_arm_pcrel_relocs_copied): Rename to ... + (struct elf32_arm_relocs_copied): ... this. Count both + pcrel and non-pcrel relocs. All uses updated. + (struct elf32_arm_link_hash_table): Add pointers to dynamic linker + sections and symbol/section mapping cache. + (create_got_section): New. + (elf32_arm_create_dynamic_sections): New. + (elf_backend_create_dynamic_sections): Use it. + (elf32_arm_final_link_relocate): Support garbage collection of relocs. + (elf32_arm_check_relocs): Likewise. + (elf32_arm_adjust_dynamic_symbol): Likewise. + (elf32_arm_copy_indirect_symbol): New. + (elf32_arm_link_hash_table_create): Initialise new fields. + (elf32_arm_gc_sweep_hook): Implement. + (elf32_arm_discard_copies): Delete. + (elf32_arm_finish_dynamic_symbol): Use new PLT code. + (elf32_arm_finish_dynamic_sections): Likewise. + (elf_backend_can_refcount): Define. + (elf_backend_copy_indirect_symbol): Likewise. + (elf_backend_plt_header_size): Set to PLT_HEADER_SIZE. + +2003-10-29 Alan Modra <amodra@bigpond.net.au> + + * elf64-ppc.c (elf_backend_grok_prstatus): Define. + (elf_backend_grok_psinfo): Define. + (ppc64_elf_grok_prstatus, ppc64_elf_grok_psinfo): New functions. + + * elf.c (_bfd_elfcore_make_pseudosection): Allow multiple + sections with the same name. + (elfcore_grok_lwpstatus): Likewise. + (elfcore_grok_win32pstatus): Likewise. + (elfcore_grok_note): Likewise. + (elfcore_grok_nto_status): Likewise. + (elfcore_grok_nto_gregs): Likewise. + +2003-10-27 Daniel Jacobowitz <drow@mvista.com> + + * elf32-arm.h (elf32_arm_merge_private_bfd_data): Never skip dynamic + objects. + +2003-10-14 Richard Sandiford <rsandifo@redhat.com> + + * elfxx-mips.c (mips_elf_create_got_section): Initialize global_gotno. + +2003-10-24 H.J. Lu <hongjiu.lu@intel.com> + + * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Look up + hash table for real symbols. + +2003-10-23 Michael Snyder <msnyder@redhat.com> + + * section.c (asection): Fix typo in comment. + +2003-10-23 Alan Modra <amodra@bigpond.net.au> + + * elf64-ppc.c (get_tls_mask): Add toc_symndx param, save toc + reloc symbol index to it. Don't allow gd syms in shared libs + to be optimized. + (ppc64_elf_tls_optimize): Adjust get_tls_mask call. + (ppc64_elf_size_stubs): Likewise. + (ppc64_elf_relocate_section): Check that tls relocs are only used + with tls syms, and similarly for non-tls. Correct symbol used + when optimizing toc tls code. + +2003-10-22 Nick Clifton <nickc@redhat.com> + + * peicode.h (coff_swap_scnhdr_in): Only remove padding when + processing an executable. + +2003-10-22 Jakub Jelinek <jakub@redhat.com> + + * elflink.c (_bfd_elf_export_symbol): Adjust for globals and locals + field changes. + (_bfd_elf_link_assign_sym_version): Likewise. + * elflink.h (size_dynamic_sections): Likewise. + +2003-10-21 Alexandre Oliva <aoliva@redhat.com>, + Michael Snyder <msnyder@redhat.com> + + * archures.c (bfd_mach_sh4a, bfd_mach_sh4al_dsp, bfd_mach_sh4_nofpu, + bfd_mach_sh4a_nofpu): New machine types. + * bfd-in2.h: Rebuilt. + * cpu-sh.c (compatible): Remove unused function. + (SH4A_NEXT, SH4AL_DSP_NEXT, SH4_NOFPU_NEXT, SH4A_NOFPU_NEXT): New. + (arch_info_struct): Add sh4a, sh4al_dsp, sh4-nofpu and sh4a-nofpu. + * elf32-sh.c (sh_elf_set_mach_from_flags): Handle them. + +2003-10-21 Wouter van Heyst <wouter@vidicode.nl> + + * elf32-arm.h (elf32_arm_merge_private_bfd_data): Correct text + describing mismatched formats involving the Maverick FP type. + +2003-10-21 Anil Paranjpe <anilp1@KPITCummins.com> + + * binary.c (binary_object_p): Pass machine flag along with + architecture. + +2003-10-21 Thorsten Brehm <brehm@gmx.net> + + * archures.c (bfd_default_scan): Add support for mcf528x. + * ieee.c (ieee_write_processor): Likewise. + +2003-10-21 Peter Barada <pbarada@mail.wm.sps.mot.com> + Bernardo Innocenti <bernie@develer.com> + + * archures.c: Add MCF528x (MCFv4) support. + * bfd/cpu-m68k.c (arch_info_struct): Likewise. + * bfd-in2.h: Regenerate. + +2003-10-20 Andrew Cagney <cagney@redhat.com> + + * targets.c: Replace "struct sec" with "struct bfd_section" + * syms.c, sparclynx.c, section.c, opncls.c: Ditto. + * libcoff-in.h, libbfd-in.h, elfxx-target.h: Ditto. + * elf.c, coffgen.c, bfd.c, bfd-in.h, aoutf1.h: Ditto. + * aout-tic30.c, aout-target.h: + * bfd-in2.h, libcoff.h, libbfd.h: Regenerate. + +2003-10-18 Hans-Peter Nilsson <hp@bitrange.com> + + Support linker relaxation of new R_MMIX_PUSHJ_STUBBABLE relocs. + * elf64-mmix.c (MAX_PUSHJ_STUB_SIZE): New macro. + (struct _mmix_elf_section_data): New member pjs. + (mmix_set_relaxable_size, mmix_elf_get_section_contents): New + functions. + (elf_mmix_howto_table): New entry for R_MMIX_PUSHJ_STUBBABLE. + (mmix_reloc_map): Ditto. + (mmix_elf_relocate_section): Handle R_MMIX_PUSHJ_STUBBABLE. + (mmix_final_link_relocate, mmix_elf_check_common_relocs): Ditto. + (mmix_elf_perform_relocation): Ditto. Don't mark parameter addr + unused. + (mmix_elf_check_relocs): Move early return to after + mmix_elf_check_common_relocs call. + (mmix_elf_symbol_processing): Fix cut-and-pasto in head comment. + (_bfd_mmix_before_linker_allocation): Rename from + _bfd_mmix_prepare_linker_allocated_gregs. All referers changed. + Arrange to set the initial relaxable size of sections. + (_bfd_mmix_after_linker_allocation): Rename from + _bfd_mmix_finalize_linker_allocated_gregs. + (mmix_elf_relax_section): Relax a R_MMIX_PUSHJ_STUBBABLE reloc. + (bfd_elf64_get_section_contents): Define. + * reloc.c: Add ENUMX for BFD_RELOC_MMIX_PUSHJ_STUBBABLE. + * libbfd.h, bfd-in2.h: Regenerate. + + * reloc.c (bfd_generic_relax_section): Default-set + section->_cooked_size here. + (bfd_generic_get_relocated_section_contents): Don't set it here. + Explain why. + +2003-10-17 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> + + * elf32-hppa.c (elf32_hppa_relocate_section): Skip relocation if + output section has been discarded. + +2003-10-17 Shrinivas Atre <shrinivasa@KPITCummins.com> + + * coff-h8300.c (funcvec_hash_newfunc): Handle normal mode. + (h8300_reloc16_extra_cases): Likewise. + (h8300_bfd_link_add_symbols): Likewise. + +2003-10-17 Dhananjay Deshpande <dhananjayd@kpitcummins.com> + + * cpu-h8300.c (h8300sxn_info_struct): Correct address size. + (h8300sn_info_struct): Likewise. + (h8300hn_info_struct): Likewise. + +2003-10-16 Pavel Roskin <proski@gnu.org> + + * peXXigen.c (_bfd_XXi_swap_aouthdr_out): Don't calculate image size + for sections which lack size info. + +2003-10-17 Danny Smith <dannysmith@users.sourceforge.net> + + * configure.host: Add __USE_MINGW_FSEEK to HDEFINES for + mingw32. + +2003-10-16 H.J. Lu <hongjiu.lu@intel.com> + + * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Also warn + undefined patterns with '*'. + +2003-10-16 H.J. Lu <hongjiu.lu@intel.com> + + * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Don't + use the last CIE from a different section. + (_bfd_elf_write_section_eh_frame): Don't pad beyond the raw + size of the output section. + +2003-10-07 Roland McGrath <roland@redhat.com> + + * elf.c (_bfd_elf_make_section_from_phdr): Set alignment_power of + new section from p_align header field. + +2003-10-16 H.J. Lu <hongjiu.lu@intel.com> + + * elf32-xtensa.c (xtensa_read_table_entries): The external size + of entry is 8 bytes. + +2003-10-15 Andrew Cagney <cagney@redhat.com> + + * targets.c (BFD_JUMP_TABLE_SYMBOLS): Replace NAME##_get_symtab + with NAME##_canonicalize_symtab. + * libcoff-in.h (coff_canonicalize_symtab): Update. + * xsym.h (bfd_sym_canonicalize_symtab): Update. + * elf-bfd.h (_bfd_elf_canonicalize_symtab): Update. + * coffgen.c (coff_canonicalize_symtab): Update. + * libbfd-in.h (_bfd_nosymbols_canonicalize_symtab): Update. + * libnlm.h (nlmNAME(canonicalize_symtab)): Update. + * ieee.c (ieee_vec): Update comment. + * libecoff.h (_bfd_ecoff_canonicalize_symtab): Update. + * mmo.c (mmo_canonicalize_symtab): Update. + * nlm-target.h (nlm_canonicalize_symtab): Update. + * nlmcode.h (nlm_canonicalize_symtab): Update. + * i386msdos.c (msdos_canonicalize_symtab): Update. + * hp300hpux.c (MY (canonicalize_symtab)): Update. + * oasys.c (oasys_canonicalize_symtab): Update. + * som.c (som_canonicalize_symtab): Update. + * pef.c (bfd_pef_canonicalize_symtab): Update. + * nlmcode.h (nlm_canonicalize_symtab): Update. + * xsym.c (bfd_sym_canonicalize_symtab): Update. + * vms.c (vms_canonicalize_symtab): Update. + * versados.c (versados_canonicalize_symtab): Update. + * mach-o.c (bfd_mach_o_canonicalize_symtab): Update. + * ieee.c (ieee_canonicalize_symtab): Update. + * pdp11.c (NAME(aout,canonicalize_symtab)): Update. + * reloc.c: Update comment. + * libaout.h (NAME(aout,canonicalize_symtab)): Update. + * coff64-rs6000.c (aix5coff64_vec): Update. + * coff64-rs6000.c (bfd_xcoff_aix5_backend_data): Update. + * coff-rs6000.c (rs6000coff_vec, pmac_xcoff_vec): Update. + * aoutx.h (NAME(aout,canonicalize_symtab)): Update. + * elfxx-target.h (bfd_elfNN_canonicalize_symtab): Update. + * hp300hpux.c (MY_canonicalize_symtab): Update. + * ecoff.c (_bfd_ecoff_canonicalize_symtab): Update. + * aout-tic30.c (MY_canonicalize_symtab): Update. + * aout-target.h (MY_canonicalize_symtab): Update. + * ppcboot.c (ppcboot_canonicalize_symtab): Update. + * elf.c (_bfd_elf_canonicalize_symtab): Update. + * elfcode.h (elf_canonicalize_symtab): Update. + * ihex.c (ihex_canonicalize_symtab): Update. + * tekhex.c (tekhex_canonicalize_symtab): Update. + * binary.c (binary_canonicalize_symtab): Update. + * srec.c (srec_canonicalize_symtab): Update. + +2003-10-15 Kazu Hirata <kazu@cs.umass.edu> + + * elf32-h8300.c (elf_reloc_map): Fix a comment typo. + +2003-10-15 Kaz Kojima <kkojima@rr.iij4u.or.jp> + + * elf32-sh.c (sh_elf_relocate_section): Handle R_SH_IMM_*_PCREL + relocations. + (sh_elf_check_relocs): Likewise. + + * elf32-sh64.c (elf_backend_merge_symbol_attribute): Define. + (sh64_elf_merge_symbol_attribute): New. + * elf64-sh64.c (elf_backend_merge_symbol_attribute): Define. + (sh64_elf64_merge_symbol_attribute): New. + +2003-10-14 Kaz Kojima <kkojima@rr.iij4u.or.jp> + + * elf-bfd.h (struct elf_backend_data): New function pointer member + elf_backend_merge_symbol_attribute. + * elflink.h (elf_link_add_object_symbols): Adjust call to + elf_backend_merge_symbol_attribute if the backend defined it. + * elfxx-target.h (elf_backend_merge_symbol_attribute): New macro. + (elfNN_bed): Add that to the initializer. + +2003-10-14 Bob Wilson <bob.wilson@acm.org> + + * elf32-xtensa.c (get_is_linkonce_section): Delete. + (xtensa_is_property_section, xtensa_is_littable_section): Use + XTENSA_INSN_SEC_NAME and XTENSA_LIT_SEC_NAME macros. Do not recognize + linkonce sections containing ".xt.insn" and ".xt.lit" substrings. + (xtensa_get_property_section_name): Check section name instead of + calling get_is_linkonce_section. Remove unused bfd parameter. Use + XTENSA_INSN_SEC_NAME and XTENSA_LIT_SEC_NAME macros. Never generate + linkonce section names by appending ".xt.insn" or ".xt.lit". + (xtensa_read_table_entries): Remove bfd argument in call to + xtensa_get_property_section_name. Free section name when done. + (elf_xtensa_combine_prop_entries): Free leaking table. + +2003-10-13 Richard Sandiford <rsandifo@redht.com> + + * elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Don't add + DT_MIPS_LIBLIST or DT_MIPS_CONFLICT entries. + (_bfd_mips_elf_finish_dynamic_symbol): Don't handle them. Don't + handle DT_MIPS_MSYM. Set DT_RELSZ based on the number of relocations + that were needed. + (_bfd_mips_elf_modify_segment_map): Fix placement of PT_MIPS_OPTIONS. + (_bfd_mips_elf_merge_private_bfd_data): Ignore EF_MIPS_UCODE. + +2003-10-13 H.J. Lu <hongjiu.lu@intel.com> + + * bfd-in.h (bfd_elf32_ia64_after_parse): New prototype. + (bfd_elf64_ia64_after_parse): Likewise. + * bfd-in2.h: Regenerated. + + * elfxx-ia64.c (oor_ip): New. + (oor_branch_size): Likewise. + (bfd_elfNN_ia64_after_parse): Likewise. + (elfNN_ia64_relax_section): Use oor_ip if oor_branch_size + equals sizeof (oor_ip). + +2003-10-12 Kaz Kojima <kkojima@rr.iij4u.or.jp> + + * elf64-sh64.c (sh_elf64_relocate_section): Tidy up for the + renumbering of some relocation numbers. + +2003-10-11 Alan Modra <amodra@bigpond.net.au> + + * coff-sh.c: Move definition of MAP and guard more code with + COFF_IMAGE_WITH_PE. + + * section.c (bfd_get_section_size_before_reloc): Ignore reloc_done. + * bfd-in2.h: Regenerate. + +2003-10-10 H.J. Lu <hongjiu.lu@intel.com> + + * Makefile.am: Run "make dep-am". + * Makefile.in: Regenerate. + * doc/Makefile.in: Likewise. + +2003-10-09 H.J. Lu <hongjiu.lu@intel.com> + + * cofflink.c: Include "safe-ctype.h". + (coff_link_add_symbols): Use ISDIGIT instead of isdigit. + +2003-10-08 Dave Brolley <brolley@redhat.com> + On behalf of Michael Snyder <msnyder@redhat.com> + + * archures.c: Add FRV fr550 machine. + * cpu-frv.c: Ditto. + * elf32-frv.c: Ditto. + * bfd-in2.h: Regenerate. + +2003-10-08 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de> + + * elfxx-mips.c (STUB_MOVE,STUB_LI16): Fix stub code + for non-SGI N64 ABI. Improve code consitency. + +2003-10-07 Alexandre Oliva <aoliva@redhat.com> + + * elf32-frv.c (elf32_frv_howto_table): Set R_FRV_LABEL16's + rightshift to 2. + +2003-10-07 Nathan Sidwell <nathan@codesourcery.com> + + * libbfd-in.h (_bfd_link_section_stabs): Add string offset + parameter. + * cofflink.c (coff_link_add_symbols): Deal with split stab + sections. + * elflink.h (elf_link_add_object_symbols): Deal with split stab + sections. + * stabs.c (_bfd_link_section_stabs): Add string offset parameter. + * libbfd.h: Regenerated. + + * coffcode.h (coff_set_alignment_hook): With PE_COFF reloc + overflow, set reloc start position to after the count + reloc. Subtract one from num relocs. Give error on 0xffff relocs + and no overflow. + * cofflink.c (_bfd_coff_final_link): Deal with PE_COFF reloc + overflow. + * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Do overflow if >= + 0xffff. + +2003-10-06 H.J. Lu <hongjiu.lu@intel.com> + + * elf-eh-frame.c (_bfd_elf_write_section_eh_frame): Pad the + last CIE/FDE if needed. + +2003-10-06 Nick Clifton <nickc@redhat.com> + + * targets.c (_bfd_target_vector): Include bfd_elf64_sparc_vec if + BFD64 is enabled. + +2003-10-06 Matt Thomas <matt@3am-software.com> + + * config.bfd: Move the hppa*-*-netbsd* case to the hppa*-*-linux* case. + +2003-10-06 Robert Millan <robertmh@gnu.org> + + * configure.in: Match GNU/KNetBSD with new knetbsd*-gnu triplet. + * config.bfd: Likewise. + * configure: Regenerate. + +2003-10-04 Christian Groessler <chris@groessler.org> + + * coff-z8k.c (extra_case): Fix displacement length check for R_JR + and R_CALLR. + +2003-10-04 Stephane Carrez <stcarrez@nerim.fr> + + * elf32-m68hc1x.c: Update to ISO C90; replace PTR with void*. + * elf32-m68hc11.c: Likewise. + * elf32-m68hc12.c: Likewise. + * elf32-m68hc1x.h: Likewise. + +2003-10-04 Stephane Carrez <stcarrez@nerim.fr> + + * elf32-m68hc1x.c (_bfd_m68hc11_elf_merge_private_bfd_data): Fix merge + of flags between HC12 and HCS12. + +2003-10-04 Bryce McKinlay <bryce@mckinlay.net.nz> + + * merge.c (_bfd_merge_sections): Set SEC_EXCLUDE flag on sections + which become empty after merging. + +2003-09-30 Jakub Jelinek <jakub@redhat.com> + + * elfxx-ia64.c (ia64_howto_table): Fix size of R_IA64_TPREL64[LM]SB, + R_IA64_DTPREL{32,64}[LM]SB and R_IA64_DTPMOD64[LM]SB. + +2003-09-30 Chris Demetriou <cgd@broadcom.com> + + * archures.c (bfd_mach_mipsisa64r2): New define. + * bfd-in2.h: Regenerate. + * aoutx.h (NAME(aout,machine_type)): Handle bfd_mach_mipsisa64r2. + * cpu-mips.c (I_mipsisa64r2): New enum value. + (arch_info_struct): Add entry for I_mipsisa64r2. + * elfxx-mips.c (_bfd_elf_mips_mach) + (_bfd_mips_elf_print_private_bfd_data): Handle E_MIPS_ARCH_64R2. + (mips_set_isa_flags): Add bfd_mach_mipsisa64r2 case. + (mips_mach_extensions): Add entry for bfd_mach_mipsisa64r2. + +2003-09-29 H.J. Lu <hongjiu.lu@intel.com> + + * elfxx-ia64.c (elfNN_hpux_backend_symbol_processing): New. + Handle SHN_IA_64_ANSI_COMMON. + (elf_backend_section_from_bfd_section): Defined. + +2003-09-26 H.J. Lu <hongjiu.lu@intel.com> + + * elflink.c (elf_link_read_relocs_from_section): Add an argument + of a pointer to section. Check bad symbol index. + (_bfd_elf_link_read_relocs): Modify calls to + elf_link_read_relocs_from_section. + +2003-09-23 DJ Delorie <dj@redhat.com> + + * elf32-sh.c (sh_elf_howto_table): R_SH_SWITCH8, + R_SH_GNU_VTINHERIT, R_SH_GNU_VTENTRY, + R_SH_LOOP_START,R_SH_LOOP_END moved to "reserved" spaces, + R_SH_DIR16, R_SH_DIR8, R_SH_DIR8UL, R_SH_DIR8UW, R_SH_DIR8U, + R_SH_DIR8SW, R_SH_DIR8S, R_SH_DIR4UL, R_SH_DIR4UW, R_SH_DIR4U, + R_SH_PSHA, R_SH_PSHL added. + (sh_reloc_map): Add R_SH_DIR16 and R_SH_DIR8. + (sh_elf_relocate_section): Support new relocs. + +2003-09-23 Bob Wilson <bob.wilson@acm.org> + + * elf32-xtensa.c (elf_xtensa_relocate_section): Fix typo that clobbered + dynamic relocation offsets. + +2003-09-23 Alan Modra <amodra@bigpond.net.au> + + * simple.c (bfd_simple_get_relocated_section_contents): Free the + hash table using _bfd_generic_link_hash_table_free. + +2003-09-23 Alan Modra <amodra@bigpond.net.au> + + * elf-bfd.h (struct bfd_elf_special_section): Remove "suffix". Change + type of prefix_length and suffix_length to int. Rename "attributes" + to "attr". Comment. + (_bfd_elf_get_sec_type_attr): Update prototype. + * elf.c (get_special_section): Rewrite. + (_bfd_elf_get_sec_type_attr): Return struct rather than passing in + attr and type pointers. + (_bfd_elf_new_section_hook): Adjust for above. + (special_sections): Merge suffix with prefix. Set + prefix_length for all entries. Set suffix_length appropriately. + * elf32-m32r.c (m32r_elf_special_sections): Likewise. + * elf32-m68hc11.c (elf32_m68hc11_special_sections): Likewise. + * elf32-m68hc12.c (elf32_m68hc12_special_sections): Likewise. + * elf32-mcore.c (mcore_elf_special_sections): Likewise. + * elf32-sh64.c (sh64_elf_special_sections): Likewise. + * elf32-v850.c (v850_elf_special_sections): Likewise. + * elf32-xtensa.c (elf_xtensa_special_sections): Likewise. + * elf64-alpha.c (elf64_alpha_special_sections): Likewise. + * elf64-hppa.c (elf64_hppa_special_sections): Likewise. + * elf64-ppc.c (ppc64_elf_special_sections): Likewise. + * elf64-sh64.c (sh64_elf64_special_sections): Likewise. + * elfxx-ia64.c (elfNN_ia64_special_sections): Likewise. + * elfxx-mips.c (_bfd_mips_elf_special_sections): Likewise. + * elf32-ppc.c (ppc_elf_special_sections): Likewise. Fix .plt flags. + +2003-09-21 Daniel Jacobowitz <drow@mvista.com> + + * elf64-alpha.c (elf64_alpha_create_got_section): Initialize + ->got if the section already exists. + +2003-09-19 Nathan Sidwell <nathan@codesourcery.com> + + * dwarf2.c (decode_line_info): Cope with an initially empty + filename table. + +2003-09-18 H.J. Lu <hongjiu.lu@intel.com> + + * acinclude.m4: Include ../config/accross.m4. + * aclocal.m4: Regenerated. + + * configure.host (HOST_64BIT_TYPE): Remove if it is set to long + or long long. + (HOST_U_64BIT_TYPE): Remove if it is set to unsigned long long. + (host64): Remove if HOST_64BIT_TYPE is set to long. + + * configure.in (HOST_64BIT_TYPE): Set according to the size of + long and long long. + (HOST_U_64BIT_TYPE): Likewise. + (host64): Likewise. + * configure: Regenerated. + +2003-09-19 Alan Modra <amodra@bigpond.net.au> + + * elf.c (elfcore_write_note): Don't use sizeof(Elf_External_note) + since some ABIs round up the size of the struct. + +2003-09-18 H.J. Lu <hongjiu.lu@intel.com> + + * elflink.c (_bfd_elf_merge_symbol): Allow type change if + the old symbol is undefined and the new symbol is defined. + +2003-09-18 Andreas Schwab <schwab@suse.de> + + * simple.c (bfd_simple_get_relocated_section_contents): Use + _bfd_generic_link_hash_table_create instead of + bfd_link_hash_table_create. + 2003-09-10 H.J. Lu <hongjiu.lu@intel.com> * elfxx-ia64.c (elfNN_ia64_special_sections): Mark all sections @@ -58,10 +928,10 @@ (v850_elf_print_private_bfd_data): Interpret E_V850E1_ARCH flag. (v850_elf_merge_private_bfd_data): Allow v850e1 binaries to be linked with v850e binaries. Mark the output as v850e. - + 2003-09-03 Nick Clifton <nickc@redhat.com> - * cofflink.c (_bfd_coff_link_input_bfd): Do not skip section + * cofflink.c (_bfd_coff_link_input_bfd): Do not skip section symbols that are used in relocs. 2003-08-30 Robert Millan <robertmh@gnu.org> @@ -116,7 +986,7 @@ 2003-08-24 Jason Eckhardt <jle@rice.edu> - * coff-i860.c (CALC_ADDEND): Define to be a no-op. + * coff-i860.c (CALC_ADDEND): Define to be a no-op. 2003-08-24 Jason Eckhardt <jle@rice.edu> @@ -125,7 +995,7 @@ 2003-08-23 Jason Eckhardt <jle@rice.edu> - * coff-i860.c (coff_i860_reloc_nyi): New function. + * coff-i860.c (coff_i860_reloc_nyi): New function. (howto_table): Add entries for relocations PAIR, HIGHADJ, HIGH, LOWn, SPLITn, and BRADDR. (RTYPE2HOWTO): Check that the r_type is within the howto_table diff --git a/bfd/Makefile.am b/bfd/Makefile.am index d27c873..216b399 100644 --- a/bfd/Makefile.am +++ b/bfd/Makefile.am @@ -1097,7 +1097,7 @@ coff-z8k.lo: coff-z8k.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ $(INCDIR)/coff/z8k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ libcoff.h coffcode.h coffswap.h cofflink.lo: cofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/coff/internal.h libcoff.h + $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/safe-ctype.h dwarf1.lo: dwarf1.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf.h @@ -1310,7 +1310,7 @@ elf32-xtensa.lo: elf32-xtensa.c $(INCDIR)/filenames.h \ elf32.lo: elf32.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h \ - elflink.h + elflink.h $(INCDIR)/safe-ctype.h elflink.lo: elflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h @@ -1592,7 +1592,7 @@ elf64-sparc.lo: elf64-sparc.c $(INCDIR)/filenames.h \ elf64.lo: elf64.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h \ - elflink.h + elflink.h $(INCDIR)/safe-ctype.h mmo.lo: mmo.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ $(INCDIR)/elf/mmix.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/mmix.h nlm32-alpha.lo: nlm32-alpha.c $(INCDIR)/filenames.h \ diff --git a/bfd/Makefile.in b/bfd/Makefile.in index 5ca774a..f85a6fe 100644 --- a/bfd/Makefile.in +++ b/bfd/Makefile.in @@ -812,7 +812,7 @@ configure.in version.h DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = tar +TAR = gtar GZIP_ENV = --best SOURCES = $(libbfd_a_SOURCES) $(libbfd_la_SOURCES) OBJECTS = $(libbfd_a_OBJECTS) $(libbfd_la_OBJECTS) @@ -941,7 +941,7 @@ libbfd.la: $(libbfd_la_OBJECTS) $(libbfd_la_DEPENDENCIES) all-recursive install-data-recursive install-exec-recursive \ installdirs-recursive install-recursive uninstall-recursive install-info-recursive \ check-recursive installcheck-recursive info-recursive dvi-recursive: - @set fnord $(MAKEFLAGS); amf=$$2; \ + @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ @@ -961,7 +961,7 @@ check-recursive installcheck-recursive info-recursive dvi-recursive: mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: - @set fnord $(MAKEFLAGS); amf=$$2; \ + @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ rev="$$subdir $$rev"; \ @@ -1632,7 +1632,7 @@ coff-z8k.lo: coff-z8k.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ $(INCDIR)/coff/z8k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ libcoff.h coffcode.h coffswap.h cofflink.lo: cofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/coff/internal.h libcoff.h + $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/safe-ctype.h dwarf1.lo: dwarf1.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf.h @@ -1845,7 +1845,7 @@ elf32-xtensa.lo: elf32-xtensa.c $(INCDIR)/filenames.h \ elf32.lo: elf32.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h \ - elflink.h + elflink.h $(INCDIR)/safe-ctype.h elflink.lo: elflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h @@ -2127,7 +2127,7 @@ elf64-sparc.lo: elf64-sparc.c $(INCDIR)/filenames.h \ elf64.lo: elf64.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h \ - elflink.h + elflink.h $(INCDIR)/safe-ctype.h mmo.lo: mmo.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ $(INCDIR)/elf/mmix.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/mmix.h nlm32-alpha.lo: nlm32-alpha.c $(INCDIR)/filenames.h \ diff --git a/bfd/acinclude.m4 b/bfd/acinclude.m4 index bf328db..b1bd1be 100644 --- a/bfd/acinclude.m4 +++ b/bfd/acinclude.m4 @@ -1,3 +1,5 @@ +sinclude(../config/accross.m4) + dnl See whether we need to use fopen-bin.h rather than fopen-same.h. AC_DEFUN(BFD_BINARY_FOPEN, [AC_REQUIRE([AC_CANONICAL_SYSTEM]) diff --git a/bfd/aclocal.m4 b/bfd/aclocal.m4 index 3673e07..9d27670 100644 --- a/bfd/aclocal.m4 +++ b/bfd/aclocal.m4 @@ -1,4 +1,4 @@ -dnl aclocal.m4 generated automatically by aclocal 1.4-p5 +dnl aclocal.m4 generated automatically by aclocal 1.4-p6 dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation @@ -10,6 +10,8 @@ dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A dnl PARTICULAR PURPOSE. +sinclude(../config/accross.m4) + dnl See whether we need to use fopen-bin.h rather than fopen-same.h. AC_DEFUN(BFD_BINARY_FOPEN, [AC_REQUIRE([AC_CANONICAL_SYSTEM]) @@ -173,7 +175,16 @@ else $1_FALSE= fi]) -#serial 1 +# isc-posix.m4 serial 2 (gettext-0.11.2) +dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +# This file is not needed with autoconf-2.53 and newer. Remove it in 2005. + # This test replaces the one in autoconf. # Currently this macro should have the same name as the autoconf macro # because gettext's gettext.m4 (distributed in the automake package) @@ -201,7 +212,8 @@ dnl Usage: dnl AM_INIT_AUTOMAKE(package,version, [no-define]) AC_DEFUN([AM_INIT_AUTOMAKE], -[AC_REQUIRE([AC_PROG_INSTALL]) +[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL]) PACKAGE=[$1] AC_SUBST(PACKAGE) VERSION=[$2] @@ -217,13 +229,42 @@ AC_REQUIRE([AM_SANITY_CHECK]) AC_REQUIRE([AC_ARG_PROGRAM]) dnl FIXME This is truly gross. missing_dir=`cd $ac_aux_dir && pwd` -AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}, $missing_dir) AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) -AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}, $missing_dir) AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) AC_REQUIRE([AC_PROG_MAKE_SET])]) +# Copyright 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.4"]) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION so it can be traced. +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], + [AM_AUTOMAKE_VERSION([1.4-p6])]) + # # Check to make sure that the build environment is sane. # diff --git a/bfd/aout-adobe.c b/bfd/aout-adobe.c index b064650..052e938 100644 --- a/bfd/aout-adobe.c +++ b/bfd/aout-adobe.c @@ -1,6 +1,6 @@ /* BFD back-end for a.out.adobe binaries. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, - 2002 + 2002, 2003 Free Software Foundation, Inc. Written by Cygnus Support. Based on bout.c. @@ -47,7 +47,7 @@ static bfd_boolean aout_adobe_mkobject static bfd_boolean aout_adobe_write_object_contents PARAMS ((bfd *)); static bfd_boolean aout_adobe_set_section_contents - PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); + PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type)); static bfd_boolean aout_adobe_set_arch_mach PARAMS ((bfd *, enum bfd_architecture, unsigned long)); static int aout_adobe_sizeof_headers @@ -415,7 +415,7 @@ static bfd_boolean aout_adobe_set_section_contents (abfd, section, location, offset, count) bfd *abfd; asection *section; - PTR location; + const PTR location; file_ptr offset; bfd_size_type count; { diff --git a/bfd/aout-target.h b/bfd/aout-target.h index cc4a4f5..d8cad54 100644 --- a/bfd/aout-target.h +++ b/bfd/aout-target.h @@ -1,6 +1,6 @@ /* Define a target vector and some small routines for a variant of a.out. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002 + 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -443,7 +443,7 @@ MY_bfd_final_link (abfd, info) #endif #ifndef MY_bfd_debug_info_accumulate #define MY_bfd_debug_info_accumulate \ - (void (*) PARAMS ((bfd*, struct sec *))) bfd_void + (void (*) PARAMS ((bfd*, struct bfd_section *))) bfd_void #endif #ifndef MY_core_file_failing_command @@ -470,8 +470,8 @@ MY_bfd_final_link (abfd, info) #ifndef MY_get_symtab_upper_bound #define MY_get_symtab_upper_bound NAME(aout,get_symtab_upper_bound) #endif -#ifndef MY_get_symtab -#define MY_get_symtab NAME(aout,get_symtab) +#ifndef MY_canonicalize_symtab +#define MY_canonicalize_symtab NAME(aout,canonicalize_symtab) #endif #ifndef MY_get_reloc_upper_bound #define MY_get_reloc_upper_bound NAME(aout,get_reloc_upper_bound) diff --git a/bfd/aout-tic30.c b/bfd/aout-tic30.c index 6e65fcf..1f37b99 100644 --- a/bfd/aout-tic30.c +++ b/bfd/aout-tic30.c @@ -899,7 +899,7 @@ tic30_aout_set_arch_mach (abfd, arch, machine) #endif #ifndef MY_bfd_debug_info_accumulate #define MY_bfd_debug_info_accumulate \ - (void (*) PARAMS ((bfd*, struct sec *))) bfd_void + (void (*) PARAMS ((bfd*, struct bfd_section *))) bfd_void #endif #ifndef MY_core_file_failing_command @@ -926,8 +926,8 @@ tic30_aout_set_arch_mach (abfd, arch, machine) #ifndef MY_get_symtab_upper_bound #define MY_get_symtab_upper_bound NAME(aout,get_symtab_upper_bound) #endif -#ifndef MY_get_symtab -#define MY_get_symtab NAME(aout,get_symtab) +#ifndef MY_canonicalize_symtab +#define MY_canonicalize_symtab NAME(aout,canonicalize_symtab) #endif #ifndef MY_get_reloc_upper_bound #define MY_get_reloc_upper_bound NAME(aout,get_reloc_upper_bound) diff --git a/bfd/aoutf1.h b/bfd/aoutf1.h index 4d66d87..352dadf 100644 --- a/bfd/aoutf1.h +++ b/bfd/aoutf1.h @@ -1,6 +1,6 @@ /* A.out "format 1" file handling code for BFD. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, - 2001, 2002 + 2001, 2002, 2003 Free Software Foundation, Inc. Written by Cygnus Support. @@ -834,7 +834,7 @@ static const struct aout_backend_data sunos4_aout_backend = #define MY_bfd_debug_info_start bfd_void #define MY_bfd_debug_info_end bfd_void #define MY_bfd_debug_info_accumulate \ - (void (*) PARAMS ((bfd *, struct sec *))) bfd_void + (void (*) PARAMS ((bfd *, struct bfd_section *))) bfd_void #define MY_core_file_p sunos4_core_file_p #define MY_write_object_contents NAME(aout,sunos4_write_object_contents) #define MY_backend_data &sunos4_aout_backend diff --git a/bfd/aoutx.h b/bfd/aoutx.h index 674fc76..6c20bd0 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -801,6 +801,7 @@ NAME(aout,machine_type) (arch, machine, unknown) case bfd_mach_mipsisa32r2: case bfd_mach_mips5: case bfd_mach_mipsisa64: + case bfd_mach_mipsisa64r2: case bfd_mach_mips_sb1: /* FIXME: These should be MIPS3, MIPS4, MIPS16, MIPS32, etc. */ arch_flags = M_MIPS2; @@ -1264,7 +1265,7 @@ bfd_boolean NAME(aout,set_section_contents) (abfd, section, location, offset, count) bfd *abfd; sec_ptr section; - PTR location; + const PTR location; file_ptr offset; bfd_size_type count; { @@ -2025,7 +2026,7 @@ error_return: } long -NAME(aout,get_symtab) (abfd, location) +NAME(aout,canonicalize_symtab) (abfd, location) bfd *abfd; asymbol **location; { diff --git a/bfd/archures.c b/bfd/archures.c index 9033f28..064fa55 100644 --- a/bfd/archures.c +++ b/bfd/archures.c @@ -84,6 +84,7 @@ DESCRIPTION .#define bfd_mach_mcf5206e 10 .#define bfd_mach_mcf5307 11 .#define bfd_mach_mcf5407 12 +.#define bfd_mach_mcf528x 13 . bfd_arch_vax, {* DEC Vax *} . bfd_arch_i960, {* Intel 960 *} . {* The order of the following is important. @@ -148,6 +149,7 @@ DESCRIPTION .#define bfd_mach_mipsisa32 32 .#define bfd_mach_mipsisa32r2 33 .#define bfd_mach_mipsisa64 64 +.#define bfd_mach_mipsisa64r2 65 . bfd_arch_i386, {* Intel 386 *} .#define bfd_mach_i386_i386 1 .#define bfd_mach_i386_i8086 2 @@ -227,6 +229,10 @@ DESCRIPTION .#define bfd_mach_sh3_dsp 0x3d .#define bfd_mach_sh3e 0x3e .#define bfd_mach_sh4 0x40 +.#define bfd_mach_sh4_nofpu 0x41 +.#define bfd_mach_sh4a 0x4a +.#define bfd_mach_sh4a_nofpu 0x4b +.#define bfd_mach_sh4al_dsp 0x4d .#define bfd_mach_sh5 0x50 . bfd_arch_alpha, {* Dec Alpha *} .#define bfd_mach_alpha_ev4 0x10 @@ -280,6 +286,7 @@ DESCRIPTION .#define bfd_mach_fr400 400 .#define bfd_mach_frvtomcat 499 {* fr500 prototype *} .#define bfd_mach_fr500 500 +.#define bfd_mach_fr550 550 . bfd_arch_mcore, . bfd_arch_ia64, {* HP/Intel ia64 *} .#define bfd_mach_ia64_elf64 64 @@ -957,6 +964,10 @@ bfd_default_scan (const bfd_arch_info_type *info, const char *string) arch = bfd_arch_m68k; number = bfd_mach_mcf5407; break; + case 5282: + arch = bfd_arch_m68k; + number = bfd_mach_mcf528x; + break; case 32000: arch = bfd_arch_we32k; diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index 49ebee7..1a67d08 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -303,7 +303,7 @@ typedef struct lineno_cache_entry unsigned int line_number; /* Linenumber from start of function. */ union { - struct symbol_cache_entry *sym; /* Function name. */ + struct bfd_symbol *sym; /* Function name. */ bfd_vma offset; /* Offset into section. */ } u; } @@ -314,7 +314,7 @@ alent; #define align_power(addr, align) \ (((addr) + ((bfd_vma) 1 << (align)) - 1) & ((bfd_vma) -1 << (align))) -typedef struct sec *sec_ptr; +typedef struct bfd_section *sec_ptr; #define bfd_get_section_name(bfd, ptr) ((ptr)->name + 0) #define bfd_get_section_vma(bfd, ptr) ((ptr)->vma + 0) @@ -520,7 +520,7 @@ extern bfd_boolean bfd_cache_close extern bfd_boolean bfd_record_phdr (bfd *, unsigned long, bfd_boolean, flagword, bfd_boolean, bfd_vma, - bfd_boolean, bfd_boolean, unsigned int, struct sec **); + bfd_boolean, bfd_boolean, unsigned int, struct bfd_section **); /* Byte swapping routines. */ @@ -554,7 +554,7 @@ void bfd_put_bits (bfd_vma, bfd_byte *, int, bfd_boolean); struct ecoff_debug_info; struct ecoff_debug_swap; struct ecoff_extr; -struct symbol_cache_entry; +struct bfd_symbol; struct bfd_link_info; struct bfd_link_hash_entry; struct bfd_elf_version_tree; @@ -584,8 +584,8 @@ extern bfd_boolean bfd_ecoff_debug_accumulate_other extern bfd_boolean bfd_ecoff_debug_externals (bfd *abfd, struct ecoff_debug_info *debug, const struct ecoff_debug_swap *swap, bfd_boolean relocatable, - bfd_boolean (*get_extr) (struct symbol_cache_entry *, struct ecoff_extr *), - void (*set_index) (struct symbol_cache_entry *, bfd_size_type)); + bfd_boolean (*get_extr) (struct bfd_symbol *, struct ecoff_extr *), + void (*set_index) (struct bfd_symbol *, bfd_size_type)); extern bfd_boolean bfd_ecoff_debug_one_external (bfd *abfd, struct ecoff_debug_info *debug, const struct ecoff_debug_swap *swap, const char *name, @@ -601,7 +601,7 @@ extern bfd_boolean bfd_ecoff_write_accumulated_debug const struct ecoff_debug_swap *swap, struct bfd_link_info *info, file_ptr where); extern bfd_boolean bfd_mips_ecoff_create_embedded_relocs - (bfd *, struct bfd_link_info *, struct sec *, struct sec *, char **); + (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **); /* Externally visible ELF routines. */ @@ -620,10 +620,10 @@ extern bfd_boolean bfd_elf_get_bfd_needed_list (bfd *, struct bfd_link_needed_list **); extern bfd_boolean bfd_elf32_size_dynamic_sections (bfd *, const char *, const char *, const char *, const char * const *, - struct bfd_link_info *, struct sec **, struct bfd_elf_version_tree *); + struct bfd_link_info *, struct bfd_section **, struct bfd_elf_version_tree *); extern bfd_boolean bfd_elf64_size_dynamic_sections (bfd *, const char *, const char *, const char *, const char * const *, - struct bfd_link_info *, struct sec **, struct bfd_elf_version_tree *); + struct bfd_link_info *, struct bfd_section **, struct bfd_elf_version_tree *); extern void bfd_elf_set_dt_needed_name (bfd *, const char *); extern void bfd_elf_set_dt_needed_soname @@ -677,10 +677,13 @@ extern int bfd_get_arch_size extern int bfd_get_sign_extend_vma (bfd *); +extern struct bfd_section *_bfd_elf_tls_setup + (bfd *, struct bfd_link_info *); + extern bfd_boolean bfd_m68k_elf32_create_embedded_relocs - (bfd *, struct bfd_link_info *, struct sec *, struct sec *, char **); + (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **); extern bfd_boolean bfd_mips_elf32_create_embedded_relocs - (bfd *, struct bfd_link_info *, struct sec *, struct sec *, char **); + (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **); /* SunOS shared library support routines for the linker. */ @@ -689,7 +692,7 @@ extern struct bfd_link_needed_list *bfd_sunos_get_needed_list extern bfd_boolean bfd_sunos_record_link_assignment (bfd *, struct bfd_link_info *, const char *); extern bfd_boolean bfd_sunos_size_dynamic_sections - (bfd *, struct bfd_link_info *, struct sec **, struct sec **, struct sec **); + (bfd *, struct bfd_link_info *, struct bfd_section **, struct bfd_section **, struct bfd_section **); /* Linux shared library support routines for the linker. */ @@ -743,7 +746,7 @@ extern bfd_boolean bfd_xcoff_record_link_assignment extern bfd_boolean bfd_xcoff_size_dynamic_sections (bfd *, struct bfd_link_info *, const char *, const char *, unsigned long, unsigned long, unsigned long, bfd_boolean, - int, bfd_boolean, bfd_boolean, struct sec **, bfd_boolean); + int, bfd_boolean, bfd_boolean, struct bfd_section **, bfd_boolean); extern bfd_boolean bfd_xcoff_link_generate_rtinit (bfd *, const char *, const char *, bfd_boolean); @@ -759,16 +762,16 @@ union internal_auxent; #endif extern bfd_boolean bfd_coff_get_syment - (bfd *, struct symbol_cache_entry *, struct internal_syment *); + (bfd *, struct bfd_symbol *, struct internal_syment *); extern bfd_boolean bfd_coff_get_auxent - (bfd *, struct symbol_cache_entry *, int, union internal_auxent *); + (bfd *, struct bfd_symbol *, int, union internal_auxent *); extern bfd_boolean bfd_coff_set_symbol_class - (bfd *, struct symbol_cache_entry *, unsigned int); + (bfd *, struct bfd_symbol *, unsigned int); extern bfd_boolean bfd_m68k_coff_create_embedded_relocs - (bfd *, struct bfd_link_info *, struct sec *, struct sec *, char **); + (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **); /* ARM Interworking support. Called from linker. */ extern bfd_boolean bfd_arm_allocate_interworking_sections @@ -815,12 +818,19 @@ extern unsigned int bfd_arm_get_mach_from_notes /* TI COFF load page support. */ extern void bfd_ticoff_set_section_load_page - (struct sec *, int); + (struct bfd_section *, int); extern int bfd_ticoff_get_section_load_page - (struct sec *); + (struct bfd_section *); /* H8/300 functions. */ extern bfd_vma bfd_h8300_pad_address (bfd *, bfd_vma); +/* IA64 Itanium code generation. Called from linker. */ +extern void bfd_elf32_ia64_after_parse + (int); + +extern void bfd_elf64_ia64_after_parse + (int); + diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index a7cca3e..5c17a7a 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -310,7 +310,7 @@ typedef struct lineno_cache_entry unsigned int line_number; /* Linenumber from start of function. */ union { - struct symbol_cache_entry *sym; /* Function name. */ + struct bfd_symbol *sym; /* Function name. */ bfd_vma offset; /* Offset into section. */ } u; } @@ -321,7 +321,7 @@ alent; #define align_power(addr, align) \ (((addr) + ((bfd_vma) 1 << (align)) - 1) & ((bfd_vma) -1 << (align))) -typedef struct sec *sec_ptr; +typedef struct bfd_section *sec_ptr; #define bfd_get_section_name(bfd, ptr) ((ptr)->name + 0) #define bfd_get_section_vma(bfd, ptr) ((ptr)->vma + 0) @@ -527,7 +527,7 @@ extern bfd_boolean bfd_cache_close extern bfd_boolean bfd_record_phdr (bfd *, unsigned long, bfd_boolean, flagword, bfd_boolean, bfd_vma, - bfd_boolean, bfd_boolean, unsigned int, struct sec **); + bfd_boolean, bfd_boolean, unsigned int, struct bfd_section **); /* Byte swapping routines. */ @@ -561,7 +561,7 @@ void bfd_put_bits (bfd_vma, bfd_byte *, int, bfd_boolean); struct ecoff_debug_info; struct ecoff_debug_swap; struct ecoff_extr; -struct symbol_cache_entry; +struct bfd_symbol; struct bfd_link_info; struct bfd_link_hash_entry; struct bfd_elf_version_tree; @@ -591,8 +591,8 @@ extern bfd_boolean bfd_ecoff_debug_accumulate_other extern bfd_boolean bfd_ecoff_debug_externals (bfd *abfd, struct ecoff_debug_info *debug, const struct ecoff_debug_swap *swap, bfd_boolean relocatable, - bfd_boolean (*get_extr) (struct symbol_cache_entry *, struct ecoff_extr *), - void (*set_index) (struct symbol_cache_entry *, bfd_size_type)); + bfd_boolean (*get_extr) (struct bfd_symbol *, struct ecoff_extr *), + void (*set_index) (struct bfd_symbol *, bfd_size_type)); extern bfd_boolean bfd_ecoff_debug_one_external (bfd *abfd, struct ecoff_debug_info *debug, const struct ecoff_debug_swap *swap, const char *name, @@ -608,7 +608,7 @@ extern bfd_boolean bfd_ecoff_write_accumulated_debug const struct ecoff_debug_swap *swap, struct bfd_link_info *info, file_ptr where); extern bfd_boolean bfd_mips_ecoff_create_embedded_relocs - (bfd *, struct bfd_link_info *, struct sec *, struct sec *, char **); + (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **); /* Externally visible ELF routines. */ @@ -627,10 +627,10 @@ extern bfd_boolean bfd_elf_get_bfd_needed_list (bfd *, struct bfd_link_needed_list **); extern bfd_boolean bfd_elf32_size_dynamic_sections (bfd *, const char *, const char *, const char *, const char * const *, - struct bfd_link_info *, struct sec **, struct bfd_elf_version_tree *); + struct bfd_link_info *, struct bfd_section **, struct bfd_elf_version_tree *); extern bfd_boolean bfd_elf64_size_dynamic_sections (bfd *, const char *, const char *, const char *, const char * const *, - struct bfd_link_info *, struct sec **, struct bfd_elf_version_tree *); + struct bfd_link_info *, struct bfd_section **, struct bfd_elf_version_tree *); extern void bfd_elf_set_dt_needed_name (bfd *, const char *); extern void bfd_elf_set_dt_needed_soname @@ -684,10 +684,13 @@ extern int bfd_get_arch_size extern int bfd_get_sign_extend_vma (bfd *); +extern struct bfd_section *_bfd_elf_tls_setup + (bfd *, struct bfd_link_info *); + extern bfd_boolean bfd_m68k_elf32_create_embedded_relocs - (bfd *, struct bfd_link_info *, struct sec *, struct sec *, char **); + (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **); extern bfd_boolean bfd_mips_elf32_create_embedded_relocs - (bfd *, struct bfd_link_info *, struct sec *, struct sec *, char **); + (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **); /* SunOS shared library support routines for the linker. */ @@ -696,7 +699,7 @@ extern struct bfd_link_needed_list *bfd_sunos_get_needed_list extern bfd_boolean bfd_sunos_record_link_assignment (bfd *, struct bfd_link_info *, const char *); extern bfd_boolean bfd_sunos_size_dynamic_sections - (bfd *, struct bfd_link_info *, struct sec **, struct sec **, struct sec **); + (bfd *, struct bfd_link_info *, struct bfd_section **, struct bfd_section **, struct bfd_section **); /* Linux shared library support routines for the linker. */ @@ -750,7 +753,7 @@ extern bfd_boolean bfd_xcoff_record_link_assignment extern bfd_boolean bfd_xcoff_size_dynamic_sections (bfd *, struct bfd_link_info *, const char *, const char *, unsigned long, unsigned long, unsigned long, bfd_boolean, - int, bfd_boolean, bfd_boolean, struct sec **, bfd_boolean); + int, bfd_boolean, bfd_boolean, struct bfd_section **, bfd_boolean); extern bfd_boolean bfd_xcoff_link_generate_rtinit (bfd *, const char *, const char *, bfd_boolean); @@ -766,16 +769,16 @@ union internal_auxent; #endif extern bfd_boolean bfd_coff_get_syment - (bfd *, struct symbol_cache_entry *, struct internal_syment *); + (bfd *, struct bfd_symbol *, struct internal_syment *); extern bfd_boolean bfd_coff_get_auxent - (bfd *, struct symbol_cache_entry *, int, union internal_auxent *); + (bfd *, struct bfd_symbol *, int, union internal_auxent *); extern bfd_boolean bfd_coff_set_symbol_class - (bfd *, struct symbol_cache_entry *, unsigned int); + (bfd *, struct bfd_symbol *, unsigned int); extern bfd_boolean bfd_m68k_coff_create_embedded_relocs - (bfd *, struct bfd_link_info *, struct sec *, struct sec *, char **); + (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **); /* ARM Interworking support. Called from linker. */ extern bfd_boolean bfd_arm_allocate_interworking_sections @@ -822,15 +825,22 @@ extern unsigned int bfd_arm_get_mach_from_notes /* TI COFF load page support. */ extern void bfd_ticoff_set_section_load_page - (struct sec *, int); + (struct bfd_section *, int); extern int bfd_ticoff_get_section_load_page - (struct sec *); + (struct bfd_section *); /* H8/300 functions. */ extern bfd_vma bfd_h8300_pad_address (bfd *, bfd_vma); +/* IA64 Itanium code generation. Called from linker. */ +extern void bfd_elf32_ia64_after_parse + (int); + +extern void bfd_elf64_ia64_after_parse + (int); + /* Extracted from init.c. */ void bfd_init (void); @@ -858,11 +868,11 @@ unsigned long bfd_calc_gnu_debuglink_crc32 char *bfd_follow_gnu_debuglink (bfd *abfd, const char *dir); -struct sec *bfd_create_gnu_debuglink_section +struct bfd_section *bfd_create_gnu_debuglink_section (bfd *abfd, const char *filename); bfd_boolean bfd_fill_in_gnu_debuglink_section - (bfd *abfd, struct sec *sect, const char *filename); + (bfd *abfd, struct bfd_section *sect, const char *filename); /* Extracted from libbfd.c. */ @@ -1029,7 +1039,7 @@ struct bfd_comdat_info long symbol; }; -typedef struct sec +typedef struct bfd_section { /* The name of the section; the name isn't a copy, the pointer is the same as that passed to bfd_make_section. */ @@ -1042,7 +1052,7 @@ typedef struct sec int index; /* The next section in the list belonging to the BFD, or NULL. */ - struct sec *next; + struct bfd_section *next; /* The field flags contains attributes of the section. Some flags are read in from the object file, and some are @@ -1265,7 +1275,7 @@ typedef struct sec /* Nonzero if this section has a gp reloc. */ unsigned int has_gp_reloc:1; - /* Usused bits. */ + /* Unused bits. */ unsigned int flag13:1; unsigned int flag14:1; unsigned int flag15:1; @@ -1308,7 +1318,7 @@ typedef struct sec bfd_vma output_offset; /* The output section through which to map on output. */ - struct sec *output_section; + struct bfd_section *output_section; /* The alignment requirement of the section, as an exponent of 2 - e.g., 3 aligns to 2^3 (or 8). */ @@ -1358,7 +1368,7 @@ typedef struct sec /* Points to the kept section if this section is a link-once section, and is discarded. */ - struct sec *kept_section; + struct bfd_section *kept_section; /* When a section is being output, this value changes as more linenumbers are written out. */ @@ -1377,8 +1387,8 @@ typedef struct sec bfd *owner; /* A symbol which points at this section only. */ - struct symbol_cache_entry *symbol; - struct symbol_cache_entry **symbol_ptr_ptr; + struct bfd_symbol *symbol; + struct bfd_symbol **symbol_ptr_ptr; struct bfd_link_order *link_order_head; struct bfd_link_order *link_order_tail; @@ -1416,13 +1426,12 @@ extern asection bfd_ind_section; || ((SEC) == bfd_com_section_ptr) \ || ((SEC) == bfd_ind_section_ptr)) -extern const struct symbol_cache_entry * const bfd_abs_symbol; -extern const struct symbol_cache_entry * const bfd_com_symbol; -extern const struct symbol_cache_entry * const bfd_und_symbol; -extern const struct symbol_cache_entry * const bfd_ind_symbol; +extern const struct bfd_symbol * const bfd_abs_symbol; +extern const struct bfd_symbol * const bfd_com_symbol; +extern const struct bfd_symbol * const bfd_und_symbol; +extern const struct bfd_symbol * const bfd_ind_symbol; #define bfd_get_section_size_before_reloc(section) \ - ((section)->reloc_done ? (abort (), (bfd_size_type) 1) \ - : (section)->_raw_size) + ((section)->_raw_size) #define bfd_get_section_size_after_reloc(section) \ ((section)->reloc_done ? (section)->_cooked_size \ : (abort (), (bfd_size_type) 1)) @@ -1477,8 +1486,8 @@ bfd_boolean bfd_set_section_size (bfd *abfd, asection *sec, bfd_size_type val); bfd_boolean bfd_set_section_contents - (bfd *abfd, asection *section, void *data, file_ptr offset, - bfd_size_type count); + (bfd *abfd, asection *section, const void *data, + file_ptr offset, bfd_size_type count); bfd_boolean bfd_get_section_contents (bfd *abfd, asection *section, void *location, file_ptr offset, @@ -1513,6 +1522,7 @@ enum bfd_architecture #define bfd_mach_mcf5206e 10 #define bfd_mach_mcf5307 11 #define bfd_mach_mcf5407 12 +#define bfd_mach_mcf528x 13 bfd_arch_vax, /* DEC Vax */ bfd_arch_i960, /* Intel 960 */ /* The order of the following is important. @@ -1577,6 +1587,7 @@ enum bfd_architecture #define bfd_mach_mipsisa32 32 #define bfd_mach_mipsisa32r2 33 #define bfd_mach_mipsisa64 64 +#define bfd_mach_mipsisa64r2 65 bfd_arch_i386, /* Intel 386 */ #define bfd_mach_i386_i386 1 #define bfd_mach_i386_i8086 2 @@ -1656,6 +1667,10 @@ enum bfd_architecture #define bfd_mach_sh3_dsp 0x3d #define bfd_mach_sh3e 0x3e #define bfd_mach_sh4 0x40 +#define bfd_mach_sh4_nofpu 0x41 +#define bfd_mach_sh4a 0x4a +#define bfd_mach_sh4a_nofpu 0x4b +#define bfd_mach_sh4al_dsp 0x4d #define bfd_mach_sh5 0x50 bfd_arch_alpha, /* Dec Alpha */ #define bfd_mach_alpha_ev4 0x10 @@ -1709,6 +1724,7 @@ enum bfd_architecture #define bfd_mach_fr400 400 #define bfd_mach_frvtomcat 499 /* fr500 prototype */ #define bfd_mach_fr500 500 +#define bfd_mach_fr550 550 bfd_arch_mcore, bfd_arch_ia64, /* HP/Intel ia64 */ #define bfd_mach_ia64_elf64 64 @@ -1845,7 +1861,7 @@ typedef enum bfd_reloc_status typedef struct reloc_cache_entry { /* A pointer into the canonical table of pointers. */ - struct symbol_cache_entry **sym_ptr_ptr; + struct bfd_symbol **sym_ptr_ptr; /* offset in section. */ bfd_size_type address; @@ -1919,7 +1935,7 @@ struct reloc_howto_struct strange relocation methods to be accomodated (e.g., i960 callj instructions). */ bfd_reloc_status_type (*special_function) - (bfd *, arelent *, struct symbol_cache_entry *, void *, asection *, + (bfd *, arelent *, struct bfd_symbol *, void *, asection *, bfd *, char **); /* The textual name of the relocation type. */ @@ -2947,6 +2963,7 @@ short offset into 11 bits. */ BFD_RELOC_MMIX_PUSHJ_1, BFD_RELOC_MMIX_PUSHJ_2, BFD_RELOC_MMIX_PUSHJ_3, + BFD_RELOC_MMIX_PUSHJ_STUBBABLE, /* These are relocations for the JMP instruction. */ BFD_RELOC_MMIX_JMP, @@ -3472,7 +3489,7 @@ const char *bfd_get_reloc_code_name (bfd_reloc_code_real_type code); /* Extracted from syms.c. */ -typedef struct symbol_cache_entry +typedef struct bfd_symbol { /* A pointer to the BFD which owns the symbol. This information is necessary so that a back end can work out what additional @@ -3584,7 +3601,7 @@ typedef struct symbol_cache_entry /* A pointer to the section to which this symbol is relative. This will always be non NULL, there are special sections for undefined and absolute symbols. */ - struct sec *section; + struct bfd_section *section; /* Back end special data. */ union @@ -3715,10 +3732,10 @@ struct bfd struct bfd_hash_table section_htab; /* Pointer to linked list of sections. */ - struct sec *sections; + struct bfd_section *sections; /* The place where we add to the section list. */ - struct sec **section_tail; + struct bfd_section **section_tail; /* The number of sections. */ unsigned int section_count; @@ -3731,7 +3748,7 @@ struct bfd unsigned int symcount; /* Symbol table for output BFD (with symcount entries). */ - struct symbol_cache_entry **outsymbols; + struct bfd_symbol **outsymbols; /* Used for slurped dynamic symbol tables. */ unsigned int dynsymcount; @@ -3964,8 +3981,8 @@ struct bfd_preserve void *tdata; flagword flags; const struct bfd_arch_info *arch_info; - struct sec *sections; - struct sec **section_tail; + struct bfd_section *sections; + struct bfd_section **section_tail; unsigned int section_count; struct bfd_hash_table section_htab; }; @@ -4205,7 +4222,7 @@ typedef struct bfd_target /* Entry points used for symbols. */ #define BFD_JUMP_TABLE_SYMBOLS(NAME) \ NAME##_get_symtab_upper_bound, \ - NAME##_get_symtab, \ + NAME##_canonicalize_symtab, \ NAME##_make_empty_symbol, \ NAME##_print_symbol, \ NAME##_get_symbol_info, \ @@ -4218,20 +4235,20 @@ typedef struct bfd_target long (*_bfd_get_symtab_upper_bound) (bfd *); long (*_bfd_canonicalize_symtab) - (bfd *, struct symbol_cache_entry **); - struct symbol_cache_entry * + (bfd *, struct bfd_symbol **); + struct bfd_symbol * (*_bfd_make_empty_symbol) (bfd *); void (*_bfd_print_symbol) - (bfd *, void *, struct symbol_cache_entry *, bfd_print_symbol_type); + (bfd *, void *, struct bfd_symbol *, bfd_print_symbol_type); #define bfd_print_symbol(b,p,s,e) BFD_SEND (b, _bfd_print_symbol, (b,p,s,e)) void (*_bfd_get_symbol_info) - (bfd *, struct symbol_cache_entry *, symbol_info *); + (bfd *, struct bfd_symbol *, symbol_info *); #define bfd_get_symbol_info(b,p,e) BFD_SEND (b, _bfd_get_symbol_info, (b,p,e)) bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *); - alent * (*_get_lineno) (bfd *, struct symbol_cache_entry *); + alent * (*_get_lineno) (bfd *, struct bfd_symbol *); bfd_boolean (*_bfd_find_nearest_line) - (bfd *, struct sec *, struct symbol_cache_entry **, bfd_vma, + (bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma, const char **, const char **, unsigned int *); /* Back-door to allow format-aware applications to create debug symbols while using BFD for everything else. Currently used by the assembler @@ -4255,7 +4272,7 @@ typedef struct bfd_target long (*_get_reloc_upper_bound) (bfd *, sec_ptr); long (*_bfd_canonicalize_reloc) - (bfd *, sec_ptr, arelent **, struct symbol_cache_entry **); + (bfd *, sec_ptr, arelent **, struct bfd_symbol **); /* See documentation on reloc types. */ reloc_howto_type * (*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type); @@ -4268,7 +4285,7 @@ typedef struct bfd_target bfd_boolean (*_bfd_set_arch_mach) (bfd *, enum bfd_architecture, unsigned long); bfd_boolean (*_bfd_set_section_contents) - (bfd *, sec_ptr, void *, file_ptr, bfd_size_type); + (bfd *, sec_ptr, const void *, file_ptr, bfd_size_type); /* Routines used by the linker. */ #define BFD_JUMP_TABLE_LINK(NAME) \ @@ -4288,10 +4305,10 @@ typedef struct bfd_target int (*_bfd_sizeof_headers) (bfd *, bfd_boolean); bfd_byte * (*_bfd_get_relocated_section_contents) (bfd *, struct bfd_link_info *, struct bfd_link_order *, - bfd_byte *, bfd_boolean, struct symbol_cache_entry **); + bfd_byte *, bfd_boolean, struct bfd_symbol **); bfd_boolean (*_bfd_relax_section) - (bfd *, struct sec *, struct bfd_link_info *, bfd_boolean *); + (bfd *, struct bfd_section *, struct bfd_link_info *, bfd_boolean *); /* Create a hash table for the linker. Different backends store different information in this table. */ @@ -4312,7 +4329,7 @@ typedef struct bfd_target bfd_boolean (*_bfd_final_link) (bfd *, struct bfd_link_info *); /* Should this section be split up into smaller pieces during linking. */ - bfd_boolean (*_bfd_link_split_section) (bfd *, struct sec *); + bfd_boolean (*_bfd_link_split_section) (bfd *, struct bfd_section *); /* Remove sections that are not referenced from the output. */ bfd_boolean (*_bfd_gc_sections) (bfd *, struct bfd_link_info *); @@ -4321,7 +4338,7 @@ typedef struct bfd_target bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *); /* Discard members of a group. */ - bfd_boolean (*_bfd_discard_group) (bfd *, struct sec *); + bfd_boolean (*_bfd_discard_group) (bfd *, struct bfd_section *); /* Routines to handle dynamic symbols and relocs. */ #define BFD_JUMP_TABLE_DYNAMIC(NAME) \ @@ -4334,12 +4351,12 @@ typedef struct bfd_target long (*_bfd_get_dynamic_symtab_upper_bound) (bfd *); /* Read in the dynamic symbols. */ long (*_bfd_canonicalize_dynamic_symtab) - (bfd *, struct symbol_cache_entry **); + (bfd *, struct bfd_symbol **); /* Get the amount of memory required to hold the dynamic relocs. */ long (*_bfd_get_dynamic_reloc_upper_bound) (bfd *); /* Read in the dynamic relocs. */ long (*_bfd_canonicalize_dynamic_reloc) - (bfd *, arelent **, struct symbol_cache_entry **); + (bfd *, arelent **, struct bfd_symbol **); /* Opposite endian version of this target. */ const struct bfd_target * alternative_target; @@ -113,10 +113,10 @@ CODE_FRAGMENT . struct bfd_hash_table section_htab; . . {* Pointer to linked list of sections. *} -. struct sec *sections; +. struct bfd_section *sections; . . {* The place where we add to the section list. *} -. struct sec **section_tail; +. struct bfd_section **section_tail; . . {* The number of sections. *} . unsigned int section_count; @@ -129,7 +129,7 @@ CODE_FRAGMENT . unsigned int symcount; . . {* Symbol table for output BFD (with symcount entries). *} -. struct symbol_cache_entry **outsymbols; +. struct bfd_symbol **outsymbols; . . {* Used for slurped dynamic symbol tables. *} . unsigned int dynsymcount; @@ -1276,8 +1276,8 @@ CODE_FRAGMENT . void *tdata; . flagword flags; . const struct bfd_arch_info *arch_info; -. struct sec *sections; -. struct sec **section_tail; +. struct bfd_section *sections; +. struct bfd_section **section_tail; . unsigned int section_count; . struct bfd_hash_table section_htab; .}; diff --git a/bfd/bfdio.c b/bfd/bfdio.c index 377622f..f99fddd 100644 --- a/bfd/bfdio.c +++ b/bfd/bfdio.c @@ -1,6 +1,6 @@ /* Low-level I/O routines for BFDs. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002 Free Software Foundation, Inc. + 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. diff --git a/bfd/bfdwin.c b/bfd/bfdwin.c index 00d1a14..fb7c967 100644 --- a/bfd/bfdwin.c +++ b/bfd/bfdwin.c @@ -1,5 +1,5 @@ /* Support for memory-mapped windows into a BFD. - Copyright 1995, 1996, 2001, 2002 Free Software Foundation, Inc. + Copyright 1995, 1996, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. diff --git a/bfd/binary.c b/bfd/binary.c index a27eb95..65f46af 100644 --- a/bfd/binary.c +++ b/bfd/binary.c @@ -1,23 +1,23 @@ /* BFD back-end for binary objects. - Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 + Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com> -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* This is a BFD backend which may be used to write binary objects. It may only be used for output, not input. The intention is that @@ -47,15 +47,16 @@ static bfd_boolean binary_get_section_contents PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); static long binary_get_symtab_upper_bound PARAMS ((bfd *)); static char *mangle_name PARAMS ((bfd *, char *)); -static long binary_get_symtab PARAMS ((bfd *, asymbol **)); +static long binary_canonicalize_symtab PARAMS ((bfd *, asymbol **)); static void binary_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *)); static bfd_boolean binary_set_section_contents - PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); + PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type)); static int binary_sizeof_headers PARAMS ((bfd *, bfd_boolean)); -/* Set by external programs - specifies the BFD architecture - to use when creating binary BFDs. */ -enum bfd_architecture bfd_external_binary_architecture = bfd_arch_unknown; +/* Set by external programs - specifies the BFD architecture and + machine number to be uses when creating binary BFDs. */ +enum bfd_architecture bfd_external_binary_architecture = bfd_arch_unknown; +unsigned long bfd_external_machine = 0; /* Create a binary object. Invoked via bfd_set_format. */ @@ -107,7 +108,8 @@ binary_object_p (abfd) { if ((bfd_get_arch_info (abfd)->arch == bfd_arch_unknown) && (bfd_external_binary_architecture != bfd_arch_unknown)) - bfd_set_arch_info (abfd, bfd_lookup_arch (bfd_external_binary_architecture, 0)); + bfd_set_arch_info (abfd, bfd_lookup_arch + (bfd_external_binary_architecture, bfd_external_machine)); } return abfd->xvec; @@ -174,7 +176,7 @@ mangle_name (abfd, suffix) /* Return the symbol table. */ static long -binary_get_symtab (abfd, alocation) +binary_canonicalize_symtab (abfd, alocation) bfd *abfd; asymbol **alocation; { @@ -254,7 +256,7 @@ static bfd_boolean binary_set_section_contents (abfd, sec, data, offset, size) bfd *abfd; asection *sec; - PTR data; + const PTR data; file_ptr offset; bfd_size_type size; { @@ -61,7 +61,7 @@ static int b_out_sizeof_headers static bfd_boolean b_out_set_arch_mach PARAMS ((bfd *, enum bfd_architecture, unsigned long)); static bfd_boolean b_out_set_section_contents - PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); + PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type)); static long b_out_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr)); static long b_out_canonicalize_reloc @@ -983,7 +983,7 @@ static bfd_boolean b_out_set_section_contents (abfd, section, location, offset, count) bfd *abfd; asection *section; - PTR location; + const PTR location; file_ptr offset; bfd_size_type count; { diff --git a/bfd/coff-apollo.c b/bfd/coff-apollo.c index cf58453..a2dd210 100644 --- a/bfd/coff-apollo.c +++ b/bfd/coff-apollo.c @@ -1,5 +1,5 @@ /* BFD back-end for Apollo 68000 COFF binaries. - Copyright 1990, 1991, 1992, 1993, 1994, 1999, 2000, 2001, 2002 + Copyright 1990, 1991, 1992, 1993, 1994, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. By Troy Rollo (troy@cbme.unsw.edu.au) Based on m68k standard COFF version Written by Cygnus Support. diff --git a/bfd/coff-h8300.c b/bfd/coff-h8300.c index bfe31c6..5cb327a 100644 --- a/bfd/coff-h8300.c +++ b/bfd/coff-h8300.c @@ -154,13 +154,20 @@ funcvec_hash_newfunc (struct bfd_hash_entry *entry, /* Bump the offset at which we store entries in the function vector. We'd like to bump up the size of the vectors section, but it's not easily available here. */ - if (bfd_get_mach (table->abfd) == bfd_mach_h8300) - table->offset += 2; - else if (bfd_get_mach (table->abfd) == bfd_mach_h8300h - || bfd_get_mach (table->abfd) == bfd_mach_h8300s) - table->offset += 4; - else - return NULL; + switch (bfd_get_mach (table->abfd)) + { + case bfd_mach_h8300: + case bfd_mach_h8300hn: + case bfd_mach_h8300sn: + table->offset += 2; + break; + case bfd_mach_h8300h: + case bfd_mach_h8300s: + table->offset += 4; + break; + default: + return NULL; + } /* Everything went OK. */ return (struct bfd_hash_entry *) ret; @@ -1096,6 +1103,7 @@ h8300_reloc16_extra_cases (bfd *abfd, struct bfd_link_info *link_info, if (symbol->flags & BSF_LOCAL) { char *new_name = bfd_malloc ((bfd_size_type) strlen (name) + 9); + if (new_name == NULL) abort (); @@ -1124,21 +1132,28 @@ h8300_reloc16_extra_cases (bfd *abfd, struct bfd_link_info *link_info, src_address++; /* Now create an entry in the function vector itself. */ - if (bfd_get_mach (input_section->owner) == bfd_mach_h8300) - bfd_put_16 (abfd, - bfd_coff_reloc16_get_value (reloc, - link_info, - input_section), - vectors_sec->contents + h->offset); - else if (bfd_get_mach (input_section->owner) == bfd_mach_h8300h - || bfd_get_mach (input_section->owner) == bfd_mach_h8300s) - bfd_put_32 (abfd, - bfd_coff_reloc16_get_value (reloc, - link_info, - input_section), - vectors_sec->contents + h->offset); - else - abort (); + switch (bfd_get_mach (input_section->owner)) + { + case bfd_mach_h8300: + case bfd_mach_h8300hn: + case bfd_mach_h8300sn: + bfd_put_16 (abfd, + bfd_coff_reloc16_get_value (reloc, + link_info, + input_section), + vectors_sec->contents + h->offset); + break; + case bfd_mach_h8300h: + case bfd_mach_h8300s: + bfd_put_32 (abfd, + bfd_coff_reloc16_get_value (reloc, + link_info, + input_section), + vectors_sec->contents + h->offset); + break; + default: + abort (); + } /* Gross. We've already written the contents of the vector section before we get here... So we write it again with the new data. */ @@ -1304,11 +1319,20 @@ h8300_bfd_link_add_symbols (bfd *abfd, struct bfd_link_info *info) /* Bump the size of the vectors section. Each vector takes 2 bytes on the h8300 and 4 bytes on the h8300h. */ - if (bfd_get_mach (abfd) == bfd_mach_h8300) - htab->vectors_sec->_raw_size += 2; - else if (bfd_get_mach (abfd) == bfd_mach_h8300h - || bfd_get_mach (abfd) == bfd_mach_h8300s) - htab->vectors_sec->_raw_size += 4; + switch (bfd_get_mach (abfd)) + { + case bfd_mach_h8300: + case bfd_mach_h8300hn: + case bfd_mach_h8300sn: + htab->vectors_sec->_raw_size += 2; + break; + case bfd_mach_h8300h: + case bfd_mach_h8300s: + htab->vectors_sec->_raw_size += 4; + break; + default: + abort (); + } } } } diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index 8ba305c..0b73bd5 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -4165,7 +4165,7 @@ const bfd_target rs6000coff_vec = /* Symbols */ coff_get_symtab_upper_bound, - coff_get_symtab, + coff_canonicalize_symtab, coff_make_empty_symbol, coff_print_symbol, coff_get_symbol_info, @@ -4407,7 +4407,7 @@ const bfd_target pmac_xcoff_vec = /* Symbols */ coff_get_symtab_upper_bound, - coff_get_symtab, + coff_canonicalize_symtab, coff_make_empty_symbol, coff_print_symbol, coff_get_symbol_info, diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c index 6b1468e..d78cc16 100644 --- a/bfd/coff-sh.c +++ b/bfd/coff-sh.c @@ -1647,6 +1647,8 @@ struct sh_opcode #define SETSAS (0x40000) #define SETSAS_REG(x) USESAS_REG (x) +#define MAP(a) a, sizeof a / sizeof a[0] + #ifndef COFF_IMAGE_WITH_PE static bfd_boolean sh_insn_uses_reg PARAMS ((unsigned int, const struct sh_opcode *, unsigned int)); @@ -1666,10 +1668,8 @@ static bfd_boolean sh_insns_conflict static bfd_boolean sh_load_use PARAMS ((unsigned int, const struct sh_opcode *, unsigned int, const struct sh_opcode *)); -#endif -/* The opcode maps. */ -#define MAP(a) a, sizeof a / sizeof a[0] +/* The opcode maps. */ static const struct sh_opcode sh_opcode00[] = { @@ -2089,7 +2089,6 @@ static const struct sh_minor_opcode sh_opcodef[] = { MAP (sh_opcodef1), 0xf0ff } }; -#ifndef COFF_IMAGE_WITH_PE static struct sh_major_opcode sh_opcodes[] = { { MAP (sh_opcode0) }, @@ -2109,7 +2108,6 @@ static struct sh_major_opcode sh_opcodes[] = { MAP (sh_opcodee) }, { MAP (sh_opcodef) } }; -#endif /* The double data transfer / parallel processing insns are not described here. This will cause sh_align_load_span to leave them alone. */ @@ -2131,7 +2129,6 @@ static const struct sh_minor_opcode sh_dsp_opcodef[] = { MAP (sh_dsp_opcodef0), 0xfc0d } }; -#ifndef COFF_IMAGE_WITH_PE /* Given an instruction, return a pointer to the corresponding sh_opcode structure. Return NULL if the instruction is not recognized. */ diff --git a/bfd/coff-sparc.c b/bfd/coff-sparc.c index acfa6d4..372b1a7 100644 --- a/bfd/coff-sparc.c +++ b/bfd/coff-sparc.c @@ -1,6 +1,6 @@ /* BFD back-end for Sparc COFF files. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2001, 2002 - Free Software Foundation, Inc. + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2001, + 2002, 2003 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. diff --git a/bfd/coff-tic54x.c b/bfd/coff-tic54x.c index fdf1b5a..5d8ccc2 100644 --- a/bfd/coff-tic54x.c +++ b/bfd/coff-tic54x.c @@ -1,5 +1,5 @@ /* BFD back-end for TMS320C54X coff binaries. - Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by Timothy Wall (twall@cygnus.com) This file is part of BFD, the Binary File Descriptor library. @@ -35,7 +35,7 @@ static void tic54x_reloc_processing static bfd_reloc_status_type tic54x_relocation PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); static bfd_boolean tic54x_set_section_contents - PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type)); + PARAMS ((bfd *, sec_ptr, const PTR, file_ptr, bfd_size_type)); static reloc_howto_type *coff_tic54x_rtype_to_howto PARAMS ((bfd *, asection *, struct internal_reloc *, struct coff_link_hash_entry *, struct internal_syment *, bfd_vma *)); static bfd_vma tic54x_getl32 @@ -345,7 +345,7 @@ static bfd_boolean tic54x_set_section_contents (abfd, section, location, offset, bytes_to_do) bfd *abfd; sec_ptr section; - PTR location; + const PTR location; file_ptr offset; bfd_size_type bytes_to_do; { diff --git a/bfd/coff-w65.c b/bfd/coff-w65.c index cc31a23..63634b7 100644 --- a/bfd/coff-w65.c +++ b/bfd/coff-w65.c @@ -1,5 +1,5 @@ /* BFD back-end for WDC 65816 COFF binaries. - Copyright 1995, 1996, 1997, 1999, 2000, 2001, 2002 + Copyright 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Steve Chamberlain, <sac@cygnus.com>. diff --git a/bfd/coff-we32k.c b/bfd/coff-we32k.c index b71df53..72fa86c 100644 --- a/bfd/coff-we32k.c +++ b/bfd/coff-we32k.c @@ -1,5 +1,5 @@ /* BFD back-end for we32k COFF files. - Copyright 1992, 1993, 1994, 1999, 2000, 2002 + Copyright 1992, 1993, 1994, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. Contributed by Brendan Kehoe (brendan@cs.widener.edu). diff --git a/bfd/coff-z8k.c b/bfd/coff-z8k.c index 3337376..15c7f9d 100644 --- a/bfd/coff-z8k.c +++ b/bfd/coff-z8k.c @@ -1,5 +1,5 @@ /* BFD back-end for Zilog Z800n COFF binaries. - Copyright 1992, 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002 + Copyright 1992, 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by Cygnus Support. Written by Steve Chamberlain, <sac@cygnus.com>. @@ -268,7 +268,7 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr) abort (); gap /= 2; - if (gap > 0 || gap < -128) + if (gap > 0 || gap < -127) { if (! ((*link_info->callbacks->reloc_overflow) (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr), @@ -295,8 +295,7 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr) if (gap & 1) abort (); - gap /= 2; - if (gap > 8191 || gap < -8192) + if (gap > 4096 || gap < -4095) { if (! ((*link_info->callbacks->reloc_overflow) (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr), @@ -304,6 +303,7 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr) input_section, reloc->address))) abort (); } + gap /= 2; bfd_put_16 (in_abfd, (bfd_get_16 ( in_abfd, data + *dst_ptr) & 0xf000) | (-gap & 0x0fff), data + *dst_ptr); diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c index c6b1803..895f96b 100644 --- a/bfd/coff64-rs6000.c +++ b/bfd/coff64-rs6000.c @@ -2706,7 +2706,7 @@ const bfd_target rs6000coff64_vec = /* Symbols */ coff_get_symtab_upper_bound, - coff_get_symtab, + coff_canonicalize_symtab, coff_make_empty_symbol, coff_print_symbol, coff_get_symbol_info, @@ -2949,7 +2949,7 @@ const bfd_target aix5coff64_vec = /* Symbols */ coff_get_symtab_upper_bound, - coff_get_symtab, + coff_canonicalize_symtab, coff_make_empty_symbol, coff_print_symbol, coff_get_symbol_info, diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 3b39f09..924bb34 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -333,7 +333,7 @@ static bfd_boolean coff_compute_section_file_positions static bfd_boolean coff_write_object_contents PARAMS ((bfd *)) ATTRIBUTE_UNUSED; static bfd_boolean coff_set_section_contents - PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); + PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type)); static PTR buy_and_read PARAMS ((bfd *, file_ptr, bfd_size_type)); static bfd_boolean coff_slurp_line_table @@ -1694,15 +1694,21 @@ coff_set_alignment_hook (abfd, section, scnhdr) struct external_reloc dst; struct internal_reloc n; file_ptr oldpos = bfd_tell (abfd); + bfd_size_type relsz = bfd_coff_relsz (abfd); + bfd_seek (abfd, (file_ptr) hdr->s_relptr, 0); - if (bfd_bread ((PTR) &dst, (bfd_size_type) bfd_coff_relsz (abfd), abfd) - != bfd_coff_relsz (abfd)) + if (bfd_bread ((PTR) &dst, relsz, abfd) != relsz) return; coff_swap_reloc_in (abfd, &dst, &n); bfd_seek (abfd, oldpos, 0); - section->reloc_count = hdr->s_nreloc = n.r_vaddr; + section->reloc_count = hdr->s_nreloc = n.r_vaddr - 1; + section->rel_filepos += relsz; } + else if (hdr->s_nreloc == 0xffff) + (*_bfd_error_handler) + ("%s: warning: claims to have 0xffff relocs, without overflow", + bfd_get_filename (abfd)); } #undef ALIGN_SET #undef ELIFALIGN_SET @@ -4265,7 +4271,7 @@ static bfd_boolean coff_set_section_contents (abfd, section, location, offset, count) bfd * abfd; sec_ptr section; - PTR location; + const PTR location; file_ptr offset; bfd_size_type count; { diff --git a/bfd/coffgen.c b/bfd/coffgen.c index fcb00fc..a712b4b 100644 --- a/bfd/coffgen.c +++ b/bfd/coffgen.c @@ -1,6 +1,6 @@ /* Support for the generic parts of COFF, for BFD. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002 + 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Cygnus Support. @@ -329,7 +329,7 @@ coff_section_from_bfd_index (abfd, index) bfd *abfd; int index; { - struct sec *answer = abfd->sections; + struct bfd_section *answer = abfd->sections; if (index == N_ABS) return bfd_abs_section_ptr; @@ -365,7 +365,7 @@ coff_get_symtab_upper_bound (abfd) /* Canonicalize a COFF symbol table. */ long -coff_get_symtab (abfd, alocation) +coff_canonicalize_symtab (abfd, alocation) bfd *abfd; asymbol **alocation; { diff --git a/bfd/cofflink.c b/bfd/cofflink.c index c1eee1b..91a3822 100644 --- a/bfd/cofflink.c +++ b/bfd/cofflink.c @@ -27,6 +27,7 @@ #include "libbfd.h" #include "coff/internal.h" #include "libcoff.h" +#include "safe-ctype.h" static bfd_boolean coff_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info); static bfd_boolean coff_link_check_archive_element (bfd *abfd, struct bfd_link_info *info, bfd_boolean *pneeded); @@ -570,19 +571,24 @@ coff_link_add_symbols (bfd *abfd, && info->hash->creator->flavour == bfd_get_flavour (abfd) && (info->strip != strip_all && info->strip != strip_debugger)) { - asection *stab, *stabstr; + asection *stabstr; - stab = bfd_get_section_by_name (abfd, ".stab"); - if (stab != NULL) - { - stabstr = bfd_get_section_by_name (abfd, ".stabstr"); + stabstr = bfd_get_section_by_name (abfd, ".stabstr"); - if (stabstr != NULL) + if (stabstr != NULL) + { + bfd_size_type string_offset = 0; + asection *stab; + + for (stab = abfd->sections; stab; stab = stab->next) + if (strncmp (".stab", stab->name, 5) == 0 + && (!stab->name[5] + || (stab->name[5] == '.' && ISDIGIT (stab->name[6])))) { struct coff_link_hash_table *table; - struct coff_section_tdata *secdata; - - secdata = coff_section_data (abfd, stab); + struct coff_section_tdata *secdata + = coff_section_data (abfd, stab); + if (secdata == NULL) { amt = sizeof (struct coff_section_tdata); @@ -596,7 +602,8 @@ coff_link_add_symbols (bfd *abfd, if (! _bfd_link_section_stabs (abfd, &table->stab_info, stab, stabstr, - &secdata->stab_info)) + &secdata->stab_info, + &string_offset)) goto error_return; } } @@ -1028,10 +1035,27 @@ _bfd_coff_final_link (bfd *abfd, bfd_coff_swap_reloc_out (abfd, irel, erel); } - if (bfd_seek (abfd, o->rel_filepos, SEEK_SET) != 0 - || (bfd_bwrite (external_relocs, - (bfd_size_type) relsz * o->reloc_count, abfd) - != (bfd_size_type) relsz * o->reloc_count)) + if (bfd_seek (abfd, o->rel_filepos, SEEK_SET) != 0) + goto error_return; + if (obj_pe (abfd) && o->reloc_count >= 0xffff) + { + /* In PE COFF, write the count of relocs as the first + reloc. The header overflow bit will be set + elsewhere. */ + struct internal_reloc incount; + bfd_byte *excount = (bfd_byte *)bfd_malloc (relsz); + + memset (&incount, 0, sizeof (incount)); + incount.r_vaddr = o->reloc_count + 1; + bfd_coff_swap_reloc_out (abfd, (PTR) &incount, (PTR) excount); + if (bfd_bwrite (excount, relsz, abfd) != relsz) + /* We'll leak, but it's an error anyway. */ + goto error_return; + free (excount); + } + if (bfd_bwrite (external_relocs, + (bfd_size_type) relsz * o->reloc_count, abfd) + != (bfd_size_type) relsz * o->reloc_count) goto error_return; } diff --git a/bfd/config.bfd b/bfd/config.bfd index b047c64..9f51538 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -199,12 +199,6 @@ case "${targ}" in targ_defvec=aout_arm_big_vec targ_selvecs=aout_arm_little_vec ;; - arm-*-vxworks*) - targ_defvec=armcoff_little_vec - targ_selvecs=armcoff_big_vec - targ_underscore=yes - targ_cflags=-DARM_COFF_BUGFIX - ;; arm-*-coff) targ_defvec=armcoff_little_vec targ_selvecs=armcoff_big_vec @@ -222,7 +216,8 @@ case "${targ}" in targ_defvec=bfd_elf32_littlearm_vec targ_selvecs=bfd_elf32_bigarm_vec ;; - arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-conix* | arm*-*-uclinux* | arm-*-kfreebsd*-gnu) + arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-conix* | \ + arm*-*-uclinux* | arm-*-kfreebsd*-gnu | arm-*-vxworks) targ_defvec=bfd_elf32_littlearm_vec targ_selvecs=bfd_elf32_bigarm_vec ;; @@ -366,11 +361,11 @@ case "${targ}" in ;; #endif - hppa*-*-linux-gnu*) + hppa*-*-linux-gnu* | hppa*-*-netbsd*) targ_defvec=bfd_elf32_hppa_linux_vec targ_selvecs=bfd_elf32_hppa_vec ;; - hppa*-*-*elf* | hppa*-*-lites* | hppa*-*-netbsd* | hppa*-*-sysv4* | hppa*-*-rtems* | hppa*-*-openbsd*) + hppa*-*-*elf* | hppa*-*-lites* | hppa*-*-sysv4* | hppa*-*-rtems* | hppa*-*-openbsd*) targ_defvec=bfd_elf32_hppa_vec targ_selvecs=bfd_elf32_hppa_linux_vec ;; @@ -461,7 +456,7 @@ case "${targ}" in targ_cflags=-DOLD_FREEBSD_ABI_LABEL ;; esac ;; - i[3-7]86-*-netbsdelf* | i[3-7]86-*-netbsd*-gnu*) + i[3-7]86-*-netbsdelf* | i[3-7]86-*-netbsd*-gnu* | i[3-7]86-*-knetbsd*-gnu) targ_defvec=bfd_elf32_i386_vec targ_selvecs=i386netbsd_vec ;; @@ -554,8 +549,8 @@ case "${targ}" in i[3-7]86-*-aout* | i[3-7]86*-*-vsta*) targ_defvec=i386aout_vec ;; - i[3-7]86-*-vxworks*) - targ_defvec=i386aout_vec + i[3-7]86-*-vxworks) + targ_defvec=bfd_elf32_i386_vec targ_underscore=yes ;; i[3-7]86-*-chaos) @@ -797,7 +792,7 @@ case "${targ}" in targ_defvec=bfd_elf32_littlemips_vec targ_selvecs="bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec" ;; - mips*-*-elf* | mips*-*-rtems* | mips*-*-vxworks*) + mips*-*-elf* | mips*-*-rtems* | mips*-*-vxworks | mips*-*-windiss) targ_defvec=bfd_elf32_bigmips_vec targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec" ;; @@ -1084,6 +1079,14 @@ case "${targ}" in targ_selvecs="shlpe_vec shlpei_vec" targ_underscore=yes ;; + sh-*-vxworks) + targ_defvec=bfd_elf32_sh_vec + targ_selvecs="bfd_elf32_shl_vec" + # FIXME None of the following are actually used on this target, but + # they're necessary for coff-sh.c (which is unconditionally used) to be + # compiled correctly. + targ_selvecs="$targ_selvecs shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec" + ;; sh-*-* | sh-*-rtems*) targ_defvec=shcoff_vec targ_selvecs="shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec" diff --git a/bfd/configure b/bfd/configure index 0d62a86..34d9bc5 100755 --- a/bfd/configure +++ b/bfd/configure @@ -778,6 +778,7 @@ fi +am__api_version="1.4" # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: @@ -790,7 +791,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:794: checking for a BSD compatible install" >&5 +echo "configure:795: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -843,7 +844,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:847: checking whether build environment is sane" >&5 +echo "configure:848: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile @@ -900,7 +901,7 @@ test "$program_suffix" != NONE && test "$program_transform_name" = "" && program_transform_name="s,x,x," echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:904: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:905: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -945,21 +946,21 @@ EOF missing_dir=`cd $ac_aux_dir && pwd` -echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 -echo "configure:950: checking for working aclocal" >&5 +echo $ac_n "checking for working aclocal-${am__api_version}""... $ac_c" 1>&6 +echo "configure:951: checking for working aclocal-${am__api_version}" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. -if (aclocal --version) < /dev/null > /dev/null 2>&1; then - ACLOCAL=aclocal +if (aclocal-${am__api_version} --version) < /dev/null > /dev/null 2>&1; then + ACLOCAL=aclocal-${am__api_version} echo "$ac_t""found" 1>&6 else - ACLOCAL="$missing_dir/missing aclocal" + ACLOCAL="$missing_dir/missing aclocal-${am__api_version}" echo "$ac_t""missing" 1>&6 fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:963: checking for working autoconf" >&5 +echo "configure:964: checking for working autoconf" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -971,21 +972,21 @@ else echo "$ac_t""missing" 1>&6 fi -echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:976: checking for working automake" >&5 +echo $ac_n "checking for working automake-${am__api_version}""... $ac_c" 1>&6 +echo "configure:977: checking for working automake-${am__api_version}" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. -if (automake --version) < /dev/null > /dev/null 2>&1; then - AUTOMAKE=automake +if (automake-${am__api_version} --version) < /dev/null > /dev/null 2>&1; then + AUTOMAKE=automake-${am__api_version} echo "$ac_t""found" 1>&6 else - AUTOMAKE="$missing_dir/missing automake" + AUTOMAKE="$missing_dir/missing automake-${am__api_version}" echo "$ac_t""missing" 1>&6 fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:989: checking for working autoheader" >&5 +echo "configure:990: checking for working autoheader" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -998,7 +999,7 @@ else fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:1002: checking for working makeinfo" >&5 +echo "configure:1003: checking for working makeinfo" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1033,7 +1034,7 @@ fi # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1037: checking for $ac_word" >&5 +echo "configure:1038: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1065,7 +1066,7 @@ fi # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1069: checking for $ac_word" >&5 +echo "configure:1070: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1097,7 +1098,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1101: checking for $ac_word" >&5 +echo "configure:1102: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1203,7 +1204,7 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1207: checking for $ac_word" >&5 +echo "configure:1208: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1233,7 +1234,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1237: checking for $ac_word" >&5 +echo "configure:1238: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1284,7 +1285,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1288: checking for $ac_word" >&5 +echo "configure:1289: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1316,7 +1317,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1320: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1321: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1327,12 +1328,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 1331 "configure" +#line 1332 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1336: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1337: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1358,12 +1359,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1362: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1363: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1367: checking whether we are using GNU C" >&5 +echo "configure:1368: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1372,7 +1373,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1376: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1377: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -1391,7 +1392,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1395: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1396: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1434,7 +1435,7 @@ ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 -echo "configure:1438: checking for ld used by GCC" >&5 +echo "configure:1439: checking for ld used by GCC" >&5 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw @@ -1464,10 +1465,10 @@ echo "configure:1438: checking for ld used by GCC" >&5 esac elif test "$with_gnu_ld" = yes; then echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 -echo "configure:1468: checking for GNU ld" >&5 +echo "configure:1469: checking for GNU ld" >&5 else echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 -echo "configure:1471: checking for non-GNU ld" >&5 +echo "configure:1472: checking for non-GNU ld" >&5 fi if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1502,7 +1503,7 @@ else fi test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 -echo "configure:1506: checking if the linker ($LD) is GNU ld" >&5 +echo "configure:1507: checking if the linker ($LD) is GNU ld" >&5 if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1519,7 +1520,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6 -echo "configure:1523: checking for $LD option to reload object files" >&5 +echo "configure:1524: checking for $LD option to reload object files" >&5 if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1531,7 +1532,7 @@ reload_flag=$lt_cv_ld_reload_flag test -n "$reload_flag" && reload_flag=" $reload_flag" echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 -echo "configure:1535: checking for BSD-compatible nm" >&5 +echo "configure:1536: checking for BSD-compatible nm" >&5 if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1569,7 +1570,7 @@ NM="$lt_cv_path_NM" echo "$ac_t""$NM" 1>&6 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1573: checking whether ln -s works" >&5 +echo "configure:1574: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1590,7 +1591,7 @@ else fi echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6 -echo "configure:1594: checking how to recognise dependant libraries" >&5 +echo "configure:1595: checking how to recognise dependant libraries" >&5 if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1763,13 +1764,13 @@ file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method echo $ac_n "checking for object suffix""... $ac_c" 1>&6 -echo "configure:1767: checking for object suffix" >&5 +echo "configure:1768: checking for object suffix" >&5 if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else rm -f conftest* echo 'int i = 1;' > conftest.$ac_ext -if { (eval echo configure:1773: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1774: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then for ac_file in conftest.*; do case $ac_file in *.c) ;; @@ -1789,7 +1790,7 @@ ac_objext=$ac_cv_objext echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:1793: checking for executable suffix" >&5 +echo "configure:1794: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1799,7 +1800,7 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:1803: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:1804: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in *.c | *.o | *.obj | *.ilk | *.pdb) ;; @@ -1826,7 +1827,7 @@ case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6 -echo "configure:1830: checking for ${ac_tool_prefix}file" >&5 +echo "configure:1831: checking for ${ac_tool_prefix}file" >&5 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1888,7 +1889,7 @@ fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then echo $ac_n "checking for file""... $ac_c" 1>&6 -echo "configure:1892: checking for file" >&5 +echo "configure:1893: checking for file" >&5 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1959,7 +1960,7 @@ esac # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1963: checking for $ac_word" >&5 +echo "configure:1964: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1991,7 +1992,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1995: checking for $ac_word" >&5 +echo "configure:1996: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2026,7 +2027,7 @@ fi # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2030: checking for $ac_word" >&5 +echo "configure:2031: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2058,7 +2059,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2062: checking for $ac_word" >&5 +echo "configure:2063: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2125,8 +2126,8 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" case $host in *-*-irix6*) # Find out which ABI we are using. - echo '#line 2129 "configure"' > conftest.$ac_ext - if { (eval echo configure:2130: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + echo '#line 2130 "configure"' > conftest.$ac_ext + if { (eval echo configure:2131: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) @@ -2159,7 +2160,7 @@ case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext - if { (eval echo configure:2163: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + if { (eval echo configure:2164: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then case "`/usr/bin/file conftest.o`" in *ELF-32*) HPUX_IA64_MODE="32" @@ -2177,7 +2178,7 @@ ia64-*-hpux*) SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 -echo "configure:2181: checking whether the C compiler needs -belf" >&5 +echo "configure:2182: checking whether the C compiler needs -belf" >&5 if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2190,14 +2191,14 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <<EOF -#line 2194 "configure" +#line 2195 "configure" #include "confdefs.h" int main() { ; return 0; } EOF -if { (eval echo configure:2201: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2202: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* lt_cv_cc_needs_belf=yes else @@ -2387,7 +2388,7 @@ if test -z "$target" ; then fi echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:2391: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:2392: checking whether to enable maintainer-specific portions of Makefiles" >&5 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" @@ -2410,7 +2411,7 @@ fi echo $ac_n "checking whether to install libbfd""... $ac_c" 1>&6 -echo "configure:2414: checking whether to install libbfd" >&5 +echo "configure:2415: checking whether to install libbfd" >&5 # Check whether --enable-install-libbfd or --disable-install-libbfd was given. if test "${enable_install_libbfd+set}" = set; then enableval="$enable_install_libbfd" @@ -2447,7 +2448,7 @@ fi echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:2451: checking for executable suffix" >&5 +echo "configure:2452: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2457,7 +2458,7 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:2461: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:2462: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in *.c | *.o | *.obj | *.ilk | *.pdb) ;; @@ -2487,7 +2488,7 @@ bfd_default_target_size=32 # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2491: checking for $ac_word" >&5 +echo "configure:2492: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2517,7 +2518,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2521: checking for $ac_word" >&5 +echo "configure:2522: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2568,7 +2569,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2572: checking for $ac_word" >&5 +echo "configure:2573: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2600,7 +2601,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2604: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:2605: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -2611,12 +2612,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 2615 "configure" +#line 2616 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:2620: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2621: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -2642,12 +2643,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2646: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2647: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:2651: checking whether we are using GNU C" >&5 +echo "configure:2652: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2656,7 +2657,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2660: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2661: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -2675,7 +2676,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:2679: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:2680: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2709,7 +2710,7 @@ fi ALL_LINGUAS="fr tr ja es sv da zh_CN" echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:2713: checking how to run the C preprocessor" >&5 +echo "configure:2714: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -2724,13 +2725,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 2728 "configure" +#line 2729 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2734: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2735: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2741,13 +2742,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 2745 "configure" +#line 2746 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2751: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2752: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2758,13 +2759,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 2762 "configure" +#line 2763 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2768: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2769: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2791,7 +2792,7 @@ echo "$ac_t""$CPP" 1>&6 # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2795: checking for $ac_word" >&5 +echo "configure:2796: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2819,12 +2820,12 @@ else fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:2823: checking for ANSI C header files" >&5 +echo "configure:2824: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2828 "configure" +#line 2829 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -2832,7 +2833,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2836: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2837: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2849,7 +2850,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 2853 "configure" +#line 2854 "configure" #include "confdefs.h" #include <string.h> EOF @@ -2867,7 +2868,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 2871 "configure" +#line 2872 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -2888,7 +2889,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 2892 "configure" +#line 2893 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -2899,7 +2900,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:2903: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2904: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -2923,12 +2924,12 @@ EOF fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:2927: checking for working const" >&5 +echo "configure:2928: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2932 "configure" +#line 2933 "configure" #include "confdefs.h" int main() { @@ -2977,7 +2978,7 @@ ccp = (char const *const *) p; ; return 0; } EOF -if { (eval echo configure:2981: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2982: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -2998,21 +2999,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:3002: checking for inline" >&5 +echo "configure:3003: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <<EOF -#line 3009 "configure" +#line 3010 "configure" #include "confdefs.h" int main() { } $ac_kw foo() { ; return 0; } EOF -if { (eval echo configure:3016: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3017: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -3038,12 +3039,12 @@ EOF esac echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:3042: checking for off_t" >&5 +echo "configure:3043: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3047 "configure" +#line 3048 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -3071,12 +3072,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:3075: checking for size_t" >&5 +echo "configure:3076: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3080 "configure" +#line 3081 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -3106,19 +3107,19 @@ fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:3110: checking for working alloca.h" >&5 +echo "configure:3111: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3115 "configure" +#line 3116 "configure" #include "confdefs.h" #include <alloca.h> int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:3122: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3123: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -3139,12 +3140,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:3143: checking for alloca" >&5 +echo "configure:3144: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3148 "configure" +#line 3149 "configure" #include "confdefs.h" #ifdef __GNUC__ @@ -3172,7 +3173,7 @@ int main() { char *p = (char *) alloca(1); ; return 0; } EOF -if { (eval echo configure:3176: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3177: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -3204,12 +3205,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:3208: checking whether alloca needs Cray hooks" >&5 +echo "configure:3209: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3213 "configure" +#line 3214 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray @@ -3234,12 +3235,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3238: checking for $ac_func" >&5 +echo "configure:3239: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3243 "configure" +#line 3244 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3262,7 +3263,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3266: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3267: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3289,7 +3290,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:3293: checking stack direction for C alloca" >&5 +echo "configure:3294: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3297,7 +3298,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <<EOF -#line 3301 "configure" +#line 3302 "configure" #include "confdefs.h" find_stack_direction () { @@ -3316,7 +3317,7 @@ main () exit (find_stack_direction() < 0); } EOF -if { (eval echo configure:3320: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3321: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -3341,17 +3342,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3345: checking for $ac_hdr" >&5 +echo "configure:3346: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3350 "configure" +#line 3351 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3355: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3356: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3380,12 +3381,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3384: checking for $ac_func" >&5 +echo "configure:3385: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3389 "configure" +#line 3390 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3408,7 +3409,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3412: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3413: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3433,7 +3434,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:3437: checking for working mmap" >&5 +echo "configure:3438: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3441,7 +3442,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <<EOF -#line 3445 "configure" +#line 3446 "configure" #include "confdefs.h" /* Thanks to Mike Haertel and Jim Avera for this test. @@ -3581,7 +3582,7 @@ main() } EOF -if { (eval echo configure:3585: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3586: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -3609,17 +3610,17 @@ unistd.h values.h sys/param.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3613: checking for $ac_hdr" >&5 +echo "configure:3614: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3618 "configure" +#line 3619 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3623: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3624: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3649,12 +3650,12 @@ done __argz_count __argz_stringify __argz_next do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3653: checking for $ac_func" >&5 +echo "configure:3654: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3658 "configure" +#line 3659 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3677,7 +3678,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3681: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3682: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3706,12 +3707,12 @@ done for ac_func in stpcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3710: checking for $ac_func" >&5 +echo "configure:3711: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3715 "configure" +#line 3716 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3734,7 +3735,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3738: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3739: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3768,19 +3769,19 @@ EOF if test $ac_cv_header_locale_h = yes; then echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:3772: checking for LC_MESSAGES" >&5 +echo "configure:3773: checking for LC_MESSAGES" >&5 if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3777 "configure" +#line 3778 "configure" #include "confdefs.h" #include <locale.h> int main() { return LC_MESSAGES ; return 0; } EOF -if { (eval echo configure:3784: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3785: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_val_LC_MESSAGES=yes else @@ -3801,7 +3802,7 @@ EOF fi fi echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 -echo "configure:3805: checking whether NLS is requested" >&5 +echo "configure:3806: checking whether NLS is requested" >&5 # Check whether --enable-nls or --disable-nls was given. if test "${enable_nls+set}" = set; then enableval="$enable_nls" @@ -3821,7 +3822,7 @@ fi EOF echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 -echo "configure:3825: checking whether included gettext is requested" >&5 +echo "configure:3826: checking whether included gettext is requested" >&5 # Check whether --with-included-gettext or --without-included-gettext was given. if test "${with_included_gettext+set}" = set; then withval="$with_included_gettext" @@ -3840,17 +3841,17 @@ fi ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 -echo "configure:3844: checking for libintl.h" >&5 +echo "configure:3845: checking for libintl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3849 "configure" +#line 3850 "configure" #include "confdefs.h" #include <libintl.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3854: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3855: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3867,19 +3868,19 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6 -echo "configure:3871: checking for gettext in libc" >&5 +echo "configure:3872: checking for gettext in libc" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3876 "configure" +#line 3877 "configure" #include "confdefs.h" #include <libintl.h> int main() { return (int) gettext ("") ; return 0; } EOF -if { (eval echo configure:3883: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3884: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gettext_libc=yes else @@ -3895,7 +3896,7 @@ echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6 if test "$gt_cv_func_gettext_libc" != "yes"; then echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6 -echo "configure:3899: checking for bindtextdomain in -lintl" >&5 +echo "configure:3900: checking for bindtextdomain in -lintl" >&5 ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3903,7 +3904,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <<EOF -#line 3907 "configure" +#line 3908 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3914,7 +3915,7 @@ int main() { bindtextdomain() ; return 0; } EOF -if { (eval echo configure:3918: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3919: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3930,19 +3931,19 @@ fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6 -echo "configure:3934: checking for gettext in libintl" >&5 +echo "configure:3935: checking for gettext in libintl" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3939 "configure" +#line 3940 "configure" #include "confdefs.h" int main() { return (int) gettext ("") ; return 0; } EOF -if { (eval echo configure:3946: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3947: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gettext_libintl=yes else @@ -3970,7 +3971,7 @@ EOF # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3974: checking for $ac_word" >&5 +echo "configure:3975: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4004,12 +4005,12 @@ fi for ac_func in dcgettext do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4008: checking for $ac_func" >&5 +echo "configure:4009: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4013 "configure" +#line 4014 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4032,7 +4033,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4036: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4037: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4059,7 +4060,7 @@ done # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4063: checking for $ac_word" >&5 +echo "configure:4064: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4095,7 +4096,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4099: checking for $ac_word" >&5 +echo "configure:4100: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4127,7 +4128,7 @@ else fi cat > conftest.$ac_ext <<EOF -#line 4131 "configure" +#line 4132 "configure" #include "confdefs.h" int main() { @@ -4135,7 +4136,7 @@ extern int _nl_msg_cat_cntr; return _nl_msg_cat_cntr ; return 0; } EOF -if { (eval echo configure:4139: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4140: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* CATOBJEXT=.gmo DATADIRNAME=share @@ -4167,7 +4168,7 @@ fi # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4171: checking for $ac_word" >&5 +echo "configure:4172: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4201,7 +4202,7 @@ fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4205: checking for $ac_word" >&5 +echo "configure:4206: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4237,7 +4238,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4241: checking for $ac_word" >&5 +echo "configure:4242: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4327,7 +4328,7 @@ fi LINGUAS= else echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 -echo "configure:4331: checking for catalogs to be installed" >&5 +echo "configure:4332: checking for catalogs to be installed" >&5 NEW_LINGUAS= for lang in ${LINGUAS=$ALL_LINGUAS}; do case "$ALL_LINGUAS" in @@ -4355,17 +4356,17 @@ echo "configure:4331: checking for catalogs to be installed" >&5 if test "$CATOBJEXT" = ".cat"; then ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6 -echo "configure:4359: checking for linux/version.h" >&5 +echo "configure:4360: checking for linux/version.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4364 "configure" +#line 4365 "configure" #include "confdefs.h" #include <linux/version.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4369: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4370: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4443,7 +4444,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:4447: checking for a BSD compatible install" >&5 +echo "configure:4448: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4501,28 +4502,21 @@ BFD_HOST_LONG_LONG=0 BFD_HOST_64_BIT_DEFINED=0 BFD_HOST_64_BIT= BFD_HOST_U_64_BIT= -if test "x${HOST_64BIT_TYPE}" = "xlong"; then - BFD_HOST_64BIT_LONG=1 -elif test "x${HOST_64BIT_TYPE}" != "x"; then - BFD_HOST_64_BIT_DEFINED=1 - BFD_HOST_64_BIT=${HOST_64BIT_TYPE} - BFD_HOST_U_64_BIT=${HOST_U_64BIT_TYPE} -fi echo $ac_n "checking for long long""... $ac_c" 1>&6 -echo "configure:4514: checking for long long" >&5 +echo "configure:4508: checking for long long" >&5 if eval "test \"`echo '$''{'bfd_cv_has_long_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4519 "configure" +#line 4513 "configure" #include "confdefs.h" int main() { unsigned long long ll = 18446744073709551615ULL; ; return 0; } EOF -if { (eval echo configure:4526: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4520: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_has_long_long=yes else @@ -4537,6 +4531,100 @@ fi echo "$ac_t""$bfd_cv_has_long_long" 1>&6 if test $bfd_cv_has_long_long = yes; then BFD_HOST_LONG_LONG=1 + echo $ac_n "checking size of long long""... $ac_c" 1>&6 +echo "configure:4536: checking size of long long" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence. + cat > conftest.$ac_ext <<EOF +#line 4542 "configure" +#include "confdefs.h" +#include "confdefs.h" +#include <sys/types.h> + + +int main() { +switch (0) case 0: case (sizeof (long long) == $ac_size):; +; return 0; } +EOF +if { (eval echo configure:4552: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_sizeof_long_long=$ac_size +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + if test x$ac_cv_sizeof_long_long != x ; then break; fi +done + +fi + +if test x$ac_cv_sizeof_long_long = x ; then + { echo "configure: error: cannot determine a size for long long" 1>&2; exit 1; } +fi +echo "$ac_t""$ac_cv_sizeof_long_long" 1>&6 +cat >> confdefs.h <<EOF +#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long +EOF + + +fi + +echo $ac_n "checking size of long""... $ac_c" 1>&6 +echo "configure:4577: checking size of long" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence. + cat > conftest.$ac_ext <<EOF +#line 4583 "configure" +#include "confdefs.h" +#include "confdefs.h" +#include <sys/types.h> + + +int main() { +switch (0) case 0: case (sizeof (long) == $ac_size):; +; return 0; } +EOF +if { (eval echo configure:4593: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_sizeof_long=$ac_size +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + if test x$ac_cv_sizeof_long != x ; then break; fi +done + +fi + +if test x$ac_cv_sizeof_long = x ; then + { echo "configure: error: cannot determine a size for long" 1>&2; exit 1; } +fi +echo "$ac_t""$ac_cv_sizeof_long" 1>&6 +cat >> confdefs.h <<EOF +#define SIZEOF_LONG $ac_cv_sizeof_long +EOF + + +if test "x${ac_cv_sizeof_long}" = "x8"; then + host64=true + HOST_64BIT_TYPE="long" +elif test "x${ac_cv_sizeof_long_long}" = "x8"; then + HOST_64BIT_TYPE="long long" + HOST_U_64BIT_TYPE="unsigned long long" +fi + +if test "x${HOST_64BIT_TYPE}" = "xlong"; then + BFD_HOST_64BIT_LONG=1 +elif test "x${HOST_64BIT_TYPE}" != "x"; then + BFD_HOST_64_BIT_DEFINED=1 + BFD_HOST_64_BIT=${HOST_64BIT_TYPE} + BFD_HOST_U_64_BIT=${HOST_U_64BIT_TYPE} fi @@ -4559,7 +4647,7 @@ if test "x$cross_compiling" = "xno"; then EXEEXT_FOR_BUILD='$(EXEEXT)' else echo $ac_n "checking for build system executable suffix""... $ac_c" 1>&6 -echo "configure:4563: checking for build system executable suffix" >&5 +echo "configure:4651: checking for build system executable suffix" >&5 if eval "test \"`echo '$''{'bfd_cv_build_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4587,17 +4675,17 @@ for ac_hdr in stddef.h string.h strings.h stdlib.h time.h unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4591: checking for $ac_hdr" >&5 +echo "configure:4679: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4596 "configure" +#line 4684 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4601: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4689: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4627,17 +4715,17 @@ for ac_hdr in fcntl.h sys/file.h sys/time.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4631: checking for $ac_hdr" >&5 +echo "configure:4719: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4636 "configure" +#line 4724 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4641: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4729: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4664,12 +4752,12 @@ fi done echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:4668: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:4756: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4673 "configure" +#line 4761 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/time.h> @@ -4678,7 +4766,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:4682: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4770: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -4703,12 +4791,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:4707: checking for $ac_hdr that defines DIR" >&5 +echo "configure:4795: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4712 "configure" +#line 4800 "configure" #include "confdefs.h" #include <sys/types.h> #include <$ac_hdr> @@ -4716,7 +4804,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:4720: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4808: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -4741,7 +4829,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:4745: checking for opendir in -ldir" >&5 +echo "configure:4833: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4749,7 +4837,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <<EOF -#line 4753 "configure" +#line 4841 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4760,7 +4848,7 @@ int main() { opendir() ; return 0; } EOF -if { (eval echo configure:4764: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4852: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4782,7 +4870,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:4786: checking for opendir in -lx" >&5 +echo "configure:4874: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4790,7 +4878,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <<EOF -#line 4794 "configure" +#line 4882 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4801,7 +4889,7 @@ int main() { opendir() ; return 0; } EOF -if { (eval echo configure:4805: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4893: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4826,12 +4914,12 @@ fi for ac_func in fcntl getpagesize setitimer sysconf fdopen getuid getgid do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4830: checking for $ac_func" >&5 +echo "configure:4918: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4835 "configure" +#line 4923 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4854,7 +4942,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4858: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4946: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4881,12 +4969,12 @@ done for ac_func in strtoull do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4885: checking for $ac_func" >&5 +echo "configure:4973: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4890 "configure" +#line 4978 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4909,7 +4997,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4913: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5001: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4944,12 +5032,12 @@ EOF esac echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6 -echo "configure:4948: checking whether strstr must be declared" >&5 +echo "configure:5036: checking whether strstr must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_strstr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4953 "configure" +#line 5041 "configure" #include "confdefs.h" #include <stdio.h> @@ -4970,7 +5058,7 @@ int main() { char *(*pfn) = (char *(*)) strstr ; return 0; } EOF -if { (eval echo configure:4974: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5062: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strstr=no else @@ -4991,12 +5079,12 @@ EOF fi echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6 -echo "configure:4995: checking whether malloc must be declared" >&5 +echo "configure:5083: checking whether malloc must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_malloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5000 "configure" +#line 5088 "configure" #include "confdefs.h" #include <stdio.h> @@ -5017,7 +5105,7 @@ int main() { char *(*pfn) = (char *(*)) malloc ; return 0; } EOF -if { (eval echo configure:5021: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5109: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_malloc=no else @@ -5038,12 +5126,12 @@ EOF fi echo $ac_n "checking whether realloc must be declared""... $ac_c" 1>&6 -echo "configure:5042: checking whether realloc must be declared" >&5 +echo "configure:5130: checking whether realloc must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_realloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5047 "configure" +#line 5135 "configure" #include "confdefs.h" #include <stdio.h> @@ -5064,7 +5152,7 @@ int main() { char *(*pfn) = (char *(*)) realloc ; return 0; } EOF -if { (eval echo configure:5068: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5156: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_realloc=no else @@ -5085,12 +5173,12 @@ EOF fi echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6 -echo "configure:5089: checking whether free must be declared" >&5 +echo "configure:5177: checking whether free must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_free'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5094 "configure" +#line 5182 "configure" #include "confdefs.h" #include <stdio.h> @@ -5111,7 +5199,7 @@ int main() { char *(*pfn) = (char *(*)) free ; return 0; } EOF -if { (eval echo configure:5115: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5203: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_free=no else @@ -5132,12 +5220,12 @@ EOF fi echo $ac_n "checking whether getenv must be declared""... $ac_c" 1>&6 -echo "configure:5136: checking whether getenv must be declared" >&5 +echo "configure:5224: checking whether getenv must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_getenv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5141 "configure" +#line 5229 "configure" #include "confdefs.h" #include <stdio.h> @@ -5158,7 +5246,7 @@ int main() { char *(*pfn) = (char *(*)) getenv ; return 0; } EOF -if { (eval echo configure:5162: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5250: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_getenv=no else @@ -5230,7 +5318,7 @@ if test "${target}" = "${host}"; then COREFILE='' TRAD_HEADER='"hosts/i386bsd.h"' ;; - i[3-7]86-*-netbsd* | i[3-7]86-*-openbsd*) + i[3-7]86-*-netbsd* | i[3-7]86-*-knetbsd*-gnu | i[3-7]86-*-openbsd*) COREFILE=netbsd-core.lo ;; i[3-7]86-esix-sysv3*) @@ -5346,16 +5434,16 @@ if test "${target}" = "${host}"; then # Not all versions of AIX with -DAIX_CORE_DUMPX_CORE # have c_impl as a member of struct core_dumpx echo $ac_n "checking for c_impl in struct core_dumpx""... $ac_c" 1>&6 -echo "configure:5350: checking for c_impl in struct core_dumpx" >&5 +echo "configure:5438: checking for c_impl in struct core_dumpx" >&5 cat > conftest.$ac_ext <<EOF -#line 5352 "configure" +#line 5440 "configure" #include "confdefs.h" #include <core.h> int main() { struct core_dumpx c; c.c_impl = 0; ; return 0; } EOF -if { (eval echo configure:5359: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5447: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_ST_C_IMPL 1 @@ -5426,17 +5514,17 @@ rm -f conftest* do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5430: checking for $ac_hdr" >&5 +echo "configure:5518: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5435 "configure" +#line 5523 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5440: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5528: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5464,12 +5552,12 @@ done if test "$ac_cv_header_sys_procfs_h" = yes; then echo $ac_n "checking for prstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5468: checking for prstatus_t in sys/procfs.h" >&5 +echo "configure:5556: checking for prstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5473 "configure" +#line 5561 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5478,7 +5566,7 @@ int main() { prstatus_t avar ; return 0; } EOF -if { (eval echo configure:5482: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5570: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prstatus_t=yes else @@ -5500,12 +5588,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus_t" 1>&6 echo $ac_n "checking for prstatus32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5504: checking for prstatus32_t in sys/procfs.h" >&5 +echo "configure:5592: checking for prstatus32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prstatus32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5509 "configure" +#line 5597 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5514,7 +5602,7 @@ int main() { prstatus32_t avar ; return 0; } EOF -if { (eval echo configure:5518: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5606: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prstatus32_t=yes else @@ -5536,12 +5624,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus32_t" 1>&6 echo $ac_n "checking for prstatus_t.pr_who in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5540: checking for prstatus_t.pr_who in sys/procfs.h" >&5 +echo "configure:5628: checking for prstatus_t.pr_who in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5545 "configure" +#line 5633 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5550,7 +5638,7 @@ int main() { prstatus_t avar; void* aref = (void*) &avar.pr_who ; return 0; } EOF -if { (eval echo configure:5554: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5642: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who=yes else @@ -5572,12 +5660,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who" 1>&6 echo $ac_n "checking for prstatus32_t.pr_who in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5576: checking for prstatus32_t.pr_who in sys/procfs.h" >&5 +echo "configure:5664: checking for prstatus32_t.pr_who in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5581 "configure" +#line 5669 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5586,7 +5674,7 @@ int main() { prstatus32_t avar; void* aref = (void*) &avar.pr_who ; return 0; } EOF -if { (eval echo configure:5590: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5678: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who=yes else @@ -5608,12 +5696,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who" 1>&6 echo $ac_n "checking for pstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5612: checking for pstatus_t in sys/procfs.h" >&5 +echo "configure:5700: checking for pstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5617 "configure" +#line 5705 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5622,7 +5710,7 @@ int main() { pstatus_t avar ; return 0; } EOF -if { (eval echo configure:5626: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5714: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pstatus_t=yes else @@ -5644,12 +5732,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus_t" 1>&6 echo $ac_n "checking for pxstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5648: checking for pxstatus_t in sys/procfs.h" >&5 +echo "configure:5736: checking for pxstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pxstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5653 "configure" +#line 5741 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5658,7 +5746,7 @@ int main() { pxstatus_t avar ; return 0; } EOF -if { (eval echo configure:5662: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5750: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pxstatus_t=yes else @@ -5680,12 +5768,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pxstatus_t" 1>&6 echo $ac_n "checking for pstatus32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5684: checking for pstatus32_t in sys/procfs.h" >&5 +echo "configure:5772: checking for pstatus32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5689 "configure" +#line 5777 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5694,7 +5782,7 @@ int main() { pstatus32_t avar ; return 0; } EOF -if { (eval echo configure:5698: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5786: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pstatus32_t=yes else @@ -5716,12 +5804,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus32_t" 1>&6 echo $ac_n "checking for prpsinfo_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5720: checking for prpsinfo_t in sys/procfs.h" >&5 +echo "configure:5808: checking for prpsinfo_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prpsinfo_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5725 "configure" +#line 5813 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5730,7 +5818,7 @@ int main() { prpsinfo_t avar ; return 0; } EOF -if { (eval echo configure:5734: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5822: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prpsinfo_t=yes else @@ -5752,12 +5840,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo_t" 1>&6 echo $ac_n "checking for prpsinfo32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5756: checking for prpsinfo32_t in sys/procfs.h" >&5 +echo "configure:5844: checking for prpsinfo32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prpsinfo32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5761 "configure" +#line 5849 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5766,7 +5854,7 @@ int main() { prpsinfo32_t avar ; return 0; } EOF -if { (eval echo configure:5770: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5858: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prpsinfo32_t=yes else @@ -5788,12 +5876,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo32_t" 1>&6 echo $ac_n "checking for psinfo_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5792: checking for psinfo_t in sys/procfs.h" >&5 +echo "configure:5880: checking for psinfo_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psinfo_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5797 "configure" +#line 5885 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5802,7 +5890,7 @@ int main() { psinfo_t avar ; return 0; } EOF -if { (eval echo configure:5806: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5894: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_psinfo_t=yes else @@ -5824,12 +5912,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo_t" 1>&6 echo $ac_n "checking for psinfo32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5828: checking for psinfo32_t in sys/procfs.h" >&5 +echo "configure:5916: checking for psinfo32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psinfo32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5833 "configure" +#line 5921 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5838,7 +5926,7 @@ int main() { psinfo32_t avar ; return 0; } EOF -if { (eval echo configure:5842: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5930: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_psinfo32_t=yes else @@ -5860,12 +5948,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo32_t" 1>&6 echo $ac_n "checking for lwpstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5864: checking for lwpstatus_t in sys/procfs.h" >&5 +echo "configure:5952: checking for lwpstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5869 "configure" +#line 5957 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5874,7 +5962,7 @@ int main() { lwpstatus_t avar ; return 0; } EOF -if { (eval echo configure:5878: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5966: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_lwpstatus_t=yes else @@ -5896,12 +5984,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpstatus_t" 1>&6 echo $ac_n "checking for lwpxstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5900: checking for lwpxstatus_t in sys/procfs.h" >&5 +echo "configure:5988: checking for lwpxstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpxstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5905 "configure" +#line 5993 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5910,7 +5998,7 @@ int main() { lwpxstatus_t avar ; return 0; } EOF -if { (eval echo configure:5914: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6002: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_lwpxstatus_t=yes else @@ -5932,12 +6020,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpxstatus_t" 1>&6 echo $ac_n "checking for lwpstatus_t.pr_context in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5936: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5 +echo "configure:6024: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5941 "configure" +#line 6029 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5946,7 +6034,7 @@ int main() { lwpstatus_t avar; void* aref = (void*) &avar.pr_context ; return 0; } EOF -if { (eval echo configure:5950: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6038: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context=yes else @@ -5968,12 +6056,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context" 1>&6 echo $ac_n "checking for lwpstatus_t.pr_reg in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5972: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5 +echo "configure:6060: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5977 "configure" +#line 6065 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5982,7 +6070,7 @@ int main() { lwpstatus_t avar; void* aref = (void*) &avar.pr_reg ; return 0; } EOF -if { (eval echo configure:5986: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6074: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg=yes else @@ -6004,12 +6092,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg" 1>&6 echo $ac_n "checking for win32_pstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:6008: checking for win32_pstatus_t in sys/procfs.h" >&5 +echo "configure:6096: checking for win32_pstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_win32_pstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6013 "configure" +#line 6101 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -6018,7 +6106,7 @@ int main() { win32_pstatus_t avar ; return 0; } EOF -if { (eval echo configure:6022: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6110: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_win32_pstatus_t=yes else @@ -6487,10 +6575,10 @@ case ${host64}-${target64}-${want64} in if test -n "$GCC" ; then bad_64bit_gcc=no; echo $ac_n "checking for gcc version with buggy 64-bit support""... $ac_c" 1>&6 -echo "configure:6491: checking for gcc version with buggy 64-bit support" >&5 +echo "configure:6579: checking for gcc version with buggy 64-bit support" >&5 # Add more tests for gcc versions with non-working 64-bit support here. cat > conftest.$ac_ext <<EOF -#line 6494 "configure" +#line 6582 "configure" #include "confdefs.h" :__GNUC__:__GNUC_MINOR__:__i386__: EOF @@ -6536,17 +6624,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6540: checking for $ac_hdr" >&5 +echo "configure:6628: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6545 "configure" +#line 6633 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6550: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6638: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6575,12 +6663,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6579: checking for $ac_func" >&5 +echo "configure:6667: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6584 "configure" +#line 6672 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6603,7 +6691,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6607: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6695: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6628,7 +6716,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:6632: checking for working mmap" >&5 +echo "configure:6720: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6636,7 +6724,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <<EOF -#line 6640 "configure" +#line 6728 "configure" #include "confdefs.h" /* Thanks to Mike Haertel and Jim Avera for this test. @@ -6776,7 +6864,7 @@ main() } EOF -if { (eval echo configure:6780: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6868: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -6801,12 +6889,12 @@ fi for ac_func in madvise mprotect do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6805: checking for $ac_func" >&5 +echo "configure:6893: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6810 "configure" +#line 6898 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6829,7 +6917,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6833: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6921: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else diff --git a/bfd/configure.host b/bfd/configure.host index c9aa356..69eb17a 100644 --- a/bfd/configure.host +++ b/bfd/configure.host @@ -19,22 +19,17 @@ HOST_U_64BIT_TYPE= case "${host}" in -alpha*-*-*) host64=true; HOST_64BIT_TYPE=long ;; - -hppa*64*-*-hpux*) HDEFINES=-DHOST_HPPAHPUX; - host64=true; HOST_64BIT_TYPE=long ;; hppa*-*-hpux*) HDEFINES=-DHOST_HPPAHPUX ;; hppa*-*-hiux*) HDEFINES=-DHOST_HPPAHPUX ;; -hppa*64*-*-linux*) host64=true; HOST_64BIT_TYPE=long ;; hppa*-*-mpeix*) HDEFINES=-DHOST_HPPAMPEIX ;; hppa*-*-bsd*) HDEFINES=-DHOST_HPPABSD ;; hppa*-*-osf*) HDEFINES=-DHOST_HPPAOSF ;; -ia64-*-linux*) host64=true; HOST_64BIT_TYPE=long ;; -ia64-*-hpux*) host64=true - HOST_64BIT_TYPE="long long"; - HOST_U_64BIT_TYPE="unsigned long long"; - ;; +ia64-*-*) host64=true;; + +# Workaround for limitations on win9x where file contents are +# not zero'd out if you seek past the end and then write. +i[3-7]86-*-mingw32*) HDEFINES=-D__USE_MINGW_FSEEK;; i[3-7]86-sequent-bsd*) HDEFINES=-Dshared=genshared ;; i[3-7]86-sequent-sysv4*) ;; @@ -45,28 +40,14 @@ mips*-*-openbsd*) ;; mips*-dec-*) HDEFINES="-G 4" ;; mips*-sgi-irix3*) HDEFINES="-G 4" ;; mips*-sgi-irix4*) HDEFINES="-G 4" ;; -mips*-sgi-irix6*) host64=true - HOST_64BIT_TYPE="long long"; - HOST_U_64BIT_TYPE="unsigned long long"; - ;; -mips64*-*-linux*) host64=true - HOST_64BIT_TYPE="long long"; - HOST_U_64BIT_TYPE="unsigned long long"; - ;; +mips*-sgi-irix6*) host64=true;; +mips64*-*-linux*) host64=true;; mips*-*-sysv4*) ;; mips*-*-sysv*) HDEFINES="-G 4" ;; mips*-*-riscos*) HDEFINES="-G 4" ;; m68*-hp-hpux*) HDEFINES=-DHOST_HP300HPUX ;; -*-*-aix*) HOST_64BIT_TYPE="long long" - HOST_U_64BIT_TYPE="unsigned long long" - ;; - -*-*-solaris*) HOST_64BIT_TYPE="long long" - HOST_U_64BIT_TYPE="unsigned long long" - ;; - *-*-windows*) HOST_64BIT_TYPE=__int64 HOST_U_64BIT_TYPE="unsigned __int64" diff --git a/bfd/configure.in b/bfd/configure.in index b3a6e68..35ba4e2 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -117,13 +117,6 @@ BFD_HOST_LONG_LONG=0 BFD_HOST_64_BIT_DEFINED=0 BFD_HOST_64_BIT= BFD_HOST_U_64_BIT= -if test "x${HOST_64BIT_TYPE}" = "xlong"; then - BFD_HOST_64BIT_LONG=1 -elif test "x${HOST_64BIT_TYPE}" != "x"; then - BFD_HOST_64_BIT_DEFINED=1 - BFD_HOST_64_BIT=${HOST_64BIT_TYPE} - BFD_HOST_U_64_BIT=${HOST_U_64BIT_TYPE} -fi AC_MSG_CHECKING([for long long]) AC_CACHE_VAL(bfd_cv_has_long_long, @@ -133,6 +126,24 @@ bfd_cv_has_long_long=yes, bfd_cv_has_long_long=no)]) AC_MSG_RESULT($bfd_cv_has_long_long) if test $bfd_cv_has_long_long = yes; then BFD_HOST_LONG_LONG=1 + AC_COMPILE_CHECK_SIZEOF(long long) +fi + +AC_COMPILE_CHECK_SIZEOF(long) +if test "x${ac_cv_sizeof_long}" = "x8"; then + host64=true + HOST_64BIT_TYPE="long" +elif test "x${ac_cv_sizeof_long_long}" = "x8"; then + HOST_64BIT_TYPE="long long" + HOST_U_64BIT_TYPE="unsigned long long" +fi + +if test "x${HOST_64BIT_TYPE}" = "xlong"; then + BFD_HOST_64BIT_LONG=1 +elif test "x${HOST_64BIT_TYPE}" != "x"; then + BFD_HOST_64_BIT_DEFINED=1 + BFD_HOST_64_BIT=${HOST_64BIT_TYPE} + BFD_HOST_U_64_BIT=${HOST_U_64BIT_TYPE} fi AC_SUBST(BFD_HOST_64BIT_LONG) @@ -220,7 +231,7 @@ changequote([,])dnl TRAD_HEADER='"hosts/i386bsd.h"' ;; changequote(,)dnl - i[3-7]86-*-netbsd* | i[3-7]86-*-openbsd*) + i[3-7]86-*-netbsd* | i[3-7]86-*-knetbsd*-gnu | i[3-7]86-*-openbsd*) changequote([,])dnl COREFILE=netbsd-core.lo ;; diff --git a/bfd/cpu-frv.c b/bfd/cpu-frv.c index 8589144..f911881 100644 --- a/bfd/cpu-frv.c +++ b/bfd/cpu-frv.c @@ -1,5 +1,5 @@ /* BFD support for the FRV processor. - Copyright 2002 Free Software Foundation, Inc. + Copyright 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -46,8 +46,11 @@ static const bfd_arch_info_type arch_info_400 static const bfd_arch_info_type arch_info_500 = FRV_ARCH (bfd_mach_fr500, "fr500", FALSE, &arch_info_400); +static const bfd_arch_info_type arch_info_550 + = FRV_ARCH (bfd_mach_fr550, "fr550", FALSE, &arch_info_500); + static const bfd_arch_info_type arch_info_simple - = FRV_ARCH (bfd_mach_frvsimple, "simple", FALSE, &arch_info_500); + = FRV_ARCH (bfd_mach_frvsimple, "simple", FALSE, &arch_info_550); static const bfd_arch_info_type arch_info_tomcat = FRV_ARCH (bfd_mach_frvtomcat, "tomcat", FALSE, &arch_info_simple); diff --git a/bfd/cpu-h8300.c b/bfd/cpu-h8300.c index 1a4f4d7..5907de0 100644 --- a/bfd/cpu-h8300.c +++ b/bfd/cpu-h8300.c @@ -23,11 +23,6 @@ #include "sysdep.h" #include "libbfd.h" -static bfd_boolean h8300_scan - (const struct bfd_arch_info *, const char *); -static const bfd_arch_info_type * compatible - (const bfd_arch_info_type *, const bfd_arch_info_type *); - static bfd_boolean h8300_scan (const struct bfd_arch_info *info, const char *string) { @@ -111,7 +106,7 @@ compatible (const bfd_arch_info_type *in, const bfd_arch_info_type *out) static const bfd_arch_info_type h8300sxn_info_struct = { 32, /* 32 bits in a word */ - 32, /* 32 bits in an address */ + 16, /* 16 bits in an address */ 8, /* 8 bits in a byte */ bfd_arch_h8300, bfd_mach_h8300sxn, @@ -143,7 +138,7 @@ static const bfd_arch_info_type h8300sx_info_struct = static const bfd_arch_info_type h8300sn_info_struct = { 32, /* 32 bits in a word. */ - 32, /* 32 bits in an address. */ + 16, /* 16 bits in an address. */ 8, /* 8 bits in a byte. */ bfd_arch_h8300, bfd_mach_h8300sn, @@ -156,11 +151,10 @@ static const bfd_arch_info_type h8300sn_info_struct = &h8300sx_info_struct }; - static const bfd_arch_info_type h8300hn_info_struct = { 32, /* 32 bits in a word. */ - 32, /* 32 bits in an address. */ + 16, /* 16 bits in an address. */ 8, /* 8 bits in a byte. */ bfd_arch_h8300, bfd_mach_h8300hn, diff --git a/bfd/cpu-h8500.c b/bfd/cpu-h8500.c index 08fb359..fe05df5 100644 --- a/bfd/cpu-h8500.c +++ b/bfd/cpu-h8500.c @@ -1,5 +1,6 @@ /* BFD library support routines for the H8/500 architecture. - Copyright 1993, 1995, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1993, 1995, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. Hacked by Steve Chamberlain of Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -35,7 +36,7 @@ howto16_callback (abfd, reloc_entry, symbol_in, data, ignore_input_section, ignore_bfd) bfd *abfd; arelent *reloc_entry; - struct symbol_cache_entry *symbol_in; + struct bfd_symbol *symbol_in; PTR data; asection *ignore_input_section; bfd *ignore_bfd; @@ -57,7 +58,7 @@ howto8_callback (abfd, reloc_entry, symbol_in, data, ignore_input_section, ignore_bfd) bfd *abfd; arelent *reloc_entry; - struct symbol_cache_entry *symbol_in; + struct bfd_symbol *symbol_in; PTR data; asection *ignore_input_section; bfd *ignore_bfd; @@ -79,7 +80,7 @@ howto8_FFnn_callback (abfd, reloc_entry, symbol_in, data, ignore_input_section, ignore_bfd) bfd *abfd; arelent *reloc_entry; - struct symbol_cache_entry *symbol_in; + struct bfd_symbol *symbol_in; PTR data; asection *ignore_input_section; bfd *ignore_bfd; @@ -102,7 +103,7 @@ howto8_pcrel_callback (abfd, reloc_entry, symbol_in, data, ignore_input_section, ignore_bfd) bfd *abfd; arelent *reloc_entry; - struct symbol_cache_entry *symbol_in; + struct bfd_symbol *symbol_in; PTR data; asection *ignore_input_section; bfd *ignore_bfd; diff --git a/bfd/cpu-hppa.c b/bfd/cpu-hppa.c index 250c630..de5de7e 100644 --- a/bfd/cpu-hppa.c +++ b/bfd/cpu-hppa.c @@ -1,5 +1,5 @@ /* BFD support for the HP Precision Architecture architecture. - Copyright 1992, 1995, 1998, 1999, 2000, 2002 + Copyright 1992, 1995, 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. diff --git a/bfd/cpu-ia64-opc.c b/bfd/cpu-ia64-opc.c index 3cafb9f..740c2ee 100644 --- a/bfd/cpu-ia64-opc.c +++ b/bfd/cpu-ia64-opc.c @@ -1,4 +1,5 @@ -/* Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc. +/* Copyright 1998, 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. Contributed by David Mosberger-Tang <davidm@hpl.hp.com> This file is part of BFD, the Binary File Descriptor library. diff --git a/bfd/cpu-iq2000.c b/bfd/cpu-iq2000.c index fd6d230..4545f30 100644 --- a/bfd/cpu-iq2000.c +++ b/bfd/cpu-iq2000.c @@ -23,18 +23,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ static const bfd_arch_info_type arch_info_struct[] = { - 32, /* bits per word */ - 32, /* bits per address */ - 8, /* bits per byte */ - bfd_arch_iq2000, /* architecture */ - bfd_mach_iq10, /* machine */ - "iq2000", /* architecture name */ - "iq10", /* printable name */ - 3, /* section align power */ - FALSE, /* the default ? */ - bfd_default_compatible, /* architecture comparison fn */ - bfd_default_scan, /* string to architecture convert fn */ - NULL /* next in list */ + { + 32, /* bits per word */ + 32, /* bits per address */ + 8, /* bits per byte */ + bfd_arch_iq2000, /* architecture */ + bfd_mach_iq10, /* machine */ + "iq2000", /* architecture name */ + "iq10", /* printable name */ + 3, /* section align power */ + FALSE, /* the default ? */ + bfd_default_compatible, /* architecture comparison fn */ + bfd_default_scan, /* string to architecture convert fn */ + NULL /* next in list */ + } }; const bfd_arch_info_type bfd_iq2000_arch = @@ -52,6 +54,3 @@ const bfd_arch_info_type bfd_iq2000_arch = bfd_default_scan, /* string to architecture convert fn */ &arch_info_struct[0], /* next in list */ }; - - - diff --git a/bfd/cpu-m10300.c b/bfd/cpu-m10300.c index 2de9cd1..76e40fd 100644 --- a/bfd/cpu-m10300.c +++ b/bfd/cpu-m10300.c @@ -1,5 +1,5 @@ /* BFD support for the Matsushita 10300 processor - Copyright 1996, 1997, 1999, 2002 Free Software Foundation, Inc. + Copyright 1996, 1997, 1999, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. diff --git a/bfd/cpu-m68k.c b/bfd/cpu-m68k.c index 1648340..71c7029 100644 --- a/bfd/cpu-m68k.c +++ b/bfd/cpu-m68k.c @@ -1,23 +1,23 @@ /* BFD library support routines for architectures. - Copyright 1990, 1991, 1992, 1993, 1994, 1997, 1998, 2000, 2001, 2002 - Free Software Foundation, Inc. + Copyright 1990, 1991, 1992, 1993, 1994, 1997, 1998, 2000, 2001, 2002, + 2003 Free Software Foundation, Inc. Hacked by Steve Chamberlain of Cygnus Support. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" @@ -28,18 +28,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ static const bfd_arch_info_type arch_info_struct[] = { - N(bfd_mach_m68000, "m68k:68000", FALSE, &arch_info_struct[1]), - N(bfd_mach_m68008, "m68k:68008", FALSE, &arch_info_struct[2]), - N(bfd_mach_m68010, "m68k:68010", FALSE, &arch_info_struct[3]), - N(bfd_mach_m68020, "m68k:68020", FALSE, &arch_info_struct[4]), - N(bfd_mach_m68030, "m68k:68030", FALSE, &arch_info_struct[5]), - N(bfd_mach_m68040, "m68k:68040", FALSE, &arch_info_struct[6]), - N(bfd_mach_cpu32, "m68k:cpu32", FALSE, &arch_info_struct[7]), - N(bfd_mach_mcf5200,"m68k:5200", FALSE, &arch_info_struct[8]), - N(bfd_mach_mcf5206e,"m68k:5206e",FALSE, &arch_info_struct[9]), - N(bfd_mach_mcf5307, "m68k:5307", FALSE, &arch_info_struct[10]), - N(bfd_mach_mcf5407, "m68k:5407", FALSE, &arch_info_struct[11]), - N(bfd_mach_m68060, "m68k:68060", FALSE, 0), + N(bfd_mach_m68000, "m68k:68000", FALSE, &arch_info_struct[1]), + N(bfd_mach_m68008, "m68k:68008", FALSE, &arch_info_struct[2]), + N(bfd_mach_m68010, "m68k:68010", FALSE, &arch_info_struct[3]), + N(bfd_mach_m68020, "m68k:68020", FALSE, &arch_info_struct[4]), + N(bfd_mach_m68030, "m68k:68030", FALSE, &arch_info_struct[5]), + N(bfd_mach_m68040, "m68k:68040", FALSE, &arch_info_struct[6]), + N(bfd_mach_cpu32, "m68k:cpu32", FALSE, &arch_info_struct[7]), + N(bfd_mach_mcf5200, "m68k:5200", FALSE, &arch_info_struct[8]), + N(bfd_mach_mcf5206e,"m68k:5206e", FALSE, &arch_info_struct[9]), + N(bfd_mach_mcf5307, "m68k:5307", FALSE, &arch_info_struct[10]), + N(bfd_mach_mcf5407, "m68k:5407", FALSE, &arch_info_struct[11]), + N(bfd_mach_m68060, "m68k:68060", FALSE, &arch_info_struct[12]), + N(bfd_mach_mcf528x, "m68k:528x", FALSE, 0), }; const bfd_arch_info_type bfd_m68k_arch = diff --git a/bfd/cpu-mips.c b/bfd/cpu-mips.c index e64ee06..1d56dff 100644 --- a/bfd/cpu-mips.c +++ b/bfd/cpu-mips.c @@ -1,6 +1,6 @@ /* bfd back-end for mips support - Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2002 - Free Software Foundation, Inc. + Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001, + 2002, 2003 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -85,6 +85,7 @@ enum I_mipsisa32, I_mipsisa32r2, I_mipsisa64, + I_mipsisa64r2, I_sb1, }; @@ -116,6 +117,7 @@ static const bfd_arch_info_type arch_info_struct[] = N (32, 32, bfd_mach_mipsisa32, "mips:isa32", FALSE, NN(I_mipsisa32)), N (32, 32, bfd_mach_mipsisa32r2,"mips:isa32r2", FALSE, NN(I_mipsisa32r2)), N (64, 64, bfd_mach_mipsisa64, "mips:isa64", FALSE, NN(I_mipsisa64)), + N (64, 64, bfd_mach_mipsisa64r2,"mips:isa64r2", FALSE, NN(I_mipsisa64r2)), N (64, 64, bfd_mach_mips_sb1, "mips:sb1", FALSE, 0), }; diff --git a/bfd/cpu-msp430.c b/bfd/cpu-msp430.c index 54ed649..519131c 100644 --- a/bfd/cpu-msp430.c +++ b/bfd/cpu-msp430.c @@ -1,5 +1,5 @@ /* BFD library support routines for the MSP architecture. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2003 Free Software Foundation, Inc. Contributed by Dmitry Diky <diwil@mail.ru> This file is part of BFD, the Binary File Descriptor library. diff --git a/bfd/cpu-ns32k.c b/bfd/cpu-ns32k.c index 1a12b16..aab1559 100644 --- a/bfd/cpu-ns32k.c +++ b/bfd/cpu-ns32k.c @@ -37,7 +37,7 @@ const bfd_arch_info_type bfd_ns32k_arch = N(32032,"ns32k:32032",FALSE, &arch_info_struct[0]); static bfd_reloc_status_type do_ns32k_reloc - PARAMS ((bfd *, arelent *, struct symbol_cache_entry *, PTR, asection *, + PARAMS ((bfd *, arelent *, struct bfd_symbol *, PTR, asection *, bfd *, char **, bfd_vma (*) (bfd_byte *, int), void (*) (bfd_vma, bfd_byte *, int))); @@ -158,7 +158,7 @@ do_ns32k_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message, get_data, put_data) bfd *abfd; arelent *reloc_entry; - struct symbol_cache_entry *symbol; + struct bfd_symbol *symbol; PTR data; asection *input_section; bfd *output_bfd; @@ -762,7 +762,7 @@ _bfd_ns32k_reloc_disp (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message) bfd *abfd; arelent *reloc_entry; - struct symbol_cache_entry *symbol; + struct bfd_symbol *symbol; PTR data; asection *input_section; bfd *output_bfd; @@ -779,7 +779,7 @@ _bfd_ns32k_reloc_imm (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message) bfd *abfd; arelent *reloc_entry; - struct symbol_cache_entry *symbol; + struct bfd_symbol *symbol; PTR data; asection *input_section; bfd *output_bfd; diff --git a/bfd/cpu-rs6000.c b/bfd/cpu-rs6000.c index 63df554..d94921f 100644 --- a/bfd/cpu-rs6000.c +++ b/bfd/cpu-rs6000.c @@ -1,5 +1,5 @@ /* BFD back-end for rs6000 support - Copyright 1990, 1991, 1993, 1995, 2000, 2002 + Copyright 1990, 1991, 1993, 1995, 2000, 2002, 2003 Free Software Foundation, Inc. FIXME: Can someone provide a transliteration of this name into ASCII? Using the following chars caused a compiler warning on HIUX (so I replaced @@ -47,7 +47,7 @@ rs6000_compatible (a,b) case bfd_arch_rs6000: return bfd_default_compatible (a, b); case bfd_arch_powerpc: - if (b->mach == bfd_mach_rs6k) + if (a->mach == bfd_mach_rs6k) return b; return NULL; } diff --git a/bfd/cpu-sh.c b/bfd/cpu-sh.c index e247cb8..2f33240 100644 --- a/bfd/cpu-sh.c +++ b/bfd/cpu-sh.c @@ -23,21 +23,6 @@ #include "sysdep.h" #include "libbfd.h" -#if 0 -/* This routine is provided two arch_infos and returns whether - they'd be compatible. */ - -static const bfd_arch_info_type * -compatible (a,b) - const bfd_arch_info_type *a; - const bfd_arch_info_type *b; -{ - if (a->arch != b->arch || a->mach != b->mach) - return NULL; - return a; -} -#endif - #define SH_NEXT &arch_info_struct[0] #define SH2_NEXT &arch_info_struct[1] #define SH2E_NEXT &arch_info_struct[2] @@ -46,6 +31,10 @@ compatible (a,b) #define SH3_DSP_NEXT &arch_info_struct[5] #define SH3E_NEXT &arch_info_struct[6] #define SH4_NEXT &arch_info_struct[7] +#define SH4A_NEXT &arch_info_struct[8] +#define SH4AL_DSP_NEXT &arch_info_struct[9] +#define SH4_NOFPU_NEXT &arch_info_struct[10] +#define SH4A_NOFPU_NEXT &arch_info_struct[11] #define SH64_NEXT NULL static const bfd_arch_info_type arch_info_struct[] = @@ -149,6 +138,62 @@ static const bfd_arch_info_type arch_info_struct[] = SH4_NEXT }, { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_sh, + bfd_mach_sh4a, + "sh", /* arch_name */ + "sh4a", /* printable name */ + 1, + FALSE, /* not the default */ + bfd_default_compatible, + bfd_default_scan, + SH4A_NEXT + }, + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_sh, + bfd_mach_sh4al_dsp, + "sh", /* arch_name */ + "sh4al-dsp", /* printable name */ + 1, + FALSE, /* not the default */ + bfd_default_compatible, + bfd_default_scan, + SH4AL_DSP_NEXT + }, + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_sh, + bfd_mach_sh4_nofpu, + "sh", /* arch_name */ + "sh4-nofpu", /* printable name */ + 1, + FALSE, /* not the default */ + bfd_default_compatible, + bfd_default_scan, + SH4_NOFPU_NEXT + }, + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_sh, + bfd_mach_sh4a_nofpu, + "sh", /* arch_name */ + "sh4a-nofpu", /* printable name */ + 1, + FALSE, /* not the default */ + bfd_default_compatible, + bfd_default_scan, + SH4A_NOFPU_NEXT + }, + { 64, /* 64 bits in a word */ 64, /* 64 bits in an address */ 8, /* 8 bits in a byte */ diff --git a/bfd/cpu-z8k.c b/bfd/cpu-z8k.c index 60d82ef..3ccedf6 100644 --- a/bfd/cpu-z8k.c +++ b/bfd/cpu-z8k.c @@ -1,5 +1,5 @@ /* BFD library support routines for the Z800n architecture. - Copyright 1992, 1993, 1994, 2000, 2001, 2002 + Copyright 1992, 1993, 1994, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Hacked by Steve Chamberlain of Cygnus Support. @@ -36,7 +36,7 @@ howto16_callback (abfd, reloc_entry, symbol_in, data, ignore_input_section, ignore_bfd) bfd *abfd; arelent *reloc_entry; - struct symbol_cache_entry *symbol_in; + struct bfd_symbol *symbol_in; PTR data; asection *ignore_input_section; bfd *ignore_bfd; @@ -58,7 +58,7 @@ howto8_callback (abfd, reloc_entry, symbol_in, data, ignore_input_section, ignore_bfd) bfd *abfd; arelent *reloc_entry; - struct symbol_cache_entry *symbol_in; + struct bfd_symbol *symbol_in; PTR data; asection *ignore_input_section; bfd *ignore_bfd; @@ -80,7 +80,7 @@ howto8_FFnn_callback (abfd, reloc_entry, symbol_in, data, ignore_input_section, ignore_bfd) bfd *abfd; arelent *reloc_entry; - struct symbol_cache_entry *symbol_in; + struct bfd_symbol *symbol_in; PTR data; asection *ignore_input_section; bfd *ignore_bfd; @@ -103,7 +103,7 @@ howto8_pcrel_callback (abfd, reloc_entry, symbol_in, data, ignore_input_section, ignore_bfd) bfd *abfd; arelent *reloc_entry; - struct symbol_cache_entry *symbol_in; + struct bfd_symbol *symbol_in; PTR data; asection *ignore_input_section; bfd *ignore_bfd; diff --git a/bfd/doc/ChangeLog b/bfd/doc/ChangeLog index d345d80..3636ed8 100644 --- a/bfd/doc/ChangeLog +++ b/bfd/doc/ChangeLog @@ -1,3 +1,12 @@ +2003-10-15 Andrew Cagney <cagney@redhat.com> + + * bfdint.texi (BFD target vector symbols): Rename _get_symtab to + _canonicalize_symtab. + +2003-10-08 David Taylor <dtaylor@emc.com> + + * bfd.texinfo: Remove spurious backslash. + 2003-07-04 Josh Baratz <baratz@intersystems.com> * Makefile.am (MKDOC rule): Add $(CFLAGS) in case it contains diff --git a/bfd/doc/Makefile.in b/bfd/doc/Makefile.in index 81db77e..1c1fce9 100644 --- a/bfd/doc/Makefile.in +++ b/bfd/doc/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am +# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation diff --git a/bfd/doc/bfd.texinfo b/bfd/doc/bfd.texinfo index d6a427f..3ed4194 100644 --- a/bfd/doc/bfd.texinfo +++ b/bfd/doc/bfd.texinfo @@ -64,7 +64,7 @@ notice identical to this one except for the removal of this paragraph @tex \def\$#1${{#1}} % Kluge: collect RCS revision info without $...$ -\xdef\manvers{\1.5} % For use in headers, footers too +\xdef\manvers{1.5} % For use in headers, footers too {\parskip=0pt \hfill Free Software Foundation\par \hfill sac\@www.gnu.org\par diff --git a/bfd/doc/bfdint.texi b/bfd/doc/bfdint.texi index 4566731..cd29ae8 100644 --- a/bfd/doc/bfdint.texi +++ b/bfd/doc/bfdint.texi @@ -694,7 +694,7 @@ information in BFD private data. This is called via @samp{bfd_get_symtab_upper_bound}. The corresponding field in the target vector is named @samp{_bfd_get_symtab_upper_bound}. -@item _get_symtab +@item _canonicalize_symtab Read in the symbol table. This is called via @samp{bfd_canonicalize_symtab}. The corresponding field in the target vector is named @samp{_bfd_canonicalize_symtab}. diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index 7a9e5b0..49422b2 100644 --- a/bfd/dwarf2.c +++ b/bfd/dwarf2.c @@ -61,21 +61,12 @@ struct attribute { char *str; struct dwarf_block *blk; - unsigned int unsnd; - int snd; - bfd_vma addr; + bfd_vma val; + bfd_signed_vma sval; } u; }; -/* Get at parts of an attribute structure. */ - -#define DW_STRING(attr) ((attr)->u.str) -#define DW_UNSND(attr) ((attr)->u.unsnd) -#define DW_BLOCK(attr) ((attr)->u.blk) -#define DW_SND(attr) ((attr)->u.snd) -#define DW_ADDR(attr) ((attr)->u.addr) - /* Blocks are a bunch of untyped bytes. */ struct dwarf_block { @@ -652,7 +643,7 @@ read_attribute_value (attr, form, unit, info_ptr) case DW_FORM_addr: /* FIXME: DWARF3 draft says DW_FORM_ref_addr is offset_size. */ case DW_FORM_ref_addr: - DW_ADDR (attr) = read_address (unit, info_ptr); + attr->u.val = read_address (unit, info_ptr); info_ptr += unit->addr_size; break; case DW_FORM_block2: @@ -662,7 +653,7 @@ read_attribute_value (attr, form, unit, info_ptr) info_ptr += 2; blk->data = read_n_bytes (abfd, info_ptr, blk->size); info_ptr += blk->size; - DW_BLOCK (attr) = blk; + attr->u.blk = blk; break; case DW_FORM_block4: amt = sizeof (struct dwarf_block); @@ -671,26 +662,26 @@ read_attribute_value (attr, form, unit, info_ptr) info_ptr += 4; blk->data = read_n_bytes (abfd, info_ptr, blk->size); info_ptr += blk->size; - DW_BLOCK (attr) = blk; + attr->u.blk = blk; break; case DW_FORM_data2: - DW_UNSND (attr) = read_2_bytes (abfd, info_ptr); + attr->u.val = read_2_bytes (abfd, info_ptr); info_ptr += 2; break; case DW_FORM_data4: - DW_UNSND (attr) = read_4_bytes (abfd, info_ptr); + attr->u.val = read_4_bytes (abfd, info_ptr); info_ptr += 4; break; case DW_FORM_data8: - DW_UNSND (attr) = read_8_bytes (abfd, info_ptr); + attr->u.val = read_8_bytes (abfd, info_ptr); info_ptr += 8; break; case DW_FORM_string: - DW_STRING (attr) = read_string (abfd, info_ptr, &bytes_read); + attr->u.str = read_string (abfd, info_ptr, &bytes_read); info_ptr += bytes_read; break; case DW_FORM_strp: - DW_STRING (attr) = read_indirect_string (unit, info_ptr, &bytes_read); + attr->u.str = read_indirect_string (unit, info_ptr, &bytes_read); info_ptr += bytes_read; break; case DW_FORM_block: @@ -700,7 +691,7 @@ read_attribute_value (attr, form, unit, info_ptr) info_ptr += bytes_read; blk->data = read_n_bytes (abfd, info_ptr, blk->size); info_ptr += blk->size; - DW_BLOCK (attr) = blk; + attr->u.blk = blk; break; case DW_FORM_block1: amt = sizeof (struct dwarf_block); @@ -709,42 +700,42 @@ read_attribute_value (attr, form, unit, info_ptr) info_ptr += 1; blk->data = read_n_bytes (abfd, info_ptr, blk->size); info_ptr += blk->size; - DW_BLOCK (attr) = blk; + attr->u.blk = blk; break; case DW_FORM_data1: - DW_UNSND (attr) = read_1_byte (abfd, info_ptr); + attr->u.val = read_1_byte (abfd, info_ptr); info_ptr += 1; break; case DW_FORM_flag: - DW_UNSND (attr) = read_1_byte (abfd, info_ptr); + attr->u.val = read_1_byte (abfd, info_ptr); info_ptr += 1; break; case DW_FORM_sdata: - DW_SND (attr) = read_signed_leb128 (abfd, info_ptr, &bytes_read); + attr->u.sval = read_signed_leb128 (abfd, info_ptr, &bytes_read); info_ptr += bytes_read; break; case DW_FORM_udata: - DW_UNSND (attr) = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); + attr->u.val = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); info_ptr += bytes_read; break; case DW_FORM_ref1: - DW_UNSND (attr) = read_1_byte (abfd, info_ptr); + attr->u.val = read_1_byte (abfd, info_ptr); info_ptr += 1; break; case DW_FORM_ref2: - DW_UNSND (attr) = read_2_bytes (abfd, info_ptr); + attr->u.val = read_2_bytes (abfd, info_ptr); info_ptr += 2; break; case DW_FORM_ref4: - DW_UNSND (attr) = read_4_bytes (abfd, info_ptr); + attr->u.val = read_4_bytes (abfd, info_ptr); info_ptr += 4; break; case DW_FORM_ref8: - DW_UNSND (attr) = read_8_bytes (abfd, info_ptr); + attr->u.val = read_8_bytes (abfd, info_ptr); info_ptr += 8; break; case DW_FORM_ref_udata: - DW_UNSND (attr) = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); + attr->u.val = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); info_ptr += bytes_read; break; case DW_FORM_indirect: @@ -1168,7 +1159,7 @@ decode_line_info (unit, stash) { /* State machine registers. */ bfd_vma address = 0; - char * filename = concat_filename (table, 1); + char * filename = table->num_files ? concat_filename (table, 1) : NULL; unsigned int line = 1; unsigned int column = 0; int is_stmt = lh.default_is_stmt; @@ -1493,23 +1484,23 @@ scan_unit_for_functions (unit) { case DW_AT_name: - name = DW_STRING (&attr); + name = attr.u.str; /* Prefer DW_AT_MIPS_linkage_name over DW_AT_name. */ if (func->name == NULL) - func->name = DW_STRING (&attr); + func->name = attr.u.str; break; case DW_AT_MIPS_linkage_name: - func->name = DW_STRING (&attr); + func->name = attr.u.str; break; case DW_AT_low_pc: - func->low = DW_ADDR (&attr); + func->low = attr.u.val; break; case DW_AT_high_pc: - func->high = DW_ADDR (&attr); + func->high = attr.u.val; break; default: @@ -1521,7 +1512,7 @@ scan_unit_for_functions (unit) switch (attr.name) { case DW_AT_name: - name = DW_STRING (&attr); + name = attr.u.str; break; default: @@ -1642,24 +1633,24 @@ parse_comp_unit (abfd, stash, unit_length, offset_size) { case DW_AT_stmt_list: unit->stmtlist = 1; - unit->line_offset = DW_UNSND (&attr); + unit->line_offset = attr.u.val; break; case DW_AT_name: - unit->name = DW_STRING (&attr); + unit->name = attr.u.str; break; case DW_AT_low_pc: - unit->arange.low = DW_ADDR (&attr); + unit->arange.low = attr.u.val; break; case DW_AT_high_pc: - unit->arange.high = DW_ADDR (&attr); + unit->arange.high = attr.u.val; break; case DW_AT_comp_dir: { - char* comp_dir = DW_STRING (&attr); + char* comp_dir = attr.u.str; if (comp_dir) { /* Irix 6.2 native cc prepends <machine>.: to the compilation diff --git a/bfd/ecoff.c b/bfd/ecoff.c index 021c1fe..b45f168 100644 --- a/bfd/ecoff.c +++ b/bfd/ecoff.c @@ -100,9 +100,9 @@ static asection bfd_debug_section = /* target_index, used_by_bfd, constructor_chain, owner, */ 0, NULL, NULL, NULL, /* symbol, */ - (struct symbol_cache_entry *) NULL, + (struct bfd_symbol *) NULL, /* symbol_ptr_ptr, */ - (struct symbol_cache_entry **) NULL, + (struct bfd_symbol **) NULL, /* link_order_head, link_order_tail */ NULL, NULL }; @@ -1062,7 +1062,7 @@ _bfd_ecoff_get_symtab_upper_bound (abfd) /* Get the canonical symbols. */ long -_bfd_ecoff_get_symtab (abfd, alocation) +_bfd_ecoff_canonicalize_symtab (abfd, alocation) bfd *abfd; asymbol **alocation; { @@ -2262,7 +2262,7 @@ bfd_boolean _bfd_ecoff_set_section_contents (abfd, section, location, offset, count) bfd *abfd; asection *section; - PTR location; + const PTR location; file_ptr offset; bfd_size_type count; { diff --git a/bfd/efi-app-ia32.c b/bfd/efi-app-ia32.c index 0315221..92a17ef 100644 --- a/bfd/efi-app-ia32.c +++ b/bfd/efi-app-ia32.c @@ -1,5 +1,5 @@ /* BFD back-end for Intel IA-32 EFI application files. - Copyright 1999, 2000, 2002 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Contributed by David Mosberger <davidm@hpl.hp.com> This file is part of BFD, the Binary File Descriptor library. diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index abbe377..d5965d3 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -309,14 +309,6 @@ struct eh_frame_hdr_info bfd_boolean table; }; -/* Cached start, size and alignment of PT_TLS segment. */ -struct elf_link_tls_segment -{ - bfd_vma start; - bfd_size_type size; - unsigned int align; -}; - /* ELF linker hash table. */ struct elf_link_hash_table @@ -377,8 +369,9 @@ struct elf_link_hash_table objects included in the link. */ struct bfd_link_needed_list *runpath; - /* Cached start, size and alignment of PT_TLS segment. */ - struct elf_link_tls_segment *tls_segment; + /* Cached first output tls section and size of PT_TLS segment. */ + asection *tls_sec; + bfd_size_type tls_size; /* A linked list of BFD's loaded in the link. */ struct elf_link_loaded_list *loaded; @@ -511,11 +504,16 @@ typedef enum { struct bfd_elf_special_section { const char *prefix; - size_t prefix_length; - const char *suffix; - size_t suffix_length; + int prefix_length; + /* 0 means name must match PREFIX exactly. + -1 means name must start with PREFIX followed by an arbitrary string. + -2 means name must match PREFIX exactly or consist of PREFIX followed + by a dot then anything. + > 0 means name must start with the first PREFIX_LENGTH chars of + PREFIX and finish with the last SUFFIX_LENGTH chars of PREFIX. */ + int suffix_length; int type; - int attributes; + int attr; }; struct elf_backend_data @@ -808,6 +806,11 @@ struct elf_backend_data void (*elf_backend_hide_symbol) (struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean); + /* Merge the backend specific symbol attribute. */ + void (*elf_backend_merge_symbol_attribute) + (struct elf_link_hash_entry *, const Elf_Internal_Sym *, bfd_boolean, + bfd_boolean); + /* Emit relocations. Overrides default routine for emitting relocs, except during a relocatable link, or if all relocs are being emitted. */ bfd_boolean (*elf_backend_emit_relocs) @@ -884,10 +887,9 @@ struct elf_backend_data .got section */ bfd_vma got_symbol_offset; - /* The size in bytes of the headers for the GOT and PLT. This includes - the so-called reserved entries on some systems. */ + /* The size in bytes of the header for the GOT. This includes the + so-called reserved entries on some systems. */ bfd_vma got_header_size; - bfd_vma plt_header_size; /* This is TRUE if the linker should act like collect and gather global constructors and destructors by name. This is TRUE for @@ -1003,7 +1005,7 @@ struct bfd_elf_section_data const char *name; /* Group signature sym, if this is the SHT_GROUP section. */ - struct symbol_cache_entry *id; + struct bfd_symbol *id; } group; /* A linked list of sections in the group. Circular when used by @@ -1293,7 +1295,7 @@ extern void _bfd_elf_fprintf_vma extern enum elf_reloc_type_class _bfd_elf_reloc_type_class (const Elf_Internal_Rela *); extern bfd_vma _bfd_elf_rela_local_sym - (bfd *, Elf_Internal_Sym *, asection *, Elf_Internal_Rela *); + (bfd *, Elf_Internal_Sym *, asection **, Elf_Internal_Rela *); extern bfd_vma _bfd_elf_rel_local_sym (bfd *, Elf_Internal_Sym *, asection **, bfd_vma); extern bfd_vma _bfd_elf_section_offset @@ -1332,7 +1334,7 @@ extern bfd_boolean _bfd_elf_slurp_version_tables extern bfd_boolean _bfd_elf_merge_sections (bfd *, struct bfd_link_info *); extern bfd_boolean bfd_elf_discard_group - (bfd *, struct sec *); + (bfd *, struct bfd_section *); extern void bfd_elf_set_group_contents (bfd *, asection *, void *); extern void _bfd_elf_link_just_syms @@ -1346,10 +1348,10 @@ extern bfd_boolean _bfd_elf_write_object_contents extern bfd_boolean _bfd_elf_write_corefile_contents (bfd *); extern bfd_boolean _bfd_elf_set_section_contents - (bfd *, sec_ptr, void *, file_ptr, bfd_size_type); + (bfd *, sec_ptr, const void *, file_ptr, bfd_size_type); extern long _bfd_elf_get_symtab_upper_bound (bfd *); -extern long _bfd_elf_get_symtab +extern long _bfd_elf_canonicalize_symtab (bfd *, asymbol **); extern long _bfd_elf_get_dynamic_symtab_upper_bound (bfd *); @@ -1384,8 +1386,8 @@ extern bfd_boolean _bfd_elf_new_section_hook (bfd *, asection *); extern bfd_boolean _bfd_elf_init_reloc_shdr (bfd *, Elf_Internal_Shdr *, asection *, bfd_boolean); -extern bfd_boolean _bfd_elf_get_sec_type_attr - (bfd *, const char *, int *, int *); +extern const struct bfd_elf_special_section *_bfd_elf_get_sec_type_attr + (bfd *, const char *); /* If the target doesn't have reloc handling written yet: */ extern void _bfd_elf_no_info_to_howto @@ -1624,7 +1626,7 @@ extern int elf_link_record_local_dynamic_symbol extern bfd_boolean _bfd_elf_close_and_cleanup (bfd *); extern bfd_reloc_status_type _bfd_elf_rel_vtable_reloc_fn - (bfd *, arelent *, struct symbol_cache_entry *, void *, + (bfd *, arelent *, struct bfd_symbol *, void *, asection *, bfd *, char **); extern bfd_boolean _bfd_elf32_gc_sections diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c index c71129e..28e0b55 100644 --- a/bfd/elf-eh-frame.c +++ b/bfd/elf-eh-frame.c @@ -372,6 +372,9 @@ _bfd_elf_discard_section_eh_frame all FDEs. Also, it can be removed if we have removed all FDEs using it. */ if ((!info->relocatable + && hdr_info->last_cie_sec + && (sec->output_section + == hdr_info->last_cie_sec->output_section) && cie_compare (&cie, &hdr_info->last_cie) == 0) || cie_usage_count == 0) { @@ -1026,6 +1029,42 @@ _bfd_elf_write_section_eh_frame (bfd *abfd, and 3xDW_CFA_nop as pad */ p += 16; } + else + { + unsigned int alignment = 1 << sec->alignment_power; + unsigned int pad = sec->_cooked_size % alignment; + + /* Don't pad beyond the raw size of the output section. It + can happen at the last input section. */ + if (pad + && ((sec->output_offset + sec->_cooked_size + pad) + <= sec->output_section->_raw_size)) + { + /* Find the last CIE/FDE. */ + for (i = sec_info->count - 1; i > 0; i--) + if (! sec_info->entry[i].removed) + break; + + /* The size of the last CIE/FDE must be at least 4. */ + if (sec_info->entry[i].removed + || sec_info->entry[i].size < 4) + abort (); + + pad = alignment - pad; + + buf = contents + sec_info->entry[i].new_offset; + + /* Update length. */ + sec_info->entry[i].size += pad; + bfd_put_32 (abfd, sec_info->entry[i].size - 4, buf); + + /* Pad it with DW_CFA_nop */ + memset (p, 0, pad); + p += pad; + + sec->_cooked_size += pad; + } + } BFD_ASSERT ((bfd_size_type) (p - contents) == sec->_cooked_size); diff --git a/bfd/elf-hppa.h b/bfd/elf-hppa.h index bdd7a74..0f15b0d 100644 --- a/bfd/elf-hppa.h +++ b/bfd/elf-hppa.h @@ -1346,7 +1346,7 @@ elf_hppa_relocate_section (bfd *output_bfd, /* This is a local symbol. */ sym = local_syms + r_symndx; sym_sec = local_sections[r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sym_sec, rel); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sym_sec, rel); /* If this symbol has an entry in the PA64 dynamic hash table, then get it. */ diff --git a/bfd/elf-m10200.c b/bfd/elf-m10200.c index 09d7d99..7373dc0 100644 --- a/bfd/elf-m10200.c +++ b/bfd/elf-m10200.c @@ -373,7 +373,7 @@ mn10200_elf_relocate_section (output_bfd, info, input_bfd, input_section, { sym = local_syms + r_symndx; sec = local_sections[r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); } else { diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index dc25c38..685ac9b 100644 --- a/bfd/elf-m10300.c +++ b/bfd/elf-m10300.c @@ -561,6 +561,7 @@ _bfd_mn10300_elf_create_got_section (abfd, info) flagword flags; flagword pltflags; asection * s; + struct bfd_link_hash_entry * bh; struct elf_link_hash_entry * h; const struct elf_backend_data * bed = get_elf_backend_data (abfd); int ptralign; @@ -604,13 +605,13 @@ _bfd_mn10300_elf_create_got_section (abfd, info) { /* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the .plt section. */ - struct elf_link_hash_entry *h = NULL; + bh = NULL; if (! (_bfd_generic_link_add_one_symbol (info, abfd, "_PROCEDURE_LINKAGE_TABLE_", BSF_GLOBAL, s, (bfd_vma) 0, (const char *) NULL, FALSE, - get_elf_backend_data (abfd)->collect, - (struct bfd_link_hash_entry **) &h))) + get_elf_backend_data (abfd)->collect, &bh))) return FALSE; + h = (struct elf_link_hash_entry *) bh; h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; h->type = STT_OBJECT; @@ -638,12 +639,13 @@ _bfd_mn10300_elf_create_got_section (abfd, info) (or .got.plt) section. We don't do this in the linker script because we don't want to define the symbol if we are not creating a global offset table. */ - h = NULL; + bh = NULL; if (!(_bfd_generic_link_add_one_symbol (info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, s, bed->got_symbol_offset, (const char *) NULL, FALSE, - bed->collect, (struct bfd_link_hash_entry **) &h))) + bed->collect, &bh))) return FALSE; + h = (struct elf_link_hash_entry *) bh; h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; h->type = STT_OBJECT; @@ -1574,7 +1576,7 @@ mn10300_elf_relocate_section (output_bfd, info, input_bfd, input_section, { sym = local_syms + r_symndx; sec = local_sections[r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); } else { @@ -4349,7 +4351,7 @@ _bfd_mn10300_elf_size_dynamic_sections (output_bfd, info) if (elf_hash_table (info)->dynamic_sections_created) { /* Set the contents of the .interp section to the interpreter. */ - if (! info->shared) + if (info->executable) { s = bfd_get_section_by_name (dynobj, ".interp"); BFD_ASSERT (s != NULL); @@ -4874,6 +4876,5 @@ _bfd_mn10300_elf_finish_dynamic_sections (output_bfd, info) #define elf_backend_plt_readonly 1 #define elf_backend_want_plt_sym 0 #define elf_backend_got_header_size 12 -#define elf_backend_plt_header_size PLT0_ENTRY_SIZE #include "elf32-target.h" diff --git a/bfd/elf-strtab.c b/bfd/elf-strtab.c index 764ab54..673b9d7 100644 --- a/bfd/elf-strtab.c +++ b/bfd/elf-strtab.c @@ -1,5 +1,5 @@ /* ELF strtab with GC and suffix merging support. - Copyright 2001, 2002 Free Software Foundation, Inc. + Copyright 2001, 2002, 2003 Free Software Foundation, Inc. Written by Jakub Jelinek <jakub@redhat.com>. This file is part of BFD, the Binary File Descriptor library. @@ -30,15 +30,14 @@ struct elf_strtab_hash_entry { struct bfd_hash_entry root; - /* Length of this entry. */ - unsigned int len; + /* Length of this entry. This includes the zero terminator. */ + int len; unsigned int refcount; union { /* Index within the merged section. */ bfd_size_type index; - /* Entry this is a suffix of (if len is 0). */ + /* Entry this is a suffix of (if len < 0). */ struct elf_strtab_hash_entry *suffix; - struct elf_strtab_hash_entry *next; } u; }; @@ -158,6 +157,8 @@ _bfd_elf_strtab_add (struct elf_strtab_hash *tab, if (entry->len == 0) { entry->len = strlen (str) + 1; + /* 2G strings lose. */ + BFD_ASSERT (entry->len > 0); if (tab->size == tab->alloced) { bfd_size_type amt = sizeof (struct elf_strtab_hash_entry *); @@ -235,14 +236,14 @@ _bfd_elf_strtab_emit (register bfd *abfd, struct elf_strtab_hash *tab) for (i = 1; i < tab->size; ++i) { register const char *str; - register size_t len; + register unsigned int len; - str = tab->array[i]->root.string; - len = tab->array[i]->len; BFD_ASSERT (tab->array[i]->refcount == 0); - if (len == 0) + len = tab->array[i]->len; + if ((int) len < 0) continue; + str = tab->array[i]->root.string; if (bfd_bwrite (str, len, abfd) != len) return FALSE; @@ -253,40 +254,41 @@ _bfd_elf_strtab_emit (register bfd *abfd, struct elf_strtab_hash *tab) return TRUE; } -/* Compare two elf_strtab_hash_entry structures. This is called via qsort. */ +/* Compare two elf_strtab_hash_entry structures. Called via qsort. */ static int -cmplengthentry (const void *a, const void *b) +strrevcmp (const void *a, const void *b) { struct elf_strtab_hash_entry *A = *(struct elf_strtab_hash_entry **) a; struct elf_strtab_hash_entry *B = *(struct elf_strtab_hash_entry **) b; + unsigned int lenA = A->len; + unsigned int lenB = B->len; + const unsigned char *s = A->root.string + lenA - 1; + const unsigned char *t = B->root.string + lenB - 1; + int l = lenA < lenB ? lenA : lenB; - if (A->len < B->len) - return 1; - else if (A->len > B->len) - return -1; - - return memcmp (A->root.string, B->root.string, A->len); + while (l) + { + if (*s != *t) + return (int) *s - (int) *t; + s--; + t--; + l--; + } + return lenA - lenB; } -static int -last4_eq (const void *a, const void *b) +static inline int +is_suffix (const struct elf_strtab_hash_entry *A, + const struct elf_strtab_hash_entry *B) { - const struct elf_strtab_hash_entry *A = a; - const struct elf_strtab_hash_entry *B = b; - - if (memcmp (A->root.string + A->len - 5, B->root.string + B->len - 5, 4) - != 0) - /* This was a hashtable collision. */ - return 0; - if (A->len <= B->len) /* B cannot be a suffix of A unless A is equal to B, which is guaranteed not to be equal by the hash table. */ return 0; return memcmp (A->root.string + (A->len - B->len), - B->root.string, B->len - 5) == 0; + B->root.string, B->len - 1) == 0; } /* This function assigns final string table offsets for used strings, @@ -295,10 +297,8 @@ last4_eq (const void *a, const void *b) void _bfd_elf_strtab_finalize (struct elf_strtab_hash *tab) { - struct elf_strtab_hash_entry **array, **a, **end, *e; - htab_t last4tab = NULL; + struct elf_strtab_hash_entry **array, **a, *e; bfd_size_type size, amt; - struct elf_strtab_hash_entry *last[256], **last_ptr[256]; /* GCC 2.91.66 (egcs-1.1.2) on i386 miscompiles this function when i is a 64-bit bfd_size_type: a 64-bit target or --enable-64-bit-bfd. @@ -306,105 +306,71 @@ _bfd_elf_strtab_finalize (struct elf_strtab_hash *tab) cycles. */ size_t i; - /* Now sort the strings by length, longest first. */ - array = NULL; + /* Sort the strings by suffix and length. */ amt = tab->size * sizeof (struct elf_strtab_hash_entry *); array = bfd_malloc (amt); if (array == NULL) goto alloc_failure; - memset (last, 0, sizeof (last)); - for (i = 0; i < 256; ++i) - last_ptr[i] = &last[i]; for (i = 1, a = array; i < tab->size; ++i) - if (tab->array[i]->refcount) - *a++ = tab->array[i]; - else - tab->array[i]->len = 0; + { + e = tab->array[i]; + if (e->refcount) + { + *a++ = e; + /* Adjust the length to not include the zero terminator. */ + e->len -= 1; + } + else + e->len = 0; + } size = a - array; + if (size != 0) + { + qsort (array, size, sizeof (struct elf_strtab_hash_entry *), strrevcmp); - qsort (array, size, sizeof (struct elf_strtab_hash_entry *), cmplengthentry); + /* Loop over the sorted array and merge suffixes. Start from the + end because we want eg. - last4tab = htab_create_alloc (size * 4, NULL, last4_eq, NULL, calloc, free); - if (last4tab == NULL) - goto alloc_failure; + s1 -> "d" + s2 -> "bcd" + s3 -> "abcd" - /* Now insert the strings into hash tables (strings with last 4 characters - and strings with last character equal), look for longer strings which - we're suffix of. */ - for (a = array, end = array + size; a < end; a++) - { - register hashval_t hash; - unsigned int c; - unsigned int j; - const unsigned char *s; - void **p; - - e = *a; - if (e->len > 4) - { - s = e->root.string + e->len - 1; - hash = 0; - for (j = 0; j < 4; j++) - { - c = *--s; - hash += c + (c << 17); - hash ^= hash >> 2; - } - p = htab_find_slot_with_hash (last4tab, e, hash, INSERT); - if (p == NULL) - goto alloc_failure; - if (*p) - { - struct elf_strtab_hash_entry *ent; + to end up as - ent = *p; - e->u.suffix = ent; - e->len = 0; - continue; - } - else - *p = e; - } - else - { - struct elf_strtab_hash_entry *tem; + s3 -> "abcd" + s2 _____^ + s1 _______^ - c = e->root.string[e->len - 2] & 0xff; + ie. we don't want s1 pointing into the old s2. */ + e = *--a; + e->len += 1; + while (--a >= array) + { + struct elf_strtab_hash_entry *cmp = *a; - for (tem = last[c]; tem; tem = tem->u.next) - if (tem->len > e->len - && memcmp (tem->root.string + (tem->len - e->len), - e->root.string, e->len - 1) == 0) - break; - if (tem) + cmp->len += 1; + if (is_suffix (e, cmp)) { - e->u.suffix = tem; - e->len = 0; - continue; + cmp->u.suffix = e; + cmp->len = -cmp->len; } + else + e = cmp; } - - c = e->root.string[e->len - 2] & 0xff; - /* Put longest strings first. */ - *last_ptr[c] = e; - last_ptr[c] = &e->u.next; - e->u.next = NULL; } alloc_failure: if (array) free (array); - if (last4tab) - htab_delete (last4tab); - /* Now assign positions to the strings we want to keep. */ + /* Assign positions to the strings we want to keep. */ size = 1; for (i = 1; i < tab->size; ++i) { e = tab->array[i]; - if (e->refcount && e->len) + if (e->refcount && e->len > 0) { e->u.index = size; size += e->len; @@ -413,12 +379,11 @@ alloc_failure: tab->sec_size = size; - /* And now adjust the rest. */ + /* Adjust the rest. */ for (i = 1; i < tab->size; ++i) { e = tab->array[i]; - if (e->refcount && ! e->len) - e->u.index = e->u.suffix->u.index - + (e->u.suffix->len - strlen (e->root.string) - 1); + if (e->refcount && e->len < 0) + e->u.index = e->u.suffix->u.index + (e->u.suffix->len + e->len); } } @@ -1444,7 +1444,8 @@ _bfd_elf_link_hash_table_init memset (&table->eh_info, 0, sizeof (table->eh_info)); table->dynlocal = NULL; table->runpath = NULL; - table->tls_segment = NULL; + table->tls_sec = NULL; + table->tls_size = 0; table->loaded = NULL; ret = _bfd_link_hash_table_init (&table->root, abfd, newfunc); @@ -2019,82 +2020,44 @@ bfd_section_from_elf_index (bfd *abfd, unsigned int index) static struct bfd_elf_special_section const special_sections[] = { - { ".bss", 0, NULL, 0, - SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, - { ".comment", 0, NULL, 0, - SHT_PROGBITS, 0 }, - { ".data", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".data1", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".debug", 0, NULL, 0, - SHT_PROGBITS, 0 }, - { ".fini", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, - { ".init", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, - { ".line", 0, NULL, 0, - SHT_PROGBITS, 0 }, - { ".rodata", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC }, - { ".rodata1", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC }, - { ".tbss", 0, NULL, 0, - SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_TLS }, - { ".tdata", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_TLS }, - { ".text", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, - { ".init_array", 0, NULL, 0, - SHT_INIT_ARRAY, SHF_ALLOC + SHF_WRITE }, - { ".fini_array", 0, NULL, 0, - SHT_FINI_ARRAY, SHF_ALLOC + SHF_WRITE }, - { ".preinit_array", 0, NULL, 0, - SHT_PREINIT_ARRAY, SHF_ALLOC + SHF_WRITE }, - { ".debug_line", 0, NULL, 0, - SHT_PROGBITS, 0 }, - { ".debug_info", 0, NULL, 0, - SHT_PROGBITS, 0 }, - { ".debug_abbrev", 0, NULL, 0, - SHT_PROGBITS, 0 }, - { ".debug_aranges", 0, NULL, 0, - SHT_PROGBITS, 0 }, - { ".dynamic", 0, NULL, 0, - SHT_DYNAMIC, SHF_ALLOC }, - { ".dynstr", 0, NULL, 0, - SHT_STRTAB, SHF_ALLOC }, - { ".dynsym", 0, NULL, 0, - SHT_DYNSYM, SHF_ALLOC }, - { ".got", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".hash", 0, NULL, 0, - SHT_HASH, SHF_ALLOC }, - { ".interp", 0, NULL, 0, - SHT_PROGBITS, 0 }, - { ".plt", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, - { ".shstrtab", 0, NULL, 0, - SHT_STRTAB, 0 }, - { ".strtab", 0, NULL, 0, - SHT_STRTAB, 0 }, - { ".symtab", 0, NULL, 0, - SHT_SYMTAB, 0 }, - { ".gnu.version", 0, NULL, 0, - SHT_GNU_versym, 0 }, - { ".gnu.version_d", 0, NULL, 0, - SHT_GNU_verdef, 0 }, - { ".gnu.version_r", 0, NULL, 0, - SHT_GNU_verneed, 0 }, - { ".note", 5, NULL, 0, - SHT_NOTE, 0 }, - { ".rela", 5, NULL, 0, - SHT_RELA, 0 }, - { ".rel", 4, NULL, 0, - SHT_REL, 0 }, - { ".stab", 5, "str", 3, - SHT_STRTAB, 0 }, - { NULL, 0, NULL, 0, - 0, 0 } + { ".bss", 4, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, + { ".comment", 8, 0, SHT_PROGBITS, 0 }, + { ".data", 5, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".data1", 6, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".debug", 6, 0, SHT_PROGBITS, 0 }, + { ".fini", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, + { ".init", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, + { ".line", 5, 0, SHT_PROGBITS, 0 }, + { ".rodata", 7, -2, SHT_PROGBITS, SHF_ALLOC }, + { ".rodata1", 8, 0, SHT_PROGBITS, SHF_ALLOC }, + { ".tbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_TLS }, + { ".tdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_TLS }, + { ".text", 5, -2, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, + { ".init_array", 11, 0, SHT_INIT_ARRAY, SHF_ALLOC + SHF_WRITE }, + { ".fini_array", 11, 0, SHT_FINI_ARRAY, SHF_ALLOC + SHF_WRITE }, + { ".preinit_array", 14, 0, SHT_PREINIT_ARRAY, SHF_ALLOC + SHF_WRITE }, + { ".debug_line", 11, 0, SHT_PROGBITS, 0 }, + { ".debug_info", 11, 0, SHT_PROGBITS, 0 }, + { ".debug_abbrev", 13, 0, SHT_PROGBITS, 0 }, + { ".debug_aranges", 14, 0, SHT_PROGBITS, 0 }, + { ".dynamic", 8, 0, SHT_DYNAMIC, SHF_ALLOC }, + { ".dynstr", 7, 0, SHT_STRTAB, SHF_ALLOC }, + { ".dynsym", 7, 0, SHT_DYNSYM, SHF_ALLOC }, + { ".got", 4, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".hash", 5, 0, SHT_HASH, SHF_ALLOC }, + { ".interp", 7, 0, SHT_PROGBITS, 0 }, + { ".plt", 4, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, + { ".shstrtab", 9, 0, SHT_STRTAB, 0 }, + { ".strtab", 7, 0, SHT_STRTAB, 0 }, + { ".symtab", 7, 0, SHT_SYMTAB, 0 }, + { ".gnu.version", 12, 0, SHT_GNU_versym, 0 }, + { ".gnu.version_d", 14, 0, SHT_GNU_verdef, 0 }, + { ".gnu.version_r", 14, 0, SHT_GNU_verneed, 0 }, + { ".note", 5, -1, SHT_NOTE, 0 }, + { ".rela", 5, -1, SHT_RELA, 0 }, + { ".rel", 4, -1, SHT_REL, 0 }, + { ".stabstr", 5, 3, SHT_STRTAB, 0 }, + { NULL, 0, 0, 0, 0 } }; static const struct bfd_elf_special_section * @@ -2103,32 +2066,55 @@ get_special_section (const char *name, unsigned int rela) { int i; + int len = strlen (name); for (i = 0; special_sections[i].prefix != NULL; i++) - if (((special_sections[i].prefix_length - && strncmp (name, special_sections[i].prefix, - special_sections[i].prefix_length) == 0 - && (! special_sections[i].suffix_length - || strcmp ((name + strlen (name) - - special_sections[i].suffix_length), - special_sections[i].suffix) == 0)) - || strcmp (name, special_sections[i].prefix) == 0) - && (rela || special_sections[i].type != SHT_RELA)) + { + int suffix_len; + int prefix_len = special_sections[i].prefix_length; + + if (len < prefix_len) + continue; + if (memcmp (name, special_sections[i].prefix, prefix_len) != 0) + continue; + + suffix_len = special_sections[i].suffix_length; + if (suffix_len <= 0) + { + if (name[prefix_len] != 0) + { + if (suffix_len == 0) + continue; + if (name[prefix_len] != '.' + && (suffix_len == -2 + || (rela && special_sections[i].type == SHT_REL))) + continue; + } + } + else + { + if (len < prefix_len + suffix_len) + continue; + if (memcmp (name + len - suffix_len, + special_sections[i].prefix + prefix_len, + suffix_len) != 0) + continue; + } return &special_sections[i]; + } return NULL; } -bfd_boolean -_bfd_elf_get_sec_type_attr (bfd *abfd, const char *name, int *type, int *attr) +const struct bfd_elf_special_section * +_bfd_elf_get_sec_type_attr (bfd *abfd, const char *name) { - bfd_boolean found = FALSE; const struct elf_backend_data *bed = get_elf_backend_data (abfd); + const struct bfd_elf_special_section *ssect = NULL; /* See if this is one of the special sections. */ if (name) { - const struct bfd_elf_special_section *ssect = NULL; unsigned int rela = bed->default_use_rela_p; if (bed->special_sections) @@ -2136,23 +2122,16 @@ _bfd_elf_get_sec_type_attr (bfd *abfd, const char *name, int *type, int *attr) if (! ssect) ssect = get_special_section (name, special_sections, rela); - - if (ssect) - { - *type = ssect->type; - *attr = ssect->attributes; - found = TRUE; - } } - return found; + return ssect; } bfd_boolean _bfd_elf_new_section_hook (bfd *abfd, asection *sec) { struct bfd_elf_section_data *sdata; - int type, attr; + const struct bfd_elf_special_section *ssect; sdata = (struct bfd_elf_section_data *) sec->used_by_bfd; if (sdata == NULL) @@ -2164,11 +2143,11 @@ _bfd_elf_new_section_hook (bfd *abfd, asection *sec) } elf_section_type (sec) = SHT_NULL; - if (sec->name && _bfd_elf_get_sec_type_attr (abfd, sec->name, - &type, &attr)) + ssect = _bfd_elf_get_sec_type_attr (abfd, sec->name); + if (ssect != NULL) { - elf_section_type (sec) = type; - elf_section_flags (sec) = attr; + elf_section_type (sec) = ssect->type; + elf_section_flags (sec) = ssect->attr; } /* Indicate whether or not this section should use RELA relocations. */ @@ -2228,6 +2207,7 @@ _bfd_elf_make_section_from_phdr (bfd *abfd, newsect->_raw_size = hdr->p_filesz; newsect->filepos = hdr->p_offset; newsect->flags |= SEC_HAS_CONTENTS; + newsect->alignment_power = bfd_log2 (hdr->p_align); if (hdr->p_type == PT_LOAD) { newsect->flags |= SEC_ALLOC; @@ -2430,7 +2410,7 @@ elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg) case SHT_HASH: this_hdr->sh_entsize = bed->s->sizeof_hash_entry; break; - + case SHT_DYNSYM: this_hdr->sh_entsize = bed->s->sizeof_sym; break; @@ -4453,7 +4433,7 @@ _bfd_elf_write_corefile_contents (bfd *abfd) /* Given a section, search the header to find them. */ int -_bfd_elf_section_from_bfd_section (bfd *abfd, struct sec *asect) +_bfd_elf_section_from_bfd_section (bfd *abfd, struct bfd_section *asect) { const struct elf_backend_data *bed; int index; @@ -5613,7 +5593,7 @@ _bfd_elf_canonicalize_reloc (bfd *abfd, } long -_bfd_elf_get_symtab (bfd *abfd, asymbol **allocation) +_bfd_elf_canonicalize_symtab (bfd *abfd, asymbol **allocation) { const struct elf_backend_data *bed = get_elf_backend_data (abfd); long symcount = bed->s->slurp_symbol_table (abfd, allocation, FALSE); @@ -6116,7 +6096,7 @@ _bfd_elf_sizeof_headers (bfd *abfd, bfd_boolean reloc) bfd_boolean _bfd_elf_set_section_contents (bfd *abfd, sec_ptr section, - void *location, + const void *location, file_ptr offset, bfd_size_type count) { @@ -6260,7 +6240,7 @@ _bfd_elf_close_and_cleanup (bfd *abfd) bfd_reloc_status_type _bfd_elf_rel_vtable_reloc_fn (bfd *abfd ATTRIBUTE_UNUSED, arelent *re ATTRIBUTE_UNUSED, - struct symbol_cache_entry *symbol ATTRIBUTE_UNUSED, + struct bfd_symbol *symbol ATTRIBUTE_UNUSED, void *data ATTRIBUTE_UNUSED, asection *is ATTRIBUTE_UNUSED, bfd *obfd ATTRIBUTE_UNUSED, char **errmsg ATTRIBUTE_UNUSED) { @@ -6336,7 +6316,7 @@ _bfd_elfcore_make_pseudosection (bfd *abfd, return FALSE; memcpy (threaded_name, buf, len); - sect = bfd_make_section (abfd, threaded_name); + sect = bfd_make_section_anyway (abfd, threaded_name); if (sect == NULL) return FALSE; sect->_raw_size = size; @@ -6620,7 +6600,7 @@ elfcore_grok_lwpstatus (bfd *abfd, Elf_Internal_Note *note) return FALSE; memcpy (name, buf, len); - sect = bfd_make_section (abfd, name); + sect = bfd_make_section_anyway (abfd, name); if (sect == NULL) return FALSE; @@ -6650,7 +6630,7 @@ elfcore_grok_lwpstatus (bfd *abfd, Elf_Internal_Note *note) return FALSE; memcpy (name, buf, len); - sect = bfd_make_section (abfd, name); + sect = bfd_make_section_anyway (abfd, name); if (sect == NULL) return FALSE; @@ -6706,7 +6686,7 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note) memcpy (name, buf, len); - sect = bfd_make_section (abfd, name); + sect = bfd_make_section_anyway (abfd, name); if (sect == NULL) return FALSE; @@ -6733,7 +6713,7 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note) memcpy (name, buf, len); - sect = bfd_make_section (abfd, name); + sect = bfd_make_section_anyway (abfd, name); if (sect == NULL) return FALSE; @@ -6810,7 +6790,7 @@ elfcore_grok_note (bfd *abfd, Elf_Internal_Note *note) case NT_AUXV: { - asection *sect = bfd_make_section (abfd, ".auxv"); + asection *sect = bfd_make_section_anyway (abfd, ".auxv"); if (sect == NULL) return FALSE; @@ -6962,7 +6942,7 @@ elfcore_grok_nto_status (bfd *abfd, Elf_Internal_Note *note, pid_t *tid) return FALSE; strcpy (name, buf); - sect = bfd_make_section (abfd, name); + sect = bfd_make_section_anyway (abfd, name); if (sect == NULL) return FALSE; @@ -6989,7 +6969,7 @@ elfcore_grok_nto_gregs (bfd *abfd, Elf_Internal_Note *note, pid_t tid) return FALSE; strcpy (name, buf); - sect = bfd_make_section (abfd, name); + sect = bfd_make_section_anyway (abfd, name); if (sect == NULL) return FALSE; @@ -7066,7 +7046,7 @@ elfcore_write_note (bfd *abfd, pad = -namesz & ((1 << bed->s->log_file_align) - 1); } - newspace = sizeof (Elf_External_Note) - 1 + namesz + pad + size; + newspace = 12 + namesz + pad + size; p = realloc (buf, *bufsiz + newspace); dest = p + *bufsiz; @@ -7388,9 +7368,10 @@ _bfd_elf_reloc_type_class (const Elf_Internal_Rela *rela ATTRIBUTE_UNUSED) bfd_vma _bfd_elf_rela_local_sym (bfd *abfd, Elf_Internal_Sym *sym, - asection *sec, + asection **psec, Elf_Internal_Rela *rel) { + asection *sec = *psec; bfd_vma relocation; relocation = (sec->output_section->vma @@ -7400,16 +7381,14 @@ _bfd_elf_rela_local_sym (bfd *abfd, && ELF_ST_TYPE (sym->st_info) == STT_SECTION && sec->sec_info_type == ELF_INFO_TYPE_MERGE) { - asection *msec; - - msec = sec; rel->r_addend = - _bfd_merged_section_offset (abfd, &msec, + _bfd_merged_section_offset (abfd, psec, elf_section_data (sec)->sec_info, sym->st_value + rel->r_addend, - 0) - - relocation; - rel->r_addend += msec->output_section->vma + msec->output_offset; + 0); + sec = *psec; + rel->r_addend -= relocation; + rel->r_addend += sec->output_section->vma + sec->output_offset; } return relocation; } diff --git a/bfd/elf32-am33lin.c b/bfd/elf32-am33lin.c index 4cc2230..32e5663 100644 --- a/bfd/elf32-am33lin.c +++ b/bfd/elf32-am33lin.c @@ -1,5 +1,5 @@ /* Matsushita AM33/2.0 support for 32-bit GNU/Linux ELF - Copyright 2001 + Copyright 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. diff --git a/bfd/elf32-arm.h b/bfd/elf32-arm.h index a28c558..bcc1188 100644 --- a/bfd/elf32-arm.h +++ b/bfd/elf32-arm.h @@ -84,6 +84,12 @@ static struct bfd_hash_entry * elf32_arm_link_hash_newfunc static void arm_add_to_rel PARAMS ((bfd *, bfd_byte *, reloc_howto_type *, bfd_signed_vma)); #endif +static bfd_boolean allocate_dynrelocs + PARAMS ((struct elf_link_hash_entry *h, PTR inf)); +static bfd_boolean create_got_section + PARAMS ((bfd * dynobj, struct bfd_link_info * info)); +static bfd_boolean elf32_arm_create_dynamic_sections + PARAMS ((bfd * dynobj, struct bfd_link_info * info)); static enum elf_reloc_type_class elf32_arm_reloc_type_class PARAMS ((const Elf_Internal_Rela *)); static bfd_boolean elf32_arm_object_p @@ -119,6 +125,12 @@ bfd_boolean bfd_elf32_arm_process_before_allocation section. */ #define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1" +#ifdef FOUR_WORD_PLT + +/* The size in bytes of the special first entry in the procedure + linkage table. */ +#define PLT_HEADER_SIZE 16 + /* The size in bytes of an entry in the procedure linkage table. */ #define PLT_ENTRY_SIZE 16 @@ -126,23 +138,56 @@ bfd_boolean bfd_elf32_arm_process_before_allocation this. It is set up so that any shared library function that is called before the relocation has been set up calls the dynamic linker first. */ -static const bfd_vma elf32_arm_plt0_entry [PLT_ENTRY_SIZE / 4] = +static const bfd_vma elf32_arm_plt0_entry [PLT_HEADER_SIZE / 4] = + { + 0xe52de004, /* str lr, [sp, #-4]! */ + 0xe59fe010, /* ldr lr, [pc, #16] */ + 0xe08fe00e, /* add lr, pc, lr */ + 0xe5bef008, /* ldr pc, [lr, #8]! */ + }; + +/* Subsequent entries in a procedure linkage table look like + this. */ +static const bfd_vma elf32_arm_plt_entry [PLT_ENTRY_SIZE / 4] = + { + 0xe28fc600, /* add ip, pc, #NN */ + 0xe28cca00, /* add ip, ip, #NN */ + 0xe5bcf000, /* ldr pc, [ip, #NN]! */ + 0x00000000, /* unused */ + }; + +#else + +/* The size in bytes of the special first entry in the procedure + linkage table. */ +#define PLT_HEADER_SIZE 20 + +/* The size in bytes of an entry in the procedure linkage table. */ +#define PLT_ENTRY_SIZE 12 + +/* The first entry in a procedure linkage table looks like + this. It is set up so that any shared library function that is + called before the relocation has been set up calls the dynamic + linker first. */ +static const bfd_vma elf32_arm_plt0_entry [PLT_HEADER_SIZE / 4] = { - 0xe52de004, /* str lr, [sp, #-4]! */ - 0xe59fe010, /* ldr lr, [pc, #16] */ - 0xe08fe00e, /* add lr, pc, lr */ - 0xe5bef008 /* ldr pc, [lr, #8]! */ + 0xe52de004, /* str lr, [sp, #-4]! */ + 0xe59fe004, /* ldr lr, [pc, #4] */ + 0xe08fe00e, /* add lr, pc, lr */ + 0xe5bef008, /* ldr pc, [lr, #8]! */ + 0x00000000, /* &GOT[0] - . */ }; /* Subsequent entries in a procedure linkage table look like this. */ static const bfd_vma elf32_arm_plt_entry [PLT_ENTRY_SIZE / 4] = - { - 0xe59fc004, /* ldr ip, [pc, #4] */ - 0xe08fc00c, /* add ip, pc, ip */ - 0xe59cf000, /* ldr pc, [ip] */ - 0x00000000 /* offset to symbol in got */ - }; + { + 0xe28fc600, /* add ip, pc, #0xNN00000 */ + 0xe28cca00, /* add ip, ip, #0xNN000 */ + 0xe5bcf000, /* ldr pc, [ip, #0xNNN]! */ + }; + +#endif /* The ARM linker needs to keep track of the number of relocs that it decides to copy in check_relocs for each symbol. This is so that @@ -152,14 +197,16 @@ static const bfd_vma elf32_arm_plt_entry [PLT_ENTRY_SIZE / 4] = /* This structure keeps track of the number of PC relative relocs we have copied for a given symbol. */ -struct elf32_arm_pcrel_relocs_copied +struct elf32_arm_relocs_copied { /* Next section. */ - struct elf32_arm_pcrel_relocs_copied * next; + struct elf32_arm_relocs_copied * next; /* A section in dynobj. */ asection * section; /* Number of relocs copied in this section. */ bfd_size_type count; + /* Number of relocs copied in this section. */ + bfd_size_type pc_count; }; /* Arm ELF linker hash entry. */ @@ -168,13 +215,9 @@ struct elf32_arm_link_hash_entry struct elf_link_hash_entry root; /* Number of PC relative relocs copied for this symbol. */ - struct elf32_arm_pcrel_relocs_copied * pcrel_relocs_copied; + struct elf32_arm_relocs_copied * relocs_copied; }; -/* Declare this now that the above structures are defined. */ -static bfd_boolean elf32_arm_discard_copies - PARAMS ((struct elf32_arm_link_hash_entry *, PTR)); - /* Traverse an arm ELF linker hash table. */ #define elf32_arm_link_hash_traverse(table, func, info) \ (elf_link_hash_traverse \ @@ -204,6 +247,18 @@ struct elf32_arm_link_hash_table /* A boolean indicating whether knowledge of the ARM's pipeline length should be applied by the linker. */ int no_pipeline_knowledge; + + /* Short-cuts to get to dynamic linker sections. */ + asection *sgot; + asection *sgotplt; + asection *srelgot; + asection *splt; + asection *srelplt; + asection *sdynbss; + asection *srelbss; + + /* Small local sym to section mapping cache. */ + struct sym_sec_cache sym_sec; }; /* Create an entry in an ARM ELF linker hash table. */ @@ -231,11 +286,121 @@ elf32_arm_link_hash_newfunc (entry, table, string) _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, table, string)); if (ret != (struct elf32_arm_link_hash_entry *) NULL) - ret->pcrel_relocs_copied = NULL; + ret->relocs_copied = NULL; return (struct bfd_hash_entry *) ret; } +/* Create .got, .gotplt, and .rel.got sections in DYNOBJ, and set up + shortcuts to them in our hash table. */ + +static bfd_boolean +create_got_section (dynobj, info) + bfd *dynobj; + struct bfd_link_info *info; +{ + struct elf32_arm_link_hash_table *htab; + + if (! _bfd_elf_create_got_section (dynobj, info)) + return FALSE; + + htab = elf32_arm_hash_table (info); + htab->sgot = bfd_get_section_by_name (dynobj, ".got"); + htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt"); + if (!htab->sgot || !htab->sgotplt) + abort (); + + htab->srelgot = bfd_make_section (dynobj, ".rel.got"); + if (htab->srelgot == NULL + || ! bfd_set_section_flags (dynobj, htab->srelgot, + (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS + | SEC_IN_MEMORY | SEC_LINKER_CREATED + | SEC_READONLY)) + || ! bfd_set_section_alignment (dynobj, htab->srelgot, 2)) + return FALSE; + return TRUE; +} + +/* Create .plt, .rel.plt, .got, .got.plt, .rel.got, .dynbss, and + .rel.bss sections in DYNOBJ, and set up shortcuts to them in our + hash table. */ + +static bfd_boolean +elf32_arm_create_dynamic_sections (dynobj, info) + bfd *dynobj; + struct bfd_link_info *info; +{ + struct elf32_arm_link_hash_table *htab; + + htab = elf32_arm_hash_table (info); + if (!htab->sgot && !create_got_section (dynobj, info)) + return FALSE; + + if (!_bfd_elf_create_dynamic_sections (dynobj, info)) + return FALSE; + + htab->splt = bfd_get_section_by_name (dynobj, ".plt"); + htab->srelplt = bfd_get_section_by_name (dynobj, ".rel.plt"); + htab->sdynbss = bfd_get_section_by_name (dynobj, ".dynbss"); + if (!info->shared) + htab->srelbss = bfd_get_section_by_name (dynobj, ".rel.bss"); + + if (!htab->splt || !htab->srelplt || !htab->sdynbss + || (!info->shared && !htab->srelbss)) + abort (); + + return TRUE; +} + +/* Copy the extra info we tack onto an elf_link_hash_entry. */ + +static void +elf32_arm_copy_indirect_symbol (const struct elf_backend_data *bed, + struct elf_link_hash_entry *dir, + struct elf_link_hash_entry *ind) +{ + struct elf32_arm_link_hash_entry *edir, *eind; + + edir = (struct elf32_arm_link_hash_entry *) dir; + eind = (struct elf32_arm_link_hash_entry *) ind; + + if (eind->relocs_copied != NULL) + { + if (edir->relocs_copied != NULL) + { + struct elf32_arm_relocs_copied **pp; + struct elf32_arm_relocs_copied *p; + + if (ind->root.type == bfd_link_hash_indirect) + abort (); + + /* Add reloc counts against the weak sym to the strong sym + list. Merge any entries against the same section. */ + for (pp = &eind->relocs_copied; (p = *pp) != NULL; ) + { + struct elf32_arm_relocs_copied *q; + + for (q = edir->relocs_copied; q != NULL; q = q->next) + if (q->section == p->section) + { + q->pc_count += p->pc_count; + q->count += p->count; + *pp = p->next; + break; + } + if (q == NULL) + pp = &p->next; + } + *pp = edir->relocs_copied; + } + + edir->relocs_copied = eind->relocs_copied; + eind->relocs_copied = NULL; + } + + _bfd_elf_link_hash_copy_indirect (bed, dir, ind); +} + /* Create an ARM elf linker hash table. */ static struct bfd_link_hash_table * @@ -256,10 +421,18 @@ elf32_arm_link_hash_table_create (abfd) return NULL; } + ret->sgot = NULL; + ret->sgotplt = NULL; + ret->srelgot = NULL; + ret->splt = NULL; + ret->srelplt = NULL; + ret->sdynbss = NULL; + ret->srelbss = NULL; ret->thumb_glue_size = 0; ret->arm_glue_size = 0; ret->bfd_of_glue_owner = NULL; ret->no_pipeline_knowledge = 0; + ret->sym_sec.abfd = NULL; return &ret->root.root; } @@ -1134,16 +1307,21 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd, #ifndef OLD_ARM_ABI case R_ARM_XPC25: #endif + /* r_symndx will be zero only for relocs against symbols + from removed linkonce sections, or sections discarded by + a linker script. */ + if (r_symndx == 0) + return bfd_reloc_ok; + /* When generating a shared object, these relocations are copied into the output file to be resolved at run time. */ - if (info->shared - && r_symndx != 0 - && (r_type != R_ARM_PC24 - || (h != NULL - && h->dynindx != -1 - && (! info->symbolic - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)))) + if ((info->shared + && (input_section->flags & SEC_ALLOC) + && (h == NULL + || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT + || h->root.type != bfd_link_hash_undefweak) + && (r_type != R_ARM_PC24 + || !SYMBOL_CALLS_LOCAL (info, h)))) { Elf_Internal_Rela outrel; bfd_byte *loc; @@ -1184,30 +1362,19 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd, if (skip) memset (&outrel, 0, sizeof outrel); - else if (r_type == R_ARM_PC24) - { - BFD_ASSERT (h != NULL && h->dynindx != -1); - if ((input_section->flags & SEC_ALLOC) == 0) - relocate = TRUE; - outrel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_PC24); - } + else if (h != NULL + && h->dynindx != -1 + && (r_type == R_ARM_PC24 + || !info->shared + || !info->symbolic + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)) + outrel.r_info = ELF32_R_INFO (h->dynindx, r_type); else { - if (h == NULL - || ((info->symbolic || h->dynindx == -1) - && (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) != 0)) - { - relocate = TRUE; - outrel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE); - } - else - { - BFD_ASSERT (h->dynindx != -1); - if ((input_section->flags & SEC_ALLOC) == 0) - relocate = TRUE; - outrel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_ABS32); - } + /* This symbol is local, or marked to become local. */ + relocate = TRUE; + outrel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE); } loc = sreloc->contents; @@ -1617,16 +1784,17 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd, if (h != NULL) { bfd_vma off; - bfd_boolean dyn = elf_hash_table (info)->dynamic_sections_created; + bfd_boolean dyn; off = h->got.offset; BFD_ASSERT (off != (bfd_vma) -1); + dyn = globals->root.dynamic_sections_created; - if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h) + if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h) || (info->shared - && (info->symbolic || h->dynindx == -1 - || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL)) - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) + && SYMBOL_REFERENCES_LOCAL (info, h)) + || (ELF_ST_VISIBILITY (h->other) + && h->root.type == bfd_link_hash_undefweak)) { /* This is actually a static link, or it is a -Bsymbolic link and the symbol is defined locally. We must initialize this @@ -1712,7 +1880,8 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd, contents, rel->r_offset, value, (bfd_vma) 0); - if (h->plt.offset == (bfd_vma) -1) + if (h->plt.offset == (bfd_vma) -1 + || globals->splt == NULL) /* We didn't make a PLT entry for this symbol. This happens when statically linking PIC code, or when using -Bsymbolic. */ @@ -1958,7 +2127,7 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section, bfd_put_32 (input_bfd, value, contents + rel->r_offset); } #else - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); #endif } else @@ -1983,9 +2152,10 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section, case R_ARM_THM_PC22: if (info->shared && ( - (!info->symbolic && h->dynindx != -1) + (!info->symbolic && h->dynindx != -1) || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0 ) + && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT && ((input_section->flags & SEC_ALLOC) != 0 /* DWARF will emit R_ARM_ABS32 relocations in its sections against symbols defined externally @@ -2217,7 +2387,6 @@ elf32_arm_merge_private_bfd_data (ibfd, obfd) flagword out_flags; flagword in_flags; bfd_boolean flags_compatible = TRUE; - bfd_boolean null_input_bfd = TRUE; asection *sec; /* Check if we have the same endianess. */ @@ -2268,21 +2437,29 @@ elf32_arm_merge_private_bfd_data (ibfd, obfd) if (in_flags == out_flags) return TRUE; - /* Check to see if the input BFD actually contains any sections. - If not, its flags may not have been initialised either, but it cannot - actually cause any incompatibility. */ - for (sec = ibfd->sections; sec != NULL; sec = sec->next) + /* Check to see if the input BFD actually contains any sections. If + not, its flags may not have been initialised either, but it + cannot actually cause any incompatibility. Do not short-circuit + dynamic objects; their section list may be emptied by + elf_link_add_object_symbols. */ + + if (!(ibfd->flags & DYNAMIC)) { - /* Ignore synthetic glue sections. */ - if (strcmp (sec->name, ".glue_7") - && strcmp (sec->name, ".glue_7t")) + bfd_boolean null_input_bfd = TRUE; + + for (sec = ibfd->sections; sec != NULL; sec = sec->next) { - null_input_bfd = FALSE; - break; + /* Ignore synthetic glue sections. */ + if (strcmp (sec->name, ".glue_7") + && strcmp (sec->name, ".glue_7t")) + { + null_input_bfd = FALSE; + break; + } } + if (null_input_bfd) + return TRUE; } - if (null_input_bfd) - return TRUE; /* Complain about various flag mismatches. */ if (EF_ARM_EABI_VERSION (in_flags) != EF_ARM_EABI_VERSION (out_flags)) @@ -2351,7 +2528,7 @@ ERROR: %s uses Maverick instructions, whereas %s does not"), bfd_get_filename (obfd)); else _bfd_error_handler (_("\ -ERROR: %s uses Maverick instructions, whereas %s does not"), +ERROR: %s does not use Maverick instructions, whereas %s does"), bfd_archive_filename (ibfd), bfd_get_filename (obfd)); @@ -2596,7 +2773,82 @@ elf32_arm_gc_sweep_hook (abfd, info, sec, relocs) asection *sec ATTRIBUTE_UNUSED; const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED; { - /* We don't support garbage collection of GOT and PLT relocs yet. */ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + bfd_signed_vma *local_got_refcounts; + const Elf_Internal_Rela *rel, *relend; + unsigned long r_symndx; + struct elf_link_hash_entry *h; + + elf_section_data (sec)->local_dynrel = NULL; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + local_got_refcounts = elf_local_got_refcounts (abfd); + + relend = relocs + sec->reloc_count; + for (rel = relocs; rel < relend; rel++) + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_ARM_GOT32: + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx >= symtab_hdr->sh_info) + { + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + if (h->got.refcount > 0) + h->got.refcount -= 1; + } + else if (local_got_refcounts != NULL) + { + if (local_got_refcounts[r_symndx] > 0) + local_got_refcounts[r_symndx] -= 1; + } + break; + + case R_ARM_ABS32: + case R_ARM_REL32: + case R_ARM_PC24: + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx >= symtab_hdr->sh_info) + { + struct elf32_arm_link_hash_entry *eh; + struct elf32_arm_relocs_copied **pp; + struct elf32_arm_relocs_copied *p; + + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + + if (!info->shared && h->plt.refcount > 0) + h->plt.refcount -= 1; + + eh = (struct elf32_arm_link_hash_entry *) h; + + for (pp = &eh->relocs_copied; (p = *pp) != NULL; pp = &p->next) + if (p->section == sec) + { + if (ELF32_R_TYPE (rel->r_info) == R_ARM_PC24) + p->pc_count -= 1; + p->count -= 1; + if (p->count == 0) + *pp = p->next; + break; + } + } + break; + + case R_ARM_PLT32: + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx >= symtab_hdr->sh_info) + { + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + if (h->plt.refcount > 0) + h->plt.refcount -= 1; + } + break; + + default: + break; + } + return TRUE; } @@ -2615,13 +2867,15 @@ elf32_arm_check_relocs (abfd, info, sec, relocs) const Elf_Internal_Rela *rel; const Elf_Internal_Rela *rel_end; bfd *dynobj; - asection *sgot, *srelgot, *sreloc; + asection *sreloc; bfd_vma *local_got_offsets; + struct elf32_arm_link_hash_table *htab; if (info->relocatable) return TRUE; - sgot = srelgot = sreloc = NULL; + htab = elf32_arm_hash_table (info); + sreloc = NULL; dynobj = elf_hash_table (info)->dynobj; local_got_offsets = elf_local_got_offsets (abfd); @@ -2646,126 +2900,82 @@ elf32_arm_check_relocs (abfd, info, sec, relocs) else h = sym_hashes[r_symndx - symtab_hdr->sh_info]; - /* Some relocs require a global offset table. */ - if (dynobj == NULL) - { - switch (ELF32_R_TYPE (rel->r_info)) - { - case R_ARM_GOT32: - case R_ARM_GOTOFF: - case R_ARM_GOTPC: - elf_hash_table (info)->dynobj = dynobj = abfd; - if (! _bfd_elf_create_got_section (dynobj, info)) - return FALSE; - break; - - default: - break; - } - } - switch (ELF32_R_TYPE (rel->r_info)) { - case R_ARM_GOT32: - /* This symbol requires a global offset table entry. */ - if (sgot == NULL) - { - sgot = bfd_get_section_by_name (dynobj, ".got"); - BFD_ASSERT (sgot != NULL); - } + case R_ARM_PLT32: + /* This symbol requires a procedure linkage table entry. We + actually build the entry in adjust_dynamic_symbol, + because this might be a case of linking PIC code which is + never referenced by a dynamic object, in which case we + don't need to generate a procedure linkage table entry + after all. */ - /* Get the got relocation section if necessary. */ - if (srelgot == NULL - && (h != NULL || info->shared)) - { - srelgot = bfd_get_section_by_name (dynobj, ".rel.got"); + /* If this is a local symbol, we resolve it directly without + creating a procedure linkage table entry. */ + if (h == NULL) + continue; - /* If no got relocation section, make one and initialize. */ - if (srelgot == NULL) - { - srelgot = bfd_make_section (dynobj, ".rel.got"); - if (srelgot == NULL - || ! bfd_set_section_flags (dynobj, srelgot, - (SEC_ALLOC - | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY - | SEC_LINKER_CREATED - | SEC_READONLY)) - || ! bfd_set_section_alignment (dynobj, srelgot, 2)) - return FALSE; - } - } + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + h->plt.refcount++; + break; + case R_ARM_GOT32: + /* This symbol requires a global offset table entry. */ if (h != NULL) { - if (h->got.offset != (bfd_vma) -1) - /* We have already allocated space in the .got. */ - break; - - h->got.offset = sgot->_raw_size; - - /* Make sure this symbol is output as a dynamic symbol. */ - if (h->dynindx == -1) - if (! bfd_elf32_link_record_dynamic_symbol (info, h)) - return FALSE; - - srelgot->_raw_size += sizeof (Elf32_External_Rel); + h->got.refcount++; } else { - /* This is a global offset table entry for a local - symbol. */ - if (local_got_offsets == NULL) + bfd_signed_vma *local_got_refcounts; + + /* This is a global offset table entry for a local symbol. */ + local_got_refcounts = elf_local_got_refcounts (abfd); + if (local_got_refcounts == NULL) { bfd_size_type size; - unsigned int i; size = symtab_hdr->sh_info; - size *= sizeof (bfd_vma); - local_got_offsets = (bfd_vma *) bfd_alloc (abfd, size); - if (local_got_offsets == NULL) + size *= (sizeof (bfd_signed_vma) + sizeof(char)); + local_got_refcounts = ((bfd_signed_vma *) + bfd_zalloc (abfd, size)); + if (local_got_refcounts == NULL) return FALSE; - elf_local_got_offsets (abfd) = local_got_offsets; - for (i = 0; i < symtab_hdr->sh_info; i++) - local_got_offsets[i] = (bfd_vma) -1; + elf_local_got_refcounts (abfd) = local_got_refcounts; } - - if (local_got_offsets[r_symndx] != (bfd_vma) -1) - /* We have already allocated space in the .got. */ - break; - - local_got_offsets[r_symndx] = sgot->_raw_size; - - if (info->shared) - /* If we are generating a shared object, we need to - output a R_ARM_RELATIVE reloc so that the dynamic - linker can adjust this GOT entry. */ - srelgot->_raw_size += sizeof (Elf32_External_Rel); + local_got_refcounts[r_symndx] += 1; } - - sgot->_raw_size += 4; break; - case R_ARM_PLT32: - /* This symbol requires a procedure linkage table entry. We - actually build the entry in adjust_dynamic_symbol, - because this might be a case of linking PIC code which is - never referenced by a dynamic object, in which case we - don't need to generate a procedure linkage table entry - after all. */ - - /* If this is a local symbol, we resolve it directly without - creating a procedure linkage table entry. */ - if (h == NULL) - continue; - - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + case R_ARM_GOTOFF: + case R_ARM_GOTPC: + if (htab->sgot == NULL) + { + if (htab->root.dynobj == NULL) + htab->root.dynobj = abfd; + if (!create_got_section (htab->root.dynobj, info)) + return FALSE; + } break; case R_ARM_ABS32: case R_ARM_REL32: case R_ARM_PC24: + if (h != NULL && !info->shared) + { + /* If this reloc is in a read-only section, we might + need a copy reloc. We can't check reliably at this + stage whether the section is read-only, as input + sections have not yet been mapped to output sections. + Tentatively set the flag for now, and correct in + adjust_dynamic_symbol. */ + h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF; + + /* We may need a .plt entry if the function this reloc + refers to is in a shared lib. */ + h->plt.refcount += 1; + } + /* If we are creating a shared library, and this is a reloc against a global symbol, or a non PC relative reloc against a local symbol, then we need to copy the reloc @@ -2777,14 +2987,17 @@ elf32_arm_check_relocs (abfd, info, sec, relocs) possible that DEF_REGULAR is not set now but will be set later (it is never cleared). We account for that possibility below by storing information in the - pcrel_relocs_copied field of the hash table entry. */ + relocs_copied field of the hash table entry. */ if (info->shared - && (ELF32_R_TYPE (rel->r_info) != R_ARM_PC24 - || (h != NULL - && (! info->symbolic - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)))) + && (sec->flags & SEC_ALLOC) != 0 + && (ELF32_R_TYPE (rel->r_info) != R_ARM_PC24 + || (h != NULL + && (! info->symbolic + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)))) { + struct elf32_arm_relocs_copied *p, **head; + /* When creating a shared object, we must copy these reloc types into the output file. We create a reloc section in dynobj and make room for this reloc. */ @@ -2818,45 +3031,49 @@ elf32_arm_check_relocs (abfd, info, sec, relocs) || ! bfd_set_section_alignment (dynobj, sreloc, 2)) return FALSE; } - if (sec->flags & SEC_READONLY) - info->flags |= DF_TEXTREL; + + elf_section_data (sec)->sreloc = sreloc; } - sreloc->_raw_size += sizeof (Elf32_External_Rel); - /* If we are linking with -Bsymbolic, and this is a - global symbol, we count the number of PC relative - relocations we have entered for this symbol, so that - we can discard them again if the symbol is later - defined by a regular object. Note that this function - is only called if we are using an elf_i386 linker - hash table, which means that h is really a pointer to - an elf_i386_link_hash_entry. */ - if (h != NULL && info->symbolic - && ELF32_R_TYPE (rel->r_info) == R_ARM_PC24) + /* If this is a global symbol, we count the number of + relocations we need for this symbol. */ + if (h != NULL) { - struct elf32_arm_link_hash_entry * eh; - struct elf32_arm_pcrel_relocs_copied * p; - - eh = (struct elf32_arm_link_hash_entry *) h; - - for (p = eh->pcrel_relocs_copied; p != NULL; p = p->next) - if (p->section == sreloc) - break; - + head = &((struct elf32_arm_link_hash_entry *) h)->relocs_copied; + } + else + { + /* Track dynamic relocs needed for local syms too. + We really need local syms available to do this + easily. Oh well. */ + + asection *s; + s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, + sec, r_symndx); + if (s == NULL) + return FALSE; + + head = ((struct elf32_arm_relocs_copied **) + &elf_section_data (s)->local_dynrel); + } + + p = *head; + if (p == NULL || p->section != sec) + { + bfd_size_type amt = sizeof *p; + p = bfd_alloc (htab->root.dynobj, amt); if (p == NULL) - { - p = ((struct elf32_arm_pcrel_relocs_copied *) - bfd_alloc (dynobj, (bfd_size_type) sizeof * p)); - if (p == NULL) - return FALSE; - p->next = eh->pcrel_relocs_copied; - eh->pcrel_relocs_copied = p; - p->section = sreloc; - p->count = 0; - } - - ++p->count; + return FALSE; + p->next = *head; + *head = p; + p->section = sec; + p->count = 0; + p->pc_count = 0; } + + p->count += 1; + if (ELF32_R_TYPE (rel->r_info) == R_ARM_PC24) + p->pc_count += 1; } break; @@ -2996,71 +3213,29 @@ elf32_arm_adjust_dynamic_symbol (info, h) if (h->type == STT_FUNC || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) { - /* If we link a program (not a DSO), we'll get rid of unnecessary - PLT entries; we point to the actual symbols -- even for pic - relocs, because a program built with -fpic should have the same - result as one built without -fpic, specifically considering weak - symbols. - FIXME: m68k and i386 differ here, for unclear reasons. */ - if (! info->shared - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0) + if (h->plt.refcount <= 0 + || SYMBOL_CALLS_LOCAL (info, h) + || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT + && h->root.type == bfd_link_hash_undefweak)) { /* This case can occur if we saw a PLT32 reloc in an input - file, but the symbol was not defined by a dynamic object. - In such a case, we don't actually need to build a - procedure linkage table, and we can just do a PC32 reloc - instead. */ - BFD_ASSERT ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0); + file, but the symbol was never referred to by a dynamic + object, or if all references were garbage collected. In + such a case, we don't actually need to build a procedure + linkage table, and we can just do a PC24 reloc instead. */ + h->plt.offset = (bfd_vma) -1; h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; - return TRUE; - } - - /* Make sure this symbol is output as a dynamic symbol. */ - if (h->dynindx == -1) - { - if (! bfd_elf32_link_record_dynamic_symbol (info, h)) - return FALSE; - } - - s = bfd_get_section_by_name (dynobj, ".plt"); - BFD_ASSERT (s != NULL); - - /* If this is the first .plt entry, make room for the special - first entry. */ - if (s->_raw_size == 0) - s->_raw_size += PLT_ENTRY_SIZE; - - /* If this symbol is not defined in a regular file, and we are - not generating a shared library, then set the symbol to this - location in the .plt. This is required to make function - pointers compare as equal between the normal executable and - the shared library. */ - if (! info->shared - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - { - h->root.u.def.section = s; - h->root.u.def.value = s->_raw_size; } - h->plt.offset = s->_raw_size; - - /* Make room for this entry. */ - s->_raw_size += PLT_ENTRY_SIZE; - - /* We also need to make an entry in the .got.plt section, which - will be placed in the .got section by the linker script. */ - s = bfd_get_section_by_name (dynobj, ".got.plt"); - BFD_ASSERT (s != NULL); - s->_raw_size += 4; - - /* We also need to make an entry in the .rel.plt section. */ - - s = bfd_get_section_by_name (dynobj, ".rel.plt"); - BFD_ASSERT (s != NULL); - s->_raw_size += sizeof (Elf32_External_Rel); - return TRUE; } + else + /* It's possible that we incorrectly decided a .plt reloc was + needed for an R_ARM_PC24 reloc to a non-function sym in + check_relocs. We can't decide accurately between function and + non-function syms in check-relocs; Objects loaded later in + the link may change h->type. So fix it now. */ + h->plt.offset = (bfd_vma) -1; /* If this is a weak symbol, and there is a real definition, the processor independent code will have arranged for us to see the @@ -3135,6 +3310,198 @@ elf32_arm_adjust_dynamic_symbol (info, h) return TRUE; } +/* Allocate space in .plt, .got and associated reloc sections for + dynamic relocs. */ + +static bfd_boolean +allocate_dynrelocs (h, inf) + struct elf_link_hash_entry *h; + PTR inf; +{ + struct bfd_link_info *info; + struct elf32_arm_link_hash_table *htab; + struct elf32_arm_link_hash_entry *eh; + struct elf32_arm_relocs_copied *p; + + if (h->root.type == bfd_link_hash_indirect) + return TRUE; + + if (h->root.type == bfd_link_hash_warning) + /* When warning symbols are created, they **replace** the "real" + entry in the hash table, thus we never get to see the real + symbol in a hash traversal. So look at it now. */ + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + info = (struct bfd_link_info *) inf; + htab = elf32_arm_hash_table (info); + + if (htab->root.dynamic_sections_created + && h->plt.refcount > 0) + { + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 + && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + { + if (! bfd_elf32_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + if (info->shared + || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h)) + { + asection *s = htab->splt; + + /* If this is the first .plt entry, make room for the special + first entry. */ + if (s->_raw_size == 0) + s->_raw_size += PLT_HEADER_SIZE; + + h->plt.offset = s->_raw_size; + + /* If this symbol is not defined in a regular file, and we are + not generating a shared library, then set the symbol to this + location in the .plt. This is required to make function + pointers compare as equal between the normal executable and + the shared library. */ + if (! info->shared + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + { + h->root.u.def.section = s; + h->root.u.def.value = h->plt.offset; + } + + /* Make room for this entry. */ + s->_raw_size += PLT_ENTRY_SIZE; + + /* We also need to make an entry in the .got.plt section, which + will be placed in the .got section by the linker script. */ + htab->sgotplt->_raw_size += 4; + + /* We also need to make an entry in the .rel.plt section. */ + htab->srelplt->_raw_size += sizeof (Elf32_External_Rel); + } + else + { + h->plt.offset = (bfd_vma) -1; + h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + } + } + else + { + h->plt.offset = (bfd_vma) -1; + h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + } + + if (h->got.refcount > 0) + { + asection *s; + bfd_boolean dyn; + + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 + && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + { + if (! bfd_elf32_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + s = htab->sgot; + h->got.offset = s->_raw_size; + s->_raw_size += 4; + dyn = htab->root.dynamic_sections_created; + if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT + || h->root.type != bfd_link_hash_undefweak) + && (info->shared + || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))) + htab->srelgot->_raw_size += sizeof (Elf32_External_Rel); + } + else + h->got.offset = (bfd_vma) -1; + + eh = (struct elf32_arm_link_hash_entry *) h; + if (eh->relocs_copied == NULL) + return TRUE; + + /* In the shared -Bsymbolic case, discard space allocated for + dynamic pc-relative relocs against symbols which turn out to be + defined in regular objects. For the normal shared case, discard + space for pc-relative relocs that have become local due to symbol + visibility changes. */ + + if (info->shared) + { + /* The only reloc that uses pc_count is R_ARM_PC24, which will + appear on a call or on something like ".long foo - .". We + want calls to protected symbols to resolve directly to the + function rather than going via the plt. If people want + function pointer comparisons to work as expected then they + should avoid writing assembly like ".long foo - .". */ + if (SYMBOL_CALLS_LOCAL (info, h)) + { + struct elf32_arm_relocs_copied **pp; + + for (pp = &eh->relocs_copied; (p = *pp) != NULL; ) + { + p->count -= p->pc_count; + p->pc_count = 0; + if (p->count == 0) + *pp = p->next; + else + pp = &p->next; + } + } + + /* Also discard relocs on undefined weak syms with non-default + visibility. */ + if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT + && h->root.type == bfd_link_hash_undefweak) + eh->relocs_copied = NULL; + } + else + { + /* For the non-shared case, discard space for relocs against + symbols which turn out to need copy relocs or are not + dynamic. */ + + if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 + && (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + || (htab->root.dynamic_sections_created + && (h->root.type == bfd_link_hash_undefweak + || h->root.type == bfd_link_hash_undefined)))) + { + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 + && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + { + if (! bfd_elf32_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + /* If that succeeded, we know we'll be keeping all the + relocs. */ + if (h->dynindx != -1) + goto keep; + } + + eh->relocs_copied = NULL; + + keep: ; + } + + /* Finally, allocate space. */ + for (p = eh->relocs_copied; p != NULL; p = p->next) + { + asection *sreloc = elf_section_data (p->section)->sreloc; + sreloc->_raw_size += p->count * sizeof (Elf32_External_Rel); + } + + return TRUE; +} + /* Set the sizes of the dynamic sections. */ static bfd_boolean @@ -3146,14 +3513,17 @@ elf32_arm_size_dynamic_sections (output_bfd, info) asection * s; bfd_boolean plt; bfd_boolean relocs; + bfd *ibfd; + struct elf32_arm_link_hash_table *htab; + htab = elf32_arm_hash_table (info); dynobj = elf_hash_table (info)->dynobj; BFD_ASSERT (dynobj != NULL); if (elf_hash_table (info)->dynamic_sections_created) { /* Set the contents of the .interp section to the interpreter. */ - if (! info->shared) + if (info->executable) { s = bfd_get_section_by_name (dynobj, ".interp"); BFD_ASSERT (s != NULL); @@ -3161,26 +3531,74 @@ elf32_arm_size_dynamic_sections (output_bfd, info) s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; } } - else + + /* Set up .got offsets for local syms, and space for local dynamic + relocs. */ + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) { - /* We may have created entries in the .rel.got section. - However, if we are not creating the dynamic sections, we will - not actually use these entries. Reset the size of .rel.got, - which will cause it to get stripped from the output file - below. */ - s = bfd_get_section_by_name (dynobj, ".rel.got"); - if (s != NULL) - s->_raw_size = 0; + bfd_signed_vma *local_got; + bfd_signed_vma *end_local_got; + char *local_tls_type; + bfd_size_type locsymcount; + Elf_Internal_Shdr *symtab_hdr; + asection *srel; + + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour) + continue; + + for (s = ibfd->sections; s != NULL; s = s->next) + { + struct elf32_arm_relocs_copied *p; + + for (p = *((struct elf32_arm_relocs_copied **) + &elf_section_data (s)->local_dynrel); + p != NULL; + p = p->next) + { + if (!bfd_is_abs_section (p->section) + && bfd_is_abs_section (p->section->output_section)) + { + /* Input section has been discarded, either because + it is a copy of a linkonce section or due to + linker script /DISCARD/, so we'll be discarding + the relocs too. */ + } + else if (p->count != 0) + { + srel = elf_section_data (p->section)->sreloc; + srel->_raw_size += p->count * sizeof (Elf32_External_Rel); + if ((p->section->output_section->flags & SEC_READONLY) != 0) + info->flags |= DF_TEXTREL; + } + } + } + + local_got = elf_local_got_refcounts (ibfd); + if (!local_got) + continue; + + symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; + locsymcount = symtab_hdr->sh_info; + end_local_got = local_got + locsymcount; + s = htab->sgot; + srel = htab->srelgot; + for (; local_got < end_local_got; ++local_got, ++local_tls_type) + { + if (*local_got > 0) + { + *local_got = s->_raw_size; + s->_raw_size += 4; + if (info->shared) + srel->_raw_size += sizeof (Elf32_External_Rel); + } + else + *local_got = (bfd_vma) -1; + } } - /* If this is a -Bsymbolic shared link, then we need to discard all - PC relative relocs against symbols defined in a regular object. - We allocated space for them in the check_relocs routine, but we - will not fill them in in the relocate_section routine. */ - if (info->shared && info->symbolic) - elf32_arm_link_hash_traverse (elf32_arm_hash_table (info), - elf32_arm_discard_copies, - (PTR) NULL); + /* Allocate global sym .plt and .got entries, and space for global + sym dynamic relocs. */ + elf_link_hash_traverse (&htab->root, allocate_dynrelocs, (PTR) info); /* The check_relocs and adjust_dynamic_symbol entry points have determined the sizes of the various dynamic sections. Allocate @@ -3305,33 +3723,6 @@ elf32_arm_size_dynamic_sections (output_bfd, info) return TRUE; } -/* This function is called via elf32_arm_link_hash_traverse if we are - creating a shared object with -Bsymbolic. It discards the space - allocated to copy PC relative relocs against symbols which are - defined in regular objects. We allocated space for them in the - check_relocs routine, but we won't fill them in in the - relocate_section routine. */ - -static bfd_boolean -elf32_arm_discard_copies (h, ignore) - struct elf32_arm_link_hash_entry * h; - PTR ignore ATTRIBUTE_UNUSED; -{ - struct elf32_arm_pcrel_relocs_copied * s; - - if (h->root.root.type == bfd_link_hash_warning) - h = (struct elf32_arm_link_hash_entry *) h->root.root.u.i.link; - - /* We only discard relocs for symbols defined in a regular object. */ - if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - return TRUE; - - for (s = h->pcrel_relocs_copied; s != NULL; s = s->next) - s->section->_raw_size -= s->count * sizeof (Elf32_External_Rel); - - return TRUE; -} - /* Finish up dynamic symbol handling. We set the contents of various dynamic sections here. */ @@ -3355,6 +3746,7 @@ elf32_arm_finish_dynamic_symbol (output_bfd, info, h, sym) bfd_vma got_offset; Elf_Internal_Rela rel; bfd_byte *loc; + bfd_vma got_displacement; /* This symbol has an entry in the procedure linkage table. Set it up. */ @@ -3370,35 +3762,43 @@ elf32_arm_finish_dynamic_symbol (output_bfd, info, h, sym) corresponds to this symbol. This is the index of this symbol in all the symbols for which we are making plt entries. The first entry in the procedure linkage table is reserved. */ - plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1; + plt_index = (h->plt.offset - PLT_HEADER_SIZE) / PLT_ENTRY_SIZE; /* Get the offset into the .got table of the entry that corresponds to this function. Each .got entry is 4 bytes. The first three are reserved. */ got_offset = (plt_index + 3) * 4; + /* Calculate the displacement between the PLT slot and the + entry in the GOT. */ + got_displacement = (sgot->output_section->vma + + sgot->output_offset + + got_offset + - splt->output_section->vma + - splt->output_offset + - h->plt.offset + - 8); + + BFD_ASSERT ((got_displacement & 0xf0000000) == 0); + /* Fill in the entry in the procedure linkage table. */ - bfd_put_32 (output_bfd, elf32_arm_plt_entry[0], + bfd_put_32 (output_bfd, elf32_arm_plt_entry[0] | ((got_displacement & 0x0ff00000) >> 20), splt->contents + h->plt.offset + 0); - bfd_put_32 (output_bfd, elf32_arm_plt_entry[1], + bfd_put_32 (output_bfd, elf32_arm_plt_entry[1] | ((got_displacement & 0x000ff000) >> 12), splt->contents + h->plt.offset + 4); - bfd_put_32 (output_bfd, elf32_arm_plt_entry[2], + bfd_put_32 (output_bfd, elf32_arm_plt_entry[2] | (got_displacement & 0x00000fff), splt->contents + h->plt.offset + 8); - bfd_put_32 (output_bfd, - (sgot->output_section->vma - + sgot->output_offset - + got_offset - - splt->output_section->vma - - splt->output_offset - - h->plt.offset - 12), - splt->contents + h->plt.offset + 12); +#ifdef FOUR_WORD_PLT + bfd_put_32 (output_bfd, elf32_arm_plt_entry[3], + splt->contents + h->plt.offset + 12); +#endif /* Fill in the entry in the global offset table. */ bfd_put_32 (output_bfd, (splt->output_section->vma + splt->output_offset), sgot->contents + got_offset); - + /* Fill in the entry in the .rel.plt section. */ rel.r_offset = (sgot->output_section->vma + sgot->output_offset @@ -3439,16 +3839,20 @@ elf32_arm_finish_dynamic_symbol (output_bfd, info, h, sym) + sgot->output_offset + (h->got.offset &~ (bfd_vma) 1)); - /* If this is a -Bsymbolic link, and the symbol is defined - locally, we just want to emit a RELATIVE reloc. The entry in - the global offset table will already have been initialized in - the relocate_section function. */ + /* If this is a static link, or it is a -Bsymbolic link and the + symbol is defined locally or was forced to be local because + of a version file, we just want to emit a RELATIVE reloc. + The entry in the global offset table will already have been + initialized in the relocate_section function. */ if (info->shared - && (info->symbolic || h->dynindx == -1) - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) - rel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE); + && SYMBOL_REFERENCES_LOCAL (info, h)) + { + BFD_ASSERT((h->got.offset & 1) != 0); + rel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE); + } else { + BFD_ASSERT((h->got.offset & 1) == 0); bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset); rel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_GLOB_DAT); } @@ -3602,10 +4006,26 @@ elf32_arm_finish_dynamic_sections (output_bfd, info) /* Fill in the first entry in the procedure linkage table. */ if (splt->_raw_size > 0) { + bfd_vma got_displacement; + + /* Calculate the displacement between the PLT slot and &GOT[0]. */ + got_displacement = (sgot->output_section->vma + + sgot->output_offset + - splt->output_section->vma + - splt->output_offset + - 16); + bfd_put_32 (output_bfd, elf32_arm_plt0_entry[0], splt->contents + 0); bfd_put_32 (output_bfd, elf32_arm_plt0_entry[1], splt->contents + 4); bfd_put_32 (output_bfd, elf32_arm_plt0_entry[2], splt->contents + 8); bfd_put_32 (output_bfd, elf32_arm_plt0_entry[3], splt->contents + 12); +#ifdef FOUR_WORD_PLT + /* The displacement value goes in the otherwise-unused last word of + the second entry. */ + bfd_put_32 (output_bfd, got_displacement, splt->contents + 28); +#else + bfd_put_32 (output_bfd, got_displacement, splt->contents + 16); +#endif } /* UnixWare sets the entsize of .plt to 4, although that doesn't @@ -3707,7 +4127,7 @@ elf32_arm_final_write_processing (abfd, linker) #define elf_backend_check_relocs elf32_arm_check_relocs #define elf_backend_relocate_section elf32_arm_relocate_section #define elf_backend_adjust_dynamic_symbol elf32_arm_adjust_dynamic_symbol -#define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections +#define elf_backend_create_dynamic_sections elf32_arm_create_dynamic_sections #define elf_backend_finish_dynamic_symbol elf32_arm_finish_dynamic_symbol #define elf_backend_finish_dynamic_sections elf32_arm_finish_dynamic_sections #define elf_backend_size_dynamic_sections elf32_arm_size_dynamic_sections @@ -3716,7 +4136,9 @@ elf32_arm_final_write_processing (abfd, linker) #define elf_backend_object_p elf32_arm_object_p #define elf_backend_section_flags elf32_arm_section_flags #define elf_backend_final_write_processing elf32_arm_final_write_processing +#define elf_backend_copy_indirect_symbol elf32_arm_copy_indirect_symbol +#define elf_backend_can_refcount 1 #define elf_backend_can_gc_sections 1 #define elf_backend_plt_readonly 1 #define elf_backend_want_got_plt 1 @@ -3726,7 +4148,6 @@ elf32_arm_final_write_processing (abfd, linker) #endif #define elf_backend_got_header_size 12 -#define elf_backend_plt_header_size PLT_ENTRY_SIZE #include "elf32-target.h" diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c index defa9ce..44f2b38 100644 --- a/bfd/elf32-avr.c +++ b/bfd/elf32-avr.c @@ -750,7 +750,7 @@ elf32_avr_relocate_section (output_bfd, info, input_bfd, input_section, { sym = local_syms + r_symndx; sec = local_sections [r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c index d630a2a..2c63474 100644 --- a/bfd/elf32-cris.c +++ b/bfd/elf32-cris.c @@ -847,7 +847,7 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section, { sym = local_syms + r_symndx; sec = local_sections [r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); symname = (bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name)); @@ -1292,16 +1292,7 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section, { long indx; - if (h == NULL) - sec = local_sections[r_symndx]; - else - { - BFD_ASSERT (h->root.type == bfd_link_hash_defined - || (h->root.type - == bfd_link_hash_defweak)); - sec = h->root.u.def.section; - } - if (sec != NULL && bfd_is_abs_section (sec)) + if (bfd_is_abs_section (sec)) indx = 0; else if (sec == NULL || sec->owner == NULL) { @@ -2647,7 +2638,7 @@ elf_cris_size_dynamic_sections (output_bfd, info) if (elf_hash_table (info)->dynamic_sections_created) { /* Set the contents of the .interp section to the interpreter. */ - if (!info->shared) + if (info->executable) { s = bfd_get_section_by_name (dynobj, ".interp"); BFD_ASSERT (s != NULL); @@ -3064,7 +3055,6 @@ elf_cris_reloc_type_class (rela) #define elf_backend_plt_readonly 1 #define elf_backend_want_plt_sym 0 #define elf_backend_got_header_size 12 -#define elf_backend_plt_header_size PLT_ENTRY_SIZE /* Later, we my want to optimize RELA entries into REL entries for dynamic linking and libraries (if it's a win of any significance). Until then, diff --git a/bfd/elf32-d10v.c b/bfd/elf32-d10v.c index cc5eddc..f9454ff 100644 --- a/bfd/elf32-d10v.c +++ b/bfd/elf32-d10v.c @@ -38,6 +38,10 @@ static bfd_boolean elf32_d10v_gc_sweep_hook static bfd_boolean elf32_d10v_check_relocs PARAMS ((bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *)); +static bfd_vma extract_rel_addend + PARAMS ((bfd *, bfd_byte *, reloc_howto_type *)); +static void insert_rel_addend + PARAMS ((bfd *, bfd_byte *, reloc_howto_type *, bfd_vma)); static bfd_boolean elf32_d10v_relocate_section PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, @@ -346,6 +350,75 @@ elf32_d10v_check_relocs (abfd, info, sec, relocs) return TRUE; } +static bfd_vma +extract_rel_addend (abfd, where, howto) + bfd *abfd; + bfd_byte *where; + reloc_howto_type *howto; +{ + bfd_vma insn, val; + + switch (howto->size) + { + case 0: + insn = bfd_get_8 (abfd, where); + break; + case 1: + insn = bfd_get_16 (abfd, where); + break; + case 2: + insn = bfd_get_32 (abfd, where); + break; + default: + abort (); + } + + val = (insn & howto->dst_mask) >> howto->bitpos << howto->rightshift; + /* We should really be testing for signed addends here, but we don't + have that info directly in the howto. */ + if (howto->pc_relative) + { + bfd_vma sign; + sign = howto->dst_mask & (~howto->dst_mask >> 1 | ~(-(bfd_vma) 1 >> 1)); + sign = sign >> howto->bitpos << howto->rightshift; + val = (val ^ sign) - sign; + } + return val; +} + +static void +insert_rel_addend (abfd, where, howto, addend) + bfd *abfd; + bfd_byte *where; + reloc_howto_type *howto; + bfd_vma addend; +{ + bfd_vma insn; + + addend = (addend >> howto->rightshift << howto->bitpos) & howto->dst_mask; + insn = ~howto->dst_mask; + switch (howto->size) + { + case 0: + insn &= bfd_get_8 (abfd, where); + insn |= addend; + bfd_put_8 (abfd, insn, where); + break; + case 1: + insn &= bfd_get_16 (abfd, where); + insn |= addend; + bfd_put_16 (abfd, insn, where); + break; + case 2: + insn &= bfd_get_32 (abfd, where); + insn |= addend; + bfd_put_32 (abfd, insn, where); + break; + default: + abort (); + } +} + /* Relocate a D10V ELF section. */ static bfd_boolean elf32_d10v_relocate_section (output_bfd, info, input_bfd, input_section, @@ -391,20 +464,28 @@ elf32_d10v_relocate_section (output_bfd, info, input_bfd, input_section, if (info->relocatable) { + bfd_vma val; + bfd_byte *where; + /* This is a relocatable link. We don't have to change anything, unless the reloc is against a section symbol, in which case we have to adjust according to where the section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections[r_symndx]; - rel->r_addend += sec->output_offset + sym->st_value; - } - } + if (r_symndx >= symtab_hdr->sh_info) + continue; + sym = local_syms + r_symndx; + if (ELF_ST_TYPE (sym->st_info) != STT_SECTION) + continue; + + sec = local_sections[r_symndx]; + val = sec->output_offset; + if (val == 0) + continue; + + where = contents + rel->r_offset; + val += extract_rel_addend (input_bfd, where, howto); + insert_rel_addend (input_bfd, where, howto, val); continue; } @@ -416,7 +497,23 @@ elf32_d10v_relocate_section (output_bfd, info, input_bfd, input_section, { sym = local_syms + r_symndx; sec = local_sections[r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + relocation = (sec->output_section->vma + + sec->output_offset + + sym->st_value); + if ((sec->flags & SEC_MERGE) + && ELF_ST_TYPE (sym->st_info) == STT_SECTION) + { + asection *msec; + bfd_vma addend; + bfd_byte *where = contents + rel->r_offset; + + addend = extract_rel_addend (input_bfd, where, howto); + msec = sec; + addend = _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend); + addend -= relocation; + addend += msec->output_section->vma + msec->output_offset; + insert_rel_addend (input_bfd, where, howto, addend); + } } else { @@ -456,7 +553,7 @@ elf32_d10v_relocate_section (output_bfd, info, input_bfd, input_section, r = _bfd_final_link_relocate (howto, input_bfd, input_section, contents, rel->r_offset, - relocation, rel->r_addend); + relocation, (bfd_vma) 0); if (r != bfd_reloc_ok) { diff --git a/bfd/elf32-fr30.c b/bfd/elf32-fr30.c index c4e2290..472a07a 100644 --- a/bfd/elf32-fr30.c +++ b/bfd/elf32-fr30.c @@ -552,7 +552,7 @@ fr30_elf_relocate_section (output_bfd, info, input_bfd, input_section, { sym = local_syms + r_symndx; sec = local_sections [r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c index faa1401..5157f40 100644 --- a/bfd/elf32-frv.c +++ b/bfd/elf32-frv.c @@ -111,7 +111,7 @@ static reloc_howto_type elf32_frv_howto_table [] = /* A 16 bit pc-relative relocation. */ HOWTO (R_FRV_LABEL16, /* type */ - 0, /* rightshift */ + 2, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ TRUE, /* pc_relative */ @@ -724,7 +724,7 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, { sym = local_syms + r_symndx; sec = local_sections [r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); @@ -997,6 +997,7 @@ elf32_frv_machine (abfd) switch (elf_elfheader (abfd)->e_flags & EF_FRV_CPU_MASK) { default: break; + case EF_FRV_CPU_FR550: return bfd_mach_fr550; case EF_FRV_CPU_FR500: return bfd_mach_fr500; case EF_FRV_CPU_FR400: return bfd_mach_fr400; case EF_FRV_CPU_FR300: return bfd_mach_fr300; @@ -1245,6 +1246,7 @@ frv_elf_merge_private_bfd_data (ibfd, obfd) default: strcat (new_opt, " -mcpu=?"); break; case EF_FRV_CPU_GENERIC: strcat (new_opt, " -mcpu=frv"); break; case EF_FRV_CPU_SIMPLE: strcat (new_opt, " -mcpu=simple"); break; + case EF_FRV_CPU_FR550: strcat (new_opt, " -mcpu=fr550"); break; case EF_FRV_CPU_FR500: strcat (new_opt, " -mcpu=fr500"); break; case EF_FRV_CPU_FR400: strcat (new_opt, " -mcpu=fr400"); break; case EF_FRV_CPU_FR300: strcat (new_opt, " -mcpu=fr300"); break; @@ -1256,6 +1258,7 @@ frv_elf_merge_private_bfd_data (ibfd, obfd) default: strcat (old_opt, " -mcpu=?"); break; case EF_FRV_CPU_GENERIC: strcat (old_opt, " -mcpu=frv"); break; case EF_FRV_CPU_SIMPLE: strcat (old_opt, " -mcpu=simple"); break; + case EF_FRV_CPU_FR550: strcat (old_opt, " -mcpu=fr550"); break; case EF_FRV_CPU_FR500: strcat (old_opt, " -mcpu=fr500"); break; case EF_FRV_CPU_FR400: strcat (old_opt, " -mcpu=fr400"); break; case EF_FRV_CPU_FR300: strcat (old_opt, " -mcpu=fr300"); break; @@ -1322,6 +1325,7 @@ frv_elf_print_private_bfd_data (abfd, ptr) { default: break; case EF_FRV_CPU_SIMPLE: fprintf (file, " -mcpu=simple"); break; + case EF_FRV_CPU_FR550: fprintf (file, " -mcpu=fr550"); break; case EF_FRV_CPU_FR500: fprintf (file, " -mcpu=fr500"); break; case EF_FRV_CPU_FR400: fprintf (file, " -mcpu=fr400"); break; case EF_FRV_CPU_FR300: fprintf (file, " -mcpu=fr300"); break; diff --git a/bfd/elf32-h8300.c b/bfd/elf32-h8300.c index efd14bb..452db27 100644 --- a/bfd/elf32-h8300.c +++ b/bfd/elf32-h8300.c @@ -225,7 +225,7 @@ struct elf_reloc_map { unsigned char howto_index; }; -/* An array mapping BFD reloc codes to SH ELF relocs. */ +/* An array mapping BFD reloc codes to H8 ELF relocs. */ static const struct elf_reloc_map h8_reloc_map[] = { { BFD_RELOC_NONE, R_H8_NONE_X }, @@ -435,7 +435,7 @@ elf32_h8_relocate_section (bfd *output_bfd, struct bfd_link_info *info, { sym = local_syms + r_symndx; sec = local_sections[r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); } else { diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index be0727f..c2e2f70 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -141,6 +141,12 @@ static const bfd_byte plt_stub[] = #define IS_ABSOLUTE_RELOC(r_type) 1 #endif +/* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid + copying dynamic variables from a shared lib into an app's dynbss + section, and instead use a dynamic relocation to point into the + shared lib. */ +#define ELIMINATE_COPY_RELOCS 1 + enum elf32_hppa_stub_type { hppa_stub_long_branch, hppa_stub_long_branch_shared, @@ -1003,7 +1009,18 @@ elf32_hppa_copy_indirect_symbol (const struct elf_backend_data *bed, eind->dyn_relocs = NULL; } - _bfd_elf_link_hash_copy_indirect (bed, dir, ind); + if (ELIMINATE_COPY_RELOCS + && ind->root.type != bfd_link_hash_indirect + && (dir->elf_link_hash_flags & ELF_LINK_HASH_DYNAMIC_ADJUSTED) != 0) + /* If called to transfer flags for a weakdef during processing + of elf_adjust_dynamic_symbol, don't copy ELF_LINK_NON_GOT_REF. + We clear it ourselves for ELIMINATE_COPY_RELOCS. */ + dir->elf_link_hash_flags |= + (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC + | ELF_LINK_HASH_REF_REGULAR + | ELF_LINK_HASH_REF_REGULAR_NONWEAK)); + else + _bfd_elf_link_hash_copy_indirect (bed, dir, ind); } /* Look through the relocs for a section during the first phase, and @@ -1332,7 +1349,8 @@ elf32_hppa_check_relocs (bfd *abfd, || h->elf.root.type == bfd_link_hash_defweak || (h->elf.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)))) - || (!info->shared + || (ELIMINATE_COPY_RELOCS + && !info->shared && (sec->flags & SEC_ALLOC) != 0 && h != NULL && (h->elf.root.type == bfd_link_hash_defweak @@ -1623,8 +1641,6 @@ elf32_hppa_adjust_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h) { struct elf32_hppa_link_hash_table *htab; - struct elf32_hppa_link_hash_entry *eh; - struct elf32_hppa_dyn_reloc_entry *p; asection *s; unsigned int power_of_two; @@ -1666,6 +1682,10 @@ elf32_hppa_adjust_dynamic_symbol (struct bfd_link_info *info, abort (); h->root.u.def.section = h->weakdef->root.u.def.section; h->root.u.def.value = h->weakdef->root.u.def.value; + if (ELIMINATE_COPY_RELOCS) + h->elf_link_hash_flags + = ((h->elf_link_hash_flags & ~ELF_LINK_NON_GOT_REF) + | (h->weakdef->elf_link_hash_flags & ELF_LINK_NON_GOT_REF)); return TRUE; } @@ -1684,20 +1704,26 @@ elf32_hppa_adjust_dynamic_symbol (struct bfd_link_info *info, if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0) return TRUE; - eh = (struct elf32_hppa_link_hash_entry *) h; - for (p = eh->dyn_relocs; p != NULL; p = p->next) + if (ELIMINATE_COPY_RELOCS) { - s = p->sec->output_section; - if (s != NULL && (s->flags & SEC_READONLY) != 0) - break; - } + struct elf32_hppa_link_hash_entry *eh; + struct elf32_hppa_dyn_reloc_entry *p; - /* If we didn't find any dynamic relocs in read-only sections, then - we'll be keeping the dynamic relocs and avoiding the copy reloc. */ - if (p == NULL) - { - h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF; - return TRUE; + eh = (struct elf32_hppa_link_hash_entry *) h; + for (p = eh->dyn_relocs; p != NULL; p = p->next) + { + s = p->sec->output_section; + if (s != NULL && (s->flags & SEC_READONLY) != 0) + break; + } + + /* If we didn't find any dynamic relocs in read-only sections, then + we'll be keeping the dynamic relocs and avoiding the copy reloc. */ + if (p == NULL) + { + h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF; + return TRUE; + } } /* We must allocate the symbol in our .dynbss section, which will @@ -1883,9 +1909,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) if (info->shared) { #if RELATIVE_DYNRELOCS - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0 - && ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0 - || info->symbolic)) + if (SYMBOL_CALLS_LOCAL (info, h)) { struct elf32_hppa_dyn_reloc_entry **pp; @@ -1900,6 +1924,12 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) } } #endif + + /* Also discard relocs on undefined weak syms with non-default + visibility. */ + if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT + && h->root.type == bfd_link_hash_undefweak) + eh->dyn_relocs = NULL; } else { @@ -1907,7 +1937,8 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) symbols which turn out to need copy relocs or are not dynamic. */ if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 - && (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 + && ((ELIMINATE_COPY_RELOCS + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) || (htab->elf.dynamic_sections_created && (h->root.type == bfd_link_hash_undefweak @@ -2016,7 +2047,7 @@ elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, if (htab->elf.dynamic_sections_created) { /* Set the contents of the .interp section to the interpreter. */ - if (! info->shared) + if (info->executable) { s = bfd_get_section_by_name (dynobj, ".interp"); if (s == NULL) @@ -3067,17 +3098,17 @@ final_link_relocate (asection *input_section, if (!info->shared) { switch (r_type) - { - case R_PARISC_DLTIND21L: - r_type = R_PARISC_DPREL21L; + { + case R_PARISC_DLTIND21L: + r_type = R_PARISC_DPREL21L; break; - case R_PARISC_DLTIND14R: - r_type = R_PARISC_DPREL14R; + case R_PARISC_DLTIND14R: + r_type = R_PARISC_DPREL14R; break; - case R_PARISC_DLTIND14F: - r_type = R_PARISC_DPREL14F; + case R_PARISC_DLTIND14F: + r_type = R_PARISC_DPREL14F; break; } } @@ -3155,7 +3186,7 @@ final_link_relocate (asection *input_section, and convert the associated add instruction, so issue an error. */ (*_bfd_error_handler) - (_("%s(%s+0x%lx): %s fixup for insn 0x%x is not supported in a non-shared link"), + (_("%s(%s+0x%lx): %s fixup for insn 0x%x is not supported in a non-shared link"), bfd_archive_filename (input_bfd), input_section->name, (long) rel->r_offset, @@ -3408,7 +3439,7 @@ elf32_hppa_relocate_section (bfd *output_bfd, /* This is a local symbol, h defaults to NULL. */ sym = local_syms + r_symndx; sym_sec = local_sections[r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sym_sec, rel); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sym_sec, rel); } else { @@ -3423,7 +3454,7 @@ elf32_hppa_relocate_section (bfd *output_bfd, && hh->root.type != bfd_link_hash_defined && hh->root.type != bfd_link_hash_defweak && hh->root.type != bfd_link_hash_undefweak) - { + { if (!info->executable && info->unresolved_syms_in_objects == RM_IGNORE && ELF_ST_VISIBILITY (hh->other) == STV_DEFAULT @@ -3671,18 +3702,18 @@ elf32_hppa_relocate_section (bfd *output_bfd, Conversely, DEF_DYNAMIC can't be used in check_relocs as there all files have not been loaded. */ if ((info->shared + && (h == NULL + || ELF_ST_VISIBILITY (h->elf.other) == STV_DEFAULT + || h->elf.root.type != bfd_link_hash_undefweak) && (IS_ABSOLUTE_RELOC (r_type) - || (h != NULL - && h->elf.dynindx != -1 - && (!info->symbolic - || (h->elf.elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)))) + || !SYMBOL_CALLS_LOCAL (info, &h->elf))) || (!info->shared && h != NULL && h->elf.dynindx != -1 && (h->elf.elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 - && (((h->elf.elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) != 0 + && ((ELIMINATE_COPY_RELOCS + && (h->elf.elf_link_hash_flags + & ELF_LINK_HASH_DEF_DYNAMIC) != 0 && (h->elf.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) || h->elf.root.type == bfd_link_hash_undefweak @@ -3739,6 +3770,11 @@ elf32_hppa_relocate_section (bfd *output_bfd, && sym_sec->output_section != NULL && ! bfd_is_abs_section (sym_sec)) { + /* Skip this relocation if the output section has + been discarded. */ + if (bfd_is_abs_section (sym_sec->output_section)) + break; + indx = elf_section_data (sym_sec->output_section)->dynindx; /* We are turning this relocation into one against a section symbol, so subtract out the diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c index 4a06ac0..83783ae 100644 --- a/bfd/elf32-i370.c +++ b/bfd/elf32-i370.c @@ -653,7 +653,7 @@ i370_elf_size_dynamic_sections (output_bfd, info) if (elf_hash_table (info)->dynamic_sections_created) { /* Set the contents of the .interp section to the interpreter. */ - if (! info->shared) + if (info->executable) { s = bfd_get_section_by_name (dynobj, ".interp"); BFD_ASSERT (s != NULL); @@ -1210,7 +1210,7 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section, sec = local_sections[r_symndx]; sym_name = "<local symbol>"; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); addend = rel->r_addend; } else @@ -1363,16 +1363,7 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section, { long indx; - if (h == NULL) - sec = local_sections[r_symndx]; - else - { - BFD_ASSERT (h->root.type == bfd_link_hash_defined - || (h->root.type - == bfd_link_hash_defweak)); - sec = h->root.u.def.section; - } - if (sec != NULL && bfd_is_abs_section (sec)) + if (bfd_is_abs_section (sec)) indx = 0; else if (sec == NULL || sec->owner == NULL) { diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 11fadab..ff8aab4 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -1953,10 +1953,10 @@ elf_i386_fake_sections (bfd *abfd ATTRIBUTE_UNUSED, static bfd_vma dtpoff_base (struct bfd_link_info *info) { - /* If tls_segment is NULL, we should have signalled an error already. */ - if (elf_hash_table (info)->tls_segment == NULL) + /* If tls_sec is NULL, we should have signalled an error already. */ + if (elf_hash_table (info)->tls_sec == NULL) return 0; - return elf_hash_table (info)->tls_segment->start; + return elf_hash_table (info)->tls_sec->vma; } /* Return the relocation value for @tpoff relocation @@ -1965,14 +1965,12 @@ dtpoff_base (struct bfd_link_info *info) static bfd_vma tpoff (struct bfd_link_info *info, bfd_vma address) { - struct elf_link_tls_segment *tls_segment - = elf_hash_table (info)->tls_segment; + struct elf_link_hash_table *htab = elf_hash_table (info); - /* If tls_segment is NULL, we should have signalled an error already. */ - if (tls_segment == NULL) + /* If tls_sec is NULL, we should have signalled an error already. */ + if (htab->tls_sec == NULL) return 0; - return (align_power (tls_segment->size, tls_segment->align) - + tls_segment->start - address); + return htab->tls_size + htab->tls_sec->vma - address; } /* Relocate an i386 ELF section. */ @@ -3240,7 +3238,6 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd, #define elf_backend_plt_readonly 1 #define elf_backend_want_plt_sym 0 #define elf_backend_got_header_size 12 -#define elf_backend_plt_header_size PLT_ENTRY_SIZE /* Support RELA for objdump of prelink objects. */ #define elf_info_to_howto elf_i386_info_to_howto_rel diff --git a/bfd/elf32-i860.c b/bfd/elf32-i860.c index 209cbe6..8ab3c92 100644 --- a/bfd/elf32-i860.c +++ b/bfd/elf32-i860.c @@ -1104,7 +1104,7 @@ elf32_i860_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, { sym = local_syms + r_symndx; sec = local_sections [r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index 7e955e9..7500f56 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -1107,7 +1107,7 @@ m32r_elf_relocate_section (output_bfd, info, input_bfd, input_section, sec = local_sections[r_symndx]; sym_name = "<local symbol>"; #if !USE_REL - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); addend = rel->r_addend; #else /* FIXME: This won't handle local relocations against SEC_MERGE @@ -2094,12 +2094,9 @@ m32r_elf_check_relocs (abfd, info, sec, relocs) static struct bfd_elf_special_section const m32r_elf_special_sections[]= { - { ".sdata", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".sbss", 0, NULL, 0, - SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, - { NULL, 0, NULL, 0, - 0, 0 } + { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, + { NULL, 0, 0, 0, 0 } }; #define ELF_ARCH bfd_arch_m32r diff --git a/bfd/elf32-m68hc11.c b/bfd/elf32-m68hc11.c index 2844b48..4d8f6b5 100644 --- a/bfd/elf32-m68hc11.c +++ b/bfd/elf32-m68hc11.c @@ -30,27 +30,26 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Relocation functions. */ static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup - PARAMS ((bfd *, bfd_reloc_code_real_type)); + (bfd *, bfd_reloc_code_real_type); static void m68hc11_info_to_howto_rel - PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); + (bfd *, arelent *, Elf_Internal_Rela *); /* Trampoline generation. */ static bfd_boolean m68hc11_elf_size_one_stub - PARAMS((struct bfd_hash_entry *gen_entry, PTR in_arg)); + (struct bfd_hash_entry *gen_entry, void *in_arg); static bfd_boolean m68hc11_elf_build_one_stub - PARAMS((struct bfd_hash_entry *gen_entry, PTR in_arg)); + (struct bfd_hash_entry *gen_entry, void *in_arg); static struct bfd_link_hash_table* m68hc11_elf_bfd_link_hash_table_create - PARAMS ((bfd* abfd)); + (bfd* abfd); /* Linker relaxation. */ static bfd_boolean m68hc11_elf_relax_section - PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *)); + (bfd *, asection *, struct bfd_link_info *, bfd_boolean *); static void m68hc11_elf_relax_delete_bytes - PARAMS ((bfd *, asection *, bfd_vma, int)); + (bfd *, asection *, bfd_vma, int); static void m68hc11_relax_group - PARAMS ((bfd *, asection *, bfd_byte *, unsigned, - unsigned long, unsigned long)); -static int compare_reloc PARAMS ((const void *, const void *)); + (bfd *, asection *, bfd_byte *, unsigned, unsigned long, unsigned long); +static int compare_reloc (const void *, const void *); /* Use REL instead of RELA to save space */ #define USE_REL 1 @@ -342,9 +341,8 @@ static const struct m68hc11_reloc_map m68hc11_reloc_map[] = { }; static reloc_howto_type * -bfd_elf32_bfd_reloc_type_lookup (abfd, code) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_reloc_code_real_type code; +bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, + bfd_reloc_code_real_type code) { unsigned int i; @@ -362,10 +360,8 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code) /* Set the howto pointer for an M68HC11 ELF reloc. */ static void -m68hc11_info_to_howto_rel (abfd, cache_ptr, dst) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *cache_ptr; - Elf_Internal_Rela *dst; +m68hc11_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, + arelent *cache_ptr, Elf_Internal_Rela *dst) { unsigned int r_type; @@ -379,9 +375,7 @@ m68hc11_info_to_howto_rel (abfd, cache_ptr, dst) /* Build a 68HC11 trampoline stub. */ static bfd_boolean -m68hc11_elf_build_one_stub (gen_entry, in_arg) - struct bfd_hash_entry *gen_entry; - PTR in_arg; +m68hc11_elf_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) { struct elf32_m68hc11_stub_hash_entry *stub_entry; struct bfd_link_info *info; @@ -443,9 +437,8 @@ m68hc11_elf_build_one_stub (gen_entry, in_arg) we know stub section sizes. */ static bfd_boolean -m68hc11_elf_size_one_stub (gen_entry, in_arg) - struct bfd_hash_entry *gen_entry; - PTR in_arg ATTRIBUTE_UNUSED; +m68hc11_elf_size_one_stub (struct bfd_hash_entry *gen_entry, + void *in_arg ATTRIBUTE_UNUSED) { struct elf32_m68hc11_stub_hash_entry *stub_entry; @@ -459,8 +452,7 @@ m68hc11_elf_size_one_stub (gen_entry, in_arg) /* Create a 68HC11 ELF linker hash table. */ static struct bfd_link_hash_table * -m68hc11_elf_bfd_link_hash_table_create (abfd) - bfd *abfd; +m68hc11_elf_bfd_link_hash_table_create (bfd *abfd) { struct m68hc11_elf_link_hash_table *ret; @@ -533,9 +525,7 @@ find_relaxable_insn (unsigned char code) } static int -compare_reloc (e1, e2) - const void *e1; - const void *e2; +compare_reloc (const void *e1, const void *e2) { const Elf_Internal_Rela *i1 = (const Elf_Internal_Rela *) e1; const Elf_Internal_Rela *i2 = (const Elf_Internal_Rela *) e2; @@ -549,13 +539,9 @@ compare_reloc (e1, e2) #define M6811_OP_LDX_IMMEDIATE (0xCE) static void -m68hc11_relax_group (abfd, sec, contents, value, offset, end_group) - bfd *abfd; - asection *sec; - bfd_byte *contents; - unsigned value; - unsigned long offset; - unsigned long end_group; +m68hc11_relax_group (bfd *abfd, asection *sec, bfd_byte *contents, + unsigned value, unsigned long offset, + unsigned long end_group) { unsigned char code; unsigned long start_offset; @@ -665,11 +651,8 @@ m68hc11_relax_group (abfd, sec, contents, value, offset, end_group) and somewhat more difficult to support. */ static bfd_boolean -m68hc11_elf_relax_section (abfd, sec, link_info, again) - bfd *abfd; - asection *sec; - struct bfd_link_info *link_info; - bfd_boolean *again; +m68hc11_elf_relax_section (bfd *abfd, asection *sec, + struct bfd_link_info *link_info, bfd_boolean *again) { Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Shdr *shndx_hdr; @@ -1121,11 +1104,8 @@ m68hc11_elf_relax_section (abfd, sec, link_info, again) /* Delete some bytes from a section while relaxing. */ static void -m68hc11_elf_relax_delete_bytes (abfd, sec, addr, count) - bfd *abfd; - asection *sec; - bfd_vma addr; - int count; +m68hc11_elf_relax_delete_bytes (bfd *abfd, asection *sec, + bfd_vma addr, int count) { Elf_Internal_Shdr *symtab_hdr; unsigned int sec_shndx; @@ -1289,16 +1269,11 @@ m68hc11_elf_relax_delete_bytes (abfd, sec, addr, count) vectors. */ static struct bfd_elf_special_section const elf32_m68hc11_special_sections[]= { - { ".eeprom", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".softregs", 0, NULL, 0, - SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, - { ".page0", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".vectors", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC }, - { NULL, 0, NULL, 0, - 0, 0 } + { ".eeprom", 7, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".softregs", 9, 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, + { ".page0", 6, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".vectors", 8, 0, SHT_PROGBITS, SHF_ALLOC }, + { NULL, 0, 0, 0, 0 } }; #define ELF_ARCH bfd_arch_m68hc11 diff --git a/bfd/elf32-m68hc12.c b/bfd/elf32-m68hc12.c index 3074935..cfc265e 100644 --- a/bfd/elf32-m68hc12.c +++ b/bfd/elf32-m68hc12.c @@ -30,17 +30,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Relocation functions. */ static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup - PARAMS ((bfd *, bfd_reloc_code_real_type)); + (bfd *, bfd_reloc_code_real_type); static void m68hc11_info_to_howto_rel - PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); + (bfd *, arelent *, Elf_Internal_Rela *); /* Trampoline generation. */ static bfd_boolean m68hc12_elf_size_one_stub - PARAMS((struct bfd_hash_entry *gen_entry, PTR in_arg)); + (struct bfd_hash_entry *gen_entry, void *in_arg); static bfd_boolean m68hc12_elf_build_one_stub - PARAMS((struct bfd_hash_entry *gen_entry, PTR in_arg)); + (struct bfd_hash_entry *gen_entry, void *in_arg); static struct bfd_link_hash_table* m68hc12_elf_bfd_link_hash_table_create - PARAMS((bfd*)); + (bfd*); static bfd_boolean m68hc12_elf_set_mach_from_flags PARAMS ((bfd *)); @@ -390,9 +390,8 @@ static const struct m68hc11_reloc_map m68hc11_reloc_map[] = { }; static reloc_howto_type * -bfd_elf32_bfd_reloc_type_lookup (abfd, code) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_reloc_code_real_type code; +bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, + bfd_reloc_code_real_type code) { unsigned int i; @@ -410,10 +409,8 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code) /* Set the howto pointer for an M68HC11 ELF reloc. */ static void -m68hc11_info_to_howto_rel (abfd, cache_ptr, dst) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *cache_ptr; - Elf_Internal_Rela *dst; +m68hc11_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, + arelent *cache_ptr, Elf_Internal_Rela *dst) { unsigned int r_type; @@ -427,9 +424,7 @@ m68hc11_info_to_howto_rel (abfd, cache_ptr, dst) /* Build a 68HC12 trampoline stub. */ static bfd_boolean -m68hc12_elf_build_one_stub (gen_entry, in_arg) - struct bfd_hash_entry *gen_entry; - PTR in_arg; +m68hc12_elf_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) { struct elf32_m68hc11_stub_hash_entry *stub_entry; struct bfd_link_info *info; @@ -483,9 +478,8 @@ m68hc12_elf_build_one_stub (gen_entry, in_arg) we know stub section sizes. */ static bfd_boolean -m68hc12_elf_size_one_stub (gen_entry, in_arg) - struct bfd_hash_entry *gen_entry; - PTR in_arg ATTRIBUTE_UNUSED; +m68hc12_elf_size_one_stub (struct bfd_hash_entry *gen_entry, + void *in_arg ATTRIBUTE_UNUSED) { struct elf32_m68hc11_stub_hash_entry *stub_entry; @@ -499,8 +493,7 @@ m68hc12_elf_size_one_stub (gen_entry, in_arg) /* Create a 68HC12 ELF linker hash table. */ static struct bfd_link_hash_table * -m68hc12_elf_bfd_link_hash_table_create (abfd) - bfd *abfd; +m68hc12_elf_bfd_link_hash_table_create (bfd *abfd) { struct m68hc11_elf_link_hash_table *ret; @@ -515,8 +508,7 @@ m68hc12_elf_bfd_link_hash_table_create (abfd) } static bfd_boolean -m68hc12_elf_set_mach_from_flags (abfd) - bfd *abfd; +m68hc12_elf_set_mach_from_flags (bfd *abfd) { flagword flags = elf_elfheader (abfd)->e_flags; @@ -545,16 +537,11 @@ m68hc12_elf_set_mach_from_flags (abfd) vectors. */ static struct bfd_elf_special_section const elf32_m68hc12_special_sections[]= { - { ".eeprom", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".softregs", 0, NULL, 0, - SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, - { ".page0", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".vectors", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC }, - { NULL, 0, NULL, 0, - 0, 0 } + { ".eeprom", 7, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".softregs", 9, 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, + { ".page0", 6, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".vectors", 8, 0, SHT_PROGBITS, SHF_ALLOC }, + { NULL, 0, 0, 0, 0 } }; #define ELF_ARCH bfd_arch_m68hc12 diff --git a/bfd/elf32-m68hc1x.c b/bfd/elf32-m68hc1x.c index 8d71cb6..709b8f4 100644 --- a/bfd/elf32-m68hc1x.c +++ b/bfd/elf32-m68hc1x.c @@ -33,31 +33,31 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ bfd_hash_lookup ((table), (string), (create), (copy))) static struct elf32_m68hc11_stub_hash_entry* m68hc12_add_stub - PARAMS((const char *stub_name, - asection *section, - struct m68hc11_elf_link_hash_table *htab)); + (const char *stub_name, + asection *section, + struct m68hc11_elf_link_hash_table *htab); static struct bfd_hash_entry *stub_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); + (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); -static void m68hc11_elf_set_symbol - PARAMS ((bfd* abfd, struct bfd_link_info *info, - const char* name, bfd_vma value, asection* sec)); +static void m68hc11_elf_set_symbol (bfd* abfd, struct bfd_link_info *info, + const char* name, bfd_vma value, + asection* sec); static bfd_boolean m68hc11_elf_export_one_stub - PARAMS((struct bfd_hash_entry *gen_entry, PTR in_arg)); + (struct bfd_hash_entry *gen_entry, void *in_arg); static bfd_boolean m68hc11_get_relocation_value - PARAMS ((bfd* abfd, - struct bfd_link_info* info, - asection **local_sections, - Elf_Internal_Sym* local_syms, - Elf_Internal_Rela* rel, - const char** name, - bfd_vma* relocation, - bfd_boolean* is_far)); + (bfd* abfd, + struct bfd_link_info* info, + asection **local_sections, + Elf_Internal_Sym* local_syms, + Elf_Internal_Rela* rel, + const char** name, + bfd_vma* relocation, + bfd_boolean* is_far); -static void scan_sections_for_abi PARAMS ((bfd*, asection*, PTR)); +static void scan_sections_for_abi (bfd*, asection*, PTR); struct m68hc11_scan_param { @@ -69,8 +69,7 @@ struct m68hc11_scan_param /* Create a 68HC11/68HC12 ELF linker hash table. */ struct m68hc11_elf_link_hash_table* -m68hc11_elf_hash_table_create (abfd) - bfd *abfd; +m68hc11_elf_hash_table_create (bfd *abfd) { struct m68hc11_elf_link_hash_table *ret; bfd_size_type amt = sizeof (struct m68hc11_elf_link_hash_table); @@ -109,8 +108,7 @@ m68hc11_elf_hash_table_create (abfd) /* Free the derived linker hash table. */ void -m68hc11_elf_bfd_link_hash_table_free (hash) - struct bfd_link_hash_table *hash; +m68hc11_elf_bfd_link_hash_table_free (struct bfd_link_hash_table *hash) { struct m68hc11_elf_link_hash_table *ret = (struct m68hc11_elf_link_hash_table *) hash; @@ -125,10 +123,8 @@ m68hc11_elf_bfd_link_hash_table_free (hash) /* Initialize an entry in the stub hash table. */ static struct bfd_hash_entry * -stub_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; +stub_hash_newfunc (struct bfd_hash_entry *entry, struct bfd_hash_table *table, + const char *string) { /* Allocate the structure if it has not already been allocated by a subclass. */ @@ -161,10 +157,8 @@ stub_hash_newfunc (entry, table, string) stub entry are initialised. */ static struct elf32_m68hc11_stub_hash_entry * -m68hc12_add_stub (stub_name, section, htab) - const char *stub_name; - asection *section; - struct m68hc11_elf_link_hash_table *htab; +m68hc12_add_stub (const char *stub_name, asection *section, + struct m68hc11_elf_link_hash_table *htab) { struct elf32_m68hc11_stub_hash_entry *stub_entry; @@ -195,14 +189,12 @@ m68hc12_add_stub (stub_name, section, htab) the trampoline handler. */ bfd_boolean -elf32_m68hc11_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) - bfd *abfd; - struct bfd_link_info *info; - const Elf_Internal_Sym *sym; - const char **namep ATTRIBUTE_UNUSED; - flagword *flagsp ATTRIBUTE_UNUSED; - asection **secp ATTRIBUTE_UNUSED; - bfd_vma *valp ATTRIBUTE_UNUSED; +elf32_m68hc11_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, + const Elf_Internal_Sym *sym, + const char **namep ATTRIBUTE_UNUSED, + flagword *flagsp ATTRIBUTE_UNUSED, + asection **secp ATTRIBUTE_UNUSED, + bfd_vma *valp ATTRIBUTE_UNUSED) { if (sym->st_other & STO_M68HC12_FAR) { @@ -234,9 +226,7 @@ elf32_m68hc11_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) 0 when no stubs will be needed, and 1 on success. */ int -elf32_m68hc11_setup_section_lists (output_bfd, info) - bfd *output_bfd; - struct bfd_link_info *info; +elf32_m68hc11_setup_section_lists (bfd *output_bfd, struct bfd_link_info *info) { bfd *input_bfd; unsigned int bfd_count; @@ -326,11 +316,9 @@ elf32_m68hc11_setup_section_lists (output_bfd, info) instruction. */ bfd_boolean -elf32_m68hc11_size_stubs (output_bfd, stub_bfd, info, add_stub_section) - bfd *output_bfd; - bfd *stub_bfd; - struct bfd_link_info *info; - asection * (*add_stub_section) PARAMS ((const char *, asection *)); +elf32_m68hc11_size_stubs (bfd *output_bfd, bfd *stub_bfd, + struct bfd_link_info *info, + asection * (*add_stub_section) (const char*, asection*)) { bfd *input_bfd; asection *section; @@ -571,9 +559,7 @@ elf32_m68hc11_size_stubs (output_bfd, stub_bfd, info, add_stub_section) /* Export the trampoline addresses in the symbol table. */ static bfd_boolean -m68hc11_elf_export_one_stub (gen_entry, in_arg) - struct bfd_hash_entry *gen_entry; - PTR in_arg; +m68hc11_elf_export_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) { struct bfd_link_info *info; struct m68hc11_elf_link_hash_table *htab; @@ -603,12 +589,8 @@ m68hc11_elf_export_one_stub (gen_entry, in_arg) /* Export a symbol or set its value and section. */ static void -m68hc11_elf_set_symbol (abfd, info, name, value, sec) - bfd* abfd; - struct bfd_link_info *info; - const char* name; - bfd_vma value; - asection* sec; +m68hc11_elf_set_symbol (bfd *abfd, struct bfd_link_info *info, + const char *name, bfd_vma value, asection *sec) { struct elf_link_hash_entry *h; @@ -639,9 +621,7 @@ m68hc11_elf_set_symbol (abfd, info, name, value, sec) linker. */ bfd_boolean -elf32_m68hc11_build_stubs (abfd, info) - bfd* abfd; - struct bfd_link_info *info; +elf32_m68hc11_build_stubs (bfd *abfd, struct bfd_link_info *info) { asection *stub_sec; struct bfd_hash_table *table; @@ -694,8 +674,7 @@ elf32_m68hc11_build_stubs (abfd, info) } void -m68hc11_elf_get_bank_parameters (info) - struct bfd_link_info *info; +m68hc11_elf_get_bank_parameters (struct bfd_link_info *info) { unsigned i; struct m68hc11_page_info *pinfo; @@ -755,9 +734,7 @@ m68hc11_elf_get_bank_parameters (info) /* Return 1 if the address is in banked memory. This can be applied to a virtual address and to a physical address. */ int -m68hc11_addr_is_banked (pinfo, addr) - struct m68hc11_page_info *pinfo; - bfd_vma addr; +m68hc11_addr_is_banked (struct m68hc11_page_info *pinfo, bfd_vma addr) { if (addr >= pinfo->bank_virtual) return 1; @@ -771,9 +748,7 @@ m68hc11_addr_is_banked (pinfo, addr) /* Return the physical address seen by the processor, taking into account banked memory. */ bfd_vma -m68hc11_phys_addr (pinfo, addr) - struct m68hc11_page_info *pinfo; - bfd_vma addr; +m68hc11_phys_addr (struct m68hc11_page_info *pinfo, bfd_vma addr) { if (addr < pinfo->bank_virtual) return addr; @@ -787,9 +762,7 @@ m68hc11_phys_addr (pinfo, addr) /* Return the page number corresponding to an address in banked memory. */ bfd_vma -m68hc11_phys_page (pinfo, addr) - struct m68hc11_page_info *pinfo; - bfd_vma addr; +m68hc11_phys_page (struct m68hc11_page_info *pinfo, bfd_vma addr) { if (addr < pinfo->bank_virtual) return 0; @@ -805,15 +778,13 @@ m68hc11_phys_page (pinfo, addr) which the linker should otherwise ignore. */ bfd_reloc_status_type -m68hc11_elf_ignore_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol ATTRIBUTE_UNUSED; - PTR data ATTRIBUTE_UNUSED; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; +m68hc11_elf_ignore_reloc (bfd *abfd ATTRIBUTE_UNUSED, + arelent *reloc_entry, + asymbol *symbol ATTRIBUTE_UNUSED, + void *data ATTRIBUTE_UNUSED, + asection *input_section, + bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) { if (output_bfd != NULL) reloc_entry->address += input_section->output_offset; @@ -821,15 +792,13 @@ m68hc11_elf_ignore_reloc (abfd, reloc_entry, symbol, data, input_section, } bfd_reloc_status_type -m68hc11_elf_special_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data ATTRIBUTE_UNUSED; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; +m68hc11_elf_special_reloc (bfd *abfd ATTRIBUTE_UNUSED, + arelent *reloc_entry, + asymbol *symbol, + void *data ATTRIBUTE_UNUSED, + asection *input_section, + bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) { if (output_bfd != (bfd *) NULL && (symbol->flags & BSF_SECTION_SYM) == 0 @@ -850,12 +819,11 @@ m68hc11_elf_special_reloc (abfd, reloc_entry, symbol, data, input_section, } asection * -elf32_m68hc11_gc_mark_hook (sec, info, rel, h, sym) - asection *sec; - struct bfd_link_info *info ATTRIBUTE_UNUSED; - Elf_Internal_Rela *rel; - struct elf_link_hash_entry *h; - Elf_Internal_Sym *sym; +elf32_m68hc11_gc_mark_hook (asection *sec, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + Elf_Internal_Rela *rel, + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) { if (h != NULL) { @@ -883,11 +851,10 @@ elf32_m68hc11_gc_mark_hook (sec, info, rel, h, sym) } bfd_boolean -elf32_m68hc11_gc_sweep_hook (abfd, info, sec, relocs) - bfd *abfd ATTRIBUTE_UNUSED; - struct bfd_link_info *info ATTRIBUTE_UNUSED; - asection *sec ATTRIBUTE_UNUSED; - const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED; +elf32_m68hc11_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + asection *sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED) { /* We don't use got and plt entries for 68hc11/68hc12. */ return TRUE; @@ -898,11 +865,8 @@ elf32_m68hc11_gc_sweep_hook (abfd, info, sec, relocs) virtual table relocs for gc. */ bfd_boolean -elf32_m68hc11_check_relocs (abfd, info, sec, relocs) - bfd * abfd; - struct bfd_link_info * info; - asection * sec; - const Elf_Internal_Rela * relocs; +elf32_m68hc11_check_relocs (bfd *abfd, struct bfd_link_info *info, + asection *sec, const Elf_Internal_Rela *relocs) { Elf_Internal_Shdr * symtab_hdr; struct elf_link_hash_entry ** sym_hashes; @@ -955,17 +919,12 @@ elf32_m68hc11_check_relocs (abfd, info, sec, relocs) } static bfd_boolean -m68hc11_get_relocation_value (abfd, info, local_sections, local_syms, - rel, name, - relocation, is_far) - bfd *abfd; - struct bfd_link_info *info; - asection **local_sections; - Elf_Internal_Sym* local_syms; - Elf_Internal_Rela* rel; - const char** name; - bfd_vma* relocation; - bfd_boolean* is_far; +m68hc11_get_relocation_value (bfd *abfd, struct bfd_link_info *info, + asection **local_sections, + Elf_Internal_Sym *local_syms, + Elf_Internal_Rela *rel, + const char **name, + bfd_vma *relocation, bfd_boolean *is_far) { Elf_Internal_Shdr *symtab_hdr; struct elf_link_hash_entry **sym_hashes; @@ -1056,16 +1015,12 @@ m68hc11_get_relocation_value (abfd, info, local_sections, local_syms, /* Relocate a 68hc11/68hc12 ELF section. */ bfd_boolean -elf32_m68hc11_relocate_section (output_bfd, info, input_bfd, input_section, - contents, relocs, local_syms, local_sections) - bfd *output_bfd ATTRIBUTE_UNUSED; - struct bfd_link_info *info; - bfd *input_bfd; - asection *input_section; - bfd_byte *contents; - Elf_Internal_Rela *relocs; - Elf_Internal_Sym *local_syms; - asection **local_sections; +elf32_m68hc11_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info, + bfd *input_bfd, asection *input_section, + bfd_byte *contents, Elf_Internal_Rela *relocs, + Elf_Internal_Sym *local_syms, + asection **local_sections) { Elf_Internal_Shdr *symtab_hdr; struct elf_link_hash_entry **sym_hashes; @@ -1289,9 +1244,7 @@ elf32_m68hc11_relocate_section (output_bfd, info, input_bfd, input_section, /* Set and control ELF flags in ELF header. */ bfd_boolean -_bfd_m68hc11_elf_set_private_flags (abfd, flags) - bfd *abfd; - flagword flags; +_bfd_m68hc11_elf_set_private_flags (bfd *abfd, flagword flags) { BFD_ASSERT (!elf_flags_init (abfd) || elf_elfheader (abfd)->e_flags == flags); @@ -1305,9 +1258,7 @@ _bfd_m68hc11_elf_set_private_flags (abfd, flags) object file when linking. */ bfd_boolean -_bfd_m68hc11_elf_merge_private_bfd_data (ibfd, obfd) - bfd *ibfd; - bfd *obfd; +_bfd_m68hc11_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) { flagword old_flags; flagword new_flags; @@ -1375,8 +1326,8 @@ _bfd_m68hc11_elf_merge_private_bfd_data (ibfd, obfd) elf_elfheader (obfd)->e_flags = new_flags; - new_flags &= ~EF_M68HC11_ABI; - old_flags &= ~EF_M68HC11_ABI; + new_flags &= ~(EF_M68HC11_ABI | EF_M68HC11_MACH_MASK); + old_flags &= ~(EF_M68HC11_ABI | EF_M68HC11_MACH_MASK); /* Warn about any other mismatches */ if (new_flags != old_flags) @@ -1398,9 +1349,7 @@ _bfd_m68hc11_elf_merge_private_bfd_data (ibfd, obfd) } bfd_boolean -_bfd_m68hc11_elf_print_private_bfd_data (abfd, ptr) - bfd *abfd; - PTR ptr; +_bfd_m68hc11_elf_print_private_bfd_data (bfd *abfd, void *ptr) { FILE *file = (FILE *) ptr; @@ -1439,10 +1388,8 @@ _bfd_m68hc11_elf_print_private_bfd_data (abfd, ptr) return TRUE; } -static void scan_sections_for_abi (abfd, asect, arg) - bfd* abfd ATTRIBUTE_UNUSED; - asection* asect; - PTR arg; +static void scan_sections_for_abi (bfd *abfd ATTRIBUTE_UNUSED, + asection *asect, void *arg) { struct m68hc11_scan_param* p = (struct m68hc11_scan_param*) arg; @@ -1453,9 +1400,7 @@ static void scan_sections_for_abi (abfd, asect, arg) /* Tweak the OSABI field of the elf header. */ void -elf32_m68hc11_post_process_headers (abfd, link_info) - bfd *abfd; - struct bfd_link_info *link_info; +elf32_m68hc11_post_process_headers (bfd *abfd, struct bfd_link_info *link_info) { struct m68hc11_scan_param param; diff --git a/bfd/elf32-m68hc1x.h b/bfd/elf32-m68hc1x.h index c5e9372..5964023 100644 --- a/bfd/elf32-m68hc1x.h +++ b/bfd/elf32-m68hc1x.h @@ -32,9 +32,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define BFD_M68HC11_BANK_VIRTUAL_NAME "__bank_virtual" /* Set and control ELF flags in ELF header. */ -extern bfd_boolean _bfd_m68hc11_elf_merge_private_bfd_data PARAMS ((bfd*,bfd*)); -extern bfd_boolean _bfd_m68hc11_elf_set_private_flags PARAMS ((bfd*,flagword)); -extern bfd_boolean _bfd_m68hc11_elf_print_private_bfd_data PARAMS ((bfd*,PTR)); +extern bfd_boolean _bfd_m68hc11_elf_merge_private_bfd_data (bfd*,bfd*); +extern bfd_boolean _bfd_m68hc11_elf_set_private_flags (bfd*,flagword); +extern bfd_boolean _bfd_m68hc11_elf_print_private_bfd_data (bfd*, void*); /* This hash entry is used to record a trampoline that must be generated to call a far function using a normal calling convention ('jsr'). @@ -122,8 +122,8 @@ struct m68hc11_elf_link_hash_table /* Small local sym to section mapping cache. */ struct sym_sec_cache sym_sec; - bfd_boolean (* size_one_stub) PARAMS((struct bfd_hash_entry*, PTR)); - bfd_boolean (* build_one_stub) PARAMS((struct bfd_hash_entry*, PTR)); + bfd_boolean (* size_one_stub) PARAMS((struct bfd_hash_entry*, void*)); + bfd_boolean (* build_one_stub) PARAMS((struct bfd_hash_entry*, void*)); }; /* Get the Sparc64 ELF linker hash table from a link_info structure. */ @@ -134,71 +134,63 @@ struct m68hc11_elf_link_hash_table /* Create a 68HC11/68HC12 ELF linker hash table. */ extern struct m68hc11_elf_link_hash_table* m68hc11_elf_hash_table_create - PARAMS ((bfd*)); -extern void m68hc11_elf_bfd_link_hash_table_free - PARAMS ((struct bfd_link_hash_table*)); + (bfd*); +extern void m68hc11_elf_bfd_link_hash_table_free (struct bfd_link_hash_table*); -extern void m68hc11_elf_get_bank_parameters - PARAMS ((struct bfd_link_info*)); +extern void m68hc11_elf_get_bank_parameters (struct bfd_link_info*); /* Return 1 if the address is in banked memory. This can be applied to a virtual address and to a physical address. */ -extern int m68hc11_addr_is_banked - PARAMS ((struct m68hc11_page_info*, bfd_vma)); +extern int m68hc11_addr_is_banked (struct m68hc11_page_info*, bfd_vma); /* Return the physical address seen by the processor, taking into account banked memory. */ -extern bfd_vma m68hc11_phys_addr - PARAMS ((struct m68hc11_page_info*, bfd_vma)); +extern bfd_vma m68hc11_phys_addr (struct m68hc11_page_info*, bfd_vma); /* Return the page number corresponding to an address in banked memory. */ -extern bfd_vma m68hc11_phys_page - PARAMS ((struct m68hc11_page_info*, bfd_vma)); +extern bfd_vma m68hc11_phys_page (struct m68hc11_page_info*, bfd_vma); bfd_reloc_status_type m68hc11_elf_ignore_reloc - PARAMS ((bfd *abfd, arelent *reloc_entry, - asymbol *symbol, PTR data, asection *input_section, - bfd *output_bfd, char **error_message)); + (bfd *abfd, arelent *reloc_entry, + asymbol *symbol, void *data, asection *input_section, + bfd *output_bfd, char **error_message); bfd_reloc_status_type m68hc11_elf_special_reloc - PARAMS ((bfd *abfd, arelent *reloc_entry, - asymbol *symbol, PTR data, asection *input_section, - bfd *output_bfd, char **error_message)); + (bfd *abfd, arelent *reloc_entry, + asymbol *symbol, void *data, asection *input_section, + bfd *output_bfd, char **error_message); /* GC mark and sweep. */ asection *elf32_m68hc11_gc_mark_hook - PARAMS ((asection *sec, struct bfd_link_info *info, - Elf_Internal_Rela *rel, struct elf_link_hash_entry *h, - Elf_Internal_Sym *sym)); + (asection *sec, struct bfd_link_info *info, + Elf_Internal_Rela *rel, struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym); bfd_boolean elf32_m68hc11_gc_sweep_hook - PARAMS ((bfd *abfd, struct bfd_link_info *info, - asection *sec, const Elf_Internal_Rela *relocs)); + (bfd *abfd, struct bfd_link_info *info, + asection *sec, const Elf_Internal_Rela *relocs); bfd_boolean elf32_m68hc11_check_relocs - PARAMS ((bfd * abfd, struct bfd_link_info * info, - asection * sec, const Elf_Internal_Rela * relocs)); + (bfd * abfd, struct bfd_link_info * info, + asection * sec, const Elf_Internal_Rela * relocs); bfd_boolean elf32_m68hc11_relocate_section - PARAMS ((bfd *output_bfd, struct bfd_link_info *info, - bfd *input_bfd, asection *input_section, - bfd_byte *contents, Elf_Internal_Rela *relocs, - Elf_Internal_Sym *local_syms, asection **local_sections)); + (bfd *output_bfd, struct bfd_link_info *info, + bfd *input_bfd, asection *input_section, + bfd_byte *contents, Elf_Internal_Rela *relocs, + Elf_Internal_Sym *local_syms, asection **local_sections); bfd_boolean elf32_m68hc11_add_symbol_hook - PARAMS ((bfd *abfd, struct bfd_link_info *info, - const Elf_Internal_Sym *sym, const char **namep, - flagword *flagsp, asection **secp, - bfd_vma *valp)); + (bfd *abfd, struct bfd_link_info *info, + const Elf_Internal_Sym *sym, const char **namep, + flagword *flagsp, asection **secp, + bfd_vma *valp); /* Tweak the OSABI field of the elf header. */ -extern void elf32_m68hc11_post_process_headers - PARAMS ((bfd*, struct bfd_link_info*)); +extern void elf32_m68hc11_post_process_headers (bfd*, struct bfd_link_info*); -int elf32_m68hc11_setup_section_lists - PARAMS ((bfd *, struct bfd_link_info *)); +int elf32_m68hc11_setup_section_lists (bfd *, struct bfd_link_info *); bfd_boolean elf32_m68hc11_size_stubs - PARAMS ((bfd *, bfd *, struct bfd_link_info *, - asection * (*) PARAMS ((const char *, asection *)))); + (bfd *, bfd *, struct bfd_link_info *, + asection * (*) (const char *, asection *)); -bfd_boolean elf32_m68hc11_build_stubs - PARAMS ((bfd* abfd, struct bfd_link_info *)); +bfd_boolean elf32_m68hc11_build_stubs (bfd* abfd, struct bfd_link_info *); #endif diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index 7688bfd..90609c5 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -1127,7 +1127,7 @@ elf_m68k_size_dynamic_sections (output_bfd, info) if (elf_hash_table (info)->dynamic_sections_created) { /* Set the contents of the .interp section to the interpreter. */ - if (!info->shared) + if (info->executable) { s = bfd_get_section_by_name (dynobj, ".interp"); BFD_ASSERT (s != NULL); @@ -1403,7 +1403,7 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section, { sym = local_syms + r_symndx; sec = local_sections[r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); } else { @@ -1657,16 +1657,7 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section, { long indx; - if (h == NULL) - sec = local_sections[r_symndx]; - else - { - BFD_ASSERT (h->root.type == bfd_link_hash_defined - || (h->root.type - == bfd_link_hash_defweak)); - sec = h->root.u.def.section; - } - if (sec != NULL && bfd_is_abs_section (sec)) + if (bfd_is_abs_section (sec)) indx = 0; else if (sec == NULL || sec->owner == NULL) { diff --git a/bfd/elf32-mcore.c b/bfd/elf32-mcore.c index 3f878cf..6992a3d 100644 --- a/bfd/elf32-mcore.c +++ b/bfd/elf32-mcore.c @@ -467,7 +467,7 @@ mcore_elf_relocate_section (output_bfd, info, input_bfd, input_section, { sym = local_syms + r_symndx; sec = local_sections [r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); addend = rel->r_addend; } else @@ -683,12 +683,9 @@ mcore_elf_check_relocs (abfd, info, sec, relocs) static struct bfd_elf_special_section const mcore_elf_special_sections[]= { - { ".ctors", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".dtors", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { NULL, 0, NULL, 0, - 0, 0 } + { ".ctors", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".dtors", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { NULL, 0, 0, 0, 0 } }; #define TARGET_BIG_SYM bfd_elf32_mcore_big_vec diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c index e495cc4..b17008e 100644 --- a/bfd/elf32-mips.c +++ b/bfd/elf32-mips.c @@ -1940,7 +1940,6 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = { #define elf_backend_ecoff_debug_swap &mips_elf32_ecoff_debug_swap #define elf_backend_got_header_size (4 * MIPS_RESERVED_GOTNO) -#define elf_backend_plt_header_size 0 #define elf_backend_may_use_rel_p 1 #define elf_backend_may_use_rela_p 0 #define elf_backend_default_use_rela_p 0 diff --git a/bfd/elf32-msp430.c b/bfd/elf32-msp430.c index b09ef87..306a798 100644 --- a/bfd/elf32-msp430.c +++ b/bfd/elf32-msp430.c @@ -449,7 +449,7 @@ elf32_msp430_relocate_section (output_bfd, info, input_bfd, input_section, { sym = local_syms + r_symndx; sec = local_sections[r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); diff --git a/bfd/elf32-openrisc.c b/bfd/elf32-openrisc.c index a9b6d1d..62f86d4 100644 --- a/bfd/elf32-openrisc.c +++ b/bfd/elf32-openrisc.c @@ -375,7 +375,7 @@ openrisc_elf_relocate_section (output_bfd, info, input_bfd, input_section, { sym = local_syms + r_symndx; sec = local_sections[r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 3bffc70..e2de01e 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -205,9 +205,6 @@ struct ppc_elf_link_hash_table elf_linker_section_t *sdata2; asection *sbss; - /* Short-cut to first output tls section. */ - asection *tls_sec; - /* Shortcut to .__tls_get_addr. */ struct elf_link_hash_entry *tls_get_addr; @@ -1534,19 +1531,33 @@ static reloc_howto_type ppc_elf_howto_raw[] = { 0xffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* Phony reloc to handle branch stubs. */ - HOWTO (R_PPC_RELAX32, /* type */ - 0, /* rightshift */ - 0, /* size */ + /* Phony relocs to handle branch stubs. */ + HOWTO (R_PPC_RELAX32, /* type */ + 0, /* rightshift */ + 0, /* size */ 0, /* bitsize */ FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ - "R_PPC_RELAX32", /* name */ + "R_PPC_RELAX32", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ - 0, /* dst_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_PPC_RELAX32PC, /* type */ + 0, /* rightshift */ + 0, /* size */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_PPC_RELAX32PC", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ FALSE), /* pcrel_offset */ /* GNU extension to record C++ vtable hierarchy. */ @@ -1614,90 +1625,26 @@ ppc_elf_howto_init (void) } } -static bfd_reloc_status_type -ppc_elf_install_value (bfd *abfd, - bfd_byte *hit_addr, - bfd_vma v, - unsigned int r_type) -{ - bfd_vma t0, t1; -#ifdef BFD_HOST_U_64_BIT - BFD_HOST_U_64_BIT val = (BFD_HOST_U_64_BIT) v; -#else - bfd_vma val = v; -#endif - - switch (r_type) - { - case R_PPC_RELAX32: - /* Do stuff here. */ - t0 = bfd_get_32 (abfd, hit_addr); - t1 = bfd_get_32 (abfd, hit_addr + 4); - - /* We're clearing the bits for R_PPC_ADDR16_HA - and R_PPC_ADDR16_LO here. */ - t0 &= ~0xffff; - t1 &= ~0xffff; - - /* t0 is HA, t1 is lo */ - t0 |= ((val + 0x8000) >> 16) & 0xffff; - t1 |= val & 0xffff; - - bfd_put_32 (abfd, t0, hit_addr); - bfd_put_32 (abfd, t1, hit_addr + 4); - break; - - case R_PPC_REL24: - t0 = bfd_get_32 (abfd, hit_addr); - t0 &= ~0x3fffffc; - t0 |= val & 0x3fffffc; - bfd_put_32 (abfd, t0, hit_addr); - break; - - case R_PPC_REL14: - case R_PPC_REL14_BRTAKEN: - case R_PPC_REL14_BRNTAKEN: - t0 = bfd_get_32 (abfd, hit_addr); - t0 &= ~0xfffc; - t0 |= val & 0xfffc; - bfd_put_32 (abfd, t0, hit_addr); - break; - - case R_PPC_LOCAL24PC: - case R_PPC_PLTREL24: - t0 = bfd_get_32 (abfd, hit_addr); - t0 &= ~0x3fffffc; - t0 |= val & 0x3fffffc; - bfd_put_32 (abfd, t0, hit_addr); - break; - - default: - return bfd_reloc_notsupported; - } - - return bfd_reloc_ok; -} +#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) -static const bfd_byte shared_stub_entry[] = +static const int shared_stub_entry[] = { - 0x48, 0x00, 0x00, 0x24, /* b .+36 */ - 0x7c, 0x08, 0x02, 0xa6, /* mflr 0 */ - 0x42, 0x9f, 0x00, 0x05, /* bcl 20, 31, .Lxxx */ - 0x7d, 0x68, 0x02, 0xa6, /* mflr 11 */ - 0x3d, 0x60, 0x00, 0x00, /* addis 11, 11, (xxx-.Lxxx)@ha */ - 0x39, 0x6b, 0x00, 0x18, /* addi 11, 11, (xxx-.Lxxx)@l */ - 0x7c, 0x08, 0x03, 0xa6, /* mtlr 0 */ - 0x7d, 0x69, 0x03, 0xa6, /* mtctr 11 */ - 0x4e, 0x80, 0x04, 0x20, /* bctr */ + 0x7c0802a6, /* mflr 0 */ + 0x429f0005, /* bcl 20, 31, .Lxxx */ + 0x7d6802a6, /* mflr 11 */ + 0x3d6b0000, /* addis 11, 11, (xxx-.Lxxx)@ha */ + 0x396b0018, /* addi 11, 11, (xxx-.Lxxx)@l */ + 0x7c0803a6, /* mtlr 0 */ + 0x7d6903a6, /* mtctr 11 */ + 0x4e800420, /* bctr */ }; -static const bfd_byte stub_entry[] = +static const int stub_entry[] = { - 0x48, 0x00, 0x00, 0x14, /* b .+20 */ - 0x3d, 0x60, 0x00, 0x00, /* lis 11,xxx@ha */ - 0x39, 0x6b, 0x00, 0x00, /* addi 11,11,xxx@l */ - 0x7d, 0x69, 0x03, 0xa6, /* mtctr 11 */ - 0x4e, 0x80, 0x04, 0x20, /* bctr */ + 0x3d600000, /* lis 11,xxx@ha */ + 0x396b0000, /* addi 11,11,xxx@l */ + 0x7d6903a6, /* mtctr 11 */ + 0x4e800420, /* bctr */ }; @@ -1721,9 +1668,9 @@ ppc_elf_relax_section (bfd *abfd, Elf_Internal_Rela *internal_relocs = NULL; Elf_Internal_Rela *irel, *irelend; struct one_fixup *fixups = NULL; - bfd_boolean changed_contents = FALSE; - bfd_boolean changed_relocs = FALSE; + bfd_boolean changed; struct ppc_elf_link_hash_table *ppc_info; + bfd_size_type trampoff; *again = FALSE; @@ -1738,6 +1685,10 @@ ppc_elf_relax_section (bfd *abfd, if (isec->_cooked_size == 0) isec->_cooked_size = isec->_raw_size; + trampoff = (isec->_cooked_size + 3) & (bfd_vma) -4; + /* Space for a branch around any trampolines. */ + trampoff += 4; + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; /* Get a copy of the native relocations. */ @@ -1767,21 +1718,26 @@ ppc_elf_relax_section (bfd *abfd, for (irel = internal_relocs; irel < irelend; irel++) { unsigned long r_type = ELF32_R_TYPE (irel->r_info); - bfd_vma symaddr, reladdr, trampoff, toff, roff; + bfd_vma symaddr, reladdr, toff, roff; asection *tsec; - bfd_size_type amt; struct one_fixup *f; size_t insn_offset = 0; - bfd_vma max_branch_offset; + bfd_vma max_branch_offset, val; + bfd_byte *hit_addr; + unsigned long t0; switch (r_type) { case R_PPC_REL24: case R_PPC_LOCAL24PC: + case R_PPC_PLTREL24: + max_branch_offset = 1 << 25; + break; + case R_PPC_REL14: case R_PPC_REL14_BRTAKEN: case R_PPC_REL14_BRNTAKEN: - case R_PPC_PLTREL24: + max_branch_offset = 1 << 15; break; default: @@ -1819,7 +1775,7 @@ ppc_elf_relax_section (bfd *abfd, } else { - /* Need dynamic symbol handling. */ + /* Global symbol handling. */ unsigned long indx; struct elf_link_hash_entry *h; @@ -1830,62 +1786,34 @@ ppc_elf_relax_section (bfd *abfd, || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; - if (r_type == R_PPC_PLTREL24) + if (r_type == R_PPC_PLTREL24 + && ppc_info->plt != NULL + && h->plt.offset != (bfd_vma) -1) { - Elf_Internal_Sym *isym; - - if (h->plt.offset == (bfd_vma) -1 - || ppc_info->plt == NULL) - { - - /* Read this BFD's local symbols. */ - if (isymbuf == NULL) - { - isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; - if (isymbuf == NULL) - isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr, - symtab_hdr->sh_info, 0, - NULL, NULL, NULL); - if (isymbuf == 0) - goto error_return; - } - isym = isymbuf + ELF32_R_SYM (irel->r_info); - - if (isym->st_shndx == SHN_UNDEF) - /* We can't do anthing with undefined symbols. */ - continue; - else if (isym->st_shndx == SHN_ABS) - tsec = bfd_abs_section_ptr; - else if (isym->st_shndx == SHN_COMMON) - tsec = bfd_com_section_ptr; - else - tsec = h->root.u.def.section; - - toff = h->root.u.def.value; - } - else - { - tsec = ppc_info->plt; - toff = h->plt.offset; - } + tsec = ppc_info->plt; + toff = h->plt.offset; } - else if (h->root.type == bfd_link_hash_undefined - || h->root.type == bfd_link_hash_undefweak) - continue; - - else + else if (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) { tsec = h->root.u.def.section; toff = h->root.u.def.value; } + else + continue; } + /* If the branch and target are in the same section, you have + no hope of adding stubs. We'll error out later should the + branch overflow. */ + if (tsec == isec) + continue; + + toff += irel->r_addend; if (tsec->sec_info_type == ELF_INFO_TYPE_MERGE) toff = _bfd_merged_section_offset (abfd, &tsec, elf_section_data (tsec)->sec_info, - toff + irel->r_addend, 0); - else - toff += irel->r_addend; + toff, 0); symaddr = tsec->output_section->vma + tsec->output_offset + toff; @@ -1893,22 +1821,10 @@ ppc_elf_relax_section (bfd *abfd, reladdr = (isec->output_section->vma + isec->output_offset - + roff) & (bfd_vma) -4; + + roff); /* If the branch is in range, no need to do anything. */ - max_branch_offset = 1 << 25; - if (r_type != R_PPC_REL24 - && r_type != R_PPC_LOCAL24PC - && r_type != R_PPC_PLTREL24) - max_branch_offset = 1 << 15; - - if ((bfd_vma) (symaddr - reladdr) + max_branch_offset - <= 2 * max_branch_offset) - continue; - - /* If the branch and target are in the same section, you have - no hope. We'll error out later. */ - if (tsec == isec) + if (symaddr - reladdr + max_branch_offset < 2 * max_branch_offset) continue; /* Look for an existing fixup to this address. */ @@ -1919,40 +1835,31 @@ ppc_elf_relax_section (bfd *abfd, if (f == NULL) { size_t size; + unsigned long stub_rtype; + + val = trampoff - roff; + if (val >= max_branch_offset) + /* Oh dear, we can't reach a trampoline. Don't try to add + one. We'll report an error later. */ + continue; - if (link_info->shared - || tsec == ppc_info->plt - || r_type == R_PPC_LOCAL24PC) + if (link_info->shared) { - size = sizeof (shared_stub_entry); - insn_offset = 16; + size = 4 * ARRAY_SIZE (shared_stub_entry); + insn_offset = 12; + stub_rtype = R_PPC_RELAX32PC; } else { - size = sizeof (stub_entry); - insn_offset = 4; + size = 4 * ARRAY_SIZE (stub_entry); + insn_offset = 0; + stub_rtype = R_PPC_RELAX32; } - /* Resize the current section to make room for the new branch. */ - trampoff = (isec->_cooked_size + 3) & (bfd_vma) - 4; - amt = trampoff + size; - contents = bfd_realloc (contents, amt); - if (contents == NULL) - abort (); - - isec->_cooked_size = amt; - - if (link_info->shared - || tsec == ppc_info->plt - || r_type == R_PPC_LOCAL24PC) - memcpy (contents + trampoff, shared_stub_entry, size); - else - memcpy (contents + trampoff, stub_entry, size); - /* Hijack the old relocation. Since we need two relocations for this use a "composite" reloc. */ irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), - R_PPC_RELAX32); + stub_rtype); irel->r_offset = trampoff + insn_offset; /* Record the fixup so we don't do it again this section. */ @@ -1962,31 +1869,95 @@ ppc_elf_relax_section (bfd *abfd, f->toff = toff; f->trampoff = trampoff; fixups = f; + + trampoff += size; } else { + val = f->trampoff - roff; + if (val >= max_branch_offset) + continue; + /* Nop out the reloc, since we're finalizing things here. */ irel->r_info = ELF32_R_INFO (0, R_PPC_NONE); } - /* Fix up the existing branch to hit the trampoline. Hope like - hell this doesn't overflow too. */ - if (ppc_elf_install_value (abfd, contents + roff, - f->trampoff - (roff & (bfd_vma) -3) + 4, - r_type) != bfd_reloc_ok) - abort (); + /* Fix up the existing branch to hit the trampoline. */ + hit_addr = contents + roff; + switch (r_type) + { + case R_PPC_REL24: + case R_PPC_LOCAL24PC: + case R_PPC_PLTREL24: + t0 = bfd_get_32 (abfd, hit_addr); + t0 &= ~0x3fffffc; + t0 |= val & 0x3fffffc; + bfd_put_32 (abfd, t0, hit_addr); + break; - changed_contents = TRUE; - changed_relocs = TRUE; + case R_PPC_REL14: + case R_PPC_REL14_BRTAKEN: + case R_PPC_REL14_BRNTAKEN: + t0 = bfd_get_32 (abfd, hit_addr); + t0 &= ~0xfffc; + t0 |= val & 0xfffc; + bfd_put_32 (abfd, t0, hit_addr); + break; + } } - /* Clean up. */ - while (fixups) + /* Write out the trampolines. */ + changed = fixups != NULL; + if (fixups != NULL) { - struct one_fixup *f = fixups; - fixups = fixups->next; - free (f); + const int *stub; + bfd_byte *dest; + bfd_vma val; + int i, size; + + do + { + struct one_fixup *f = fixups; + fixups = fixups->next; + free (f); + } + while (fixups); + + contents = bfd_realloc (contents, trampoff); + if (contents == NULL) + goto error_return; + + isec->_cooked_size = (isec->_cooked_size + 3) & (bfd_vma) -4; + /* Branch around the trampolines. */ + val = trampoff - isec->_cooked_size + 0x48000000; + dest = contents + isec->_cooked_size; + isec->_cooked_size = trampoff; + bfd_put_32 (abfd, val, dest); + dest += 4; + + if (link_info->shared) + { + stub = shared_stub_entry; + size = ARRAY_SIZE (shared_stub_entry); + } + else + { + stub = stub_entry; + size = ARRAY_SIZE (stub_entry); + } + + i = 0; + while (dest < contents + trampoff) + { + bfd_put_32 (abfd, stub[i], dest); + i++; + if (i == size) + i = 0; + dest += 4; + } + BFD_ASSERT (i == 0); } + if (isymbuf != NULL && symtab_hdr->contents != (unsigned char *) isymbuf) { @@ -2002,7 +1973,7 @@ ppc_elf_relax_section (bfd *abfd, if (contents != NULL && elf_section_data (isec)->this_hdr.contents != contents) { - if (!changed_contents && !link_info->keep_memory) + if (!changed && !link_info->keep_memory) free (contents); else { @@ -2013,13 +1984,13 @@ ppc_elf_relax_section (bfd *abfd, if (elf_section_data (isec)->relocs != internal_relocs) { - if (!changed_relocs) + if (!changed) free (internal_relocs); else elf_section_data (isec)->relocs = internal_relocs; } - *again = changed_contents || changed_relocs; + *again = changed; return TRUE; error_return: @@ -4184,25 +4155,18 @@ ppc_elf_gc_sweep_hook (bfd *abfd, return TRUE; } -/* Set htab->tls_sec and htab->tls_get_addr. */ +/* Set htab->tls_get_addr and call the generic ELF tls_setup function. */ -bfd_boolean +asection * ppc_elf_tls_setup (bfd *obfd, struct bfd_link_info *info) { - asection *tls; struct ppc_elf_link_hash_table *htab; htab = ppc_elf_hash_table (info); htab->tls_get_addr = elf_link_hash_lookup (&htab->elf, "__tls_get_addr", FALSE, FALSE, TRUE); - for (tls = obfd->sections; tls != NULL; tls = tls->next) - if ((tls->flags & (SEC_THREAD_LOCAL | SEC_LOAD)) - == (SEC_THREAD_LOCAL | SEC_LOAD)) - break; - htab->tls_sec = tls; - - return tls != NULL; + return _bfd_elf_tls_setup (obfd, info); } /* Run through all the TLS relocs looking for optimization @@ -4725,7 +4689,7 @@ ppc_elf_relocate_section (bfd *output_bfd, sec = local_sections[r_symndx]; sym_name = bfd_elf_local_sym_name (input_bfd, sym); - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); } else { @@ -4733,7 +4697,7 @@ ppc_elf_relocate_section (bfd *output_bfd, symtab_hdr, relocation, sec, unresolved_reloc, info, warned); - + sym_name = h->root.root.string; } @@ -4917,8 +4881,8 @@ ppc_elf_relocate_section (bfd *output_bfd, { /* Was an LD reloc. */ r_symndx = 0; - rel->r_addend = htab->tls_sec->vma + DTP_OFFSET; - rel[1].r_addend = htab->tls_sec->vma + DTP_OFFSET; + rel->r_addend = htab->elf.tls_sec->vma + DTP_OFFSET; + rel[1].r_addend = htab->elf.tls_sec->vma + DTP_OFFSET; } r_type = R_PPC_TPREL16_HA; rel->r_info = ELF32_R_INFO (r_symndx, r_type); @@ -5156,7 +5120,7 @@ ppc_elf_relocate_section (bfd *output_bfd, { outrel.r_addend += relocation; if (tls_ty & (TLS_GD | TLS_DTPREL | TLS_TPREL)) - outrel.r_addend -= htab->tls_sec->vma; + outrel.r_addend -= htab->elf.tls_sec->vma; } loc = htab->relgot->contents; loc += (htab->relgot->reloc_count++ @@ -5174,7 +5138,7 @@ ppc_elf_relocate_section (bfd *output_bfd, value = 1; else if (tls_ty != 0) { - value -= htab->tls_sec->vma + DTP_OFFSET; + value -= htab->elf.tls_sec->vma + DTP_OFFSET; if (tls_ty == (TLS_TLS | TLS_TPREL)) value += DTP_OFFSET - TP_OFFSET; @@ -5262,7 +5226,7 @@ ppc_elf_relocate_section (bfd *output_bfd, case R_PPC_DTPREL16_LO: case R_PPC_DTPREL16_HI: case R_PPC_DTPREL16_HA: - addend -= htab->tls_sec->vma + DTP_OFFSET; + addend -= htab->elf.tls_sec->vma + DTP_OFFSET; break; /* Relocations that may need to be propagated if this is a shared @@ -5271,18 +5235,18 @@ ppc_elf_relocate_section (bfd *output_bfd, case R_PPC_TPREL16_LO: case R_PPC_TPREL16_HI: case R_PPC_TPREL16_HA: - addend -= htab->tls_sec->vma + TP_OFFSET; + addend -= htab->elf.tls_sec->vma + TP_OFFSET; /* The TPREL16 relocs shouldn't really be used in shared libs as they will result in DT_TEXTREL being set, but support them anyway. */ goto dodyn; case R_PPC_TPREL32: - addend -= htab->tls_sec->vma + TP_OFFSET; + addend -= htab->elf.tls_sec->vma + TP_OFFSET; goto dodyn; case R_PPC_DTPREL32: - addend -= htab->tls_sec->vma + DTP_OFFSET; + addend -= htab->elf.tls_sec->vma + DTP_OFFSET; goto dodyn; case R_PPC_DTPMOD32: @@ -5450,45 +5414,33 @@ ppc_elf_relocate_section (bfd *output_bfd, } break; + case R_PPC_RELAX32PC: + relocation -= (input_section->output_section->vma + + input_section->output_offset + + rel->r_offset - 4); + /* Fall thru */ case R_PPC_RELAX32: { - unsigned long r_symndx; - Elf_Internal_Sym *sym; - asection *sym_sec; - bfd_byte *hit_addr = 0; - bfd_vma value = 0; + unsigned long t0; + unsigned long t1; - r_symndx = ELF32_R_SYM (rel->r_info); + t0 = bfd_get_32 (output_bfd, contents + rel->r_offset); + t1 = bfd_get_32 (output_bfd, contents + rel->r_offset + 4); - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - sym_sec = local_sections[r_symndx]; + /* We're clearing the bits for R_PPC_ADDR16_HA + and R_PPC_ADDR16_LO here. */ + t0 &= ~0xffff; + t1 &= ~0xffff; - value = _bfd_elf_rela_local_sym (output_bfd, sym, sym_sec, rel); - } - else - { - bfd_boolean warned; - bfd_boolean unresolved_reloc; - - RELOC_FOR_GLOBAL_SYMBOL (h, elf_sym_hashes (input_bfd), - r_symndx, symtab_hdr, - value, sym_sec, - unresolved_reloc, info, - warned); - if (warned) - continue; - } - hit_addr = contents + rel->r_offset; - value += rel->r_addend; + /* t0 is HA, t1 is LO */ + relocation += addend; + t0 |= ((relocation + 0x8000) >> 16) & 0xffff; + t1 |= relocation & 0xffff; - r = ppc_elf_install_value (output_bfd, hit_addr, value, r_type); - if (r != bfd_reloc_ok) - break; - else - continue; + bfd_put_32 (output_bfd, t0, contents + rel->r_offset); + bfd_put_32 (output_bfd, t1, contents + rel->r_offset + 4); } + continue; /* Indirect .sdata relocation. */ case R_PPC_EMB_SDAI16: @@ -6186,26 +6138,16 @@ ppc_elf_final_write_processing (bfd *abfd, bfd_boolean linker ATTRIBUTE_UNUSED) static struct bfd_elf_special_section const ppc_elf_special_sections[]= { - { ".tags", 0, NULL, 0, - SHT_ORDERED, SHF_ALLOC }, - { ".sdata", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".sbss", 0, NULL, 0, - SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, - { ".sdata2", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC }, - { ".sbss2", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC }, - { ".PPC.EMB.apuinfo", 0, NULL, 0, - SHT_NOTE, 0 }, - { ".PPC.EMB.sdata0", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC }, - { ".PPC.EMB.sbss0", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC }, - { ".plt", 0, NULL, 0, - SHT_NOBITS, 0 }, - { NULL, 0, NULL, 0, - 0, 0 } + { ".tags", 5, 0, SHT_ORDERED, SHF_ALLOC }, + { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, + { ".sdata2", 7, -2, SHT_PROGBITS, SHF_ALLOC }, + { ".sbss2", 6, -2, SHT_PROGBITS, SHF_ALLOC }, + { ".PPC.EMB.apuinfo", 16, 0, SHT_NOTE, 0 }, + { ".PPC.EMB.sdata0", 15, 0, SHT_PROGBITS, SHF_ALLOC }, + { ".PPC.EMB.sbss0", 14, 0, SHT_PROGBITS, SHF_ALLOC }, + { ".plt", 4, 0, SHT_NOBITS, SHF_ALLOC + SHF_EXECINSTR }, + { NULL, 0, 0, 0, 0 } }; #define TARGET_LITTLE_SYM bfd_elf32_powerpcle_vec @@ -6234,7 +6176,6 @@ static struct bfd_elf_special_section const ppc_elf_special_sections[]= #define elf_backend_can_gc_sections 1 #define elf_backend_can_refcount 1 #define elf_backend_got_header_size 12 -#define elf_backend_plt_header_size PLT_INITIAL_ENTRY_SIZE #define elf_backend_rela_normal 1 #define bfd_elf32_mkobject ppc_elf_mkobject diff --git a/bfd/elf32-ppc.h b/bfd/elf32-ppc.h index 72be813..fa2c585 100644 --- a/bfd/elf32-ppc.h +++ b/bfd/elf32-ppc.h @@ -17,5 +17,5 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -bfd_boolean ppc_elf_tls_setup (bfd *, struct bfd_link_info *); +asection *ppc_elf_tls_setup (bfd *, struct bfd_link_info *); bfd_boolean ppc_elf_tls_optimize (bfd *, struct bfd_link_info *); diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index 5b07ab0..80a753a 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -2216,10 +2216,10 @@ static bfd_vma dtpoff_base (info) struct bfd_link_info *info; { - /* If tls_segment is NULL, we should have signalled an error already. */ - if (elf_hash_table (info)->tls_segment == NULL) + /* If tls_sec is NULL, we should have signalled an error already. */ + if (elf_hash_table (info)->tls_sec == NULL) return 0; - return elf_hash_table (info)->tls_segment->start; + return elf_hash_table (info)->tls_sec->vma; } /* Return the relocation value for @tpoff relocation @@ -2230,14 +2230,12 @@ tpoff (info, address) struct bfd_link_info *info; bfd_vma address; { - struct elf_link_tls_segment *tls_segment - = elf_hash_table (info)->tls_segment; + struct elf_link_hash_table *htab = elf_hash_table (info); - /* If tls_segment is NULL, we should have signalled an error already. */ - if (tls_segment == NULL) + /* If tls_sec is NULL, we should have signalled an error already. */ + if (htab->tls_sec == NULL) return 0; - return (align_power (tls_segment->size, tls_segment->align) - + tls_segment->start - address); + return htab->tls_size + htab->tls_sec->vma - address; } /* Complain if TLS instruction relocation is against an invalid @@ -2327,7 +2325,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, { sym = local_syms + r_symndx; sec = local_sections[r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); } else { @@ -3463,7 +3461,6 @@ elf_s390_grok_prstatus (abfd, note) #define elf_backend_plt_readonly 1 #define elf_backend_want_plt_sym 0 #define elf_backend_got_header_size 12 -#define elf_backend_plt_header_size PLT_ENTRY_SIZE #define elf_backend_rela_normal 1 #define elf_info_to_howto elf_s390_info_to_howto diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index 368bbca..9ffd05b 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -276,8 +276,36 @@ static reloc_howto_type sh_elf_howto_table[] = 0xff, /* dst_mask */ TRUE), /* pcrel_offset */ - EMPTY_HOWTO (10), - EMPTY_HOWTO (11), + /* 8 bit PC relative divided by 2 - but specified in a very odd way. */ + HOWTO (R_SH_LOOP_START, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_LOOP_START", /* name */ + TRUE, /* partial_inplace */ + 0xff, /* src_mask */ + 0xff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* 8 bit PC relative divided by 2 - but specified in a very odd way. */ + HOWTO (R_SH_LOOP_END, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_LOOP_END", /* name */ + TRUE, /* partial_inplace */ + 0xff, /* src_mask */ + 0xff, /* dst_mask */ + TRUE), /* pcrel_offset */ + EMPTY_HOWTO (12), EMPTY_HOWTO (13), EMPTY_HOWTO (14), @@ -288,15 +316,59 @@ static reloc_howto_type sh_elf_howto_table[] = EMPTY_HOWTO (19), EMPTY_HOWTO (20), EMPTY_HOWTO (21), - EMPTY_HOWTO (22), - EMPTY_HOWTO (23), - EMPTY_HOWTO (24), /* The remaining relocs are a GNU extension used for relaxing. The final pass of the linker never needs to do anything with any of these relocs. Any required operations are handled by the relaxation code. */ + /* GNU extension to record C++ vtable hierarchy */ + HOWTO (R_SH_GNU_VTINHERIT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + NULL, /* special_function */ + "R_SH_GNU_VTINHERIT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable member usage */ + HOWTO (R_SH_GNU_VTENTRY, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + _bfd_elf_rel_vtable_reloc_fn, /* special_function */ + "R_SH_GNU_VTENTRY", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* An 8 bit switch table entry. This is generated for an expression + such as ``.word L1 - L2''. The offset holds the difference + between the reloc address and L2. */ + HOWTO (R_SH_SWITCH8, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_SWITCH8", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ + /* A 16 bit switch table entry. This is generated for an expression such as ``.word L1 - L2''. The offset holds the difference between the reloc address and L2. */ @@ -434,90 +506,174 @@ static reloc_howto_type sh_elf_howto_table[] = 0, /* dst_mask */ TRUE), /* pcrel_offset */ - /* An 8 bit switch table entry. This is generated for an expression - such as ``.word L1 - L2''. The offset holds the difference - between the reloc address and L2. */ - HOWTO (R_SH_SWITCH8, /* type */ + /* The next 12 are only supported via linking in SHC-generated objects. */ + HOWTO (R_SH_DIR16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_DIR8, /* type */ 0, /* rightshift */ 0, /* size (0 = byte, 1 = short, 2 = long) */ 8, /* bitsize */ FALSE, /* pc_relative */ 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR8", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_DIR8UL, /* type */ + 2, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_SWITCH8", /* name */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR8UL", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ - 0, /* dst_mask */ - TRUE), /* pcrel_offset */ + 0xff, /* dst_mask */ + FALSE), /* pcrel_offset */ - /* GNU extension to record C++ vtable hierarchy */ - HOWTO (R_SH_GNU_VTINHERIT, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ + HOWTO (R_SH_DIR8UW, /* type */ + 1, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ FALSE, /* pc_relative */ 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - NULL, /* special_function */ - "R_SH_GNU_VTINHERIT", /* name */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR8UW", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ - 0, /* dst_mask */ + 0xff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* GNU extension to record C++ vtable member usage */ - HOWTO (R_SH_GNU_VTENTRY, /* type */ + HOWTO (R_SH_DIR8U, /* type */ 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ FALSE, /* pc_relative */ 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - _bfd_elf_rel_vtable_reloc_fn, /* special_function */ - "R_SH_GNU_VTENTRY", /* name */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR8U", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ - 0, /* dst_mask */ + 0xff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* 8 bit PC relative divided by 2 - but specified in a very odd way. */ - HOWTO (R_SH_LOOP_START, /* type */ + HOWTO (R_SH_DIR8SW, /* type */ 1, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ 8, /* bitsize */ FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_LOOP_START", /* name */ - TRUE, /* partial_inplace */ - 0xff, /* src_mask */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR8SW", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ 0xff, /* dst_mask */ - TRUE), /* pcrel_offset */ + FALSE), /* pcrel_offset */ - /* 8 bit PC relative divided by 2 - but specified in a very odd way. */ - HOWTO (R_SH_LOOP_END, /* type */ - 1, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ + HOWTO (R_SH_DIR8S, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ 8, /* bitsize */ FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_LOOP_END", /* name */ - TRUE, /* partial_inplace */ - 0xff, /* src_mask */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR8S", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ 0xff, /* dst_mask */ - TRUE), /* pcrel_offset */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_DIR4UL, /* type */ + 2, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 4, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR4UL", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x0f, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_DIR4UW, /* type */ + 1, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 4, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR4UW", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x0f, /* dst_mask */ + FALSE), /* pcrel_offset */ - EMPTY_HOWTO (38), - EMPTY_HOWTO (39), - EMPTY_HOWTO (40), - EMPTY_HOWTO (41), - EMPTY_HOWTO (42), - EMPTY_HOWTO (43), - EMPTY_HOWTO (44), + HOWTO (R_SH_DIR4U, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 4, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR4U", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x0f, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_PSHA, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 7, /* bitsize */ + FALSE, /* pc_relative */ + 4, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_PSHA", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x0f, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_PSHL, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 7, /* bitsize */ + FALSE, /* pc_relative */ + 4, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_PSHL", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x0f, /* dst_mask */ + FALSE), /* pcrel_offset */ #ifdef INCLUDE_SHMEDIA /* Used in SHLLI.L and SHLRI.L. */ @@ -636,7 +792,21 @@ static reloc_howto_type sh_elf_howto_table[] = #endif EMPTY_HOWTO (52), - EMPTY_HOWTO (53), + + HOWTO (R_SH_DIR16S, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR16S", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + EMPTY_HOWTO (54), EMPTY_HOWTO (55), EMPTY_HOWTO (56), @@ -1861,6 +2031,8 @@ static const struct elf_reloc_map sh_reloc_map[] = { { BFD_RELOC_NONE, R_SH_NONE }, { BFD_RELOC_32, R_SH_DIR32 }, + { BFD_RELOC_16, R_SH_DIR16 }, + { BFD_RELOC_8, R_SH_DIR8 }, { BFD_RELOC_CTOR, R_SH_DIR32 }, { BFD_RELOC_32_PCREL, R_SH_REL32 }, { BFD_RELOC_SH_PCDISP8BY2, R_SH_DIR8WPN }, @@ -4546,8 +4718,8 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, /* Many of the relocs are only used for relaxing, and are handled entirely by the relaxation code. */ - if (r_type > (int) R_SH_LAST_INVALID_RELOC - && r_type < (int) R_SH_LOOP_START) + if (r_type >= (int) R_SH_GNU_VTINHERIT + && r_type <= (int) R_SH_LABEL) continue; if (r_type == (int) R_SH_NONE) continue; @@ -4633,7 +4805,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, } else if (! howto->partial_inplace) { - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); addend = rel->r_addend; } else if ((sec->flags & SEC_MERGE) @@ -4843,15 +5015,85 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, bfd_set_error (bfd_error_bad_value); return FALSE; + case R_SH_DIR16: + case R_SH_DIR8: + case R_SH_DIR8U: + case R_SH_DIR8S: + case R_SH_DIR4U: + goto final_link_relocate; + + case R_SH_DIR8UL: + case R_SH_DIR4UL: + if (relocation & 3) + { + ((*_bfd_error_handler) + (_("%s: 0x%lx: fatal: unaligned %s relocation 0x%lx"), + bfd_archive_filename (input_section->owner), + (unsigned long) rel->r_offset, howto->name, + (unsigned long)relocation)); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + goto final_link_relocate; + + case R_SH_DIR8UW: + case R_SH_DIR8SW: + case R_SH_DIR4UW: + if (relocation & 1) + { + ((*_bfd_error_handler) + (_("%s: 0x%lx: fatal: unaligned %s relocation 0x%lx"), + bfd_archive_filename (input_section->owner), + (unsigned long) rel->r_offset, howto->name, + (unsigned long)relocation)); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + goto final_link_relocate; + + case R_SH_PSHA: + if ((signed int)relocation < -32 + || (signed int)relocation > 32) + { + ((*_bfd_error_handler) + (_("%s: 0x%lx: fatal: R_SH_PSHA relocation %d not in range -32..32"), + bfd_archive_filename (input_section->owner), + (unsigned long) rel->r_offset, + (unsigned long)relocation)); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + goto final_link_relocate; + + case R_SH_PSHL: + if ((signed int)relocation < -16 + || (signed int)relocation > 16) + { + ((*_bfd_error_handler) + (_("%s: 0x%lx: fatal: R_SH_PSHL relocation %d not in range -32..32"), + bfd_archive_filename (input_section->owner), + (unsigned long) rel->r_offset, + (unsigned long)relocation)); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + goto final_link_relocate; + case R_SH_DIR32: case R_SH_REL32: +#ifdef INCLUDE_SHMEDIA + case R_SH_IMM_LOW16_PCREL: + case R_SH_IMM_MEDLOW16_PCREL: + case R_SH_IMM_MEDHI16_PCREL: + case R_SH_IMM_HI16_PCREL: +#endif if (info->shared && (h == NULL || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT || h->root.type != bfd_link_hash_undefweak) && r_symndx != 0 && (input_section->flags & SEC_ALLOC) != 0 - && (r_type != R_SH_REL32 + && (r_type == R_SH_DIR32 || !SYMBOL_CALLS_LOCAL (info, h))) { Elf_Internal_Rela outrel; @@ -4904,6 +5146,17 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, outrel.r_addend = bfd_get_32 (input_bfd, contents + rel->r_offset); } +#ifdef INCLUDE_SHMEDIA + else if (r_type == R_SH_IMM_LOW16_PCREL + || r_type == R_SH_IMM_MEDLOW16_PCREL + || r_type == R_SH_IMM_MEDHI16_PCREL + || r_type == R_SH_IMM_HI16_PCREL) + { + BFD_ASSERT (h != NULL && h->dynindx != -1); + outrel.r_info = ELF32_R_INFO (h->dynindx, r_type); + outrel.r_addend = addend; + } +#endif else { /* h->dynindx may be -1 if this symbol was marked to @@ -5768,10 +6021,10 @@ sh_elf_get_relocated_section_contents (bfd *output_bfd, static bfd_vma dtpoff_base (struct bfd_link_info *info) { - /* If tls_segment is NULL, we should have signalled an error already. */ - if (elf_hash_table (info)->tls_segment == NULL) + /* If tls_sec is NULL, we should have signalled an error already. */ + if (elf_hash_table (info)->tls_sec == NULL) return 0; - return elf_hash_table (info)->tls_segment->start; + return elf_hash_table (info)->tls_sec->vma; } /* Return the relocation value for R_SH_TLS_TPOFF32.. */ @@ -5779,12 +6032,12 @@ dtpoff_base (struct bfd_link_info *info) static bfd_vma tpoff (struct bfd_link_info *info, bfd_vma address) { - /* If tls_segment is NULL, we should have signalled an error already. */ - if (elf_hash_table (info)->tls_segment == NULL) + /* If tls_sec is NULL, we should have signalled an error already. */ + if (elf_hash_table (info)->tls_sec == NULL) return 0; /* SH TLS ABI is variant I and static TLS block start just after tcbhead structure which has 2 pointer fields. */ - return (address - dtpoff_base (info) + 8); + return address - elf_hash_table (info)->tls_sec->vma + 8; } static asection * @@ -6419,6 +6672,12 @@ sh_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, case R_SH_DIR32: case R_SH_REL32: +#ifdef INCLUDE_SHMEDIA + case R_SH_IMM_LOW16_PCREL: + case R_SH_IMM_MEDLOW16_PCREL: + case R_SH_IMM_MEDHI16_PCREL: + case R_SH_IMM_HI16_PCREL: +#endif if (h != NULL && ! info->shared) { h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF; @@ -6536,7 +6795,14 @@ sh_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, } p->count += 1; - if (r_type == R_SH_REL32) + if (r_type == R_SH_REL32 +#ifdef INCLUDE_SHMEDIA + || r_type == R_SH_IMM_LOW16_PCREL + || r_type == R_SH_IMM_MEDLOW16_PCREL + || r_type == R_SH_IMM_MEDHI16_PCREL + || r_type == R_SH_IMM_HI16_PCREL +#endif + ) p->pc_count += 1; } @@ -6597,6 +6863,18 @@ sh_elf_set_mach_from_flags (bfd *abfd) case EF_SH4: bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh4); break; + case EF_SH4_NOFPU: + bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh4_nofpu); + break; + case EF_SH4A: + bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh4a); + break; + case EF_SH4A_NOFPU: + bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh4a_nofpu); + break; + case EF_SH4AL_DSP: + bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh4al_dsp); + break; default: return FALSE; } @@ -7277,7 +7555,6 @@ elf32_shlin_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) #define elf_backend_plt_readonly 1 #define elf_backend_want_plt_sym 0 #define elf_backend_got_header_size 12 -#define elf_backend_plt_header_size PLT_ENTRY_SIZE #ifndef INCLUDE_SHMEDIA diff --git a/bfd/elf32-sh64.c b/bfd/elf32-sh64.c index 396fedf..c3be09f 100644 --- a/bfd/elf32-sh64.c +++ b/bfd/elf32-sh64.c @@ -85,6 +85,7 @@ static void sh64_find_section_for_address #define elf_backend_add_symbol_hook sh64_elf_add_symbol_hook #define elf_backend_link_output_symbol_hook \ sh64_elf_link_output_symbol_hook +#define elf_backend_merge_symbol_attribute sh64_elf_merge_symbol_attribute #define elf_backend_final_write_processing sh64_elf_final_write_processing #define elf_backend_section_from_shdr sh64_backend_section_from_shdr #define elf_backend_special_sections sh64_elf_special_sections @@ -735,12 +736,31 @@ sh64_elf_final_write_processing (bfd *abfd, } } +/* Merge non visibility st_other attribute when the symbol comes from + a dynamic object. */ +static void +sh64_elf_merge_symbol_attribute (struct elf_link_hash_entry *h, + const Elf_Internal_Sym *isym, + bfd_boolean definition, + bfd_boolean dynamic) +{ + if (isym->st_other != 0 && dynamic) + { + unsigned char other; + + /* Take the balance of OTHER from the definition. */ + other = (definition ? isym->st_other : h->other); + other &= ~ ELF_ST_VISIBILITY (-1); + h->other = other | ELF_ST_VISIBILITY (h->other); + } + + return; +} + static struct bfd_elf_special_section const sh64_elf_special_sections[]= { - { ".cranges", 0, NULL, 0, - SHT_PROGBITS, 0 }, - { NULL, 0, NULL, 0, - 0, 0 } + { ".cranges", 8, 0, SHT_PROGBITS, 0 }, + { NULL, 0, 0, 0, 0 } }; #undef TARGET_BIG_SYM diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c index 50d968e..ea3a9b1 100644 --- a/bfd/elf32-sparc.c +++ b/bfd/elf32-sparc.c @@ -2082,10 +2082,10 @@ static bfd_vma dtpoff_base (info) struct bfd_link_info *info; { - /* If tls_segment is NULL, we should have signalled an error already. */ - if (elf_hash_table (info)->tls_segment == NULL) + /* If tls_sec is NULL, we should have signalled an error already. */ + if (elf_hash_table (info)->tls_sec == NULL) return 0; - return elf_hash_table (info)->tls_segment->start; + return elf_hash_table (info)->tls_sec->vma; } /* Return the relocation value for @tpoff relocation @@ -2096,14 +2096,12 @@ tpoff (info, address) struct bfd_link_info *info; bfd_vma address; { - struct elf_link_tls_segment *tls_segment - = elf_hash_table (info)->tls_segment; + struct elf_link_hash_table *htab = elf_hash_table (info); - /* If tls_segment is NULL, we should have signalled an error already. */ - if (tls_segment == NULL) + /* If tls_sec is NULL, we should have signalled an error already. */ + if (htab->tls_sec == NULL) return 0; - return -(align_power (tls_segment->size, tls_segment->align) - + tls_segment->start - address); + return address - htab->tls_size - htab->tls_sec->vma; } /* Relocate a SPARC ELF section. */ @@ -2182,7 +2180,7 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section, { sym = local_syms + r_symndx; sec = local_sections[r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); } else { @@ -2459,16 +2457,8 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section, if (is_plt) sec = htab->splt; - else if (h == NULL) - sec = local_sections[r_symndx]; - else - { - BFD_ASSERT (h->root.type == bfd_link_hash_defined - || (h->root.type - == bfd_link_hash_defweak)); - sec = h->root.u.def.section; - } - if (sec != NULL && bfd_is_abs_section (sec)) + + if (bfd_is_abs_section (sec)) indx = 0; else if (sec == NULL || sec->owner == NULL) { @@ -3478,7 +3468,6 @@ elf32_sparc_reloc_type_class (rela) #define elf_backend_plt_readonly 0 #define elf_backend_want_plt_sym 1 #define elf_backend_got_header_size 4 -#define elf_backend_plt_header_size (4*PLT_ENTRY_SIZE) #define elf_backend_rela_normal 1 #include "elf32-target.h" diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c index 0dc6542..fb290eb 100644 --- a/bfd/elf32-v850.c +++ b/bfd/elf32-v850.c @@ -1681,7 +1681,7 @@ v850_elf_relocate_section (output_bfd, info, input_bfd, input_section, { sym = local_syms + r_symndx; sec = local_sections[r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); #if 0 { char * name; @@ -3163,34 +3163,33 @@ v850_elf_relax_section (abfd, sec, link_info, again) static struct bfd_elf_special_section const v850_elf_special_sections[]= { - { ".sdata", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_GPREL }, - { ".rosdata", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_V850_GPREL }, - { ".sbss", 0, NULL, 0, - SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_GPREL }, - { ".scommon", 0, NULL, 0, - SHT_V850_SCOMMON, SHF_ALLOC + SHF_WRITE + SHF_V850_GPREL }, - { ".tdata", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_EPREL }, - { ".tbss", 0, NULL, 0, - SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_EPREL }, - { ".tcommon", 0, NULL, 0, - SHT_V850_TCOMMON, SHF_ALLOC + SHF_WRITE + SHF_V850_R0REL }, - { ".zdata", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_R0REL }, - { ".rozdata", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_V850_R0REL }, - { ".zbss", 0, NULL, 0, - SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_R0REL }, - { ".zcommon", 0, NULL, 0, - SHT_V850_ZCOMMON, SHF_ALLOC + SHF_WRITE + SHF_V850_R0REL }, - { ".call_table_data", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".call_table_text", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_EXECINSTR }, - { NULL, 0, NULL, 0, - 0, 0 } + { ".sdata", 6, -2, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE + + SHF_V850_GPREL) }, + { ".rosdata", 8, -2, SHT_PROGBITS, (SHF_ALLOC + + SHF_V850_GPREL) }, + { ".sbss", 5, -2, SHT_NOBITS, (SHF_ALLOC + SHF_WRITE + + SHF_V850_GPREL) }, + { ".scommon", 8, -2, SHT_V850_SCOMMON, (SHF_ALLOC + SHF_WRITE + + SHF_V850_GPREL) }, + { ".tdata", 6, -2, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE + + SHF_V850_EPREL) }, + { ".tbss", 5, -2, SHT_NOBITS, (SHF_ALLOC + SHF_WRITE + + SHF_V850_EPREL) }, + { ".tcommon", 8, -2, SHT_V850_TCOMMON, (SHF_ALLOC + SHF_WRITE + + SHF_V850_R0REL) }, + { ".zdata", 6, -2, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE + + SHF_V850_R0REL) }, + { ".rozdata", 8, -2, SHT_PROGBITS, (SHF_ALLOC + + SHF_V850_R0REL) }, + { ".zbss", 5, -2, SHT_NOBITS, (SHF_ALLOC + SHF_WRITE + + SHF_V850_R0REL) }, + { ".zcommon", 8, -2, SHT_V850_ZCOMMON, (SHF_ALLOC + SHF_WRITE + + SHF_V850_R0REL) }, + { ".call_table_data", 16, 0, SHT_PROGBITS, (SHF_ALLOC + + SHF_WRITE) }, + { ".call_table_text", 16, 0, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE + + SHF_EXECINSTR) }, + { NULL, 0, 0, 0, 0 } }; #define TARGET_LITTLE_SYM bfd_elf32_v850_vec diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c index 7d78e0f..21fdd9d 100644 --- a/bfd/elf32-vax.c +++ b/bfd/elf32-vax.c @@ -1149,7 +1149,7 @@ elf_vax_size_dynamic_sections (output_bfd, info) if (elf_hash_table (info)->dynamic_sections_created) { /* Set the contents of the .interp section to the interpreter. */ - if (!info->shared) + if (info->executable) { s = bfd_get_section_by_name (dynobj, ".interp"); BFD_ASSERT (s != NULL); @@ -1483,7 +1483,7 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section, { sym = local_syms + r_symndx; sec = local_sections[r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); } else { @@ -1737,16 +1737,7 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section, { long indx; - if (h == NULL) - sec = local_sections[r_symndx]; - else - { - BFD_ASSERT (h->root.type == bfd_link_hash_defined - || (h->root.type - == bfd_link_hash_defweak)); - sec = h->root.u.def.section; - } - if (sec != NULL && bfd_is_abs_section (sec)) + if (bfd_is_abs_section (sec)) indx = 0; else if (sec == NULL || sec->owner == NULL) { diff --git a/bfd/elf32-xstormy16.c b/bfd/elf32-xstormy16.c index af9a048..1377ff2 100644 --- a/bfd/elf32-xstormy16.c +++ b/bfd/elf32-xstormy16.c @@ -845,7 +845,7 @@ xstormy16_elf_relocate_section (output_bfd, info, input_bfd, input_section, { sym = local_syms + r_symndx; sec = local_sections [r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c index 251c332..e8c276b 100644 --- a/bfd/elf32-xtensa.c +++ b/bfd/elf32-xtensa.c @@ -212,10 +212,8 @@ static bfd_boolean is_literal_section PARAMS ((asection *)); static int internal_reloc_compare PARAMS ((const PTR, const PTR)); -static bfd_boolean get_is_linkonce_section - PARAMS ((bfd *, asection *)); extern char *xtensa_get_property_section_name - PARAMS ((bfd *, asection *, const char *)); + PARAMS ((asection *, const char *)); /* Other functions called directly by the linker. */ @@ -504,8 +502,9 @@ xtensa_read_table_entries (abfd, section, table_p, sec_name) Elf_Internal_Rela *internal_relocs; table_section_name = - xtensa_get_property_section_name (abfd, section, sec_name); + xtensa_get_property_section_name (section, sec_name); table_section = bfd_get_section_by_name (abfd, table_section_name); + free (table_section_name); if (table_section != NULL) table_size = bfd_get_section_size_before_reloc (table_section); @@ -515,7 +514,7 @@ xtensa_read_table_entries (abfd, section, table_p, sec_name) return 0; } - num_records = table_size / sizeof (property_table_entry); + num_records = table_size / 8; table_data = retrieve_contents (abfd, table_section, TRUE); blocks = (property_table_entry *) bfd_malloc (num_records * sizeof (property_table_entry)); @@ -557,7 +556,7 @@ xtensa_read_table_entries (abfd, section, table_p, sec_name) and the addresses are already in the table. */ bfd_vma off; - for (off = 0; off < table_size; off += sizeof (property_table_entry)) + for (off = 0; off < table_size; off += 8) { bfd_vma address = bfd_get_32 (abfd, table_data + off); @@ -1177,7 +1176,7 @@ elf_xtensa_size_dynamic_sections (output_bfd, info) if (elf_hash_table (info)->dynamic_sections_created) { /* Set the contents of the .interp section to the interpreter. */ - if (! info->shared) + if (info->executable) { s = bfd_get_section_by_name (dynobj, ".interp"); if (s == NULL) @@ -2005,7 +2004,7 @@ elf_xtensa_relocate_section (output_bfd, info, input_bfd, { sym = local_syms + r_symndx; sec = local_sections[r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); } else { @@ -2081,8 +2080,8 @@ elf_xtensa_relocate_section (output_bfd, info, input_bfd, memset (&outrel, 0, sizeof outrel); else { - outrel.r_offset = (input_section->output_section->vma - + input_section->output_offset); + outrel.r_offset += (input_section->output_section->vma + + input_section->output_offset); if (dynamic_symbol) { @@ -2314,6 +2313,7 @@ elf_xtensa_combine_prop_entries (output_bfd, sxtlit, sgotloc) memcpy (sgotloc->contents, contents, section_size); free (contents); + free (table); return num; } @@ -5605,25 +5605,25 @@ pcrel_reloc_fits (opnd, self_address, dest_address) } +static int linkonce_len = sizeof (".gnu.linkonce.") - 1; +static int insn_sec_len = sizeof (XTENSA_INSN_SEC_NAME) - 1; +static int lit_sec_len = sizeof (XTENSA_LIT_SEC_NAME) - 1; + + static bfd_boolean xtensa_is_property_section (sec) asection *sec; { - static int linkonce_len = sizeof (".gnu.linkonce.") - 1; + if (strncmp (XTENSA_INSN_SEC_NAME, sec->name, insn_sec_len) == 0 + || strncmp (XTENSA_LIT_SEC_NAME, sec->name, lit_sec_len) == 0) + return TRUE; - if (strncmp (".xt.insn", sec->name, 8) == 0 - || strncmp (".xt.lit", sec->name, 7) == 0) + if (strncmp (".gnu.linkonce.", sec->name, linkonce_len) == 0 + && (sec->name[linkonce_len] == 'x' + || sec->name[linkonce_len] == 'p') + && sec->name[linkonce_len + 1] == '.') return TRUE; - if (strncmp (".gnu.linkonce.", sec->name, linkonce_len) == 0) - { - if (strncmp ("x.", sec->name + linkonce_len, 2) == 0 - || strncmp ("p.", sec->name + linkonce_len, 2) == 0) - return TRUE; - if (strstr (sec->name + linkonce_len, ".xt.insn") != NULL - || strstr (sec->name + linkonce_len, ".xt.lit") != NULL) - return TRUE; - } return FALSE; } @@ -5632,18 +5632,14 @@ static bfd_boolean xtensa_is_littable_section (sec) asection *sec; { - static int linkonce_len = sizeof (".gnu.linkonce.") - 1; + if (strncmp (XTENSA_LIT_SEC_NAME, sec->name, lit_sec_len) == 0) + return TRUE; - if (strncmp (".xt.lit", sec->name, 7) == 0) + if (strncmp (".gnu.linkonce.", sec->name, linkonce_len) == 0 + && sec->name[linkonce_len] == 'p' + && sec->name[linkonce_len + 1] == '.') return TRUE; - if (strncmp (".gnu.linkonce.", sec->name, linkonce_len) == 0) - { - if (strncmp ("p.", sec->name + linkonce_len, 2) == 0) - return TRUE; - if (strstr (sec->name + linkonce_len, ".xt.lit") != NULL) - return TRUE; - } return FALSE; } @@ -5671,78 +5667,42 @@ internal_reloc_compare (ap, bp) } -static bfd_boolean -get_is_linkonce_section (abfd, sec) - bfd *abfd ATTRIBUTE_UNUSED; - asection *sec; -{ - flagword flags, link_once_flags; - bfd_boolean is_linkonce = FALSE;; - - flags = bfd_get_section_flags (abfd, sec); - link_once_flags = (flags & SEC_LINK_ONCE); - if (link_once_flags != 0) - is_linkonce = TRUE; - - /* In order for this to be useful to the assembler - before the linkonce flag is set we need to - check for the GNU extension name. */ - if (!is_linkonce && - strncmp (sec->name, ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) == 0) - is_linkonce = TRUE; - - return is_linkonce; -} - - char * -xtensa_get_property_section_name (abfd, sec, base_name) - bfd *abfd; +xtensa_get_property_section_name (sec, base_name) asection *sec; - const char * base_name; + const char *base_name; { - char *table_sec_name = NULL; - bfd_boolean is_linkonce; - - is_linkonce = get_is_linkonce_section (abfd, sec); - - if (!is_linkonce) + if (strncmp (sec->name, ".gnu.linkonce.", linkonce_len) == 0) { - table_sec_name = strdup (base_name); - } - else - { - static size_t prefix_len = sizeof (".gnu.linkonce.t.") - 1; - size_t len = strlen (sec->name) + 1; - char repl_char = '\0'; - const char *segname = sec->name; - - if (strncmp (segname, ".gnu.linkonce.t.", prefix_len) == 0) - { - if (strcmp (base_name, ".xt.insn") == 0) - repl_char = 'x'; - else if (strcmp (base_name, ".xt.lit") == 0) - repl_char = 'p'; - } - - if (repl_char != '\0') - { - char *name = (char *) bfd_malloc (len); - memcpy (name, sec->name, len); - name[prefix_len - 2] = repl_char; - table_sec_name = name; - } + char *prop_sec_name; + const char *suffix; + char linkonce_kind = 0; + + if (strcmp (base_name, XTENSA_INSN_SEC_NAME) == 0) + linkonce_kind = 'x'; + else if (strcmp (base_name, XTENSA_LIT_SEC_NAME) == 0) + linkonce_kind = 'p'; else + abort (); + + prop_sec_name = (char *) bfd_malloc (strlen (sec->name) + 1); + memcpy (prop_sec_name, ".gnu.linkonce.", linkonce_len); + prop_sec_name[linkonce_len] = linkonce_kind; + prop_sec_name[linkonce_len + 1] = '.'; + + suffix = sec->name + linkonce_len; + while (*suffix) { - size_t base_len = strlen (base_name) + 1; - char *name = (char *) bfd_malloc (len + base_len); - memcpy (name, sec->name, len - 1); - memcpy (name + len - 1, base_name, base_len); - table_sec_name = name; + suffix += 1; + if (suffix[-1] == '.') + break; } + strcpy (prop_sec_name + linkonce_len + 2, suffix); + + return prop_sec_name; } - return table_sec_name; + return strdup (base_name); } @@ -5841,14 +5801,10 @@ xtensa_callback_required_dependence (abfd, sec, link_info, callback, closure) module loader so that the literals are not placed after the text. */ static struct bfd_elf_special_section const elf_xtensa_special_sections[]= { - { ".literal", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, - { ".init.literal", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, - { ".fini.literal", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, - { NULL, 0, NULL, 0, - 0, 0 } + { ".literal", 8, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, + { ".init.literal", 13, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, + { ".fini.literal", 13, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, + { NULL, 0, 0, 0, 0 } }; diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index 0b64bd3..ac16fb5 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -1158,13 +1158,15 @@ elf64_alpha_info_to_howto (abfd, cache_ptr, dst) (r_type == R_ALPHA_TLSGD || r_type == R_ALPHA_TLSLDM ? 16 : 8) /* This is PT_TLS segment p_vaddr. */ -#define alpha_get_dtprel_base(tlss) \ - ((tlss)->start) +#define alpha_get_dtprel_base(info) \ + (elf_hash_table (info)->tls_sec->vma) /* Main program TLS (whose template starts at PT_TLS p_vaddr) is assigned offset round(16, PT_TLS p_align). */ -#define alpha_get_tprel_base(tlss) \ - ((tlss)->start - align_power ((bfd_vma) 16, (tlss)->align)) +#define alpha_get_tprel_base(info) \ + (elf_hash_table (info)->tls_sec->vma \ + - align_power ((bfd_vma) 16, \ + elf_hash_table (info)->tls_sec->alignment_power)) /* These functions do relaxation for Alpha ELF. @@ -1198,7 +1200,6 @@ struct alpha_relax_info Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Rela *relocs, *relend; struct bfd_link_info *link_info; - struct elf_link_tls_segment *tls_segment; bfd_vma gp; bfd *gotobj; asection *tsec; @@ -1224,8 +1225,6 @@ static bfd_boolean elf64_alpha_relax_gprelhilo static bfd_boolean elf64_alpha_relax_tls_get_addr PARAMS((struct alpha_relax_info *info, bfd_vma symval, Elf_Internal_Rela *irel, bfd_boolean)); -static struct elf_link_tls_segment *elf64_alpha_relax_find_tls_segment - PARAMS((struct alpha_relax_info *, struct elf_link_tls_segment *)); static bfd_boolean elf64_alpha_relax_section PARAMS((bfd *abfd, asection *sec, struct bfd_link_info *link_info, bfd_boolean *again)); @@ -1598,9 +1597,9 @@ elf64_alpha_relax_got_load (info, symval, irel, r_type) { bfd_vma dtp_base, tp_base; - BFD_ASSERT (info->tls_segment != NULL); - dtp_base = alpha_get_dtprel_base (info->tls_segment); - tp_base = alpha_get_tprel_base (info->tls_segment); + BFD_ASSERT (elf_hash_table (info->link_info)->tls_sec != NULL); + dtp_base = alpha_get_dtprel_base (info->link_info); + tp_base = alpha_get_tprel_base (info->link_info); disp = symval - (r_type == R_ALPHA_GOTDTPREL ? dtp_base : tp_base); } @@ -1845,8 +1844,8 @@ elf64_alpha_relax_tls_get_addr (info, symval, irel, is_gd) bfd_vma tp_base; bfd_signed_vma disp; - BFD_ASSERT (info->tls_segment != NULL); - tp_base = alpha_get_tprel_base (info->tls_segment); + BFD_ASSERT (elf_hash_table (info->link_info)->tls_sec != NULL); + tp_base = alpha_get_tprel_base (info->link_info); disp = symval - tp_base; if (disp >= -0x8000 && disp < 0x8000) @@ -1961,53 +1960,6 @@ elf64_alpha_relax_tls_get_addr (info, symval, irel, is_gd) return TRUE; } -static struct elf_link_tls_segment * -elf64_alpha_relax_find_tls_segment (info, seg) - struct alpha_relax_info *info; - struct elf_link_tls_segment *seg; -{ - bfd *output_bfd = info->sec->output_section->owner; - asection *o; - unsigned int align; - bfd_vma base, end; - - for (o = output_bfd->sections; o ; o = o->next) - if ((o->flags & SEC_THREAD_LOCAL) != 0 - && (o->flags & SEC_LOAD) != 0) - break; - if (!o) - return NULL; - - base = o->vma; - align = 0; - - do - { - bfd_vma size; - - if (bfd_get_section_alignment (output_bfd, o) > align) - align = bfd_get_section_alignment (output_bfd, o); - - size = o->_raw_size; - if (size == 0 && (o->flags & SEC_HAS_CONTENTS) == 0) - { - struct bfd_link_order *lo; - for (lo = o->link_order_head; lo ; lo = lo->next) - if (size < lo->offset + lo->size) - size = lo->offset + lo->size; - } - end = o->vma + size; - o = o->next; - } - while (o && (o->flags & SEC_THREAD_LOCAL)); - - seg->start = base; - seg->size = end - base; - seg->align = align; - - return seg; -} - static bfd_boolean elf64_alpha_relax_section (abfd, sec, link_info, again) bfd *abfd; @@ -2021,7 +1973,6 @@ elf64_alpha_relax_section (abfd, sec, link_info, again) Elf_Internal_Sym *isymbuf = NULL; struct alpha_elf_got_entry **local_got_entries; struct alpha_relax_info info; - struct elf_link_tls_segment tls_segment; /* We are not currently changing any sizes, so only one pass. */ *again = FALSE; @@ -2079,11 +2030,6 @@ elf64_alpha_relax_section (abfd, sec, link_info, again) goto error_return; } - /* Compute the TLS segment information. The version normally found in - elf_hash_table (link_info)->tls_segment isn't built until final_link. - ??? Probably should look into extracting this into a common function. */ - info.tls_segment = elf64_alpha_relax_find_tls_segment (&info, &tls_segment); - for (irel = internal_relocs; irel < irelend; irel++) { bfd_vma symval; @@ -2137,7 +2083,7 @@ elf64_alpha_relax_section (abfd, sec, link_info, again) if (r_type == R_ALPHA_TLSLDM) { info.tsec = bfd_abs_section_ptr; - symval = alpha_get_tprel_base (info.tls_segment); + symval = alpha_get_tprel_base (info.link_info); } else { @@ -2467,8 +2413,13 @@ elf64_alpha_create_got_section(abfd, info) { asection *s; - if (bfd_get_section_by_name (abfd, ".got")) - return TRUE; + if ((s = bfd_get_section_by_name (abfd, ".got"))) + { + /* Check for a non-linker created .got? */ + if (alpha_elf_tdata (abfd)->got == NULL) + alpha_elf_tdata (abfd)->got = s; + return TRUE; + } s = bfd_make_section (abfd, ".got"); if (s == NULL @@ -4289,7 +4240,6 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; - struct elf_link_tls_segment *tls_segment; asection *sgot, *srel, *srelgot; bfd *dynobj, *gotobj; bfd_vma gp, tp_base, dtp_base; @@ -4343,11 +4293,10 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, local_got_entries = alpha_elf_tdata(input_bfd)->local_got_entries; - tls_segment = elf_hash_table (info)->tls_segment; - if (tls_segment) + if (elf_hash_table (info)->tls_sec != NULL) { - dtp_base = alpha_get_dtprel_base (tls_segment); - tp_base = alpha_get_tprel_base (tls_segment); + dtp_base = alpha_get_dtprel_base (info); + tp_base = alpha_get_tprel_base (info); } else dtp_base = tp_base = 0; @@ -4389,9 +4338,11 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, if (r_symndx < symtab_hdr->sh_info) { + asection *msec; sym = local_syms + r_symndx; sec = local_sections[r_symndx]; - value = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + msec = sec; + value = _bfd_elf_rela_local_sym (output_bfd, sym, &msec, rel); /* If this is a tp-relative relocation against sym 0, this is hackery from relax_section. Force the value to @@ -4419,7 +4370,6 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, && !gotent->reloc_xlated) { struct alpha_elf_got_entry *ent; - asection *msec; for (ent = gotent; ent; ent = ent->next) { @@ -4669,13 +4619,13 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, } else if (r_type == R_ALPHA_DTPREL64) { - BFD_ASSERT(tls_segment != NULL); + BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL); value -= dtp_base; goto default_reloc; } else if (r_type == R_ALPHA_TPREL64) { - BFD_ASSERT(tls_segment != NULL); + BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL); if (!info->shared) { value -= tp_base; @@ -4755,7 +4705,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, value = 0; else { - BFD_ASSERT(tls_segment != NULL); + BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL); value -= dtp_base; } bfd_put_64 (output_bfd, value, @@ -4778,7 +4728,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, bfd_archive_filename (input_bfd), h->root.root.root.string); ret_val = FALSE; } - BFD_ASSERT(tls_segment != NULL); + BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL); value -= dtp_base; if (r_type == R_ALPHA_DTPRELHI) value = ((bfd_signed_vma) value >> 16) + ((value >> 15) & 1); @@ -4801,7 +4751,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, bfd_archive_filename (input_bfd), h->root.root.root.string); ret_val = FALSE; } - BFD_ASSERT(tls_segment != NULL); + BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL); value -= tp_base; if (r_type == R_ALPHA_TPRELHI) value = ((bfd_signed_vma) value >> 16) + ((value >> 15) & 1); @@ -4822,7 +4772,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, value = 0; else { - BFD_ASSERT(tls_segment != NULL); + BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL); if (r_type == R_ALPHA_GOTDTPREL) value -= dtp_base; else if (!info->shared) @@ -5444,12 +5394,9 @@ elf64_alpha_reloc_type_class (rela) static struct bfd_elf_special_section const elf64_alpha_special_sections[]= { - { ".sdata", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL }, - { ".sbss", 0, NULL, 0, - SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL }, - { NULL, 0, NULL, 0, - 0, 0 } + { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL }, + { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL }, + { NULL, 0, 0, 0, 0 } }; /* ECOFF swapping routines. These are used when dealing with the @@ -5598,7 +5545,6 @@ static const struct elf_size_info alpha_elf_size_info = #define elf_backend_plt_readonly 0 #define elf_backend_want_plt_sym 1 #define elf_backend_got_header_size 0 -#define elf_backend_plt_header_size PLT_HEADER_SIZE #include "elf64-target.h" diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c index 88403f5..294d643 100644 --- a/bfd/elf64-hppa.c +++ b/bfd/elf64-hppa.c @@ -1642,7 +1642,7 @@ elf64_hppa_size_dynamic_sections (output_bfd, info) if (elf_hash_table (info)->dynamic_sections_created) { /* Set the contents of the .interp section to the interpreter. */ - if (! info->shared) + if (info->executable) { s = bfd_get_section_by_name (dynobj, ".interp"); BFD_ASSERT (s != NULL); @@ -2675,12 +2675,9 @@ elf64_hppa_elf_get_symbol_type (elf_sym, type) static struct bfd_elf_special_section const elf64_hppa_special_sections[]= { - { ".fini", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".init", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { NULL, 0, NULL, 0, - 0, 0 } + { ".fini", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".init", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { NULL, 0, 0, 0, 0 } }; /* The hash bucket size is the standard one, namely 4. */ @@ -2775,7 +2772,6 @@ const struct elf_size_info hppa64_elf_size_info = #define elf_backend_plt_readonly 0 #define elf_backend_want_plt_sym 0 #define elf_backend_got_header_size 0 -#define elf_backend_plt_header_size 0 #define elf_backend_type_change_ok TRUE #define elf_backend_get_symbol_type elf64_hppa_elf_get_symbol_type #define elf_backend_reloc_type_class elf64_hppa_reloc_type_class diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c index 3a874d8..11d0565 100644 --- a/bfd/elf64-mips.c +++ b/bfd/elf64-mips.c @@ -2913,7 +2913,6 @@ const struct elf_size_info mips_elf64_size_info = #define elf_backend_grok_psinfo elf64_mips_grok_psinfo #define elf_backend_got_header_size (4 * MIPS_RESERVED_GOTNO) -#define elf_backend_plt_header_size 0 /* MIPS ELF64 can use a mixture of REL and RELA, but some Relocations work better/work only in RELA, so we default to this. */ diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c index 54c4ca8..6440dcb 100644 --- a/bfd/elf64-mmix.c +++ b/bfd/elf64-mmix.c @@ -21,7 +21,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* No specific ABI or "processor-specific supplement" defined. */ /* TODO: - - Linker relaxation. */ + - "Traditional" linker relaxation (shrinking whole sections). + - Merge reloc stubs jumping to same location. + - GETA stub relaxation (call a stub for out of range new + R_MMIX_GETA_STUBBABLE). */ #include "bfd.h" #include "sysdep.h" @@ -32,6 +35,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define MINUS_ONE (((bfd_vma) 0) - 1) +#define MAX_PUSHJ_STUB_SIZE (5 * 4) + /* Put these everywhere in new code. */ #define FATAL_DEBUG \ _bfd_abort (__FILE__, __LINE__, \ @@ -49,6 +54,24 @@ struct _mmix_elf_section_data struct bpo_reloc_section_info *reloc; struct bpo_greg_section_info *greg; } bpo; + + struct pushj_stub_info + { + /* Maximum number of stubs needed for this section. */ + bfd_size_type n_pushj_relocs; + + /* Size of stubs after a mmix_elf_relax_section round. */ + bfd_size_type stubs_size_sum; + + /* Per-reloc stubs_size_sum information. The stubs_size_sum member is the sum + of these. Allocated in mmix_elf_check_common_relocs. */ + bfd_size_type *stub_size; + + /* Offset of next stub during relocation. Somewhat redundant with the + above: error coverage is easier and we don't have to reset the + stubs_size_sum for relocation. */ + bfd_size_type stub_offset; + } pjs; }; #define mmix_elf_section_data(sec) \ @@ -119,9 +142,9 @@ struct bpo_greg_section_info size_t n_remaining_bpo_relocs_this_relaxation_round; /* The number of linker-allocated GREGs resulting from BPO relocs. - This is an approximation after _bfd_mmix_allocated_gregs_init and - supposedly accurate after mmix_elf_relax_section is called for all - incoming non-collected sections. */ + This is an approximation after _bfd_mmix_before_linker_allocation + and supposedly accurate after mmix_elf_relax_section is called for + all incoming non-collected sections. */ size_t n_allocated_bpo_gregs; /* Index into reloc_request[], sorted on increasing "value", secondary @@ -202,6 +225,15 @@ extern void mmix_elf_symbol_processing PARAMS ((bfd *, asymbol *)); extern void mmix_dump_bpo_gregs PARAMS ((struct bfd_link_info *, bfd_error_handler_type)); +static void +mmix_set_relaxable_size + PARAMS ((bfd *, asection *, void *)); + +static bfd_boolean +mmix_elf_get_section_contents + PARAMS ((bfd *, sec_ptr, void *, file_ptr, bfd_size_type)); + + /* Watch out: this currently needs to have elements with the same index as their R_MMIX_ number. */ static reloc_howto_type elf_mmix_howto_table[] = @@ -538,7 +570,8 @@ static reloc_howto_type elf_mmix_howto_table[] = /* The PUSHJ instruction can reach any (code) address, as long as it's the beginning of a function (no usable restriction). It can silently expand to a 64-bit operand, but will emit an error if any of the two - least significant bits are set. The howto members reflect a simple + least significant bits are set. It can also expand into a call to a + stub; see R_MMIX_PUSHJ_STUBBABLE. The howto members reflect a simple PUSHJ. */ HOWTO (R_MMIX_PUSHJ, /* type */ 2, /* rightshift */ @@ -754,6 +787,20 @@ static reloc_howto_type elf_mmix_howto_table[] = 0, /* src_mask */ 0, /* dst_mask */ FALSE), /* pcrel_offset */ + + HOWTO (R_MMIX_PUSHJ_STUBBABLE, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 19, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + mmix_elf_reloc, /* special_function */ + "R_MMIX_PUSHJ_STUBBABLE", /* name */ + FALSE, /* partial_inplace */ + ~0x0100ffff, /* src_mask */ + 0x0100ffff, /* dst_mask */ + TRUE) /* pcrel_offset */ }; @@ -790,7 +837,8 @@ static const struct mmix_reloc_map mmix_reloc_map[] = {BFD_RELOC_MMIX_REG_OR_BYTE, R_MMIX_REG_OR_BYTE}, {BFD_RELOC_MMIX_REG, R_MMIX_REG}, {BFD_RELOC_MMIX_BASE_PLUS_OFFSET, R_MMIX_BASE_PLUS_OFFSET}, - {BFD_RELOC_MMIX_LOCAL, R_MMIX_LOCAL} + {BFD_RELOC_MMIX_LOCAL, R_MMIX_LOCAL}, + {BFD_RELOC_MMIX_PUSHJ_STUBBABLE, R_MMIX_PUSHJ_STUBBABLE} }; static reloc_howto_type * @@ -880,7 +928,7 @@ mmix_elf_perform_relocation (isec, howto, datap, addr, value) asection *isec; reloc_howto_type *howto; PTR datap; - bfd_vma addr ATTRIBUTE_UNUSED; + bfd_vma addr; bfd_vma value; { bfd *abfd = isec->owner; @@ -931,6 +979,96 @@ mmix_elf_perform_relocation (isec, howto, datap, addr, value) } break; + case R_MMIX_PUSHJ_STUBBABLE: + /* If the address fits, we're fine. */ + if ((value & 3) == 0 + /* Note rightshift 0; see R_MMIX_JMP case below. */ + && (r = bfd_check_overflow (complain_overflow_signed, + howto->bitsize, + 0, + bfd_arch_bits_per_address (abfd), + value)) == bfd_reloc_ok) + goto pcrel_mmix_reloc_fits; + else + { + bfd_size_type raw_size + = (isec->_raw_size + - mmix_elf_section_data (isec)->pjs.n_pushj_relocs + * MAX_PUSHJ_STUB_SIZE); + + /* We have the bytes at the PUSHJ insn and need to get the + position for the stub. There's supposed to be room allocated + for the stub. */ + bfd_byte *stubcontents + = ((char *) datap + - (addr - (isec->output_section->vma + isec->output_offset)) + + raw_size + + mmix_elf_section_data (isec)->pjs.stub_offset); + bfd_vma stubaddr; + + /* The address doesn't fit, so redirect the PUSHJ to the + location of the stub. */ + r = mmix_elf_perform_relocation (isec, + &elf_mmix_howto_table + [R_MMIX_ADDR19], + datap, + addr, + isec->output_section->vma + + isec->output_offset + + raw_size + + (mmix_elf_section_data (isec) + ->pjs.stub_offset) + - addr); + if (r != bfd_reloc_ok) + return r; + + stubaddr + = (isec->output_section->vma + + isec->output_offset + + raw_size + + mmix_elf_section_data (isec)->pjs.stub_offset); + + /* We generate a simple JMP if that suffices, else the whole 5 + insn stub. */ + if (bfd_check_overflow (complain_overflow_signed, + elf_mmix_howto_table[R_MMIX_ADDR27].bitsize, + 0, + bfd_arch_bits_per_address (abfd), + addr + value - stubaddr) == bfd_reloc_ok) + { + bfd_put_32 (abfd, JMP_INSN_BYTE << 24, stubcontents); + r = mmix_elf_perform_relocation (isec, + &elf_mmix_howto_table + [R_MMIX_ADDR27], + stubcontents, + stubaddr, + value + addr - stubaddr); + mmix_elf_section_data (isec)->pjs.stub_offset += 4; + + if (raw_size + + mmix_elf_section_data (isec)->pjs.stub_offset + > isec->_cooked_size) + abort (); + + return r; + } + else + { + /* Put a "GO $255,0" after the common sequence. */ + bfd_put_32 (abfd, + ((GO_INSN_BYTE | IMM_OFFSET_BIT) << 24) + | 0xff00, (bfd_byte *) stubcontents + 16); + + /* Prepare for the general code to set the first part of the + linker stub, and */ + value += addr; + datap = stubcontents; + mmix_elf_section_data (isec)->pjs.stub_offset + += MAX_PUSHJ_STUB_SIZE; + } + } + break; + case R_MMIX_PUSHJ: { int inreg = bfd_get_8 (abfd, (bfd_byte *) datap + 1); @@ -978,6 +1116,7 @@ mmix_elf_perform_relocation (isec, howto, datap, addr, value) /* FALLTHROUGH. */ case R_MMIX_ADDR19: case R_MMIX_ADDR27: + pcrel_mmix_reloc_fits: /* These must be in range, or else we emit an error. */ if ((value & 3) == 0 /* Note rightshift 0; see above. */ @@ -993,7 +1132,7 @@ mmix_elf_perform_relocation (isec, howto, datap, addr, value) if ((bfd_signed_vma) value < 0) { - highbit = (1 << 24); + highbit = 1 << 24; value += (1 << (howto->bitsize - 1)); } else @@ -1203,6 +1342,11 @@ mmix_elf_relocate_section (output_bfd, info, input_bfd, input_section, struct elf_link_hash_entry **sym_hashes; Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; + bfd_size_type raw_size + = (input_section->_raw_size + - mmix_elf_section_data (input_section)->pjs.n_pushj_relocs + * MAX_PUSHJ_STUB_SIZE); + size_t pjsno = 0; symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); @@ -1231,10 +1375,10 @@ mmix_elf_relocate_section (output_bfd, info, input_bfd, input_section, if (info->relocatable) { - /* This is a relocatable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ + /* This is a relocatable link. For most relocs we don't have to + change anything, unless the reloc is against a section + symbol, in which case we have to adjust according to where + the section symbol winds up in the output section. */ if (r_symndx < symtab_hdr->sh_info) { sym = local_syms + r_symndx; @@ -1246,6 +1390,75 @@ mmix_elf_relocate_section (output_bfd, info, input_bfd, input_section, } } + /* For PUSHJ stub relocs however, we may need to change the + reloc and the section contents, if the reloc doesn't reach + beyond the end of the output section and previous stubs. + Then we change the section contents to be a PUSHJ to the end + of the input section plus stubs (we can do that without using + a reloc), and then we change the reloc to be a R_MMIX_PUSHJ + at the stub location. */ + if (r_type == R_MMIX_PUSHJ_STUBBABLE) + { + /* We've already checked whether we need a stub; use that + knowledge. */ + if (mmix_elf_section_data (input_section)->pjs.stub_size[pjsno] + != 0) + { + Elf_Internal_Rela relcpy; + + if (mmix_elf_section_data (input_section) + ->pjs.stub_size[pjsno] != MAX_PUSHJ_STUB_SIZE) + abort (); + + /* There's already a PUSHJ insn there, so just fill in + the offset bits to the stub. */ + if (mmix_final_link_relocate (elf_mmix_howto_table + + R_MMIX_ADDR19, + input_section, + contents, + rel->r_offset, + 0, + input_section + ->output_section->vma + + input_section->output_offset + + raw_size + + mmix_elf_section_data (input_section) + ->pjs.stub_offset, + NULL, NULL) != bfd_reloc_ok) + return FALSE; + + /* Put a JMP insn at the stub; it goes with the + R_MMIX_JMP reloc. */ + bfd_put_32 (output_bfd, JMP_INSN_BYTE << 24, + contents + + raw_size + + mmix_elf_section_data (input_section) + ->pjs.stub_offset); + + /* Change the reloc to be at the stub, and to a full + R_MMIX_JMP reloc. */ + rel->r_info = ELF64_R_INFO (r_symndx, R_MMIX_JMP); + rel->r_offset + = (raw_size + + mmix_elf_section_data (input_section) + ->pjs.stub_offset); + + mmix_elf_section_data (input_section)->pjs.stub_offset + += MAX_PUSHJ_STUB_SIZE; + + /* Shift this reloc to the end of the relocs to maintain + the r_offset sorted reloc order. */ + relcpy = *rel; + memmove (rel, rel + 1, (char *) relend - (char *) rel); + relend[-1] = relcpy; + + /* Back up one reloc, or else we'd skip the next reloc + in turn. */ + rel--; + } + + pjsno++; + } continue; } @@ -1259,7 +1472,7 @@ mmix_elf_relocate_section (output_bfd, info, input_bfd, input_section, { sym = local_syms + r_symndx; sec = local_sections [r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); @@ -1383,6 +1596,7 @@ mmix_final_link_relocate (howto, input_section, contents, switch (howto->type) { /* All these are PC-relative. */ + case R_MMIX_PUSHJ_STUBBABLE: case R_MMIX_PUSHJ: case R_MMIX_CBRANCH: case R_MMIX_ADDR19: @@ -1669,9 +1883,6 @@ mmix_elf_check_common_relocs (abfd, info, sec, relocs) const Elf_Internal_Rela *rel; const Elf_Internal_Rela *rel_end; - if (info->relocatable) - return TRUE; - /* We currently have to abuse this COFF-specific member, since there's no target-machine-dedicated member. There's no alternative outside the bfd_link_info struct; we can't specialize a hash-table since @@ -1689,6 +1900,10 @@ mmix_elf_check_common_relocs (abfd, info, sec, relocs) the ELF dynobj for this, since the ELF bits assume lots of DSO-related stuff if that member is non-NULL. */ case R_MMIX_BASE_PLUS_OFFSET: + /* We don't do anything with this reloc for a relocatable link. */ + if (info->relocatable) + break; + if (bpo_greg_owner == NULL) { bpo_greg_owner = abfd; @@ -1756,13 +1971,34 @@ mmix_elf_check_common_relocs (abfd, info, sec, relocs) gregdata->n_max_bpo_relocs++; /* We don't get another chance to set this before GC; we've not - set up set up any hook that runs before GC. */ + set up any hook that runs before GC. */ gregdata->n_bpo_relocs = gregdata->n_max_bpo_relocs; break; + + case R_MMIX_PUSHJ_STUBBABLE: + mmix_elf_section_data (sec)->pjs.n_pushj_relocs++; + break; } } + /* Allocate per-reloc stub storage and initialize it to the max stub + size. */ + if (mmix_elf_section_data (sec)->pjs.n_pushj_relocs != 0) + { + size_t i; + + mmix_elf_section_data (sec)->pjs.stub_size + = bfd_alloc (abfd, mmix_elf_section_data (sec)->pjs.n_pushj_relocs + * sizeof (mmix_elf_section_data (sec) + ->pjs.stub_size[0])); + if (mmix_elf_section_data (sec)->pjs.stub_size == NULL) + return FALSE; + + for (i = 0; i < mmix_elf_section_data (sec)->pjs.n_pushj_relocs; i++) + mmix_elf_section_data (sec)->pjs.stub_size[i] = MAX_PUSHJ_STUB_SIZE; + } + return TRUE; } @@ -1780,9 +2016,6 @@ mmix_elf_check_relocs (abfd, info, sec, relocs) const Elf_Internal_Rela *rel; const Elf_Internal_Rela *rel_end; - if (info->relocatable) - return TRUE; - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; sym_hashes = elf_sym_hashes (abfd); sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof(Elf64_External_Sym); @@ -1798,6 +2031,9 @@ mmix_elf_check_relocs (abfd, info, sec, relocs) if (!mmix_elf_check_common_relocs (abfd, info, sec, relocs)) return FALSE; + if (info->relocatable) + return TRUE; + rel_end = relocs + sec->reloc_count; for (rel = relocs; rel < rel_end; rel++) { @@ -1904,8 +2140,7 @@ static asection mmix_elf_reg_section; static asymbol mmix_elf_reg_section_symbol; static asymbol *mmix_elf_reg_section_symbol_ptr; -/* Handle the special MIPS section numbers that a symbol may use. - This is used for both the 32-bit and the 64-bit ABI. */ +/* Handle the special section numbers that a symbol may use. */ void mmix_elf_symbol_processing (abfd, asym) @@ -2082,11 +2317,49 @@ mmix_elf_final_link (abfd, info) return TRUE; } +/* We need to include the maximum size of PUSHJ-stubs in the initial + section size. This is expected to shrink during linker relaxation. + + You might think that we should set *only* _cooked_size, but that won't + work: section contents allocation will be using _raw_size in mixed + format linking and not enough storage will be allocated. FIXME: That's + a major bug, including the name bfd_get_section_size_before_reloc; it + should be bfd_get_section_size_before_relax. The relaxation functions + set _cooked size. Relaxation happens before relocation. All functions + *after relaxation* should be using _cooked size. */ + +static void +mmix_set_relaxable_size (abfd, sec, ptr) + bfd *abfd ATTRIBUTE_UNUSED; + asection *sec; + void *ptr; +{ + struct bfd_link_info *info = ptr; + + /* Make sure we only do this for section where we know we want this, + otherwise we might end up resetting the size of COMMONs. */ + if (mmix_elf_section_data (sec)->pjs.n_pushj_relocs == 0) + return; + + sec->_cooked_size + = (sec->_raw_size + + mmix_elf_section_data (sec)->pjs.n_pushj_relocs + * MAX_PUSHJ_STUB_SIZE); + sec->_raw_size = sec->_cooked_size; + + /* For use in relocatable link, we start with a max stubs size. See + mmix_elf_relax_section. */ + if (info->relocatable && sec->output_section) + mmix_elf_section_data (sec->output_section)->pjs.stubs_size_sum + += (mmix_elf_section_data (sec)->pjs.n_pushj_relocs + * MAX_PUSHJ_STUB_SIZE); +} + /* Initialize stuff for the linker-generated GREGs to match R_MMIX_BASE_PLUS_OFFSET relocs seen by the linker. */ bfd_boolean -_bfd_mmix_prepare_linker_allocated_gregs (abfd, info) +_bfd_mmix_before_linker_allocation (abfd, info) bfd *abfd ATTRIBUTE_UNUSED; struct bfd_link_info *info; { @@ -2097,6 +2370,11 @@ _bfd_mmix_prepare_linker_allocated_gregs (abfd, info) bfd_vma gregs_size; size_t i; size_t *bpo_reloc_indexes; + bfd *ibfd; + + /* Set the initial size of sections. */ + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) + bfd_map_over_sections (ibfd, mmix_set_relaxable_size, info); /* The bpo_greg_owner bfd is supposed to have been set by mmix_elf_check_relocs when the first R_MMIX_BASE_PLUS_OFFSET is seen. @@ -2160,7 +2438,7 @@ _bfd_mmix_prepare_linker_allocated_gregs (abfd, info) calculated at this point; we just move the contents into place here. */ bfd_boolean -_bfd_mmix_finalize_linker_allocated_gregs (abfd, link_info) +_bfd_mmix_after_linker_allocation (abfd, link_info) bfd *abfd ATTRIBUTE_UNUSED; struct bfd_link_info *link_info; { @@ -2324,6 +2602,8 @@ mmix_dump_bpo_gregs (link_info, pf) from the first allocated register number) and offsets for use in real relocation. + PUSHJ stub accounting is also done here. + Symbol- and reloc-reading infrastructure copied from elf-m10200.c. */ static bfd_boolean @@ -2340,37 +2620,51 @@ mmix_elf_relax_section (abfd, sec, link_info, again) struct bpo_greg_section_info *gregdata; struct bpo_reloc_section_info *bpodata = mmix_elf_section_data (sec)->bpo.reloc; - size_t bpono; + /* The initialization is to quiet compiler warnings. The value is to + spot a missing actual initialization. */ + size_t bpono = (size_t) -1; + size_t pjsno = 0; bfd *bpo_greg_owner; Elf_Internal_Sym *isymbuf = NULL; + bfd_size_type raw_size + = (sec->_raw_size + - mmix_elf_section_data (sec)->pjs.n_pushj_relocs + * MAX_PUSHJ_STUB_SIZE); + + mmix_elf_section_data (sec)->pjs.stubs_size_sum = 0; /* Assume nothing changes. */ *again = FALSE; /* If this is the first time we have been called for this section, initialize the cooked size. */ - if (sec->_cooked_size == 0) - sec->_cooked_size = sec->_raw_size; - - /* We don't have to do anything for a relocatable link, if - this section does not have relocs, or if this is not a - code section. */ - if (link_info->relocatable - || (sec->flags & SEC_RELOC) == 0 + if (sec->_cooked_size == 0 && sec->_raw_size != 0) + abort (); + + /* We don't have to do anything if this section does not have relocs, or + if this is not a code section. */ + if ((sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0 || (sec->flags & SEC_CODE) == 0 || (sec->flags & SEC_LINKER_CREATED) != 0 - /* If no R_MMIX_BASE_PLUS_OFFSET relocs, then nothing to do. */ - || bpodata == NULL) + /* If no R_MMIX_BASE_PLUS_OFFSET relocs and no PUSHJ-stub relocs, + then nothing to do. */ + || (bpodata == NULL + && mmix_elf_section_data (sec)->pjs.n_pushj_relocs == 0)) return TRUE; symtab_hdr = &elf_tdata (abfd)->symtab_hdr; bpo_greg_owner = (bfd *) link_info->base_file; - bpo_gregs_section = bpodata->bpo_greg_section; - gregdata = mmix_elf_section_data (bpo_gregs_section)->bpo.greg; - bpono = bpodata->first_base_plus_offset_reloc; + if (bpodata != NULL) + { + bpo_gregs_section = bpodata->bpo_greg_section; + gregdata = mmix_elf_section_data (bpo_gregs_section)->bpo.greg; + bpono = bpodata->first_base_plus_offset_reloc; + } + else + gregdata = NULL; /* Get a copy of the native relocations. */ internal_relocs @@ -2385,10 +2679,61 @@ mmix_elf_relax_section (abfd, sec, link_info, again) for (irel = internal_relocs; irel < irelend; irel++) { bfd_vma symval; + struct elf_link_hash_entry *h = NULL; - if (ELF64_R_TYPE (irel->r_info) != (int) R_MMIX_BASE_PLUS_OFFSET) + /* We only process two relocs. */ + if (ELF64_R_TYPE (irel->r_info) != (int) R_MMIX_BASE_PLUS_OFFSET + && ELF64_R_TYPE (irel->r_info) != (int) R_MMIX_PUSHJ_STUBBABLE) continue; + /* We process relocs in a distinctly different way when this is a + relocatable link (for one, we don't look at symbols), so we avoid + mixing its code with that for the "normal" relaxation. */ + if (link_info->relocatable) + { + /* The only transformation in a relocatable link is to generate + a full stub at the location of the stub calculated for the + input section, if the relocated stub location, the end of the + output section plus earlier stubs, cannot be reached. Thus + relocatable linking can only lead to worse code, but it still + works. */ + if (ELF64_R_TYPE (irel->r_info) == R_MMIX_PUSHJ_STUBBABLE) + { + /* If we can reach the end of the output-section and beyond + any current stubs, then we don't need a stub for this + reloc. The relaxed order of output stub allocation may + not exactly match the straightforward order, so we always + assume presence of output stubs, which will allow + relaxation only on relocations indifferent to the + presence of output stub allocations for other relocations + and thus the order of output stub allocation. */ + if (bfd_check_overflow (complain_overflow_signed, + 19, + 0, + bfd_arch_bits_per_address (abfd), + /* Output-stub location. */ + sec->output_section->_cooked_size + + (mmix_elf_section_data (sec + ->output_section) + ->pjs.stubs_size_sum) + /* Location of this PUSHJ reloc. */ + - (sec->output_offset + irel->r_offset) + /* Don't count *this* stub twice. */ + - (mmix_elf_section_data (sec) + ->pjs.stub_size[pjsno] + + MAX_PUSHJ_STUB_SIZE)) + == bfd_reloc_ok) + mmix_elf_section_data (sec)->pjs.stub_size[pjsno] = 0; + + mmix_elf_section_data (sec)->pjs.stubs_size_sum + += mmix_elf_section_data (sec)->pjs.stub_size[pjsno]; + + pjsno++; + } + + continue; + } + /* Get the value of the symbol referred to by the reloc. */ if (ELF64_R_SYM (irel->r_info) < symtab_hdr->sh_info) { @@ -2424,7 +2769,6 @@ mmix_elf_relax_section (abfd, sec, link_info, again) else { unsigned long indx; - struct elf_link_hash_entry *h; /* An external symbol. */ indx = ELF64_R_SYM (irel->r_info) - symtab_hdr->sh_info; @@ -2433,12 +2777,16 @@ mmix_elf_relax_section (abfd, sec, link_info, again) if (h->root.type != bfd_link_hash_defined && h->root.type != bfd_link_hash_defweak) { - /* This appears to be a reference to an undefined symbol. - Just ignore it--it will be caught by the regular reloc - processing. We need to keep BPO reloc accounting - consistent, though. */ - gregdata->n_remaining_bpo_relocs_this_relaxation_round--; - bpono++; + /* This appears to be a reference to an undefined symbol. Just + ignore it--it will be caught by the regular reloc processing. + We need to keep BPO reloc accounting consistent, though + else we'll abort instead of emitting an error message. */ + if (ELF64_R_TYPE (irel->r_info) == R_MMIX_BASE_PLUS_OFFSET + && gregdata != NULL) + { + gregdata->n_remaining_bpo_relocs_this_relaxation_round--; + bpono++; + } continue; } @@ -2447,6 +2795,62 @@ mmix_elf_relax_section (abfd, sec, link_info, again) + h->root.u.def.section->output_offset); } + if (ELF64_R_TYPE (irel->r_info) == (int) R_MMIX_PUSHJ_STUBBABLE) + { + bfd_vma value = symval + irel->r_addend; + bfd_vma dot + = (sec->output_section->vma + + sec->output_offset + + irel->r_offset); + bfd_vma stubaddr + = (sec->output_section->vma + + sec->output_offset + + raw_size + + mmix_elf_section_data (sec)->pjs.stubs_size_sum); + + if ((value & 3) == 0 + && bfd_check_overflow (complain_overflow_signed, + 19, + 0, + bfd_arch_bits_per_address (abfd), + value - dot + - (value > dot + ? mmix_elf_section_data (sec) + ->pjs.stub_size[pjsno] + : 0)) + == bfd_reloc_ok) + /* If the reloc fits, no stub is needed. */ + mmix_elf_section_data (sec)->pjs.stub_size[pjsno] = 0; + else + /* Maybe we can get away with just a JMP insn? */ + if ((value & 3) == 0 + && bfd_check_overflow (complain_overflow_signed, + 27, + 0, + bfd_arch_bits_per_address (abfd), + value - stubaddr + - (value > dot + ? mmix_elf_section_data (sec) + ->pjs.stub_size[pjsno] - 4 + : 0)) + == bfd_reloc_ok) + /* Yep, account for a stub consisting of a single JMP insn. */ + mmix_elf_section_data (sec)->pjs.stub_size[pjsno] = 4; + else + /* Nope, go for the full insn stub. It doesn't seem useful to + emit the intermediate sizes; those will only be useful for + a >64M program assuming contiguous code. */ + mmix_elf_section_data (sec)->pjs.stub_size[pjsno] + = MAX_PUSHJ_STUB_SIZE; + + mmix_elf_section_data (sec)->pjs.stubs_size_sum + += mmix_elf_section_data (sec)->pjs.stub_size[pjsno]; + pjsno++; + continue; + } + + /* We're looking at a R_MMIX_BASE_PLUS_OFFSET reloc. */ + gregdata->reloc_request[gregdata->bpo_reloc_indexes[bpono]].value = symval + irel->r_addend; gregdata->reloc_request[gregdata->bpo_reloc_indexes[bpono++]].valid = TRUE; @@ -2457,7 +2861,8 @@ mmix_elf_relax_section (abfd, sec, link_info, again) calculate how many registers we need to cover them. Set the size of the linker gregs, and if the number of registers changed, indicate that we need to relax some more because we have more work to do. */ - if (gregdata->n_remaining_bpo_relocs_this_relaxation_round == 0) + if (gregdata != NULL + && gregdata->n_remaining_bpo_relocs_this_relaxation_round == 0) { size_t i; bfd_vma prev_base; @@ -2529,6 +2934,18 @@ mmix_elf_relax_section (abfd, sec, link_info, again) && elf_section_data (sec)->relocs != internal_relocs) free (internal_relocs); + if (sec->_cooked_size + < raw_size + mmix_elf_section_data (sec)->pjs.stubs_size_sum) + abort (); + + if (sec->_cooked_size + > raw_size + mmix_elf_section_data (sec)->pjs.stubs_size_sum) + { + sec->_cooked_size + = raw_size + mmix_elf_section_data (sec)->pjs.stubs_size_sum; + *again = TRUE; + } + return TRUE; error_return: @@ -2539,6 +2956,53 @@ mmix_elf_relax_section (abfd, sec, link_info, again) free (internal_relocs); return FALSE; } + +/* Because we set _raw_size to include the max size of pushj stubs, + i.e. larger than the actual section input size (see + mmix_set_relaxable_raw_size), we have to take care of that when reading + the section. */ + +static bfd_boolean +mmix_elf_get_section_contents (abfd, section, location, offset, count) + bfd *abfd; + sec_ptr section; + void *location; + file_ptr offset; + bfd_size_type count; +{ + bfd_size_type raw_size + = (section->_raw_size + - mmix_elf_section_data (section)->pjs.n_pushj_relocs + * MAX_PUSHJ_STUB_SIZE); + + if (offset + count > section->_raw_size) + { + abort(); + bfd_set_error (bfd_error_invalid_operation); + return FALSE; + } + + /* Check bounds against the faked raw_size. */ + if (offset + count > raw_size) + { + /* Clear the part in the faked area. */ + memset (location + raw_size - offset, 0, count - (raw_size - offset)); + + /* If there's no initial part within the "real" contents, we're + done. */ + if ((bfd_size_type) offset >= raw_size) + return TRUE; + + /* Else adjust the count and fall through to call the generic + function. */ + count = raw_size - offset; + } + + return + _bfd_generic_get_section_contents (abfd, section, location, offset, + count); +} + #define ELF_ARCH bfd_arch_mmix #define ELF_MACHINE_CODE EM_MMIX @@ -2587,5 +3051,6 @@ mmix_elf_relax_section (abfd, sec, link_info, again) #define bfd_elf64_new_section_hook mmix_elf_new_section_hook #define bfd_elf64_bfd_final_link mmix_elf_final_link #define bfd_elf64_bfd_relax_section mmix_elf_relax_section +#define bfd_elf64_get_section_contents mmix_elf_get_section_contents #include "elf64-target.h" diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 2042e6a..8ae3f12 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -2,6 +2,7 @@ Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Linus Nordberg, Swox AB <info@swox.com>, based on elf32-ppc.c by Ian Lance Taylor. + Largely rewritten by Alan Modra <amodra@bigpond.net.au> This file is part of BFD, the Binary File Descriptor library. @@ -64,7 +65,6 @@ static bfd_reloc_status_type ppc64_elf_unhandled_reloc #define elf_backend_plt_not_loaded 1 #define elf_backend_got_symbol_offset 0 #define elf_backend_got_header_size 8 -#define elf_backend_plt_header_size PLT_INITIAL_ENTRY_SIZE #define elf_backend_can_gc_sections 1 #define elf_backend_can_refcount 1 #define elf_backend_rela_normal 1 @@ -77,6 +77,8 @@ static bfd_reloc_status_type ppc64_elf_unhandled_reloc #define bfd_elf64_bfd_link_hash_table_free ppc64_elf_link_hash_table_free #define elf_backend_object_p ppc64_elf_object_p +#define elf_backend_grok_prstatus ppc64_elf_grok_prstatus +#define elf_backend_grok_psinfo ppc64_elf_grok_psinfo #define elf_backend_create_dynamic_sections ppc64_elf_create_dynamic_sections #define elf_backend_copy_indirect_symbol ppc64_elf_copy_indirect_symbol #define elf_backend_check_relocs ppc64_elf_check_relocs @@ -2372,6 +2374,45 @@ ppc64_elf_object_p (bfd *abfd) return TRUE; } +/* Support for core dump NOTE sections. */ + +static bfd_boolean +ppc64_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) +{ + size_t offset, raw_size; + + if (note->descsz != 504) + return FALSE; + + /* pr_cursig */ + elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); + + /* pr_pid */ + elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 32); + + /* pr_reg */ + offset = 112; + raw_size = 384; + + /* Make a ".reg/999" section. */ + return _bfd_elfcore_make_pseudosection (abfd, ".reg", + raw_size, note->descpos + offset); +} + +static bfd_boolean +ppc64_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) +{ + if (note->descsz != 136) + return FALSE; + + elf_tdata (abfd)->core_program + = _bfd_elfcore_strndup (abfd, note->descdata + 40, 16); + elf_tdata (abfd)->core_command + = _bfd_elfcore_strndup (abfd, note->descdata + 56, 80); + + return TRUE; +} + /* Merge backend specific data from an object file to the output object file when linking. */ @@ -2405,20 +2446,13 @@ ppc64_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) static struct bfd_elf_special_section const ppc64_elf_special_sections[]= { - { ".sdata", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".sbss", 0, NULL, 0, - SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, - { ".plt", 0, NULL, 0, - SHT_NOBITS, 0 }, - { ".toc", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".toc1", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".tocbss", 0, NULL, 0, - SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, - { NULL, 0, NULL, 0, - 0, 0 } + { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, + { ".plt", 4, 0, SHT_NOBITS, 0 }, + { ".toc", 4, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".toc1", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".tocbss", 7, 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, + { NULL, 0, 0, 0, 0 } }; struct _ppc64_elf_section_data @@ -2803,9 +2837,6 @@ struct ppc_link_hash_table asection *brlt; asection *relbrlt; - /* Short-cut to first output tls section. */ - asection *tls_sec; - /* Shortcut to .__tls_get_addr. */ struct elf_link_hash_entry *tls_get_addr; @@ -4798,11 +4829,12 @@ get_sym_h (struct elf_link_hash_entry **hp, Elf_Internal_Sym **symp, type suitable for optimization, and 1 otherwise. */ static int -get_tls_mask (char **tls_maskp, Elf_Internal_Sym **locsymsp, +get_tls_mask (char **tls_maskp, unsigned long *toc_symndx, + Elf_Internal_Sym **locsymsp, const Elf_Internal_Rela *rel, bfd *ibfd) { unsigned long r_symndx; - unsigned int next_r; + int next_r; struct elf_link_hash_entry *h; Elf_Internal_Sym *sym; asection *sec; @@ -4831,17 +4863,14 @@ get_tls_mask (char **tls_maskp, Elf_Internal_Sym **locsymsp, next_r = ppc64_elf_section_data (sec)->t_symndx[off / 8 + 1]; if (!get_sym_h (&h, &sym, &sec, tls_maskp, locsymsp, r_symndx, ibfd)) return 0; - if (h == NULL - || h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - if (next_r == (unsigned) -1) - return 2; - if (next_r == (unsigned) -2 - && (h == NULL - || !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC))) - return 3; - } + if (toc_symndx != NULL) + *toc_symndx = r_symndx; + if ((h == NULL + || ((h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + && !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC))) + && (next_r == -1 || next_r == -2)) + return 1 - next_r; return 1; } @@ -5021,7 +5050,7 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info) r_symndx = ELF64_R_SYM (rel->r_info); if (!get_sym_h (&h, &sym, &sym_sec, NULL, &local_syms, - r_symndx, ibfd)) + r_symndx, ibfd)) goto error_ret; if (rel->r_offset == offset) @@ -5097,7 +5126,7 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info) { p->count -= 1; if (p->count == 0) - *pp = p->next; + *pp = p->next; break; } pp = &p->next; @@ -5140,22 +5169,14 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info) return TRUE; } -/* Set htab->tls_sec. */ +/* Set htab->tls_get_addr and call the generic ELF tls_setup function. */ -bfd_boolean +asection * ppc64_elf_tls_setup (bfd *obfd, struct bfd_link_info *info) { - asection *tls; struct ppc_link_hash_table *htab; - for (tls = obfd->sections; tls != NULL; tls = tls->next) - if ((tls->flags & (SEC_THREAD_LOCAL | SEC_LOAD)) - == (SEC_THREAD_LOCAL | SEC_LOAD)) - break; - htab = ppc_hash_table (info); - htab->tls_sec = tls; - if (htab->tls_get_addr != NULL) { struct elf_link_hash_entry *h = htab->tls_get_addr; @@ -5167,7 +5188,7 @@ ppc64_elf_tls_setup (bfd *obfd, struct bfd_link_info *info) htab->tls_get_addr = h; } - return tls != NULL; + return _bfd_elf_tls_setup (obfd, info); } /* Run through all the TLS relocs looking for optimization @@ -5250,7 +5271,7 @@ ppc64_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info) is_local = TRUE; value += sym_sec->output_offset; value += sym_sec->output_section->vma; - value -= htab->tls_sec->vma; + value -= htab->elf.tls_sec->vma; ok_tprel = (value + TP_OFFSET + ((bfd_vma) 1 << 31) < (bfd_vma) 1 << 32); } @@ -5325,7 +5346,7 @@ ppc64_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info) char *toc_tls; int retval; - retval = get_tls_mask (&toc_tls, &locsyms, + retval = get_tls_mask (&toc_tls, NULL, &locsyms, rel - 1, ibfd); if (retval == 0) goto err_free_rel; @@ -6333,13 +6354,16 @@ static bfd_boolean ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) { struct ppc_stub_hash_entry *stub_entry; + struct bfd_link_info *info; struct ppc_link_hash_table *htab; bfd_vma off; int size; /* Massage our args to the form they really have. */ stub_entry = (struct ppc_stub_hash_entry *) gen_entry; - htab = in_arg; + info = in_arg; + + htab = ppc_hash_table (info); if (stub_entry->stub_type == ppc_stub_plt_call) { @@ -6406,6 +6430,9 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) br_entry->iter = htab->stub_iteration; br_entry->offset = htab->brlt->_raw_size; htab->brlt->_raw_size += 8; + + if (info->shared) + htab->relbrlt->_raw_size += sizeof (Elf64_External_Rela); } stub_entry->stub_type += ppc_stub_plt_branch - ppc_stub_long_branch; @@ -6909,7 +6936,7 @@ ppc64_elf_size_stubs (bfd *output_bfd, /* Get tls info. */ char *tls_mask; - if (!get_tls_mask (&tls_mask, &local_syms, + if (!get_tls_mask (&tls_mask, NULL, &local_syms, irela - 1, input_bfd)) goto error_ret_free_internal; if (*tls_mask != 0) @@ -6986,8 +7013,13 @@ ppc64_elf_size_stubs (bfd *output_bfd, } htab->brlt->_raw_size = 0; htab->brlt->_cooked_size = 0; + if (info->shared) + { + htab->relbrlt->_raw_size = 0; + htab->relbrlt->_cooked_size = 0; + } - bfd_hash_traverse (&htab->stub_hash_table, ppc_size_one_stub, htab); + bfd_hash_traverse (&htab->stub_hash_table, ppc_size_one_stub, info); /* Ask the linker to do its stuff. */ (*htab->layout_sections_again) (); @@ -7190,6 +7222,13 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms, if (htab->brlt->contents == NULL) return FALSE; } + if (info->shared && htab->relbrlt->_raw_size != 0) + { + htab->relbrlt->contents = bfd_zalloc (htab->relbrlt->owner, + htab->relbrlt->_raw_size); + if (htab->relbrlt->contents == NULL) + return FALSE; + } /* Build the stubs as directed by the stub hash table. */ bfd_hash_traverse (&htab->stub_hash_table, ppc_build_one_stub, info); @@ -7315,8 +7354,9 @@ ppc64_elf_relocate_section (bfd *output_bfd, struct elf_link_hash_entry *h; struct elf_link_hash_entry *fdh; const char *sym_name; - unsigned long r_symndx; + unsigned long r_symndx, toc_symndx; char tls_mask, tls_gd, tls_type; + char sym_type; bfd_vma relocation; bfd_boolean unresolved_reloc; bfd_boolean warned; @@ -7350,7 +7390,8 @@ ppc64_elf_relocate_section (bfd *output_bfd, sym = local_syms + r_symndx; sec = local_sections[r_symndx]; sym_name = bfd_elf_local_sym_name (input_bfd, sym); - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + sym_type = ELF64_ST_TYPE (sym->st_info); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); if (elf_section_data (sec) != NULL) { long *opd_sym_adjust; @@ -7367,6 +7408,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, unresolved_reloc, info, warned); sym_name = h->root.root.string; + sym_type = h->type; } /* TLS optimizations. Replace instruction sequences and relocs @@ -7375,6 +7417,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, for the final instruction stream. */ tls_mask = 0; tls_gd = 0; + toc_symndx = 0; if (IS_PPC64_TLS_RELOC (r_type)) { if (h != NULL) @@ -7385,6 +7428,42 @@ ppc64_elf_relocate_section (bfd *output_bfd, lgot_masks = (char *) (local_got_ents + symtab_hdr->sh_info); tls_mask = lgot_masks[r_symndx]; } + if (tls_mask == 0 && r_type == R_PPC64_TLS) + { + /* Check for toc tls entries. */ + char *toc_tls; + + if (!get_tls_mask (&toc_tls, &toc_symndx, &local_syms, + rel, input_bfd)) + return FALSE; + + if (toc_tls) + tls_mask = *toc_tls; + } + } + + /* Check that tls relocs are used with tls syms, and non-tls + relocs are used with non-tls syms. */ + if (r_symndx != 0 + && r_type != R_PPC64_NONE + && (h == NULL + || h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + && IS_PPC64_TLS_RELOC (r_type) != (sym_type == STT_TLS)) + { + if (r_type == R_PPC64_TLS && tls_mask != 0) + /* R_PPC64_TLS is OK against a symbol in the TOC. */ + ; + else + (*_bfd_error_handler) + (sym_type == STT_TLS + ? _("%s(%s+0x%lx): %s used with TLS symbol %s") + : _("%s(%s+0x%lx): %s used with non-TLS symbol %s"), + bfd_archive_filename (input_bfd), + input_section->name, + (long) rel->r_offset, + ppc64_elf_howto_table[r_type]->name, + sym_name); } /* Ensure reloc mapping code below stays sane. */ @@ -7399,6 +7478,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, || (R_PPC64_GOT_TLSLD16_HI & 3) != (R_PPC64_GOT_TPREL16_HI & 3) || (R_PPC64_GOT_TLSLD16_HA & 3) != (R_PPC64_GOT_TPREL16_HA & 3)) abort (); + switch (r_type) { default: @@ -7413,7 +7493,8 @@ ppc64_elf_relocate_section (bfd *output_bfd, char *toc_tls; int retval; - retval = get_tls_mask (&toc_tls, &local_syms, rel, input_bfd); + retval = get_tls_mask (&toc_tls, &toc_symndx, &local_syms, + rel, input_bfd); if (retval == 0) return FALSE; @@ -7458,22 +7539,20 @@ ppc64_elf_relocate_section (bfd *output_bfd, insn |= 0x3c0d0000; /* addis 0,13,0 */ bfd_put_32 (output_bfd, insn, contents + rel->r_offset - 2); r_type = R_PPC64_TPREL16_HA; - rel->r_info = ELF64_R_INFO (r_symndx, r_type); + if (toc_symndx != 0) + { + rel->r_info = ELF64_R_INFO (toc_symndx, r_type); + /* We changed the symbol. Start over in order to + get h, sym, sec etc. right. */ + rel--; + continue; + } + else + rel->r_info = ELF64_R_INFO (r_symndx, r_type); } break; case R_PPC64_TLS: - if (tls_mask == 0) - { - /* Check for toc tls entries. */ - char *toc_tls; - - if (!get_tls_mask (&toc_tls, &local_syms, rel, input_bfd)) - return FALSE; - - if (toc_tls) - tls_mask = *toc_tls; - } if (tls_mask != 0 && (tls_mask & TLS_TPREL) == 0) { @@ -7509,11 +7588,20 @@ ppc64_elf_relocate_section (bfd *output_bfd, abort (); insn |= rtra; bfd_put_32 (output_bfd, insn, contents + rel->r_offset); - r_type = R_PPC64_TPREL16_LO; - rel->r_info = ELF64_R_INFO (r_symndx, r_type); /* Was PPC64_TLS which sits on insn boundary, now PPC64_TPREL16_LO which is at insn+2. */ rel->r_offset += 2; + r_type = R_PPC64_TPREL16_LO; + if (toc_symndx != 0) + { + rel->r_info = ELF64_R_INFO (toc_symndx, r_type); + /* We changed the symbol. Start over in order to + get h, sym, sec etc. right. */ + rel--; + continue; + } + else + rel->r_info = ELF64_R_INFO (r_symndx, r_type); } break; @@ -7609,9 +7697,11 @@ ppc64_elf_relocate_section (bfd *output_bfd, { /* Was an LD reloc. */ r_symndx = 0; - rel->r_addend = htab->tls_sec->vma + DTP_OFFSET; - rel[1].r_addend = htab->tls_sec->vma + DTP_OFFSET; + rel->r_addend = htab->elf.tls_sec->vma + DTP_OFFSET; + rel[1].r_addend = htab->elf.tls_sec->vma + DTP_OFFSET; } + else if (toc_symndx != 0) + r_symndx = toc_symndx; r_type = R_PPC64_TPREL16_HA; rel->r_info = ELF64_R_INFO (r_symndx, r_type); rel[1].r_info = ELF64_R_INFO (r_symndx, @@ -7628,10 +7718,10 @@ ppc64_elf_relocate_section (bfd *output_bfd, bfd_put_32 (output_bfd, insn1, contents + rel->r_offset - 2); bfd_put_32 (output_bfd, insn2, contents + offset); bfd_put_32 (output_bfd, insn3, contents + offset + 4); - if (tls_gd == 0) + if (tls_gd == 0 || toc_symndx != 0) { - /* We changed the symbol on an LD reloc. Start over - in order to get h, sym, sec etc. right. */ + /* We changed the symbol. Start over in order + to get h, sym, sec etc. right. */ rel--; continue; } @@ -8013,7 +8103,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, { outrel.r_addend += relocation; if (tls_type & (TLS_GD | TLS_DTPREL | TLS_TPREL)) - outrel.r_addend -= htab->tls_sec->vma; + outrel.r_addend -= htab->elf.tls_sec->vma; } loc = relgot->contents; loc += (relgot->reloc_count++ @@ -8030,7 +8120,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, relocation = 1; else if (tls_type != 0) { - relocation -= htab->tls_sec->vma + DTP_OFFSET; + relocation -= htab->elf.tls_sec->vma + DTP_OFFSET; if (tls_type == (TLS_TLS | TLS_TPREL)) relocation += DTP_OFFSET - TP_OFFSET; @@ -8094,7 +8184,9 @@ ppc64_elf_relocate_section (bfd *output_bfd, relocation = TOCstart; if (r_symndx == 0) relocation += htab->stub_group[input_section->id].toc_off; - else if (sec != NULL && !unresolved_reloc) + else if (unresolved_reloc) + ; + else if (sec != NULL && sec->id <= htab->top_id) relocation += htab->stub_group[sec->id].toc_off; else unresolved_reloc = TRUE; @@ -8140,7 +8232,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, case R_PPC64_TPREL16_HIGHERA: case R_PPC64_TPREL16_HIGHEST: case R_PPC64_TPREL16_HIGHESTA: - addend -= htab->tls_sec->vma + TP_OFFSET; + addend -= htab->elf.tls_sec->vma + TP_OFFSET; if (info->shared) /* The TPREL16 relocs shouldn't really be used in shared libs as they will result in DT_TEXTREL being set, but @@ -8158,7 +8250,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, case R_PPC64_DTPREL16_HIGHERA: case R_PPC64_DTPREL16_HIGHEST: case R_PPC64_DTPREL16_HIGHESTA: - addend -= htab->tls_sec->vma + DTP_OFFSET; + addend -= htab->elf.tls_sec->vma + DTP_OFFSET; break; case R_PPC64_DTPMOD64: @@ -8167,11 +8259,11 @@ ppc64_elf_relocate_section (bfd *output_bfd, goto dodyn; case R_PPC64_TPREL64: - addend -= htab->tls_sec->vma + TP_OFFSET; + addend -= htab->elf.tls_sec->vma + TP_OFFSET; goto dodyn; case R_PPC64_DTPREL64: - addend -= htab->tls_sec->vma + DTP_OFFSET; + addend -= htab->elf.tls_sec->vma + DTP_OFFSET; /* Fall thru */ /* Relocations that may need to be propagated if this is a diff --git a/bfd/elf64-ppc.h b/bfd/elf64-ppc.h index c26df82..998e7e1 100644 --- a/bfd/elf64-ppc.h +++ b/bfd/elf64-ppc.h @@ -23,7 +23,7 @@ bfd_boolean ppc64_elf_mark_entry_syms (struct bfd_link_info *); bfd_boolean ppc64_elf_edit_opd (bfd *, struct bfd_link_info *); -bfd_boolean ppc64_elf_tls_setup +asection *ppc64_elf_tls_setup (bfd *, struct bfd_link_info *); bfd_boolean ppc64_elf_tls_optimize (bfd *, struct bfd_link_info *); diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index de712f7..6e72ced 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -2186,10 +2186,10 @@ static bfd_vma dtpoff_base (info) struct bfd_link_info *info; { - /* If tls_segment is NULL, we should have signalled an error already. */ - if (elf_hash_table (info)->tls_segment == NULL) + /* If tls_sec is NULL, we should have signalled an error already. */ + if (elf_hash_table (info)->tls_sec == NULL) return 0; - return elf_hash_table (info)->tls_segment->start; + return elf_hash_table (info)->tls_sec->vma; } /* Return the relocation value for @tpoff relocation @@ -2200,14 +2200,12 @@ tpoff (info, address) struct bfd_link_info *info; bfd_vma address; { - struct elf_link_tls_segment *tls_segment - = elf_hash_table (info)->tls_segment; + struct elf_link_hash_table *htab = elf_hash_table (info); - /* If tls_segment is NULL, we should have signalled an error already. */ - if (tls_segment == NULL) + /* If tls_sec is NULL, we should have signalled an error already. */ + if (htab->tls_sec == NULL) return 0; - return (align_power (tls_segment->size, tls_segment->align) - + tls_segment->start - address); + return htab->tls_size + htab->tls_sec->vma - address; } /* Complain if TLS instruction relocation is against an invalid @@ -2297,7 +2295,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, { sym = local_syms + r_symndx; sec = local_sections[r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); } else { @@ -3411,7 +3409,6 @@ const struct elf_size_info s390_elf64_size_info = #define elf_backend_plt_readonly 1 #define elf_backend_want_plt_sym 0 #define elf_backend_got_header_size 24 -#define elf_backend_plt_header_size PLT_ENTRY_SIZE #define elf_backend_rela_normal 1 #define elf_info_to_howto elf_s390_info_to_howto diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c index e0bc8df..db096a5 100644 --- a/bfd/elf64-sh64.c +++ b/bfd/elf64-sh64.c @@ -1532,8 +1532,10 @@ sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, || (r_type >= (int) R_SH_FIRST_INVALID_RELOC && r_type <= (int) R_SH_LAST_INVALID_RELOC) || (r_type >= (int) R_SH_DIR8WPN - && r_type <= (int) R_SH_LAST_INVALID_RELOC_2) - || (r_type >= (int) R_SH_FIRST_INVALID_RELOC_3 + && r_type <= (int) R_SH_LAST_INVALID_RELOC) + || (r_type >= (int) R_SH_GNU_VTINHERIT + && r_type <= (int) R_SH_PSHL) + || (r_type >= (int) R_SH_FIRST_INVALID_RELOC_2 && r_type <= R_SH_GOTPLT32) || (r_type >= (int) R_SH_FIRST_INVALID_RELOC_4 && r_type <= (int) R_SH_LAST_INVALID_RELOC_4)) @@ -1580,7 +1582,7 @@ sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, } else if (! howto->partial_inplace) { - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); relocation |= ((sym->st_other & STO_SH5_ISA32) != 0); } else if ((sec->flags & SEC_MERGE) @@ -4116,12 +4118,31 @@ sh64_elf64_finish_dynamic_sections (bfd *output_bfd, return TRUE; } +/* Merge non visibility st_other attribute when the symbol comes from + a dynamic object. */ +static void +sh64_elf64_merge_symbol_attribute (struct elf_link_hash_entry *h, + const Elf_Internal_Sym *isym, + bfd_boolean definition, + bfd_boolean dynamic) +{ + if (isym->st_other != 0 && dynamic) + { + unsigned char other; + + /* Take the balance of OTHER from the definition. */ + other = (definition ? isym->st_other : h->other); + other &= ~ ELF_ST_VISIBILITY (-1); + h->other = other | ELF_ST_VISIBILITY (h->other); + } + + return; +} + static struct bfd_elf_special_section const sh64_elf64_special_sections[]= { - { ".cranges", 0, NULL, 0, - SHT_PROGBITS, 0 }, - { NULL, 0, NULL, 0, - 0, 0 } + { ".cranges", 8, 0, SHT_PROGBITS, 0 }, + { NULL, 0, 0, 0, 0 } }; #define TARGET_BIG_SYM bfd_elf64_sh64_vec @@ -4164,6 +4185,9 @@ static struct bfd_elf_special_section const sh64_elf64_special_sections[]= #define elf_backend_link_output_symbol_hook \ sh64_elf64_link_output_symbol_hook +#define elf_backend_merge_symbol_attribute \ + sh64_elf64_merge_symbol_attribute + #define elf_backend_final_write_processing \ sh64_elf64_final_write_processing @@ -4185,7 +4209,6 @@ static struct bfd_elf_special_section const sh64_elf64_special_sections[]= #define elf_backend_plt_readonly 1 #define elf_backend_want_plt_sym 0 #define elf_backend_got_header_size 24 -#define elf_backend_plt_header_size PLT_ENTRY_SIZE #include "elf64-target.h" diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c index a74a7f3..92609e2 100644 --- a/bfd/elf64-sparc.c +++ b/bfd/elf64-sparc.c @@ -2070,7 +2070,7 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, { sym = local_syms + r_symndx; sec = local_sections[r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); } else { @@ -2247,16 +2247,8 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, if (is_plt) sec = splt; - else if (h == NULL) - sec = local_sections[r_symndx]; - else - { - BFD_ASSERT (h->root.type == bfd_link_hash_defined - || (h->root.type - == bfd_link_hash_defweak)); - sec = h->root.u.def.section; - } - if (sec != NULL && bfd_is_abs_section (sec)) + + if (bfd_is_abs_section (sec)) indx = 0; else if (sec == NULL || sec->owner == NULL) { @@ -3236,6 +3228,5 @@ const struct elf_size_info sparc64_elf_size_info = #define elf_backend_plt_alignment 8 #define elf_backend_got_header_size 8 -#define elf_backend_plt_header_size PLT_HEADER_SIZE #include "elf64-target.h" diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 8aed498..4cfcba5 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -1739,10 +1739,10 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, static bfd_vma dtpoff_base (struct bfd_link_info *info) { - /* If tls_segment is NULL, we should have signalled an error already. */ - if (elf_hash_table (info)->tls_segment == NULL) + /* If tls_sec is NULL, we should have signalled an error already. */ + if (elf_hash_table (info)->tls_sec == NULL) return 0; - return elf_hash_table (info)->tls_segment->start; + return elf_hash_table (info)->tls_sec->vma; } /* Return the relocation value for @tpoff relocation @@ -1751,14 +1751,12 @@ dtpoff_base (struct bfd_link_info *info) static bfd_vma tpoff (struct bfd_link_info *info, bfd_vma address) { - struct elf_link_tls_segment *tls_segment - = elf_hash_table (info)->tls_segment; + struct elf_link_hash_table *htab = elf_hash_table (info); /* If tls_segment is NULL, we should have signalled an error already. */ - if (tls_segment == NULL) + if (htab->tls_sec == NULL) return 0; - return address - align_power (tls_segment->size, tls_segment->align) - - tls_segment->start; + return address - htab->tls_size - htab->tls_sec->vma; } /* Relocate an x86_64 ELF section. */ @@ -1823,7 +1821,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, sym = local_syms + r_symndx; sec = local_sections[r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); } else { @@ -2048,16 +2046,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, { long sindx; - if (h == NULL) - sec = local_sections[r_symndx]; - else - { - BFD_ASSERT (h->root.type == bfd_link_hash_defined - || (h->root.type - == bfd_link_hash_defweak)); - sec = h->root.u.def.section; - } - if (sec != NULL && bfd_is_abs_section (sec)) + if (bfd_is_abs_section (sec)) sindx = 0; else if (sec == NULL || sec->owner == NULL) { @@ -2792,7 +2781,6 @@ elf64_x86_64_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *inf #define elf_backend_plt_readonly 1 #define elf_backend_want_plt_sym 0 #define elf_backend_got_header_size (GOT_ENTRY_SIZE*3) -#define elf_backend_plt_header_size PLT_ENTRY_SIZE #define elf_backend_rela_normal 1 #define elf_info_to_howto elf64_x86_64_info_to_howto diff --git a/bfd/elfcode.h b/bfd/elfcode.h index a627e48..87d96fa 100644 --- a/bfd/elfcode.h +++ b/bfd/elfcode.h @@ -102,7 +102,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define elf_get_reloc_upper_bound NAME(bfd_elf,get_reloc_upper_bound) #define elf_canonicalize_reloc NAME(bfd_elf,canonicalize_reloc) #define elf_slurp_symbol_table NAME(bfd_elf,slurp_symbol_table) -#define elf_get_symtab NAME(bfd_elf,get_symtab) +#define elf_canonicalize_symtab NAME(bfd_elf,canonicalize_symtab) #define elf_canonicalize_dynamic_symtab \ NAME(bfd_elf,canonicalize_dynamic_symtab) #define elf_make_empty_symbol NAME(bfd_elf,make_empty_symbol) diff --git a/bfd/elflink.c b/bfd/elflink.c index d53571d..919de9c 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -353,9 +353,8 @@ _bfd_elf_link_record_dynamic_symbol (struct bfd_link_info *info, if (h->dynindx == -1) { struct elf_strtab_hash *dynstr; - char *p, *alc; + char *p; const char *name; - bfd_boolean copy; bfd_size_type indx; /* XXX: The ABI draft says the linker must turn hidden and @@ -393,28 +392,18 @@ _bfd_elf_link_record_dynamic_symbol (struct bfd_link_info *info, table. */ name = h->root.root.string; p = strchr (name, ELF_VER_CHR); - if (p == NULL) - { - alc = NULL; - copy = FALSE; - } - else - { - size_t len = p - name + 1; + if (p != NULL) + /* We know that the p points into writable memory. In fact, + there are only a few symbols that have read-only names, being + those like _GLOBAL_OFFSET_TABLE_ that are created specially + by the backends. Most symbols will have names pointing into + an ELF string table read from a file, or to objalloc memory. */ + *p = 0; - alc = bfd_malloc (len); - if (alc == NULL) - return FALSE; - memcpy (alc, name, len - 1); - alc[len - 1] = '\0'; - name = alc; - copy = TRUE; - } - - indx = _bfd_elf_strtab_add (dynstr, name, copy); + indx = _bfd_elf_strtab_add (dynstr, name, p != NULL); - if (alc != NULL) - free (alc); + if (p != NULL) + *p = ELF_VER_CHR; if (indx == (bfd_size_type) -1) return FALSE; @@ -962,12 +951,16 @@ _bfd_elf_merge_symbol (bfd *abfd, /* It's OK to change the type if either the existing symbol or the new symbol is weak unless it comes from a DT_NEEDED entry of a shared object, in which case, the DT_NEEDED entry may not be - required at the run time. */ + required at the run time. The type change is also OK if the + old symbol is undefined and the new symbol is defined. */ if ((! dt_needed && oldweakdef) || oldweakundef || newweakdef - || newweakundef) + || newweakundef + || (newdef + && (h->root.type == bfd_link_hash_undefined + || h->root.type == bfd_link_hash_undefweak))) *type_change_ok = TRUE; /* It's OK to change the size if either the existing symbol or the @@ -1501,22 +1494,18 @@ _bfd_elf_export_symbol (struct elf_link_hash_entry *h, void *data) for (t = eif->verdefs; t != NULL; t = t->next) { - if (t->globals != NULL) + if (t->globals.list != NULL) { - for (d = t->globals; d != NULL; d = d->next) - { - if ((*d->match) (d, h->root.root.string)) - goto doit; - } + d = (*t->match) (&t->globals, NULL, h->root.root.string); + if (d != NULL) + goto doit; } - if (t->locals != NULL) + if (t->locals.list != NULL) { - for (d = t->locals ; d != NULL; d = d->next) - { - if ((*d->match) (d, h->root.root.string)) - return TRUE; - } + d = (*t->match) (&t->locals, NULL, h->root.root.string); + if (d != NULL) + return TRUE; } } @@ -1695,31 +1684,19 @@ _bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data) t->used = TRUE; d = NULL; - if (t->globals != NULL) - { - for (d = t->globals; d != NULL; d = d->next) - if ((*d->match) (d, alc)) - break; - } + if (t->globals.list != NULL) + d = (*t->match) (&t->globals, NULL, alc); /* See if there is anything to force this symbol to local scope. */ - if (d == NULL && t->locals != NULL) + if (d == NULL && t->locals.list != NULL) { - for (d = t->locals; d != NULL; d = d->next) - { - if ((*d->match) (d, alc)) - { - if (h->dynindx != -1 - && info->shared - && ! info->export_dynamic) - { - (*bed->elf_backend_hide_symbol) (info, h, TRUE); - } - - break; - } - } + d = (*t->match) (&t->locals, NULL, alc); + if (d != NULL + && h->dynindx != -1 + && info->shared + && ! info->export_dynamic) + (*bed->elf_backend_hide_symbol) (info, h, TRUE); } free (alc); @@ -1740,18 +1717,14 @@ _bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data) return TRUE; amt = sizeof *t; - t = bfd_alloc (sinfo->output_bfd, amt); + t = bfd_zalloc (sinfo->output_bfd, amt); if (t == NULL) { sinfo->failed = TRUE; return FALSE; } - t->next = NULL; t->name = p; - t->globals = NULL; - t->locals = NULL; - t->deps = NULL; t->name_indx = (unsigned int) -1; t->used = TRUE; @@ -1797,30 +1770,26 @@ _bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data) local_ver = NULL; for (t = sinfo->verdefs; t != NULL; t = t->next) { - if (t->globals != NULL) + if (t->globals.list != NULL) { bfd_boolean matched; matched = FALSE; - for (d = t->globals; d != NULL; d = d->next) - { - if ((*d->match) (d, h->root.root.string)) - { - if (d->symver) - matched = TRUE; - else - { - /* There is a version without definition. Make - the symbol the default definition for this - version. */ - h->verinfo.vertree = t; - local_ver = NULL; - d->script = 1; - break; - } - } - } - + d = NULL; + while ((d = (*t->match) (&t->globals, d, + h->root.root.string)) != NULL) + if (d->symver) + matched = TRUE; + else + { + /* There is a version without definition. Make + the symbol the default definition for this + version. */ + h->verinfo.vertree = t; + local_ver = NULL; + d->script = 1; + break; + } if (d != NULL) break; else if (matched) @@ -1829,19 +1798,18 @@ _bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data) (*bed->elf_backend_hide_symbol) (info, h, TRUE); } - if (t->locals != NULL) + if (t->locals.list != NULL) { - for (d = t->locals; d != NULL; d = d->next) + d = NULL; + while ((d = (*t->match) (&t->locals, d, + h->root.root.string)) != NULL) { + local_ver = t; /* If the match is "*", keep looking for a more - explicit, perhaps even global, match. */ - if (d->pattern[0] == '*' && d->pattern[1] == '\0') - local_ver = t; - else if ((*d->match) (d, h->root.root.string)) - { - local_ver = t; - break; - } + explicit, perhaps even global, match. + XXX: Shouldn't this be !d->wildcard instead? */ + if (d->pattern[0] != '*' || d->pattern[1] != '\0') + break; } if (d != NULL) @@ -1875,6 +1843,7 @@ _bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data) static bfd_boolean elf_link_read_relocs_from_section (bfd *abfd, + asection *sec, Elf_Internal_Shdr *shdr, void *external_relocs, Elf_Internal_Rela *internal_relocs) @@ -1884,6 +1853,8 @@ elf_link_read_relocs_from_section (bfd *abfd, const bfd_byte *erela; const bfd_byte *erelaend; Elf_Internal_Rela *irela; + Elf_Internal_Shdr *symtab_hdr; + size_t nsyms; /* If there aren't any relocations, that's OK. */ if (!shdr) @@ -1897,6 +1868,9 @@ elf_link_read_relocs_from_section (bfd *abfd, if (bfd_bread (external_relocs, shdr->sh_size, abfd) != shdr->sh_size) return FALSE; + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + nsyms = symtab_hdr->sh_size / symtab_hdr->sh_entsize; + bed = get_elf_backend_data (abfd); /* Convert the external relocations to the internal format. */ @@ -1915,7 +1889,21 @@ elf_link_read_relocs_from_section (bfd *abfd, irela = internal_relocs; while (erela < erelaend) { + bfd_vma r_symndx; + (*swap_in) (abfd, erela, irela); + r_symndx = ELF32_R_SYM (irela->r_info); + if (bed->s->arch_size == 64) + r_symndx >>= 24; + if ((size_t) r_symndx >= nsyms) + { + (*_bfd_error_handler) + (_("%s: bad reloc symbol index (0x%lx >= 0x%lx) for offset 0x%lx in section `%s'"), + bfd_archive_filename (abfd), (unsigned long) r_symndx, + (unsigned long) nsyms, irela->r_offset, sec->name); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } irela += bed->s->int_rels_per_ext_rel; erela += shdr->sh_entsize; } @@ -1979,12 +1967,12 @@ _bfd_elf_link_read_relocs (bfd *abfd, external_relocs = alloc1; } - if (!elf_link_read_relocs_from_section (abfd, rel_hdr, + if (!elf_link_read_relocs_from_section (abfd, o, rel_hdr, external_relocs, internal_relocs)) goto error_return; if (!elf_link_read_relocs_from_section - (abfd, + (abfd, o, elf_section_data (o)->rel_hdr2, ((bfd_byte *) external_relocs) + rel_hdr->sh_size, internal_relocs + (NUM_SHDR_ENTRIES (rel_hdr) @@ -2531,3 +2519,31 @@ _bfd_elf_symbol_refs_local_p (struct elf_link_hash_entry *h, dynamic linker will resolve them locally. */ return local_protected; } + +/* Caches some TLS segment info, and ensures that the TLS segment vma is + aligned. Returns the first TLS output section. */ + +struct bfd_section * +_bfd_elf_tls_setup (bfd *obfd, struct bfd_link_info *info) +{ + struct bfd_section *sec, *tls; + unsigned int align = 0; + + for (sec = obfd->sections; sec != NULL; sec = sec->next) + if ((sec->flags & SEC_THREAD_LOCAL) != 0) + break; + tls = sec; + + for (; sec != NULL && (sec->flags & SEC_THREAD_LOCAL) != 0; sec = sec->next) + if (sec->alignment_power > align) + align = sec->alignment_power; + + elf_hash_table (info)->tls_sec = tls; + + /* Ensure the alignment of the first section is the largest alignment, + so that the tls segment starts aligned. */ + if (tls != NULL) + tls->alignment_power = align; + + return tls; +} diff --git a/bfd/elflink.h b/bfd/elflink.h index 48b86cf..04df5d6 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -20,6 +20,8 @@ /* ELF linker code. */ +#include "safe-ctype.h" + static bfd_boolean elf_link_add_object_symbols (bfd *, struct bfd_link_info *); static bfd_boolean elf_link_add_archive_symbols (bfd *, struct bfd_link_info *); @@ -1259,6 +1261,10 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) /* If st_other has a processor-specific meaning, specific code might be needed here. We never merge the visibility attribute with the one from a dynamic object. */ + if (bed->elf_backend_merge_symbol_attribute) + (*bed->elf_backend_merge_symbol_attribute) (h, isym, definition, + dynamic); + if (isym->st_other != 0 && !dynamic) { unsigned char hvis, symvis, other, nvis; @@ -1607,27 +1613,32 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) && is_elf_hash_table (info) && (info->strip != strip_all && info->strip != strip_debugger)) { - asection *stab, *stabstr; - - stab = bfd_get_section_by_name (abfd, ".stab"); - if (stab != NULL - && (stab->flags & SEC_MERGE) == 0 - && !bfd_is_abs_section (stab->output_section)) + asection *stabstr; + + stabstr = bfd_get_section_by_name (abfd, ".stabstr"); + if (stabstr != NULL) { - stabstr = bfd_get_section_by_name (abfd, ".stabstr"); - - if (stabstr != NULL) - { - struct bfd_elf_section_data *secdata; - - secdata = elf_section_data (stab); - if (! _bfd_link_section_stabs (abfd, - & hash_table->stab_info, - stab, stabstr, - &secdata->sec_info)) - goto error_return; - if (secdata->sec_info) - stab->sec_info_type = ELF_INFO_TYPE_STABS; + bfd_size_type string_offset = 0; + asection *stab; + + for (stab = abfd->sections; stab; stab = stab->next) + if (strncmp (".stab", stab->name, 5) == 0 + && (!stab->name[5] || + (stab->name[5] == '.' && ISDIGIT (stab->name[6]))) + && (stab->flags & SEC_MERGE) == 0 + && !bfd_is_abs_section (stab->output_section)) + { + struct bfd_elf_section_data *secdata; + + secdata = elf_section_data (stab); + if (! _bfd_link_section_stabs (abfd, + & hash_table->stab_info, + stab, stabstr, + &secdata->sec_info, + &string_offset)) + goto error_return; + if (secdata->sec_info) + stab->sec_info_type = ELF_INFO_TYPE_STABS; } } } @@ -1970,7 +1981,7 @@ NAME(bfd_elf,size_dynamic_sections) (bfd *output_bfd, bfd_boolean all_defined; *sinterpptr = bfd_get_section_by_name (dynobj, ".interp"); - BFD_ASSERT (*sinterpptr != NULL || info->shared); + BFD_ASSERT (*sinterpptr != NULL || !info->executable); if (soname != NULL) { @@ -2047,15 +2058,15 @@ NAME(bfd_elf,size_dynamic_sections) (bfd *output_bfd, /* Make all global versions with definiton. */ for (t = verdefs; t != NULL; t = t->next) - for (d = t->globals; d != NULL; d = d->next) - if (!d->symver && strchr (d->pattern, '*') == NULL) + for (d = t->globals.list; d != NULL; d = d->next) + if (!d->symver && d->symbol) { const char *verstr, *name; size_t namelen, verlen, newlen; char *newname, *p; struct elf_link_hash_entry *newh; - name = d->pattern; + name = d->symbol; namelen = strlen (name); verstr = t->name; verlen = strlen (verstr); @@ -2113,9 +2124,8 @@ NAME(bfd_elf,size_dynamic_sections) (bfd *output_bfd, /* Check if all global versions have a definiton. */ all_defined = TRUE; for (t = verdefs; t != NULL; t = t->next) - for (d = t->globals; d != NULL; d = d->next) - if (!d->symver && !d->script - && strchr (d->pattern, '*') == NULL) + for (d = t->globals.list; d != NULL; d = d->next) + if (!d->symver && !d->script) { (*_bfd_error_handler) (_("%s: undefined version: %s"), @@ -2362,7 +2372,7 @@ NAME(bfd_elf,size_dynamic_sections) (bfd *output_bfd, def.vd_version = VER_DEF_CURRENT; def.vd_flags = 0; - if (t->globals == NULL && t->locals == NULL && ! t->used) + if (t->globals.list == NULL && t->locals.list == NULL && ! t->used) def.vd_flags |= VER_FLG_WEAK; def.vd_ndx = t->vernum + 1; def.vd_cnt = cdeps + 1; @@ -2794,8 +2804,6 @@ struct elf_final_link_info asection *hash_sec; /* symbol version section (.gnu.version). */ asection *symver_sec; - /* first SHF_TLS section (if any). */ - asection *first_tls_sec; /* Buffer large enough to hold contents of any section. */ bfd_byte *contents; /* Buffer large enough to hold external relocs of any section. */ @@ -3150,14 +3158,6 @@ elf_bfd_final_link (bfd *abfd, struct bfd_link_info *info) finfo.symshndxbuf = NULL; finfo.symbuf_count = 0; finfo.shndxbuf_size = 0; - finfo.first_tls_sec = NULL; - for (o = abfd->sections; o != NULL; o = o->next) - if ((o->flags & SEC_THREAD_LOCAL) != 0 - && (o->flags & SEC_LOAD) != 0) - { - finfo.first_tls_sec = o; - break; - } /* Count up the number of relocations we will output for each output section, so that we know the sizes of the reloc sections. We @@ -3515,38 +3515,30 @@ elf_bfd_final_link (bfd *abfd, struct bfd_link_info *info) goto error_return; } - if (finfo.first_tls_sec) + if (elf_hash_table (info)->tls_sec) { - unsigned int align = 0; - bfd_vma base = finfo.first_tls_sec->vma, end = 0; + bfd_vma base, end = 0; asection *sec; - for (sec = finfo.first_tls_sec; + for (sec = elf_hash_table (info)->tls_sec; sec && (sec->flags & SEC_THREAD_LOCAL); sec = sec->next) { bfd_vma size = sec->_raw_size; - if (bfd_get_section_alignment (abfd, sec) > align) - align = bfd_get_section_alignment (abfd, sec); - if (sec->_raw_size == 0 && (sec->flags & SEC_HAS_CONTENTS) == 0) + if (size == 0 && (sec->flags & SEC_HAS_CONTENTS) == 0) { struct bfd_link_order *o; - size = 0; for (o = sec->link_order_head; o != NULL; o = o->next) if (size < o->offset + o->size) size = o->offset + o->size; } end = sec->vma + size; } - elf_hash_table (info)->tls_segment - = bfd_zalloc (abfd, sizeof (struct elf_link_tls_segment)); - if (elf_hash_table (info)->tls_segment == NULL) - goto error_return; - elf_hash_table (info)->tls_segment->start = base; - elf_hash_table (info)->tls_segment->size = end - base; - elf_hash_table (info)->tls_segment->align = align; + base = elf_hash_table (info)->tls_sec->vma; + end = align_power (end, elf_hash_table (info)->tls_sec->alignment_power); + elf_hash_table (info)->tls_size = end - base; } /* Since ELF permits relocations to be against local symbols, we @@ -4493,8 +4485,8 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data) { /* STT_TLS symbols are relative to PT_TLS segment base. */ - BFD_ASSERT (finfo->first_tls_sec != NULL); - sym.st_value -= finfo->first_tls_sec->vma; + BFD_ASSERT (elf_hash_table (finfo->info)->tls_sec != NULL); + sym.st_value -= elf_hash_table (finfo->info)->tls_sec->vma; } } } @@ -4852,8 +4844,8 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) if (ELF_ST_TYPE (osym.st_info) == STT_TLS) { /* STT_TLS symbols are relative to PT_TLS segment base. */ - BFD_ASSERT (finfo->first_tls_sec != NULL); - osym.st_value -= finfo->first_tls_sec->vma; + BFD_ASSERT (elf_hash_table (finfo->info)->tls_sec != NULL); + osym.st_value -= elf_hash_table (finfo->info)->tls_sec->vma; } } @@ -5209,8 +5201,10 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) { /* STT_TLS symbols are relative to PT_TLS segment base. */ - BFD_ASSERT (finfo->first_tls_sec != NULL); - sym.st_value -= finfo->first_tls_sec->vma; + BFD_ASSERT (elf_hash_table (finfo->info) + ->tls_sec != NULL); + sym.st_value -= (elf_hash_table (finfo->info) + ->tls_sec->vma); } } diff --git a/bfd/elfn32-mips.c b/bfd/elfn32-mips.c index 60c6ad0..d944a46 100644 --- a/bfd/elfn32-mips.c +++ b/bfd/elfn32-mips.c @@ -2248,7 +2248,6 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = { #define elf_backend_ecoff_debug_swap &mips_elf32_ecoff_debug_swap #define elf_backend_got_header_size (4 * MIPS_RESERVED_GOTNO) -#define elf_backend_plt_header_size 0 /* MIPS n32 ELF can use a mixture of REL and RELA, but some Relocations work better/work only in RELA, so we default to this. */ diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c index 47f4575..24d6079 100644 --- a/bfd/elfxx-ia64.c +++ b/bfd/elfxx-ia64.c @@ -24,6 +24,8 @@ #include "elf-bfd.h" #include "opcode/ia64.h" #include "elf/ia64.h" +#include "objalloc.h" +#include "hashtab.h" /* THE RULES for all the stuff the linker creates -- @@ -115,7 +117,8 @@ struct elfNN_ia64_dyn_sym_info struct elfNN_ia64_local_hash_entry { - struct bfd_hash_entry root; + int id; + unsigned int r_sym; struct elfNN_ia64_dyn_sym_info *info; /* TRUE if this hash entry's addends was translated for @@ -123,12 +126,6 @@ struct elfNN_ia64_local_hash_entry unsigned sec_merge_done : 1; }; -struct elfNN_ia64_local_hash_table -{ - struct bfd_hash_table root; - /* No additional fields for now. */ -}; - struct elfNN_ia64_link_hash_entry { struct elf_link_hash_entry root; @@ -153,7 +150,8 @@ struct elfNN_ia64_link_hash_table unsigned self_dtpmod_done : 1;/* has self DTPMOD entry been finished? */ bfd_vma self_dtpmod_offset; /* .got offset to self DTPMOD entry */ - struct elfNN_ia64_local_hash_table loc_hash_table; + htab_t loc_hash_table; + void *loc_hash_memory; }; struct elfNN_ia64_allocate_data @@ -201,12 +199,6 @@ static bfd_boolean elfNN_ia64_is_local_label_name PARAMS ((bfd *abfd, const char *name)); static bfd_boolean elfNN_ia64_dynamic_symbol_p PARAMS ((struct elf_link_hash_entry *h, struct bfd_link_info *info, int)); -static bfd_boolean elfNN_ia64_local_hash_table_init - PARAMS ((struct elfNN_ia64_local_hash_table *ht, bfd *abfd, - new_hash_entry_func new)); -static struct bfd_hash_entry *elfNN_ia64_new_loc_hash_entry - PARAMS ((struct bfd_hash_entry *entry, struct bfd_hash_table *table, - const char *string)); static struct bfd_hash_entry *elfNN_ia64_new_elf_hash_entry PARAMS ((struct bfd_hash_entry *entry, struct bfd_hash_table *table, const char *string)); @@ -215,15 +207,17 @@ static void elfNN_ia64_hash_copy_indirect struct elf_link_hash_entry *)); static void elfNN_ia64_hash_hide_symbol PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean)); +static hashval_t elfNN_ia64_local_htab_hash PARAMS ((const void *)); +static int elfNN_ia64_local_htab_eq PARAMS ((const void *ptr1, + const void *ptr2)); static struct bfd_link_hash_table *elfNN_ia64_hash_table_create PARAMS ((bfd *abfd)); -static struct elfNN_ia64_local_hash_entry *elfNN_ia64_local_hash_lookup - PARAMS ((struct elfNN_ia64_local_hash_table *table, const char *string, - bfd_boolean create, bfd_boolean copy)); +static void elfNN_ia64_hash_table_free + PARAMS ((struct bfd_link_hash_table *hash)); static bfd_boolean elfNN_ia64_global_dyn_sym_thunk PARAMS ((struct bfd_hash_entry *, PTR)); -static bfd_boolean elfNN_ia64_local_dyn_sym_thunk - PARAMS ((struct bfd_hash_entry *, PTR)); +static int elfNN_ia64_local_dyn_sym_thunk + PARAMS ((void **, PTR)); static void elfNN_ia64_dyn_sym_traverse PARAMS ((struct elfNN_ia64_link_hash_table *ia64_info, bfd_boolean (*func) (struct elfNN_ia64_dyn_sym_info *, PTR), @@ -446,21 +440,21 @@ static reloc_howto_type ia64_howto_table[] = IA64_HOWTO (R_IA64_TPREL14, "TPREL14", 0, FALSE, FALSE), IA64_HOWTO (R_IA64_TPREL22, "TPREL22", 0, FALSE, FALSE), IA64_HOWTO (R_IA64_TPREL64I, "TPREL64I", 0, FALSE, FALSE), - IA64_HOWTO (R_IA64_TPREL64MSB, "TPREL64MSB", 8, FALSE, FALSE), - IA64_HOWTO (R_IA64_TPREL64LSB, "TPREL64LSB", 8, FALSE, FALSE), + IA64_HOWTO (R_IA64_TPREL64MSB, "TPREL64MSB", 4, FALSE, FALSE), + IA64_HOWTO (R_IA64_TPREL64LSB, "TPREL64LSB", 4, FALSE, FALSE), IA64_HOWTO (R_IA64_LTOFF_TPREL22, "LTOFF_TPREL22", 0, FALSE, FALSE), - IA64_HOWTO (R_IA64_DTPMOD64MSB, "TPREL64MSB", 8, FALSE, FALSE), - IA64_HOWTO (R_IA64_DTPMOD64LSB, "TPREL64LSB", 8, FALSE, FALSE), + IA64_HOWTO (R_IA64_DTPMOD64MSB, "TPREL64MSB", 4, FALSE, FALSE), + IA64_HOWTO (R_IA64_DTPMOD64LSB, "TPREL64LSB", 4, FALSE, FALSE), IA64_HOWTO (R_IA64_LTOFF_DTPMOD22, "LTOFF_DTPMOD22", 0, FALSE, FALSE), IA64_HOWTO (R_IA64_DTPREL14, "DTPREL14", 0, FALSE, FALSE), IA64_HOWTO (R_IA64_DTPREL22, "DTPREL22", 0, FALSE, FALSE), IA64_HOWTO (R_IA64_DTPREL64I, "DTPREL64I", 0, FALSE, FALSE), - IA64_HOWTO (R_IA64_DTPREL32MSB, "DTPREL32MSB", 4, FALSE, FALSE), - IA64_HOWTO (R_IA64_DTPREL32LSB, "DTPREL32LSB", 4, FALSE, FALSE), - IA64_HOWTO (R_IA64_DTPREL64MSB, "DTPREL64MSB", 8, FALSE, FALSE), - IA64_HOWTO (R_IA64_DTPREL64LSB, "DTPREL64LSB", 8, FALSE, FALSE), + IA64_HOWTO (R_IA64_DTPREL32MSB, "DTPREL32MSB", 2, FALSE, FALSE), + IA64_HOWTO (R_IA64_DTPREL32LSB, "DTPREL32LSB", 2, FALSE, FALSE), + IA64_HOWTO (R_IA64_DTPREL64MSB, "DTPREL64MSB", 4, FALSE, FALSE), + IA64_HOWTO (R_IA64_DTPREL64LSB, "DTPREL64LSB", 4, FALSE, FALSE), IA64_HOWTO (R_IA64_LTOFF_DTPREL22, "LTOFF_DTPREL22", 0, FALSE, FALSE), }; @@ -656,6 +650,28 @@ static const bfd_byte oor_brl[16] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* brl.sptk.few tgt;; */ 0x00, 0x00, 0x00, 0xc0 }; + +static const bfd_byte oor_ip[48] = +{ + 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, /* [MLX] nop.m 0 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, /* movl r15=0 */ + 0x01, 0x00, 0x00, 0x60, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, /* [MII] nop.m 0 */ + 0x00, 0x01, 0x00, 0x60, 0x00, 0x00, /* mov r16=ip;; */ + 0xf2, 0x80, 0x00, 0x80, /* add r16=r15,r16;; */ + 0x11, 0x00, 0x00, 0x00, 0x01, 0x00, /* [MIB] nop.m 0 */ + 0x60, 0x80, 0x04, 0x80, 0x03, 0x00, /* mov b6=r16 */ + 0x60, 0x00, 0x80, 0x00 /* br b6;; */ +}; + +static size_t oor_branch_size = sizeof (oor_brl); + +void +bfd_elfNN_ia64_after_parse (int itanium) +{ + oor_branch_size = itanium ? sizeof (oor_ip) : sizeof (oor_brl); +} + /* These functions do relaxation for IA-64 ELF. */ @@ -891,9 +907,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) if (tsec == ia64_info->plt_sec) size = sizeof (plt_full_entry); else - { - size = sizeof (oor_brl); - } + size = oor_branch_size; /* Resize the current section to make room for the new branch. */ trampoff = (sec->_cooked_size + 15) & (bfd_vma) -16; @@ -914,10 +928,22 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) } else { - memcpy (contents + trampoff, oor_brl, size); - irel->r_info = ELFNN_R_INFO (ELFNN_R_SYM (irel->r_info), - R_IA64_PCREL60B); - irel->r_offset = trampoff + 2; + if (size == sizeof (oor_ip)) + { + memcpy (contents + trampoff, oor_ip, size); + irel->r_info = ELFNN_R_INFO (ELFNN_R_SYM (irel->r_info), + R_IA64_PCREL64I); + irel->r_addend -= 16; + irel->r_offset = trampoff + 2; + } + else + { + memcpy (contents + trampoff, oor_brl, size); + irel->r_info = ELFNN_R_INFO (ELFNN_R_SYM (irel->r_info), + R_IA64_PCREL60B); + irel->r_offset = trampoff + 2; + } + } /* Record the fixup so we don't do it again this section. */ @@ -1520,44 +1546,6 @@ elfNN_ia64_dynamic_symbol_p (h, info, r_type) return _bfd_elf_dynamic_symbol_p (h, info, ignore_protected); } -static bfd_boolean -elfNN_ia64_local_hash_table_init (ht, abfd, new) - struct elfNN_ia64_local_hash_table *ht; - bfd *abfd ATTRIBUTE_UNUSED; - new_hash_entry_func new; -{ - memset (ht, 0, sizeof (*ht)); - return bfd_hash_table_init (&ht->root, new); -} - -static struct bfd_hash_entry* -elfNN_ia64_new_loc_hash_entry (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; -{ - struct elfNN_ia64_local_hash_entry *ret; - ret = (struct elfNN_ia64_local_hash_entry *) entry; - - /* Allocate the structure if it has not already been allocated by a - subclass. */ - if (!ret) - ret = bfd_hash_allocate (table, sizeof (*ret)); - - if (!ret) - return 0; - - /* Initialize our local data. All zeros, and definitely easier - than setting a handful of bit fields. */ - memset (ret, 0, sizeof (*ret)); - - /* Call the allocation method of the superclass. */ - ret = ((struct elfNN_ia64_local_hash_entry *) - bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string)); - - return (struct bfd_hash_entry *) ret; -} - static struct bfd_hash_entry* elfNN_ia64_new_elf_hash_entry (entry, table, string) struct bfd_hash_entry *entry; @@ -1657,6 +1645,33 @@ elfNN_ia64_hash_hide_symbol (info, xh, force_local) } } +/* Compute a hash of a local hash entry. */ + +static hashval_t +elfNN_ia64_local_htab_hash (ptr) + const void *ptr; +{ + struct elfNN_ia64_local_hash_entry *entry + = (struct elfNN_ia64_local_hash_entry *) ptr; + + return (((entry->id & 0xff) << 24) | ((entry->id & 0xff00) << 8)) + ^ entry->r_sym ^ (entry->id >> 16); +} + +/* Compare local hash entries. */ + +static int +elfNN_ia64_local_htab_eq (ptr1, ptr2) + const void *ptr1, *ptr2; +{ + struct elfNN_ia64_local_hash_entry *entry1 + = (struct elfNN_ia64_local_hash_entry *) ptr1; + struct elfNN_ia64_local_hash_entry *entry2 + = (struct elfNN_ia64_local_hash_entry *) ptr2; + + return entry1->id == entry2->id && entry1->r_sym == entry2->r_sym; +} + /* Create the derived linker hash table. The IA-64 ELF port uses this derived hash table to keep information specific to the IA-64 ElF linker (without using static variables). */ @@ -1678,8 +1693,10 @@ elfNN_ia64_hash_table_create (abfd) return 0; } - if (!elfNN_ia64_local_hash_table_init (&ret->loc_hash_table, abfd, - elfNN_ia64_new_loc_hash_entry)) + ret->loc_hash_table = htab_try_create (1024, elfNN_ia64_local_htab_hash, + elfNN_ia64_local_htab_eq, NULL); + ret->loc_hash_memory = objalloc_create (); + if (!ret->loc_hash_table || !ret->loc_hash_memory) { free (ret); return 0; @@ -1688,16 +1705,19 @@ elfNN_ia64_hash_table_create (abfd) return &ret->root.root; } -/* Look up an entry in a Alpha ELF linker hash table. */ +/* Destroy IA-64 linker hash table. */ -static INLINE struct elfNN_ia64_local_hash_entry * -elfNN_ia64_local_hash_lookup(table, string, create, copy) - struct elfNN_ia64_local_hash_table *table; - const char *string; - bfd_boolean create, copy; +static void +elfNN_ia64_hash_table_free (hash) + struct bfd_link_hash_table *hash; { - return ((struct elfNN_ia64_local_hash_entry *) - bfd_hash_lookup (&table->root, string, create, copy)); + struct elfNN_ia64_link_hash_table *ia64_info + = (struct elfNN_ia64_link_hash_table *) hash; + if (ia64_info->loc_hash_table) + htab_delete (ia64_info->loc_hash_table); + if (ia64_info->loc_hash_memory) + objalloc_free ((struct objalloc *) ia64_info->loc_hash_memory); + _bfd_generic_link_hash_table_free (hash); } /* Traverse both local and global hash tables. */ @@ -1729,20 +1749,20 @@ elfNN_ia64_global_dyn_sym_thunk (xentry, xdata) } static bfd_boolean -elfNN_ia64_local_dyn_sym_thunk (xentry, xdata) - struct bfd_hash_entry *xentry; +elfNN_ia64_local_dyn_sym_thunk (slot, xdata) + void **slot; PTR xdata; { struct elfNN_ia64_local_hash_entry *entry - = (struct elfNN_ia64_local_hash_entry *) xentry; + = (struct elfNN_ia64_local_hash_entry *) *slot; struct elfNN_ia64_dyn_sym_traverse_data *data = (struct elfNN_ia64_dyn_sym_traverse_data *) xdata; struct elfNN_ia64_dyn_sym_info *dyn_i; for (dyn_i = entry->info; dyn_i; dyn_i = dyn_i->next) if (! (*data->func) (dyn_i, data->data)) - return FALSE; - return TRUE; + return 0; + return 1; } static void @@ -1758,8 +1778,8 @@ elfNN_ia64_dyn_sym_traverse (ia64_info, func, data) elf_link_hash_traverse (&ia64_info->root, elfNN_ia64_global_dyn_sym_thunk, &xdata); - bfd_hash_traverse (&ia64_info->loc_hash_table.root, - elfNN_ia64_local_dyn_sym_thunk, &xdata); + htab_traverse (ia64_info->loc_hash_table, + elfNN_ia64_local_dyn_sym_thunk, &xdata); } static bfd_boolean @@ -1821,22 +1841,33 @@ get_local_sym_hash (ia64_info, abfd, rel, create) const Elf_Internal_Rela *rel; bfd_boolean create; { - struct elfNN_ia64_local_hash_entry *ret; + struct elfNN_ia64_local_hash_entry e, *ret; asection *sec = abfd->sections; - char addr_name [34]; + hashval_t h = (((sec->id & 0xff) << 24) | ((sec->id & 0xff00) << 8)) + ^ ELFNN_R_SYM (rel->r_info) ^ (sec->id >> 16); + void **slot; - BFD_ASSERT ((sizeof (sec->id)*2 + 1 + sizeof (unsigned long)*2 + 1) <= 34); - BFD_ASSERT (sec); + e.id = sec->id; + e.r_sym = ELFNN_R_SYM (rel->r_info); + slot = htab_find_slot_with_hash (ia64_info->loc_hash_table, &e, h, + create ? INSERT : NO_INSERT); - /* Construct a string for use in the elfNN_ia64_local_hash_table. - name describes what was once anonymous memory. */ + if (!slot) + return NULL; - sprintf (addr_name, "%x:%lx", - sec->id, (unsigned long) ELFNN_R_SYM (rel->r_info)); + if (*slot) + return (struct elfNN_ia64_local_hash_entry *) *slot; - /* Collect the canonical entry data for this address. */ - ret = elfNN_ia64_local_hash_lookup (&ia64_info->loc_hash_table, - addr_name, create, create); + ret = (struct elfNN_ia64_local_hash_entry *) + objalloc_alloc ((struct objalloc *) ia64_info->loc_hash_memory, + sizeof (struct elfNN_ia64_local_hash_entry)); + if (ret) + { + memset (ret, 0, sizeof (*ret)); + ret->id = sec->id; + ret->r_sym = ELFNN_R_SYM (rel->r_info); + *slot = ret; + } return ret; } @@ -3513,12 +3544,10 @@ static bfd_vma elfNN_ia64_tprel_base (info) struct bfd_link_info *info; { - struct elf_link_tls_segment *tls_segment - = elf_hash_table (info)->tls_segment; + asection *tls_sec = elf_hash_table (info)->tls_sec; - BFD_ASSERT (tls_segment != NULL); - return (tls_segment->start - - align_power ((bfd_vma) 16, tls_segment->align)); + BFD_ASSERT (tls_sec != NULL); + return tls_sec->vma - align_power ((bfd_vma) 16, tls_sec->alignment_power); } /* Return the base VMA address which should be subtracted from real addresses @@ -3529,8 +3558,8 @@ static bfd_vma elfNN_ia64_dtprel_base (info) struct bfd_link_info *info; { - BFD_ASSERT (elf_hash_table (info)->tls_segment != NULL); - return elf_hash_table (info)->tls_segment->start; + BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL); + return elf_hash_table (info)->tls_sec->vma; } /* Called through qsort to sort the .IA_64.unwind section during a @@ -3817,9 +3846,11 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, if (r_symndx < symtab_hdr->sh_info) { /* Reloc against local symbol. */ + asection *msec; sym = local_syms + r_symndx; sym_sec = local_sections[r_symndx]; - value = _bfd_elf_rela_local_sym (output_bfd, sym, sym_sec, rel); + msec = sym_sec; + value = _bfd_elf_rela_local_sym (output_bfd, sym, &msec, rel); if ((sym_sec->flags & SEC_MERGE) && ELF_ST_TYPE (sym->st_info) == STT_SECTION && sym_sec->sec_info_type == ELF_INFO_TYPE_MERGE) @@ -3830,7 +3861,6 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, if (loc_h && ! loc_h->sec_merge_done) { struct elfNN_ia64_dyn_sym_info *dynent; - asection *msec; for (dynent = loc_h->info; dynent; dynent = dynent->next) { @@ -4748,12 +4778,9 @@ elfNN_ia64_reloc_type_class (rela) static struct bfd_elf_special_section const elfNN_ia64_special_sections[]= { - { ".sbss", 5, NULL, 0, - SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT }, - { ".sdata", 6, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT }, - { NULL, 0, NULL, 0, - 0, 0 } + { ".sbss", 5, -1, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT }, + { ".sdata", 6, -1, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT }, + { NULL, 0, 0, 0, 0 } }; static bfd_boolean @@ -4787,6 +4814,23 @@ elfNN_hpux_backend_section_from_bfd_section (abfd, sec, retval) } return FALSE; } + +static void +elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED, + asymbol *asym) +{ + elf_symbol_type *elfsym = (elf_symbol_type *) asym;; + + switch (elfsym->internal_elf_sym.st_shndx) + { + case SHN_IA_64_ANSI_COMMON: + asym->section = bfd_com_section_ptr; + asym->value = elfsym->internal_elf_sym.st_size; + asym->flags &= ~BSF_GLOBAL; + break; + } +} + #define TARGET_LITTLE_SYM bfd_elfNN_ia64_little_vec #define TARGET_LITTLE_NAME "elfNN-ia64-little" @@ -4825,6 +4869,8 @@ elfNN_hpux_backend_section_from_bfd_section (abfd, sec, retval) /* Stuff for the BFD linker: */ #define bfd_elfNN_bfd_link_hash_table_create \ elfNN_ia64_hash_table_create +#define bfd_elfNN_bfd_link_hash_table_free \ + elfNN_ia64_hash_table_free #define elf_backend_create_dynamic_sections \ elfNN_ia64_create_dynamic_sections #define elf_backend_check_relocs \ @@ -4853,7 +4899,6 @@ elfNN_hpux_backend_section_from_bfd_section (abfd, sec, retval) #define elf_backend_want_plt_sym 0 #define elf_backend_plt_alignment 5 #define elf_backend_got_header_size 0 -#define elf_backend_plt_header_size PLT_HEADER_SIZE #define elf_backend_want_got_plt 1 #define elf_backend_may_use_rel_p 1 #define elf_backend_may_use_rela_p 1 @@ -4884,6 +4929,9 @@ elfNN_hpux_backend_section_from_bfd_section (abfd, sec, retval) #undef elf_backend_section_from_bfd_section #define elf_backend_section_from_bfd_section elfNN_hpux_backend_section_from_bfd_section +#undef elf_backend_symbol_processing +#define elf_backend_symbol_processing elfNN_hpux_backend_symbol_processing + #undef elf_backend_want_p_paddr_set_to_zero #define elf_backend_want_p_paddr_set_to_zero 1 diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 919593d..b545683 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -587,17 +587,20 @@ static bfd *reldyn_sorting_bfd; offsets from $gp. */ #define MIPS_ELF_GOT_MAX_SIZE(abfd) (ELF_MIPS_GP_OFFSET(abfd) + 0x7fff) -/* Instructions which appear in a stub. For some reason the stub is - slightly different on an SGI system. */ +/* Instructions which appear in a stub. */ #define STUB_LW(abfd) \ ((ABI_64_P (abfd) \ ? 0xdf998010 /* ld t9,0x8010(gp) */ \ : 0x8f998010)) /* lw t9,0x8010(gp) */ #define STUB_MOVE(abfd) \ - (SGI_COMPAT (abfd) ? 0x03e07825 : 0x03e07821) /* move t7,ra */ -#define STUB_JALR 0x0320f809 /* jal t9 */ + ((ABI_64_P (abfd) \ + ? 0x03e0782d /* daddu t7,ra */ \ + : 0x03e07821)) /* addu t7,ra */ +#define STUB_JALR 0x0320f809 /* jalr t9,ra */ #define STUB_LI16(abfd) \ - (SGI_COMPAT (abfd) ? 0x34180000 : 0x24180000) /* ori t8,zero,0 */ + ((ABI_64_P (abfd) \ + ? 0x64180000 /* daddiu t8,zero,0 */ \ + : 0x24180000)) /* addiu t8,zero,0 */ #define MIPS_FUNCTION_STUB_SIZE (16) /* The name of the dynamic interpreter. This is put in the .interp @@ -2864,6 +2867,7 @@ mips_elf_create_got_section (abfd, info, maybe_exclude) if (g == NULL) return FALSE; g->global_gotsym = NULL; + g->global_gotno = 0; g->local_gotno = MIPS_RESERVED_GOTNO; g->assigned_gotno = MIPS_RESERVED_GOTNO; g->bfd2got = NULL; @@ -4056,6 +4060,10 @@ _bfd_elf_mips_mach (flags) case E_MIPS_ARCH_32R2: return bfd_mach_mipsisa32r2; break; + + case E_MIPS_ARCH_64R2: + return bfd_mach_mipsisa64r2; + break; } } @@ -5863,7 +5871,7 @@ _bfd_mips_elf_size_dynamic_sections (output_bfd, info) if (elf_hash_table (info)->dynamic_sections_created) { /* Set the contents of the .interp section to the interpreter. */ - if (! info->shared) + if (info->executable) { s = bfd_get_section_by_name (dynobj, ".interp"); BFD_ASSERT (s != NULL); @@ -6081,30 +6089,6 @@ _bfd_mips_elf_size_dynamic_sections (output_bfd, info) return FALSE; } - if (SGI_COMPAT (output_bfd)) - { - if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_CONFLICTNO, 0)) - return FALSE; - } - - if (SGI_COMPAT (output_bfd)) - { - if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_LIBLISTNO, 0)) - return FALSE; - } - - if (bfd_get_section_by_name (dynobj, ".conflict") != NULL) - { - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_CONFLICT, 0)) - return FALSE; - - s = bfd_get_section_by_name (dynobj, ".liblist"); - BFD_ASSERT (s != NULL); - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_LIBLIST, 0)) - return FALSE; - } - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_VERSION, 0)) return FALSE; @@ -6874,13 +6858,6 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info) case DT_PLTGOT: name = ".got"; - goto get_vma; - case DT_MIPS_CONFLICT: - name = ".conflict"; - goto get_vma; - case DT_MIPS_LIBLIST: - name = ".liblist"; - get_vma: s = bfd_get_section_by_name (output_bfd, name); BFD_ASSERT (s != NULL); dyn.d_un.d_ptr = s->vma; @@ -6894,27 +6871,6 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info) dyn.d_un.d_val = RHF_NOTPOT; /* XXX */ break; - case DT_MIPS_CONFLICTNO: - name = ".conflict"; - elemsize = sizeof (Elf32_Conflict); - goto set_elemno; - - case DT_MIPS_LIBLISTNO: - name = ".liblist"; - elemsize = sizeof (Elf32_Lib); - set_elemno: - s = bfd_get_section_by_name (output_bfd, name); - if (s != NULL) - { - if (s->_cooked_size != 0) - dyn.d_un.d_val = s->_cooked_size / elemsize; - else - dyn.d_un.d_val = s->_raw_size / elemsize; - } - else - dyn.d_un.d_val = 0; - break; - case DT_MIPS_TIME_STAMP: time ((time_t *) &dyn.d_un.d_val); break; @@ -6982,9 +6938,16 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info) dyn.d_un.d_ptr = s->vma; break; - case DT_MIPS_MSYM: - s = (bfd_get_section_by_name (output_bfd, ".msym")); - dyn.d_un.d_ptr = s->vma; + case DT_RELSZ: + /* Reduce DT_RELSZ to account for any relocations we + decided not to make. This is for the n64 irix rld, + which doesn't seem to apply any relocations if there + are trailing null entries. */ + s = mips_elf_rel_dyn_section (dynobj, FALSE); + dyn.d_un.d_val = (s->reloc_count + * (ABI_64_P (output_bfd) + ? sizeof (Elf64_Mips_External_Rel) + : sizeof (Elf32_External_Rel))); break; default: @@ -7192,6 +7155,10 @@ mips_set_isa_flags (abfd) case bfd_mach_mipsisa32r2: val = E_MIPS_ARCH_32R2; break; + + case bfd_mach_mipsisa64r2: + val = E_MIPS_ARCH_64R2; + break; } elf_elfheader (abfd)->e_flags &= ~(EF_MIPS_ARCH | EF_MIPS_MACH); elf_elfheader (abfd)->e_flags |= val; @@ -7361,7 +7328,7 @@ _bfd_mips_elf_modify_segment_map (abfd) /* For IRIX 6, we don't have .mdebug sections, nor does anything but .dynamic end up in PT_DYNAMIC. However, we do have to insert a - PT_OPTIONS segment immediately following the program header + PT_MIPS_OPTIONS segment immediately following the program header table. */ if (NEWABI_P (abfd) /* On non-IRIX6 new abi, we'll have already created a segment @@ -7378,15 +7345,11 @@ _bfd_mips_elf_modify_segment_map (abfd) { struct elf_segment_map *options_segment; - /* Usually, there's a program header table. But, sometimes - there's not (like when running the `ld' testsuite). So, - if there's no program header table, we just put the - options segment at the end. */ - for (pm = &elf_tdata (abfd)->segment_map; - *pm != NULL; - pm = &(*pm)->next) - if ((*pm)->p_type == PT_PHDR) - break; + pm = &elf_tdata (abfd)->segment_map; + while (*pm != NULL + && ((*pm)->p_type == PT_PHDR + || (*pm)->p_type == PT_INTERP)) + pm = &(*pm)->next; amt = sizeof (struct elf_segment_map); options_segment = bfd_zalloc (abfd, amt); @@ -7950,7 +7913,7 @@ bfd_boolean _bfd_mips_elf_set_section_contents (abfd, section, location, offset, count) bfd *abfd; sec_ptr section; - PTR location; + const PTR location; file_ptr offset; bfd_size_type count; { @@ -8929,6 +8892,7 @@ struct mips_mach_extension { static const struct mips_mach_extension mips_mach_extensions[] = { /* MIPS64 extensions. */ + { bfd_mach_mipsisa64r2, bfd_mach_mipsisa64 }, { bfd_mach_mips_sb1, bfd_mach_mipsisa64 }, /* MIPS V extensions. */ @@ -9076,6 +9040,11 @@ _bfd_mips_elf_merge_private_bfd_data (ibfd, obfd) new_flags &= ~EF_MIPS_XGOT; old_flags &= ~EF_MIPS_XGOT; + /* MIPSpro generates ucode info in n64 objects. Again, we should + just be able to ignore this. */ + new_flags &= ~EF_MIPS_UCODE; + old_flags &= ~EF_MIPS_UCODE; + if (new_flags == old_flags) return TRUE; @@ -9275,6 +9244,8 @@ _bfd_mips_elf_print_private_bfd_data (abfd, ptr) fprintf (file, _(" [mips64]")); else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_32R2) fprintf (file, _(" [mips32r2]")); + else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_64R2) + fprintf (file, _(" [mips64r2]")); else fprintf (file, _(" [unknown ISA]")); @@ -9296,18 +9267,11 @@ _bfd_mips_elf_print_private_bfd_data (abfd, ptr) struct bfd_elf_special_section const _bfd_mips_elf_special_sections[]= { - { ".sdata", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL }, - { ".sbss", 0, NULL, 0, - SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL }, - { ".lit4", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL }, - { ".lit8", 0, NULL, 0, - SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL }, - { ".ucode", 0, NULL, 0, - SHT_MIPS_UCODE, 0 }, - { ".mdebug", 0, NULL, 0, - SHT_MIPS_DEBUG, 0 }, - { NULL, 0, NULL, 0, - 0, 0 } + { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL }, + { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL }, + { ".lit4", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL }, + { ".lit8", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL }, + { ".ucode", 6, 0, SHT_MIPS_UCODE, 0 }, + { ".mdebug", 7, 0, SHT_MIPS_DEBUG, 0 }, + { NULL, 0, 0, 0, 0 } }; diff --git a/bfd/elfxx-mips.h b/bfd/elfxx-mips.h index 71cdc07..b4230eb 100644 --- a/bfd/elfxx-mips.h +++ b/bfd/elfxx-mips.h @@ -80,7 +80,7 @@ extern bfd_boolean _bfd_mips_elf_find_nearest_line PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, const char **, unsigned int *)); extern bfd_boolean _bfd_mips_elf_set_section_contents - PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); + PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type)); extern bfd_byte *_bfd_elf_mips_get_relocated_section_contents PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *, bfd_boolean, asymbol **)); diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h index 544f8f3..40fe8e7 100644 --- a/bfd/elfxx-target.h +++ b/bfd/elfxx-target.h @@ -51,7 +51,7 @@ #ifndef bfd_elfNN_get_symbol_info #define bfd_elfNN_get_symbol_info _bfd_elf_get_symbol_info #endif -#define bfd_elfNN_get_symtab _bfd_elf_get_symtab +#define bfd_elfNN_canonicalize_symtab _bfd_elf_canonicalize_symtab #define bfd_elfNN_get_symtab_upper_bound _bfd_elf_get_symtab_upper_bound #define bfd_elfNN_make_empty_symbol _bfd_elf_make_empty_symbol #ifndef bfd_elfNN_new_section_hook @@ -99,7 +99,7 @@ #define bfd_elfNN_bfd_debug_info_start bfd_void #define bfd_elfNN_bfd_debug_info_end bfd_void #define bfd_elfNN_bfd_debug_info_accumulate \ - ((void (*) (bfd*, struct sec *)) bfd_void) + ((void (*) (bfd*, struct bfd_section *)) bfd_void) #ifndef bfd_elfNN_bfd_get_relocated_section_contents #define bfd_elfNN_bfd_get_relocated_section_contents \ @@ -343,9 +343,6 @@ #ifndef elf_backend_got_header_size #define elf_backend_got_header_size 0 #endif -#ifndef elf_backend_plt_header_size -#define elf_backend_plt_header_size 0 -#endif #ifndef elf_backend_post_process_headers #define elf_backend_post_process_headers NULL #endif @@ -361,6 +358,9 @@ #ifndef elf_backend_hide_symbol #define elf_backend_hide_symbol _bfd_elf_link_hash_hide_symbol #endif +#ifndef elf_backend_merge_symbol_attribute +#define elf_backend_merge_symbol_attribute NULL +#endif #ifndef elf_backend_emit_relocs #define elf_backend_emit_relocs NULL #endif @@ -483,6 +483,7 @@ static const struct elf_backend_data elfNN_bed = elf_backend_output_arch_syms, elf_backend_copy_indirect_symbol, elf_backend_hide_symbol, + elf_backend_merge_symbol_attribute, elf_backend_emit_relocs, elf_backend_count_relocs, elf_backend_grok_prstatus, @@ -503,7 +504,6 @@ static const struct elf_backend_data elfNN_bed = elf_backend_special_sections, elf_backend_got_symbol_offset, elf_backend_got_header_size, - elf_backend_plt_header_size, elf_backend_collect, elf_backend_type_change_ok, elf_backend_may_use_rel_p, diff --git a/bfd/gen-aout.c b/bfd/gen-aout.c index b6720e8..ea207db 100644 --- a/bfd/gen-aout.c +++ b/bfd/gen-aout.c @@ -1,5 +1,5 @@ /* Generate parameters for an a.out system. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 2001 + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -1,5 +1,5 @@ /* hash.c -- hash table routines for BFD - Copyright 1993, 1994, 1995, 1997, 1999, 2001, 2002 + Copyright 1993, 1994, 1995, 1997, 1999, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Steve Chamberlain <sac@cygnus.com> diff --git a/bfd/hp300hpux.c b/bfd/hp300hpux.c index d4eb3aa..e5a567d 100644 --- a/bfd/hp300hpux.c +++ b/bfd/hp300hpux.c @@ -1,5 +1,5 @@ /* BFD backend for hp-ux 9000/300 - Copyright 1990, 1991, 1993, 1994, 1995, 1997, 2000, 2001, 2002 + Copyright 1990, 1991, 1993, 1994, 1995, 1997, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Glenn Engel. @@ -93,7 +93,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ slurp_symbol_table swap_std_reloc_in slurp_reloc_table - get_symtab + canonicalize_symtab get_symtab_upper_bound canonicalize_reloc mkobject @@ -129,7 +129,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* these don't use MY because that causes problems within JUMP_TABLE (CONCAT2 winds up being expanded recursively, which ANSI C compilers will not do). */ -#define MY_get_symtab hp300hpux_get_symtab +#define MY_canonicalize_symtab hp300hpux_canonicalize_symtab #define MY_get_symtab_upper_bound hp300hpux_get_symtab_upper_bound #define MY_canonicalize_reloc hp300hpux_canonicalize_reloc #define MY_write_object_contents hp300hpux_write_object_contents @@ -208,7 +208,7 @@ void MY (swap_std_reloc_in) bfd_size_type)); bfd_boolean MY (slurp_reloc_table) PARAMS ((bfd *, sec_ptr, asymbol **)); -long MY (get_symtab) +long MY (canonicalize_symtab) PARAMS ((bfd *, asymbol **)); long MY (get_symtab_upper_bound) PARAMS ((bfd *)); @@ -802,7 +802,7 @@ doit: /* call aout_32 versions if the input file was generated by gcc */ /************************************************************************/ -long aout_32_get_symtab +long aout_32_canonicalize_symtab PARAMS ((bfd * abfd, asymbol ** location)); long aout_32_get_symtab_upper_bound PARAMS ((bfd * abfd)); @@ -811,7 +811,7 @@ long aout_32_canonicalize_reloc asymbol ** symbols)); long -MY (get_symtab) (abfd, location) +MY (canonicalize_symtab) (abfd, location) bfd *abfd; asymbol **location; { @@ -819,7 +819,7 @@ MY (get_symtab) (abfd, location) aout_symbol_type *symbase; if (obj_aout_subformat (abfd) == gnu_encap_format) - return aout_32_get_symtab (abfd, location); + return aout_32_canonicalize_symtab (abfd, location); if (!MY (slurp_symbol_table) (abfd)) return -1; diff --git a/bfd/i386msdos.c b/bfd/i386msdos.c index 7d5a0d4..059466b 100644 --- a/bfd/i386msdos.c +++ b/bfd/i386msdos.c @@ -1,6 +1,6 @@ /* BFD back-end for MS-DOS executables. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002 - Free Software Foundation, Inc. + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002, + 2003 Free Software Foundation, Inc. Written by Bryan Ford of the University of Utah. Contributed by the Center for Software Science at the @@ -61,7 +61,7 @@ static int msdos_sizeof_headers static bfd_boolean msdos_write_object_contents PARAMS ((bfd *)); static bfd_boolean msdos_set_section_contents - PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type)); + PARAMS ((bfd *, sec_ptr, const PTR, file_ptr, bfd_size_type)); static int msdos_sizeof_headers (abfd, exec) @@ -139,7 +139,7 @@ static bfd_boolean msdos_set_section_contents (abfd, section, location, offset, count) bfd *abfd; sec_ptr section; - PTR location; + const PTR location; file_ptr offset; bfd_size_type count; { @@ -186,7 +186,7 @@ msdos_set_section_contents (abfd, section, location, offset, count) #define msdos_set_arch_mach _bfd_generic_set_arch_mach #define msdos_get_symtab_upper_bound _bfd_nosymbols_get_symtab_upper_bound -#define msdos_get_symtab _bfd_nosymbols_get_symtab +#define msdos_canonicalize_symtab _bfd_nosymbols_canonicalize_symtab #define msdos_print_symbol _bfd_nosymbols_print_symbol #define msdos_get_symbol_info _bfd_nosymbols_get_symbol_info #define msdos_find_nearest_line _bfd_nosymbols_find_nearest_line @@ -80,7 +80,7 @@ static bfd_boolean ieee_slurp_symbol_table PARAMS ((bfd *)); static long ieee_get_symtab_upper_bound PARAMS ((bfd *)); -static long ieee_get_symtab +static long ieee_canonicalize_symtab PARAMS ((bfd *, asymbol **)); static asection *get_section_entry PARAMS ((bfd *, ieee_data_type *i, unsigned int)); @@ -160,7 +160,7 @@ static bfd_boolean ieee_write_data_part static bfd_boolean init_for_output PARAMS ((bfd *)); static bfd_boolean ieee_set_section_contents - PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type)); + PARAMS ((bfd *, sec_ptr, const PTR, file_ptr, bfd_size_type)); static bfd_boolean ieee_write_external_part PARAMS ((bfd *)); static bfd_boolean ieee_write_me_part @@ -1145,7 +1145,7 @@ ieee_get_symtab_upper_bound (abfd) extern const bfd_target ieee_vec; static long -ieee_get_symtab (abfd, location) +ieee_canonicalize_symtab (abfd, location) bfd *abfd; asymbol **location; { @@ -3440,7 +3440,7 @@ static bfd_boolean ieee_set_section_contents (abfd, section, location, offset, count) bfd *abfd; sec_ptr section; - PTR location; + const PTR location; file_ptr offset; bfd_size_type count; { @@ -3704,6 +3704,7 @@ ieee_write_processor (abfd) case bfd_mach_mcf5206e:id = "5206e"; break; case bfd_mach_mcf5307:id = "5307"; break; case bfd_mach_mcf5407:id = "5407"; break; + case bfd_mach_mcf528x:id = "5282"; break; } if (! ieee_write_id (abfd, id)) @@ -4097,10 +4098,11 @@ const bfd_target ieee_vec = ieee_update_armap_timestamp */ BFD_JUMP_TABLE_ARCHIVE (ieee), - /* ieee_get_symtab_upper_bound, ieee_get_symtab, ieee_make_empty_symbol, - ieee_print_symbol, ieee_get_symbol_info, ieee_bfd_is_local_label_name, - ieee_get_lineno, ieee_find_nearest_line, ieee_bfd_make_debug_symbol, - ieee_read_minisymbols, ieee_minisymbol_to_symbol */ + /* ieee_get_symtab_upper_bound, ieee_canonicalize_symtab, + ieee_make_empty_symbol, ieee_print_symbol, ieee_get_symbol_info, + ieee_bfd_is_local_label_name, ieee_get_lineno, + ieee_find_nearest_line, ieee_bfd_make_debug_symbol, + ieee_read_minisymbols, ieee_minisymbol_to_symbol */ BFD_JUMP_TABLE_SYMBOLS (ieee), /* ieee_get_reloc_upper_bound, ieee_canonicalize_reloc, @@ -1,5 +1,5 @@ /* BFD back-end for Intel Hex objects. - Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002 + Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Ian Lance Taylor of Cygnus Support <ian@cygnus.com>. @@ -142,7 +142,7 @@ static bfd_boolean ihex_read_section static bfd_boolean ihex_get_section_contents PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); static bfd_boolean ihex_set_section_contents - PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); + PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type)); static bfd_boolean ihex_write_record PARAMS ((bfd *, size_t, unsigned int, unsigned int, bfd_byte *)); static bfd_boolean ihex_write_object_contents @@ -699,7 +699,7 @@ static bfd_boolean ihex_set_section_contents (abfd, section, location, offset, count) bfd *abfd; asection *section; - PTR location; + const PTR location; file_ptr offset; bfd_size_type count; { @@ -966,7 +966,7 @@ ihex_sizeof_headers (abfd, exec) _bfd_generic_get_section_contents_in_window #define ihex_get_symtab_upper_bound bfd_0l -#define ihex_get_symtab \ +#define ihex_canonicalize_symtab \ ((long (*) PARAMS ((bfd *, asymbol **))) bfd_0l) #define ihex_make_empty_symbol _bfd_generic_make_empty_symbol #define ihex_print_symbol _bfd_nosymbols_print_symbol @@ -1,5 +1,5 @@ /* bfd initialization stuff - Copyright 1990, 1991, 1992, 1993, 1994, 1995 + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 2003 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support. diff --git a/bfd/libaout.h b/bfd/libaout.h index 7dc44a2..2b93dbf 100644 --- a/bfd/libaout.h +++ b/bfd/libaout.h @@ -1,6 +1,6 @@ /* BFD back-end data structures for a.out (and similar) files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002 + 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Cygnus Support. @@ -513,7 +513,7 @@ extern bfd_boolean NAME(aout,new_section_hook) PARAMS ((bfd *, asection *)); extern bfd_boolean NAME(aout,set_section_contents) - PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type)); + PARAMS ((bfd *, sec_ptr, const PTR, file_ptr, bfd_size_type)); extern asymbol * NAME(aout,make_empty_symbol) PARAMS ((bfd *)); @@ -534,7 +534,7 @@ extern void NAME(aout,reclaim_symbol_table) extern long NAME(aout,get_symtab_upper_bound) PARAMS ((bfd *)); -extern long NAME(aout,get_symtab) +extern long NAME(aout,canonicalize_symtab) PARAMS ((bfd *, asymbol **)); extern void NAME(aout,swap_ext_reloc_in) diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h index 2c9c23c..0ec808d 100644 --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h @@ -286,7 +286,7 @@ extern bfd_boolean _bfd_archive_coff_construct_extended_name_table support. Use BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols). */ #define _bfd_nosymbols_get_symtab_upper_bound _bfd_n1 -#define _bfd_nosymbols_get_symtab \ +#define _bfd_nosymbols_canonicalize_symtab \ ((long (*) (bfd *, asymbol **)) _bfd_n1) #define _bfd_nosymbols_make_empty_symbol _bfd_generic_make_empty_symbol #define _bfd_nosymbols_print_symbol \ @@ -326,7 +326,7 @@ extern bfd_boolean _bfd_archive_coff_construct_extended_name_table ((bfd_boolean (*) (bfd *, enum bfd_architecture, unsigned long)) \ bfd_false) #define _bfd_nowrite_set_section_contents \ - ((bfd_boolean (*) (bfd *, asection *, void *, file_ptr, bfd_size_type)) \ + ((bfd_boolean (*) (bfd *, asection *, const void *, file_ptr, bfd_size_type)) \ bfd_false) /* Generic routines to use for BFD_JUMP_TABLE_WRITE. Use @@ -334,7 +334,7 @@ extern bfd_boolean _bfd_archive_coff_construct_extended_name_table #define _bfd_generic_set_arch_mach bfd_default_set_arch_mach extern bfd_boolean _bfd_generic_set_section_contents - (bfd *, asection *, void *, file_ptr, bfd_size_type); + (bfd *, asection *, const void *, file_ptr, bfd_size_type); /* Routines to use for BFD_JUMP_TABLE_LINK for targets which do not support linking. Use BFD_JUMP_TABLE_LINK (_bfd_nolink). */ @@ -355,7 +355,7 @@ extern bfd_boolean _bfd_generic_set_section_contents ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) \ bfd_false) #define _bfd_nolink_bfd_discard_group \ - ((bfd_boolean (*) (bfd *, struct sec *)) \ + ((bfd_boolean (*) (bfd *, struct bfd_section *)) \ bfd_false) #define _bfd_nolink_bfd_link_hash_table_create \ ((struct bfd_link_hash_table *(*) (bfd *)) bfd_nullvoidptr) @@ -368,7 +368,7 @@ extern bfd_boolean _bfd_generic_set_section_contents #define _bfd_nolink_bfd_final_link \ ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) bfd_false) #define _bfd_nolink_bfd_link_split_section \ - ((bfd_boolean (*) (bfd *, struct sec *)) bfd_false) + ((bfd_boolean (*) (bfd *, struct bfd_section *)) bfd_false) /* Routines to use for BFD_JUMP_TABLE_DYNAMIC for targets which do not have dynamic symbols or relocs. Use BFD_JUMP_TABLE_DYNAMIC @@ -464,7 +464,7 @@ extern bfd_boolean _bfd_generic_final_link (bfd *, struct bfd_link_info *); extern bfd_boolean _bfd_generic_link_split_section - (bfd *, struct sec *); + (bfd *, struct bfd_section *); /* Generic reloc_link_order processing routine. */ extern bfd_boolean _bfd_generic_reloc_link_order @@ -490,7 +490,7 @@ extern bfd_reloc_status_type _bfd_relocate_contents /* Link stabs in sections in the first pass. */ extern bfd_boolean _bfd_link_section_stabs - (bfd *, void **, asection *, asection *, void **); + (bfd *, void **, asection *, asection *, void **, bfd_size_type *); /* Eliminate stabs for discarded functions and symbols. */ extern bfd_boolean _bfd_discard_section_stabs diff --git a/bfd/libbfd.c b/bfd/libbfd.c index 50bd215..abcf44f 100644 --- a/bfd/libbfd.c +++ b/bfd/libbfd.c @@ -771,7 +771,7 @@ _bfd_generic_get_section_contents_in_window bfd_boolean _bfd_generic_set_section_contents (bfd *abfd, sec_ptr section, - void *location, + const void *location, file_ptr offset, bfd_size_type count) { diff --git a/bfd/libbfd.h b/bfd/libbfd.h index a428c66..b40a249 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -291,7 +291,7 @@ extern bfd_boolean _bfd_archive_coff_construct_extended_name_table support. Use BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols). */ #define _bfd_nosymbols_get_symtab_upper_bound _bfd_n1 -#define _bfd_nosymbols_get_symtab \ +#define _bfd_nosymbols_canonicalize_symtab \ ((long (*) (bfd *, asymbol **)) _bfd_n1) #define _bfd_nosymbols_make_empty_symbol _bfd_generic_make_empty_symbol #define _bfd_nosymbols_print_symbol \ @@ -331,7 +331,7 @@ extern bfd_boolean _bfd_archive_coff_construct_extended_name_table ((bfd_boolean (*) (bfd *, enum bfd_architecture, unsigned long)) \ bfd_false) #define _bfd_nowrite_set_section_contents \ - ((bfd_boolean (*) (bfd *, asection *, void *, file_ptr, bfd_size_type)) \ + ((bfd_boolean (*) (bfd *, asection *, const void *, file_ptr, bfd_size_type)) \ bfd_false) /* Generic routines to use for BFD_JUMP_TABLE_WRITE. Use @@ -339,7 +339,7 @@ extern bfd_boolean _bfd_archive_coff_construct_extended_name_table #define _bfd_generic_set_arch_mach bfd_default_set_arch_mach extern bfd_boolean _bfd_generic_set_section_contents - (bfd *, asection *, void *, file_ptr, bfd_size_type); + (bfd *, asection *, const void *, file_ptr, bfd_size_type); /* Routines to use for BFD_JUMP_TABLE_LINK for targets which do not support linking. Use BFD_JUMP_TABLE_LINK (_bfd_nolink). */ @@ -360,7 +360,7 @@ extern bfd_boolean _bfd_generic_set_section_contents ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) \ bfd_false) #define _bfd_nolink_bfd_discard_group \ - ((bfd_boolean (*) (bfd *, struct sec *)) \ + ((bfd_boolean (*) (bfd *, struct bfd_section *)) \ bfd_false) #define _bfd_nolink_bfd_link_hash_table_create \ ((struct bfd_link_hash_table *(*) (bfd *)) bfd_nullvoidptr) @@ -373,7 +373,7 @@ extern bfd_boolean _bfd_generic_set_section_contents #define _bfd_nolink_bfd_final_link \ ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) bfd_false) #define _bfd_nolink_bfd_link_split_section \ - ((bfd_boolean (*) (bfd *, struct sec *)) bfd_false) + ((bfd_boolean (*) (bfd *, struct bfd_section *)) bfd_false) /* Routines to use for BFD_JUMP_TABLE_DYNAMIC for targets which do not have dynamic symbols or relocs. Use BFD_JUMP_TABLE_DYNAMIC @@ -469,7 +469,7 @@ extern bfd_boolean _bfd_generic_final_link (bfd *, struct bfd_link_info *); extern bfd_boolean _bfd_generic_link_split_section - (bfd *, struct sec *); + (bfd *, struct bfd_section *); /* Generic reloc_link_order processing routine. */ extern bfd_boolean _bfd_generic_reloc_link_order @@ -495,7 +495,7 @@ extern bfd_reloc_status_type _bfd_relocate_contents /* Link stabs in sections in the first pass. */ extern bfd_boolean _bfd_link_section_stabs - (bfd *, void **, asection *, asection *, void **); + (bfd *, void **, asection *, asection *, void **, bfd_size_type *); /* Eliminate stabs for discarded functions and symbols. */ extern bfd_boolean _bfd_discard_section_stabs @@ -1222,6 +1222,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_MMIX_PUSHJ_1", "BFD_RELOC_MMIX_PUSHJ_2", "BFD_RELOC_MMIX_PUSHJ_3", + "BFD_RELOC_MMIX_PUSHJ_STUBBABLE", "BFD_RELOC_MMIX_JMP", "BFD_RELOC_MMIX_JMP_1", "BFD_RELOC_MMIX_JMP_2", diff --git a/bfd/libcoff-in.h b/bfd/libcoff-in.h index 0c19433..6b5947c 100644 --- a/bfd/libcoff-in.h +++ b/bfd/libcoff-in.h @@ -301,11 +301,11 @@ struct coff_link_hash_table /* Functions in coffgen.c. */ extern const bfd_target *coff_object_p PARAMS ((bfd *)); -extern struct sec *coff_section_from_bfd_index +extern struct bfd_section *coff_section_from_bfd_index PARAMS ((bfd *, int)); extern long coff_get_symtab_upper_bound PARAMS ((bfd *)); -extern long coff_get_symtab +extern long coff_canonicalize_symtab PARAMS ((bfd *, asymbol **)); extern int coff_count_linenumbers PARAMS ((bfd *)); diff --git a/bfd/libcoff.h b/bfd/libcoff.h index 3cac32a..5771132 100644 --- a/bfd/libcoff.h +++ b/bfd/libcoff.h @@ -305,11 +305,11 @@ struct coff_link_hash_table /* Functions in coffgen.c. */ extern const bfd_target *coff_object_p PARAMS ((bfd *)); -extern struct sec *coff_section_from_bfd_index +extern struct bfd_section *coff_section_from_bfd_index PARAMS ((bfd *, int)); extern long coff_get_symtab_upper_bound PARAMS ((bfd *)); -extern long coff_get_symtab +extern long coff_canonicalize_symtab PARAMS ((bfd *, asymbol **)); extern int coff_count_linenumbers PARAMS ((bfd *)); diff --git a/bfd/libecoff.h b/bfd/libecoff.h index 7fa5069..161f06c 100644 --- a/bfd/libecoff.h +++ b/bfd/libecoff.h @@ -1,5 +1,5 @@ /* BFD ECOFF object file private structure. - Copyright 1993, 1994, 1995, 1996, 1999, 2001, 2002 + Copyright 1993, 1994, 1995, 1996, 1999, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. @@ -299,7 +299,7 @@ extern bfd_boolean _bfd_ecoff_write_armap #define _bfd_ecoff_update_armap_timestamp bfd_true extern long _bfd_ecoff_get_symtab_upper_bound PARAMS ((bfd *abfd)); -extern long _bfd_ecoff_get_symtab PARAMS ((bfd *abfd, asymbol **alocation)); +extern long _bfd_ecoff_canonicalize_symtab PARAMS ((bfd *abfd, asymbol **alocation)); extern asymbol *_bfd_ecoff_make_empty_symbol PARAMS ((bfd *abfd)); extern void _bfd_ecoff_print_symbol PARAMS ((bfd *, PTR filep, asymbol *, bfd_print_symbol_type)); @@ -324,7 +324,7 @@ extern long _bfd_ecoff_canonicalize_reloc extern bfd_boolean _bfd_ecoff_set_arch_mach PARAMS ((bfd *, enum bfd_architecture, unsigned long)); extern bfd_boolean _bfd_ecoff_set_section_contents - PARAMS ((bfd *, asection *, PTR location, file_ptr, bfd_size_type)); + PARAMS ((bfd *, asection *, const PTR location, file_ptr, bfd_size_type)); extern int _bfd_ecoff_sizeof_headers PARAMS ((bfd *abfd, bfd_boolean reloc)); /* ecoff_bfd_get_relocated_section_contents defined by backend. */ diff --git a/bfd/libnlm.h b/bfd/libnlm.h index 314a21f..0a7b4d9 100644 --- a/bfd/libnlm.h +++ b/bfd/libnlm.h @@ -1,5 +1,5 @@ /* BFD back-end data structures for NLM (NetWare Loadable Modules) files. - Copyright 1993, 1994, 2001, 2002 Free Software Foundation, Inc. + Copyright 1993, 1994, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -61,7 +61,7 @@ extern void nlmNAME(get_symbol_info) PARAMS ((bfd *, asymbol *, symbol_info *)); extern long nlmNAME(get_symtab_upper_bound) PARAMS ((bfd *)); -extern long nlmNAME(get_symtab) +extern long nlmNAME(canonicalize_symtab) PARAMS ((bfd *, asymbol **)); extern asymbol *nlmNAME(make_empty_symbol) PARAMS ((bfd *)); @@ -76,7 +76,7 @@ extern const bfd_target *nlmNAME(object_p) extern bfd_boolean nlmNAME(set_arch_mach) PARAMS ((bfd *, enum bfd_architecture, unsigned long)); extern bfd_boolean nlmNAME(set_section_contents) - PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); + PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type)); extern bfd_boolean nlmNAME(write_object_contents) PARAMS ((bfd *)); @@ -188,7 +188,8 @@ struct nlm_backend_data /* To make objcopy to an i386 NLM work, the i386 backend needs a chance to work over the relocs. This is a bit icky. */ bfd_boolean (*nlm_mangle_relocs) - PARAMS ((bfd *, asection *, PTR data, bfd_vma offset, bfd_size_type count)); + PARAMS ((bfd *, asection *, const PTR data, bfd_vma offset, + bfd_size_type count)); /* Read an import record from abfd. It would be nice if this were in a machine-dependent format, but it doesn't seem to be. */ bfd_boolean (*nlm_read_import) PARAMS ((bfd *, nlmNAME(symbol_type) *)); diff --git a/bfd/linker.c b/bfd/linker.c index b7c5576..a1a8a4c 100644 --- a/bfd/linker.c +++ b/bfd/linker.c @@ -786,7 +786,7 @@ generic_link_add_object_symbols (bfd *abfd, bfd_boolean collect) { bfd_size_type symcount; - struct symbol_cache_entry **outsyms; + struct bfd_symbol **outsyms; if (! generic_link_read_symbols (abfd)) return FALSE; diff --git a/bfd/mach-o.c b/bfd/mach-o.c index 4c4736a..2dc8073 100644 --- a/bfd/mach-o.c +++ b/bfd/mach-o.c @@ -1,5 +1,5 @@ /* Mach-O support for BFD. - Copyright 1999, 2000, 2001, 2002 + Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -80,7 +80,7 @@ static long bfd_mach_o_count_symbols PARAMS ((bfd *)); static long bfd_mach_o_get_symtab_upper_bound PARAMS ((bfd *)); -static long bfd_mach_o_get_symtab +static long bfd_mach_o_canonicalize_symtab PARAMS ((bfd *, asymbol **)); static void bfd_mach_o_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *)); @@ -255,7 +255,7 @@ bfd_mach_o_get_symtab_upper_bound (abfd) } static long -bfd_mach_o_get_symtab (abfd, alocation) +bfd_mach_o_canonicalize_symtab (abfd, alocation) bfd *abfd; asymbol **alocation; { @@ -275,7 +275,7 @@ bfd_mach_o_get_symtab (abfd, alocation) if (bfd_mach_o_scan_read_symtab_symbols (abfd, &mdata->commands[i].command.symtab) != 0) { - fprintf (stderr, "bfd_mach_o_get_symtab: unable to load symbols for section %lu\n", i); + fprintf (stderr, "bfd_mach_o_canonicalize_symtab: unable to load symbols for section %lu\n", i); return 0; } diff --git a/bfd/merge.c b/bfd/merge.c index aa8b334..89f45cd 100644 --- a/bfd/merge.c +++ b/bfd/merge.c @@ -34,7 +34,7 @@ struct sec_merge_sec_info; struct sec_merge_hash_entry { struct bfd_hash_entry root; - /* Length of this entry. */ + /* Length of this entry. This includes the zero terminator. */ unsigned int len; /* Start of this string needs to be aligned to alignment octets (not 1 << align). */ @@ -43,8 +43,6 @@ struct sec_merge_hash_entry { /* Index within the merged section. */ bfd_size_type index; - /* Entity size (if present in suffix hash tables). */ - unsigned int entsize; /* Entry this is a suffix of (if alignment is 0). */ struct sec_merge_hash_entry *suffix; } u; @@ -205,9 +203,12 @@ sec_merge_hash_lookup (struct sec_merge_hash *table, const char *string, alignment, we need to insert another copy. */ if (hashp->alignment < alignment) { - /* Mark the less aligned copy as deleted. */ - hashp->len = 0; - hashp->alignment = 0; + if (create) + { + /* Mark the less aligned copy as deleted. */ + hashp->len = 0; + hashp->alignment = 0; + } break; } return hashp; @@ -287,7 +288,7 @@ sec_merge_add (struct sec_merge_hash *tab, const char *str, } static bfd_boolean -sec_merge_emit (register bfd *abfd, struct sec_merge_hash_entry *entry) +sec_merge_emit (bfd *abfd, struct sec_merge_hash_entry *entry) { struct sec_merge_sec_info *secinfo = entry->secinfo; asection *sec = secinfo->sec; @@ -420,79 +421,6 @@ _bfd_merge_section (bfd *abfd, void **psinfo, asection *sec, void **psecinfo) return FALSE; } -/* Compare two sec_merge_hash_entry structures. This is called via qsort. */ - -static int -cmplengthentry (const void *a, const void *b) -{ - struct sec_merge_hash_entry * A = *(struct sec_merge_hash_entry **) a; - struct sec_merge_hash_entry * B = *(struct sec_merge_hash_entry **) b; - - if (A->len < B->len) - return 1; - else if (A->len > B->len) - return -1; - - return memcmp (A->root.string, B->root.string, A->len); -} - -static int -last4_eq (const void *a, const void *b) -{ - struct sec_merge_hash_entry * A = (struct sec_merge_hash_entry *) a; - struct sec_merge_hash_entry * B = (struct sec_merge_hash_entry *) b; - - if (memcmp (A->root.string + A->len - 5 * A->u.entsize, - B->root.string + B->len - 5 * A->u.entsize, - 4 * A->u.entsize) != 0) - /* This was a hashtable collision. */ - return 0; - - if (A->len <= B->len) - /* B cannot be a suffix of A unless A is equal to B, which is guaranteed - not to be equal by the hash table. */ - return 0; - - if (A->alignment < B->alignment - || ((A->len - B->len) & (B->alignment - 1))) - /* The suffix is not sufficiently aligned. */ - return 0; - - return memcmp (A->root.string + (A->len - B->len), - B->root.string, B->len - 5 * A->u.entsize) == 0; -} - -static int -last_eq (const void *a, const void *b) -{ - struct sec_merge_hash_entry * A = (struct sec_merge_hash_entry *) a; - struct sec_merge_hash_entry * B = (struct sec_merge_hash_entry *) b; - - if (B->len >= 5 * A->u.entsize) - /* Longer strings are just pushed into the hash table, - they'll be used when looking up for very short strings. */ - return 0; - - if (memcmp (A->root.string + A->len - 2 * A->u.entsize, - B->root.string + B->len - 2 * A->u.entsize, - A->u.entsize) != 0) - /* This was a hashtable collision. */ - return 0; - - if (A->len <= B->len) - /* B cannot be a suffix of A unless A is equal to B, which is guaranteed - not to be equal by the hash table. */ - return 0; - - if (A->alignment < B->alignment - || ((A->len - B->len) & (B->alignment - 1))) - /* The suffix is not sufficiently aligned. */ - return 0; - - return memcmp (A->root.string + (A->len - B->len), - B->root.string, B->len - 2 * A->u.entsize) == 0; -} - /* Record one section into the hash table. */ static bfd_boolean record_section (struct sec_merge_info *sinfo, @@ -534,7 +462,7 @@ record_section (struct sec_merge_info *sinfo, goto error_return; } p++; - } + } } else { @@ -576,18 +504,81 @@ error_return: return FALSE; } +static int +strrevcmp (const void *a, const void *b) +{ + struct sec_merge_hash_entry *A = *(struct sec_merge_hash_entry **) a; + struct sec_merge_hash_entry *B = *(struct sec_merge_hash_entry **) b; + unsigned int lenA = A->len; + unsigned int lenB = B->len; + const unsigned char *s = A->root.string + lenA - 1; + const unsigned char *t = B->root.string + lenB - 1; + int l = lenA < lenB ? lenA : lenB; + + while (l) + { + if (*s != *t) + return (int) *s - (int) *t; + s--; + t--; + l--; + } + return lenA - lenB; +} + +/* Like strrevcmp, but for the case where all strings have the same + alignment > entsize. */ + +static int +strrevcmp_align (const void *a, const void *b) +{ + struct sec_merge_hash_entry *A = *(struct sec_merge_hash_entry **) a; + struct sec_merge_hash_entry *B = *(struct sec_merge_hash_entry **) b; + unsigned int lenA = A->len; + unsigned int lenB = B->len; + const unsigned char *s = A->root.string + lenA - 1; + const unsigned char *t = B->root.string + lenB - 1; + int l = lenA < lenB ? lenA : lenB; + int tail_align = (lenA & (A->alignment - 1)) - (lenB & (A->alignment - 1)); + + if (tail_align != 0) + return tail_align; + + while (l) + { + if (*s != *t) + return (int) *s - (int) *t; + s--; + t--; + l--; + } + return lenA - lenB; +} + +static inline int +is_suffix (const struct sec_merge_hash_entry *A, + const struct sec_merge_hash_entry *B) +{ + if (A->len <= B->len) + /* B cannot be a suffix of A unless A is equal to B, which is guaranteed + not to be equal by the hash table. */ + return 0; + + return memcmp (A->root.string + (A->len - B->len), + B->root.string, B->len) == 0; +} + /* This is a helper function for _bfd_merge_sections. It attempts to merge strings matching suffixes of longer strings. */ static void merge_strings (struct sec_merge_info *sinfo) { - struct sec_merge_hash_entry **array, **a, **end, *e; + struct sec_merge_hash_entry **array, **a, *e; struct sec_merge_sec_info *secinfo; - htab_t lasttab = NULL, last4tab = NULL; bfd_size_type size, amt; + unsigned int alignment = 0; - /* Now sort the strings by length, longest first. */ - array = NULL; + /* Now sort the strings */ amt = sinfo->htab->size * sizeof (struct sec_merge_hash_entry *); array = (struct sec_merge_hash_entry **) bfd_malloc (amt); if (array == NULL) @@ -595,90 +586,50 @@ merge_strings (struct sec_merge_info *sinfo) for (e = sinfo->htab->first, a = array; e; e = e->next) if (e->alignment) - *a++ = e; + { + *a++ = e; + /* Adjust the length to not include the zero terminator. */ + e->len -= sinfo->htab->entsize; + if (alignment != e->alignment) + { + if (alignment == 0) + alignment = e->alignment; + else + alignment = (unsigned) -1; + } + } sinfo->htab->size = a - array; - - qsort (array, (size_t) sinfo->htab->size, - sizeof (struct sec_merge_hash_entry *), cmplengthentry); - - last4tab = htab_create_alloc ((size_t) sinfo->htab->size * 4, - NULL, last4_eq, NULL, calloc, free); - lasttab = htab_create_alloc ((size_t) sinfo->htab->size * 4, - NULL, last_eq, NULL, calloc, free); - if (lasttab == NULL || last4tab == NULL) - goto alloc_failure; - - /* Now insert the strings into hash tables (strings with last 4 characters - and strings with last character equal), look for longer strings which - we're suffix of. */ - for (a = array, end = array + sinfo->htab->size; a < end; a++) + if (sinfo->htab->size != 0) { - register hashval_t hash; - unsigned int c; - unsigned int i; - const unsigned char *s; - void **p; - - e = *a; - e->u.entsize = sinfo->htab->entsize; - if (e->len <= e->u.entsize) - break; - if (e->len > 4 * e->u.entsize) + qsort (array, (size_t) sinfo->htab->size, + sizeof (struct sec_merge_hash_entry *), + (alignment != (unsigned) -1 && alignment > sinfo->htab->entsize + ? strrevcmp_align : strrevcmp)); + + /* Loop over the sorted array and merge suffixes */ + e = *--a; + e->len += sinfo->htab->entsize; + while (--a >= array) { - s = (const unsigned char *) (e->root.string + e->len - e->u.entsize); - hash = 0; - for (i = 0; i < 4 * e->u.entsize; i++) - { - c = *--s; - hash += c + (c << 17); - hash ^= hash >> 2; - } - p = htab_find_slot_with_hash (last4tab, e, hash, INSERT); - if (p == NULL) - goto alloc_failure; - if (*p) - { - struct sec_merge_hash_entry *ent; + struct sec_merge_hash_entry *cmp = *a; - ent = (struct sec_merge_hash_entry *) *p; - e->u.suffix = ent; - e->alignment = 0; - continue; + cmp->len += sinfo->htab->entsize; + if (e->alignment >= cmp->alignment + && !((e->len - cmp->len) & (cmp->alignment - 1)) + && is_suffix (e, cmp)) + { + cmp->u.suffix = e; + cmp->alignment = 0; } else - *p = e; + e = cmp; } - s = (const unsigned char *) (e->root.string + e->len - e->u.entsize); - hash = 0; - for (i = 0; i < e->u.entsize; i++) - { - c = *--s; - hash += c + (c << 17); - hash ^= hash >> 2; - } - p = htab_find_slot_with_hash (lasttab, e, hash, INSERT); - if (p == NULL) - goto alloc_failure; - if (*p) - { - struct sec_merge_hash_entry *ent; - - ent = (struct sec_merge_hash_entry *) *p; - e->u.suffix = ent; - e->alignment = 0; - } - else - *p = e; } alloc_failure: if (array) free (array); - if (lasttab) - htab_delete (lasttab); - if (last4tab) - htab_delete (last4tab); /* Now assign positions to the strings we want to keep. */ size = 0; @@ -787,11 +738,14 @@ _bfd_merge_sections (bfd *abfd ATTRIBUTE_UNUSED, void *xsinfo, secinfo->sec->_cooked_size = size; } - /* Finally shrink all input sections which have not made it into + /* Finally remove all input sections which have not made it into the hash table at all. */ for (secinfo = sinfo->chain; secinfo; secinfo = secinfo->next) if (secinfo->first == NULL) - secinfo->sec->_cooked_size = 0; + { + secinfo->sec->_cooked_size = 0; + secinfo->sec->flags |= SEC_EXCLUDE; + } } return TRUE; diff --git a/bfd/mipsbsd.c b/bfd/mipsbsd.c index af1ba55..59f231b 100644 --- a/bfd/mipsbsd.c +++ b/bfd/mipsbsd.c @@ -70,7 +70,7 @@ static bfd_boolean MY(write_object_contents) PARAMS ((bfd *abfd)); #include "aout-target.h" static bfd_reloc_status_type mips_fix_jmp_addr - PARAMS ((bfd *, arelent *, struct symbol_cache_entry *, PTR, asection *, + PARAMS ((bfd *, arelent *, struct bfd_symbol *, PTR, asection *, bfd *, char **)); static reloc_howto_type *MY(reloc_howto_type_lookup) PARAMS ((bfd *, bfd_reloc_code_real_type)); @@ -203,7 +203,7 @@ mips_fix_jmp_addr (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message) bfd *abfd ATTRIBUTE_UNUSED; arelent *reloc_entry; - struct symbol_cache_entry *symbol; + struct bfd_symbol *symbol; PTR data ATTRIBUTE_UNUSED; asection *input_section; bfd *output_bfd; @@ -401,14 +401,14 @@ static bfd_boolean mmo_get_section_contents PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); static long mmo_get_symtab_upper_bound PARAMS ((bfd *)); -static long mmo_get_symtab +static long mmo_canonicalize_symtab PARAMS ((bfd *, asymbol **)); static void mmo_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *)); static void mmo_print_symbol PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type)); static bfd_boolean mmo_set_section_contents - PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type)); + PARAMS ((bfd *, sec_ptr, const PTR, file_ptr, bfd_size_type)); static int mmo_sizeof_headers PARAMS ((bfd *, bfd_boolean)); static long mmo_get_reloc_upper_bound @@ -2200,7 +2200,7 @@ mmo_sort_mmo_symbols (arg1, arg2) /* Translate the symbol table. */ static long -mmo_get_symtab (abfd, alocation) +mmo_canonicalize_symtab (abfd, alocation) bfd *abfd; asymbol **alocation; { @@ -2613,7 +2613,7 @@ static bfd_boolean mmo_set_section_contents (abfd, sec, location, offset, bytes_to_do) bfd *abfd ATTRIBUTE_UNUSED; sec_ptr sec; - PTR location; + const PTR location; file_ptr offset; bfd_size_type bytes_to_do; { diff --git a/bfd/nlm-target.h b/bfd/nlm-target.h index e0a8304..70ae4f4 100644 --- a/bfd/nlm-target.h +++ b/bfd/nlm-target.h @@ -1,5 +1,5 @@ /* Target definitions for 32/64-bit NLM (NetWare Loadable Module) - Copyright 1993, 1994, 1998, 1999, 2000, 2001, 2002 + Copyright 1993, 1994, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define nlm_core_file_p _bfd_dummy_target #define nlm_get_symtab_upper_bound nlmNAME(get_symtab_upper_bound) -#define nlm_get_symtab nlmNAME(get_symtab) +#define nlm_canonicalize_symtab nlmNAME(canonicalize_symtab) #define nlm_make_empty_symbol nlmNAME(make_empty_symbol) #define nlm_print_symbol nlmNAME(print_symbol) #define nlm_get_symbol_info nlmNAME(get_symbol_info) @@ -1,5 +1,5 @@ /* NLM (NetWare Loadable Module) executable support for BFD. - Copyright 1993, 1994, 2001, 2002 Free Software Foundation, Inc. + Copyright 1993, 1994, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. diff --git a/bfd/nlm32-alpha.c b/bfd/nlm32-alpha.c index 7f74b52..bcaa6ab 100644 --- a/bfd/nlm32-alpha.c +++ b/bfd/nlm32-alpha.c @@ -1,5 +1,6 @@ /* Support for 32-bit Alpha NLM (NetWare Loadable Module) - Copyright 1993, 1994, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1993, 1994, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -40,7 +41,7 @@ static bfd_boolean nlm_alpha_write_prefix static bfd_boolean nlm_alpha_read_reloc PARAMS ((bfd *, nlmNAME(symbol_type) *, asection **, arelent *)); static bfd_boolean nlm_alpha_mangle_relocs - PARAMS ((bfd *, asection *, PTR, bfd_vma, bfd_size_type)); + PARAMS ((bfd *, asection *, const PTR, bfd_vma, bfd_size_type)); static bfd_boolean nlm_alpha_read_import PARAMS ((bfd *, nlmNAME(symbol_type) *)); static bfd_boolean nlm_alpha_write_import @@ -605,7 +606,7 @@ static bfd_boolean nlm_alpha_mangle_relocs (abfd, sec, data, offset, count) bfd *abfd ATTRIBUTE_UNUSED; asection *sec ATTRIBUTE_UNUSED; - PTR data ATTRIBUTE_UNUSED; + const PTR data ATTRIBUTE_UNUSED; bfd_vma offset ATTRIBUTE_UNUSED; bfd_size_type count ATTRIBUTE_UNUSED; { diff --git a/bfd/nlm32-i386.c b/bfd/nlm32-i386.c index ce9595e..d084d18 100644 --- a/bfd/nlm32-i386.c +++ b/bfd/nlm32-i386.c @@ -1,5 +1,6 @@ /* Support for 32-bit i386 NLM (NetWare Loadable Module) - Copyright 1993, 1994, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1993, 1994, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -33,7 +34,7 @@ static bfd_boolean nlm_i386_read_reloc static bfd_boolean nlm_i386_write_import PARAMS ((bfd *, asection *, arelent *)); static bfd_boolean nlm_i386_mangle_relocs - PARAMS ((bfd *, asection *, PTR, bfd_vma, bfd_size_type)); + PARAMS ((bfd *, asection *, const PTR, bfd_vma, bfd_size_type)); static bfd_boolean nlm_i386_read_import PARAMS ((bfd *, nlmNAME(symbol_type) *)); static bfd_boolean nlm_i386_write_external @@ -247,7 +248,7 @@ static bfd_boolean nlm_i386_mangle_relocs (abfd, sec, data, offset, count) bfd *abfd; asection *sec; - PTR data; + const PTR data; bfd_vma offset; bfd_size_type count; { diff --git a/bfd/nlm32-ppc.c b/bfd/nlm32-ppc.c index 9f5f9c0..aafe2cc 100644 --- a/bfd/nlm32-ppc.c +++ b/bfd/nlm32-ppc.c @@ -1,5 +1,6 @@ /* Support for 32-bit PowerPC NLM (NetWare Loadable Module) - Copyright 1994, 1995, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1994, 1995, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -41,7 +42,7 @@ static bfd_boolean nlm_powerpc_write_prefix static bfd_boolean nlm_powerpc_read_reloc PARAMS ((bfd *, nlmNAME(symbol_type) *, asection **, arelent *)); static bfd_boolean nlm_powerpc_mangle_relocs - PARAMS ((bfd *, asection *, PTR, bfd_vma, bfd_size_type)); + PARAMS ((bfd *, asection *, const PTR, bfd_vma, bfd_size_type)); static bfd_boolean nlm_powerpc_read_import PARAMS ((bfd *, nlmNAME(symbol_type) *)); @@ -641,7 +642,7 @@ static bfd_boolean nlm_powerpc_mangle_relocs (abfd, sec, data, offset, count) bfd *abfd ATTRIBUTE_UNUSED; asection *sec ATTRIBUTE_UNUSED; - PTR data ATTRIBUTE_UNUSED; + const PTR data ATTRIBUTE_UNUSED; bfd_vma offset ATTRIBUTE_UNUSED; bfd_size_type count ATTRIBUTE_UNUSED; { diff --git a/bfd/nlm32-sparc.c b/bfd/nlm32-sparc.c index 5094ed0..e973d42 100644 --- a/bfd/nlm32-sparc.c +++ b/bfd/nlm32-sparc.c @@ -1,5 +1,6 @@ /* Support for 32-bit SPARC NLM (NetWare Loadable Module) - Copyright 1993, 1994, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1993, 1994, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -33,7 +34,7 @@ static bfd_boolean nlm_sparc_read_reloc static bfd_boolean nlm_sparc_write_reloc PARAMS ((bfd *, asection *, arelent *)); static bfd_boolean nlm_sparc_mangle_relocs - PARAMS ((bfd *, asection *, PTR, bfd_vma, bfd_size_type)); + PARAMS ((bfd *, asection *, const PTR, bfd_vma, bfd_size_type)); static bfd_boolean nlm_sparc_read_import PARAMS ((bfd *, nlmNAME(symbol_type) *)); static bfd_boolean nlm_sparc_write_import @@ -237,7 +238,7 @@ static bfd_boolean nlm_sparc_mangle_relocs (abfd, sec, data, offset, count) bfd *abfd ATTRIBUTE_UNUSED; asection *sec ATTRIBUTE_UNUSED; - PTR data ATTRIBUTE_UNUSED; + const PTR data ATTRIBUTE_UNUSED; bfd_vma offset ATTRIBUTE_UNUSED; bfd_size_type count ATTRIBUTE_UNUSED; { diff --git a/bfd/nlmcode.h b/bfd/nlmcode.h index 5eeb41e..68e4a2a 100644 --- a/bfd/nlmcode.h +++ b/bfd/nlmcode.h @@ -1,5 +1,5 @@ /* NLM (NetWare Loadable Module) executable support for BFD. - Copyright 1993, 1994, 1995, 1998, 2000, 2001, 2002 + Copyright 1993, 1994, 1995, 1998, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Fred Fish @ Cygnus Support, using ELF support as the @@ -42,7 +42,7 @@ #define nlm_symbol_type nlmNAME(symbol_type) #define nlm_get_symtab_upper_bound nlmNAME(get_symtab_upper_bound) -#define nlm_get_symtab nlmNAME(get_symtab) +#define nlm_canonicalize_symtab nlmNAME(canonicalize_symtab) #define nlm_make_empty_symbol nlmNAME(make_empty_symbol) #define nlm_print_symbol nlmNAME(print_symbol) #define nlm_get_symbol_info nlmNAME(get_symbol_info) @@ -918,7 +918,7 @@ nlm_get_symtab_upper_bound (abfd) symbol table fails. */ long -nlm_get_symtab (abfd, alocation) +nlm_canonicalize_symtab (abfd, alocation) bfd *abfd; asymbol **alocation; { @@ -1568,7 +1568,7 @@ bfd_boolean nlm_set_section_contents (abfd, section, location, offset, count) bfd *abfd; asection *section; - PTR location; + const PTR location; file_ptr offset; bfd_size_type count; { @@ -1586,7 +1586,7 @@ nlm_set_section_contents (abfd, section, location, offset, count) if (section->reloc_count != 0) { bfd_boolean (*mangle_relocs_func) - PARAMS ((bfd *, asection *, PTR, bfd_vma, bfd_size_type)); + PARAMS ((bfd *, asection *, const PTR, bfd_vma, bfd_size_type)); mangle_relocs_func = nlm_mangle_relocs_func (abfd); if (mangle_relocs_func != NULL) diff --git a/bfd/oasys.c b/bfd/oasys.c index 3c39386..8c30197 100644 --- a/bfd/oasys.c +++ b/bfd/oasys.c @@ -70,7 +70,7 @@ static int comp static bfd_boolean oasys_write_object_contents PARAMS ((bfd *)); static bfd_boolean oasys_set_section_contents - PARAMS ((bfd *, sec_ptr, void *, file_ptr, bfd_size_type)); + PARAMS ((bfd *, sec_ptr, const void *, file_ptr, bfd_size_type)); static asymbol *oasys_make_empty_symbol PARAMS ((bfd *)); static bfd *oasys_openr_next_archived_file @@ -83,7 +83,7 @@ static int oasys_generic_stat_arch_elt static int oasys_sizeof_headers PARAMS ((bfd *, bfd_boolean)); -long oasys_get_symtab +long oasys_canonicalize_symtab PARAMS ((bfd *, asymbol **)); long oasys_canonicalize_reloc PARAMS ((bfd *, sec_ptr, arelent **, asymbol **)); @@ -271,7 +271,7 @@ oasys_get_symtab_upper_bound (abfd) extern const bfd_target oasys_vec; long -oasys_get_symtab (abfd, location) +oasys_canonicalize_symtab (abfd, location) bfd *abfd; asymbol **location; { @@ -1346,7 +1346,7 @@ static bfd_boolean oasys_set_section_contents (abfd, section, location, offset, count) bfd *abfd; sec_ptr section; - PTR location; + const PTR location; file_ptr offset; bfd_size_type count; { diff --git a/bfd/opncls.c b/bfd/opncls.c index 086775b..34b39ae 100644 --- a/bfd/opncls.c +++ b/bfd/opncls.c @@ -1024,7 +1024,7 @@ FUNCTION bfd_create_gnu_debuglink_section SYNOPSIS - struct sec *bfd_create_gnu_debuglink_section + struct bfd_section *bfd_create_gnu_debuglink_section (bfd *abfd, const char *filename); DESCRIPTION @@ -1089,7 +1089,7 @@ FUNCTION SYNOPSIS bfd_boolean bfd_fill_in_gnu_debuglink_section - (bfd *abfd, struct sec *sect, const char *filename); + (bfd *abfd, struct bfd_section *sect, const char *filename); DESCRIPTION @@ -1105,7 +1105,7 @@ RETURNS bfd_boolean bfd_fill_in_gnu_debuglink_section (bfd *abfd, - struct sec *sect, + struct bfd_section *sect, const char *filename) { bfd_size_type debuglink_size; diff --git a/bfd/pdp11.c b/bfd/pdp11.c index 52f7b70..3d009ba 100644 --- a/bfd/pdp11.c +++ b/bfd/pdp11.c @@ -1429,7 +1429,7 @@ bfd_boolean NAME(aout,set_section_contents) (abfd, section, location, offset, count) bfd *abfd; sec_ptr section; - PTR location; + const PTR location; file_ptr offset; bfd_size_type count; { @@ -2008,7 +2008,7 @@ error_return: long -NAME(aout,get_symtab) (abfd, location) +NAME(aout,canonicalize_symtab) (abfd, location) bfd *abfd; asymbol **location; { diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c index 7f1a6a3..f3b3a96 100644 --- a/bfd/peXXigen.c +++ b/bfd/peXXigen.c @@ -570,8 +570,7 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out) struct internal_extra_pe_aouthdr *extra = &pe->pe_opthdr; PEAOUTHDR *aouthdr_out = (PEAOUTHDR *) out; bfd_vma sa, fa, ib; - IMAGE_DATA_DIRECTORY idata2, idata5; - + IMAGE_DATA_DIRECTORY idata2, idata5, tls; if (pe->force_minimum_alignment) { @@ -590,6 +589,7 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out) idata2 = pe->pe_opthdr.DataDirectory[1]; idata5 = pe->pe_opthdr.DataDirectory[12]; + tls = pe->pe_opthdr.DataDirectory[9]; if (aouthdr_in->tsize) { @@ -641,6 +641,7 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out) a final link is going to be performed, it can overwrite them. */ extra->DataDirectory[1] = idata2; extra->DataDirectory[12] = idata5; + extra->DataDirectory[9] = tls; if (extra->DataDirectory[1].VirtualAddress == 0) /* Until other .idata fixes are made (pending patch), the entry for @@ -674,7 +675,9 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out) 5.0 link.exe) where the file size of the .data segment is quite small compared to the virtual size. Without this fix, strip munges the file. */ - isize += SA (FA (pei_section_data (abfd, sec)->virt_size)); + if (coff_section_data (abfd, sec) != NULL + && pei_section_data (abfd, sec) != NULL) + isize += SA (FA (pei_section_data (abfd, sec)->virt_size)); } aouthdr_in->dsize = dsize; @@ -990,7 +993,11 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out) ret = 0; } - if (scnhdr_int->s_nreloc <= 0xffff) + /* Although we could encode 0xffff relocs here, we do not, to be + consistent with other parts of bfd. Also it lets us warn, as + we should never see 0xffff here w/o having the overflow flag + set. */ + if (scnhdr_int->s_nreloc < 0xffff) H_PUT_16 (abfd, scnhdr_int->s_nreloc, scnhdr_ext->s_nreloc); else { @@ -2019,7 +2026,19 @@ _bfd_XXi_final_link_postscript (abfd, pfinfo) + h1->root.u.def.section->output_offset) - pe_data (abfd)->pe_opthdr.DataDirectory[12].VirtualAddress); } - + + h1 = coff_link_hash_lookup (coff_hash_table (info), + "__tls_used", FALSE, FALSE, TRUE); + if (h1 != NULL) + { + pe_data (abfd)->pe_opthdr.DataDirectory[9].VirtualAddress = + (h1->root.u.def.value + + h1->root.u.def.section->output_section->vma + + h1->root.u.def.section->output_offset + - pe_data (abfd)->pe_opthdr.ImageBase); + pe_data (abfd)->pe_opthdr.DataDirectory[9].Size = 0x18; + } + /* If we couldn't find idata$2, we either have an excessively trivial program or are in DEEP trouble; we have to assume trivial program.... */ @@ -76,7 +76,7 @@ static int bfd_pef_parse_function_stubs PARAMS ((bfd *, asection *, unsig static long bfd_pef_parse_symbols PARAMS ((bfd *, asymbol **)); static long bfd_pef_count_symbols PARAMS ((bfd *)); static long bfd_pef_get_symtab_upper_bound PARAMS ((bfd *)); -static long bfd_pef_get_symtab PARAMS ((bfd *, asymbol **)); +static long bfd_pef_canonicalize_symtab PARAMS ((bfd *, asymbol **)); static asymbol *bfd_pef_make_empty_symbol PARAMS ((bfd *)); static void bfd_pef_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *)); static int bfd_pef_sizeof_headers PARAMS ((bfd *, bfd_boolean)); @@ -1027,7 +1027,7 @@ bfd_pef_get_symtab_upper_bound (abfd) } static long -bfd_pef_get_symtab (abfd, alocation) +bfd_pef_canonicalize_symtab (abfd, alocation) bfd *abfd; asymbol **alocation; { diff --git a/bfd/peicode.h b/bfd/peicode.h index b3c1f29..41fcbbc 100644 --- a/bfd/peicode.h +++ b/bfd/peicode.h @@ -135,7 +135,7 @@ static asection_ptr pe_ILF_make_a_section PARAMS ((pe_ILF_vars *, const static void pe_ILF_make_a_reloc PARAMS ((pe_ILF_vars *, bfd_vma, bfd_reloc_code_real_type, asection_ptr)); static void pe_ILF_make_a_symbol PARAMS ((pe_ILF_vars *, const char *, const char *, asection_ptr, flagword)); static void pe_ILF_save_relocs PARAMS ((pe_ILF_vars *, asection_ptr)); -static void pe_ILF_make_a_symbol_reloc PARAMS ((pe_ILF_vars *, bfd_vma, bfd_reloc_code_real_type, struct symbol_cache_entry **, unsigned int)); +static void pe_ILF_make_a_symbol_reloc PARAMS ((pe_ILF_vars *, bfd_vma, bfd_reloc_code_real_type, struct bfd_symbol **, unsigned int)); static bfd_boolean pe_ILF_build_a_bfd PARAMS ((bfd *, unsigned int, bfd_byte *, bfd_byte *, unsigned int, unsigned int)); static const bfd_target * pe_ILF_object_p PARAMS ((bfd *)); static const bfd_target * pe_bfd_object_p PARAMS ((bfd *)); @@ -258,12 +258,12 @@ coff_swap_scnhdr_in (abfd, ext, in) #ifndef COFF_NO_HACK_SCNHDR_SIZE /* If this section holds uninitialized data and is from an object file or from an executable image that has not initialized the field, - or if the physical size is padded, use the virtual size (stored in - s_paddr) instead. */ + or if the image is an executable file and the physical size is padded, + use the virtual size (stored in s_paddr) instead. */ if (scnhdr_int->s_paddr > 0 && (((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0 - && (! bfd_pe_executable_p (abfd) || scnhdr_int->s_size == 0)) - || scnhdr_int->s_size > scnhdr_int->s_paddr)) + && (! bfd_pe_executable_p (abfd) || scnhdr_int->s_size == 0)) + || (bfd_pe_executable_p (abfd) && scnhdr_int->s_size > scnhdr_int->s_paddr))) { scnhdr_int->s_size = scnhdr_int->s_paddr; @@ -470,7 +470,7 @@ static void pe_ILF_make_a_symbol_reloc (pe_ILF_vars * vars, bfd_vma address, bfd_reloc_code_real_type reloc, - struct symbol_cache_entry ** sym, + struct bfd_symbol ** sym, unsigned int sym_index) { arelent * entry; @@ -967,11 +967,11 @@ pe_ILF_build_a_bfd (bfd * abfd, if (magic == MIPS_ARCH_MAGIC_WINCE) { pe_ILF_make_a_symbol_reloc (&vars, (bfd_vma) 0, BFD_RELOC_HI16_S, - (struct symbol_cache_entry **) imp_sym, + (struct bfd_symbol **) imp_sym, imp_index); pe_ILF_make_a_reloc (&vars, (bfd_vma) 0, BFD_RELOC_LO16, text); pe_ILF_make_a_symbol_reloc (&vars, (bfd_vma) 4, BFD_RELOC_LO16, - (struct symbol_cache_entry **) imp_sym, + (struct bfd_symbol **) imp_sym, imp_index); } else diff --git a/bfd/ppcboot.c b/bfd/ppcboot.c index a4fe0ca..05fb7de 100644 --- a/bfd/ppcboot.c +++ b/bfd/ppcboot.c @@ -1,5 +1,5 @@ /* BFD back-end for PPCbug boot records. - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Michael Meissner, Cygnus Support, <meissner@cygnus.com> @@ -95,10 +95,10 @@ static bfd_boolean ppcboot_get_section_contents PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); static long ppcboot_get_symtab_upper_bound PARAMS ((bfd *)); static char *mangle_name PARAMS ((bfd *, char *)); -static long ppcboot_get_symtab PARAMS ((bfd *, asymbol **)); +static long ppcboot_canonicalize_symtab PARAMS ((bfd *, asymbol **)); static void ppcboot_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *)); static bfd_boolean ppcboot_set_section_contents - PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); + PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type)); static int ppcboot_sizeof_headers PARAMS ((bfd *, bfd_boolean)); static bfd_boolean ppcboot_bfd_print_private_bfd_data PARAMS ((bfd *, PTR)); @@ -287,7 +287,7 @@ mangle_name (abfd, suffix) /* Return the symbol table. */ static long -ppcboot_get_symtab (abfd, alocation) +ppcboot_canonicalize_symtab (abfd, alocation) bfd *abfd; asymbol **alocation; { @@ -364,7 +364,7 @@ static bfd_boolean ppcboot_set_section_contents (abfd, sec, data, offset, size) bfd *abfd; asection *sec; - PTR data; + const PTR data; file_ptr offset; bfd_size_type size; { diff --git a/bfd/reloc.c b/bfd/reloc.c index 6318190..8fdca41 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -98,7 +98,7 @@ CODE_FRAGMENT .typedef struct reloc_cache_entry .{ . {* A pointer into the canonical table of pointers. *} -. struct symbol_cache_entry **sym_ptr_ptr; +. struct bfd_symbol **sym_ptr_ptr; . . {* offset in section. *} . bfd_size_type address; @@ -122,15 +122,16 @@ DESCRIPTION o <<sym_ptr_ptr>> The symbol table pointer points to a pointer to the symbol - associated with the relocation request. It is - the pointer into the table returned by the back end's - <<get_symtab>> action. @xref{Symbols}. The symbol is referenced - through a pointer to a pointer so that tools like the linker - can fix up all the symbols of the same name by modifying only - one pointer. The relocation routine looks in the symbol and - uses the base of the section the symbol is attached to and the - value of the symbol as the initial relocation offset. If the - symbol pointer is zero, then the section provided is looked up. + associated with the relocation request. It is the pointer + into the table returned by the back end's + <<canonicalize_symtab>> action. @xref{Symbols}. The symbol is + referenced through a pointer to a pointer so that tools like + the linker can fix up all the symbols of the same name by + modifying only one pointer. The relocation routine looks in + the symbol and uses the base of the section the symbol is + attached to and the value of the symbol as the initial + relocation offset. If the symbol pointer is zero, then the + section provided is looked up. o <<address>> @@ -277,7 +278,7 @@ SUBSUBSECTION information that libbfd needs to know to tie up a back end's data. CODE_FRAGMENT -.struct symbol_cache_entry; {* Forward declaration. *} +.struct bfd_symbol; {* Forward declaration. *} . .struct reloc_howto_struct .{ @@ -321,7 +322,7 @@ CODE_FRAGMENT . strange relocation methods to be accomodated (e.g., i960 callj . instructions). *} . bfd_reloc_status_type (*special_function) -. (bfd *, arelent *, struct symbol_cache_entry *, void *, asection *, +. (bfd *, arelent *, struct bfd_symbol *, void *, asection *, . bfd *, char **); . . {* The textual name of the relocation type. *} @@ -3132,6 +3133,8 @@ ENUMX BFD_RELOC_MMIX_PUSHJ_2 ENUMX BFD_RELOC_MMIX_PUSHJ_3 +ENUMX + BFD_RELOC_MMIX_PUSHJ_STUBBABLE ENUMDOC These are relocations for the PUSHJ instruction. ENUM @@ -4029,7 +4032,8 @@ SYNOPSIS DESCRIPTION Provides default handling for relaxing for back ends which - don't do relaxing -- i.e., does nothing. + don't do relaxing -- i.e., does nothing except make sure that the + final size of the section is set. */ bfd_boolean @@ -4038,6 +4042,11 @@ bfd_generic_relax_section (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *link_info ATTRIBUTE_UNUSED, bfd_boolean *again) { + /* We're not relaxing the section, so just copy the size info if it's + zero. Someone else, like bfd_merge_sections, might have set it, so + don't overwrite a non-zero value. */ + if (section->_cooked_size == 0) + section->_cooked_size = section->_raw_size; *again = FALSE; return TRUE; } @@ -4132,8 +4141,13 @@ bfd_generic_get_relocated_section_contents (bfd *abfd, input_section->_raw_size)) goto error_return; - /* We're not relaxing the section, so just copy the size info. */ - input_section->_cooked_size = input_section->_raw_size; + /* Don't set input_section->_cooked_size here. The caller has set + _cooked_size or called bfd_relax_section, which sets _cooked_size. + Despite using this generic relocation function, some targets perform + target-specific relaxation or string merging, which happens before + this function is called. We do not want to clobber the _cooked_size + they computed. */ + input_section->reloc_done = TRUE; reloc_count = bfd_canonicalize_reloc (input_bfd, diff --git a/bfd/section.c b/bfd/section.c index 5347c2b..e99062a 100644 --- a/bfd/section.c +++ b/bfd/section.c @@ -166,7 +166,7 @@ CODE_FRAGMENT . long symbol; .}; . -.typedef struct sec +.typedef struct bfd_section .{ . {* The name of the section; the name isn't a copy, the pointer is . the same as that passed to bfd_make_section. *} @@ -179,7 +179,7 @@ CODE_FRAGMENT . int index; . . {* The next section in the list belonging to the BFD, or NULL. *} -. struct sec *next; +. struct bfd_section *next; . . {* The field flags contains attributes of the section. Some . flags are read in from the object file, and some are @@ -402,7 +402,7 @@ CODE_FRAGMENT . {* Nonzero if this section has a gp reloc. *} . unsigned int has_gp_reloc:1; . -. {* Usused bits. *} +. {* Unused bits. *} . unsigned int flag13:1; . unsigned int flag14:1; . unsigned int flag15:1; @@ -445,7 +445,7 @@ CODE_FRAGMENT . bfd_vma output_offset; . . {* The output section through which to map on output. *} -. struct sec *output_section; +. struct bfd_section *output_section; . . {* The alignment requirement of the section, as an exponent of 2 - . e.g., 3 aligns to 2^3 (or 8). *} @@ -495,7 +495,7 @@ CODE_FRAGMENT . . {* Points to the kept section if this section is a link-once section, . and is discarded. *} -. struct sec *kept_section; +. struct bfd_section *kept_section; . . {* When a section is being output, this value changes as more . linenumbers are written out. *} @@ -514,8 +514,8 @@ CODE_FRAGMENT . bfd *owner; . . {* A symbol which points at this section only. *} -. struct symbol_cache_entry *symbol; -. struct symbol_cache_entry **symbol_ptr_ptr; +. struct bfd_symbol *symbol; +. struct bfd_symbol **symbol_ptr_ptr; . . struct bfd_link_order *link_order_head; . struct bfd_link_order *link_order_tail; @@ -553,13 +553,12 @@ CODE_FRAGMENT . || ((SEC) == bfd_com_section_ptr) \ . || ((SEC) == bfd_ind_section_ptr)) . -.extern const struct symbol_cache_entry * const bfd_abs_symbol; -.extern const struct symbol_cache_entry * const bfd_com_symbol; -.extern const struct symbol_cache_entry * const bfd_und_symbol; -.extern const struct symbol_cache_entry * const bfd_ind_symbol; +.extern const struct bfd_symbol * const bfd_abs_symbol; +.extern const struct bfd_symbol * const bfd_com_symbol; +.extern const struct bfd_symbol * const bfd_und_symbol; +.extern const struct bfd_symbol * const bfd_ind_symbol; .#define bfd_get_section_size_before_reloc(section) \ -. ((section)->reloc_done ? (abort (), (bfd_size_type) 1) \ -. : (section)->_raw_size) +. ((section)->_raw_size) .#define bfd_get_section_size_after_reloc(section) \ . ((section)->reloc_done ? (section)->_cooked_size \ . : (abort (), (bfd_size_type) 1)) @@ -636,7 +635,7 @@ static const asymbol global_syms[] = 0, 0, 0, 0, \ \ /* output_offset, output_section, alignment_power, */ \ - 0, (struct sec *) &SEC, 0, \ + 0, (struct bfd_section *) &SEC, 0, \ \ /* relocation, orelocation, reloc_count, filepos, rel_filepos, */ \ NULL, NULL, 0, 0, 0, \ @@ -651,10 +650,10 @@ static const asymbol global_syms[] = 0, NULL, NULL, NULL, \ \ /* symbol, */ \ - (struct symbol_cache_entry *) &global_syms[IDX], \ + (struct bfd_symbol *) &global_syms[IDX], \ \ /* symbol_ptr_ptr, */ \ - (struct symbol_cache_entry **) &SYM, \ + (struct bfd_symbol **) &SYM, \ \ /* link_order_head, link_order_tail */ \ NULL, NULL \ @@ -1133,8 +1132,8 @@ FUNCTION SYNOPSIS bfd_boolean bfd_set_section_contents - (bfd *abfd, asection *section, void *data, file_ptr offset, - bfd_size_type count); + (bfd *abfd, asection *section, const void *data, + file_ptr offset, bfd_size_type count); DESCRIPTION Sets the contents of the section @var{section} in BFD @@ -1162,7 +1161,7 @@ DESCRIPTION bfd_boolean bfd_set_section_contents (bfd *abfd, sec_ptr section, - void *location, + const void *location, file_ptr offset, bfd_size_type count) { diff --git a/bfd/simple.c b/bfd/simple.c index c2a741c..afed604 100644 --- a/bfd/simple.c +++ b/bfd/simple.c @@ -185,7 +185,7 @@ bfd_simple_get_relocated_section_contents (bfd *abfd, memset (&link_info, 0, sizeof (link_info)); link_info.input_bfds = abfd; - link_info.hash = bfd_link_hash_table_create (abfd); + link_info.hash = _bfd_generic_link_hash_table_create (abfd); link_info.callbacks = &callbacks; callbacks.warning = simple_dummy_warning; callbacks.undefined_symbol = simple_dummy_undefined_symbol; @@ -265,7 +265,7 @@ bfd_simple_get_relocated_section_contents (bfd *abfd, bfd_map_over_sections (abfd, simple_restore_output_info, saved_offsets); free (saved_offsets); - bfd_link_hash_table_free (abfd, link_info.hash); + _bfd_generic_link_hash_table_free (link_info.hash); RETURN (contents); } @@ -175,7 +175,7 @@ static unsigned int som_set_reloc_info asymbol **, bfd_boolean)); static bfd_boolean som_slurp_reloc_table PARAMS ((bfd *, asection *, asymbol **, bfd_boolean)); -static long som_get_symtab +static long som_canonicalize_symtab PARAMS ((bfd *, asymbol **)); static asymbol * som_make_empty_symbol PARAMS ((bfd *)); @@ -4520,7 +4520,7 @@ som_slurp_symbol_table (abfd) in the symbol table. */ static long -som_get_symtab (abfd, location) +som_canonicalize_symtab (abfd, location) bfd *abfd; asymbol **location; { @@ -1,6 +1,6 @@ /* HP PA-RISC SOM object file format: definitions internal to BFD. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001, - 2002 Free Software Foundation, Inc. + 2002, 2003 Free Software Foundation, Inc. Contributed by the Center for Software Science at the University of Utah (pa-gdb-bugs@cs.utah.edu). diff --git a/bfd/sparclynx.c b/bfd/sparclynx.c index 6be9a44..a7d78c6 100644 --- a/bfd/sparclynx.c +++ b/bfd/sparclynx.c @@ -245,7 +245,7 @@ static const struct aout_backend_data sparclynx_aout_backend = #define MY_bfd_debug_info_start bfd_void #define MY_bfd_debug_info_end bfd_void #define MY_bfd_debug_info_accumulate \ - (void (*) PARAMS ((bfd *, struct sec *))) bfd_void + (void (*) PARAMS ((bfd *, struct bfd_section *))) bfd_void #define MY_write_object_contents NAME(aout,sparclynx_write_object_contents) #define MY_backend_data &sparclynx_aout_backend @@ -1,6 +1,6 @@ /* BFD back-end for s-record objects. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002 + 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>. @@ -132,13 +132,13 @@ static bfd_boolean srec_get_section_contents static bfd_boolean srec_set_arch_mach PARAMS ((bfd *, enum bfd_architecture, unsigned long)); static bfd_boolean srec_set_section_contents - PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type)); + PARAMS ((bfd *, sec_ptr, const PTR, file_ptr, bfd_size_type)); static bfd_boolean internal_srec_write_object_contents PARAMS ((bfd *, int)); static bfd_boolean srec_write_object_contents PARAMS ((bfd *)); static bfd_boolean symbolsrec_write_object_contents PARAMS ((bfd *)); static int srec_sizeof_headers PARAMS ((bfd *, bfd_boolean)); static long srec_get_symtab_upper_bound PARAMS ((bfd *)); -static long srec_get_symtab PARAMS ((bfd *, asymbol **)); +static long srec_canonicalize_symtab PARAMS ((bfd *, asymbol **)); /* Macros for converting between hex and binary. */ @@ -872,7 +872,7 @@ static bfd_boolean srec_set_section_contents (abfd, section, location, offset, bytes_to_do) bfd *abfd; sec_ptr section; - PTR location; + const PTR location; file_ptr offset; bfd_size_type bytes_to_do; { @@ -1188,7 +1188,7 @@ srec_get_symtab_upper_bound (abfd) /* Return the symbol table. */ static long -srec_get_symtab (abfd, alocation) +srec_canonicalize_symtab (abfd, alocation) bfd *abfd; asymbol **alocation; { diff --git a/bfd/stabs.c b/bfd/stabs.c index 6e6d290..193fc58 100644 --- a/bfd/stabs.c +++ b/bfd/stabs.c @@ -1,5 +1,5 @@ /* Stabs in sections linking support. - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. @@ -169,12 +169,13 @@ stab_link_includes_newfunc (entry, table, string) pass of the linker. */ bfd_boolean -_bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo) +_bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_offset) bfd *abfd; PTR *psinfo; asection *stabsec; asection *stabstrsec; PTR *psecinfo; + bfd_size_type *pstring_offset; { bfd_boolean first; struct stab_info *sinfo; @@ -276,7 +277,11 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo) and identify N_BINCL symbols which can be eliminated. */ stroff = 0; - next_stroff = 0; + /* The stabs sections can be split when + -split-by-reloc/-split-by-file is used. We must keep track of + each stab section's place in the single concatenated string + table. */ + next_stroff = pstring_offset ? *pstring_offset : 0; skip = 0; symend = stabbuf + stabsec->_raw_size; @@ -302,6 +307,8 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo) string table. We only copy the very first one. */ stroff = next_stroff; next_stroff += bfd_get_32 (abfd, sym + 8); + if (pstring_offset) + *pstring_offset = next_stroff; if (! first) { *pstridx = (bfd_size_type) -1; @@ -181,7 +181,7 @@ SUBSECTION CODE_FRAGMENT . -.typedef struct symbol_cache_entry +.typedef struct bfd_symbol .{ . {* A pointer to the BFD which owns the symbol. This information . is necessary so that a back end can work out what additional @@ -293,7 +293,7 @@ CODE_FRAGMENT . {* A pointer to the section to which this symbol is . relative. This will always be non NULL, there are special . sections for undefined and absolute symbols. *} -. struct sec *section; +. struct bfd_section *section; . . {* Back end special data. *} . union @@ -581,7 +581,7 @@ coff_section_type (const char *s) we could perhaps obsolete coff_section_type. */ static char -decode_section_type (const struct sec *section) +decode_section_type (const struct bfd_section *section) { if (section->flags & SEC_CODE) return 't'; diff --git a/bfd/sysdep.h b/bfd/sysdep.h index 1338d6b..1954470 100644 --- a/bfd/sysdep.h +++ b/bfd/sysdep.h @@ -1,5 +1,5 @@ /* sysdep.h -- handle host dependencies for the BFD library - Copyright 1995, 1996, 1997, 1998, 1999, 2000 + Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Written by Cygnus Support. diff --git a/bfd/targets.c b/bfd/targets.c index c3212a9..a173857 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -328,7 +328,7 @@ BFD_JUMP_TABLE macros. . {* Entry points used for symbols. *} .#define BFD_JUMP_TABLE_SYMBOLS(NAME) \ . NAME##_get_symtab_upper_bound, \ -. NAME##_get_symtab, \ +. NAME##_canonicalize_symtab, \ . NAME##_make_empty_symbol, \ . NAME##_print_symbol, \ . NAME##_get_symbol_info, \ @@ -341,20 +341,20 @@ BFD_JUMP_TABLE macros. . . long (*_bfd_get_symtab_upper_bound) (bfd *); . long (*_bfd_canonicalize_symtab) -. (bfd *, struct symbol_cache_entry **); -. struct symbol_cache_entry * +. (bfd *, struct bfd_symbol **); +. struct bfd_symbol * . (*_bfd_make_empty_symbol) (bfd *); . void (*_bfd_print_symbol) -. (bfd *, void *, struct symbol_cache_entry *, bfd_print_symbol_type); +. (bfd *, void *, struct bfd_symbol *, bfd_print_symbol_type); .#define bfd_print_symbol(b,p,s,e) BFD_SEND (b, _bfd_print_symbol, (b,p,s,e)) . void (*_bfd_get_symbol_info) -. (bfd *, struct symbol_cache_entry *, symbol_info *); +. (bfd *, struct bfd_symbol *, symbol_info *); .#define bfd_get_symbol_info(b,p,e) BFD_SEND (b, _bfd_get_symbol_info, (b,p,e)) . bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *); . -. alent * (*_get_lineno) (bfd *, struct symbol_cache_entry *); +. alent * (*_get_lineno) (bfd *, struct bfd_symbol *); . bfd_boolean (*_bfd_find_nearest_line) -. (bfd *, struct sec *, struct symbol_cache_entry **, bfd_vma, +. (bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma, . const char **, const char **, unsigned int *); . {* Back-door to allow format-aware applications to create debug symbols . while using BFD for everything else. Currently used by the assembler @@ -378,7 +378,7 @@ BFD_JUMP_TABLE macros. . . long (*_get_reloc_upper_bound) (bfd *, sec_ptr); . long (*_bfd_canonicalize_reloc) -. (bfd *, sec_ptr, arelent **, struct symbol_cache_entry **); +. (bfd *, sec_ptr, arelent **, struct bfd_symbol **); . {* See documentation on reloc types. *} . reloc_howto_type * . (*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type); @@ -391,7 +391,7 @@ BFD_JUMP_TABLE macros. . bfd_boolean (*_bfd_set_arch_mach) . (bfd *, enum bfd_architecture, unsigned long); . bfd_boolean (*_bfd_set_section_contents) -. (bfd *, sec_ptr, void *, file_ptr, bfd_size_type); +. (bfd *, sec_ptr, const void *, file_ptr, bfd_size_type); . . {* Routines used by the linker. *} .#define BFD_JUMP_TABLE_LINK(NAME) \ @@ -411,10 +411,10 @@ BFD_JUMP_TABLE macros. . int (*_bfd_sizeof_headers) (bfd *, bfd_boolean); . bfd_byte * (*_bfd_get_relocated_section_contents) . (bfd *, struct bfd_link_info *, struct bfd_link_order *, -. bfd_byte *, bfd_boolean, struct symbol_cache_entry **); +. bfd_byte *, bfd_boolean, struct bfd_symbol **); . . bfd_boolean (*_bfd_relax_section) -. (bfd *, struct sec *, struct bfd_link_info *, bfd_boolean *); +. (bfd *, struct bfd_section *, struct bfd_link_info *, bfd_boolean *); . . {* Create a hash table for the linker. Different backends store . different information in this table. *} @@ -435,7 +435,7 @@ BFD_JUMP_TABLE macros. . bfd_boolean (*_bfd_final_link) (bfd *, struct bfd_link_info *); . . {* Should this section be split up into smaller pieces during linking. *} -. bfd_boolean (*_bfd_link_split_section) (bfd *, struct sec *); +. bfd_boolean (*_bfd_link_split_section) (bfd *, struct bfd_section *); . . {* Remove sections that are not referenced from the output. *} . bfd_boolean (*_bfd_gc_sections) (bfd *, struct bfd_link_info *); @@ -444,7 +444,7 @@ BFD_JUMP_TABLE macros. . bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *); . . {* Discard members of a group. *} -. bfd_boolean (*_bfd_discard_group) (bfd *, struct sec *); +. bfd_boolean (*_bfd_discard_group) (bfd *, struct bfd_section *); . . {* Routines to handle dynamic symbols and relocs. *} .#define BFD_JUMP_TABLE_DYNAMIC(NAME) \ @@ -457,12 +457,12 @@ BFD_JUMP_TABLE macros. . long (*_bfd_get_dynamic_symtab_upper_bound) (bfd *); . {* Read in the dynamic symbols. *} . long (*_bfd_canonicalize_dynamic_symtab) -. (bfd *, struct symbol_cache_entry **); +. (bfd *, struct bfd_symbol **); . {* Get the amount of memory required to hold the dynamic relocs. *} . long (*_bfd_get_dynamic_reloc_upper_bound) (bfd *); . {* Read in the dynamic relocs. *} . long (*_bfd_canonicalize_dynamic_reloc) -. (bfd *, arelent **, struct symbol_cache_entry **); +. (bfd *, arelent **, struct bfd_symbol **); . A pointer to an alternative bfd_target in case the current one is not @@ -898,9 +898,7 @@ static const bfd_target * const _bfd_target_vector[] = { &bfd_elf64_sh64nbsd_vec, &bfd_elf64_sh64lin_vec, &bfd_elf64_sh64blin_vec, -#if 0 &bfd_elf64_sparc_vec, -#endif &bfd_elf64_tradbigmips_vec, &bfd_elf64_tradlittlemips_vec, &bfd_elf64_x86_64_vec, diff --git a/bfd/tekhex.c b/bfd/tekhex.c index 77b471a..32c3d97 100644 --- a/bfd/tekhex.c +++ b/bfd/tekhex.c @@ -1,5 +1,5 @@ /* BFD backend for Extended Tektronix Hex Format objects. - Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 + Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>. @@ -110,17 +110,17 @@ static void out PARAMS ((bfd *, int, char *, char *)); static void writesym PARAMS ((char **, const char *)); static void writevalue PARAMS ((char **, bfd_vma)); static bfd_boolean tekhex_set_section_contents - PARAMS ((bfd*, sec_ptr, PTR, file_ptr, bfd_size_type)); + PARAMS ((bfd*, sec_ptr, const PTR, file_ptr, bfd_size_type)); static bfd_boolean tekhex_set_arch_mach PARAMS ((bfd *, enum bfd_architecture, unsigned long)); static bfd_boolean tekhex_get_section_contents PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); static void move_section_contents - PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type, bfd_boolean)); + PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type, bfd_boolean)); static const bfd_target *tekhex_object_p PARAMS ((bfd *)); static bfd_boolean tekhex_mkobject PARAMS ((bfd *)); static long tekhex_get_symtab_upper_bound PARAMS ((bfd *)); -static long tekhex_get_symtab PARAMS ((bfd *, asymbol **)); +static long tekhex_canonicalize_symtab PARAMS ((bfd *, asymbol **)); static void pass_over PARAMS ((bfd *, void (*) (bfd*, int, char *))); static void first_phase PARAMS ((bfd *, int, char *)); static void insert_byte PARAMS ((bfd *, int, bfd_vma)); @@ -522,7 +522,7 @@ pass_over (abfd, func) } static long -tekhex_get_symtab (abfd, table) +tekhex_canonicalize_symtab (abfd, table) bfd *abfd; asymbol **table; { @@ -593,7 +593,7 @@ static void move_section_contents (abfd, section, locationp, offset, count, get) bfd *abfd; asection *section; - PTR locationp; + const PTR locationp; file_ptr offset; bfd_size_type count; bfd_boolean get; @@ -672,7 +672,7 @@ static bfd_boolean tekhex_set_section_contents (abfd, section, locationp, offset, bytes_to_do) bfd *abfd; sec_ptr section; - PTR locationp; + const PTR locationp; file_ptr offset; bfd_size_type bytes_to_do; { diff --git a/bfd/versados.c b/bfd/versados.c index ee0897a..b978312 100644 --- a/bfd/versados.c +++ b/bfd/versados.c @@ -55,10 +55,10 @@ static bfd_boolean versados_pass_2 PARAMS ((bfd *)); static bfd_boolean versados_get_section_contents PARAMS ((bfd *, asection *, void *, file_ptr, bfd_size_type)); static bfd_boolean versados_set_section_contents - PARAMS ((bfd *, sec_ptr, void *, file_ptr, bfd_size_type)); + PARAMS ((bfd *, sec_ptr, const void *, file_ptr, bfd_size_type)); static int versados_sizeof_headers PARAMS ((bfd *, bfd_boolean)); static long int versados_get_symtab_upper_bound PARAMS ((bfd *)); -static long int versados_get_symtab PARAMS ((bfd *, asymbol **)); +static long int versados_canonicalize_symtab PARAMS ((bfd *, asymbol **)); static void versados_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *)); static void versados_print_symbol @@ -713,7 +713,7 @@ static bfd_boolean versados_set_section_contents (abfd, section, location, offset, bytes_to_do) bfd *abfd ATTRIBUTE_UNUSED; sec_ptr section ATTRIBUTE_UNUSED; - PTR location ATTRIBUTE_UNUSED; + const PTR location ATTRIBUTE_UNUSED; file_ptr offset ATTRIBUTE_UNUSED; bfd_size_type bytes_to_do ATTRIBUTE_UNUSED; { @@ -740,7 +740,7 @@ versados_get_symtab_upper_bound (abfd) /* Return the symbol table. */ static long -versados_get_symtab (abfd, alocation) +versados_canonicalize_symtab (abfd, alocation) bfd *abfd; asymbol **alocation; { diff --git a/bfd/version.h b/bfd/version.h index 445ac0f..339535c 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -1,3 +1,3 @@ -#define BFD_VERSION_DATE 20030917 +#define BFD_VERSION_DATE 20031111 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_string@ diff --git a/bfd/vms-misc.c b/bfd/vms-misc.c index 86b84d7..b6f3042 100644 --- a/bfd/vms-misc.c +++ b/bfd/vms-misc.c @@ -1,6 +1,6 @@ /* vms-misc.c -- Miscellaneous functions for VAX (openVMS/VAX) and EVAX (openVMS/Alpha) files. - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Klaus K"ampf (kkaempf@rmi.de) @@ -612,7 +612,7 @@ bfd_boolean _bfd_save_vms_section (abfd, section, data, offset, count) bfd *abfd; sec_ptr section; - PTR data; + const PTR data; file_ptr offset; bfd_size_type count; { @@ -95,7 +95,7 @@ static int vms_generic_stat_arch_elt PARAMS ((bfd *, struct stat *)); static long vms_get_symtab_upper_bound PARAMS ((bfd *abfd)); -static long vms_get_symtab +static long vms_canonicalize_symtab PARAMS ((bfd *abfd, asymbol **symbols)); static void vms_print_symbol PARAMS ((bfd *abfd, PTR file, asymbol *symbol, bfd_print_symbol_type how)); @@ -125,7 +125,7 @@ static const struct reloc_howto_struct *vms_bfd_reloc_type_lookup static bfd_boolean vms_set_arch_mach PARAMS ((bfd *abfd, enum bfd_architecture arch, unsigned long mach)); static bfd_boolean vms_set_section_contents - PARAMS ((bfd *abfd, asection *section, PTR location, file_ptr offset, + PARAMS ((bfd *abfd, asection *section, const PTR location, file_ptr offset, bfd_size_type count)); static int vms_sizeof_headers PARAMS ((bfd *abfd, bfd_boolean reloc)); @@ -1065,7 +1065,7 @@ vms_get_symtab_upper_bound (abfd) /* Copy symbols from hash table to symbol vector - called from bfd_hash_traverse in vms_get_symtab + called from bfd_hash_traverse in vms_canonicalize_symtab init counter to 0 if entry == 0 */ static bfd_boolean @@ -1089,12 +1089,12 @@ copy_symbols (entry, arg) return # of symbols read */ static long -vms_get_symtab (abfd, symbols) +vms_canonicalize_symtab (abfd, symbols) bfd *abfd; asymbol **symbols; { #if VMS_DEBUG - vms_debug (1, "vms_get_symtab(%p, <ret>)\n", abfd); + vms_debug (1, "vms_canonicalize_symtab(%p, <ret>)\n", abfd); #endif /* init counter */ @@ -1659,7 +1659,7 @@ static bfd_boolean vms_set_section_contents (abfd, section, location, offset, count) bfd *abfd; asection *section; - PTR location; + const PTR location; file_ptr offset; bfd_size_type count; { @@ -1,6 +1,6 @@ #undef vms /* vms.h -- Header file for VMS (Alpha and Vax) support. - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Klaus K"ampf (kkaempf@rmi.de) @@ -505,9 +505,6 @@ typedef struct _vms_section { struct _vms_section *next; } vms_section; -extern bfd_boolean _bfd_save_vms_section - PARAMS ((bfd *abfd, asection *section, PTR data, file_ptr offset, - bfd_size_type count)); extern vms_section *_bfd_get_vms_section PARAMS ((bfd *abfd, int index)); typedef struct _vms_reloc { @@ -594,7 +591,7 @@ struct vms_private_data_struct { vms_section *vms_section_table[VMS_SECTION_COUNT]; struct bfd_hash_table *vms_symbol_table; - struct symbol_cache_entry **symcache; + struct bfd_symbol **symcache; int symnum; struct location_struct *location_stack; @@ -649,7 +646,7 @@ extern void _bfd_vms_push PARAMS ((bfd *abfd, uquad val, int psect)); extern uquad _bfd_vms_pop PARAMS ((bfd *abfd, int *psect)); extern bfd_boolean _bfd_save_vms_section - PARAMS ((bfd *abfd, asection *section, PTR data, file_ptr offset, + PARAMS ((bfd *abfd, asection *section, const PTR data, file_ptr offset, bfd_size_type count)); extern void _bfd_vms_output_begin PARAMS ((bfd *abfd, int rectype, int rechead)); @@ -2413,7 +2413,7 @@ bfd_sym_get_symtab_upper_bound (abfd) } long -bfd_sym_get_symtab (abfd, sym) +bfd_sym_canonicalize_symtab (abfd, sym) bfd *abfd ATTRIBUTE_UNUSED; asymbol **sym ATTRIBUTE_UNUSED; { @@ -1,5 +1,5 @@ /* xSYM symbol-file support for BFD. - Copyright 1999, 2000, 2001, 2002 + Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -693,7 +693,7 @@ extern void bfd_sym_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *)); extern long bfd_sym_get_symtab_upper_bound PARAMS ((bfd *)); -extern long bfd_sym_get_symtab +extern long bfd_sym_canonicalize_symtab PARAMS ((bfd *, asymbol **)); extern int bfd_sym_sizeof_headers PARAMS ((bfd *, bfd_boolean)); |