diff -uprN binutils-2.11.93.0.2/ChangeLog binutils-2.12.90.0.1/ChangeLog --- binutils-2.11.93.0.2/ChangeLog Thu Feb 7 10:21:03 2002 +++ binutils-2.12.90.0.1/ChangeLog Thu Mar 7 11:52:36 2002 @@ -1,3 +1,33 @@ +2002-03-07 H.J. Lu (hjl@gnu.org) + + * configure.in: Enable gprof for mips*-*-linux*. + +2002-02-28 Alexandre Oliva + + * configure.in (libstdcxx_flags): Don't add libstdc++-v3 flags for + libjava. + (CXX_FOR_TARGET): Add -shared-libgcc for libstdc++-v3 and libjava. + +2002-02-24 Andrew Cagney + + * texinfo/texinfo.tex: Update to version 2002-02-14.08. + +2002-02-23 Daniel Jacobowitz + + * config.guess: Import from master sources, rev 1.232. + * config.sub: Import from master sources, rev 1.246. + +2002-02-23 Alexandre Oliva + + * Makefile.in (MAKEINFO): Don't assume makeinfo will be built just + because its Makefile is there; test for the executable instead. + +2002-02-09 Alexandre Oliva + + Contribute sh64-elf. + 2000-12-01 Alexandre Oliva + * configure.in: Added sh64-*-*. + 2002-02-04 Jeff Johnston * COPYING.NEWLIB: Remove advertising clause from diff -uprN binutils-2.11.93.0.2/ChangeLog.linux binutils-2.12.90.0.1/ChangeLog.linux --- binutils-2.11.93.0.2/ChangeLog.linux Thu Feb 7 10:21:03 2002 +++ binutils-2.12.90.0.1/ChangeLog.linux Thu Mar 7 12:20:56 2002 @@ -1,3 +1,7 @@ +2002-03-07 H.J. Lu + + * binutils.spec.in: Remove gasp.info.gz. + 2002-02-07 H.J. Lu * binutils.spec.in: Apply mips/build.patch for cross compile. diff -uprN binutils-2.11.93.0.2/Makefile.in binutils-2.12.90.0.1/Makefile.in --- binutils-2.11.93.0.2/Makefile.in Sun Feb 3 11:22:29 2002 +++ binutils-2.12.90.0.1/Makefile.in Thu Mar 7 11:52:36 2002 @@ -143,7 +143,7 @@ M4 = `if [ -f $$r/m4/m4 ] ; \ # For an installed makeinfo, we require it to be from texinfo 4 or # higher, else we use the "missing" dummy. -MAKEINFO = `if [ -f $$r/texinfo/makeinfo/Makefile ] ; \ +MAKEINFO = `if [ -f $$r/texinfo/makeinfo/makeinfo ] ; \ then echo $$r/texinfo/makeinfo/makeinfo ; \ else if (makeinfo --version \ | egrep 'texinfo[^0-9]*([1-3][0-9]|[4-9])') >/dev/null 2>&1; \ diff -uprN binutils-2.11.93.0.2/bfd/ChangeLog binutils-2.12.90.0.1/bfd/ChangeLog --- binutils-2.11.93.0.2/bfd/ChangeLog Thu Feb 7 10:21:03 2002 +++ binutils-2.12.90.0.1/bfd/ChangeLog Thu Mar 7 11:52:36 2002 @@ -1,3 +1,748 @@ +2002-03-07 H.J. Lu (hjl@gnu.org) + + * coff-sh.c (shcoff_reloc_map): Use bfd_reloc_code_real_type + as the type for bfd_reloc_val. + +2002-03-05 John David Anglin + + * elf-hppa.h (elf_hppa_is_dynamic_loader_symbol): New function. + (elf_hppa_relocate_section): Ignore undefined dynamic loader symbols. + (elf_hppa_final_link_relocate): Correct relocations for indirect + references to local data through the DLT. Fix .opd creation for + local symbols using R_PARISC_LTOFF_FPTR32 and R_PARISC_FPTR64 + relocations. Use e_lsel selector for R_PARISC_DLTIND21L, + R_PARISC_LTOFF_FPTR21L and R_PARISC_LTOFF_TP21L as per + "Processor-Specific ELF for PA_RISC, Version 1.43" document. + Similarly, use e_rsel for DLT and LTOFF 'R' relocations. + * elf32-hppa.c (final_link_relocate): Revise relocation selectors + as per "Processor-Specific ELF for PA_RISC, Version 1.43" document. + +2002-03-05 Jakub Jelinek + + * merge.c (_bfd_merge_sections): Don't segfault if there + is nothing to merge due to GC. + +2002-03-05 Alan Modra + + * elf32-hppa.c (clobber_millicode_symbols): Remove hack to keep + symbols that have been forced local. + + * elflink.h (elf_bfd_final_link): Call elf_link_output_extsym + to output forced local syms for non-shared link. + (elf_link_output_extsym): Tweak condition for calling backend + adjust_dynamic_symbol so that previous behaviour is kept. + Whitespace changes throughout file. + +2002-03-04 H.J. Lu + + * elf.c (bfd_section_from_shdr): Handle special sections, + .init_array, .fini_array and .preinit_array. + (elf_fake_sections): Likewise. + + * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Create the + DT entry only if the section is in output for .init_array, + .fini_array and .preinit_array. Complain about .preinit_array + section in DSO. + (elf_bfd_final_link): Warn zero size for .init_array, + .fini_array and .preinit_array sections. + + * elfxx-ia64.c (elfNN_ia64_section_from_shdr): Remove + SHT_INIT_ARRAY, SHT_FINI_ARRAY and SHT_PREINIT_ARRAY. + (elfNN_ia64_fake_sections): Remove .init_array, .fini_array and + .preinit_array. + +2002-03-04 Alan Modra + + * configure.in (WIN32LIBADD): Don't eval PICFLAG assignment. + * configure: Regenerate. + +2002-03-02 Tom Rix + + * coff64-rs6000.c (xcoff64_howto_table): Replace howto types with + symbolic equiv. + * coff-rs6000.c (xcoff_howto_table): Same. + +2002-03-01 David Mosberger + + * elflink.h (size_dynamic_sections): If section named + ".preinit_array" exists, create DT_PREINIT_ARRAY and + DT_PREINIT_ARRAYSZ entries in dynamic table. Analogously for + ".init_array" and ".fini_array". + (elf_bfd_final_link): Handle DT_PREINIT_ARRAYSZ, DT_INIT_ARRAYSZ, + DT_FINI_ARRAYSZ, DT_PREINIT_ARRAY, DT_INIT_ARRAY, and + DT_FINI_ARRAY. + +2002-02-26 Andrew Macleod + + * elflink.h (elf_bfd_final_link): Don't crash on SHN_UNDEF local + dynsyms. + +2002-02-25 Alan Modra + + * elf64-hppa.h: Update copyright date. + + * elf64-ppc.c (ppc64_elf_check_relocs): Warning fix. + (ppc64_elf_relocate_section): Don't generate power4 style branch + hints for *_BRTAKEN and *_BRNTAKEN relocs. + +2002-02-22 Jakub Jelinek + + * elf64-sh64.c (sh_elf64_relocate_section): Fix a typo from my + last patch. + * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. + +2002-02-21 Andreas Jaeger + + * elf64-x86-64.c: Major rework that introduces all recent changes + to the x86-64 backend. Get a closer match to elf32-i386. + (struct elf64_x86_64_dyn_relocs): Rename from + elf64_x86_64_pcrel_relocs_copied, add additional fields. Change + all users. + (struct elf64_x86_64_link_hash_table): Add short cuts to some + sections. + (link_hash_newfunc): Rename from elf64_x86_64_link_hash_newfunc, + remove casts, initialize new hash members. + (create_got_section): New. + (elf64_x86_64_create_dynamic_sections): New. + (elf64_x86_64_copy_indirect_symbol): New. + (elf64_x86_64_check_relocs): Don't allocate space for dynamic + relocs, .got or .relgot here but do it in allocate_dynrelocs. + Reference count possible .plt and .got entries. Don't test input + section SEC_READONLY here to try to avoid copy relocs, and keep + dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set + DF_TEXTREL here. Delay setting of variables until needed. Cache + pointer to "sreloc" section in elf_section_data. Tweak condition + under which .got created. Report files with bad relocation + section names. + (elf64_x86_64_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. + Reference count possible .plt entries. Don't deallocate .got and + .relgot space here. + (elf64_x86_64_adjust_dynamic_symbol): Handle nocopyreloc. Don't + do copy reloc processing for weakdefs. Remove redundant casts and + aborts. Delay setting of vars until needed. Move creation of + dynamic symbols and allocation of .plt and .rela.plt to + allocate_dynrelocs. Replace BFD_ASSERT with abort. + (WILL_CALL_FINISH_DYNAMIC_SYMBOL): New. + (allocate_dynrelocs): New. + (readonly_dynrelocs): New. + (elf64_x86_64_size_dynamic_sections): Call readonly_dynrelocs. + Allocate space for dyn relocs. Replace BFD_ASSERT with abort. + Zero out the dynamic allocated content space. + (elf64_x86_64_discard_copies): Removed. + (elf64_x86_64_relocate_section): Make use of dynamic section + short-cuts. Localise vars, and delay setting. Better error + reporting, replace BFD_ASSERT with abort. Check + ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the + regular object file and tread the weak definition as the normal + one. Don't discard relocs for undefweak or undefined symbols and + check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy + relocs. + (elf64_x86_64_finish_dynamic_symbol): Don't copy relocs for + symbols that have been forced local. Use same test to decide if + we can use a relative reloc for got as relocate_section. Expand + SHN_UNDEF comment. Move expressions out of function calls. + Replace BFD_ASSERT with abort. + (bfd_elf64_bfd_final_link): Removed. + (elf_backend_copy_indirect_symbol): Define. + +2002-02-20 Tom Rix + + * coff-rs6000.c (xcoff_howto_table): Add 16 bit R_BA. + (_bfd_xcoff_reloc_type_lookup): Use it. + * coff64-rs6000.c (xcoff64_howto_table): Same. + (xcoff64_reloc_type_lookup): Same. + +2002-02-20 Peter Schauer + + * osf-core.c (osf_core_vec): OSF/1 (Digital Unix) core files are + little endian. + +2002-02-19 Martin Schwidefsky + + * archures.c (bfd_mach_s390_esa): Rename to bfd_mach_s390_31. + (bfd_mach_s390_esame): Rename to bfd_mach_s390_64. + * bfd-in2.h: Regenerate. + * cpu-s390.c (arch_info_struct): Use renamed architecture defines. + Replace architecture name "s390" with "s390:31-bit" and "s390:esame" + with "s390:64-bit". + * elf32-s390.c (elf_howto_table): Add 32 bit pc relative relocations. + (elf_s390_reloc_type_lookup): Likewise. + (elf_s390_check_relocs): Likewise. + (elf_s390_gc_sweep_hook): Likewise. + (elf_s390_relocate_section): Likewise. + (elf_s390_object_p): Use renamed architecture define. + * elf64-s390.c (elf_s390_object_p): Use renamed architecture define. + +2002-02-19 Frank Ch. Eigler + + * syms.c (stt[]): Sorted. Added .init/.fini -> "t" mapping. + +2002-02-19 Jakub Jelinek + + * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Enable + absptr -> pcrel optimization for shared libs. + Only create minimal .eh_frame_hdr if absptr FDE encoding in shared + library cannot be converted to pcrel. + (_bfd_elf_eh_frame_section_offset): Return -2 if making absptr + relative. + * elf32-i386.c (elf_i386_relocate_section): If + _bfd_elf_section_offset returned -2, skip, but make sure the + relocation is installed. + * elf32-arm.h (elf32_arm_final_link_relocate): Likewise. + * elf32-cris.c (cris_elf_relocate_section): Likewise. + * elf32-hppa.c (elf32_hppa_relocate_section): Likewise. + * elf32-i370.c (i370_elf_relocate_section): Likewise. + * elf32-m68k.c (elf_m68k_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. + * 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. + * elf64-alpha.c (elf64_alpha_relocate_section): Handle + _bfd_elf_section_offset returning -2 the same way as -1. + * elfxx-ia64.c (elfNN_ia64_install_dyn_reloc): Likewise. + * elf32-mips.c (mips_elf_create_dynamic_relocation): Add FIXME + and BFD_ASSERT. + * elf64-mips.c (mips_elf64_create_dynamic_relocation): Likewise. + +2002-02-18 Tom Rix + + * xcofflink.c (bfd_xcoff_link_gernate_rtinit): Add -brtl support. + (bfd_xcoff_size_dynamic_sections): Same. + * bfd-in.h (bfd_xcoff_link_generate_rtinit): Same. + (bfd_xcoff_size_dynamic_sections): Same. + * coff-rs6000.c (xcoff_generate_rtinit): Same. + * coff-rs646000.c (xcoff64_generate_rtinit): Same. + * libxcoff.h (struct xcoff_backend_data_rec): Same. + * xcofflink.c (xcoff_build_ldsyms, xcoff_link_add_symbols): Clean. + * bfd-in2.h: Regenerate. + +2002-02-18 Alan Modra + + * elf64-ppc.c (STFD_FR0_0R1, LFD_FR0_0R1, BLR): Define. + (struct ppc_link_hash_table): Add sfpr. + (ppc64_elf_link_hash_table_create): Init it. + (ppc64_elf_create_dynamic_sections): Split creation of .stub and + .glink out to.. + (create_linkage_sections): ..here. Make .sfpr too. + (ppc64_elf_check_relocs): Call create_linkage_sections, and set + dynobj early. + (MIN_SAVE_FPR, MAX_SAVE_FPR): Define. + (ppc64_elf_func_desc_adjust): Look for missing ._savef* and + ._restf* functions, and create as needed. + (func_desc_adjust): Only force_local for shared libs. + +2002-02-18 David O'Brien + + * configure.in: Bump version number post 2.12 branching. + * configure: Regenerate. + +2002-02-17 Hans-Peter Nilsson + + * mmo.c: Correct and improve comments. + (mmo_write_chunk): Store trailing byte in bfd buffer; don't + zero-pad. Use input to fill up non-empty bfd buffer. + (mmo_flush_chunk): New function. + (mmo_write_loc_chunk): Add parameter last_vmap, all callers + changed. Don't emit location specifier if VMA is same as + *LAST_VMAP after omitting leading zero contents. Call + mmo_flush_chunk before emitting location specifier. + (mmo_write_loc_chunk_list): Call mmo_flush_chunk when finished + with mmo_write_loc_chunk calls. + (mmo_internal_write_section): Call mmo_flush_chunk after + mmo_write_chunk. + (mmo_write_symbols_and_terminator): Move :Main to first position + in symbol array. Add faked one if it does not exist if there are + other symbols. Don't add it if there are no symbols at all. Move + out test for value of :Main from symbol loop. Rename table + fakemain to maintable and variable mainsym to fakemain. + +2002-02-15 Richard Henderson + + * elf64-alpha.c (elf64_alpha_relocate_section) [BRSGP]: A target + section with no got matches any got. Simplify error generaion. + +2002-02-15 Alan Modra + + Support arbitrary length fill patterns. + * linker.c (bfd_new_link_order): Zero all fields with bfd_zalloc. + (_bfd_default_link_order): Remove bfd_fill_link_order code. + Call default_data_link_order. + (default_fill_link_order): Delete. + (default_data_link_order): New function. + * elf32-mips.c (_bfd_mips_elf_final_link): Replace occurrences + of bfd_fill_link_order with bfd_data_link_order. + * elf64-alpha.c (elf64_alpha_final_link): Likewise. + * elf64-mips.c (mips_elf64_final_link): Likewise. + + * bfd.c (bfd_scan_vma): Clamp overflows to max bfd_vma value. + Correct value returned in "end" for "0x". + +2002-02-14 Nick Clifton + + * cpu-arm.c (processors): Replace 'arch' field with 'mach'. + (scan): Test against 'mach' field in info structure. + +2002-02-14 Alan Modra + + * elf.c (elf_fake_sections): Use SHT_NOBITS when SEC_NEVER_LOAD. + +2002-02-14 Matt Fredette + + * elf32-m68k.c (elf32_m68k_print_private_bfd_data): Recognize + EF_M68000. + +2002-02-13 Nick Clifton + + * elf.c (_bfd_elf_make_section_from_shdr): Do not insist on + non-zero physical addresses when adjusting the LMAs of new + sections. + +2002-02-12 John David Anglin + + * elf-hppa.h (elf_hppa_reloc_final_type): New function stripped + from _bfd_elf_hppa_gen_reloc_type. + (_bfd_elf_hppa_gen_reloc_type): Remove duplicate prototype. + * elf32-hppa.h (elf32_hppa_reloc_final_type): Add protptype. + * elf32-hppa.c: Include elf32-hppa.h before elf-hppa.h. + * elf64-hppa.h (elf64_hppa_reloc_final_type): Add protptype. + +2002-02-12 Alexandre Oliva + + * elf-m10300.c (mn10300_elf_relax_section): Skip section before + loading its contents if there's nothing to do in it. + +2002-02-12 Alan Modra + + * elf64-ppc.c (ppc64_elf_size_stubs): Correct test for crossing + 64k boundary. + + * elf64-ppc.c (ppc64_elf_size_dynamic_sections): Add dynamic + DT_PPC64_OPD and DT_PPC64_OPDSZ tags. + (ppc64_elf_finish_dynamic_sections): Set values for them. + +2002-02-11 Michael Snyder + + * elf-bfd.h (elfcore_write_lwpstatus): Add prototype. + * elf.c (elfcore_grok_pstatus): Add prototype. + (elfcore_grok_lwpstatus): Add prototype. + (elfcore_write_lwpstatus): New function. + (elfcore_write_pstatus): Fix typo, eliminate unnecessary memcpy. + +2002-02-11 Alexandre Oliva + + * elf32-sh.c: Added missing prototypes. + * elf32-sh64.c: Likewise. + (sh_elf_align_loads): Mark unused args as such. + * elf64-sh64.c: Added missing prototypes. + (struct elf_sh64_link_hash_entry): Fix typo. + (sh_elf64_relocate_section): Fix info argument passed to + _bfd_elf_section_offset. + +2002-02-11 Alan Modra + + * Makefile.am: "make dep-am". + * Makefile.in: Regenerate. + * aclocal.m4: Regenerate. + * config.in: Regenerate. + * configure: Regenerate. + +2002-02-10 Daniel Jacobowitz + + * coff-rs6000.c (xcoff_generate_rtinit): Silence uninitialized + variable warnings. + * elf32-sh.c (sh_elf_relax_section): Silence signed/unsigned + comparison warning. + * trad-core.c (trad_unix_core_file_p): Silence pointer/integer + cast warnings for the common case. + +2002-02-10 Hans-Peter Nilsson + + * config.bfd (sh-*-linux*, sh-*-elf* | sh-*-rtemself*): Add sh64 + vectors. + (sh-*-netbsdelf*): New, to trump sh*-*-netbsdelf* and add sh64 + vectors. + +2002-02-09 Richard Henderson + + * elf64-alpha.c (elf64_alpha_howto): Add R_ALPHA_BRSGP. + (elf64_alpha_reloc_map, elf64_alpha_check_relocs): Likewise. + (elf64_alpha_relocate_section): Likewise. + * reloc.c (BFD_RELOC_ALPHA_BRSGP): New. + * bfd-in2.h, libbfd.h: Rebuild. + +2002-02-09 Hans-Peter Nilsson + + * elf64-mmix.c (_bfd_mmix_finalize_linker_allocated_gregs): Check + that base-plus-offset reloc accounting is consistent. + (mmix_elf_relax_section): Keep base-plus-offset reloc accounting + up to date for undefined symbols. + +2002-02-08 Eric Christopher + + From Rainer Orth + + * elf32-mips.c (_bfd_mips_elf_fake_sections): Don't create .rela + sections for the O32 ABI. + +2002-02-08 Chris Demetriou + + * elf32-arm.h: Fix formatting of _("..."). + * elf32-d10v.c: Likewise. + * elf32-m68k.c: Likewise. + * elf32-mips.c: Likewise. + +2002-02-08 Ivan Guzvinec + + * coff-or32.c: Fix compile time warning messages. + +2002-02-08 Alexandre Oliva + + Contribute sh64-elf. + 2002-01-23 Alexandre Oliva + * reloc.c (R_SH_GOTPLT32, R_SH_GOT_LOW16, R_SH_GOT_MEDLOW16, + R_SH_GOT_MEDHI16, R_SH_GOT_HI16, R_SH_GOTPLT_LOW16, + R_SH_GOTPLT_MEDLOW16, R_SH_GOTPLT_MEDHI16, R_SH_GOTPLT_HI16, + R_SH_PLT_LOW16, R_SH_PLT_MEDLOW16, R_SH_PLT_MEDHI16, + R_SH_PLT_HI16, R_SH_GOTOFF_LOW16, R_SH_GOTOFF_MEDLOW16, + R_SH_GOTOFF_MEDHI16, R_SH_GOTOFF_HI16, R_SH_GOTPC_LOW16, + R_SH_GOTPC_MEDLOW16, R_SH_GOTPC_MEDHI16, R_SH_GOTPC_HI16, + R_SH_GOT10BY4, R_SH_GOTPLT10BY4, R_SH_GOT10BY8, R_SH_GOTPLT10BY8, + R_SH_COPY64, R_SH_GLOB_DAT64, R_SH_JMP_SLOT64, R_SH_RELATIVE64): + New relocs. + * libbfd.h, bfd-in2.h: Rebuilt. + * elf32-sh.c (sh_elf_howto_table): Define new relocs. + (sh_reloc_map): Map them. + (PLT_ENTRY_SIZE, elf_sh_plt0_entry_be, elf_sh_plt0_entry_le, + elf_sh_plt_entry_be, elf_sh_plt_entry_le, elf_sh_pic_plt_entry_be, + elf_sh_pic_plt_entry_le, elf_sh_plt0_entry, elf_sh_plt_entry, + elf_sh_pic_plt_entry, elf_sh_sizeof_plt, elf_sh_plt_plt0_offset, + elf_sh_plt0_gotplt_offset, elf_sh_plt_temp_offset, + elf_sh_plt_symbol_offset, elf_sh_plt_reloc_offset, + movi_shori_putval) [INCLUDE_SHMEDIA]: New. + (elf_sh_link_hash_entry) [INCLUDE_SHMEDIA]: Add + datalabel_got_offset. + (sh_elf_link_hash_newfunc): Initialize it. + (sh_elf_relocate_section): Augment the scope of + seen_stt_datalabel. Introduce GOTPLT support. Extend GOTPC, PLT, + GOT and GOTOFF handling to new SHmedia relocation types. Support + GOT_BIAS. + (sh_elf_check_relocs): Likewise. + (sh_elf_finish_dynamic_symbol) [TARGET_SHMEDIA]: Set up values in + PLT entries using movi_shori_putval. Support GOT_BIAS. + (sh_elf_finish_dynamic_sections): Likewise. + * elf32-sh64.c (shmedia_prepare_reloc): Do not add addend to + relocation, it's now done by the caller. + (GOT_BIAS): New. + * elf64-sh64.c (GOT_BIAS, PLT_ENTRY_SIZE, elf_sh64_sizeof_plt, + elf_sh64_plt_plt0_offset, elf_sh64_plt0_gotplt_offset, + elf_sh64_plt_temp_offset, elf_sh64_plt_symbol_offset, + elf_sh64_plt_reloc_offset, ELF_DYNAMIC_INTERPRETER, + elf_sh64_pcrel_relocs_copied, elf_sh64_link_hash_entry, + elf_sh64_link_hash_table, sh64_elf64_link_hash_traverse, + sh64_elf64_hash_table): New. + (sh_elf64_howto_table): Introduce new relocs. + (sh_elf64_info_to_howto): Accept new PIC relocs. + (sh_elf64_relocate_section): Augment the scope of + seen_stt_datalabel. Support new PIC relocs. + (sh_elf64_check_relocs): Support new PIC relocs. + (elf_sh64_plt0_entry_be, elf_sh64_plt0_entry_le, + elf_sh64_plt_entry_be, elf_sh64_plt_entry_le, + elf_sh64_pic_plt_entry_be, elf_sh64_pic_plt_entry_le, + elf_sh64_plt0_entry, elf_sh64_plt_entry, elf_sh64_pic_plt_entry, + sh64_elf64_link_hash_newfunc, sh64_elf64_link_hash_table_create, + movi_shori_putval, movi_3shori_putval, + sh64_elf64_create_dynamic_sections, + sh64_elf64_adjust_dynamic_symbol, sh64_elf64_discard_copies, + sh64_elf64_size_dynamic_sections, + sh64_elf64_finish_dynamic_symbol, + sh64_elf64_finish_dynamic_sections): New. + (elf_backend_create_dynamic-sections, + bfd_elf64_bfd_link_hash_table_create, + elf_backend_adjust_dynamic_symbol, + elf_backend_size_dynamic_sections, + elf_backend_finish_dynamic_symbol, + elf_backend_finish_dynamic_sections, elf_backend_want_got_plt, + elf_backend_plt_readonly, elf_backend_want_plt_sym, + elf_backend_got_header_size, elf_backend_plt_header_size): + Define. + 2001-05-16 Alexandre Oliva + * elf32-sh.c: Renumbered and renamed some SH5 relocations to + match official numbers and names; moved unmaching ones to the + range 0xf2-0xff. + * elf32-sh64.c, elf64-sh64.c: Likewise. + 2001-03-12 DJ Delorie + * elf32-sh.c (sh_elf_relax_section): Don't relax SHmedia + sections. + 2001-03-12 DJ Delorie + * elf32-sh64.c (shmedia_prepare_reloc): Validate relocs that must + be aligned. + * elf64-sh64.c (sh_elf64_relocate_section): Ditto. + 2001-01-14 Hans-Peter Nilsson + * elf32-sh64.c (bfd_elf32_bfd_copy_private_section_data): Define. + (sh64_elf_fake_sections): Set type to SHT_SH5_CR_SORTED for a + .cranges section with SEC_SORT_ENTRIES set. + (sh64_backend_section_from_shdr): Set SEC_SORT_ENTRIES on an + incoming sorted .cranges section. + (sh64_bfd_elf_copy_private_section_data): New. + (sh64_elf_final_write_processing): Only sort .cranges and modify + start address if called by linker. + 2001-01-08 Ben Elliston + * elf32-sh64.c (sh64_elf_final_write_processing): Activate + Hans-Peter Nilsson's set bit 0 patch from 2001-01-06. + * elf64-sh64.c (sh64_elf64_final_write_processing): Ditto. + 2001-01-06 Hans-Peter Nilsson + * elf64-sh64.c (sh_elf64_howto_table): No open brace at start of + line. Add comments before all entries. + : Correct and clarify describing + comment. + (sh_elf64_reloc): Correct head comment. + (sh_elf64_relocate_section): Correct spacing. + : Do not honour STO_SH5_ISA32; + instead call reloc_dangerous callback. + : New case. + (sh_elf64_gc_mark_hook): Correct spacing. + (sh_elf64_check_relocs): Ditto. + * elf32-sh64.c (shmedia_prepare_reloc) : + New case. + * elf32-sh.c: Correct #endif comments for #ifndef-wrapped + functions. + (sh_elf_howto_table) : Correct, + clarify describing comment. Add comments before all entries. + (sh_elf_relocate_section) : Do not + honour STO_SH5_ISA32; instead call reloc_dangerous callback. + 2001-01-06 Hans-Peter Nilsson + Sort .cranges section in final link. Prepare to set bit 0 on + entry address. + * elf32-sh64.c (struct sh64_find_section_vma_data): New. + (sh64_elf_link_output_symbol_hook): Fix typo in prototype. + (sh64_elf_set_mach_from_flags): Set SEC_DEBUGGING on incoming + .cranges section. + (sh64_backend_section_from_shdr): New, to recognize + SHT_SH5_CR_SORTED on incoming .cranges section. + (elf_backend_section_from_shdr): Define. + (sh64_elf_final_write_processing): Sort outgoing .cranges + section. (New, temporarily disabled:) Set bit 0 on entry address + according to ISA type. + (sh64_find_section_for_address): New. + (crange_qsort_cmpb, crange_qsort_cmpl, crange_bsearch_cmpb, + crange_bsearch_cmpl): Move here from opcodes/sh64-dis.c. + (sh64_address_in_cranges): Move here from opcodes/sh64-dis.c. Use + bfd_malloc, not xmalloc. + (sh64_get_contents_type): Move here from opcodes/sh64-dis.c. Make + global. + * elf32-sh64.c (sh64_elf64_final_write_processing): New, (but + temporarily disabled) setting bit 0 on entry address. + (elf_backend_final_write_processing): Define. + 2001-01-05 Hans-Peter Nilsson + * elf32-sh.c (sh_elf_howto_table) : Adjust fields to + be a proper relocation for PTA and PTB rather than a marker. + : + Zero src_mask. + * elf64-sh64.c: Ditto. + (sh_elf64_relocate_section) : New case. + * elf32-sh64.c: Include opcodes/sh64-opc.h + (shmedia_prepare_reloc): Take a bfd_link_info pointer as first + argument. Drop const qualifiers from "bfd *" and "bfd_byte *" + parameters. No unused parameters. Caller changed. + : New case. + * Makefile.am (elf32-sh64.lo): Add dependency on sh64-opc.h. + * Makefile.in: Regenerate. + 2000-12-30 Hans-Peter Nilsson + * elf64-sh64.c (sh64_elf64_fake_sections): Set SHF_SH5_ISA32 for + all code sections. + (sh_elf64_set_mach_from_flags): Change from EF_SH64 to EF_SH5. + (sh64_elf_merge_private_data): Ditto. + * elf32-sh64.c (sh64_elf_fake_sections): Use sh64_elf_section_data + to access stored section flags. + (sh64_elf_final_write_processing): Return immediately unless + called by linker. Use sh64_elf_section_data (cranges) to get size + of linker-generated cranges entries. + (sh64_elf_copy_private_data): Add missing "return true". + (sh64_elf_set_mach_from_flags): Change from EF_SH64 to EF_SH5. + (sh_elf64_merge_private_data): Ditto. + 2000-12-19 Hans-Peter Nilsson + * elf64-sh64.c (sh64_elf64_fake_sections): New, copy of + elf64-sh64.c:sh64_elf_fake_sections. + (elf_backend_fake_sections): Define as sh64_elf64_fake_sections. + 2000-12-18 Hans-Peter Nilsson + * elf32-sh64.c (sh64_elf_copy_private_data_internal): Delete. + (sh64_elf_final_write_processing): New. + (elf_backend_final_write_processing): Define. + (sh64_elf_fake_sections): Get header flags from tdata field. + (sh64_elf_copy_private_data): Do not call + sh64_elf_copy_private_data_internal, just copy e_flags field. + (sh64_elf_merge_private_data): Do not call + sh64_elf_copy_private_data_internal. + 2000-12-12 Hans-Peter Nilsson + Remove EF_SH64_ABI64, let ELF size make difference. + Remove SH64-specific BFD section flag. + * elf32-sh64.c (sh64_elf_fake_sections): Recognize section as + containing SHmedia through elf_section_data (asect)->tdata + non-zero, not using a BFD section flag. + (sh64_elf_set_mach_from_flags): Don't recognize EF_SH64_ABI64. + (sh64_elf_merge_private_data): Similar. + (elf_backend_section_flags): Don't define. + (sh64_elf_backend_section_flags): Delete. + * elf64-sh64.c (sh_elf64_set_mach_from_flags): Recognize EF_SH64, + not EF_SH64_ABI64. + (sh_elf64_merge_private_data): Similar. + * section.c (Section flags definitions): Don't define + SEC_SH_ISA_SHMEDIA. + (bfd-in2.h): Regenerate. + 2000-12-09 Hans-Peter Nilsson + Make DataLabel references work with partial linking. + * elf32-sh64.c: Fix formatting. + (sh64_elf_link_output_symbol_hook): New. + (elf_backend_link_output_symbol_hook): Define to + sh64_elf_link_output_symbol_hook. + (sh64_elf_add_symbol_hook): Make DataLabel symbol just global + undefined if partial linking. Adjust sanity check. + * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): New. + (elf_backend_link_output_symbol_hook): Define to + sh64_elf64_link_output_symbol_hook. + (sh64_elf64_add_symbol_hook): Make DataLabel symbol just global + undefined if partial linking. Adjust sanity check. + 2000-12-07 Hans-Peter Nilsson + Implement semantics for inter-file DataLabel references. + * elf64-sh64.c (DATALABEL_SUFFIX): Define. + (sh64_elf64_add_symbol_hook): New. + (sh_elf64_relocate_section): If passing an indirect symbol with + st_type STT_DATALABEL on the way to a symbol with st_other + STO_SH5_ISA32, do not bitor 1 to the relocation. + (elf_backend_add_symbol_hook): Define to + sh64_elf64_add_symbol_hook. + * elf64-sh32.c: Tweak comments. + (DATALABEL_SUFFIX): Define. + (sh64_elf_add_symbol_hook): New. + (elf_backend_add_symbol_hook): Define to sh64_elf_add_symbol_hook. + * elf32-sh.c (sh_elf_relocate_section): If passing an indirect + symbol with st_type STT_DATALABEL on the way to a symbol with + st_other STO_SH5_ISA32, do not bitor 1 to the relocation. + 2000-12-05 Hans-Peter Nilsson + Pass through STT_DATALABEL. + * elf32-sh64.c (sh64_elf_get_symbol_type): New. + (elf_backend_get_symbol_type): Define. + * elf64-sh64.c (sh64_elf64_get_symbol_type): New. + (elf_backend_get_symbol_type): Define. + 2000-11-30 Hans-Peter Nilsson + * elf32-sh64.c: Tweak comments. + (sh64_elf_copy_private_data_internal): Add prototype. + (bfd_elf32_bfd_set_private_flags): Define. + (sh64_elf_copy_private_data_internal): Compare machine name, not + textual BFD target name, to check whether to copy section flag + SHF_SH5_ISA32. + (sh64_elf_merge_private_data): Validize bfd_get_arch_size. + Tweak section-contents-type-mismatch message. + (shmedia_prepare_reloc): Add ATTRIBUTE_UNUSED markers. + Validize reloc-types. + * elf64-sh64.c: New file. + * targets.c (bfd_elf64_sh64_vec, bfd_elf64_sh64l_vec): Declare. + * Makefile.am (BFD64_BACKENDS): Add elf64-sh64.lo. + (BFD64_BACKENDS_CFILES): Add elf64-sh64.c. + Regenerate dependencies. + * Makefile.in: Regenerate. + * config.bfd (sh64-*-elf*): Add bfd_elf64_sh64_vec and + bfd_elf64_sh64l_vec. + * configure.in: Handle bfd_elf64_sh64_vec and + bfd_elf64_sh64l_vec. + * configure: Regenerate. + * po/POTFILES.in: Regenerate. + * po/bfd.pot: Regenerate. + 2000-11-29 Hans-Peter Nilsson + * elf32-sh64.c (sh64_elf_set_mach_from_flags): Do not recognize + anything else but EF_SH64 and EF_SH64_ABI64. + (sh64_elf_merge_private_data): Emit error for anything else but + EF_SH64 and EF_SH64_ABI64. + * config.bfd: Remove bfd_elf32_shblin_vec and bfd_elf32_shlin_vec + from targ_selvecs. + * configure.in: Add cofflink.lo to bfd_elf32_sh64_vec and + bfd_elf32_sh64l_vec as a temporary measure. + * configure: Regenerate. + 2000-11-27 Hans-Peter Nilsson + * cpu-sh.c (arch_info_struct): Include sh5 item + unconditionalized. + * config.bfd (sh64-*-elf*): Do not set targ_cflags. + Add targ_selvecs bfd_elf32_sh_vec, bfd_elf32_shl_vec, + bfd_elf32_shblin_vec and bfd_elf32_shlin_vec. + * elf32-sh64.c: Tweak comments. + (sh64_elf_set_mach_from_flags): Recognize all machine flags that + are proper subsets of SH64 as bfd_mach_sh5. Add EF_SH64_ABI64. + (sh64_elf_copy_private_data_internal): Wrap long line. + (sh64_elf_merge_private_data): Rewrite to allow objects from + SH64 subsets to be linked together. + (INCLUDE_SHMEDIA): Define. + * elf32-sh.c (sh_elf_relocate_section) : + Parenthesize plus-expression inside or-expression. + : Ditto. + (sh_elf_set_mach_from_flags): Remove code refusing + deleted EF_SH64_32BIT_ABI flag. + 2000-11-26 Hans-Peter Nilsson + * elf32-sh.c (sh_elf_howto_table) : Set pcrel_offset to true. + (sh_elf_relocate_section) : Or 1 in + calculation of relocation if sym->st_other & STO_SH5_ISA32. + : Ditto if h->other & STO_SH5_ISA32. + * elf32-sh64.c (shmedia_prepare_reloc): Add rel->r_addend to + relocation. + 2000-11-24 Hans-Peter Nilsson + * Makefile.am (BFD32_BACKENDS): Add elf32-sh64.lo. + (BFD32_BACKENDS_CFILES): Add elf32-sh64.c. + Regenerate dependencies. + * Makefile.in: Regenerate. + * archures.c: Add bfd_mach_sh5. + * config.bfd: Map targ_cpu sh* to bfd_sh_arch. + Handle sh64-*-elf*. Set targ_cflags to -DINCLUDE_SHMEDIA. + * configure.in: Handle bfd_elf32_sh64_vec and bfd_elf32_sh64l_vec. + * configure: Regenerate. + * reloc.c (BFD_RELOC_SH_SHMEDIA_CODE, BFD_RELOC_SH_IMMU5, + BFD_RELOC_SH_IMMS6, BFD_RELOC_SH_IMMS6BY32, BFD_RELOC_SH_IMMU6, + BFD_RELOC_SH_IMMS10, BFD_RELOC_SH_IMMS10BY2, + BFD_RELOC_SH_IMMS10BY4, BFD_RELOC_SH_IMMS10BY8, + BFD_RELOC_SH_IMMS16, BFD_RELOC_SH_IMMU16, BFD_RELOC_SH_IMM_LOW16, + BFD_RELOC_SH_IMM_LOW16_PCREL, BFD_RELOC_SH_IMM_MEDLOW16, + BFD_RELOC_SH_IMM_MEDLOW16_PCREL, BFD_RELOC_SH_IMM_MEDHI16, + BFD_RELOC_SH_IMM_MEDHI16_PCREL, BFD_RELOC_SH_IMM_HI16, + BFD_RELOC_SH_IMM_HI16_PCREL, BFD_RELOC_SH_PT_16): New relocations. + * cpu-sh.c [INCLUDE_SHMEDIA] (arch_info_struct): Define and link + in item for SH5. + * elf32-sh.c [INCLUDE_SHMEDIA] (sh_elf_howto_table): Add howto items + for SHmedia relocs. + [INCLUDE_SHMEDIA] (sh_rel): Add mappings for SHmedia relocs. + [INCLUDE_SHMEDIA] (sh_elf_relocate_section) [default]: Call + shmedia_prepare_reloc, goto final_link_relocate if it returns + non-zero, else fail as before. + (sh_elf_set_mach_from_flags): Provide function only if not defined + as macro. Do not recognize objects with EF_SH64_32BIT_ABI set. + (sh_elf_set_private_flags): Provide function only if not defined + as a macro. + (sh_elf_copy_private_data): Similar. + (sh_elf_merge_private_data): Similar. + * section.c (SEC_SH_ISA_SHMEDIA): New. + * targets.c (bfd_elf32_sh64_vec, bfd_elf32_sh64l_vec): Declare. + * elf32-sh64.c: New file. + * libbfd.h: Regenerate. + * bfd-in2.h: Regenerate. + * po/POTFILES.in: Regenerate. + * po/bfd.pot: Regenerate. + * bfd-in2.h: Regenerate. + * libbfd.h: Regenerate. + +2002-02-07 Daniel Jacobowitz + + * bfd-in.h: Update check to only see if has + been included, not drag it in. + * bfd-in2.h: Regenerate. + 2002-02-06 H.J. Lu (hjl@gnu.org) * elf32-mips.c (_bfd_mips_elf_merge_private_bfd_data): Update @@ -31,6 +776,7 @@ sym check if we find one. * elf64-s390.c (elf_s390_size_dynamic_sections): Likewise. * elf32-hppa.c (elf32_hppa_size_dynamic_sections): Likewise. + * elf32-i386.c (elf_i386_size_dynamic_sections): Likewise. * elf32-s390.c (elf_s390_size_dynamic_sections): Likewise. (elf_s390_grok_prstatus): Add missing prototype. @@ -57,14 +803,14 @@ 2002-01-31 Philipp Thomas - * coff-arm.c (coff_arm_merge_private_bfd_data): Move ERROR - to front of message. Unify messages with elf32-arm.h. Use - commas where neccessary. - * elf32-arm.h (elf32_arm_merge_private_bfd_data): Use all upcase - ERROR in messages. Unify messages with coff-arm.c. Correct - VFP/FPA error message. - (elf32_arm_print_private_bfd_data): Don't mark APCS-26 and - APCS-32 for translation. + * coff-arm.c (coff_arm_merge_private_bfd_data): Move ERROR + to front of message. Unify messages with elf32-arm.h. Use + commas where neccessary. + * elf32-arm.h (elf32_arm_merge_private_bfd_data): Use all upcase + ERROR in messages. Unify messages with coff-arm.c. Correct + VFP/FPA error message. + (elf32_arm_print_private_bfd_data): Don't mark APCS-26 and + APCS-32 for translation. 2002-02-01 Hans-Peter Nilsson diff -uprN binutils-2.11.93.0.2/bfd/ChangeLog-9495 binutils-2.12.90.0.1/bfd/ChangeLog-9495 --- binutils-2.11.93.0.2/bfd/ChangeLog-9495 Fri Mar 9 11:15:21 2001 +++ binutils-2.12.90.0.1/bfd/ChangeLog-9495 Thu Mar 7 11:52:36 2002 @@ -6887,7 +6887,7 @@ Tue May 24 16:17:18 1994 Ian Lance Tayl * libelf.h (struct elf_obj_tdata): Add new field bad_symtab. (elf_bad_symtab): Define new accessor macro. (_bfd_elf_link_hash_newfunc): Declare. - (_bew_elf_link_hash_table_init): Declare. + (_bfd_elf_link_hash_table_init): Declare. * elfcode.h (elf_object_p): Call backend object_p hook after swapping in all the section headers. (map_program_segments): Correct typo: Internal for External. diff -uprN binutils-2.11.93.0.2/bfd/Makefile.am binutils-2.12.90.0.1/bfd/Makefile.am --- binutils-2.11.93.0.2/bfd/Makefile.am Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/Makefile.am Thu Mar 7 11:52:36 2002 @@ -221,6 +221,7 @@ BFD32_BACKENDS = \ elf32-s390.lo \ elf32-sh.lo \ elf32-sh-lin.lo \ + elf32-sh64.lo \ elf32-sh-nbsd.lo \ elf32-sparc.lo \ elf32-v850.lo \ @@ -364,6 +365,7 @@ BFD32_BACKENDS_CFILES = \ elf32-or32.c \ elf32-pj.c \ elf32-ppc.c \ + elf32-sh64.c \ elf32-s390.c \ elf32-sh.c \ elf32-sh-lin.c \ @@ -451,6 +453,7 @@ BFD64_BACKENDS = \ elf64-gen.lo \ elf64-mips.lo \ elf64-mmix.lo \ + elf64-sh64.lo \ elf64-ppc.lo \ elf64-s390.lo \ elf64-sparc.lo \ @@ -474,6 +477,7 @@ BFD64_BACKENDS_CFILES = \ elf64-mmix.c \ elf64-ppc.c \ elf64-s390.c \ + elf64-sh64.c \ elf64-sparc.c \ elf64.c \ mmo.c \ @@ -1135,6 +1139,11 @@ elf32-ppc.lo: elf32-ppc.c $(INCDIR)/file elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \ elf32-target.h +elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \ + elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ + elf32-target.h elf32-s390.lo: elf32-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h \ @@ -1414,6 +1423,10 @@ elf64-s390.lo: elf64-s390.c $(INCDIR)/fi elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h \ elf64-target.h +elf64-sh64.lo: elf64-sh64.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ + elf64-target.h elf64-sparc.lo: elf64-sparc.c $(INCDIR)/filenames.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/sparc.h \ diff -uprN binutils-2.11.93.0.2/bfd/Makefile.in binutils-2.12.90.0.1/bfd/Makefile.in --- binutils-2.11.93.0.2/bfd/Makefile.in Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/Makefile.in Thu Mar 7 11:52:36 2002 @@ -349,6 +349,7 @@ BFD32_BACKENDS = \ elf32-s390.lo \ elf32-sh.lo \ elf32-sh-lin.lo \ + elf32-sh64.lo \ elf32-sh-nbsd.lo \ elf32-sparc.lo \ elf32-v850.lo \ @@ -493,6 +494,7 @@ BFD32_BACKENDS_CFILES = \ elf32-or32.c \ elf32-pj.c \ elf32-ppc.c \ + elf32-sh64.c \ elf32-s390.c \ elf32-sh.c \ elf32-sh-lin.c \ @@ -581,6 +583,7 @@ BFD64_BACKENDS = \ elf64-gen.lo \ elf64-mips.lo \ elf64-mmix.lo \ + elf64-sh64.lo \ elf64-ppc.lo \ elf64-s390.lo \ elf64-sparc.lo \ @@ -605,6 +608,7 @@ BFD64_BACKENDS_CFILES = \ elf64-mmix.c \ elf64-ppc.c \ elf64-s390.c \ + elf64-sh64.c \ elf64-sparc.c \ elf64.c \ mmo.c \ @@ -1679,6 +1683,11 @@ elf32-ppc.lo: elf32-ppc.c $(INCDIR)/file elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \ elf32-target.h +elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \ + elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ + elf32-target.h elf32-s390.lo: elf32-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h \ @@ -1958,6 +1967,10 @@ elf64-s390.lo: elf64-s390.c $(INCDIR)/fi elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h \ elf64-target.h +elf64-sh64.lo: elf64-sh64.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ + elf64-target.h elf64-sparc.lo: elf64-sparc.c $(INCDIR)/filenames.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/sparc.h \ diff -uprN binutils-2.11.93.0.2/bfd/aclocal.m4 binutils-2.12.90.0.1/bfd/aclocal.m4 --- binutils-2.11.93.0.2/bfd/aclocal.m4 Fri Apr 27 14:28:04 2001 +++ binutils-2.12.90.0.1/bfd/aclocal.m4 Thu Mar 7 11:52:36 2002 @@ -1,6 +1,6 @@ -dnl aclocal.m4 generated automatically by aclocal 1.4 +dnl aclocal.m4 generated automatically by aclocal 1.4-p5 -dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -145,7 +145,7 @@ AC_SUBST(INTLLIBS) dnl Usage: dnl AM_INIT_AUTOMAKE(package,version, [no-define]) -AC_DEFUN(AM_INIT_AUTOMAKE, +AC_DEFUN([AM_INIT_AUTOMAKE], [AC_REQUIRE([AC_PROG_INSTALL]) PACKAGE=[$1] AC_SUBST(PACKAGE) @@ -173,7 +173,7 @@ AC_REQUIRE([AC_PROG_MAKE_SET])]) # Check to make sure that the build environment is sane. # -AC_DEFUN(AM_SANITY_CHECK, +AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 @@ -214,7 +214,7 @@ AC_MSG_RESULT(yes)]) dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) dnl The program must properly implement --version. -AC_DEFUN(AM_MISSING_PROG, +AC_DEFUN([AM_MISSING_PROG], [AC_MSG_CHECKING(for working $2) # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. @@ -230,7 +230,7 @@ AC_SUBST($1)]) # Like AC_CONFIG_HEADER, but automatically create stamp file. -AC_DEFUN(AM_CONFIG_HEADER, +AC_DEFUN([AM_CONFIG_HEADER], [AC_PREREQ([2.12]) AC_CONFIG_HEADER([$1]) dnl When config.status generates a header, we must update the stamp-h file. @@ -256,7 +256,7 @@ changequote([,]))]) # serial 1 -AC_DEFUN(AM_MAINTAINER_MODE, +AC_DEFUN([AM_MAINTAINER_MODE], [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode is disabled by default AC_ARG_ENABLE(maintainer-mode, @@ -273,7 +273,7 @@ AC_DEFUN(AM_MAINTAINER_MODE, # Define a conditional. -AC_DEFUN(AM_CONDITIONAL, +AC_DEFUN([AM_CONDITIONAL], [AC_SUBST($1_TRUE) AC_SUBST($1_FALSE) if $2; then diff -uprN binutils-2.11.93.0.2/bfd/archures.c binutils-2.12.90.0.1/bfd/archures.c --- binutils-2.11.93.0.2/bfd/archures.c Thu Feb 7 10:21:03 2002 +++ binutils-2.12.90.0.1/bfd/archures.c Thu Mar 7 11:52:36 2002 @@ -207,6 +207,7 @@ DESCRIPTION .#define bfd_mach_sh3_dsp 0x3d .#define bfd_mach_sh3e 0x3e .#define bfd_mach_sh4 0x40 +.#define bfd_mach_sh5 0x50 . bfd_arch_alpha, {* Dec Alpha *} .#define bfd_mach_alpha_ev4 0x10 .#define bfd_mach_alpha_ev5 0x20 @@ -258,8 +259,8 @@ DESCRIPTION .#define bfd_mach_avr5 5 . bfd_arch_cris, {* Axis CRIS *} . bfd_arch_s390, {* IBM s390 *} -.#define bfd_mach_s390_esa 0 -.#define bfd_mach_s390_esame 1 +.#define bfd_mach_s390_31 0 +.#define bfd_mach_s390_64 1 . bfd_arch_openrisc, {* OpenRISC *} . bfd_arch_mmix, {* Donald Knuth's educational processor. *} . bfd_arch_xstormy16, diff -uprN binutils-2.11.93.0.2/bfd/bfd-in.h binutils-2.12.90.0.1/bfd/bfd-in.h --- binutils-2.11.93.0.2/bfd/bfd-in.h Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/bfd-in.h Thu Mar 7 11:52:36 2002 @@ -89,12 +89,13 @@ typedef struct _bfd bfd; /* It gets worse if the host also defines a true/false enum... -sts */ /* And even worse if your compiler has built-in boolean types... -law */ /* And even worse if your compiler provides a stdbool.h that conflicts - with these definitions... gcc 2.95 and later do. -drow */ + with these definitions... gcc 2.95 and later do. If so, it must + be included first. -drow */ #if defined (__GNUG__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6)) #define TRUE_FALSE_ALREADY_DEFINED #else -#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)) -#include +#if defined (__bool_true_false_are_defined) +/* We have . */ #define TRUE_FALSE_ALREADY_DEFINED #endif #endif @@ -744,9 +745,9 @@ extern boolean bfd_xcoff_record_link_ass extern boolean bfd_xcoff_size_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *, const char *, const char *, unsigned long, unsigned long, unsigned long, boolean, - int, boolean, boolean, struct sec **)); + int, boolean, boolean, struct sec **, boolean)); extern boolean bfd_xcoff_link_generate_rtinit - PARAMS ((bfd *, const char *, const char *)); + PARAMS ((bfd *, const char *, const char *, boolean)); /* Externally visible COFF routines. */ diff -uprN binutils-2.11.93.0.2/bfd/bfd-in2.h binutils-2.12.90.0.1/bfd/bfd-in2.h --- binutils-2.11.93.0.2/bfd/bfd-in2.h Thu Feb 7 10:21:03 2002 +++ binutils-2.12.90.0.1/bfd/bfd-in2.h Thu Mar 7 11:52:36 2002 @@ -95,12 +95,13 @@ typedef struct _bfd bfd; /* It gets worse if the host also defines a true/false enum... -sts */ /* And even worse if your compiler has built-in boolean types... -law */ /* And even worse if your compiler provides a stdbool.h that conflicts - with these definitions... gcc 2.95 and later do. -drow */ + with these definitions... gcc 2.95 and later do. If so, it must + be included first. -drow */ #if defined (__GNUG__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6)) #define TRUE_FALSE_ALREADY_DEFINED #else -#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)) -#include +#if defined (__bool_true_false_are_defined) +/* We have . */ #define TRUE_FALSE_ALREADY_DEFINED #endif #endif @@ -750,9 +751,9 @@ extern boolean bfd_xcoff_record_link_ass extern boolean bfd_xcoff_size_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *, const char *, const char *, unsigned long, unsigned long, unsigned long, boolean, - int, boolean, boolean, struct sec **)); + int, boolean, boolean, struct sec **, boolean)); extern boolean bfd_xcoff_link_generate_rtinit - PARAMS ((bfd *, const char *, const char *)); + PARAMS ((bfd *, const char *, const char *, boolean)); /* Externally visible COFF routines. */ @@ -1585,6 +1586,7 @@ enum bfd_architecture #define bfd_mach_sh3_dsp 0x3d #define bfd_mach_sh3e 0x3e #define bfd_mach_sh4 0x40 +#define bfd_mach_sh5 0x50 bfd_arch_alpha, /* Dec Alpha */ #define bfd_mach_alpha_ev4 0x10 #define bfd_mach_alpha_ev5 0x20 @@ -1636,8 +1638,8 @@ enum bfd_architecture #define bfd_mach_avr5 5 bfd_arch_cris, /* Axis CRIS */ bfd_arch_s390, /* IBM s390 */ -#define bfd_mach_s390_esa 0 -#define bfd_mach_s390_esame 1 +#define bfd_mach_s390_31 0 +#define bfd_mach_s390_64 1 bfd_arch_openrisc, /* OpenRISC */ bfd_arch_mmix, /* Donald Knuth's educational processor. */ bfd_arch_xstormy16, @@ -2134,6 +2136,11 @@ GP register. */ BFD_RELOC_ALPHA_GPREL_HI16, BFD_RELOC_ALPHA_GPREL_LO16, +/* Like BFD_RELOC_23_PCREL_S2, except that the source and target must +share a common GP, and the target address is adjusted for +STO_ALPHA_STD_GPLOAD. */ + BFD_RELOC_ALPHA_BRSGP, + /* Bits 27..2 of the relocation address shifted right 2 bits; simple reloc otherwise. */ BFD_RELOC_MIPS_JMP, @@ -2187,6 +2194,55 @@ to compensate for the borrow when the lo BFD_RELOC_MIPS_REL16, BFD_RELOC_MIPS_RELGOT, BFD_RELOC_MIPS_JALR, + BFD_RELOC_SH_GOT_LOW16, + BFD_RELOC_SH_GOT_MEDLOW16, + BFD_RELOC_SH_GOT_MEDHI16, + BFD_RELOC_SH_GOT_HI16, + BFD_RELOC_SH_GOTPLT_LOW16, + BFD_RELOC_SH_GOTPLT_MEDLOW16, + BFD_RELOC_SH_GOTPLT_MEDHI16, + BFD_RELOC_SH_GOTPLT_HI16, + BFD_RELOC_SH_PLT_LOW16, + BFD_RELOC_SH_PLT_MEDLOW16, + BFD_RELOC_SH_PLT_MEDHI16, + BFD_RELOC_SH_PLT_HI16, + BFD_RELOC_SH_GOTOFF_LOW16, + BFD_RELOC_SH_GOTOFF_MEDLOW16, + BFD_RELOC_SH_GOTOFF_MEDHI16, + BFD_RELOC_SH_GOTOFF_HI16, + BFD_RELOC_SH_GOTPC_LOW16, + BFD_RELOC_SH_GOTPC_MEDLOW16, + BFD_RELOC_SH_GOTPC_MEDHI16, + BFD_RELOC_SH_GOTPC_HI16, + BFD_RELOC_SH_COPY64, + BFD_RELOC_SH_GLOB_DAT64, + BFD_RELOC_SH_JMP_SLOT64, + BFD_RELOC_SH_RELATIVE64, + BFD_RELOC_SH_GOT10BY4, + BFD_RELOC_SH_GOT10BY8, + BFD_RELOC_SH_GOTPLT10BY4, + BFD_RELOC_SH_GOTPLT10BY8, + BFD_RELOC_SH_GOTPLT32, + BFD_RELOC_SH_SHMEDIA_CODE, + BFD_RELOC_SH_IMMU5, + BFD_RELOC_SH_IMMS6, + BFD_RELOC_SH_IMMS6BY32, + BFD_RELOC_SH_IMMU6, + BFD_RELOC_SH_IMMS10, + BFD_RELOC_SH_IMMS10BY2, + BFD_RELOC_SH_IMMS10BY4, + BFD_RELOC_SH_IMMS10BY8, + BFD_RELOC_SH_IMMS16, + BFD_RELOC_SH_IMMU16, + BFD_RELOC_SH_IMM_LOW16, + BFD_RELOC_SH_IMM_LOW16_PCREL, + BFD_RELOC_SH_IMM_MEDLOW16, + BFD_RELOC_SH_IMM_MEDLOW16_PCREL, + BFD_RELOC_SH_IMM_MEDHI16, + BFD_RELOC_SH_IMM_MEDHI16_PCREL, + BFD_RELOC_SH_IMM_HI16, + BFD_RELOC_SH_IMM_HI16_PCREL, + BFD_RELOC_SH_PT_16, /* i386/elf relocations */ diff -uprN binutils-2.11.93.0.2/bfd/bfd.c binutils-2.12.90.0.1/bfd/bfd.c --- binutils-2.11.93.0.2/bfd/bfd.c Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/bfd.c Thu Mar 7 11:52:36 2002 @@ -1008,7 +1008,8 @@ DESCRIPTION in hex if a leading "0x" or "0X" is found, otherwise in octal if a leading zero is found, otherwise in decimal. - Overflow is not detected. + If the value would overflow, the maximum <> value is + returned. */ bfd_vma @@ -1018,48 +1019,64 @@ bfd_scan_vma (string, end, base) int base; { bfd_vma value; - int digit; + bfd_vma cutoff; + unsigned int cutlim; + int overflow; /* Let the host do it if possible. */ if (sizeof (bfd_vma) <= sizeof (unsigned long)) return (bfd_vma) strtoul (string, (char **) end, base); - /* A negative base makes no sense, and we only need to go as high as hex. */ - if ((base < 0) || (base > 16)) - return (bfd_vma) 0; - if (base == 0) { if (string[0] == '0') { if ((string[1] == 'x') || (string[1] == 'X')) base = 16; - /* XXX should we also allow "0b" or "0B" to set base to 2? */ else base = 8; } - else - base = 10; } - if ((base == 16) && - (string[0] == '0') && ((string[1] == 'x') || (string[1] == 'X'))) - string += 2; - /* XXX should we also skip over "0b" or "0B" if base is 2? */ - -/* Speed could be improved with a table like hex_value[] in gas. */ -#define HEX_VALUE(c) \ - (ISXDIGIT (c) \ - ? (ISDIGIT (c) \ - ? (c - '0') \ - : (10 + c - (ISLOWER (c) ? 'a' : 'A'))) \ - : 42) + if ((base < 2) || (base > 36)) + base = 10; + + if (base == 16 + && string[0] == '0' + && (string[1] == 'x' || string[1] == 'X') + && ISXDIGIT (string[2])) + { + string += 2; + } + + cutoff = (~ (bfd_vma) 0) / (bfd_vma) base; + cutlim = (~ (bfd_vma) 0) % (bfd_vma) base; + value = 0; + overflow = 0; + while (1) + { + unsigned int digit; + + digit = *string; + if (ISDIGIT (digit)) + digit = digit - '0'; + else if (ISALPHA (digit)) + digit = TOUPPER (digit) - 'A' + 10; + else + break; + if (digit >= (unsigned int) base) + break; + if (value > cutoff || (value == cutoff && digit > cutlim)) + overflow = 1; + value = value * base + digit; + ++string; + } - for (value = 0; (digit = HEX_VALUE (* string)) < base; string ++) - value = value * base + digit; + if (overflow) + value = ~ (bfd_vma) 0; - if (end) - * end = string; + if (end != NULL) + *end = string; return value; } diff -uprN binutils-2.11.93.0.2/bfd/coff-or32.c binutils-2.12.90.0.1/bfd/coff-or32.c --- binutils-2.11.93.0.2/bfd/coff-or32.c Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/coff-or32.c Thu Mar 7 11:52:36 2002 @@ -28,9 +28,10 @@ #include "libcoff.h" static long get_symbol_value PARAMS ((asymbol *)); -static bfd_reloc_status_type or1_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static boolean coff_or1_relocate_section PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, struct internal_reloc *, struct internal_syment *, asection **)); -static boolean coff_or1_adjust_symndx PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, struct internal_reloc *, boolean *)); +static bfd_reloc_status_type or32_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static boolean coff_or32_relocate_section PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, struct internal_reloc *, struct internal_syment *, asection **)); +static boolean coff_or32_adjust_symndx PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, struct internal_reloc *, boolean *)); +static void reloc_processing PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *)); #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2) @@ -249,9 +250,29 @@ or32_reloc (abfd, reloc_entry, symbol_in static reloc_howto_type howto_table[] = { { R_ABS, 0, 3, 32, false, 0, complain_overflow_bitfield, or32_reloc, "ABS", true, 0xffffffff,0xffffffff, false }, - {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, - {11}, {12}, {13}, {14}, {15}, {16}, {17}, {18}, {19}, {20}, - {21}, {22}, {23}, + EMPTY_HOWTO (1), + EMPTY_HOWTO (2), + EMPTY_HOWTO (3), + EMPTY_HOWTO (4), + EMPTY_HOWTO (5), + EMPTY_HOWTO (6), + EMPTY_HOWTO (7), + EMPTY_HOWTO (8), + EMPTY_HOWTO (9), + EMPTY_HOWTO (10), + EMPTY_HOWTO (11), + EMPTY_HOWTO (12), + EMPTY_HOWTO (13), + EMPTY_HOWTO (14), + EMPTY_HOWTO (15), + EMPTY_HOWTO (16), + EMPTY_HOWTO (17), + EMPTY_HOWTO (18), + EMPTY_HOWTO (19), + EMPTY_HOWTO (20), + EMPTY_HOWTO (21), + EMPTY_HOWTO (22), + EMPTY_HOWTO (23), { R_IREL, 0, 3, 32, true, 0, complain_overflow_signed, or32_reloc, "IREL", true, 0xffffffff,0xffffffff, false }, { R_IABS, 0, 3, 32, false, 0, complain_overflow_bitfield, or32_reloc, "IABS", true, 0xffffffff,0xffffffff, false }, { R_ILOHALF, 0, 3, 16, true, 0, complain_overflow_signed, or32_reloc, "ILOHALF", true, 0x0000ffff,0x0000ffff, false }, @@ -318,7 +339,7 @@ reloc_processing (relent,reloc, symbols, static boolean coff_or32_relocate_section (output_bfd, info, input_bfd, input_section, contents, relocs, syms, sections) - bfd *output_bfd; + bfd *output_bfd ATTRIBUTE_UNUSED; struct bfd_link_info *info; bfd *input_bfd; asection *input_section; diff -uprN binutils-2.11.93.0.2/bfd/coff-rs6000.c binutils-2.12.90.0.1/bfd/coff-rs6000.c --- binutils-2.11.93.0.2/bfd/coff-rs6000.c Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/coff-rs6000.c Thu Mar 7 11:52:36 2002 @@ -1,6 +1,5 @@ /* BFD back-end for IBM RS/6000 "XCOFF" files. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001 + Copyright 1990-1999, 2000, 2001, 2002 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 @@ -81,8 +80,9 @@ void _bfd_xcoff_rtype2howto PARAMS ((are #define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name #define coff_bfd_reloc_type_lookup _bfd_xcoff_reloc_type_lookup #ifdef AIX_CORE -extern const bfd_target * rs6000coff_core_p (); -extern boolean rs6000coff_core_file_matches_executable_p (); +extern const bfd_target * rs6000coff_core_p PARAMS ((bfd *abfd)); +extern boolean rs6000coff_core_file_matches_executable_p + PARAMS ((bfd *cbfd, bfd *ebfd)); extern char *rs6000coff_core_file_failing_command PARAMS ((bfd *abfd)); extern int rs6000coff_core_file_failing_signal PARAMS ((bfd *abfd)); #define CORE_FILE_P rs6000coff_core_p @@ -144,8 +144,7 @@ static bfd_vma xcoff_loader_symbol_offse static bfd_vma xcoff_loader_reloc_offset PARAMS ((bfd *, struct internal_ldhdr *)); static boolean xcoff_generate_rtinit - PARAMS((bfd *, const char *, const char *)); - + PARAMS((bfd *, const char *, const char *, boolean)); /* We use our own tdata type. Its first field is the COFF tdata type, so the COFF routines are compatible. */ @@ -517,7 +516,7 @@ end: reloc_howto_type xcoff_howto_table[] = { /* Standard 32 bit relocation. */ - HOWTO (0, /* type */ + HOWTO (R_POS, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 32, /* bitsize */ @@ -532,7 +531,7 @@ reloc_howto_type xcoff_howto_table[] = false), /* pcrel_offset */ /* 32 bit relocation, but store negative value. */ - HOWTO (1, /* type */ + HOWTO (R_NEG, /* type */ 0, /* rightshift */ -2, /* size (0 = byte, 1 = short, 2 = long) */ 32, /* bitsize */ @@ -547,7 +546,7 @@ reloc_howto_type xcoff_howto_table[] = false), /* pcrel_offset */ /* 32 bit PC relative relocation. */ - HOWTO (2, /* type */ + HOWTO (R_REL, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 32, /* bitsize */ @@ -562,7 +561,7 @@ reloc_howto_type xcoff_howto_table[] = false), /* pcrel_offset */ /* 16 bit TOC relative relocation. */ - HOWTO (3, /* type */ + HOWTO (R_TOC, /* type */ 0, /* rightshift */ 1, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ @@ -577,7 +576,7 @@ reloc_howto_type xcoff_howto_table[] = false), /* pcrel_offset */ /* I don't really know what this is. */ - HOWTO (4, /* type */ + HOWTO (R_RTB, /* type */ 1, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 32, /* bitsize */ @@ -592,7 +591,7 @@ reloc_howto_type xcoff_howto_table[] = false), /* pcrel_offset */ /* External TOC relative symbol. */ - HOWTO (5, /* type */ + HOWTO (R_GL, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ @@ -607,7 +606,7 @@ reloc_howto_type xcoff_howto_table[] = false), /* pcrel_offset */ /* Local TOC relative symbol. */ - HOWTO (6, /* type */ + HOWTO (R_TCL, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ @@ -624,7 +623,7 @@ reloc_howto_type xcoff_howto_table[] = EMPTY_HOWTO (7), /* Non modifiable absolute branch. */ - HOWTO (8, /* type */ + HOWTO (R_BA, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 26, /* bitsize */ @@ -641,7 +640,7 @@ reloc_howto_type xcoff_howto_table[] = EMPTY_HOWTO (9), /* Non modifiable relative branch. */ - HOWTO (0xa, /* type */ + HOWTO (R_BR, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 26, /* bitsize */ @@ -658,7 +657,7 @@ reloc_howto_type xcoff_howto_table[] = EMPTY_HOWTO (0xb), /* Indirect load. */ - HOWTO (0xc, /* type */ + HOWTO (R_RL, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ @@ -673,7 +672,7 @@ reloc_howto_type xcoff_howto_table[] = false), /* pcrel_offset */ /* Load address. */ - HOWTO (0xd, /* type */ + HOWTO (R_RLA, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ @@ -690,7 +689,7 @@ reloc_howto_type xcoff_howto_table[] = EMPTY_HOWTO (0xe), /* Non-relocating reference. */ - HOWTO (0xf, /* type */ + HOWTO (R_REF, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 32, /* bitsize */ @@ -708,7 +707,7 @@ reloc_howto_type xcoff_howto_table[] = EMPTY_HOWTO (0x11), /* TOC relative indirect load. */ - HOWTO (0x12, /* type */ + HOWTO (R_TRL, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ @@ -723,7 +722,7 @@ reloc_howto_type xcoff_howto_table[] = false), /* pcrel_offset */ /* TOC relative load address. */ - HOWTO (0x13, /* type */ + HOWTO (R_TRLA, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ @@ -738,7 +737,7 @@ reloc_howto_type xcoff_howto_table[] = false), /* pcrel_offset */ /* Modifiable relative branch. */ - HOWTO (0x14, /* type */ + HOWTO (R_RRTBI, /* type */ 1, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 32, /* bitsize */ @@ -753,7 +752,7 @@ reloc_howto_type xcoff_howto_table[] = false), /* pcrel_offset */ /* Modifiable absolute branch. */ - HOWTO (0x15, /* type */ + HOWTO (R_RRTBA, /* type */ 1, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 32, /* bitsize */ @@ -768,7 +767,7 @@ reloc_howto_type xcoff_howto_table[] = false), /* pcrel_offset */ /* Modifiable call absolute indirect. */ - HOWTO (0x16, /* type */ + HOWTO (R_CAI, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ @@ -783,7 +782,7 @@ reloc_howto_type xcoff_howto_table[] = false), /* pcrel_offset */ /* Modifiable call relative. */ - HOWTO (0x17, /* type */ + HOWTO (R_CREL, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ @@ -798,7 +797,7 @@ reloc_howto_type xcoff_howto_table[] = false), /* pcrel_offset */ /* Modifiable branch absolute. */ - HOWTO (0x18, /* type */ + HOWTO (R_RBA, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 26, /* bitsize */ @@ -813,7 +812,7 @@ reloc_howto_type xcoff_howto_table[] = false), /* pcrel_offset */ /* Modifiable branch absolute. */ - HOWTO (0x19, /* type */ + HOWTO (R_RBAC, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 32, /* bitsize */ @@ -828,7 +827,7 @@ reloc_howto_type xcoff_howto_table[] = false), /* pcrel_offset */ /* Modifiable branch relative. */ - HOWTO (0x1a, /* type */ + HOWTO (R_RBR, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 26, /* bitsize */ @@ -843,7 +842,7 @@ reloc_howto_type xcoff_howto_table[] = false), /* pcrel_offset */ /* Modifiable branch absolute. */ - HOWTO (0x1b, /* type */ + HOWTO (R_RBRC, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ @@ -857,7 +856,7 @@ reloc_howto_type xcoff_howto_table[] = 0xffff, /* dst_mask */ false), /* pcrel_offset */ - HOWTO (0, /* type */ + HOWTO (R_POS, /* type */ 0, /* rightshift */ 4, /* size (0 = byte, 1 = short, 2 = long) */ 64, /* bitsize */ @@ -869,8 +868,22 @@ reloc_howto_type xcoff_howto_table[] = true, /* partial_inplace */ MINUS_ONE, /* src_mask */ MINUS_ONE, /* dst_mask */ - false) /* pcrel_offset */ + false), /* pcrel_offset */ + /* 16 bit Non modifiable absolute branch. */ + HOWTO (R_BA, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + 0, /* special_function */ + "R_BA", /* name */ + true, /* partial_inplace */ + 0xfffc, /* src_mask */ + 0xfffc, /* dst_mask */ + false), /* pcrel_offset */ }; void @@ -913,6 +926,8 @@ _bfd_xcoff_reloc_type_lookup (abfd, code { case BFD_RELOC_PPC_B26: return &xcoff_howto_table[0xa]; + case BFD_RELOC_PPC_BA16: + return &xcoff_howto_table[0x1d]; case BFD_RELOC_PPC_BA26: return &xcoff_howto_table[8]; case BFD_RELOC_PPC_TOC16: @@ -3051,18 +3066,19 @@ xcoff_loader_reloc_offset (abfd, ldhdr) } static boolean -xcoff_generate_rtinit (abfd, init, fini) +xcoff_generate_rtinit (abfd, init, fini, rtld) bfd *abfd; const char *init; const char *fini; + boolean rtld; { bfd_byte filehdr_ext[FILHSZ]; bfd_byte scnhdr_ext[SCNHSZ]; - bfd_byte syment_ext[SYMESZ * 8]; - bfd_byte reloc_ext[RELSZ * 2]; + bfd_byte syment_ext[SYMESZ * 10]; + bfd_byte reloc_ext[RELSZ * 3]; bfd_byte *data_buffer; bfd_size_type data_buffer_size; - bfd_byte *string_table, *st_tmp; + bfd_byte *string_table = NULL, *st_tmp = NULL; bfd_size_type string_table_size; bfd_vma val; size_t initsz, finisz; @@ -3074,9 +3090,9 @@ xcoff_generate_rtinit (abfd, init, fini char *data_name = ".data"; char *rtinit_name = "__rtinit"; + char *rtld_name = "__rtld"; - if (! bfd_xcoff_rtinit_size (abfd) - || (init == NULL && fini == NULL)) + if (! bfd_xcoff_rtinit_size (abfd)) return false; initsz = (init == NULL ? 0 : 1 + strlen (init)); @@ -3088,7 +3104,7 @@ xcoff_generate_rtinit (abfd, init, fini filehdr.f_magic = bfd_xcoff_magic_number (abfd); filehdr.f_nscns = 1; filehdr.f_timdat = 0; - filehdr.f_nsyms = 0; /* at least 6, no more than 8 */ + filehdr.f_nsyms = 0; /* at least 6, no more than 10 */ filehdr.f_symptr = 0; /* set below */ filehdr.f_opthdr = 0; filehdr.f_flags = 0; @@ -3179,9 +3195,10 @@ xcoff_generate_rtinit (abfd, init, fini 0. .data csect 2. __rtinit 4. init function - 6. fini function */ - memset (syment_ext, 0, 8 * SYMESZ); - memset (reloc_ext, 0, 2 * RELSZ); + 6. fini function + 8. __rtld */ + memset (syment_ext, 0, 10 * SYMESZ); + memset (reloc_ext, 0, 3 * RELSZ); /* .data csect */ memset (&syment, 0, sizeof (struct internal_syment)); @@ -3287,6 +3304,32 @@ xcoff_generate_rtinit (abfd, init, fini scnhdr.s_nreloc += 1; } + if (rtld) + { + memset (&syment, 0, sizeof (struct internal_syment)); + memset (&auxent, 0, sizeof (union internal_auxent)); + memcpy (syment._n._n_name, rtld_name, strlen (rtld_name)); + syment.n_sclass = C_EXT; + syment.n_numaux = 1; + bfd_coff_swap_sym_out (abfd, &syment, + &syment_ext[filehdr.f_nsyms * SYMESZ]); + bfd_coff_swap_aux_out (abfd, &auxent, syment.n_type, syment.n_sclass, 0, + syment.n_numaux, + &syment_ext[(filehdr.f_nsyms + 1) * SYMESZ]); + + /* reloc */ + memset (&reloc, 0, sizeof (struct internal_reloc)); + reloc.r_vaddr = 0x0000; + reloc.r_symndx = filehdr.f_nsyms; + reloc.r_type = R_POS; + reloc.r_size = 31; + bfd_coff_swap_reloc_out (abfd, &reloc, + &reloc_ext[scnhdr.s_nreloc * RELSZ]); + + filehdr.f_nsyms += 2; + scnhdr.s_nreloc += 1; + } + scnhdr.s_relptr = scnhdr.s_scnptr + data_buffer_size; filehdr.f_symptr = scnhdr.s_relptr + scnhdr.s_nreloc * RELSZ; @@ -3696,7 +3739,6 @@ static const struct xcoff_backend_data_r /* rtinit */ 0, /* _xcoff_rtinit_size */ xcoff_generate_rtinit, /* _xcoff_generate_rtinit */ - }; /* The transfer vector that leads the outside world to all of the above. */ diff -uprN binutils-2.11.93.0.2/bfd/coff-sh.c binutils-2.12.90.0.1/bfd/coff-sh.c --- binutils-2.11.93.0.2/bfd/coff-sh.c Mon Oct 1 15:25:21 2001 +++ binutils-2.12.90.0.1/bfd/coff-sh.c Thu Mar 7 11:52:36 2002 @@ -469,7 +469,7 @@ coff_sh_rtype_to_howto (abfd, sec, rel, /* This structure is used to map BFD reloc codes to SH PE relocs. */ struct shcoff_reloc_map { - unsigned char bfd_reloc_val; + bfd_reloc_code_real_type bfd_reloc_val; unsigned char shcoff_reloc_val; }; diff -uprN binutils-2.11.93.0.2/bfd/coff64-rs6000.c binutils-2.12.90.0.1/bfd/coff64-rs6000.c --- binutils-2.11.93.0.2/bfd/coff64-rs6000.c Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/coff64-rs6000.c Thu Mar 7 11:52:36 2002 @@ -1,5 +1,5 @@ /* BFD back-end for IBM RS/6000 "XCOFF64" files. - Copyright 2000, 2001 + Copyright 2000, 2001, 2002 Free Software Foundation, Inc. Written Clinton Popetz. Contributed by Cygnus Support. @@ -144,8 +144,7 @@ static bfd_vma xcoff64_loader_symbol_off static bfd_vma xcoff64_loader_reloc_offset PARAMS ((bfd *, struct internal_ldhdr *)); static boolean xcoff64_generate_rtinit - PARAMS((bfd *, const char *, const char *)); - + PARAMS((bfd *, const char *, const char *, boolean)); /* coffcode.h needs these to be defined */ /* Internalcoff.h and coffcode.h modify themselves based on these flags. */ @@ -171,8 +170,9 @@ static boolean xcoff64_generate_rtinit #define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name #define coff_bfd_reloc_type_lookup xcoff64_reloc_type_lookup #ifdef AIX_CORE -extern const bfd_target * rs6000coff_core_p (); -extern boolean rs6000coff_core_file_matches_executable_p (); +extern const bfd_target * rs6000coff_core_p PARAMS ((bfd *abfd)); +extern boolean rs6000coff_core_file_matches_executable_p + PARAMS((bfd *cbfd, bfd *ebfd)); extern char *rs6000coff_core_file_failing_command PARAMS ((bfd *abfd)); extern int rs6000coff_core_file_failing_signal PARAMS ((bfd *abfd)); #define CORE_FILE_P rs6000coff_core_p @@ -1374,7 +1374,7 @@ xcoff64_ppc_relocate_section (output_bfd reloc_howto_type xcoff64_howto_table[] = { /* Standard 64 bit relocation. */ - HOWTO (0, /* type */ + HOWTO (R_POS, /* type */ 0, /* rightshift */ 4, /* size (0 = byte, 1 = short, 2 = long) */ 64, /* bitsize */ @@ -1389,7 +1389,7 @@ reloc_howto_type xcoff64_howto_table[] = false), /* pcrel_offset */ /* 64 bit relocation, but store negative value. */ - HOWTO (1, /* type */ + HOWTO (R_NEG, /* type */ 0, /* rightshift */ -4, /* size (0 = byte, 1 = short, 2 = long) */ 64, /* bitsize */ @@ -1404,7 +1404,7 @@ reloc_howto_type xcoff64_howto_table[] = false), /* pcrel_offset */ /* 32 bit PC relative relocation. */ - HOWTO (2, /* type */ + HOWTO (R_REL, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 32, /* bitsize */ @@ -1419,7 +1419,7 @@ reloc_howto_type xcoff64_howto_table[] = false), /* pcrel_offset */ /* 16 bit TOC relative relocation. */ - HOWTO (3, /* type */ + HOWTO (R_TOC, /* type */ 0, /* rightshift */ 1, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ @@ -1434,7 +1434,7 @@ reloc_howto_type xcoff64_howto_table[] = false), /* pcrel_offset */ /* I don't really know what this is. */ - HOWTO (4, /* type */ + HOWTO (R_RTB, /* type */ 1, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 32, /* bitsize */ @@ -1449,7 +1449,7 @@ reloc_howto_type xcoff64_howto_table[] = false), /* pcrel_offset */ /* External TOC relative symbol. */ - HOWTO (5, /* type */ + HOWTO (R_GL, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ @@ -1464,7 +1464,7 @@ reloc_howto_type xcoff64_howto_table[] = false), /* pcrel_offset */ /* Local TOC relative symbol. */ - HOWTO (6, /* type */ + HOWTO (R_TCL, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ @@ -1481,7 +1481,7 @@ reloc_howto_type xcoff64_howto_table[] = EMPTY_HOWTO (7), /* Non modifiable absolute branch. */ - HOWTO (8, /* type */ + HOWTO (R_BA, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 26, /* bitsize */ @@ -1498,7 +1498,7 @@ reloc_howto_type xcoff64_howto_table[] = EMPTY_HOWTO (9), /* Non modifiable relative branch. */ - HOWTO (0xa, /* type */ + HOWTO (R_BR, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 26, /* bitsize */ @@ -1515,7 +1515,7 @@ reloc_howto_type xcoff64_howto_table[] = EMPTY_HOWTO (0xb), /* Indirect load. */ - HOWTO (0xc, /* type */ + HOWTO (R_RL, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ @@ -1530,7 +1530,7 @@ reloc_howto_type xcoff64_howto_table[] = false), /* pcrel_offset */ /* Load address. */ - HOWTO (0xd, /* type */ + HOWTO (R_RLA, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ @@ -1547,7 +1547,7 @@ reloc_howto_type xcoff64_howto_table[] = EMPTY_HOWTO (0xe), /* Non-relocating reference. */ - HOWTO (0xf, /* type */ + HOWTO (R_REF, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 32, /* bitsize */ @@ -1565,7 +1565,7 @@ reloc_howto_type xcoff64_howto_table[] = EMPTY_HOWTO (0x11), /* TOC relative indirect load. */ - HOWTO (0x12, /* type */ + HOWTO (R_TRL, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ @@ -1580,7 +1580,7 @@ reloc_howto_type xcoff64_howto_table[] = false), /* pcrel_offset */ /* TOC relative load address. */ - HOWTO (0x13, /* type */ + HOWTO (R_TRLA, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ @@ -1595,7 +1595,7 @@ reloc_howto_type xcoff64_howto_table[] = false), /* pcrel_offset */ /* Modifiable relative branch. */ - HOWTO (0x14, /* type */ + HOWTO (R_RRTBI, /* type */ 1, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 32, /* bitsize */ @@ -1610,7 +1610,7 @@ reloc_howto_type xcoff64_howto_table[] = false), /* pcrel_offset */ /* Modifiable absolute branch. */ - HOWTO (0x15, /* type */ + HOWTO (R_RRTBA, /* type */ 1, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 32, /* bitsize */ @@ -1625,7 +1625,7 @@ reloc_howto_type xcoff64_howto_table[] = false), /* pcrel_offset */ /* Modifiable call absolute indirect. */ - HOWTO (0x16, /* type */ + HOWTO (R_CAI, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ @@ -1640,7 +1640,7 @@ reloc_howto_type xcoff64_howto_table[] = false), /* pcrel_offset */ /* Modifiable call relative. */ - HOWTO (0x17, /* type */ + HOWTO (R_CREL, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ @@ -1655,7 +1655,7 @@ reloc_howto_type xcoff64_howto_table[] = false), /* pcrel_offset */ /* Modifiable branch absolute. */ - HOWTO (0x18, /* type */ + HOWTO (R_RBA, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 26, /* bitsize */ @@ -1670,7 +1670,7 @@ reloc_howto_type xcoff64_howto_table[] = false), /* pcrel_offset */ /* Modifiable branch absolute. */ - HOWTO (0x19, /* type */ + HOWTO (R_RBAC, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 32, /* bitsize */ @@ -1685,7 +1685,7 @@ reloc_howto_type xcoff64_howto_table[] = false), /* pcrel_offset */ /* Modifiable branch relative. */ - HOWTO (0x1a, /* type */ + HOWTO (R_RBR, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 26, /* bitsize */ @@ -1700,7 +1700,7 @@ reloc_howto_type xcoff64_howto_table[] = false), /* pcrel_offset */ /* Modifiable branch absolute. */ - HOWTO (0x1b, /* type */ + HOWTO (R_RBRC, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ @@ -1714,7 +1714,7 @@ reloc_howto_type xcoff64_howto_table[] = 0xffff, /* dst_mask */ false), /* pcrel_offset */ - HOWTO (0, /* type */ + HOWTO (R_POS, /* type */ 0, /* rightshift */ 4, /* size (0 = byte, 1 = short, 2 = long) */ 64, /* bitsize */ @@ -1726,7 +1726,22 @@ reloc_howto_type xcoff64_howto_table[] = true, /* partial_inplace */ MINUS_ONE, /* src_mask */ MINUS_ONE, /* dst_mask */ - false) /* pcrel_offset */ + false), /* pcrel_offset */ + + /* 16 bit Non modifiable absolute branch. */ + HOWTO (R_BA, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + 0, /* special_function */ + "R_BA", /* name */ + true, /* partial_inplace */ + 0xfffc, /* src_mask */ + 0xfffc, /* dst_mask */ + false), /* pcrel_offset */ }; void @@ -1769,6 +1784,8 @@ xcoff64_reloc_type_lookup (abfd, code) { case BFD_RELOC_PPC_B26: return &xcoff64_howto_table[0xa]; + case BFD_RELOC_PPC_BA16: + return &xcoff64_howto_table[0x1d]; case BFD_RELOC_PPC_BA26: return &xcoff64_howto_table[8]; case BFD_RELOC_PPC_TOC16: @@ -2098,15 +2115,16 @@ xcoff64_loader_reloc_offset (abfd, ldhdr } static boolean -xcoff64_generate_rtinit (abfd, init, fini) +xcoff64_generate_rtinit (abfd, init, fini, rtld) bfd *abfd; const char *init; const char *fini; + boolean rtld; { bfd_byte filehdr_ext[FILHSZ]; - bfd_byte scnhdr_ext[SCNHSZ]; - bfd_byte syment_ext[SYMESZ * 8]; - bfd_byte reloc_ext[RELSZ * 2]; + bfd_byte scnhdr_ext[SCNHSZ * 3]; + bfd_byte syment_ext[SYMESZ * 10]; + bfd_byte reloc_ext[RELSZ * 3]; bfd_byte *data_buffer; bfd_size_type data_buffer_size; bfd_byte *string_table, *st_tmp; @@ -2114,16 +2132,20 @@ xcoff64_generate_rtinit (abfd, init, fi bfd_vma val; size_t initsz, finisz; struct internal_filehdr filehdr; - struct internal_scnhdr scnhdr; + struct internal_scnhdr text_scnhdr; + struct internal_scnhdr data_scnhdr; + struct internal_scnhdr bss_scnhdr; struct internal_syment syment; union internal_auxent auxent; struct internal_reloc reloc; + char *text_name = ".text"; char *data_name = ".data"; + char *bss_name = ".bss"; char *rtinit_name = "__rtinit"; + char *rtld_name = "__rtld"; - if (! bfd_xcoff_rtinit_size (abfd) - || (init == NULL && fini == NULL)) + if (! bfd_xcoff_rtinit_size (abfd)) return false; initsz = (init == NULL ? 0 : 1 + strlen (init)); @@ -2133,26 +2155,54 @@ xcoff64_generate_rtinit (abfd, init, fi memset (filehdr_ext, 0, FILHSZ); memset (&filehdr, 0, sizeof (struct internal_filehdr)); filehdr.f_magic = bfd_xcoff_magic_number (abfd); - filehdr.f_nscns = 1; + filehdr.f_nscns = 3; filehdr.f_timdat = 0; filehdr.f_nsyms = 0; /* at least 6, no more than 8 */ filehdr.f_symptr = 0; /* set below */ filehdr.f_opthdr = 0; filehdr.f_flags = 0; - /* section header */ - memset (scnhdr_ext, 0, SCNHSZ); - memset (&scnhdr, 0, sizeof (struct internal_scnhdr)); - memcpy (scnhdr.s_name, data_name, strlen (data_name)); - scnhdr.s_paddr = 0; - scnhdr.s_vaddr = 0; - scnhdr.s_size = 0; /* set below */ - scnhdr.s_scnptr = FILHSZ + SCNHSZ; - scnhdr.s_relptr = 0; /* set below */ - scnhdr.s_lnnoptr = 0; - scnhdr.s_nreloc = 0; /* either 1 or 2 */ - scnhdr.s_nlnno = 0; - scnhdr.s_flags = STYP_DATA; + /* section headers */ + memset (scnhdr_ext, 0, 3 * SCNHSZ); + + /* text */ + memset (&text_scnhdr, 0, sizeof (struct internal_scnhdr)); + memcpy (text_scnhdr.s_name, text_name, strlen (text_name)); + text_scnhdr.s_paddr = 0; + text_scnhdr.s_vaddr = 0; + text_scnhdr.s_size = 0; + text_scnhdr.s_scnptr = 0; + text_scnhdr.s_relptr = 0; + text_scnhdr.s_lnnoptr = 0; + text_scnhdr.s_nreloc = 0; + text_scnhdr.s_nlnno = 0; + text_scnhdr.s_flags = STYP_TEXT; + + /* data */ + memset (&data_scnhdr, 0, sizeof (struct internal_scnhdr)); + memcpy (data_scnhdr.s_name, data_name, strlen (data_name)); + data_scnhdr.s_paddr = 0; + data_scnhdr.s_vaddr = 0; + data_scnhdr.s_size = 0; /* set below */ + data_scnhdr.s_scnptr = FILHSZ + 3 * SCNHSZ; + data_scnhdr.s_relptr = 0; /* set below */ + data_scnhdr.s_lnnoptr = 0; + data_scnhdr.s_nreloc = 0; /* either 1 or 2 */ + data_scnhdr.s_nlnno = 0; + data_scnhdr.s_flags = STYP_DATA; + + /* bss */ + memset (&bss_scnhdr, 0, sizeof (struct internal_scnhdr)); + memcpy (bss_scnhdr.s_name, bss_name, strlen (bss_name)); + bss_scnhdr.s_paddr = 0; /* set below */ + bss_scnhdr.s_vaddr = 0; /* set below */ + bss_scnhdr.s_size = 0; /* set below */ + bss_scnhdr.s_scnptr = 0; + bss_scnhdr.s_relptr = 0; + bss_scnhdr.s_lnnoptr = 0; + bss_scnhdr.s_nreloc = 0; + bss_scnhdr.s_nlnno = 0; + bss_scnhdr.s_flags = STYP_BSS; /* .data 0x0000 0x00000000 : rtl @@ -2209,7 +2259,8 @@ xcoff64_generate_rtinit (abfd, init, fi val = 0x10; bfd_put_32 (abfd, val, &data_buffer[0x10]); - scnhdr.s_size = data_buffer_size; + data_scnhdr.s_size = data_buffer_size; + bss_scnhdr.s_paddr = bss_scnhdr.s_vaddr = data_scnhdr.s_size; /* string table */ string_table_size = 4; @@ -2217,6 +2268,8 @@ xcoff64_generate_rtinit (abfd, init, fi string_table_size += strlen (rtinit_name) + 1; string_table_size += initsz; string_table_size += finisz; + if (true == rtld) + string_table_size += strlen (rtld_name) + 1; string_table = (bfd_byte *)bfd_malloc (string_table_size); memset (string_table, 0, string_table_size); @@ -2228,9 +2281,10 @@ xcoff64_generate_rtinit (abfd, init, fi 0. .data csect 2. __rtinit 4. init function - 6. fini function */ - memset (syment_ext, 0, 8 * SYMESZ); - memset (reloc_ext, 0, 2 * RELSZ); + 6. fini function + 8. __rtld */ + memset (syment_ext, 0, 10 * SYMESZ); + memset (reloc_ext, 0, 3 * RELSZ); /* .data csect */ memset (&syment, 0, sizeof (struct internal_syment)); @@ -2240,7 +2294,7 @@ xcoff64_generate_rtinit (abfd, init, fi memcpy (st_tmp, data_name, strlen (data_name)); st_tmp += strlen (data_name) + 1; - syment.n_scnum = 1; + syment.n_scnum = 2; syment.n_sclass = C_HIDEXT; syment.n_numaux = 1; auxent.x_csect.x_scnlen.l = data_buffer_size; @@ -2260,7 +2314,7 @@ xcoff64_generate_rtinit (abfd, init, fi memcpy (st_tmp, rtinit_name, strlen (rtinit_name)); st_tmp += strlen (rtinit_name) + 1; - syment.n_scnum = 1; + syment.n_scnum = 2; syment.n_sclass = C_EXT; syment.n_numaux = 1; auxent.x_csect.x_smtyp = XTY_LD; @@ -2298,7 +2352,7 @@ xcoff64_generate_rtinit (abfd, init, fi bfd_coff_swap_reloc_out (abfd, &reloc, &reloc_ext[0]); filehdr.f_nsyms += 2; - scnhdr.s_nreloc += 1; + data_scnhdr.s_nreloc += 1; } /* finit */ @@ -2326,21 +2380,55 @@ xcoff64_generate_rtinit (abfd, init, fi reloc.r_type = R_POS; reloc.r_size = 63; bfd_coff_swap_reloc_out (abfd, &reloc, - &reloc_ext[scnhdr.s_nreloc * RELSZ]); + &reloc_ext[data_scnhdr.s_nreloc * RELSZ]); filehdr.f_nsyms += 2; - scnhdr.s_nreloc += 1; + data_scnhdr.s_nreloc += 1; } - scnhdr.s_relptr = scnhdr.s_scnptr + data_buffer_size; - filehdr.f_symptr = scnhdr.s_relptr + scnhdr.s_nreloc * RELSZ; + if (rtld) + { + memset (&syment, 0, sizeof (struct internal_syment)); + memset (&auxent, 0, sizeof (union internal_auxent)); + + syment._n._n_n._n_offset = st_tmp - string_table; + memcpy (st_tmp, rtld_name, strlen (rtld_name)); + st_tmp += strlen (rtld_name) + 1; + + syment.n_sclass = C_EXT; + syment.n_numaux = 1; + bfd_coff_swap_sym_out (abfd, &syment, + &syment_ext[filehdr.f_nsyms * SYMESZ]); + bfd_coff_swap_aux_out (abfd, &auxent, syment.n_type, syment.n_sclass, 0, + syment.n_numaux, + &syment_ext[(filehdr.f_nsyms + 1) * SYMESZ]); + + /* reloc */ + memset (&reloc, 0, sizeof (struct internal_reloc)); + reloc.r_vaddr = 0x0000; + reloc.r_symndx = filehdr.f_nsyms; + reloc.r_type = R_POS; + reloc.r_size = 63; + bfd_coff_swap_reloc_out (abfd, &reloc, + &reloc_ext[data_scnhdr.s_nreloc * RELSZ]); + + filehdr.f_nsyms += 2; + data_scnhdr.s_nreloc += 1; + + bss_scnhdr.s_size = 0; + } + + data_scnhdr.s_relptr = data_scnhdr.s_scnptr + data_buffer_size; + filehdr.f_symptr = data_scnhdr.s_relptr + data_scnhdr.s_nreloc * RELSZ; bfd_coff_swap_filehdr_out (abfd, &filehdr, filehdr_ext); bfd_bwrite (filehdr_ext, FILHSZ, abfd); - bfd_coff_swap_scnhdr_out (abfd, &scnhdr, scnhdr_ext); - bfd_bwrite (scnhdr_ext, SCNHSZ, abfd); + bfd_coff_swap_scnhdr_out (abfd, &text_scnhdr, &scnhdr_ext[SCNHSZ * 0]); + bfd_coff_swap_scnhdr_out (abfd, &data_scnhdr, &scnhdr_ext[SCNHSZ * 1]); + bfd_coff_swap_scnhdr_out (abfd, &bss_scnhdr, &scnhdr_ext[SCNHSZ * 2]); + bfd_bwrite (scnhdr_ext, 3 * SCNHSZ, abfd); bfd_bwrite (data_buffer, data_buffer_size, abfd); - bfd_bwrite (reloc_ext, scnhdr.s_nreloc * RELSZ, abfd); + bfd_bwrite (reloc_ext, data_scnhdr.s_nreloc * RELSZ, abfd); bfd_bwrite (syment_ext, filehdr.f_nsyms * SYMESZ, abfd); bfd_bwrite (string_table, string_table_size, abfd); @@ -2478,7 +2566,6 @@ static const struct xcoff_backend_data_r /* rtinit */ 88, /* _xcoff_rtinit_size */ xcoff64_generate_rtinit, /* _xcoff_generate_rtinit */ - }; /* The transfer vector that leads the outside world to all of the above. */ diff -uprN binutils-2.11.93.0.2/bfd/config.bfd binutils-2.12.90.0.1/bfd/config.bfd --- binutils-2.11.93.0.2/bfd/config.bfd Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/config.bfd Thu Mar 7 11:52:36 2002 @@ -57,6 +57,7 @@ v850*) targ_archs=bfd_v850_arch x86_64) targ_archs=bfd_i386_arch ;; xscale*) targ_archs=bfd_arm_arch ;; z8k*) targ_archs=bfd_z8k_arch ;; +sh*) targ_archs=bfd_sh_arch ;; *) targ_archs=bfd_${targ_cpu}_arch ;; esac @@ -845,9 +846,20 @@ case "${targ}" in ;; #endif +#ifdef BFD64 + sh64-*-elf*) + targ_defvec=bfd_elf32_sh64_vec + targ_selvecs="bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec bfd_elf32_sh_vec bfd_elf32_shl_vec" + targ_underscore=yes + ;; +#endif /* BFD64 */ + sh-*-linux*) targ_defvec=bfd_elf32_shblin_vec targ_selvecs=bfd_elf32_shlin_vec +#ifdef BFD64 + targ_selvecs="${targ_selvecs} bfd_elf32_sh64_vec bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec" +#endif ;; sh*eb-*-linux*) targ_defvec=bfd_elf32_shblin_vec @@ -860,6 +872,13 @@ case "${targ}" in targ_defvec=bfd_elf32_shlnbsd_vec targ_selvecs="bfd_elf32_shnbsd_vec shcoff_vec shlcoff_vec" ;; + sh-*-netbsdelf*) + targ_defvec=bfd_elf32_shnbsd_vec + targ_selvecs="bfd_elf32_shlnbsd_vec shcoff_vec shlcoff_vec" +#ifdef BFD64 + targ_selvecs="${targ_selvecs} bfd_elf32_sh64_vec bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec" +#endif + ;; sh*-*-netbsdelf*) targ_defvec=bfd_elf32_shnbsd_vec targ_selvecs="bfd_elf32_shlnbsd_vec shcoff_vec shlcoff_vec" @@ -868,6 +887,9 @@ case "${targ}" in sh-*-elf* | sh-*-rtemself*) targ_defvec=bfd_elf32_sh_vec targ_selvecs="bfd_elf32_shl_vec shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec" +#ifdef BFD64 + targ_selvecs="${targ_selvecs} bfd_elf32_sh64_vec bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec" +#endif targ_underscore=yes ;; sh-*-pe) diff -uprN binutils-2.11.93.0.2/bfd/config.in binutils-2.12.90.0.1/bfd/config.in --- binutils-2.11.93.0.2/bfd/config.in Wed May 23 10:53:56 2001 +++ binutils-2.12.90.0.1/bfd/config.in Thu Mar 7 11:52:36 2002 @@ -160,9 +160,15 @@ /* Define if you have the header file. */ #undef HAVE_SYS_PROCFS_H +/* Define if you have the header file. */ +#undef HAVE_SYS_STAT_H + /* Define if you have the header file. */ #undef HAVE_SYS_TIME_H +/* Define if you have the header file. */ +#undef HAVE_SYS_TYPES_H + /* Define if you have the header file. */ #undef HAVE_TIME_H diff -uprN binutils-2.11.93.0.2/bfd/configure binutils-2.12.90.0.1/bfd/configure --- binutils-2.11.93.0.2/bfd/configure Thu Feb 7 10:24:47 2002 +++ binutils-2.12.90.0.1/bfd/configure Thu Mar 7 11:52:36 2002 @@ -1116,7 +1116,7 @@ fi PACKAGE=bfd -VERSION=2.11.93.0.2 +VERSION=2.12.90.0.1 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } @@ -5852,9 +5852,8 @@ case "${host}" in fi ;; *) - PICFLAG= - eval `grep "^[ ]*PICFLAG[ ]*=" ../libiberty/Makefile | sed -e "s/[ ]*//g"` - if test -n "$PICFLAG"; then + x=`sed -n -e 's/^[ ]*PICFLAG[ ]*=[ ]*//p' < ../libiberty/Makefile | tail -1` + if test -n "$x"; then WIN32LIBADD="-L../libiberty/pic -liberty" fi ;; @@ -5941,6 +5940,17 @@ do # This list is alphabetized to make it easy to compare # with the two vector lists in targets.c. For the same reason, # use one entry per line, even though this leads to long lines. + # FIXME: We include cofflink.lo not because it's needed for + # bfd_elf32_sh64[l]_vec, but because we include bfd_elf32_sh[l]_vec + # which needs it but does not list it. Should be fixed in right place. + bfd_elf32_sh64_vec) tb="$tb elf32-sh64.lo elf32.lo $elf cofflink.lo" + target_size=64 ;; + bfd_elf32_sh64l_vec) tb="$tb elf32-sh64.lo elf32.lo $elf cofflink.lo" + target_size=64 ;; + bfd_elf64_sh64_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" + target_size=64 ;; + bfd_elf64_sh64l_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" + target_size=64 ;; a29kcoff_big_vec) tb="$tb coff-a29k.lo cofflink.lo" ;; a_out_adobe_vec) tb="$tb aout-adobe.lo aout32.lo" ;; aout0_big_vec) tb="$tb aout0.lo aout32.lo" ;; @@ -6206,10 +6216,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:6210: checking for gcc version with buggy 64-bit support" >&5 +echo "configure:6220: 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 <&6 -echo "configure:6258: checking for $ac_hdr" >&5 +echo "configure:6268: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6268: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6278: \"$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* @@ -6293,12 +6303,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6297: checking for $ac_func" >&5 +echo "configure:6307: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6335: \"$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 @@ -6346,7 +6356,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:6350: checking for working mmap" >&5 +echo "configure:6360: 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 @@ -6354,7 +6364,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6508: \"$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 @@ -6519,12 +6529,12 @@ fi for ac_func in madvise mprotect do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6523: checking for $ac_func" >&5 +echo "configure:6533: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6561: \"$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 -uprN binutils-2.11.93.0.2/bfd/configure.in binutils-2.12.90.0.1/bfd/configure.in --- binutils-2.11.93.0.2/bfd/configure.in Thu Feb 7 10:24:37 2002 +++ binutils-2.12.90.0.1/bfd/configure.in Thu Mar 7 11:52:36 2002 @@ -7,7 +7,7 @@ AC_INIT(libbfd.c) AC_CANONICAL_SYSTEM AC_ISC_POSIX -AM_INIT_AUTOMAKE(bfd, 2.11.93.0.2) +AM_INIT_AUTOMAKE(bfd, 2.12.90.0.1) # Uncomment the next line to remove the date from the reported bfd version #is_release=y @@ -424,11 +424,10 @@ case "${host}" in fi ;; *) - PICFLAG= - changequote(,)dnl - eval `grep "^[ ]*PICFLAG[ ]*=" ../libiberty/Makefile | sed -e "s/[ ]*//g"` - changequote([,])dnl - if test -n "$PICFLAG"; then +changequote(,)dnl + x=`sed -n -e 's/^[ ]*PICFLAG[ ]*=[ ]*//p' < ../libiberty/Makefile | tail -1` +changequote([,])dnl + if test -n "$x"; then WIN32LIBADD="-L../libiberty/pic -liberty" fi ;; @@ -515,6 +514,17 @@ do # This list is alphabetized to make it easy to compare # with the two vector lists in targets.c. For the same reason, # use one entry per line, even though this leads to long lines. + # FIXME: We include cofflink.lo not because it's needed for + # bfd_elf32_sh64[l]_vec, but because we include bfd_elf32_sh[l]_vec + # which needs it but does not list it. Should be fixed in right place. + bfd_elf32_sh64_vec) tb="$tb elf32-sh64.lo elf32.lo $elf cofflink.lo" + target_size=64 ;; + bfd_elf32_sh64l_vec) tb="$tb elf32-sh64.lo elf32.lo $elf cofflink.lo" + target_size=64 ;; + bfd_elf64_sh64_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" + target_size=64 ;; + bfd_elf64_sh64l_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" + target_size=64 ;; a29kcoff_big_vec) tb="$tb coff-a29k.lo cofflink.lo" ;; a_out_adobe_vec) tb="$tb aout-adobe.lo aout32.lo" ;; aout0_big_vec) tb="$tb aout0.lo aout32.lo" ;; diff -uprN binutils-2.11.93.0.2/bfd/cpu-arm.c binutils-2.12.90.0.1/bfd/cpu-arm.c --- binutils-2.11.93.0.2/bfd/cpu-arm.c Fri Mar 9 11:15:43 2001 +++ binutils-2.12.90.0.1/bfd/cpu-arm.c Thu Mar 7 11:52:36 2002 @@ -1,70 +1,72 @@ /* BFD support for the ARM processor - Copyright 1994, 1997, 1999, 2000 Free Software Foundation, Inc. + Copyright 1994, 1997, 1999, 2000, 2002 Free Software Foundation, Inc. Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org) -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 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. */ + 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. + + 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" #include "libbfd.h" -static const bfd_arch_info_type *compatible +static const bfd_arch_info_type * compatible PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *)); -static boolean scan PARAMS ((const struct bfd_arch_info *, const char *)); +static boolean scan + PARAMS ((const struct bfd_arch_info *, const char *)); /* This routine is provided two arch_infos and works out which ARM machine which would be compatible with both and returns a pointer - to its info structure */ + to its info structure. */ static const bfd_arch_info_type * compatible (a,b) const bfd_arch_info_type * a; const bfd_arch_info_type * b; { - /* If a & b are for different architecture we can do nothing */ + /* If a & b are for different architecture we can do nothing. */ if (a->arch != b->arch) return NULL; - /* If a & b are for the same machine then all is well */ + /* If a & b are for the same machine then all is well. */ if (a->mach == b->mach) return a; - /* Otherwise if either a or b is the 'default' machine then - it can be polymorphed into the other */ + /* Otherwise if either a or b is the 'default' machine + then it can be polymorphed into the other. */ if (a->the_default) return b; if (b->the_default) return a; - /* So far all newer ARM architecture cores are supersets of previous cores */ + /* So far all newer ARM architecture cores are + supersets of previous cores. */ if (a->mach < b->mach) return b; else if (a->mach > b->mach) return a; - /* Never reached! */ + /* Never reached! */ return NULL; } static struct { - enum bfd_architecture arch; - char * name; + unsigned int mach; + char * name; } processors[] = { @@ -103,21 +105,21 @@ scan (info, string) { int i; - /* First test for an exact match */ + /* First test for an exact match. */ if (strcasecmp (string, info->printable_name) == 0) return true; - /* Next check for a processor name instead of an Architecture name */ + /* Next check for a processor name instead of an Architecture name. */ for (i = sizeof (processors) / sizeof (processors[0]); i--;) { - if (strcasecmp (string, processors[ i ].name) == 0) + if (strcasecmp (string, processors [i].name) == 0) break; } - if (i != -1 && info->arch == processors[ i ].arch) + if (i != -1 && info->mach == processors [i].mach) return true; - /* Finally check for the default architecture */ + /* Finally check for the default architecture. */ if (strcasecmp (string, "arm") == 0) return info->the_default; @@ -129,17 +131,17 @@ scan (info, string) static const bfd_arch_info_type arch_info_struct[] = { - N( bfd_mach_arm_2, "armv2", false, & arch_info_struct[1] ), - N( bfd_mach_arm_2a, "armv2a", false, & arch_info_struct[2] ), - N( bfd_mach_arm_3, "armv3", false, & arch_info_struct[3] ), - N( bfd_mach_arm_3M, "armv3m", false, & arch_info_struct[4] ), - N( bfd_mach_arm_4, "armv4", false, & arch_info_struct[5] ), - N( bfd_mach_arm_4T, "armv4t", false, & arch_info_struct[6] ), - N( bfd_mach_arm_5, "armv5", false, & arch_info_struct[7] ), - N( bfd_mach_arm_5T, "armv5t", false, & arch_info_struct[8] ), - N( bfd_mach_arm_5TE, "armv5te", false, & arch_info_struct[9] ), - N( bfd_mach_arm_XScale, "xscale", false, NULL ) + N (bfd_mach_arm_2, "armv2", false, & arch_info_struct[1]), + N (bfd_mach_arm_2a, "armv2a", false, & arch_info_struct[2]), + N (bfd_mach_arm_3, "armv3", false, & arch_info_struct[3]), + N (bfd_mach_arm_3M, "armv3m", false, & arch_info_struct[4]), + N (bfd_mach_arm_4, "armv4", false, & arch_info_struct[5]), + N (bfd_mach_arm_4T, "armv4t", false, & arch_info_struct[6]), + N (bfd_mach_arm_5, "armv5", false, & arch_info_struct[7]), + N (bfd_mach_arm_5T, "armv5t", false, & arch_info_struct[8]), + N (bfd_mach_arm_5TE, "armv5te", false, & arch_info_struct[9]), + N (bfd_mach_arm_XScale, "xscale", false, NULL) }; const bfd_arch_info_type bfd_arm_arch = - N( 0, "arm", true, & arch_info_struct[0] ); + N (0, "arm", true, & arch_info_struct[0]); diff -uprN binutils-2.11.93.0.2/bfd/cpu-s390.c binutils-2.12.90.0.1/bfd/cpu-s390.c --- binutils-2.11.93.0.2/bfd/cpu-s390.c Fri Mar 9 11:15:44 2001 +++ binutils-2.12.90.0.1/bfd/cpu-s390.c Thu Mar 7 11:52:36 2002 @@ -23,15 +23,15 @@ #include "sysdep.h" #include "libbfd.h" -const bfd_arch_info_type bfd_s390_esame_arch = +const bfd_arch_info_type bfd_s390_64_arch = { 64, /* bits in a word */ 64, /* bits in an address */ 8, /* bits in a byte */ bfd_arch_s390, - bfd_mach_s390_esame, + bfd_mach_s390_64, "s390", - "s390:esame", + "s390:64-bit", 3, /* section alignment power */ true, /* the default */ bfd_default_compatible, @@ -45,12 +45,12 @@ const bfd_arch_info_type bfd_s390_arch = 32, /* bits in an address */ 8, /* bits in a byte */ bfd_arch_s390, - bfd_mach_s390_esa, + bfd_mach_s390_31, "s390", - "s390:390", + "s390:31-bit", 3, /* section alignment power */ true, /* the default */ bfd_default_compatible, bfd_default_scan, - &bfd_s390_esame_arch + &bfd_s390_64_arch }; diff -uprN binutils-2.11.93.0.2/bfd/cpu-sh.c binutils-2.12.90.0.1/bfd/cpu-sh.c --- binutils-2.11.93.0.2/bfd/cpu-sh.c Mon Oct 1 15:25:21 2001 +++ binutils-2.12.90.0.1/bfd/cpu-sh.c Thu Mar 7 11:52:36 2002 @@ -58,6 +58,9 @@ compatible (a,b) #define SH3_DSP_NEXT &arch_info_struct[4] #define SH3E_NEXT &arch_info_struct[5] #define SH4_NEXT NULL +#undef SH4_NEXT +#define SH4_NEXT &arch_info_struct[6] +#define SH64_NEXT NULL static const bfd_arch_info_type arch_info_struct[] = { @@ -145,6 +148,20 @@ static const bfd_arch_info_type arch_inf scan_mach, SH4_NEXT }, + { + 64, /* 64 bits in a word */ + 64, /* 64 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_sh, + bfd_mach_sh5, + "sh", /* arch_name */ + "sh5", /* printable name */ + 1, + false, /* not the default */ + bfd_default_compatible, + scan_mach, + SH64_NEXT + }, }; const bfd_arch_info_type bfd_sh_arch = diff -uprN binutils-2.11.93.0.2/bfd/doc/ChangeLog binutils-2.12.90.0.1/bfd/doc/ChangeLog --- binutils-2.11.93.0.2/bfd/doc/ChangeLog Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/doc/ChangeLog Thu Mar 7 11:52:37 2002 @@ -1,3 +1,7 @@ +2002-02-11 Alan Modra + + * Makefile.in: Regenerate. + 2002-02-01 Alan Modra * chew.c (WORD): Eliminate. diff -uprN binutils-2.11.93.0.2/bfd/doc/Makefile.in binutils-2.12.90.0.1/bfd/doc/Makefile.in --- binutils-2.11.93.0.2/bfd/doc/Makefile.in Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/doc/Makefile.in Thu Mar 7 11:52:37 2002 @@ -242,7 +242,7 @@ DIST_COMMON = ChangeLog Makefile.am Mak DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = gtar +TAR = tar GZIP_ENV = --best all: all-redirect .SUFFIXES: diff -uprN binutils-2.11.93.0.2/bfd/elf-bfd.h binutils-2.12.90.0.1/bfd/elf-bfd.h --- binutils-2.11.93.0.2/bfd/elf-bfd.h Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/elf-bfd.h Thu Mar 7 11:52:36 2002 @@ -1539,6 +1539,8 @@ extern char *elfcore_write_prfpreg PARAMS ((bfd *, char *, int *, void *, int)); extern char *elfcore_write_prxfpreg PARAMS ((bfd *, char *, int *, void *, int)); +extern char *elfcore_write_lwpstatus + PARAMS ((bfd*, char*, int*, long, int, void*)); /* MIPS ELF specific routines. */ diff -uprN binutils-2.11.93.0.2/bfd/elf-eh-frame.c binutils-2.12.90.0.1/bfd/elf-eh-frame.c --- binutils-2.11.93.0.2/bfd/elf-eh-frame.c Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/elf-eh-frame.c Thu Mar 7 11:52:36 2002 @@ -586,16 +586,12 @@ _bfd_elf_discard_section_eh_frame (abfd, } /* For shared libraries, try to get rid of as many RELATIVE relocs - as possible. - FIXME: For this to work, ELF backends need to perform the - relocation if omitting dynamic relocs, not skip it. */ - if (0 - && info->shared + as possible. */ + if (info->shared && (cie.fde_encoding & 0xf0) == DW_EH_PE_absptr) cie.make_relative = 1; - if (0 - && info->shared + if (info->shared && (cie.lsda_encoding & 0xf0) == DW_EH_PE_absptr) cie.make_lsda_relative = 1; @@ -636,6 +632,16 @@ _bfd_elf_discard_section_eh_frame (abfd, } else { + if (info->shared + && (cie.fde_encoding & 0xf0) == DW_EH_PE_absptr + && cie.make_relative == 0) + { + /* If shared library uses absolute pointers + which we cannot turn into PC relative, + don't create the binary search table, + since it is affected by runtime relocations. */ + hdr_info->table = false; + } cie_usage_count++; hdr_info->fde_count++; } @@ -856,7 +862,7 @@ _bfd_elf_eh_frame_section_offset (output if (sec_info->entry[mid].make_relative && ! sec_info->entry[mid].cie && offset == sec_info->entry[mid].offset + 8) - return (bfd_vma) -1; + return (bfd_vma) -2; /* If converting LSDA pointers to DW_EH_PE_pcrel, there will be no need for run-time relocation against LSDA field. */ @@ -865,7 +871,7 @@ _bfd_elf_eh_frame_section_offset (output && (offset == (sec_info->entry[mid].offset + 8 + sec_info->entry[mid].lsda_offset))) - return (bfd_vma) -1; + return (bfd_vma) -2; return (offset + sec_info->entry[mid].new_offset - sec_info->entry[mid].offset); diff -uprN binutils-2.11.93.0.2/bfd/elf-hppa.h binutils-2.12.90.0.1/bfd/elf-hppa.h --- binutils-2.11.93.0.2/bfd/elf-hppa.h Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/elf-hppa.h Thu Mar 7 11:52:36 2002 @@ -1,5 +1,5 @@ /* Common code for PA ELF implementations. - Copyright 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -29,6 +29,7 @@ Foundation, Inc., 59 Temple Place - Suit #define ELF_R_TYPE(X) ELF64_R_TYPE(X) #define ELF_R_SYM(X) ELF64_R_SYM(X) #define elf_hppa_internal_shdr Elf64_Internal_Shdr +#define elf_hppa_reloc_final_type elf64_hppa_reloc_final_type #define _bfd_elf_hppa_gen_reloc_type _bfd_elf64_hppa_gen_reloc_type #define elf_hppa_relocate_section elf64_hppa_relocate_section #define bfd_elf_bfd_final_link bfd_elf64_bfd_final_link @@ -38,15 +39,13 @@ Foundation, Inc., 59 Temple Place - Suit #define ELF_R_TYPE(X) ELF32_R_TYPE(X) #define ELF_R_SYM(X) ELF32_R_SYM(X) #define elf_hppa_internal_shdr Elf32_Internal_Shdr +#define elf_hppa_reloc_final_type elf32_hppa_reloc_final_type #define _bfd_elf_hppa_gen_reloc_type _bfd_elf32_hppa_gen_reloc_type #define elf_hppa_relocate_section elf32_hppa_relocate_section #define bfd_elf_bfd_final_link bfd_elf32_bfd_final_link #define elf_hppa_final_link elf32_hppa_final_link #endif -elf_hppa_reloc_type ** _bfd_elf_hppa_gen_reloc_type - PARAMS ((bfd *, elf_hppa_reloc_type, int, unsigned int, int, asymbol *)); - static void elf_hppa_info_to_howto PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); @@ -76,6 +75,9 @@ static boolean elf_hppa_unmark_useless_d static boolean elf_hppa_remark_useless_dynamic_symbols PARAMS ((struct elf_link_hash_entry *, PTR)); +static boolean elf_hppa_is_dynamic_loader_symbol + PARAMS ((const char *)); + static void elf_hppa_record_segment_addrs PARAMS ((bfd *, asection *, PTR)); @@ -605,40 +607,17 @@ static reloc_howto_type elf_hppa_howto_t #define OFFSET_14R_FROM_21L 4 #define OFFSET_14F_FROM_21L 5 -/* Return one (or more) BFD relocations which implement the base - relocation with modifications based on format and field. */ +/* Return the final relocation type for the given base type, instruction + format, and field selector. */ -elf_hppa_reloc_type ** -_bfd_elf_hppa_gen_reloc_type (abfd, base_type, format, field, ignore, sym) +elf_hppa_reloc_type +elf_hppa_reloc_final_type (abfd, base_type, format, field) bfd *abfd; elf_hppa_reloc_type base_type; int format; unsigned int field; - int ignore ATTRIBUTE_UNUSED; - asymbol *sym ATTRIBUTE_UNUSED; { - elf_hppa_reloc_type *finaltype; - elf_hppa_reloc_type **final_types; - bfd_size_type amt = sizeof (elf_hppa_reloc_type *) * 2; - - /* Allocate slots for the BFD relocation. */ - final_types = (elf_hppa_reloc_type **) bfd_alloc (abfd, amt); - if (final_types == NULL) - return NULL; - - /* Allocate space for the relocation itself. */ - amt = sizeof (elf_hppa_reloc_type); - finaltype = (elf_hppa_reloc_type *) bfd_alloc (abfd, amt); - if (finaltype == NULL) - return NULL; - - /* Some reasonable defaults. */ - final_types[0] = finaltype; - final_types[1] = NULL; - -#define final_type finaltype[0] - - final_type = base_type; + elf_hppa_reloc_type final_type = base_type; /* Just a tangle of nested switch statements to deal with the braindamage that a different field selector means a completely different relocation @@ -677,7 +656,7 @@ _bfd_elf_hppa_gen_reloc_type (abfd, base final_type = R_PARISC_PLABEL14R; break; default: - return NULL; + return R_PARISC_NONE; } break; @@ -693,7 +672,7 @@ _bfd_elf_hppa_gen_reloc_type (abfd, base final_type = R_PARISC_DIR17R; break; default: - return NULL; + return R_PARISC_NONE; } break; @@ -717,7 +696,7 @@ _bfd_elf_hppa_gen_reloc_type (abfd, base final_type = R_PARISC_PLABEL21L; break; default: - return NULL; + return R_PARISC_NONE; } break; @@ -736,7 +715,7 @@ _bfd_elf_hppa_gen_reloc_type (abfd, base final_type = R_PARISC_PLABEL32; break; default: - return NULL; + return R_PARISC_NONE; } break; @@ -750,12 +729,12 @@ _bfd_elf_hppa_gen_reloc_type (abfd, base final_type = R_PARISC_FPTR64; break; default: - return NULL; + return R_PARISC_NONE; } break; default: - return NULL; + return R_PARISC_NONE; } break; @@ -776,7 +755,7 @@ _bfd_elf_hppa_gen_reloc_type (abfd, base final_type = base_type + OFFSET_14F_FROM_21L; break; default: - return NULL; + return R_PARISC_NONE; } break; @@ -792,12 +771,12 @@ _bfd_elf_hppa_gen_reloc_type (abfd, base final_type = base_type; break; default: - return NULL; + return R_PARISC_NONE; } break; default: - return NULL; + return R_PARISC_NONE; } break; @@ -811,7 +790,7 @@ _bfd_elf_hppa_gen_reloc_type (abfd, base final_type = R_PARISC_PCREL12F; break; default: - return NULL; + return R_PARISC_NONE; } break; @@ -829,7 +808,7 @@ _bfd_elf_hppa_gen_reloc_type (abfd, base final_type = R_PARISC_PCREL14F; break; default: - return NULL; + return R_PARISC_NONE; } break; @@ -845,7 +824,7 @@ _bfd_elf_hppa_gen_reloc_type (abfd, base final_type = R_PARISC_PCREL17F; break; default: - return NULL; + return R_PARISC_NONE; } break; @@ -860,7 +839,7 @@ _bfd_elf_hppa_gen_reloc_type (abfd, base final_type = R_PARISC_PCREL21L; break; default: - return NULL; + return R_PARISC_NONE; } break; @@ -871,12 +850,12 @@ _bfd_elf_hppa_gen_reloc_type (abfd, base final_type = R_PARISC_PCREL22F; break; default: - return NULL; + return R_PARISC_NONE; } break; default: - return NULL; + return R_PARISC_NONE; } break; @@ -888,9 +867,45 @@ _bfd_elf_hppa_gen_reloc_type (abfd, base break; default: - return NULL; + return R_PARISC_NONE; } + return final_type; +} + +/* Return one (or more) BFD relocations which implement the base + relocation with modifications based on format and field. */ + +elf_hppa_reloc_type ** +_bfd_elf_hppa_gen_reloc_type (abfd, base_type, format, field, ignore, sym) + bfd *abfd; + elf_hppa_reloc_type base_type; + int format; + unsigned int field; + int ignore ATTRIBUTE_UNUSED; + asymbol *sym ATTRIBUTE_UNUSED; +{ + elf_hppa_reloc_type *finaltype; + elf_hppa_reloc_type **final_types; + bfd_size_type amt = sizeof (elf_hppa_reloc_type *) * 2; + + /* Allocate slots for the BFD relocation. */ + final_types = (elf_hppa_reloc_type **) bfd_alloc (abfd, amt); + if (final_types == NULL) + return NULL; + + /* Allocate space for the relocation itself. */ + amt = sizeof (elf_hppa_reloc_type); + finaltype = (elf_hppa_reloc_type *) bfd_alloc (abfd, amt); + if (finaltype == NULL) + return NULL; + + /* Some reasonable defaults. */ + final_types[0] = finaltype; + final_types[1] = NULL; + + *finaltype = elf_hppa_reloc_final_type (abfd, base_type, format, field); + return final_types; } @@ -1124,6 +1139,23 @@ elf_hppa_remark_useless_dynamic_symbols return true; } +static boolean +elf_hppa_is_dynamic_loader_symbol (name) + const char * name; +{ + return (! strcmp (name, "__CPU_REVISION") + || ! strcmp (name, "__CPU_KEYBITS_1") + || ! strcmp (name, "__SYSTEM_ID_D") + || ! strcmp (name, "__FPU_MODEL") + || ! strcmp (name, "__FPU_REVISION") + || ! strcmp (name, "__ARGC") + || ! strcmp (name, "__ARGV") + || ! strcmp (name, "__ENVP") + || ! strcmp (name, "__TLS_SIZE_D") + || ! strcmp (name, "__LOAD_INFO") + || ! strcmp (name, "__systab")); +} + /* Record the lowest address for the data and text segments. */ static void elf_hppa_record_segment_addrs (abfd, section, data) @@ -1407,11 +1439,17 @@ elf_hppa_relocate_section (output_bfd, i relocation = 0; else { - if (!((*info->callbacks->undefined_symbol) - (info, h->root.root.string, input_bfd, - input_section, rel->r_offset, true))) - return false; - break; + /* Ignore dynamic loader defined symbols. */ + if (elf_hppa_is_dynamic_loader_symbol (h->root.root.string)) + relocation = 0; + else + { + if (!((*info->callbacks->undefined_symbol) + (info, h->root.root.string, input_bfd, + input_section, rel->r_offset, true))) + return false; + break; + } } } @@ -1608,11 +1646,7 @@ elf_hppa_final_link_relocate (rel, input a local function which had its address taken. */ if (dyn_h->h == NULL) { - bfd_put_64 (hppa_info->dlt_sec->owner, - value, - hppa_info->dlt_sec->contents + dyn_h->dlt_offset); - - /* Now handle .opd creation if needed. */ + /* Now do .opd creation if needed. */ if (r_type == R_PARISC_LTOFF_FPTR14R || r_type == R_PARISC_LTOFF_FPTR14DR || r_type == R_PARISC_LTOFF_FPTR14WR @@ -1626,7 +1660,7 @@ elf_hppa_final_link_relocate (rel, input 0, 16); /* The next word is the address of the function. */ - bfd_put_64 (hppa_info->opd_sec->owner, value, + bfd_put_64 (hppa_info->opd_sec->owner, value + addend, (hppa_info->opd_sec->contents + dyn_h->opd_offset + 16)); @@ -1636,7 +1670,17 @@ elf_hppa_final_link_relocate (rel, input bfd_put_64 (hppa_info->opd_sec->owner, value, (hppa_info->opd_sec->contents + dyn_h->opd_offset + 24)); + + /* The DLT value is the address of the .opd entry. */ + value = (dyn_h->opd_offset + + hppa_info->opd_sec->output_offset + + hppa_info->opd_sec->output_section->vma); + addend = 0; } + + bfd_put_64 (hppa_info->dlt_sec->owner, + value + addend, + hppa_info->dlt_sec->contents + dyn_h->dlt_offset); } /* We want the value of the DLT offset for this symbol, not @@ -1654,7 +1698,7 @@ elf_hppa_final_link_relocate (rel, input if (r_type == R_PARISC_DLTIND21L || r_type == R_PARISC_LTOFF_FPTR21L || r_type == R_PARISC_LTOFF_TP21L) - value = hppa_field_adjust (value, addend, e_lrsel); + value = hppa_field_adjust (value, 0, e_lsel); else if (r_type == R_PARISC_DLTIND14F || r_type == R_PARISC_LTOFF_FPTR16F || r_type == R_PARISC_LTOFF_FPTR16WF @@ -1665,9 +1709,9 @@ elf_hppa_final_link_relocate (rel, input || r_type == R_PARISC_LTOFF_TP16F || r_type == R_PARISC_LTOFF_TP16WF || r_type == R_PARISC_LTOFF_TP16DF) - value = hppa_field_adjust (value, addend, e_fsel); + value = hppa_field_adjust (value, 0, e_fsel); else - value = hppa_field_adjust (value, addend, e_rrsel); + value = hppa_field_adjust (value, 0, e_rsel); insn = elf_hppa_relocate_insn (insn, (int) value, r_type); break; @@ -1792,7 +1836,7 @@ elf_hppa_final_link_relocate (rel, input memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16); /* The next word is the address of the function. */ - bfd_put_64 (hppa_info->opd_sec->owner, value, + bfd_put_64 (hppa_info->opd_sec->owner, value + addend, (hppa_info->opd_sec->contents + dyn_h->opd_offset + 16)); @@ -1801,6 +1845,15 @@ elf_hppa_final_link_relocate (rel, input (hppa_info->opd_sec->output_section->owner); bfd_put_64 (hppa_info->opd_sec->owner, value, hppa_info->opd_sec->contents + dyn_h->opd_offset + 24); + + /* The DLT value is the address of the .opd entry. */ + value = (dyn_h->opd_offset + + hppa_info->opd_sec->output_offset + + hppa_info->opd_sec->output_section->vma); + + bfd_put_64 (hppa_info->dlt_sec->owner, + value, + hppa_info->dlt_sec->contents + dyn_h->dlt_offset); } /* We want the value of the DLT offset for this symbol, not @@ -1826,7 +1879,7 @@ elf_hppa_final_link_relocate (rel, input memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16); /* The next word is the address of the function. */ - bfd_put_64 (hppa_info->opd_sec->owner, value, + bfd_put_64 (hppa_info->opd_sec->owner, value + addend, (hppa_info->opd_sec->contents + dyn_h->opd_offset + 16)); @@ -1835,6 +1888,15 @@ elf_hppa_final_link_relocate (rel, input (hppa_info->opd_sec->output_section->owner); bfd_put_64 (hppa_info->opd_sec->owner, value, hppa_info->opd_sec->contents + dyn_h->opd_offset + 24); + + /* The DLT value is the address of the .opd entry. */ + value = (dyn_h->opd_offset + + hppa_info->opd_sec->output_offset + + hppa_info->opd_sec->output_section->vma); + + bfd_put_64 (hppa_info->dlt_sec->owner, + value, + hppa_info->dlt_sec->contents + dyn_h->dlt_offset); } /* We want the value of the DLT offset for this symbol, not @@ -1926,7 +1988,7 @@ elf_hppa_final_link_relocate (rel, input memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16); /* The next word is the address of the function. */ - bfd_put_64 (hppa_info->opd_sec->owner, value, + bfd_put_64 (hppa_info->opd_sec->owner, value + addend, (hppa_info->opd_sec->contents + dyn_h->opd_offset + 16)); @@ -1943,7 +2005,7 @@ elf_hppa_final_link_relocate (rel, input + hppa_info->opd_sec->output_offset + hppa_info->opd_sec->output_section->vma); - bfd_put_64 (input_bfd, value + addend, hit_data); + bfd_put_64 (input_bfd, value, hit_data); return bfd_reloc_ok; } diff -uprN binutils-2.11.93.0.2/bfd/elf-m10300.c binutils-2.12.90.0.1/bfd/elf-m10300.c --- binutils-2.11.93.0.2/bfd/elf-m10300.c Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/elf-m10300.c Thu Mar 7 11:52:36 2002 @@ -1,5 +1,5 @@ /* Matsushita 10300 specific support for 32-bit ELF - Copyright 1996, 1997, 1998, 1999, 2000, 2001 + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -874,6 +874,12 @@ mn10300_elf_relax_section (abfd, sec, li const char *sym_name; char *new_name; + /* If there's nothing to do in this section, skip it. */ + if (! (((section->flags & SEC_RELOC) != 0 + && section->reloc_count != 0) + || (section->flags & SEC_CODE) != 0)) + continue; + /* Get cached copy of section contents if it exists. */ if (elf_section_data (section)->this_hdr.contents != NULL) contents = elf_section_data (section)->this_hdr.contents; diff -uprN binutils-2.11.93.0.2/bfd/elf.c binutils-2.12.90.0.1/bfd/elf.c --- binutils-2.11.93.0.2/bfd/elf.c Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/elf.c Thu Mar 7 11:52:36 2002 @@ -652,10 +652,15 @@ _bfd_elf_make_section_from_shdr (abfd, h offset plus size lies within the segment's memory span and, if the section is loaded, the extent of the loaded data lies within the extent of the segment. - If the p_paddr field is not set, we don't alter the - LMA. */ + + Note - we used to check the p_paddr field as well, and + refuse to set the LMA if it was 0. This is wrong + though as a perfectly valid, initialised segment can + have a p_paddr of zero. Some architectures, eg ARM, + place special significance one the address 0 and + executables need to be able to have a segment which + covers this address. */ if (phdr->p_type == PT_LOAD - && phdr->p_paddr && (bfd_vma) hdr->sh_offset >= phdr->p_offset && (hdr->sh_offset + hdr->sh_size <= phdr->p_offset + phdr->p_memsz) @@ -1559,6 +1564,9 @@ bfd_section_from_shdr (abfd, shindex) case SHT_NOBITS: /* .bss section. */ case SHT_HASH: /* .hash section. */ case SHT_NOTE: /* .note section. */ + case SHT_INIT_ARRAY: /* .init_array section. */ + case SHT_FINI_ARRAY: /* .fini_array section. */ + case SHT_PREINIT_ARRAY: /* .preinit_array section. */ return _bfd_elf_make_section_from_shdr (abfd, hdr, name); case SHT_SYMTAB: /* A symbol table */ @@ -2173,6 +2181,12 @@ elf_fake_sections (abfd, asect, failedpt this_hdr->sh_type = SHT_REL; this_hdr->sh_entsize = bed->s->sizeof_rel; } + else if (strcmp (asect->name, ".init_array") == 0) + this_hdr->sh_type = SHT_INIT_ARRAY; + else if (strcmp (asect->name, ".fini_array") == 0) + this_hdr->sh_type = SHT_FINI_ARRAY; + else if (strcmp (asect->name, ".preinit_array") == 0) + this_hdr->sh_type = SHT_PREINIT_ARRAY; else if (strncmp (asect->name, ".note", 5) == 0) this_hdr->sh_type = SHT_NOTE; else if (strncmp (asect->name, ".stab", 5) == 0 @@ -2215,7 +2229,8 @@ elf_fake_sections (abfd, asect, failedpt this_hdr->sh_entsize = 4; } else if ((asect->flags & SEC_ALLOC) != 0 - && ((asect->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0)) + && (((asect->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0) + || (asect->flags & SEC_NEVER_LOAD) != 0)) this_hdr->sh_type = SHT_NOBITS; else this_hdr->sh_type = SHT_PROGBITS; @@ -6149,6 +6164,8 @@ elfcore_grok_psinfo (abfd, note) #endif /* defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T) */ #if defined (HAVE_PSTATUS_T) +static boolean elfcore_grok_pstatus PARAMS ((bfd *, Elf_Internal_Note *)); + static boolean elfcore_grok_pstatus (abfd, note) bfd *abfd; @@ -6186,6 +6203,8 @@ elfcore_grok_pstatus (abfd, note) #endif /* defined (HAVE_PSTATUS_T) */ #if defined (HAVE_LWPSTATUS_T) +static boolean elfcore_grok_lwpstatus PARAMS ((bfd *, Elf_Internal_Note *)); + static boolean elfcore_grok_lwpstatus (abfd, note) bfd *abfd; @@ -6599,6 +6618,38 @@ elfcore_write_prstatus (abfd, buf, bufsi } #endif /* HAVE_PRSTATUS_T */ +#if defined (HAVE_LWPSTATUS_T) +char * +elfcore_write_lwpstatus (abfd, buf, bufsiz, pid, cursig, gregs) + bfd *abfd; + char *buf; + int *bufsiz; + long pid; + int cursig; + void *gregs; +{ + lwpstatus_t lwpstat; + char *note_name = "CORE"; + + memset (&lwpstat, 0, sizeof (lwpstat)); + lwpstat.pr_lwpid = pid >> 16; + lwpstat.pr_cursig = cursig; +#if defined (HAVE_LWPSTATUS_T_PR_REG) + memcpy (lwpstat.pr_reg, gregs, sizeof (lwpstat.pr_reg)); +#elif defined (HAVE_LWPSTATUS_T_PR_CONTEXT) +#if !defined(gregs) + memcpy (lwpstat.pr_context.uc_mcontext.gregs, + gregs, sizeof (lwpstat.pr_context.uc_mcontext.gregs)); +#else + memcpy (lwpstat.pr_context.uc_mcontext.__gregs, + gregs, sizeof (lwpstat.pr_context.uc_mcontext.__gregs)); +#endif +#endif + return elfcore_write_note (abfd, buf, bufsiz, note_name, + NT_LWPSTATUS, &lwpstat, sizeof (lwpstat)); +} +#endif /* HAVE_LWPSTATUS_T */ + #if defined (HAVE_PSTATUS_T) char * elfcore_write_pstatus (abfd, buf, bufsiz, pid, cursig, gregs) @@ -6612,11 +6663,11 @@ elfcore_write_pstatus (abfd, buf, bufsiz pstatus_t pstat; char *note_name = "CORE"; - memset (&pstat, 0, sizeof (prstat)); - pstat.pr_pid = pid; - memcpy (pstat.pr_reg, gregs, sizeof (pstat.pr_reg)); - return elfcore_write_note (abfd, buf, bufsiz, - note_name, NT_PSTATUS, &pstat, sizeof (pstat)); + memset (&pstat, 0, sizeof (pstat)); + pstat.pr_pid = pid & 0xffff; + buf = elfcore_write_note (abfd, buf, bufsiz, note_name, + NT_PSTATUS, &pstat, sizeof (pstat)); + return buf; } #endif /* HAVE_PSTATUS_T */ diff -uprN binutils-2.11.93.0.2/bfd/elf32-arm.h binutils-2.12.90.0.1/bfd/elf32-arm.h --- binutils-2.11.93.0.2/bfd/elf32-arm.h Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/elf32-arm.h Thu Mar 7 11:52:36 2002 @@ -1148,26 +1148,24 @@ elf32_arm_final_link_relocate (howto, in } skip = false; + relocate = false; outrel.r_offset = _bfd_elf_section_offset (output_bfd, info, input_section, rel->r_offset); if (outrel.r_offset == (bfd_vma) -1) skip = true; + else if (outrel.r_offset == (bfd_vma) -2) + skip = true, relocate = true; outrel.r_offset += (input_section->output_section->vma + input_section->output_offset); if (skip) - { - memset (&outrel, 0, sizeof outrel); - relocate = false; - } + 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 = false; - else + if ((input_section->flags & SEC_ALLOC) == 0) relocate = true; outrel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_PC24); } @@ -1184,9 +1182,7 @@ elf32_arm_final_link_relocate (howto, in else { BFD_ASSERT (h->dynindx != -1); - if ((input_section->flags & SEC_ALLOC) != 0) - relocate = false; - else + if ((input_section->flags & SEC_ALLOC) == 0) relocate = true; outrel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_ABS32); } @@ -2325,12 +2321,12 @@ ERROR: %s uses FPA instructions, whereas || (in_flags & EF_ARM_VFP_FLOAT) == 0) { if (in_flags & EF_ARM_SOFT_FLOAT) - _bfd_error_handler (_ ("\ + _bfd_error_handler (_("\ ERROR: %s uses software FP, whereas %s uses hardware FP"), bfd_archive_filename (ibfd), bfd_get_filename (obfd)); else - _bfd_error_handler (_ ("\ + _bfd_error_handler (_("\ ERROR: %s uses hardware FP, whereas %s uses software FP"), bfd_archive_filename (ibfd), bfd_get_filename (obfd)); diff -uprN binutils-2.11.93.0.2/bfd/elf32-cris.c binutils-2.12.90.0.1/bfd/elf32-cris.c --- binutils-2.11.93.0.2/bfd/elf32-cris.c Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/elf32-cris.c Thu Mar 7 11:52:36 2002 @@ -1296,20 +1296,20 @@ cris_elf_relocate_section (output_bfd, i } skip = false; + relocate = false; outrel.r_offset = _bfd_elf_section_offset (output_bfd, info, input_section, rel->r_offset); if (outrel.r_offset == (bfd_vma) -1) skip = true; + else if (outrel.r_offset == (bfd_vma) -2) + skip = true, relocate = true; outrel.r_offset += (input_section->output_section->vma + input_section->output_offset); if (skip) - { - memset (&outrel, 0, sizeof outrel); - relocate = false; - } + memset (&outrel, 0, sizeof outrel); /* h->dynindx may be -1 if the symbol was marked to become local. */ else if (h != NULL @@ -1318,7 +1318,6 @@ cris_elf_relocate_section (output_bfd, i & ELF_LINK_HASH_DEF_REGULAR) == 0)) { BFD_ASSERT (h->dynindx != -1); - relocate = false; outrel.r_info = ELF32_R_INFO (h->dynindx, r_type); outrel.r_addend = relocation + rel->r_addend; } @@ -1359,7 +1358,6 @@ cris_elf_relocate_section (output_bfd, i BFD_ASSERT (indx > 0); } - relocate = false; outrel.r_info = ELF32_R_INFO (indx, r_type); outrel.r_addend = relocation + rel->r_addend; } diff -uprN binutils-2.11.93.0.2/bfd/elf32-d10v.c binutils-2.12.90.0.1/bfd/elf32-d10v.c --- binutils-2.11.93.0.2/bfd/elf32-d10v.c Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/elf32-d10v.c Thu Mar 7 11:52:36 2002 @@ -479,19 +479,19 @@ elf32_d10v_relocate_section (output_bfd, break; case bfd_reloc_outofrange: - msg = _ ("internal error: out of range error"); + msg = _("internal error: out of range error"); goto common_error; case bfd_reloc_notsupported: - msg = _ ("internal error: unsupported relocation error"); + msg = _("internal error: unsupported relocation error"); goto common_error; case bfd_reloc_dangerous: - msg = _ ("internal error: dangerous error"); + msg = _("internal error: dangerous error"); goto common_error; default: - msg = _ ("internal error: unknown error"); + msg = _("internal error: unknown error"); /* fall through */ common_error: diff -uprN binutils-2.11.93.0.2/bfd/elf32-hppa.c binutils-2.12.90.0.1/bfd/elf32-hppa.c --- binutils-2.11.93.0.2/bfd/elf32-hppa.c Thu Feb 7 10:21:03 2002 +++ binutils-2.12.90.0.1/bfd/elf32-hppa.c Thu Mar 7 11:52:36 2002 @@ -32,8 +32,8 @@ Foundation, Inc., 59 Temple Place - Suit #include "libhppa.h" #include "elf32-hppa.h" #define ARCH_SIZE 32 -#include "elf-hppa.h" #include "elf32-hppa.h" +#include "elf-hppa.h" /* In order to gain some understanding of code in this file without knowing all the intricate details of the linker, note the @@ -2217,10 +2217,6 @@ clobber_millicode_symbols (h, info) && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) { elf32_hppa_hide_symbol (info, h, true); - - /* ?!? We only want to remove these from the dynamic symbol table. - Therefore we do not leave ELF_LINK_FORCED_LOCAL set. */ - h->elf_link_hash_flags &= ~ELF_LINK_FORCED_LOCAL; } return true; } @@ -3475,21 +3471,27 @@ final_link_relocate (input_section, cont r_field = e_fsel; break; - case R_PARISC_DIR21L: + case R_PARISC_DLTIND21L: case R_PARISC_PCREL21L: - case R_PARISC_DPREL21L: case R_PARISC_PLABEL21L: - case R_PARISC_DLTIND21L: + r_field = e_lsel; + break; + + case R_PARISC_DIR21L: + case R_PARISC_DPREL21L: r_field = e_lrsel; break; - case R_PARISC_DIR17R: case R_PARISC_PCREL17R: - case R_PARISC_DIR14R: case R_PARISC_PCREL14R: - case R_PARISC_DPREL14R: case R_PARISC_PLABEL14R: case R_PARISC_DLTIND14R: + r_field = e_rsel; + break; + + case R_PARISC_DIR17R: + case R_PARISC_DIR14R: + case R_PARISC_DPREL14R: r_field = e_rrsel; break; @@ -3976,7 +3978,8 @@ elf32_hppa_relocate_section (output_bfd, outrel.r_offset = _bfd_elf_section_offset (output_bfd, info, input_section, rel->r_offset); - skip = (outrel.r_offset == (bfd_vma) -1); + skip = (outrel.r_offset == (bfd_vma) -1 + || outrel.r_offset == (bfd_vma) -2); outrel.r_offset += (input_section->output_offset + input_section->output_section->vma); diff -uprN binutils-2.11.93.0.2/bfd/elf32-hppa.h binutils-2.12.90.0.1/bfd/elf32-hppa.h --- binutils-2.11.93.0.2/bfd/elf32-hppa.h Fri Mar 9 11:15:50 2001 +++ binutils-2.12.90.0.1/bfd/elf32-hppa.h Thu Mar 7 11:52:36 2002 @@ -47,6 +47,9 @@ boolean elf32_hppa_set_gp boolean elf32_hppa_build_stubs PARAMS ((struct bfd_link_info *)); +elf_hppa_reloc_type elf32_hppa_reloc_final_type + PARAMS ((bfd *, elf_hppa_reloc_type, int, unsigned int)); + extern elf_hppa_reloc_type ** _bfd_elf32_hppa_gen_reloc_type PARAMS ((bfd *, elf_hppa_reloc_type, int, unsigned int, int, asymbol *)); diff -uprN binutils-2.11.93.0.2/bfd/elf32-i370.c binutils-2.12.90.0.1/bfd/elf32-i370.c --- binutils-2.11.93.0.2/bfd/elf32-i370.c Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/elf32-i370.c Thu Mar 7 11:52:36 2002 @@ -1436,7 +1436,7 @@ i370_elf_relocate_section (output_bfd, i && r_symndx != 0) { Elf_Internal_Rela outrel; - boolean skip; + int skip; #ifdef DEBUG fprintf (stderr, @@ -1468,13 +1468,14 @@ i370_elf_relocate_section (output_bfd, i BFD_ASSERT (sreloc != NULL); } - skip = false; + skip = 0; outrel.r_offset = _bfd_elf_section_offset (output_bfd, info, input_section, rel->r_offset); - if (outrel.r_offset == (bfd_vma) -1) - skip = true; + if (outrel.r_offset == (bfd_vma) -1 + || outrel.r_offset == (bfd_vma) -2) + skip = (int) outrel.r_offset; outrel.r_offset += (input_section->output_section->vma + input_section->output_offset); @@ -1549,7 +1550,7 @@ i370_elf_relocate_section (output_bfd, i /* This reloc will be computed at runtime, so there's no need to do anything now, unless this is a RELATIVE reloc in an unallocated section. */ - if (skip + if (skip == -1 || (input_section->flags & SEC_ALLOC) != 0 || ELF32_R_TYPE (outrel.r_info) != R_I370_RELATIVE) continue; diff -uprN binutils-2.11.93.0.2/bfd/elf32-i386.c binutils-2.12.90.0.1/bfd/elf32-i386.c --- binutils-2.11.93.0.2/bfd/elf32-i386.c Thu Feb 7 10:21:03 2002 +++ binutils-2.12.90.0.1/bfd/elf32-i386.c Thu Mar 7 11:52:36 2002 @@ -2006,20 +2006,20 @@ elf_i386_relocate_section (output_bfd, i time. */ skip = false; + relocate = false; outrel.r_offset = _bfd_elf_section_offset (output_bfd, info, input_section, rel->r_offset); if (outrel.r_offset == (bfd_vma) -1) skip = true; + else if (outrel.r_offset == (bfd_vma) -2) + skip = true, relocate = true; outrel.r_offset += (input_section->output_section->vma + input_section->output_offset); if (skip) - { - memset (&outrel, 0, sizeof outrel); - relocate = false; - } + memset (&outrel, 0, sizeof outrel); else if (h != NULL && h->dynindx != -1 && (r_type == R_386_PC32 @@ -2027,11 +2027,7 @@ elf_i386_relocate_section (output_bfd, i || !info->symbolic || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)) - - { - relocate = false; - outrel.r_info = ELF32_R_INFO (h->dynindx, r_type); - } + outrel.r_info = ELF32_R_INFO (h->dynindx, r_type); else { /* This symbol is local, or marked to become local. */ diff -uprN binutils-2.11.93.0.2/bfd/elf32-m68k.c binutils-2.12.90.0.1/bfd/elf32-m68k.c --- binutils-2.11.93.0.2/bfd/elf32-m68k.c Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/elf32-m68k.c Thu Mar 7 11:52:36 2002 @@ -407,10 +407,13 @@ elf32_m68k_print_private_bfd_data (abfd, /* Ignore init flag - it may not be set, despite the flags field containing valid data. */ /* xgettext:c-format */ - fprintf (file, _ ("private flags = %lx:"), elf_elfheader (abfd)->e_flags); + fprintf (file, _("private flags = %lx:"), elf_elfheader (abfd)->e_flags); if (elf_elfheader (abfd)->e_flags & EF_CPU32) - fprintf (file, _ (" [cpu32]")); + fprintf (file, _(" [cpu32]")); + + if (elf_elfheader (abfd)->e_flags & EF_M68000) + fprintf (file, _ (" [m68000]")); fputc ('\n', file); @@ -1651,20 +1654,20 @@ elf_m68k_relocate_section (output_bfd, i } skip = false; + relocate = false; outrel.r_offset = _bfd_elf_section_offset (output_bfd, info, input_section, rel->r_offset); if (outrel.r_offset == (bfd_vma) -1) skip = true; + else if (outrel.r_offset == (bfd_vma) -2) + skip = true, relocate = true; outrel.r_offset += (input_section->output_section->vma + input_section->output_offset); if (skip) - { - memset (&outrel, 0, sizeof outrel); - relocate = false; - } + memset (&outrel, 0, sizeof outrel); /* h->dynindx may be -1 if the symbol was marked to become local. */ else if (h != NULL @@ -1673,7 +1676,6 @@ elf_m68k_relocate_section (output_bfd, i & ELF_LINK_HASH_DEF_REGULAR) == 0)) { BFD_ASSERT (h->dynindx != -1); - relocate = false; outrel.r_info = ELF32_R_INFO (h->dynindx, r_type); outrel.r_addend = relocation + rel->r_addend; } @@ -1714,7 +1716,6 @@ elf_m68k_relocate_section (output_bfd, i BFD_ASSERT (indx > 0); } - relocate = false; outrel.r_info = ELF32_R_INFO (indx, r_type); outrel.r_addend = relocation + rel->r_addend; } diff -uprN binutils-2.11.93.0.2/bfd/elf32-mips.c binutils-2.12.90.0.1/bfd/elf32-mips.c --- binutils-2.11.93.0.2/bfd/elf32-mips.c Thu Feb 7 10:21:03 2002 +++ binutils-2.12.90.0.1/bfd/elf32-mips.c Thu Mar 7 11:52:36 2002 @@ -3280,11 +3280,11 @@ _bfd_mips_elf_print_private_bfd_data (ab else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_4) fprintf (file, _(" [mips4]")); else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_5) - fprintf (file, _ (" [mips5]")); + fprintf (file, _(" [mips5]")); else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_32) - fprintf (file, _ (" [mips32]")); + fprintf (file, _(" [mips32]")); else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_64) - fprintf (file, _ (" [mips64]")); + fprintf (file, _(" [mips64]")); else fprintf (file, _(" [unknown ISA]")); @@ -3583,8 +3583,16 @@ _bfd_mips_elf_fake_sections (abfd, hdr, /* The generic elf_fake_sections will set up REL_HDR using the default kind of relocations. But, we may actually need both - kinds of relocations, so we set up the second header here. */ - if ((sec->flags & SEC_RELOC) != 0) + kinds of relocations, so we set up the second header here. + + This is not necessary for the O32 ABI since that only uses Elf32_Rel + relocations (cf. System V ABI, MIPS RISC Processor Supplement, + 3rd Edition, p. 4-17). It breaks the IRIX 5/6 32-bit ld, since one + of the resulting empty .rela.
sections starts with + sh_offset == object size, and ld doesn't allow that. While the check + is arguably bogus for empty or SHT_NOBITS sections, it can easily be + avoided by not emitting those useless sections in the first place. */ + if (IRIX_COMPAT (abfd) != ict_irix5 && (sec->flags & SEC_RELOC) != 0) { struct bfd_elf_section_data *esd; bfd_size_type amt = sizeof (Elf_Internal_Shdr); @@ -5263,7 +5271,7 @@ _bfd_mips_elf_final_link (abfd, info) if (p->type != bfd_indirect_link_order) { - if (p->type == bfd_fill_link_order) + if (p->type == bfd_data_link_order) continue; abort (); } @@ -5390,7 +5398,7 @@ _bfd_mips_elf_final_link (abfd, info) if (p->type != bfd_indirect_link_order) { - if (p->type == bfd_fill_link_order) + if (p->type == bfd_data_link_order) continue; abort (); } @@ -5546,7 +5554,7 @@ _bfd_mips_elf_final_link (abfd, info) if (p->type != bfd_indirect_link_order) { - if (p->type == bfd_fill_link_order) + if (p->type == bfd_data_link_order) continue; abort (); } @@ -5626,7 +5634,7 @@ _bfd_mips_elf_final_link (abfd, info) if (p->type != bfd_indirect_link_order) { - if (p->type == bfd_fill_link_order) + if (p->type == bfd_data_link_order) continue; abort (); } @@ -6361,6 +6369,9 @@ mips_elf_create_dynamic_relocation (outp _bfd_elf_section_offset (output_bfd, info, input_section, rel->r_offset); if (outrel.r_offset == (bfd_vma) -1) skip = true; + /* FIXME: For -2 runtime relocation needs to be skipped, but + properly resolved statically and installed. */ + BFD_ASSERT (outrel.r_offset != (bfd_vma) -2); /* If we've decided to skip this relocation, just output an empty record. Note that R_MIPS_NONE == 0, so that this call to memset diff -uprN binutils-2.11.93.0.2/bfd/elf32-ppc.c binutils-2.12.90.0.1/bfd/elf32-ppc.c --- binutils-2.11.93.0.2/bfd/elf32-ppc.c Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/elf32-ppc.c Thu Mar 7 11:52:36 2002 @@ -3153,7 +3153,7 @@ ppc_elf_relocate_section (output_bfd, in && (input_section->flags & SEC_ALLOC) != 0) { Elf_Internal_Rela outrel; - boolean skip; + int skip; #ifdef DEBUG fprintf (stderr, "ppc_elf_relocate_section need to create relocation for %s\n", @@ -3184,13 +3184,14 @@ ppc_elf_relocate_section (output_bfd, in BFD_ASSERT (sreloc != NULL); } - skip = false; + skip = 0; outrel.r_offset = _bfd_elf_section_offset (output_bfd, info, input_section, rel->r_offset); - if (outrel.r_offset == (bfd_vma) -1) - skip = true; + if (outrel.r_offset == (bfd_vma) -1 + || outrel.r_offset == (bfd_vma) -2) + skip = (int) outrel.r_offset; outrel.r_offset += (input_section->output_section->vma + input_section->output_offset); @@ -3261,7 +3262,7 @@ ppc_elf_relocate_section (output_bfd, in /* This reloc will be computed at runtime, so there's no need to do anything now, unless this is a RELATIVE reloc in an unallocated section. */ - if (skip + if (skip != -1 || (input_section->flags & SEC_ALLOC) != 0 || ELF32_R_TYPE (outrel.r_info) != R_PPC_RELATIVE) continue; diff -uprN binutils-2.11.93.0.2/bfd/elf32-s390.c binutils-2.12.90.0.1/bfd/elf32-s390.c --- binutils-2.11.93.0.2/bfd/elf32-s390.c Thu Feb 7 10:21:03 2002 +++ binutils-2.12.90.0.1/bfd/elf32-s390.c Thu Mar 7 11:52:36 2002 @@ -111,6 +111,10 @@ static reloc_howto_type elf_howto_table[ HOWTO(R_390_PC16, 0, 1, 16, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_PC16", false, 0,0x0000ffff, true), HOWTO(R_390_PC16DBL, 1, 1, 16, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_PC16DBL", false, 0,0x0000ffff, true), HOWTO(R_390_PLT16DBL, 1, 1, 16, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_PLT16DBL", false, 0,0x0000ffff, true), + HOWTO(R_390_PC32DBL, 1, 2, 32, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_PC32DBL", false, 0,0xffffffff, true), + HOWTO(R_390_PLT32DBL, 1, 2, 32, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_PLT32DBL", false, 0,0xffffffff, true), + HOWTO(R_390_GOTPCDBL, 1, 2, 32, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_GOTPCDBL", false, 0,0xffffffff, true), + HOWTO(R_390_GOTENT, 1, 2, 32, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_GOTENT", false, 0,0xffffffff, true), }; /* GNU extension to record C++ vtable hierarchy. */ @@ -166,6 +170,14 @@ elf_s390_reloc_type_lookup (abfd, code) return &elf_howto_table[(int) R_390_PC16DBL]; case BFD_RELOC_390_PLT16DBL: return &elf_howto_table[(int) R_390_PLT16DBL]; + case BFD_RELOC_390_PC32DBL: + return &elf_howto_table[(int) R_390_PC32DBL]; + case BFD_RELOC_390_PLT32DBL: + return &elf_howto_table[(int) R_390_PLT32DBL]; + case BFD_RELOC_390_GOTPCDBL: + return &elf_howto_table[(int) R_390_GOTPCDBL]; + case BFD_RELOC_390_GOTENT: + return &elf_howto_table[(int) R_390_GOTENT]; case BFD_RELOC_VTABLE_INHERIT: return &elf32_s390_vtinherit_howto; case BFD_RELOC_VTABLE_ENTRY: @@ -650,6 +662,7 @@ elf_s390_check_relocs (abfd, info, sec, case R_390_GOT12: case R_390_GOT16: case R_390_GOT32: + case R_390_GOTENT: /* This symbol requires a global offset table entry. */ if (h != NULL) { @@ -679,6 +692,7 @@ elf_s390_check_relocs (abfd, info, sec, case R_390_GOTOFF: case R_390_GOTPC: + case R_390_GOTPCDBL: if (htab->sgot == NULL) { if (htab->elf.dynobj == NULL) @@ -689,6 +703,7 @@ elf_s390_check_relocs (abfd, info, sec, break; case R_390_PLT16DBL: + case R_390_PLT32DBL: case R_390_PLT32: /* This symbol requires a procedure linkage table entry. We actually build the entry in adjust_dynamic_symbol, @@ -711,6 +726,7 @@ elf_s390_check_relocs (abfd, info, sec, case R_390_32: case R_390_PC16: case R_390_PC16DBL: + case R_390_PC32DBL: case R_390_PC32: if (h != NULL && !info->shared) { @@ -752,6 +768,7 @@ elf_s390_check_relocs (abfd, info, sec, && (sec->flags & SEC_ALLOC) != 0 && ((ELF32_R_TYPE (rel->r_info) != R_390_PC16 && ELF32_R_TYPE (rel->r_info) != R_390_PC16DBL + && ELF32_R_TYPE (rel->r_info) != R_390_PC32DBL && ELF32_R_TYPE (rel->r_info) != R_390_PC32) || (h != NULL && (! info->symbolic @@ -854,6 +871,7 @@ elf_s390_check_relocs (abfd, info, sec, p->count += 1; if (ELF32_R_TYPE (rel->r_info) == R_390_PC16 || ELF32_R_TYPE (rel->r_info) == R_390_PC16DBL + || ELF32_R_TYPE (rel->r_info) == R_390_PC32DBL || ELF32_R_TYPE (rel->r_info) == R_390_PC32) p->pc_count += 1; } @@ -954,6 +972,8 @@ elf_s390_gc_sweep_hook (abfd, info, sec, case R_390_GOT32: case R_390_GOTOFF: case R_390_GOTPC: + case R_390_GOTPCDBL: + case R_390_GOTENT: r_symndx = ELF32_R_SYM (rel->r_info); if (r_symndx >= symtab_hdr->sh_info) { @@ -974,6 +994,7 @@ elf_s390_gc_sweep_hook (abfd, info, sec, case R_390_32: case R_390_PC16: case R_390_PC16DBL: + case R_390_PC32DBL: case R_390_PC32: r_symndx = ELF32_R_SYM (rel->r_info); if (r_symndx >= symtab_hdr->sh_info) @@ -994,6 +1015,7 @@ elf_s390_gc_sweep_hook (abfd, info, sec, { if (ELF32_R_TYPE (rel->r_info) == R_390_PC16 || ELF32_R_TYPE (rel->r_info) == R_390_PC16DBL + || ELF32_R_TYPE (rel->r_info) == R_390_PC32DBL || ELF32_R_TYPE (rel->r_info) == R_390_PC32) p->pc_count -= 1; p->count -= 1; @@ -1005,6 +1027,7 @@ elf_s390_gc_sweep_hook (abfd, info, sec, break; case R_390_PLT16DBL: + case R_390_PLT32DBL: case R_390_PLT32: r_symndx = ELF32_R_SYM (rel->r_info); if (r_symndx >= symtab_hdr->sh_info) @@ -1716,6 +1739,7 @@ elf_s390_relocate_section (output_bfd, i case R_390_GOT12: case R_390_GOT16: case R_390_GOT32: + case R_390_GOTENT: /* Relocation is to the entry for this symbol in the global offset table. */ if (htab->sgot == NULL) @@ -1803,6 +1827,16 @@ elf_s390_relocate_section (output_bfd, i abort (); relocation = htab->sgot->output_offset + off; + + /* + * For @GOTENT the relocation is against the offset between + * the instruction and the symbols entry in the GOT and not + * between the start of the GOT and the symbols entry. We + * add the vma of the GOT to get the correct value. + */ + if (r_type == R_390_GOTENT) + relocation += htab->sgot->output_section->vma; + break; case R_390_GOTOFF: @@ -1818,12 +1852,14 @@ elf_s390_relocate_section (output_bfd, i break; case R_390_GOTPC: + case R_390_GOTPCDBL: /* Use global offset table as symbol value. */ relocation = htab->sgot->output_section->vma; unresolved_reloc = false; break; case R_390_PLT16DBL: + case R_390_PLT32DBL: case R_390_PLT32: /* Relocation is to the entry for this symbol in the procedure linkage table. */ @@ -1853,6 +1889,7 @@ elf_s390_relocate_section (output_bfd, i case R_390_32: case R_390_PC16: case R_390_PC16DBL: + case R_390_PC32DBL: case R_390_PC32: /* r_symndx will be zero only for relocs against symbols from removed linkonce sections, or sections discarded by @@ -1864,6 +1901,7 @@ elf_s390_relocate_section (output_bfd, i if ((info->shared && ((r_type != R_390_PC16 && r_type != R_390_PC16DBL + && r_type != R_390_PC32DBL && r_type != R_390_PC32) || (h != NULL && h->dynindx != -1 @@ -1891,31 +1929,31 @@ elf_s390_relocate_section (output_bfd, i time. */ skip = false; + relocate = false; outrel.r_offset = _bfd_elf_section_offset (output_bfd, info, input_section, rel->r_offset); if (outrel.r_offset == (bfd_vma) -1) skip = true; + else if (outrel.r_offset == (bfd_vma) -2) + skip = true, relocate = true; outrel.r_offset += (input_section->output_section->vma + input_section->output_offset); if (skip) - { - memset (&outrel, 0, sizeof outrel); - relocate = false; - } + memset (&outrel, 0, sizeof outrel); else if (h != NULL && h->dynindx != -1 && (r_type == R_390_PC16 || r_type == R_390_PC16DBL + || r_type == R_390_PC32DBL || r_type == R_390_PC32 || !info->shared || !info->symbolic || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)) { - relocate = false; outrel.r_info = ELF32_R_INFO (h->dynindx, r_type); outrel.r_addend = rel->r_addend; } @@ -2376,7 +2414,7 @@ static boolean elf_s390_object_p (abfd) bfd *abfd; { - return bfd_default_set_arch_mach (abfd, bfd_arch_s390, bfd_mach_s390_esa); + return bfd_default_set_arch_mach (abfd, bfd_arch_s390, bfd_mach_s390_31); } static boolean diff -uprN binutils-2.11.93.0.2/bfd/elf32-sh.c binutils-2.12.90.0.1/bfd/elf32-sh.c --- binutils-2.11.93.0.2/bfd/elf32-sh.c Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/elf32-sh.c Thu Mar 7 11:52:36 2002 @@ -1,5 +1,5 @@ /* Hitachi SH specific support for 32-bit ELF - Copyright 1996, 1997, 1998, 1999, 2000, 2001 + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Contributed by Ian Lance Taylor, Cygnus Support. @@ -85,6 +85,9 @@ static boolean sh_elf_gc_sweep_hook const Elf_Internal_Rela *)); static enum elf_reloc_type_class sh_elf_reloc_type_class PARAMS ((const Elf_Internal_Rela *)); +#ifdef INCLUDE_SHMEDIA +inline static void movi_shori_putval PARAMS ((bfd *, unsigned long, char *)); +#endif /* The name of the dynamic interpreter. This is put in the .interp section. */ @@ -492,6 +495,114 @@ static reloc_howto_type sh_elf_howto_tab EMPTY_HOWTO (42), EMPTY_HOWTO (43), EMPTY_HOWTO (44), + +#ifdef INCLUDE_SHMEDIA + /* Used in SHLLI.L and SHLRI.L. */ + HOWTO (R_SH_DIR5U, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 5, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR5U", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0xfc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in SHARI, SHLLI et al. */ + HOWTO (R_SH_DIR6U, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 6, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR6U", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0xfc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in BxxI, LDHI.L et al. */ + HOWTO (R_SH_DIR6S, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 6, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR6S", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0xfc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in ADDI, ANDI et al. */ + HOWTO (R_SH_DIR10S, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 10, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR10S", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in LD.UW, ST.W et al. */ + HOWTO (R_SH_DIR10SW, /* type */ + 1, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 11, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR10SW", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in LD.L, FLD.S et al. */ + HOWTO (R_SH_DIR10SL, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR10SL", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in FLD.D, FST.P et al. */ + HOWTO (R_SH_DIR10SQ, /* type */ + 3, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 13, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR10SQ", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + false), /* pcrel_offset */ + +#else EMPTY_HOWTO (45), EMPTY_HOWTO (46), EMPTY_HOWTO (47), @@ -499,6 +610,8 @@ static reloc_howto_type sh_elf_howto_tab EMPTY_HOWTO (49), EMPTY_HOWTO (50), EMPTY_HOWTO (51), +#endif + EMPTY_HOWTO (52), EMPTY_HOWTO (53), EMPTY_HOWTO (54), @@ -720,6 +833,704 @@ static reloc_howto_type sh_elf_howto_tab 0xffffffff, /* dst_mask */ true), /* pcrel_offset */ + HOWTO (R_SH_GOTPLT32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_GOTPLT32", /* name */ + false, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + false), /* pcrel_offset */ + +#ifdef INCLUDE_SHMEDIA + /* Used in MOVI and SHORI (x & 65536). */ + HOWTO (R_SH_GOT_LOW16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOT_LOW16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 16) & 65536). */ + HOWTO (R_SH_GOT_MEDLOW16, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOT_MEDLOW16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 32) & 65536). */ + HOWTO (R_SH_GOT_MEDHI16, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOT_MEDHI16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 48) & 65536). */ + HOWTO (R_SH_GOT_HI16, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOT_HI16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI (x & 65536). */ + HOWTO (R_SH_GOTPLT_LOW16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPLT_LOW16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 16) & 65536). */ + HOWTO (R_SH_GOTPLT_MEDLOW16, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPLT_MEDLOW16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 32) & 65536). */ + HOWTO (R_SH_GOTPLT_MEDHI16, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPLT_MEDHI16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 48) & 65536). */ + HOWTO (R_SH_GOTPLT_HI16, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPLT_HI16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI (x & 65536). */ + HOWTO (R_SH_PLT_LOW16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + true, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_PLT_LOW16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + true), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 16) & 65536). */ + HOWTO (R_SH_PLT_MEDLOW16, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + true, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_PLT_MEDLOW16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + true), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 32) & 65536). */ + HOWTO (R_SH_PLT_MEDHI16, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + true, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_PLT_MEDHI16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + true), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 48) & 65536). */ + HOWTO (R_SH_PLT_HI16, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + true, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_PLT_HI16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + true), /* pcrel_offset */ + + /* Used in MOVI and SHORI (x & 65536). */ + HOWTO (R_SH_GOTOFF_LOW16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTOFF_LOW16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 16) & 65536). */ + HOWTO (R_SH_GOTOFF_MEDLOW16, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTOFF_MEDLOW16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 32) & 65536). */ + HOWTO (R_SH_GOTOFF_MEDHI16, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTOFF_MEDHI16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 48) & 65536). */ + HOWTO (R_SH_GOTOFF_HI16, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTOFF_HI16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI (x & 65536). */ + HOWTO (R_SH_GOTPC_LOW16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + true, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPC_LOW16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + true), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 16) & 65536). */ + HOWTO (R_SH_GOTPC_MEDLOW16, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + true, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPC_MEDLOW16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + true), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 32) & 65536). */ + HOWTO (R_SH_GOTPC_MEDHI16, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + true, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPC_MEDHI16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + true), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 48) & 65536). */ + HOWTO (R_SH_GOTPC_HI16, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + true, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPC_HI16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + true), /* pcrel_offset */ + + /* Used in LD.L, FLD.S et al. */ + HOWTO (R_SH_GOT10BY4, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOT10BY4", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in LD.L, FLD.S et al. */ + HOWTO (R_SH_GOTPLT10BY4, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPLT10BY4", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in FLD.D, FST.P et al. */ + HOWTO (R_SH_GOT10BY8, /* type */ + 3, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 13, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOT10BY8", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in FLD.D, FST.P et al. */ + HOWTO (R_SH_GOTPLT10BY8, /* type */ + 3, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 13, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPLT10BY8", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + false), /* pcrel_offset */ + + HOWTO (R_SH_COPY64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_COPY64", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + ((bfd_vma) 0) - 1, /* dst_mask */ + false), /* pcrel_offset */ + + HOWTO (R_SH_GLOB_DAT64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GLOB_DAT64", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + ((bfd_vma) 0) - 1, /* dst_mask */ + false), /* pcrel_offset */ + + HOWTO (R_SH_JMP_SLOT64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_JMP_SLOT64", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + ((bfd_vma) 0) - 1, /* dst_mask */ + false), /* pcrel_offset */ + + HOWTO (R_SH_RELATIVE64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_RELATIVE64", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + ((bfd_vma) 0) - 1, /* dst_mask */ + false), /* pcrel_offset */ + + EMPTY_HOWTO (197), + EMPTY_HOWTO (198), + EMPTY_HOWTO (199), + EMPTY_HOWTO (200), + EMPTY_HOWTO (201), + EMPTY_HOWTO (202), + EMPTY_HOWTO (203), + EMPTY_HOWTO (204), + EMPTY_HOWTO (205), + EMPTY_HOWTO (206), + EMPTY_HOWTO (207), + EMPTY_HOWTO (208), + EMPTY_HOWTO (209), + EMPTY_HOWTO (210), + EMPTY_HOWTO (211), + EMPTY_HOWTO (212), + EMPTY_HOWTO (213), + EMPTY_HOWTO (214), + EMPTY_HOWTO (215), + EMPTY_HOWTO (216), + EMPTY_HOWTO (217), + EMPTY_HOWTO (218), + EMPTY_HOWTO (219), + EMPTY_HOWTO (220), + EMPTY_HOWTO (221), + EMPTY_HOWTO (222), + EMPTY_HOWTO (223), + EMPTY_HOWTO (224), + EMPTY_HOWTO (225), + EMPTY_HOWTO (226), + EMPTY_HOWTO (227), + EMPTY_HOWTO (228), + EMPTY_HOWTO (229), + EMPTY_HOWTO (230), + EMPTY_HOWTO (231), + EMPTY_HOWTO (232), + EMPTY_HOWTO (233), + EMPTY_HOWTO (234), + EMPTY_HOWTO (235), + EMPTY_HOWTO (236), + EMPTY_HOWTO (237), + EMPTY_HOWTO (238), + EMPTY_HOWTO (239), + EMPTY_HOWTO (240), + EMPTY_HOWTO (241), + + /* Relocations for SHmedia code. None of these are partial_inplace or + use the field being relocated (except R_SH_PT_16). */ + + /* The assembler will generate this reloc before a block of SHmedia + instructions. A section should be processed as assuming it contains + data, unless this reloc is seen. Note that a block of SHcompact + instructions are instead preceded by R_SH_CODE. + This is currently not implemented, but should be used for SHmedia + linker relaxation. */ + HOWTO (R_SH_SHMEDIA_CODE, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_SHMEDIA_CODE", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + false), /* pcrel_offset */ + + /* The assembler will generate this reloc at a PTA or PTB instruction, + and the linker checks the right type of target, or changes a PTA to a + PTB, if the original insn was PT. */ + HOWTO (R_SH_PT_16, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 18, /* bitsize */ + true, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_PT_16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + true), /* pcrel_offset */ + + /* Used in unexpanded MOVI. */ + HOWTO (R_SH_IMMS16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMMS16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in SHORI. */ + HOWTO (R_SH_IMMU16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMMU16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI (x & 65536). */ + HOWTO (R_SH_IMM_LOW16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_LOW16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x - $) & 65536). */ + HOWTO (R_SH_IMM_LOW16_PCREL, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + true, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_LOW16_PCREL", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + true), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 16) & 65536). */ + HOWTO (R_SH_IMM_MEDLOW16, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_MEDLOW16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI (((x - $) >> 16) & 65536). */ + HOWTO (R_SH_IMM_MEDLOW16_PCREL, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + true, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_MEDLOW16_PCREL", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + true), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 32) & 65536). */ + HOWTO (R_SH_IMM_MEDHI16, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_MEDHI16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI (((x - $) >> 32) & 65536). */ + HOWTO (R_SH_IMM_MEDHI16_PCREL, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + true, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_MEDHI16_PCREL", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + true), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 48) & 65536). */ + HOWTO (R_SH_IMM_HI16, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_HI16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI (((x - $) >> 48) & 65536). */ + HOWTO (R_SH_IMM_HI16_PCREL, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + true, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_HI16_PCREL", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + true), /* pcrel_offset */ + + /* For the .uaquad pseudo. */ + HOWTO (R_SH_64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_64", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + ((bfd_vma) 0) - 1, /* dst_mask */ + false), /* pcrel_offset */ + + /* For the .uaquad pseudo, (x - $). */ + HOWTO (R_SH_64_PCREL, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + true, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_64_PCREL", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + ((bfd_vma) 0) - 1, /* dst_mask */ + true), /* pcrel_offset */ + +#endif }; static bfd_reloc_status_type @@ -965,6 +1776,58 @@ static const struct elf_reloc_map sh_rel { BFD_RELOC_SH_RELATIVE, R_SH_RELATIVE }, { BFD_RELOC_32_GOTOFF, R_SH_GOTOFF }, { BFD_RELOC_SH_GOTPC, R_SH_GOTPC }, + { BFD_RELOC_SH_GOTPLT32, R_SH_GOTPLT32 }, +#ifdef INCLUDE_SHMEDIA + { BFD_RELOC_SH_GOT_LOW16, R_SH_GOT_LOW16 }, + { BFD_RELOC_SH_GOT_MEDLOW16, R_SH_GOT_MEDLOW16 }, + { BFD_RELOC_SH_GOT_MEDHI16, R_SH_GOT_MEDHI16 }, + { BFD_RELOC_SH_GOT_HI16, R_SH_GOT_HI16 }, + { BFD_RELOC_SH_GOTPLT_LOW16, R_SH_GOTPLT_LOW16 }, + { BFD_RELOC_SH_GOTPLT_MEDLOW16, R_SH_GOTPLT_MEDLOW16 }, + { BFD_RELOC_SH_GOTPLT_MEDHI16, R_SH_GOTPLT_MEDHI16 }, + { BFD_RELOC_SH_GOTPLT_HI16, R_SH_GOTPLT_HI16 }, + { BFD_RELOC_SH_PLT_LOW16, R_SH_PLT_LOW16 }, + { BFD_RELOC_SH_PLT_MEDLOW16, R_SH_PLT_MEDLOW16 }, + { BFD_RELOC_SH_PLT_MEDHI16, R_SH_PLT_MEDHI16 }, + { BFD_RELOC_SH_PLT_HI16, R_SH_PLT_HI16 }, + { BFD_RELOC_SH_GOTOFF_LOW16, R_SH_GOTOFF_LOW16 }, + { BFD_RELOC_SH_GOTOFF_MEDLOW16, R_SH_GOTOFF_MEDLOW16 }, + { BFD_RELOC_SH_GOTOFF_MEDHI16, R_SH_GOTOFF_MEDHI16 }, + { BFD_RELOC_SH_GOTOFF_HI16, R_SH_GOTOFF_HI16 }, + { BFD_RELOC_SH_GOTPC_LOW16, R_SH_GOTPC_LOW16 }, + { BFD_RELOC_SH_GOTPC_MEDLOW16, R_SH_GOTPC_MEDLOW16 }, + { BFD_RELOC_SH_GOTPC_MEDHI16, R_SH_GOTPC_MEDHI16 }, + { BFD_RELOC_SH_GOTPC_HI16, R_SH_GOTPC_HI16 }, + { BFD_RELOC_SH_COPY64, R_SH_COPY64 }, + { BFD_RELOC_SH_GLOB_DAT64, R_SH_GLOB_DAT64 }, + { BFD_RELOC_SH_JMP_SLOT64, R_SH_JMP_SLOT64 }, + { BFD_RELOC_SH_RELATIVE64, R_SH_RELATIVE64 }, + { BFD_RELOC_SH_GOT10BY4, R_SH_GOT10BY4 }, + { BFD_RELOC_SH_GOT10BY8, R_SH_GOT10BY8 }, + { BFD_RELOC_SH_GOTPLT10BY4, R_SH_GOTPLT10BY4 }, + { BFD_RELOC_SH_GOTPLT10BY8, R_SH_GOTPLT10BY8 }, + { BFD_RELOC_SH_PT_16, R_SH_PT_16 }, + { BFD_RELOC_SH_SHMEDIA_CODE, R_SH_SHMEDIA_CODE }, + { BFD_RELOC_SH_IMMU5, R_SH_DIR5U }, + { BFD_RELOC_SH_IMMS6, R_SH_DIR6S }, + { BFD_RELOC_SH_IMMU6, R_SH_DIR6U }, + { BFD_RELOC_SH_IMMS10, R_SH_DIR10S }, + { BFD_RELOC_SH_IMMS10BY2, R_SH_DIR10SW }, + { BFD_RELOC_SH_IMMS10BY4, R_SH_DIR10SL }, + { BFD_RELOC_SH_IMMS10BY8, R_SH_DIR10SQ }, + { BFD_RELOC_SH_IMMS16, R_SH_IMMS16 }, + { BFD_RELOC_SH_IMMU16, R_SH_IMMU16 }, + { BFD_RELOC_SH_IMM_LOW16, R_SH_IMM_LOW16 }, + { BFD_RELOC_SH_IMM_LOW16_PCREL, R_SH_IMM_LOW16_PCREL }, + { BFD_RELOC_SH_IMM_MEDLOW16, R_SH_IMM_MEDLOW16 }, + { BFD_RELOC_SH_IMM_MEDLOW16_PCREL, R_SH_IMM_MEDLOW16_PCREL }, + { BFD_RELOC_SH_IMM_MEDHI16, R_SH_IMM_MEDHI16 }, + { BFD_RELOC_SH_IMM_MEDHI16_PCREL, R_SH_IMM_MEDHI16_PCREL }, + { BFD_RELOC_SH_IMM_HI16, R_SH_IMM_HI16 }, + { BFD_RELOC_SH_IMM_HI16_PCREL, R_SH_IMM_HI16_PCREL }, + { BFD_RELOC_64, R_SH_64 }, + { BFD_RELOC_64_PCREL, R_SH_64_PCREL }, +#endif /* not INCLUDE_SHMEDIA */ }; /* Given a BFD reloc code, return the howto structure for the @@ -1001,6 +1864,8 @@ sh_elf_info_to_howto (abfd, cache_ptr, d BFD_ASSERT (r < (unsigned int) R_SH_max); BFD_ASSERT (r < R_SH_FIRST_INVALID_RELOC || r > R_SH_LAST_INVALID_RELOC); BFD_ASSERT (r < R_SH_FIRST_INVALID_RELOC_2 || r > R_SH_LAST_INVALID_RELOC_2); + BFD_ASSERT (r < R_SH_FIRST_INVALID_RELOC_3 || r > R_SH_LAST_INVALID_RELOC_3); + BFD_ASSERT (r < R_SH_FIRST_INVALID_RELOC_4 || r > R_SH_LAST_INVALID_RELOC_4); cache_ptr->howto = &sh_elf_howto_table[r]; } @@ -1041,6 +1906,14 @@ sh_elf_relax_section (abfd, sec, link_in || sec->reloc_count == 0) return true; +#ifdef INCLUDE_SHMEDIA + if (elf_section_data (sec)->this_hdr.sh_flags + & (SHF_SH5_ISA32 | SHF_SH5_ISA32_MIXED)) + { + return true; + } +#endif + /* If this is the first time we have been called for this section, initialize the cooked size. */ if (sec->_cooked_size == 0) @@ -1196,7 +2069,8 @@ sh_elf_relax_section (abfd, sec, link_in shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irelfn->r_info) : 0); bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym); - if (isym.st_shndx != _bfd_elf_section_from_bfd_section (abfd, sec)) + if (isym.st_shndx + != (unsigned int) _bfd_elf_section_from_bfd_section (abfd, sec)) { ((*_bfd_error_handler) (_("%s: 0x%lx: warning: symbol in unexpected section"), @@ -1937,10 +2811,10 @@ sh_elf_relax_delete_bytes (abfd, sec, ad static boolean sh_elf_align_loads (abfd, sec, internal_relocs, contents, pswapped) - bfd *abfd; + bfd *abfd ATTRIBUTE_UNUSED; asection *sec; Elf_Internal_Rela *internal_relocs; - bfd_byte *contents; + bfd_byte *contents ATTRIBUTE_UNUSED; boolean *pswapped; { Elf_Internal_Rela *irel, *irelend; @@ -2140,6 +3014,178 @@ sh_elf_swap_insns (abfd, sec, relocs, co return true; } +#ifdef INCLUDE_SHMEDIA + +/* The size in bytes of an entry in the procedure linkage table. */ + +#define PLT_ENTRY_SIZE 64 + +/* First entry in an absolute procedure linkage table look like this. */ + +static const bfd_byte elf_sh_plt0_entry_be[PLT_ENTRY_SIZE] = +{ + 0xcc, 0x00, 0x01, 0x10, /* movi .got.plt >> 16, r17 */ + 0xc8, 0x00, 0x01, 0x10, /* shori .got.plt & 65535, r17 */ + 0x89, 0x10, 0x09, 0x90, /* ld.l r17, 8, r25 */ + 0x6b, 0xf1, 0x46, 0x00, /* ptabs r17, tr0 */ + 0x89, 0x10, 0x05, 0x10, /* ld.l r17, 4, r17 */ + 0x44, 0x01, 0xff, 0xf0, /* blink tr0, r63 */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ +}; + +static const bfd_byte elf_sh_plt0_entry_le[PLT_ENTRY_SIZE] = +{ + 0x10, 0x01, 0x00, 0xcc, /* movi .got.plt >> 16, r17 */ + 0x10, 0x01, 0x00, 0xc8, /* shori .got.plt & 65535, r17 */ + 0x90, 0x09, 0x10, 0x89, /* ld.l r17, 8, r25 */ + 0x00, 0x46, 0xf1, 0x6b, /* ptabs r17, tr0 */ + 0x10, 0x05, 0x10, 0x89, /* ld.l r17, 4, r17 */ + 0xf0, 0xff, 0x01, 0x44, /* blink tr0, r63 */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ +}; + +/* Sebsequent entries in an absolute procedure linkage table look like + this. */ + +static const bfd_byte elf_sh_plt_entry_be[PLT_ENTRY_SIZE] = +{ + 0xcc, 0x00, 0x01, 0x90, /* movi nameN-in-GOT >> 16, r25 */ + 0xc8, 0x00, 0x01, 0x90, /* shori nameN-in-GOT & 65535, r25 */ + 0x89, 0x90, 0x01, 0x90, /* ld.l r25, 0, r25 */ + 0x6b, 0xf1, 0x66, 0x00, /* ptabs r25, tr0 */ + 0x44, 0x01, 0xff, 0xf0, /* blink tr0, r63 */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0xcc, 0x00, 0x01, 0x90, /* movi .PLT0 >> 16, r25 */ + 0xc8, 0x00, 0x01, 0x90, /* shori .PLT0 & 65535, r25 */ + 0x6b, 0xf1, 0x66, 0x00, /* ptabs r25, tr0 */ + 0xcc, 0x00, 0x01, 0x50, /* movi reloc-offset >> 16, r21 */ + 0xc8, 0x00, 0x01, 0x50, /* shori reloc-offset & 65535, r21 */ + 0x44, 0x01, 0xff, 0xf0, /* blink tr0, r63 */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ +}; + +static const bfd_byte elf_sh_plt_entry_le[PLT_ENTRY_SIZE] = +{ + 0x90, 0x01, 0x00, 0xcc, /* movi nameN-in-GOT >> 16, r25 */ + 0x90, 0x01, 0x00, 0xc8, /* shori nameN-in-GOT & 65535, r25 */ + 0x90, 0x01, 0x90, 0x89, /* ld.l r25, 0, r25 */ + 0x00, 0x66, 0xf1, 0x6b, /* ptabs r25, tr0 */ + 0xf0, 0xff, 0x01, 0x44, /* blink tr0, r63 */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0x90, 0x01, 0x00, 0xcc, /* movi .PLT0 >> 16, r25 */ + 0x90, 0x01, 0x00, 0xc8, /* shori .PLT0 & 65535, r25 */ + 0x00, 0x66, 0xf1, 0x6b, /* ptabs r25, tr0 */ + 0x50, 0x01, 0x00, 0xcc, /* movi reloc-offset >> 16, r21 */ + 0x50, 0x01, 0x00, 0xc8, /* shori reloc-offset & 65535, r21 */ + 0xf0, 0xff, 0x01, 0x44, /* blink tr0, r63 */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ +}; + +/* Entries in a PIC procedure linkage table look like this. */ + +static const bfd_byte elf_sh_pic_plt_entry_be[PLT_ENTRY_SIZE] = +{ + 0xcc, 0x00, 0x01, 0x90, /* movi nameN@GOT >> 16, r25 */ + 0xc8, 0x00, 0x01, 0x90, /* shori nameN@GOT & 65535, r25 */ + 0x40, 0xc2, 0x65, 0x90, /* ldx.l r12, r25, r25 */ + 0x6b, 0xf1, 0x66, 0x00, /* ptabs r25, tr0 */ + 0x44, 0x01, 0xff, 0xf0, /* blink tr0, r63 */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0xce, 0x00, 0x01, 0x10, /* movi -GOT_BIAS, r17 */ + 0x00, 0xca, 0x45, 0x10, /* sub.l r12, r17, r17 */ + 0x89, 0x10, 0x09, 0x90, /* ld.l r17, 8, r25 */ + 0x6b, 0xf1, 0x66, 0x00, /* ptabs r25, tr0 */ + 0x89, 0x10, 0x05, 0x10, /* ld.l r17, 4, r17 */ + 0xcc, 0x00, 0x01, 0x50, /* movi reloc-offset >> 16, r21 */ + 0xc8, 0x00, 0x01, 0x50, /* shori reloc-offset & 65535, r21 */ + 0x44, 0x01, 0xff, 0xf0, /* blink tr0, r63 */ +}; + +static const bfd_byte elf_sh_pic_plt_entry_le[PLT_ENTRY_SIZE] = +{ + 0x90, 0x01, 0x00, 0xcc, /* movi nameN@GOT >> 16, r25 */ + 0x90, 0x01, 0x00, 0xc8, /* shori nameN@GOT & 65535, r25 */ + 0x90, 0x65, 0xc2, 0x40, /* ldx.l r12, r25, r25 */ + 0x00, 0x66, 0xf1, 0x6b, /* ptabs r25, tr0 */ + 0xf0, 0xff, 0x01, 0x44, /* blink tr0, r63 */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0x10, 0x01, 0x00, 0xce, /* movi -GOT_BIAS, r17 */ + 0x10, 0x45, 0xca, 0x00, /* sub.l r12, r17, r17 */ + 0x90, 0x09, 0x10, 0x89, /* ld.l r17, 8, r25 */ + 0x00, 0x66, 0xf1, 0x6b, /* ptabs r25, tr0 */ + 0x10, 0x05, 0x10, 0x89, /* ld.l r17, 4, r17 */ + 0x50, 0x01, 0x00, 0xcc, /* movi reloc-offset >> 16, r21 */ + 0x50, 0x01, 0x00, 0xc8, /* shori reloc-offset & 65535, r21 */ + 0xf0, 0xff, 0x01, 0x44, /* blink tr0, r63 */ +}; + +static const bfd_byte *elf_sh_plt0_entry; +static const bfd_byte *elf_sh_plt_entry; +static const bfd_byte *elf_sh_pic_plt_entry; + +/* Return size of a PLT entry. */ +#define elf_sh_sizeof_plt(info) PLT_ENTRY_SIZE + +/* Return offset of the PLT0 address in an absolute PLT entry. */ +#define elf_sh_plt_plt0_offset(info) 32 + +/* Return offset of the linker in PLT0 entry. */ +#define elf_sh_plt0_gotplt_offset(info) 0 + +/* Return offset of the trampoline in PLT entry */ +#define elf_sh_plt_temp_offset(info) 33 /* Add one because it's SHmedia. */ + +/* Return offset of the symbol in PLT entry. */ +#define elf_sh_plt_symbol_offset(info) 0 + +/* Return offset of the relocation in PLT entry. */ +#define elf_sh_plt_reloc_offset(info) (info->shared ? 52 : 44) + +inline static void +movi_shori_putval (output_bfd, value, addr) + bfd *output_bfd; + unsigned long value; + char *addr; +{ + bfd_put_32 (output_bfd, + bfd_get_32 (output_bfd, addr) + | ((value >> 6) & 0x3fffc00), + addr); + bfd_put_32 (output_bfd, + bfd_get_32 (output_bfd, addr + 4) + | ((value << 10) & 0x3fffc00), + addr + 4); +} + +#else /* The size in bytes of an entry in the procedure linkage table. */ #define PLT_ENTRY_SIZE 28 @@ -2379,6 +3425,7 @@ static const bfd_byte *elf_sh_pic_plt_en /* Return offset of the relocation in PLT entry. */ #define elf_sh_plt_reloc_offset(info) 24 +#endif /* The sh 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 @@ -2405,6 +3452,10 @@ struct elf_sh_link_hash_entry { struct elf_link_hash_entry root; +#ifdef INCLUDE_SHMEDIA + bfd_vma datalabel_got_offset; +#endif + /* Number of PC relative relocs copied for this symbol. */ struct elf_sh_pcrel_relocs_copied *pcrel_relocs_copied; }; @@ -2461,6 +3512,9 @@ sh_elf_link_hash_newfunc (entry, table, if (ret != (struct elf_sh_link_hash_entry *) NULL) { ret->pcrel_relocs_copied = NULL; +#ifdef INCLUDE_SHMEDIA + ret->datalabel_got_offset = (bfd_vma) -1; +#endif } return (struct bfd_hash_entry *) ret; @@ -3014,6 +4068,7 @@ sh_elf_relocate_section (output_bfd, inf bfd *dynobj; bfd_vma *local_got_offsets; asection *sgot; + asection *sgotplt; asection *splt; asection *sreloc; @@ -3023,6 +4078,7 @@ sh_elf_relocate_section (output_bfd, inf local_got_offsets = elf_local_got_offsets (input_bfd); sgot = NULL; + sgotplt = NULL; splt = NULL; sreloc = NULL; @@ -3039,6 +4095,7 @@ sh_elf_relocate_section (output_bfd, inf bfd_vma relocation; bfd_vma addend = (bfd_vma) 0; bfd_reloc_status_type r; + int seen_stt_datalabel = 0; r_symndx = ELF32_R_SYM (rel->r_info); @@ -3056,6 +4113,10 @@ sh_elf_relocate_section (output_bfd, inf || r_type >= R_SH_max || (r_type >= (int) R_SH_FIRST_INVALID_RELOC && r_type <= (int) R_SH_LAST_INVALID_RELOC) + || ( r_type >= (int) R_SH_FIRST_INVALID_RELOC_3 + && r_type <= (int) R_SH_LAST_INVALID_RELOC_3) + || ( r_type >= (int) R_SH_FIRST_INVALID_RELOC_4 + && r_type <= (int) R_SH_LAST_INVALID_RELOC_4) || (r_type >= (int) R_SH_FIRST_INVALID_RELOC_2 && r_type <= (int) R_SH_LAST_INVALID_RELOC_2)) { @@ -3080,6 +4141,14 @@ sh_elf_relocate_section (output_bfd, inf relocation = (sec->output_section->vma + sec->output_offset + sym->st_value); + /* A local symbol never has STO_SH5_ISA32, so we don't need + datalabel processing here. Make sure this does not change + without notice. */ + if ((sym->st_other & STO_SH5_ISA32) != 0) + ((*info->callbacks->reloc_dangerous) + (info, + _("Unexpected STO_SH5_ISA32 on local symbol is not handled"), + input_bfd, input_section, rel->r_offset)); if (info->relocateable) { /* This is a relocateable link. We don't have to change @@ -3158,7 +4227,15 @@ sh_elf_relocate_section (output_bfd, inf h = sym_hashes[r_symndx - symtab_hdr->sh_info]; while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; + { +#ifdef INCLUDE_SHMEDIA + /* If the reference passes a symbol marked with + STT_DATALABEL, then any STO_SH5_ISA32 on the final value + doesn't count. */ + seen_stt_datalabel |= h->type == STT_DATALABEL; +#endif + h = (struct elf_link_hash_entry *) h->root.u.i.link; + } if (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) { @@ -3167,9 +4244,21 @@ sh_elf_relocate_section (output_bfd, inf We check specially because in some obscure cases sec->output_section will be NULL. */ if (r_type == R_SH_GOTPC - || (r_type == R_SH_PLT32 + || r_type == R_SH_GOTPC_LOW16 + || r_type == R_SH_GOTPC_MEDLOW16 + || r_type == R_SH_GOTPC_MEDHI16 + || r_type == R_SH_GOTPC_HI16 + || ((r_type == R_SH_PLT32 + || r_type == R_SH_PLT_LOW16 + || r_type == R_SH_PLT_MEDLOW16 + || r_type == R_SH_PLT_MEDHI16 + || r_type == R_SH_PLT_HI16) && h->plt.offset != (bfd_vma) -1) - || (r_type == R_SH_GOT32 + || ((r_type == R_SH_GOT32 + || r_type == R_SH_GOT_LOW16 + || r_type == R_SH_GOT_MEDLOW16 + || r_type == R_SH_GOT_MEDHI16 + || r_type == R_SH_GOT_HI16) && elf_hash_table (info)->dynamic_sections_created && (! info->shared || (! info->symbolic && h->dynindx != -1) @@ -3204,9 +4293,14 @@ sh_elf_relocate_section (output_bfd, inf relocation = 0; } else - relocation = (h->root.u.def.value + relocation = ((h->root.u.def.value + sec->output_section->vma - + sec->output_offset); + + sec->output_offset) + /* A STO_SH5_ISA32 causes a "bitor 1" to the + symbol value, unless we've seen + STT_DATALABEL on the way to it. */ + | ((h->other & STO_SH5_ISA32) != 0 + && ! seen_stt_datalabel)); } else if (h->root.type == bfd_link_hash_undefweak) relocation = 0; @@ -3277,6 +4371,11 @@ sh_elf_relocate_section (output_bfd, inf break; default: +#ifdef INCLUDE_SHMEDIA + if (shmedia_prepare_reloc (info, input_bfd, input_section, + contents, rel, &relocation)) + goto final_link_relocate; +#endif bfd_set_error (bfd_error_bad_value); return false; @@ -3320,24 +4419,23 @@ sh_elf_relocate_section (output_bfd, inf } skip = false; + relocate = false; outrel.r_offset = _bfd_elf_section_offset (output_bfd, info, input_section, rel->r_offset); if (outrel.r_offset == (bfd_vma) -1) skip = true; + else if (outrel.r_offset == (bfd_vma) -2) + skip = true, relocate = true; outrel.r_offset += (input_section->output_section->vma + input_section->output_offset); if (skip) - { - memset (&outrel, 0, sizeof outrel); - relocate = false; - } + memset (&outrel, 0, sizeof outrel); else if (r_type == R_SH_REL32) { BFD_ASSERT (h != NULL && h->dynindx != -1); - relocate = false; outrel.r_info = ELF32_R_INFO (h->dynindx, R_SH_REL32); outrel.r_addend = bfd_get_32 (input_bfd, contents + rel->r_offset); @@ -3360,7 +4458,6 @@ sh_elf_relocate_section (output_bfd, inf else { BFD_ASSERT (h->dynindx != -1); - relocate = false; outrel.r_info = ELF32_R_INFO (h->dynindx, R_SH_DIR32); outrel.r_addend = relocation + bfd_get_32 (input_bfd, @@ -3383,7 +4480,56 @@ sh_elf_relocate_section (output_bfd, inf } goto final_link_relocate; + case R_SH_GOTPLT32: +#ifdef INCLUDE_SHMEDIA + case R_SH_GOTPLT_LOW16: + case R_SH_GOTPLT_MEDLOW16: + case R_SH_GOTPLT_MEDHI16: + case R_SH_GOTPLT_HI16: + case R_SH_GOTPLT10BY4: + case R_SH_GOTPLT10BY8: +#endif + /* Relocation is to the entry for this symbol in the + procedure linkage table. */ + + if (h == NULL + || ELF_ST_VISIBILITY (h->other) == STV_INTERNAL + || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN + || ! info->shared + || info->symbolic + || h->dynindx == -1 + || h->plt.offset == (bfd_vma) -1 + || h->got.offset != (bfd_vma) -1) + goto force_got; + + /* Relocation is to the entry for this symbol in the global + offset table extension for the procedure linkage table. */ + if (sgotplt == NULL) + { + sgotplt = bfd_get_section_by_name (dynobj, ".got.plt"); + BFD_ASSERT (sgotplt != NULL); + } + + relocation = (sgotplt->output_offset + + ((h->plt.offset / elf_sh_sizeof_plt (info) + - 1 + 3) * 4)); + +#ifdef GOT_BIAS + relocation -= GOT_BIAS; +#endif + + goto final_link_relocate; + + force_got: case R_SH_GOT32: +#ifdef INCLUDE_SHMEDIA + case R_SH_GOT_LOW16: + case R_SH_GOT_MEDLOW16: + case R_SH_GOT_MEDHI16: + case R_SH_GOT_HI16: + case R_SH_GOT10BY4: + case R_SH_GOT10BY8: +#endif /* Relocation is to the entry for this symbol in the global offset table. */ if (sgot == NULL) @@ -3397,6 +4543,15 @@ sh_elf_relocate_section (output_bfd, inf bfd_vma off; off = h->got.offset; +#ifdef INCLUDE_SHMEDIA + if (seen_stt_datalabel) + { + struct elf_sh_link_hash_entry *hsh; + + hsh = (struct elf_sh_link_hash_entry *)h; + off = hsh->datalabel_got_offset; + } +#endif BFD_ASSERT (off != (bfd_vma) -1); if (! elf_hash_table (info)->dynamic_sections_created @@ -3424,7 +4579,17 @@ sh_elf_relocate_section (output_bfd, inf { bfd_put_32 (output_bfd, relocation, sgot->contents + off); - h->got.offset |= 1; +#ifdef INCLUDE_SHMEDIA + if (seen_stt_datalabel) + { + struct elf_sh_link_hash_entry *hsh; + + hsh = (struct elf_sh_link_hash_entry *)h; + hsh->datalabel_got_offset |= 1; + } + else +#endif + h->got.offset |= 1; } } @@ -3434,10 +4599,27 @@ sh_elf_relocate_section (output_bfd, inf { bfd_vma off; +#ifdef INCLUDE_SHMEDIA + if (rel->r_addend) + { + BFD_ASSERT (local_got_offsets != NULL + && (local_got_offsets[symtab_hdr->sh_info + + r_symndx] + != (bfd_vma) -1)); + + off = local_got_offsets[symtab_hdr->sh_info + + r_symndx]; + } + else + { +#endif BFD_ASSERT (local_got_offsets != NULL && local_got_offsets[r_symndx] != (bfd_vma) -1); off = local_got_offsets[r_symndx]; +#ifdef INCLUDE_SHMEDIA + } +#endif /* The offset must always be a multiple of 4. We use the least significant bit to record whether we have @@ -3468,15 +4650,30 @@ sh_elf_relocate_section (output_bfd, inf ++srelgot->reloc_count; } - local_got_offsets[r_symndx] |= 1; +#ifdef INCLUDE_SHMEDIA + if (rel->r_addend) + local_got_offsets[symtab_hdr->sh_info + r_symndx] |= 1; + else +#endif + local_got_offsets[r_symndx] |= 1; } relocation = sgot->output_offset + off; } +#ifdef GOT_BIAS + relocation -= GOT_BIAS; +#endif + goto final_link_relocate; case R_SH_GOTOFF: +#ifdef INCLUDE_SHMEDIA + case R_SH_GOTOFF_LOW16: + case R_SH_GOTOFF_MEDLOW16: + case R_SH_GOTOFF_MEDHI16: + case R_SH_GOTOFF_HI16: +#endif /* Relocation is relative to the start of the global offset table. */ @@ -3493,9 +4690,21 @@ sh_elf_relocate_section (output_bfd, inf calculation. */ relocation -= sgot->output_section->vma; +#ifdef GOT_BIAS + relocation -= GOT_BIAS; +#endif + + addend = rel->r_addend; + goto final_link_relocate; case R_SH_GOTPC: +#ifdef INCLUDE_SHMEDIA + case R_SH_GOTPC_LOW16: + case R_SH_GOTPC_MEDLOW16: + case R_SH_GOTPC_MEDHI16: + case R_SH_GOTPC_HI16: +#endif /* Use global offset table as symbol value. */ if (sgot == NULL) @@ -3506,9 +4715,21 @@ sh_elf_relocate_section (output_bfd, inf relocation = sgot->output_section->vma; +#ifdef GOT_BIAS + relocation += GOT_BIAS; +#endif + + addend = rel->r_addend; + goto final_link_relocate; case R_SH_PLT32: +#ifdef INCLUDE_SHMEDIA + case R_SH_PLT_LOW16: + case R_SH_PLT_MEDLOW16: + case R_SH_PLT_MEDHI16: + case R_SH_PLT_HI16: +#endif /* Relocation is to the entry for this symbol in the procedure linkage table. */ @@ -3539,6 +4760,12 @@ sh_elf_relocate_section (output_bfd, inf + splt->output_offset + h->plt.offset); +#ifdef INCLUDE_SHMEDIA + relocation++; +#endif + + addend = rel->r_addend; + goto final_link_relocate; case R_SH_LOOP_START: @@ -3851,9 +5078,32 @@ sh_elf_check_relocs (abfd, info, sec, re { switch (ELF32_R_TYPE (rel->r_info)) { + case R_SH_GOTPLT32: case R_SH_GOT32: case R_SH_GOTOFF: case R_SH_GOTPC: +#ifdef INCLUDE_SHMEDIA + case R_SH_GOTPLT_LOW16: + case R_SH_GOTPLT_MEDLOW16: + case R_SH_GOTPLT_MEDHI16: + case R_SH_GOTPLT_HI16: + case R_SH_GOTPLT10BY4: + case R_SH_GOTPLT10BY8: + case R_SH_GOT_LOW16: + case R_SH_GOT_MEDLOW16: + case R_SH_GOT_MEDHI16: + case R_SH_GOT_HI16: + case R_SH_GOT10BY4: + case R_SH_GOT10BY8: + case R_SH_GOTOFF_LOW16: + case R_SH_GOTOFF_MEDLOW16: + case R_SH_GOTOFF_MEDHI16: + case R_SH_GOTOFF_HI16: + case R_SH_GOTPC_LOW16: + case R_SH_GOTPC_MEDLOW16: + case R_SH_GOTPC_MEDHI16: + case R_SH_GOTPC_HI16: +#endif elf_hash_table (info)->dynobj = dynobj = abfd; if (! _bfd_elf_create_got_section (dynobj, info)) return false; @@ -3880,7 +5130,16 @@ sh_elf_check_relocs (abfd, info, sec, re return false; break; + force_got: case R_SH_GOT32: +#ifdef INCLUDE_SHMEDIA + case R_SH_GOT_LOW16: + case R_SH_GOT_MEDLOW16: + case R_SH_GOT_MEDHI16: + case R_SH_GOT_HI16: + case R_SH_GOT10BY4: + case R_SH_GOT10BY8: +#endif /* This symbol requires a global offset table entry. */ if (sgot == NULL) @@ -3911,12 +5170,30 @@ sh_elf_check_relocs (abfd, info, sec, re if (h != NULL) { +#ifdef INCLUDE_SHMEDIA + if (h->type == STT_DATALABEL) + { + struct elf_sh_link_hash_entry *hsh; + + h = (struct elf_link_hash_entry *) h->root.u.i.link; + hsh = (struct elf_sh_link_hash_entry *)h; + if (hsh->datalabel_got_offset != (bfd_vma) -1) + break; + + hsh->datalabel_got_offset = sgot->_raw_size; + } + else + { +#endif if (h->got.offset != (bfd_vma) -1) { /* We have already allocated space in the .got. */ break; } h->got.offset = sgot->_raw_size; +#ifdef INCLUDE_SHMEDIA + } +#endif /* Make sure this symbol is output as a dynamic symbol. */ if (h->dynindx == -1) @@ -3938,19 +5215,46 @@ sh_elf_check_relocs (abfd, info, sec, re size = symtab_hdr->sh_info; size *= sizeof (bfd_vma); +#ifdef INCLUDE_SHMEDIA + /* Reserve space for both the datalabel and + codelabel local GOT offsets. */ + size *= 2; +#endif local_got_offsets = (bfd_vma *) bfd_alloc (abfd, size); if (local_got_offsets == 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; +#ifdef INCLUDE_SHMEDIA + for (; i < 2 * symtab_hdr->sh_info; i++) + local_got_offsets[i] = (bfd_vma) -1; +#endif } +#ifdef INCLUDE_SHMEDIA + if ((rel->r_addend & 1) != 0) + { + if (local_got_offsets[symtab_hdr->sh_info + + r_symndx] != (bfd_vma) -1) + { + /* We have already allocated space in the .got. */ + break; + } + local_got_offsets[symtab_hdr->sh_info + + r_symndx] = sgot->_raw_size; + } + else + { +#endif 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; +#ifdef INCLUDE_SHMEDIA + } +#endif if (info->shared) { @@ -3965,7 +5269,45 @@ sh_elf_check_relocs (abfd, info, sec, re break; + case R_SH_GOTPLT32: +#ifdef INCLUDE_SHMEDIA + case R_SH_GOTPLT_LOW16: + case R_SH_GOTPLT_MEDLOW16: + case R_SH_GOTPLT_MEDHI16: + case R_SH_GOTPLT_HI16: + case R_SH_GOTPLT10BY4: + case R_SH_GOTPLT10BY8: +#endif + /* If this is a local symbol, we resolve it directly without + creating a procedure linkage table entry. */ + + if (h == NULL + || ELF_ST_VISIBILITY (h->other) == STV_INTERNAL + || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN + || ! info->shared + || info->symbolic + || h->dynindx == -1 + || h->got.offset != (bfd_vma) -1) + goto force_got; + + /* 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; + } + + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + + break; + case R_SH_PLT32: +#ifdef INCLUDE_SHMEDIA + case R_SH_PLT_LOW16: + case R_SH_PLT_MEDLOW16: + case R_SH_PLT_MEDHI16: + case R_SH_PLT_HI16: +#endif /* 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 @@ -4093,6 +5435,7 @@ sh_elf_check_relocs (abfd, info, sec, re return true; } +#ifndef sh_elf_set_mach_from_flags static boolean sh_elf_set_mach_from_flags (abfd) bfd *abfd; @@ -4128,7 +5471,9 @@ sh_elf_set_mach_from_flags (abfd) } return true; } +#endif /* not sh_elf_set_mach_from_flags */ +#ifndef sh_elf_set_private_flags /* Function to keep SH specific file flags. */ static boolean @@ -4143,7 +5488,9 @@ sh_elf_set_private_flags (abfd, flags) elf_flags_init (abfd) = true; return sh_elf_set_mach_from_flags (abfd); } +#endif /* not sh_elf_set_private_flags */ +#ifndef sh_elf_copy_private_data /* Copy backend specific data from one object module to another */ static boolean @@ -4157,7 +5504,9 @@ sh_elf_copy_private_data (ibfd, obfd) return sh_elf_set_private_flags (obfd, elf_elfheader (ibfd)->e_flags); } +#endif /* not sh_elf_copy_private_data */ +#ifndef sh_elf_merge_private_data /* This routine checks for linking big and little endian objects together, and for linking sh-dsp with sh3e / sh4 objects. */ @@ -4198,6 +5547,7 @@ sh_elf_merge_private_data (ibfd, obfd) return sh_elf_set_mach_from_flags (obfd); } +#endif /* not sh_elf_merge_private_data */ /* Finish up dynamic symbol handling. We set the contents of various dynamic sections here. */ @@ -4244,6 +5594,10 @@ sh_elf_finish_dynamic_symbol (output_bfd The first three are reserved. */ got_offset = (plt_index + 3) * 4; +#ifdef GOT_BIAS + got_offset -= GOT_BIAS; +#endif + /* Fill in the entry in the procedure linkage table. */ if (! info->shared) { @@ -4254,6 +5608,19 @@ sh_elf_finish_dynamic_symbol (output_bfd } memcpy (splt->contents + h->plt.offset, elf_sh_plt_entry, elf_sh_sizeof_plt (info)); +#ifdef INCLUDE_SHMEDIA + movi_shori_putval (output_bfd, + (sgot->output_section->vma + + sgot->output_offset + + got_offset), + (splt->contents + h->plt.offset + + elf_sh_plt_symbol_offset (info))); + + movi_shori_putval (output_bfd, + (splt->output_section->vma + splt->output_offset), + (splt->contents + h->plt.offset + + elf_sh_plt_plt0_offset (info))); +#else bfd_put_32 (output_bfd, (sgot->output_section->vma + sgot->output_offset @@ -4265,6 +5632,7 @@ sh_elf_finish_dynamic_symbol (output_bfd (splt->output_section->vma + splt->output_offset), (splt->contents + h->plt.offset + elf_sh_plt_plt0_offset (info))); +#endif } else { @@ -4276,14 +5644,31 @@ sh_elf_finish_dynamic_symbol (output_bfd } memcpy (splt->contents + h->plt.offset, elf_sh_pic_plt_entry, elf_sh_sizeof_plt (info)); +#ifdef INCLUDE_SHMEDIA + movi_shori_putval (output_bfd, got_offset, + (splt->contents + h->plt.offset + + elf_sh_plt_symbol_offset (info))); +#else bfd_put_32 (output_bfd, got_offset, (splt->contents + h->plt.offset + elf_sh_plt_symbol_offset (info))); +#endif } +#ifdef GOT_BIAS + got_offset += GOT_BIAS; +#endif + +#ifdef INCLUDE_SHMEDIA + movi_shori_putval (output_bfd, + plt_index * sizeof (Elf32_External_Rela), + (splt->contents + h->plt.offset + + elf_sh_plt_reloc_offset (info))); +#else bfd_put_32 (output_bfd, plt_index * sizeof (Elf32_External_Rela), (splt->contents + h->plt.offset + elf_sh_plt_reloc_offset (info))); +#endif /* Fill in the entry in the global offset table. */ bfd_put_32 (output_bfd, @@ -4299,6 +5684,9 @@ sh_elf_finish_dynamic_symbol (output_bfd + got_offset); rel.r_info = ELF32_R_INFO (h->dynindx, R_SH_JMP_SLOT); rel.r_addend = 0; +#ifdef GOT_BIAS + rel.r_addend = GOT_BIAS; +#endif bfd_elf32_swap_reloca_out (output_bfd, &rel, ((Elf32_External_Rela *) srel->contents + plt_index)); @@ -4498,12 +5886,20 @@ sh_elf_finish_dynamic_sections (output_b elf_sh_plt0_entry_le); } memcpy (splt->contents, elf_sh_plt0_entry, PLT_ENTRY_SIZE); +#ifdef INCLUDE_SHMEDIA + movi_shori_putval (output_bfd, + sgot->output_section->vma + + sgot->output_offset, + splt->contents + + elf_sh_plt0_gotplt_offset (info)); +#else bfd_put_32 (output_bfd, sgot->output_section->vma + sgot->output_offset + 4, splt->contents + elf_sh_plt0_gotid_offset (info)); bfd_put_32 (output_bfd, sgot->output_section->vma + sgot->output_offset + 8, splt->contents + elf_sh_plt0_linker_offset (info)); +#endif } /* UnixWare sets the entsize of .plt to 4, although that doesn't diff -uprN binutils-2.11.93.0.2/bfd/elf32-sh64.c binutils-2.12.90.0.1/bfd/elf32-sh64.c --- binutils-2.11.93.0.2/bfd/elf32-sh64.c Wed Dec 31 16:00:00 1969 +++ binutils-2.12.90.0.1/bfd/elf32-sh64.c Thu Mar 7 11:52:36 2002 @@ -0,0 +1,984 @@ +/* Hitachi SH64-specific support for 32-bit ELF + Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. + + 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 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. */ + +#define SH64_ELF + +#include "bfd.h" +#include "sysdep.h" +#include "elf-bfd.h" +#include "../opcodes/sh64-opc.h" + +/* Add a suffix for datalabel indirection symbols. It must not match any + other symbols; user symbols with or without version or other + decoration. It must only be used internally and not emitted by any + means. */ +#define DATALABEL_SUFFIX " DL" + +/* Used to hold data for function called through bfd_map_over_sections. */ +struct sh64_find_section_vma_data + { + asection *section; + bfd_vma addr; + }; + +static boolean sh64_elf_copy_private_data PARAMS ((bfd *, bfd *)); +static boolean sh64_elf_merge_private_data PARAMS ((bfd *, bfd *)); +static boolean sh64_elf_fake_sections PARAMS ((bfd *, Elf_Internal_Shdr *, + asection *)); +static boolean sh64_elf_set_private_flags PARAMS ((bfd *, flagword)); +static boolean sh64_elf_set_mach_from_flags PARAMS ((bfd *)); +static boolean shmedia_prepare_reloc + PARAMS ((struct bfd_link_info *, bfd *, asection *, + bfd_byte *, const Elf_Internal_Rela *, bfd_vma *)); +static int sh64_elf_get_symbol_type PARAMS ((Elf_Internal_Sym *, int)); +static boolean sh64_elf_add_symbol_hook + PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, + const char **, flagword *, asection **, bfd_vma *)); +static boolean sh64_elf_link_output_symbol_hook + PARAMS ((bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *, + asection *)); +static boolean sh64_backend_section_from_shdr + PARAMS ((bfd *, Elf_Internal_Shdr *, char *)); +static void sh64_elf_final_write_processing PARAMS ((bfd *, boolean)); +static boolean sh64_bfd_elf_copy_private_section_data + PARAMS ((bfd *, asection *, bfd *, asection *)); +static void sh64_find_section_for_address PARAMS ((bfd *, asection *, PTR)); + +/* Let elf32-sh.c handle the "bfd_" definitions, so we only have to + intrude with an #ifndef around the function definition. */ +#define sh_elf_copy_private_data sh64_elf_copy_private_data +#define sh_elf_merge_private_data sh64_elf_merge_private_data +#define sh_elf_set_private_flags sh64_elf_set_private_flags +/* Typo in elf32-sh.c (and unlinear name). */ +#define bfd_elf32_bfd_set_private_flags sh64_elf_set_private_flags +#define sh_elf_set_mach_from_flags sh64_elf_set_mach_from_flags + +#define elf_backend_sign_extend_vma 1 +#define elf_backend_fake_sections sh64_elf_fake_sections +#define elf_backend_get_symbol_type sh64_elf_get_symbol_type +#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_final_write_processing sh64_elf_final_write_processing +#define elf_backend_section_from_shdr sh64_backend_section_from_shdr + +/* For objcopy, we need to set up sh64_elf_section_data (asection *) from + incoming section flags. This is otherwise done in sh64elf.em when + linking or tc-sh64.c when assembling. */ +#define bfd_elf32_bfd_copy_private_section_data \ + sh64_bfd_elf_copy_private_section_data + +/* This COFF-only function (only compiled with COFF support, making + ELF-only chains problematic) returns true early for SH4, so let's just + define it true here. */ +#define _bfd_sh_align_load_span(a,b,c,d,e,f,g,h,i,j) true + +#ifndef ELF_ARCH +#define TARGET_BIG_SYM bfd_elf32_sh64_vec +#define TARGET_BIG_NAME "elf32-sh64" +#define TARGET_LITTLE_SYM bfd_elf32_sh64l_vec +#define TARGET_LITTLE_NAME "elf32-sh64l" +#define ELF_ARCH bfd_arch_sh +#define ELF_MACHINE_CODE EM_SH +#define ELF_MAXPAGESIZE 128 + +#define elf_symbol_leading_char '_' +#endif /* ELF_ARCH */ + +#define GOT_BIAS (-((long)-32768)) +#define INCLUDE_SHMEDIA +#include "elf32-sh.c" + +/* The type sh64_elf_crange is defined in elf/sh.h which is included in + elf32-sh.c, hence these prototypes located after including it. */ +static int crange_qsort_cmpb PARAMS ((const void *, const void *)); +static int crange_qsort_cmpl PARAMS ((const void *, const void *)); +static int crange_bsearch_cmpb PARAMS ((const void *, const void *)); +static int crange_bsearch_cmpl PARAMS ((const void *, const void *)); +static boolean sh64_address_in_cranges + PARAMS ((asection *cranges, bfd_vma, sh64_elf_crange *)); + +/* Set the SHF_SH5_ISA32 flag for ISA SHmedia code sections, and pass + through SHT_SH5_CR_SORTED on a sorted .cranges section. */ + +boolean +sh64_elf_fake_sections (output_bfd, elf_section_hdr, asect) + bfd *output_bfd ATTRIBUTE_UNUSED; + Elf_Internal_Shdr *elf_section_hdr; + asection *asect; +{ + if (sh64_elf_section_data (asect) != NULL) + elf_section_hdr->sh_flags + |= sh64_elf_section_data (asect)->contents_flags; + + /* If this section has the SEC_SORT_ENTRIES flag set, it is a sorted + .cranges section passing through objcopy. */ + if ((bfd_get_section_flags (output_bfd, asect) & SEC_SORT_ENTRIES) != 0 + && strcmp (bfd_get_section_name (output_bfd, asect), + SH64_CRANGES_SECTION_NAME) == 0) + elf_section_hdr->sh_type = SHT_SH5_CR_SORTED; + + return true; +} + +static boolean +sh64_elf_set_mach_from_flags (abfd) + bfd *abfd; +{ + flagword flags = elf_elfheader (abfd)->e_flags; + asection *cranges; + + switch (flags & EF_SH_MACH_MASK) + { + case EF_SH5: + /* These are fit to execute on SH5. Just one but keep the switch + construct to make additions easy. */ + bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh5); + break; + + default: + bfd_set_error (bfd_error_wrong_format); + return false; + } + + /* We also need to set SEC_DEBUGGING on an incoming .cranges section. + We could have used elf_backend_section_flags if it had given us the + section name; the bfd_section member in the header argument is not + set at the point of the call. FIXME: Find out whether that is by + undocumented design or a bug. */ + cranges = bfd_get_section_by_name (abfd, SH64_CRANGES_SECTION_NAME); + if (cranges != NULL + && ! bfd_set_section_flags (abfd, cranges, + bfd_get_section_flags (abfd, cranges) + | SEC_DEBUGGING)) + return false; + + return true; +} + +static boolean +sh64_elf_copy_private_data (ibfd, obfd) + bfd * ibfd; + bfd * obfd; +{ + if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return true; + + BFD_ASSERT (!elf_flags_init (obfd) + || (elf_elfheader (obfd)->e_flags + == elf_elfheader (ibfd)->e_flags)); + + elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags; + return true; +} + +static boolean +sh64_elf_merge_private_data (ibfd, obfd) + bfd *ibfd; + bfd *obfd; +{ + flagword old_flags, new_flags; + + if (_bfd_generic_verify_endian_match (ibfd, obfd) == false) + return false; + + if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return true; + + if (bfd_get_arch_size (ibfd) != bfd_get_arch_size (obfd)) + { + const char *msg; + + if (bfd_get_arch_size (ibfd) == 32 + && bfd_get_arch_size (obfd) == 64) + msg = _("%s: compiled as 32-bit object and %s is 64-bit"); + else if (bfd_get_arch_size (ibfd) == 64 + && bfd_get_arch_size (obfd) == 32) + msg = _("%s: compiled as 64-bit object and %s is 32-bit"); + else + msg = _("%s: object size does not match that of target %s"); + + (*_bfd_error_handler) (msg, bfd_get_filename (ibfd), + bfd_get_filename (obfd)); + bfd_set_error (bfd_error_wrong_format); + return false; + } + + old_flags = elf_elfheader (obfd)->e_flags; + new_flags = elf_elfheader (ibfd)->e_flags; + if (! elf_flags_init (obfd)) + { + /* This happens when ld starts out with a 'blank' output file. */ + elf_flags_init (obfd) = true; + elf_elfheader (obfd)->e_flags = old_flags = new_flags; + } + /* We don't allow linking in non-SH64 code. */ + else if ((new_flags & EF_SH_MACH_MASK) != EF_SH5) + { + (*_bfd_error_handler) + ("%s: uses non-SH64 instructions while previous modules use SH64 instructions", + bfd_get_filename (ibfd)); + bfd_set_error (bfd_error_bad_value); + return false; + } + + /* I can't think of anything sane other than old_flags being EF_SH5 and + that we need to preserve that. */ + elf_elfheader (obfd)->e_flags = old_flags; + return sh64_elf_set_mach_from_flags (obfd); +} + +/* Handle a SH64-specific section when reading an object file. This + is called when elfcode.h finds a section with an unknown type. + + We only recognize SHT_SH5_CR_SORTED, on the .cranges section. */ + +boolean +sh64_backend_section_from_shdr (abfd, hdr, name) + bfd *abfd; + Elf_Internal_Shdr *hdr; + char *name; +{ + flagword flags = 0; + + /* We do like MIPS with a bit switch for recognized types, and returning + false for a recognized section type with an unexpected name. Right + now we only have one recognized type, but that might change. */ + switch (hdr->sh_type) + { + case SHT_SH5_CR_SORTED: + if (strcmp (name, SH64_CRANGES_SECTION_NAME) != 0) + return false; + + /* We set the SEC_SORT_ENTRIES flag so it can be passed on to + sh64_elf_fake_sections, keeping SHT_SH5_CR_SORTED if this object + passes through objcopy. Perhaps it is brittle; the flag can + suddenly be used by other BFD parts, but it seems not really used + anywhere at the moment. */ + flags = SEC_DEBUGGING | SEC_SORT_ENTRIES; + break; + + default: + return false; + } + + if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name)) + return false; + + if (flags + && ! bfd_set_section_flags (abfd, hdr->bfd_section, + bfd_get_section_flags (abfd, + hdr->bfd_section) + | flags)) + return false; + + return true; +} + +/* In contrast to sh64_backend_section_from_shdr, this is called for all + sections, but only when copying sections, not when linking or + assembling. We need to set up the sh64_elf_section_data (asection *) + structure for the SH64 ELF section flags to be copied correctly. */ + +boolean +sh64_bfd_elf_copy_private_section_data (ibfd, isec, obfd, osec) + bfd *ibfd; + asection *isec; + bfd *obfd; + asection *osec; +{ + struct sh64_section_data *sh64_sec_data; + + if (ibfd->xvec->flavour != bfd_target_elf_flavour + || obfd->xvec->flavour != bfd_target_elf_flavour) + return true; + + if (! _bfd_elf_copy_private_section_data (ibfd, isec, obfd, osec)) + return false; + + sh64_sec_data = sh64_elf_section_data (isec); + if (sh64_sec_data == NULL) + { + sh64_sec_data = bfd_zmalloc (sizeof (struct sh64_section_data)); + + if (sh64_sec_data == NULL) + return false; + + sh64_sec_data->contents_flags + = (elf_section_data (isec)->this_hdr.sh_flags + & (SHF_SH5_ISA32 | SHF_SH5_ISA32_MIXED)); + + sh64_elf_section_data (osec) = sh64_sec_data; + } + + return true; +} + +/* Function to keep SH64 specific file flags. */ + +static boolean +sh64_elf_set_private_flags (abfd, flags) + bfd * abfd; + flagword flags; +{ + BFD_ASSERT (! elf_flags_init (abfd) + || elf_elfheader (abfd)->e_flags == flags); + + elf_elfheader (abfd)->e_flags = flags; + elf_flags_init (abfd) = true; + return sh64_elf_set_mach_from_flags (abfd); +} + +/* Called when writing out an object file to decide the type of a symbol. */ + +static int +sh64_elf_get_symbol_type (elf_sym, type) + Elf_Internal_Sym * elf_sym; + int type; +{ + if (ELF_ST_TYPE (elf_sym->st_info) == STT_DATALABEL) + return STT_DATALABEL; + + return type; +} + +/* Hook called by the linker routine which adds symbols from an object + file. We must make indirect symbols for undefined symbols marked with + STT_DATALABEL, so relocations passing them will pick up that attribute + and neutralize STO_SH5_ISA32 found on the symbol definition. + + There is a problem, though: We want to fill in the hash-table entry for + this symbol and signal to the caller that no further processing is + needed. But we don't have the index for this hash-table entry. We + rely here on that the current entry is the first hash-entry with NULL, + which seems brittle. Also, iterating over the hash-table to find that + entry is a linear operation on the number of symbols in this input + file, and this function should take constant time, so that's not good + too. Only comfort is that DataLabel references should only be found in + hand-written assembly code and thus be rare. FIXME: Talk maintainers + into adding an option to elf_add_symbol_hook (preferably) for the index + or the hash entry, alternatively adding the index to Elf_Internal_Sym + (not so good). */ + +static boolean +sh64_elf_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; + flagword *flagsp ATTRIBUTE_UNUSED; + asection **secp; + bfd_vma *valp; +{ + /* We want to do this for relocatable as well as final linking. */ + if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL) + { + struct elf_link_hash_entry *h; + + /* For relocateable links, we register the DataLabel sym in its own + right, and tweak the name when it's output. Otherwise, we make + an indirect symbol of it. */ + flagword flags + = info->relocateable || info->emitrelocations + ? BSF_GLOBAL : BSF_GLOBAL | BSF_INDIRECT; + + char *dl_name + = bfd_malloc (strlen (*namep) + sizeof (DATALABEL_SUFFIX)); + struct elf_link_hash_entry ** sym_hash = elf_sym_hashes (abfd); + + BFD_ASSERT (sym_hash != NULL); + + /* Allocation may fail. */ + if (dl_name == NULL) + return false; + + strcpy (dl_name, *namep); + strcat (dl_name, DATALABEL_SUFFIX); + + h = (struct elf_link_hash_entry *) + bfd_link_hash_lookup (info->hash, dl_name, false, false, false); + + if (h == NULL) + { + /* No previous datalabel symbol. Make one. */ + if (! _bfd_generic_link_add_one_symbol (info, abfd, dl_name, + flags, *secp, *valp, + *namep, false, + get_elf_backend_data (abfd)->collect, + (struct bfd_link_hash_entry **) &h)) + { + free (dl_name); + return false; + } + + h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF; + h->type = STT_DATALABEL; + } + else + /* If a new symbol was created, it holds the allocated name. + Otherwise, we don't need it anymore and should deallocate it. */ + free (dl_name); + + if (h->type != STT_DATALABEL + || ((info->relocateable || info->emitrelocations) + && h->root.type != bfd_link_hash_undefined) + || (! info->relocateable && !info->emitrelocations + && h->root.type != bfd_link_hash_indirect)) + { + /* Make sure we don't get confused on invalid input. */ + (*_bfd_error_handler) + (_("%s: encountered datalabel symbol in input"), + bfd_get_filename (abfd)); + bfd_set_error (bfd_error_bad_value); + return false; + } + + /* Now find the hash-table slot for this entry and fill it in. */ + while (*sym_hash != NULL) + sym_hash++; + *sym_hash = h; + + /* Signal to caller to skip this symbol - we've handled it. */ + *namep = NULL; + } + + return true; +} + +/* This hook function is called before the linker writes out a global + symbol. For relocatable links, DataLabel symbols will be present in + linker output. We cut off the special suffix on those symbols, so the + right name appears in the output. + + When linking and emitting relocations, there can appear global symbols + that are not referenced by relocs, but rather only implicitly through + DataLabel references, a relation that is not visible to the linker. + Since no stripping of global symbols in done when doing such linking, + we don't need to look up and make sure to emit the main symbol for each + DataLabel symbol. */ + +boolean +sh64_elf_link_output_symbol_hook (abfd, info, cname, sym, input_sec) + bfd *abfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info; + const char *cname; + Elf_Internal_Sym *sym; + asection *input_sec ATTRIBUTE_UNUSED; +{ + char *name = (char *) cname; + + if (info->relocateable || info->emitrelocations) + { + if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL) + name[strlen (name) - strlen (DATALABEL_SUFFIX)] = 0; + } + + return true; +} + +/* Check a SH64-specific reloc and put the value to relocate to into + RELOCATION, ready to pass to _bfd_final_link_relocate. Return FALSE if + bad value, TRUE if ok. */ + +static boolean +shmedia_prepare_reloc (info, abfd, input_section, + contents, rel, relocation) + struct bfd_link_info *info; + bfd *abfd; + asection *input_section; + bfd_byte *contents; + const Elf_Internal_Rela *rel; + bfd_vma *relocation; +{ + bfd_vma disp, dropped; + + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_SH_PT_16: + /* Check the lowest bit of the destination field. If it is 1, we + check the ISA type of the destination (i.e. the low bit of the + "relocation" value, and emit an error if the instruction does not + match). If it is 0, we change a PTA to PTB. There should never + be a PTB that should change to a PTA; that indicates a toolchain + error; a mismatch with GAS. */ + { + char *msg = NULL; + bfd_vma insn = bfd_get_32 (abfd, contents + rel->r_offset); + + if (insn & (1 << 10)) + { + /* Check matching insn and ISA (address of target). */ + if ((insn & SHMEDIA_PTB_BIT) != 0 + && ((*relocation + rel->r_addend) & 1) != 0) + msg = _("PTB mismatch: a SHmedia address (bit 0 == 1)"); + else if ((insn & SHMEDIA_PTB_BIT) == 0 + && ((*relocation + rel->r_addend) & 1) == 0) + msg = _("PTA mismatch: a SHcompact address (bit 0 == 0)"); + + if (msg != NULL + && ! ((*info->callbacks->reloc_dangerous) + (info, msg, abfd, input_section, + rel->r_offset))) + return false; + } + else + { + /* We shouldn't get here with a PTB insn and a R_SH_PT_16. It + means GAS output does not match expectations; a PTA or PTB + expressed as such (or a PT found at assembly to be PTB) + would match the test above, and PT expansion with an + unknown destination (or when relaxing) will get us here. */ + if ((insn & SHMEDIA_PTB_BIT) != 0) + { + (*_bfd_error_handler) + (_("%s: GAS error: unexpected PTB insn with R_SH_PT_16"), + bfd_get_filename (input_section->owner)); + return false; + } + + /* Change the PTA to a PTB, if destination indicates so. */ + if (((*relocation + rel->r_addend) & 1) == 0) + bfd_put_32 (abfd, insn | SHMEDIA_PTB_BIT, + contents + rel->r_offset); + } + } + + case R_SH_SHMEDIA_CODE: + case R_SH_DIR5U: + case R_SH_DIR6S: + case R_SH_DIR6U: + case R_SH_DIR10S: + case R_SH_DIR10SW: + case R_SH_DIR10SL: + case R_SH_DIR10SQ: + case R_SH_IMMS16: + case R_SH_IMMU16: + case R_SH_IMM_LOW16: + case R_SH_IMM_LOW16_PCREL: + case R_SH_IMM_MEDLOW16: + case R_SH_IMM_MEDLOW16_PCREL: + case R_SH_IMM_MEDHI16: + case R_SH_IMM_MEDHI16_PCREL: + case R_SH_IMM_HI16: + case R_SH_IMM_HI16_PCREL: + case R_SH_64: + case R_SH_64_PCREL: + break; + + default: + return false; + } + + disp = (*relocation & 0xf); + dropped = 0; + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_SH_DIR10SW: dropped = disp & 1; break; + case R_SH_DIR10SL: dropped = disp & 3; break; + case R_SH_DIR10SQ: dropped = disp & 7; break; + } + if (dropped != 0) + { + (*_bfd_error_handler) + (_("%s: error: unaligned relocation type %d at %08x reloc %08x\n"), + bfd_get_filename (input_section->owner), ELF32_R_TYPE (rel->r_info), + (unsigned)rel->r_offset, (unsigned)relocation); + return false; + } + + return true; +} + +/* Helper function to locate the section holding a certain address. This + is called via bfd_map_over_sections. */ + +static void +sh64_find_section_for_address (abfd, section, data) + bfd *abfd ATTRIBUTE_UNUSED; + asection *section; + PTR data; +{ + bfd_vma vma; + bfd_size_type size; + struct sh64_find_section_vma_data *fsec_datap + = (struct sh64_find_section_vma_data *) data; + + /* Return if already found. */ + if (fsec_datap->section) + return; + + /* If this section isn't part of the addressable contents, skip it. */ + if ((bfd_get_section_flags (abfd, section) & SEC_ALLOC) == 0) + return; + + vma = bfd_get_section_vma (abfd, section); + if (fsec_datap->addr < vma) + return; + + /* FIXME: section->reloc_done isn't set properly; a generic buglet + preventing us from using bfd_get_section_size_after_reloc. */ + size + = section->_cooked_size ? section->_cooked_size : section->_raw_size; + + if (fsec_datap->addr >= vma + size) + return; + + fsec_datap->section = section; +} + +/* Make sure to write out the generated entries in the .cranges section + when doing partial linking, and set bit 0 on the entry address if it + points to SHmedia code and write sorted .cranges entries when writing + executables (final linking and objcopy). */ + +static void +sh64_elf_final_write_processing (abfd, linker) + bfd * abfd; + boolean linker ATTRIBUTE_UNUSED; +{ + bfd_vma ld_generated_cranges_size; + asection *cranges + = bfd_get_section_by_name (abfd, SH64_CRANGES_SECTION_NAME); + + /* If no new .cranges were added, the generic ELF linker parts will + write it all out. If not, we need to write them out when doing + partial linking. For a final link, we will sort them and write them + all out further below. */ + if (linker + && cranges != NULL + && elf_elfheader (abfd)->e_type != ET_EXEC + && (ld_generated_cranges_size + = sh64_elf_section_data (cranges)->cranges_growth) != 0) + { + bfd_vma incoming_cranges_size + = ((cranges->_cooked_size != 0 + ? cranges->_cooked_size : cranges->_raw_size) + - ld_generated_cranges_size); + + if (! bfd_set_section_contents (abfd, cranges, + cranges->contents + + incoming_cranges_size, + cranges->output_offset + + incoming_cranges_size, + ld_generated_cranges_size)) + { + bfd_set_error (bfd_error_file_truncated); + (*_bfd_error_handler) + (_("%s: could not write out added .cranges entries"), + bfd_get_filename (abfd)); + } + } + + /* Only set entry address bit 0 and sort .cranges when linking to an + executable; never with objcopy or strip. */ + if (linker && elf_elfheader (abfd)->e_type == ET_EXEC) + { + struct sh64_find_section_vma_data fsec_data; + sh64_elf_crange dummy; + + /* For a final link, set the low bit of the entry address to + reflect whether or not it is a SHmedia address. + FIXME: Perhaps we shouldn't do this if the entry address was + supplied numerically, but we currently lack the infrastructure to + recognize that: The entry symbol, and info whether it is numeric + or a symbol name is kept private in the linker. */ + fsec_data.addr = elf_elfheader (abfd)->e_entry; + fsec_data.section = NULL; + + bfd_map_over_sections (abfd, sh64_find_section_for_address, + (PTR) &fsec_data); + if (fsec_data.section + && (sh64_get_contents_type (fsec_data.section, + elf_elfheader (abfd)->e_entry, + &dummy) == CRT_SH5_ISA32)) + elf_elfheader (abfd)->e_entry |= 1; + + /* If we have a .cranges section, sort the entries. */ + if (cranges != NULL) + { + bfd_size_type cranges_size + = (cranges->_cooked_size != 0 + ? cranges->_cooked_size : cranges->_raw_size); + + /* We know we always have these in memory at this time. */ + BFD_ASSERT (cranges->contents != NULL); + + /* The .cranges may already have been sorted in the process of + finding out the ISA-type of the entry address. If not, we do + it here. */ + if (elf_section_data (cranges)->this_hdr.sh_type + != SHT_SH5_CR_SORTED) + { + qsort (cranges->contents, cranges_size / SH64_CRANGE_SIZE, + SH64_CRANGE_SIZE, + bfd_big_endian (cranges->owner) + ? crange_qsort_cmpb : crange_qsort_cmpl); + elf_section_data (cranges)->this_hdr.sh_type + = SHT_SH5_CR_SORTED; + } + + /* We need to write it out in whole as sorted. */ + if (! bfd_set_section_contents (abfd, cranges, + cranges->contents, + cranges->output_offset, + cranges_size)) + { + bfd_set_error (bfd_error_file_truncated); + (*_bfd_error_handler) + (_("%s: could not write out sorted .cranges entries"), + bfd_get_filename (abfd)); + } + } + } +} + +/* Ordering functions of a crange, for the qsort and bsearch calls and for + different endianness. */ + +static int +crange_qsort_cmpb (p1, p2) + const PTR p1; + const PTR p2; +{ + bfd_vma a1 = bfd_getb32 (p1); + bfd_vma a2 = bfd_getb32 (p2); + + /* Preserve order if there's ambiguous contents. */ + if (a1 == a2) + return (char *) p1 - (char *) p2; + + return a1 - a2; +} + +static int +crange_qsort_cmpl (p1, p2) + const PTR p1; + const PTR p2; +{ + bfd_vma a1 = (bfd_vma) bfd_getl32 (p1); + bfd_vma a2 = (bfd_vma) bfd_getl32 (p2); + + /* Preserve order if there's ambiguous contents. */ + if (a1 == a2) + return (char *) p1 - (char *) p2; + + return a1 - a2; +} + +static int +crange_bsearch_cmpb (p1, p2) + const PTR p1; + const PTR p2; +{ + bfd_vma a1 = *(bfd_vma *) p1; + bfd_vma a2 = (bfd_vma) bfd_getb32 (p2); + bfd_size_type size + = (bfd_size_type) bfd_getb32 (SH64_CRANGE_CR_SIZE_OFFSET + (char *) p2); + + if (a1 >= a2 + size) + return 1; + if (a1 < a2) + return -1; + return 0; +} + +static int +crange_bsearch_cmpl (p1, p2) + const PTR p1; + const PTR p2; +{ + bfd_vma a1 = *(bfd_vma *) p1; + bfd_vma a2 = (bfd_vma) bfd_getl32 (p2); + bfd_size_type size + = (bfd_size_type) bfd_getl32 (SH64_CRANGE_CR_SIZE_OFFSET + (char *) p2); + + if (a1 >= a2 + size) + return 1; + if (a1 < a2) + return -1; + return 0; +} + +/* Check whether a specific address is specified within a .cranges + section. Return FALSE if not found, and TRUE if found, and the region + filled into RANGEP if non-NULL. */ + +static boolean +sh64_address_in_cranges (cranges, addr, rangep) + asection *cranges; + bfd_vma addr; + sh64_elf_crange *rangep; +{ + bfd_byte *cranges_contents; + bfd_byte *found_rangep; + bfd_size_type cranges_size = bfd_section_size (cranges->owner, cranges); + + /* If the size is not a multiple of the cranges entry size, then + something is badly wrong. */ + if ((cranges_size % SH64_CRANGE_SIZE) != 0) + return false; + + /* If this section has relocations, then we can't do anything sane. */ + if (bfd_get_section_flags (cranges->owner, cranges) & SEC_RELOC) + return false; + + /* Has some kind soul (or previous call) left processed, sorted contents + for us? */ + if ((bfd_get_section_flags (cranges->owner, cranges) & SEC_IN_MEMORY) + && elf_section_data (cranges)->this_hdr.sh_type == SHT_SH5_CR_SORTED) + cranges_contents = cranges->contents; + else + { + cranges_contents + = bfd_malloc (cranges->_cooked_size == 0 + ? cranges->_cooked_size : cranges->_raw_size); + if (cranges_contents == NULL) + return false; + + if (! bfd_get_section_contents (cranges->owner, cranges, + cranges_contents, (file_ptr) 0, + cranges_size)) + goto error_return; + + /* Is it sorted? */ + if (elf_section_data (cranges)->this_hdr.sh_type + != SHT_SH5_CR_SORTED) + /* Nope. Lets sort it. */ + qsort (cranges_contents, cranges_size / SH64_CRANGE_SIZE, + SH64_CRANGE_SIZE, + bfd_big_endian (cranges->owner) + ? crange_qsort_cmpb : crange_qsort_cmpl); + + /* Let's keep it around. */ + cranges->contents = cranges_contents; + bfd_set_section_flags (cranges->owner, cranges, + bfd_get_section_flags (cranges->owner, cranges) + | SEC_IN_MEMORY); + + /* It's sorted now. */ + elf_section_data (cranges)->this_hdr.sh_type = SHT_SH5_CR_SORTED; + } + + /* Try and find a matching range. */ + found_rangep + = bsearch (&addr, cranges_contents, cranges_size / SH64_CRANGE_SIZE, + SH64_CRANGE_SIZE, + bfd_big_endian (cranges->owner) + ? crange_bsearch_cmpb : crange_bsearch_cmpl); + + /* Fill in a few return values if we found a matching range. */ + if (found_rangep) + { + enum sh64_elf_cr_type cr_type + = bfd_get_16 (cranges->owner, + SH64_CRANGE_CR_TYPE_OFFSET + found_rangep); + bfd_vma cr_addr + = bfd_get_32 (cranges->owner, + SH64_CRANGE_CR_ADDR_OFFSET + + (char *) found_rangep); + bfd_size_type cr_size + = bfd_get_32 (cranges->owner, + SH64_CRANGE_CR_SIZE_OFFSET + + (char *) found_rangep); + + rangep->cr_addr = cr_addr; + rangep->cr_size = cr_size; + rangep->cr_type = cr_type; + + return true; + } + + /* There is a .cranges section, but it does not have a descriptor + matching this address. */ + return false; + +error_return: + free (cranges_contents); + return false; +} + +/* Determine what ADDR points to in SEC, and fill in a range descriptor in + *RANGEP if it's non-NULL. */ + +enum sh64_elf_cr_type +sh64_get_contents_type (sec, addr, rangep) + asection *sec; + bfd_vma addr; + sh64_elf_crange *rangep; +{ + asection *cranges; + + /* Fill in the range with the boundaries of the section as a default. */ + if (bfd_get_flavour (sec->owner) == bfd_target_elf_flavour + && elf_elfheader (sec->owner)->e_type == ET_EXEC) + { + rangep->cr_addr = bfd_get_section_vma (sec->owner, sec); + rangep->cr_size = bfd_section_size (sec->owner, sec); + rangep->cr_type = CRT_NONE; + } + else + return false; + + /* If none of the pertinent bits are set, then it's a SHcompact (or at + least not SHmedia). */ + if ((elf_section_data (sec)->this_hdr.sh_flags + & (SHF_SH5_ISA32 | SHF_SH5_ISA32_MIXED)) == 0) + { + enum sh64_elf_cr_type cr_type + = ((bfd_get_section_flags (sec->owner, sec) & SEC_CODE) != 0 + ? CRT_SH5_ISA16 : CRT_DATA); + rangep->cr_type = cr_type; + return cr_type; + } + + /* If only the SHF_SH5_ISA32 bit is set, then we have SHmedia. */ + if ((elf_section_data (sec)->this_hdr.sh_flags + & (SHF_SH5_ISA32 | SHF_SH5_ISA32_MIXED)) == SHF_SH5_ISA32) + { + rangep->cr_type = CRT_SH5_ISA32; + return CRT_SH5_ISA32; + } + + /* Otherwise, we have to look up the .cranges section. */ + cranges = bfd_get_section_by_name (sec->owner, SH64_CRANGES_SECTION_NAME); + + if (cranges == NULL) + /* A mixed section but there's no .cranges section. This is probably + bad input; it does not comply to specs. */ + return CRT_NONE; + + /* If this call fails, we will still have CRT_NONE in rangep->cr_type + and that will be suitable to return. */ + sh64_address_in_cranges (cranges, addr, rangep); + + return rangep->cr_type; +} + +/* This is a simpler exported interface for the benefit of gdb et al. */ + +boolean +sh64_address_is_shmedia (sec, addr) + asection *sec; + bfd_vma addr; +{ + sh64_elf_crange dummy; + return sh64_get_contents_type (sec, addr, &dummy) == CRT_SH5_ISA32; +} diff -uprN binutils-2.11.93.0.2/bfd/elf32-sparc.c binutils-2.12.90.0.1/bfd/elf32-sparc.c --- binutils-2.11.93.0.2/bfd/elf32-sparc.c Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/elf32-sparc.c Thu Mar 7 11:52:36 2002 @@ -1438,7 +1438,7 @@ elf32_sparc_relocate_section (output_bfd && (input_section->flags & SEC_ALLOC)) { Elf_Internal_Rela outrel; - boolean skip; + boolean skip, relocate = false; /* When generating a shared object, these relocations are copied into the output file to be resolved at run @@ -1471,6 +1471,8 @@ elf32_sparc_relocate_section (output_bfd rel->r_offset); if (outrel.r_offset == (bfd_vma) -1) skip = true; + else if (outrel.r_offset == (bfd_vma) -2) + skip = true, relocate = true; outrel.r_offset += (input_section->output_section->vma + input_section->output_offset); @@ -1571,7 +1573,8 @@ elf32_sparc_relocate_section (output_bfd /* This reloc will be computed at runtime, so there's no need to do anything now. */ - continue; + if (! relocate) + continue; } break; diff -uprN binutils-2.11.93.0.2/bfd/elf64-alpha.c binutils-2.12.90.0.1/bfd/elf64-alpha.c --- binutils-2.11.93.0.2/bfd/elf64-alpha.c Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/elf64-alpha.c Thu Mar 7 11:52:36 2002 @@ -732,7 +732,22 @@ static reloc_howto_type elf64_alpha_howt false, 0, 0, - true) + true), + + /* A 21 bit branch that adjusts for gp loads. */ + HOWTO (R_ALPHA_BRSGP, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 21, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + 0, /* special_function */ + "BRSGP", /* name */ + false, /* partial_inplace */ + 0x1fffff, /* src_mask */ + 0x1fffff, /* dst_mask */ + true), /* pcrel_offset */ }; /* A relocation function which doesn't do anything. */ @@ -886,6 +901,7 @@ static const struct elf_reloc_map elf64_ {BFD_RELOC_ALPHA_GPREL_HI16, R_ALPHA_GPRELHIGH}, {BFD_RELOC_ALPHA_GPREL_LO16, R_ALPHA_GPRELLOW}, {BFD_RELOC_GPREL16, R_ALPHA_GPREL16}, + {BFD_RELOC_ALPHA_BRSGP, R_ALPHA_BRSGP}, }; /* Given a BFD reloc type, return a HOWTO structure. */ @@ -2414,6 +2430,7 @@ elf64_alpha_check_relocs (abfd, info, se case R_ALPHA_GPREL32: case R_ALPHA_GPRELHIGH: case R_ALPHA_GPRELLOW: + case R_ALPHA_BRSGP: /* We don't actually use the .got here, but the sections must be created before the linker maps input sections to output sections. */ @@ -3555,6 +3572,64 @@ elf64_alpha_relocate_section (output_bfd addend -= 4; goto default_reloc; + case R_ALPHA_BRSGP: + { + int other; + const char *name; + + /* The regular PC-relative stuff measures from the start of + the instruction rather than the end. */ + addend -= 4; + + /* The source and destination gp must be the same. Note that + the source will always have an assigned gp, since we forced + one in check_relocs, but that the destination may not, as + it might not have had any relocations at all. Also take + care not to crash if H is an undefined symbol. */ + if (h != NULL && sec != NULL + && alpha_elf_tdata (sec->owner)->gotobj + && gotobj != alpha_elf_tdata (sec->owner)->gotobj) + { + (*_bfd_error_handler) + (_("%s: change in gp: BRSGP %s"), + bfd_archive_filename (input_bfd), h->root.root.root.string); + ret_val = false; + } + + /* The symbol should be marked either NOPV or STD_GPLOAD. */ + if (h != NULL) + other = h->root.other; + else + other = sym->st_other; + switch (other & STO_ALPHA_STD_GPLOAD) + { + case STO_ALPHA_NOPV: + break; + case STO_ALPHA_STD_GPLOAD: + addend += 8; + break; + default: + if (h != NULL) + name = h->root.root.root.string; + else + { + name = (bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name)); + if (name == NULL) + name = _(""); + else if (name[0] == 0) + name = bfd_section_name (input_bfd, sec); + } + (*_bfd_error_handler) + (_("%s: !samegp reloc against symbol without .prologue: %s"), + bfd_archive_filename (input_bfd), name); + ret_val = false; + break; + } + + goto default_reloc; + } + case R_ALPHA_REFLONG: case R_ALPHA_REFQUAD: { @@ -3596,7 +3671,7 @@ elf64_alpha_relocate_section (output_bfd outrel.r_offset = _bfd_elf_section_offset (output_bfd, info, input_section, rel->r_offset); - if (outrel.r_offset != (bfd_vma) -1) + if ((outrel.r_offset | 1) != (bfd_vma) -1) outrel.r_offset += (input_section->output_section->vma + input_section->output_offset); else @@ -4024,7 +4099,7 @@ elf64_alpha_final_link (abfd, info) if (p->type != bfd_indirect_link_order) { - if (p->type == bfd_fill_link_order) + if (p->type == bfd_data_link_order) continue; abort (); } diff -uprN binutils-2.11.93.0.2/bfd/elf64-hppa.h binutils-2.12.90.0.1/bfd/elf64-hppa.h --- binutils-2.11.93.0.2/bfd/elf64-hppa.h Fri Mar 9 11:15:56 2001 +++ binutils-2.12.90.0.1/bfd/elf64-hppa.h Thu Mar 7 11:52:36 2002 @@ -1,6 +1,6 @@ /* ELF64/HPPA support - Copyright 1999, 2000 Free Software Foundation, Inc. + Copyright 1999, 2000, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -25,6 +25,9 @@ Foundation, Inc., 59 Temple Place - Suit #include "libhppa.h" #include "elf/hppa.h" +elf_hppa_reloc_type elf64_hppa_reloc_final_type + PARAMS ((bfd *, elf_hppa_reloc_type, int, unsigned int)); + extern elf_hppa_reloc_type ** _bfd_elf64_hppa_gen_reloc_type PARAMS ((bfd *, elf_hppa_reloc_type, int, unsigned int, int, asymbol *)); diff -uprN binutils-2.11.93.0.2/bfd/elf64-mips.c binutils-2.12.90.0.1/bfd/elf64-mips.c --- binutils-2.11.93.0.2/bfd/elf64-mips.c Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/elf64-mips.c Thu Mar 7 11:52:36 2002 @@ -3396,6 +3396,9 @@ mips_elf64_create_dynamic_relocation (ou outrel[0].r_offset = _bfd_elf_section_offset (output_bfd, info, input_section, rel[0].r_offset); + /* FIXME: For -2 runtime relocation needs to be skipped, but + properly resolved statically and installed. */ + BFD_ASSERT (outrel[0].r_offset != (bfd_vma) -2); /* We begin by assuming that the offset for the dynamic relocation is the same as for the original relocation. We'll adjust this @@ -6518,7 +6521,7 @@ mips_elf64_final_link (abfd, info) if (p->type != bfd_indirect_link_order) { - if (p->type == bfd_fill_link_order) + if (p->type == bfd_data_link_order) continue; abort (); } @@ -6655,7 +6658,7 @@ mips_elf64_final_link (abfd, info) if (p->type != bfd_indirect_link_order) { - if (p->type == bfd_fill_link_order) + if (p->type == bfd_data_link_order) continue; abort (); } @@ -6734,7 +6737,7 @@ mips_elf64_final_link (abfd, info) if (p->type != bfd_indirect_link_order) { - if (p->type == bfd_fill_link_order) + if (p->type == bfd_data_link_order) continue; abort (); } diff -uprN binutils-2.11.93.0.2/bfd/elf64-mmix.c binutils-2.12.90.0.1/bfd/elf64-mmix.c --- binutils-2.11.93.0.2/bfd/elf64-mmix.c Thu Feb 7 10:21:03 2002 +++ binutils-2.12.90.0.1/bfd/elf64-mmix.c Thu Mar 7 11:52:36 2002 @@ -2177,6 +2177,21 @@ _bfd_mmix_finalize_linker_allocated_greg if (contents == NULL) return false; + /* Sanity check: If these numbers mismatch, some relocation has not been + accounted for and the rest of gregdata is probably inconsistent. + It's a bug, but it's more helpful to identify it than segfaulting + below. */ + if (gregdata->n_remaining_bpo_relocs_this_relaxation_round + != gregdata->n_bpo_relocs) + { + (*_bfd_error_handler) + (_("Internal inconsistency: remaining %u != max %u.\n\ + Please report this bug."), + gregdata->n_remaining_bpo_relocs_this_relaxation_round, + gregdata->n_bpo_relocs); + return false; + } + for (lastreg = 255, i = 0, j = 0; j < n_gregs; i++) if (gregdata->reloc_request[i].regindex != lastreg) { @@ -2287,7 +2302,6 @@ mmix_elf_relax_section (abfd, sec, link_ struct bfd_link_info *link_info; boolean *again; { - Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Shdr *shndx_hdr; Elf_Internal_Rela *internal_relocs; @@ -2431,9 +2445,12 @@ mmix_elf_relax_section (abfd, sec, link_ 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. */ + /* 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++; continue; } diff -uprN binutils-2.11.93.0.2/bfd/elf64-ppc.c binutils-2.12.90.0.1/bfd/elf64-ppc.c --- binutils-2.11.93.0.2/bfd/elf64-ppc.c Thu Feb 7 10:21:03 2002 +++ binutils-2.12.90.0.1/bfd/elf64-ppc.c Thu Mar 7 11:52:36 2002 @@ -51,6 +51,8 @@ static struct bfd_hash_entry *link_hash_ PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); static struct bfd_link_hash_table *ppc64_elf_link_hash_table_create PARAMS ((bfd *)); +static boolean create_linkage_sections + PARAMS ((bfd *, struct bfd_link_info *)); static boolean create_got_section PARAMS ((bfd *, struct bfd_link_info *)); static boolean ppc64_elf_create_dynamic_sections @@ -153,14 +155,16 @@ static boolean ppc64_elf_finish_dynamic_ #define LIS_R0_0 0x3c000000 /* lis %r0,0 */ #define ORI_R0_R0_0 0x60000000 /* ori %r0,%r0,0 */ +/* Instructions to save and restore floating point regs. */ +#define STFD_FR0_0R1 0xd8010000 /* stfd %fr0,0(%r1) */ +#define LFD_FR0_0R1 0xc8010000 /* lfd %fr0,0(%r1) */ +#define BLR 0x4e800020 /* blr */ + /* Since .opd is an array of descriptors and each entry will end up with identical R_PPC64_RELATIVE relocs, there is really no need to propagate .opd relocs; The dynamic linker should be taught to - relocate .opd without reloc entries. FIXME: the dynamic linker - will need to know where and how large .opd is via a couple of new - DT_PPC64_* tags, or perhaps just with one reloc that specifies the - start of .opd via its offset and the size via its addend. Also, - .opd should be trimmed of unused values. */ + relocate .opd without reloc entries. FIXME: .opd should be trimmed + of unused values. */ #ifndef NO_OPD_RELOCS #define NO_OPD_RELOCS 0 #endif @@ -1722,6 +1726,7 @@ struct ppc_link_hash_table asection *srelbss; asection *sstub; asection *sglink; + asection *sfpr; /* Set on error. */ int plt_overflow; @@ -1793,12 +1798,49 @@ ppc64_elf_link_hash_table_create (abfd) htab->srelbss = NULL; htab->sstub = NULL; htab->sglink = NULL; + htab->sfpr = NULL; htab->plt_overflow = 0; htab->sym_sec.abfd = NULL; return &htab->elf.root; } +/* Create sections for linker generated code. */ + +static boolean +create_linkage_sections (dynobj, info) + bfd *dynobj; + struct bfd_link_info *info; +{ + struct ppc_link_hash_table *htab; + flagword flags; + + htab = ppc_hash_table (info); + + /* Create .sfpr for code to save and restore fp regs. */ + flags = (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_READONLY + | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED); + htab->sfpr = bfd_make_section (dynobj, ".sfpr"); + if (htab->sfpr == NULL + || ! bfd_set_section_flags (dynobj, htab->sfpr, flags) + || ! bfd_set_section_alignment (dynobj, htab->sfpr, 2)) + return false; + + /* Create .stub and .glink for global linkage functions. */ + htab->sstub = bfd_make_section (dynobj, ".stub"); + if (htab->sstub == NULL + || ! bfd_set_section_flags (dynobj, htab->sstub, flags) + || ! bfd_set_section_alignment (dynobj, htab->sstub, 2)) + return false; + htab->sglink = bfd_make_section (dynobj, ".glink"); + if (htab->sglink == NULL + || ! bfd_set_section_flags (dynobj, htab->sglink, flags) + || ! bfd_set_section_alignment (dynobj, htab->sglink, 2)) + return false; + + return true; +} + /* Create .got and .rela.got sections in DYNOBJ, and set up shortcuts to them in our hash table. */ @@ -1828,8 +1870,7 @@ create_got_section (dynobj, info) return true; } -/* Create the .stub and .glink sections as well as the ordinary - dynamic sections. */ +/* Create the dynamic sections, and set up shortcuts. */ static boolean ppc64_elf_create_dynamic_sections (dynobj, info) @@ -1837,7 +1878,6 @@ ppc64_elf_create_dynamic_sections (dynob struct bfd_link_info *info; { struct ppc_link_hash_table *htab; - flagword flags; htab = ppc_hash_table (info); if (!htab->sgot && !create_got_section (dynobj, info)) @@ -1856,20 +1896,6 @@ ppc64_elf_create_dynamic_sections (dynob || (!info->shared && !htab->srelbss)) abort (); - /* Create .stub and .glink for global linkage functions. */ - flags = (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_READONLY - | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED); - htab->sstub = bfd_make_section (dynobj, ".stub"); - if (htab->sstub == NULL - || ! bfd_set_section_flags (dynobj, htab->sstub, flags) - || ! bfd_set_section_alignment (dynobj, htab->sstub, 2)) - return false; - htab->sglink = bfd_make_section (dynobj, ".glink"); - if (htab->sglink == NULL - || ! bfd_set_section_flags (dynobj, htab->sglink, flags) - || ! bfd_set_section_alignment (dynobj, htab->sglink, 3)) - return false; - return true; } @@ -1958,6 +1984,12 @@ ppc64_elf_check_relocs (abfd, info, sec, sreloc = NULL; is_opd = strcmp (bfd_get_section_name (abfd, sec), ".opd") == 0; + if (htab->elf.dynobj == NULL) + htab->elf.dynobj = abfd; + if (htab->sfpr == NULL + && !create_linkage_sections (htab->elf.dynobj, info)) + return false; + rel_end = relocs + sec->reloc_count; for (rel = relocs; rel < rel_end; rel++) { @@ -1983,13 +2015,9 @@ ppc64_elf_check_relocs (abfd, info, sec, case R_PPC64_GOT16_LO_DS: /* This symbol requires a global offset table entry. */ - if (htab->sgot == NULL) - { - if (htab->elf.dynobj == NULL) - htab->elf.dynobj = abfd; - if (!create_got_section (htab->elf.dynobj, info)) - return false; - } + if (htab->sgot == NULL + && !create_got_section (htab->elf.dynobj, info)) + return false; if (h != NULL) { @@ -2200,9 +2228,6 @@ ppc64_elf_check_relocs (abfd, info, sec, bfd_set_error (bfd_error_bad_value); } - if (htab->elf.dynobj == NULL) - htab->elf.dynobj = abfd; - dynobj = htab->elf.dynobj; sreloc = bfd_get_section_by_name (dynobj, name); if (sreloc == NULL) @@ -2266,6 +2291,7 @@ ppc64_elf_check_relocs (abfd, info, sec, break; default: + break; } } @@ -2557,25 +2583,117 @@ func_desc_adjust (h, inf) been imported from another library. Function code syms that are really in the library we must leave global to prevent the linker dragging in a definition from a static library. */ - force_local = (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0; + force_local = ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0 + && info->shared); _bfd_elf_link_hash_hide_symbol (info, h, force_local); } return true; } +#define MIN_SAVE_FPR 14 +#define MAX_SAVE_FPR 31 + /* Called near the start of bfd_elf_size_dynamic_sections. We use - this hook to transfer dynamic linking information gathered so far - on function code symbol entries, to their corresponding function - descriptor symbol entries. */ + this hook to a) provide some gcc support functions, and b) transfer + dynamic linking information gathered so far on function code symbol + entries, to their corresponding function descriptor symbol entries. */ static boolean ppc64_elf_func_desc_adjust (obfd, info) bfd *obfd ATTRIBUTE_UNUSED; struct bfd_link_info *info; { struct ppc_link_hash_table *htab; + unsigned int lowest_savef = MAX_SAVE_FPR + 2; + unsigned int lowest_restf = MAX_SAVE_FPR + 2; + unsigned int i; + struct elf_link_hash_entry *h; + char sym[10]; htab = ppc_hash_table (info); + + if (htab->sfpr == NULL) + /* We don't have any relocs. */ + return true; + + /* First provide any missing ._savef* and ._restf* functions. */ + memcpy (sym, "._savef14", 10); + for (i = MIN_SAVE_FPR; i <= MAX_SAVE_FPR; i++) + { + sym[7] = i / 10 + '0'; + sym[8] = i % 10 + '0'; + h = elf_link_hash_lookup (&htab->elf, sym, false, false, true); + if (h != NULL + && h->root.type == bfd_link_hash_undefined) + { + if (lowest_savef > i) + lowest_savef = i; + h->root.type = bfd_link_hash_defined; + h->root.u.def.section = htab->sfpr; + h->root.u.def.value = (i - lowest_savef) * 4; + h->type = STT_FUNC; + h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; + _bfd_elf_link_hash_hide_symbol (info, h, info->shared); + } + } + + memcpy (sym, "._restf14", 10); + for (i = MIN_SAVE_FPR; i <= MAX_SAVE_FPR; i++) + { + sym[7] = i / 10 + '0'; + sym[8] = i % 10 + '0'; + h = elf_link_hash_lookup (&htab->elf, sym, false, false, true); + if (h != NULL + && h->root.type == bfd_link_hash_undefined) + { + if (lowest_restf > i) + lowest_restf = i; + h->root.type = bfd_link_hash_defined; + h->root.u.def.section = htab->sfpr; + h->root.u.def.value = ((MAX_SAVE_FPR + 2 - lowest_savef) * 4 + + (i - lowest_restf) * 4); + h->type = STT_FUNC; + h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; + _bfd_elf_link_hash_hide_symbol (info, h, info->shared); + } + } + + htab->sfpr->_raw_size = ((MAX_SAVE_FPR + 2 - lowest_savef) * 4 + + (MAX_SAVE_FPR + 2 - lowest_restf) * 4); + + if (htab->sfpr->_raw_size == 0) + { + _bfd_strip_section_from_output (info, htab->sfpr); + } + else + { + bfd_byte *p = (bfd_byte *) bfd_alloc (htab->elf.dynobj, + htab->sfpr->_raw_size); + if (p == NULL) + return false; + htab->sfpr->contents = p; + + for (i = lowest_savef; i <= MAX_SAVE_FPR; i++) + { + unsigned int fpr = i << 21; + unsigned int stackoff = (1 << 16) - (MAX_SAVE_FPR + 1 - i) * 8; + bfd_put_32 (htab->elf.dynobj, STFD_FR0_0R1 + fpr + stackoff, p); + p += 4; + } + bfd_put_32 (htab->elf.dynobj, BLR, p); + p += 4; + + for (i = lowest_restf; i <= MAX_SAVE_FPR; i++) + { + unsigned int fpr = i << 21; + unsigned int stackoff = (1 << 16) - (MAX_SAVE_FPR + 1 - i) * 8; + bfd_put_32 (htab->elf.dynobj, LFD_FR0_0R1 + fpr + stackoff, p); + p += 4; + } + bfd_put_32 (htab->elf.dynobj, BLR, p); + p += 4; + } + elf_link_hash_traverse (&htab->elf, func_desc_adjust, (PTR) info); return true; } @@ -3128,6 +3246,13 @@ ppc64_elf_size_dynamic_sections (output_ return false; } + if (NO_OPD_RELOCS) + { + if (!add_dynamic_entry (DT_PPC64_OPD, 0) + || !add_dynamic_entry (DT_PPC64_OPDSZ, 0)) + return false; + } + if (relocs) { if (!add_dynamic_entry (DT_RELA, 0) @@ -3251,7 +3376,7 @@ ppc64_elf_size_stubs (obfd, info, change /* If the .plt doesn't have any entries crossing a 64k boundary, then there is no need for bigger stubs. */ - if (next_64k <= plt_offset + htab->splt->_raw_size) + if (plt_offset + htab->splt->_raw_size <= next_64k) return true; /* OK, so we have at least one transition. Since .plt entries are @@ -3507,6 +3632,8 @@ ppc64_elf_relocate_section (output_bfd, bfd_vma TOCstart; boolean ret = true; boolean is_opd; + /* Disabled until we sort out how ld should choose 'y' vs 'at'. */ + boolean is_power4 = false; /* Initialize howto table if needed. */ if (!ppc64_elf_howto_table[R_PPC64_ADDR32]) @@ -3636,22 +3763,31 @@ ppc64_elf_relocate_section (output_bfd, /* Branch taken prediction relocations. */ case R_PPC64_ADDR14_BRTAKEN: case R_PPC64_REL14_BRTAKEN: - insn = 0x01 << 21; /* Set 't' bit, lowest bit of BO field. */ + insn = 0x01 << 21; /* 'y' or 't' bit, lowest bit of BO field. */ /* Fall thru. */ /* Branch not taken prediction relocations. */ case R_PPC64_ADDR14_BRNTAKEN: case R_PPC64_REL14_BRNTAKEN: insn |= bfd_get_32 (output_bfd, contents + offset) & ~(0x01 << 21); - /* Set 'a' bit. This is 0b00010 in BO field for branch on CR(BI) - insns (BO == 001at or 011at), and 0b01000 for branch on CTR - insns (BO == 1a00t or 1a01t). */ - if ((insn & (0x14 << 21)) == (0x04 << 21)) - insn |= 0x02 << 21; - else if ((insn & (0x14 << 21)) == (0x10 << 21)) - insn |= 0x08 << 21; + if (is_power4) + { + /* Set 'a' bit. This is 0b00010 in BO field for branch + on CR(BI) insns (BO == 001at or 011at), and 0b01000 + for branch on CTR insns (BO == 1a00t or 1a01t). */ + if ((insn & (0x14 << 21)) == (0x04 << 21)) + insn |= 0x02 << 21; + else if ((insn & (0x14 << 21)) == (0x10 << 21)) + insn |= 0x08 << 21; + else + break; + } else - break; + { + /* Invert 'y' bit if not the default. */ + if ((bfd_signed_vma) (relocation - offset) < 0) + insn ^= 0x01 << 21; + } bfd_put_32 (output_bfd, (bfd_vma) insn, contents + offset); break; @@ -3958,22 +4094,21 @@ ppc64_elf_relocate_section (output_bfd, time. */ skip = false; + relocate = false; outrel.r_offset = _bfd_elf_section_offset (output_bfd, info, input_section, rel->r_offset); if (outrel.r_offset == (bfd_vma) -1) skip = true; - + else if (outrel.r_offset == (bfd_vma) -2) + skip = true, relocate = true; outrel.r_offset += (input_section->output_section->vma + input_section->output_offset); outrel.r_addend = addend; if (skip) - { - relocate = false; - memset (&outrel, 0, sizeof outrel); - } + memset (&outrel, 0, sizeof outrel); else if (h != NULL && h->dynindx != -1 && !is_opd @@ -3982,10 +4117,7 @@ ppc64_elf_relocate_section (output_bfd, || !info->symbolic || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)) - { - relocate = false; - outrel.r_info = ELF64_R_INFO (h->dynindx, r_type); - } + outrel.r_info = ELF64_R_INFO (h->dynindx, r_type); else { /* This symbol is local, or marked to become local, @@ -4354,6 +4486,7 @@ ppc64_elf_finish_dynamic_sections (outpu for (; dyncon < dynconend; dyncon++) { Elf_Internal_Dyn dyn; + asection *s; bfd_elf64_swap_dyn_in (dynobj, dyncon, &dyn); @@ -4367,6 +4500,18 @@ ppc64_elf_finish_dynamic_sections (outpu + htab->sglink->output_offset); break; + case DT_PPC64_OPD: + s = bfd_get_section_by_name (output_bfd, ".opd"); + if (s != NULL) + dyn.d_un.d_ptr = s->vma; + break; + + case DT_PPC64_OPDSZ: + s = bfd_get_section_by_name (output_bfd, ".opd"); + if (s != NULL) + dyn.d_un.d_val = s->_raw_size; + break; + case DT_PLTGOT: dyn.d_un.d_ptr = (htab->splt->output_section->vma + htab->splt->output_offset); diff -uprN binutils-2.11.93.0.2/bfd/elf64-s390.c binutils-2.12.90.0.1/bfd/elf64-s390.c --- binutils-2.11.93.0.2/bfd/elf64-s390.c Thu Feb 7 10:21:03 2002 +++ binutils-2.12.90.0.1/bfd/elf64-s390.c Thu Mar 7 11:52:36 2002 @@ -1890,21 +1890,21 @@ elf_s390_relocate_section (output_bfd, i time. */ skip = false; + relocate = false; outrel.r_offset = _bfd_elf_section_offset (output_bfd, info, input_section, rel->r_offset); if (outrel.r_offset == (bfd_vma) -1) skip = true; + else if (outrel.r_offset == (bfd_vma) -2) + skip = true, relocate = true; outrel.r_offset += (input_section->output_section->vma + input_section->output_offset); if (skip) - { - memset (&outrel, 0, sizeof outrel); - relocate = false; - } + memset (&outrel, 0, sizeof outrel); else if (h != NULL && h->dynindx != -1 && (r_type == R_390_PC16 @@ -1917,7 +1917,6 @@ elf_s390_relocate_section (output_bfd, i || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)) { - relocate = false; outrel.r_info = ELF64_R_INFO (h->dynindx, r_type); outrel.r_addend = rel->r_addend; } @@ -2326,7 +2325,7 @@ static boolean elf_s390_object_p (abfd) bfd *abfd; { - return bfd_default_set_arch_mach (abfd, bfd_arch_s390, bfd_mach_s390_esame); + return bfd_default_set_arch_mach (abfd, bfd_arch_s390, bfd_mach_s390_64); } /* diff -uprN binutils-2.11.93.0.2/bfd/elf64-sh64.c binutils-2.12.90.0.1/bfd/elf64-sh64.c --- binutils-2.11.93.0.2/bfd/elf64-sh64.c Wed Dec 31 16:00:00 1969 +++ binutils-2.12.90.0.1/bfd/elf64-sh64.c Thu Mar 7 11:52:36 2002 @@ -0,0 +1,4208 @@ +/* Hitachi SH64-specific support for 64-bit ELF + Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. + + 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 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. */ + +#define SH64_ELF64 + +#include "bfd.h" +#include "sysdep.h" +#include "bfdlink.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/sh.h" + +/* Add a suffix for datalabel indirection symbols. It must not match any + other symbols; user symbols with or without version or other + decoration. It must only be used internally and not emitted by any + means. */ +#define DATALABEL_SUFFIX " DL" + +#define GOT_BIAS (-((long)-32768)) + +#define PLT_ENTRY_SIZE 64 + +/* Return size of a PLT entry. */ +#define elf_sh64_sizeof_plt(info) PLT_ENTRY_SIZE + +/* Return offset of the PLT0 address in an absolute PLT entry. */ +#define elf_sh64_plt_plt0_offset(info) 32 + +/* Return offset of the linker in PLT0 entry. */ +#define elf_sh64_plt0_gotplt_offset(info) 0 + +/* Return offset of the trampoline in PLT entry */ +#define elf_sh64_plt_temp_offset(info) 33 /* Add one because it's SHmedia. */ + +/* Return offset of the symbol in PLT entry. */ +#define elf_sh64_plt_symbol_offset(info) 0 + +/* Return offset of the relocation in PLT entry. */ +#define elf_sh64_plt_reloc_offset(info) (info->shared ? 52 : 44) + +#define ELF_DYNAMIC_INTERPRETER "/usr/lib/libc.so.1" + +/* The sh 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 + it can discard PC relative relocs if it doesn't need them when + linking with -Bsymbolic. We store the information in a field + extending the regular ELF linker hash table. */ + +/* This structure keeps track of the number of PC relative relocs we + have copied for a given symbol. */ + +struct elf_sh64_pcrel_relocs_copied +{ + /* Next section. */ + struct elf_sh64_pcrel_relocs_copied *next; + /* A section in dynobj. */ + asection *section; + /* Number of relocs copied in this section. */ + bfd_size_type count; +}; + +/* sh ELF linker hash entry. */ + +struct elf_sh64_link_hash_entry +{ + struct elf_link_hash_entry root; + + bfd_vma datalabel_got_offset; + + /* Number of PC relative relocs copied for this symbol. */ + struct elf_sh64_pcrel_relocs_copied *pcrel_relocs_copied; +}; + +/* sh ELF linker hash table. */ + +struct elf_sh64_link_hash_table +{ + struct elf_link_hash_table root; +}; + +/* Traverse an sh ELF linker hash table. */ + +#define sh64_elf64_link_hash_traverse(table, func, info) \ + (elf_link_hash_traverse \ + (&(table)->root, \ + (boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \ + (info))) + +/* Get the sh ELF linker hash table from a link_info structure. */ + +#define sh64_elf64_hash_table(p) \ + ((struct elf_sh64_link_hash_table *) ((p)->hash)) + +static boolean sh_elf64_copy_private_data PARAMS ((bfd *, bfd *)); +static boolean sh_elf64_copy_private_data_internal PARAMS ((bfd *, bfd *)); +static boolean sh_elf64_merge_private_data PARAMS ((bfd *, bfd *)); +static bfd_reloc_status_type sh_elf64_ignore_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_reloc_status_type sh_elf64_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static reloc_howto_type *sh_elf64_reloc_type_lookup + PARAMS ((bfd *, bfd_reloc_code_real_type)); +static void sh_elf64_info_to_howto + PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); +static boolean sh_elf64_relocate_section + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); +static bfd_byte *sh_elf64_get_relocated_section_contents + PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, + bfd_byte *, boolean, asymbol **)); +static boolean sh_elf64_set_mach_from_flags PARAMS ((bfd *)); +static boolean sh_elf64_set_private_flags PARAMS ((bfd *, flagword)); +static asection *sh_elf64_gc_mark_hook + PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *, + struct elf_link_hash_entry *, Elf_Internal_Sym *)); +static boolean sh_elf64_gc_sweep_hook + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); +static boolean sh_elf64_check_relocs + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); +static int sh64_elf64_get_symbol_type PARAMS ((Elf_Internal_Sym *, int)); +static boolean sh64_elf64_add_symbol_hook + PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, + const char **, flagword *, asection **, bfd_vma *)); +extern boolean sh64_elf64_link_output_symbol_hook + PARAMS ((bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *, + asection *)); +static boolean sh64_elf64_fake_sections + PARAMS ((bfd *, Elf_Internal_Shdr *, asection *)); +static void sh64_elf64_final_write_processing PARAMS ((bfd *, boolean)); +static struct bfd_hash_entry *sh64_elf64_link_hash_newfunc + PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); +static struct bfd_link_hash_table *sh64_elf64_link_hash_table_create + PARAMS ((bfd *)); +inline static void movi_shori_putval PARAMS ((bfd *, unsigned long, char *)); +inline static void movi_3shori_putval PARAMS ((bfd *, bfd_vma, char *)); +static boolean sh64_elf64_create_dynamic_sections + PARAMS ((bfd *, struct bfd_link_info *)); +static boolean sh64_elf64_adjust_dynamic_symbol + PARAMS ((struct bfd_link_info *info, struct elf_link_hash_entry *)); +static boolean sh64_elf64_discard_copies + PARAMS ((struct elf_sh64_link_hash_entry *, PTR)); +static boolean sh64_elf64_size_dynamic_sections + PARAMS ((bfd *, struct bfd_link_info *)); +static boolean sh64_elf64_finish_dynamic_symbol + PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, + Elf_Internal_Sym *)); +static boolean sh64_elf64_finish_dynamic_sections + PARAMS ((bfd *, struct bfd_link_info *)); + +static reloc_howto_type sh_elf64_howto_table[] = { + /* No relocation. */ + HOWTO (R_SH_NONE, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + sh_elf64_ignore_reloc, /* special_function */ + "R_SH_NONE", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + false), /* pcrel_offset */ + + /* 32 bit absolute relocation. Setting partial_inplace to true and + src_mask to a non-zero value is similar to the COFF toolchain. */ + HOWTO (R_SH_DIR32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + sh_elf64_reloc, /* special_function */ + "R_SH_DIR32", /* name */ + true, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + false), /* pcrel_offset */ + + /* 32 bit PC relative relocation. */ + HOWTO (R_SH_REL32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + sh_elf64_ignore_reloc, /* special_function */ + "R_SH_REL32", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0xffffffff, /* dst_mask */ + true), /* pcrel_offset */ + + /* For 32-bit sh, this is R_SH_DIR8WPN. */ + EMPTY_HOWTO (3), + + /* For 32-bit sh, this is R_SH_IND12W. */ + EMPTY_HOWTO (4), + + /* For 32-bit sh, this is R_SH_DIR8WPL. */ + EMPTY_HOWTO (5), + + /* For 32-bit sh, this is R_SH_DIR8WPZ. */ + EMPTY_HOWTO (6), + + /* For 32-bit sh, this is R_SH_DIR8BP. */ + EMPTY_HOWTO (7), + + /* For 32-bit sh, this is R_SH_DIR8W. */ + EMPTY_HOWTO (8), + + /* For 32-bit sh, this is R_SH_DIR8L. */ + EMPTY_HOWTO (9), + + EMPTY_HOWTO (10), + EMPTY_HOWTO (11), + EMPTY_HOWTO (12), + EMPTY_HOWTO (13), + EMPTY_HOWTO (14), + EMPTY_HOWTO (15), + EMPTY_HOWTO (16), + EMPTY_HOWTO (17), + EMPTY_HOWTO (18), + 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. */ + + /* 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. */ + HOWTO (R_SH_SWITCH16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf64_ignore_reloc, /* special_function */ + "R_SH_SWITCH16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + true), /* pcrel_offset */ + + /* A 32 bit switch table entry. This is generated for an expression + such as ``.long L1 - L2''. The offset holds the difference + between the reloc address and L2. */ + HOWTO (R_SH_SWITCH32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf64_ignore_reloc, /* special_function */ + "R_SH_SWITCH32", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + true), /* pcrel_offset */ + + /* For 32-bit sh, this is R_SH_USES. */ + EMPTY_HOWTO (27), + + /* For 32-bit sh, this is R_SH_COUNT. */ + EMPTY_HOWTO (28), + + /* For 32-bit sh, this is R_SH_ALIGN. FIXME: For linker relaxation, + this might be emitted. When linker relaxation is implemented, we + might want to use it. */ + EMPTY_HOWTO (29), + + /* For 32-bit sh, this is R_SH_CODE. FIXME: For linker relaxation, + this might be emitted. When linker relaxation is implemented, we + might want to use it. */ + EMPTY_HOWTO (30), + + /* For 32-bit sh, this is R_SH_DATA. FIXME: For linker relaxation, + this might be emitted. When linker relaxation is implemented, we + might want to use it. */ + EMPTY_HOWTO (31), + + /* For 32-bit sh, this is R_SH_LABEL. FIXME: For linker relaxation, + this might be emitted. When linker relaxation is implemented, we + might want to use it. */ + EMPTY_HOWTO (32), + + /* 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_elf64_ignore_reloc, /* special_function */ + "R_SH_SWITCH8", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + true), /* 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 */ + 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 */ + + /* For 32-bit sh, this is R_SH_LOOP_START. */ + EMPTY_HOWTO (36), + + /* For 32-bit sh, this is R_SH_LOOP_END. */ + EMPTY_HOWTO (37), + + EMPTY_HOWTO (38), + EMPTY_HOWTO (39), + EMPTY_HOWTO (40), + EMPTY_HOWTO (41), + EMPTY_HOWTO (42), + EMPTY_HOWTO (43), + EMPTY_HOWTO (44), + + /* Used in SHLLI.L and SHLRI.L. */ + HOWTO (R_SH_DIR5U, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 5, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR5U", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0xfc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in SHARI, SHLLI et al. */ + HOWTO (R_SH_DIR6U, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 6, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR6U", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0xfc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in BxxI, LDHI.L et al. */ + HOWTO (R_SH_DIR6S, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 6, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR6S", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0xfc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in ADDI, ANDI et al. */ + HOWTO (R_SH_DIR10S, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 10, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR10S", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in LD.UW, ST.W et al. */ + HOWTO (R_SH_DIR10SW, /* type */ + 1, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 11, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR10SW", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in LD.L, FLD.S et al. */ + HOWTO (R_SH_DIR10SL, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR10SL", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in FLD.D, FST.P et al. */ + HOWTO (R_SH_DIR10SQ, /* type */ + 3, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 13, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR10SQ", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + false), /* pcrel_offset */ + + EMPTY_HOWTO (52), + EMPTY_HOWTO (53), + EMPTY_HOWTO (54), + EMPTY_HOWTO (55), + EMPTY_HOWTO (56), + EMPTY_HOWTO (57), + EMPTY_HOWTO (58), + EMPTY_HOWTO (59), + EMPTY_HOWTO (60), + EMPTY_HOWTO (61), + EMPTY_HOWTO (62), + EMPTY_HOWTO (63), + EMPTY_HOWTO (64), + EMPTY_HOWTO (65), + EMPTY_HOWTO (66), + EMPTY_HOWTO (67), + EMPTY_HOWTO (68), + EMPTY_HOWTO (69), + EMPTY_HOWTO (70), + EMPTY_HOWTO (71), + EMPTY_HOWTO (72), + EMPTY_HOWTO (73), + EMPTY_HOWTO (74), + EMPTY_HOWTO (75), + EMPTY_HOWTO (76), + EMPTY_HOWTO (77), + EMPTY_HOWTO (78), + EMPTY_HOWTO (79), + EMPTY_HOWTO (80), + EMPTY_HOWTO (81), + EMPTY_HOWTO (82), + EMPTY_HOWTO (83), + EMPTY_HOWTO (84), + EMPTY_HOWTO (85), + EMPTY_HOWTO (86), + EMPTY_HOWTO (87), + EMPTY_HOWTO (88), + EMPTY_HOWTO (89), + EMPTY_HOWTO (90), + EMPTY_HOWTO (91), + EMPTY_HOWTO (92), + EMPTY_HOWTO (93), + EMPTY_HOWTO (94), + EMPTY_HOWTO (95), + EMPTY_HOWTO (96), + EMPTY_HOWTO (97), + EMPTY_HOWTO (98), + EMPTY_HOWTO (99), + EMPTY_HOWTO (100), + EMPTY_HOWTO (101), + EMPTY_HOWTO (102), + EMPTY_HOWTO (103), + EMPTY_HOWTO (104), + EMPTY_HOWTO (105), + EMPTY_HOWTO (106), + EMPTY_HOWTO (107), + EMPTY_HOWTO (108), + EMPTY_HOWTO (109), + EMPTY_HOWTO (110), + EMPTY_HOWTO (111), + EMPTY_HOWTO (112), + EMPTY_HOWTO (113), + EMPTY_HOWTO (114), + EMPTY_HOWTO (115), + EMPTY_HOWTO (116), + EMPTY_HOWTO (117), + EMPTY_HOWTO (118), + EMPTY_HOWTO (119), + EMPTY_HOWTO (120), + EMPTY_HOWTO (121), + EMPTY_HOWTO (122), + EMPTY_HOWTO (123), + EMPTY_HOWTO (124), + EMPTY_HOWTO (125), + EMPTY_HOWTO (126), + EMPTY_HOWTO (127), + EMPTY_HOWTO (128), + EMPTY_HOWTO (129), + EMPTY_HOWTO (130), + EMPTY_HOWTO (131), + EMPTY_HOWTO (132), + EMPTY_HOWTO (133), + EMPTY_HOWTO (134), + EMPTY_HOWTO (135), + EMPTY_HOWTO (136), + EMPTY_HOWTO (137), + EMPTY_HOWTO (138), + EMPTY_HOWTO (139), + EMPTY_HOWTO (140), + EMPTY_HOWTO (141), + EMPTY_HOWTO (142), + EMPTY_HOWTO (143), + EMPTY_HOWTO (144), + EMPTY_HOWTO (145), + EMPTY_HOWTO (146), + EMPTY_HOWTO (147), + EMPTY_HOWTO (148), + EMPTY_HOWTO (149), + EMPTY_HOWTO (150), + EMPTY_HOWTO (151), + EMPTY_HOWTO (152), + EMPTY_HOWTO (153), + EMPTY_HOWTO (154), + EMPTY_HOWTO (155), + EMPTY_HOWTO (156), + EMPTY_HOWTO (157), + EMPTY_HOWTO (158), + EMPTY_HOWTO (159), + + /* Relocs for dynamic linking for 32-bit SH would follow. We don't have + any dynamic linking support for 64-bit SH at present. */ + + EMPTY_HOWTO (160), + EMPTY_HOWTO (161), + EMPTY_HOWTO (162), + EMPTY_HOWTO (163), + EMPTY_HOWTO (164), + EMPTY_HOWTO (165), + EMPTY_HOWTO (166), + EMPTY_HOWTO (167), + EMPTY_HOWTO (168), + + /* Back to SH5 relocations. */ + /* Used in MOVI and SHORI (x & 65536). */ + HOWTO (R_SH_GOT_LOW16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOT_LOW16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 16) & 65536). */ + HOWTO (R_SH_GOT_MEDLOW16, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOT_MEDLOW16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 32) & 65536). */ + HOWTO (R_SH_GOT_MEDHI16, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOT_MEDHI16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 48) & 65536). */ + HOWTO (R_SH_GOT_HI16, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOT_HI16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI (x & 65536). */ + HOWTO (R_SH_GOTPLT_LOW16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPLT_LOW16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 16) & 65536). */ + HOWTO (R_SH_GOTPLT_MEDLOW16, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPLT_MEDLOW16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 32) & 65536). */ + HOWTO (R_SH_GOTPLT_MEDHI16, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPLT_MEDHI16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 48) & 65536). */ + HOWTO (R_SH_GOTPLT_HI16, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPLT_HI16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI (x & 65536). */ + HOWTO (R_SH_PLT_LOW16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + true, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_PLT_LOW16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + true), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 16) & 65536). */ + HOWTO (R_SH_PLT_MEDLOW16, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + true, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_PLT_MEDLOW16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + true), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 32) & 65536). */ + HOWTO (R_SH_PLT_MEDHI16, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + true, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_PLT_MEDHI16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + true), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 48) & 65536). */ + HOWTO (R_SH_PLT_HI16, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + true, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_PLT_HI16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + true), /* pcrel_offset */ + + /* Used in MOVI and SHORI (x & 65536). */ + HOWTO (R_SH_GOTOFF_LOW16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTOFF_LOW16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 16) & 65536). */ + HOWTO (R_SH_GOTOFF_MEDLOW16, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTOFF_MEDLOW16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 32) & 65536). */ + HOWTO (R_SH_GOTOFF_MEDHI16, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTOFF_MEDHI16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 48) & 65536). */ + HOWTO (R_SH_GOTOFF_HI16, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTOFF_HI16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI (x & 65536). */ + HOWTO (R_SH_GOTPC_LOW16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + true, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPC_LOW16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + true), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 16) & 65536). */ + HOWTO (R_SH_GOTPC_MEDLOW16, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + true, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPC_MEDLOW16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + true), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 32) & 65536). */ + HOWTO (R_SH_GOTPC_MEDHI16, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + true, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPC_MEDHI16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + true), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 48) & 65536). */ + HOWTO (R_SH_GOTPC_HI16, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + true, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPC_HI16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + true), /* pcrel_offset */ + + /* Used in LD.L, FLD.S et al. */ + HOWTO (R_SH_GOT10BY4, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOT10BY4", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in LD.L, FLD.S et al. */ + HOWTO (R_SH_GOTPLT10BY4, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPLT10BY4", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in FLD.D, FST.P et al. */ + HOWTO (R_SH_GOT10BY8, /* type */ + 3, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 13, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOT10BY8", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in FLD.D, FST.P et al. */ + HOWTO (R_SH_GOTPLT10BY8, /* type */ + 3, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 13, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPLT10BY8", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + false), /* pcrel_offset */ + + HOWTO (R_SH_COPY64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_COPY64", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + ((bfd_vma) 0) - 1, /* dst_mask */ + false), /* pcrel_offset */ + + HOWTO (R_SH_GLOB_DAT64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GLOB_DAT64", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + ((bfd_vma) 0) - 1, /* dst_mask */ + false), /* pcrel_offset */ + + HOWTO (R_SH_JMP_SLOT64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_JMP_SLOT64", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + ((bfd_vma) 0) - 1, /* dst_mask */ + false), /* pcrel_offset */ + + HOWTO (R_SH_RELATIVE64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_RELATIVE64", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + ((bfd_vma) 0) - 1, /* dst_mask */ + false), /* pcrel_offset */ + + EMPTY_HOWTO (197), + EMPTY_HOWTO (198), + EMPTY_HOWTO (199), + EMPTY_HOWTO (200), + EMPTY_HOWTO (201), + EMPTY_HOWTO (202), + EMPTY_HOWTO (203), + EMPTY_HOWTO (204), + EMPTY_HOWTO (205), + EMPTY_HOWTO (206), + EMPTY_HOWTO (207), + EMPTY_HOWTO (208), + EMPTY_HOWTO (209), + EMPTY_HOWTO (210), + EMPTY_HOWTO (211), + EMPTY_HOWTO (212), + EMPTY_HOWTO (213), + EMPTY_HOWTO (214), + EMPTY_HOWTO (215), + EMPTY_HOWTO (216), + EMPTY_HOWTO (217), + EMPTY_HOWTO (218), + EMPTY_HOWTO (219), + EMPTY_HOWTO (220), + EMPTY_HOWTO (221), + EMPTY_HOWTO (222), + EMPTY_HOWTO (223), + EMPTY_HOWTO (224), + EMPTY_HOWTO (225), + EMPTY_HOWTO (226), + EMPTY_HOWTO (227), + EMPTY_HOWTO (228), + EMPTY_HOWTO (229), + EMPTY_HOWTO (230), + EMPTY_HOWTO (231), + EMPTY_HOWTO (232), + EMPTY_HOWTO (233), + EMPTY_HOWTO (234), + EMPTY_HOWTO (235), + EMPTY_HOWTO (236), + EMPTY_HOWTO (237), + EMPTY_HOWTO (238), + EMPTY_HOWTO (239), + EMPTY_HOWTO (240), + EMPTY_HOWTO (241), + + /* Relocations for SHmedia code. None of these are partial_inplace or + use the field being relocated. */ + + /* The assembler will generate this reloc before a block of SHmedia + instructions. A section should be processed as assuming it contains + data, unless this reloc is seen. Note that a block of SHcompact + instructions are instead preceded by R_SH_CODE. + This is currently not implemented, but should be used for SHmedia + linker relaxation. */ + HOWTO (R_SH_SHMEDIA_CODE, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf64_ignore_reloc, /* special_function */ + "R_SH_SHMEDIA_CODE", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + false), /* pcrel_offset */ + + /* The assembler will generate this reloc at a PTA or PTB instruction, + and the linker checks the right type of target, or changes a PTA to a + PTB, if the original insn was PT. */ + HOWTO (R_SH_PT_16, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 18, /* bitsize */ + true, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_PT_16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + true), /* pcrel_offset */ + + /* Used in unexpanded MOVI. */ + HOWTO (R_SH_IMMS16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMMS16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in SHORI. */ + HOWTO (R_SH_IMMU16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMMU16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI (x & 65536). */ + HOWTO (R_SH_IMM_LOW16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_LOW16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x - $) & 65536). */ + HOWTO (R_SH_IMM_LOW16_PCREL, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + true, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_LOW16_PCREL", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + true), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 16) & 65536). */ + HOWTO (R_SH_IMM_MEDLOW16, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_MEDLOW16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI (((x - $) >> 16) & 65536). */ + HOWTO (R_SH_IMM_MEDLOW16_PCREL, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + true, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_MEDLOW16_PCREL", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + true), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 32) & 65536). */ + HOWTO (R_SH_IMM_MEDHI16, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_MEDHI16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI (((x - $) >> 32) & 65536). */ + HOWTO (R_SH_IMM_MEDHI16_PCREL, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + true, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_MEDHI16_PCREL", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + true), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 48) & 65536). */ + HOWTO (R_SH_IMM_HI16, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_HI16", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false), /* pcrel_offset */ + + /* Used in MOVI and SHORI (((x - $) >> 48) & 65536). */ + HOWTO (R_SH_IMM_HI16_PCREL, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + true, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_HI16_PCREL", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + true), /* pcrel_offset */ + + /* For the .uaquad pseudo. */ + HOWTO (R_SH_64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_64", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + ((bfd_vma) 0) - 1, /* dst_mask */ + false), /* pcrel_offset */ + + /* For the .uaquad pseudo, (x - $). */ + HOWTO (R_SH_64_PCREL, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + true, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_64_PCREL", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + ((bfd_vma) 0) - 1, /* dst_mask */ + true), /* pcrel_offset */ + +}; + +/* This function is used for relocs which are only used for relaxing, + which the linker should otherwise ignore. */ + +static bfd_reloc_status_type +sh_elf64_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; +{ + if (output_bfd != NULL) + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; +} + +/* This function is used for normal relocs. This used to be like the COFF + function, and is almost certainly incorrect for other ELF targets. + + See sh_elf_reloc in elf32-sh.c for the original. */ + +static bfd_reloc_status_type +sh_elf64_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd, + error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol_in; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; +{ + unsigned long insn; + bfd_vma sym_value; + enum elf_sh_reloc_type r_type; + bfd_vma addr = reloc_entry->address; + bfd_byte *hit_data = addr + (bfd_byte *) data; + + r_type = (enum elf_sh_reloc_type) reloc_entry->howto->type; + + if (output_bfd != NULL) + { + /* Partial linking--do nothing. */ + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + if (symbol_in != NULL + && bfd_is_und_section (symbol_in->section)) + return bfd_reloc_undefined; + + if (bfd_is_com_section (symbol_in->section)) + sym_value = 0; + else + sym_value = (symbol_in->value + + symbol_in->section->output_section->vma + + symbol_in->section->output_offset); + + switch (r_type) + { + case R_SH_DIR32: + insn = bfd_get_32 (abfd, hit_data); + insn += sym_value + reloc_entry->addend; + bfd_put_32 (abfd, insn, hit_data); + break; + + default: + abort (); + break; + } + + return bfd_reloc_ok; +} + +/* This structure is used to map BFD reloc codes to SH ELF relocs. */ + +struct elf_reloc_map +{ + bfd_reloc_code_real_type bfd_reloc_val; + unsigned char elf_reloc_val; +}; + +/* An array mapping BFD reloc codes to SH ELF relocs. */ + +static const struct elf_reloc_map sh64_reloc_map[] = +{ + { BFD_RELOC_NONE, R_SH_NONE }, + { BFD_RELOC_32, R_SH_DIR32 }, + { BFD_RELOC_CTOR, R_SH_DIR32 }, + { BFD_RELOC_32_PCREL, R_SH_REL32 }, + { BFD_RELOC_8_PCREL, R_SH_SWITCH8 }, + { BFD_RELOC_SH_SWITCH16, R_SH_SWITCH16 }, + { BFD_RELOC_SH_SWITCH32, R_SH_SWITCH32 }, + { BFD_RELOC_VTABLE_INHERIT, R_SH_GNU_VTINHERIT }, + { BFD_RELOC_VTABLE_ENTRY, R_SH_GNU_VTENTRY }, + { BFD_RELOC_SH_GOT_LOW16, R_SH_GOT_LOW16 }, + { BFD_RELOC_SH_GOT_MEDLOW16, R_SH_GOT_MEDLOW16 }, + { BFD_RELOC_SH_GOT_MEDHI16, R_SH_GOT_MEDHI16 }, + { BFD_RELOC_SH_GOT_HI16, R_SH_GOT_HI16 }, + { BFD_RELOC_SH_GOTPLT_LOW16, R_SH_GOTPLT_LOW16 }, + { BFD_RELOC_SH_GOTPLT_MEDLOW16, R_SH_GOTPLT_MEDLOW16 }, + { BFD_RELOC_SH_GOTPLT_MEDHI16, R_SH_GOTPLT_MEDHI16 }, + { BFD_RELOC_SH_GOTPLT_HI16, R_SH_GOTPLT_HI16 }, + { BFD_RELOC_SH_PLT_LOW16, R_SH_PLT_LOW16 }, + { BFD_RELOC_SH_PLT_MEDLOW16, R_SH_PLT_MEDLOW16 }, + { BFD_RELOC_SH_PLT_MEDHI16, R_SH_PLT_MEDHI16 }, + { BFD_RELOC_SH_PLT_HI16, R_SH_PLT_HI16 }, + { BFD_RELOC_SH_GOTOFF_LOW16, R_SH_GOTOFF_LOW16 }, + { BFD_RELOC_SH_GOTOFF_MEDLOW16, R_SH_GOTOFF_MEDLOW16 }, + { BFD_RELOC_SH_GOTOFF_MEDHI16, R_SH_GOTOFF_MEDHI16 }, + { BFD_RELOC_SH_GOTOFF_HI16, R_SH_GOTOFF_HI16 }, + { BFD_RELOC_SH_GOTPC_LOW16, R_SH_GOTPC_LOW16 }, + { BFD_RELOC_SH_GOTPC_MEDLOW16, R_SH_GOTPC_MEDLOW16 }, + { BFD_RELOC_SH_GOTPC_MEDHI16, R_SH_GOTPC_MEDHI16 }, + { BFD_RELOC_SH_GOTPC_HI16, R_SH_GOTPC_HI16 }, + { BFD_RELOC_SH_COPY64, R_SH_COPY64 }, + { BFD_RELOC_SH_GLOB_DAT64, R_SH_GLOB_DAT64 }, + { BFD_RELOC_SH_JMP_SLOT64, R_SH_JMP_SLOT64 }, + { BFD_RELOC_SH_RELATIVE64, R_SH_RELATIVE64 }, + { BFD_RELOC_SH_GOT10BY4, R_SH_GOT10BY4 }, + { BFD_RELOC_SH_GOT10BY8, R_SH_GOT10BY8 }, + { BFD_RELOC_SH_GOTPLT10BY4, R_SH_GOTPLT10BY4 }, + { BFD_RELOC_SH_GOTPLT10BY8, R_SH_GOTPLT10BY8 }, + { BFD_RELOC_SH_PT_16, R_SH_PT_16 }, + { BFD_RELOC_SH_SHMEDIA_CODE, R_SH_SHMEDIA_CODE }, + { BFD_RELOC_SH_IMMU5, R_SH_DIR5U }, + { BFD_RELOC_SH_IMMS6, R_SH_DIR6S }, + { BFD_RELOC_SH_IMMU6, R_SH_DIR6U }, + { BFD_RELOC_SH_IMMS10, R_SH_DIR10S }, + { BFD_RELOC_SH_IMMS10BY2, R_SH_DIR10SW }, + { BFD_RELOC_SH_IMMS10BY4, R_SH_DIR10SL }, + { BFD_RELOC_SH_IMMS10BY8, R_SH_DIR10SQ }, + { BFD_RELOC_SH_IMMS16, R_SH_IMMS16 }, + { BFD_RELOC_SH_IMMU16, R_SH_IMMU16 }, + { BFD_RELOC_SH_IMM_LOW16, R_SH_IMM_LOW16 }, + { BFD_RELOC_SH_IMM_LOW16_PCREL, R_SH_IMM_LOW16_PCREL }, + { BFD_RELOC_SH_IMM_MEDLOW16, R_SH_IMM_MEDLOW16 }, + { BFD_RELOC_SH_IMM_MEDLOW16_PCREL, R_SH_IMM_MEDLOW16_PCREL }, + { BFD_RELOC_SH_IMM_MEDHI16, R_SH_IMM_MEDHI16 }, + { BFD_RELOC_SH_IMM_MEDHI16_PCREL, R_SH_IMM_MEDHI16_PCREL }, + { BFD_RELOC_SH_IMM_HI16, R_SH_IMM_HI16 }, + { BFD_RELOC_SH_IMM_HI16_PCREL, R_SH_IMM_HI16_PCREL }, + { BFD_RELOC_64, R_SH_64 }, + { BFD_RELOC_64_PCREL, R_SH_64_PCREL }, +}; + +/* Given a BFD reloc code, return the howto structure for the + corresponding SH ELf reloc. */ + +static reloc_howto_type * +sh_elf64_reloc_type_lookup (abfd, code) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + unsigned int i; + + for (i = 0; i < sizeof (sh64_reloc_map) / sizeof (struct elf_reloc_map); i++) + { + if (sh64_reloc_map[i].bfd_reloc_val == code) + return &sh_elf64_howto_table[(int) sh64_reloc_map[i].elf_reloc_val]; + } + + return NULL; +} + +/* Given an ELF reloc, fill in the howto field of a relent. + + See sh_elf_info_to_howto in elf32-sh.c for the original. */ + +static void +sh_elf64_info_to_howto (abfd, cache_ptr, dst) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *cache_ptr; + Elf_Internal_Rela *dst; +{ + unsigned int r; + + r = ELF64_R_TYPE (dst->r_info); + + BFD_ASSERT (r <= (unsigned int) R_SH_64_PCREL); + BFD_ASSERT (r < R_SH_FIRST_INVALID_RELOC || r > R_SH_LAST_INVALID_RELOC); + BFD_ASSERT (r < R_SH_DIR8WPN || r > R_SH_LAST_INVALID_RELOC_2); + BFD_ASSERT (r < R_SH_FIRST_INVALID_RELOC_3 || r > R_SH_GOTPLT32); + BFD_ASSERT (r < R_SH_FIRST_INVALID_RELOC_4 || r > R_SH_LAST_INVALID_RELOC_4); + + cache_ptr->howto = &sh_elf64_howto_table[r]; +} + +/* Relocate an SH ELF section. + + See sh_elf_info_to_howto in elf32-sh.c for the original. */ + +static boolean +sh_elf64_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; +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + Elf_Internal_Rela *rel, *relend; + bfd *dynobj; + bfd_vma *local_got_offsets; + asection *sgot; + asection *sgotplt; + asection *splt; + asection *sreloc; + bfd_vma disp, dropped; + + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + dynobj = elf_hash_table (info)->dynobj; + local_got_offsets = elf_local_got_offsets (input_bfd); + + sgot = NULL; + sgotplt = NULL; + splt = NULL; + sreloc = NULL; + + rel = relocs; + relend = relocs + input_section->reloc_count; + for (; rel < relend; rel++) + { + int r_type; + reloc_howto_type *howto; + unsigned long r_symndx; + Elf_Internal_Sym *sym; + asection *sec; + struct elf_link_hash_entry *h; + bfd_vma relocation; + bfd_vma addend = (bfd_vma)0; + bfd_reloc_status_type r; + int seen_stt_datalabel = 0; + + r_symndx = ELF64_R_SYM (rel->r_info); + + r_type = ELF64_R_TYPE (rel->r_info); + + if (r_type == (int) R_SH_NONE) + continue; + + if (r_type < 0 + || r_type > R_SH_64_PCREL + || (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 <= R_SH_GOTPLT32) + || (r_type >= (int) R_SH_FIRST_INVALID_RELOC_4 + && r_type <= (int) R_SH_LAST_INVALID_RELOC_4)) + { + bfd_set_error (bfd_error_bad_value); + return false; + } + + howto = sh_elf64_howto_table + r_type; + + /* This is a final link. */ + h = NULL; + sym = NULL; + sec = NULL; + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; + relocation = ((sec->output_section->vma + + sec->output_offset + + sym->st_value) + | ((sym->st_other & STO_SH5_ISA32) != 0)); + + /* A local symbol never has STO_SH5_ISA32, so we don't need + datalabel processing here. Make sure this does not change + without notice. */ + if ((sym->st_other & STO_SH5_ISA32) != 0) + ((*info->callbacks->reloc_dangerous) + (info, + _("Unexpected STO_SH5_ISA32 on local symbol is not handled"), + input_bfd, input_section, rel->r_offset)); + + if (info->relocateable) + { + /* This is a relocateable 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. */ + sym = local_syms + r_symndx; + if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) + goto final_link_relocate; + + continue; + } + } + else + { + /* Section symbols are never (?) placed in the hash table, so + we can just ignore hash relocations when creating a + relocateable object file. */ + if (info->relocateable) + continue; + + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + { + /* If the reference passes a symbol marked with + STT_DATALABEL, then any STO_SH5_ISA32 on the final value + doesn't count. */ + seen_stt_datalabel |= h->type == STT_DATALABEL; + h = (struct elf_link_hash_entry *) h->root.u.i.link; + } + + if (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + { + sec = h->root.u.def.section; + /* In these cases, we don't need the relocation value. + We check specially because in some obscure cases + sec->output_section will be NULL. */ + if (r_type == R_SH_GOTPC_LOW16 + || r_type == R_SH_GOTPC_MEDLOW16 + || r_type == R_SH_GOTPC_MEDHI16 + || r_type == R_SH_GOTPC_HI16 + || ((r_type == R_SH_PLT_LOW16 + || r_type == R_SH_PLT_MEDLOW16 + || r_type == R_SH_PLT_MEDHI16 + || r_type == R_SH_PLT_HI16) + && h->plt.offset != (bfd_vma) -1) + || ((r_type == R_SH_GOT_LOW16 + || r_type == R_SH_GOT_MEDLOW16 + || r_type == R_SH_GOT_MEDHI16 + || r_type == R_SH_GOT_HI16) + && elf_hash_table (info)->dynamic_sections_created + && (! info->shared + || (! info->symbolic && h->dynindx != -1) + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)) + /* The cases above are those in which relocation is + overwritten in the switch block below. The cases + below are those in which we must defer relocation + to run-time, because we can't resolve absolute + addresses when creating a shared library. */ + || (info->shared + && ((! info->symbolic && h->dynindx != -1) + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0) + && ((r_type == R_SH_64 + && !(ELF_ST_VISIBILITY (h->other) == STV_INTERNAL + || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN)) + || r_type == R_SH_64_PCREL) + && ((input_section->flags & SEC_ALLOC) != 0 + /* DWARF will emit R_SH_DIR32 relocations in its + sections against symbols defined externally + in shared libraries. We can't do anything + with them here. */ + || (input_section->flags & SEC_DEBUGGING) != 0))) + relocation = 0; + else if (sec->output_section == NULL) + { + (*_bfd_error_handler) + (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"), + bfd_get_filename (input_bfd), h->root.root.string, + bfd_get_section_name (input_bfd, input_section)); + relocation = 0; + } + else + relocation = ((h->root.u.def.value + + sec->output_section->vma + + sec->output_offset) + /* A STO_SH5_ISA32 causes a "bitor 1" to the + symbol value, unless we've seen + STT_DATALABEL on the way to it. */ + | ((h->other & STO_SH5_ISA32) != 0 + && ! seen_stt_datalabel)); + } + else if (h->root.type == bfd_link_hash_undefweak) + relocation = 0; + else if (info->shared && !info->symbolic && !info->no_undefined) + relocation = 0; + else + { + if (! ((*info->callbacks->undefined_symbol) + (info, h->root.root.string, input_bfd, + input_section, rel->r_offset, true))) + return false; + relocation = 0; + } + } + + disp = (relocation + - input_section->output_section->vma + - input_section->output_offset + - rel->r_offset); + dropped = 0; + switch ((int)r_type) + { + case R_SH_PT_16: dropped = disp & 2; break; + case R_SH_DIR10SW: dropped = disp & 1; break; + case R_SH_DIR10SL: dropped = disp & 3; break; + case R_SH_DIR10SQ: dropped = disp & 7; break; + } + if (dropped != 0) + { + (*_bfd_error_handler) + (_("%s: error: unaligned relocation type %d at %08x reloc %08x\n"), + bfd_get_filename (input_bfd), (int)r_type, (unsigned)rel->r_offset, (unsigned)relocation); + bfd_set_error (bfd_error_bad_value); + return false; + } + switch ((int)r_type) + { + case R_SH_64: + case R_SH_64_PCREL: + if (info->shared + && (input_section->flags & SEC_ALLOC) != 0 + && (r_type != R_SH_64_PCREL + || (h != NULL + && h->dynindx != -1 + && (! info->symbolic + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)))) + { + Elf_Internal_Rela outrel; + boolean skip, relocate; + + /* When generating a shared object, these relocations + are copied into the output file to be resolved at run + time. */ + + if (sreloc == NULL) + { + const char *name; + + name = (bfd_elf_string_from_elf_section + (input_bfd, + elf_elfheader (input_bfd)->e_shstrndx, + elf_section_data (input_section)->rel_hdr.sh_name)); + if (name == NULL) + return false; + + BFD_ASSERT (strncmp (name, ".rela", 5) == 0 + && strcmp (bfd_get_section_name (input_bfd, + input_section), + name + 5) == 0); + + sreloc = bfd_get_section_by_name (dynobj, name); + BFD_ASSERT (sreloc != NULL); + } + + skip = false; + relocate = false; + + outrel.r_offset + = _bfd_elf_section_offset (output_bfd, info, + input_section, rel->r_offset); + + if (outrel.r_offset == (bfd_vma) -1) + skip = true; + else if (outrel.r_offset == (bfd_vma) -2) + skip = true, relocate = true; + + outrel.r_offset += (input_section->output_section->vma + + input_section->output_offset); + + if (skip) + memset (&outrel, 0, sizeof outrel); + else if (r_type == R_SH_64_PCREL) + { + BFD_ASSERT (h != NULL && h->dynindx != -1); + outrel.r_info = ELF64_R_INFO (h->dynindx, R_SH_64_PCREL); + outrel.r_addend = rel->r_addend; + } + else + { + /* h->dynindx may be -1 if this symbol was marked to + become local. */ + if (h == NULL + || ((info->symbolic || h->dynindx == -1) + && (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) != 0)) + { + relocate = true; + outrel.r_info = ELF64_R_INFO (0, R_SH_RELATIVE64); + outrel.r_addend = relocation + rel->r_addend; + } + else + { + BFD_ASSERT (h->dynindx != -1); + outrel.r_info = ELF64_R_INFO (h->dynindx, R_SH_64); + outrel.r_addend = relocation + rel->r_addend; + } + } + + bfd_elf64_swap_reloca_out (output_bfd, &outrel, + (((Elf64_External_Rela *) + sreloc->contents) + + sreloc->reloc_count)); + ++sreloc->reloc_count; + + /* If this reloc is against an external symbol, we do + not want to fiddle with the addend. Otherwise, we + need to include the symbol value so that it becomes + an addend for the dynamic reloc. */ + if (! relocate) + continue; + } + else if (r_type == R_SH_64) + addend = rel->r_addend; + goto final_link_relocate; + + case R_SH_GOTPLT_LOW16: + case R_SH_GOTPLT_MEDLOW16: + case R_SH_GOTPLT_MEDHI16: + case R_SH_GOTPLT_HI16: + case R_SH_GOTPLT10BY4: + case R_SH_GOTPLT10BY8: + /* Relocation is to the entry for this symbol in the + procedure linkage table. */ + + if (h == NULL + || ELF_ST_VISIBILITY (h->other) == STV_INTERNAL + || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN + || ! info->shared + || info->symbolic + || h->dynindx == -1 + || h->plt.offset == (bfd_vma) -1 + || h->got.offset != (bfd_vma) -1) + goto force_got; + + /* Relocation is to the entry for this symbol in the global + offset table extension for the procedure linkage table. */ + if (sgotplt == NULL) + { + sgotplt = bfd_get_section_by_name (dynobj, ".got.plt"); + BFD_ASSERT (sgotplt != NULL); + } + + relocation = (sgotplt->output_offset + + ((h->plt.offset / elf_sh64_sizeof_plt (info) + - 1 + 3) * 8)); + + relocation -= GOT_BIAS; + + goto final_link_relocate; + + force_got: + case R_SH_GOT_LOW16: + case R_SH_GOT_MEDLOW16: + case R_SH_GOT_MEDHI16: + case R_SH_GOT_HI16: + case R_SH_GOT10BY4: + case R_SH_GOT10BY8: + /* Relocation is to the entry for this symbol in the global + offset table. */ + if (sgot == NULL) + { + sgot = bfd_get_section_by_name (dynobj, ".got"); + BFD_ASSERT (sgot != NULL); + } + + if (h != NULL) + { + bfd_vma off; + + off = h->got.offset; + if (seen_stt_datalabel) + { + struct elf_sh64_link_hash_entry *hsh; + + hsh = (struct elf_sh64_link_hash_entry *)h; + off = hsh->datalabel_got_offset; + } + BFD_ASSERT (off != (bfd_vma) -1); + + if (! elf_hash_table (info)->dynamic_sections_created + || (info->shared + && (info->symbolic || h->dynindx == -1 + || ELF_ST_VISIBILITY (h->other) == STV_INTERNAL + || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN) + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) + { + /* This is actually a static link, or it is a + -Bsymbolic link and the symbol is defined + locally, or the symbol was forced to be local + because of a version file. We must initialize + this entry in the global offset table. Since the + offset must always be a multiple of 4, we use the + least significant bit to record whether we have + initialized it already. + + When doing a dynamic link, we create a .rela.got + relocation entry to initialize the value. This + is done in the finish_dynamic_symbol routine. */ + if ((off & 1) != 0) + off &= ~1; + else + { + bfd_put_64 (output_bfd, relocation, + sgot->contents + off); + if (seen_stt_datalabel) + { + struct elf_sh64_link_hash_entry *hsh; + + hsh = (struct elf_sh64_link_hash_entry *)h; + hsh->datalabel_got_offset |= 1; + } + else + h->got.offset |= 1; + } + } + + relocation = sgot->output_offset + off; + } + else + { + bfd_vma off; + + if (rel->r_addend) + { + BFD_ASSERT (local_got_offsets != NULL + && (local_got_offsets[symtab_hdr->sh_info + + r_symndx] + != (bfd_vma) -1)); + + off = local_got_offsets[symtab_hdr->sh_info + + r_symndx]; + } + else + { + BFD_ASSERT (local_got_offsets != NULL + && local_got_offsets[r_symndx] != (bfd_vma) -1); + + off = local_got_offsets[r_symndx]; + } + + /* The offset must always be a multiple of 8. We use + the least significant bit to record whether we have + already generated the necessary reloc. */ + if ((off & 1) != 0) + off &= ~1; + else + { + bfd_put_64 (output_bfd, relocation, sgot->contents + off); + + if (info->shared) + { + asection *srelgot; + Elf_Internal_Rela outrel; + + srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); + BFD_ASSERT (srelgot != NULL); + + outrel.r_offset = (sgot->output_section->vma + + sgot->output_offset + + off); + outrel.r_info = ELF64_R_INFO (0, R_SH_RELATIVE64); + outrel.r_addend = relocation; + bfd_elf64_swap_reloca_out (output_bfd, &outrel, + (((Elf64_External_Rela *) + srelgot->contents) + + srelgot->reloc_count)); + ++srelgot->reloc_count; + } + + if (rel->r_addend) + local_got_offsets[symtab_hdr->sh_info + r_symndx] |= 1; + else + local_got_offsets[r_symndx] |= 1; + } + + relocation = sgot->output_offset + off; + } + + relocation -= GOT_BIAS; + + goto final_link_relocate; + + case R_SH_GOTOFF_LOW16: + case R_SH_GOTOFF_MEDLOW16: + case R_SH_GOTOFF_MEDHI16: + case R_SH_GOTOFF_HI16: + /* Relocation is relative to the start of the global offset + table. */ + + if (sgot == NULL) + { + sgot = bfd_get_section_by_name (dynobj, ".got"); + BFD_ASSERT (sgot != NULL); + } + + /* Note that sgot->output_offset is not involved in this + calculation. We always want the start of .got. If we + defined _GLOBAL_OFFSET_TABLE in a different way, as is + permitted by the ABI, we might have to change this + calculation. */ + relocation -= sgot->output_section->vma; + + relocation -= GOT_BIAS; + + addend = rel->r_addend; + + goto final_link_relocate; + + case R_SH_GOTPC_LOW16: + case R_SH_GOTPC_MEDLOW16: + case R_SH_GOTPC_MEDHI16: + case R_SH_GOTPC_HI16: + /* Use global offset table as symbol value. */ + + if (sgot == NULL) + { + sgot = bfd_get_section_by_name (dynobj, ".got"); + BFD_ASSERT (sgot != NULL); + } + + relocation = sgot->output_section->vma; + + relocation += GOT_BIAS; + + addend = rel->r_addend; + + goto final_link_relocate; + + case R_SH_PLT_LOW16: + case R_SH_PLT_MEDLOW16: + case R_SH_PLT_MEDHI16: + case R_SH_PLT_HI16: + /* Relocation is to the entry for this symbol in the + procedure linkage table. */ + + /* Resolve a PLT reloc against a local symbol directly, + without using the procedure linkage table. */ + if (h == NULL) + goto final_link_relocate; + + if (ELF_ST_VISIBILITY (h->other) == STV_INTERNAL + || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN) + goto final_link_relocate; + + if (h->plt.offset == (bfd_vma) -1) + { + /* We didn't make a PLT entry for this symbol. This + happens when statically linking PIC code, or when + using -Bsymbolic. */ + goto final_link_relocate; + } + + if (splt == NULL) + { + splt = bfd_get_section_by_name (dynobj, ".plt"); + BFD_ASSERT (splt != NULL); + } + + relocation = (splt->output_section->vma + + splt->output_offset + + h->plt.offset); + relocation++; + + addend = rel->r_addend; + + goto final_link_relocate; + + case R_SH_DIR32: + case R_SH_SHMEDIA_CODE: + case R_SH_PT_16: + case R_SH_DIR5U: + case R_SH_DIR6S: + case R_SH_DIR6U: + case R_SH_DIR10S: + case R_SH_DIR10SW: + case R_SH_DIR10SL: + case R_SH_DIR10SQ: + case R_SH_IMMS16: + case R_SH_IMMU16: + case R_SH_IMM_LOW16: + case R_SH_IMM_LOW16_PCREL: + case R_SH_IMM_MEDLOW16: + case R_SH_IMM_MEDLOW16_PCREL: + case R_SH_IMM_MEDHI16: + case R_SH_IMM_MEDHI16_PCREL: + case R_SH_IMM_HI16: + case R_SH_IMM_HI16_PCREL: + addend = rel->r_addend; + /* Fall through. */ + case R_SH_REL32: + final_link_relocate: + r = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, + relocation, addend); + break; + + default: + bfd_set_error (bfd_error_bad_value); + return false; + + } + + if (r != bfd_reloc_ok) + { + switch (r) + { + default: + case bfd_reloc_outofrange: + abort (); + case bfd_reloc_overflow: + { + const char *name; + + if (h != NULL) + name = h->root.root.string; + else + { + name = (bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name)); + if (name == NULL) + return false; + if (*name == '\0') + name = bfd_section_name (input_bfd, sec); + } + if (! ((*info->callbacks->reloc_overflow) + (info, name, howto->name, (bfd_vma) 0, + input_bfd, input_section, rel->r_offset))) + return false; + } + break; + } + } + } + + return true; +} + +/* This is a version of bfd_generic_get_relocated_section_contents + that uses sh_elf64_relocate_section. + + See sh_elf_relocate_section in elf32-sh.c for the original. */ + +static bfd_byte * +sh_elf64_get_relocated_section_contents (output_bfd, link_info, link_order, + data, relocateable, symbols) + bfd *output_bfd; + struct bfd_link_info *link_info; + struct bfd_link_order *link_order; + bfd_byte *data; + boolean relocateable; + asymbol **symbols; +{ + Elf_Internal_Shdr *symtab_hdr; + Elf_Internal_Shdr *shndx_hdr; + asection *input_section = link_order->u.indirect.section; + bfd *input_bfd = input_section->owner; + asection **sections = NULL; + Elf_Internal_Rela *internal_relocs = NULL; + Elf64_External_Sym *external_syms = NULL; + Elf_External_Sym_Shndx *shndx_buf = NULL; + Elf_External_Sym_Shndx *shndx; + Elf_Internal_Sym *internal_syms = NULL; + + /* We only need to handle the case of relaxing, or of having a + particular set of section contents, specially. */ + if (relocateable + || elf_section_data (input_section)->this_hdr.contents == NULL) + return bfd_generic_get_relocated_section_contents (output_bfd, link_info, + link_order, data, + relocateable, + symbols); + + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + shndx_hdr = &elf_tdata (input_bfd)->symtab_shndx_hdr; + + memcpy (data, elf_section_data (input_section)->this_hdr.contents, + input_section->_raw_size); + + if ((input_section->flags & SEC_RELOC) != 0 + && input_section->reloc_count > 0) + { + Elf_Internal_Sym *isymp; + asection **secpp; + Elf64_External_Sym *esym, *esymend; + bfd_size_type amt; + + if (symtab_hdr->contents != NULL) + external_syms = (Elf64_External_Sym *) symtab_hdr->contents; + else + { + amt = symtab_hdr->sh_info; + amt *= sizeof (Elf64_External_Sym); + + external_syms = (Elf64_External_Sym *) bfd_malloc (amt); + if (external_syms == NULL && symtab_hdr->sh_info > 0) + goto error_return; + + if (bfd_seek (input_bfd, symtab_hdr->sh_offset, SEEK_SET) != 0 + || (bfd_bread ((PTR) external_syms, amt, input_bfd) != amt)) + goto error_return; + } + + if (symtab_hdr->sh_info != 0 && shndx_hdr->sh_size != 0) + { + amt = symtab_hdr->sh_info; + amt *= sizeof (Elf_External_Sym_Shndx); + + shndx_buf = (Elf_External_Sym_Shndx *) bfd_malloc (amt); + if (shndx_buf == NULL) + goto error_return; + + if (bfd_seek (input_bfd, shndx_hdr->sh_offset, SEEK_SET) != 0 + || bfd_bread ((PTR) shndx_buf, amt, input_bfd) != amt) + goto error_return; + } + + internal_relocs = (_bfd_elf64_link_read_relocs + (input_bfd, input_section, (PTR) NULL, + (Elf_Internal_Rela *) NULL, false)); + if (internal_relocs == NULL) + goto error_return; + + internal_syms = ((Elf_Internal_Sym *) + bfd_malloc (symtab_hdr->sh_info + * sizeof (Elf_Internal_Sym))); + if (internal_syms == NULL && symtab_hdr->sh_info > 0) + goto error_return; + + sections = (asection **) bfd_malloc (symtab_hdr->sh_info + * sizeof (asection *)); + if (sections == NULL && symtab_hdr->sh_info > 0) + goto error_return; + + isymp = internal_syms; + secpp = sections; + esym = external_syms; + esymend = esym + symtab_hdr->sh_info; + shndx = shndx_buf; + for (; esym < esymend; + ++esym, ++isymp, ++secpp, shndx = (shndx ? shndx + 1 : NULL)) + { + asection *isec; + + bfd_elf64_swap_symbol_in (input_bfd, esym, shndx, isymp); + + if (isymp->st_shndx == SHN_UNDEF) + isec = bfd_und_section_ptr; + else if (isymp->st_shndx > 0 && isymp->st_shndx < SHN_LORESERVE) + isec = bfd_section_from_elf_index (input_bfd, isymp->st_shndx); + else if (isymp->st_shndx == SHN_ABS) + isec = bfd_abs_section_ptr; + else if (isymp->st_shndx == SHN_COMMON) + isec = bfd_com_section_ptr; + else + { + /* Who knows? */ + isec = NULL; + } + + *secpp = isec; + } + + if (! sh_elf64_relocate_section (output_bfd, link_info, input_bfd, + input_section, data, internal_relocs, + internal_syms, sections)) + goto error_return; + + if (sections != NULL) + free (sections); + sections = NULL; + if (internal_syms != NULL) + free (internal_syms); + internal_syms = NULL; + if (external_syms != NULL && symtab_hdr->contents == NULL) + free (external_syms); + external_syms = NULL; + if (internal_relocs != elf_section_data (input_section)->relocs) + free (internal_relocs); + internal_relocs = NULL; + } + + return data; + + error_return: + if (internal_relocs != NULL + && internal_relocs != elf_section_data (input_section)->relocs) + free (internal_relocs); + if (external_syms != NULL && symtab_hdr->contents == NULL) + free (external_syms); + if (internal_syms != NULL) + free (internal_syms); + if (sections != NULL) + free (sections); + return NULL; +} + +/* Set the SHF_SH5_ISA32 flag for ISA SHmedia code sections. */ + +boolean +sh64_elf64_fake_sections (output_bfd, elf_section_hdr, asect) + bfd *output_bfd ATTRIBUTE_UNUSED; + Elf_Internal_Shdr *elf_section_hdr; + asection *asect; +{ + /* Code sections can only contain SH64 code, so mark them as such. */ + if (bfd_get_section_flags (output_bfd, asect) & SEC_CODE) + elf_section_hdr->sh_flags |= SHF_SH5_ISA32; + + return true; +} + +static boolean +sh_elf64_set_mach_from_flags (abfd) + bfd *abfd; +{ + flagword flags = elf_elfheader (abfd)->e_flags; + + switch (flags & EF_SH_MACH_MASK) + { + case EF_SH5: + /* Just one, but keep the switch construct to make additions easy. */ + bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh5); + break; + + default: + bfd_set_error (bfd_error_wrong_format); + return false; + } + return true; +} + +/* Function to keep SH64 specific file flags. + + See sh64_elf_set_private_flags in elf32-sh64.c for the original. */ + +static boolean +sh_elf64_set_private_flags (abfd, flags) + bfd * abfd; + flagword flags; +{ + BFD_ASSERT (! elf_flags_init (abfd) + || elf_elfheader (abfd)->e_flags == flags); + + elf_elfheader (abfd)->e_flags = flags; + elf_flags_init (abfd) = true; + return sh_elf64_set_mach_from_flags (abfd); +} + +/* Copy the SHF_SH5_ISA32 attribute that we keep on all sections with + code, to keep attributes the same as for SHmedia in 32-bit ELF. */ + +static boolean +sh_elf64_copy_private_data_internal (ibfd, obfd) + bfd * ibfd; + bfd * obfd; +{ + Elf_Internal_Shdr **o_shdrp; + asection *isec; + asection *osec; + + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return true; + + o_shdrp = elf_elfsections (obfd); + for (osec = obfd->sections; osec; osec = osec->next) + { + int oIndex = ((struct bfd_elf_section_data *) elf_section_data (osec))->this_idx; + for (isec = ibfd->sections; isec; isec = isec->next) + { + if (strcmp (osec->name, isec->name) == 0) + { + /* Note that we're not disallowing mixing data and code. */ + if ((elf_section_data (isec)->this_hdr.sh_flags + & SHF_SH5_ISA32) != 0) + o_shdrp[oIndex]->sh_flags |= SHF_SH5_ISA32; + break; + } + } + } + + return sh_elf64_set_private_flags (obfd, elf_elfheader (ibfd)->e_flags); +} + +static boolean +sh_elf64_copy_private_data (ibfd, obfd) + bfd * ibfd; + bfd * obfd; +{ + return sh_elf64_copy_private_data_internal (ibfd, obfd); +} + +static boolean +sh_elf64_merge_private_data (ibfd, obfd) + bfd *ibfd; + bfd *obfd; +{ + flagword old_flags, new_flags; + + if (_bfd_generic_verify_endian_match (ibfd, obfd) == false) + return false; + + if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return true; + + if (bfd_get_arch_size (ibfd) != bfd_get_arch_size (obfd)) + { + const char *msg; + + if (bfd_get_arch_size (ibfd) == 32 + && bfd_get_arch_size (obfd) == 64) + msg = _("%s: compiled as 32-bit object and %s is 64-bit"); + else if (bfd_get_arch_size (ibfd) == 64 + && bfd_get_arch_size (obfd) == 32) + msg = _("%s: compiled as 64-bit object and %s is 32-bit"); + else + msg = _("%s: object size does not match that of target %s"); + + (*_bfd_error_handler) (msg, bfd_get_filename (ibfd), + bfd_get_filename (obfd)); + bfd_set_error (bfd_error_wrong_format); + return false; + } + + old_flags = elf_elfheader (obfd)->e_flags; + new_flags = elf_elfheader (ibfd)->e_flags; + if (! elf_flags_init (obfd)) + { + /* This happens when ld starts out with a 'blank' output file. */ + elf_flags_init (obfd) = true; + elf_elfheader (obfd)->e_flags = old_flags = new_flags; + } + /* We don't allow linking in anything else than SH64 code, and since + this is a 64-bit ELF, we assume the 64-bit ABI is used. Add code + here as things change. */ + else if ((new_flags & EF_SH_MACH_MASK) != EF_SH5) + { + (*_bfd_error_handler) + ("%s: does not use the SH64 64-bit ABI as previous modules do", + bfd_get_filename (ibfd)); + bfd_set_error (bfd_error_bad_value); + return false; + } + + sh_elf64_copy_private_data_internal (ibfd, obfd); + + /* I can't think of anything sane other than old_flags being EF_SH5 and + that we need to preserve that. */ + elf_elfheader (obfd)->e_flags = old_flags; + + return sh_elf64_set_mach_from_flags (obfd); +} + +/* Return the section that should be marked against GC for a given + relocation. */ + +static asection * +sh_elf64_gc_mark_hook (abfd, info, rel, h, sym) + bfd *abfd; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + Elf_Internal_Rela *rel; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; +{ + if (h != NULL) + { + switch (ELF64_R_TYPE (rel->r_info)) + { + case R_SH_GNU_VTINHERIT: + case R_SH_GNU_VTENTRY: + break; + + default: + switch (h->root.type) + { + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + return h->root.u.def.section; + + case bfd_link_hash_common: + return h->root.u.c.p->section; + + default: + break; + } + } + } + else + { + if (!(elf_bad_symtab (abfd) + && ELF_ST_BIND (sym->st_info) != STB_LOCAL) + && ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE) + && sym->st_shndx != SHN_COMMON)) + return bfd_section_from_elf_index (abfd, sym->st_shndx); + } + + return NULL; +} + +/* Update the got entry reference counts for the section being removed. */ + +static boolean +sh_elf64_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; +{ + /* No got and plt entries for 64-bit SH at present. */ + return true; +} + +/* Look through the relocs for a section during the first phase. + Since we don't do .gots or .plts, we just need to consider the + virtual table relocs for gc. */ + +static boolean +sh_elf64_check_relocs (abfd, info, sec, 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, **sym_hashes_end; + const Elf_Internal_Rela *rel; + const Elf_Internal_Rela *rel_end; + bfd *dynobj; + bfd_vma *local_got_offsets; + asection *sgot; + asection *srelgot; + asection *sreloc; + + sgot = NULL; + srelgot = NULL; + sreloc = NULL; + + if (info->relocateable) + 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); + if (!elf_bad_symtab (abfd)) + sym_hashes_end -= symtab_hdr->sh_info; + + dynobj = elf_hash_table (info)->dynobj; + local_got_offsets = elf_local_got_offsets (abfd); + + rel_end = relocs + sec->reloc_count; + for (rel = relocs; rel < rel_end; rel++) + { + struct elf_link_hash_entry *h; + unsigned long r_symndx; + + r_symndx = ELF64_R_SYM (rel->r_info); + if (r_symndx < symtab_hdr->sh_info) + h = NULL; + else + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + + /* Some relocs require a global offset table. */ + if (dynobj == NULL) + { + switch (ELF64_R_TYPE (rel->r_info)) + { + case R_SH_GOTPLT_LOW16: + case R_SH_GOTPLT_MEDLOW16: + case R_SH_GOTPLT_MEDHI16: + case R_SH_GOTPLT_HI16: + case R_SH_GOTPLT10BY4: + case R_SH_GOTPLT10BY8: + case R_SH_GOT_LOW16: + case R_SH_GOT_MEDLOW16: + case R_SH_GOT_MEDHI16: + case R_SH_GOT_HI16: + case R_SH_GOT10BY4: + case R_SH_GOT10BY8: + case R_SH_GOTOFF_LOW16: + case R_SH_GOTOFF_MEDLOW16: + case R_SH_GOTOFF_MEDHI16: + case R_SH_GOTOFF_HI16: + case R_SH_GOTPC_LOW16: + case R_SH_GOTPC_MEDLOW16: + case R_SH_GOTPC_MEDHI16: + case R_SH_GOTPC_HI16: + elf_hash_table (info)->dynobj = dynobj = abfd; + if (! _bfd_elf_create_got_section (dynobj, info)) + return false; + break; + + default: + break; + } + } + + switch (ELF64_R_TYPE (rel->r_info)) + { + /* This relocation describes the C++ object vtable hierarchy. + Reconstruct it for later use during GC. */ + case R_SH_GNU_VTINHERIT: + if (!_bfd_elf64_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) + return false; + break; + + /* This relocation describes which C++ vtable entries are actually + used. Record for later use during GC. */ + case R_SH_GNU_VTENTRY: + if (!_bfd_elf64_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + return false; + break; + + force_got: + case R_SH_GOT_LOW16: + case R_SH_GOT_MEDLOW16: + case R_SH_GOT_MEDHI16: + case R_SH_GOT_HI16: + case R_SH_GOT10BY4: + case R_SH_GOT10BY8: + /* This symbol requires a global offset table entry. */ + + if (sgot == NULL) + { + sgot = bfd_get_section_by_name (dynobj, ".got"); + BFD_ASSERT (sgot != NULL); + } + + if (srelgot == NULL + && (h != NULL || info->shared)) + { + srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); + if (srelgot == NULL) + { + srelgot = bfd_make_section (dynobj, ".rela.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; + } + } + + if (h != NULL) + { + if (h->type == STT_DATALABEL) + { + struct elf_sh64_link_hash_entry *hsh; + + h = (struct elf_link_hash_entry *) h->root.u.i.link; + hsh = (struct elf_sh64_link_hash_entry *)h; + if (hsh->datalabel_got_offset != (bfd_vma) -1) + break; + + hsh->datalabel_got_offset = sgot->_raw_size; + } + else + { + 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_elf64_link_record_dynamic_symbol (info, h)) + return false; + } + + srelgot->_raw_size += sizeof (Elf64_External_Rela); + } + else + { + /* This is a global offset table entry for a local + symbol. */ + if (local_got_offsets == NULL) + { + size_t size; + register unsigned int i; + + size = symtab_hdr->sh_info * sizeof (bfd_vma); + /* Reserve space for both the datalabel and + codelabel local GOT offsets. */ + size *= 2; + local_got_offsets = (bfd_vma *) bfd_alloc (abfd, size); + if (local_got_offsets == 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; + for (; i < 2 * symtab_hdr->sh_info; i++) + local_got_offsets[i] = (bfd_vma) -1; + } + if ((rel->r_addend & 1) != 0) + { + if (local_got_offsets[symtab_hdr->sh_info + + r_symndx] != (bfd_vma) -1) + { + /* We have already allocated space in the .got. */ + break; + } + local_got_offsets[symtab_hdr->sh_info + + r_symndx] = sgot->_raw_size; + } + else + { + 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_SH_RELATIVE reloc so that the dynamic + linker can adjust this GOT entry. */ + srelgot->_raw_size += sizeof (Elf64_External_Rela); + } + } + + sgot->_raw_size += 8; + + break; + + case R_SH_GOTPLT_LOW16: + case R_SH_GOTPLT_MEDLOW16: + case R_SH_GOTPLT_MEDHI16: + case R_SH_GOTPLT_HI16: + case R_SH_GOTPLT10BY4: + case R_SH_GOTPLT10BY8: + /* If this is a local symbol, we resolve it directly without + creating a procedure linkage table entry. */ + + if (h == NULL + || ELF_ST_VISIBILITY (h->other) == STV_INTERNAL + || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN + || ! info->shared + || info->symbolic + || h->dynindx == -1 + || h->got.offset != (bfd_vma) -1) + goto force_got; + + /* Make sure this symbol is output as a dynamic symbol. */ + if (h->dynindx == -1) + { + if (! bfd_elf64_link_record_dynamic_symbol (info, h)) + return false; + } + + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + + break; + + case R_SH_PLT_LOW16: + case R_SH_PLT_MEDLOW16: + case R_SH_PLT_MEDHI16: + case R_SH_PLT_HI16: + /* 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; + + if (ELF_ST_VISIBILITY (h->other) == STV_INTERNAL + || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN) + break; + + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + + break; + + case R_SH_64: + case R_SH_64_PCREL: + if (h != NULL) + h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF; + + /* 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 + into the shared library. However, if we are linking with + -Bsymbolic, we do not need to copy a reloc against a + global symbol which is defined in an object we are + including in the link (i.e., DEF_REGULAR is set). At + this point we have not seen all the input files, so it is + 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. */ + if (info->shared + && (sec->flags & SEC_ALLOC) != 0 + && (ELF32_R_TYPE (rel->r_info) != R_SH_64_PCREL + || (h != NULL + && (! info->symbolic + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)))) + { + /* 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. */ + if (sreloc == NULL) + { + const char *name; + + name = (bfd_elf_string_from_elf_section + (abfd, + elf_elfheader (abfd)->e_shstrndx, + elf_section_data (sec)->rel_hdr.sh_name)); + if (name == NULL) + return false; + + BFD_ASSERT (strncmp (name, ".rela", 5) == 0 + && strcmp (bfd_get_section_name (abfd, sec), + name + 5) == 0); + + sreloc = bfd_get_section_by_name (dynobj, name); + if (sreloc == NULL) + { + flagword flags; + + sreloc = bfd_make_section (dynobj, name); + flags = (SEC_HAS_CONTENTS | SEC_READONLY + | SEC_IN_MEMORY | SEC_LINKER_CREATED); + if ((sec->flags & SEC_ALLOC) != 0) + flags |= SEC_ALLOC | SEC_LOAD; + if (sreloc == NULL + || ! bfd_set_section_flags (dynobj, sreloc, flags) + || ! bfd_set_section_alignment (dynobj, sreloc, 2)) + return false; + } + } + + sreloc->_raw_size += sizeof (Elf64_External_Rela); + + /* 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_sh linker + hash table, which means that h is really a pointer to + an elf_sh_link_hash_entry. */ + if (h != NULL && info->symbolic + && ELF64_R_TYPE (rel->r_info) == R_SH_64_PCREL) + { + struct elf_sh64_link_hash_entry *eh; + struct elf_sh64_pcrel_relocs_copied *p; + + eh = (struct elf_sh64_link_hash_entry *) h; + + for (p = eh->pcrel_relocs_copied; p != NULL; p = p->next) + if (p->section == sreloc) + break; + + if (p == NULL) + { + p = ((struct elf_sh64_pcrel_relocs_copied *) + bfd_alloc (dynobj, 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; + } + } + + break; + } + } + + return true; +} + +static int +sh64_elf64_get_symbol_type (elf_sym, type) + Elf_Internal_Sym * elf_sym; + int type; +{ + if (ELF_ST_TYPE (elf_sym->st_info) == STT_DATALABEL) + return STT_DATALABEL; + + return type; +} + +/* FIXME: This is a copy of sh64_elf_add_symbol_hook in elf32-sh64.c. + Either file can presumably exist without the other, but do not differ + in elf-size-ness. How to share? + + Hook called by the linker routine which adds symbols from an object + file. We must make indirect symbols for undefined symbols marked with + STT_DATALABEL, so relocations passing them will pick up that attribute + and neutralize STO_SH5_ISA32 found on the symbol definition. + + There is a problem, though: We want to fill in the hash-table entry for + this symbol and signal to the caller that no further processing is + needed. But we don't have the index for this hash-table entry. We + rely here on that the current entry is the first hash-entry with NULL, + which seems brittle. Also, iterating over the hash-table to find that + entry is a linear operation on the number of symbols in this input + file, and this function should take constant time, so that's not good + too. Only comfort is that DataLabel references should only be found in + hand-written assembly code and thus be rare. FIXME: Talk maintainers + into adding an option to elf_add_symbol_hook (preferably) for the index + or the hash entry, alternatively adding the index to Elf_Internal_Sym + (not so good). */ + +static boolean +sh64_elf64_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; + flagword *flagsp ATTRIBUTE_UNUSED; + asection **secp; + bfd_vma *valp; +{ + /* We want to do this for relocatable as well as final linking. */ + if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL) + { + struct elf_link_hash_entry *h; + + /* For relocateable links, we register the DataLabel sym in its own + right, and tweak the name when it's output. Otherwise, we make + an indirect symbol of it. */ + flagword flags + = info->relocateable || info->emitrelocations + ? BSF_GLOBAL : BSF_GLOBAL | BSF_INDIRECT; + + char *dl_name + = bfd_malloc (strlen (*namep) + sizeof (DATALABEL_SUFFIX)); + struct elf_link_hash_entry ** sym_hash = elf_sym_hashes (abfd); + + BFD_ASSERT (sym_hash != NULL); + + /* Allocation may fail. */ + if (dl_name == NULL) + return false; + + strcpy (dl_name, *namep); + strcat (dl_name, DATALABEL_SUFFIX); + + h = (struct elf_link_hash_entry *) + bfd_link_hash_lookup (info->hash, dl_name, false, false, false); + + if (h == NULL) + { + /* No previous datalabel symbol. Make one. */ + if (! _bfd_generic_link_add_one_symbol (info, abfd, dl_name, + flags, *secp, *valp, + *namep, false, + get_elf_backend_data (abfd)->collect, + (struct bfd_link_hash_entry **) &h)) + { + free (dl_name); + return false; + } + + h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF; + h->type = STT_DATALABEL; + } + else + /* If a new symbol was created, it holds the allocated name. + Otherwise, we don't need it anymore and should deallocate it. */ + free (dl_name); + + if (h->type != STT_DATALABEL + || ((info->relocateable || info->emitrelocations) + && h->root.type != bfd_link_hash_undefined) + || (! info->relocateable && !info->emitrelocations + && h->root.type != bfd_link_hash_indirect)) + { + /* Make sure we don't get confused on invalid input. */ + (*_bfd_error_handler) + (_("%s: encountered datalabel symbol in input"), + bfd_get_filename (abfd)); + bfd_set_error (bfd_error_bad_value); + return false; + } + + /* Now find the hash-table slot for this entry and fill it in. */ + while (*sym_hash != NULL) + sym_hash++; + *sym_hash = h; + + /* Signal to caller to skip this symbol - we've handled it. */ + *namep = NULL; + } + + return true; +} + +/* This hook function is called before the linker writes out a global + symbol. For relocatable links, DataLabel symbols will be present in + linker output. We cut off the special suffix on those symbols, so the + right name appears in the output. + + When linking and emitting relocations, there can appear global symbols + that are not referenced by relocs, but rather only implicitly through + DataLabel references, a relation that is not visible to the linker. + Since no stripping of global symbols in done when doing such linking, + we don't need to look up and make sure to emit the main symbol for each + DataLabel symbol. */ + +boolean +sh64_elf64_link_output_symbol_hook (abfd, info, cname, sym, input_sec) + bfd *abfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info; + const char *cname; + Elf_Internal_Sym *sym; + asection *input_sec ATTRIBUTE_UNUSED; +{ + char *name = (char *) cname; + + if (info->relocateable || info->emitrelocations) + { + if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL) + name[strlen (name) - strlen (DATALABEL_SUFFIX)] = 0; + } + + return true; +} + +/* Set bit 0 on the entry address; it always points to SHmedia code. This + is mostly for symmetry with the 32-bit format, where code can be + SHcompact and we need to make a distinction to make sure execution + starts in the right ISA mode. It is also convenient for a loader, + which would otherwise have to set this bit when loading a TR register + before jumping to the program entry. */ + +static void +sh64_elf64_final_write_processing (abfd, linker) + bfd *abfd; + boolean linker ATTRIBUTE_UNUSED; +{ + /* FIXME: Perhaps we shouldn't do this if the entry address was supplied + numerically, but we currently lack the infrastructure to recognize + that: The entry symbol, and info whether it is numeric or a symbol + name is kept private in the linker. */ + if (elf_elfheader (abfd)->e_type == ET_EXEC) + elf_elfheader (abfd)->e_entry |= 1; +} + +/* First entry in an absolute procedure linkage table look like this. */ + +static const bfd_byte elf_sh64_plt0_entry_be[PLT_ENTRY_SIZE] = +{ + 0xcc, 0x00, 0x01, 0x10, /* movi .got.plt >> 48, r17 */ + 0xc8, 0x00, 0x01, 0x10, /* shori (.got.plt >> 32) & 65535, r17 */ + 0xc8, 0x00, 0x01, 0x10, /* shori (.got.plt >> 16) & 65535, r17 */ + 0xc8, 0x00, 0x01, 0x10, /* shori .got.plt & 65535, r17 */ + 0x8d, 0x10, 0x09, 0x90, /* ld.q r17, 16, r25 */ + 0x6b, 0xf1, 0x46, 0x00, /* ptabs r17, tr0 */ + 0x8d, 0x10, 0x05, 0x10, /* ld.q r17, 8, r17 */ + 0x44, 0x01, 0xff, 0xf0, /* blink tr0, r63 */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ +}; + +static const bfd_byte elf_sh64_plt0_entry_le[PLT_ENTRY_SIZE] = +{ + 0x10, 0x01, 0x00, 0xcc, /* movi .got.plt >> 16, r17 */ + 0x10, 0x01, 0x00, 0xc8, /* shori (.got.plt >> 32) & 65535, r17 */ + 0x10, 0x01, 0x00, 0xc8, /* shori (.got.plt >> 16) & 65535, r17 */ + 0x10, 0x01, 0x00, 0xc8, /* shori .got.plt & 65535, r17 */ + 0x90, 0x09, 0x10, 0x8d, /* ld.q r17, 16, r25 */ + 0x00, 0x46, 0xf1, 0x6b, /* ptabs r17, tr0 */ + 0x10, 0x05, 0x10, 0x8d, /* ld.q r17, 8, r17 */ + 0xf0, 0xff, 0x01, 0x44, /* blink tr0, r63 */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ +}; + +/* Sebsequent entries in an absolute procedure linkage table look like + this. */ + +static const bfd_byte elf_sh64_plt_entry_be[PLT_ENTRY_SIZE] = +{ + 0xcc, 0x00, 0x01, 0x90, /* movi nameN-in-GOT >> 48, r25 */ + 0xc8, 0x00, 0x01, 0x90, /* shori (nameN-in-GOT >> 32) & 65535, r25 */ + 0xc8, 0x00, 0x01, 0x90, /* shori (nameN-in-GOT >> 16) & 65535, r25 */ + 0xc8, 0x00, 0x01, 0x90, /* shori nameN-in-GOT & 65535, r25 */ + 0x8d, 0x90, 0x01, 0x90, /* ld.q r25, 0, r25 */ + 0x6b, 0xf1, 0x66, 0x00, /* ptabs r25, tr0 */ + 0x44, 0x01, 0xff, 0xf0, /* blink tr0, r63 */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0xcc, 0x00, 0x01, 0x90, /* movi .PLT0 >> 16, r25 */ + 0xc8, 0x00, 0x01, 0x90, /* shori .PLT0 & 65535, r25 */ + 0x6b, 0xf1, 0x66, 0x00, /* ptabs r25, tr0 */ + 0xcc, 0x00, 0x01, 0x50, /* movi reloc-offset >> 16, r21 */ + 0xc8, 0x00, 0x01, 0x50, /* shori reloc-offset & 65535, r21 */ + 0x44, 0x01, 0xff, 0xf0, /* blink tr0, r63 */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ +}; + +static const bfd_byte elf_sh64_plt_entry_le[PLT_ENTRY_SIZE] = +{ + 0x90, 0x01, 0x00, 0xcc, /* movi nameN-in-GOT >> 16, r25 */ + 0x90, 0x01, 0x00, 0xc8, /* shori nameN-in-GOT & 65535, r25 */ + 0x90, 0x01, 0x00, 0xc8, /* shori nameN-in-GOT & 65535, r25 */ + 0x90, 0x01, 0x00, 0xc8, /* shori nameN-in-GOT & 65535, r25 */ + 0x90, 0x01, 0x90, 0x8d, /* ld.q r25, 0, r25 */ + 0x00, 0x66, 0xf1, 0x6b, /* ptabs r25, tr0 */ + 0xf0, 0xff, 0x01, 0x44, /* blink tr0, r63 */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0x90, 0x01, 0x00, 0xcc, /* movi .PLT0 >> 16, r25 */ + 0x90, 0x01, 0x00, 0xc8, /* shori .PLT0 & 65535, r25 */ + 0x00, 0x66, 0xf1, 0x6b, /* ptabs r25, tr0 */ + 0x50, 0x01, 0x00, 0xcc, /* movi reloc-offset >> 16, r21 */ + 0x50, 0x01, 0x00, 0xc8, /* shori reloc-offset & 65535, r21 */ + 0xf0, 0xff, 0x01, 0x44, /* blink tr0, r63 */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ +}; + +/* Entries in a PIC procedure linkage table look like this. */ + +static const bfd_byte elf_sh64_pic_plt_entry_be[PLT_ENTRY_SIZE] = +{ + 0xcc, 0x00, 0x01, 0x90, /* movi nameN@GOT >> 16, r25 */ + 0xc8, 0x00, 0x01, 0x90, /* shori nameN@GOT & 65535, r25 */ + 0x40, 0xc3, 0x65, 0x90, /* ldx.q r12, r25, r25 */ + 0x6b, 0xf1, 0x66, 0x00, /* ptabs r25, tr0 */ + 0x44, 0x01, 0xff, 0xf0, /* blink tr0, r63 */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0xce, 0x00, 0x01, 0x10, /* movi -GOT_BIAS, r17 */ + 0x00, 0xcb, 0x45, 0x10, /* sub r12, r17, r17 */ + 0x8d, 0x10, 0x09, 0x90, /* ld.q r17, 16, r25 */ + 0x6b, 0xf1, 0x66, 0x00, /* ptabs r25, tr0 */ + 0x8d, 0x10, 0x05, 0x10, /* ld.q r17, 8, r17 */ + 0xcc, 0x00, 0x01, 0x50, /* movi reloc-offset >> 16, r21 */ + 0xc8, 0x00, 0x01, 0x50, /* shori reloc-offset & 65535, r21 */ + 0x44, 0x01, 0xff, 0xf0, /* blink tr0, r63 */ +}; + +static const bfd_byte elf_sh64_pic_plt_entry_le[PLT_ENTRY_SIZE] = +{ + 0x90, 0x01, 0x00, 0xcc, /* movi nameN@GOT >> 16, r25 */ + 0x90, 0x01, 0x00, 0xc8, /* shori nameN@GOT & 65535, r25 */ + 0x90, 0x65, 0xc3, 0x40, /* ldx.q r12, r25, r25 */ + 0x00, 0x66, 0xf1, 0x6b, /* ptabs r25, tr0 */ + 0xf0, 0xff, 0x01, 0x44, /* blink tr0, r63 */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0x10, 0x01, 0x00, 0xce, /* movi -GOT_BIAS, r17 */ + 0x10, 0x45, 0xcb, 0x00, /* sub r12, r17, r17 */ + 0x90, 0x09, 0x10, 0x8d, /* ld.q r17, 16, r25 */ + 0x00, 0x66, 0xf1, 0x6b, /* ptabs r25, tr0 */ + 0x10, 0x05, 0x10, 0x8d, /* ld.q r17, 8, r17 */ + 0x50, 0x01, 0x00, 0xcc, /* movi reloc-offset >> 16, r21 */ + 0x50, 0x01, 0x00, 0xc8, /* shori reloc-offset & 65535, r21 */ + 0xf0, 0xff, 0x01, 0x44, /* blink tr0, r63 */ +}; + +static const bfd_byte *elf_sh64_plt0_entry; +static const bfd_byte *elf_sh64_plt_entry; +static const bfd_byte *elf_sh64_pic_plt_entry; + +/* Create an entry in an sh ELF linker hash table. */ + +static struct bfd_hash_entry * +sh64_elf64_link_hash_newfunc (entry, table, string) + struct bfd_hash_entry *entry; + struct bfd_hash_table *table; + const char *string; +{ + struct elf_sh64_link_hash_entry *ret = + (struct elf_sh64_link_hash_entry *) entry; + + /* Allocate the structure if it has not already been allocated by a + subclass. */ + if (ret == (struct elf_sh64_link_hash_entry *) NULL) + ret = ((struct elf_sh64_link_hash_entry *) + bfd_hash_allocate (table, + sizeof (struct elf_sh64_link_hash_entry))); + if (ret == (struct elf_sh64_link_hash_entry *) NULL) + return (struct bfd_hash_entry *) ret; + + /* Call the allocation method of the superclass. */ + ret = ((struct elf_sh64_link_hash_entry *) + _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, + table, string)); + if (ret != (struct elf_sh64_link_hash_entry *) NULL) + { + ret->pcrel_relocs_copied = NULL; + ret->datalabel_got_offset = (bfd_vma) -1; + } + + return (struct bfd_hash_entry *) ret; +} + +/* Create an sh64 ELF linker hash table. */ + +static struct bfd_link_hash_table * +sh64_elf64_link_hash_table_create (abfd) + bfd *abfd; +{ + struct elf_sh64_link_hash_table *ret; + + ret = ((struct elf_sh64_link_hash_table *) + bfd_alloc (abfd, sizeof (struct elf_sh64_link_hash_table))); + if (ret == (struct elf_sh64_link_hash_table *) NULL) + return NULL; + + if (! _bfd_elf_link_hash_table_init (&ret->root, abfd, + sh64_elf64_link_hash_newfunc)) + { + bfd_release (abfd, ret); + return NULL; + } + + return &ret->root.root; +} + +inline static void +movi_shori_putval (output_bfd, value, addr) + bfd *output_bfd; + unsigned long value; + char *addr; +{ + bfd_put_32 (output_bfd, + bfd_get_32 (output_bfd, addr) + | ((value >> 6) & 0x3fffc00), + addr); + bfd_put_32 (output_bfd, + bfd_get_32 (output_bfd, addr + 4) + | ((value << 10) & 0x3fffc00), + addr + 4); +} + +inline static void +movi_3shori_putval (output_bfd, value, addr) + bfd *output_bfd; + bfd_vma value; + char *addr; +{ + bfd_put_32 (output_bfd, + bfd_get_32 (output_bfd, addr) + | ((value >> 38) & 0x3fffc00), + addr); + bfd_put_32 (output_bfd, + bfd_get_32 (output_bfd, addr + 4) + | ((value >> 22) & 0x3fffc00), + addr + 4); + bfd_put_32 (output_bfd, + bfd_get_32 (output_bfd, addr + 8) + | ((value >> 6) & 0x3fffc00), + addr + 8); + bfd_put_32 (output_bfd, + bfd_get_32 (output_bfd, addr + 12) + | ((value << 10) & 0x3fffc00), + addr + 12); +} + +/* Create dynamic sections when linking against a dynamic object. */ + +static boolean +sh64_elf64_create_dynamic_sections (abfd, info) + bfd *abfd; + struct bfd_link_info *info; +{ + flagword flags, pltflags; + register asection *s; + struct elf_backend_data *bed = get_elf_backend_data (abfd); + int ptralign = 0; + + switch (bed->s->arch_size) + { + case 32: + ptralign = 2; + break; + + case 64: + ptralign = 3; + break; + + default: + bfd_set_error (bfd_error_bad_value); + return false; + } + + /* We need to create .plt, .rel[a].plt, .got, .got.plt, .dynbss, and + .rel[a].bss sections. */ + + flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_LINKER_CREATED); + + pltflags = flags; + pltflags |= SEC_CODE; + if (bed->plt_not_loaded) + pltflags &= ~ (SEC_LOAD | SEC_HAS_CONTENTS); + if (bed->plt_readonly) + pltflags |= SEC_READONLY; + + s = bfd_make_section (abfd, ".plt"); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, pltflags) + || ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) + return false; + + if (bed->want_plt_sym) + { + /* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the + .plt section. */ + struct elf_link_hash_entry *h = 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))) + return false; + h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; + h->type = STT_OBJECT; + + if (info->shared + && ! _bfd_elf_link_record_dynamic_symbol (info, h)) + return false; + } + + s = bfd_make_section (abfd, + bed->default_use_rela_p ? ".rela.plt" : ".rel.plt"); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) + || ! bfd_set_section_alignment (abfd, s, ptralign)) + return false; + + if (! _bfd_elf_create_got_section (abfd, info)) + return false; + + { + const char *secname; + char *relname; + flagword secflags; + asection *sec; + + for (sec = abfd->sections; sec; sec = sec->next) + { + secflags = bfd_get_section_flags (abfd, sec); + if ((secflags & (SEC_DATA | SEC_LINKER_CREATED)) + || ((secflags & SEC_HAS_CONTENTS) != SEC_HAS_CONTENTS)) + continue; + secname = bfd_get_section_name (abfd, sec); + relname = (char *) bfd_malloc (strlen (secname) + 6); + strcpy (relname, ".rela"); + strcat (relname, secname); + s = bfd_make_section (abfd, relname); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) + || ! bfd_set_section_alignment (abfd, s, ptralign)) + return false; + } + } + + if (bed->want_dynbss) + { + /* The .dynbss section is a place to put symbols which are defined + by dynamic objects, are referenced by regular objects, and are + not functions. We must allocate space for them in the process + image and use a R_*_COPY reloc to tell the dynamic linker to + initialize them at run time. The linker script puts the .dynbss + section into the .bss section of the final image. */ + s = bfd_make_section (abfd, ".dynbss"); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, SEC_ALLOC)) + return false; + + /* The .rel[a].bss section holds copy relocs. This section is not + normally needed. We need to create it here, though, so that the + linker will map it to an output section. We can't just create it + only if we need it, because we will not know whether we need it + until we have seen all the input files, and the first time the + main linker code calls BFD after examining all the input files + (size_dynamic_sections) the input sections have already been + mapped to the output sections. If the section turns out not to + be needed, we can discard it later. We will never need this + section when generating a shared object, since they do not use + copy relocs. */ + if (! info->shared) + { + s = bfd_make_section (abfd, + (bed->default_use_rela_p + ? ".rela.bss" : ".rel.bss")); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) + || ! bfd_set_section_alignment (abfd, s, ptralign)) + return false; + } + } + + return true; +} + +/* Adjust a symbol defined by a dynamic object and referenced by a + regular object. The current definition is in some section of the + dynamic object, but we're not including those sections. We have to + change the definition to something the rest of the link can + understand. */ + +static boolean +sh64_elf64_adjust_dynamic_symbol (info, h) + struct bfd_link_info *info; + struct elf_link_hash_entry *h; +{ + bfd *dynobj; + asection *s; + unsigned int power_of_two; + + dynobj = elf_hash_table (info)->dynobj; + + /* Make sure we know what is going on here. */ + BFD_ASSERT (dynobj != NULL + && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) + || h->weakdef != NULL + || ((h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_DYNAMIC) != 0 + && (h->elf_link_hash_flags + & ELF_LINK_HASH_REF_REGULAR) != 0 + && (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0))); + + /* If this is a function, put it in the procedure linkage table. We + will fill in the contents of the procedure linkage table later, + when we know the address of the .got section. */ + if (h->type == STT_FUNC + || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) + { + if (! info->shared + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 + && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0) + { + /* This case can occur if we saw a PLT reloc in an input + file, but the symbol was never referred to 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 REL64 + reloc instead. */ + BFD_ASSERT ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0); + return true; + } + + /* Make sure this symbol is output as a dynamic symbol. */ + if (h->dynindx == -1) + { + if (! bfd_elf64_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 += elf_sh64_sizeof_plt (info); + + /* 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 += 8; + + /* We also need to make an entry in the .rela.plt section. */ + + s = bfd_get_section_by_name (dynobj, ".rela.plt"); + BFD_ASSERT (s != NULL); + s->_raw_size += sizeof (Elf64_External_Rela); + + return true; + } + + /* If this is a weak symbol, and there is a real definition, the + processor independent code will have arranged for us to see the + real definition first, and we can just use the same value. */ + if (h->weakdef != NULL) + { + BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined + || h->weakdef->root.type == bfd_link_hash_defweak); + h->root.u.def.section = h->weakdef->root.u.def.section; + h->root.u.def.value = h->weakdef->root.u.def.value; + return true; + } + + /* This is a reference to a symbol defined by a dynamic object which + is not a function. */ + + /* If we are creating a shared library, we must presume that the + only references to the symbol are via the global offset table. + For such cases we need not do anything here; the relocations will + be handled correctly by relocate_section. */ + if (info->shared) + return true; + + /* If there are no references to this symbol that do not use the + GOT, we don't need to generate a copy reloc. */ + if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0) + return true; + + /* We must allocate the symbol in our .dynbss section, which will + become part of the .bss section of the executable. There will be + an entry for this symbol in the .dynsym section. The dynamic + object will contain position independent code, so all references + from the dynamic object to this symbol will go through the global + offset table. The dynamic linker will use the .dynsym entry to + determine the address it must put in the global offset table, so + both the dynamic object and the regular object will refer to the + same memory location for the variable. */ + + s = bfd_get_section_by_name (dynobj, ".dynbss"); + BFD_ASSERT (s != NULL); + + /* We must generate a R_SH_COPY reloc to tell the dynamic linker to + copy the initial value out of the dynamic object and into the + runtime process image. We need to remember the offset into the + .rela.bss section we are going to use. */ + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + { + asection *srel; + + srel = bfd_get_section_by_name (dynobj, ".rela.bss"); + BFD_ASSERT (srel != NULL); + srel->_raw_size += sizeof (Elf64_External_Rela); + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY; + } + + /* We need to figure out the alignment required for this symbol. I + have no idea how ELF linkers handle this. */ + power_of_two = bfd_log2 (h->size); + if (power_of_two > 3) + power_of_two = 3; + + /* Apply the required alignment. */ + s->_raw_size = BFD_ALIGN (s->_raw_size, + (bfd_size_type) (1 << power_of_two)); + if (power_of_two > bfd_get_section_alignment (dynobj, s)) + { + if (! bfd_set_section_alignment (dynobj, s, power_of_two)) + return false; + } + + /* Define the symbol as being at this point in the section. */ + h->root.u.def.section = s; + h->root.u.def.value = s->_raw_size; + + /* Increment the section size to make room for the symbol. */ + s->_raw_size += h->size; + + return true; +} + +/* This function is called via sh_elf_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 boolean +sh64_elf64_discard_copies (h, ignore) + struct elf_sh64_link_hash_entry *h; + PTR ignore ATTRIBUTE_UNUSED; +{ + struct elf_sh64_pcrel_relocs_copied *s; + + /* 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 (Elf64_External_Rela); + + return true; +} + +/* Set the sizes of the dynamic sections. */ + +static boolean +sh64_elf64_size_dynamic_sections (output_bfd, info) + bfd *output_bfd; + struct bfd_link_info *info; +{ + bfd *dynobj; + asection *s; + boolean plt; + boolean relocs; + boolean reltext; + + 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) + { + s = bfd_get_section_by_name (dynobj, ".interp"); + BFD_ASSERT (s != NULL); + s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER; + s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; + } + } + else + { + /* We may have created entries in the .rela.got section. + However, if we are not creating the dynamic sections, we will + not actually use these entries. Reset the size of .rela.got, + which will cause it to get stripped from the output file + below. */ + s = bfd_get_section_by_name (dynobj, ".rela.got"); + if (s != NULL) + s->_raw_size = 0; + } + + /* 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) + sh64_elf64_link_hash_traverse (sh64_elf64_hash_table (info), + sh64_elf64_discard_copies, + (PTR) NULL); + + /* The check_relocs and adjust_dynamic_symbol entry points have + determined the sizes of the various dynamic sections. Allocate + memory for them. */ + plt = false; + relocs = false; + reltext = false; + for (s = dynobj->sections; s != NULL; s = s->next) + { + const char *name; + boolean strip; + + if ((s->flags & SEC_LINKER_CREATED) == 0) + continue; + + /* It's OK to base decisions on the section name, because none + of the dynobj section names depend upon the input files. */ + name = bfd_get_section_name (dynobj, s); + + strip = false; + + if (strcmp (name, ".plt") == 0) + { + if (s->_raw_size == 0) + { + /* Strip this section if we don't need it; see the + comment below. */ + strip = true; + } + else + { + /* Remember whether there is a PLT. */ + plt = true; + } + } + else if (strncmp (name, ".rela", 5) == 0) + { + if (s->_raw_size == 0) + { + /* If we don't need this section, strip it from the + output file. This is mostly to handle .rela.bss and + .rela.plt. We must create both sections in + create_dynamic_sections, because they must be created + before the linker maps input sections to output + sections. The linker does that before + adjust_dynamic_symbol is called, and it is that + function which decides whether anything needs to go + into these sections. */ + strip = true; + } + else + { + asection *target; + + /* Remember whether there are any reloc sections other + than .rela.plt. */ + if (strcmp (name, ".rela.plt") != 0) + { + const char *outname; + + relocs = true; + + /* If this relocation section applies to a read only + section, then we probably need a DT_TEXTREL + entry. The entries in the .rela.plt section + really apply to the .got section, which we + created ourselves and so know is not readonly. */ + outname = bfd_get_section_name (output_bfd, + s->output_section); + target = bfd_get_section_by_name (output_bfd, outname + 5); + if (target != NULL + && (target->flags & SEC_READONLY) != 0 + && (target->flags & SEC_ALLOC) != 0) + reltext = true; + } + + /* We use the reloc_count field as a counter if we need + to copy relocs into the output file. */ + s->reloc_count = 0; + } + } + else if (strncmp (name, ".got", 4) != 0) + { + /* It's not one of our sections, so don't allocate space. */ + continue; + } + + if (strip) + { + _bfd_strip_section_from_output (info, s); + continue; + } + + /* Allocate memory for the section contents. */ + s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size); + if (s->contents == NULL && s->_raw_size != 0) + return false; + } + + if (elf_hash_table (info)->dynamic_sections_created) + { + /* Add some entries to the .dynamic section. We fill in the + values later, in sh64_elf64_finish_dynamic_sections, but we + must add the entries now so that we get the correct size for + the .dynamic section. The DT_DEBUG entry is filled in by the + dynamic linker and used by the debugger. */ + if (! info->shared) + { + if (! bfd_elf64_add_dynamic_entry (info, DT_DEBUG, 0)) + return false; + } + + if (plt) + { + if (! bfd_elf64_add_dynamic_entry (info, DT_PLTGOT, 0) + || ! bfd_elf64_add_dynamic_entry (info, DT_PLTRELSZ, 0) + || ! bfd_elf64_add_dynamic_entry (info, DT_PLTREL, DT_RELA) + || ! bfd_elf64_add_dynamic_entry (info, DT_JMPREL, 0)) + return false; + } + + if (relocs) + { + if (! bfd_elf64_add_dynamic_entry (info, DT_RELA, 0) + || ! bfd_elf64_add_dynamic_entry (info, DT_RELASZ, 0) + || ! bfd_elf64_add_dynamic_entry (info, DT_RELAENT, + sizeof (Elf64_External_Rela))) + return false; + } + + if (reltext) + { + if (! bfd_elf64_add_dynamic_entry (info, DT_TEXTREL, 0)) + return false; + } + } + + return true; +} + +/* Finish up dynamic symbol handling. We set the contents of various + dynamic sections here. */ + +static boolean +sh64_elf64_finish_dynamic_symbol (output_bfd, info, h, sym) + bfd *output_bfd; + struct bfd_link_info *info; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; +{ + bfd *dynobj; + + dynobj = elf_hash_table (info)->dynobj; + + if (h->plt.offset != (bfd_vma) -1) + { + asection *splt; + asection *sgot; + asection *srel; + + bfd_vma plt_index; + bfd_vma got_offset; + Elf_Internal_Rela rel; + + /* This symbol has an entry in the procedure linkage table. Set + it up. */ + + BFD_ASSERT (h->dynindx != -1); + + splt = bfd_get_section_by_name (dynobj, ".plt"); + sgot = bfd_get_section_by_name (dynobj, ".got.plt"); + srel = bfd_get_section_by_name (dynobj, ".rela.plt"); + BFD_ASSERT (splt != NULL && sgot != NULL && srel != NULL); + + /* Get the index in the procedure linkage table which + 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 / elf_sh64_sizeof_plt (info) - 1; + + /* Get the offset into the .got table of the entry that + corresponds to this function. Each .got entry is 8 bytes. + The first three are reserved. */ + got_offset = (plt_index + 3) * 8; + + got_offset -= GOT_BIAS; + + /* Fill in the entry in the procedure linkage table. */ + if (! info->shared) + { + if (elf_sh64_plt_entry == NULL) + { + elf_sh64_plt_entry = (bfd_big_endian (output_bfd) ? + elf_sh64_plt_entry_be : elf_sh64_plt_entry_le); + } + memcpy (splt->contents + h->plt.offset, elf_sh64_plt_entry, + elf_sh64_sizeof_plt (info)); + movi_3shori_putval (output_bfd, + (sgot->output_section->vma + + sgot->output_offset + + got_offset), + (splt->contents + h->plt.offset + + elf_sh64_plt_symbol_offset (info))); + + movi_shori_putval (output_bfd, + (splt->output_section->vma + splt->output_offset), + (splt->contents + h->plt.offset + + elf_sh64_plt_plt0_offset (info))); + } + else + { + if (elf_sh64_pic_plt_entry == NULL) + { + elf_sh64_pic_plt_entry = (bfd_big_endian (output_bfd) ? + elf_sh64_pic_plt_entry_be : + elf_sh64_pic_plt_entry_le); + } + memcpy (splt->contents + h->plt.offset, elf_sh64_pic_plt_entry, + elf_sh64_sizeof_plt (info)); + movi_shori_putval (output_bfd, got_offset, + (splt->contents + h->plt.offset + + elf_sh64_plt_symbol_offset (info))); + } + + got_offset += GOT_BIAS; + + movi_shori_putval (output_bfd, + plt_index * sizeof (Elf64_External_Rela), + (splt->contents + h->plt.offset + + elf_sh64_plt_reloc_offset (info))); + + /* Fill in the entry in the global offset table. */ + bfd_put_64 (output_bfd, + (splt->output_section->vma + + splt->output_offset + + h->plt.offset + + elf_sh64_plt_temp_offset (info)), + sgot->contents + got_offset); + + /* Fill in the entry in the .rela.plt section. */ + rel.r_offset = (sgot->output_section->vma + + sgot->output_offset + + got_offset); + rel.r_info = ELF64_R_INFO (h->dynindx, R_SH_JMP_SLOT64); + rel.r_addend = 0; + rel.r_addend = GOT_BIAS; + bfd_elf64_swap_reloca_out (output_bfd, &rel, + ((Elf64_External_Rela *) srel->contents + + plt_index)); + + if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + { + /* Mark the symbol as undefined, rather than as defined in + the .plt section. Leave the value alone. */ + sym->st_shndx = SHN_UNDEF; + } + } + + if (h->got.offset != (bfd_vma) -1) + { + asection *sgot; + asection *srel; + Elf_Internal_Rela rel; + + /* This symbol has an entry in the global offset table. Set it + up. */ + + sgot = bfd_get_section_by_name (dynobj, ".got"); + srel = bfd_get_section_by_name (dynobj, ".rela.got"); + BFD_ASSERT (sgot != NULL && srel != NULL); + + rel.r_offset = (sgot->output_section->vma + + sgot->output_offset + + (h->got.offset &~ 1)); + + /* If this is a -Bsymbolic link, and the symbol is defined + locally, we just want to emit a RELATIVE reloc. Likewise if + the symbol was forced to be local because of a version file. + 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 = ELF64_R_INFO (0, R_SH_RELATIVE64); + rel.r_addend = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + } + else + { + bfd_put_64 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset); + rel.r_info = ELF64_R_INFO (h->dynindx, R_SH_GLOB_DAT64); + rel.r_addend = 0; + } + + bfd_elf64_swap_reloca_out (output_bfd, &rel, + ((Elf64_External_Rela *) srel->contents + + srel->reloc_count)); + ++srel->reloc_count; + } + + if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0) + { + asection *s; + Elf_Internal_Rela rel; + + /* This symbol needs a copy reloc. Set it up. */ + + BFD_ASSERT (h->dynindx != -1 + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak)); + + s = bfd_get_section_by_name (h->root.u.def.section->owner, + ".rela.bss"); + BFD_ASSERT (s != NULL); + + rel.r_offset = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + rel.r_info = ELF64_R_INFO (h->dynindx, R_SH_COPY64); + rel.r_addend = 0; + bfd_elf64_swap_reloca_out (output_bfd, &rel, + ((Elf64_External_Rela *) s->contents + + s->reloc_count)); + ++s->reloc_count; + } + + /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */ + if (strcmp (h->root.root.string, "_DYNAMIC") == 0 + || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) + sym->st_shndx = SHN_ABS; + + return true; +} + +/* Finish up the dynamic sections. */ + +static boolean +sh64_elf64_finish_dynamic_sections (output_bfd, info) + bfd *output_bfd; + struct bfd_link_info *info; +{ + bfd *dynobj; + asection *sgot; + asection *sdyn; + + dynobj = elf_hash_table (info)->dynobj; + + sgot = bfd_get_section_by_name (dynobj, ".got.plt"); + BFD_ASSERT (sgot != NULL); + sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); + + if (elf_hash_table (info)->dynamic_sections_created) + { + asection *splt; + Elf64_External_Dyn *dyncon, *dynconend; + + BFD_ASSERT (sdyn != NULL); + + dyncon = (Elf64_External_Dyn *) sdyn->contents; + dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->_raw_size); + for (; dyncon < dynconend; dyncon++) + { + Elf_Internal_Dyn dyn; + const char *name; + asection *s; + + bfd_elf64_swap_dyn_in (dynobj, dyncon, &dyn); + + switch (dyn.d_tag) + { + default: + break; + + case DT_PLTGOT: + name = ".got"; + goto get_vma; + + case DT_JMPREL: + name = ".rela.plt"; + get_vma: + s = bfd_get_section_by_name (output_bfd, name); + BFD_ASSERT (s != NULL); + dyn.d_un.d_ptr = s->vma; + bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + + case DT_PLTRELSZ: + s = bfd_get_section_by_name (output_bfd, ".rela.plt"); + BFD_ASSERT (s != NULL); + if (s->_cooked_size != 0) + dyn.d_un.d_val = s->_cooked_size; + else + dyn.d_un.d_val = s->_raw_size; + bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + + case DT_RELASZ: + /* My reading of the SVR4 ABI indicates that the + procedure linkage table relocs (DT_JMPREL) should be + included in the overall relocs (DT_RELA). This is + what Solaris does. However, UnixWare can not handle + that case. Therefore, we override the DT_RELASZ entry + here to make it not include the JMPREL relocs. Since + the linker script arranges for .rela.plt to follow all + other relocation sections, we don't have to worry + about changing the DT_RELA entry. */ + s = bfd_get_section_by_name (output_bfd, ".rela.plt"); + if (s != NULL) + { + if (s->_cooked_size != 0) + dyn.d_un.d_val -= s->_cooked_size; + else + dyn.d_un.d_val -= s->_raw_size; + } + bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + } + } + + /* Fill in the first entry in the procedure linkage table. */ + splt = bfd_get_section_by_name (dynobj, ".plt"); + if (splt && splt->_raw_size > 0) + { + if (info->shared) + { + if (elf_sh64_pic_plt_entry == NULL) + { + elf_sh64_pic_plt_entry = (bfd_big_endian (output_bfd) ? + elf_sh64_pic_plt_entry_be : + elf_sh64_pic_plt_entry_le); + } + memcpy (splt->contents, elf_sh64_pic_plt_entry, + elf_sh64_sizeof_plt (info)); + } + else + { + if (elf_sh64_plt0_entry == NULL) + { + elf_sh64_plt0_entry = (bfd_big_endian (output_bfd) ? + elf_sh64_plt0_entry_be : + elf_sh64_plt0_entry_le); + } + memcpy (splt->contents, elf_sh64_plt0_entry, PLT_ENTRY_SIZE); + movi_3shori_putval (output_bfd, + sgot->output_section->vma + + sgot->output_offset, + splt->contents + + elf_sh64_plt0_gotplt_offset (info)); + } + + /* UnixWare sets the entsize of .plt to 8, although that doesn't + really seem like the right value. */ + elf_section_data (splt->output_section)->this_hdr.sh_entsize = 8; + } + } + + /* Fill in the first three entries in the global offset table. */ + if (sgot->_raw_size > 0) + { + if (sdyn == NULL) + bfd_put_64 (output_bfd, (bfd_vma) 0, sgot->contents); + else + bfd_put_64 (output_bfd, + sdyn->output_section->vma + sdyn->output_offset, + sgot->contents); + bfd_put_64 (output_bfd, (bfd_vma) 0, sgot->contents + 8); + bfd_put_64 (output_bfd, (bfd_vma) 0, sgot->contents + 16); + } + + elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 8; + + return true; +} + + +#ifndef ELF_ARCH +#define TARGET_BIG_SYM bfd_elf64_sh64_vec +#define TARGET_BIG_NAME "elf64-sh64" +#define TARGET_LITTLE_SYM bfd_elf64_sh64l_vec +#define TARGET_LITTLE_NAME "elf64-sh64l" +#define ELF_ARCH bfd_arch_sh +#define ELF_MACHINE_CODE EM_SH +#define ELF_MAXPAGESIZE 128 + +#define elf_symbol_leading_char '_' +#endif /* ELF_ARCH */ + +#define bfd_elf64_bfd_reloc_type_lookup sh_elf64_reloc_type_lookup +#define elf_info_to_howto sh_elf64_info_to_howto + +/* Note: there's no relaxation at present. */ + +#define elf_backend_relocate_section sh_elf64_relocate_section +#define bfd_elf64_bfd_get_relocated_section_contents \ + sh_elf64_get_relocated_section_contents +#define elf_backend_object_p sh_elf64_set_mach_from_flags +#define bfd_elf64_bfd_set_private_flags \ + sh_elf64_set_private_flags +#define bfd_elf64_bfd_copy_private_bfd_data \ + sh_elf64_copy_private_data +#define bfd_elf64_bfd_merge_private_bfd_data \ + sh_elf64_merge_private_data +#define elf_backend_fake_sections sh64_elf64_fake_sections + +#define elf_backend_gc_mark_hook sh_elf64_gc_mark_hook +#define elf_backend_gc_sweep_hook sh_elf64_gc_sweep_hook +#define elf_backend_check_relocs sh_elf64_check_relocs + +#define elf_backend_can_gc_sections 1 + +#define elf_backend_get_symbol_type sh64_elf64_get_symbol_type + +#define elf_backend_add_symbol_hook sh64_elf64_add_symbol_hook + +#define elf_backend_link_output_symbol_hook \ + sh64_elf64_link_output_symbol_hook + +#define elf_backend_final_write_processing \ + sh64_elf64_final_write_processing + +#define elf_backend_create_dynamic_sections \ + sh64_elf64_create_dynamic_sections +#define bfd_elf64_bfd_link_hash_table_create \ + sh64_elf64_link_hash_table_create +#define elf_backend_adjust_dynamic_symbol \ + sh64_elf64_adjust_dynamic_symbol +#define elf_backend_size_dynamic_sections \ + sh64_elf64_size_dynamic_sections +#define elf_backend_finish_dynamic_symbol \ + sh64_elf64_finish_dynamic_symbol +#define elf_backend_finish_dynamic_sections \ + sh64_elf64_finish_dynamic_sections + +#define elf_backend_want_got_plt 1 +#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 -uprN binutils-2.11.93.0.2/bfd/elf64-sparc.c binutils-2.12.90.0.1/bfd/elf64-sparc.c --- binutils-2.11.93.0.2/bfd/elf64-sparc.c Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/elf64-sparc.c Thu Mar 7 11:52:36 2002 @@ -2161,7 +2161,7 @@ do_dynreloc: case R_SPARC_UA16: { Elf_Internal_Rela outrel; - boolean skip; + boolean skip, relocate; if (sreloc == NULL) { @@ -2184,12 +2184,15 @@ do_dynreloc: } skip = false; + relocate = false; outrel.r_offset = _bfd_elf_section_offset (output_bfd, info, input_section, rel->r_offset); if (outrel.r_offset == (bfd_vma) -1) skip = true; + else if (outrel.r_offset == (bfd_vma) -2) + skip = true, relocate = true; outrel.r_offset += (input_section->output_section->vma + input_section->output_offset); @@ -2301,7 +2304,8 @@ do_dynreloc: /* This reloc will be computed at runtime, so there's no need to do anything now. */ - continue; + if (! relocate) + continue; } break; } diff -uprN binutils-2.11.93.0.2/bfd/elf64-x86-64.c binutils-2.12.90.0.1/bfd/elf64-x86-64.c --- binutils-2.11.93.0.2/bfd/elf64-x86-64.c Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/elf64-x86-64.c Thu Mar 7 11:52:36 2002 @@ -1,5 +1,5 @@ /* X86-64 specific support for 64-bit ELF - Copyright 2000, 2001 Free Software Foundation, Inc. + Copyright 2000, 2001, 2002 Free Software Foundation, Inc. Contributed by Jan Hubicka . This file is part of BFD, the Binary File Descriptor library. @@ -20,13 +20,14 @@ Foundation, Inc., 59 Temple Place - Suit #include "bfd.h" #include "sysdep.h" +#include "bfdlink.h" #include "libbfd.h" #include "elf-bfd.h" #include "elf/x86-64.h" /* We use only the RELA entries. */ -#define USE_RELA +#define USE_RELA 1 /* In case we're on a 32-bit machine, construct a 64-bit "-1" value. */ #define MINUS_ONE (~ (bfd_vma) 0) @@ -127,6 +128,12 @@ static void elf64_x86_64_info_to_howto static struct bfd_link_hash_table *elf64_x86_64_link_hash_table_create PARAMS ((bfd *)); static boolean elf64_x86_64_elf_object_p PARAMS ((bfd *abfd)); +static boolean create_got_section + PARAMS((bfd *, struct bfd_link_info *)); +static boolean elf64_x86_64_create_dynamic_sections + PARAMS((bfd *, struct bfd_link_info *)); +static void elf64_x86_64_copy_indirect_symbol + PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *)); static boolean elf64_x86_64_check_relocs PARAMS ((bfd *, struct bfd_link_info *, asection *sec, const Elf_Internal_Rela *)); @@ -138,11 +145,15 @@ static boolean elf64_x86_64_gc_sweep_hoo PARAMS ((bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *)); -static struct bfd_hash_entry *elf64_x86_64_link_hash_newfunc +static struct bfd_hash_entry *link_hash_newfunc PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); static boolean elf64_x86_64_adjust_dynamic_symbol PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); +static boolean allocate_dynrelocs + PARAMS ((struct elf_link_hash_entry *, PTR)); +static boolean readonly_dynrelocs + PARAMS ((struct elf_link_hash_entry *, PTR)); static boolean elf64_x86_64_size_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *)); static boolean elf64_x86_64_relocate_section @@ -235,53 +246,54 @@ static const bfd_byte elf64_x86_64_plt_e }; /* The x86-64 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 it can discard PC relative relocs if it doesn't need them when - linking with -Bsymbolic. We store the information in a field - extending the regular ELF linker hash table. */ + decides to copy as dynamic relocs in check_relocs for each symbol. + This is so that it can later discard them if they are found to be + unnecessary. We store the information in a field extending the + regular ELF linker hash table. */ -/* This structure keeps track of the number of PC relative relocs we - have copied for a given symbol. */ - -struct elf64_x86_64_pcrel_relocs_copied +struct elf64_x86_64_dyn_relocs { /* Next section. */ - struct elf64_x86_64_pcrel_relocs_copied *next; - /* A section in dynobj. */ - asection *section; - /* Number of relocs copied in this section. */ + struct elf64_x86_64_dyn_relocs *next; + + /* The input section of the reloc. */ + asection *sec; + + /* Total number of relocs copied for the input section. */ bfd_size_type count; + + /* Number of pc-relative relocs copied for the input section. */ + bfd_size_type pc_count; }; /* x86-64 ELF linker hash entry. */ struct elf64_x86_64_link_hash_entry { - struct elf_link_hash_entry root; + struct elf_link_hash_entry elf; - /* Number of PC relative relocs copied for this symbol. */ - struct elf64_x86_64_pcrel_relocs_copied *pcrel_relocs_copied; + /* Track dynamic relocs copied for this symbol. */ + struct elf64_x86_64_dyn_relocs *dyn_relocs; }; -/* x86-64 ELF linker hash table. */ +/* x86-64 ELF linker hash table. */ struct elf64_x86_64_link_hash_table { - struct elf_link_hash_table root; -}; - -/* Declare this now that the above structures are defined. */ + struct elf_link_hash_table elf; -static boolean elf64_x86_64_discard_copies - PARAMS ((struct elf64_x86_64_link_hash_entry *, PTR)); - -/* Traverse an x86-64 ELF linker hash table. */ + /* Short-cuts to get to dynamic linker sections. */ + asection *sgot; + asection *sgotplt; + asection *srelgot; + asection *splt; + asection *srelplt; + asection *sdynbss; + asection *srelbss; -#define elf64_x86_64_link_hash_traverse(table, func, info) \ - (elf_link_hash_traverse \ - (&(table)->root, \ - (boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \ - (info))) + /* Small local sym to section mapping cache. */ + struct sym_sec_cache sym_sec; +}; /* Get the x86-64 ELF linker hash table from a link_info structure. */ @@ -291,33 +303,32 @@ static boolean elf64_x86_64_discard_copi /* Create an entry in an x86-64 ELF linker hash table. */ static struct bfd_hash_entry * -elf64_x86_64_link_hash_newfunc (entry, table, string) +link_hash_newfunc (entry, table, string) struct bfd_hash_entry *entry; struct bfd_hash_table *table; const char *string; { - struct elf64_x86_64_link_hash_entry *ret = - (struct elf64_x86_64_link_hash_entry *) entry; - /* Allocate the structure if it has not already been allocated by a - subclass. */ - if (ret == (struct elf64_x86_64_link_hash_entry *) NULL) - ret = ((struct elf64_x86_64_link_hash_entry *) - bfd_hash_allocate (table, - sizeof (struct elf64_x86_64_link_hash_entry))); - if (ret == (struct elf64_x86_64_link_hash_entry *) NULL) - return (struct bfd_hash_entry *) ret; + subclass. */ + if (entry == NULL) + { + entry = bfd_hash_allocate (table, + sizeof (struct elf64_x86_64_link_hash_entry)); + if (entry == NULL) + return entry; + } /* Call the allocation method of the superclass. */ - ret = ((struct elf64_x86_64_link_hash_entry *) - _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, - table, string)); - if (ret != (struct elf64_x86_64_link_hash_entry *) NULL) + entry = _bfd_elf_link_hash_newfunc (entry, table, string); + if (entry != NULL) { - ret->pcrel_relocs_copied = NULL; + struct elf64_x86_64_link_hash_entry *eh; + + eh = (struct elf64_x86_64_link_hash_entry *) entry; + eh->dyn_relocs = NULL; } - return (struct bfd_hash_entry *) ret; + return entry; } /* Create an X86-64 ELF linker hash table. */ @@ -329,18 +340,135 @@ elf64_x86_64_link_hash_table_create (abf struct elf64_x86_64_link_hash_table *ret; bfd_size_type amt = sizeof (struct elf64_x86_64_link_hash_table); - ret = ((struct elf64_x86_64_link_hash_table *) bfd_alloc (abfd, amt)); - if (ret == (struct elf64_x86_64_link_hash_table *) NULL) + ret = (struct elf64_x86_64_link_hash_table *) bfd_alloc (abfd, amt); + if (ret == NULL) return NULL; - if (! _bfd_elf_link_hash_table_init (&ret->root, abfd, - elf64_x86_64_link_hash_newfunc)) + if (! _bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc)) { bfd_release (abfd, ret); return NULL; } - return &ret->root.root; + ret->sgot = NULL; + ret->sgotplt = NULL; + ret->srelgot = NULL; + ret->splt = NULL; + ret->srelplt = NULL; + ret->sdynbss = NULL; + ret->srelbss = NULL; + ret->sym_sec.abfd = NULL; + + return &ret->elf.root; +} + +/* Create .got, .gotplt, and .rela.got sections in DYNOBJ, and set up + shortcuts to them in our hash table. */ + +static boolean +create_got_section (dynobj, info) + bfd *dynobj; + struct bfd_link_info *info; +{ + struct elf64_x86_64_link_hash_table *htab; + + if (! _bfd_elf_create_got_section (dynobj, info)) + return false; + + htab = elf64_x86_64_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, ".rela.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, 3)) + return false; + return true; +} + +/* Create .plt, .rela.plt, .got, .got.plt, .rela.got, .dynbss, and + .rela.bss sections in DYNOBJ, and set up shortcuts to them in our + hash table. */ + +static boolean +elf64_x86_64_create_dynamic_sections (dynobj, info) + bfd *dynobj; + struct bfd_link_info *info; +{ + struct elf64_x86_64_link_hash_table *htab; + + htab = elf64_x86_64_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, ".rela.plt"); + htab->sdynbss = bfd_get_section_by_name (dynobj, ".dynbss"); + if (!info->shared) + htab->srelbss = bfd_get_section_by_name (dynobj, ".rela.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 +elf64_x86_64_copy_indirect_symbol (dir, ind) + struct elf_link_hash_entry *dir, *ind; +{ + struct elf64_x86_64_link_hash_entry *edir, *eind; + + edir = (struct elf64_x86_64_link_hash_entry *) dir; + eind = (struct elf64_x86_64_link_hash_entry *) ind; + + if (eind->dyn_relocs != NULL) + { + if (edir->dyn_relocs != NULL) + { + struct elf64_x86_64_dyn_relocs **pp; + struct elf64_x86_64_dyn_relocs *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->dyn_relocs; (p = *pp) != NULL; ) + { + struct elf64_x86_64_dyn_relocs *q; + + for (q = edir->dyn_relocs; q != NULL; q = q->next) + if (q->sec == p->sec) + { + q->pc_count += p->pc_count; + q->count += p->count; + *pp = p->next; + break; + } + if (q == NULL) + pp = &p->next; + } + *pp = edir->dyn_relocs; + } + + edir->dyn_relocs = eind->dyn_relocs; + eind->dyn_relocs = NULL; + } + + _bfd_elf_link_hash_copy_indirect (dir, ind); } static boolean @@ -353,8 +481,8 @@ elf64_x86_64_elf_object_p (abfd) } /* Look through the relocs for a section during the first phase, and - allocate space in the global offset table or procedure linkage - table. */ + calculate needed space in the global offset table, procedure + linkage table, and dynamic reloc sections. */ static boolean elf64_x86_64_check_relocs (abfd, info, sec, relocs) @@ -363,25 +491,22 @@ elf64_x86_64_check_relocs (abfd, info, s asection *sec; const Elf_Internal_Rela *relocs; { - bfd *dynobj; + struct elf64_x86_64_link_hash_table *htab; Elf_Internal_Shdr *symtab_hdr; struct elf_link_hash_entry **sym_hashes; - bfd_signed_vma *local_got_refcounts; const Elf_Internal_Rela *rel; const Elf_Internal_Rela *rel_end; - asection *sgot; - asection *srelgot; asection *sreloc; if (info->relocateable) return true; - dynobj = elf_hash_table (info)->dynobj; + htab = elf64_x86_64_hash_table (info); symtab_hdr = &elf_tdata (abfd)->symtab_hdr; sym_hashes = elf_sym_hashes (abfd); - local_got_refcounts = elf_local_got_refcounts (abfd); - sgot = srelgot = sreloc = NULL; + sreloc = NULL; + rel_end = relocs + sec->reloc_count; for (rel = relocs; rel < rel_end; rel++) { @@ -389,75 +514,35 @@ elf64_x86_64_check_relocs (abfd, info, s struct elf_link_hash_entry *h; r_symndx = ELF64_R_SYM (rel->r_info); + + if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr)) + { + (*_bfd_error_handler) (_("%s: bad symbol index: %d"), + bfd_archive_filename (abfd), + r_symndx); + return false; + } + if (r_symndx < symtab_hdr->sh_info) h = NULL; else h = sym_hashes[r_symndx - symtab_hdr->sh_info]; - /* Some relocs require a global offset table. */ - if (dynobj == NULL) - { - switch (ELF64_R_TYPE (rel->r_info)) - { - case R_X86_64_GOT32: - case R_X86_64_GOTPCREL: - elf_hash_table (info)->dynobj = dynobj = abfd; - if (! _bfd_elf_create_got_section (dynobj, info)) - return false; - break; - } - } - switch (ELF64_R_TYPE (rel->r_info)) { - case R_X86_64_GOTPCREL: case R_X86_64_GOT32: + case R_X86_64_GOTPCREL: /* This symbol requires a global offset table entry. */ - - if (sgot == NULL) - { - sgot = bfd_get_section_by_name (dynobj, ".got"); - BFD_ASSERT (sgot != NULL); - } - - if (srelgot == NULL && (h != NULL || info->shared)) - { - srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); - if (srelgot == NULL) - { - srelgot = bfd_make_section (dynobj, ".rela.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, 3)) - return false; - } - } - if (h != NULL) { - if (h->got.refcount == 0) - { - /* Make sure this symbol is output as a dynamic symbol. */ - if (h->dynindx == -1) - { - if (! bfd_elf64_link_record_dynamic_symbol (info, h)) - return false; - } - - sgot->_raw_size += GOT_ENTRY_SIZE; - srelgot->_raw_size += sizeof (Elf64_External_Rela); - } h->got.refcount += 1; } else { + 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; @@ -470,19 +555,18 @@ elf64_x86_64_check_relocs (abfd, info, s return false; elf_local_got_refcounts (abfd) = local_got_refcounts; } - if (local_got_refcounts[r_symndx] == 0) - { - sgot->_raw_size += GOT_ENTRY_SIZE; - if (info->shared) - { - /* If we are generating a shared object, we need to - output a R_X86_64_RELATIVE reloc so that the dynamic - linker can adjust this GOT entry. */ - srelgot->_raw_size += sizeof (Elf64_External_Rela); - } - } local_got_refcounts[r_symndx] += 1; } + /* Fall through */ + + //case R_X86_64_GOTPCREL: + if (htab->sgot == NULL) + { + if (htab->elf.dynobj == NULL) + htab->elf.dynobj = abfd; + if (!create_got_section (htab->elf.dynobj, info)) + return false; + } break; case R_X86_64_PLT32: @@ -507,9 +591,23 @@ elf64_x86_64_check_relocs (abfd, info, s case R_X86_64_32: case R_X86_64_64: case R_X86_64_32S: + case R_X86_64_PC8: + case R_X86_64_PC16: case R_X86_64_PC32: - if (h != NULL) - h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF; + 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 @@ -520,27 +618,45 @@ elf64_x86_64_check_relocs (abfd, info, s including in the link (i.e., DEF_REGULAR is set). At this point we have not seen all the input files, so it is 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. - A similar situation occurs when creating shared libraries - and symbol visibility changes render the symbol local. */ - if (info->shared - && (sec->flags & SEC_ALLOC) != 0 - && (((ELF64_R_TYPE (rel->r_info) != R_X86_64_PC8) - && (ELF64_R_TYPE (rel->r_info) != R_X86_64_PC16) - && (ELF64_R_TYPE (rel->r_info) != R_X86_64_PC32)) - || (h != NULL - && (! info->symbolic - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)))) - { - /* 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. */ + later (it is never cleared). In case of a weak definition, + DEF_REGULAR may be cleared later by a strong definition in + a shared library. We account for that possibility below by + storing information in the relocs_copied field of the hash + table entry. A similar situation occurs when creating + shared libraries and symbol visibility changes render the + symbol local. + + If on the other hand, we are creating an executable, we + may need to keep relocations for symbols satisfied by a + dynamic library if we manage to avoid copy relocs for the + symbol. */ + if ((info->shared + && (sec->flags & SEC_ALLOC) != 0 + && (((ELF64_R_TYPE (rel->r_info) != R_X86_64_PC8) + && (ELF64_R_TYPE (rel->r_info) != R_X86_64_PC16) + && (ELF64_R_TYPE (rel->r_info) != R_X86_64_PC32)) + || (h != NULL + && (! info->symbolic + || h->root.type == bfd_link_hash_defweak + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)))) + || (!info->shared + && (sec->flags & SEC_ALLOC) != 0 + && h != NULL + && (h->root.type == bfd_link_hash_defweak + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0))) + { + struct elf64_x86_64_dyn_relocs *p; + struct elf64_x86_64_dyn_relocs **head; + + /* We must copy these reloc types into the output file. + Create a reloc section in dynobj and make room for + this reloc. */ if (sreloc == NULL) { const char *name; + bfd *dynobj; name = (bfd_elf_string_from_elf_section (abfd, @@ -549,9 +665,19 @@ elf64_x86_64_check_relocs (abfd, info, s if (name == NULL) return false; - BFD_ASSERT (strncmp (name, ".rela", 5) == 0 - && strcmp (bfd_get_section_name (abfd, sec), - name + 5) == 0); + if (strncmp (name, ".rela", 5) != 0 + || strcmp (bfd_get_section_name (abfd, sec), + name + 5) != 0) + { + (*_bfd_error_handler) + (_("%s: bad relocation section name `%s\'"), + bfd_archive_filename (abfd), name); + } + + if (htab->elf.dynobj == NULL) + htab->elf.dynobj = abfd; + + dynobj = htab->elf.dynobj; sreloc = bfd_get_section_by_name (dynobj, name); if (sreloc == NULL) @@ -568,46 +694,51 @@ elf64_x86_64_check_relocs (abfd, info, s || ! bfd_set_section_alignment (dynobj, sreloc, 3)) return false; } - if (sec->flags & SEC_READONLY) - info->flags |= DF_TEXTREL; + elf_section_data (sec)->sreloc = sreloc; } - sreloc->_raw_size += sizeof (Elf64_External_Rela); - - /* If 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 later as necessary. Note - that this function is only called if we are using an - elf64_x86_64 linker hash table, which means that h is - really a pointer to an elf64_x86_64_link_hash_entry. */ - if (h != NULL - && ((ELF64_R_TYPE (rel->r_info) == R_X86_64_PC8) - || (ELF64_R_TYPE (rel->r_info) == R_X86_64_PC16) - || (ELF64_R_TYPE (rel->r_info) == R_X86_64_PC32))) + /* If this is a global symbol, we count the number of + relocations we need for this symbol. */ + if (h != NULL) { - struct elf64_x86_64_link_hash_entry *eh; - struct elf64_x86_64_pcrel_relocs_copied *p; - - eh = (struct elf64_x86_64_link_hash_entry *) h; + head = &((struct elf64_x86_64_link_hash_entry *) h)->dyn_relocs; + } + 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; - for (p = eh->pcrel_relocs_copied; p != NULL; p = p->next) - if (p->section == sreloc) - break; + head = ((struct elf64_x86_64_dyn_relocs **) + &elf_section_data (s)->local_dynrel); + } + p = *head; + if (p == NULL || p->sec != sec) + { + bfd_size_type amt = sizeof *p; + p = ((struct elf64_x86_64_dyn_relocs *) + bfd_alloc (htab->elf.dynobj, amt)); if (p == NULL) - { - p = ((struct elf64_x86_64_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->sec = sec; + p->count = 0; + p->pc_count = 0; } + + p->count += 1; + if (ELF64_R_TYPE (rel->r_info) == R_X86_64_PC8 + || ELF64_R_TYPE (rel->r_info) == R_X86_64_PC16 + || ELF64_R_TYPE (rel->r_info) == R_X86_64_PC32) + p->pc_count += 1; } break; @@ -624,6 +755,9 @@ elf64_x86_64_check_relocs (abfd, info, s if (!_bfd_elf64_gc_record_vtentry (abfd, sec, h, rel->r_addend)) return false; break; + + default: + break; } } @@ -637,7 +771,7 @@ static asection * elf64_x86_64_gc_mark_hook (abfd, info, rel, h, sym) bfd *abfd; struct bfd_link_info *info ATTRIBUTE_UNUSED; - Elf_Internal_Rela *rel ATTRIBUTE_UNUSED; + Elf_Internal_Rela *rel; struct elf_link_hash_entry *h; Elf_Internal_Sym *sym; { @@ -677,7 +811,7 @@ elf64_x86_64_gc_mark_hook (abfd, info, r static boolean elf64_x86_64_gc_sweep_hook (abfd, info, sec, relocs) bfd *abfd; - struct bfd_link_info *info ATTRIBUTE_UNUSED; + struct bfd_link_info *info; asection *sec; const Elf_Internal_Rela *relocs; { @@ -687,21 +821,13 @@ elf64_x86_64_gc_sweep_hook (abfd, info, const Elf_Internal_Rela *rel, *relend; unsigned long r_symndx; struct elf_link_hash_entry *h; - bfd *dynobj; - asection *sgot; - asection *srelgot; + + 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); - dynobj = elf_hash_table (info)->dynobj; - if (dynobj == NULL) - return true; - - sgot = bfd_get_section_by_name (dynobj, ".got"); - srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); - relend = relocs + sec->reloc_count; for (rel = relocs; rel < relend; rel++) switch (ELF64_R_TYPE (rel->r_info)) @@ -713,30 +839,53 @@ elf64_x86_64_gc_sweep_hook (abfd, info, { h = sym_hashes[r_symndx - symtab_hdr->sh_info]; if (h->got.refcount > 0) - { - h->got.refcount -= 1; - if (h->got.refcount == 0) - { - sgot->_raw_size -= GOT_ENTRY_SIZE; - srelgot->_raw_size -= sizeof (Elf64_External_Rela); - } - } + h->got.refcount -= 1; } else if (local_got_refcounts != NULL) { if (local_got_refcounts[r_symndx] > 0) - { - local_got_refcounts[r_symndx] -= 1; - if (local_got_refcounts[r_symndx] == 0) - { - sgot->_raw_size -= GOT_ENTRY_SIZE; - if (info->shared) - srelgot->_raw_size -= sizeof (Elf64_External_Rela); - } - } + local_got_refcounts[r_symndx] -= 1; } break; + case R_X86_64_8: + case R_X86_64_16: + case R_X86_64_32: + case R_X86_64_64: + case R_X86_64_32S: + case R_X86_64_PC8: + case R_X86_64_PC16: + case R_X86_64_PC32: + r_symndx = ELF64_R_SYM (rel->r_info); + if (r_symndx >= symtab_hdr->sh_info) + { + struct elf64_x86_64_link_hash_entry *eh; + struct elf64_x86_64_dyn_relocs **pp; + struct elf64_x86_64_dyn_relocs *p; + + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + + if (!info->shared && h->plt.refcount > 0) + h->plt.refcount -= 1; + + eh = (struct elf64_x86_64_link_hash_entry *) h; + + for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next) + if (p->sec == sec) + { + if (ELF64_R_TYPE (rel->r_info) == R_X86_64_PC8 + || ELF64_R_TYPE (rel->r_info) == R_X86_64_PC16 + || ELF64_R_TYPE (rel->r_info) == R_X86_64_PC32) + p->pc_count -= 1; + p->count -= 1; + if (p->count == 0) + *pp = p->next; + break; + } + } + break; + + case R_X86_64_PLT32: r_symndx = ELF64_R_SYM (rel->r_info); if (r_symndx >= symtab_hdr->sh_info) @@ -765,33 +914,24 @@ elf64_x86_64_adjust_dynamic_symbol (info struct bfd_link_info *info; struct elf_link_hash_entry *h; { - bfd *dynobj; + struct elf64_x86_64_link_hash_table *htab; + struct elf64_x86_64_link_hash_entry * eh; + struct elf64_x86_64_dyn_relocs *p; asection *s; unsigned int power_of_two; - dynobj = elf_hash_table (info)->dynobj; - - /* Make sure we know what is going on here. */ - BFD_ASSERT (dynobj != NULL - && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) - || h->weakdef != NULL - || ((h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_REF_REGULAR) != 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0))); - /* If this is a function, put it in the procedure linkage table. We will fill in the contents of the procedure linkage table later, when we know the address of the .got section. */ if (h->type == STT_FUNC || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) { - if ((! info->shared - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0) - || (info->shared && h->plt.refcount <= 0)) + if (h->plt.refcount <= 0 + || (! info->shared + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 + && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0 + && h->root.type != bfd_link_hash_undefweak + && h->root.type != bfd_link_hash_undefined)) { /* This case can occur if we saw a PLT32 reloc in an input file, but the symbol was never referred to by a dynamic @@ -800,55 +940,16 @@ elf64_x86_64_adjust_dynamic_symbol (info linkage table, and we can just do a PC32 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_elf64_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 += GOT_ENTRY_SIZE; - - /* We also need to make an entry in the .rela.plt section. */ - s = bfd_get_section_by_name (dynobj, ".rela.plt"); - BFD_ASSERT (s != NULL); - s->_raw_size += sizeof (Elf64_External_Rela); - return true; } else + /* It's possible that we incorrectly decided a .plt reloc was + needed for an R_X86_64_PC32 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 @@ -878,6 +979,29 @@ elf64_x86_64_adjust_dynamic_symbol (info if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0) return true; + /* If -z nocopyreloc was given, we won't generate them either. */ + if (info->nocopyreloc) + { + h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF; + return true; + } + + eh = (struct elf64_x86_64_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 become part of the .bss section of the executable. There will be an entry for this symbol in the .dynsym section. The dynamic @@ -888,20 +1012,14 @@ elf64_x86_64_adjust_dynamic_symbol (info both the dynamic object and the regular object will refer to the same memory location for the variable. */ - s = bfd_get_section_by_name (dynobj, ".dynbss"); - BFD_ASSERT (s != NULL); + htab = elf64_x86_64_hash_table (info); /* We must generate a R_X86_64_COPY reloc to tell the dynamic linker to copy the initial value out of the dynamic object and into the - runtime process image. We need to remember the offset into the - .rela.bss section we are going to use. */ + runtime process image. */ if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) { - asection *srel; - - srel = bfd_get_section_by_name (dynobj, ".rela.bss"); - BFD_ASSERT (srel != NULL); - srel->_raw_size += sizeof (Elf64_External_Rela); + htab->srelbss->_raw_size += sizeof (Elf64_External_Rela); h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY; } @@ -915,10 +1033,11 @@ elf64_x86_64_adjust_dynamic_symbol (info power_of_two = 4; /* Apply the required alignment. */ + s = htab->sdynbss; s->_raw_size = BFD_ALIGN (s->_raw_size, (bfd_size_type) (1 << power_of_two)); - if (power_of_two > bfd_get_section_alignment (dynobj, s)) + if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s)) { - if (! bfd_set_section_alignment (dynobj, s, power_of_two)) + if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two)) return false; } @@ -932,6 +1051,218 @@ elf64_x86_64_adjust_dynamic_symbol (info return true; } +/* This is the condition under which elf64_x86_64_finish_dynamic_symbol + will be called from elflink.h. If elflink.h doesn't call our + finish_dynamic_symbol routine, we'll need to do something about + initializing any .plt and .got entries in elf64_x86_64_relocate_section. */ +#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, INFO, H) \ + ((DYN) \ + && ((INFO)->shared \ + || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) \ + && ((H)->dynindx != -1 \ + || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)) + +/* Allocate space in .plt, .got and associated reloc sections for + dynamic relocs. */ + +static boolean +allocate_dynrelocs (h, inf) + struct elf_link_hash_entry *h; + PTR inf; +{ + struct bfd_link_info *info; + struct elf64_x86_64_link_hash_table *htab; + struct elf64_x86_64_link_hash_entry *eh; + struct elf64_x86_64_dyn_relocs *p; + + if (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + return true; + + info = (struct bfd_link_info *) inf; + htab = elf64_x86_64_hash_table (info); + + if (htab->elf.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_elf64_link_record_dynamic_symbol (info, h)) + return false; + } + + if (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_ENTRY_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 += GOT_ENTRY_SIZE; + + /* We also need to make an entry in the .rela.plt section. */ + htab->srelplt->_raw_size += sizeof (Elf64_External_Rela); + } + 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; + 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_elf64_link_record_dynamic_symbol (info, h)) + return false; + } + + s = htab->sgot; + h->got.offset = s->_raw_size; + s->_raw_size += GOT_ENTRY_SIZE; + dyn = htab->elf.dynamic_sections_created; + if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h)) + htab->srelgot->_raw_size += sizeof (Elf64_External_Rela); + } + else + h->got.offset = (bfd_vma) -1; + + eh = (struct elf64_x86_64_link_hash_entry *) h; + if (eh->dyn_relocs == 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) + { + if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0 + && ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0 + || info->symbolic)) + { + struct elf64_x86_64_dyn_relocs **pp; + + for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + { + p->count -= p->pc_count; + p->pc_count = 0; + if (p->count == 0) + *pp = p->next; + else + pp = &p->next; + } + } + } + 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->elf.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_elf64_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->dyn_relocs = NULL; + + keep: ; + } + + /* Finally, allocate space. */ + for (p = eh->dyn_relocs; p != NULL; p = p->next) + { + asection *sreloc = elf_section_data (p->sec)->sreloc; + sreloc->_raw_size += p->count * sizeof (Elf64_External_Rela); + } + + return true; +} + +/* Find any dynamic relocs that apply to read-only sections. */ + +static boolean +readonly_dynrelocs (h, inf) + struct elf_link_hash_entry *h; + PTR inf; +{ + struct elf64_x86_64_link_hash_entry *eh; + struct elf64_x86_64_dyn_relocs *p; + + eh = (struct elf64_x86_64_link_hash_entry *) h; + for (p = eh->dyn_relocs; p != NULL; p = p->next) + { + asection *s = p->sec->output_section; + + if (s != NULL && (s->flags & SEC_READONLY) != 0) + { + struct bfd_link_info *info = (struct bfd_link_info *) inf; + + info->flags |= DF_TEXTREL; + + /* Not an error, just cut short the traversal. */ + return false; + } + } + return true; +} + /* Set the sizes of the dynamic sections. */ static boolean @@ -939,110 +1270,140 @@ elf64_x86_64_size_dynamic_sections (outp bfd *output_bfd ATTRIBUTE_UNUSED; struct bfd_link_info *info; { + struct elf64_x86_64_link_hash_table *htab; bfd *dynobj; asection *s; - boolean plt; boolean relocs; + bfd *ibfd; - dynobj = elf_hash_table (info)->dynobj; - BFD_ASSERT (dynobj != NULL); + htab = elf64_x86_64_hash_table (info); + dynobj = htab->elf.dynobj; + if (dynobj == NULL) + abort (); - if (elf_hash_table (info)->dynamic_sections_created) + if (htab->elf.dynamic_sections_created) { /* Set the contents of the .interp section to the interpreter. */ if (! info->shared) { s = bfd_get_section_by_name (dynobj, ".interp"); - BFD_ASSERT (s != NULL); + if (s == NULL) + abort (); s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER; s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; } } - else - { - /* We may have created entries in the .rela.got section. - However, if we are not creating the dynamic sections, we will - not actually use these entries. Reset the size of .rela.got, - which will cause it to get stripped from the output file - below. */ - s = bfd_get_section_by_name (dynobj, ".rela.got"); - if (s != NULL) - s->_raw_size = 0; - } - /* 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) - elf64_x86_64_link_hash_traverse (elf64_x86_64_hash_table (info), - elf64_x86_64_discard_copies, - (PTR) info); - - /* The check_relocs and adjust_dynamic_symbol entry points have - determined the sizes of the various dynamic sections. Allocate - memory for them. */ - plt = relocs = false; - for (s = dynobj->sections; s != NULL; s = s->next) - { - const char *name; - boolean strip; + /* Set up .got offsets for local syms, and space for local dynamic + relocs. */ + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) + { + bfd_signed_vma *local_got; + bfd_signed_vma *end_local_got; + bfd_size_type locsymcount; + Elf_Internal_Shdr *symtab_hdr; + asection *srel; - if ((s->flags & SEC_LINKER_CREATED) == 0) + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour) continue; - /* It's OK to base decisions on the section name, because none - of the dynobj section names depend upon the input files. */ - name = bfd_get_section_name (dynobj, s); - - strip = false; - if (strcmp (name, ".plt") == 0) + for (s = ibfd->sections; s != NULL; s = s->next) { - if (s->_raw_size == 0) - { - /* Strip this section if we don't need it; see the - comment below. */ - strip = true; - } - else + struct elf64_x86_64_dyn_relocs *p; + + for (p = *((struct elf64_x86_64_dyn_relocs **) + &elf_section_data (s)->local_dynrel); + p != NULL; + p = p->next) { - /* Remember whether there is a PLT. */ - plt = true; + if (!bfd_is_abs_section (p->sec) + && bfd_is_abs_section (p->sec->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->sec)->sreloc; + srel->_raw_size += p->count * sizeof (Elf64_External_Rela); + if ((p->sec->output_section->flags & SEC_READONLY) != 0) + info->flags |= DF_TEXTREL; + + } } } - else if (strncmp (name, ".rela", 5) == 0) + + 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) { - if (s->_raw_size == 0) + if (*local_got > 0) { - /* If we don't need this section, strip it from the - output file. This is mostly to handle .rela.bss and - .rela.plt. We must create both sections in - create_dynamic_sections, because they must be created - before the linker maps input sections to output - sections. The linker does that before - adjust_dynamic_symbol is called, and it is that - function which decides whether anything needs to go - into these sections. */ - strip = true; + *local_got = s->_raw_size; + s->_raw_size += GOT_ENTRY_SIZE; + if (info->shared) + srel->_raw_size += sizeof (Elf64_External_Rela); } else - { - if (strcmp (name, ".rela.plt") != 0) - relocs = true; + *local_got = (bfd_vma) -1; + } + } - /* We use the reloc_count field as a counter if we need - to copy relocs into the output file. */ - s->reloc_count = 0; - } + /* Allocate global sym .plt and .got entries, and space for global + sym dynamic relocs. */ + elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info); + + /* We now have determined the sizes of the various dynamic sections. + Allocate memory for them. */ + relocs = false; + for (s = dynobj->sections; s != NULL; s = s->next) + { + if ((s->flags & SEC_LINKER_CREATED) == 0) + continue; + + if (s == htab->splt + || s == htab->sgot + || s == htab->sgotplt) + { + /* Strip this section if we don't need it; see the + comment below. */ } - else if (strncmp (name, ".got", 4) != 0) + else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0) + { + if (s->_raw_size != 0 && s != htab->srelplt) + relocs = true; + + /* We use the reloc_count field as a counter if we need + to copy relocs into the output file. */ + s->reloc_count = 0; + } + else { /* It's not one of our sections, so don't allocate space. */ continue; } - if (strip) + if (s->_raw_size == 0) { + /* If we don't need this section, strip it from the + output file. This is mostly to handle .rela.bss and + .rela.plt. We must create both sections in + create_dynamic_sections, because they must be created + before the linker maps input sections to output + sections. The linker does that before + adjust_dynamic_symbol is called, and it is that + function which decides whether anything needs to go + into these sections. */ + _bfd_strip_section_from_output (info, s); continue; } @@ -1053,11 +1414,11 @@ elf64_x86_64_size_dynamic_sections (outp but this way if it does, we get a R_X86_64_NONE reloc instead of garbage. */ s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); - if (s->contents == NULL && s->_raw_size != 0) + if (s->contents == NULL) return false; } - if (elf_hash_table (info)->dynamic_sections_created) + if (htab->elf.dynamic_sections_created) { /* Add some entries to the .dynamic section. We fill in the values later, in elf64_x86_64_finish_dynamic_sections, but we @@ -1073,7 +1434,7 @@ elf64_x86_64_size_dynamic_sections (outp return false; } - if (plt) + if (htab->splt->_raw_size != 0) { if (!add_dynamic_entry (DT_PLTGOT, 0) || !add_dynamic_entry (DT_PLTRELSZ, 0) @@ -1088,12 +1449,18 @@ elf64_x86_64_size_dynamic_sections (outp || !add_dynamic_entry (DT_RELASZ, 0) || !add_dynamic_entry (DT_RELAENT, sizeof (Elf64_External_Rela))) return false; - } - if ((info->flags & DF_TEXTREL) != 0) - { - if (!add_dynamic_entry (DT_TEXTREL, 0)) - return false; + /* If any dynamic relocs apply to a read-only section, + then we need a DT_TEXTREL entry. */ + if ((info->flags & DF_TEXTREL) == 0) + elf_link_hash_traverse (&htab->elf, readonly_dynrelocs, + (PTR) info); + + if ((info->flags & DF_TEXTREL) != 0) + { + if (!add_dynamic_entry (DT_TEXTREL, 0)) + return false; + } } } #undef add_dynamic_entry @@ -1101,37 +1468,6 @@ elf64_x86_64_size_dynamic_sections (outp return true; } -/* This function is called via elf64_x86_64_link_hash_traverse if we are - creating a shared object. In the -Bsymbolic case, it discards the - space allocated to copy PC relative relocs against symbols which - are defined in regular objects. For the normal non-symbolic case, - we also discard space for relocs that have become local due to - symbol visibility changes. We allocated space for them in the - check_relocs routine, but we won't fill them in in the - relocate_section routine. */ - -static boolean -elf64_x86_64_discard_copies (h, inf) - struct elf64_x86_64_link_hash_entry *h; - PTR inf; -{ - struct elf64_x86_64_pcrel_relocs_copied *s; - struct bfd_link_info *info = (struct bfd_link_info *) inf; - - /* If a symbol has been forced local or we have found a regular - definition for the symbolic link case, then we won't be needing - any relocs. */ - if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0 - && ((h->root.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0 - || info->symbolic)) - { - for (s = h->pcrel_relocs_copied; s != NULL; s = s->next) - s->section->_raw_size -= s->count * sizeof (Elf64_External_Rela); - } - - return true; -} - /* Relocate an x86_64 ELF section. */ static boolean @@ -1146,31 +1482,21 @@ elf64_x86_64_relocate_section (output_bf Elf_Internal_Sym *local_syms; asection **local_sections; { - bfd *dynobj; + struct elf64_x86_64_link_hash_table *htab; Elf_Internal_Shdr *symtab_hdr; struct elf_link_hash_entry **sym_hashes; bfd_vma *local_got_offsets; - asection *sgot; - asection *splt; - asection *sreloc; - Elf_Internal_Rela *rela; + Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; - dynobj = elf_hash_table (info)->dynobj; + htab = elf64_x86_64_hash_table (info); symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); local_got_offsets = elf_local_got_offsets (input_bfd); - sreloc = splt = sgot = NULL; - if (dynobj != NULL) - { - splt = bfd_get_section_by_name (dynobj, ".plt"); - sgot = bfd_get_section_by_name (dynobj, ".got"); - } - - rela = relocs; + rel = relocs; relend = relocs + input_section->reloc_count; - for (; rela < relend; rela++) + for (; rel < relend; rel++) { int r_type; reloc_howto_type *howto; @@ -1178,23 +1504,24 @@ elf64_x86_64_relocate_section (output_bf struct elf_link_hash_entry *h; Elf_Internal_Sym *sym; asection *sec; + bfd_vma off; bfd_vma relocation; + boolean unresolved_reloc; bfd_reloc_status_type r; - unsigned int indx; - r_type = ELF64_R_TYPE (rela->r_info); + r_type = ELF64_R_TYPE (rel->r_info); if (r_type == (int) R_X86_64_GNU_VTINHERIT || r_type == (int) R_X86_64_GNU_VTENTRY) continue; - if ((indx = (unsigned) r_type) >= R_X86_64_max) + if (r_type < 0 || r_type >= R_X86_64_max) { bfd_set_error (bfd_error_bad_value); return false; } - howto = x86_64_elf_howto_table + indx; + howto = x86_64_elf_howto_table + r_type; - r_symndx = ELF64_R_SYM (rela->r_info); + r_symndx = ELF64_R_SYM (rel->r_info); if (info->relocateable) { @@ -1208,7 +1535,7 @@ elf64_x86_64_relocate_section (output_bf if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) { sec = local_sections[r_symndx]; - rela->r_addend += sec->output_offset + sym->st_value; + rel->r_addend += sec->output_offset + sym->st_value; } } @@ -1219,11 +1546,13 @@ elf64_x86_64_relocate_section (output_bf h = NULL; sym = NULL; sec = NULL; + unresolved_reloc = false; if (r_symndx < symtab_hdr->sh_info) { sym = local_syms + r_symndx; sec = local_sections[r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rela); + + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); } else { @@ -1231,50 +1560,18 @@ elf64_x86_64_relocate_section (output_bf while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) { sec = h->root.u.def.section; - if ((r_type == R_X86_64_PLT32 - && splt != NULL - && h->plt.offset != (bfd_vma) -1) - || ((r_type == R_X86_64_GOT32 || r_type == R_X86_64_GOTPCREL) - && elf_hash_table (info)->dynamic_sections_created - && (!info->shared - || (! info->symbolic && h->dynindx != -1) - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)) - || (info->shared - && ((! info->symbolic && h->dynindx != -1) - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0) - && (r_type == R_X86_64_8 - || r_type == R_X86_64_16 - || r_type == R_X86_64_32 - || r_type == R_X86_64_64 - || r_type == R_X86_64_PC8 - || r_type == R_X86_64_PC16 - || r_type == R_X86_64_PC32) - && ((input_section->flags & SEC_ALLOC) != 0 - /* DWARF will emit R_X86_64_32 relocations in its - sections against symbols defined externally - in shared libraries. We can't do anything - with them here. */ - || ((input_section->flags & SEC_DEBUGGING) != 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) != 0)))) - { - /* In these cases, we don't need the relocation - value. We check specially because in some - obscure cases sec->output_section will be NULL. */ - relocation = 0; - } - else if (sec->output_section == NULL) + if (sec->output_section == NULL) { - (*_bfd_error_handler) - (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"), - bfd_archive_filename (input_bfd), h->root.root.string, - bfd_get_section_name (input_bfd, input_section)); + /* Set a flag that will be cleared later if we find a + relocation value for this symbol. output_section + is typically NULL for symbols satisfied by a shared + library. */ + unresolved_reloc = true; relocation = 0; } else @@ -1293,14 +1590,13 @@ elf64_x86_64_relocate_section (output_bf { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, - input_section, rela->r_offset, + input_section, rel->r_offset, (!info->shared || info->no_undefined || ELF_ST_VISIBILITY (h->other))))) return false; relocation = 0; } } - /* When generating a shared object, the relocations handled here are copied into the output file to be resolved at run time. */ switch (r_type) @@ -1310,16 +1606,21 @@ elf64_x86_64_relocate_section (output_bf offset table. */ case R_X86_64_GOTPCREL: /* Use global offset table as symbol value. */ - BFD_ASSERT (sgot != NULL); + if (htab->sgot == NULL) + abort (); if (h != NULL) { - bfd_vma off = h->got.offset; - BFD_ASSERT (off != (bfd_vma) -1); + boolean dyn; - if (! elf_hash_table (info)->dynamic_sections_created + off = h->got.offset; + dyn = htab->elf.dynamic_sections_created; + + if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h) || (info->shared - && (info->symbolic || h->dynindx == -1) + && (info->symbolic + || h->dynindx == -1 + || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL)) && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) { /* This is actually a static link, or it is a -Bsymbolic @@ -1338,21 +1639,17 @@ elf64_x86_64_relocate_section (output_bf else { bfd_put_64 (output_bfd, relocation, - sgot->contents + off); + htab->sgot->contents + off); h->got.offset |= 1; } } - if (r_type == R_X86_64_GOTPCREL) - relocation = sgot->output_section->vma + sgot->output_offset + off; else - relocation = sgot->output_offset + off; + unresolved_reloc = false; } else { - bfd_vma off; - - BFD_ASSERT (local_got_offsets != NULL - && local_got_offsets[r_symndx] != (bfd_vma) -1); + if (local_got_offsets == NULL) + abort (); off = local_got_offsets[r_symndx]; @@ -1363,39 +1660,42 @@ elf64_x86_64_relocate_section (output_bf off &= ~1; else { - bfd_put_64 (output_bfd, relocation, sgot->contents + off); + bfd_put_64 (output_bfd, relocation, + htab->sgot->contents + off); if (info->shared) { asection *srelgot; Elf_Internal_Rela outrel; + Elf64_External_Rela *loc; /* We need to generate a R_X86_64_RELATIVE reloc for the dynamic linker. */ - srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); - BFD_ASSERT (srelgot != NULL); + srelgot = htab->srelgot; + if (srelgot == NULL) + abort (); - outrel.r_offset = (sgot->output_section->vma - + sgot->output_offset + outrel.r_offset = (htab->sgot->output_section->vma + + htab->sgot->output_offset + off); outrel.r_info = ELF64_R_INFO (0, R_X86_64_RELATIVE); outrel.r_addend = relocation; - bfd_elf64_swap_reloca_out (output_bfd, &outrel, - (((Elf64_External_Rela *) - srelgot->contents) - + srelgot->reloc_count)); - ++srelgot->reloc_count; + loc = (Elf64_External_Rela *) srelgot->contents; + loc += srelgot->reloc_count++; + bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc); } local_got_offsets[r_symndx] |= 1; } - - if (r_type == R_X86_64_GOTPCREL) - relocation = sgot->output_section->vma + sgot->output_offset + off; - else - relocation = sgot->output_offset + off; } + if (off >= (bfd_vma) -2) + abort (); + + relocation = htab->sgot->output_offset + off; + if (r_type == R_X86_64_GOTPCREL) + relocation += htab->sgot->output_section->vma; + break; case R_X86_64_PLT32: @@ -1407,7 +1707,8 @@ elf64_x86_64_relocate_section (output_bf if (h == NULL) break; - if (h->plt.offset == (bfd_vma) -1 || splt == NULL) + if (h->plt.offset == (bfd_vma) -1 + || htab->splt == NULL) { /* We didn't make a PLT entry for this symbol. This happens when statically linking PIC code, or when @@ -1415,133 +1716,105 @@ elf64_x86_64_relocate_section (output_bf break; } - relocation = (splt->output_section->vma - + splt->output_offset + relocation = (htab->splt->output_section->vma + + htab->splt->output_offset + h->plt.offset); + unresolved_reloc = false; break; case R_X86_64_PC8: case R_X86_64_PC16: case R_X86_64_PC32: - if (h == NULL || h->dynindx == -1 - || (info->symbolic - && h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) - break; - /* Fall through. */ case R_X86_64_8: case R_X86_64_16: case R_X86_64_32: case R_X86_64_64: /* FIXME: The ABI says the linker should make sure the value is the same when it's zeroextended to 64 bit. */ - if (info->shared - && r_symndx != 0 - && (input_section->flags & SEC_ALLOC) != 0) + + /* 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 + || (input_section->flags & SEC_ALLOC) == 0) + break; + + if ((info->shared + && ((r_type != R_X86_64_PC8 + && r_type != R_X86_64_PC16 + && r_type != R_X86_64_PC32) + || (h != NULL + && h->dynindx != -1 + && (! info->symbolic + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)))) + || (!info->shared + && h != NULL + && h->dynindx != -1 + && (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) + || h->root.type == bfd_link_hash_undefweak + || h->root.type == bfd_link_hash_undefined))) { Elf_Internal_Rela outrel; boolean skip, relocate; + asection *sreloc; + Elf64_External_Rela *loc; /* When generating a shared object, these relocations are copied into the output file to be resolved at run time. */ - if (sreloc == NULL) - { - const char *name; - - name = (bfd_elf_string_from_elf_section - (input_bfd, - elf_elfheader (input_bfd)->e_shstrndx, - elf_section_data (input_section)->rel_hdr.sh_name)); - if (name == NULL) - return false; - - BFD_ASSERT (strncmp (name, ".rela", 5) == 0 - && strcmp (bfd_get_section_name (input_bfd, - input_section), - name + 5) == 0); - - sreloc = bfd_get_section_by_name (dynobj, name); - BFD_ASSERT (sreloc != NULL); - } - skip = false; + relocate = false; outrel.r_offset = _bfd_elf_section_offset (output_bfd, info, input_section, - rela->r_offset); + rel->r_offset); if (outrel.r_offset == (bfd_vma) -1) skip = true; + else if (outrel.r_offset == (bfd_vma) -2) + skip = true, relocate = true; outrel.r_offset += (input_section->output_section->vma + input_section->output_offset); if (skip) - { - memset (&outrel, 0, sizeof outrel); - relocate = false; - } + memset (&outrel, 0, sizeof outrel); + /* h->dynindx may be -1 if this symbol was marked to become local. */ else if (h != NULL - && ((! info->symbolic && h->dynindx != -1) + && h->dynindx != -1 + && (r_type == R_X86_64_PC8 + || r_type == R_X86_64_PC16 + || r_type == R_X86_64_PC32 + || !info->shared + || !info->symbolic || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)) { - BFD_ASSERT (h->dynindx != -1); - relocate = false; outrel.r_info = ELF64_R_INFO (h->dynindx, r_type); - outrel.r_addend = relocation + rela->r_addend; + outrel.r_addend = rel->r_addend; } else { - if (r_type == R_X86_64_64) - { - relocate = true; - outrel.r_info = ELF64_R_INFO (0, R_X86_64_RELATIVE); - outrel.r_addend = relocation + rela->r_addend; - } - else - { - 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)) - sindx = 0; - else if (sec == NULL || sec->owner == NULL) - { - bfd_set_error (bfd_error_bad_value); - return false; - } - else - { - asection *osec; - - osec = sec->output_section; - sindx = elf_section_data (osec)->dynindx; - BFD_ASSERT (sindx > 0); - } - - relocate = false; - outrel.r_info = ELF64_R_INFO (sindx, r_type); - outrel.r_addend = relocation + rela->r_addend; - } - + /* This symbol is local, or marked to become local. */ + relocate = true; + outrel.r_info = ELF64_R_INFO (0, R_X86_64_RELATIVE); + outrel.r_addend = relocation + rel->r_addend; } - bfd_elf64_swap_reloca_out (output_bfd, &outrel, - (((Elf64_External_Rela *) - sreloc->contents) - + sreloc->reloc_count)); - ++sreloc->reloc_count; + sreloc = elf_section_data (input_section)->sreloc; + if (sreloc == NULL) + abort (); + + loc = (Elf64_External_Rela *) sreloc->contents; + loc += sreloc->reloc_count++; + bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc); /* If this reloc is against an external symbol, we do not want to fiddle with the addend. Otherwise, we @@ -1557,39 +1830,59 @@ elf64_x86_64_relocate_section (output_bf break; } + /* FIXME: Why do we allow debugging sections to escape this error? + More importantly, why do we not emit dynamic relocs for + R_386_32 above in debugging sections (which are ! SEC_ALLOC)? + If we had emitted the dynamic reloc, we could remove the + fudge here. */ + if (unresolved_reloc + && !(info->shared + && (input_section->flags & SEC_DEBUGGING) != 0 + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) + (*_bfd_error_handler) + (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"), + bfd_archive_filename (input_bfd), + bfd_get_section_name (input_bfd, input_section), + (long) rel->r_offset, + h->root.root.string); + r = _bfd_final_link_relocate (howto, input_bfd, input_section, - contents, rela->r_offset, - relocation, rela->r_addend); + contents, rel->r_offset, + relocation, rel->r_addend); if (r != bfd_reloc_ok) { - switch (r) + const char *name; + + if (h != NULL) + name = h->root.root.string; + else { - default: - case bfd_reloc_outofrange: - abort (); - case bfd_reloc_overflow: - { - const char *name; - - if (h != NULL) - name = h->root.root.string; - else - { - name = bfd_elf_string_from_elf_section (input_bfd, - symtab_hdr->sh_link, - sym->st_name); - if (name == NULL) - return false; - if (*name == '\0') - name = bfd_section_name (input_bfd, sec); - } - if (! ((*info->callbacks->reloc_overflow) - (info, name, howto->name, (bfd_vma) 0, - input_bfd, input_section, rela->r_offset))) - return false; - } - break; + name = bfd_elf_string_from_elf_section (input_bfd, + symtab_hdr->sh_link, + sym->st_name); + if (name == NULL) + return false; + if (*name == '\0') + name = bfd_section_name (input_bfd, sec); + } + + if (r == bfd_reloc_overflow) + { + + if (! ((*info->callbacks->reloc_overflow) + (info, name, howto->name, (bfd_vma) 0, + input_bfd, input_section, rel->r_offset))) + return false; + } + else + { + (*_bfd_error_handler) + (_("%s(%s+0x%lx): reloc against `%s': error %d"), + bfd_archive_filename (input_bfd), + bfd_get_section_name (input_bfd, input_section), + (long) rel->r_offset, name, (int) r); + return false; } } } @@ -1607,28 +1900,25 @@ elf64_x86_64_finish_dynamic_symbol (outp struct elf_link_hash_entry *h; Elf_Internal_Sym *sym; { - bfd *dynobj; + struct elf64_x86_64_link_hash_table *htab; - dynobj = elf_hash_table (info)->dynobj; + htab = elf64_x86_64_hash_table (info); if (h->plt.offset != (bfd_vma) -1) { - asection *splt; - asection *sgot; - asection *srela; bfd_vma plt_index; bfd_vma got_offset; Elf_Internal_Rela rela; + Elf64_External_Rela *loc; /* This symbol has an entry in the procedure linkage table. Set it up. */ - BFD_ASSERT (h->dynindx != -1); - - splt = bfd_get_section_by_name (dynobj, ".plt"); - sgot = bfd_get_section_by_name (dynobj, ".got.plt"); - srela = bfd_get_section_by_name (dynobj, ".rela.plt"); - BFD_ASSERT (splt != NULL && sgot != NULL && srela != NULL); + if (h->dynindx == -1 + || htab->splt == NULL + || htab->sgotplt == NULL + || htab->srelplt == NULL) + abort (); /* Get the index in the procedure linkage table which corresponds to this symbol. This is the index of this symbol @@ -1642,7 +1932,7 @@ elf64_x86_64_finish_dynamic_symbol (outp got_offset = (plt_index + 3) * GOT_ENTRY_SIZE; /* Fill in the entry in the procedure linkage table. */ - memcpy (splt->contents + h->plt.offset, elf64_x86_64_plt_entry, + memcpy (htab->splt->contents + h->plt.offset, elf64_x86_64_plt_entry, PLT_ENTRY_SIZE); /* Insert the relocation positions of the plt section. The magic @@ -1651,67 +1941,61 @@ elf64_x86_64_finish_dynamic_symbol (outp /* Put offset for jmp *name@GOTPCREL(%rip), since the instruction uses 6 bytes, subtract this value. */ bfd_put_32 (output_bfd, - (sgot->output_section->vma - + sgot->output_offset + (htab->sgotplt->output_section->vma + + htab->sgotplt->output_offset + got_offset - - splt->output_section->vma - - splt->output_offset + - htab->splt->output_section->vma + - htab->splt->output_offset - h->plt.offset - 6), - splt->contents + h->plt.offset + 2); + htab->splt->contents + h->plt.offset + 2); /* Put relocation index. */ bfd_put_32 (output_bfd, plt_index, - splt->contents + h->plt.offset + 7); + htab->splt->contents + h->plt.offset + 7); /* Put offset for jmp .PLT0. */ bfd_put_32 (output_bfd, - (h->plt.offset + PLT_ENTRY_SIZE), - splt->contents + h->plt.offset + 12); + htab->splt->contents + h->plt.offset + 12); /* Fill in the entry in the global offset table, initially this points to the pushq instruction in the PLT which is at offset 6. */ - bfd_put_64 (output_bfd, (splt->output_section->vma + splt->output_offset + bfd_put_64 (output_bfd, (htab->splt->output_section->vma + + htab->splt->output_offset + h->plt.offset + 6), - sgot->contents + got_offset); + htab->sgotplt->contents + got_offset); /* Fill in the entry in the .rela.plt section. */ - rela.r_offset = (sgot->output_section->vma - + sgot->output_offset + rela.r_offset = (htab->sgotplt->output_section->vma + + htab->sgotplt->output_offset + got_offset); rela.r_info = ELF64_R_INFO (h->dynindx, R_X86_64_JUMP_SLOT); rela.r_addend = 0; - bfd_elf64_swap_reloca_out (output_bfd, &rela, - ((Elf64_External_Rela *) srela->contents - + plt_index)); + loc = (Elf64_External_Rela *) htab->srelplt->contents + plt_index; + bfd_elf64_swap_reloca_out (output_bfd, &rela, loc); if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) { /* Mark the symbol as undefined, rather than as defined in - the .plt section. Leave the value alone. */ + the .plt section. Leave the value alone. This is a clue + for the dynamic linker, to make function pointer + comparisons work between an application and shared + library. */ sym->st_shndx = SHN_UNDEF; - /* If the symbol is weak, we do need to clear the value. - Otherwise, the PLT entry would provide a definition for - the symbol even if the symbol wasn't defined anywhere, - and so the symbol would never be NULL. */ - if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR_NONWEAK) - == 0) - sym->st_value = 0; } } if (h->got.offset != (bfd_vma) -1) { - asection *sgot; - asection *srela; Elf_Internal_Rela rela; + Elf64_External_Rela *loc; /* This symbol has an entry in the global offset table. Set it up. */ - sgot = bfd_get_section_by_name (dynobj, ".got"); - srela = bfd_get_section_by_name (dynobj, ".rela.got"); - BFD_ASSERT (sgot != NULL && srela != NULL); + if (htab->sgot == NULL || htab->srelgot == NULL) + abort (); - rela.r_offset = (sgot->output_section->vma - + sgot->output_offset + rela.r_offset = (htab->sgot->output_section->vma + + htab->sgot->output_offset + (h->got.offset &~ (bfd_vma) 1)); /* If this is a static link, or it is a -Bsymbolic link and the @@ -1719,10 +2003,11 @@ elf64_x86_64_finish_dynamic_symbol (outp 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 (! elf_hash_table (info)->dynamic_sections_created - || (info->shared - && (info->symbolic || h->dynindx == -1) - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) + if (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)) { BFD_ASSERT((h->got.offset & 1) != 0); rela.r_info = ELF64_R_INFO (0, R_X86_64_RELATIVE); @@ -1733,41 +2018,38 @@ elf64_x86_64_finish_dynamic_symbol (outp else { BFD_ASSERT((h->got.offset & 1) == 0); - bfd_put_64 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset); + bfd_put_64 (output_bfd, (bfd_vma) 0, + htab->sgot->contents + h->got.offset); rela.r_info = ELF64_R_INFO (h->dynindx, R_X86_64_GLOB_DAT); rela.r_addend = 0; } - bfd_elf64_swap_reloca_out (output_bfd, &rela, - ((Elf64_External_Rela *) srela->contents - + srela->reloc_count)); - ++srela->reloc_count; + loc = (Elf64_External_Rela *) htab->srelgot->contents; + loc += htab->srelgot->reloc_count++; + bfd_elf64_swap_reloca_out (output_bfd, &rela, loc); } if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0) { - asection *s; Elf_Internal_Rela rela; + Elf64_External_Rela *loc; /* This symbol needs a copy reloc. Set it up. */ - BFD_ASSERT (h->dynindx != -1 - && (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak)); - - s = bfd_get_section_by_name (h->root.u.def.section->owner, - ".rela.bss"); - BFD_ASSERT (s != NULL); + if (h->dynindx == -1 + || (h->root.type != bfd_link_hash_defined + && h->root.type != bfd_link_hash_defweak) + || htab->srelbss == NULL) + abort (); rela.r_offset = (h->root.u.def.value + h->root.u.def.section->output_section->vma + h->root.u.def.section->output_offset); rela.r_info = ELF64_R_INFO (h->dynindx, R_X86_64_COPY); rela.r_addend = 0; - bfd_elf64_swap_reloca_out (output_bfd, &rela, - ((Elf64_External_Rela *) s->contents - + s->reloc_count)); - ++s->reloc_count; + loc = (Elf64_External_Rela *) htab->srelbss->contents; + loc += htab->srelbss->reloc_count++; + bfd_elf64_swap_reloca_out (output_bfd, &rela, loc); } /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */ @@ -1778,6 +2060,26 @@ elf64_x86_64_finish_dynamic_symbol (outp return true; } +/* Used to decide how to sort relocs in an optimal manner for the + dynamic linker, before writing them out. */ + +static enum elf_reloc_type_class +elf64_x86_64_reloc_type_class (rela) + const Elf_Internal_Rela *rela; +{ + switch ((int) ELF64_R_TYPE (rela->r_info)) + { + case R_X86_64_RELATIVE: + return reloc_class_relative; + case R_X86_64_JUMP_SLOT: + return reloc_class_plt; + case R_X86_64_COPY: + return reloc_class_copy; + default: + return reloc_class_normal; + } +} + /* Finish up the dynamic sections. */ static boolean @@ -1785,29 +2087,26 @@ elf64_x86_64_finish_dynamic_sections (ou bfd *output_bfd; struct bfd_link_info *info; { + struct elf64_x86_64_link_hash_table *htab; bfd *dynobj; asection *sdyn; - asection *sgot; - dynobj = elf_hash_table (info)->dynobj; - - sgot = bfd_get_section_by_name (dynobj, ".got.plt"); - BFD_ASSERT (sgot != NULL); + htab = elf64_x86_64_hash_table (info); + dynobj = htab->elf.dynobj; sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); - if (elf_hash_table (info)->dynamic_sections_created) + if (htab->elf.dynamic_sections_created) { - asection *splt; Elf64_External_Dyn *dyncon, *dynconend; - BFD_ASSERT (sdyn != NULL); + if (sdyn == NULL || htab->sgot == NULL) + abort (); dyncon = (Elf64_External_Dyn *) sdyn->contents; dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->_raw_size); for (; dyncon < dynconend; dyncon++) { Elf_Internal_Dyn dyn; - const char *name; asection *s; bfd_elf64_swap_dyn_in (dynobj, dyncon, &dyn); @@ -1818,115 +2117,100 @@ elf64_x86_64_finish_dynamic_sections (ou continue; case DT_PLTGOT: - name = ".got"; - goto get_vma; + dyn.d_un.d_ptr = htab->sgot->output_section->vma; + break; case DT_JMPREL: - name = ".rela.plt"; + dyn.d_un.d_ptr = htab->srelplt->output_section->vma; + break; - get_vma: - s = bfd_get_section_by_name (output_bfd, name); - BFD_ASSERT (s != NULL); - dyn.d_un.d_ptr = s->vma; + case DT_PLTRELSZ: + s = htab->srelplt->output_section; + if (s->_cooked_size != 0) + dyn.d_un.d_val = s->_cooked_size; + else + dyn.d_un.d_val = s->_raw_size; break; case DT_RELASZ: - /* FIXME: This comment and code is from elf64-alpha.c: */ - /* My interpretation of the TIS v1.1 ELF document indicates - that RELASZ should not include JMPREL. This is not what - the rest of the BFD does. It is, however, what the - glibc ld.so wants. Do this fixup here until we found - out who is right. */ - s = bfd_get_section_by_name (output_bfd, ".rela.plt"); - if (s) + /* The procedure linkage table relocs (DT_JMPREL) should + not be included in the overall relocs (DT_RELA). + Therefore, we override the DT_RELASZ entry here to + make it not include the JMPREL relocs. Since the + linker script arranges for .rela.plt to follow all + other relocation sections, we don't have to worry + about changing the DT_RELA entry. */ + if (htab->srelplt != NULL) { - /* Subtract JMPREL size from RELASZ. */ - dyn.d_un.d_val -= - (s->_cooked_size ? s->_cooked_size : s->_raw_size); + s = htab->srelplt->output_section; + if (s->_cooked_size != 0) + dyn.d_un.d_val -= s->_cooked_size; + else + dyn.d_un.d_val -= s->_raw_size; } break; - - case DT_PLTRELSZ: - s = bfd_get_section_by_name (output_bfd, ".rela.plt"); - BFD_ASSERT (s != NULL); - dyn.d_un.d_val = - (s->_cooked_size != 0 ? s->_cooked_size : s->_raw_size); - break; } + bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); } - /* Initialize the contents of the .plt section. */ - splt = bfd_get_section_by_name (dynobj, ".plt"); - BFD_ASSERT (splt != NULL); - if (splt->_raw_size > 0) + /* Fill in the special first entry in the procedure linkage table. */ + if (htab->splt && htab->splt->_raw_size > 0) { /* Fill in the first entry in the procedure linkage table. */ - memcpy (splt->contents, elf64_x86_64_plt0_entry, PLT_ENTRY_SIZE); + memcpy (htab->splt->contents, elf64_x86_64_plt0_entry, + PLT_ENTRY_SIZE); /* Add offset for pushq GOT+8(%rip), since the instruction uses 6 bytes subtract this value. */ bfd_put_32 (output_bfd, - (sgot->output_section->vma - + sgot->output_offset + (htab->sgotplt->output_section->vma + + htab->sgotplt->output_offset + 8 - - splt->output_section->vma - - splt->output_offset + - htab->splt->output_section->vma + - htab->splt->output_offset - 6), - splt->contents + 2); + htab->splt->contents + 2); /* Add offset for jmp *GOT+16(%rip). The 12 is the offset to the end of the instruction. */ bfd_put_32 (output_bfd, - (sgot->output_section->vma - + sgot->output_offset + (htab->sgotplt->output_section->vma + + htab->sgotplt->output_offset + 16 - - splt->output_section->vma - - splt->output_offset + - htab->splt->output_section->vma + - htab->splt->output_offset - 12), - splt->contents + 8); + htab->splt->contents + 8); + elf_section_data (htab->splt->output_section)->this_hdr.sh_entsize = + PLT_ENTRY_SIZE; } - - elf_section_data (splt->output_section)->this_hdr.sh_entsize = - PLT_ENTRY_SIZE; } - /* Set the first entry in the global offset table to the address of - the dynamic section. */ - if (sgot->_raw_size > 0) + if (htab->sgotplt) { - if (sdyn == NULL) - bfd_put_64 (output_bfd, (bfd_vma) 0, sgot->contents); - else - bfd_put_64 (output_bfd, - sdyn->output_section->vma + sdyn->output_offset, - sgot->contents); - /* Write GOT[1] and GOT[2], needed for the dynamic linker. */ - bfd_put_64 (output_bfd, (bfd_vma) 0, sgot->contents + GOT_ENTRY_SIZE); - bfd_put_64 (output_bfd, (bfd_vma) 0, sgot->contents + GOT_ENTRY_SIZE*2); - } + /* Fill in the first three entries in the global offset table. */ + if (htab->sgotplt->_raw_size > 0) + { + /* Set the first entry in the global offset table to the address of + the dynamic section. */ + if (sdyn == NULL) + bfd_put_64 (output_bfd, (bfd_vma) 0, htab->sgotplt->contents); + else + bfd_put_64 (output_bfd, + sdyn->output_section->vma + sdyn->output_offset, + htab->sgotplt->contents); + /* Write GOT[1] and GOT[2], needed for the dynamic linker. */ + bfd_put_64 (output_bfd, (bfd_vma) 0, htab->sgotplt->contents + GOT_ENTRY_SIZE); + bfd_put_64 (output_bfd, (bfd_vma) 0, htab->sgotplt->contents + GOT_ENTRY_SIZE*2); + } - elf_section_data (sgot->output_section)->this_hdr.sh_entsize = - GOT_ENTRY_SIZE; + elf_section_data (htab->sgotplt->output_section)->this_hdr.sh_entsize = + GOT_ENTRY_SIZE; + } return true; } -static enum elf_reloc_type_class -elf64_x86_64_reloc_type_class (rela) - const Elf_Internal_Rela *rela; -{ - switch ((int) ELF64_R_TYPE (rela->r_info)) - { - case R_X86_64_RELATIVE: - return reloc_class_relative; - case R_X86_64_JUMP_SLOT: - return reloc_class_plt; - case R_X86_64_COPY: - return reloc_class_copy; - default: - return reloc_class_normal; - } -} #define TARGET_LITTLE_SYM bfd_elf64_x86_64_vec #define TARGET_LITTLE_NAME "elf64-x86-64" @@ -1944,22 +2228,21 @@ elf64_x86_64_reloc_type_class (rela) #define elf_info_to_howto elf64_x86_64_info_to_howto -#define bfd_elf64_bfd_final_link _bfd_elf64_gc_common_final_link #define bfd_elf64_bfd_link_hash_table_create \ elf64_x86_64_link_hash_table_create #define bfd_elf64_bfd_reloc_type_lookup elf64_x86_64_reloc_type_lookup #define elf_backend_adjust_dynamic_symbol elf64_x86_64_adjust_dynamic_symbol #define elf_backend_check_relocs elf64_x86_64_check_relocs -#define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections -#define elf_backend_finish_dynamic_sections \ - elf64_x86_64_finish_dynamic_sections +#define elf_backend_copy_indirect_symbol elf64_x86_64_copy_indirect_symbol +#define elf_backend_create_dynamic_sections elf64_x86_64_create_dynamic_sections +#define elf_backend_finish_dynamic_sections elf64_x86_64_finish_dynamic_sections #define elf_backend_finish_dynamic_symbol elf64_x86_64_finish_dynamic_symbol #define elf_backend_gc_mark_hook elf64_x86_64_gc_mark_hook #define elf_backend_gc_sweep_hook elf64_x86_64_gc_sweep_hook +#define elf_backend_reloc_type_class elf64_x86_64_reloc_type_class #define elf_backend_relocate_section elf64_x86_64_relocate_section #define elf_backend_size_dynamic_sections elf64_x86_64_size_dynamic_sections #define elf_backend_object_p elf64_x86_64_elf_object_p -#define elf_backend_reloc_type_class elf64_x86_64_reloc_type_class #include "elf64-target.h" diff -uprN binutils-2.11.93.0.2/bfd/elflink.h binutils-2.12.90.0.1/bfd/elflink.h --- binutils-2.11.93.0.2/bfd/elflink.h Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/elflink.h Thu Mar 7 11:52:36 2002 @@ -1,5 +1,5 @@ /* ELF linker support. - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001 + Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -744,7 +744,7 @@ elf_merge_symbol (abfd, info, name, sym, asection *hsec; /* This code handles the special SHN_MIPS_{TEXT,DATA} section - indices used by MIPS ELF. */ + indices used by MIPS ELF. */ switch (h->root.type) { default: @@ -854,10 +854,10 @@ elf_merge_symbol (abfd, info, name, sym, && sym->st_size != h->size) { /* Since we think we have two common symbols, issue a multiple - common warning if desired. Note that we only warn if the - size is different. If the size is the same, we simply let - the old symbol override the new one as normally happens with - symbols defined in dynamic objects. */ + common warning if desired. Note that we only warn if the + size is different. If the size is the same, we simply let + the old symbol override the new one as normally happens with + symbols defined in dynamic objects. */ if (! ((*info->callbacks->multiple_common) (info, h->root.root.string, oldbfd, bfd_link_hash_common, @@ -907,10 +907,10 @@ elf_merge_symbol (abfd, info, name, sym, *size_change_ok = true; /* If we get here when the old symbol is a common symbol, then - we are explicitly letting it override a weak symbol or - function in a dynamic object, and we don't want to warn about - a type change. If the old symbol is a defined symbol, a type - change warning may still be appropriate. */ + we are explicitly letting it override a weak symbol or + function in a dynamic object, and we don't want to warn about + a type change. If the old symbol is a defined symbol, a type + change warning may still be appropriate. */ if (h->root.type == bfd_link_hash_common) *type_change_ok = true; @@ -969,7 +969,7 @@ elf_merge_symbol (abfd, info, name, sym, olddyncommon = false; /* We again permit a type change when a common symbol may be - overriding a function. */ + overriding a function. */ if (bfd_is_com_section (sec)) *type_change_ok = true; @@ -981,11 +981,11 @@ elf_merge_symbol (abfd, info, name, sym, h->verinfo.vertree = NULL; /* In this special case, if H is the target of an indirection, - we want the caller to frob with H rather than with the - indirect symbol. That will permit the caller to redefine the - target of the indirection, rather than the indirect symbol - itself. FIXME: This will break the -y option if we store a - symbol with a different name. */ + we want the caller to frob with H rather than with the + indirect symbol. That will permit the caller to redefine the + target of the indirection, rather than the indirect symbol + itself. FIXME: This will break the -y option if we store a + symbol with a different name. */ *sym_hash = h; } @@ -1008,7 +1008,7 @@ elf_merge_symbol (abfd, info, name, sym, return false; /* If the predumed common symbol in the dynamic object is - larger, pretend that the new symbol has its size. */ + larger, pretend that the new symbol has its size. */ if (h->size > *pvalue) *pvalue = h->size; @@ -1042,8 +1042,8 @@ elf_merge_symbol (abfd, info, name, sym, && bind != STB_WEAK) { /* To make this work we have to frob the flags so that the rest - of the code does not think we are using the regular - definition. */ + of the code does not think we are using the regular + definition. */ if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0) h->elf_link_hash_flags |= ELF_LINK_HASH_REF_REGULAR; else if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0) @@ -1052,9 +1052,9 @@ elf_merge_symbol (abfd, info, name, sym, | ELF_LINK_HASH_DEF_DYNAMIC); /* If H is the target of an indirection, we want the caller to - use H rather than the indirect symbol. Otherwise if we are - defining a new indirect symbol we will wind up attaching it - to the entry we are overriding. */ + use H rather than the indirect symbol. Otherwise if we are + defining a new indirect symbol we will wind up attaching it + to the entry we are overriding. */ *sym_hash = h; } @@ -1199,7 +1199,7 @@ elf_add_default_symbol (abfd, info, h, n } /* Now set HI to H, so that the following code will set the - other fields correctly. */ + other fields correctly. */ hi = h; } @@ -1285,7 +1285,7 @@ elf_add_default_symbol (abfd, info, h, n & (ELF_LINK_HASH_DEF_DYNAMIC | ELF_LINK_HASH_DEF_REGULAR)) == 0); - (*bed->elf_backend_copy_indirect_symbol) (h, hi); + (*bed->elf_backend_copy_indirect_symbol) (h, hi); /* See if the new flags lead us to realize that the symbol must be dynamic. */ @@ -1411,8 +1411,8 @@ elf_link_add_object_symbols (abfd, info) || h->root.type == bfd_link_hash_defweak)) { /* We don't want to issue this warning. Clobber - the section size so that the warning does not - get copied into the output file. */ + the section size so that the warning does not + get copied into the output file. */ s->_raw_size = 0; continue; } @@ -1436,7 +1436,7 @@ elf_link_add_object_symbols (abfd, info) if (! info->relocateable) { /* Clobber the section size so that the warning does - not get copied into the output file. */ + not get copied into the output file. */ s->_raw_size = 0; } } @@ -1467,7 +1467,7 @@ elf_link_add_object_symbols (abfd, info) goto error_return; /* Read in the symbol versions, but don't bother to convert them - to internal format. */ + to internal format. */ if (elf_dynversym (abfd) != 0) { Elf_Internal_Shdr *versymhdr; @@ -1525,10 +1525,10 @@ elf_link_add_object_symbols (abfd, info) if (! dynamic) { /* If we are creating a shared library, create all the dynamic - sections immediately. We need to attach them to something, - so we attach them to this BFD, provided it is the right - format. FIXME: If there are no input BFD's of the same - format as the output, we can't make a shared library. */ + sections immediately. We need to attach them to something, + so we attach them to this BFD, provided it is the right + format. FIXME: If there are no input BFD's of the same + format as the output, we can't make a shared library. */ if (info->shared && is_elf_hash_table (info) && ! hash_table->dynamic_sections_created @@ -1563,7 +1563,7 @@ elf_link_add_object_symbols (abfd, info) if (*name == '\0') { if (elf_dt_soname (abfd) != NULL) - dt_needed = true; + dt_needed = true; add_needed = false; } @@ -1683,7 +1683,7 @@ elf_link_add_object_symbols (abfd, info) } /* Ignore DT_RPATH if we have seen DT_RUNPATH. */ if (!runpath && dyn.d_tag == DT_RPATH) - { + { struct bfd_link_needed_list *n, **pn; char *fnm, *anm; unsigned int tagv = dyn.d_un.d_val; @@ -1775,7 +1775,7 @@ elf_link_add_object_symbols (abfd, info) } /* Save the SONAME, if there is one, because sometimes the - linker emulation code will need to know it. */ + linker emulation code will need to know it. */ if (*name == '\0') name = basename (bfd_get_filename (abfd)); elf_dt_name (abfd) = name; @@ -1916,10 +1916,10 @@ elf_link_add_object_symbols (abfd, info) vernum = iver.vs_vers & VERSYM_VERSION; /* If this is a hidden symbol, or if it is not version - 1, we append the version name to the symbol name. - However, we do not modify a non-hidden absolute - symbol, because it might be the version symbol - itself. FIXME: What if it isn't? */ + 1, we append the version name to the symbol name. + However, we do not modify a non-hidden absolute + symbol, because it might be the version symbol + itself. FIXME: What if it isn't? */ if ((iver.vs_vers & VERSYM_HIDDEN) != 0 || (vernum > 1 && ! bfd_is_abs_section (sec))) { @@ -2018,10 +2018,10 @@ elf_link_add_object_symbols (abfd, info) h = (struct elf_link_hash_entry *) h->root.u.i.link; /* Remember the old alignment if this is a common symbol, so - that we don't reduce the alignment later on. We can't - check later, because _bfd_generic_link_add_one_symbol - will set a default for the alignment which we want to - override. */ + that we don't reduce the alignment later on. We can't + check later, because _bfd_generic_link_add_one_symbol + will set a default for the alignment which we want to + override. */ if (h->root.type == bfd_link_hash_common) old_alignment = h->root.u.c.p->alignment_power; @@ -2102,10 +2102,10 @@ elf_link_add_object_symbols (abfd, info) } /* If this is a common symbol, then we always want H->SIZE - to be the size of the common symbol. The code just above - won't fix the size if a common symbol becomes larger. We - don't warn about a size change here, because that is - covered by --warn-common. */ + to be the size of the common symbol. The code just above + won't fix the size if a common symbol becomes larger. We + don't warn about a size change here, because that is + covered by --warn-common. */ if (h->root.type == bfd_link_hash_common) h->size = h->root.u.c.size; @@ -2135,8 +2135,8 @@ elf_link_add_object_symbols (abfd, info) h->other = sym.st_other; /* If neither has visibility, use the st_other of the - definition. This is an arbitrary choice, since the - other bits have no general meaning. */ + definition. This is an arbitrary choice, since the + other bits have no general meaning. */ if (!symvis && !hvis && (definition || h->other == 0)) h->other = sym.st_other; @@ -2223,7 +2223,7 @@ elf_link_add_object_symbols (abfd, info) goto error_return; /* The symbol from a DT_NEEDED object is referenced from - the regular object to create a dynamic executable. We + the regular object to create a dynamic executable. We have to make sure there is a DT_NEEDED entry for it. */ dt_needed = false; @@ -2319,10 +2319,10 @@ elf_link_add_object_symbols (abfd, info) } /* If the real definition is in the list of dynamic - symbols, make sure the weak definition is put there - as well. If we don't do this, then the dynamic - loader might not merge the entries for the real - definition and the weak definition. */ + symbols, make sure the weak definition is put there + as well. If we don't do this, then the dynamic + loader might not merge the entries for the real + definition and the weak definition. */ if (h->dynindx != -1 && hlook->dynindx == -1) { @@ -3308,11 +3308,11 @@ NAME(bfd_elf,size_dynamic_sections) (out eif.failed = false; /* If we are supposed to export all symbols into the dynamic symbol - table (this is not the normal case), then do so. */ + table (this is not the normal case), then do so. */ if (info->export_dynamic) { elf_link_hash_traverse (elf_hash_table (info), elf_export_symbol, - (PTR) &eif); + (PTR) &eif); if (eif.failed) return false; } @@ -3368,6 +3368,52 @@ NAME(bfd_elf,size_dynamic_sections) (out return false; } + if (bfd_get_section_by_name (output_bfd, ".preinit_array") != NULL) + { + /* DT_PREINIT_ARRAY is not allowed in shared library. */ + if (info->shared) + { + bfd *sub; + asection *o; + + for (sub = info->input_bfds; sub != NULL; + sub = sub->link_next) + for (o = sub->sections; o != NULL; o = o->next) + if (elf_section_data (o)->this_hdr.sh_type + == SHT_PREINIT_ARRAY) + { + (*_bfd_error_handler) + (_("%s: .preinit_array section is not allowed in DSO"), + bfd_archive_filename (sub)); + break; + } + + return false; + } + + if (!elf_add_dynamic_entry (info, (bfd_vma) DT_PREINIT_ARRAY, + (bfd_vma) 0) + || !elf_add_dynamic_entry (info, (bfd_vma) DT_PREINIT_ARRAYSZ, + (bfd_vma) 0)) + return false; + } + if (bfd_get_section_by_name (output_bfd, ".init_array") != NULL) + { + if (!elf_add_dynamic_entry (info, (bfd_vma) DT_INIT_ARRAY, + (bfd_vma) 0) + || !elf_add_dynamic_entry (info, (bfd_vma) DT_INIT_ARRAYSZ, + (bfd_vma) 0)) + return false; + } + if (bfd_get_section_by_name (output_bfd, ".fini_array") != NULL) + { + if (!elf_add_dynamic_entry (info, (bfd_vma) DT_FINI_ARRAY, + (bfd_vma) 0) + || !elf_add_dynamic_entry (info, (bfd_vma) DT_FINI_ARRAYSZ, + (bfd_vma) 0)) + return false; + } + dynstr = bfd_get_section_by_name (dynobj, ".dynstr"); /* If .dynstr is excluded from the link, we don't want any of these tags. Strictly, we should be checking each section @@ -3407,7 +3453,7 @@ NAME(bfd_elf,size_dynamic_sections) (out BFD_ASSERT (s != NULL); /* We may have created additional version definitions if we are - just linking a regular application. */ + just linking a regular application. */ verdefs = asvinfo.verdefs; /* Skip anonymous version tag. */ @@ -3801,10 +3847,10 @@ NAME(bfd_elf,size_dynamic_sections) (out /* This function is used to adjust offsets into .dynstr for dynamic symbols. This is called via elf_link_hash_traverse. */ - + static boolean elf_adjust_dynstr_offsets PARAMS ((struct elf_link_hash_entry *, PTR)); - + static boolean elf_adjust_dynstr_offsets (h, data) struct elf_link_hash_entry *h; @@ -3884,7 +3930,7 @@ elf_finalize_dynstr (output_bfd, info) bfd_size_type i; Elf_Internal_Verdef def; Elf_Internal_Verdaux defaux; - + s = bfd_get_section_by_name (dynobj, ".gnu.version_d"); p = (bfd_byte *) s->contents; do @@ -3914,7 +3960,7 @@ elf_finalize_dynstr (output_bfd, info) bfd_size_type i; Elf_Internal_Verneed need; Elf_Internal_Vernaux needaux; - + s = bfd_get_section_by_name (dynobj, ".gnu.version_r"); p = (bfd_byte *) s->contents; do @@ -3992,11 +4038,11 @@ elf_fix_symbol_flags (h, eif) else { /* Unfortunately, ELF_LINK_NON_ELF is only correct if the symbol - was first seen in a non-ELF file. Fortunately, if the symbol - was first seen in an ELF file, we're probably OK unless the - symbol was defined in a non-ELF file. Catch that case here. - FIXME: We're still in trouble if the symbol was first seen in - a dynamic object, and then later in a non-ELF regular object. */ + was first seen in a non-ELF file. Fortunately, if the symbol + was first seen in an ELF file, we're probably OK unless the + symbol was defined in a non-ELF file. Catch that case here. + FIXME: We're still in trouble if the symbol was first seen in + a dynamic object, and then later in a non-ELF regular object. */ if ((h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0 @@ -4236,14 +4282,14 @@ elf_export_symbol (h, data) } if (!eif->verdefs) - { + { doit: if (! _bfd_elf_link_record_dynamic_symbol (eif->info, h)) { eif->failed = true; return false; } - } + } } return true; @@ -4369,7 +4415,7 @@ elf_link_assign_sym_version (h, data) hidden = true; /* There are two consecutive ELF_VER_CHR characters if this is - not a hidden symbol. */ + not a hidden symbol. */ ++p; if (*p == ELF_VER_CHR) { @@ -4397,11 +4443,11 @@ elf_link_assign_sym_version (h, data) len = p - h->root.root.string; alc = bfd_malloc ((bfd_size_type) len); if (alc == NULL) - return false; + return false; strncpy (alc, h->root.root.string, len - 1); alc[len - 1] = '\0'; if (alc[len - 2] == ELF_VER_CHR) - alc[len - 2] = '\0'; + alc[len - 2] = '\0'; h->verinfo.vertree = t; t->used = true; @@ -4415,7 +4461,7 @@ elf_link_assign_sym_version (h, data) } /* See if there is anything to force this symbol to - local scope. */ + local scope. */ if (d == NULL && t->locals != NULL) { for (d = t->locals; d != NULL; d = d->next) @@ -4440,14 +4486,14 @@ elf_link_assign_sym_version (h, data) } /* If we are building an application, we need to create a - version node for this version. */ + version node for this version. */ if (t == NULL && ! info->shared) { struct bfd_elf_version_tree **pp; int version_index; /* If we aren't going to export this symbol, we don't need - to worry about it. */ + to worry about it. */ if (h->dynindx == -1) return true; @@ -4483,7 +4529,7 @@ elf_link_assign_sym_version (h, data) else if (t == NULL) { /* We could not find the version for a symbol when - generating a shared archive. Return an error. */ + generating a shared archive. Return an error. */ (*_bfd_error_handler) (_("%s: undefined versioned symbol name %s"), bfd_get_filename (sinfo->output_bfd), h->root.root.string); @@ -4505,8 +4551,8 @@ elf_link_assign_sym_version (h, data) struct bfd_elf_version_expr *d; /* See if can find what version this symbol is in. If the - symbol is supposed to be local, then don't actually register - it. */ + symbol is supposed to be local, then don't actually register + it. */ deflt = NULL; for (t = sinfo->verdefs; t != NULL; t = t->next) { @@ -5026,8 +5072,8 @@ elf_bfd_final_link (abfd, info) dynobj = elf_hash_table (info)->dynobj; emit_relocs = (info->relocateable - || info->emitrelocations - || bed->elf_backend_emit_relocs); + || info->emitrelocations + || bed->elf_backend_emit_relocs); finfo.info = info; finfo.output_bfd = abfd; @@ -5097,7 +5143,7 @@ elf_bfd_final_link (abfd, info) if (info->relocateable || info->emitrelocations) o->reloc_count += sec->reloc_count; - else if (bed->elf_backend_count_relocs) + else if (bed->elf_backend_count_relocs) { Elf_Internal_Rela * relocs; @@ -5105,8 +5151,8 @@ elf_bfd_final_link (abfd, info) (abfd, sec, (PTR) NULL, (Elf_Internal_Rela *) NULL, info->keep_memory)); - o->reloc_count += (*bed->elf_backend_count_relocs) - (sec, relocs); + o->reloc_count + += (*bed->elf_backend_count_relocs) (sec, relocs); if (!info->keep_memory) free (relocs); @@ -5467,28 +5513,25 @@ elf_bfd_final_link (abfd, info) } } + /* Output any global symbols that got converted to local in a + version script or due to symbol visibility. We do this in a + separate step since ELF requires all local symbols to appear + prior to any global symbols. FIXME: We should only do this if + some global symbols were, in fact, converted to become local. + FIXME: Will this work correctly with the Irix 5 linker? */ + eoinfo.failed = false; + eoinfo.finfo = &finfo; + eoinfo.localsyms = true; + elf_link_hash_traverse (elf_hash_table (info), elf_link_output_extsym, + (PTR) &eoinfo); + if (eoinfo.failed) + return false; + /* That wrote out all the local symbols. Finish up the symbol table with the global symbols. Even if we want to strip everything we can, we still need to deal with those global symbols that got converted to local in a version script. */ - if (info->shared) - { - /* Output any global symbols that got converted to local in a - version script. We do this in a separate step since ELF - requires all local symbols to appear prior to any global - symbols. FIXME: We should only do this if some global - symbols were, in fact, converted to become local. FIXME: - Will this work correctly with the Irix 5 linker? */ - eoinfo.failed = false; - eoinfo.finfo = &finfo; - eoinfo.localsyms = true; - elf_link_hash_traverse (elf_hash_table (info), elf_link_output_extsym, - (PTR) &eoinfo); - if (eoinfo.failed) - return false; - } - /* The sh_info field records the index of the first non local symbol. */ symtab_hdr->sh_info = bfd_get_symcount (abfd); @@ -5540,11 +5583,12 @@ elf_bfd_final_link (abfd, info) /* Copy the internal symbol as is. Note that we saved a word of storage and overwrote - the original st_name with the dynstr_index. */ - sym = e->isym; + the original st_name with the dynstr_index. */ + sym = e->isym; - if (e->isym.st_shndx < SHN_LORESERVE - || e->isym.st_shndx > SHN_HIRESERVE) + if (e->isym.st_shndx != SHN_UNDEF + && (e->isym.st_shndx < SHN_LORESERVE + || e->isym.st_shndx > SHN_HIRESERVE)) { s = bfd_section_from_elf_index (e->input_bfd, e->isym.st_shndx); @@ -5717,6 +5761,34 @@ elf_bfd_final_link (abfd, info) } break; + case DT_PREINIT_ARRAYSZ: + name = ".preinit_array"; + goto get_size; + case DT_INIT_ARRAYSZ: + name = ".init_array"; + goto get_size; + case DT_FINI_ARRAYSZ: + name = ".fini_array"; + get_size: + o = bfd_get_section_by_name (abfd, name); + BFD_ASSERT (o != NULL); + if (o->_raw_size == 0) + (*_bfd_error_handler) + (_("warning: %s section has zero size"), name); + dyn.d_un.d_val = o->_raw_size; + elf_swap_dyn_out (dynobj, &dyn, dyncon); + break; + + case DT_PREINIT_ARRAY: + name = ".preinit_array"; + goto get_vma; + case DT_INIT_ARRAY: + name = ".init_array"; + goto get_vma; + case DT_FINI_ARRAY: + name = ".fini_array"; + goto get_vma; + case DT_HASH: name = ".hash"; goto get_vma; @@ -5789,7 +5861,7 @@ elf_bfd_final_link (abfd, info) if ((o->flags & SEC_LINKER_CREATED) == 0) { /* At this point, we are only interested in sections - created by elf_link_create_dynamic_sections. */ + created by elf_link_create_dynamic_sections. */ continue; } if ((elf_section_data (o->output_section)->this_hdr.sh_type @@ -5805,7 +5877,7 @@ elf_bfd_final_link (abfd, info) else { /* The contents of the .dynstr section are actually in a - stringtab. */ + stringtab. */ off = elf_section_data (o->output_section)->this_hdr.sh_offset; if (bfd_seek (abfd, off, SEEK_SET) != 0 || ! _bfd_elf_strtab_emit (abfd, @@ -5861,7 +5933,7 @@ elf_bfd_final_link (abfd, info) { if ((o->flags & SEC_RELOC) != 0 && elf_section_data (o)->rel_hashes != NULL) - free (elf_section_data (o)->rel_hashes); + free (elf_section_data (o)->rel_hashes); } elf_tdata (abfd)->linker = true; @@ -5912,7 +5984,7 @@ elf_link_output_sym (finfo, name, elfsym { Elf_External_Sym *dest; Elf_External_Sym_Shndx *destshndx; - + boolean (*output_symbol_hook) PARAMS ((bfd *, struct bfd_link_info *info, const char *, @@ -6191,18 +6263,18 @@ elf_link_output_extsym (h, data) case bfd_link_hash_indirect: /* These symbols are created by symbol versioning. They point - to the decorated version of the name. For example, if the - symbol foo@@GNU_1.2 is the default, which should be used when - foo is used with no version, then we add an indirect symbol - foo which points to foo@@GNU_1.2. We ignore these symbols, - since the indirected symbol is already in the hash table. */ + to the decorated version of the name. For example, if the + symbol foo@@GNU_1.2 is the default, which should be used when + foo is used with no version, then we add an indirect symbol + foo which points to foo@@GNU_1.2. We ignore these symbols, + since the indirected symbol is already in the hash table. */ return true; case bfd_link_hash_warning: /* We can't represent these symbols in ELF, although a warning - symbol may have come from a .gnu.warning.SYMBOL section. We - just put the target symbol in the hash table. If the target - symbol does not really exist, don't do anything. */ + symbol may have come from a .gnu.warning.SYMBOL section. We + just put the target symbol in the hash table. If the target + symbol does not really exist, don't do anything. */ if (h->root.u.i.link->type == bfd_link_hash_new) return true; return (elf_link_output_extsym @@ -6211,9 +6283,12 @@ elf_link_output_extsym (h, data) /* Give the processor backend a chance to tweak the symbol value, and also to finish up anything that needs to be done for this - symbol. */ + symbol. FIXME: Not calling elf_backend_finish_dynamic_symbol for + forced local syms when non-shared is due to a historical quirk. */ if ((h->dynindx != -1 || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) + && (finfo->info->shared + || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) && elf_hash_table (finfo->info)->dynamic_sections_created) { struct elf_backend_data *bed; @@ -6467,8 +6542,8 @@ elf_link_input_bfd (finfo, input_bfd) return true; emit_relocs = (finfo->info->relocateable - || finfo->info->emitrelocations - || bed->elf_backend_emit_relocs); + || finfo->info->emitrelocations + || bed->elf_backend_emit_relocs); symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; if (elf_bad_symtab (input_bfd)) @@ -6584,10 +6659,10 @@ elf_link_input_bfd (finfo, input_bfd) continue; /* If this symbol is defined in a section which we are - discarding, we don't need to keep it, but note that - linker_mark is only reliable for sections that have contents. - For the benefit of the MIPS ELF linker, we check SEC_EXCLUDE - as well as linker_mark. */ + discarding, we don't need to keep it, but note that + linker_mark is only reliable for sections that have contents. + For the benefit of the MIPS ELF linker, we check SEC_EXCLUDE + as well as linker_mark. */ if ((isym->st_shndx < SHN_LORESERVE || isym->st_shndx > SHN_HIRESERVE) && isec != NULL && ((! isec->linker_mark && (isec->flags & SEC_HAS_CONTENTS) != 0) @@ -6662,9 +6737,9 @@ elf_link_input_bfd (finfo, input_bfd) } /* Get the contents of the section. They have been cached by a - relaxation routine. Note that o is a section in an input - file, so the contents field will not have been set by any of - the routines which work on output files. */ + relaxation routine. Note that o is a section in an input + file, so the contents field will not have been set by any of + the routines which work on output files. */ if (elf_section_data (o)->this_hdr.contents != NULL) contents = elf_section_data (o)->this_hdr.contents; else @@ -6974,23 +7049,23 @@ elf_link_input_bfd (finfo, input_bfd) } /* Swap out the relocs. */ - if (bed->elf_backend_emit_relocs - && !(finfo->info->relocateable + if (bed->elf_backend_emit_relocs + && !(finfo->info->relocateable || finfo->info->emitrelocations)) - reloc_emitter = bed->elf_backend_emit_relocs; - else - reloc_emitter = elf_link_output_relocs; + reloc_emitter = bed->elf_backend_emit_relocs; + else + reloc_emitter = elf_link_output_relocs; input_rel_hdr = &elf_section_data (o)->rel_hdr; - (*reloc_emitter) (output_bfd, o, input_rel_hdr, internal_relocs); + (*reloc_emitter) (output_bfd, o, input_rel_hdr, internal_relocs); input_rel_hdr = elf_section_data (o)->rel_hdr2; - if (input_rel_hdr) - { - internal_relocs += (NUM_SHDR_ENTRIES (input_rel_hdr) + if (input_rel_hdr) + { + internal_relocs += (NUM_SHDR_ENTRIES (input_rel_hdr) * bed->s->int_rels_per_ext_rel); - reloc_emitter (output_bfd, o, input_rel_hdr, internal_relocs); - } + reloc_emitter (output_bfd, o, input_rel_hdr, internal_relocs); + } } } @@ -7090,7 +7165,7 @@ elf_reloc_link_order (output_bfd, info, struct elf_link_hash_entry *h; /* Treat a reloc against a defined symbol as though it were - actually against the section. */ + actually against the section. */ h = ((struct elf_link_hash_entry *) bfd_wrapped_link_hash_lookup (output_bfd, info, link_order->u.reloc.p->u.name, @@ -7105,8 +7180,8 @@ elf_reloc_link_order (output_bfd, info, indx = section->output_section->target_index; *rel_hash_ptr = NULL; /* It seems that we ought to add the symbol value to the - addend here, but in practice it has already been added - because it was passed to constructor_callback. */ + addend here, but in practice it has already been added + because it was passed to constructor_callback. */ addend += section->output_section->vma + section->output_offset; } else if (h != NULL) @@ -7579,7 +7654,7 @@ elf_gc_mark (info, sec, gc_mark_hook) if (elf_bad_symtab (input_bfd)) { nlocsyms = symtab_hdr->sh_size / sizeof (Elf_External_Sym); - extsymoff = 0; + extsymoff = 0; } else extsymoff = nlocsyms = symtab_hdr->sh_info; @@ -7641,11 +7716,11 @@ elf_gc_mark (info, sec, gc_mark_hook) locsym_shndx + (locsym_shndx ? r_symndx : 0), &s); if (ELF_ST_BIND (s.st_info) == STB_LOCAL) - rsec = (*gc_mark_hook) (sec->owner, info, rel, NULL, &s); + rsec = (*gc_mark_hook) (sec->owner, info, rel, NULL, &s); else { - h = sym_hashes[r_symndx - extsymoff]; - rsec = (*gc_mark_hook) (sec->owner, info, rel, h, NULL); + h = sym_hashes[r_symndx - extsymoff]; + rsec = (*gc_mark_hook) (sec->owner, info, rel, h, NULL); } } else if (r_symndx >= nlocsyms) @@ -7816,9 +7891,9 @@ elf_gc_propagate_vtable_entries_used (h, pu = h->vtable_parent->vtable_entries_used; if (pu != NULL) { - asection *sec = h->root.u.def.section; - struct elf_backend_data *bed = get_elf_backend_data (sec->owner); - int file_align = bed->s->file_align; + asection *sec = h->root.u.def.section; + struct elf_backend_data *bed = get_elf_backend_data (sec->owner); + int file_align = bed->s->file_align; n = h->vtable_parent->vtable_entries_size / file_align; while (n--) @@ -7895,7 +7970,7 @@ elf_gc_sections (abfd, info) bfd *sub; asection * (*gc_mark_hook) PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *, - struct elf_link_hash_entry *h, Elf_Internal_Sym *)); + struct elf_link_hash_entry *h, Elf_Internal_Sym *)); if (!get_elf_backend_data (abfd)->can_gc_sections || info->relocateable || info->emitrelocations @@ -7929,7 +8004,7 @@ elf_gc_sections (abfd, info) for (o = sub->sections; o != NULL; o = o->next) { if (o->flags & SEC_KEEP) - if (!elf_gc_mark (info, o, gc_mark_hook)) + if (!elf_gc_mark (info, o, gc_mark_hook)) return false; } } @@ -8349,24 +8424,24 @@ elf_bfd_discard_info (output_bfd, info) freesyms = NULL; if (symtab_hdr->contents) - cookie.locsyms = (void *) symtab_hdr->contents; + cookie.locsyms = (void *) symtab_hdr->contents; else if (cookie.locsymcount == 0) - cookie.locsyms = NULL; + cookie.locsyms = NULL; else - { - bfd_size_type amt = cookie.locsymcount * sizeof (Elf_External_Sym); - cookie.locsyms = bfd_malloc (amt); - if (cookie.locsyms == NULL) + { + bfd_size_type amt = cookie.locsymcount * sizeof (Elf_External_Sym); + cookie.locsyms = bfd_malloc (amt); + if (cookie.locsyms == NULL) return false; freesyms = cookie.locsyms; if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0 - || bfd_bread (cookie.locsyms, amt, abfd) != amt) + || bfd_bread (cookie.locsyms, amt, abfd) != amt) { error_ret_free_loc: free (cookie.locsyms); return false; - } - } + } + } cookie.locsym_shndx = NULL; if (shndx_hdr->sh_size != 0 && cookie.locsymcount != 0) diff -uprN binutils-2.11.93.0.2/bfd/elfxx-ia64.c binutils-2.12.90.0.1/bfd/elfxx-ia64.c --- binutils-2.11.93.0.2/bfd/elfxx-ia64.c Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/elfxx-ia64.c Thu Mar 7 11:52:36 2002 @@ -1016,9 +1016,6 @@ elfNN_ia64_section_from_shdr (abfd, hdr, switch (hdr->sh_type) { case SHT_IA_64_UNWIND: - case SHT_INIT_ARRAY: - case SHT_FINI_ARRAY: - case SHT_PREINIT_ARRAY: case SHT_IA_64_HP_OPT_ANOT: break; @@ -1076,12 +1073,6 @@ elfNN_ia64_fake_sections (abfd, hdr, sec } else if (strcmp (name, ELF_STRING_ia64_archext) == 0) hdr->sh_type = SHT_IA_64_EXT; - else if (strcmp (name, ".init_array") == 0) - hdr->sh_type = SHT_INIT_ARRAY; - else if (strcmp (name, ".fini_array") == 0) - hdr->sh_type = SHT_FINI_ARRAY; - else if (strcmp (name, ".preinit_array") == 0) - hdr->sh_type = SHT_PREINIT_ARRAY; else if (strcmp (name, ".HP.opt_annot") == 0) hdr->sh_type = SHT_IA_64_HP_OPT_ANOT; else if (strcmp (name, ".reloc") == 0) @@ -3107,7 +3098,7 @@ elfNN_ia64_install_dyn_reloc (abfd, info outrel.r_info = ELFNN_R_INFO (dynindx, type); outrel.r_addend = addend; outrel.r_offset = _bfd_elf_section_offset (abfd, info, sec, offset); - if (outrel.r_offset == (bfd_vma) -1) + if ((outrel.r_offset | 1) == (bfd_vma) -1) { /* Run for the hills. We shouldn't be outputting a relocation for this. So do what everyone else does and output a no-op. */ diff -uprN binutils-2.11.93.0.2/bfd/libbfd.h binutils-2.12.90.0.1/bfd/libbfd.h --- binutils-2.11.93.0.2/bfd/libbfd.h Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/libbfd.h Thu Mar 7 11:52:36 2002 @@ -721,6 +721,7 @@ static const char *const bfd_reloc_code_ "BFD_RELOC_ALPHA_CODEADDR", "BFD_RELOC_ALPHA_GPREL_HI16", "BFD_RELOC_ALPHA_GPREL_LO16", + "BFD_RELOC_ALPHA_BRSGP", "BFD_RELOC_MIPS_JMP", "BFD_RELOC_MIPS16_JMP", "BFD_RELOC_MIPS16_GPREL", @@ -751,6 +752,55 @@ static const char *const bfd_reloc_code_ "BFD_RELOC_MIPS_REL16", "BFD_RELOC_MIPS_RELGOT", "BFD_RELOC_MIPS_JALR", + "BFD_RELOC_SH_GOT_LOW16", + "BFD_RELOC_SH_GOT_MEDLOW16", + "BFD_RELOC_SH_GOT_MEDHI16", + "BFD_RELOC_SH_GOT_HI16", + "BFD_RELOC_SH_GOTPLT_LOW16", + "BFD_RELOC_SH_GOTPLT_MEDLOW16", + "BFD_RELOC_SH_GOTPLT_MEDHI16", + "BFD_RELOC_SH_GOTPLT_HI16", + "BFD_RELOC_SH_PLT_LOW16", + "BFD_RELOC_SH_PLT_MEDLOW16", + "BFD_RELOC_SH_PLT_MEDHI16", + "BFD_RELOC_SH_PLT_HI16", + "BFD_RELOC_SH_GOTOFF_LOW16", + "BFD_RELOC_SH_GOTOFF_MEDLOW16", + "BFD_RELOC_SH_GOTOFF_MEDHI16", + "BFD_RELOC_SH_GOTOFF_HI16", + "BFD_RELOC_SH_GOTPC_LOW16", + "BFD_RELOC_SH_GOTPC_MEDLOW16", + "BFD_RELOC_SH_GOTPC_MEDHI16", + "BFD_RELOC_SH_GOTPC_HI16", + "BFD_RELOC_SH_COPY64", + "BFD_RELOC_SH_GLOB_DAT64", + "BFD_RELOC_SH_JMP_SLOT64", + "BFD_RELOC_SH_RELATIVE64", + "BFD_RELOC_SH_GOT10BY4", + "BFD_RELOC_SH_GOT10BY8", + "BFD_RELOC_SH_GOTPLT10BY4", + "BFD_RELOC_SH_GOTPLT10BY8", + "BFD_RELOC_SH_GOTPLT32", + "BFD_RELOC_SH_SHMEDIA_CODE", + "BFD_RELOC_SH_IMMU5", + "BFD_RELOC_SH_IMMS6", + "BFD_RELOC_SH_IMMS6BY32", + "BFD_RELOC_SH_IMMU6", + "BFD_RELOC_SH_IMMS10", + "BFD_RELOC_SH_IMMS10BY2", + "BFD_RELOC_SH_IMMS10BY4", + "BFD_RELOC_SH_IMMS10BY8", + "BFD_RELOC_SH_IMMS16", + "BFD_RELOC_SH_IMMU16", + "BFD_RELOC_SH_IMM_LOW16", + "BFD_RELOC_SH_IMM_LOW16_PCREL", + "BFD_RELOC_SH_IMM_MEDLOW16", + "BFD_RELOC_SH_IMM_MEDLOW16_PCREL", + "BFD_RELOC_SH_IMM_MEDHI16", + "BFD_RELOC_SH_IMM_MEDHI16_PCREL", + "BFD_RELOC_SH_IMM_HI16", + "BFD_RELOC_SH_IMM_HI16_PCREL", + "BFD_RELOC_SH_PT_16", "BFD_RELOC_386_GOT32", "BFD_RELOC_386_PLT32", diff -uprN binutils-2.11.93.0.2/bfd/libxcoff.h binutils-2.12.90.0.1/bfd/libxcoff.h --- binutils-2.11.93.0.2/bfd/libxcoff.h Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/libxcoff.h Thu Mar 7 11:52:36 2002 @@ -95,7 +95,8 @@ struct xcoff_backend_data_rec /* rtinit */ unsigned int _xcoff_rtinit_size; - boolean (*_xcoff_generate_rtinit)(bfd *, const char *, const char *); + boolean (*_xcoff_generate_rtinit)(bfd *, const char *, const char *, + boolean); }; /* Look up an entry in an XCOFF link hash table. */ @@ -192,6 +193,6 @@ struct xcoff_backend_data_rec #define bfd_xcoff_is_xcoff32(a) (0x01DF == (bfd_xcoff_magic_number(a))) #define bfd_xcoff_rtinit_size(a) ((xcoff_backend(a)->_xcoff_rtinit_size)) -#define bfd_xcoff_generate_rtinit(a, b, c) ((xcoff_backend(a)->_xcoff_generate_rtinit ((a), (b), (c)))) +#define bfd_xcoff_generate_rtinit(a, b, c, d) ((xcoff_backend(a)->_xcoff_generate_rtinit ((a), (b), (c), (d)))) #endif /* LIBXCOFF_H */ diff -uprN binutils-2.11.93.0.2/bfd/linker.c binutils-2.12.90.0.1/bfd/linker.c --- binutils-2.11.93.0.2/bfd/linker.c Mon Oct 1 15:25:21 2001 +++ binutils-2.12.90.0.1/bfd/linker.c Thu Mar 7 11:52:36 2002 @@ -1,5 +1,5 @@ /* linker.c -- BFD linker routines - Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 + Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Written by Steve Chamberlain and Ian Lance Taylor, Cygnus Support @@ -426,7 +426,7 @@ static void set_symbol_from_hash PARAMS ((asymbol *, struct bfd_link_hash_entry *)); static boolean generic_add_output_symbol PARAMS ((bfd *, size_t *psymalloc, asymbol *)); -static boolean default_fill_link_order +static boolean default_data_link_order PARAMS ((bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *)); static boolean default_indirect_link_order @@ -2608,14 +2608,13 @@ bfd_new_link_order (abfd, section) asection *section; { bfd_size_type amt = sizeof (struct bfd_link_order); - struct bfd_link_order *new = (struct bfd_link_order *) bfd_alloc (abfd, amt); + struct bfd_link_order *new; + + new = (struct bfd_link_order *) bfd_zalloc (abfd, amt); if (!new) return NULL; new->type = bfd_undefined_link_order; - new->offset = 0; - new->size = 0; - new->next = (struct bfd_link_order *) NULL; if (section->link_order_tail != (struct bfd_link_order *) NULL) section->link_order_tail->next = new; @@ -2637,8 +2636,6 @@ _bfd_default_link_order (abfd, info, sec asection *sec; struct bfd_link_order *link_order; { - file_ptr loc; - switch (link_order->type) { case bfd_undefined_link_order: @@ -2649,29 +2646,23 @@ _bfd_default_link_order (abfd, info, sec case bfd_indirect_link_order: return default_indirect_link_order (abfd, info, sec, link_order, false); - case bfd_fill_link_order: - return default_fill_link_order (abfd, info, sec, link_order); case bfd_data_link_order: - loc = link_order->offset * bfd_octets_per_byte (abfd); - return bfd_set_section_contents (abfd, sec, - (PTR) link_order->u.data.contents, - loc, link_order->size); + return default_data_link_order (abfd, info, sec, link_order); } } -/* Default routine to handle a bfd_fill_link_order. */ +/* Default routine to handle a bfd_data_link_order. */ static boolean -default_fill_link_order (abfd, info, sec, link_order) +default_data_link_order (abfd, info, sec, link_order) bfd *abfd; struct bfd_link_info *info ATTRIBUTE_UNUSED; asection *sec; struct bfd_link_order *link_order; { bfd_size_type size; - unsigned char *space; - size_t i; - unsigned int fill; + size_t fill_size; + bfd_byte *fill; file_ptr loc; boolean result; @@ -2681,24 +2672,37 @@ default_fill_link_order (abfd, info, sec if (size == 0) return true; - space = (unsigned char *) bfd_malloc (size); - if (space == NULL) - return false; - - fill = link_order->u.fill.value; - for (i = 0; i < size; i += 4) - space[i] = fill >> 24; - for (i = 1; i < size; i += 4) - space[i] = fill >> 16; - for (i = 2; i < size; i += 4) - space[i] = fill >> 8; - for (i = 3; i < size; i += 4) - space[i] = fill; + fill = link_order->u.data.contents; + fill_size = link_order->u.data.size; + if (fill_size != 0 && fill_size < size) + { + bfd_byte *p; + fill = (bfd_byte *) bfd_malloc (size); + if (fill == NULL) + return false; + p = fill; + if (fill_size == 1) + memset (p, (int) link_order->u.data.contents[0], (size_t) size); + else + { + do + { + memcpy (p, link_order->u.data.contents, fill_size); + p += fill_size; + size -= fill_size; + } + while (size >= fill_size); + if (size != 0) + memcpy (p, link_order->u.data.contents, (size_t) size); + size = link_order->size; + } + } loc = link_order->offset * bfd_octets_per_byte (abfd); - result = bfd_set_section_contents (abfd, sec, space, loc, size); + result = bfd_set_section_contents (abfd, sec, fill, loc, size); - free (space); + if (fill != link_order->u.data.contents) + free (fill); return result; } diff -uprN binutils-2.11.93.0.2/bfd/merge.c binutils-2.12.90.0.1/bfd/merge.c --- binutils-2.11.93.0.2/bfd/merge.c Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/merge.c Thu Mar 7 11:52:36 2002 @@ -804,6 +804,9 @@ _bfd_merge_sections (abfd, xsinfo, remov if (secinfo) continue; + if (sinfo->htab->first == NULL) + continue; + if (sinfo->htab->strings) merge_strings (sinfo); else diff -uprN binutils-2.11.93.0.2/bfd/mmo.c binutils-2.12.90.0.1/bfd/mmo.c --- binutils-2.11.93.0.2/bfd/mmo.c Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/mmo.c Thu Mar 7 11:52:36 2002 @@ -405,8 +405,9 @@ static void mmo_write_octa PARAMS ((bfd static void mmo_write_octa_raw PARAMS ((bfd *, bfd_vma)); static boolean mmo_write_chunk PARAMS ((bfd *, CONST bfd_byte *, unsigned int)); +static boolean mmo_flush_chunk PARAMS ((bfd *)); static boolean mmo_write_loc_chunk - PARAMS ((bfd *, bfd_vma, CONST bfd_byte *, unsigned int)); + PARAMS ((bfd *, bfd_vma, CONST bfd_byte *, unsigned int, bfd_vma *)); static boolean mmo_write_chunk_list PARAMS ((bfd *, mmo_data_list_type *)); static boolean mmo_write_loc_chunk_list PARAMS ((bfd *, mmo_data_list_type *)); @@ -812,7 +813,8 @@ mmo_write_octa_raw (abfd, value) mmo_write_tetra_raw (abfd, (unsigned int) value); } -/* Write quoted contents, zero filled. */ +/* Write quoted contents. Intended to be called multiple times in + sequence, followed by a call to mmo_flush_chunk. */ static INLINE boolean mmo_write_chunk (abfd, loc, len) @@ -821,7 +823,23 @@ mmo_write_chunk (abfd, loc, len) unsigned int len; { boolean retval = true; - bfd_byte buf[4] = {0, 0, 0, 0}; + + /* Fill up a tetra from bytes remaining from a previous chunk. */ + if (abfd->tdata.mmo_data->byte_no != 0) + { + while (abfd->tdata.mmo_data->byte_no < 4 && len != 0) + { + abfd->tdata.mmo_data->buf[abfd->tdata.mmo_data->byte_no++] = *loc++; + len--; + } + + if (abfd->tdata.mmo_data->byte_no == 4) + { + mmo_write_tetra (abfd, + bfd_get_32 (abfd, abfd->tdata.mmo_data->buf)); + abfd->tdata.mmo_data->byte_no = 0; + } + } while (len >= 4) { @@ -839,19 +857,34 @@ mmo_write_chunk (abfd, loc, len) if (len) { - memcpy (buf, loc, len); - if (buf[0] == LOP) - mmo_write_tetra_raw (abfd, LOP_QUOTE_NEXT); - - retval - = (retval == true - && abfd->tdata.mmo_data->have_error == false - && 4 == bfd_bwrite ((PTR) buf, 4, abfd)); + memcpy (abfd->tdata.mmo_data->buf, loc, len); + abfd->tdata.mmo_data->byte_no = len; } + if (retval == false) + abfd->tdata.mmo_data->have_error = true; return retval; } +/* Flush remaining bytes, from a previous mmo_write_chunk, zero-padded to + 4 bytes. */ + +static INLINE boolean +mmo_flush_chunk (abfd) + bfd *abfd; +{ + if (abfd->tdata.mmo_data->byte_no != 0) + { + memset (abfd->tdata.mmo_data->buf + abfd->tdata.mmo_data->byte_no, + 0, 4 - abfd->tdata.mmo_data->byte_no); + mmo_write_tetra (abfd, + bfd_get_32 (abfd, abfd->tdata.mmo_data->buf)); + abfd->tdata.mmo_data->byte_no = 0; + } + + return abfd->tdata.mmo_data->have_error == false; +} + /* Same, but from a list. */ static INLINE boolean @@ -863,24 +896,24 @@ mmo_write_chunk_list (abfd, datap) if (! mmo_write_chunk (abfd, datap->data, datap->size)) return false; - return true; + return mmo_flush_chunk (abfd); } -/* Write a lop_loc and some contents. */ +/* Write a lop_loc and some contents. A caller needs to call + mmo_flush_chunk after calling this function. The location is only + output if different than *LAST_VMAP, which is updated after this call. */ static boolean -mmo_write_loc_chunk (abfd, vma, loc, len) +mmo_write_loc_chunk (abfd, vma, loc, len, last_vmap) bfd *abfd; bfd_vma vma; CONST bfd_byte *loc; unsigned int len; + bfd_vma *last_vmap; { - /* We always write the location as 64 bits; no use saving bytes here. */ - mmo_write_tetra_raw (abfd, (LOP << 24) | (LOP_LOC << 16) | 2); - /* Find an initial and trailing section of zero tetras; we don't need to write out zeros. FIXME: When we do this, we should emit section size - and address specifiers, else objcopy can't perform a unity + and address specifiers, else objcopy can't always perform an identity translation. */ while (len >= 4 && bfd_get_32 (abfd, loc) == 0) { @@ -892,7 +925,22 @@ mmo_write_loc_chunk (abfd, vma, loc, len while (len >= 4 && bfd_get_32 (abfd, loc + len - 4) == 0) len -= 4; - mmo_write_octa_raw (abfd, vma); + /* Only write out the location if it's different than the one the caller + (supposedly) previously handled, accounting for omitted leading zeros. */ + if (vma != *last_vmap) + { + /* We might be in the middle of a sequence. */ + mmo_flush_chunk (abfd); + + /* We always write the location as 64 bits; no use saving bytes + here. */ + mmo_write_tetra_raw (abfd, (LOP << 24) | (LOP_LOC << 16) | 2); + mmo_write_octa_raw (abfd, vma); + } + + /* Update to reflect end of this chunk, with trailing zeros omitted. */ + *last_vmap = vma + len; + return abfd->tdata.mmo_data->have_error == false && mmo_write_chunk (abfd, loc, len); @@ -905,11 +953,15 @@ mmo_write_loc_chunk_list (abfd, datap) bfd *abfd; mmo_data_list_type *datap; { + /* Get an address different than the address of the first chunk. */ + bfd_vma last_vma = datap ? datap->where - 1 : 0; + for (; datap != NULL; datap = datap->next) - if (! mmo_write_loc_chunk (abfd, datap->where, datap->data, datap->size)) + if (! mmo_write_loc_chunk (abfd, datap->where, datap->data, datap->size, + &last_vma)) return false; - return true; + return mmo_flush_chunk (abfd); } /* Make a .MMIX.spec_data.N section. */ @@ -1425,6 +1477,8 @@ mmo_get_loc (sec, vma, size) struct mmo_data_list_struct *datap = sdatap->head; struct mmo_data_list_struct *entry; + /* First search the list to see if we have the requested chunk in one + piece, or perhaps if we have a suitable chunk with room to fit. */ for (; datap != NULL; datap = datap->next) { if (datap->where <= vma @@ -1440,7 +1494,11 @@ mmo_get_loc (sec, vma, size) it. Do that now. */ datap->size += (vma + size) - (datap->where + datap->size); - /* Update the section size. */ + /* Update the section size. This happens only if we update the + 32-bit-aligned chunk size. Callers that have + non-32-bit-aligned sections should do all allocation and + size-setting by themselves or at least set the section size + after the last allocating call to this function. */ if (vma + size > sec->vma + sec->_raw_size) sec->_raw_size += (vma + size) - (sec->vma + sec->_raw_size); @@ -1502,7 +1560,8 @@ mmo_get_loc (sec, vma, size) } } - /* Update the section size. */ + /* Update the section size. This happens only when we add contents and + re-size as we go. The section size will then be aligned to 32 bits. */ if (vma + size > sec->vma + sec->_raw_size) sec->_raw_size += (vma + size) - (sec->vma + sec->_raw_size); return entry->data; @@ -2449,8 +2508,8 @@ EXAMPLE | 0x00000000 - high 32 bits of section address | 0x00000004 - section address is 4 | 0x98010002 - 64 bits with address of following data -| 0x00000000 - high 64 bits of address -| 0x00000004 - data starts at address 4 +| 0x00000000 - high 32 bits of address +| 0x00000004 - low 32 bits: data starts at address 4 | 0x00000001 - 1 | 0x00000002 - 2 | 0x00000003 - 3 @@ -2476,13 +2535,13 @@ EXAMPLE | 0x00000010 - flag READONLY | 0x00000000 - high 32 bits of section length | 0x0000000c - section length is 12 bytes; 2 * 4 + 2 + alignment to 32 bits -| 0x20000000 - high 64 bits of address -| 0x0000001c - low 64 bits of address 0x200000000000001c +| 0x20000000 - high 32 bits of address +| 0x0000001c - low 32 bits of address 0x200000000000001c | 0x00030d41 - 200001 | 0x000186a2 - 100002 | 0x26280000 - 38, 40 as bytes, padded with zeros - For the latter example, the section contents must not to appear + For the latter example, the section contents must not be loaded in memory, and is therefore specified as part of the special data. The address is usually unimportant but might provide information for e.g.@: the DWARF 2 debugging format. */ @@ -2490,6 +2549,7 @@ EXAMPLE mmo_write_tetra_raw (abfd, LOP_SPEC_SECTION); mmo_write_tetra (abfd, (strlen (sec->name) + 3) / 4); mmo_write_chunk (abfd, sec->name, strlen (sec->name)); + mmo_flush_chunk (abfd); /* FIXME: We can get debug sections (.debug_line & Co.) with a section flag still having SEC_RELOC set. Investigate. This might be true for all alien sections; perhaps mmo.em should clear @@ -2785,48 +2845,95 @@ mmo_internal_3_dump (abfd, trie) mmo_internal_3_dump (abfd, trie->right); } -/* Write symbols, either in mmo format or hidden in a lop_spec 80 section. - Write the lop_end terminator also. */ +/* Write symbols in mmo format. Also write the lop_end terminator. */ static boolean mmo_write_symbols_and_terminator (abfd) bfd *abfd; { int count = bfd_get_symcount (abfd); - asymbol *fakemain[2]; + asymbol *maintable[2]; asymbol **table; - int serno = 2; + asymbol **orig_table = bfd_get_outsymbols (abfd); + int serno; struct mmo_symbol_trie root; int trie_len; int i; bfd_byte buf[4]; /* Create a symbol for "Main". */ - asymbol *mainsym = bfd_make_empty_symbol (abfd); + asymbol *fakemain = bfd_make_empty_symbol (abfd); - mainsym->flags = BSF_GLOBAL; - mainsym->value = bfd_get_start_address (abfd); - mainsym->name = MMIX_START_SYMBOL_NAME; - mainsym->section = bfd_abs_section_ptr; - fakemain[0] = mainsym; - fakemain[1] = NULL; + fakemain->flags = BSF_GLOBAL; + fakemain->value = bfd_get_start_address (abfd); + fakemain->name = MMIX_START_SYMBOL_NAME; + fakemain->section = bfd_abs_section_ptr; + maintable[0] = fakemain; + maintable[1] = NULL; memset (&root, 0, sizeof (root)); /* Make all symbols take a left turn. */ root.symchar = 0xff; - /* There must always be a ":Main", so we'll add one - if there are no symbols. */ - if (count == 0) - { - table = fakemain; - count = 1; + /* There must always be a ":Main", so we'll add one if there are no + symbols. Make sure we have room for it. */ + table = bfd_alloc (abfd, (count + 1) * sizeof (asymbol *)); + if (table == NULL) + return false; + + memcpy (table, orig_table, count * sizeof (asymbol *)); + + /* Move :Main (if there is one) to the first position. This is + necessary to get the same layout of the trie-tree when linking as + when objcopying the result as in the objcopy.exp test "simple objcopy + of executable". It also automatically takes care of assigning serial + number 1 to :Main (as is mandatory). */ + for (i = 0; i < count; i++) + if (table[i] != NULL + && strcmp (table[i]->name, MMIX_START_SYMBOL_NAME) == 0 + && (table[i]->flags & (BSF_DEBUGGING|BSF_GLOBAL)) == BSF_GLOBAL) + { + asymbol *mainsym = table[i]; + memcpy (table + 1, orig_table, i * sizeof (asymbol *)); + table[0] = mainsym; + + /* Check that the value assigned to :Main is the same as the entry + address. The default linker script asserts this. This is as + good a place as any to check this consistency. */ + if ((mainsym->value + + mainsym->section->output_section->vma + + mainsym->section->output_offset) + != bfd_get_start_address (abfd)) + { + /* Arbitrary buffer to hold the printable representation of a + vma. */ + char vmas_main[40]; + char vmas_start[40]; + bfd_vma vma_start = bfd_get_start_address (abfd); + + sprintf_vma (vmas_main, mainsym->value); + sprintf_vma (vmas_start, vma_start); + + (*_bfd_error_handler) + (_("%s: Bad symbol definition: `Main' set to %s rather\ + than the start address %s\n"), + bfd_get_filename (abfd), vmas_main, vmas_start); + bfd_set_error (bfd_error_bad_value); + return false; + } + break; + } + if (i == count && count != 0) + { + /* When there are symbols, there must be a :Main. There was no + :Main, so we need to add it manually. */ + memcpy (table + 1, orig_table, count * sizeof (asymbol *)); + table[0] = fakemain; + count++; } - else - table = bfd_get_outsymbols (abfd); - for (i = 0; i < count && table[i] != NULL; i++) + for (i = 0, serno = 1; i < count && table[i] != NULL; i++) { asymbol *s = table[i]; @@ -2871,37 +2978,9 @@ mmo_write_symbols_and_terminator (abfd) /* FIXME: We assume the order of the received symbols is an ordered mapping of the serial numbers. This is not necessarily true if we e.g. objcopy a mmo file to another and - there are gaps in the numbering. Note sure if this can + there are gaps in the numbering. Not sure if this can happen. Not sure what to do. */ - /* Make sure Main has serial number 1; others start at 2. */ - if (strcmp (s->name, MMIX_START_SYMBOL_NAME) == 0) - { - sym.serno = 1; - - /* Check that the value assigned to :Main is the same as the - entry address. The default linker script asserts this. - This is as good a place as any to check this consistency. */ - if (sym.value != bfd_get_start_address (abfd)) - { - /* Arbitrary buffer to hold the printable representation - of a vma. */ - char vmas_main[40]; - char vmas_start[40]; - bfd_vma vma_start = bfd_get_start_address (abfd); - - sprintf_vma (vmas_main, s->value); - sprintf_vma (vmas_start, vma_start); - - (*_bfd_error_handler) - (_("%s: Bad symbol definition: `Main' set to %s rather\ - than the start address %s\n"), - bfd_get_filename (abfd), vmas_main, vmas_start); - bfd_set_error (bfd_error_bad_value); - return false; - } - } - else - sym.serno = serno++; + sym.serno = serno++; if (! mmo_internal_add_3_sym (abfd, &root, &sym)) return false; diff -uprN binutils-2.11.93.0.2/bfd/osf-core.c binutils-2.12.90.0.1/bfd/osf-core.c --- binutils-2.11.93.0.2/bfd/osf-core.c Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/osf-core.c Thu Mar 7 11:52:36 2002 @@ -191,8 +191,8 @@ const bfd_target osf_core_vec = { "osf-core", bfd_target_unknown_flavour, - BFD_ENDIAN_BIG, /* target byte order */ - BFD_ENDIAN_BIG, /* target headers byte order */ + BFD_ENDIAN_LITTLE, /* target byte order */ + BFD_ENDIAN_LITTLE, /* target headers byte order */ (HAS_RELOC | EXEC_P | /* object flags */ HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), diff -uprN binutils-2.11.93.0.2/bfd/po/SRC-POTFILES.in binutils-2.12.90.0.1/bfd/po/SRC-POTFILES.in --- binutils-2.11.93.0.2/bfd/po/SRC-POTFILES.in Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/po/SRC-POTFILES.in Thu Mar 7 11:52:37 2002 @@ -140,12 +140,14 @@ elf32-m88k.c elf32-mcore.c elf32-mips.c elf32-openrisc.c +elf32-or32.c elf32-pj.c elf32-ppc.c elf32-s390.c elf32-sh-lin.c elf32-sh-nbsd.c elf32-sh.c +elf32-sh64.c elf32-sparc.c elf32-v850.c elf32-xstormy16.c @@ -158,6 +160,7 @@ elf64-mips.c elf64-mmix.c elf64-ppc.c elf64-s390.c +elf64-sh64.c elf64-sparc.c elf64-x86-64.c elf64.c diff -uprN binutils-2.11.93.0.2/bfd/po/bfd.pot binutils-2.12.90.0.1/bfd/po/bfd.pot --- binutils-2.11.93.0.2/bfd/po/bfd.pot Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/po/bfd.pot Thu Mar 7 11:52:37 2002 @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2002-01-31 17:07+0000\n" +"POT-Creation-Date: 2002-02-08 03:22-0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -240,45 +240,45 @@ msgstr "" #: coff-arm.c:2235 #, c-format -msgid "%s: ERROR: compiled for APCS-%d whereas target %s uses APCS-%d" +msgid "ERROR: %s is compiled for APCS-%d, whereas %s is compiled for APCS-%d" msgstr "" -#: coff-arm.c:2250 +#: coff-arm.c:2250 elf32-arm.h:2287 #, c-format msgid "" -"%s: ERROR: passes floats in float registers whereas target %s uses integer " -"registers" +"ERROR: %s passes floats in float registers, whereas %s passes them in " +"integer registers" msgstr "" -#: coff-arm.c:2253 +#: coff-arm.c:2253 elf32-arm.h:2292 #, c-format msgid "" -"%s: ERROR: passes floats in integer registers whereas target %s uses float " -"registers" +"ERROR: %s passes floats in integer registers, whereas %s passes them in " +"float registers" msgstr "" #: coff-arm.c:2268 #, c-format msgid "" -"%s: ERROR: compiled as position independent code, whereas target %s is " +"ERROR: %s is compiled as position independent code, whereas target %s is " "absolute position" msgstr "" #: coff-arm.c:2271 #, c-format msgid "" -"%s: ERROR: compiled as absolute position code, whereas target %s is position " -"independent" +"ERROR: %s is compiled as absolute position code, whereas target %s is " +"position independent" msgstr "" -#: coff-arm.c:2300 +#: coff-arm.c:2300 elf32-arm.h:2348 #, c-format -msgid "Warning: %s supports interworking, whereas %s does not." +msgid "Warning: %s supports interworking, whereas %s does not" msgstr "" -#: coff-arm.c:2303 +#: coff-arm.c:2303 elf32-arm.h:2355 #, c-format -msgid "Warning: %s does not support interworking, whereas %s does." +msgid "Warning: %s does not support interworking, whereas %s does" msgstr "" #: coff-arm.c:2330 @@ -330,7 +330,7 @@ msgstr "" msgid "uncertain calling convention for non-COFF symbol" msgstr "" -#: coff-m68k.c:481 coff-mips.c:2431 elf32-m68k.c:2212 elf32-mips.c:9954 +#: coff-m68k.c:481 coff-mips.c:2431 elf32-m68k.c:2212 elf32-mips.c:9967 msgid "unsupported reloc type" msgstr "" @@ -368,7 +368,7 @@ msgstr "" msgid "Unrecognized reloc type 0x%x" msgstr "" -#: coff-tic54x.c:390 coffcode.h:4868 +#: coff-tic54x.c:390 coffcode.h:4874 #, c-format msgid "%s: warning: illegal symbol index %ld in relocs" msgstr "" @@ -383,32 +383,32 @@ msgstr "" msgid "%s (%s): Section flag %s (0x%x) ignored" msgstr "" -#: coffcode.h:2132 +#: coffcode.h:2137 #, c-format msgid "Unrecognized TI COFF target id '0x%x'" msgstr "" -#: coffcode.h:4257 +#: coffcode.h:4263 #, c-format msgid "%s: warning: illegal symbol index %ld in line numbers" msgstr "" -#: coffcode.h:4271 +#: coffcode.h:4277 #, c-format msgid "%s: warning: duplicate line number information for `%s'" msgstr "" -#: coffcode.h:4630 +#: coffcode.h:4636 #, c-format msgid "%s: Unrecognized storage class %d for %s symbol `%s'" msgstr "" -#: coffcode.h:4761 +#: coffcode.h:4767 #, c-format msgid "warning: %s: local symbol `%s' has no section" msgstr "" -#: coffcode.h:4906 +#: coffcode.h:4912 #, c-format msgid "%s: illegal relocation type %d at address 0x%lx" msgstr "" @@ -568,8 +568,8 @@ msgid "" " Type: %s" msgstr "" -#: elf-hppa.h:1366 elf-hppa.h:1399 elf32-ppc.c:3062 elf32-sh.c:3201 -#: elf64-x86-64.c:1275 +#: elf-hppa.h:1366 elf-hppa.h:1399 elf32-ppc.c:3062 elf32-sh.c:4286 +#: elf64-sh64.c:1640 elf64-x86-64.c:1275 #, c-format msgid "" "%s: warning: unresolvable relocation against symbol `%s' from %s section" @@ -578,14 +578,14 @@ msgstr "" #: elf-m10200.c:463 elf-m10300.c:673 elf32-arm.h:2074 elf32-avr.c:835 #: elf32-cris.c:1406 elf32-d10v.c:482 elf32-fr30.c:653 elf32-h8300.c:547 #: elf32-i860.c:1048 elf32-m32r.c:1280 elf32-openrisc.c:455 elf32-v850.c:1691 -#: elf32-xstormy16.c:976 elf64-mmix.c:1164 +#: elf32-xstormy16.c:976 elf64-mmix.c:1302 msgid "internal error: out of range error" msgstr "" #: elf-m10200.c:467 elf-m10300.c:677 elf32-arm.h:2078 elf32-avr.c:839 #: elf32-cris.c:1410 elf32-d10v.c:486 elf32-fr30.c:657 elf32-h8300.c:551 -#: elf32-i860.c:1052 elf32-m32r.c:1284 elf32-mips.c:7587 elf32-openrisc.c:459 -#: elf32-v850.c:1695 elf32-xstormy16.c:980 elf64-mips.c:4464 elf64-mmix.c:1168 +#: elf32-i860.c:1052 elf32-m32r.c:1284 elf32-mips.c:7600 elf32-openrisc.c:459 +#: elf32-v850.c:1695 elf32-xstormy16.c:980 elf64-mips.c:4464 elf64-mmix.c:1306 msgid "internal error: unsupported relocation error" msgstr "" @@ -597,7 +597,7 @@ msgstr "" #: elf-m10200.c:475 elf-m10300.c:685 elf32-arm.h:2086 elf32-avr.c:847 #: elf32-cris.c:1418 elf32-d10v.c:494 elf32-fr30.c:665 elf32-h8300.c:559 #: elf32-i860.c:1060 elf32-m32r.c:1292 elf32-openrisc.c:467 elf32-v850.c:1715 -#: elf32-xstormy16.c:988 elf64-mmix.c:1176 +#: elf32-xstormy16.c:988 elf64-mmix.c:1314 msgid "internal error: unknown error" msgstr "" @@ -697,7 +697,7 @@ msgstr "" msgid "%s: Warning: Thumb BLX instruction targets thumb function '%s'." msgstr "" -#: elf32-arm.h:1904 elf32-i386.c:1778 elf32-sh.c:3133 +#: elf32-arm.h:1904 elf32-i386.c:1782 elf32-sh.c:4198 #, c-format msgid "%s(%s+0x%lx): %s relocation against SEC_MERGE section" msgstr "" @@ -718,61 +718,38 @@ msgstr "" #: elf32-arm.h:2261 #, c-format msgid "" -"Error: %s compiled for EABI version %d, whereas %s is compiled for version %d" +"ERROR: %s is compiled for EABI version %d, whereas %s is compiled for " +"version %d" msgstr "" #: elf32-arm.h:2275 #, c-format -msgid "Error: %s compiled for APCS-%d, whereas %s is compiled for APCS-%d" -msgstr "" - -#: elf32-arm.h:2287 -#, c-format -msgid "" -"Error: %s passes floats in FP registers, whereas %s passes them in integer " -"registers" -msgstr "" - -#: elf32-arm.h:2292 -#, c-format -msgid "" -"Error: %s passes floats in integer registers, whereas %s passes them in FP " -"registers" +msgid "ERROR: %s is compiled for APCS-%d, whereas target %s uses APCS-%d" msgstr "" #: elf32-arm.h:2303 #, c-format -msgid "Error: %s uses VFP instructions, whereas %s uses FPA instructions" +msgid "ERROR: %s uses VFP instructions, whereas %s uses FPA instructions" msgstr "" #: elf32-arm.h:2308 #, c-format -msgid "Error: %s uses FPA instructions, whereas %s uses VFP instructions" +msgid "ERROR: %s uses FPA instructions, whereas %s uses VFP instructions" msgstr "" #: elf32-arm.h:2328 #, c-format -msgid "Error: %s uses software FP, whereas %s uses hardware FP" +msgid "ERROR: %s uses software FP, whereas %s uses hardware FP" msgstr "" #: elf32-arm.h:2333 #, c-format -msgid "Error: %s uses hardware FP, whereas %s uses software FP" -msgstr "" - -#: elf32-arm.h:2348 -#, c-format -msgid "Warning: %s supports interworking, whereas %s does not" -msgstr "" - -#: elf32-arm.h:2355 -#, c-format -msgid "Warning: %s does not support interworking, whereas %s does" +msgid "ERROR: %s uses hardware FP, whereas %s uses software FP" msgstr "" #. Ignore init flag - it may not be set, despite the flags field #. containing valid data. -#: elf32-arm.h:2386 elf32-cris.c:2991 elf32-m68k.c:410 elf32-mips.c:3242 +#: elf32-arm.h:2386 elf32-cris.c:2991 elf32-m68k.c:410 elf32-mips.c:3255 #, c-format msgid "private flags = %lx:" msgstr "" @@ -781,14 +758,6 @@ msgstr "" msgid " [interworking enabled]" msgstr "" -#: elf32-arm.h:2398 -msgid " [APCS-26]" -msgstr "" - -#: elf32-arm.h:2400 -msgid " [APCS-32]" -msgstr "" - #: elf32-arm.h:2403 msgid " [VFP float format]" msgstr "" @@ -851,7 +820,7 @@ msgstr "" #: elf32-avr.c:843 elf32-cris.c:1414 elf32-fr30.c:661 elf32-i860.c:1056 #: elf32-openrisc.c:463 elf32-v850.c:1699 elf32-xstormy16.c:984 -#: elf64-mmix.c:1172 +#: elf64-mmix.c:1310 msgid "internal error: dangerous relocation" msgstr "" @@ -930,7 +899,7 @@ msgstr "" msgid "%s: cannot create stub entry %s" msgstr "" -#: elf32-hppa.c:937 elf32-hppa.c:3545 +#: elf32-hppa.c:937 elf32-hppa.c:3549 #, c-format msgid "%s(%s+0x%lx): cannot reach %s, recompile with -ffunction-sections" msgstr "" @@ -954,22 +923,22 @@ msgstr "" msgid "Could not find relocation section for %s" msgstr "" -#: elf32-hppa.c:2867 +#: elf32-hppa.c:2871 #, c-format msgid "%s: duplicate export stub %s" msgstr "" -#: elf32-hppa.c:3429 +#: elf32-hppa.c:3433 #, c-format msgid "%s(%s+0x%lx): fixing %s" msgstr "" -#: elf32-hppa.c:4069 +#: elf32-hppa.c:4073 #, c-format msgid "%s(%s+0x%lx): cannot handle %s for %s" msgstr "" -#: elf32-hppa.c:4408 +#: elf32-hppa.c:4412 msgid ".got section not immediately after .plt section" msgstr "" @@ -978,22 +947,22 @@ msgstr "" msgid "%s: invalid relocation type %d" msgstr "" -#: elf32-i386.c:718 elf32-s390.c:636 elf64-s390.c:595 +#: elf32-i386.c:718 elf32-s390.c:637 elf64-s390.c:595 #, c-format msgid "%s: bad symbol index: %d" msgstr "" -#: elf32-i386.c:863 elf32-s390.c:790 elf64-ppc.c:2198 elf64-s390.c:759 +#: elf32-i386.c:863 elf32-s390.c:791 elf64-ppc.c:2198 elf64-s390.c:759 #, c-format msgid "%s: bad relocation section name `%s'" msgstr "" -#: elf32-i386.c:2069 elf32-s390.c:1951 elf64-ppc.c:4124 elf64-s390.c:1955 +#: elf32-i386.c:2073 elf32-s390.c:1956 elf64-ppc.c:4128 elf64-s390.c:1959 #, c-format msgid "%s(%s+0x%lx): unresolvable relocation against symbol `%s'" msgstr "" -#: elf32-i386.c:2107 elf32-s390.c:1989 elf64-s390.c:1993 +#: elf32-i386.c:2111 elf32-s390.c:1994 elf64-s390.c:1997 #, c-format msgid "%s(%s+0x%lx): reloc against `%s': error %d" msgstr "" @@ -1068,117 +1037,117 @@ msgstr "" msgid "%s: ISA mismatch (-mips%d) with previous modules (-mips%d)" msgstr "" -#: elf32-mips.c:3177 +#: elf32-mips.c:3190 #, c-format msgid "%s: ISA mismatch (%d) with previous modules (%d)" msgstr "" -#: elf32-mips.c:3200 +#: elf32-mips.c:3213 #, c-format msgid "%s: ABI mismatch: linking %s module with previous %s modules" msgstr "" -#: elf32-mips.c:3214 elf32-ppc.c:1470 elf64-ppc.c:1556 elf64-sparc.c:3027 +#: elf32-mips.c:3227 elf32-ppc.c:1470 elf64-ppc.c:1556 elf64-sparc.c:3027 #, c-format msgid "%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)" msgstr "" -#: elf32-mips.c:3245 +#: elf32-mips.c:3258 msgid " [abi=O32]" msgstr "" -#: elf32-mips.c:3247 +#: elf32-mips.c:3260 msgid " [abi=O64]" msgstr "" -#: elf32-mips.c:3249 +#: elf32-mips.c:3262 msgid " [abi=EABI32]" msgstr "" -#: elf32-mips.c:3251 +#: elf32-mips.c:3264 msgid " [abi=EABI64]" msgstr "" -#: elf32-mips.c:3253 +#: elf32-mips.c:3266 msgid " [abi unknown]" msgstr "" -#: elf32-mips.c:3255 +#: elf32-mips.c:3268 msgid " [abi=N32]" msgstr "" -#: elf32-mips.c:3257 +#: elf32-mips.c:3270 msgid " [abi=64]" msgstr "" -#: elf32-mips.c:3259 +#: elf32-mips.c:3272 msgid " [no abi set]" msgstr "" -#: elf32-mips.c:3262 +#: elf32-mips.c:3275 msgid " [mips1]" msgstr "" -#: elf32-mips.c:3264 +#: elf32-mips.c:3277 msgid " [mips2]" msgstr "" -#: elf32-mips.c:3266 +#: elf32-mips.c:3279 msgid " [mips3]" msgstr "" -#: elf32-mips.c:3268 +#: elf32-mips.c:3281 msgid " [mips4]" msgstr "" -#: elf32-mips.c:3270 +#: elf32-mips.c:3283 msgid " [mips5]" msgstr "" -#: elf32-mips.c:3272 +#: elf32-mips.c:3285 msgid " [mips32]" msgstr "" -#: elf32-mips.c:3274 +#: elf32-mips.c:3287 msgid " [mips64]" msgstr "" -#: elf32-mips.c:3276 +#: elf32-mips.c:3289 msgid " [unknown ISA]" msgstr "" -#: elf32-mips.c:3279 +#: elf32-mips.c:3292 msgid " [32bitmode]" msgstr "" -#: elf32-mips.c:3281 +#: elf32-mips.c:3294 msgid " [not 32bitmode]" msgstr "" -#: elf32-mips.c:4954 +#: elf32-mips.c:4967 msgid "static procedure (no name)" msgstr "" -#: elf32-mips.c:5572 elf64-mips.c:6694 +#: elf32-mips.c:5585 elf64-mips.c:6694 #, c-format msgid "%s: illegal section name `%s'" msgstr "" -#: elf32-mips.c:6139 elf64-mips.c:3150 +#: elf32-mips.c:6152 elf64-mips.c:3150 msgid "not enough GOT space for local GOT entries" msgstr "" -#: elf32-mips.c:7250 elf64-mips.c:4203 +#: elf32-mips.c:7263 elf64-mips.c:4203 #, c-format msgid "%s: %s+0x%lx: jump to stub routine which is not jal" msgstr "" -#: elf32-mips.c:8259 elf64-mips.c:5891 +#: elf32-mips.c:8272 elf64-mips.c:5891 #, c-format msgid "%s: Malformed reloc detected for section %s" msgstr "" -#: elf32-mips.c:8337 elf64-mips.c:5969 +#: elf32-mips.c:8350 elf64-mips.c:5969 #, c-format msgid "%s: CALL16 reloc at 0x%lx not against global symbol" msgstr "" @@ -1205,7 +1174,7 @@ msgstr "" msgid "%s: relocation %s cannot be used when making a shared object" msgstr "" -#: elf32-ppc.c:3097 elf64-ppc.c:3716 +#: elf32-ppc.c:3097 elf64-ppc.c:3720 #, c-format msgid "%s: unknown relocation type %d for symbol %s" msgstr "" @@ -1221,51 +1190,103 @@ msgstr "" msgid "%s: Relocation %s is not yet supported for symbol %s." msgstr "" -#: elf32-sh.c:1101 +#: elf32-sh.c:1971 #, c-format msgid "%s: 0x%lx: warning: bad R_SH_USES offset" msgstr "" -#: elf32-sh.c:1113 +#: elf32-sh.c:1983 #, c-format msgid "%s: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x" msgstr "" -#: elf32-sh.c:1130 +#: elf32-sh.c:2000 #, c-format msgid "%s: 0x%lx: warning: bad R_SH_USES load offset" msgstr "" -#: elf32-sh.c:1145 +#: elf32-sh.c:2015 #, c-format msgid "%s: 0x%lx: warning: could not find expected reloc" msgstr "" -#: elf32-sh.c:1202 +#: elf32-sh.c:2072 #, c-format msgid "%s: 0x%lx: warning: symbol in unexpected section" msgstr "" -#: elf32-sh.c:1323 +#: elf32-sh.c:2193 #, c-format msgid "%s: 0x%lx: warning: could not find expected COUNT reloc" msgstr "" -#: elf32-sh.c:1332 +#: elf32-sh.c:2202 #, c-format msgid "%s: 0x%lx: warning: bad count" msgstr "" -#: elf32-sh.c:1741 elf32-sh.c:2132 +#: elf32-sh.c:2611 elf32-sh.c:3002 #, c-format msgid "%s: 0x%lx: fatal: reloc overflow while relaxing" msgstr "" -#: elf32-sh.c:3267 +#: elf32-sh.c:4146 elf64-sh64.c:1557 +msgid "Unexpected STO_SH5_ISA32 on local symbol is not handled" +msgstr "" + +#: elf32-sh.c:4357 #, c-format msgid "%s: 0x%lx: fatal: unaligned branch target for relax-support relocation" msgstr "" +#: elf32-sh64.c:211 elf64-sh64.c:2391 +#, c-format +msgid "%s: compiled as 32-bit object and %s is 64-bit" +msgstr "" + +#: elf32-sh64.c:214 elf64-sh64.c:2394 +#, c-format +msgid "%s: compiled as 64-bit object and %s is 32-bit" +msgstr "" + +#: elf32-sh64.c:216 elf64-sh64.c:2396 +#, c-format +msgid "%s: object size does not match that of target %s" +msgstr "" + +#: elf32-sh64.c:447 elf64-sh64.c:2973 +#, c-format +msgid "%s: encountered datalabel symbol in input" +msgstr "" + +#: elf32-sh64.c:530 +msgid "PTB mismatch: a SHmedia address (bit 0 == 1)" +msgstr "" + +#: elf32-sh64.c:533 +msgid "PTA mismatch: a SHcompact address (bit 0 == 0)" +msgstr "" + +#: elf32-sh64.c:551 +#, c-format +msgid "%s: GAS error: unexpected PTB insn with R_SH_PT_16" +msgstr "" + +#: elf32-sh64.c:600 elf64-sh64.c:1684 +#, c-format +msgid "%s: error: unaligned relocation type %d at %08x reloc %08x\n" +msgstr "" + +#: elf32-sh64.c:684 +#, c-format +msgid "%s: could not write out added .cranges entries" +msgstr "" + +#: elf32-sh64.c:745 +#, c-format +msgid "%s: could not write out sorted .cranges entries" +msgstr "" + #: elf32-sparc.c:1554 elf64-sparc.c:2280 #, c-format msgid "%s: probably compiled without -fPIC?" @@ -1371,36 +1392,55 @@ msgstr "" msgid "stub entry for %s cannot load .plt, dp offset = %ld" msgstr "" -#: elf64-mmix.c:1271 +#: elf64-mmix.c:1002 +#, c-format +msgid "" +"%s: Internal inconsistency error for value for\n" +" linker-allocated global register: linked: 0x%lx%08lx != relaxed: 0x%lx%" +"08lx\n" +msgstr "" + +#: elf64-mmix.c:1386 +#, c-format +msgid "" +"%s: base-plus-offset relocation against register symbol: (unknown) in %s" +msgstr "" + +#: elf64-mmix.c:1391 +#, c-format +msgid "%s: base-plus-offset relocation against register symbol: %s in %s" +msgstr "" + +#: elf64-mmix.c:1435 #, c-format msgid "%s: register relocation against non-register symbol: (unknown) in %s" msgstr "" -#: elf64-mmix.c:1276 +#: elf64-mmix.c:1440 #, c-format msgid "%s: register relocation against non-register symbol: %s in %s" msgstr "" -#: elf64-mmix.c:1312 +#: elf64-mmix.c:1477 #, c-format msgid "%s: directive LOCAL valid only with a register or absolute value" msgstr "" -#: elf64-mmix.c:1340 +#: elf64-mmix.c:1505 #, c-format msgid "" "%s: LOCAL directive: Register $%ld is not a local register. First global " "register is $%ld." msgstr "" -#: elf64-mmix.c:1615 +#: elf64-mmix.c:1967 #, c-format msgid "" "%s: Error: multiple definition of `%s'; start of %s is set in a earlier " "linked file\n" msgstr "" -#: elf64-mmix.c:1674 +#: elf64-mmix.c:2026 msgid "Register section has contents\n" msgstr "" @@ -1414,21 +1454,21 @@ msgstr "" msgid "%s: compiled for a little endian system and target is big endian" msgstr "" -#: elf64-ppc.c:3350 +#: elf64-ppc.c:3354 #, c-format msgid "linkage table error against `%s'" msgstr "" -#: elf64-ppc.c:3432 +#: elf64-ppc.c:3436 msgid "stub section size doesn't match calculated size" msgstr "" -#: elf64-ppc.c:4061 +#: elf64-ppc.c:4065 #, c-format msgid "%s: Relocation %s is not supported for symbol %s." msgstr "" -#: elf64-ppc.c:4105 +#: elf64-ppc.c:4109 #, c-format msgid "%s: error: relocation %s not a multiple of 4" msgstr "" @@ -1658,142 +1698,142 @@ msgstr "" msgid "%s: access beyond end of merged section (%ld + %ld)" msgstr "" -#: mmo.c:460 +#: mmo.c:459 #, c-format msgid "%s: No core to allocate section name %s\n" msgstr "" -#: mmo.c:537 +#: mmo.c:535 #, c-format msgid "%s: No core to allocate a symbol %d bytes long\n" msgstr "" -#: mmo.c:1190 +#: mmo.c:1188 #, c-format msgid "%s: invalid mmo file: initialization value for $255 is not `Main'\n" msgstr "" -#: mmo.c:1336 +#: mmo.c:1334 #, c-format msgid "" "%s: unsupported wide character sequence 0x%02X 0x%02X after symbol name " "starting with `%s'\n" msgstr "" -#: mmo.c:1571 +#: mmo.c:1569 #, c-format msgid "%s: invalid mmo file: unsupported lopcode `%d'\n" msgstr "" -#: mmo.c:1581 +#: mmo.c:1579 #, c-format msgid "%s: invalid mmo file: expected YZ = 1 got YZ = %d for lop_quote\n" msgstr "" -#: mmo.c:1617 +#: mmo.c:1615 #, c-format msgid "%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_loc\n" msgstr "" -#: mmo.c:1663 +#: mmo.c:1661 #, c-format msgid "" "%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_fixo\n" msgstr "" -#: mmo.c:1702 +#: mmo.c:1700 #, c-format msgid "%s: invalid mmo file: expected y = 0, got y = %d for lop_fixrx\n" msgstr "" -#: mmo.c:1711 +#: mmo.c:1709 #, c-format msgid "" "%s: invalid mmo file: expected z = 16 or z = 24, got z = %d for lop_fixrx\n" msgstr "" -#: mmo.c:1734 +#: mmo.c:1732 #, c-format msgid "" "%s: invalid mmo file: leading byte of operand word must be 0 or 1, got %d " "for lop_fixrx\n" msgstr "" -#: mmo.c:1757 +#: mmo.c:1755 #, c-format msgid "%s: cannot allocate file name for file number %d, %d bytes\n" msgstr "" -#: mmo.c:1777 +#: mmo.c:1775 #, c-format msgid "" "%s: invalid mmo file: file number %d `%s', was already entered as `%s'\n" msgstr "" -#: mmo.c:1790 +#: mmo.c:1788 #, c-format msgid "" "%s: invalid mmo file: file name for number %d was not specified before use\n" msgstr "" -#: mmo.c:1896 +#: mmo.c:1894 #, c-format msgid "" "%s: invalid mmo file: fields y and z of lop_stab non-zero, y: %d, z: %d\n" msgstr "" -#: mmo.c:1932 +#: mmo.c:1930 #, c-format msgid "%s: invalid mmo file: lop_end not last item in file\n" msgstr "" -#: mmo.c:1945 +#: mmo.c:1943 #, c-format msgid "" "%s: invalid mmo file: YZ of lop_end (%ld) not equal to the number of tetras " "to the preceding lop_stab (%ld)\n" msgstr "" -#: mmo.c:2610 +#: mmo.c:2608 #, c-format msgid "%s: invalid symbol table: duplicate symbol `%s'\n" msgstr "" -#: mmo.c:2898 +#: mmo.c:2896 #, c-format msgid "" "%s: Bad symbol definition: `Main' set to %s rather than the start address %" "s\n" msgstr "" -#: mmo.c:2932 +#: mmo.c:2930 #, c-format msgid "" "%s: warning: symbol table too large for mmo, larger than 65535 32-bit words: " "%d. Only `Main' will be emitted.\n" msgstr "" -#: mmo.c:2977 +#: mmo.c:2975 #, c-format msgid "%s: internal error, symbol table changed size from %d to %d words\n" msgstr "" -#: mmo.c:3032 +#: mmo.c:3030 #, c-format msgid "%s: internal error, internal register section %s had contents\n" msgstr "" -#: mmo.c:3084 +#: mmo.c:3082 #, c-format msgid "%s: no initialized registers; section length 0\n" msgstr "" -#: mmo.c:3090 +#: mmo.c:3088 #, c-format msgid "%s: too many initialized registers; section length %ld\n" msgstr "" -#: mmo.c:3095 +#: mmo.c:3093 #, c-format msgid "" "%s: invalid start address for initialized registers of length %ld: 0x%lx%" diff -uprN binutils-2.11.93.0.2/bfd/reloc.c binutils-2.12.90.0.1/bfd/reloc.c --- binutils-2.11.93.0.2/bfd/reloc.c Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/reloc.c Thu Mar 7 11:52:36 2002 @@ -1,6 +1,6 @@ /* BFD support for handling relocation entries. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001 + 2000, 2001, 2002 Free Software Foundation, Inc. Written by Cygnus Support. @@ -1956,6 +1956,13 @@ ENUMDOC GP register. ENUM + BFD_RELOC_ALPHA_BRSGP +ENUMDOC + Like BFD_RELOC_23_PCREL_S2, except that the source and target must + share a common GP, and the target address is adjusted for + STO_ALPHA_STD_GPLOAD. + +ENUM BFD_RELOC_MIPS_JMP ENUMDOC Bits 27..2 of the relocation address shifted right 2 bits; @@ -2043,6 +2050,107 @@ ENUMX ENUMX BFD_RELOC_MIPS_JALR COMMENT +COMMENT +ENUMX + BFD_RELOC_SH_GOT_LOW16 +ENUMX + BFD_RELOC_SH_GOT_MEDLOW16 +ENUMX + BFD_RELOC_SH_GOT_MEDHI16 +ENUMX + BFD_RELOC_SH_GOT_HI16 +ENUMX + BFD_RELOC_SH_GOTPLT_LOW16 +ENUMX + BFD_RELOC_SH_GOTPLT_MEDLOW16 +ENUMX + BFD_RELOC_SH_GOTPLT_MEDHI16 +ENUMX + BFD_RELOC_SH_GOTPLT_HI16 +ENUMX + BFD_RELOC_SH_PLT_LOW16 +ENUMX + BFD_RELOC_SH_PLT_MEDLOW16 +ENUMX + BFD_RELOC_SH_PLT_MEDHI16 +ENUMX + BFD_RELOC_SH_PLT_HI16 +ENUMX + BFD_RELOC_SH_GOTOFF_LOW16 +ENUMX + BFD_RELOC_SH_GOTOFF_MEDLOW16 +ENUMX + BFD_RELOC_SH_GOTOFF_MEDHI16 +ENUMX + BFD_RELOC_SH_GOTOFF_HI16 +ENUMX + BFD_RELOC_SH_GOTPC_LOW16 +ENUMX + BFD_RELOC_SH_GOTPC_MEDLOW16 +ENUMX + BFD_RELOC_SH_GOTPC_MEDHI16 +ENUMX + BFD_RELOC_SH_GOTPC_HI16 +ENUMX + BFD_RELOC_SH_COPY64 +ENUMX + BFD_RELOC_SH_GLOB_DAT64 +ENUMX + BFD_RELOC_SH_JMP_SLOT64 +ENUMX + BFD_RELOC_SH_RELATIVE64 +ENUMX + BFD_RELOC_SH_GOT10BY4 +ENUMX + BFD_RELOC_SH_GOT10BY8 +ENUMX + BFD_RELOC_SH_GOTPLT10BY4 +ENUMX + BFD_RELOC_SH_GOTPLT10BY8 +ENUMX + BFD_RELOC_SH_GOTPLT32 +COMMENT +ENUMX + BFD_RELOC_SH_SHMEDIA_CODE +ENUMX + BFD_RELOC_SH_IMMU5 +ENUMX + BFD_RELOC_SH_IMMS6 +ENUMX + BFD_RELOC_SH_IMMS6BY32 +ENUMX + BFD_RELOC_SH_IMMU6 +ENUMX + BFD_RELOC_SH_IMMS10 +ENUMX + BFD_RELOC_SH_IMMS10BY2 +ENUMX + BFD_RELOC_SH_IMMS10BY4 +ENUMX + BFD_RELOC_SH_IMMS10BY8 +ENUMX + BFD_RELOC_SH_IMMS16 +ENUMX + BFD_RELOC_SH_IMMU16 +ENUMX + BFD_RELOC_SH_IMM_LOW16 +ENUMX + BFD_RELOC_SH_IMM_LOW16_PCREL +ENUMX + BFD_RELOC_SH_IMM_MEDLOW16 +ENUMX + BFD_RELOC_SH_IMM_MEDLOW16_PCREL +ENUMX + BFD_RELOC_SH_IMM_MEDHI16 +ENUMX + BFD_RELOC_SH_IMM_MEDHI16_PCREL +ENUMX + BFD_RELOC_SH_IMM_HI16 +ENUMX + BFD_RELOC_SH_IMM_HI16_PCREL +ENUMX + BFD_RELOC_SH_PT_16 +COMMENT ENUMDOC MIPS ELF relocations. diff -uprN binutils-2.11.93.0.2/bfd/syms.c binutils-2.12.90.0.1/bfd/syms.c --- binutils-2.11.93.0.2/bfd/syms.c Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/syms.c Thu Mar 7 11:52:37 2002 @@ -545,23 +545,25 @@ struct section_to_type adding entries. Since it is so short, a linear search is used. */ static const struct section_to_type stt[] = { - {"*DEBUG*", 'N'}, {".bss", 'b'}, - {"zerovars", 'b'}, /* MRI .bss */ + {"code", 't'}, /* MRI .text */ {".data", 'd'}, - {"vars", 'd'}, /* MRI .data */ + {"*DEBUG*", 'N'}, + {".debug", 'N'}, /* MSVC's .debug (non-standard debug syms) */ + {".drectve", 'i'}, /* MSVC's .drective section */ + {".edata", 'e'}, /* MSVC's .edata (export) section */ + {".fini", 't'}, /* ELF fini section */ + {".idata", 'i'}, /* MSVC's .idata (import) section */ + {".init", 't'}, /* ELF init section */ + {".pdata", 'p'}, /* MSVC's .pdata (stack unwind) section */ {".rdata", 'r'}, /* Read only data. */ {".rodata", 'r'}, /* Read only data. */ {".sbss", 's'}, /* Small BSS (uninitialized data). */ {".scommon", 'c'}, /* Small common. */ {".sdata", 'g'}, /* Small initialized data. */ {".text", 't'}, - {"code", 't'}, /* MRI .text */ - {".drectve", 'i'}, /* MSVC's .drective section */ - {".idata", 'i'}, /* MSVC's .idata (import) section */ - {".edata", 'e'}, /* MSVC's .edata (export) section */ - {".pdata", 'p'}, /* MSVC's .pdata (stack unwind) section */ - {".debug", 'N'}, /* MSVC's .debug (non-standard debug syms) */ + {"vars", 'd'}, /* MRI .data */ + {"zerovars", 'b'}, /* MRI .bss */ {0, 0} }; diff -uprN binutils-2.11.93.0.2/bfd/targets.c binutils-2.12.90.0.1/bfd/targets.c --- binutils-2.11.93.0.2/bfd/targets.c Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/targets.c Thu Mar 7 11:52:37 2002 @@ -682,6 +682,10 @@ extern const bfd_target ptrace_core_vec; extern const bfd_target sco5_core_vec; extern const bfd_target trad_core_vec; +extern const bfd_target bfd_elf32_sh64_vec; +extern const bfd_target bfd_elf32_sh64l_vec; +extern const bfd_target bfd_elf64_sh64_vec; +extern const bfd_target bfd_elf64_sh64l_vec; static const bfd_target * const _bfd_target_vector[] = { #ifdef SELECT_VECS diff -uprN binutils-2.11.93.0.2/bfd/trad-core.c binutils-2.12.90.0.1/bfd/trad-core.c --- binutils-2.11.93.0.2/bfd/trad-core.c Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/trad-core.c Thu Mar 7 11:52:37 2002 @@ -211,7 +211,7 @@ trad_unix_core_file_p (abfd) 0 is at the place pointed to by u_ar0 (by setting the vma of the start of the section to -u_ar0). GDB uses this info to locate the regs, using minor trickery to get around the offset-or-absolute-addr problem. */ - core_regsec (abfd)->vma = - (bfd_vma) u.u_ar0; + core_regsec (abfd)->vma = - (bfd_vma) (unsigned long) u.u_ar0; core_datasec (abfd)->filepos = NBPG * UPAGES; core_stacksec (abfd)->filepos = (NBPG * UPAGES) + NBPG * u.u_dsize diff -uprN binutils-2.11.93.0.2/bfd/version.h binutils-2.12.90.0.1/bfd/version.h --- binutils-2.11.93.0.2/bfd/version.h Thu Feb 7 10:21:03 2002 +++ binutils-2.12.90.0.1/bfd/version.h Thu Mar 7 11:52:37 2002 @@ -1 +1 @@ -#define BFD_VERSION_DATE 20020207 +#define BFD_VERSION_DATE 20020307 diff -uprN binutils-2.11.93.0.2/bfd/xcofflink.c binutils-2.12.90.0.1/bfd/xcofflink.c --- binutils-2.11.93.0.2/bfd/xcofflink.c Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/bfd/xcofflink.c Thu Mar 7 11:52:37 2002 @@ -1046,16 +1046,12 @@ xcoff_link_add_symbols (abfd, info) && ! info->static_link) { if (! xcoff_link_add_dynamic_symbols (abfd, info)) - { - return false; - } + return false; } /* create the loader, toc, gl, ds and debug sections, if needed */ if (false == xcoff_link_create_extra_sections(abfd, info)) - { - goto error_return; - } + goto error_return; if ((abfd->flags & DYNAMIC) != 0 && ! info->static_link) @@ -1146,7 +1142,6 @@ xcoff_link_add_symbols (abfd, info) } } - /* Don't let the linker relocation routines discard the symbols. */ obj_coff_keep_syms (abfd) = true; @@ -2806,7 +2801,7 @@ boolean bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry, file_align, maxstack, maxdata, gc, modtype, textro, export_defineds, - special_sections) + special_sections, rtld) bfd *output_bfd; struct bfd_link_info *info; const char *libpath; @@ -2819,6 +2814,7 @@ bfd_xcoff_size_dynamic_sections (output_ boolean textro; boolean export_defineds; asection **special_sections; + boolean rtld; { struct xcoff_link_hash_entry *hentry; asection *lsec; @@ -2837,7 +2833,6 @@ bfd_xcoff_size_dynamic_sections (output_ if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour) { - for (i = 0; i < XCOFF_NUMBER_OF_SPECIAL_SECTIONS; i++) special_sections[i] = NULL; return true; @@ -2859,11 +2854,8 @@ bfd_xcoff_size_dynamic_sections (output_ xcoff_hash_table (info)->file_align = file_align; xcoff_hash_table (info)->textro = textro; - if (entry == NULL) - { - hentry = NULL; - } - else + hentry = NULL; + if (entry != NULL) { hentry = xcoff_link_hash_lookup (xcoff_hash_table (info), entry, false, false, true); @@ -2872,65 +2864,56 @@ bfd_xcoff_size_dynamic_sections (output_ } /* __rtinit */ - if (info->init_function || info->fini_function) { - struct xcoff_link_hash_entry *hrtinit; - struct internal_ldsym *ldsym; - - hrtinit = xcoff_link_hash_lookup (xcoff_hash_table (info), - "__rtinit", - false, false, true); - if (hrtinit != NULL) - { - xcoff_mark_symbol (info, hrtinit); - hrtinit->flags |= (XCOFF_DEF_REGULAR | XCOFF_RTINIT); - } - else - { - (*_bfd_error_handler) - (_("error: undefined symbol __rtinit")); - - return false; - } - - /* __rtinit initalized here - Some information, like the location of the .initfini seciton will - be filled in later. - - name or offset taken care of below with bfd_xcoff_put_ldsymbol_name. */ - amt = sizeof (struct internal_ldsym); - ldsym = (struct internal_ldsym *) bfd_malloc (amt); - - ldsym->l_value = 0; /* will be filled in later */ - ldsym->l_scnum = 2; /* data section */ - ldsym->l_smtype = XTY_SD; /* csect section definition */ - ldsym->l_smclas = 5; /* .rw */ - ldsym->l_ifile = 0; /* special system loader symbol */ - ldsym->l_parm = 0; /* NA */ - - /* Force __rtinit to be the first symbol in the loader symbol table - See xcoff_build_ldsyms - - The first 3 symbol table indices are reserved to indicate the data, - text and bss sections. */ - BFD_ASSERT (0 == ldinfo.ldsym_count); - - hrtinit->ldindx = 3; - ldinfo.ldsym_count = 1; - hrtinit->ldsym = ldsym; - - if (false == bfd_xcoff_put_ldsymbol_name (ldinfo.output_bfd, &ldinfo, - hrtinit->ldsym, - hrtinit->root.root.string)) - { + if (info->init_function || info->fini_function || rtld == true) + { + struct xcoff_link_hash_entry *hsym; + struct internal_ldsym *ldsym; + + hsym = xcoff_link_hash_lookup (xcoff_hash_table (info), + "__rtinit", false, false, true); + if (hsym == NULL) + { + (*_bfd_error_handler) + (_("error: undefined symbol __rtinit")); + return false; + } + + xcoff_mark_symbol (info, hsym); + hsym->flags |= (XCOFF_DEF_REGULAR | XCOFF_RTINIT); + + /* __rtinit initalized */ + amt = sizeof (struct internal_ldsym); + ldsym = (struct internal_ldsym *) bfd_malloc (amt); + + ldsym->l_value = 0; /* will be filled in later */ + ldsym->l_scnum = 2; /* data section */ + ldsym->l_smtype = XTY_SD; /* csect section definition */ + ldsym->l_smclas = 5; /* .rw */ + ldsym->l_ifile = 0; /* special system loader symbol */ + ldsym->l_parm = 0; /* NA */ + + /* Force __rtinit to be the first symbol in the loader symbol table + See xcoff_build_ldsyms + + The first 3 symbol table indices are reserved to indicate the data, + text and bss sections. */ + BFD_ASSERT (0 == ldinfo.ldsym_count); + + hsym->ldindx = 3; + ldinfo.ldsym_count = 1; + hsym->ldsym = ldsym; + + if (false == bfd_xcoff_put_ldsymbol_name (ldinfo.output_bfd, &ldinfo, + hsym->ldsym, + hsym->root.root.string)) return false; - } - - /* This symbol is written out by xcoff_write_global_symbol - Set stuff up so xcoff_write_global_symbol logic works. */ - hrtinit->flags |= XCOFF_DEF_REGULAR | XCOFF_MARK; - hrtinit->root.type = bfd_link_hash_defined; - hrtinit->root.u.def.value = 0; - } + + /* This symbol is written out by xcoff_write_global_symbol + Set stuff up so xcoff_write_global_symbol logic works. */ + hsym->flags |= XCOFF_DEF_REGULAR | XCOFF_MARK; + hsym->root.type = bfd_link_hash_defined; + hsym->root.u.def.value = 0; + } /* Garbage collect unused sections. */ if (info->relocateable @@ -3220,10 +3203,11 @@ bfd_xcoff_size_dynamic_sections (output_ } boolean -bfd_xcoff_link_generate_rtinit (abfd, init, fini) +bfd_xcoff_link_generate_rtinit (abfd, init, fini, rtld) bfd *abfd; const char *init; const char *fini; + boolean rtld; { struct bfd_in_memory *bim; @@ -3242,7 +3226,7 @@ bfd_xcoff_link_generate_rtinit (abfd, in abfd->direction = write_direction; abfd->where = 0; - if (false == bfd_xcoff_generate_rtinit (abfd, init, fini)) + if (false == bfd_xcoff_generate_rtinit (abfd, init, fini, rtld)) return false; /* need to reset to unknown or it will not be read back in correctly */ @@ -3264,14 +3248,9 @@ xcoff_build_ldsyms (h, p) struct xcoff_loader_info *ldinfo = (struct xcoff_loader_info *) p; bfd_size_type amt; - /* __rtinit - Special handling of this symbol to make is the first symbol in - the loader symbol table. Make sure this pass through does not - undo it. */ + /* __rtinit, this symbol has special handling. */ if (h->flags & XCOFF_RTINIT) - { return true; - } /* If this is a final link, and the symbol was defined as a common symbol in a regular object file, and there was no definition in @@ -3386,17 +3365,11 @@ xcoff_build_ldsyms (h, p) xcoff32 uses 4 bytes in the toc. xcoff64 uses 8 bytes in the toc. */ if (bfd_xcoff_is_xcoff64 (ldinfo->output_bfd)) - { - byte_size = 8; - } + byte_size = 8; else if (bfd_xcoff_is_xcoff32 (ldinfo->output_bfd)) - { - byte_size = 4; - } + byte_size = 4; else - { - return false; - } + return false; hds->toc_section = xcoff_hash_table (ldinfo->info)->toc_section; hds->u.toc_offset = hds->toc_section->_raw_size; diff -uprN binutils-2.11.93.0.2/binutils/ChangeLog binutils-2.12.90.0.1/binutils/ChangeLog --- binutils-2.11.93.0.2/binutils/ChangeLog Thu Feb 7 10:21:03 2002 +++ binutils-2.12.90.0.1/binutils/ChangeLog Thu Mar 7 11:52:37 2002 @@ -1,3 +1,73 @@ +2002-03-01 Dmitry Timoshkov + + * dlltool.c (gen_exp_file): Take into account --kill-at (-k) while + generating .exp file. + +2002-02-21 Nick Clifton + + * readelf.c (dump_relocations): Fix typo. + +2002-02-20 Nick Clifton + + * NEWS: Mark 2.12 branch. + +2002-02-18 Timothy Daly + + * readelf.c (dump_relocations): Display 2nd and 3rd reloc + types for 64-bit MIPS. Narrow some fields for 80-char + output. + (dump_relocations): Change spelling from 'unrecognised' + to 'unrecognized'. + (decode_ARM_machine_flags): Likewise. + (parse_args): Likewise. + (read_and_display_attr_value): Likewise. + (display_debug_section): Likewise. + +2002-02-15 Hans-Peter Nilsson + + * NEWS: Mention support for MMIX. + +2002-02-13 Matt Fredette + + * readelf.c (get_machine_flags): Recognize EF_M68000. + +2002-02-12 Alexandre Oliva + + * MAINTAINERS: Added self as MN10300 co-maintainer. + +2002-02-12 Alan Modra + + * readelf.c (get_ppc64_dynamic_type): Handle DT_PPC64_OPD and + DT_PPC64_OPDSZ. + +2002-02-11 Daniel Jacobowitz + + * MAINTAINERS: List myself as branch maintainer. + +2002-02-11 Alan Modra + + * configure: Regenerate. + * objcopy.c: Update copyright date. + * doc/Makefile.in: Regenerate. + +2002-02-10 Daniel Jacobowitz + + * nlmconv.c: Back out localtime PARAMS change. + +2002-02-11 Alan Modra + + * objcopy.c (MKDIR): Define. + (copy_archive): Make name_list.name const. Use MKDIR. + Handle duplicate files in archives by making more temp dirs. + +2002-02-10 Daniel Jacobowitz + + * coffdump.c: Include "getopt.h" after "bucomm.h" + so that macros are defined correctly. + * nlmconv.c: Add PARAMS ((const time_t *)) to localtime + prototype. Prototype main. + * nlmheader.y: Add PARAMS ((int)) to strerror prototype. + 2002-02-06 Alexandre Oliva * MAINTAINERS: Added self as SH co-maintainer. diff -uprN binutils-2.11.93.0.2/binutils/MAINTAINERS binutils-2.12.90.0.1/binutils/MAINTAINERS --- binutils-2.11.93.0.2/binutils/MAINTAINERS Thu Feb 7 10:21:03 2002 +++ binutils-2.12.90.0.1/binutils/MAINTAINERS Thu Mar 7 11:52:37 2002 @@ -67,6 +67,7 @@ responsibility among the other maintaine ix86 INTEL MODE Diego Novillo M68HC11 M68HC12 Stephane Carrez MN10300 Eric Christopher + MN10300 Alexandre Oliva MIPS Eric Christopher M88k Ben Elliston MMIX Hans-Peter Nilsson @@ -127,4 +128,4 @@ burden of maintaining the branch in sync great). If you are uncertain as to whether a patch is appropriate for the branch, ask the branch maintainer. This is: - Philip Blundell + Daniel Jacobowitz diff -uprN binutils-2.11.93.0.2/binutils/NEWS binutils-2.12.90.0.1/binutils/NEWS --- binutils-2.11.93.0.2/binutils/NEWS Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/binutils/NEWS Thu Mar 7 11:52:37 2002 @@ -1,5 +1,9 @@ -*- text -*- +Changes in version 2.12: + +* Support for Don Knuth's MMIX, by Hans-Peter Nilsson. + * size: Add --totals to display summary of sizes (Berkeley format only). * readelf: Add --wide option to not break section header or segment listing diff -uprN binutils-2.11.93.0.2/binutils/coffdump.c binutils-2.12.90.0.1/binutils/coffdump.c --- binutils-2.11.93.0.2/binutils/coffdump.c Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/binutils/coffdump.c Thu Mar 7 11:52:37 2002 @@ -24,11 +24,11 @@ it out so we can test the grokker. */ #include -#include #include #include "coffgrok.h" #include "bucomm.h" +#include "getopt.h" static int atnl; diff -uprN binutils-2.11.93.0.2/binutils/configure binutils-2.12.90.0.1/binutils/configure --- binutils-2.11.93.0.2/binutils/configure Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/binutils/configure Thu Mar 7 11:52:37 2002 @@ -1564,7 +1564,7 @@ irix5* | irix6*) # This must be Linux ELF. linux-gnu*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB( .*|) (shared object|dynamic lib )' lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` ;; diff -uprN binutils-2.11.93.0.2/binutils/dlltool.c binutils-2.12.90.0.1/binutils/dlltool.c --- binutils-2.11.93.0.2/binutils/dlltool.c Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/binutils/dlltool.c Thu Mar 7 11:52:37 2002 @@ -1,5 +1,5 @@ /* dlltool.c -- tool to generate stuff for PE style DLLs - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001 + Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -1865,7 +1865,7 @@ gen_exp_file () if (!exp->noname || show_allnames) { fprintf (f, "n%d: %s \"%s\"\n", - exp->ordinal, ASM_TEXT, exp->name); + exp->ordinal, ASM_TEXT, xlate (exp->name)); if (exp->forward != 0) fprintf (f, "f%d: %s \"%s\"\n", exp->forward, ASM_TEXT, exp->internal_name); diff -uprN binutils-2.11.93.0.2/binutils/doc/Makefile.in binutils-2.12.90.0.1/binutils/doc/Makefile.in --- binutils-2.11.93.0.2/binutils/doc/Makefile.in Sun Feb 3 11:22:31 2002 +++ binutils-2.12.90.0.1/binutils/doc/Makefile.in Thu Mar 7 11:52:37 2002 @@ -175,7 +175,7 @@ DIST_COMMON = Makefile.am Makefile.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = gtar +TAR = tar GZIP_ENV = --best all: all-redirect .SUFFIXES: diff -uprN binutils-2.11.93.0.2/binutils/nlmconv.c binutils-2.12.90.0.1/binutils/nlmconv.c --- binutils-2.11.93.0.2/binutils/nlmconv.c Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/binutils/nlmconv.c Thu Mar 7 11:52:37 2002 @@ -122,6 +122,8 @@ static struct option long_options[] = /* Local routines. */ +int main PARAMS ((int, char **)); + static void show_usage PARAMS ((FILE *, int)); static const char *select_output_format PARAMS ((enum bfd_architecture, unsigned long, boolean)); diff -uprN binutils-2.11.93.0.2/binutils/nlmheader.y binutils-2.12.90.0.1/binutils/nlmheader.y --- binutils-2.11.93.0.2/binutils/nlmheader.y Mon Oct 1 15:25:22 2001 +++ binutils-2.12.90.0.1/binutils/nlmheader.y Thu Mar 7 11:52:37 2002 @@ -1,5 +1,6 @@ %{/* nlmheader.y - parse NLM header specification keywords. - Copyright 1993, 1994, 1995, 1997, 1998, 2001 Free Software Foundation, Inc. + Copyright 1993, 1994, 1995, 1997, 1998, 2001, 2002 + Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -494,7 +495,7 @@ string_list: /* If strerror is just a macro, we want to use the one from libiberty since it will handle undefined values. */ #undef strerror -extern char *strerror (); +extern char *strerror PARAMS ((int)); /* The lexer is simple, too simple for flex. Keywords are only recognized at the start of lines. Everything else must be an diff -uprN binutils-2.11.93.0.2/binutils/objcopy.c binutils-2.12.90.0.1/binutils/objcopy.c --- binutils-2.11.93.0.2/binutils/objcopy.c Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/binutils/objcopy.c Thu Mar 7 11:52:37 2002 @@ -1,6 +1,6 @@ /* objcopy.c -- copy object file from input to output, optionally massaging it. Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001 + 2001, 2002 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -1268,6 +1268,13 @@ copy_object (ibfd, obfd) } } +#undef MKDIR +#if defined (_WIN32) && !defined (__CYGWIN32__) +#define MKDIR(DIR, MODE) mkdir (DIR) +#else +#define MKDIR(DIR, MODE) mkdir (DIR, MODE) +#endif + /* Read each archive element in turn from IBFD, copy the contents to temp file, and keep the temp file handle. */ @@ -1280,7 +1287,7 @@ copy_archive (ibfd, obfd, output_target) struct name_list { struct name_list *next; - char *name; + const char *name; bfd *obfd; } *list, *l; bfd **ptr = &obfd->archive_head; @@ -1288,11 +1295,7 @@ copy_archive (ibfd, obfd, output_target) char *dir = make_tempname (bfd_get_filename (obfd)); /* Make a temp directory to hold the contents. */ -#if defined (_WIN32) && !defined (__CYGWIN32__) - if (mkdir (dir) != 0) -#else - if (mkdir (dir, 0700) != 0) -#endif + if (MKDIR (dir, 0700) != 0) { fatal (_("cannot mkdir %s for archive copying (error: %s)"), dir, strerror (errno)); @@ -1308,14 +1311,35 @@ copy_archive (ibfd, obfd, output_target) while (!status && this_element != (bfd *) NULL) { - /* Create an output file for this member. */ - char *output_name = concat (dir, "/", bfd_get_filename (this_element), - (char *) NULL); - bfd *output_bfd = bfd_openw (output_name, output_target); + char *output_name; + bfd *output_bfd; bfd *last_element; struct stat buf; int stat_status = 0; + /* Create an output file for this member. */ + output_name = concat (dir, "/", + bfd_get_filename (this_element), (char *) 0); + + /* If the file already exists, make another temp dir. */ + if (stat (output_name, &buf) >= 0) + { + output_name = make_tempname (output_name); + if (MKDIR (output_name, 0700) != 0) + { + fatal (_("cannot mkdir %s for archive copying (error: %s)"), + output_name, strerror (errno)); + } + l = (struct name_list *) xmalloc (sizeof (struct name_list)); + l->name = output_name; + l->next = list; + l->obfd = NULL; + list = l; + output_name = concat (output_name, "/", + bfd_get_filename (this_element), (char *) 0); + } + + output_bfd = bfd_openw (output_name, output_target); if (preserve_dates) { stat_status = bfd_stat_arch_elt (this_element, &buf); @@ -1371,8 +1395,13 @@ copy_archive (ibfd, obfd, output_target) /* Delete all the files that we opened. */ for (l = list; l != NULL; l = l->next) { - bfd_close (l->obfd); - unlink (l->name); + if (l->obfd == NULL) + rmdir (l->name); + else + { + bfd_close (l->obfd); + unlink (l->name); + } } rmdir (dir); } diff -uprN binutils-2.11.93.0.2/binutils/readelf.c binutils-2.12.90.0.1/binutils/readelf.c --- binutils-2.11.93.0.2/binutils/readelf.c Sun Feb 3 11:22:30 2002 +++ binutils-2.12.90.0.1/binutils/readelf.c Thu Mar 7 11:52:37 2002 @@ -845,29 +845,49 @@ dump_relocations (file, rel_offset, rel_ if (is_32bit_elf) { if (is_rela) - printf - (_(" Offset Info Type Symbol's Value Symbol's Name Addend\n")); + { + if (do_wide) + printf (_(" Offset Info Type Sym. Value Symbol's Name + Addend\n")); + else + printf (_(" Offset Info Type Sym.Value Sym. Name + Addend\n")); + } else - printf - (_(" Offset Info Type Symbol's Value Symbol's Name\n")); + { + if (do_wide) + printf (_(" Offset Info Type Sym. Value Symbol's Name\n")); + else + printf (_(" Offset Info Type Sym.Value Sym. Name\n")); + } } else { if (is_rela) - printf - (_(" Offset Info Type Symbol's Value Symbol's Name Addend\n")); + { + if (do_wide) + printf (_(" Offset Info Type Symbol's Value Symbol's Name + Addend\n")); + else + printf (_(" Offset Info Type Sym. Value Sym. Name + Addend\n")); + } else - printf - (_(" Offset Info Type Symbol's Value Symbol's Name\n")); + { + if (do_wide) + printf (_(" Offset Info Type Symbol's Value Symbol's Name\n")); + else + printf (_(" Offset Info Type Sym. Value Sym. Name\n")); + } } for (i = 0; i < rel_size; i++) { const char * rtype; + const char * rtype2 = NULL; + const char * rtype3 = NULL; bfd_vma offset; bfd_vma info; bfd_vma symtab_index; bfd_vma type; + bfd_vma type2 = (bfd_vma) NULL; + bfd_vma type3 = (bfd_vma) NULL; if (is_rela) { @@ -887,10 +907,16 @@ dump_relocations (file, rel_offset, rel_ } else { - if (elf_header.e_machine == EM_SPARCV9) - type = ELF64_R_TYPE_ID (info); + if (elf_header.e_machine == EM_MIPS) + { + type = ELF64_MIPS_R_TYPE (info); + type2 = ELF64_MIPS_R_TYPE2 (info); + type3 = ELF64_MIPS_R_TYPE3 (info); + } + else if (elf_header.e_machine == EM_SPARCV9) + type = ELF64_R_TYPE_ID (info); else - type = ELF64_R_TYPE (info); + type = ELF64_R_TYPE (info); /* The #ifdef BFD64 below is to prevent a compile time warning. We know that if we do not have a 64 bit data type that we will never execute this code anyway. */ @@ -910,13 +936,18 @@ dump_relocations (file, rel_offset, rel_ else { #ifdef _bfd_int64_low - printf ("%8.8lx%8.8lx %8.8lx%8.8lx ", + printf (do_wide + ? "%8.8lx%8.8lx %8.8lx%8.8lx " + : "%4.4lx%8.8lx %4.4lx%8.8lx ", _bfd_int64_high (offset), _bfd_int64_low (offset), _bfd_int64_high (info), _bfd_int64_low (info)); #else - printf ("%16.16lx %16.16lx ", offset, info); + printf (do_wide + ? "%16.16lx %16.16lx " + : "%12.12lx %12.12lx ", + offset, info); #endif } @@ -1006,6 +1037,11 @@ dump_relocations (file, rel_offset, rel_ case EM_MIPS: case EM_MIPS_RS3_LE: rtype = elf_mips_reloc_type (type); + if (!is_32bit_elf) + { + rtype2 = elf_mips_reloc_type (type2); + rtype3 = elf_mips_reloc_type (type3); + } break; case EM_ALPHA: @@ -1067,12 +1103,12 @@ dump_relocations (file, rel_offset, rel_ if (rtype == NULL) #ifdef _bfd_int64_low - printf (_("unrecognised: %-7lx"), _bfd_int64_low (type)); + printf (_("unrecognized: %-7lx"), _bfd_int64_low (type)); #else - printf (_("unrecognised: %-7lx"), type); + printf (_("unrecognized: %-7lx"), type); #endif else - printf ("%-21.21s", rtype); + printf (do_wide ? "%-21.21s" : "%-17.17s", rtype); if (symtab_index) { @@ -1086,14 +1122,14 @@ dump_relocations (file, rel_offset, rel_ printf (" "); print_vma (psym->st_value, LONG_HEX); - printf (" "); + printf (is_32bit_elf ? " " : " "); if (psym->st_name == 0) - print_symbol (-25, SECTION_NAME (section_headers + psym->st_shndx)); + print_symbol (22, SECTION_NAME (section_headers + psym->st_shndx)); else if (strtab == NULL) printf (_(""), psym->st_name); else - print_symbol (-25, strtab + psym->st_name); + print_symbol (22, strtab + psym->st_name); if (is_rela) printf (" + %lx", (unsigned long) relas [i].r_addend); @@ -1101,7 +1137,7 @@ dump_relocations (file, rel_offset, rel_ } else if (is_rela) { - printf ("%*c", is_32bit_elf ? 34 : 26, ' '); + printf ("%*c", is_32bit_elf ? (do_wide ? 34 : 28) : (do_wide ? 26 : 20), ' '); print_vma (relas[i].r_addend, LONG_HEX); } @@ -1110,6 +1146,33 @@ dump_relocations (file, rel_offset, rel_ printf (" + %lx", (unsigned long) ELF64_R_TYPE_DATA (info)); putchar ('\n'); + + if (! is_32bit_elf && elf_header.e_machine == EM_MIPS) + { + printf (" Type2: "); + + if (rtype2 == NULL) +#ifdef _bfd_int64_low + printf (_("unrecognized: %-7lx"), _bfd_int64_low (type2)); +#else + printf (_("unrecognized: %-7lx"), type2); +#endif + else + printf ("%-17.17s", rtype2); + + printf("\n Type3: "); + + if (rtype3 == NULL) +#ifdef _bfd_int64_low + printf (_("unrecognized: %-7lx"), _bfd_int64_low (type3)); +#else + printf (_("unrecognized: %-7lx"), type3); +#endif + else + printf ("%-17.17s", rtype3); + + putchar ('\n'); + } } if (is_rela) @@ -1193,6 +1256,8 @@ get_ppc64_dynamic_type (type) switch (type) { case DT_PPC64_GLINK: return "PPC64_GLINK"; + case DT_PPC64_OPD: return "PPC64_OPD"; + case DT_PPC64_OPDSZ: return "PPC64_OPDSZ"; default: return NULL; } @@ -1502,7 +1567,7 @@ decode_ARM_machine_flags (e_flags, buf) switch (eabi) { default: - strcat (buf, ", "); + strcat (buf, ", "); if (e_flags) unknown = 1; break; @@ -1639,6 +1704,8 @@ get_machine_flags (e_flags, e_machine) case EM_68K: if (e_flags & EF_CPU32) strcat (buf, ", cpu32"); + if (e_flags & EF_M68000) + strcat (buf, ", m68000"); break; case EM_PPC: @@ -2369,7 +2436,7 @@ parse_args (argc, argv) break; default: - warn (_("Unrecognised debug option '%s'\n"), optarg); + warn (_("Unrecognized debug option '%s'\n"), optarg); break; } } @@ -7375,7 +7442,7 @@ read_and_display_attr_value (attribute, break; default: - warn (_("Unrecognised form: %d\n"), form); + warn (_("Unrecognized form: %d\n"), form); break; } @@ -8598,7 +8665,7 @@ display_debug_section (section, file) } if (i == -1) - printf (_("Unrecognised debug section: %s\n"), name); + printf (_("Unrecognized debug section: %s\n"), name); free (start); diff -uprN binutils-2.11.93.0.2/binutils/testsuite/ChangeLog binutils-2.12.90.0.1/binutils/testsuite/ChangeLog --- binutils-2.11.93.0.2/binutils/testsuite/ChangeLog Sun Feb 3 11:22:31 2002 +++ binutils-2.12.90.0.1/binutils/testsuite/ChangeLog Thu Mar 7 11:52:37 2002 @@ -1,3 +1,26 @@ +2002-02-18 Timothy Daly + + * binutils-all/readelf.r: Change expected output to match new, + narrowed-to-80-chars format. + * binutils-all/readelf.r-64: Change expected output to match new, + narrowed-to-80-chars format. + +2002-02-18 Hans-Peter Nilsson + + * binutils-all/objcopy.exp + (strip_executable_with_saving_a_symbol): Prune symbol Main in nm + output for mmix-knuth-mmixware. + +2002-02-13 Nick Clifton + + * binutils-all/readelf.ss-mips: Do not expect an explicit + ordering of the sections. + +2002-02-10 Nick Clifton + + * binutils-all/objdump.exp: Add 'xscale' to the list of expected + CPUs. + 2002-01-14 Nick Clifton * binutils-all/objcopy.exp: Expect xscale-coff to fail simple diff -uprN binutils-2.11.93.0.2/binutils/testsuite/binutils-all/objcopy.exp binutils-2.12.90.0.1/binutils/testsuite/binutils-all/objcopy.exp --- binutils-2.11.93.0.2/binutils/testsuite/binutils-all/objcopy.exp Sun Feb 3 11:22:31 2002 +++ binutils-2.12.90.0.1/binutils/testsuite/binutils-all/objcopy.exp Thu Mar 7 11:52:37 2002 @@ -596,6 +596,15 @@ proc strip_executable_with_saving_a_symb } set exec_output [binutils_run $NM "$NMFLAGS ${copyfile}"] + if { [istarget mmix-knuth-mmixware] } { + # Whenever there's a symbol in the mmo format, there's the symbol + # Main, so remove it manually from the expected output for sake of + # this test. + + # Using "" not {} to get the \n and \r translated. + regsub "^\[0-9a-fA-F\]+\[ \]+T Main\[\n\r\]+" $exec_output "" exec_output + } + if {![regexp {^[0-9a-fA-F]+ T main} $exec_output] \ && ![regexp {^[0-9a-fA-F]+ T _main} $exec_output]} { fail $test diff -uprN binutils-2.11.93.0.2/binutils/testsuite/binutils-all/objdump.exp binutils-2.12.90.0.1/binutils/testsuite/binutils-all/objdump.exp --- binutils-2.11.93.0.2/binutils/testsuite/binutils-all/objdump.exp Wed Nov 21 15:35:32 2001 +++ binutils-2.12.90.0.1/binutils/testsuite/binutils-all/objdump.exp Thu Mar 7 11:52:37 2002 @@ -40,7 +40,7 @@ lappend cpus_expected d10v d30v fr30 h8 lappend cpus_expected m32r m68hc11 m68hc12 m68k m88k MCore lappend cpus_expected mips mn10200 mn10300 ns32k pj powerpc pyramid lappend cpus_expected romp rs6000 s390 sh sparc tahoe tic54x tms320c54x v850 -lappend cpus_expected vax we32k x86-64 z8k z8001 z8002 +lappend cpus_expected vax we32k x86-64 xscale z8k z8001 z8002 # Make sure the target CPU shows up in the list. lappend cpus_expected ${target_cpu} diff -uprN binutils-2.11.93.0.2/binutils/testsuite/binutils-all/readelf.r binutils-2.12.90.0.1/binutils/testsuite/binutils-all/readelf.r --- binutils-2.11.93.0.2/binutils/testsuite/binutils-all/readelf.r Wed Aug 22 08:52:10 2001 +++ binutils-2.12.90.0.1/binutils/testsuite/binutils-all/readelf.r Thu Mar 7 11:52:37 2002 @@ -1,4 +1,4 @@ Relocation section '.rel.*text' at offset 0x.* contains 1 entries: - Offset Info Type Symbol's Value Symbol's Name.* -00000004 [0-9A-Fa-f]+ *R_.*00000000 external_symbol.* + Offset Info Type Sym.Value Sym. Name.* +00000004 [0-9A-Fa-f]+ *R_.*00000000 external_symbol.* diff -uprN binutils-2.11.93.0.2/binutils/testsuite/binutils-all/readelf.r-64 binutils-2.12.90.0.1/binutils/testsuite/binutils-all/readelf.r-64 --- binutils-2.11.93.0.2/binutils/testsuite/binutils-all/readelf.r-64 Wed Aug 22 08:52:10 2001 +++ binutils-2.12.90.0.1/binutils/testsuite/binutils-all/readelf.r-64 Thu Mar 7 11:52:37 2002 @@ -1,4 +1,4 @@ Relocation section '.rel.*text' at offset 0x.* contains 1 entries: - Offset Info Type Symbol's Value Symbol's Name.* -0000000000000004 [0-9A-Fa-f]+ *R_.*0000000000000000 external_symbol.* + Offset Info Type Sym. Value Sym. Name.* +0+04 [0-9A-Fa-f]+ *R_.*0+00 external_symbol.* diff -uprN binutils-2.11.93.0.2/binutils/testsuite/binutils-all/readelf.ss-mips binutils-2.12.90.0.1/binutils/testsuite/binutils-all/readelf.ss-mips --- binutils-2.11.93.0.2/binutils/testsuite/binutils-all/readelf.ss-mips Sat Jun 9 00:13:01 2001 +++ binutils-2.12.90.0.1/binutils/testsuite/binutils-all/readelf.ss-mips Thu Mar 7 11:52:37 2002 @@ -2,14 +2,14 @@ Symbol table '.symtab' contains 12 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND - 1: 00000000 0 SECTION LOCAL DEFAULT 1 - 2: 00000000 0 SECTION LOCAL DEFAULT 4 - 3: 00000000 0 SECTION LOCAL DEFAULT 5 - 4: 00000000 0 SECTION LOCAL DEFAULT 6 - 5: 00000000 0 SECTION LOCAL DEFAULT 7 - 6: 00000000 0 OBJECT GLOBAL DEFAULT 1 text_symbol - 7: 00000000 0 NOTYPE LOCAL DEFAULT 1 static_text_symbol + 1: 00000000 0 SECTION LOCAL DEFAULT . + 2: 00000000 0 SECTION LOCAL DEFAULT . + 3: 00000000 0 SECTION LOCAL DEFAULT . + 4: 00000000 0 SECTION LOCAL DEFAULT . + 5: 00000000 0 SECTION LOCAL DEFAULT . + 6: 00000000 0 OBJECT GLOBAL DEFAULT . text_symbol + 7: 00000000 0 NOTYPE LOCAL DEFAULT . static_text_symbol 8: 00000000 0 NOTYPE GLOBAL DEFAULT UND external_symbol - 9: 00000000 0 OBJECT GLOBAL DEFAULT 4 data_symbol - 10: 00000000 0 NOTYPE LOCAL DEFAULT 4 static_data_symbol + 9: 00000000 0 OBJECT GLOBAL DEFAULT . data_symbol + 10: 00000000 0 NOTYPE LOCAL DEFAULT . static_data_symbol 11: 00000004 4 OBJECT GLOBAL DEFAULT (PRC|COM) common_symbol diff -uprN binutils-2.11.93.0.2/binutils.spec binutils-2.12.90.0.1/binutils.spec --- binutils-2.11.93.0.2/binutils.spec Thu Feb 7 10:33:06 2002 +++ binutils-2.12.90.0.1/binutils.spec Thu Mar 7 12:23:48 2002 @@ -9,7 +9,7 @@ Summary: A GNU collection of binary utilities. Name: binutils -Version: 2.11.93.0.2 +Version: 2.12.90.0.1 Release: 1 Copyright: GPL Group: Development/Tools @@ -131,7 +131,6 @@ rm -rf ${RPM_BUILD_ROOT} /sbin/install-info --info-dir=%{_infodir} %{_infodir}/as.info.gz /sbin/install-info --info-dir=%{_infodir} %{_infodir}/bfd.info.gz /sbin/install-info --info-dir=%{_infodir} %{_infodir}/binutils.info.gz -/sbin/install-info --info-dir=%{_infodir} %{_infodir}/gasp.info.gz /sbin/install-info --info-dir=%{_infodir} %{_infodir}/gprof.info.gz /sbin/install-info --info-dir=%{_infodir} %{_infodir}/ld.info.gz /sbin/install-info --info-dir=%{_infodir} %{_infodir}/standards.info.gz @@ -141,7 +140,6 @@ if [ $1 = 0 ] ;then /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/as.info.gz /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/bfd.info.gz /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/binutils.info.gz - /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/gasp.info.gz /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/gprof.info.gz /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/ld.info.gz /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/standards.info.gz diff -uprN binutils-2.11.93.0.2/binutils.spec.in binutils-2.12.90.0.1/binutils.spec.in --- binutils-2.11.93.0.2/binutils.spec.in Thu Feb 7 10:21:03 2002 +++ binutils-2.12.90.0.1/binutils.spec.in Thu Mar 7 12:20:10 2002 @@ -131,7 +131,6 @@ rm -rf ${RPM_BUILD_ROOT} /sbin/install-info --info-dir=%{_infodir} %{_infodir}/as.info.gz /sbin/install-info --info-dir=%{_infodir} %{_infodir}/bfd.info.gz /sbin/install-info --info-dir=%{_infodir} %{_infodir}/binutils.info.gz -/sbin/install-info --info-dir=%{_infodir} %{_infodir}/gasp.info.gz /sbin/install-info --info-dir=%{_infodir} %{_infodir}/gprof.info.gz /sbin/install-info --info-dir=%{_infodir} %{_infodir}/ld.info.gz /sbin/install-info --info-dir=%{_infodir} %{_infodir}/standards.info.gz @@ -141,7 +140,6 @@ if [ $1 = 0 ] ;then /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/as.info.gz /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/bfd.info.gz /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/binutils.info.gz - /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/gasp.info.gz /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/gprof.info.gz /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/ld.info.gz /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/standards.info.gz diff -uprN binutils-2.11.93.0.2/config.guess binutils-2.12.90.0.1/config.guess --- binutils-2.11.93.0.2/config.guess Sun Feb 3 11:22:29 2002 +++ binutils-2.12.90.0.1/config.guess Thu Mar 7 11:52:36 2002 @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002 Free Software Foundation, Inc. -timestamp='2002-01-30' +timestamp='2002-02-19' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -340,7 +340,7 @@ EOF echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; sun*:*:4.2BSD:*) - UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) @@ -509,7 +509,7 @@ EOF fi exit 0 ;; *:AIX:*:[45]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else @@ -683,9 +683,6 @@ EOF C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit 0 ;; - CRAY*X-MP:*:*:*) - echo xmp-cray-unicos - exit 0 ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; @@ -707,9 +704,6 @@ EOF CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; - CRAY-2:*:*:*) - echo cray2-cray-unicos - exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` @@ -837,9 +831,8 @@ EOF # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. - # Export LANG=C to prevent ld from outputting information in other - # languages. - ld_supported_targets=`LANG=C; export LANG; cd /; ld --help 2>&1 \ + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// diff -uprN binutils-2.11.93.0.2/config.sub binutils-2.12.90.0.1/config.sub --- binutils-2.11.93.0.2/config.sub Sun Feb 3 11:22:29 2002 +++ binutils-2.12.90.0.1/config.sub Thu Mar 7 11:52:36 2002 @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002 Free Software Foundation, Inc. -timestamp='2002-02-01' +timestamp='2002-02-22' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -118,7 +118,7 @@ esac # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*) + nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; @@ -239,7 +239,7 @@ case $basic_machine in | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | m32r | m68000 | m68k | m88k | mcore \ - | mips16 | mips64 | mips64el | mips64orion | mips64orionel \ + | mips | mips16 | mips64 | mips64el | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el | mips64vr4300 \ | mips64vr4300el | mips64vr5000 | mips64vr5000el \ | mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \ @@ -289,7 +289,7 @@ case $basic_machine in | avr-* \ | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c54x-* \ - | clipper-* | cray2-* | cydra-* \ + | clipper-* | cydra-* \ | d10v-* | d30v-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | fx80-* \ @@ -297,7 +297,7 @@ case $basic_machine in | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | m32r-* \ - | m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | mcore-* \ | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \ | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \ @@ -311,11 +311,11 @@ case $basic_machine in | romp-* | rs6000-* \ | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* | sh64-* \ | sparc-* | sparc64-* | sparc86x-* | sparclite-* \ - | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* \ - | t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ + | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ - | x86-* | x86_64-* | xmp-* | xps100-* | xscale-* | xstormy16-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ | xtensa-* \ | ymp-* \ | z8k-*) @@ -381,6 +381,10 @@ case $basic_machine in basic_machine=ns32k-sequent os=-dynix ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; convex-c1) basic_machine=c1-convex os=-bsd @@ -401,16 +405,8 @@ case $basic_machine in basic_machine=c38-convex os=-bsd ;; - cray | ymp) - basic_machine=ymp-cray - os=-unicos - ;; - cray2) - basic_machine=cray2-cray - os=-unicos - ;; - [cjt]90) - basic_machine=${basic_machine}-cray + cray | j90) + basic_machine=j90-cray os=-unicos ;; crds | unos) @@ -613,14 +609,6 @@ case $basic_machine in basic_machine=m68k-atari os=-mint ;; - mipsel*-linux*) - basic_machine=mipsel-unknown - os=-linux-gnu - ;; - mips*-linux*) - basic_machine=mips-unknown - os=-linux-gnu - ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; @@ -882,7 +870,7 @@ case $basic_machine in sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; - sv1) + sv1) basic_machine=sv1-cray os=-unicos ;; @@ -890,8 +878,16 @@ case $basic_machine in basic_machine=i386-sequent os=-dynix ;; + t3d) + basic_machine=alpha-cray + os=-unicos + ;; t3e) - basic_machine=t3e-cray + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) @@ -958,13 +954,13 @@ case $basic_machine in basic_machine=i386-pc os=-windows32-msvcrt ;; - xmp) - basic_machine=xmp-cray - os=-unicos - ;; xps | xps100) basic_machine=xps100-honeywell ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim @@ -985,13 +981,6 @@ case $basic_machine in op60c) basic_machine=hppa1.1-oki ;; - mips) - if [ x$os = x-linux-gnu ]; then - basic_machine=mips-unknown - else - basic_machine=mips-mips - fi - ;; romp) basic_machine=romp-ibm ;; @@ -1104,7 +1093,8 @@ case $os in | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* | -morphos*) + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1165,6 +1155,9 @@ case $os in -ctix* | -uts*) os=-sysv ;; + -nova*) + os=-rtmk-nova + ;; -ns2 ) os=-nextstep2 ;; diff -uprN binutils-2.11.93.0.2/configure.in binutils-2.12.90.0.1/configure.in --- binutils-2.11.93.0.2/configure.in Sun Feb 3 11:22:29 2002 +++ binutils-2.12.90.0.1/configure.in Thu Mar 7 11:52:36 2002 @@ -47,15 +47,9 @@ if [ "${enable_gdbgui}" = "yes" ] ; then host_libs="${host_libs} libgui" fi -# Set up configure/Makefile variables if libstdc++-v3 is to be built. -if [ "${enable_libstdcxx_v3}" = "yes" ] && test -d $srcdir/libstdc++-v3; then - libstdcxx_version="target-libstdc++-v3" - # Don't use libstdc++-v3's flags to configure/build itself. - libstdcxx_flags='`case $$dir in libstdc++-v3) ;; *) cat $$r/$(TARGET_SUBDIR)/libstdc++-v3/src/libstdc++.INC 2>/dev/null || : ;; esac` -L$$r/$(TARGET_SUBDIR)/libstd++-v3/src -L$$r/$(TARGET_SUBDIR)/libstd++-v3/src/.libs' -else - libstdcxx_version="target-libio target-libstdc++" - libstdcxx_flags='-isystem $$s/libstdc++ -isystem $$s/libstdc++/std -isystem $$s/libstdc++/stl -isystem $$s/libio/ -isystem $$s/libio/stdio -L$$r/$(TARGET_SUBDIR)/libstdc++' -fi +libstdcxx_version="target-libstdc++-v3" +# Don't use libstdc++-v3's flags to configure/build itself. +libstdcxx_flags='`case $$dir in libstdc++-v3 | libjava) ;; *) test ! -f $$r/$(TARGET_SUBDIR)/libstdc++-v3/testsuite_flags || $(SHELL) $$r/$(TARGET_SUBDIR)/libstdc++-v3/testsuite_flags --build-includes;; esac` -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs' # these tools are built for the host environment # Note, the powerpc-eabi build depends on sim occurring before gdb in order to @@ -889,6 +883,9 @@ case "${target}" in noconfigdirs="$noconfigdirs gprof target-libffi" # same as generic mips target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon" ;; + mips*-*-linux*) + noconfigdirs="$noconfigdirs target-libffi" + ;; mips*-*-*) noconfigdirs="$noconfigdirs gprof target-libffi" ;; @@ -904,6 +901,9 @@ case "${target}" in esac noconfigdirs="$noconfigdirs target-libgloss target-libffi" ;; + sh64-*-*) + noconfigdirs="$noconfigdirs target-libgloss ${libgcj}" + ;; sparc-*-elf*) if [ x${is_cross_compiler} != xno ] ; then target_configdirs="${target_configdirs} target-libstub target-cygmon" @@ -1440,7 +1440,10 @@ esac if test "x${CXX_FOR_TARGET+set}" = xset; then : elif test -d ${topsrcdir}/gcc; then - CXX_FOR_TARGET='$$r/gcc/`case $$dir in libstdc++-v3) echo xgcc ;; *) echo g++ ;; esac` -B$$r/gcc/ -nostdinc++ '$libstdcxx_flags + # We add -shared-libgcc to CXX_FOR_TARGET whenever we use xgcc instead + # of g++ for linking C++ or Java, because g++ has -shared-libgcc by + # default whereas gcc does not. + CXX_FOR_TARGET='$$r/gcc/`case $$dir in libstdc++-v3 | libjava) echo xgcc -shared-libgcc ;; *) echo g++ ;; esac` -B$$r/gcc/ -nostdinc++ '$libstdcxx_flags elif test "$host" = "$target"; then CXX_FOR_TARGET='$(CXX)' else diff -uprN binutils-2.11.93.0.2/etc/ChangeLog binutils-2.12.90.0.1/etc/ChangeLog --- binutils-2.11.93.0.2/etc/ChangeLog Sun Feb 3 11:22:31 2002 +++ binutils-2.12.90.0.1/etc/ChangeLog Thu Mar 7 11:52:37 2002 @@ -1,3 +1,12 @@ +2002-02-27 Andrew Cagney + + * fdl.texi: New file. + +2002-02-24 Andrew Cagney + + * standards.texi: Import February 14, 2002 version. + * make-stds.texi: Import 2001 version. + 2002-01-26 Hans-Peter Nilsson * Makefile.in (install): Depend on install-info. diff -uprN binutils-2.11.93.0.2/etc/fdl.texi binutils-2.12.90.0.1/etc/fdl.texi --- binutils-2.11.93.0.2/etc/fdl.texi Wed Dec 31 16:00:00 1969 +++ binutils-2.12.90.0.1/etc/fdl.texi Thu Mar 7 11:52:37 2002 @@ -0,0 +1,368 @@ +@c -*-texinfo-*- +@node GNU Free Documentation License, , , Copying This Manual + +@appendix GNU Free Documentation License +@center Version 1.1, March 2000 + +@display +Copyright (C) 2000 Free Software Foundation, Inc. +59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. +@end display +@sp 1 +@enumerate 0 +@item +PREAMBLE + +The purpose of this License is to make a manual, textbook, or other +written document ``free'' in the sense of freedom: to assure everyone +the effective freedom to copy and redistribute it, with or without +modifying it, either commercially or noncommercially. Secondarily, +this License preserves for the author and publisher a way to get +credit for their work, while not being considered responsible for +modifications made by others. + +This License is a kind of ``copyleft'', which means that derivative +works of the document must themselves be free in the same sense. It +complements the GNU General Public License, which is a copyleft +license designed for free software. + +We have designed this License in order to use it for manuals for free +software, because free software needs free documentation: a free +program should come with manuals providing the same freedoms that the +software does. But this License is not limited to software manuals; +it can be used for any textual work, regardless of subject matter or +whether it is published as a printed book. We recommend this License +principally for works whose purpose is instruction or reference. + +@sp 1 +@item +APPLICABILITY AND DEFINITIONS + +This License applies to any manual or other work that contains a +notice placed by the copyright holder saying it can be distributed +under the terms of this License. The ``Document'', below, refers to any +such manual or work. Any member of the public is a licensee, and is +addressed as ``you.'' + +A ``Modified Version'' of the Document means any work containing the +Document or a portion of it, either copied verbatim, or with +modifications and/or translated into another language. + +A ``Secondary Section'' is a named appendix or a front-matter section of +the Document that deals exclusively with the relationship of the +publishers or authors of the Document to the Document's overall subject +(or to related matters) and contains nothing that could fall directly +within that overall subject. (For example, if the Document is in part a +textbook of mathematics, a Secondary Section may not explain any +mathematics.) The relationship could be a matter of historical +connection with the subject or with related matters, or of legal, +commercial, philosophical, ethical or political position regarding +them. + +The ``Invariant Sections'' are certain Secondary Sections whose titles +are designated, as being those of Invariant Sections, in the notice +that says that the Document is released under this License. + +The ``Cover Texts'' are certain short passages of text that are listed, +as Front-Cover Texts or Back-Cover Texts, in the notice that says that +the Document is released under this License. + +A ``Transparent'' copy of the Document means a machine-readable copy, +represented in a format whose specification is available to the +general public, whose contents can be viewed and edited directly and +straightforwardly with generic text editors or (for images composed of +pixels) generic paint programs or (for drawings) some widely available +drawing editor, and that is suitable for input to text formatters or +for automatic translation to a variety of formats suitable for input +to text formatters. A copy made in an otherwise Transparent file +format whose markup has been designed to thwart or discourage +subsequent modification by readers is not Transparent. A copy that is +not ``Transparent'' is called ``Opaque.'' + +Examples of suitable formats for Transparent copies include plain +ASCII without markup, Texinfo input format, LaTeX input format, SGML +or XML using a publicly available DTD, and standard-conforming simple +HTML designed for human modification. Opaque formats include +PostScript, PDF, proprietary formats that can be read and edited only +by proprietary word processors, SGML or XML for which the DTD and/or +processing tools are not generally available, and the +machine-generated HTML produced by some word processors for output +purposes only. + +The ``Title Page'' means, for a printed book, the title page itself, +plus such following pages as are needed to hold, legibly, the material +this License requires to appear in the title page. For works in +formats which do not have any title page as such, ``Title Page'' means +the text near the most prominent appearance of the work's title, +preceding the beginning of the body of the text. +@sp 1 +@item +VERBATIM COPYING + +You may copy and distribute the Document in any medium, either +commercially or noncommercially, provided that this License, the +copyright notices, and the license notice saying this License applies +to the Document are reproduced in all copies, and that you add no other +conditions whatsoever to those of this License. You may not use +technical measures to obstruct or control the reading or further +copying of the copies you make or distribute. However, you may accept +compensation in exchange for copies. If you distribute a large enough +number of copies you must also follow the conditions in section 3. + +You may also lend copies, under the same conditions stated above, and +you may publicly display copies. +@sp 1 +@item +COPYING IN QUANTITY + +If you publish printed copies of the Document numbering more than 100, +and the Document's license notice requires Cover Texts, you must enclose +the copies in covers that carry, clearly and legibly, all these Cover +Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on +the back cover. Both covers must also clearly and legibly identify +you as the publisher of these copies. The front cover must present +the full title with all words of the title equally prominent and +visible. You may add other material on the covers in addition. +Copying with changes limited to the covers, as long as they preserve +the title of the Document and satisfy these conditions, can be treated +as verbatim copying in other respects. + +If the required texts for either cover are too voluminous to fit +legibly, you should put the first ones listed (as many as fit +reasonably) on the actual cover, and continue the rest onto adjacent +pages. + +If you publish or distribute Opaque copies of the Document numbering +more than 100, you must either include a machine-readable Transparent +copy along with each Opaque copy, or state in or with each Opaque copy +a publicly-accessible computer-network location containing a complete +Transparent copy of the Document, free of added material, which the +general network-using public has access to download anonymously at no +charge using public-standard network protocols. If you use the latter +option, you must take reasonably prudent steps, when you begin +distribution of Opaque copies in quantity, to ensure that this +Transparent copy will remain thus accessible at the stated location +until at least one year after the last time you distribute an Opaque +copy (directly or through your agents or retailers) of that edition to +the public. + +It is requested, but not required, that you contact the authors of the +Document well before redistributing any large number of copies, to give +them a chance to provide you with an updated version of the Document. +@sp 1 +@item +MODIFICATIONS + +You may copy and distribute a Modified Version of the Document under +the conditions of sections 2 and 3 above, provided that you release +the Modified Version under precisely this License, with the Modified +Version filling the role of the Document, thus licensing distribution +and modification of the Modified Version to whoever possesses a copy +of it. In addition, you must do these things in the Modified Version: + +A. Use in the Title Page (and on the covers, if any) a title distinct + from that of the Document, and from those of previous versions + (which should, if there were any, be listed in the History section + of the Document). You may use the same title as a previous version + if the original publisher of that version gives permission.@* +B. List on the Title Page, as authors, one or more persons or entities + responsible for authorship of the modifications in the Modified + Version, together with at least five of the principal authors of the + Document (all of its principal authors, if it has less than five).@* +C. State on the Title page the name of the publisher of the + Modified Version, as the publisher.@* +D. Preserve all the copyright notices of the Document.@* +E. Add an appropriate copyright notice for your modifications + adjacent to the other copyright notices.@* +F. Include, immediately after the copyright notices, a license notice + giving the public permission to use the Modified Version under the + terms of this License, in the form shown in the Addendum below.@* +G. Preserve in that license notice the full lists of Invariant Sections + and required Cover Texts given in the Document's license notice.@* +H. Include an unaltered copy of this License.@* +I. Preserve the section entitled ``History'', and its title, and add to + it an item stating at least the title, year, new authors, and + publisher of the Modified Version as given on the Title Page. If + there is no section entitled ``History'' in the Document, create one + stating the title, year, authors, and publisher of the Document as + given on its Title Page, then add an item describing the Modified + Version as stated in the previous sentence.@* +J. Preserve the network location, if any, given in the Document for + public access to a Transparent copy of the Document, and likewise + the network locations given in the Document for previous versions + it was based on. These may be placed in the ``History'' section. + You may omit a network location for a work that was published at + least four years before the Document itself, or if the original + publisher of the version it refers to gives permission.@* +K. In any section entitled ``Acknowledgements'' or ``Dedications'', + preserve the section's title, and preserve in the section all the + substance and tone of each of the contributor acknowledgements + and/or dedications given therein.@* +L. Preserve all the Invariant Sections of the Document, + unaltered in their text and in their titles. Section numbers + or the equivalent are not considered part of the section titles.@* +M. Delete any section entitled ``Endorsements.'' Such a section + may not be included in the Modified Version.@* +N. Do not retitle any existing section as ``Endorsements'' + or to conflict in title with any Invariant Section.@* +@sp 1 +If the Modified Version includes new front-matter sections or +appendices that qualify as Secondary Sections and contain no material +copied from the Document, you may at your option designate some or all +of these sections as invariant. To do this, add their titles to the +list of Invariant Sections in the Modified Version's license notice. +These titles must be distinct from any other section titles. + +You may add a section entitled ``Endorsements'', provided it contains +nothing but endorsements of your Modified Version by various +parties--for example, statements of peer review or that the text has +been approved by an organization as the authoritative definition of a +standard. + +You may add a passage of up to five words as a Front-Cover Text, and a +passage of up to 25 words as a Back-Cover Text, to the end of the list +of Cover Texts in the Modified Version. Only one passage of +Front-Cover Text and one of Back-Cover Text may be added by (or +through arrangements made by) any one entity. If the Document already +includes a cover text for the same cover, previously added by you or +by arrangement made by the same entity you are acting on behalf of, +you may not add another; but you may replace the old one, on explicit +permission from the previous publisher that added the old one. + +The author(s) and publisher(s) of the Document do not by this License +give permission to use their names for publicity for or to assert or +imply endorsement of any Modified Version. +@sp 1 +@item +COMBINING DOCUMENTS + +You may combine the Document with other documents released under this +License, under the terms defined in section 4 above for modified +versions, provided that you include in the combination all of the +Invariant Sections of all of the original documents, unmodified, and +list them all as Invariant Sections of your combined work in its +license notice. + +The combined work need only contain one copy of this License, and +multiple identical Invariant Sections may be replaced with a single +copy. If there are multiple Invariant Sections with the same name but +different contents, make the title of each such section unique by +adding at the end of it, in parentheses, the name of the original +author or publisher of that section if known, or else a unique number. +Make the same adjustment to the section titles in the list of +Invariant Sections in the license notice of the combined work. + +In the combination, you must combine any sections entitled ``History'' +in the various original documents, forming one section entitled +``History''; likewise combine any sections entitled ``Acknowledgements'', +and any sections entitled ``Dedications.'' You must delete all sections +entitled ``Endorsements.'' +@sp 1 +@item +COLLECTIONS OF DOCUMENTS + +You may make a collection consisting of the Document and other documents +released under this License, and replace the individual copies of this +License in the various documents with a single copy that is included in +the collection, provided that you follow the rules of this License for +verbatim copying of each of the documents in all other respects. + +You may extract a single document from such a collection, and distribute +it individually under this License, provided you insert a copy of this +License into the extracted document, and follow this License in all +other respects regarding verbatim copying of that document. +@sp 1 +@item +AGGREGATION WITH INDEPENDENT WORKS + +A compilation of the Document or its derivatives with other separate +and independent documents or works, in or on a volume of a storage or +distribution medium, does not as a whole count as a Modified Version +of the Document, provided no compilation copyright is claimed for the +compilation. Such a compilation is called an ``aggregate'', and this +License does not apply to the other self-contained works thus compiled +with the Document, on account of their being thus compiled, if they +are not themselves derivative works of the Document. + +If the Cover Text requirement of section 3 is applicable to these +copies of the Document, then if the Document is less than one quarter +of the entire aggregate, the Document's Cover Texts may be placed on +covers that surround only the Document within the aggregate. +Otherwise they must appear on covers around the whole aggregate. +@sp 1 +@item +TRANSLATION + +Translation is considered a kind of modification, so you may +distribute translations of the Document under the terms of section 4. +Replacing Invariant Sections with translations requires special +permission from their copyright holders, but you may include +translations of some or all Invariant Sections in addition to the +original versions of these Invariant Sections. You may include a +translation of this License provided that you also include the +original English version of this License. In case of a disagreement +between the translation and the original English version of this +License, the original English version will prevail. +@sp 1 +@item +TERMINATION + +You may not copy, modify, sublicense, or distribute the Document except +as expressly provided for under this License. Any other attempt to +copy, modify, sublicense or distribute the Document is void, and will +automatically terminate your rights under this License. However, +parties who have received copies, or rights, from you under this +License will not have their licenses terminated so long as such +parties remain in full compliance. +@sp 1 +@item +FUTURE REVISIONS OF THIS LICENSE + +The Free Software Foundation may publish new, revised versions +of the GNU Free Documentation License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. See +http://www.gnu.org/copyleft/. + +Each version of the License is given a distinguishing version number. +If the Document specifies that a particular numbered version of this +License ``or any later version'' applies to it, you have the option of +following the terms and conditions either of that specified version or +of any later version that has been published (not as a draft) by the +Free Software Foundation. If the Document does not specify a version +number of this License, you may choose any version ever published (not +as a draft) by the Free Software Foundation. + +@end enumerate + +@unnumberedsec ADDENDUM: How to use this License for your documents + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and +license notices just after the title page: + +@smallexample +@group +Copyright (C) @var{year} @var{your name}. +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.1 +or any later version published by the Free Software Foundation; +with the Invariant Sections being @var{list their titles}, with the +Front-Cover Texts being @var{list}, and with the Back-Cover Texts being @var{list}. +A copy of the license is included in the section entitled "GNU +Free Documentation License." +@end group +@end smallexample + +If you have no Invariant Sections, write ``with no Invariant Sections'' +instead of saying which ones are invariant. If you have no +Front-Cover Texts, write ``no Front-Cover Texts'' instead of +``Front-Cover Texts being @var{list}''; likewise for Back-Cover Texts. + +If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, +to permit their use in free software. diff -uprN binutils-2.11.93.0.2/etc/make-stds.texi binutils-2.12.90.0.1/etc/make-stds.texi --- binutils-2.11.93.0.2/etc/make-stds.texi Thu Jun 3 11:01:55 1999 +++ binutils-2.12.90.0.1/etc/make-stds.texi Thu Mar 7 11:52:37 2002 @@ -8,6 +8,17 @@ @cindex conventions for makefiles @cindex standards for makefiles +@c Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001 Free +@c Software Foundation, Inc. + +@c Permission is granted to copy, distribute and/or modify this document +@c under the terms of the GNU Free Documentation License, Version 1.1 +@c or any later version published by the Free Software Foundation; +@c with no Invariant Sections, with no +@c Front-Cover Texts, and with no Back-Cover Texts. +@c A copy of the license is included in the section entitled ``GNU +@c Free Documentation License''. + This @ifinfo node @@ -21,13 +32,15 @@ chapter @end ifclear @end iftex describes conventions for writing the Makefiles for GNU programs. +Using Automake will help you write a Makefile that follows these +conventions. @menu -* Makefile Basics:: General Conventions for Makefiles -* Utilities in Makefiles:: Utilities in Makefiles -* Command Variables:: Variables for Specifying Commands -* Directory Variables:: Variables for Installation Directories -* Standard Targets:: Standard Targets for Users +* Makefile Basics:: General Conventions for Makefiles +* Utilities in Makefiles:: Utilities in Makefiles +* Command Variables:: Variables for Specifying Commands +* Directory Variables:: Variables for Installation Directories +* Standard Targets:: Standard Targets for Users * Install Command Categories:: Three categories of commands in the `install' rule: normal, pre-install and post-install. @end menu @@ -79,7 +92,7 @@ foo.1 : foo.man sedscript @noindent will fail when the build directory is not the source directory, because -@file{foo.man} and @file{sedscript} are in the the source directory. +@file{foo.man} and @file{sedscript} are in the source directory. When using GNU @code{make}, relying on @samp{VPATH} to find the source file will work in the case where there is a single dependency file, @@ -138,7 +151,7 @@ installation should not use any utilitie @c dd find @c gunzip gzip md5sum -@c mkfifo mknod tee uname +@c mkfifo mknod tee uname @example cat cmp cp diff echo egrep expr false grep install-info @@ -247,9 +260,10 @@ Every Makefile should define the variabl basic command for installing a file into the system. Every Makefile should also define the variables @code{INSTALL_PROGRAM} -and @code{INSTALL_DATA}. (The default for each of these should be -@code{$(INSTALL)}.) Then it should use those variables as the commands -for actual installation, for executables and nonexecutables +and @code{INSTALL_DATA}. (The default for @code{INSTALL_PROGRAM} should +be @code{$(INSTALL)}; the default for @code{INSTALL_DATA} should be +@code{$@{INSTALL@} -m 644}.) Then it should use those variables as the +commands for actual installation, for executables and nonexecutables respectively. Use these variables as follows: @example @@ -280,26 +294,28 @@ installed. Installation directories should always be named by variables, so it is easy to install in a nonstandard place. The standard names for these variables are described below. They are based on a standard filesystem -layout; variants of it are used in SVR4, 4.4BSD, Linux, Ultrix v4, and -other modern operating systems. +layout; variants of it are used in SVR4, 4.4BSD, GNU/Linux, Ultrix v4, +and other modern operating systems. These two variables set the root for the installation. All the other installation directories should be subdirectories of one of these two, and nothing should be directly installed into these two directories. -@table @samp +@table @code @item prefix +@vindex prefix A prefix used in constructing the default values of the variables listed below. The default value of @code{prefix} should be @file{/usr/local}. When building the complete GNU system, the prefix will be empty and @file{/usr} will be a symbolic link to @file{/}. (If you are using Autoconf, write it as @samp{@@prefix@@}.) -Running @samp{make install} with a different value of @code{prefix} -from the one used to build the program should @var{not} recompile -the program. +Running @samp{make install} with a different value of @code{prefix} from +the one used to build the program should @emph{not} recompile the +program. @item exec_prefix +@vindex exec_prefix A prefix used in constructing the default values of some of the variables listed below. The default value of @code{exec_prefix} should be @code{$(prefix)}. @@ -310,20 +326,22 @@ machine-specific files (such as executab while @code{$(prefix)} is used directly for other directories. Running @samp{make install} with a different value of @code{exec_prefix} -from the one used to build the program should @var{not} recompile the +from the one used to build the program should @emph{not} recompile the program. @end table Executable programs are installed in one of the following directories. -@table @samp +@table @code @item bindir +@vindex bindir The directory for installing executable programs that users can run. This should normally be @file{/usr/local/bin}, but write it as @file{$(exec_prefix)/bin}. (If you are using Autoconf, write it as @samp{@@bindir@@}.) @item sbindir +@vindex sbindir The directory for installing executable programs that can be run from the shell, but are only generally useful to system administrators. This should normally be @file{/usr/local/sbin}, but write it as @@ -331,6 +349,7 @@ should normally be @file{/usr/local/sbin (If you are using Autoconf, write it as @samp{@@sbindir@@}.) @item libexecdir +@vindex libexecdir @comment This paragraph adjusted to avoid overfull hbox --roland 5jul94 The directory for installing executable programs to be run by other programs rather than by users. This directory should normally be @@ -623,7 +642,8 @@ the installation commands. @xref{Instal @item install-strip Like @code{install}, but strip the executable files while installing -them. In many cases, the definition of this target can be very simple: +them. In simple cases, this target can use the @code{install} target in +a simple way: @smallexample install-strip: @@ -631,6 +651,14 @@ install-strip: install @end smallexample +But if the package installs scripts as well as real executables, the +@code{install-strip} target can't just refer to the @code{install} +target; it has to strip the executables but not the scripts. + +@code{install-strip} should not strip the executables in the build +directory which are being copied for installation. It should only strip +the copies that are installed. + Normally we do not recommend stripping an executable unless you are sure the program has no bugs. However, it can be reasonable to install a stripped executable for actual execution while saving the unstripped @@ -745,7 +773,7 @@ The easiest way to do this is to create named, use @code{ln} or @code{cp} to install the proper files in it, and then @code{tar} that subdirectory. -Compress the tar file file with @code{gzip}. For example, the actual +Compress the tar file with @code{gzip}. For example, the actual distribution file for GCC version 1.40 is called @file{gcc-1.40.tar.gz}. The @code{dist} target should explicitly depend on all non-source files @@ -793,6 +821,19 @@ installdirs: mkinstalldirs $(mandir) @end smallexample +@noindent +or, if you wish to support @env{DESTDIR}, + +@smallexample +# Make sure all installation directories (e.g. $(bindir)) +# actually exist by making them if necessary. +installdirs: mkinstalldirs + $(srcdir)/mkinstalldirs \ + $(DESTDIR)$(bindir) $(DESTDIR)$(datadir) \ + $(DESTDIR)$(libdir) $(DESTDIR)$(infodir) \ + $(DESTDIR)$(mandir) +@end smallexample + This rule should not modify the directories where compilation is done. It should do nothing but create installation directories. @end table diff -uprN binutils-2.11.93.0.2/etc/standards.texi binutils-2.12.90.0.1/etc/standards.texi --- binutils-2.11.93.0.2/etc/standards.texi Thu Jun 3 11:01:55 1999 +++ binutils-2.12.90.0.1/etc/standards.texi Thu Mar 7 11:52:37 2002 @@ -3,7 +3,7 @@ @setfilename standards.info @settitle GNU Coding Standards @c This date is automagically updated when you save this file: -@set lastupdate March 13, 1998 +@set lastupdate February 14, 2002 @c %**end of header @ifinfo @@ -17,6 +17,12 @@ END-INFO-DIR-ENTRY @c @setchapternewpage odd @setchapternewpage off +@c Put everything in one index (arbitrarily chosen to be the concept index). +@syncodeindex fn cp +@syncodeindex ky cp +@syncodeindex pg cp +@syncodeindex vr cp + @c This is used by a cross ref in make-stds.texi @set CODESTD 1 @iftex @@ -28,52 +34,33 @@ END-INFO-DIR-ENTRY @ifinfo GNU Coding Standards -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -@ignore -Permission is granted to process this file through TeX and print the -results, provided the printed document carries copying permission -notice identical to this one except for the removal of this paragraph -(this paragraph not being relevant to the printed manual). -@end ignore - -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided that the entire -resulting derived work is distributed under the terms of a permission -notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions, -except that this permission notice may be stated in a translation approved -by the Free Software Foundation. +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.1 +or any later version published by the Free Software Foundation; +with no Invariant Sections, with no +Front-Cover Texts, and with no Back-Cover Texts. +A copy of the license is included in the section entitled ``GNU +Free Documentation License''. @end ifinfo @titlepage @title GNU Coding Standards -@author Richard Stallman +@author Richard Stallman, et al. @author last updated @value{lastupdate} @page @vskip 0pt plus 1filll -Copyright @copyright{} 1992, 1993, 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. +Copyright @copyright{} 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided that the entire -resulting derived work is distributed under the terms of a permission -notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions, -except that this permission notice may be stated in a translation approved -by the Free Software Foundation. +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.1 +or any later version published by the Free Software Foundation; +with no Invariant Sections, with no +Front-Cover Texts, and with no Back-Cover Texts. +A copy of the license is included in the section entitled ``GNU +Free Documentation License''. @end titlepage @ifinfo @@ -85,12 +72,16 @@ Last updated @value{lastupdate}. @menu * Preface:: About the GNU Coding Standards -* Intellectual Property:: Keeping Free Software Free +* Legal Issues:: Keeping Free Software Free * Design Advice:: General Program Design * Program Behavior:: Program Behavior for All Programs * Writing C:: Making The Best Use of C * Documentation:: Documenting Programs * Managing Releases:: The Release Process +* References:: References to Non-Free Software or Documentation +* Copying This Manual:: How to Make Copies of This Manual +* Index:: + @end menu @node Preface @@ -104,28 +95,57 @@ programs written in C, but many of the r even if you write in another programming language. The rules often state reasons for writing in a certain way. +This release of the GNU Coding Standards was last updated +@value{lastupdate}. + +@cindex where to obtain @code{standards.texi} +@cindex downloading this manual +If you did not obtain this file directly from the GNU project and +recently, please check for a newer version. You can ftp the GNU +Coding Standards from any GNU FTP host in the directory +@file{/pub/gnu/standards/}. The GNU Coding Standards are available +there in several different formats: @file{standards.text}, +@file{standards.info}, and @file{standards.dvi}, as well as the +Texinfo ``source'' which is divided in two files: +@file{standards.texi} and @file{make-stds.texi}. The GNU Coding +Standards are also available on the GNU World Wide Web server: +@uref{http://www.gnu.org/prep/standards_toc.html}. + Corrections or suggestions for this document should be sent to -@email{gnu@@gnu.org}. If you make a suggestion, please include a +@email{bug-standards@@gnu.org}. If you make a suggestion, please include a suggested new wording for it; our time is limited. We prefer a context diff to the @file{standards.texi} or @file{make-stds.texi} files, but if you don't have those files, please mail your suggestion anyway. -This release of the GNU Coding Standards was last updated -@value{lastupdate}. +These standards cover the minimum of what is important when writing a +GNU package. Likely, the needs for additional standards will come up. +Sometimes, you might suggest that such standards be added to this +document. If you think your standards would be generally useful, please +do suggest them. + +You should also set standards for your package on many questions not +addressed or not firmly specified here. The most important point is to +be self-consistent---try to stick to the conventions you pick, and try +to document them as much as possible. That way, your program will be +more maintainable by others. -@node Intellectual Property +@node Legal Issues @chapter Keeping Free Software Free +@cindex legal aspects This @value{CHAPTER} discusses how you can make sure that GNU software -remains unencumbered. +avoids legal difficulties, and other related issues. @menu * Reading Non-Free Code:: Referring to Proprietary Programs * Contributions:: Accepting Contributions +* Trademarks:: How We Deal with Trademark Issues @end menu @node Reading Non-Free Code @section Referring to Proprietary Programs +@cindex proprietary programs +@cindex avoiding proprietary code Don't in any circumstances refer to Unix source code for or during your work on GNU! (Or to any other proprietary programs.) @@ -157,15 +177,17 @@ Or turn some parts of the program into i Or use a simple garbage collector instead of tracking precisely when to free memory, or use a new GNU facility such as obstacks. - @node Contributions @section Accepting Contributions +@cindex legal papers +@cindex accepting contributions -If someone else sends you a piece of code to add to the program you are -working on, we need legal papers to use it---the same sort of legal -papers we will need to get from you. @emph{Each} significant -contributor to a program must sign some sort of legal papers in order -for us to have clear title to the program. The main author alone is not +If the program you are working on is copyrighted by the Free Software +Foundation, then when someone else sends you a piece of code to add to +the program, we need legal papers to use it---just as we asked you to +sign papers initially. @emph{Each} person who makes a nontrivial +contribution to a program must sign some sort of legal papers in order +for us to have clear title to the program; the main author alone is not enough. So, before adding in any contributions from other people, please tell @@ -181,16 +203,17 @@ This also applies to comments and docume law, comments and code are just text. Copyright applies to all kinds of text, so we need legal papers for all kinds. +We know it is frustrating to ask for legal papers; it's frustrating for +us as well. But if you don't wait, you are going out on a limb---for +example, what if the contributor's employer won't sign a disclaimer? +You might have to take that code out again! + You don't need papers for changes of a few lines here or there, since they are not significant for copyright purposes. Also, you don't need papers if all you get from the suggestion is some ideas, not actual code -which you use. For example, if you write a different solution to the -problem, you don't need to get papers. - -We know this is frustrating; it's frustrating for us as well. But if -you don't wait, you are going out on a limb---for example, what if the -contributor's employer won't sign a disclaimer? You might have to take -that code out again! +which you use. For example, if someone send you one implementation, but +you write a different implementation of the same idea, you don't need to +get papers. The very worst thing is if you forget to tell us about the other contributor. We could be very embarrassed in court some day as a @@ -200,39 +223,124 @@ We have more detailed advice for maintai reached the stage of actually maintaining a program for GNU (whether released or not), please ask us for a copy. +@node Trademarks +@section Trademarks +@cindex trademarks + +Please do not include any trademark acknowledgements in GNU software +packages or documentation. + +Trademark acknowledgements are the statements that such-and-such is a +trademark of so-and-so. The GNU Project has no objection to the basic +idea of trademarks, but these acknowledgements feel like kowtowing, so +we don't use them. There is no legal requirement for them. + +What is legally required, as regards other people's trademarks, is to +avoid using them in ways which a reader might read as naming or labeling +our own programs or activities. For example, since ``Objective C'' is +(or at least was) a trademark, we made sure to say that we provide a +``compiler for the Objective C language'' rather than an ``Objective C +compiler''. The latter is meant to be short for the former, but it does +not explicitly state the relationship, so it could be misinterpreted as +using ``Objective C'' as a label for the compiler rather than for the +language. + @node Design Advice @chapter General Program Design +@cindex program design This @value{CHAPTER} discusses some of the issues you should take into account when designing your program. +@c Standard or ANSI C +@c +@c In 1989 the American National Standards Institute (ANSI) standardized +@c C as standard X3.159-1989. In December of that year the +@c International Standards Organization ISO adopted the ANSI C standard +@c making minor changes. In 1990 ANSI then re-adopted ISO standard +@c C. This version of C is known as either ANSI C or Standard C. + +@c A major revision of the C Standard appeared in 1999. + @menu +* Source Language:: Which languges to use. * Compatibility:: Compatibility with other implementations * Using Extensions:: Using non-standard features -* ANSI C:: Using ANSI C features -* Source Language:: Using languages other than C +* Standard C:: Using Standard C features +* Conditional Compilation:: Compiling Code Only If A Conditional is True @end menu +@node Source Language +@section Which Languages to Use +@cindex programming languges + +When you want to use a language that gets compiled and runs at high +speed, the best language to use is C. Using another language is like +using a non-standard feature: it will cause trouble for users. Even if +GCC supports the other language, users may find it inconvenient to have +to install the compiler for that other language in order to build your +program. For example, if you write your program in C++, people will +have to install the GNU C++ compiler in order to compile your program. + +C has one other advantage over C++ and other compiled languages: more +people know C, so more people will find it easy to read and modify the +program if it is written in C. + +So in general it is much better to use C, rather than the +comparable alternatives. + +But there are two exceptions to that conclusion: + +@itemize @bullet +@item +It is no problem to use another language to write a tool specifically +intended for use with that language. That is because the only people +who want to build the tool will be those who have installed the other +language anyway. + +@item +If an application is of interest only to a narrow part of the community, +then the question of which language it is written in has less effect on +other people, so you may as well please yourself. +@end itemize + +Many programs are designed to be extensible: they include an interpreter +for a language that is higher level than C. Often much of the program +is written in that language, too. The Emacs editor pioneered this +technique. + +@cindex GUILE +The standard extensibility interpreter for GNU software is GUILE, which +implements the language Scheme (an especially clean and simple dialect +of Lisp). @uref{http://www.gnu.org/software/guile/}. We don't reject +programs written in other ``scripting languages'' such as Perl and +Python, but using GUILE is very important for the overall consistency of +the GNU system. + @node Compatibility @section Compatibility with Other Implementations +@cindex compatibility with C and @sc{posix} standards +@cindex @sc{posix} compatibility With occasional exceptions, utility programs and libraries for GNU should be upward compatible with those in Berkeley Unix, and upward -compatible with @sc{ansi} C if @sc{ansi} C specifies their behavior, and -upward compatible with @sc{POSIX} if @sc{POSIX} specifies their -behavior. +compatible with Standard C if Standard C specifies their +behavior, and upward compatible with @sc{posix} if @sc{posix} specifies +their behavior. When these standards conflict, it is useful to offer compatibility modes for each of them. -@sc{ansi} C and @sc{POSIX} prohibit many kinds of extensions. Feel free -to make the extensions anyway, and include a @samp{--ansi}, +@cindex options for compatibility +Standard C and @sc{posix} prohibit many kinds of extensions. Feel +free to make the extensions anyway, and include a @samp{--ansi}, @samp{--posix}, or @samp{--compatible} option to turn them off. However, if the extension has a significant chance of breaking any real -programs or scripts, then it is not really upward compatible. Try to -redesign its interface. +programs or scripts, then it is not really upward compatible. So you +should try to redesign its interface to make it upward compatible. -Many GNU programs suppress extensions that conflict with POSIX if the +@cindex @code{POSIXLY_CORRECT}, environment variable +Many GNU programs suppress extensions that conflict with @sc{posix} if the environment variable @code{POSIXLY_CORRECT} is defined (even if it is defined with a null value). Please make your program recognize this variable if appropriate. @@ -243,10 +351,12 @@ completely with something totally differ @code{vi} is replaced with Emacs.) But it is nice to offer a compatible feature as well. (There is a free @code{vi} clone, so we offer it.) -Additional useful features not in Berkeley Unix are welcome. +Additional useful features are welcome regardless of whether +there is any precedent for them. @node Using Extensions @section Using Non-standard Features +@cindex non-standard extensions Many GNU facilities that already exist support a number of convenient extensions over the comparable Unix facilities. Whether to use these @@ -267,29 +377,33 @@ straightforwardly do without them, but t are a big improvement. An exception to this rule are the large, established programs (such as -Emacs) which run on a great variety of systems. Such programs would -be broken by use of GNU extensions. +Emacs) which run on a great variety of systems. Using GNU extensions in +such programs would make many users unhappy, so we don't do that. -Another exception is for programs that are used as part of -compilation: anything that must be compiled with other compilers in -order to bootstrap the GNU compilation facilities. If these require -the GNU compiler, then no one can compile them without having them -installed already. That would be no good. - -@node ANSI C -@section @sc{ansi} C and pre-@sc{ansi} C - -Do not ever use the ``trigraph'' feature of @sc{ansi} C. - -@sc{ansi} C is widespread enough now that it is ok to write new programs -that use @sc{ansi} C features (and therefore will not work in -non-@sc{ansi} compilers). And if a program is already written in -@sc{ansi} C, there's no need to convert it to support non-@sc{ansi} -compilers. - -However, it is easy to support non-@sc{ansi} compilers in most programs, -so you might still consider doing so when you write a program. Instead -of writing function definitions in @sc{ansi} prototype form, +Another exception is for programs that are used as part of compilation: +anything that must be compiled with other compilers in order to +bootstrap the GNU compilation facilities. If these require the GNU +compiler, then no one can compile them without having them installed +already. That would be extremely troublesome in certain cases. + +@node Standard C +@section Standard C and Pre-Standard C +@cindex @sc{ansi} C standard + +1989 Standard C is widespread enough now that it is ok to use its +features in new programs. There is one exception: do not ever use the +``trigraph'' feature of Standard C. + +1999 Standard C is not widespread yet, so please do not require its +features in programs. It is ok to use its features if they are present. + +However, it is easy to support pre-standard compilers in most programs, +so if you know how to do that, feel free. If a program you are +maintaining has such support, you should try to keep it working. + +@cindex function prototypes +To support pre-standard C, instead of writing function definitions in +standard prototype form, @example int @@ -298,7 +412,7 @@ foo (int x, int y) @end example @noindent -write the definition in pre-@sc{ansi} style like this, +write the definition in pre-standard style like this, @example int @@ -315,79 +429,123 @@ int foo (int, int); @end example You need such a declaration anyway, in a header file, to get the benefit -of @sc{ansi} C prototypes in all the files where the function is called. -And once you have it, you lose nothing by writing the function -definition in the pre-@sc{ansi} style. - -If you don't know non-@sc{ansi} C, there's no need to learn it; just -write in @sc{ansi} C. +of prototypes in all the files where the function is called. And once +you have the declaration, you normally lose nothing by writing the +function definition in the pre-standard style. + +This technique does not work for integer types narrower than @code{int}. +If you think of an argument as being of a type narrower than @code{int}, +declare it as @code{int} instead. + +There are a few special cases where this technique is hard to use. For +example, if a function argument needs to hold the system type +@code{dev_t}, you run into trouble, because @code{dev_t} is shorter than +@code{int} on some machines; but you cannot use @code{int} instead, +because @code{dev_t} is wider than @code{int} on some machines. There +is no type you can safely use on all machines in a non-standard +definition. The only way to support non-standard C and pass such an +argument is to check the width of @code{dev_t} using Autoconf and choose +the argument type accordingly. This may not be worth the trouble. + +In order to support pre-standard compilers that do not recognize +prototypes, you may want to use a preprocessor macro like this: + +@example +/* Declare the prototype for a general external function. */ +#if defined (__STDC__) || defined (WINDOWSNT) +#define P_(proto) proto +#else +#define P_(proto) () +#endif +@end example -@node Source Language -@section Using Languages Other Than C +@node Conditional Compilation +@section Conditional Compilation -Using a language other than C is like using a non-standard feature: it -will cause trouble for users. Even if GCC supports the other language, -users may find it inconvenient to have to install the compiler for that -other language in order to build your program. For example, if you -write your program in C++, people will have to install the C++ compiler -in order to compile your program. Thus, it is better if you write in C. +When supporting configuration options already known when building your +program we prefer using @code{if (... )} over conditional compilation, +as in the former case the compiler is able to perform more extensive +checking of all possible code paths. -But there are three situations when there is no disadvantage in using -some other language: +For example, please write -@itemize @bullet -@item -It is okay to use another language if your program contains an -interpreter for that language. +@smallexample + if (HAS_FOO) + ... + else + ... +@end smallexample -For example, if your program links with GUILE, it is ok to write part of -the program in Scheme or another language supported by GUILE. +instead of: -@item -It is okay to use another language in a tool specifically intended for -use with that language. - -This is okay because the only people who want to build the tool will be -those who have installed the other language anyway. +@smallexample + #ifdef HAS_FOO + ... + #else + ... + #endif +@end smallexample -@item -If an application is of interest to a narrow community, then perhaps -it's not important if the application is inconvenient to install. -@end itemize +A modern compiler such as GCC will generate exactly the same code in +both cases, and we have been using similar techniques with good success +in several projects. + +While this is not a silver bullet solving all portability problems, +following this policy would have saved the GCC project alone many person +hours if not days per year. + +In the case of function-like macros like @code{REVERSIBLE_CC_MODE} in +GCC which cannot be simply used in @code{if( ...)} statements, there is +an easy workaround. Simply introduce another macro +@code{HAS_REVERSIBLE_CC_MODE} as in the following example: -C has one other advantage over C++ and other compiled languages: more -people know C, so more people will find it easy to read and modify the -program if it is written in C. +@smallexample + #ifdef REVERSIBLE_CC_MODE + #define HAS_REVERSIBLE_CC_MODE 1 + #else + #define HAS_REVERSIBLE_CC_MODE 0 + #endif +@end smallexample @node Program Behavior @chapter Program Behavior for All Programs -This @value{CHAPTER} describes how to write robust software. It also -describes general standards for error messages, the command line interface, -and how libraries should behave. +This @value{CHAPTER} describes conventions for writing robust +software. It also describes general standards for error messages, the +command line interface, and how libraries should behave. @menu * Semantics:: Writing robust programs * Libraries:: Library behavior * Errors:: Formatting error messages -* User Interfaces:: Standards for command line interfaces -* Option Table:: Table of long options. +* User Interfaces:: Standards about interfaces generally +* Graphical Interfaces:: Standards for graphical interfaces +* Command-Line Interfaces:: Standards for command line interfaces +* Option Table:: Table of long options * Memory Usage:: When and how to care about memory needs +* File Usage:: Which files to use, and where @end menu @node Semantics @section Writing Robust Programs +@cindex arbitrary limits on data Avoid arbitrary limits on the length or number of @emph{any} data structure, including file names, lines, files, and symbols, by allocating all data structures dynamically. In most Unix utilities, ``long lines are silently truncated''. This is not acceptable in a GNU utility. +@cindex @code{NUL} characters Utilities reading files should not drop NUL characters, or any other -nonprinting characters @emph{including those with codes above 0177}. The -only sensible exceptions would be utilities specifically intended for -interface to certain types of printers that can't handle those characters. +nonprinting characters @emph{including those with codes above 0177}. +The only sensible exceptions would be utilities specifically intended +for interface to certain types of terminals or printers +that can't handle those characters. +Whenever possible, try to make programs work properly with +sequences of bytes that represent multibyte characters, using encodings +such as UTF-8 and others. +@cindex error messages Check every system call for an error return, unless you know you wish to ignore errors. Include the system error text (from @code{perror} or equivalent) in @emph{every} error message resulting from a failing @@ -395,6 +553,8 @@ system call, as well as the name of the utility. Just ``cannot open foo.c'' or ``stat failed'' is not sufficient. +@cindex @code{malloc} return value +@cindex memory allocation failure Check every call to @code{malloc} or @code{realloc} to see if it returned zero. Check @code{realloc} even if you are making the block smaller; in a system that rounds block sizes to a power of 2, @@ -416,6 +576,7 @@ user), it is better to abort the command reader loop. This allows the user to kill other processes to free up virtual memory, and then try the command again. +@cindex command-line arguments, decoding Use @code{getopt_long} to decode arguments, unless the argument syntax makes this unreasonable. @@ -428,12 +589,21 @@ Try to avoid low-level interfaces to obs as file directories, utmp, or the layout of kernel memory), since these are less likely to work compatibly. If you need to find all the files in a directory, use @code{readdir} or some other high-level interface. -These will be supported compatibly by GNU. +These are supported compatibly by GNU. -By default, the GNU system will provide the signal handling functions of -@sc{BSD} and of @sc{POSIX}. So GNU software should be written to use -these. +@cindex signal handling +The preferred signal handling facilities are the BSD variant of +@code{signal}, and the @sc{posix} @code{sigaction} function; the +alternative USG @code{signal} interface is an inferior design. + +Nowadays, using the @sc{posix} signal functions may be the easiest way +to make a program portable. If you use @code{signal}, then on GNU/Linux +systems running GNU libc version 1, you should include +@file{bsd/signal.h} instead of @file{signal.h}, so as to get BSD +behavior. It is up to you whether to support systems where +@code{signal} has only the USG behavior, or give up on them. +@cindex impossible conditions In error checks that detect ``impossible'' conditions, just abort. There is usually no point in printing any message. These checks indicate the existence of bugs. Whoever wants to fix the bugs will have @@ -448,12 +618,28 @@ bits (0 through 255). A single run of t errors; if you try to return 256 as the exit status, the parent process will see 0 as the status, and it will appear that the program succeeded. +@cindex temporary files +@cindex @code{TMPDIR} environment variable If you make temporary files, check the @code{TMPDIR} environment variable; if that variable is defined, use the specified directory instead of @file{/tmp}. +In addition, be aware that there is a possible security problem when +creating temporary files in world-writable directories. In C, you can +avoid this problem by creating temporary files in this manner: + +@example +fd = open(filename, O_WRONLY | O_CREAT | O_EXCL, 0600); +@end example + +@noindent +or by using the @code{mkstemps} function from libiberty. + +In bash, use @code{set -C} to avoid this problem. + @node Libraries @section Library Behavior +@cindex libraries Try to make library functions reentrant. If they need to do dynamic storage allocation, at least try to avoid any nonreentrancy aside from @@ -473,16 +659,18 @@ together, so that no reasonable program other; then they can both go in the same file. External symbols that are not documented entry points for the user -should have names beginning with @samp{_}. They should also contain -the chosen name prefix for the library, to prevent collisions with -other libraries. These can go in the same files with user entry -points if you like. +should have names beginning with @samp{_}. The @samp{_} should be +followed by the chosen name prefix for the library, to prevent +collisions with other libraries. These can go in the same files with +user entry points if you like. Static functions and variables can be used as you like and need not fit any naming convention. @node Errors @section Formatting Error Messages +@cindex formatting error messages +@cindex error messages, formatting Error messages from compilers should look like this: @@ -490,6 +678,20 @@ Error messages from compilers should loo @var{source-file-name}:@var{lineno}: @var{message} @end example +@noindent +If you want to mention the column number, use this format: + +@example +@var{source-file-name}:@var{lineno}:@var{column}: @var{message} +@end example + +@noindent +Line numbers should start from 1 at the beginning of the file, and +column numbers should start from 1 at the beginning of the line. (Both +of these conventions are chosen for compatibility.) Calculate column +numbers assuming that space and all ASCII printing characters have +equal width, and assuming tab stops every 8 columns. + Error messages from other noninteractive programs should look like this: @example @@ -506,6 +708,12 @@ when there is an appropriate source file @noindent when there is no relevant source file. +If you want to mention the column number, use this format: + +@example +@var{program}:@var{source-file-name}:@var{lineno}:@var{column}: @var{message} +@end example + In an interactive program (one that is reading commands from a terminal), it is better not to include the program name in an error message. The place to indicate which program is running is in the @@ -522,8 +730,10 @@ usage messages, should start with a capi end with a period. @node User Interfaces -@section Standards for Command Line Interfaces +@section Standards for Interfaces Generally +@cindex program name and its behavior +@cindex behavior, dependent on program's name Please don't make the behavior of a utility depend on the name used to invoke it. It is useful sometimes to make a link to a utility with a different name, and that should not change what it does. @@ -531,10 +741,13 @@ with a different name, and that should n Instead, use a run time option or a compilation switch or both to select among the alternate behaviors. +@cindex output device and program's behavior Likewise, please don't make the behavior of the program depend on the type of output device it is used with. Device independence is an -important principle of the system's design; do not compromise it -merely to save someone from typing an option now and then. +important principle of the system's design; do not compromise it merely +to save someone from typing an option now and then. (Variation in error +message syntax when using a terminal is ok, because that is a side issue +that people do not depend on.) If you think one behavior is most useful when the output is to a terminal, and another is most useful when the output is a file or a @@ -550,13 +763,42 @@ output device type. For example, we pro like @code{ls} except that its default output format is always multi-column format. -It is a good idea to follow the @sc{POSIX} guidelines for the +@node Graphical Interfaces +@section Standards for Graphical Interfaces +@cindex graphical user interface + +@cindex gtk +When you write a program that provides a graphical user interface, +please make it work with X Windows and the GTK toolkit unless the +functionality specifically requires some alternative (for example, +``displaying jpeg images while in console mode''). + +In addition, please provide a command-line interface to control the +functionality. (In many cases, the graphical user interface can be a +separate program which invokes the command-line program.) This is +so that the same jobs can be done from scripts. + +@cindex corba +@cindex gnome +Please also consider providing a CORBA interface (for use from GNOME), a +library interface (for use from C), and perhaps a keyboard-driven +console interface (for use by users from console mode). Once you are +doing the work to provide the functionality and the graphical interface, +these won't be much extra work. + +@node Command-Line Interfaces +@section Standards for Command Line Interfaces +@cindex command-line interface + +@findex getopt +It is a good idea to follow the @sc{posix} guidelines for the command-line options of a program. The easiest way to do this is to use @code{getopt} to parse them. Note that the GNU version of @code{getopt} will normally permit options anywhere among the arguments unless the -special argument @samp{--} is used. This is not what @sc{POSIX} +special argument @samp{--} is used. This is not what @sc{posix} specifies; it is a GNU extension. +@cindex long-named options Please define long-named options that are equivalent to the single-letter Unix-style options. We hope to make GNU more user friendly this way. This is easy to do with the GNU function @@ -576,16 +818,20 @@ file name as an ordinary argument for co option as another way to specify it. This will lead to more consistency among GNU utilities, and fewer idiosyncracies for users to remember. +@cindex standard command-line options All programs should support two standard options: @samp{--version} and @samp{--help}. @table @code +@cindex @samp{--version} option @item --version -This option should direct the program to information about its name, +This option should direct the program to print information about its name, version, origin and legal status, all on standard output, and then exit successfully. Other options and arguments should be ignored once this is seen, and the program should not perform its normal function. +@cindex canonical name of a program +@cindex program's canonical name The first line is meant to be easy for a program to parse; the version number proper starts after the last space. In addition, it contains the canonical name for this program, in this format: @@ -658,12 +904,33 @@ versions' changes. You don't have to me these notices, if that is inconvenient, since it appeared in the first line. +Translations of the above lines must preserve the validity of the +copyright notices (@pxref{Internationalization}). If the translation's +character set supports it, the @samp{(C)} should be replaced with the +copyright symbol, as follows: + +@ifinfo +(the official copyright symbol, which is the letter C in a circle); +@end ifinfo +@ifnotinfo +@copyright{} +@end ifnotinfo + +Write the word ``Copyright'' exactly like that, in English. Do not +translate it into another language. International treaties recognize +the English word ``Copyright''; translations into other languages do not +have legal significance. + + +@cindex @samp{--help} option @item --help This option should output brief documentation for how to invoke the program, on standard output, then exit successfully. Other options and arguments should be ignored once this is seen, and the program should not perform its normal function. +@cindex address for bug reports +@cindex bug reports Near the end of the @samp{--help} option's output there should be a line that says where to mail bug reports. It should have this format: @@ -674,11 +941,13 @@ Report bugs to @var{mailing-address}. @node Option Table @section Table of Long Options +@cindex long option names +@cindex table of long options Here is a table of long options used by GNU programs. It is surely incomplete, but we aim to list all the options that a new program might want to be compatible with. If you use names not already in the table, -please send @email{gnu@@gnu.org} a list of them, with their +please send @email{bug-standards@@gnu.org} a list of them, with their meanings, so we can update the table. @c Please leave newlines between items in this table; it's much easier @@ -738,6 +1007,9 @@ and @code{unexpand}. @item avoid-wraps @samp{-n} in @code{wdiff}. +@item background +For server programs, run in the background. + @item backward-search @samp{-B} in @code{ctags}. @@ -862,6 +1134,9 @@ Used in @code{tar} and @code{cpio}. @item dereference-args @samp{-D} in @code{du}. +@item device +Specify an I/O device (special file name). + @item diacritics @samp{-d} in @code{recode}. @@ -994,6 +1269,11 @@ Used in @code{makeinfo}. @item force-prefix @samp{-F} in @code{shar}. +@item foreground +For server programs, run in the foreground; +in other words, don't do anything special to run the server +in the background. + @item format Used in @code{ls}, @code{time}, and @code{ptx}. @@ -1039,6 +1319,9 @@ Used to ask for brief usage information. @item hide-control-chars @samp{-q} in @code{ls}. +@item html +In @code{makeinfo}, output HTML. + @item idle @samp{-u} in @code{who}. @@ -1099,6 +1382,10 @@ Used to ask for brief usage information. @item info @samp{-i}, @samp{-l}, and @samp{-m} in Finger. +@item init-file +In some programs, specify the name of the file to read as the user's +init file. + @item initial @samp{-i} in @code{expand}. @@ -1117,6 +1404,9 @@ Used to ask for brief usage information. @item intermix-type @samp{-p} in @code{shar}. +@item iso-8601 +Used in @code{date} + @item jobs @samp{-j} in Make. @@ -1352,6 +1642,10 @@ Used in GDB. @item only-time @samp{-F} in @code{gprof}. +@item options +@samp{-o} in @code{getopt}, @code{fdlist}, @code{fdmount}, +@code{fdmountd}, and @code{fdumount}. + @item output In various programs, specify the output file name. @@ -1436,6 +1730,9 @@ Used in @code{tar} and @code{cp}. @item prompt @samp{-p} in @code{ed}. +@item proxy +Specify an HTTP proxy. + @item query-user @samp{-X} in @code{shar}. @@ -1564,6 +1861,12 @@ Used in many programs to inhibit the usu @item size @samp{-s} in @code{ls}. +@item socket +Specify a file descriptor for a network server to use for its socket, +instead of opening and binding a new socket. This provides a way to +run, in a nonpriveledged process, a server that normally needs a +reserved port number. + @item sort Used in @code{ls}. @@ -1662,6 +1965,9 @@ Used in GDB and @code{objdump}. @item time Used in @code{ls} and @code{touch}. +@item timeout +Specify how long to wait before giving up on some operation. + @item to-stdout @samp{-O} in @code{tar}. @@ -1754,8 +2060,9 @@ Print the version number. @node Memory Usage @section Memory Usage +@cindex memory usage -If it typically uses just a few meg of memory, don't bother making any +If a program typically uses just a few meg of memory, don't bother making any effort to reduce memory usage. For example, if it is impractical for other reasons to operate on files more than a few meg long, it is reasonable to read entire input files into core to operate on them. @@ -1771,6 +2078,23 @@ files that are bigger than will fit in c If your program creates complicated data structures, just make them in core and give a fatal error if @code{malloc} returns zero. +@node File Usage +@section File Usage +@cindex file usage + +Programs should be prepared to operate when @file{/usr} and @file{/etc} +are read-only file systems. Thus, if the program manages log files, +lock files, backup files, score files, or any other files which are +modified for internal purposes, these files should not be stored in +@file{/usr} or @file{/etc}. + +There are two exceptions. @file{/etc} is used to store system +configuration information; it is reasonable for a program to modify +files in @file{/etc} when its job is to update the system configuration. +Also, if the user explicitly asks to modify one file in a directory, it +is reasonable for the program to store other files in the same +directory. + @node Writing C @chapter Making The Best Use of C @@ -1781,7 +2105,7 @@ when writing GNU software. * Formatting:: Formatting Your Source Code * Comments:: Commenting Your Work * Syntactic Conventions:: Clean Use of C Constructs -* Names:: Naming Variables and Functions +* Names:: Naming Variables, Functions, and Files * System Portability:: Portability between different operating systems * CPU Portability:: Supporting the range of CPU types * System Functions:: Portability and ``standard'' library functions @@ -1791,7 +2115,10 @@ when writing GNU software. @node Formatting @section Formatting Your Source Code +@cindex formatting source code +@cindex open brace +@cindex braces, in C source It is important to put the open-brace that starts the body of a C function in column zero, and avoid putting any other open-brace or open-parenthesis or open-bracket in column zero. Several tools look @@ -1813,7 +2140,8 @@ concat (s1, s2) /* Name starts in @end example @noindent -or, if you want to use @sc{ansi} C, format the definition like this: +or, if you want to use Standard C syntax, format the definition like +this: @example static char * @@ -1823,7 +2151,7 @@ concat (char *s1, char *s2) @} @end example -In @sc{ansi} C, if the arguments don't fit nicely on one line, +In Standard C, if the arguments don't fit nicely on one line, split it like this: @example @@ -1833,7 +2161,25 @@ lots_of_args (int an_integer, long a_lon @dots{} @end example -For the body of the function, we prefer code formatted like this: +The rest of this section gives our recommendations for other aspects of +C formatting style, which is also the default style of the @code{indent} +program in version 1.2 and newer. It corresponds to the options + +@smallexample +-nbad -bap -nbc -bbo -bl -bli2 -bls -ncdb -nce -cp1 -cs -di2 +-ndj -nfc1 -nfca -hnl -i2 -ip5 -lp -pcs -psl -nsc -nsob +@end smallexample + +We don't think of these recommendations as requirements, because it +causes no problems for users if two different programs have different +formatting styles. + +But whatever style you use, please use it consistently, since a mixture +of styles within one program tends to look ugly. If you are +contributing changes to an existing program, please follow the style of +that program. + +For the body of the function, our recommended style looks like this: @example if (x < foo (y, z)) @@ -1849,12 +2195,14 @@ else @} @end example +@cindex spaces before open-paren We find it easier to read a program when it has spaces before the open-parentheses and after the commas. Especially after the commas. When you split an expression into multiple lines, split it before an operator, not after one. Here is the right way: +@cindex expressions, splitting @example if (foo_this_is_long && bar > win (x, y, z) && remaining_condition) @@ -1879,14 +2227,15 @@ mode = ((inmode[j] == VOIDmode Insert extra parentheses so that Emacs will indent the code properly. For example, the following indentation looks nice if you do it by hand, -but Emacs would mess it up: @example v = rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000 + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000; @end example -But adding a set of parentheses solves the problem: +@noindent +but Emacs would alter it. Adding a set of parentheses produces +something that looks equally nice, and which Emacs will preserve: @example v = (rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000 @@ -1903,14 +2252,16 @@ do while (a > 0); @end example +@cindex formfeed +@cindex control-L Please use formfeed characters (control-L) to divide the program into pages at logical places (but not within a function). It does not matter just how long the pages are, since they do not have to fit on a printed page. The formfeeds should appear alone on lines by themselves. - @node Comments @section Commenting Your Work +@cindex commenting Every program should start with a comment saying briefly what it is for. Example: @samp{fmt - filter for simple filling of text}. @@ -1962,6 +2313,8 @@ There should be a comment on each static int truncate_lines; @end example +@cindex conditionals, comments for +@cindex @code{#endif}, commenting Every @samp{#endif} should have a comment, except in the case of short conditionals (just a few lines) that are not nested. The comment should state the condition of the conditional that is ending, @emph{including @@ -2003,9 +2356,23 @@ but, by contrast, write the comments thi @node Syntactic Conventions @section Clean Use of C Constructs +@cindex syntactic conventions -Please explicitly declare all arguments to functions. -Don't omit them just because they are @code{int}s. +@cindex implicit @code{int} +@cindex function argument, declaring +Please explicitly declare the types of all objects. For example, you +should explicitly declare all arguments to functions, and you should +declare functions to return @code{int} rather than omitting the +@code{int}. + +@cindex compiler warnings +@cindex @samp{-Wall} compiler option +Some programmers like to use the GCC @samp{-Wall} option, and change the +code whenever it issues a warning. If you want to do this, then do. +Other programmers prefer not to use @samp{-Wall}, because it gives +warnings for valid and legitimate code which they do not want to change. +If you want to do this, then do. The compiler should be your servant, +not your master. Declarations of external functions and functions to appear later in the source file should all go in one place near the beginning of the file @@ -2013,6 +2380,7 @@ source file should all go in one place n should go in a header file. Don't put @code{extern} declarations inside functions. +@cindex temporary variables It used to be common practice to use the same local variables (with names like @code{tem}) over and over for different values within one function. Instead of doing this, it is better declare a separate local @@ -2024,6 +2392,7 @@ all its uses. This makes the program ev Don't use local variables or parameters that shadow global identifiers. +@cindex multiple variables in a line Don't declare multiple variables in one declaration that spans lines. Start a new declaration on each line, instead. For example, instead of this: @@ -2124,13 +2493,15 @@ if (foo == 0) fatal ("virtual memory exhausted"); @end example +@pindex lint Don't make the program ugly to placate @code{lint}. Please don't insert any casts to @code{void}. Zero without a cast is perfectly fine as a null pointer constant, except when calling a varargs function. -@node Names -@section Naming Variables and Functions +@node Names +@section Naming Variables, Functions, and Files +@cindex names of variables, functions, and files The names of global variables and functions in a program serve as comments of a sort. So don't choose terse names---instead, look for names that give useful information about the meaning of the variable or @@ -2140,6 +2511,10 @@ comments. Local variable names can be shorter, because they are used only within one context, where (presumably) comments explain their purpose. +Try to limit your use of abbreviations in symbol names. It is ok to +make a few abbreviations, explain what they mean, and then use them +frequently, but don't use lots of obscure abbreviations. + Please use underscores to separate words in a name, so that the Emacs word commands can be useful within them. Stick to lower case; reserve upper case for macros and @code{enum} constants, and for name-prefixes @@ -2164,30 +2539,41 @@ When you want to define names with const @code{enum} rather than @samp{#define}. GDB knows about enumeration constants. -Use file names of 14 characters or less, to avoid creating gratuitous -problems on older System V systems. You can use the program -@code{doschk} to test for this. @code{doschk} also tests for potential -name conflicts if the files were loaded onto an MS-DOS file -system---something you may or may not care about. +@cindex file-name limitations +@pindex doschk +You might want to make sure that none of the file names would conflict +the files were loaded onto an MS-DOS file system which shortens the +names. You can use the program @code{doschk} to test for this. + +Some GNU programs were designed to limit themselves to file names of 14 +characters or less, to avoid file name conflicts if they are read into +older System V systems. Please preserve this feature in the existing +GNU programs that have it, but there is no need to do this in new GNU +programs. @code{doschk} also reports file names longer than 14 +characters. @node System Portability @section Portability between System Types +@cindex portability, between system types In the Unix world, ``portability'' refers to porting to different Unix versions. For a GNU program, this kind of portability is desirable, but not paramount. The primary purpose of GNU software is to run on top of the GNU kernel, -compiled with the GNU C compiler, on various types of @sc{cpu}. The -amount and kinds of variation among GNU systems on different @sc{cpu}s -will be comparable to the variation among Linux-based GNU systems or -among BSD systems today. So the kinds of portability that are absolutely -necessary are quite limited. - -But many users do run GNU software on non-GNU Unix or Unix-like systems. -So supporting a variety of Unix-like systems is desirable, although not -paramount. +compiled with the GNU C compiler, on various types of @sc{cpu}. So the +kinds of portability that are absolutely necessary are quite limited. +But it is important to support Linux-based GNU systems, since they +are the form of GNU that is popular. + +Beyond that, it is good to support the other free operating systems +(*BSD), and it is nice to support other Unix-like systems if you want +to. Supporting a variety of Unix-like systems is desirable, although +not paramount. It is usually not too hard, so you may as well do it. +But you don't have to consider it an obligation, if it does turn out to +be hard. +@pindex autoconf The easiest way to achieve portability to most Unix-like systems is to use Autoconf. It's unlikely that your program needs to know more information about the host platform than Autoconf can provide, simply @@ -2197,19 +2583,30 @@ written. Avoid using the format of semi-internal data bases (e.g., directories) when there is a higher-level alternative (@code{readdir}). +@cindex non-@sc{posix} systems, and portability As for systems that are not like Unix, such as MSDOS, Windows, the -Macintosh, VMS, and MVS, supporting them is usually so much work that it -is better if you don't. - -The planned GNU kernel is not finished yet, but you can tell which -facilities it will provide by looking at the GNU C Library Manual. The -GNU kernel is based on Mach, so the features of Mach will also be -available. However, if you use Mach features, you'll probably have -trouble debugging your program today. +Macintosh, VMS, and MVS, supporting them is often a lot of work. When +that is the case, it is better to spend your time adding features that +will be useful on GNU and GNU/Linux, rather than on supporting other +incompatible systems. + +It is a good idea to define the ``feature test macro'' +@code{_GNU_SOURCE} when compiling your C files. When you compile on GNU +or GNU/Linux, this will enable the declarations of GNU library extension +functions, and that will usually give you a compiler error message if +you define the same function names in some other way in your program. +(You don't have to actually @emph{use} these functions, if you prefer +to make the program more portable to other systems.) + +But whether or not you use these GNU extensions, you should avoid +using their names for any other meanings. Doing so would make it hard +to move your code into other GNU programs. @node CPU Portability @section Portability between @sc{cpu}s +@cindex data types, and portability +@cindex portability, and data types Even GNU systems will differ because of differences among @sc{cpu} types---for example, difference in byte ordering and alignment requirements. It is absolutely essential to handle these differences. @@ -2217,6 +2614,25 @@ However, don't make any effort to cater @code{int} will be less than 32 bits. We don't support 16-bit machines in GNU. +Similarly, don't make any effort to cater to the possibility that +@code{long} will be smaller than predefined types like @code{size_t}. +For example, the following code is ok: + +@example +printf ("size = %lu\n", (unsigned long) sizeof array); +printf ("diff = %ld\n", (long) (pointer2 - pointer1)); +@end example + +1989 Standard C requires this to work, and we know of only one +counterexample: 64-bit programs on Microsoft Windows IA-64. We will +leave it to those who want to port GNU programs to that environment +to figure out how to do it. + +Predefined file-size types like @code{off_t} are an exception: they are +longer than @code{long} on many platforms, so code like the above won't +work with them. One way to print an @code{off_t} value portably is to +print its digits yourself, one by one. + Don't assume that the address of an @code{int} object is also the address of its least-significant byte. This is false on big-endian machines. Thus, don't make the following mistake: @@ -2231,9 +2647,9 @@ while ((c = getchar()) != EOF) When calling functions, you need not worry about the difference between pointers of various types, or between pointers and integers. On most machines, there's no difference anyway. As for the few machines where -there is a difference, all of them support @sc{ansi} C, so you can use -prototypes (conditionalized to be active only in @sc{ansi} C) to make -the code work on those systems. +there is a difference, all of them support Standard C prototypes, so you can +use prototypes (perhaps conditionalized to be active only in Standard C) +to make the code work on those systems. In certain cases, it is ok to pass integer and pointer arguments indiscriminately to the same function, and use no prototype on any @@ -2243,7 +2659,7 @@ that pass their arguments along to @code @example error (s, a1, a2, a3) char *s; - int a1, a2, a3; + char *a1, *a2, *a3; @{ fprintf (stderr, "error: "); fprintf (stderr, s, a1, a2, a3); @@ -2251,36 +2667,50 @@ error (s, a1, a2, a3) @end example @noindent -In practice, this works on all machines, and it is much simpler than any -``correct'' alternative. Be sure @emph{not} to use a prototype -for such functions. - -However, avoid casting pointers to integers unless you really need to. -These assumptions really reduce portability, and in most programs they -are easy to avoid. In the cases where casting pointers to integers is -essential---such as, a Lisp interpreter which stores type information as -well as an address in one word---it is ok to do so, but you'll have to -make explicit provisions to handle different word sizes. +In practice, this works on all machines, since a pointer is generally +the widest possible kind of argument; it is much simpler than any +``correct'' alternative. Be sure @emph{not} to use a prototype for such +functions. + +If you have decided to use Standard C, then you can instead define +@code{error} using @file{stdarg.h}, and pass the arguments along to +@code{vfprintf}. + +@cindex casting pointers to integers +Avoid casting pointers to integers if you can. Such casts greatly +reduce portability, and in most programs they are easy to avoid. In the +cases where casting pointers to integers is essential---such as, a Lisp +interpreter which stores type information as well as an address in one +word---you'll have to make explicit provisions to handle different word +sizes. You will also need to make provision for systems in which the +normal range of addresses you can get from @code{malloc} starts far away +from zero. @node System Functions @section Calling System Functions +@cindex library functions, and portability +@cindex portability, and library functions -C implementations differ substantially. @sc{ansi} C reduces but does not -eliminate the incompatibilities; meanwhile, many users wish to compile -GNU software with pre-@sc{ansi} compilers. This chapter gives -recommendations for how to use the more or less standard C library -functions to avoid unnecessary loss of portability. +C implementations differ substantially. Standard C reduces but does +not eliminate the incompatibilities; meanwhile, many GNU packages still +support pre-standard compilers because this is not hard to do. This +chapter gives recommendations for how to use the more-or-less standard C +library functions to avoid unnecessary loss of portability. @itemize @bullet @item -Don't use the value of @code{sprintf}. It returns the number of +Don't use the return value of @code{sprintf}. It returns the number of characters written on some systems, but not on all systems. @item +Be aware that @code{vfprintf} is not always available. + +@item @code{main} should be declared to return type @code{int}. It should terminate either by calling @code{exit} or by returning the integer status code; make sure it cannot ever return an undefined value. +@cindex declaration for system functions @item Don't declare system functions explicitly. @@ -2297,7 +2727,7 @@ actual conflicts. @item If you must declare a system function, don't specify the argument types. -Use an old-style declaration, not an @sc{ansi} prototype. The more you +Use an old-style declaration, not a Standard C prototype. The more you specify about the function, the more likely a conflict. @item @@ -2319,6 +2749,7 @@ exceptional systems (mostly 64-bit machi @code{realloc}---or put these declarations in configuration files specific to those systems. +@cindex string library functions @item The string functions require special treatment. Some Unix systems have a header file @file{string.h}; others have @file{strings.h}. Neither @@ -2329,7 +2760,7 @@ figure out which file to include, or don If you don't include either strings file, you can't get declarations for the string functions from the header file in the usual way. -That causes less of a problem than you might think. The newer @sc{ansi} +That causes less of a problem than you might think. The newer standard string functions should be avoided anyway because many systems still don't support them. The string functions you can use are these: @@ -2359,7 +2790,7 @@ names, but neither pair works on all sys You should pick a single pair of names and use it throughout your program. (Nowadays, it is better to choose @code{strchr} and -@code{strrchr} for new programs, since those are the standard @sc{ansi} +@code{strrchr} for new programs, since those are the standard names.) Declare both of those names as functions returning @code{char *}. On systems which don't support those names, define them as macros in terms of the other pair. For example, here is what to put at the @@ -2385,7 +2816,9 @@ One way to get them properly defined is @node Internationalization @section Internationalization +@cindex internationalization +@pindex gettext GNU has a library called GNU gettext that makes it easy to translate the messages in a program into various languages. You should use this library in every program. Use English for the messages as they appear @@ -2412,6 +2845,7 @@ translations for this package from the t Normally, the text domain name should be the same as the name of the package---for example, @samp{fileutils} for the GNU file utilities. +@cindex message text, and internationalization To enable gettext to work well, avoid writing code that makes assumptions about the structure of words or sentences. When you want the precise text of a sentence to vary depending on the data, use two or @@ -2483,6 +2917,7 @@ printf (f->tried_implicit @node Mmap @section Mmap +@findex mmap Don't assume that @code{mmap} either works on all files or fails for all files. It may work on some files and fail on others. @@ -2499,10 +2934,20 @@ all these kinds of files. @node Documentation @chapter Documenting Programs +@cindex documentation + +A GNU program should ideally come with full free documentation, adequate +for both reference and tutorial purposes. If the package can be +programmed or extended, the documentation should cover programming or +extending it, as well as just using it. @menu * GNU Manuals:: Writing proper manuals. +* Doc Strings and Manuals:: Compiling doc strings doesn't make a manual. * Manual Structure Details:: Specific structure conventions. +* License for Manuals:: Writing the distribution terms for a manual. +* Manual Credits:: Giving credit to documentation contributors. +* Printed Manuals:: Mentioning the printed manual. * NEWS File:: NEWS files supplement manuals. * Change Logs:: Recording Changes * Man Pages:: Man pages are secondary. @@ -2513,10 +2958,18 @@ all these kinds of files. @node GNU Manuals @section GNU Manuals -The preferred way to document part of the GNU system is to write a -manual in the Texinfo formatting language. See the Texinfo manual, -either the hardcopy, or the on-line version available through -@code{info} or the Emacs Info subsystem (@kbd{C-h i}). +The preferred document format for the GNU system is the Texinfo +formatting language. Every GNU package should (ideally) have +documentation in Texinfo both for reference and for learners. Texinfo +makes it possible to produce a good quality formatted book, using +@TeX{}, and to generate an Info file. It is also possible to generate +HTML output from Texinfo source. See the Texinfo manual, either the +hardcopy, or the on-line version available through @code{info} or the +Emacs Info subsystem (@kbd{C-h i}). + +Nowadays some other formats such as Docbook and Sgmltexi can be +converted automatically into Texinfo. It is ok to produce the Texinfo +documentation by conversion this way, as long as it gives good results. Programmers often find it most natural to structure the documentation following the structure of the implementation, which they know. But @@ -2545,9 +2998,9 @@ have one manual for ``comparison of file programs, as well as @code{cmp}. By documenting these programs together, we can make the whole subject clearer. -The manual which discusses a program should document all of the -program's command-line options and all of its commands. It should give -examples of their use. But don't organize the manual as a list of +The manual which discusses a program should certainly document all of +the program's command-line options and all of its commands. It should +give examples of their use. But don't organize the manual as a list of features. Instead, organize it logically, by subtopics. Address the questions that a user will ask when thinking about the job that the program does. @@ -2557,6 +3010,8 @@ It should be set up for convenient acces and for reading straight through (appendixes aside). A GNU manual should give a good introduction to a beginner reading through from the start, and should also provide all the details that hackers want. +The Bison manual is a good example of this---please take a look at it +to see what we mean. That is not as hard as it first sounds. Arrange each chapter as a logical breakdown of its topic, but order the sections, and write their @@ -2570,22 +3025,62 @@ are purely tutorial and cover the basics the framework for a beginner to understand the rest of the manual. The Bison manual provides a good example of how to do this. +To serve as a reference, a manual should have an Index that list all the +functions, variables, options, and important concepts that are part of +the program. One combined Index should do for a short manual, but +sometimes for a complex package it is better to use multiple indices. +The Texinfo manual includes advice on preparing good index entries, see +@ref{Index Entries, , Making Index Entries, texinfo, The GNU Texinfo +Manual}, and see @ref{Indexing Commands, , Defining the Entries of an +Index, texinfo, The GNU Texinfo manual}. + Don't use Unix man pages as a model for how to write GNU documentation; most of them are terse, badly structured, and give inadequate -explanation of the underlying concepts. (There are, of course -exceptions.) Also Unix man pages use a particular format which is +explanation of the underlying concepts. (There are, of course, some +exceptions.) Also, Unix man pages use a particular format which is different from what we use in GNU manuals. +Please include an email address in the manual for where to report +bugs @emph{in the manual}. + Please do not use the term ``pathname'' that is used in Unix documentation; use ``file name'' (two words) instead. We use the term -``path'' only for search paths, which are lists of file names. +``path'' only for search paths, which are lists of directory names. Please do not use the term ``illegal'' to refer to erroneous input to a computer program. Please use ``invalid'' for this, and reserve the term -``illegal'' for violations of law. +``illegal'' for activities punishable by law. + +@node Doc Strings and Manuals +@section Doc Strings and Manuals + +Some programming systems, such as Emacs, provide a documentation string +for each function, command or variable. You may be tempted to write a +reference manual by compiling the documentation strings and writing a +little additional text to go around them---but you must not do it. That +approach is a fundamental mistake. The text of well-written +documentation strings will be entirely wrong for a manual. + +A documentation string needs to stand alone---when it appears on the +screen, there will be no other text to introduce or explain it. +Meanwhile, it can be rather informal in style. + +The text describing a function or variable in a manual must not stand +alone; it appears in the context of a section or subsection. Other text +at the beginning of the section should explain some of the concepts, and +should often make some general points that apply to several functions or +variables. The previous descriptions of functions and variables in the +section will also have given information about the topic. A description +written to stand alone would repeat some of that information; this +redundance looks bad. Meanwhile, the informality that is acceptable in +a documentation string is totally unacceptable in a manual. + +The only good way to use documentation strings in writing a good manual +is to use them as a source of information for writing good text. @node Manual Structure Details @section Manual Structure Details +@cindex manual structure The title page of the manual should state the version of the programs or packages documented in the manual. The Top node of the manual should @@ -2593,7 +3088,7 @@ also contain this information. If the m frequently than or independent of the program, also state a version number for the manual in both of these places. -Each program documented in the manual should should have a node named +Each program documented in the manual should have a node named @samp{@var{program} Invocation} or @samp{Invoking @var{program}}. This node (together with its subnodes, if any) should describe the program's command line arguments and how to run it (the sort of information people @@ -2605,14 +3100,57 @@ Alternatively, put a menu item in some m the above patterns. This identifies the node which that item points to as the node for this purpose, regardless of the node's actual name. -There will be automatic features for specifying a program name and -quickly reading just this part of its manual. +The @samp{--usage} feature of the Info reader looks for such a node +or menu item in order to find the relevant text, so it is essential +for every Texinfo file to have one. If one manual describes several programs, it should have such a node for -each program described. +each program described in the manual. + +@node License for Manuals +@section License for Manuals +@cindex license for manuals + +Please use the GNU Free Documentation License for all GNU manuals that +are more than a few pages long. Likewise for a collection of short +documents---you only need one copy of the GNU FDL for the whole +collection. For a single short document, you can use a very permissive +non-copyleft license, to avoid taking up space with a long license. + +See @uref{http://www.gnu.org/copyleft/fdl-howto.html} for more explanation +of how to employ the GFDL. + +Note that it is not obligatory to include a copy of the GNU GPL or GNU +LGPL in a manual whose license is neither the GPL nor the LGPL. It can +be a good idea to include the program's license in a large manual; in a +short manual, whose size would be increased considerably by including +the program's license, it is probably better not to include it. + +@node Manual Credits +@section Manual Credits +@cindex credits for manuals + +Please credit the principal human writers of the manual as the authors, +on the title page of the manual. If a company sponsored the work, thank +the company in a suitable place in the manual, but do not cite the +company as an author. + +@node Printed Manuals +@section Printed Manuals + +The FSF publishes some GNU manuals in printed form. To encourage sales +of these manuals, the on-line versions of the manual should mention at +the very start that the printed manual is available and should point at +information for getting it---for instance, with a link to the page +@url{http://www.gnu.org/order/order.html}. This should not be included +in the printed manual, though, because there it is redundant. + +It is also useful to explain in the on-line forms of the manual how the +user can print out the manual from the sources. @node NEWS File @section The NEWS File +@cindex @file{NEWS} file In addition to its manual, the package should have a file named @file{NEWS} which contains a list of user-visible changes worth @@ -2627,6 +3165,7 @@ user to that file. @node Change Logs @section Change Logs +@cindex change logs Keep a change log to describe all the changes made to program source files. The purpose of this is so that people investigating bugs in the @@ -2641,6 +3180,7 @@ history of how the conflicting concepts * Style of Change Logs:: * Simple Changes:: * Conditional Changes:: +* Indicating the Part Changed:: @end menu @node Change Log Concepts @@ -2659,7 +3199,8 @@ you. Another alternative is to record change log information with a version control system such as RCS or CVS. This can be converted automatically -to a @file{ChangeLog} file. +to a @file{ChangeLog} file using @code{rcs2log}; in Emacs, the command +@kbd{C-x v a} (@code{vc-update-change-log}) does the job. There's no need to describe the full purpose of the changes or how they work together. If you think that a change calls for explanation, you're @@ -2680,10 +3221,16 @@ Then describe the changes you made to th @node Style of Change Logs @subsection Style of Change Logs +@cindex change logs, style -Here are some examples of change log entries: +Here are some simple examples of change log entries, starting with the +header line that says who made the change and when, followed by +descriptions of specific changes. (These examples are drawn from Emacs +and GCC.) @example +1998-08-17 Richard Stallman + * register.el (insert-register): Return nil. (jump-to-register): Likewise. @@ -2714,6 +3261,15 @@ entries represent parts of the same chan then don't put blank lines between them. Then you can omit the file name and the asterisk when successive entries are in the same file. +Break long lists of function names by closing continued lines with +@samp{)}, rather than @samp{,}, and opening the continuation with +@samp{(} as in this example: + +@example +* keyboard.c (menu_bar_items, tool_bar_items) +(Fexecute_extended_command): Deal with `keymap' property. +@end example + @node Simple Changes @subsection Simple Changes @@ -2721,9 +3277,10 @@ Certain simple kinds of changes don't ne log. When you change the calling sequence of a function in a simple fashion, -and you change all the callers of the function, there is no need to make -individual entries for all the callers that you changed. Just write in -the entry for the function being called, ``All callers changed.'' +and you change all the callers of the function to use the new calling +sequence, there is no need to make individual entries for all the +callers that you changed. Just write in the entry for the function +being called, ``All callers changed''---like this: @example * keyboard.c (Fcommand_execute): New arg SPECIAL. @@ -2743,6 +3300,8 @@ documentation says with the way the prog @node Conditional Changes @subsection Conditional Changes +@cindex conditional changes, and change logs +@cindex change logs, conditional changes C programs often contain compile-time @code{#if} conditionals. Many changes are conditional; sometimes you add a new definition which is @@ -2782,8 +3341,23 @@ a certain macro is @emph{not} defined: (gethostname) [!HAVE_SOCKETS]: Replace with winsock version. @end example +@node Indicating the Part Changed +@subsection Indicating the Part Changed + +Indicate the part of a function which changed by using angle brackets +enclosing an indication of what the changed part does. Here is an entry +for a change in the part of the function @code{sh-while-getopts} that +deals with @code{sh} commands: + +@example +* progmodes/sh-script.el (sh-while-getopts) : Handle case that +user-specified option string is empty. +@end example + + @node Man Pages @section Man Pages +@cindex man pages In the GNU project, man pages are secondary. It is not necessary or expected for every GNU program to have a man page, but some of them do. @@ -2830,6 +3404,7 @@ with the FSF about the individual case. @node Managing Releases @chapter The Release Process +@cindex releasing Making a release is more than just bundling up your source files in a tar file and putting it up for FTP. You should set up your software so @@ -2841,13 +3416,15 @@ all GNU software. @menu * Configuration:: How Configuration Should Work -* Makefile Conventions:: Makefile Conventions +* Makefile Conventions:: Makefile Conventions * Releases:: Making Releases @end menu @node Configuration @section How Configuration Should Work +@cindex program configuration +@pindex configure Each GNU distribution should come with a shell script named @code{configure}. This script is given arguments which describe the kind of machine and system you want to compile the program for. @@ -2915,13 +3492,14 @@ The @code{configure} script needs to be alternatives for how to describe a machine. Thus, @samp{sun3-sunos4.1} would be a valid alias. For many programs, @samp{vax-dec-ultrix} would be an alias for @samp{vax-dec-bsd}, simply because the differences -between Ultrix and @sc{BSD} are rarely noticeable, but a few programs +between Ultrix and @sc{bsd} are rarely noticeable, but a few programs might need to distinguish them. @c Real 4.4BSD now runs on some Suns. There is a shell script called @file{config.sub} that you can use as a subroutine to validate system types and canonicalize aliases. +@cindex optional features, configure-time Other options are permitted to specify in more detail the software or hardware present on the machine, and include or exclude optional parts of the package: @@ -2947,27 +3525,16 @@ to work with @var{package}. @c Giving an optional @var{parameter} of @c @samp{no} should omit @var{package}, if it is used by default. -Possible values of @var{package} include +Possible values of @var{package} include @samp{gnu-as} (or @samp{gas}), @samp{gnu-ld}, @samp{gnu-libc}, @samp{gdb}, -@samp{x}, +@samp{x}, and @samp{x-toolkit}. Do not use a @samp{--with} option to specify the file name to use to find certain files. That is outside the scope of what @samp{--with} options are for. - -@item --nfp -The target machine has no floating point processor. - -@item --gas -The target machine assembler is GAS, the GNU assembler. -This is obsolete; users should use @samp{--with-gnu-as} instead. - -@item --x -The target machine has the X Window System installed. -This is obsolete; users should use @samp{--with-x} instead. @end table All @code{configure} scripts should accept all of these ``detail'' @@ -2983,27 +3550,36 @@ you might think of. That is deliberate. configuration options in GNU software. We do not want GNU programs to have idiosyncratic configuration options. -Packages that perform part of the compilation process may support cross-compilation. -In such a case, the host and target machines for the program may be -different. The @code{configure} script should normally treat the -specified type of system as both the host and the target, thus producing -a program which works for the same type of machine that it runs on. - -The way to build a cross-compiler, cross-assembler, or what have you, is -to specify the option @samp{--host=@var{hosttype}} when running -@code{configure}. This specifies the host system without changing the -type of target system. The syntax for @var{hosttype} is the same as -described above. +Packages that perform part of the compilation process may support +cross-compilation. In such a case, the host and target machines for the +program may be different. + +The @code{configure} script should normally treat the specified type of +system as both the host and the target, thus producing a program which +works for the same type of machine that it runs on. + +To configure a cross-compiler, cross-assembler, or what have you, you +should specify a target different from the host, using the configure +option @samp{--target=@var{targettype}}. The syntax for +@var{targettype} is the same as for the host type. So the command would +look like this: -Bootstrapping a cross-compiler requires compiling it on a machine other -than the host it will run on. Compilation packages accept a -configuration option @samp{--build=@var{hosttype}} for specifying the -configuration on which you will compile them, in case that is different -from the host. +@example +./configure @var{hosttype} --target=@var{targettype} +@end example Programs for which cross-operation is not meaningful need not accept the -@samp{--host} option, because configuring an entire operating system for -cross-operation is not a meaningful thing. +@samp{--target} option, because configuring an entire operating system for +cross-operation is not a meaningful operation. + +Bootstrapping a cross-compiler requires compiling it on a machine other +than the host it will run on. Compilation packages accept a +configuration option @samp{--build=@var{buildtype}} for specifying the +configuration on which you will compile them, but the configure script +should normally guess the build machine type (using +@file{config.guess}), so this option is probably not necessary. The +host and target types normally default from the build type, so in +bootstrapping a cross-compiler you must specify them both explicitly. Some programs have ways of configuring themselves automatically. If your program is set up to do this, your @code{configure} script can simply @@ -3018,6 +3594,7 @@ ignore most of its arguments. @node Releases @section Making Releases +@cindex packaging Package the distribution of @code{Foo version 69.96} up in a gzipped tar file with the name @file{foo-69.96.tar.gz}. It should unpack into a @@ -3030,6 +3607,22 @@ files} and @dfn{non-source files}. Sour and never changed automatically; non-source files are produced from source files by programs under the control of the Makefile. +@cindex @file{README} file +The distribution should contain a file named @file{README} which gives +the name of the package, and a general description of what it does. It +is also good to explain the purpose of each of the first-level +subdirectories in the package, if there are any. The @file{README} file +should either state the version number of the package, or refer to where +in the package it can be found. + +The @file{README} file should refer to the file @file{INSTALL}, which +should contain an explanation of the installation procedure. + +The @file{README} file should also refer to the file which contains the +copying conditions. The GNU GPL, if used, should be in a file called +@file{COPYING}. If the GNU LGPL is used, it should be in a file called +@file{COPYING.LIB}. + Naturally, all the source files must be in the distribution. It is okay to include non-source files in the distribution, provided they are up-to-date and machine-independent, so that building the distribution @@ -3054,7 +3647,7 @@ Make sure that all the files in the dist Make sure that no file name in the distribution is more than 14 characters long. Likewise, no file created by building the program should have a name longer than 14 characters. The reason for this is -that some systems adhere to a foolish interpretation of the POSIX +that some systems adhere to a foolish interpretation of the @sc{posix} standard, and refuse to open a longer name, rather than truncating as they did in the past. @@ -3073,6 +3666,7 @@ characters both before and after the per are truncated to @file{foobarha.c} and @file{foobarha.o}, which are distinct. +@cindex @file{texinfo.tex}, in a distribution Include in your distribution a copy of the @file{texinfo.tex} you used to test print any @file{*.texinfo} or @file{*.texi} files. @@ -3082,12 +3676,67 @@ Leaving them out would make the distribu the expense of possible inconvenience to a user who doesn't know what other files to get. +@node References +@chapter References to Non-Free Software and Documentation +@cindex references to non-free material + +A GNU program should not recommend use of any non-free program. We +can't stop some people from writing proprietary programs, or stop +other people from using them, but we can and should avoid helping to +advertise them to new potential customers. Proprietary software is a +social and ethical problem, and the point of GNU is to solve that +problem. + +When a non-free program or system is well known, you can mention it in +passing---that is harmless, since users who might want to use it +probably already know about it. For instance, it is fine to explain +how to build your package on top of some non-free operating system, or +how to use it together with some widely used non-free program. + +However, you should give only the necessary information to help those +who already use the non-free program to use your program with +it---don't give, or refer to, any further information about the +proprietary program, and don't imply that the proprietary program +enhances your program, or that its existence is in any way a good +thing. The goal should be that people already using the proprietary +program will get the advice they need about how to use your free +program, while people who don't already use the proprietary program +will not see anything to lead them to take an interest in it. + +If a non-free program or system is obscure in your program's domain, +your program should not mention or support it at all, since doing so +would tend to popularize the non-free program more than it popularizes +your program. (You cannot hope to find many additional users among +the users of Foobar if the users of Foobar are few.) + +A GNU package should not refer the user to any non-free documentation +for free software. Free documentation that can be included in free +operating systems is essential for completing the GNU system, so it is +a major focus of the GNU Project; to recommend use of documentation +that we are not allowed to use in GNU would undermine the efforts to +get documentation that we can include. So GNU packages should never +recommend non-free documentation. + +@node Copying This Manual +@appendix Copying This Manual + +@menu +* GNU Free Documentation License:: License for copying this manual +@end menu + +@include fdl.texi + +@node Index +@unnumbered Index +@printindex cp + @contents @bye -Local variables: -update-date-leading-regexp: "@c This date is automagically updated when you save this file:\n@set lastupdate " -update-date-trailing-regexp: "" -eval: (load "/gd/gnuorg/update-date.el") -eval: (add-hook 'write-file-hooks 'update-date) -End: +@c Local variables: +@c eval: (add-hook 'write-file-hooks 'time-stamp) +@c time-stamp-start: "@set lastupdate " +@c time-stamp-end: "$" +@c time-stamp-format: "%:b %:d, %:y" +@c compile-command: "make just-standards" +@c End: diff -uprN binutils-2.11.93.0.2/gas/ChangeLog binutils-2.12.90.0.1/gas/ChangeLog --- binutils-2.11.93.0.2/gas/ChangeLog Thu Feb 7 10:21:04 2002 +++ binutils-2.12.90.0.1/gas/ChangeLog Thu Mar 7 11:52:37 2002 @@ -1,3 +1,755 @@ +2002-03-06 Alan Modra + + * config/tc-i386.c (tc_gen_reloc): Don't attempt to handle 8 byte + relocs except when BFD64. + + * write.c (number_to_chars_bigendian): Don't abort when N is + larger than sizeof (VAL). + (number_to_chars_littleendian): Likewise. + +2002-03-05 John David Anglin + + * config/tc-hppa.c (md_apply_fix3): Add cast. + (hppa_fix_adjustable): Adjust list of selectors using e_lrsel and + e_rrsel. + +2002-03-05 Paul Koning + + * tc-pdp11.c: Use VAX float format support for PDP-11 target. + (parse_ac5): New function for parsing float regs in float operand. + (parse_expression): Remove attempt to make literals be octal. + (parse_op_no_deferred): Support float literals. + (parse_op): Reject attempts to refer to float regs. + (parse_fop): New function, like parse_op but for float operand. + (md_assemble): Add cases to parse float operands. Also fix + IMM3, IMM6, IMM8 cases to pick up the operand from the right spot. + +2002-03-04 H.J. Lu + + * config/obj-elf.c (special_section): Add .init_array, + .fini_array and .preinit_array. + + * config/tc-ia64.h (ELF_TC_SPECIAL_SECTIONS): Remove + .init_array and .fini_array. + +2002-03-01 Jakub Jelinek + + * config/obj-elf.c (elf_copy_symbol_attributes): Don't copy + visibility. + (obj_frob_symbol): Copy visibility. + +2002-02-28 Jakub Jelinek + + * config/tc-alpha.c (s_alpha_text): Use obj_elf_text for OBJ_ELF, not + s_text. + (s_alpha_data): Use obj_elf_data for OBJ_ELF, not s_data. + +2002-02-27 Nick Clifton + + * po/es.po: Updated. + +2002-02-26 Chris Demetriou + + * config/tc-mips.c (mips_need_elf_addend_fixup): For embedded-PIC + only, undo the changes made on 2001-06-08, with the + effect being that common or extern symbols are + adjusted for embedded-PIC, but weak symbols are not. + (md_estimate_size_before_relax: Likewise, with the effect + that extern symbols are treated the same as weak symbols + only if not embedded-PIC. + (mips_fix_adjustable) Likewise, with the effect that + weak or extern symbols are not adjusted for embedded-PIC. + (md_apply_fix3): Tweak so that the case where value is zero + is handled more correctly for embedded-PIC code. + +2002-02-26 Nick Clifton + + * doc/as.texinfo (Overview): Add missing @ifset IA64 + + * configure.in (LINGUAS): Add es.po. + * configure: Regenerate. + * po/es.po: New file. + +2002-02-25 Thiemo Seufer + + * config/tc-mips.c (set_at): Fix handling of 64bit register loads. + (macro): Likewise. Fix la/dla address expansions for EMBEDDED_PIC + and NO_PIC cases. Code cleanup. + (macro2): Fix handling of 64bit register loads. + +2002-02-25 David Mosberger + + * doc/as.texinfo: Add entry for IA64. + * doc/c-ia64.texi: New file. + +2002-02-25 Alan Modra + + * config/tc-hppa.c: Update copyright date. + + * doc/c-ppc.texi (PowerPC-Opts): Add -mpower4, -maltivec and -m7400 + Remove references to chip manufacturers. + * config/tc-ppc.c (md_parse_option): Handle -mpower4 option. + Correct comments. + (md_show_usage): Remove references to chip manufacturers. Mention + -mpower4. + (md_begin): Test power4 opcode flag bits. + +2002-02-22 David Mosberger + + * config/tc-ia64.c (dot_restore): Issue error message of epilogue + count exceeds prologue count. + (md_show_usage): Describe -mconstant-gp and -mauto-pic. + (unwind.label_prologue_count): New member. + + Based on a patch by Hans Boehm : + + (get_saved_prologue_count): New function. + (save_prologue_count): New function. + (free_saved_prologue_count): New function. + (dot_label_state): Record state label by calling save_prologue_count(). + (dot_copy_state): Restore prologue count by calling + get_saved_prologue_count(). + (generate_unwind_image): Free up list of saved prologue + counts by calling free_saved_prologue_counts(). + +2002-02-22 Nick Clifton + + * config/tc-tic54x.c: Add missing prototypes and remove ANSI style + function declarations. + +2002-02-21 Nick Clifton + + * NEWS: Note that GASP is now deprecated. + * Makefile.am: Do not build gasp-new by default. + * Makefile.in: Regenerate. + * doc/Makefile.am: Do not install gasp.info. + * doc/Makefile.in: Regenerate. + * gas/gasp.texi: Note that gasp is now deprecated. + +2002-02-20 Nick Clifton + + * NEWS: Mark 2.12 branch. + +2002-02-19 Tom Tromey + + * config/tc-xstormy16.h (DWARF2_LINE_MIN_INSN_LENGTH): Define. + +2002-02-19 Thiemo Seufer + + * config/tc-mips.c (md_parse_option): Complain about invalid -mabi + option input. + +2002-02-19 Martin Schwidefsky + + * config/tc-s390.c (md_parse_option): Add switches -m31 and -m64. + Make bit size independent of architecture switch. + (md_begin): Add warning for -m64 with -Aesa. + (s390_md_end): Use renamed architecture defines. + +2002-02-18 Daniel Jacobowitz + + * config/obj-coff.h: Check !target_big_endian, not shl, for coff-sh. + +2002-02-16 Nick Clifton + + * doc/as.texinfo (Machine Dependencies): Fix typo: MMIX used + instead of CRIS. + +2002-02-15 Chris Demetriou + + * config/tc-mips.c (md_estimate_size_before_relax): Really + make sure we treat weak like extern only for ELF. (Fixes + patch from 2001-07-25.) + +2002-02-15 Ben Elliston + + * doc/as.texinfo: Add duplicate directory entry so that "info gas" + works as expected. + +2002-02-15 Hans-Peter Nilsson + + * NEWS: Mention support for MMIX. + +2002-02-13 Chris Demetriou + + * config/tc-mips.c (mips_need_elf_addend_fixup): Restructure into + a sequence of indpendent 'if' statements for easier debugging + and future modification. + +2002-02-13 Matt Fredette + + * config/tc-m68k.c (md_show_usage): No longer display a + hard-coded "68020" for the default CPU, instead display the + canonical name of the true, configured default CPU. + (m68k_elf_final_processing): Mark objects for sub-68020 + CPUs with the new EF_M68000 flag. + +2002-02-13 Andreas Schwab + + * config/tc-i386.c (tc_i386_fix_adjustable): Don't adjust + pc-relative relocations to merge sections in 64-bit mode. + +2002-02-13 Ben Elliston + + * NEWS: Document floating point number handling in gasp. + * gasp.c: Include and "xregex.h". + (is_flonum): New function. + (chew_flownum): Likewise. + (change_base): Consume flonums from the input, where possible. + * doc/gasp.texi (Constants): Document floating point numbers. + +2002-02-12 John David Anglin + + * config/tc-hppa.c (hppa_fix_adjustable): Don't adjust final types + that implicitly use LR and RR selectors. + +2002-02-12 Alexandre Oliva + + * config/tc-mn10300.c (other_registers): Added `epsw'. Mark `pc' + and `epsw' as available on AM33 and above only. + (other_register_name): Add logic to handle machine type encoded in + reg_number. + +2002-02-11 Tom Rix + + * config/tc-ppc.c (md_apply_fix3): Check for insert fop invalid for + xcoff64. + +Mon Feb 11 11:23:38 2002 Alexandre Oliva + + * config/tc-sparc.c (U0x80000000, U0xffffffff): New constants. + Use all over. + +Mon Feb 11 12:59:29 CET 2002 Jan Hubicka + + * i386.c (md_assemble): Support 32bit address prefix. + (i386_displacement): Likewise. + (i386_index_check): Accept 32bit addressing in 64bit mode. + +2002-02-11 Alexandre Oliva + + * config/tc-sh.c (dot): Removed unused function. + +2002-02-11 Alan Modra + + * Makefile.am: "make dep-am". + * Makefile.in: Regenerate. + * aclocal.m4: Regenerate. + * config.in: Regenerate. + * configure: Regenerate. + * doc/Makefile.in: Regenerate. + +2002-02-10 Richard Henderson + + * doc/c-alpha.texi: New file. + * doc/Makefile.am (CPU_DOCS): Add it. + * doc/all.texi, doc/as.texinfo: Add hooks for Alpha. + +2002-02-09 Richard Henderson + + * config/tc-alpha.c (O_samegp): New. + (USER_RELOC_P): Include it. + (alpha_reloc_op_tag, debug_exp, find_macro_match): Add it. + (md_apply_fix3): Handle BFD_RELOC_ALPHA_BRSGP. + (alpha_force_relocation, alpha_fix_adjustable): Likewise. + (alpha_validate_fix): New. + * config/tc-alpha.h (TC_VALIDATE_FIX): New. + +2002-02-09 Hans-Peter Nilsson + + * doc/c-cris.texi: New. + * doc/all.texi: @set CRIS. + * doc/as.texinfo: Ditto. Add CRIS gas manpage option overview. + Include c-cris.texi. + * doc/Makefile.am (CPU_DOCS): Add c-cris.texi + * doc/Makefile.in: Regenerate. + +2002-02-08 Chris Demetriou + + * config/tc-mips.c (IS_SEXT_32BIT_NUM): New macro to + determine if a number is a sign-extended 32-bit number. + (load_register): Use IS_SEXT_32BIT_NUM. + (macro): Check if load/store macro handling is using a + constant 32-bit address on 64-bit address systems, and if + so optimize the generation of that address. + +2002-02-08 Richard Henderson + + * config/tc-alpha.c (alpha_force_relocation): Don't assert that + we've eliminated all foreign relocation types yet. + (alpha_fix_adjustable): Likewise. + +2002-02-08 Alexandre Oliva + + Contribute sh64-elf. + 2002-02-08 Alexandre Oliva + Stephen Clarke + * doc/c-sh64.texi: Fix citation of SH64 architecture manual. + 2002-01-31 Alexandre Oliva + * config/tc-sh.c (md_relax_table): Added default sizes for + non-PC-relative UNDEF_MOVI, and relaxation sequences for + MOVI_16, MOVI_32 and MOVI_48. + * config/tc-sh64.c (shmedia_md_apply_fix3): Fix warning. + (shmedia_md_convert_frag): Handle non-PC-relative UNDEF_MOVI + and MOVI_16. + (shmedia_md_estimate_size_before_relax): Remove redundant + blocks. Set fragP->fr_var even if relaxation type unchanged. + Retain UNDEF_MOVI until expression decays to number. + 2002-01-24 Alexandre Oliva + * config/tc-sh64.c (shmedia_init_reloc): Handle new SHmedia PIC + relocation types. Take fixP->fx_addnumber into account too. + (shmedia_md_apply_fix): Likewise. + (shmedia_md_convert_frag): Likewise. + (shmedia_build_Mytes): Likewise. + (sh64_consume_datalabel): Complain about nested datalabel. + Support PIC relocs. Call sh_parse_name. + * config/tc-sh64.h (TC_RELOC_RTSYM_LOC_FIXUP): Extend definition + in tc-sh.h to SHmedia reloc types. + * config/tc-sh.c (SH64PCRELPLT, MOVI_PLT, MOVI_GOTOFF, + MOVI_GOTPC): New relaxation constants. + (md_relax_table): Introduce relaxation directives for PIC-related + constants. + (sh_PIC_related_p): Handle datalabel. + (sh_check_fixup): Choose SH5 PIC relocations. + (sh_cons_fix_new): Added BDF_RELOC_64. + (md_apply_fix3, sh_parse_name): Handle GOTPLT. + 2002-01-18 Alexandre Oliva + * config/tc-sh64.c (sh64_max_mem_for_rs_align_code): If the + current ISA is SHmedia, get 7 bytes. + 2001-11-28 Nick Clifton + * config/tc-sh.c (md_apply_fix3): Treat shmedia_md_apply_fix3 as a + void function. + * config/tc-sh64.c (shmedia_apply_fix): Rename to + shmedia_apply_fix3 and make void. + 2001-05-17 Alexandre Oliva + * config/tc-sh64.c (s_sh64_abi): Remove unused arguments passed to + as_bad. + 2001-04-12 Alexandre Oliva + * config/tc-sh64.h (md_parse_name): Take &c as argument. + 2001-03-14 DJ Delorie + * doc/Makefile.am (CPU_DOCS): Added c-sh64.texi + * doc/Makefile.in(CPU_DOCS): Ditto. + * doc/c-sh64.texi: New file. + * doc/as.texinfo: Add SH64 support. + 2001-03-13 DJ Delorie + * config/tc-sh64.c (shmedia_get_operands): Rename A_RESV_Fx to + A_REUSE_PREV so that its purpose is more obvious. + (shmedia_build_Mytes): Ditto. + 2001-03-07 DJ Delorie + * config/tc-sh64.c (sh64_vtable_entry): New, strip datalabels + before processing. + (sh64_vtable_inherit): Ditto. + (strip_datalabels): New, strip "datalabel" from given line. + * config/tc-sh.c (md_pseudo_table): Add sh64-specific vtable + pseudos. + 2001-03-06 Hans-Peter Nilsson + * config/tc-sh64.c (shmedia_md_assemble): Move dwarf2_emit_insn + call ... + (shmedia_build_Mytes): ... to here. + 2001-03-06 DJ Delorie + * config/tc-sh.c: Remove sh64-specific uaquad now that there + is a generic one. + 2001-01-21 Hans-Peter Nilsson + * config/tc-sh64.h (DWARF2_LINE_MIN_INSN_LENGTH): Override. + * config/tc-sh64.c (shmedia_md_assemble): Offset recorded insn + address by one in call to dwarf2_emit_insn. + 2001-01-13 Hans-Peter Nilsson + Implement ".abi" pseudo and correct .cranges descriptors. Correct + alignment handling broken by imported changes. + * config/tc-sh64.h (HANDLE_ALIGN): Override definition in tc-sh.h. + (sh64_handle_align): Declare. + (MAX_MEM_FOR_RS_ALIGN_CODE): Override definition in tc-sh.h. + (sh64_max_mem_for_rs_align_code): Declare. + (enum sh64_isa_values): Moved here from tc-sh64.c. + (md_do_align): Define. + (sh64_do_align): Declare. + (struct sh64_tc_frag_data): New. + (TC_FRAG_TYPE): Change to struct sh64_tc_frag_data. Users + changed. + (TC_FRAG_INIT): Change to set new datatype. + (struct sh64_segment_info_type): Rename member + last_flushed_location to last_contents_mark. All users changed. + (md_elf_section_change_hook, TC_CONS_FIX_NEW): Do not define. + (shmedia_elf_new_section, sh64_tc_cons_fix_new): Do not prototype. + * config/tc-sh.c (md_pseudo_table): Add ".abi". + (sh_elf_cons) [HAVE_SH64]: Call sh64_update_contents_mark instead + of unsetting seen_insn. + (md_assemble) [HAVE_SH64] : Also + call sh64_update_contents_mark. + (sh_handle_align): Remove HAVE_SH64-conditioned code. + * config/tc-sh64.c (sh64_isa_mode): Correct type from boolean to + enum sh64_isa_values. + (sh64_set_contents_type): Drop segT parameter. All callers changed. + (emitting_crange): Boolean guard moved to file scope from function + scope in sh64_set_contents_type. + (s_sh64_abi): New. + (sh64_update_contents_mark): New; most split out from + sh64_flush_pending_output. + (shmedia_md_end): Call sh64_update_contents_mark. Set + sh64_isa_mode to sh64_isa_sh5_guard unless sh64_isa_unspecified. + (sh64_do_align): New function. + (sh64_max_mem_for_rs_align_code): New function. + (sh64_handle_align): Rename from shmedia_do_align. Make + non-static. Add head comment. Emit zero bytes for n bytes modulo + four. Change return-type to void. + (shmedia_elf_new_section): Remove. + (shmedia_md_assemble): Call sh64_update_contents_mark. + (s_sh64_mode): Ditto. Do not call md_flush_pending_output. Make + new frag. Call sh64_update_contents_mark after making the new + frag. + (sh64_flush_pending_output): Just call sh64_update_contents_mark + and sh_flush_pending_output. + (sh64_flag_output): Also call md_flush_pending_output, but add + condition on not emitting_crange. + (sh64_tc_cons_fix_new): Remove. + 2001-01-12 Nick Clifton + * config/tc-sh64.c (shmedia_do_align): Fix to work with new + alignment handling scheme imported from sourceware. + 2001-01-12 Hans-Peter Nilsson + * config/tc-sh64.h (TARGET_FORMAT): Define. + (sh64_target_format): Prototype. + * config/tc-sh64.c (sh64_target_mach): New function. + 2001-01-07 Hans-Peter Nilsson + * config/tc-sh64.c (shmedia_md_end): When equating a symbol, use + zero_address_frag instead of copying the frag of the symbol. + (shmedia_frob_file_before_adjust): Ditto. + (shmedia_md_apply_fix) : Cast mask + to valueT to remove signedness. + (shmedia_md_convert_frag): Add parameter final. Rename parameter + headers to output_bfd. Do not evaluate symbols if final is false; + do emit fixups. + (shmedia_md_estimate_size_before_relax) : If symbol cannot be modified to be PC-relative + to the current frag, call shmedia_md_convert_frag to emit fixups + and make frag_wane neutralize the frag. Update comments. + * config/tc-sh.c (md_convert_frag): Change caller of + shmedia_md_convert_frag. + 2001-01-06 Hans-Peter Nilsson + * config/tc-sh64.h: Tweak comments and correct formatting. + * config/tc-sh64.c: Ditto. + (shmedia_md_convert_frag) : Fix thinko calculating offset + for the no-relocation case. + (shmedia_check_limits): Fix range check being off-by-one for PTA. + * config/tc-sh.c: Ditto. Add proper comments to #ifdef/#ifndef + wrappers. + (SH64PCREL16_F): Increment for proper max-PTA handling. Update + comment. + (SH64PCREL16_M, MOVI_16_M): Correct range thinko. + (SH64PCREL48_M, MOVI_48_M): Similar; don't count in length of + expansion. + (SH64PCREL32_M, MOVI_32_M): Ditto; handle overflowing expression. + Correct comment. + 2001-01-05 Hans-Peter Nilsson + * config/tc-sh64.c (shmedia_md_apply_fix) : Set lowest bit in field to be relocated to 1. + (shmedia_md_convert_frag) : Set lowest bit of field to relocate to 1 and rest to empty, + if reloc is emitted. + 2000-12-31 Hans-Peter Nilsson + New options plus bugfixes. + * config/tc-sh.c (md_longopts): New options "-no-expand" and + "-expand-pt32". + (md_parse_option): Handle new options. + (md_show_usage): Add blurb for new options. + * config/tc-sh64.c (SHMEDIA_BFD_RELOC_PT): New macro. + (sh64_expand, sh64_pt32): New variables. + (shmedia_init_reloc): Handle BFD_RELOC_SH_PT_16. + (shmedia_md_apply_fix): Hold original fixP->fx_r_type in + orig_fx_r_type. Change SHMEDIA_BFD_RELOC_PT into + BFD_RELOC_SH_PT_16. Handle BFD_RELOC_SH_PT_16 as pc-relative. + : Handle + SHMEDIA_BFD_RELOC_PT and BFD_RELOC_SH_PT_16. + (shmedia_md_convert_frag) : Modify to PTB if operand + points to SHcompact code. + : Check that ISA of what operand points at and + PTA/PTB matches, or emit error. + (shmedia_check_limits): Handle BFD_RELOC_SH_PT_16 and + SHMEDIA_BFD_RELOC_PT. + (shmedia_immediate_op): If pcrel, emit fixup also for constant + operand. + (shmedia_build_Mytes) : Also check sh64_expand in + condition for MOVI expansion. + : Handle expansion to 32 bits only, if + sh64_pt32. Emit only a BFD_RELOC_SH_PT_16 fixup if not + sh64_expand. + : Likewise, but emit a SHMEDIA_BFD_RELOC_PT + fixup. + (sh64_target_format): Error-check setting of sh64_pt32 and + sh64_expand. Fix typo in check for sh64_shcompact_const_crange. + (shmedia_md_pcrel_from_section): Handle BFD_RELOC_SH_PT_16 and + SHMEDIA_BFD_RELOC_PT as coming from SHmedia code. + 2000-12-31 Hans-Peter Nilsson + * config/tc-sh64.c: Improve comments. + (shmedia_md_convert_frag): Remove inactive is_pt_variant code. Do + not say the linker will check correctness of PTA/PTB expansion. + (shmedia_md_end): Make non-static. + * config/tc-sh64.h (md_end): Define to shmedia_md_end. Add + prototype. + * config/tc-sh.c (sh_finalize): Remove. + * config/tc-sh.h (md_end): Do not define. + Remove prototype for sh_finalize. + 2000-12-30 Hans-Peter Nilsson + * config/tc-sh64.c (shmedia_frob_section_type): Use a struct + sh64_section_data container when storing section type in tdata + field in elf_section_data. + * config/tc-sh.c (sh_elf_final_processing): Change from EF_SH64 to + EF_SH5. + * Makefile.am: Update dependencies. + * Makefile.in: Regenerate. + 2000-12-22 Hans-Peter Nilsson + * config/tc-sh64.c (shmedia_md_assemble): Don't protect + dwarf2_emit_insn call with test on debug_type. + 2000-12-19 Hans-Peter Nilsson + * config/tc-sh64.c (sh64_set_contents_type): Make contents-type + CRT_SH5_ISA32 sticky for 64-bit. + 2000-12-18 Hans-Peter Nilsson + Generate .crange sections when switching ISA mode or emitting + constants in same section as code. + * config/tc-sh64.c: Reformat structure definitions. + (sh64_end_of_assembly, sh64_mix, sh64_shcompact_const_crange): New + variables. + (sh64_set_contents_type): Rename from sh64_init_section. Rewrite + to emit a .cranges descriptor when contents type changes. Only + emit error if changing contents type and -no-mix is in effect. + (sh64_emit_crange, sh64_flush_last_crange, sh64_flag_output, + sh64_flush_pending_output, sh64_tc_cons_fix_new): New functions. + (shmedia_md_end): Set sh64_end_of_assembly. Pass + sh64_flush_last_crange over sections. + When checking main symbol of datalabel symbol, check for + STO_SH5_ISA32, not ISA type of section in definition. + (shmedia_frob_file_before_adjust): Check main symbol for + STO_SH5_ISA32; don't check ISA type of section in definition. + (shmedia_frob_section_type): Adjust for .cranges; set section flag + to SHF_SH5_ISA32_MIXED or SHF_SH5_ISA32 according to whether + .cranges entries have been output. + (shmedia_elf_new_section): Just call md_flush_pending_output. + (shmedia_md_assemble): Do not emit a BFD_RELOC_SH_SHMEDIA_CODE + fix. Do not set tc_segment_info_data.in_code for section. Call + sh64_set_contents_type for SHmedia code. + (s_sh64_mode): Do not call sh64_init_section or set seen_insn to + false. Call md_flush_pending_output. + (sh64_target_format): Check that -no-mix and + -shcompact-const-crange are used in sane combination with other + options. + (shmedia_md_pcrel_from_section): Check type of fix for how to + adjust pc-relative. + (sh64_consume_datalabel): Check symbol for having STO_SH5_ISA32, + not ISA type of section in definition. + * config/tc-sh64.h (struct sh64_segment_info_type): Rewrite to + hold contents-type state. + (md_flush_pending_output): Redefine to sh64_flush_pending_output. + (sh64_flush_pending_output): Declare. + (TC_CONS_FIX_NEW): Define to sh64_tc_cons_fix_new. + (sh64_tc_cons_fix_new): Declare. + * config/tc-sh.c (sh_elf_cons) [HAVE_SH64]: Unset seen_insn and + call sh64_flag_output. + (md_assemble) [HAVE_SH64]: Do not emit BFD_RELOC_SH_CODE. Just + call sh64_set_contents_type to mark SHcompact code and set + seen_insn. + (md_longopts): New options "-no-mix" and + "-shcompact-const-crange". + (md_parse_option): Handle new options. + (md_show_usage): Add blurb for new options. + (md_number_to_chars) [HAVE_SH64]: Call sh64_flag_output. + 2000-12-15 Hans-Peter Nilsson + * config/tc-sh64.c: Delete investigated and obsolete fixme:s. + (sh64_last_insn_frag): New. + (shmedia_md_convert_frag): Use tc_frag_data field of incoming frag + to get frag for insn opcode for generating fixups; do not assume it + is the same frag. + (shmedia_build_Mytes): Set sh64_last_insn_frag after growing frag + for new insn. + * config/tc-sh64.h (ELF_TC_SPECIAL_SECTIONS): Define for .cranges + section. + (TC_FRAG_TYPE): Define as fragS *. + (TC_FRAG_INIT): Define to set tc_frag_data to sh64_last_insn_frag. + (sh64_last_insn_frag): Declare. + (sh64_consume_datalabel): Fix typo; check for seginfo != NULL, + not == NULL before dereferencing. + 2000-12-12 Hans-Peter Nilsson + Get rid of BFD section flag and EF_SH64_ABI64. + * config/tc-sh64.c (shmedia_frob_section_type): Use + elf_section_data (sec)->tdata, not a specific BFD section flag, to + communicate the section as containing SHmedia code. Describe why. + * config/tc-sh.c (sh_elf_final_processing): Tweak comment. Set + EF_SH64 regardless of ABI. + * config/tc-sh64.c (shmedia_md_apply_fix): Decapitalize "invalid" + in error message. Handle resolved expressions for + BFD_RELOC_SH_IMMS10, BFD_RELOC_SH_IMMS10BY2, + BFD_RELOC_SH_IMMS10BY4 and BFD_RELOC_64. + (shmedia_check_limits): Handle BFD_RELOC_64. + (sh64_adjust_symtab): Do not decrement the GAS symbol value for + a STO_SH5_ISA32 symbol, only the BFD value. + 2000-12-11 Ben Elliston + * config/tc-sh64.c: Call dwarf2_emit_insn, not the defunct + dwarf2_generate_asm_lineno. + 2000-12-11 Hans-Peter Nilsson + Handle PC-relative MOVI expansions with assembler relaxation. + Generate PC-relative relocs from 16-bit PC-relative expressions. + * config/tc-sh64.c (SHMEDIA_MD_PCREL_FROM_FIX): Break out from... + (shmedia_md_pcrel_from_section): ...here. + (shmedia_md_apply_fix): Handle fixups for 16-bit operands that has + turned completely resolved. Adjust relocation type for 16-bit + immediate operands that has turned PC-relative. Adjust back for + MD_PCREL_FROM_SECTION being applied twice. + (shmedia_md_convert_frag): Always emit reloc for expression with + global or weak symbol. Handle relaxation result for PC-relative + expressions. + (shmedia_md_estimate_size_before_relax): An expression with a weak + or global symbol can not be relaxed. Break out tests for + relaxable symbol into variable sym_relaxable. + : Break out any PC-relative expression and change + relaxation type. + (shmedia_build_Mytes): CSE &operands->operands[j] into variable + opjp. + : Fix typo for initial minor relaxation type of + MOVI expansion. If X_op_symbol of the immediate expression is + set, make an expression symbol for the argument to frag_var. + * config/tc-sh.c (MOVI_IMM_32_PCREL, MOVI_IMM_64_PCREL): New + relaxations. + (END): Adjust for new relaxations. + (md_relax_table): Add entries for new relaxations. + 2000-12-07 Ben Elliston + * config/tc-sh64.c (shmedia_parse_reg): Initialize variable len. + 2000-12-07 Hans-Peter Nilsson + * config/tc-sh64.c (shmedia_md_convert_frag): Correct all MOVI and + SHORI operand offsets in PT/PTA/PTB expansions. + 2000-12-05 Hans-Peter Nilsson + Implement DataLabel semantics. + * config/tc-sh.c (sh_frob_file) [HAVE_SH64]: Call + shmedia_frob_file_before_adjust. + * config/tc-sh64.c [! OBJ_ELF]: Emit #error. + (DATALABEL_SUFFIX): Define. + (shmedia_md_end) : Walk + symbol list to update "datalabel" symbols to their main symbol + counterparts. + (shmedia_frob_file_before_adjust): New. + (sh64_adjust_symtab): For remaining datalabel symbols, set to + undefined and set STT_DATALABEL. + (sh64_frob_label): Initialize TC symbol field. + (sh64_consume_datalabel): Actually implement semantics. New + parameter operandf, call it instead of expression. + (sh64_exclude_symbol): New. + * config/tc-sh64.h (md_parse_name): Pass on the function operand + to sh64_consume_datalabel. + (tc_symbol_new_hook): Define to tc_frob_symbol. + (TC_SYMFIELD_TYPE): Define to symbolS *. + (tc_frob_symbol): Define to call sh64_exclude_symbol. + 2000-12-01 Hans-Peter Nilsson + * config/tc-sh64.c (shmedia_init_reloc): Tweak comment for default + case. + (shmedia_md_assemble): Call dwarf2_generate_asm_lineno if + generating dwarf2 debug information. + 2000-11-30 Hans-Peter Nilsson + * config/tc-sh64.c (sh64_target_format): Use elf64-sh64l and + elf64-sh64 for the 64-bit ABI. + * config/tc-sh.c (md_show_usage): Tweak usage output for -abi=* + option. + 2000-11-29 Hans-Peter Nilsson + * config/tc-sh.c: Remove conditionalizing on HAVE_SH64 for + case-insensitivity. + 2000-11-27 Hans-Peter Nilsson + * config/tc-sh64.c: Tweak comments, formatting and error messages. + (enum sh64_abi_values): New type. + (enum sh64_isa_values): New type. + (sh64_isa_mode): Replace shmedia_mode. All referers changed. + (seen_shcompact_mode, seen_shmedia_mode): Delete. + (sh64_abi): Replace shmedia_64. + (shmedia_md_convert_frag) : Correct register number handling. + (s_sh64_mode): Check validity for this target. + (sh64_target_format): Initialize defaults for ISA and ABI. + Fallback to old object format if no SH64 ISA or ABI has been + specified. + * config/tc-sh.c (md_parse_option): Check combinations for errors. + (sh_elf_final_processing): Change to have EF_SH64_ABI64 for 64-bit + ABI and EF_SH64 for 32-bit ABI, if SH64 options are specified. + * config/tc-sh64.h: Fix typo in comment. + 2000-11-25 Hans-Peter Nilsson + * config/tc-sh64.c (shmedia_md_estimate_size_before_relax) + : Size will be longest, not + shortest. + (shmedia_md_convert_frag): Disable PTB-warning machinery. Correct + all MOVI and SHORI operand offsets in PT/PTA/PTB expansions. + * config/tc-sh.c (parse_reg) [HAVE_SH64]: Add local variables l0 + and l1 to hold lowercase of two first characters. Change all + remaining TO_LOWER to tolower. + * config/tc-sh64.c (TO_LOWER): Delete. + (shmedia_find_cooked_opcode): Use tolower, not TO_LOWER. + (md_parse_name): Define. + (sh64_consume_datalabel): Declare. + (DOLLAR_DOT): Define. + * config/tc-sh64.c (shmedia_parse_exp): New. + (sh64_consume_datalabel): New; just ignoring datalabel semantics. + (shmedia_parse_reg): Remove const from src + parameter. + (shmedia_get_operands): Ditto for args parameter and ptr variable. + (shmedia_md_assemble): Ditto for op_end variable. + (shmedia_get_operand): Ditto for ptr parameter and src variable. + Use shmedia_parse_exp, not parse_exp. + * config/tc-sh64.c (shmedia_parse_reg): Add shmedia_arg_type + parameter. All callers changed. + (shmedia_get_operand): Add shmedia_arg_type parameter. All + callers changed. + (shmedia_parse_reg): Put first two character in local variables. + Use tolower, not TO_LOWER. If no register is found and argtype + indicates a control register, scan shmedia_creg_table + case-insensitive. + 2000-11-24 Hans-Peter Nilsson + * Makefile.am (CPU_TYPES): Add sh64. + (TARGET_CPU_CFILES): Add config/tc-sh64.c. + (TARGET_CPU_HFILES): Add config/tc-sh64.h. + Regenerate dependencies. + * Makefile.in: Regenerate. + * configure.in: Add support for sh64-*-elf*. + * configure: Regenerate. + * config/tc-sh64.h: New. + * config/tc-sh64.c: New. + * config/tc-sh.c (md_pseudo_table) [HAVE_SH64]: New pseudos + .mode, .isa and .uaquad. + [HAVE_SH64] (SH64PCREL16_32, SH64PCREL16_64, SH64PCREL16PT_32, + SH64PCREL16PT_64, MOVI_IMM_32, MOVI_IMM_64): Define. + [HAVE_SH64] (END): Define as 10. + [HAVE_SH64] (UNDEF_SH64PCREL, SH64PCREL16, SH64PCREL32, + SH64PCREL48, SH64PCREL64, UNDEF_MOVI, MOVI_16, MOVI_32, MOVI_48, + MOVI_64): Define. + [HAVE_SH64] (SH64PCREL16_F, SH64PCREL16_M, SH64PCREL16_LENGTH, + SH64PCREL32_F, SH64PCREL32_M, SH64PCREL32_LENGTH, SH64PCREL48_F, + SH64PCREL48_M, SH64PCREL48_LENGTH, SH64PCREL64_LENGTH, + MOVI_16_LENGTH, MOVI_32_LENGTH, MOVI_48_LENGTH, MOVI_64_LENGTH): + Define. + (md_relax_table) [HAVE_SH64]: Provide relaxations for SHmedia. + (md_begin) [HAVE_SH64]: Call shmedia_md_begin. + (parse_reg) [HAVE_SH64]: Parse register names case-insensitive. + (md_assemble) [HAVE_SH64]: Call shmedia_md_assemble if assembling + SHmedia instructions. Handle state-change after switching to + SHcompact. + (md_longopts) [HAVE_SH64]: New options --isa=* and --abi=*. + (md_parse_option) [HAVE_SH64]: Parse new options. + (md_show_usage) [HAVE_SH64]: Show usage of new options. + (md_convert_frag) [HAVE_SH64] : Call + shmedia_md_convert_frag instead of abort. + (sh_force_relocation) [HAVE_SH64]: Also force relocation for + BFD_RELOC_SH_SHMEDIA_CODE. + (sh_elf_final_processing) [HAVE_SH64]: Set flags identifying + SHcompact or SHmedia code. + (md_apply_fix) [HAVE_SH64] : Return result from calling + shmedia_md_apply_fix instead of abort. + (md_estimate_size_before_relax) [HAVE_SH64] : Return + result from calling shmedia_md_estimate_size_before_relax instead + of calling abort. + (sh_do_align) [HAVE_SH64]: If shmedia_mode, let shmedia_do_align + do the work. + (tc_gen_reloc) [HAVE_SH64]: For unrecognized relocs, call + shmedia_init_reloc and do nothing more if it returns non-zero. + (sh_finalize) [HAVE_SH64]: Call shmedia_md_end. + * po/POTFILES.in: Regenerate. + * po/gas.pot: Regenerate. + 2002-02-06 Alexandre Oliva * config/tc-sh.c (parse_at): Install the correct version of diff -uprN binutils-2.11.93.0.2/gas/Makefile.am binutils-2.12.90.0.1/gas/Makefile.am --- binutils-2.11.93.0.2/gas/Makefile.am Sun Feb 3 11:22:31 2002 +++ binutils-2.12.90.0.1/gas/Makefile.am Thu Mar 7 11:52:37 2002 @@ -79,6 +79,7 @@ CPU_TYPES = \ vax \ w65 \ v850 \ + sh64 \ xstormy16 \ z8k @@ -258,6 +259,7 @@ TARGET_CPU_CFILES = \ config/tc-ppc.c \ config/tc-s390.c \ config/tc-sh.c \ + config/tc-sh64.c \ config/tc-sparc.c \ config/tc-tahoe.c \ config/tc-tic30.c \ @@ -304,6 +306,7 @@ TARGET_CPU_HFILES = \ config/tc-ppc.h \ config/tc-s390.h \ config/tc-sh.h \ + config/tc-sh64.h \ config/tc-sparc.h \ config/tc-tahoe.h \ config/tc-tic30.h \ @@ -434,7 +437,9 @@ po/POTFILES.in: @MAINT@ Makefile for file in $(POTFILES); do echo $$file; done | sort > tmp \ && mv tmp $(srcdir)/po/POTFILES.in -noinst_PROGRAMS = as-new gasp-new +# Note: GASP is now deprecated and will be removed at some point in the future. +# Anything that GASP could do can now be done by GAS. +noinst_PROGRAMS = as-new noinst_SCRIPTS = $(GDBINIT) EXTRA_SCRIPTS = .gdbinit @@ -630,7 +635,7 @@ itbl-parse.c itbl-parse.h: $(srcdir)/itb # stand-alone itbl assembler & disassembler -EXTRA_PROGRAMS = itbl-test +EXTRA_PROGRAMS = gasp-new itbl-test itbl_test_SOURCES = itbl-parse.y itbl-lex.l itbl_test_LDADD = itbl-tops.o itbl-test.o $(GASLIBS) @LEXLIB@ @@ -1419,6 +1424,13 @@ DEPTC_v850_elf = $(INCDIR)/symcat.h $(sr $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h \ $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ $(INCDIR)/opcode/v850.h dwarf2dbg.h +DEPTC_sh64_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh64.h \ + $(srcdir)/config/tc-sh.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/safe-ctype.h $(srcdir)/../opcodes/sh64-opc.h \ + $(srcdir)/config/tc-sh.c subsegs.h $(INCDIR)/obstack.h \ + $(srcdir)/../opcodes/sh-opc.h struc-symbol.h dwarf2dbg.h DEPTC_xstormy16_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-xstormy16.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ @@ -1872,6 +1884,17 @@ DEPOBJ_v850_elf = $(INCDIR)/symcat.h $(s $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h \ $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ $(INCDIR)/aout/aout64.h +DEPOBJ_sh64_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-sh64.h $(srcdir)/config/tc-sh.h \ + $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/sh.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h +DEPOBJ_sh64_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh64.h \ + $(srcdir)/config/tc-sh.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h DEPOBJ_xstormy16_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-xstormy16.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ @@ -2176,6 +2199,14 @@ DEP_v850_coff = $(srcdir)/config/obj-cof DEP_v850_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h +DEP_sh64_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sh64.h \ + $(srcdir)/config/tc-sh.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/sh.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +DEP_sh64_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh64.h \ + $(srcdir)/config/tc-sh.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h DEP_xstormy16_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-xstormy16.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h diff -uprN binutils-2.11.93.0.2/gas/Makefile.in binutils-2.12.90.0.1/gas/Makefile.in --- binutils-2.11.93.0.2/gas/Makefile.in Sun Feb 3 11:22:31 2002 +++ binutils-2.12.90.0.1/gas/Makefile.in Thu Mar 7 11:52:37 2002 @@ -190,6 +190,7 @@ CPU_TYPES = \ vax \ w65 \ v850 \ + sh64 \ xstormy16 \ z8k @@ -375,6 +376,7 @@ TARGET_CPU_CFILES = \ config/tc-ppc.c \ config/tc-s390.c \ config/tc-sh.c \ + config/tc-sh64.c \ config/tc-sparc.c \ config/tc-tahoe.c \ config/tc-tic30.c \ @@ -422,6 +424,7 @@ TARGET_CPU_HFILES = \ config/tc-ppc.h \ config/tc-s390.h \ config/tc-sh.h \ + config/tc-sh64.h \ config/tc-sparc.h \ config/tc-tahoe.h \ config/tc-tic30.h \ @@ -557,7 +560,9 @@ POTFILES = $(MULTI_CFILES) $(TARGET_ENV_ $(HFILES) $(CFILES) $(GAS_CFILES) -noinst_PROGRAMS = as-new gasp-new +# Note: GASP is now deprecated and will be removed at some point in the future. +# Anything that GASP could do can now be done by GAS. +noinst_PROGRAMS = as-new noinst_SCRIPTS = $(GDBINIT) EXTRA_SCRIPTS = .gdbinit @@ -625,7 +630,7 @@ EXTRA_as_new_SOURCES = config/m68k-parse # stand-alone itbl assembler & disassembler -EXTRA_PROGRAMS = itbl-test +EXTRA_PROGRAMS = gasp-new itbl-test itbl_test_SOURCES = itbl-parse.y itbl-lex.l itbl_test_LDADD = itbl-tops.o itbl-test.o $(GASLIBS) @LEXLIB@ @@ -1224,6 +1229,14 @@ DEPTC_v850_elf = $(INCDIR)/symcat.h $(sr $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ $(INCDIR)/opcode/v850.h dwarf2dbg.h +DEPTC_sh64_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh64.h \ + $(srcdir)/config/tc-sh.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/safe-ctype.h $(srcdir)/../opcodes/sh64-opc.h \ + $(srcdir)/config/tc-sh.c subsegs.h $(INCDIR)/obstack.h \ + $(srcdir)/../opcodes/sh-opc.h struc-symbol.h dwarf2dbg.h + DEPTC_xstormy16_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-xstormy16.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ @@ -1783,6 +1796,19 @@ DEPOBJ_v850_elf = $(INCDIR)/symcat.h $(s $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ $(INCDIR)/aout/aout64.h +DEPOBJ_sh64_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-sh64.h $(srcdir)/config/tc-sh.h \ + $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/sh.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h + +DEPOBJ_sh64_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh64.h \ + $(srcdir)/config/tc-sh.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h + DEPOBJ_xstormy16_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-xstormy16.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ @@ -2191,6 +2217,16 @@ DEP_v850_elf = $(srcdir)/config/obj-elf. $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h +DEP_sh64_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sh64.h \ + $(srcdir)/config/tc-sh.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/sh.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + +DEP_sh64_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh64.h \ + $(srcdir)/config/tc-sh.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h + DEP_xstormy16_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-xstormy16.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h @@ -2220,7 +2256,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = ${GDBINIT} -noinst_PROGRAMS = as-new$(EXEEXT) gasp-new$(EXEEXT) +noinst_PROGRAMS = as-new$(EXEEXT) PROGRAMS = $(noinst_PROGRAMS) @@ -2228,6 +2264,9 @@ DEFS = @DEFS@ -I. -I$(srcdir) -I. CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ +gasp_new_OBJECTS = gasp.$(OBJEXT) macro.$(OBJEXT) sb.$(OBJEXT) \ +hash.$(OBJEXT) +gasp_new_LDFLAGS = itbl_test_OBJECTS = itbl-parse.$(OBJEXT) itbl-lex.$(OBJEXT) itbl_test_DEPENDENCIES = itbl-tops.o itbl-test.o \ ../libiberty/libiberty.a @@ -2242,9 +2281,6 @@ macro.$(OBJEXT) messages.$(OBJEXT) outpu sb.$(OBJEXT) stabs.$(OBJEXT) subsegs.$(OBJEXT) symbols.$(OBJEXT) \ write.$(OBJEXT) as_new_LDFLAGS = -gasp_new_OBJECTS = gasp.$(OBJEXT) macro.$(OBJEXT) sb.$(OBJEXT) \ -hash.$(OBJEXT) -gasp_new_LDFLAGS = SCRIPTS = $(noinst_SCRIPTS) LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -2262,10 +2298,10 @@ configure configure.in gdbinit.in itbl-l DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = tar +TAR = gtar GZIP_ENV = --best -SOURCES = $(itbl_test_SOURCES) $(as_new_SOURCES) $(EXTRA_as_new_SOURCES) $(gasp_new_SOURCES) -OBJECTS = $(itbl_test_OBJECTS) $(as_new_OBJECTS) $(gasp_new_OBJECTS) +SOURCES = $(gasp_new_SOURCES) $(itbl_test_SOURCES) $(as_new_SOURCES) $(EXTRA_as_new_SOURCES) +OBJECTS = $(gasp_new_OBJECTS) $(itbl_test_OBJECTS) $(as_new_OBJECTS) all: all-redirect .SUFFIXES: @@ -2368,6 +2404,10 @@ distclean-libtool: maintainer-clean-libtool: +gasp-new$(EXEEXT): $(gasp_new_OBJECTS) $(gasp_new_DEPENDENCIES) + @rm -f gasp-new$(EXEEXT) + $(LINK) $(gasp_new_LDFLAGS) $(gasp_new_OBJECTS) $(gasp_new_LDADD) $(LIBS) + itbl-test$(EXEEXT): $(itbl_test_OBJECTS) $(itbl_test_DEPENDENCIES) @rm -f itbl-test$(EXEEXT) $(LINK) $(itbl_test_LDFLAGS) $(itbl_test_OBJECTS) $(itbl_test_LDADD) $(LIBS) @@ -2375,10 +2415,6 @@ itbl-test$(EXEEXT): $(itbl_test_OBJECTS) as-new$(EXEEXT): $(as_new_OBJECTS) $(as_new_DEPENDENCIES) @rm -f as-new$(EXEEXT) $(LINK) $(as_new_LDFLAGS) $(as_new_OBJECTS) $(as_new_LDADD) $(LIBS) - -gasp-new$(EXEEXT): $(gasp_new_OBJECTS) $(gasp_new_DEPENDENCIES) - @rm -f gasp-new$(EXEEXT) - $(LINK) $(gasp_new_LDFLAGS) $(gasp_new_OBJECTS) $(gasp_new_LDADD) $(LIBS) .l.c: $(LEX) $(AM_LFLAGS) $(LFLAGS) $< && mv $(LEX_OUTPUT_ROOT).c $@ .y.c: diff -uprN binutils-2.11.93.0.2/gas/NEWS binutils-2.12.90.0.1/gas/NEWS --- binutils-2.11.93.0.2/gas/NEWS Sun Feb 3 11:22:31 2002 +++ binutils-2.12.90.0.1/gas/NEWS Thu Mar 7 11:52:37 2002 @@ -1,4 +1,15 @@ -*- text -*- +GASP has now been deprecated and will be removed in a future release. Use the +macro facilities in GAS instead. + +GASP now correctly parses floating point numbers. Unless the base is explicitly +specified, they are interpreted as decimal numbers regardless of the currently +specified base. + +Changes in 2.12: + +Support for Don Knuth's MMIX, by Hans-Peter Nilsson. + Support for the OpenRISC 32-bit embedded processor by OpenCores. The ARM assembler now accepts -march=..., -mcpu=... and -mfpu=... for diff -uprN binutils-2.11.93.0.2/gas/aclocal.m4 binutils-2.12.90.0.1/gas/aclocal.m4 --- binutils-2.11.93.0.2/gas/aclocal.m4 Tue Apr 24 09:12:30 2001 +++ binutils-2.12.90.0.1/gas/aclocal.m4 Thu Mar 7 11:52:37 2002 @@ -1,6 +1,6 @@ -dnl aclocal.m4 generated automatically by aclocal 1.4 +dnl aclocal.m4 generated automatically by aclocal 1.4-p5 -dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -92,7 +92,7 @@ AC_SUBST(INTLLIBS) dnl Usage: dnl AM_INIT_AUTOMAKE(package,version, [no-define]) -AC_DEFUN(AM_INIT_AUTOMAKE, +AC_DEFUN([AM_INIT_AUTOMAKE], [AC_REQUIRE([AC_PROG_INSTALL]) PACKAGE=[$1] AC_SUBST(PACKAGE) @@ -120,7 +120,7 @@ AC_REQUIRE([AC_PROG_MAKE_SET])]) # Check to make sure that the build environment is sane. # -AC_DEFUN(AM_SANITY_CHECK, +AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 @@ -161,7 +161,7 @@ AC_MSG_RESULT(yes)]) dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) dnl The program must properly implement --version. -AC_DEFUN(AM_MISSING_PROG, +AC_DEFUN([AM_MISSING_PROG], [AC_MSG_CHECKING(for working $2) # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. @@ -177,7 +177,7 @@ AC_SUBST($1)]) # Like AC_CONFIG_HEADER, but automatically create stamp file. -AC_DEFUN(AM_CONFIG_HEADER, +AC_DEFUN([AM_CONFIG_HEADER], [AC_PREREQ([2.12]) AC_CONFIG_HEADER([$1]) dnl When config.status generates a header, we must update the stamp-h file. @@ -201,9 +201,9 @@ changequote([,]))]) dnl AM_PROG_LEX dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT -AC_DEFUN(AM_PROG_LEX, +AC_DEFUN([AM_PROG_LEX], [missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1) -AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex") +AC_CHECK_PROGS(LEX, flex lex, $missing_dir/missing flex) AC_PROG_LEX AC_DECL_YYTEXT]) @@ -212,7 +212,7 @@ AC_DECL_YYTEXT]) # serial 1 -AC_DEFUN(AM_MAINTAINER_MODE, +AC_DEFUN([AM_MAINTAINER_MODE], [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode is disabled by default AC_ARG_ENABLE(maintainer-mode, @@ -229,7 +229,7 @@ AC_DEFUN(AM_MAINTAINER_MODE, # Define a conditional. -AC_DEFUN(AM_CONDITIONAL, +AC_DEFUN([AM_CONDITIONAL], [AC_SUBST($1_TRUE) AC_SUBST($1_FALSE) if $2; then diff -uprN binutils-2.11.93.0.2/gas/config/obj-coff.h binutils-2.12.90.0.1/gas/config/obj-coff.h --- binutils-2.11.93.0.2/gas/config/obj-coff.h Sun Feb 3 11:22:31 2002 +++ binutils-2.12.90.0.1/gas/config/obj-coff.h Thu Mar 7 11:52:37 2002 @@ -127,15 +127,10 @@ #define TARGET_FORMAT "pe-shl" #else -#if 0 /* FIXME: The "shl" varaible does not appear to exist. What happened to it ? */ #define TARGET_FORMAT \ - (shl \ + (!target_big_endian \ ? (sh_small ? "coff-shl-small" : "coff-shl") \ : (sh_small ? "coff-sh-small" : "coff-sh")) -#else -#define TARGET_FORMAT \ - (sh_small ? "coff-shl-small" : "coff-shl") -#endif #endif #endif diff -uprN binutils-2.11.93.0.2/gas/config/obj-elf.c binutils-2.12.90.0.1/gas/config/obj-elf.c --- binutils-2.11.93.0.2/gas/config/obj-elf.c Sun Feb 3 11:22:31 2002 +++ binutils-2.12.90.0.1/gas/config/obj-elf.c Thu Mar 7 11:52:37 2002 @@ -595,6 +595,27 @@ static struct special_section const spec { ".rodata", SHT_PROGBITS, SHF_ALLOC }, { ".rodata1", SHT_PROGBITS, SHF_ALLOC }, { ".text", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, +#if 0 + /* FIXME: The current gcc, as of 2002-03-03, will emit + + .section .init_array,"aw",@progbits + + for __attribute__ ((section (".init_array"))). "@progbits" marks + the incorrect section type. For now, we make them with + SHT_PROGBITS. BFD will fix the section type. Gcc should be changed + to emit + + .section .init_array + + */ + { ".init_array",SHT_INIT_ARRAY, SHF_ALLOC + SHF_WRITE }, + { ".fini_array",SHT_FINI_ARRAY, SHF_ALLOC + SHF_WRITE }, + { ".preinit_array",SHT_PREINIT_ARRAY, SHF_ALLOC + SHF_WRITE }, +#else + { ".init_array",SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".fini_array",SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".preinit_array",SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, +#endif #ifdef ELF_TC_SPECIAL_SECTIONS ELF_TC_SPECIAL_SECTIONS @@ -1408,7 +1429,9 @@ elf_copy_symbol_attributes (dest, src) destelf->size = NULL; } S_SET_SIZE (dest, S_GET_SIZE (src)); - S_SET_OTHER (dest, S_GET_OTHER (src)); + /* Don't copy visibility. */ + S_SET_OTHER (dest, (ELF_ST_VISIBILITY (S_GET_OTHER (dest)) + | (S_GET_OTHER (src) & ~ELF_ST_VISIBILITY (-1)))); } void @@ -1839,6 +1862,8 @@ elf_frob_symbol (symp, puntp) /* This will copy over the size information. */ copy_symbol_attributes (symp2, symp); + S_SET_OTHER (symp2, S_GET_OTHER (symp)); + if (S_IS_WEAK (symp)) S_SET_WEAK (symp2); diff -uprN binutils-2.11.93.0.2/gas/config/tc-alpha.c binutils-2.12.90.0.1/gas/config/tc-alpha.c --- binutils-2.11.93.0.2/gas/config/tc-alpha.c Sun Feb 3 11:22:31 2002 +++ binutils-2.12.90.0.1/gas/config/tc-alpha.c Thu Mar 7 11:52:37 2002 @@ -117,6 +117,7 @@ struct alpha_macro { #define O_gprelhigh O_md9 /* !gprelhigh relocation */ #define O_gprellow O_md10 /* !gprellow relocation */ #define O_gprel O_md11 /* !gprel relocation */ +#define O_samegp O_md12 /* !samegp relocation */ #define DUMMY_RELOC_LITUSE_ADDR (BFD_RELOC_UNUSED + 1) #define DUMMY_RELOC_LITUSE_BASE (BFD_RELOC_UNUSED + 2) @@ -128,7 +129,7 @@ struct alpha_macro { #define LITUSE_BYTOFF 2 #define LITUSE_JSR 3 -#define USER_RELOC_P(R) ((R) >= O_literal && (R) <= O_gprel) +#define USER_RELOC_P(R) ((R) >= O_literal && (R) <= O_samegp) /* Macros for extracting the type and number of encoded register tokens */ @@ -498,7 +499,8 @@ static const struct alpha_reloc_op_tag { DEF(gpdisp, BFD_RELOC_ALPHA_GPDISP, 1, 1), DEF(gprelhigh, BFD_RELOC_ALPHA_GPREL_HI16, 0, 0), DEF(gprellow, BFD_RELOC_ALPHA_GPREL_LO16, 0, 0), - DEF(gprel, BFD_RELOC_GPREL16, 0, 0) + DEF(gprel, BFD_RELOC_GPREL16, 0, 0), + DEF(samegp, BFD_RELOC_ALPHA_BRSGP, 0, 0) }; #undef DEF @@ -1219,6 +1221,11 @@ md_apply_fix3 (fixP, valP, seg) } return; +#ifdef OBJ_ELF + case BFD_RELOC_ALPHA_BRSGP: + return; +#endif + #ifdef OBJ_ECOFF case BFD_RELOC_ALPHA_LITERAL: md_number_to_chars (fixpos, value, 2); @@ -1364,6 +1371,49 @@ alpha_define_label (sym) alpha_insn_label = sym; } +/* If we have a BRSGP reloc to a local symbol, adjust it to BRADDR and + let it get resolved at assembly time. */ + +void +alpha_validate_fix (f) + fixS *f; +{ +#ifdef OBJ_ELF + int offset = 0; + const char *name; + + if (f->fx_r_type != BFD_RELOC_ALPHA_BRSGP) + return; + + if (! S_IS_DEFINED (f->fx_addsy)) + return; + + switch (S_GET_OTHER (f->fx_addsy) & STO_ALPHA_STD_GPLOAD) + { + case STO_ALPHA_NOPV: + break; + case STO_ALPHA_STD_GPLOAD: + offset = 8; + break; + default: + if (S_IS_LOCAL (f->fx_addsy)) + name = ""; + else + name = S_GET_NAME (f->fx_addsy); + as_bad_where (f->fx_file, f->fx_line, + _("!samegp reloc against symbol without .prologue: %s"), + name); + break; + } + + if (! (S_IS_EXTERN (f->fx_addsy) || S_IS_WEAK (f->fx_addsy))) + { + f->fx_r_type = BFD_RELOC_23_PCREL_S2; + f->fx_offset += offset; + } +#endif +} + /* Return true if we must always emit a reloc for a type and false if there is some hope of resolving it at assembly time. */ @@ -1388,6 +1438,7 @@ alpha_force_relocation (f) case BFD_RELOC_ALPHA_GPREL_LO16: case BFD_RELOC_ALPHA_LINKAGE: case BFD_RELOC_ALPHA_CODEADDR: + case BFD_RELOC_ALPHA_BRSGP: case BFD_RELOC_VTABLE_INHERIT: case BFD_RELOC_VTABLE_ENTRY: return 1; @@ -1399,8 +1450,6 @@ alpha_force_relocation (f) return 0; default: - assert ((int) f->fx_r_type < 0 - && -(int) f->fx_r_type < (int) alpha_num_operands); return 0; } } @@ -1424,6 +1473,7 @@ alpha_fix_adjustable (f) case BFD_RELOC_ALPHA_GPDISP_HI16: case BFD_RELOC_ALPHA_GPDISP_LO16: case BFD_RELOC_ALPHA_GPDISP: + case BFD_RELOC_ALPHA_BRSGP: return 0; case BFD_RELOC_ALPHA_LITERAL: @@ -1448,8 +1498,6 @@ alpha_fix_adjustable (f) return 1; default: - assert ((int) f->fx_r_type < 0 - && - (int) f->fx_r_type < (int) alpha_num_operands); return 1; } /*NOTREACHED*/ @@ -1767,6 +1815,7 @@ debug_exp (tok, ntok) case O_pregister: name = "O_pregister"; break; case O_cpregister: name = "O_cpregister"; break; case O_literal: name = "O_literal"; break; + case O_lituse_addr: name = "O_lituse_addr"; break; case O_lituse_base: name = "O_lituse_base"; break; case O_lituse_bytoff: name = "O_lituse_bytoff"; break; case O_lituse_jsr: name = "O_lituse_jsr"; break; @@ -1774,8 +1823,7 @@ debug_exp (tok, ntok) case O_gprelhigh: name = "O_gprelhigh"; break; case O_gprellow: name = "O_gprellow"; break; case O_gprel: name = "O_gprel"; break; - case O_md11: name = "O_md11"; break; - case O_md12: name = "O_md12"; break; + case O_samegp: name = "O_samegp"; break; case O_md13: name = "O_md13"; break; case O_md14: name = "O_md14"; break; case O_md15: name = "O_md15"; break; @@ -2170,6 +2218,7 @@ find_macro_match (first_macro, tok, pnto case O_gprelhigh: case O_gprellow: case O_gprel: + case O_samegp: goto match_failed; default: @@ -3982,7 +4031,11 @@ s_alpha_text (i) int i; { +#ifdef OBJ_ELF + obj_elf_text (i); +#else s_text (i); +#endif alpha_insn_label = NULL; alpha_auto_align_on = 1; alpha_current_align = 0; @@ -3995,7 +4048,11 @@ static void s_alpha_data (i) int i; { +#ifdef OBJ_ELF + obj_elf_data (i); +#else s_data (i); +#endif alpha_insn_label = NULL; alpha_auto_align_on = 1; alpha_current_align = 0; diff -uprN binutils-2.11.93.0.2/gas/config/tc-alpha.h binutils-2.12.90.0.1/gas/config/tc-alpha.h --- binutils-2.11.93.0.2/gas/config/tc-alpha.h Fri Nov 16 14:05:52 2001 +++ binutils-2.12.90.0.1/gas/config/tc-alpha.h Thu Mar 7 11:52:37 2002 @@ -39,12 +39,14 @@ #define NEED_LITERAL_POOL #define REPEAT_CONS_EXPRESSIONS +extern void alpha_validate_fix PARAMS ((struct fix *)); extern int alpha_force_relocation PARAMS ((struct fix *)); extern int alpha_fix_adjustable PARAMS ((struct fix *)); extern unsigned long alpha_gprmask, alpha_fprmask; extern valueT alpha_gp_value; +#define TC_VALIDATE_FIX(FIXP,SEGTYPE,SKIP) alpha_validate_fix (FIXP) #define TC_FORCE_RELOCATION(FIXP) alpha_force_relocation (FIXP) #define tc_fix_adjustable(FIXP) alpha_fix_adjustable (FIXP) #define RELOC_REQUIRES_SYMBOL diff -uprN binutils-2.11.93.0.2/gas/config/tc-hppa.c binutils-2.12.90.0.1/gas/config/tc-hppa.c --- binutils-2.11.93.0.2/gas/config/tc-hppa.c Sun Feb 3 11:22:31 2002 +++ binutils-2.12.90.0.1/gas/config/tc-hppa.c Thu Mar 7 11:52:37 2002 @@ -1,6 +1,6 @@ /* tc-hppa.c -- Assemble for the PA - Copyright 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 - Free Software Foundation, Inc. + Copyright 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, + 2002 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -57,8 +57,10 @@ typedef elf_symbol_type obj_symbol_type; #if TARGET_ARCH_SIZE == 64 /* How to generate a relocation. */ #define hppa_gen_reloc_type _bfd_elf64_hppa_gen_reloc_type +#define elf_hppa_reloc_final_type elf64_hppa_reloc_final_type #else #define hppa_gen_reloc_type _bfd_elf32_hppa_gen_reloc_type +#define elf_hppa_reloc_final_type elf32_hppa_reloc_final_type #endif /* ELF objects can have versions, but apparently do not have anywhere @@ -4457,7 +4459,7 @@ md_apply_fix3 (fixP, valP, seg) return; } - buf = fixP->fx_frag->fr_literal + fixP->fx_where; + buf = (unsigned char *) (fixP->fx_frag->fr_literal + fixP->fx_where); insn = bfd_get_32 (stdoutput, buf); fmt = bfd_hppa_insn2fmt (stdoutput, insn); @@ -8373,6 +8375,7 @@ int hppa_fix_adjustable (fixp) fixS *fixp; { + reloc_type code; struct hppa_fix_struct *hppa_fix; hppa_fix = (struct hppa_fix_struct *) fixp->tc_fix_data; @@ -8384,9 +8387,43 @@ hppa_fix_adjustable (fixp) #endif #ifdef OBJ_ELF - if (fixp->fx_r_type == (int) R_PARISC_GNU_VTINHERIT - || fixp->fx_r_type == (int) R_PARISC_GNU_VTENTRY) - return 0; + /* LR/RR selectors are implicitly used for a number of different relocation + types. We must ensure that none of these types are adjusted (see below) + even if they occur with a different selector. */ + code = elf_hppa_reloc_final_type (stdoutput, fixp->fx_r_type, + hppa_fix->fx_r_format, + hppa_fix->fx_r_field); + + switch (code) + { + /* Relocation types which use e_lrsel. */ + case R_PARISC_DIR21L: + case R_PARISC_DLTREL21L: + case R_PARISC_DPREL21L: + case R_PARISC_PLTOFF21L: + + /* Relocation types which use e_rrsel. */ + case R_PARISC_DIR14R: + case R_PARISC_DIR14DR: + case R_PARISC_DIR14WR: + case R_PARISC_DIR17R: + case R_PARISC_DLTREL14R: + case R_PARISC_DLTREL14DR: + case R_PARISC_DLTREL14WR: + case R_PARISC_DPREL14R: + case R_PARISC_DPREL14DR: + case R_PARISC_DPREL14WR: + case R_PARISC_PLTOFF14R: + case R_PARISC_PLTOFF14DR: + case R_PARISC_PLTOFF14WR: + + /* Other types that we reject for reduction. */ + case R_PARISC_GNU_VTENTRY: + case R_PARISC_GNU_VTINHERIT: + return 0; + default: + break; + } #endif if (fixp->fx_addsy && (S_IS_EXTERNAL (fixp->fx_addsy) diff -uprN binutils-2.11.93.0.2/gas/config/tc-i386.c binutils-2.12.90.0.1/gas/config/tc-i386.c --- binutils-2.11.93.0.2/gas/config/tc-i386.c Sun Feb 3 11:22:31 2002 +++ binutils-2.12.90.0.1/gas/config/tc-i386.c Thu Mar 7 11:52:37 2002 @@ -1,6 +1,6 @@ /* i386.c -- Assemble code for the Intel 80386 Copyright 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001 + 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -1178,7 +1178,12 @@ tc_i386_fix_adjustable (fixP) /* Prevent all adjustments to global symbols, or else dynamic linking will not work correctly. */ if (S_IS_EXTERNAL (fixP->fx_addsy) - || S_IS_WEAK (fixP->fx_addsy)) + || S_IS_WEAK (fixP->fx_addsy) + /* Don't adjust pc-relative references to merge sections in 64-bit + mode. */ + || (use_rela_relocations + && (S_GET_SEGMENT (fixP->fx_addsy)->flags & SEC_MERGE) != 0 + && fixP->fx_pcrel)) return 0; #endif /* adjust_reloc_syms doesn't know about the GOT. */ @@ -1298,6 +1303,7 @@ md_assemble (line) /* If we are in 16-bit mode, do not allow addr16 or data16. Similarly, in 32-bit mode, do not allow addr32 or data32. */ if ((current_templates->start->opcode_modifier & (Size16 | Size32)) + && flag_code != CODE_64BIT && (((current_templates->start->opcode_modifier & Size32) != 0) ^ (flag_code == CODE_16BIT))) { @@ -2263,6 +2269,14 @@ md_assemble (line) return; } + if (i.suffix != QWORD_MNEM_SUFFIX && (flag_code == CODE_64BIT) + && !(i.tm.opcode_modifier & IgnoreSize) + && (i.tm.opcode_modifier & JumpByte)) + { + if (! add_prefix (ADDR_PREFIX_OPCODE)) + return; + } + /* Set mode64 for an operand. */ if (i.suffix == QWORD_MNEM_SUFFIX && !(i.tm.opcode_modifier & NoRex64)) @@ -2415,13 +2429,15 @@ md_assemble (line) if (! i.index_reg) { /* Operand is just */ - if ((flag_code == CODE_16BIT) ^ (i.prefix[ADDR_PREFIX] != 0)) + if ((flag_code == CODE_16BIT) ^ (i.prefix[ADDR_PREFIX] != 0) + && (flag_code != CODE_64BIT)) { i.rm.regmem = NO_BASE_REGISTER_16; i.types[op] &= ~Disp; i.types[op] |= Disp16; } - else if (flag_code != CODE_64BIT) + else if (flag_code != CODE_64BIT + || (i.prefix[ADDR_PREFIX] != 0)) { i.rm.regmem = NO_BASE_REGISTER; i.types[op] &= ~Disp; @@ -3438,10 +3454,13 @@ i386_displacement (disp_start, disp_end) #endif int bigdisp = Disp32; - if ((flag_code == CODE_16BIT) ^ (i.prefix[ADDR_PREFIX] != 0)) - bigdisp = Disp16; if (flag_code == CODE_64BIT) - bigdisp = Disp64; + { + if (!i.prefix[ADDR_PREFIX]) + bigdisp = Disp64; + } + else if ((flag_code == CODE_16BIT) ^ (i.prefix[ADDR_PREFIX] != 0)) + bigdisp = Disp16; i.types[this_operand] |= bigdisp; exp = &disp_expressions[i.disp_operands]; @@ -3596,15 +3615,28 @@ i386_index_check (operand_string) ok = 1; if (flag_code == CODE_64BIT) { - /* 64bit checks. */ - if ((i.base_reg - && ((i.base_reg->reg_type & Reg64) == 0) - && (i.base_reg->reg_type != BaseIndex - || i.index_reg)) - || (i.index_reg - && ((i.index_reg->reg_type & (Reg64|BaseIndex)) - != (Reg64|BaseIndex)))) - ok = 0; + if (i.prefix[ADDR_PREFIX] == 0) + { + /* 64bit checks. */ + if ((i.base_reg + && ((i.base_reg->reg_type & Reg64) == 0) + && (i.base_reg->reg_type != BaseIndex + || i.index_reg)) + || (i.index_reg + && ((i.index_reg->reg_type & (Reg64|BaseIndex)) + != (Reg64|BaseIndex)))) + ok = 0; + } + else + { + /* 32bit checks. */ + if ((i.base_reg + && (i.base_reg->reg_type & (Reg32 | RegRex)) != Reg32) + || (i.index_reg + && ((i.index_reg->reg_type & (Reg32|BaseIndex|RegRex)) + != (Reg32|BaseIndex)))) + ok = 0; + } } else { @@ -4850,7 +4882,9 @@ tc_gen_reloc (section, fixp) case 1: code = BFD_RELOC_8; break; case 2: code = BFD_RELOC_16; break; case 4: code = BFD_RELOC_32; break; +#ifdef BFD64 case 8: code = BFD_RELOC_64; break; +#endif } } break; diff -uprN binutils-2.11.93.0.2/gas/config/tc-ia64.c binutils-2.12.90.0.1/gas/config/tc-ia64.c --- binutils-2.11.93.0.2/gas/config/tc-ia64.c Sun Feb 3 11:22:31 2002 +++ binutils-2.12.90.0.1/gas/config/tc-ia64.c Thu Mar 7 11:52:37 2002 @@ -623,6 +623,15 @@ typedef struct unw_rec_list { #define SLOT_NUM_NOT_SET (unsigned)-1 +/* Linked list of saved prologue counts. A very poor + implementation of a map from label numbers to prologue counts. */ +typedef struct label_prologue_count +{ + struct label_prologue_count *next; + unsigned long label_number; + unsigned int prologue_count; +} label_prologue_count; + static struct { unsigned long next_slot_number; @@ -649,6 +658,8 @@ static struct int prologue; int prologue_mask; unsigned int prologue_count; /* number of .prologues seen so far */ + /* Prologue counts at previous .label_state directives. */ + struct label_prologue_count * saved_prologue_counts; } unwind; typedef void (*vbyte_func) PARAMS ((int, char *, char *)); @@ -862,6 +873,9 @@ static int output_unw_records PARAMS ((u static int convert_expr_to_ab_reg PARAMS ((expressionS *, unsigned int *, unsigned int *)); static int convert_expr_to_xy_reg PARAMS ((expressionS *, unsigned int *, unsigned int *)); static int generate_unwind_image PARAMS ((const char *)); +static unsigned int get_saved_prologue_count PARAMS ((unsigned long)); +static void save_prologue_count PARAMS ((unsigned long, unsigned int)); +static void free_saved_prologue_counts PARAMS ((void)); /* Build the unwind section name by appending the (possibly stripped) text section NAME to the unwind PREFIX. The resulting string @@ -3156,6 +3170,14 @@ dot_restore (dummy) } else ecount = unwind.prologue_count - 1; + + if (ecount >= unwind.prologue_count) + { + as_bad ("Epilogue count of %lu exceeds number of nested prologues (%u)", + ecount + 1, unwind.prologue_count); + return; + } + add_unwind_entry (output_epilogue (ecount)); if (ecount < unwind.prologue_count) @@ -3228,7 +3250,7 @@ generate_unwind_image (text_name) size = output_unw_records (unwind.list, (void **) &unw_rec); if (size % md.pointer_size != 0) as_bad ("Unwind record is not a multiple of %d bytes.", md.pointer_size); - + /* If there are unwind records, switch sections, and output the info. */ if (size != 0) { @@ -3288,6 +3310,7 @@ generate_unwind_image (text_name) } free_list_records (unwind.list); + free_saved_prologue_counts (); unwind.list = unwind.tail = unwind.current_entry = NULL; return size; @@ -3714,6 +3737,61 @@ dot_spillmem_p (psprel) add_unwind_entry (output_spill_sprel_p (ab, reg, e3.X_add_number, qp)); } +static unsigned int +get_saved_prologue_count (lbl) + unsigned long lbl; +{ + label_prologue_count *lpc = unwind.saved_prologue_counts; + + while (lpc != NULL && lpc->label_number != lbl) + lpc = lpc->next; + + if (lpc != NULL) + return lpc->prologue_count; + + as_bad ("Missing .label_state %ld", lbl); + return 1; +} + +static void +save_prologue_count (lbl, count) + unsigned long lbl; + unsigned int count; +{ + label_prologue_count *lpc = unwind.saved_prologue_counts; + + while (lpc != NULL && lpc->label_number != lbl) + lpc = lpc->next; + + if (lpc != NULL) + lpc->prologue_count = count; + else + { + label_prologue_count * new_lpc = xmalloc (sizeof (* new_lpc)); + + new_lpc->next = unwind.saved_prologue_counts; + new_lpc->label_number = lbl; + new_lpc->prologue_count = count; + unwind.saved_prologue_counts = new_lpc; + } +} + +static void +free_saved_prologue_counts () +{ + label_prologue_count * lpc = unwind.saved_prologue_counts; + label_prologue_count * next; + + while (lpc != NULL) + { + next = lpc->next; + free (lpc); + lpc = next; + } + + unwind.saved_prologue_counts = NULL; +} + static void dot_label_state (dummy) int dummy ATTRIBUTE_UNUSED; @@ -3727,6 +3805,7 @@ dot_label_state (dummy) return; } add_unwind_entry (output_label_state (e.X_add_number)); + save_prologue_count (e.X_add_number, unwind.prologue_count); } static void @@ -3742,6 +3821,7 @@ dot_copy_state (dummy) return; } add_unwind_entry (output_copy_state (e.X_add_number)); + unwind.prologue_count = get_saved_prologue_count (e.X_add_number); } static void @@ -6336,6 +6416,11 @@ md_show_usage (stream) { fputs (_("\ IA-64 options:\n\ + --mconstant-gp mark output file as using the constant-GP model\n\ + (sets ELF header flag EF_IA_64_CONS_GP)\n\ + --mauto-pic mark output file as using the constant-GP model\n\ + without function descriptors (sets ELF header flag\n\ + EF_IA_64_NOFUNCDESC_CONS_GP)\n\ -milp32|-milp64|-mlp64|-mp64 select data model (default -mlp64)\n\ -mle | -mbe select little- or big-endian byte order (default -mle)\n\ -x | -xexplicit turn on dependency violation checking (default)\n\ diff -uprN binutils-2.11.93.0.2/gas/config/tc-ia64.h binutils-2.12.90.0.1/gas/config/tc-ia64.h --- binutils-2.11.93.0.2/gas/config/tc-ia64.h Sun Feb 3 11:22:31 2002 +++ binutils-2.12.90.0.1/gas/config/tc-ia64.h Thu Mar 7 11:52:37 2002 @@ -124,8 +124,6 @@ extern void ia64_after_parse_args PARAMS #define WORKING_DOT_WORD /* don't do broken word processing for now */ #define ELF_TC_SPECIAL_SECTIONS \ -{ ".init_array",SHT_INIT_ARRAY, SHF_ALLOC + SHF_WRITE }, \ -{ ".fini_array",SHT_FINI_ARRAY, SHF_ALLOC + SHF_WRITE }, \ { ".sbss", SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT }, \ { ".sdata", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT }, diff -uprN binutils-2.11.93.0.2/gas/config/tc-m68k.c binutils-2.12.90.0.1/gas/config/tc-m68k.c --- binutils-2.11.93.0.2/gas/config/tc-m68k.c Sun Feb 3 11:22:31 2002 +++ binutils-2.12.90.0.1/gas/config/tc-m68k.c Thu Mar 7 11:52:37 2002 @@ -6916,16 +6916,40 @@ void md_show_usage (stream) FILE *stream; { + const char *default_cpu = TARGET_CPU; + int default_arch, i; + + /* Get the canonical name for the default target CPU. */ + if (*default_cpu == 'm') + default_cpu++; + for (i = 0; i < n_archs; i++) + { + if (strcasecmp (default_cpu, archs[i].name) == 0) + { + default_arch = archs[i].arch; + for (i = 0; i < n_archs; i++) + { + if (archs[i].arch == default_arch + && !archs[i].alias) + { + default_cpu = archs[i].name; + break; + } + } + } + } + fprintf (stream, _("\ 680X0 options:\n\ -l use 1 word for refs to undefined symbols [default 2]\n\ -m68000 | -m68008 | -m68010 | -m68020 | -m68030 | -m68040 | -m68060 |\n\ -m68302 | -m68331 | -m68332 | -m68333 | -m68340 | -m68360 | -mcpu32 |\n\ -m5200 | -m5202 | -m5204 | -m5206 | -m5206e | -m5307 | -m5407\n\ - specify variant of 680X0 architecture [default 68020]\n\ + specify variant of 680X0 architecture [default %s]\n\ -m68881 | -m68882 | -mno-68881 | -mno-68882\n\ target has/lacks floating-point coprocessor\n\ - [default yes for 68020, 68030, and cpu32]\n")); + [default yes for 68020, 68030, and cpu32]\n"), + default_cpu); fprintf (stream, _("\ -m68851 | -mno-68851\n\ target has/lacks memory-management unit coprocessor\n\ @@ -7118,5 +7142,8 @@ void m68k_elf_final_processing() /* Set file-specific flags if this is a cpu32 processor */ if (cpu_of_arch (current_architecture) & cpu32) elf_elfheader (stdoutput)->e_flags |= EF_CPU32; + else if ((cpu_of_arch (current_architecture) & m68000up) + && !(cpu_of_arch (current_architecture) & m68020up)) + elf_elfheader (stdoutput)->e_flags |= EF_M68000; } #endif diff -uprN binutils-2.11.93.0.2/gas/config/tc-mips.c binutils-2.12.90.0.1/gas/config/tc-mips.c --- binutils-2.11.93.0.2/gas/config/tc-mips.c Sun Feb 3 11:22:31 2002 +++ binutils-2.12.90.0.1/gas/config/tc-mips.c Thu Mar 7 11:52:37 2002 @@ -3257,7 +3257,7 @@ set_at (counter, reg, unsignedp) "t,r,j", AT, reg, (int) BFD_RELOC_LO16); else { - load_register (counter, AT, &imm_expr, 0); + load_register (counter, AT, &imm_expr, HAVE_64BIT_GPRS); macro_build ((char *) NULL, counter, (expressionS *) NULL, unsignedp ? "sltu" : "slt", "d,v,t", AT, reg, AT); @@ -3353,6 +3353,11 @@ check_absolute_expr (ip, ex) ? 1 \ : 0) +/* Is the given value a sign-extended 32-bit value? */ +#define IS_SEXT_32BIT_NUM(x) \ + (((x) &~ (offsetT) 0x7fffffff) == 0 \ + || (((x) &~ (offsetT) 0x7fffffff) == ~ (offsetT) 0x7fffffff)) + /* load_register() * This routine generates the least number of instructions neccessary to load * an absolute expression value into a register. @@ -3392,9 +3397,7 @@ load_register (counter, reg, ep, dbl) (int) BFD_RELOC_LO16); return; } - else if ((((ep->X_add_number &~ (offsetT) 0x7fffffff) == 0 - || ((ep->X_add_number &~ (offsetT) 0x7fffffff) - == ~ (offsetT) 0x7fffffff)) + else if ((IS_SEXT_32BIT_NUM (ep->X_add_number) && (! dbl || ! ep->X_unsigned || sizeof (ep->X_add_number) > 4 @@ -4021,7 +4024,7 @@ macro (ip) 0); return; } - load_register (&icnt, AT, &imm_expr, 0); + load_register (&icnt, AT, &imm_expr, HAVE_64BIT_GPRS); macro_build ((char *) NULL, &icnt, &offset_expr, s, "s,t,p", sreg, AT); break; @@ -4613,11 +4616,11 @@ macro (ip) macro_build ((char *) NULL, &icnt, &offset_expr, "lui", "t,u", tempreg, (int) BFD_RELOC_PCREL_HI16_S); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, - HAVE_32BIT_ADDRESSES ? "addu" : "daddu", + (dbl || HAVE_64BIT_ADDRESSES) ? "daddu" : "addu", "d,v,t", tempreg, tempreg, breg); } macro_build ((char *) NULL, &icnt, &offset_expr, - HAVE_32BIT_ADDRESSES ? "addiu" : "daddiu", + (dbl || HAVE_64BIT_ADDRESSES) ? "daddiu" : "addiu", "t,r,j", treg, tempreg, (int) BFD_RELOC_PCREL_LO16); if (! used_at) return; @@ -4632,7 +4635,10 @@ macro (ip) } if (offset_expr.X_op == O_constant) - load_register (&icnt, tempreg, &offset_expr, dbl); + load_register (&icnt, tempreg, &offset_expr, + ((mips_pic == EMBEDDED_PIC || mips_pic == NO_PIC) + ? (dbl || HAVE_64BIT_ADDRESSES) + : HAVE_64BIT_ADDRESSES)); else if (mips_pic == NO_PIC) { /* If this is a reference to a GP relative symbol, we want @@ -4704,8 +4710,7 @@ macro (ip) && ! nopic_need_relax (offset_expr.X_add_symbol, 1)) { frag_grow (20); - macro_build ((char *) NULL, &icnt, &offset_expr, - HAVE_32BIT_ADDRESSES ? "addiu" : "daddiu", + macro_build ((char *) NULL, &icnt, &offset_expr, "addiu", "t,r,j", tempreg, GP, (int) BFD_RELOC_GPREL16); p = frag_var (rs_machine_dependent, 8, 0, RELAX_ENCODE (4, 8, 0, 4, 0, @@ -4715,8 +4720,7 @@ macro (ip) macro_build_lui (p, &icnt, &offset_expr, tempreg); if (p != NULL) p += 4; - macro_build (p, &icnt, &offset_expr, - HAVE_32BIT_ADDRESSES ? "addiu" : "daddiu", + macro_build (p, &icnt, &offset_expr, "addiu", "t,r,j", tempreg, tempreg, (int) BFD_RELOC_LO16); } } @@ -4757,7 +4761,8 @@ macro (ip) frag_grow (32); if (expr1.X_add_number == 0 && tempreg == PIC_CALL_REG) lw_reloc_type = (int) BFD_RELOC_MIPS_CALL16; - macro_build ((char *) NULL, &icnt, &offset_expr, dbl ? "ld" : "lw", + macro_build ((char *) NULL, &icnt, &offset_expr, + HAVE_32BIT_ADDRESSES ? "lw" : "ld", "t,o(b)", tempreg, lw_reloc_type, GP); if (expr1.X_add_number == 0) { @@ -4912,7 +4917,7 @@ macro (ip) HAVE_32BIT_ADDRESSES ? "addu" : "daddu", "d,v,t", tempreg, tempreg, GP); macro_build ((char *) NULL, &icnt, &offset_expr, - dbl ? "ld" : "lw", + HAVE_32BIT_ADDRESSES ? "lw" : "ld", "t,o(b)", tempreg, lw_reloc_type, tempreg); if (expr1.X_add_number == 0) { @@ -5015,7 +5020,7 @@ macro (ip) p += 4; } macro_build (p, &icnt, &offset_expr, - dbl ? "ld" : "lw", + HAVE_32BIT_ADDRESSES ? "lw" : "ld", "t,o(b)", tempreg, (int) BFD_RELOC_MIPS_GOT16, GP); p += 4; if (expr1.X_add_number >= -0x8000 @@ -5076,9 +5081,17 @@ macro (ip) abort (); if (breg != 0) - macro_build ((char *) NULL, &icnt, (expressionS *) NULL, - HAVE_32BIT_ADDRESSES ? "addu" : "daddu", - "d,v,t", treg, tempreg, breg); + { + char *s; + + if (mips_pic == EMBEDDED_PIC || mips_pic == NO_PIC) + s = (dbl || HAVE_64BIT_ADDRESSES) ? "daddu" : "addu"; + else + s = HAVE_64BIT_ADDRESSES ? "daddu" : "addu"; + + macro_build ((char *) NULL, &icnt, (expressionS *) NULL, s, + "d,v,t", treg, tempreg, breg); + } if (! used_at) return; @@ -5544,8 +5557,17 @@ macro (ip) dsll $tempreg,16 daddu $tempreg,$tempreg,$breg $treg,($tempreg) (BFD_RELOC_LO16) + + If we have 64-bit addresses, as an optimization, for + addresses which are 32-bit constants (e.g. kseg0/kseg1 + addresses) we fall back to the 32-bit address generation + mechanism since it is more efficient. This code should + probably attempt to generate 64-bit constants more + efficiently in general. */ - if (HAVE_64BIT_ADDRESSES) + if (HAVE_64BIT_ADDRESSES + && !(offset_expr.X_op == O_constant + && IS_SEXT_32BIT_NUM (offset_expr.X_add_number))) { p = NULL; @@ -6739,7 +6761,7 @@ macro2 (ip) } else { - load_register (&icnt, AT, &imm_expr, 0); + load_register (&icnt, AT, &imm_expr, HAVE_64BIT_GPRS); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "xor", "d,v,t", dreg, sreg, AT); used_at = 1; @@ -6775,7 +6797,7 @@ macro2 (ip) } else { - load_register (&icnt, AT, &imm_expr, 0); + load_register (&icnt, AT, &imm_expr, HAVE_64BIT_GPRS); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, mask == M_SGE_I ? "slt" : "sltu", "d,v,t", dreg, sreg, AT); @@ -6803,7 +6825,7 @@ macro2 (ip) case M_SGTU_I: s = "sltu"; sgti: - load_register (&icnt, AT, &imm_expr, 0); + load_register (&icnt, AT, &imm_expr, HAVE_64BIT_GPRS); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, s, "d,v,t", dreg, AT, sreg); break; @@ -6826,7 +6848,7 @@ macro2 (ip) case M_SLEU_I: s = "sltu"; slei: - load_register (&icnt, AT, &imm_expr, 0); + load_register (&icnt, AT, &imm_expr, HAVE_64BIT_GPRS); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, s, "d,v,t", dreg, AT, sreg); macro_build ((char *) NULL, &icnt, &expr1, "xori", "t,r,i", dreg, dreg, @@ -6842,7 +6864,7 @@ macro2 (ip) dreg, sreg, (int) BFD_RELOC_LO16); return; } - load_register (&icnt, AT, &imm_expr, 0); + load_register (&icnt, AT, &imm_expr, HAVE_64BIT_GPRS); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "slt", "d,v,t", dreg, sreg, AT); break; @@ -6856,7 +6878,7 @@ macro2 (ip) dreg, sreg, (int) BFD_RELOC_LO16); return; } - load_register (&icnt, AT, &imm_expr, 0); + load_register (&icnt, AT, &imm_expr, HAVE_64BIT_GPRS); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "sltu", "d,v,t", dreg, sreg, AT); break; @@ -6913,7 +6935,7 @@ macro2 (ip) } else { - load_register (&icnt, AT, &imm_expr, 0); + load_register (&icnt, AT, &imm_expr, HAVE_64BIT_GPRS); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "xor", "d,v,t", dreg, sreg, AT); used_at = 1; @@ -6978,7 +7000,7 @@ macro2 (ip) case M_TNE_I: s = "tne"; trap: - load_register (&icnt, AT, &imm_expr, 0); + load_register (&icnt, AT, &imm_expr, HAVE_64BIT_GPRS); macro_build ((char *) NULL, &icnt, (expressionS *) NULL, s, "s,t", sreg, AT); break; @@ -10068,7 +10090,10 @@ md_parse_option (c, arg) else if (strcmp (arg, "eabi") == 0) mips_opts.abi = EABI_ABI; else - mips_opts.abi = NO_ABI; + { + as_fatal (_("invalid abi -mabi=%s"), arg); + return 0; + } break; #endif /* OBJ_ELF */ @@ -10392,17 +10417,25 @@ static int mips_need_elf_addend_fixup (fixP) fixS *fixP; { - return (S_GET_OTHER (fixP->fx_addsy) == STO_MIPS16 - || ((S_IS_WEAK (fixP->fx_addsy) - || S_IS_EXTERN (fixP->fx_addsy)) - && !S_IS_COMMON (fixP->fx_addsy)) - || (symbol_used_in_reloc_p (fixP->fx_addsy) - && (((bfd_get_section_flags (stdoutput, - S_GET_SEGMENT (fixP->fx_addsy)) - & SEC_LINK_ONCE) != 0) - || !strncmp (segment_name (S_GET_SEGMENT (fixP->fx_addsy)), - ".gnu.linkonce", - sizeof (".gnu.linkonce") - 1)))); + if (S_GET_OTHER (fixP->fx_addsy) == STO_MIPS16) + return 1; + if (mips_pic == EMBEDDED_PIC + && S_IS_WEAK (fixP->fx_addsy)) + return 1; + if (mips_pic != EMBEDDED_PIC + && (S_IS_WEAK (fixP->fx_addsy) + || S_IS_EXTERN (fixP->fx_addsy)) + && !S_IS_COMMON (fixP->fx_addsy)) + return 1; + if (symbol_used_in_reloc_p (fixP->fx_addsy) + && (((bfd_get_section_flags (stdoutput, + S_GET_SEGMENT (fixP->fx_addsy)) + & SEC_LINK_ONCE) != 0) + || !strncmp (segment_name (S_GET_SEGMENT (fixP->fx_addsy)), + ".gnu.linkonce", + sizeof (".gnu.linkonce") - 1))) + return 1; + return 0; } #endif @@ -10685,7 +10718,10 @@ md_apply_fix3 (fixP, valP, seg) /* If 'value' is zero, the remaining reloc code won't actually do the store, so it must be done here. This is probably a bug somewhere. */ - if (!fixP->fx_done) + if (!fixP->fx_done + && (fixP->fx_r_type != BFD_RELOC_16_PCREL_S2 + || fixP->fx_addsy == NULL /* ??? */ + || ! S_IS_DEFINED (fixP->fx_addsy))) value -= fixP->fx_frag->fr_address + fixP->fx_where; value = (offsetT) value >> 2; @@ -12178,8 +12214,9 @@ md_estimate_size_before_relax (fragp, se && !linkonce #ifdef OBJ_ELF /* A global or weak symbol is treated as external. */ - && (OUTPUT_FLAVOR == bfd_target_elf_flavour - && ! (S_IS_EXTERN (sym) || S_IS_WEAK (sym))) + && (OUTPUT_FLAVOR != bfd_target_elf_flavour + || (! S_IS_WEAK (sym) + && (! S_IS_EXTERN (sym) || mips_pic == EMBEDDED_PIC))) #endif ); } @@ -12220,6 +12257,7 @@ mips_fix_adjustable (fixp) #ifdef OBJ_ELF /* Prevent all adjustments to global symbols. */ if (OUTPUT_FLAVOR == bfd_target_elf_flavour + && mips_pic != EMBEDDED_PIC && (S_IS_EXTERN (fixp->fx_addsy) || S_IS_WEAK (fixp->fx_addsy))) return 0; #endif diff -uprN binutils-2.11.93.0.2/gas/config/tc-mn10300.c binutils-2.12.90.0.1/gas/config/tc-mn10300.c --- binutils-2.11.93.0.2/gas/config/tc-mn10300.c Sun Feb 3 11:22:31 2002 +++ binutils-2.12.90.0.1/gas/config/tc-mn10300.c Thu Mar 7 11:52:37 2002 @@ -1,5 +1,5 @@ /* tc-mn10300.c -- Assembler code for the Matsushita 10300 - Copyright 1996, 1997, 1998, 1999, 2000, 2001 + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -234,10 +234,16 @@ static const struct reg_name xr_register #define XR_REG_NAME_CNT \ (sizeof (xr_registers) / sizeof (struct reg_name)) +/* We abuse the `value' field, that would be otherwise unused, to + encode the architecture on which (access to) the register was + introduced. FIXME: we should probably warn when we encounter a + register name when assembling for an architecture that doesn't + support it, before parsing it as a symbol name. */ static const struct reg_name other_registers[] = { + { "epsw", AM33 }, { "mdr", 0 }, - { "pc", 0 }, + { "pc", AM33 }, { "psw", 0 }, { "sp", 0 }, }; @@ -494,10 +500,11 @@ other_register_name (expressionP) *input_line_pointer = c; /* Look to see if it's in the register table. */ - if (reg_number >= 0) + if (reg_number == 0 + || (reg_number == AM33 && HAVE_AM33)) { expressionP->X_op = O_register; - expressionP->X_add_number = reg_number; + expressionP->X_add_number = 0; /* Make the rest nice. */ expressionP->X_add_symbol = NULL; diff -uprN binutils-2.11.93.0.2/gas/config/tc-pdp11.c binutils-2.12.90.0.1/gas/config/tc-pdp11.c --- binutils-2.11.93.0.2/gas/config/tc-pdp11.c Fri Nov 16 14:05:52 2001 +++ binutils-2.12.90.0.1/gas/config/tc-pdp11.c Thu Mar 7 11:52:37 2002 @@ -1,5 +1,5 @@ /* tc-pdp11.c - pdp11-specific - - Copyright 2001 Free Software Foundation, Inc. + Copyright 2001, 2002 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -33,6 +33,9 @@ static int set_option PARAMS ((char *arg static int set_cpu_model PARAMS ((char *arg)); static int set_machine_model PARAMS ((char *arg)); +extern int flonum_gen2vax PARAMS ((char format_letter, FLONUM_TYPE * f, + LITTLENUM_TYPE * words)); + #define TRUE 1 #define FALSE 0 @@ -85,7 +88,7 @@ CONST char EXP_CHARS[] = "eE"; /* Chars that mean this number is a floating point constant */ /* as in 0f123.456 */ /* or 0H1.234E-12 (see exp chars above) */ -CONST char FLT_CHARS[] = "dDfFgGhH"; +CONST char FLT_CHARS[] = "dDfF"; void pseudo_even (int); void pseudo_bss (int); @@ -298,7 +301,7 @@ parse_reg (char *str, struct pdp11_code } static char * -parse_ac (char *str, struct pdp11_code *operand) +parse_ac5 (char *str, struct pdp11_code *operand) { str = skip_whitespace (str); if (strncmp (str, "fr", 2) == 0 || @@ -310,6 +313,7 @@ parse_ac (char *str, struct pdp11_code * switch (*str) { case '0': case '1': case '2': case '3': + case '4': case '5': operand->code = *str - '0'; str++; break; @@ -328,6 +332,19 @@ parse_ac (char *str, struct pdp11_code * } static char * +parse_ac (char *str, struct pdp11_code *operand) +{ + str = parse_ac5 (str, operand); + if (!operand->error && operand->code > 3) + { + operand->error = "Bad register name"; + return str - 3; + } + + return str; +} + +static char * parse_expression (char *str, struct pdp11_code *operand) { char *save_input_line_pointer; @@ -348,6 +365,15 @@ parse_expression (char *str, struct pdp1 operand->reloc.pc_rel = 0; +#if 0 + /* FIXME: what follows is broken badly. You can't deal with differences + in radix conventions this way, because of symbolic constants, constant + expressions made up of pieces of differing radix, etc. The only + choices are to change ../expr.c to know about pdp11 conventions, or + to accept the fact that gas will use consistent conventions that differ + from those of traditional pdp11 assemblers. For now, I've + chosen the latter. paul koning, 12/23/2001 + */ if (operand->reloc.exp.X_op == O_constant) { if (*str == '.') @@ -362,13 +388,15 @@ parse_expression (char *str, struct pdp1 operand->reloc.exp.X_add_number = strtol (buf, &end, 8); } } - +#endif return str; } static char * parse_op_no_deferred (char *str, struct pdp11_code *operand) { + LITTLENUM_TYPE literal_float[2]; + str = skip_whitespace (str); switch (*str) @@ -412,6 +440,19 @@ parse_op_no_deferred (char *str, struct operand->reloc.type = BFD_RELOC_16; operand->reloc.pc_rel = 0; break; + case O_big: + if (operand->reloc.exp.X_add_number > 0) + { + operand->error = "Error in expression"; + break; + } + /* it's a floating literal... */ + know (operand->reloc.exp.X_add_number < 0); + flonum_gen2vax ('f', &generic_floating_point_number, literal_float); + operand->word = literal_float[0]; + if (literal_float[1] != 0) + as_warn (_("Low order bits truncated in immediate float operand")); + break; default: operand->error = "Error in expression"; break; @@ -504,13 +545,9 @@ parse_op_no_deferred (char *str, struct } static char * -parse_op (char *str, struct pdp11_code *operand) +parse_op_noreg (char *str, struct pdp11_code *operand) { str = skip_whitespace (str); - - str = parse_reg (str, operand); - if (!operand->error) - return str; operand->error = NULL; if (*str == '@' || *str == '*') @@ -527,6 +564,46 @@ parse_op (char *str, struct pdp11_code * } static char * +parse_op (char *str, struct pdp11_code *operand) +{ + str = skip_whitespace (str); + + str = parse_reg (str, operand); + if (!operand->error) + return str; + + operand->error = NULL; + parse_ac5 (str, operand); + if (!operand->error) + { + operand->error = "Float AC not legal as integer operand"; + return str; + } + + return parse_op_noreg (str, operand); +} + +static char * +parse_fop (char *str, struct pdp11_code *operand) +{ + str = skip_whitespace (str); + + str = parse_ac5 (str, operand); + if (!operand->error) + return str; + + operand->error = NULL; + parse_reg (str, operand); + if (!operand->error) + { + operand->error = "General register not legal as float operand"; + return str; + } + + return parse_op_noreg (str, operand); +} + +static char * parse_separator (char *str, int *error) { str = skip_whitespace (str); @@ -585,7 +662,7 @@ md_assemble (instruction_string) &insn.reloc.exp, insn.reloc.pc_rel, insn.reloc.type); } #else - as_warn ("Unknown instruction"); + as_bad (_("Unknown instruction '%s'"), str); #endif return; @@ -627,31 +704,36 @@ md_assemble (instruction_string) str = parse_expression (str, &op1); if (op1.error) break; + if (op1.reloc.exp.X_op != O_constant || op1.reloc.type != BFD_RELOC_NONE) + { + op1.error = "operand is not an absolute constant"; + break; + } switch (op->type) { case PDP11_OPCODE_IMM3: - if (op1.code & ~7) + if (op1.reloc.exp.X_add_number & ~7) { op1.error = "3-bit immediate out of range"; break; } break; case PDP11_OPCODE_IMM6: - if (op1.code & ~0x3f) + if (op1.reloc.exp.X_add_number & ~0x3f) { op1.error = "6-bit immediate out of range"; break; } break; case PDP11_OPCODE_IMM8: - if (op1.code & ~0xff) + if (op1.reloc.exp.X_add_number & ~0xff) { op1.error = "8-bit immediate out of range"; break; } break; } - insn.code |= op1.code; + insn.code |= op1.reloc.exp.X_add_number; break; case PDP11_OPCODE_DISPL: @@ -693,6 +775,15 @@ md_assemble (instruction_string) size += 2; break; + case PDP11_OPCODE_FOP: + str = parse_fop (str, &op1); + if (op1.error) + break; + insn.code |= op1.code; + if (op1.additional) + size += 2; + break; + case PDP11_OPCODE_REG_OP: str = parse_reg (str, &op2); if (op2.error) @@ -731,6 +822,44 @@ md_assemble (instruction_string) insn.code |= op2.code << 6; break; + case PDP11_OPCODE_AC_FOP: + str = parse_ac (str, &op2); + if (op2.error) + break; + insn.code |= op2.code << 6; + str = parse_separator (str, &error); + if (error) + { + op1.error = "Missing ','"; + break; + } + str = parse_fop (str, &op1); + if (op1.error) + break; + insn.code |= op1.code; + if (op1.additional) + size += 2; + break; + + case PDP11_OPCODE_FOP_AC: + str = parse_fop (str, &op1); + if (op1.error) + break; + insn.code |= op1.code; + if (op1.additional) + size += 2; + str = parse_separator (str, &error); + if (error) + { + op1.error = "Missing ','"; + break; + } + str = parse_ac (str, &op2); + if (op2.error) + break; + insn.code |= op2.code << 6; + break; + case PDP11_OPCODE_AC_OP: str = parse_ac (str, &op2); if (op2.error) @@ -750,6 +879,25 @@ md_assemble (instruction_string) size += 2; break; + case PDP11_OPCODE_OP_AC: + str = parse_op (str, &op1); + if (op1.error) + break; + insn.code |= op1.code; + if (op1.additional) + size += 2; + str = parse_separator (str, &error); + if (error) + { + op1.error = "Missing ','"; + break; + } + str = parse_ac (str, &op2); + if (op2.error) + break; + insn.code |= op2.code << 6; + break; + case PDP11_OPCODE_OP_OP: str = parse_op (str, &op1); if (op1.error) diff -uprN binutils-2.11.93.0.2/gas/config/tc-ppc.c binutils-2.12.90.0.1/gas/config/tc-ppc.c --- binutils-2.11.93.0.2/gas/config/tc-ppc.c Sun Feb 3 11:22:31 2002 +++ binutils-2.12.90.0.1/gas/config/tc-ppc.c Thu Mar 7 11:52:37 2002 @@ -1,5 +1,5 @@ /* tc-ppc.c -- Assemble for the PowerPC or POWER (RS/6000) - Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 + Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. @@ -876,18 +876,18 @@ md_parse_option (c, arg) /* -mpwr means to assemble for the IBM POWER (RIOS1). */ else if (strcmp (arg, "pwr") == 0) ppc_cpu = PPC_OPCODE_POWER; - /* -m601 means to assemble for the Motorola PowerPC 601, which includes + /* -m601 means to assemble for the PowerPC 601, which includes instructions that are holdovers from the Power. */ else if (strcmp (arg, "601") == 0) ppc_cpu = PPC_OPCODE_PPC | PPC_OPCODE_601; /* -mppc, -mppc32, -m603, and -m604 mean to assemble for the - Motorola PowerPC 603/604. */ + PowerPC 603/604. */ else if (strcmp (arg, "ppc") == 0 || strcmp (arg, "ppc32") == 0 || strcmp (arg, "603") == 0 || strcmp (arg, "604") == 0) ppc_cpu = PPC_OPCODE_PPC; - /* -m403 and -m405 mean to assemble for the Motorola PowerPC 403/405. */ + /* -m403 and -m405 mean to assemble for the PowerPC 403/405. */ else if (strcmp (arg, "403") == 0 || strcmp (arg, "405") == 0) ppc_cpu = PPC_OPCODE_PPC | PPC_OPCODE_403; @@ -925,6 +925,11 @@ md_parse_option (c, arg) PPC_OPCODE_BOOKE64 | PPC_OPCODE_64; ppc_size = PPC_OPCODE_64; } + else if (strcmp (arg, "power4") == 0) + { + ppc_cpu = PPC_OPCODE_PPC | PPC_OPCODE_64 | PPC_OPCODE_POWER4; + ppc_size = PPC_OPCODE_64; + } /* -mcom means assemble for the common intersection between Power and PowerPC. At present, we just allow the union, rather than the intersection. */ @@ -1027,18 +1032,19 @@ md_show_usage (stream) fprintf (stream, _("\ PowerPC options:\n\ -u ignored\n\ --mpwrx, -mpwr2 generate code for IBM POWER/2 (RIOS2)\n\ --mpwr generate code for IBM POWER (RIOS1)\n\ --m601 generate code for Motorola PowerPC 601\n\ +-mpwrx, -mpwr2 generate code for POWER/2 (RIOS2)\n\ +-mpwr generate code for POWER (RIOS1)\n\ +-m601 generate code for PowerPC 601\n\ -mppc, -mppc32, -m603, -m604\n\ - generate code for Motorola PowerPC 603/604\n\ --m403, -m405 generate code for Motorola PowerPC 403/405\n\ + generate code for PowerPC 603/604\n\ +-m403, -m405 generate code for PowerPC 403/405\n\ -m7400, -m7410, -m7450, -m7455\n\ - generate code For Motorola PowerPC 7400/7410/7450/7455\n\ --mppc64, -m620 generate code for Motorola PowerPC 620\n\ + generate code For PowerPC 7400/7410/7450/7455\n\ +-mppc64, -m620 generate code for PowerPC 620/625/630\n\ -mppc64bridge generate code for PowerPC 64, including bridge insns\n\ -mbooke64 generate code for 64-bit PowerPC BookE\n\ -mbooke, mbooke32 generate code for 32-bit PowerPC BookE\n\ +-mpower4 generate code for Power4 architecture\n\ -maltivec generate code for AltiVec\n\ -mcom generate code Power/PowerPC common instructions\n\ -many generate code for any architecture (PWR/PWRX/PPC)\n\ @@ -1175,7 +1181,10 @@ md_begin () if ((op->flags & ppc_cpu) != 0 && ((op->flags & (PPC_OPCODE_32 | PPC_OPCODE_64)) == 0 || (op->flags & (PPC_OPCODE_32 | PPC_OPCODE_64)) == ppc_size - || (ppc_cpu & PPC_OPCODE_64_BRIDGE) != 0)) + || (ppc_cpu & PPC_OPCODE_64_BRIDGE) != 0) + && ((op->flags & (PPC_OPCODE_POWER4 | PPC_OPCODE_NOPOWER4)) == 0 + || ((op->flags & PPC_OPCODE_POWER4) + == (ppc_cpu & PPC_OPCODE_POWER4)))) { const char *retval; @@ -5165,7 +5174,7 @@ md_apply_fix3 (fixP, valP, seg) if ((operand->flags & PPC_OPERAND_PARENS) != 0 && operand->bits == 16 && operand->shift == 0 - && operand->insert == NULL + && (operand->insert == NULL || ppc_xcoff64) && fixP->fx_addsy != NULL && symbol_get_tc (fixP->fx_addsy)->subseg != 0 && symbol_get_tc (fixP->fx_addsy)->class != XMC_TC diff -uprN binutils-2.11.93.0.2/gas/config/tc-s390.c binutils-2.12.90.0.1/gas/config/tc-s390.c --- binutils-2.11.93.0.2/gas/config/tc-s390.c Fri Nov 16 14:05:52 2001 +++ binutils-2.12.90.0.1/gas/config/tc-s390.c Thu Mar 7 11:52:37 2002 @@ -373,6 +373,12 @@ md_parse_option (c, arg) else if (arg != NULL && strcmp (arg, "warn-areg-zero") == 0) warn_areg_zero = TRUE; + else if (arg != NULL && strcmp (arg, "31") == 0) + s390_arch_size = 31; + + else if (arg != NULL && strcmp (arg, "64") == 0) + s390_arch_size = 64; + else { as_bad (_("invalid switch -m%s"), arg); @@ -382,15 +388,9 @@ md_parse_option (c, arg) case 'A': if (arg != NULL && strcmp (arg, "esa") == 0) - { current_architecture = S390_OPCODE_ESA; - s390_arch_size = 32; - } else if (arg != NULL && strcmp (arg, "esame") == 0) - { current_architecture = S390_OPCODE_ESAME; - s390_arch_size = 64; - } else as_bad ("invalid architecture -A%s", arg); current_arch_mask = 1 << current_architecture; @@ -422,7 +422,9 @@ md_show_usage (stream) S390 options:\n\ -mregnames Allow symbolic names for registers\n\ -mwarn-areg-zero Warn about zero base/index registers\n\ - -mno-regnames Do not allow symbolic names for registers\n")); + -mno-regnames Do not allow symbolic names for registers\n\ + -m31 Set file format to 31 bit format\n\ + -m64 Set file format to 64 bit format\n")); fprintf (stream, _("\ -V print assembler version number\n\ -Qy, -Qn ignored\n")); @@ -440,6 +442,10 @@ md_begin () boolean dup_insn = false; const char *retval; + /* Give a warning if the combination -m64-bit and -Aesa is used. */ + if (s390_arch_size == 64 && current_arch_mask == (1 << S390_OPCODE_ESA)) + as_warn ("The 64 bit file format is used without esame instructions."); + /* Set the ELF flags if desired. */ if (s390_flags) bfd_set_private_flags (stdoutput, s390_flags); @@ -487,9 +493,9 @@ void s390_md_end () { if (s390_arch_size == 64) - bfd_set_arch_mach (stdoutput, bfd_arch_s390, bfd_mach_s390_esame); + bfd_set_arch_mach (stdoutput, bfd_arch_s390, bfd_mach_s390_64); else - bfd_set_arch_mach (stdoutput, bfd_arch_s390, bfd_mach_s390_esa); + bfd_set_arch_mach (stdoutput, bfd_arch_s390, bfd_mach_s390_31); } void diff -uprN binutils-2.11.93.0.2/gas/config/tc-sh.c binutils-2.12.90.0.1/gas/config/tc-sh.c --- binutils-2.11.93.0.2/gas/config/tc-sh.c Thu Feb 7 10:21:04 2002 +++ binutils-2.12.90.0.1/gas/config/tc-sh.c Thu Mar 7 11:52:37 2002 @@ -59,7 +59,6 @@ static unsigned int assemble_ppi PARAMS static void little PARAMS ((int)); static void big PARAMS ((int)); static int parse_reg PARAMS ((char *, int *, int *)); -static symbolS *dot PARAMS ((void)); static char *parse_exp PARAMS ((char *, sh_operand_info *)); static char *parse_at PARAMS ((char *, sh_operand_info *)); static void get_operand PARAMS ((char **, sh_operand_info *)); @@ -140,6 +139,18 @@ const pseudo_typeS md_pseudo_table[] = {"file", dwarf2_directive_file, 0 }, {"loc", dwarf2_directive_loc, 0 }, #endif +#ifdef HAVE_SH64 + {"mode", s_sh64_mode, 0 }, + + /* Have the old name too. */ + {"isa", s_sh64_mode, 0 }, + + /* Assert that the right ABI is used. */ + {"abi", s_sh64_abi, 0 }, + + { "vtable_inherit", sh64_vtable_inherit, 0 }, + { "vtable_entry", sh64_vtable_entry, 0 }, +#endif /* HAVE_SH64 */ {0, 0, 0} }; @@ -172,11 +183,37 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP"; #define GET_WHAT(x) ((x>>4)) /* These are the three types of relaxable instrction. */ +/* These are the types of relaxable instructions; except for END which is + a marker. */ #define COND_JUMP 1 #define COND_JUMP_DELAY 2 #define UNCOND_JUMP 3 + +#ifdef HAVE_SH64 + +/* A 16-bit (times four) pc-relative operand, at most expanded to 32 bits. */ +#define SH64PCREL16_32 4 +/* A 16-bit (times four) pc-relative operand, at most expanded to 64 bits. */ +#define SH64PCREL16_64 5 + +/* Variants of the above for adjusting the insn to PTA or PTB according to + the label. */ +#define SH64PCREL16PT_32 6 +#define SH64PCREL16PT_64 7 + +/* A MOVI expansion, expanding to at most 32 or 64 bits. */ +#define MOVI_IMM_32 8 +#define MOVI_IMM_32_PCREL 9 +#define MOVI_IMM_64 10 +#define MOVI_IMM_64_PCREL 11 +#define END 12 + +#else /* HAVE_SH64 */ + #define END 4 +#endif /* HAVE_SH64 */ + #define UNDEF_DISP 0 #define COND8 1 #define COND12 2 @@ -186,6 +223,24 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP"; #define UNCOND12 1 #define UNCOND32 2 +#ifdef HAVE_SH64 +#define UNDEF_SH64PCREL 0 +#define SH64PCREL16 1 +#define SH64PCREL32 2 +#define SH64PCREL48 3 +#define SH64PCREL64 4 +#define SH64PCRELPLT 5 + +#define UNDEF_MOVI 0 +#define MOVI_16 1 +#define MOVI_32 2 +#define MOVI_48 3 +#define MOVI_64 4 +#define MOVI_PLT 5 +#define MOVI_GOTOFF 6 +#define MOVI_GOTPC 7 +#endif /* HAVE_SH64 */ + /* Branch displacements are from the address of the branch plus four, thus all minimum and maximum values have 4 added to them. */ #define COND8_F 258 @@ -216,6 +271,85 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP"; #define UNCOND32_M -(1<<30) #define UNCOND32_LENGTH 14 +#ifdef HAVE_SH64 +/* The trivial expansion of a SH64PCREL16 relaxation is just a "PT label, + TRd" as is the current insn, so no extra length. Note that the "reach" + is calculated from the address *after* that insn, but the offset in the + insn is calculated from the beginning of the insn. We also need to + take into account the implicit 1 coded as the "A" in PTA when counting + forward. If PTB reaches an odd address, we trap that as an error + elsewhere, so we don't have to have different relaxation entries. We + don't add a one to the negative range, since PTB would then have the + farthest backward-reaching value skipped, not generated at relaxation. */ +#define SH64PCREL16_F (32767 * 4 - 4 + 1) +#define SH64PCREL16_M (-32768 * 4 - 4) +#define SH64PCREL16_LENGTH 0 + +/* The next step is to change that PT insn into + MOVI ((label - datalabel Ln) >> 16) & 65535, R25 + SHORI (label - datalabel Ln) & 65535, R25 + Ln: + PTREL R25,TRd + which means two extra insns, 8 extra bytes. This is the limit for the + 32-bit ABI. + + The expressions look a bit bad since we have to adjust this to avoid overflow on a + 32-bit host. */ +#define SH64PCREL32_F ((((long) 1 << 30) - 1) * 2 + 1 - 4) +#define SH64PCREL32_LENGTH (2 * 4) + +/* Similarly, we just change the MOVI and add a SHORI for the 48-bit + expansion. */ +#if BFD_HOST_64BIT_LONG +/* The "reach" type is long, so we can only do this for a 64-bit-long + host. */ +#define SH64PCREL32_M (((long) -1 << 30) * 2 - 4) +#define SH64PCREL48_F ((((long) 1 << 47) - 1) - 4) +#define SH64PCREL48_M (((long) -1 << 47) - 4) +#define SH64PCREL48_LENGTH (3 * 4) +#else +/* If the host does not have 64-bit longs, just make this state identical + in reach to the 32-bit state. Note that we have a slightly incorrect + reach, but the correct one above will overflow a 32-bit number. */ +#define SH64PCREL32_M (((long) -1 << 30) * 2) +#define SH64PCREL48_F SH64PCREL32_F +#define SH64PCREL48_M SH64PCREL32_M +#define SH64PCREL48_LENGTH (3 * 4) +#endif /* BFD_HOST_64BIT_LONG */ + +/* And similarly for the 64-bit expansion; a MOVI + SHORI + SHORI + SHORI + + PTREL sequence. */ +#define SH64PCREL64_LENGTH (4 * 4) + +/* For MOVI, we make the MOVI + SHORI... expansion you can see in the + SH64PCREL expansions. The PCREL one is similar, but the other has no + pc-relative reach; it must be fully expanded in + shmedia_md_estimate_size_before_relax. */ +#define MOVI_16_LENGTH 0 +#define MOVI_16_F (32767 - 4) +#define MOVI_16_M (-32768 - 4) +#define MOVI_32_LENGTH 4 +#define MOVI_32_F ((((long) 1 << 30) - 1) * 2 + 1 - 4) +#define MOVI_48_LENGTH 8 + +#if BFD_HOST_64BIT_LONG +/* The "reach" type is long, so we can only do this for a 64-bit-long + host. */ +#define MOVI_32_M (((long) -1 << 30) * 2 - 4) +#define MOVI_48_F ((((long) 1 << 47) - 1) - 4) +#define MOVI_48_M (((long) -1 << 47) - 4) +#else +/* If the host does not have 64-bit longs, just make this state identical + in reach to the 32-bit state. Note that we have a slightly incorrect + reach, but the correct one above will overflow a 32-bit number. */ +#define MOVI_32_M (((long) -1 << 30) * 2) +#define MOVI_48_F MOVI_32_F +#define MOVI_48_M MOVI_32_M +#endif /* BFD_HOST_64BIT_LONG */ + +#define MOVI_64_LENGTH 12 +#endif /* HAVE_SH64 */ + #define EMPTY { 0, 0, 0, 0 } const relax_typeS md_relax_table[C (END, 0)] = { @@ -256,6 +390,118 @@ const relax_typeS md_relax_table[C (END, { 0, 0, UNCOND32_LENGTH, 0, }, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, + +#ifdef HAVE_SH64 + /* C (SH64PCREL16_32, SH64PCREL16) */ + EMPTY, + { SH64PCREL16_F, SH64PCREL16_M, SH64PCREL16_LENGTH, C (SH64PCREL16_32, SH64PCREL32) }, + /* C (SH64PCREL16_32, SH64PCREL32) */ + { 0, 0, SH64PCREL32_LENGTH, 0 }, + EMPTY, EMPTY, + /* C (SH64PCREL16_32, SH64PCRELPLT) */ + { 0, 0, SH64PCREL32_LENGTH, 0 }, + EMPTY, EMPTY, + EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, + + /* C (SH64PCREL16_64, SH64PCREL16) */ + EMPTY, + { SH64PCREL16_F, SH64PCREL16_M, SH64PCREL16_LENGTH, C (SH64PCREL16_64, SH64PCREL32) }, + /* C (SH64PCREL16_64, SH64PCREL32) */ + { SH64PCREL32_F, SH64PCREL32_M, SH64PCREL32_LENGTH, C (SH64PCREL16_64, SH64PCREL48) }, + /* C (SH64PCREL16_64, SH64PCREL48) */ + { SH64PCREL48_F, SH64PCREL48_M, SH64PCREL48_LENGTH, C (SH64PCREL16_64, SH64PCREL64) }, + /* C (SH64PCREL16_64, SH64PCREL64) */ + { 0, 0, SH64PCREL64_LENGTH, 0 }, + /* C (SH64PCREL16_64, SH64PCRELPLT) */ + { 0, 0, SH64PCREL64_LENGTH, 0 }, + EMPTY, EMPTY, + EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, + + /* C (SH64PCREL16PT_32, SH64PCREL16) */ + EMPTY, + { SH64PCREL16_F, SH64PCREL16_M, SH64PCREL16_LENGTH, C (SH64PCREL16PT_32, SH64PCREL32) }, + /* C (SH64PCREL16PT_32, SH64PCREL32) */ + { 0, 0, SH64PCREL32_LENGTH, 0 }, + EMPTY, EMPTY, + /* C (SH64PCREL16PT_32, SH64PCRELPLT) */ + { 0, 0, SH64PCREL32_LENGTH, 0 }, + EMPTY, EMPTY, + EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, + + /* C (SH64PCREL16PT_64, SH64PCREL16) */ + EMPTY, + { SH64PCREL16_F, SH64PCREL16_M, SH64PCREL16_LENGTH, C (SH64PCREL16PT_64, SH64PCREL32) }, + /* C (SH64PCREL16PT_64, SH64PCREL32) */ + { SH64PCREL32_F, + SH64PCREL32_M, + SH64PCREL32_LENGTH, + C (SH64PCREL16PT_64, SH64PCREL48) }, + /* C (SH64PCREL16PT_64, SH64PCREL48) */ + { SH64PCREL48_F, SH64PCREL48_M, SH64PCREL48_LENGTH, C (SH64PCREL16PT_64, SH64PCREL64) }, + /* C (SH64PCREL16PT_64, SH64PCREL64) */ + { 0, 0, SH64PCREL64_LENGTH, 0 }, + /* C (SH64PCREL16PT_64, SH64PCRELPLT) */ + { 0, 0, SH64PCREL64_LENGTH, 0}, + EMPTY, EMPTY, + EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, + + /* C (MOVI_IMM_32, UNDEF_MOVI) */ + { 0, 0, MOVI_32_LENGTH, 0 }, + /* C (MOVI_IMM_32, MOVI_16) */ + { MOVI_16_F, MOVI_16_M, MOVI_16_LENGTH, C (MOVI_IMM_32, MOVI_32) }, + /* C (MOVI_IMM_32, MOVI_32) */ + { MOVI_32_F, MOVI_32_M, MOVI_32_LENGTH, 0 }, + EMPTY, EMPTY, EMPTY, + /* C (MOVI_IMM_32, MOVI_GOTOFF) */ + { 0, 0, MOVI_32_LENGTH, 0 }, + EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, + + /* C (MOVI_IMM_32_PCREL, MOVI_16) */ + EMPTY, + { MOVI_16_F, MOVI_16_M, MOVI_16_LENGTH, C (MOVI_IMM_32_PCREL, MOVI_32) }, + /* C (MOVI_IMM_32_PCREL, MOVI_32) */ + { 0, 0, MOVI_32_LENGTH, 0 }, + EMPTY, EMPTY, + /* C (MOVI_IMM_32_PCREL, MOVI_PLT) */ + { 0, 0, MOVI_32_LENGTH, 0 }, + EMPTY, + /* C (MOVI_IMM_32_PCREL, MOVI_GOTPC) */ + { 0, 0, MOVI_32_LENGTH, 0 }, + EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, + + /* C (MOVI_IMM_64, UNDEF_MOVI) */ + { 0, 0, MOVI_64_LENGTH, 0 }, + /* C (MOVI_IMM_64, MOVI_16) */ + { MOVI_16_F, MOVI_16_M, MOVI_16_LENGTH, C (MOVI_IMM_64, MOVI_32) }, + /* C (MOVI_IMM_64, MOVI_32) */ + { MOVI_32_F, MOVI_32_M, MOVI_32_LENGTH, C (MOVI_IMM_64, MOVI_48) }, + /* C (MOVI_IMM_64, MOVI_48) */ + { MOVI_48_F, MOVI_48_M, MOVI_48_LENGTH, C (MOVI_IMM_64, MOVI_64) }, + /* C (MOVI_IMM_64, MOVI_64) */ + { 0, 0, MOVI_64_LENGTH, 0 }, + EMPTY, + /* C (MOVI_IMM_64, MOVI_GOTOFF) */ + { 0, 0, MOVI_64_LENGTH, 0 }, + EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, + + /* C (MOVI_IMM_64_PCREL, MOVI_16) */ + EMPTY, + { MOVI_16_F, MOVI_16_M, MOVI_16_LENGTH, C (MOVI_IMM_64_PCREL, MOVI_32) }, + /* C (MOVI_IMM_64_PCREL, MOVI_32) */ + { MOVI_32_F, MOVI_32_M, MOVI_32_LENGTH, C (MOVI_IMM_64_PCREL, MOVI_48) }, + /* C (MOVI_IMM_64_PCREL, MOVI_48) */ + { MOVI_48_F, MOVI_48_M, MOVI_48_LENGTH, C (MOVI_IMM_64_PCREL, MOVI_64) }, + /* C (MOVI_IMM_64_PCREL, MOVI_64) */ + { 0, 0, MOVI_64_LENGTH, 0 }, + /* C (MOVI_IMM_64_PCREL, MOVI_PLT) */ + { 0, 0, MOVI_64_LENGTH, 0 }, + EMPTY, + /* C (MOVI_IMM_64_PCREL, MOVI_GOTPC) */ + { 0, 0, MOVI_64_LENGTH, 0 }, + EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, + +#endif /* HAVE_SH64 */ + }; #undef EMPTY @@ -278,6 +524,11 @@ sh_PIC_related_p (sym) if (sym == GOT_symbol) return 1; +#ifdef HAVE_SH64 + if (sh_PIC_related_p (*symbol_get_tc (sym))) + return 1; +#endif + exp = symbol_get_value_expression (sym); return (exp->X_op == O_PIC_reloc @@ -341,11 +592,47 @@ sh_check_fixup (main_exp, r_type_p) if (exp->X_op == O_symbol || exp->X_op == O_add || exp->X_op == O_subtract) { +#ifdef HAVE_SH64 + if (exp->X_add_symbol + && (exp->X_add_symbol == GOT_symbol + || (GOT_symbol + && *symbol_get_tc (exp->X_add_symbol) == GOT_symbol))) + { + switch (*r_type_p) + { + case BFD_RELOC_SH_IMM_LOW16: + *r_type_p = BFD_RELOC_SH_GOTPC_LOW16; + break; + + case BFD_RELOC_SH_IMM_MEDLOW16: + *r_type_p = BFD_RELOC_SH_GOTPC_MEDLOW16; + break; + + case BFD_RELOC_SH_IMM_MEDHI16: + *r_type_p = BFD_RELOC_SH_GOTPC_MEDHI16; + break; + + case BFD_RELOC_SH_IMM_HI16: + *r_type_p = BFD_RELOC_SH_GOTPC_HI16; + break; + + case BFD_RELOC_NONE: + case BFD_RELOC_UNUSED: + *r_type_p = BFD_RELOC_SH_GOTPC; + break; + + default: + abort (); + } + return 0; + } +#else if (exp->X_add_symbol && exp->X_add_symbol == GOT_symbol) { *r_type_p = BFD_RELOC_SH_GOTPC; return 0; } +#endif exp = symbol_get_value_expression (exp->X_add_symbol); if (! exp) return 0; @@ -353,7 +640,116 @@ sh_check_fixup (main_exp, r_type_p) if (exp->X_op == O_PIC_reloc) { +#ifdef HAVE_SH64 + switch (*r_type_p) + { + case BFD_RELOC_NONE: + case BFD_RELOC_UNUSED: + *r_type_p = exp->X_md; + break; + + case BFD_RELOC_SH_IMM_LOW16: + switch (exp->X_md) + { + case BFD_RELOC_32_GOTOFF: + *r_type_p = BFD_RELOC_SH_GOTOFF_LOW16; + break; + + case BFD_RELOC_SH_GOTPLT32: + *r_type_p = BFD_RELOC_SH_GOTPLT_LOW16; + break; + + case BFD_RELOC_32_GOT_PCREL: + *r_type_p = BFD_RELOC_SH_GOT_LOW16; + break; + + case BFD_RELOC_32_PLT_PCREL: + *r_type_p = BFD_RELOC_SH_PLT_LOW16; + break; + + default: + abort (); + } + break; + + case BFD_RELOC_SH_IMM_MEDLOW16: + switch (exp->X_md) + { + case BFD_RELOC_32_GOTOFF: + *r_type_p = BFD_RELOC_SH_GOTOFF_MEDLOW16; + break; + + case BFD_RELOC_SH_GOTPLT32: + *r_type_p = BFD_RELOC_SH_GOTPLT_MEDLOW16; + break; + + case BFD_RELOC_32_GOT_PCREL: + *r_type_p = BFD_RELOC_SH_GOT_MEDLOW16; + break; + + case BFD_RELOC_32_PLT_PCREL: + *r_type_p = BFD_RELOC_SH_PLT_MEDLOW16; + break; + + default: + abort (); + } + break; + + case BFD_RELOC_SH_IMM_MEDHI16: + switch (exp->X_md) + { + case BFD_RELOC_32_GOTOFF: + *r_type_p = BFD_RELOC_SH_GOTOFF_MEDHI16; + break; + + case BFD_RELOC_SH_GOTPLT32: + *r_type_p = BFD_RELOC_SH_GOTPLT_MEDHI16; + break; + + case BFD_RELOC_32_GOT_PCREL: + *r_type_p = BFD_RELOC_SH_GOT_MEDHI16; + break; + + case BFD_RELOC_32_PLT_PCREL: + *r_type_p = BFD_RELOC_SH_PLT_MEDHI16; + break; + + default: + abort (); + } + break; + + case BFD_RELOC_SH_IMM_HI16: + switch (exp->X_md) + { + case BFD_RELOC_32_GOTOFF: + *r_type_p = BFD_RELOC_SH_GOTOFF_HI16; + break; + + case BFD_RELOC_SH_GOTPLT32: + *r_type_p = BFD_RELOC_SH_GOTPLT_HI16; + break; + + case BFD_RELOC_32_GOT_PCREL: + *r_type_p = BFD_RELOC_SH_GOT_HI16; + break; + + case BFD_RELOC_32_PLT_PCREL: + *r_type_p = BFD_RELOC_SH_PLT_HI16; + break; + + default: + abort (); + } + break; + + default: + abort (); + } +#else *r_type_p = exp->X_md; +#endif if (exp == main_exp) exp->X_op = O_symbol; else @@ -397,6 +793,12 @@ sh_cons_fix_new (frag, off, size, exp) r_type = BFD_RELOC_32; break; +#ifdef HAVE_SH64 + case 8: + r_type = BFD_RELOC_64; + break; +#endif + default: goto error; } @@ -420,6 +822,16 @@ sh_elf_cons (nbytes) { expressionS exp; +#ifdef HAVE_SH64 + + /* Update existing range to include a previous insn, if there was one. */ + sh64_update_contents_mark (true); + + /* We need to make sure the contents type is set to data. */ + sh64_flag_output (); + +#endif /* HAVE_SH64 */ + if (is_it_end_of_statement ()) { demand_empty_rest_of_line (); @@ -457,6 +869,10 @@ md_begin () target_arch = arch_sh1_up & ~(sh_dsp ? arch_sh3e_up : arch_sh_dsp_up); valid_arch = target_arch; +#ifdef HAVE_SH64 + shmedia_md_begin (); +#endif + opcode_hash_control = hash_new (); /* Insert unique names into hash table. */ @@ -841,20 +1257,6 @@ parse_reg (src, mode, reg) return 0; } -static symbolS * -dot () -{ - const char *fake; - - /* JF: '.' is pseudo symbol with value of current location - in current segment. */ - fake = FAKE_LABEL_NAME; - return symbol_new (fake, - now_seg, - (valueT) frag_now_fix (), - frag_now); -} - static char * parse_exp (s, op) char *s; @@ -1908,6 +2310,26 @@ md_assemble (str) sh_opcode_info *opcode; unsigned int size = 0; +#ifdef HAVE_SH64 + if (sh64_isa_mode == sh64_isa_shmedia) + { + shmedia_md_assemble (str); + return; + } + else + { + /* If we've seen pseudo-directives, make sure any emitted data or + frags are marked as data. */ + if (seen_insn == false) + { + sh64_update_contents_mark (true); + sh64_set_contents_type (CRT_SH5_ISA16); + } + + seen_insn = true; + } +#endif /* HAVE_SH64 */ + opcode = find_cooked_opcode (&str); op_end = str; @@ -2149,6 +2571,21 @@ struct option md_longopts[] = {"little", no_argument, NULL, OPTION_LITTLE}, {"small", no_argument, NULL, OPTION_SMALL}, {"dsp", no_argument, NULL, OPTION_DSP}, +#ifdef HAVE_SH64 +#define OPTION_ISA (OPTION_DSP + 1) +#define OPTION_ABI (OPTION_ISA + 1) +#define OPTION_NO_MIX (OPTION_ABI + 1) +#define OPTION_SHCOMPACT_CONST_CRANGE (OPTION_NO_MIX + 1) +#define OPTION_NO_EXPAND (OPTION_SHCOMPACT_CONST_CRANGE + 1) +#define OPTION_PT32 (OPTION_NO_EXPAND + 1) + {"isa", required_argument, NULL, OPTION_ISA}, + {"abi", required_argument, NULL, OPTION_ABI}, + {"no-mix", no_argument, NULL, OPTION_NO_MIX}, + {"shcompact-const-crange", no_argument, NULL, OPTION_SHCOMPACT_CONST_CRANGE}, + {"no-expand", no_argument, NULL, OPTION_NO_EXPAND}, + {"expand-pt32", no_argument, NULL, OPTION_PT32}, +#endif /* HAVE_SH64 */ + {NULL, no_argument, NULL, 0} }; size_t md_longopts_size = sizeof (md_longopts); @@ -2180,6 +2617,62 @@ md_parse_option (c, arg) sh_dsp = 1; break; +#ifdef HAVE_SH64 + case OPTION_ISA: + if (strcasecmp (arg, "shmedia") == 0) + { + if (sh64_isa_mode == sh64_isa_shcompact) + as_bad (_("Invalid combination: --isa=SHcompact with --isa=SHmedia")); + sh64_isa_mode = sh64_isa_shmedia; + } + else if (strcasecmp (arg, "shcompact") == 0) + { + if (sh64_isa_mode == sh64_isa_shmedia) + as_bad (_("Invalid combination: --isa=SHmedia with --isa=SHcompact")); + if (sh64_abi == sh64_abi_64) + as_bad (_("Invalid combination: --abi=64 with --isa=SHcompact")); + sh64_isa_mode = sh64_isa_shcompact; + } + else + as_bad ("Invalid argument to --isa option: %s", arg); + break; + + case OPTION_ABI: + if (strcmp (arg, "32") == 0) + { + if (sh64_abi == sh64_abi_64) + as_bad (_("Invalid combination: --abi=32 with --abi=64")); + sh64_abi = sh64_abi_32; + } + else if (strcmp (arg, "64") == 0) + { + if (sh64_abi == sh64_abi_32) + as_bad (_("Invalid combination: --abi=64 with --abi=32")); + if (sh64_isa_mode == sh64_isa_shcompact) + as_bad (_("Invalid combination: --isa=SHcompact with --abi=64")); + sh64_abi = sh64_abi_64; + } + else + as_bad ("Invalid argument to --abi option: %s", arg); + break; + + case OPTION_NO_MIX: + sh64_mix = false; + break; + + case OPTION_SHCOMPACT_CONST_CRANGE: + sh64_shcompact_const_crange = true; + break; + + case OPTION_NO_EXPAND: + sh64_expand = false; + break; + + case OPTION_PT32: + sh64_pt32 = true; + break; +#endif /* HAVE_SH64 */ + default: return 0; } @@ -2198,6 +2691,22 @@ SH options:\n\ -relax alter jump instructions for long displacements\n\ -small align sections to 4 byte boundaries, not 16\n\ -dsp enable sh-dsp insns, and disable sh3e / sh4 insns.\n")); +#ifdef HAVE_SH64 + fprintf (stream, _("\ +-isa=[shmedia set default instruction set for SH64\n\ + | SHmedia\n\ + | shcompact\n\ + | SHcompact]\n\ +-abi=[32|64] set size of expanded SHmedia operands and object\n\ + file type\n\ +-shcompact-const-crange emit code-range descriptors for constants in\n\ + SHcompact code sections\n\ +-no-mix disallow SHmedia code in the same section as\n\ + constants and SHcompact code\n\ +-no-expand do not expand MOVI, PT, PTA or PTB instructions\n\ +-expand-pt32 with -abi=64, expand PT, PTA and PTB instructions\n\ + to 32 bits only")); +#endif /* HAVE_SH64 */ } /* This struct is used to pass arguments to sh_count_relocs through @@ -2367,6 +2876,10 @@ sh_frob_section (abfd, sec, ignore) void sh_frob_file () { +#ifdef HAVE_SH64 + shmedia_frob_file_before_adjust (); +#endif + if (! sh_relax) return; @@ -2520,7 +3033,11 @@ md_convert_frag (headers, seg, fragP) break; default: +#ifdef HAVE_SH64 + shmedia_md_convert_frag (headers, seg, fragP, true); +#else abort (); +#endif } if (donerelax && !sh_relax) @@ -2710,6 +3227,9 @@ sh_force_relocation (fix) || fix->fx_r_type == BFD_RELOC_SH_ALIGN || fix->fx_r_type == BFD_RELOC_SH_CODE || fix->fx_r_type == BFD_RELOC_SH_DATA +#ifdef HAVE_SH64 + || fix->fx_r_type == BFD_RELOC_SH_SHMEDIA_CODE +#endif || fix->fx_r_type == BFD_RELOC_SH_LABEL); } @@ -2750,6 +3270,13 @@ sh_elf_final_processing () /* Set file-specific flags to indicate if this code needs a processor with the sh-dsp / sh3e ISA to execute. */ +#ifdef HAVE_SH64 + /* SH5 and above don't know about the valid_arch arch_sh* bits defined + in sh-opc.h, so check SH64 mode before checking valid_arch. */ + if (sh64_isa_mode != sh64_isa_unspecified) + val = EF_SH5; + else +#endif /* HAVE_SH64 */ if (valid_arch & arch_sh1) val = EF_SH1; else if (valid_arch & arch_sh2) @@ -2998,6 +3525,7 @@ md_apply_fix3 (fixP, valP, seg) break; case BFD_RELOC_32_GOT_PCREL: + case BFD_RELOC_SH_GOTPLT32: * valP = 0; /* Fully resolved at runtime. No addend. */ md_number_to_chars (buf, 0, 4); break; @@ -3008,7 +3536,12 @@ md_apply_fix3 (fixP, valP, seg) #endif default: +#ifdef HAVE_SH64 + shmedia_md_apply_fix3 (fixP, valP); + return; +#else abort (); +#endif } if (shift != 0) @@ -3041,7 +3574,12 @@ md_estimate_size_before_relax (fragP, se switch (fragP->fr_subtype) { default: +#ifdef HAVE_SH64 + return shmedia_md_estimate_size_before_relax (fragP, segment_type); +#else abort (); +#endif + case C (UNCOND_JUMP, UNDEF_DISP): /* Used to be a branch to somewhere which was unknown. */ @@ -3110,6 +3648,11 @@ md_number_to_chars (ptr, use, nbytes) valueT use; int nbytes; { +#ifdef HAVE_SH64 + /* We might need to set the contents type to data. */ + sh64_flag_output (); +#endif + if (! target_big_endian) number_to_chars_littleendian (ptr, use, nbytes); else @@ -3355,6 +3898,10 @@ tc_gen_reloc (section, fixp) rel->addend = 0; rel->address = rel->addend = fixp->fx_offset; } +#ifdef HAVE_SH64 + else if (shmedia_init_reloc (rel, fixp)) + ; +#endif else if (fixp->fx_pcrel) rel->addend = fixp->fx_addnumber; else if (r_type == BFD_RELOC_32 || r_type == BFD_RELOC_32_GOTOFF) @@ -3440,6 +3987,8 @@ sh_parse_name (name, exprP, nextcharP) goto no_suffix; else if ((next_end = sh_end_of_match (next + 1, "GOTOFF"))) reloc_type = BFD_RELOC_32_GOTOFF; + else if ((next_end = sh_end_of_match (next + 1, "GOTPLT"))) + reloc_type = BFD_RELOC_SH_GOTPLT32; else if ((next_end = sh_end_of_match (next + 1, "GOT"))) reloc_type = BFD_RELOC_32_GOT_PCREL; else if ((next_end = sh_end_of_match (next + 1, "PLT"))) diff -uprN binutils-2.11.93.0.2/gas/config/tc-sh64.c binutils-2.12.90.0.1/gas/config/tc-sh64.c --- binutils-2.11.93.0.2/gas/config/tc-sh64.c Wed Dec 31 16:00:00 1969 +++ binutils-2.12.90.0.1/gas/config/tc-sh64.c Thu Mar 7 11:52:37 2002 @@ -0,0 +1,3513 @@ +/* tc-sh64.c -- Assemble code for the Hitachi Super-H SHcompact and SHmedia. + Copyright (C) 2000, 2001, 2002 Free Software Foundation. + + This file is part of GAS, the GNU Assembler. + + GAS 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. + + GAS 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 GAS; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* This file defines SHmedia ISA-specific functions and includes tc-sh.c. + The SHcompact ISA is in all useful aspects the "old" sh4 as implemented + in tc-sh.c. Not making this file part of tc-sh.c makes it easier to + keep a leaner sh[1-4]-only implementation. */ + +#define HAVE_SH64 + +#include +#include "as.h" +#include "safe-ctype.h" +#include "opcodes/sh64-opc.h" + +#ifndef OBJ_ELF +#error This file assumes object output is in the ELF format +#endif + +/* Suffix used when we make "datalabel" symbol copies. It must not + collide with anything that can normally appear in a symbol, "faked + symbol" or local symbol. */ +#define DATALABEL_SUFFIX " DL" + +/* See shmedia_md_apply_fix3 and shmedia_md_pcrel_from_section for usage. */ +#define SHMEDIA_MD_PCREL_FROM_FIX(FIXP) \ + ((FIXP)->fx_size + (FIXP)->fx_where + (FIXP)->fx_frag->fr_address - 4) + +/* We use this internally to see which one is PT and which is a PTA/PTB + that should be error-checked. We give it a better name here (but not + one that looks official). Adding it to reloc.c would make it look too + much of a real reloc; it is just used temporarily as a fixup-type. */ +#define SHMEDIA_BFD_RELOC_PT BFD_RELOC_12_PCREL + +typedef struct + { + shmedia_arg_type type; + + /* These could go into a union, but that would uglify the code. */ + int reg; + expressionS immediate; + + /* If IMMEDIATE was a shift-expression, like "(S >> N) & 65535", where + N = 0, 16, 32, 48, used to extract a certain 16-bit-field to make up + a MOVI or SHORI relocation for a symbol, then we put the + corresponding reloc-type here and modify the "immediate" expression + to S. Otherwise, this is just BFD_RELOC_NONE. */ + bfd_reloc_code_real_type reloctype; + } shmedia_operand_info; + +/* Frag containing last base instruction. This is put in the TC field in + a frag, so we can emit fixups for fr_opcode without needing to make + sure that the opcode is in the same frag as any variant operand. */ +fragS *sh64_last_insn_frag = NULL; + +typedef struct + { + shmedia_operand_info operands[3]; + unsigned long ops_val; + } shmedia_operands_info; + +enum sh64_abi_values + { sh64_abi_unspecified, sh64_abi_32, sh64_abi_64 }; + +/* What ISA are we assembling code for? */ +enum sh64_isa_values sh64_isa_mode = sh64_isa_unspecified; + +/* What ABI was specified, if any (implicitly or explicitly)? */ +static enum sh64_abi_values sh64_abi = sh64_abi_unspecified; + +/* A note that says if we're in a sequence of insns without label + settings, segment or ISA mode changes or emitted data. */ +static boolean seen_insn = false; + +/* This is set to true in shmedia_md_end, so that we don't emit any + .cranges entries when the assembler calls output functions while + grinding along after all input is seen. */ +static boolean sh64_end_of_assembly = false; + +/* Controlled by the option -no-mix, this invalidates mixing SHcompact and + SHmedia code in the same section, and also invalidates mixing data and + SHmedia code in the same section. No .cranges will therefore be + emitted, unless -shcompact-const-crange is specified and there is a + constant pool in SHcompact code. */ +static boolean sh64_mix = true; + +static boolean sh64_shcompact_const_crange = false; + +/* Controlled by the option -no-expand, this says whether or not we expand + MOVI and PT/PTA/PTB. When we do not expand these insns to fit an + operand, we will emit errors for operands out of range and generate the + basic instruction and reloc for an external symbol. */ +static boolean sh64_expand = true; + +/* Controlled by the option -expand-pt32, this says whether we expand + PT/PTA/PTB of an external symbol to (only) 32 or (the full) 64 bits + when -abi=64 is in effect. */ +static boolean sh64_pt32 = false; + +/* When emitting a .cranges descriptor, we want to avoid getting recursive + calls through emit_expr. */ +static boolean emitting_crange = false; + +/* SHmedia mnemonics. */ +static struct hash_control *shmedia_opcode_hash_control = NULL; + +static const unsigned char shmedia_big_nop_pattern[4] = + { + (SHMEDIA_NOP_OPC >> 24) & 255, (SHMEDIA_NOP_OPC >> 16) & 255, + (SHMEDIA_NOP_OPC >> 8) & 255, SHMEDIA_NOP_OPC & 255 + }; + +static const unsigned char shmedia_little_nop_pattern[4] = + { + SHMEDIA_NOP_OPC & 255, (SHMEDIA_NOP_OPC >> 8) & 255, + (SHMEDIA_NOP_OPC >> 16) & 255, (SHMEDIA_NOP_OPC >> 24) & 255 + }; + +static void shmedia_md_begin PARAMS ((void)); +static int shmedia_parse_reg PARAMS ((char *, int *, int *, shmedia_arg_type)); +static void shmedia_md_assemble PARAMS ((char *)); +static void shmedia_md_apply_fix3 PARAMS ((fixS *, valueT *)); +static int shmedia_md_estimate_size_before_relax PARAMS ((fragS *, segT)); +static int shmedia_init_reloc PARAMS ((arelent *, fixS *)); +static char *shmedia_get_operands PARAMS ((shmedia_opcode_info *, char *, shmedia_operands_info *)); +static void s_sh64_mode PARAMS ((int)); +static void s_sh64_abi PARAMS ((int)); +static void shmedia_md_convert_frag PARAMS ((bfd *, segT, fragS *, boolean)); +static void shmedia_check_limits PARAMS ((offsetT *, bfd_reloc_code_real_type, fixS *)); +static void sh64_set_contents_type PARAMS ((enum sh64_elf_cr_type)); +static void shmedia_get_operand PARAMS ((char **, shmedia_operand_info *, shmedia_arg_type)); +static unsigned long shmedia_immediate_op PARAMS ((char *, shmedia_operand_info *, int, bfd_reloc_code_real_type)); +static char *shmedia_parse_exp PARAMS ((char *, shmedia_operand_info *)); +static void shmedia_frob_file_before_adjust PARAMS ((void)); +static void sh64_emit_crange PARAMS ((symbolS *, symbolS *, enum sh64_elf_cr_type)); +static void sh64_flush_last_crange PARAMS ((bfd *, asection *, PTR)); +static void sh64_flag_output PARAMS ((void)); +static void sh64_update_contents_mark PARAMS ((boolean)); +static void sh64_vtable_entry PARAMS ((int)); +static void sh64_vtable_inherit PARAMS ((int)); +static char * strip_datalabels PARAMS ((void)); +static int shmedia_build_Mytes PARAMS ((shmedia_opcode_info *, shmedia_operands_info *)); +static shmedia_opcode_info * shmedia_find_cooked_opcode PARAMS ((char **)); +static unsigned long shmedia_mask_number PARAMS ((unsigned long, bfd_reloc_code_real_type)); + +#include "tc-sh.c" + +void +shmedia_md_end () +{ + symbolS *symp; + + /* First, update the last range to include whatever data was last + emitted. */ + sh64_update_contents_mark (true); + + /* Make sure frags generated after this point are not marked with the + wrong ISA; make them easily spottable. We still want to distinguish + it from sh64_isa_unspecified when we compile for SHcompact or + SHmedia. */ + if (sh64_isa_mode != sh64_isa_unspecified) + sh64_isa_mode = sh64_isa_sh5_guard; + + sh64_end_of_assembly = true; + + bfd_map_over_sections (stdoutput, sh64_flush_last_crange, NULL); + + /* Iterate over segments and emit the last .cranges descriptor. */ + for (symp = symbol_rootP; symp != NULL; symp = symp->sy_next) + { + symbolS *mainsym = *symbol_get_tc (symp); + + /* Is this a datalabel symbol; does it have a pointer to the main + symbol? */ + if (mainsym != NULL) + { + /* If the datalabel symbol is undefined, check if the main + symbol has changed in that respect. */ + if (S_GET_SEGMENT (symp) == undefined_section) + { + segT symseg; + + symseg = S_GET_SEGMENT (mainsym); + + /* If the symbol is now defined to something that is not + global and without STO_SH5_ISA32, we just equate the + datalabel symbol to the main symbol, and the lack of + STO_SH5_ISA32 will handle the datalabelness. */ + if (symseg != undefined_section) + { + if (S_GET_OTHER (mainsym) != STO_SH5_ISA32) + { + symp->sy_value.X_op = O_symbol; + symp->sy_value.X_add_symbol = mainsym; + symp->sy_value.X_op_symbol = NULL; + symp->sy_value.X_add_number = 0; + S_SET_SEGMENT (symp, S_GET_SEGMENT (mainsym)); + symbol_set_frag (symp, &zero_address_frag); + copy_symbol_attributes (symp, mainsym); + } + else + { + /* An undefined symbol has since we saw it at + "datalabel", been defined to a BranchTarget + symbol. What we need to do here is very similar + to when we find the "datalabel" for a defined + symbol. FIXME: Break out to common function. */ + symbol_set_value_expression (symp, + symbol_get_value_expression + (mainsym)); + S_SET_SEGMENT (symp, symseg); + symbol_set_frag (symp, symbol_get_frag (mainsym)); + copy_symbol_attributes (symp, mainsym); + + /* Unset the BranchTarget mark that can be set at + attribute-copying. */ + S_SET_OTHER (symp, + S_GET_OTHER (symp) & ~STO_SH5_ISA32); + + /* The GLOBAL and WEAK attributes are not copied + over by copy_symbol_attributes. Do it here. */ + if (S_IS_WEAK (mainsym)) + S_SET_WEAK (symp); + else if (S_IS_EXTERNAL (mainsym)) + S_SET_EXTERNAL (symp); + } + } + else + { + /* A symbol that was defined at the time we saw + "datalabel" can since have been attributed with being + weak or global. */ + if (S_IS_WEAK (mainsym)) + S_SET_WEAK (symp); + else if (S_IS_EXTERNAL (mainsym)) + S_SET_EXTERNAL (symp); + } + } + } + } + + for (symp = symbol_rootP; symp != NULL; symp = symp->sy_next) + if (S_GET_OTHER (symp) & STO_SH5_ISA32) + symp->sy_value.X_add_number++; +} + +/* When resolving symbols, the main assembler has done us a misfavour. It + has removed the equation to the main symbol for a datalabel reference + that should be equal to the main symbol, e.g. when it's a global or + weak symbol and is a non-BranchTarget symbol anyway. We change that + back, so that relocs are against the main symbol, not the local "section + + offset" value. */ + +static void +shmedia_frob_file_before_adjust () +{ + symbolS *symp; + for (symp = symbol_rootP; symp != NULL; symp = symp->sy_next) + { + symbolS *mainsym = *symbol_get_tc (symp); + + if (mainsym != NULL + && S_GET_OTHER (mainsym) != STO_SH5_ISA32 + && (S_IS_EXTERN (mainsym) || S_IS_WEAK (mainsym))) + { + symp->sy_value.X_op = O_symbol; + symp->sy_value.X_add_symbol = mainsym; + symp->sy_value.X_op_symbol = NULL; + symp->sy_value.X_add_number = 0; + + /* For the "equation trick" to work, we have to set the section + to undefined. */ + S_SET_SEGMENT (symp, undefined_section); + symbol_set_frag (symp, &zero_address_frag); + copy_symbol_attributes (symp, mainsym); + + /* Don't forget to remove the STO_SH5_ISA32 attribute after + copying the other attributes. */ + S_SET_OTHER (symp, S_GET_OTHER (symp) & ~STO_SH5_ISA32); + } + } +} + +/* We need to mark the current location after the alignment. This is + copied code the caller, do_align. We mark the frag location before and + after as we need and arrange to skip the same code in do_align. + + An alternative to code duplication is to call the do_align recursively, + arranging to fall through into do_align if we're already here. That + would require do_align as an incoming function parameter, since it's + static in read.c. That solution was discarded a too kludgy. */ + +void +sh64_do_align (n, fill, len, max) + int n; + const char *fill; + int len; + int max; +{ + /* Update region, or put a data region in front. */ + sh64_update_contents_mark (true); + + /* Only make a frag if we HAVE to... */ + if (n != 0 && !need_pass_2) + { + if (fill == NULL) + { + if (subseg_text_p (now_seg)) + frag_align_code (n, max); + else + frag_align (n, 0, max); + } + else if (len <= 1) + frag_align (n, *fill, max); + else + frag_align_pattern (n, fill, len, max); + } + + /* Update mark for current region with current type. */ + sh64_update_contents_mark (false); +} + +/* The MAX_MEM_FOR_RS_ALIGN_CODE worker. We have to find out the ISA of + the current segment at this position. We can't look just at + sh64_isa_shmedia, and we can't look at frag_now. This is brittle: + callers are currently frag_align_code from subsegs_finish in write.c + (end of assembly) and frag_align_code from do_align in read.c (during + assembly). */ + +int +sh64_max_mem_for_rs_align_code () +{ + segment_info_type *seginfo; + fragS *mode_start_frag; + seginfo = seg_info (now_seg); + + /* We don't use the contents type we find at the tc_segment_info_data, + since that does not give us absolute information about the ISA; the + contents type can presumably be CRT_DATA and we'd be none the wiser. + Instead we use the information stored at the frag of the symbol at + the start of this range. If any information is missing or NULL, + assume SHcompact. */ + return + /* If the current ISA mode is SHmedia, that's the mode that we're + going to assign to the new frag, so request enough memory for + it, even if we switch modes afterwards, otherwise we may + allocate too little memory and end up overflowing our buffer. */ + (sh64_isa_mode == sh64_isa_shmedia + || (sh64_isa_mode != sh64_isa_unspecified + && seginfo != NULL + && seginfo->tc_segment_info_data.mode_start_symbol != NULL + && ((mode_start_frag + = (symbol_get_frag + (seginfo->tc_segment_info_data.mode_start_symbol))) + != NULL) + && mode_start_frag->tc_frag_data.isa == sh64_isa_shmedia)) + ? (3 + 4) : (2 + 1); +} + +/* Put in SHmedia NOP:s if the alignment was created when in SHmedia mode. */ + +void +sh64_handle_align (frag) + fragS * frag; +{ + int bytes = frag->fr_next->fr_address - frag->fr_address - frag->fr_fix; + char * p = frag->fr_literal + frag->fr_fix; + + if (frag->tc_frag_data.isa == sh64_isa_shmedia + && frag->fr_type == rs_align_code) + { + while (bytes & 3) + { + *p++ = 0; + bytes--; + frag->fr_fix += 1; + } + + if (target_big_endian) + { + memcpy (p, shmedia_big_nop_pattern, + sizeof shmedia_big_nop_pattern); + frag->fr_var = sizeof shmedia_big_nop_pattern; + } + else + { + memcpy (p, shmedia_little_nop_pattern, + sizeof shmedia_little_nop_pattern); + frag->fr_var = sizeof shmedia_little_nop_pattern; + } + } + else + /* Punt to SHcompact function. */ + sh_handle_align (frag); +} + +/* Set SEC_SH64_ISA32 for SHmedia sections. */ + +void +shmedia_frob_section_type (sec) + asection *sec; +{ + segment_info_type *seginfo; + seginfo = seg_info (sec); + + /* This and elf32-sh64.c:sh64_elf_fake_sections are the only places + where we use anything else than ELF header flags to communicate the + section as containing SHmedia or other contents. BFD SEC_* section + flags are running out and should not be overloaded with + target-specific semantics. This target is ELF only (semantics not + defined for other formats), so we use the target-specific pointer + field of the ELF section data. */ + if (seginfo) + { + struct sh64_section_data *sec_elf_data; + flagword sec_type = 0; + + if (seginfo->tc_segment_info_data.emitted_ranges != 0) + sec_type = SHF_SH5_ISA32_MIXED; + else if (seginfo->tc_segment_info_data.contents_type == CRT_SH5_ISA32) + sec_type = SHF_SH5_ISA32; + + sec_elf_data = sh64_elf_section_data (sec); + if (sec_elf_data == NULL) + { + sec_elf_data = xcalloc (1, sizeof (*sec_elf_data)); + sh64_elf_section_data (sec) = sec_elf_data; + } + + sec_elf_data->contents_flags = sec_type; + } +} + +/* This function is called by write_object_file right before the symbol + table is written. We subtract 1 from all symbols marked STO_SH5_ISA32, + as their values are temporarily incremented in shmedia_md_end, before + symbols values are used by relocs and fixups. + + To increment all symbols and then decrement here is admittedly a + hackish solution. The alternative is to add infrastructure and hooks + to symbol evaluation that evaluates symbols differently internally to + the value output into the object file, but at the moment that just + seems too much for little benefit. */ + +void +sh64_adjust_symtab () +{ + symbolS *symp; + + for (symp = symbol_rootP; symp; symp = symbol_next (symp)) + { + symbolS *main_symbol = *symbol_get_tc (symp); + + if (main_symbol) + { + char *sym_name = (char *) S_GET_NAME (symp); + + /* All datalabels not used in relocs should be gone by now. + + We change those remaining to have the name of the main + symbol, and we set the ELF type of the symbol of the reloc to + STT_DATALABEL. */ + sym_name[strlen (sym_name) - strlen (DATALABEL_SUFFIX)] = 0; + elf_symbol (symbol_get_bfdsym (symp))->internal_elf_sym.st_info + = STT_DATALABEL; + + /* Also set this symbol to "undefined", so we'll have only one + definition. */ + S_SET_SEGMENT (symp, undefined_section); + } + else if (S_GET_OTHER (symp) & STO_SH5_ISA32) + { + /* It's important to change the BFD symbol value, since it is now + set to the GAS symbolS value. */ + symp->bsym->value--; + + /* Note that we do *not* adjust symp->sy_value.X_add_number. If + you do this, the test case in sh/sh64/immexpr2.s will fail. + This is because *after* symbols have been output but before + relocs are output, fixups are inspected one more time, and + some leftover expressions are resolved. To resolve to the + same values, those expressions must have the same GAS symbol + values before as after symbols have been output. We could + "symp->sy_value.X_add_number++" on the STO_SH5_ISA32 symbols + through tc_frob_file after symbols have been output, but that + would be too gross. */ + } + } +} + +/* Fill-in an allocated arelent. */ + +static int +shmedia_init_reloc (rel, fixP) + arelent *rel; + fixS *fixP; +{ + /* Adjust parts of *relp according to *fixp, and tell that it has been + done, so default initializations will not happen. */ + switch (fixP->fx_r_type) + { + case BFD_RELOC_64: + case BFD_RELOC_64_PCREL: + case BFD_RELOC_SH_IMM_LOW16: + case BFD_RELOC_SH_IMM_MEDLOW16: + case BFD_RELOC_SH_IMM_MEDHI16: + case BFD_RELOC_SH_IMM_HI16: + case BFD_RELOC_SH_IMM_LOW16_PCREL: + case BFD_RELOC_SH_IMM_MEDLOW16_PCREL: + case BFD_RELOC_SH_IMM_MEDHI16_PCREL: + case BFD_RELOC_SH_IMM_HI16_PCREL: + case BFD_RELOC_SH_IMMU5: + case BFD_RELOC_SH_IMMU6: + case BFD_RELOC_SH_IMMS6: + case BFD_RELOC_SH_IMMS10: + case BFD_RELOC_SH_IMMS10BY2: + case BFD_RELOC_SH_IMMS10BY4: + case BFD_RELOC_SH_IMMS10BY8: + case BFD_RELOC_SH_IMMS16: + case BFD_RELOC_SH_IMMU16: + case BFD_RELOC_SH_PT_16: + case BFD_RELOC_SH_GOT_LOW16: + case BFD_RELOC_SH_GOT_MEDLOW16: + case BFD_RELOC_SH_GOT_MEDHI16: + case BFD_RELOC_SH_GOT_HI16: + case BFD_RELOC_SH_GOT10BY4: + case BFD_RELOC_SH_GOT10BY8: + case BFD_RELOC_SH_GOTPLT_LOW16: + case BFD_RELOC_SH_GOTPLT_MEDLOW16: + case BFD_RELOC_SH_GOTPLT_MEDHI16: + case BFD_RELOC_SH_GOTPLT_HI16: + case BFD_RELOC_SH_GOTPLT10BY4: + case BFD_RELOC_SH_GOTPLT10BY8: + case BFD_RELOC_SH_GOTOFF_LOW16: + case BFD_RELOC_SH_GOTOFF_MEDLOW16: + case BFD_RELOC_SH_GOTOFF_MEDHI16: + case BFD_RELOC_SH_GOTOFF_HI16: + case BFD_RELOC_SH_GOTPC_LOW16: + case BFD_RELOC_SH_GOTPC_MEDLOW16: + case BFD_RELOC_SH_GOTPC_MEDHI16: + case BFD_RELOC_SH_GOTPC_HI16: + case BFD_RELOC_SH_PLT_LOW16: + case BFD_RELOC_SH_PLT_MEDLOW16: + case BFD_RELOC_SH_PLT_MEDHI16: + case BFD_RELOC_SH_PLT_HI16: + rel->addend = fixP->fx_addnumber + fixP->fx_offset; + return 1; + + case BFD_RELOC_SH_IMMS6BY32: + /* This must be resolved in assembly; we do not support it as a + reloc in an object file. */ + as_bad_where (fixP->fx_file, fixP->fx_line, + _("This operand must be constant at assembly time")); + break; + + /* There are valid cases where we get here for other than SHmedia + relocs, so don't make a BAD_CASE out of this. */ + default: + ; + } + + return 0; +} + +/* Hook called from md_apply_fix3 in tc-sh.c. */ + +static void +shmedia_md_apply_fix3 (fixP, valp) + fixS *fixP; + valueT *valp; +{ + offsetT val = *valp; + char *buf = fixP->fx_where + fixP->fx_frag->fr_literal; + unsigned long insn + = target_big_endian ? bfd_getb32 (buf) : bfd_getl32 (buf); + bfd_reloc_code_real_type orig_fx_r_type = fixP->fx_r_type; + + /* Change a 64-bit pc-relative reloc into the correct type, just like + tc-sh.c:md_apply_fix. */ + if (fixP->fx_pcrel) + { + switch (orig_fx_r_type) + { + case BFD_RELOC_64: + case BFD_RELOC_SH_IMM_LOW16: + case BFD_RELOC_SH_IMM_MEDLOW16: + case BFD_RELOC_SH_IMM_MEDHI16: + case BFD_RELOC_SH_IMM_HI16: + /* Because write.c calls MD_PCREL_FROM_SECTION twice, we need to + undo one of the adjustments, if the relocation is not + actually for a symbol within the same segment (which we + cannot check, because we're not called from md_apply_fix3, so + we have to keep the reloc). FIXME: This is a bug in + write.c:fixup_segment affecting most targets that change + ordinary relocs to pcrel relocs in md_apply_fix. */ + fixP->fx_offset + = *valp + SHMEDIA_MD_PCREL_FROM_FIX (fixP); + break; + + case BFD_RELOC_SH_PLT_LOW16: + case BFD_RELOC_SH_PLT_MEDLOW16: + case BFD_RELOC_SH_PLT_MEDHI16: + case BFD_RELOC_SH_PLT_HI16: + case BFD_RELOC_SH_GOTPC_LOW16: + case BFD_RELOC_SH_GOTPC_MEDLOW16: + case BFD_RELOC_SH_GOTPC_MEDHI16: + case BFD_RELOC_SH_GOTPC_HI16: + *valp = 0; + return; + + default: + ; + } + + /* We might need to change some relocs into the corresponding + PC-relative one. */ + switch (orig_fx_r_type) + { + case BFD_RELOC_64: + fixP->fx_r_type = BFD_RELOC_64_PCREL; + break; + + case BFD_RELOC_SH_IMM_LOW16: + fixP->fx_r_type = BFD_RELOC_SH_IMM_LOW16_PCREL; + break; + + case BFD_RELOC_SH_IMM_MEDLOW16: + fixP->fx_r_type = BFD_RELOC_SH_IMM_MEDLOW16_PCREL; + break; + + case BFD_RELOC_SH_IMM_MEDHI16: + fixP->fx_r_type = BFD_RELOC_SH_IMM_MEDHI16_PCREL; + break; + + case BFD_RELOC_SH_IMM_HI16: + fixP->fx_r_type = BFD_RELOC_SH_IMM_HI16_PCREL; + break; + + case SHMEDIA_BFD_RELOC_PT: + /* This is how we see a difference between PT and PTA when not + expanding (in which case we handle it in + shmedia_md_convert_frag). Note that we don't see a + difference after the reloc is emitted. */ + fixP->fx_r_type = BFD_RELOC_SH_PT_16; + break; + + case BFD_RELOC_SH_PT_16: + /* This tells us there was a PTA or PTB insn explicitly + expressed as such (not as PT). We "or" in a 1 into the + lowest bit in the (unused) destination field to tell the + linker that it should check the right ISA type of the + destination and not just change a PTA to PTB (if necessary). */ + md_number_to_chars (buf, insn | (1 << 10), 4); + break; + + case BFD_RELOC_64_PCREL: + case BFD_RELOC_SH_IMM_LOW16_PCREL: + case BFD_RELOC_SH_IMM_MEDLOW16_PCREL: + case BFD_RELOC_SH_IMM_MEDHI16_PCREL: + case BFD_RELOC_SH_IMM_HI16_PCREL: + /* Already handled. */ + break; + + default: + /* Everything else that changes into a pc-relative relocation is + an error. */ + as_bad_where (fixP->fx_file, fixP->fx_line, + _("Invalid operand expression")); + break; + } + + return; + } + + /* If an expression looked like it was PC-relative, but was completely + resolvable, we end up here with the result only in *VALP, and no + relocation will be emitted. */ + if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0) + { + /* Emit error for an out-of-range value. */ + shmedia_check_limits (valp, fixP->fx_r_type, fixP); + + switch (fixP->fx_r_type) + { + case BFD_RELOC_SH_IMM_LOW16: + md_number_to_chars (buf, insn | ((val & 65535) << 10), 4); + break; + + case BFD_RELOC_SH_IMM_MEDLOW16: + md_number_to_chars (buf, + insn + | ((valueT) (val & ((valueT) 65535 << 16)) + >> (16 - 10)), 4); + break; + + case BFD_RELOC_SH_IMM_MEDHI16: + md_number_to_chars (buf, + insn + | ((valueT) (val & ((valueT) 65535 << 32)) + >> (32 - 10)), 4); + break; + + case BFD_RELOC_SH_IMM_HI16: + md_number_to_chars (buf, + insn + | ((valueT) (val & ((valueT) 65535 << 48)) + >> (48 - 10)), 4); + break; + + case BFD_RELOC_SH_IMMS16: + case BFD_RELOC_SH_IMMU16: + md_number_to_chars (buf, insn | ((val & 65535) << 10), 4); + break; + + case BFD_RELOC_SH_IMMS10: + md_number_to_chars (buf, insn | ((val & 0x3ff) << 10), 4); + break; + + case BFD_RELOC_SH_IMMS10BY2: + md_number_to_chars (buf, + insn | ((val & (0x3ff << 1)) << (10 - 1)), 4); + break; + + case BFD_RELOC_SH_IMMS10BY4: + md_number_to_chars (buf, + insn | ((val & (0x3ff << 2)) << (10 - 2)), 4); + break; + + case BFD_RELOC_SH_SHMEDIA_CODE: + /* We just ignore and remove this one for the moment. FIXME: + Use it when implementing relaxing. */ + break; + + case BFD_RELOC_64: + md_number_to_chars (buf, val, 8); + break; + + case SHMEDIA_BFD_RELOC_PT: + /* Change a PT to PTB if the operand turned out to be SHcompact. + The basic opcode specified with PT is equivalent to PTA. */ + if ((val & 1) == 0) + insn |= SHMEDIA_PTB_BIT; + /* Fall through. */ + + case BFD_RELOC_SH_PT_16: + if (! sh64_expand || sh_relax) + { + /* Check if the operand of a PTA or PTB was for the "wrong" + ISA. A PT had an incoming fixup of SHMEDIA_BFD_RELOC_PT, + which we have changed to the right type above. */ + if (orig_fx_r_type != SHMEDIA_BFD_RELOC_PT) + { + if ((insn & SHMEDIA_PTB_BIT) != 0 && (val & 1) != 0) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("PTB operand is a SHmedia symbol")); + else if ((insn & SHMEDIA_PTB_BIT) == 0 && (val & 1) == 0) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("PTA operand is a SHcompact symbol")); + } + + md_number_to_chars (buf, + insn | ((val & (0xffff << 2)) + << (10 - 2)), + 4); + break; + } + /* Fall through. */ + + default: + /* This isn't a BAD_CASE, because presumably we can get here + from unexpected operands. Since we don't handle them, make + them syntax errors. */ + as_bad_where (fixP->fx_file, fixP->fx_line, + _("invalid expression in operand")); + } + fixP->fx_done = 1; + } +} + +/* Hook called from md_convert_frag in tc-sh.c. */ + +static void +shmedia_md_convert_frag (output_bfd, seg, fragP, final) + bfd *output_bfd ATTRIBUTE_UNUSED; + segT seg ATTRIBUTE_UNUSED; + fragS *fragP; + boolean final; +{ + /* Pointer to first byte in variable-sized part of the frag. */ + char *var_partp; + + /* Pointer to first opcode byte in frag. */ + char *opcodep; + + /* Pointer to frag of opcode. */ + fragS *opc_fragP = fragP->tc_frag_data.opc_frag; + + /* Size in bytes of variable-sized part of frag. */ + int var_part_size = 0; + + /* This is part of *fragP. It contains all information about addresses + and offsets to varying parts. */ + symbolS *symbolP = fragP->fr_symbol; + + boolean reloc_needed + = (! final + || sh_relax + || symbolP == NULL + || ! S_IS_DEFINED (symbolP) + || S_IS_EXTERN (symbolP) + || S_IS_WEAK (symbolP) + || (S_GET_SEGMENT (fragP->fr_symbol) != absolute_section + && S_GET_SEGMENT (fragP->fr_symbol) != seg)); + + bfd_reloc_code_real_type reloctype = BFD_RELOC_NONE; + + unsigned long var_part_offset; + + /* Where, in file space, does addr point? */ + bfd_vma target_address; + bfd_vma opcode_address; + + /* What was the insn? */ + unsigned long insn; + know (fragP->fr_type == rs_machine_dependent); + + var_part_offset = fragP->fr_fix; + var_partp = fragP->fr_literal + var_part_offset; + opcodep = fragP->fr_opcode; + + insn = target_big_endian ? bfd_getb32 (opcodep) : bfd_getl32 (opcodep); + + target_address + = ((symbolP && final && ! sh_relax ? S_GET_VALUE (symbolP) : 0) + + fragP->fr_offset); + + /* The opcode that would be extended is the last four "fixed" bytes. */ + opcode_address = fragP->fr_address + fragP->fr_fix - 4; + + switch (fragP->fr_subtype) + { + case C (SH64PCREL16PT_64, SH64PCREL16): + case C (SH64PCREL16PT_32, SH64PCREL16): + /* We can get a PT to a relaxed SHcompact address if it is in the + same section; a mixed-ISA section. Change the opcode to PTB if + so. */ + if ((target_address & 1) == 0) + insn |= SHMEDIA_PTB_BIT; + /* Fall through. */ + + case C (SH64PCREL16_32, SH64PCREL16): + case C (SH64PCREL16_64, SH64PCREL16): + /* Check that a PTA or PTB points to the right type of target. We + can get here for a SHcompact target if we are in a mixed-ISA + section. */ + if (((target_address & 1) == 0) && ((insn & SHMEDIA_PTB_BIT) == 0)) + as_bad_where (fragP->fr_file, fragP->fr_line, + _("PTA operand is a SHcompact symbol")); + if (((target_address & 1) != 0) && ((insn & SHMEDIA_PTB_BIT) != 0)) + as_bad_where (fragP->fr_file, fragP->fr_line, + _("PTB operand is a SHmedia symbol")); + + /* When relaxing, we do not output the address in the insn, but + instead a 1 into the low bit. This matches what the linker + expects to find for a BFD_RELOC_SH_PT_16 reloc, when it checks + correctness for PTA/PTB insn; used when the target address is + unknown (which is not the case here). */ + md_number_to_chars (opcodep, + insn + | (((sh_relax + ? 1 : ((target_address - opcode_address) / 4)) + & ((1 << 16) - 1)) << 10), + 4); + + /* Note that we do not emit info that this was originally a PT since + we have resolved to which one of PTA or PTB it will be. */ + if (sh_relax) + fix_new (opc_fragP, opcodep - opc_fragP->fr_literal, 4, + fragP->fr_symbol, fragP->fr_offset, 1, BFD_RELOC_SH_PT_16); + var_part_size = 0; + break; + + case C (SH64PCREL16_32, SH64PCRELPLT): + case C (SH64PCREL16PT_32, SH64PCRELPLT): + reloctype = BFD_RELOC_32_PLT_PCREL; + reloc_needed = 1; + /* Fall through */ + + case C (SH64PCREL16_32, SH64PCREL32): + case C (SH64PCREL16_64, SH64PCREL32): + case C (SH64PCREL16PT_32, SH64PCREL32): + case C (SH64PCREL16PT_64, SH64PCREL32): + /* In the fixed bit, put in a MOVI. */ + md_number_to_chars (opcodep, + SHMEDIA_MOVI_OPC + | (SHMEDIA_TEMP_REG << 4) + | ((((reloc_needed + ? 0 : (target_address - (opcode_address + 8)) + ) >> 16) & 65535) << 10), + 4); + + /* Fill in a SHORI for the low part. */ + md_number_to_chars (var_partp, + SHMEDIA_SHORI_OPC + | (SHMEDIA_TEMP_REG << 4) + | (((reloc_needed + ? 0 : (target_address - (opcode_address + 8))) + & 65535) << 10), + 4); + + /* End with a "PTREL R25,TRd". */ + md_number_to_chars (var_partp + 4, + SHMEDIA_PTREL_OPC | (insn & SHMEDIA_LIKELY_BIT) + | (SHMEDIA_TEMP_REG << 10) + | (insn & (7 << 4)), + 4); + + /* We need relocs only if the target symbol was undefined or if + we're relaxing. */ + if (reloc_needed) + { + fix_new (opc_fragP, opcodep - opc_fragP->fr_literal, 4, + fragP->fr_symbol, fragP->fr_offset - 8, 1, + reloctype == BFD_RELOC_32_PLT_PCREL + ? BFD_RELOC_SH_PLT_MEDLOW16 + : BFD_RELOC_SH_IMM_MEDLOW16_PCREL); + fix_new (fragP, var_partp - fragP->fr_literal, 4, fragP->fr_symbol, + fragP->fr_offset - 4, 1, + reloctype == BFD_RELOC_32_PLT_PCREL + ? BFD_RELOC_SH_PLT_LOW16 + : BFD_RELOC_SH_IMM_LOW16_PCREL); + } + + var_part_size = 8; + break; + + case C (SH64PCREL16_64, SH64PCREL48): + case C (SH64PCREL16PT_64, SH64PCREL48): + /* In the fixed bit, put in a MOVI. */ + md_number_to_chars (opcodep, + SHMEDIA_MOVI_OPC + | (SHMEDIA_TEMP_REG << 4) + | ((((reloc_needed + ? 0 : (target_address - (opcode_address + 12)) + ) >> 32) & 65535) << 10), + 4); + + /* The first SHORI, for the medium part. */ + md_number_to_chars (var_partp, + SHMEDIA_SHORI_OPC + | (SHMEDIA_TEMP_REG << 4) + | ((((reloc_needed + ? 0 : (target_address - (opcode_address + 12)) + ) >> 16) & 65535) << 10), + 4); + + /* Fill in a SHORI for the low part. */ + md_number_to_chars (var_partp + 4, + SHMEDIA_SHORI_OPC + | (SHMEDIA_TEMP_REG << 4) + | (((reloc_needed + ? 0 : (target_address - (opcode_address + 12))) + & 65535) << 10), + 4); + + /* End with a "PTREL R25,TRd". */ + md_number_to_chars (var_partp + 8, + SHMEDIA_PTREL_OPC | (insn & SHMEDIA_LIKELY_BIT) + | (SHMEDIA_TEMP_REG << 10) + | (insn & (7 << 4)), + 4); + + /* We need relocs only if the target symbol was undefined or if + we're relaxing. */ + if (reloc_needed) + { + fix_new (opc_fragP, opcodep - opc_fragP->fr_literal, 4, + fragP->fr_symbol, fragP->fr_offset - 12, 1, + reloctype == BFD_RELOC_32_PLT_PCREL + ? BFD_RELOC_SH_PLT_MEDHI16 + : BFD_RELOC_SH_IMM_MEDHI16_PCREL); + fix_new (fragP, var_partp - fragP->fr_literal, 4, fragP->fr_symbol, + fragP->fr_offset - 8, 1, + reloctype == BFD_RELOC_32_PLT_PCREL + ? BFD_RELOC_SH_PLT_MEDLOW16 + : BFD_RELOC_SH_IMM_MEDLOW16_PCREL); + fix_new (fragP, var_partp - fragP->fr_literal + 4, 4, fragP->fr_symbol, + fragP->fr_offset - 4, 1, + reloctype == BFD_RELOC_32_PLT_PCREL + ? BFD_RELOC_SH_PLT_LOW16 + : BFD_RELOC_SH_IMM_LOW16_PCREL); + } + + var_part_size = 12; + break; + + case C (SH64PCREL16_64, SH64PCRELPLT): + case C (SH64PCREL16PT_64, SH64PCRELPLT): + reloctype = BFD_RELOC_32_PLT_PCREL; + reloc_needed = 1; + /* Fall through */ + + case C (SH64PCREL16_64, SH64PCREL64): + case C (SH64PCREL16PT_64, SH64PCREL64): + /* In the fixed bit, put in a MOVI. */ + md_number_to_chars (opcodep, + SHMEDIA_MOVI_OPC + | (SHMEDIA_TEMP_REG << 4) + | ((((reloc_needed + ? 0 : (target_address - (opcode_address + 16)) + ) >> 48) & 65535) << 10), + 4); + + /* The first SHORI, for the medium-high part. */ + md_number_to_chars (var_partp, + SHMEDIA_SHORI_OPC + | (SHMEDIA_TEMP_REG << 4) + | ((((reloc_needed + ? 0 : (target_address - (opcode_address + 16)) + ) >> 32) & 65535) << 10), + 4); + + /* A SHORI, for the medium-low part. */ + md_number_to_chars (var_partp + 4, + SHMEDIA_SHORI_OPC + | (SHMEDIA_TEMP_REG << 4) + | ((((reloc_needed + ? 0 : (target_address - (opcode_address + 16)) + ) >> 16) & 65535) << 10), + 4); + + /* Fill in a SHORI for the low part. */ + md_number_to_chars (var_partp + 8, + SHMEDIA_SHORI_OPC + | (SHMEDIA_TEMP_REG << 4) + | (((reloc_needed + ? 0 : (target_address - (opcode_address + 16))) + & 65535) << 10), + 4); + + /* End with a "PTREL R25,TRd". */ + md_number_to_chars (var_partp + 12, + SHMEDIA_PTREL_OPC | (insn & SHMEDIA_LIKELY_BIT) + | (SHMEDIA_TEMP_REG << 10) + | (insn & (7 << 4)), + 4); + + /* We need relocs only if the target symbol was undefined or if + we're relaxing. */ + if (reloc_needed) + { + fix_new (opc_fragP, opcodep - opc_fragP->fr_literal, 4, + fragP->fr_symbol, fragP->fr_offset - 16, 1, + reloctype == BFD_RELOC_32_PLT_PCREL + ? BFD_RELOC_SH_PLT_HI16 + : BFD_RELOC_SH_IMM_HI16_PCREL); + fix_new (fragP, var_partp - fragP->fr_literal, 4, fragP->fr_symbol, + fragP->fr_offset - 12, 1, + reloctype == BFD_RELOC_32_PLT_PCREL + ? BFD_RELOC_SH_PLT_MEDHI16 + : BFD_RELOC_SH_IMM_MEDHI16_PCREL); + fix_new (fragP, var_partp - fragP->fr_literal + 4, 4, fragP->fr_symbol, + fragP->fr_offset - 8, 1, + reloctype == BFD_RELOC_32_PLT_PCREL + ? BFD_RELOC_SH_PLT_MEDLOW16 + : BFD_RELOC_SH_IMM_MEDLOW16_PCREL); + fix_new (fragP, var_partp - fragP->fr_literal + 8, 4, fragP->fr_symbol, + fragP->fr_offset - 4, 1, + reloctype == BFD_RELOC_32_PLT_PCREL + ? BFD_RELOC_SH_PLT_LOW16 + : BFD_RELOC_SH_IMM_LOW16_PCREL); + } + + var_part_size = 16; + break; + + case C (MOVI_IMM_64, MOVI_GOTOFF): + reloctype = BFD_RELOC_32_GOTOFF; + reloc_needed = 1; + /* Fall through. */ + + case C (MOVI_IMM_64, UNDEF_MOVI): + case C (MOVI_IMM_64, MOVI_64): + { + /* We only get here for undefined symbols, so we can simplify + handling compared to those above; we have 0 in the parts that + will be filled with the symbol parts. */ + + int reg = (insn >> 4) & 0x3f; + + /* In the fixed bit, put in a MOVI. */ + md_number_to_chars (opcodep, SHMEDIA_MOVI_OPC | (reg << 4), 4); + fix_new (opc_fragP, opcodep - opc_fragP->fr_literal, 4, + fragP->fr_symbol, fragP->fr_offset, 0, + reloctype == BFD_RELOC_NONE + ? BFD_RELOC_SH_IMM_HI16 + : reloctype == BFD_RELOC_32_GOTOFF + ? BFD_RELOC_SH_GOTOFF_HI16 + : (abort (), BFD_RELOC_SH_IMM_HI16)); + + /* The first SHORI, for the medium-high part. */ + md_number_to_chars (var_partp, SHMEDIA_SHORI_OPC | (reg << 4), 4); + fix_new (fragP, var_partp - fragP->fr_literal, 4, fragP->fr_symbol, + fragP->fr_offset, 0, + reloctype == BFD_RELOC_NONE + ? BFD_RELOC_SH_IMM_MEDHI16 + : reloctype == BFD_RELOC_32_GOTOFF + ? BFD_RELOC_SH_GOTOFF_MEDHI16 + : (abort (), BFD_RELOC_SH_IMM_MEDHI16)); + + /* A SHORI, for the medium-low part. */ + md_number_to_chars (var_partp + 4, + SHMEDIA_SHORI_OPC | (reg << 4), 4); + fix_new (fragP, var_partp - fragP->fr_literal + 4, 4, fragP->fr_symbol, + fragP->fr_offset, 0, + reloctype == BFD_RELOC_NONE + ? BFD_RELOC_SH_IMM_MEDLOW16 + : reloctype == BFD_RELOC_32_GOTOFF + ? BFD_RELOC_SH_GOTOFF_MEDLOW16 + : (abort (), BFD_RELOC_SH_IMM_MEDLOW16)); + + /* Fill in a SHORI for the low part. */ + md_number_to_chars (var_partp + 8, + SHMEDIA_SHORI_OPC | (reg << 4), 4); + fix_new (fragP, var_partp - fragP->fr_literal + 8, 4, fragP->fr_symbol, + fragP->fr_offset, 0, + reloctype == BFD_RELOC_NONE + ? BFD_RELOC_SH_IMM_LOW16 + : reloctype == BFD_RELOC_32_GOTOFF + ? BFD_RELOC_SH_GOTOFF_LOW16 + : (abort (), BFD_RELOC_SH_IMM_LOW16)); + + var_part_size = 12; + break; + } + + case C (MOVI_IMM_32, MOVI_GOTOFF): + reloctype = BFD_RELOC_32_GOTOFF; + reloc_needed = 1; + /* Fall through. */ + + case C (MOVI_IMM_32, UNDEF_MOVI): + case C (MOVI_IMM_32, MOVI_32): + { + /* Note that we only get here for undefined symbols. */ + + int reg = (insn >> 4) & 0x3f; + + /* A MOVI, for the high part. */ + md_number_to_chars (opcodep, SHMEDIA_MOVI_OPC | (reg << 4), 4); + fix_new (opc_fragP, opcodep - opc_fragP->fr_literal, 4, + fragP->fr_symbol, fragP->fr_offset, 0, + reloctype == BFD_RELOC_NONE + ? BFD_RELOC_SH_IMM_MEDLOW16 + : reloctype == BFD_RELOC_32_GOTOFF + ? BFD_RELOC_SH_GOTOFF_MEDLOW16 + : reloctype == BFD_RELOC_SH_GOTPC + ? BFD_RELOC_SH_GOTPC_MEDLOW16 + : reloctype == BFD_RELOC_32_PLT_PCREL + ? BFD_RELOC_SH_PLT_MEDLOW16 + : (abort (), BFD_RELOC_SH_IMM_MEDLOW16)); + + /* Fill in a SHORI for the low part. */ + md_number_to_chars (var_partp, + SHMEDIA_SHORI_OPC | (reg << 4), 4); + fix_new (fragP, var_partp - fragP->fr_literal, 4, fragP->fr_symbol, + fragP->fr_offset, 0, + reloctype == BFD_RELOC_NONE + ? BFD_RELOC_SH_IMM_LOW16 + : reloctype == BFD_RELOC_32_GOTOFF + ? BFD_RELOC_SH_GOTOFF_LOW16 + : reloctype == BFD_RELOC_SH_GOTPC + ? BFD_RELOC_SH_GOTPC_LOW16 + : reloctype == BFD_RELOC_32_PLT_PCREL + ? BFD_RELOC_SH_PLT_LOW16 + : (abort (), BFD_RELOC_SH_IMM_LOW16)); + + var_part_size = 4; + break; + } + + case C (MOVI_IMM_32_PCREL, MOVI_16): + case C (MOVI_IMM_64_PCREL, MOVI_16): + md_number_to_chars (opcodep, + insn + | (((reloc_needed + ? 0 : (target_address - opcode_address)) + & 65535) << 10), + 4); + if (reloc_needed) + fix_new (opc_fragP, opcodep - opc_fragP->fr_literal, 4, + fragP->fr_symbol, fragP->fr_offset, 1, + BFD_RELOC_SH_IMM_LOW16_PCREL); + var_part_size = 0; + break; + + case C (MOVI_IMM_32, MOVI_16): + case C (MOVI_IMM_64, MOVI_16): + md_number_to_chars (opcodep, + insn + | (((reloc_needed ? 0 : target_address) + & 65535) << 10), + 4); + if (reloc_needed) + abort (); + var_part_size = 0; + break; + + case C (MOVI_IMM_32_PCREL, MOVI_PLT): + reloctype = BFD_RELOC_32_PLT_PCREL; + goto movi_imm_32_pcrel_reloc_needed; + + case C (MOVI_IMM_32_PCREL, MOVI_GOTPC): + reloctype = BFD_RELOC_SH_GOTPC; + /* Fall through. */ + + movi_imm_32_pcrel_reloc_needed: + reloc_needed = 1; + /* Fall through. */ + + case C (MOVI_IMM_32_PCREL, MOVI_32): + case C (MOVI_IMM_64_PCREL, MOVI_32): + { + int reg = (insn >> 4) & 0x3f; + + md_number_to_chars (opcodep, + insn + | (((((reloc_needed + ? 0 : (target_address - opcode_address))) + >> 16) & 65535) << 10), 4); + + /* A SHORI, for the low part. */ + md_number_to_chars (var_partp, + SHMEDIA_SHORI_OPC + | (reg << 4) + | (((reloc_needed + ? 0 : (target_address - opcode_address)) + & 65535) << 10), 4); + if (reloc_needed) + { + fix_new (opc_fragP, opcodep - opc_fragP->fr_literal, 4, + fragP->fr_symbol, fragP->fr_offset, 1, + reloctype == BFD_RELOC_NONE + ? BFD_RELOC_SH_IMM_MEDLOW16_PCREL + : reloctype == BFD_RELOC_SH_GOTPC + ? BFD_RELOC_SH_GOTPC_MEDLOW16 + : reloctype == BFD_RELOC_32_PLT_PCREL + ? BFD_RELOC_SH_PLT_MEDLOW16 + : (abort (), BFD_RELOC_SH_IMM_MEDLOW16_PCREL)); + fix_new (fragP, var_partp - fragP->fr_literal, 4, fragP->fr_symbol, + fragP->fr_offset + 4, 1, + reloctype == BFD_RELOC_NONE + ? BFD_RELOC_SH_IMM_LOW16_PCREL + : reloctype == BFD_RELOC_SH_GOTPC + ? BFD_RELOC_SH_GOTPC_LOW16 + : reloctype == BFD_RELOC_32_PLT_PCREL + ? BFD_RELOC_SH_PLT_LOW16 + : (abort (), BFD_RELOC_SH_IMM_LOW16_PCREL)); + } + var_part_size = 4; + } + break; + + case C (MOVI_IMM_32_PCREL, MOVI_48): + case C (MOVI_IMM_64_PCREL, MOVI_48): + { + int reg = (insn >> 4) & 0x3f; + + md_number_to_chars (opcodep, + insn + | (((((reloc_needed + ? 0 : (target_address - opcode_address))) + >> 32) & 65535) << 10), 4); + + /* A SHORI, for the medium part. */ + md_number_to_chars (var_partp, + SHMEDIA_SHORI_OPC + | (reg << 4) + | ((((reloc_needed + ? 0 : (target_address - opcode_address)) + >> 16) & 65535) << 10), 4); + + /* A SHORI, for the low part. */ + md_number_to_chars (var_partp + 4, + SHMEDIA_SHORI_OPC + | (reg << 4) + | (((reloc_needed + ? 0 : (target_address - opcode_address)) + & 65535) << 10), 4); + if (reloc_needed) + { + fix_new (opc_fragP, opcodep - opc_fragP->fr_literal, 4, + fragP->fr_symbol, fragP->fr_offset, 1, + BFD_RELOC_SH_IMM_MEDHI16_PCREL); + fix_new (fragP, var_partp - fragP->fr_literal, 4, fragP->fr_symbol, + fragP->fr_offset + 4, 1, BFD_RELOC_SH_IMM_MEDLOW16_PCREL); + fix_new (fragP, var_partp - fragP->fr_literal + 4, 4, fragP->fr_symbol, + fragP->fr_offset + 8, 1, BFD_RELOC_SH_IMM_LOW16_PCREL); + } + var_part_size = 8; + } + break; + + case C (MOVI_IMM_64_PCREL, MOVI_PLT): + reloctype = BFD_RELOC_32_PLT_PCREL; + goto movi_imm_64_pcrel_reloc_needed; + + case C (MOVI_IMM_64_PCREL, MOVI_GOTPC): + reloctype = BFD_RELOC_SH_GOTPC; + /* Fall through. */ + + movi_imm_64_pcrel_reloc_needed: + reloc_needed = 1; + /* Fall through. */ + + case C (MOVI_IMM_32_PCREL, MOVI_64): + case C (MOVI_IMM_64_PCREL, MOVI_64): + { + int reg = (insn >> 4) & 0x3f; + + md_number_to_chars (opcodep, + insn + | (((((reloc_needed + ? 0 : (target_address - opcode_address))) + >> 48) & 65535) << 10), 4); + + /* A SHORI, for the medium-high part. */ + md_number_to_chars (var_partp, + SHMEDIA_SHORI_OPC + | (reg << 4) + | ((((reloc_needed + ? 0 : (target_address - opcode_address)) + >> 32) & 65535) << 10), 4); + + /* A SHORI, for the medium-low part. */ + md_number_to_chars (var_partp + 4, + SHMEDIA_SHORI_OPC + | (reg << 4) + | ((((reloc_needed + ? 0 : (target_address - opcode_address)) + >> 16) & 65535) << 10), 4); + + /* A SHORI, for the low part. */ + md_number_to_chars (var_partp + 8, + SHMEDIA_SHORI_OPC + | (reg << 4) + | (((reloc_needed + ? 0 : (target_address - opcode_address)) + & 65535) << 10), 4); + if (reloc_needed) + { + fix_new (opc_fragP, opcodep - opc_fragP->fr_literal, 4, + fragP->fr_symbol, fragP->fr_offset, 1, + reloctype == BFD_RELOC_NONE + ? BFD_RELOC_SH_IMM_HI16_PCREL + : reloctype == BFD_RELOC_SH_GOTPC + ? BFD_RELOC_SH_GOTPC_HI16 + : reloctype == BFD_RELOC_32_PLT_PCREL + ? BFD_RELOC_SH_PLT_HI16 + : (abort (), BFD_RELOC_SH_IMM_HI16_PCREL)); + fix_new (fragP, var_partp - fragP->fr_literal, 4, fragP->fr_symbol, + fragP->fr_offset + 4, 1, + reloctype == BFD_RELOC_NONE + ? BFD_RELOC_SH_IMM_MEDHI16_PCREL + : reloctype == BFD_RELOC_SH_GOTPC + ? BFD_RELOC_SH_GOTPC_MEDHI16 + : reloctype == BFD_RELOC_32_PLT_PCREL + ? BFD_RELOC_SH_PLT_MEDHI16 + : (abort (), BFD_RELOC_SH_IMM_MEDHI16_PCREL)); + fix_new (fragP, var_partp - fragP->fr_literal + 4, 4, + fragP->fr_symbol, + fragP->fr_offset + 8, 1, + reloctype == BFD_RELOC_NONE + ? BFD_RELOC_SH_IMM_MEDLOW16_PCREL + : reloctype == BFD_RELOC_SH_GOTPC + ? BFD_RELOC_SH_GOTPC_MEDLOW16 + : reloctype == BFD_RELOC_32_PLT_PCREL + ? BFD_RELOC_SH_PLT_MEDLOW16 + : (abort (), BFD_RELOC_SH_IMM_MEDLOW16_PCREL)); + fix_new (fragP, var_partp - fragP->fr_literal + 8, 4, + fragP->fr_symbol, + fragP->fr_offset + 12, 1, + reloctype == BFD_RELOC_NONE + ? BFD_RELOC_SH_IMM_LOW16_PCREL + : reloctype == BFD_RELOC_SH_GOTPC + ? BFD_RELOC_SH_GOTPC_LOW16 + : reloctype == BFD_RELOC_32_PLT_PCREL + ? BFD_RELOC_SH_PLT_LOW16 + : (abort (), BFD_RELOC_SH_IMM_LOW16_PCREL)); + } + var_part_size = 12; + } + break; + + default: + BAD_CASE (fragP->fr_subtype); + } + + fragP->fr_fix += var_part_size; + fragP->fr_var = 0; +} + +/* Mask NUMBER (originating from a signed number) corresponding to the HOW + reloc. */ + +static unsigned long +shmedia_mask_number (number, how) + unsigned long number; + bfd_reloc_code_real_type how; +{ + switch (how) + { + case BFD_RELOC_SH_IMMU5: + number &= (1 << 5) - 1; + break; + + case BFD_RELOC_SH_IMMS6: + case BFD_RELOC_SH_IMMU6: + number &= (1 << 6) - 1; + break; + + case BFD_RELOC_SH_IMMS6BY32: + number = (number & ((1 << (6 + 5)) - 1)) >> 5; + break; + + case BFD_RELOC_SH_IMMS10: + number &= (1 << 10) - 1; + break; + + case BFD_RELOC_SH_IMMS10BY2: + number = (number & ((1 << (10 + 1)) - 1)) >> 1; + break; + + case BFD_RELOC_SH_IMMS10BY4: + number = (number & ((1 << (10 + 2)) - 1)) >> 2; + break; + + case BFD_RELOC_SH_IMMS10BY8: + number = (number & ((1 << (10 + 3)) - 1)) >> 3; + break; + + case BFD_RELOC_SH_IMMS16: + case BFD_RELOC_SH_IMMU16: + number &= (1 << 16) - 1; + break; + + default: + BAD_CASE (how); + } + + return number; +} + +/* Emit errors for values out-of-range, using as_bad_where if FRAGP is + non-NULL, as_bad otherwise. */ + +static void +shmedia_check_limits (valp, reloc, fixp) + offsetT *valp; + bfd_reloc_code_real_type reloc; + fixS *fixp; +{ + offsetT val = *valp; + + char *msg = NULL; + + switch (reloc) + { + case BFD_RELOC_SH_IMMU5: + if (val < 0 || val > (1 << 5) - 1) + msg = _("invalid operand, not a 5-bit unsigned value: %d"); + break; + + case BFD_RELOC_SH_IMMS6: + if (val < -(1 << 5) || val > (1 << 5) - 1) + msg = _("invalid operand, not a 6-bit signed value: %d"); + break; + + case BFD_RELOC_SH_IMMU6: + if (val < 0 || val > (1 << 6) - 1) + msg = _("invalid operand, not a 6-bit unsigned value: %d"); + break; + + case BFD_RELOC_SH_IMMS6BY32: + if (val < -(1 << 10) || val > (1 << 10) - 1) + msg = _("invalid operand, not a 11-bit signed value: %d"); + else if (val & 31) + msg = _("invalid operand, not a multiple of 32: %d"); + break; + + case BFD_RELOC_SH_IMMS10: + if (val < -(1 << 9) || val > (1 << 9) - 1) + msg = _("invalid operand, not a 10-bit signed value: %d"); + break; + + case BFD_RELOC_SH_IMMS10BY2: + if (val < -(1 << 10) || val > (1 << 10) - 1) + msg = _("invalid operand, not a 11-bit signed value: %d"); + else if (val & 1) + msg = _("invalid operand, not an even value: %d"); + break; + + case BFD_RELOC_SH_IMMS10BY4: + if (val < -(1 << 11) || val > (1 << 11) - 1) + msg = _("invalid operand, not a 12-bit signed value: %d"); + else if (val & 3) + msg = _("invalid operand, not a multiple of 4: %d"); + break; + + case BFD_RELOC_SH_IMMS10BY8: + if (val < -(1 << 12) || val > (1 << 12) - 1) + msg = _("invalid operand, not a 13-bit signed value: %d"); + else if (val & 7) + msg = _("invalid operand, not a multiple of 8: %d"); + break; + + case BFD_RELOC_SH_IMMS16: + if (val < -(1 << 15) || val > (1 << 15) - 1) + msg = _("invalid operand, not a 16-bit signed value: %d"); + break; + + case BFD_RELOC_SH_IMMU16: + if (val < 0 || val > (1 << 16) - 1) + msg = _("invalid operand, not an 16-bit unsigned value: %d"); + break; + + case BFD_RELOC_SH_PT_16: + case SHMEDIA_BFD_RELOC_PT: + if (val < -(1 << 15) * 4 || val > ((1 << 15) - 1) * 4 + 1) + msg = _("operand out of range for PT, PTA and PTB"); + else if ((val % 4) != 0 && ((val - 1) % 4) != 0) + msg = _("operand not a multiple of 4 for PT, PTA or PTB: %d"); + break; + + /* These have no limits; they take a 16-bit slice of a 32- or 64-bit + number. */ + case BFD_RELOC_SH_IMM_HI16: + case BFD_RELOC_SH_IMM_MEDHI16: + case BFD_RELOC_SH_IMM_MEDLOW16: + case BFD_RELOC_SH_IMM_LOW16: + case BFD_RELOC_SH_IMM_HI16_PCREL: + case BFD_RELOC_SH_IMM_MEDHI16_PCREL: + case BFD_RELOC_SH_IMM_MEDLOW16_PCREL: + case BFD_RELOC_SH_IMM_LOW16_PCREL: + + case BFD_RELOC_SH_SHMEDIA_CODE: + break; + + /* This one has limits out of our reach. */ + case BFD_RELOC_64: + break; + + default: + BAD_CASE (reloc); + } + + if (msg) + { + if (fixp) + as_bad_where (fixp->fx_file, fixp->fx_line, msg, val); + else + as_bad (msg, val); + } +} + +/* Handle an immediate operand by checking limits and noting it for later + evaluation if not computable yet, and return a bitfield suitable to + "or" into the opcode (non-zero if the value was a constant number). */ + +static unsigned long +shmedia_immediate_op (where, op, pcrel, how) + char *where; + shmedia_operand_info *op; + int pcrel; + bfd_reloc_code_real_type how; +{ + unsigned long retval = 0; + + /* If this is not an absolute number, make it a fixup. A constant in + place of a pc-relative operand also needs a fixup. */ + if (op->immediate.X_op != O_constant || pcrel) + fix_new_exp (frag_now, + where - frag_now->fr_literal, + 4, + &op->immediate, + pcrel, + how); + else + { + /* Check that the number is within limits as represented by the + reloc, and return the number. */ + shmedia_check_limits (&op->immediate.X_add_number, how, NULL); + + retval + = shmedia_mask_number ((unsigned long) op->immediate.X_add_number, + how); + } + + return retval << 10; +} + +/* Try and parse a register name case-insensitively, return the number of + chars consumed. */ + +static int +shmedia_parse_reg (src, mode, reg, argtype) + char *src; + int *mode; + int *reg; + shmedia_arg_type argtype; +{ + int l0 = TOLOWER (src[0]); + int l1 = l0 ? TOLOWER (src[1]) : 0; + + if (l0 == 'r') + { + if (src[1] >= '1' && src[1] <= '5') + { + if (src[2] >= '0' && src[2] <= '9' + && ! IDENT_CHAR ((unsigned char) src[3])) + { + *mode = A_GREG_M; + *reg = 10 * (src[1] - '0') + src[2] - '0'; + return 3; + } + } + + if (src[1] == '6') + { + if (src[2] >= '0' && src[2] <= '3' + && ! IDENT_CHAR ((unsigned char) src[3])) + { + *mode = A_GREG_M; + *reg = 60 + src[2] - '0'; + return 3; + } + } + + if (src[1] >= '0' && src[1] <= '9' + && ! IDENT_CHAR ((unsigned char) src[2])) + { + *mode = A_GREG_M; + *reg = (src[1] - '0'); + return 2; + } + } + + if (l0 == 't' && l1 == 'r') + { + if (src[2] >= '0' && src[2] <= '7' + && ! IDENT_CHAR ((unsigned char) src[3])) + { + *mode = A_TREG_B; + *reg = (src[2] - '0'); + return 3; + } + } + + if (l0 == 'f' && l1 == 'r') + { + if (src[2] >= '1' && src[2] <= '5') + { + if (src[3] >= '0' && src[3] <= '9' + && ! IDENT_CHAR ((unsigned char) src[4])) + { + *mode = A_FREG_G; + *reg = 10 * (src[2] - '0') + src[3] - '0'; + return 4; + } + } + if (src[2] == '6') + { + if (src[3] >= '0' && src[3] <= '3' + && ! IDENT_CHAR ((unsigned char) src[4])) + { + *mode = A_FREG_G; + *reg = 60 + src[3] - '0'; + return 4; + } + } + if (src[2] >= '0' && src[2] <= '9' + && ! IDENT_CHAR ((unsigned char) src[3])) + { + *mode = A_FREG_G; + *reg = (src[2] - '0'); + return 3; + } + } + + if (l0 == 'f' && l1 == 'v') + { + if (src[2] >= '1' && src[2] <= '5') + { + if (src[3] >= '0' && src[3] <= '9' + && ((10 * (src[2] - '0') + src[3] - '0') % 4) == 0 + && ! IDENT_CHAR ((unsigned char) src[4])) + { + *mode = A_FVREG_G; + *reg = 10 * (src[2] - '0') + src[3] - '0'; + return 4; + } + } + if (src[2] == '6') + { + if (src[3] == '0' + && ! IDENT_CHAR ((unsigned char) src[4])) + { + *mode = A_FVREG_G; + *reg = 60 + src[3] - '0'; + return 4; + } + } + if (src[2] >= '0' && src[2] <= '9' + && ((src[2] - '0') % 4) == 0 + && ! IDENT_CHAR ((unsigned char) src[3])) + { + *mode = A_FVREG_G; + *reg = (src[2] - '0'); + return 3; + } + } + + if (l0 == 'd' && l1 == 'r') + { + if (src[2] >= '1' && src[2] <= '5') + { + if (src[3] >= '0' && src[3] <= '9' + && ((src[3] - '0') % 2) == 0 + && ! IDENT_CHAR ((unsigned char) src[4])) + { + *mode = A_DREG_G; + *reg = 10 * (src[2] - '0') + src[3] - '0'; + return 4; + } + } + + if (src[2] == '6') + { + if ((src[3] == '0' || src[3] == '2') + && ! IDENT_CHAR ((unsigned char) src[4])) + { + *mode = A_DREG_G; + *reg = 60 + src[3] - '0'; + return 4; + } + } + + if (src[2] >= '0' && src[2] <= '9' + && ((src[2] - '0') % 2) == 0 + && ! IDENT_CHAR ((unsigned char) src[3])) + { + *mode = A_DREG_G; + *reg = (src[2] - '0'); + return 3; + } + } + + if (l0 == 'f' && l1 == 'p') + { + if (src[2] >= '1' && src[2] <= '5') + { + if (src[3] >= '0' && src[3] <= '9' + && ((src[3] - '0') % 2) == 0 + && ! IDENT_CHAR ((unsigned char) src[4])) + { + *mode = A_FPREG_G; + *reg = 10 * (src[2] - '0') + src[3] - '0'; + return 4; + } + } + + if (src[2] == '6') + { + if ((src[3] == '0' || src[3] == '2') + && ! IDENT_CHAR ((unsigned char) src[4])) + { + *mode = A_FPREG_G; + *reg = 60 + src[3] - '0'; + return 4; + } + } + + if (src[2] >= '0' && src[2] <= '9' + && ((src[2] - '0') % 2) == 0 + && ! IDENT_CHAR ((unsigned char) src[3])) + { + *mode = A_FPREG_G; + *reg = (src[2] - '0'); + return 3; + } + } + + if (l0 == 'm' && strncasecmp (src, "mtrx", 4) == 0) + { + if (src[4] == '0' && ! IDENT_CHAR ((unsigned char) src[5])) + { + *mode = A_FMREG_G; + *reg = 0; + return 5; + } + + if (src[4] == '1' && src[5] == '6' + && ! IDENT_CHAR ((unsigned char) src[6])) + { + *mode = A_FMREG_G; + *reg = 16; + return 6; + } + + if (src[4] == '3' && src[5] == '2' + && ! IDENT_CHAR ((unsigned char) src[6])) + { + *mode = A_FMREG_G; + *reg = 32; + return 6; + } + + if (src[4] == '4' && src[5] == '8' + && ! IDENT_CHAR ((unsigned char) src[6])) + { + *mode = A_FMREG_G; + *reg = 48; + return 6; + } + } + + if (l0 == 'c' && l1 == 'r') + { + if (src[2] >= '1' && src[2] <= '5') + { + if (src[3] >= '0' && src[3] <= '9' + && ! IDENT_CHAR ((unsigned char) src[4])) + { + *mode = A_CREG_K; + *reg = 10 * (src[2] - '0') + src[3] - '0'; + return 4; + } + } + if (src[2] == '6') + { + if (src[3] >= '0' && src[3] <= '3' + && ! IDENT_CHAR ((unsigned char) src[4])) + { + *mode = A_CREG_K; + *reg = 60 + src[3] - '0'; + return 4; + } + } + if (src[2] >= '0' && src[2] <= '9' + && ! IDENT_CHAR ((unsigned char) src[3])) + { + *mode = A_CREG_K; + *reg = (src[2] - '0'); + return 3; + } + } + + /* We either have an error, a symbol or a control register by predefined + name. To keep things simple but still fast for normal cases, we do + linear search in the (not to big) table of predefined control + registers. We only do this when we *expect* a control register. + Those instructions should be rare enough that linear searching is ok. + Or just read them into a hash-table in shmedia_md_begin. Since they + cannot be specified in the same place of symbol operands, don't add + them there to the *main* symbol table as being in "reg_section". */ + if (argtype == A_CREG_J || argtype == A_CREG_K) + { + const shmedia_creg_info *cregp; + int len = 0; + + for (cregp = shmedia_creg_table; cregp->name != NULL; cregp++) + { + len = strlen (cregp->name); + if (strncasecmp (cregp->name, src, len) == 0 + && ! IDENT_CHAR (src[len])) + break; + } + + if (cregp->name != NULL) + { + *mode = A_CREG_K; + *reg = cregp->cregno; + return len; + } + } + + return 0; +} + +/* Called from md_estimate_size_before_relax in tc-sh.c */ + +static int +shmedia_md_estimate_size_before_relax (fragP, segment_type) + fragS *fragP; + segT segment_type ATTRIBUTE_UNUSED; +{ + int old_fr_fix; + expressionS *exp; + + /* For ELF, we can't relax externally visible symbols; see tc-i386.c. */ + boolean sym_relaxable + = (fragP->fr_symbol + && S_GET_SEGMENT (fragP->fr_symbol) == segment_type + && ! S_IS_EXTERNAL (fragP->fr_symbol) + && ! S_IS_WEAK (fragP->fr_symbol)); + + old_fr_fix = fragP->fr_fix; + + switch (fragP->fr_subtype) + { + case C (SH64PCREL16_32, UNDEF_SH64PCREL): + case C (SH64PCREL16PT_32, UNDEF_SH64PCREL): + /* Used to be to somewhere which was unknown. */ + if (sym_relaxable) + { + int what = GET_WHAT (fragP->fr_subtype); + + /* In this segment, so head for shortest. */ + fragP->fr_subtype = C (what, SH64PCREL16); + } + else + { + int what = GET_WHAT (fragP->fr_subtype); + /* We know the abs value, but we don't know where we will be + linked, so we must make it the longest. Presumably we could + switch to a non-pcrel representation, but having absolute + values in PT operands should be rare enough not to be worth + adding that code. */ + fragP->fr_subtype = C (what, SH64PCREL32); + } + fragP->fr_var = md_relax_table[fragP->fr_subtype].rlx_length; + break; + + case C (SH64PCREL16_64, UNDEF_SH64PCREL): + case C (SH64PCREL16PT_64, UNDEF_SH64PCREL): + /* Used to be to somewhere which was unknown. */ + if (sym_relaxable) + { + int what = GET_WHAT (fragP->fr_subtype); + + /* In this segment, so head for shortest. */ + fragP->fr_subtype = C (what, SH64PCREL16); + } + else + { + int what = GET_WHAT (fragP->fr_subtype); + /* We know the abs value, but we don't know where we will be + linked, so we must make it the longest. Presumably we could + switch to a non-pcrel representation, but having absolute + values in PT operands should be rare enough not to be worth + adding that code. */ + fragP->fr_subtype = C (what, SH64PCREL64); + } + fragP->fr_var = md_relax_table[fragP->fr_subtype].rlx_length; + break; + + case C (MOVI_IMM_64, UNDEF_MOVI): + case C (MOVI_IMM_32, UNDEF_MOVI): + exp = NULL; + + /* Look inside the "symbol". If we find a PC-relative expression, + change this to a PC-relative, relaxable expression. */ + if (fragP->fr_symbol != NULL + && (exp = symbol_get_value_expression (fragP->fr_symbol)) != NULL + && exp->X_op == O_subtract + && exp->X_op_symbol != NULL + && S_GET_SEGMENT (exp->X_op_symbol) == segment_type) + { + int what = GET_WHAT (fragP->fr_subtype); + int what_high = what == MOVI_IMM_32 ? MOVI_32 : MOVI_64; + expressionS *opexp + = symbol_get_value_expression (exp->X_op_symbol); + expressionS *addexp + = symbol_get_value_expression (exp->X_add_symbol); + + /* Change the MOVI expression to the "X" in "X - Y" and subtract + Y:s offset to this location from X. Note that we can only + allow an Y which is offset from this frag. */ + if (opexp != NULL + && addexp != NULL + && opexp->X_op == O_constant + && fragP == symbol_get_frag (exp->X_op_symbol)) + { + /* At this point, before relaxing, the add-number of opexp + is the offset from the fr_fix part. */ + fragP->fr_offset + = (exp->X_add_number + - (opexp->X_add_number - (fragP->fr_fix - 4))); + fragP->fr_symbol = exp->X_add_symbol; + + what = what == MOVI_IMM_32 + ? MOVI_IMM_32_PCREL : MOVI_IMM_64_PCREL; + + /* Check the "X" symbol to estimate the size of this + PC-relative expression. */ + if (S_GET_SEGMENT (exp->X_add_symbol) == segment_type + && ! S_IS_EXTERNAL (exp->X_add_symbol) + && ! S_IS_WEAK (exp->X_add_symbol)) + fragP->fr_subtype = C (what, MOVI_16); + else + fragP->fr_subtype = C (what, what_high); + + /* This is now a PC-relative expression, fit to be relaxed. */ + } + else + fragP->fr_subtype = C (what, what_high); + } + else if (fragP->fr_symbol == NULL + || (S_GET_SEGMENT (fragP->fr_symbol) == absolute_section + && exp->X_op == O_constant)) + { + unsigned long insn + = (target_big_endian + ? bfd_getb32 (fragP->fr_opcode) + : bfd_getl32 (fragP->fr_opcode)); + offsetT one = (offsetT) 1; + offsetT value = fragP->fr_offset + + (fragP->fr_symbol == NULL ? 0 : S_GET_VALUE (fragP->fr_symbol)); + + if (value >= ((offsetT) -1 << 15) && value < ((offsetT) 1 << 15)) + { + /* Fits in 16-bit signed number. */ + int what = GET_WHAT (fragP->fr_subtype); + fragP->fr_subtype = C (what, MOVI_16); + + /* Just "or" in the value. */ + md_number_to_chars (fragP->fr_opcode, + insn | ((value & ((1 << 16) - 1)) << 10), + 4); + } + else if (value >= -(one << 31) + && (value < (one << 31) + || (sh64_abi == sh64_abi_32 && value < (one << 32)))) + { + /* The value fits in a 32-bit signed number. */ + int reg = (insn >> 4) & 0x3f; + + /* Just "or" in the high bits of the value, making the first + MOVI. */ + md_number_to_chars (fragP->fr_opcode, + insn + | (((value >> 16) & ((1 << 16) - 1)) << 10), + 4); + + /* Add a SHORI with the low bits. Note that this insn lives + in the variable fragment part. */ + md_number_to_chars (fragP->fr_literal + old_fr_fix, + SHMEDIA_SHORI_OPC + | (reg << 4) + | ((value & ((1 << 16) - 1)) << 10), + 4); + + /* We took a piece of the variable part. */ + fragP->fr_fix += 4; + } + else if (GET_WHAT (fragP->fr_subtype) == MOVI_IMM_32) + { + /* Value out of range. */ + as_bad_where (fragP->fr_file, fragP->fr_line, + _("MOVI operand is not a 32-bit signed value: 0x%8x%08x"), + ((unsigned int) (value >> 32) + & (unsigned int) 0xffffffff), + (unsigned int) value & (unsigned int) 0xffffffff); + + /* Must advance size, or we will get internal inconsistency + and fall into an assert. */ + fragP->fr_fix += 4; + } + /* Now we know we are allowed to expand to 48- and 64-bit values. */ + else if (value >= -(one << 47) && value < (one << 47)) + { + /* The value fits in a 48-bit signed number. */ + int reg = (insn >> 4) & 0x3f; + + /* Just "or" in the high bits of the value, making the first + MOVI. */ + md_number_to_chars (fragP->fr_opcode, + insn + | (((value >> 32) & ((1 << 16) - 1)) << 10), + 4); + + /* Add a SHORI with the middle bits. Note that this insn lives + in the variable fragment part. */ + md_number_to_chars (fragP->fr_literal + old_fr_fix, + SHMEDIA_SHORI_OPC + | (reg << 4) + | (((value >> 16) & ((1 << 16) - 1)) << 10), + 4); + + /* Add a SHORI with the low bits. */ + md_number_to_chars (fragP->fr_literal + old_fr_fix + 4, + SHMEDIA_SHORI_OPC + | (reg << 4) + | ((value & ((1 << 16) - 1)) << 10), + 4); + + /* We took a piece of the variable part. */ + fragP->fr_fix += 8; + } + else + { + /* A 64-bit number. */ + int reg = (insn >> 4) & 0x3f; + + /* Just "or" in the high bits of the value, making the first + MOVI. */ + md_number_to_chars (fragP->fr_opcode, + insn + | (((value >> 48) & ((1 << 16) - 1)) << 10), + 4); + + /* Add a SHORI with the midhigh bits. Note that this insn lives + in the variable fragment part. */ + md_number_to_chars (fragP->fr_literal + old_fr_fix, + SHMEDIA_SHORI_OPC + | (reg << 4) + | (((value >> 32) & ((1 << 16) - 1)) << 10), + 4); + + /* Add a SHORI with the midlow bits. */ + md_number_to_chars (fragP->fr_literal + old_fr_fix + 4, + SHMEDIA_SHORI_OPC + | (reg << 4) + | (((value >> 16) & ((1 << 16) - 1)) << 10), + 4); + + /* Add a SHORI with the low bits. */ + md_number_to_chars (fragP->fr_literal + old_fr_fix + 8, + SHMEDIA_SHORI_OPC + | (reg << 4) + | ((value & ((1 << 16) - 1)) << 10), 4); + /* We took all of the variable part. */ + fragP->fr_fix += 12; + } + + /* MOVI expansions that get here have not been converted to + PC-relative frags, but instead expanded by + md_number_to_chars or by calling shmedia_md_convert_frag + with final == false. We must not have them around as + frags anymore; symbols would be prematurely evaluated + when relaxing. We will not need to have md_convert_frag + called again with them; any further handling is through + the already emitted fixups. */ + frag_wane (fragP); + break; + } + fragP->fr_var = md_relax_table[fragP->fr_subtype].rlx_length; + break; + + /* For relaxation states that remain unchanged, report the + estimated length. */ + case C (SH64PCREL16_32, SH64PCREL16): + case C (SH64PCREL16PT_32, SH64PCREL16): + case C (SH64PCREL16_32, SH64PCREL32): + case C (SH64PCREL16PT_32, SH64PCREL32): + case C (SH64PCREL16_32, SH64PCRELPLT): + case C (SH64PCREL16PT_32, SH64PCRELPLT): + case C (SH64PCREL16_64, SH64PCREL16): + case C (SH64PCREL16PT_64, SH64PCREL16): + case C (SH64PCREL16_64, SH64PCREL32): + case C (SH64PCREL16PT_64, SH64PCREL32): + case C (SH64PCREL16_64, SH64PCREL48): + case C (SH64PCREL16PT_64, SH64PCREL48): + case C (SH64PCREL16_64, SH64PCREL64): + case C (SH64PCREL16PT_64, SH64PCREL64): + case C (SH64PCREL16_64, SH64PCRELPLT): + case C (SH64PCREL16PT_64, SH64PCRELPLT): + case C (MOVI_IMM_32, MOVI_16): + case C (MOVI_IMM_32, MOVI_32): + case C (MOVI_IMM_32, MOVI_GOTOFF): + case C (MOVI_IMM_32_PCREL, MOVI_16): + case C (MOVI_IMM_32_PCREL, MOVI_32): + case C (MOVI_IMM_32_PCREL, MOVI_PLT): + case C (MOVI_IMM_32_PCREL, MOVI_GOTPC): + case C (MOVI_IMM_64, MOVI_16): + case C (MOVI_IMM_64, MOVI_32): + case C (MOVI_IMM_64, MOVI_48): + case C (MOVI_IMM_64, MOVI_64): + case C (MOVI_IMM_64, MOVI_GOTOFF): + case C (MOVI_IMM_64_PCREL, MOVI_16): + case C (MOVI_IMM_64_PCREL, MOVI_32): + case C (MOVI_IMM_64_PCREL, MOVI_48): + case C (MOVI_IMM_64_PCREL, MOVI_64): + case C (MOVI_IMM_64_PCREL, MOVI_PLT): + case C (MOVI_IMM_64_PCREL, MOVI_GOTPC): + fragP->fr_var = md_relax_table[fragP->fr_subtype].rlx_length; + break; + + default: + abort (); + } + + return fragP->fr_var + (fragP->fr_fix - old_fr_fix); +} + +/* Parse an expression, SH64-style. Copied from tc-sh.c, but with + datatypes adjusted. */ + +static char * +shmedia_parse_exp (s, op) + char *s; + shmedia_operand_info *op; +{ + char *save; + char *new; + + save = input_line_pointer; + input_line_pointer = s; + expression (&op->immediate); + if (op->immediate.X_op == O_absent) + as_bad (_("missing operand")); + new = input_line_pointer; + input_line_pointer = save; + return new; +} + +/* Parse an operand. Store pointer to next character in *PTR. */ + +static void +shmedia_get_operand (ptr, op, argtype) + char **ptr; + shmedia_operand_info *op; + shmedia_arg_type argtype; +{ + char *src = *ptr; + int mode = -1; + unsigned int len; + + len = shmedia_parse_reg (src, &mode, &(op->reg), argtype); + if (len) + { + *ptr = src + len; + op->type = mode; + } + else + { + /* Not a reg, so it must be a displacement. */ + *ptr = shmedia_parse_exp (src, op); + op->type = A_IMMM; + + /* This is just an initialization; shmedia_get_operands will change + as needed. */ + op->reloctype = BFD_RELOC_NONE; + } +} + +/* Parse the operands for this insn; return NULL if invalid, else return + how much text was consumed. */ + +static char * +shmedia_get_operands (info, args, operands) + shmedia_opcode_info *info; + char *args; + shmedia_operands_info *operands; +{ + char *ptr = args; + int i; + + if (*ptr == ' ') + ptr++; + + for (i = 0; info->arg[i] != 0; i++) + { + memset (operands->operands + i, 0, sizeof (operands->operands[0])); + + /* No operand to get for these fields. */ + if (info->arg[i] == A_REUSE_PREV) + continue; + + shmedia_get_operand (&ptr, &operands->operands[i], info->arg[i]); + + /* Check operands type match. */ + switch (info->arg[i]) + { + case A_GREG_M: + case A_GREG_N: + case A_GREG_D: + if (operands->operands[i].type != A_GREG_M) + return NULL; + break; + + case A_FREG_G: + case A_FREG_H: + case A_FREG_F: + if (operands->operands[i].type != A_FREG_G) + return NULL; + break; + + case A_FVREG_G: + case A_FVREG_H: + case A_FVREG_F: + if (operands->operands[i].type != A_FVREG_G) + return NULL; + break; + + case A_FMREG_G: + case A_FMREG_H: + case A_FMREG_F: + if (operands->operands[i].type != A_FMREG_G) + return NULL; + break; + + case A_FPREG_G: + case A_FPREG_H: + case A_FPREG_F: + if (operands->operands[i].type != A_FPREG_G) + return NULL; + break; + + case A_DREG_G: + case A_DREG_H: + case A_DREG_F: + if (operands->operands[i].type != A_DREG_G) + return NULL; + break; + + case A_TREG_A: + case A_TREG_B: + if (operands->operands[i].type != A_TREG_B) + return NULL; + break; + + case A_CREG_J: + case A_CREG_K: + if (operands->operands[i].type != A_CREG_K) + return NULL; + break; + + case A_IMMS16: + case A_IMMU16: + /* Check for an expression that looks like S & 65535 or + (S >> N) & 65535, where N = 0, 16, 32, 48. + + Get the S and put at operands->operands[i].immediate, and + adjust operands->operands[i].reloctype. */ + { + expressionS *imm_expr = &operands->operands[i].immediate; + expressionS *right_expr; + + if (operands->operands[i].type == A_IMMM + && imm_expr->X_op == O_bit_and + && imm_expr->X_op_symbol != NULL + && ((right_expr + = symbol_get_value_expression (imm_expr->X_op_symbol)) + ->X_op == O_constant) + && right_expr->X_add_number == 0xffff) + { + symbolS *inner = imm_expr->X_add_symbol; + bfd_reloc_code_real_type reloctype = BFD_RELOC_SH_IMM_LOW16; + expressionS *inner_expr + = symbol_get_value_expression (inner); + + if (inner_expr->X_op == O_right_shift) + { + expressionS *inner_right; + + if (inner_expr->X_op_symbol != NULL + && ((inner_right + = symbol_get_value_expression (inner_expr + ->X_op_symbol)) + ->X_op == O_constant)) + { + offsetT addnum + = inner_right->X_add_number; + + if (addnum == 0 || addnum == 16 || addnum == 32 + || addnum == 48) + { + reloctype + = (addnum == 0 + ? BFD_RELOC_SH_IMM_LOW16 + : (addnum == 16 + ? BFD_RELOC_SH_IMM_MEDLOW16 + : (addnum == 32 + ? BFD_RELOC_SH_IMM_MEDHI16 + : BFD_RELOC_SH_IMM_HI16))); + + inner = inner_expr->X_add_symbol; + inner_expr = symbol_get_value_expression (inner); + } + } + } + + /* I'm not sure I understand the logic, but evidently the + inner expression of a lone symbol is O_constant, with + the actual symbol in expr_section. For a constant, the + section would be absolute_section. For sym+offset, + it's O_symbol as always. See expr.c:make_expr_symbol, + first statements. */ + + if (inner_expr->X_op == O_constant + && S_GET_SEGMENT (inner) != absolute_section) + { + operands->operands[i].immediate.X_op = O_symbol; + operands->operands[i].immediate.X_add_symbol = inner; + operands->operands[i].immediate.X_add_number = 0; + } + else + operands->operands[i].immediate + = *symbol_get_value_expression (inner); + + operands->operands[i].reloctype = reloctype; + } + } + /* Fall through. */ + case A_IMMS6: + case A_IMMS6BY32: + case A_IMMS10: + case A_IMMS10BY1: + case A_IMMS10BY2: + case A_IMMS10BY4: + case A_IMMS10BY8: + case A_PCIMMS16BY4: + case A_PCIMMS16BY4_PT: + case A_IMMU5: + case A_IMMU6: + if (operands->operands[i].type != A_IMMM) + return NULL; + + if (sh_check_fixup (&operands->operands[i].immediate, + &operands->operands[i].reloctype)) + { + as_bad (_("invalid PIC reference")); + return NULL; + } + + break; + + default: + BAD_CASE (info->arg[i]); + } + + if (*ptr == ',' && info->arg[i + 1]) + ptr++; + } + return ptr; +} + + +/* Find an opcode at the start of *STR_P in the hash table, and set + *STR_P to the first character after the last one read. */ + +static shmedia_opcode_info * +shmedia_find_cooked_opcode (str_p) + char **str_p; +{ + char *str = *str_p; + char *op_start; + char *op_end; + char name[20]; + unsigned int nlen = 0; + + /* Drop leading whitespace. */ + while (*str == ' ') + str++; + + /* Find the op code end. */ + for (op_start = op_end = str; + *op_end + && nlen < sizeof (name) - 1 + && ! is_end_of_line[(unsigned char) *op_end] + && ! ISSPACE ((unsigned char) *op_end); + op_end++) + { + unsigned char c = op_start[nlen]; + + /* The machine independent code will convert CMP/EQ into cmp/EQ + because it thinks the '/' is the end of the symbol. Moreover, + all but the first sub-insn is a parallel processing insn won't + be capitailzed. Instead of hacking up the machine independent + code, we just deal with it here. */ + c = TOLOWER (c); + name[nlen] = c; + nlen++; + } + + name[nlen] = 0; + *str_p = op_end; + + if (nlen == 0) + as_bad (_("can't find opcode")); + + return + (shmedia_opcode_info *) hash_find (shmedia_opcode_hash_control, name); +} + +/* Build up an instruction, including allocating the frag. */ + +static int +shmedia_build_Mytes (opcode, operands) + shmedia_opcode_info *opcode; + shmedia_operands_info *operands; +{ + unsigned long insn = opcode->opcode_base; + int i, j; + char *insn_loc = frag_more (4); + + /* The parameter to dwarf2_emit_insn is actually the offset to the start + of the insn from the fix piece of instruction that was emitted. + Since we want .debug_line addresses to record (address | 1) for + SHmedia insns, we get the wanted effect by taking one off the size, + knowing it's a multiple of 4. We count from the first fix piece of + the insn. There must be no frags changes (frag_more or frag_var) + calls in-between the frag_more call we account for, and this + dwarf2_emit_insn call. */ + dwarf2_emit_insn (3); + + /* This is stored into any frag_var operand. */ + sh64_last_insn_frag = frag_now; + + /* Loop over opcode info, emit an instruction. */ + for (i = 0, j = 0; opcode->arg[i]; i++) + { + shmedia_arg_type argtype = opcode->arg[i]; + shmedia_operand_info *opjp = &operands->operands[j]; + switch (argtype) + { + case A_TREG_A: + case A_TREG_B: + case A_GREG_M: + case A_GREG_N: + case A_GREG_D: + case A_FREG_G: + case A_FREG_H: + case A_FREG_F: + case A_FVREG_G: + case A_FVREG_H: + case A_FVREG_F: + case A_FMREG_G: + case A_FMREG_H: + case A_FMREG_F: + case A_FPREG_G: + case A_FPREG_H: + case A_FPREG_F: + case A_DREG_G: + case A_DREG_H: + case A_DREG_F: + case A_CREG_J: + case A_CREG_K: + /* Six-bit register fields. They just get filled with the + parsed register number. */ + insn |= (opjp->reg << opcode->nibbles[i]); + j++; + break; + + case A_REUSE_PREV: + /* Copy the register for the previous operand to this position. */ + insn |= (operands->operands[j - 1].reg << opcode->nibbles[i]); + j++; + break; + + case A_IMMS6: + insn |= shmedia_immediate_op (insn_loc, opjp, 0, + BFD_RELOC_SH_IMMS6); + j++; + break; + + case A_IMMS6BY32: + insn |= shmedia_immediate_op (insn_loc, opjp, 0, + BFD_RELOC_SH_IMMS6BY32); + j++; + break; + + case A_IMMS10BY1: + case A_IMMS10: + insn |= shmedia_immediate_op (insn_loc, opjp, 0, + BFD_RELOC_SH_IMMS10); + j++; + break; + + case A_IMMS10BY2: + insn |= shmedia_immediate_op (insn_loc, opjp, 0, + BFD_RELOC_SH_IMMS10BY2); + j++; + break; + + case A_IMMS10BY4: + if (opjp->reloctype == BFD_RELOC_NONE) + insn |= shmedia_immediate_op (insn_loc, opjp, 0, + BFD_RELOC_SH_IMMS10BY4); + else if (opjp->reloctype == BFD_RELOC_SH_GOTPLT32) + insn |= shmedia_immediate_op (insn_loc, opjp, 0, + BFD_RELOC_SH_GOTPLT10BY4); + else if (opjp->reloctype == BFD_RELOC_32_GOT_PCREL) + insn |= shmedia_immediate_op (insn_loc, opjp, 0, + BFD_RELOC_SH_GOT10BY4); + else + as_bad (_("invalid PIC reference")); + j++; + break; + + case A_IMMS10BY8: + if (opjp->reloctype == BFD_RELOC_NONE) + insn |= shmedia_immediate_op (insn_loc, opjp, 0, + BFD_RELOC_SH_IMMS10BY8); + else if (opjp->reloctype == BFD_RELOC_SH_GOTPLT32) + insn |= shmedia_immediate_op (insn_loc, opjp, 0, + BFD_RELOC_SH_GOTPLT10BY8); + else if (opjp->reloctype == BFD_RELOC_32_GOT_PCREL) + insn |= shmedia_immediate_op (insn_loc, opjp, 0, + BFD_RELOC_SH_GOT10BY8); + else + as_bad (_("invalid PIC reference")); + j++; + break; + + case A_IMMS16: + /* Sneak a peek if this is the MOVI insn. If so, check if we + should expand it. */ + if (opjp->reloctype == BFD_RELOC_32_GOT_PCREL) + opjp->reloctype = BFD_RELOC_SH_GOT_LOW16; + else if (opjp->reloctype == BFD_RELOC_SH_GOTPLT32) + opjp->reloctype = BFD_RELOC_SH_GOTPLT_LOW16; + + if ((opjp->reloctype == BFD_RELOC_NONE + || opjp->reloctype == BFD_RELOC_32_GOTOFF + || opjp->reloctype == BFD_RELOC_32_PLT_PCREL + || opjp->reloctype == BFD_RELOC_SH_GOTPC) + && opcode->opcode_base == SHMEDIA_MOVI_OPC + && (opjp->immediate.X_op != O_constant + || opjp->immediate.X_add_number < -32768 + || opjp->immediate.X_add_number > 32767) + && (sh64_expand + || opjp->reloctype == BFD_RELOC_32_GOTOFF + || opjp->reloctype == BFD_RELOC_32_PLT_PCREL + || opjp->reloctype == BFD_RELOC_SH_GOTPC)) + { + int what = sh64_abi == sh64_abi_64 ? MOVI_IMM_64 : MOVI_IMM_32; + offsetT max = sh64_abi == sh64_abi_64 ? MOVI_64 : MOVI_32; + offsetT min = MOVI_16; + offsetT init = UNDEF_MOVI; + valueT addvalue + = opjp->immediate.X_op_symbol != NULL + ? 0 : opjp->immediate.X_add_number; + symbolS *sym + = opjp->immediate.X_op_symbol != NULL + ? make_expr_symbol (&opjp->immediate) + : opjp->immediate.X_add_symbol; + + if (opjp->reloctype == BFD_RELOC_32_GOTOFF) + init = max = min = MOVI_GOTOFF; + else if (opjp->reloctype == BFD_RELOC_32_PLT_PCREL) + { + init = max = min = MOVI_PLT; + what = (sh64_abi == sh64_abi_64 + ? MOVI_IMM_64_PCREL + : MOVI_IMM_32_PCREL); + } + else if (opjp->reloctype == BFD_RELOC_SH_GOTPC) + { + init = max = min = MOVI_GOTPC; + what = (sh64_abi == sh64_abi_64 + ? MOVI_IMM_64_PCREL + : MOVI_IMM_32_PCREL); + } + + frag_var (rs_machine_dependent, + md_relax_table[C (what, max)].rlx_length, + md_relax_table[C (what, min)].rlx_length, + C (what, init), sym, addvalue, insn_loc); + } + else + insn |= shmedia_immediate_op (insn_loc, opjp, 0, + (opjp->reloctype + == BFD_RELOC_NONE) + ? BFD_RELOC_SH_IMMS16 + : opjp->reloctype); + j++; + break; + + case A_PCIMMS16BY4: + { + int what + = ((sh64_abi == sh64_abi_64 && ! sh64_pt32) + ? SH64PCREL16_64 : SH64PCREL16_32); + offsetT max + = ((sh64_abi == sh64_abi_64 && ! sh64_pt32) + ? SH64PCREL64 : SH64PCREL32); + offsetT min = SH64PCREL16; + offsetT init = UNDEF_SH64PCREL; + + /* Don't allow complex expressions here. */ + if (opjp->immediate.X_op_symbol != NULL) + return 0; + + if (opjp->reloctype == BFD_RELOC_32_PLT_PCREL) + init = max = min = SH64PCRELPLT; + + /* If we're not expanding, then just emit a fixup. */ + if (sh64_expand || opjp->reloctype != BFD_RELOC_NONE) + frag_var (rs_machine_dependent, + md_relax_table[C (what, max)].rlx_length, + md_relax_table[C (what, min)].rlx_length, + C (what, init), + opjp->immediate.X_add_symbol, + opjp->immediate.X_add_number, + insn_loc); + else + insn |= shmedia_immediate_op (insn_loc, opjp, 1, + opjp->reloctype == BFD_RELOC_NONE + ? BFD_RELOC_SH_PT_16 + : opjp->reloctype); + + j++; + break; + } + + case A_PCIMMS16BY4_PT: + { + int what + = ((sh64_abi == sh64_abi_64 && ! sh64_pt32) + ? SH64PCREL16PT_64 : SH64PCREL16PT_32); + offsetT max + = ((sh64_abi == sh64_abi_64 && ! sh64_pt32) + ? SH64PCREL64 : SH64PCREL32); + offsetT min = SH64PCREL16; + offsetT init = UNDEF_SH64PCREL; + + /* Don't allow complex expressions here. */ + if (opjp->immediate.X_op_symbol != NULL) + return 0; + + if (opjp->reloctype == BFD_RELOC_32_PLT_PCREL) + init = max = min = SH64PCRELPLT; + + /* If we're not expanding, then just emit a fixup. */ + if (sh64_expand || opjp->reloctype != BFD_RELOC_NONE) + frag_var (rs_machine_dependent, + md_relax_table[C (what, max)].rlx_length, + md_relax_table[C (what, min)].rlx_length, + C (what, init), + opjp->immediate.X_add_symbol, + opjp->immediate.X_add_number, + insn_loc); + else + /* This reloc-type is just temporary, so we can distinguish + PTA from PT. It is changed in shmedia_md_apply_fix3 to + BFD_RELOC_SH_PT_16. */ + insn |= shmedia_immediate_op (insn_loc, opjp, 1, + opjp->reloctype == BFD_RELOC_NONE + ? SHMEDIA_BFD_RELOC_PT + : opjp->reloctype); + + j++; + break; + } + + case A_IMMU5: + insn |= shmedia_immediate_op (insn_loc, opjp, 0, + BFD_RELOC_SH_IMMU5); + j++; + break; + + case A_IMMU6: + insn |= shmedia_immediate_op (insn_loc, opjp, 0, + BFD_RELOC_SH_IMMU6); + j++; + break; + + case A_IMMU16: + insn |= shmedia_immediate_op (insn_loc, opjp, 0, + (opjp->reloctype + == BFD_RELOC_NONE) + ? BFD_RELOC_SH_IMMU16 + : opjp->reloctype); + j++; + break; + + default: + BAD_CASE (argtype); + } + } + + md_number_to_chars (insn_loc, insn, 4); + return 4; +} + +/* Assemble a SHmedia instruction. */ + +static void +shmedia_md_assemble (str) + char *str; +{ + char *op_end; + shmedia_opcode_info *opcode; + shmedia_operands_info operands; + int size; + + opcode = shmedia_find_cooked_opcode (&str); + op_end = str; + + if (opcode == NULL) + { + as_bad (_("unknown opcode")); + return; + } + + /* Start a SHmedia code region, if there has been pseudoinsns or similar + seen since the last one. */ + if (seen_insn == false) + { + sh64_update_contents_mark (true); + sh64_set_contents_type (CRT_SH5_ISA32); + seen_insn = true; + } + + op_end = shmedia_get_operands (opcode, op_end, &operands); + + if (op_end == NULL) + { + as_bad (_("invalid operands to %s"), opcode->name); + return; + } + + if (*op_end) + { + as_bad (_("excess operands to %s"), opcode->name); + return; + } + + size = shmedia_build_Mytes (opcode, &operands); + if (size == 0) + return; +} + +/* Hook called from md_begin in tc-sh.c. */ + +void +shmedia_md_begin () +{ + const shmedia_opcode_info *shmedia_opcode; + shmedia_opcode_hash_control = hash_new (); + + /* Create opcode table for SHmedia mnemonics. */ + for (shmedia_opcode = shmedia_table; + shmedia_opcode->name; + shmedia_opcode++) + hash_insert (shmedia_opcode_hash_control, shmedia_opcode->name, + (char *) shmedia_opcode); +} + +/* Switch instruction set. Only valid if one of the --isa or --abi + options was specified. */ + +static void +s_sh64_mode (ignore) + int ignore ATTRIBUTE_UNUSED; +{ + char *name = input_line_pointer, ch; + + /* Make sure data up to this location is handled according to the + previous ISA. */ + sh64_update_contents_mark (true); + + while (!is_end_of_line[(unsigned char) *input_line_pointer]) + input_line_pointer++; + ch = *input_line_pointer; + *input_line_pointer = '\0'; + + /* If the mode was not set before, explicitly or implicitly, then we're + not emitting SH64 code, so this pseudo is invalid. */ + if (sh64_isa_mode == sh64_isa_unspecified) + as_bad (_("The `.mode %s' directive is not valid with this architecture"), + name); + + if (strcasecmp (name, "shcompact") == 0) + sh64_isa_mode = sh64_isa_shcompact; + else if (strcasecmp (name, "shmedia") == 0) + sh64_isa_mode = sh64_isa_shmedia; + else + as_bad (_("Invalid argument to .mode: %s"), name); + + /* Make a new frag, marking it with the supposedly-changed ISA. */ + frag_wane (frag_now); + frag_new (0); + + /* Contents type up to this new point is the same as before; don't add a + data region just because the new frag we created. */ + sh64_update_contents_mark (false); + + *input_line_pointer = ch; + demand_empty_rest_of_line (); +} + +/* Check that the right ABI is used. Only valid if one of the --isa or + --abi options was specified. */ + +static void +s_sh64_abi (ignore) + int ignore ATTRIBUTE_UNUSED; +{ + char *name = input_line_pointer, ch; + + while (!is_end_of_line[(unsigned char) *input_line_pointer]) + input_line_pointer++; + ch = *input_line_pointer; + *input_line_pointer = '\0'; + + /* If the mode was not set before, explicitly or implicitly, then we're + not emitting SH64 code, so this pseudo is invalid. */ + if (sh64_abi == sh64_abi_unspecified) + as_bad (_("The `.abi %s' directive is not valid with this architecture"), + name); + + if (strcmp (name, "64") == 0) + { + if (sh64_abi != sh64_abi_64) + as_bad (_("`.abi 64' but command-line options do not specify 64-bit ABI")); + } + else if (strcmp (name, "32") == 0) + { + if (sh64_abi != sh64_abi_32) + as_bad (_("`.abi 32' but command-line options do not specify 32-bit ABI")); + } + else + as_bad (_("Invalid argument to .abi: %s"), name); + + *input_line_pointer = ch; + demand_empty_rest_of_line (); +} + +/* This function is the first target-specific function called after + parsing command-line options. Therefore we set default values from + command-line options here and do some sanity checking we couldn't do + when options were being parsed. */ + +const char * +sh64_target_format () +{ +#ifdef TE_LINUX + return "FIXME: No linux target yet"; +#endif + + if (sh64_abi == sh64_abi_64 && sh64_isa_mode == sh64_isa_unspecified) + sh64_isa_mode = sh64_isa_shmedia; + + if (sh64_abi == sh64_abi_32 && sh64_isa_mode == sh64_isa_unspecified) + sh64_isa_mode = sh64_isa_shcompact; + + if (sh64_isa_mode == sh64_isa_shcompact + && sh64_abi == sh64_abi_unspecified) + sh64_abi = sh64_abi_32; + + if (sh64_isa_mode == sh64_isa_shmedia + && sh64_abi == sh64_abi_unspecified) + sh64_abi = sh64_abi_64; + + if (sh64_isa_mode == sh64_isa_unspecified && ! sh64_mix) + as_bad (_("-no-mix is invalid without specifying SHcompact or SHmedia")); + + if ((sh64_isa_mode == sh64_isa_unspecified + || sh64_isa_mode == sh64_isa_shmedia) + && sh64_shcompact_const_crange) + as_bad (_("-shcompact-const-crange is invalid without SHcompact")); + + if (sh64_pt32 && sh64_abi != sh64_abi_64) + as_bad (_("-expand-pt32 only valid with -abi=64")); + + if (! sh64_expand && sh64_isa_mode == sh64_isa_unspecified) + as_bad (_("-no-expand only valid with SHcompact or SHmedia")); + + if (sh64_pt32 && ! sh64_expand) + as_bad (_("-expand-pt32 invalid together with -no-expand")); + + /* When the ISA is not one of SHmedia or SHcompact, use the old SH + object format. */ + if (sh64_isa_mode == sh64_isa_unspecified) + return (target_big_endian ? "elf32-sh" : "elf32-shl"); + else if (sh64_abi == sh64_abi_64) + return (target_big_endian ? "elf64-sh64" : "elf64-sh64l"); + else + return (target_big_endian ? "elf32-sh64" : "elf32-sh64l"); +} + +/* The worker function of TARGET_MACH. */ + +int +sh64_target_mach () +{ + /* We need to explicitly set bfd_mach_sh5 instead of the default 0. But + we only do this for the 64-bit ABI: if we do it for the 32-bit ABI, + the SH5 info in the bfd_arch_info structure will be selected. + However correct, as the machine has 64-bit addresses, functions + expected to emit 32-bit data for addresses will start failing. For + example, the dwarf2dbg.c functions will emit 64-bit debugging format, + and we don't want that in the 32-bit ABI. + + We could have two bfd_arch_info structures for SH64; one for the + 32-bit ABI and one for the rest (64-bit ABI). But that would be a + bigger kludge: it's a flaw in the BFD design, and we need to just + work around it by having the default machine set here in the + assembler. For everything else but the assembler, the various bfd + functions will set the machine type right to bfd_mach_sh5 from object + file header flags regardless of the 0 here. */ + + return (sh64_abi == sh64_abi_64) ? bfd_mach_sh5 : 0; +} + +/* This is MD_PCREL_FROM_SECTION, we we define so it is called instead of + md_pcrel_from (in tc-sh.c). */ + +valueT +shmedia_md_pcrel_from_section (fixP, sec) + struct fix *fixP; + segT sec ATTRIBUTE_UNUSED; +{ + know (fixP->fx_frag->fr_type == rs_machine_dependent); + + /* Use the ISA for the instruction to decide which offset to use. We + can glean it from the fisup type. */ + switch (fixP->fx_r_type) + { + case BFD_RELOC_SH_IMM_LOW16: + case BFD_RELOC_SH_IMM_MEDLOW16: + case BFD_RELOC_SH_IMM_MEDHI16: + case BFD_RELOC_SH_IMM_HI16: + case BFD_RELOC_SH_IMM_LOW16_PCREL: + case BFD_RELOC_SH_IMM_MEDLOW16_PCREL: + case BFD_RELOC_SH_IMM_MEDHI16_PCREL: + case BFD_RELOC_SH_IMM_HI16_PCREL: + case BFD_RELOC_SH_IMMU5: + case BFD_RELOC_SH_IMMU6: + case BFD_RELOC_SH_IMMS6: + case BFD_RELOC_SH_IMMS10: + case BFD_RELOC_SH_IMMS10BY2: + case BFD_RELOC_SH_IMMS10BY4: + case BFD_RELOC_SH_IMMS10BY8: + case BFD_RELOC_SH_IMMS16: + case BFD_RELOC_SH_IMMU16: + case BFD_RELOC_SH_PT_16: + case SHMEDIA_BFD_RELOC_PT: + /* PC-relative relocs are relative to the address of the last generated + instruction, i.e. fx_size - 4. */ + return SHMEDIA_MD_PCREL_FROM_FIX (fixP); + + case BFD_RELOC_64: + case BFD_RELOC_64_PCREL: + know (0 /* Shouldn't get here. */); + break; + + default: + /* If section was SHcompact, use its function. */ + return (valueT) md_pcrel_from_section (fixP, sec); + } + + know (0 /* Shouldn't get here. */); + return 0; +} + +/* Create one .cranges descriptor from two symbols, STARTSYM marking begin + and ENDSYM marking end, and CR_TYPE specifying the type. */ + +static void +sh64_emit_crange (startsym, endsym, cr_type) + symbolS *startsym; + symbolS *endsym; + enum sh64_elf_cr_type cr_type; +{ + expressionS exp; + segT current_seg = now_seg; + subsegT current_subseg = now_subseg; + + asection *cranges + = bfd_make_section_old_way (stdoutput, + SH64_CRANGES_SECTION_NAME); + + /* Temporarily change to the .cranges section. */ + subseg_set (cranges, 0); + + /* Emit the cr_addr part. */ + exp.X_op = O_symbol; + exp.X_add_number = 0; + exp.X_op_symbol = NULL; + exp.X_add_symbol = startsym; + emit_expr (&exp, 4); + + /* Emit the cr_size part. */ + exp.X_op = O_subtract; + exp.X_add_number = 0; + exp.X_add_symbol = endsym; + exp.X_op_symbol = startsym; + emit_expr (&exp, 4); + + /* Emit the cr_size part. */ + exp.X_op = O_constant; + exp.X_add_number = cr_type; + exp.X_add_symbol = NULL; + exp.X_op_symbol = NULL; + emit_expr (&exp, 2); + + /* Now back to our regular program. */ + subseg_set (current_seg, current_subseg); +} + +/* Called when the assembler is about to emit contents of some type into + SEG, so it is *known* that the type of that new contents is in + NEW_CONTENTS_TYPE. If just switching back and forth between different + contents types (for example, with consecutive .mode pseudos), then this + function isn't called. */ + +static void +sh64_set_contents_type (new_contents_type) + enum sh64_elf_cr_type new_contents_type; +{ + segment_info_type *seginfo; + + /* We will not be called when emitting .cranges output, since callers + stop that. Validize that assumption. */ + know (emitting_crange == false); + + seginfo = seg_info (now_seg); + + if (seginfo) + { + symbolS *symp = seginfo->tc_segment_info_data.last_contents_mark; + + enum sh64_elf_cr_type contents_type + = seginfo->tc_segment_info_data.contents_type; + + /* If it was just SHcompact switching between code and constant + pool, don't change contents type. Just make sure we don't set + the contents type to data, as that would join with a data-region + in SHmedia mode. */ + if (sh64_isa_mode == sh64_isa_shcompact + && ! sh64_shcompact_const_crange) + new_contents_type = CRT_SH5_ISA16; + + /* If nothing changed, stop here. */ + if (contents_type == new_contents_type) + return; + + /* If we're in 64-bit ABI mode, we do not emit .cranges, as it is + only specified for 32-bit addresses. It could presumably be + extended, but in 64-bit ABI mode we don't have SHcompact code, so + we would only use it to mark code and data. */ + if (sh64_abi == sh64_abi_64) + { + /* Make the code type "sticky". We don't want to set the + sections contents type to data if there's any code in it as + we don't have .cranges in 64-bit mode to notice the + difference. */ + seginfo->tc_segment_info_data.contents_type + = (new_contents_type == CRT_SH5_ISA32 + || contents_type == CRT_SH5_ISA32) + ? CRT_SH5_ISA32 : new_contents_type; + return; + } + + /* If none was marked, create a start symbol for this range and + perhaps as a closing symbol for the old one. */ + if (symp == NULL) + symp = symbol_new (FAKE_LABEL_NAME, now_seg, (valueT) frag_now_fix (), + frag_now); + + /* We will use this symbol, so don't leave a pointer behind. */ + seginfo->tc_segment_info_data.last_contents_mark = NULL; + + /* We'll be making only datalabel references to it, if we emit a + .cranges descriptor, so remove any code flag. */ + S_SET_OTHER (symp, S_GET_OTHER (symp) & ~STO_SH5_ISA32); + + /* If we have already marked the start of a range, we need to close + and emit it before marking a new one, so emit a new .cranges + descriptor into the .cranges section. */ + if (seginfo->tc_segment_info_data.mode_start_symbol) + { + /* If we're not supposed to emit mixed-mode sections, make it an + error, but continue processing. */ + if (! sh64_mix + && (new_contents_type == CRT_SH5_ISA32 + || contents_type == CRT_SH5_ISA32)) + as_bad ( +_("SHmedia code not allowed in same section as constants and SHcompact code")); + + emitting_crange = true; + sh64_emit_crange (seginfo->tc_segment_info_data.mode_start_symbol, + symp, contents_type); + emitting_crange = false; + seginfo->tc_segment_info_data.emitted_ranges++; + } + + seginfo->tc_segment_info_data.mode_start_symbol = symp; + seginfo->tc_segment_info_data.mode_start_subseg = now_subseg; + seginfo->tc_segment_info_data.contents_type = new_contents_type; + + /* Always reset this, so the SHcompact code will emit a reloc when + it prepares to relax. */ + seginfo->tc_segment_info_data.in_code = 0; + } + else + as_bad (_("No segment info for current section")); +} + +/* Hook when defining symbols and labels. We set the ST_OTHER field if + the symbol is "shmedia" (with "bitor 1" automatically applied). Simple + semantics for a label being "shmedia" : It was defined when .mode + SHmedia was in effect, and it was defined in a code section. It + doesn't matter whether or not an assembled opcode is nearby. */ + +void +sh64_frob_label (symp) + symbolS *symp; +{ + segT seg = S_GET_SEGMENT (symp); + static const symbolS *null = NULL; + + /* Reset the tc marker for all newly created symbols. */ + symbol_set_tc (symp, (symbolS **) &null); + + if (seg != NULL && sh64_isa_mode == sh64_isa_shmedia && subseg_text_p (seg)) + S_SET_OTHER (symp, S_GET_OTHER (symp) | STO_SH5_ISA32); +} + +/* Handle the "datalabel" qualifier. We need to call "operand", but it's + static, so a function pointer is passed here instead. FIXME: A target + hook for qualifiers is needed; we currently use the md_parse_name + symbol hook. */ + +int +sh64_consume_datalabel (name, exp, cp, operandf) + const char *name; + expressionS *exp; + char *cp; + segT (*operandf) PARAMS ((expressionS *)); +{ + static int parsing_datalabel = 0; + + if (strcasecmp (name, "datalabel") == 0) + { + int save_parsing_datalabel = parsing_datalabel; + + if (parsing_datalabel) + as_bad (_("duplicate datalabel operator ignored")); + + *input_line_pointer = *cp; + parsing_datalabel = 1; + (*operandf) (exp); + parsing_datalabel = save_parsing_datalabel; + + if (exp->X_op == O_symbol || exp->X_op == O_PIC_reloc) + { + symbolS *symp = exp->X_add_symbol; + segT symseg = S_GET_SEGMENT (symp); + + /* If the symbol is defined to something that is already a + datalabel, we don't need to bother with any special handling. */ + if (symseg != undefined_section + && S_GET_OTHER (symp) != STO_SH5_ISA32) + /* Do nothing. */ + ; + else + { + symbolS *dl_symp; + const char *name = S_GET_NAME (symp); + char *dl_name + = xmalloc (strlen (name) + sizeof (DATALABEL_SUFFIX)); + + /* Now we copy the datalabel-qualified symbol into a symbol + with the same name, but with " DL" appended. We mark the + symbol using the TC_SYMFIELD_TYPE field with a pointer to + the main symbol, so we don't have to inspect all symbol + names. Note that use of "datalabel" is not expected to + be a common case. */ + strcpy (dl_name, name); + strcat (dl_name, DATALABEL_SUFFIX); + + /* A FAKE_LABEL_NAME marks "$" or ".". There can be any + number of them and all have the same (faked) name; we + must make a new one each time. */ + if (strcmp (name, FAKE_LABEL_NAME) == 0) + dl_symp = symbol_make (dl_name); + else + dl_symp = symbol_find_or_make (dl_name); + + free (dl_name); + symbol_set_value_expression (dl_symp, + symbol_get_value_expression (symp)); + S_SET_SEGMENT (dl_symp, symseg); + symbol_set_frag (dl_symp, symbol_get_frag (symp)); + symbol_set_tc (dl_symp, &symp); + copy_symbol_attributes (dl_symp, symp); + exp->X_add_symbol = dl_symp; + + /* Unset the BranchTarget mark that can be set at symbol + creation or attributes copying. */ + S_SET_OTHER (dl_symp, S_GET_OTHER (dl_symp) & ~STO_SH5_ISA32); + + /* The GLOBAL and WEAK attributes are not copied over by + copy_symbol_attributes. Do it here. */ + if (S_IS_WEAK (symp)) + S_SET_WEAK (dl_symp); + else if (S_IS_EXTERNAL (symp)) + S_SET_EXTERNAL (dl_symp); + } + } + /* Complain about other types of operands than symbol, unless they + have already been complained about. A constant is always a + datalabel. Removing the low bit would therefore be wrong. + Complaining about it would also be wrong. */ + else if (exp->X_op != O_illegal + && exp->X_op != O_absent + && exp->X_op != O_constant) + as_bad (_("Invalid DataLabel expression")); + + *cp = *input_line_pointer; + + return 1; + } + + return sh_parse_name (name, exp, cp); +} + +/* This function is called just before symbols are being output. It + returns zero when a symbol must be output, non-zero otherwise. + Datalabel references that were fully resolved to local symbols are not + necessary to output. We also do not want to output undefined symbols + that are not used in relocs. For symbols that are used in a reloc, it + does not matter what we set here. If it is *not* used in a reloc, then + it was probably the datalabel counterpart that was used in a reloc; + then we need not output the main symbol. */ + +int +sh64_exclude_symbol (symp) + symbolS *symp; +{ + symbolS *main_symbol = *symbol_get_tc (symp); + + return main_symbol != NULL || ! S_IS_DEFINED (symp); +} + +/* If we haven't seen an insn since the last update, and location + indicators have moved (a new frag, new location within frag) we have + emitted data, so change contents type to data. Forget that we have + seen a sequence of insns and store the current location so we can mark + a new region if needed. */ + +static void +sh64_update_contents_mark (update_type) + boolean update_type; +{ + segment_info_type *seginfo; + seginfo = seg_info (now_seg); + + if (seginfo != NULL) + { + symbolS *symp = seginfo->tc_segment_info_data.last_contents_mark; + + if (symp == NULL) + { + symp = symbol_new (FAKE_LABEL_NAME, now_seg, + (valueT) frag_now_fix (), frag_now); + seginfo->tc_segment_info_data.last_contents_mark = symp; + } + else + { + /* If we have moved location since last flush, we need to emit a + data range. The previous contents type ended at the location + of the last update. */ + if ((S_GET_VALUE (symp) != frag_now_fix () + || symbol_get_frag (symp) != frag_now)) + { + enum sh64_elf_cr_type contents_type + = seginfo->tc_segment_info_data.contents_type; + + if (update_type + && contents_type != CRT_DATA + && contents_type != CRT_NONE + && ! seen_insn) + { + sh64_set_contents_type (CRT_DATA); + symp = seginfo->tc_segment_info_data.last_contents_mark; + } + + /* If the symbol wasn't used up to make up a new range + descriptor, update it to this new location. */ + if (symp) + { + S_SET_VALUE (symp, (valueT) frag_now_fix ()); + symbol_set_frag (symp, frag_now); + } + } + } + } + + seen_insn = false; +} + +/* Called when the assembler is about to output some data, or maybe it's + just switching segments. */ + +void +sh64_flush_pending_output () +{ + sh64_update_contents_mark (true); + sh_flush_pending_output (); +} + +/* Flush out the last crange descriptor after all insns have been emitted. */ + +static void +sh64_flush_last_crange (abfd, seg, countparg) + bfd *abfd ATTRIBUTE_UNUSED; + asection *seg; + PTR countparg ATTRIBUTE_UNUSED; +{ + segment_info_type *seginfo; + + seginfo = seg_info (seg); + + if (seginfo + /* Only emit .cranges descriptors if we would make it more than one. */ + && seginfo->tc_segment_info_data.emitted_ranges != 0) + { + symbolS *symp; + + /* We need a closing symbol, so switch to the indicated section and + emit it. */ + + /* Change to the section we're about to handle. */ + subseg_set (seg, seginfo->tc_segment_info_data.mode_start_subseg); + + symp = symbol_new (FAKE_LABEL_NAME, now_seg, (valueT) frag_now_fix (), + frag_now); + + /* We'll be making a datalabel reference to it, so remove any code + flag. */ + S_SET_OTHER (symp, S_GET_OTHER (symp) & ~STO_SH5_ISA32); + + sh64_emit_crange (seginfo->tc_segment_info_data.mode_start_symbol, + symp, + seginfo->tc_segment_info_data.contents_type); + } +} + +/* If and only if we see a call to md_number_to_chars without flagging the + start of an insn, we set the contents type to CRT_DATA, and only when + in SHmedia mode. Note that by default we don't bother changing when + going from SHcompact to data, as the constant pools in GCC-generated + SHcompact code would create an inordinate amount of .cranges + descriptors. */ + +static void +sh64_flag_output () +{ + if (sh64_isa_mode != sh64_isa_unspecified + && seen_insn == false + && sh64_end_of_assembly == false + && ! emitting_crange) + { + md_flush_pending_output (); + sh64_set_contents_type (CRT_DATA); + } +} + +/* Vtables don't need "datalabel" but we allow it by simply deleting + any we find. */ + +static char * +strip_datalabels () +{ + char *src, *dest, *start=input_line_pointer; + + for (src=input_line_pointer, dest=input_line_pointer; *src != '\n'; ) + { + if (strncasecmp (src, "datalabel", 9) == 0 + && ISSPACE (src[9]) + && (src == start || !(ISALNUM (src[-1])) || src[-1] == '_')) + src += 10; + else + *dest++ = *src++; + } + + if (dest < src) + *dest = '\n'; + return src + 1; +} + +static void +sh64_vtable_entry (ignore) + int ignore ATTRIBUTE_UNUSED; +{ + char *eol = strip_datalabels (); + + obj_elf_vtable_entry (0); + input_line_pointer = eol; +} + +static void +sh64_vtable_inherit (ignore) + int ignore ATTRIBUTE_UNUSED; +{ + char *eol = strip_datalabels (); + + obj_elf_vtable_inherit (0); + input_line_pointer = eol; +} diff -uprN binutils-2.11.93.0.2/gas/config/tc-sh64.h binutils-2.12.90.0.1/gas/config/tc-sh64.h --- binutils-2.11.93.0.2/gas/config/tc-sh64.h Wed Dec 31 16:00:00 1969 +++ binutils-2.12.90.0.1/gas/config/tc-sh64.h Thu Mar 7 11:52:37 2002 @@ -0,0 +1,212 @@ +/* This file is tc-sh64.h + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS 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. + + GAS 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 GAS; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#define TC_SH64 +#include "config/tc-sh.h" +#include "elf/sh.h" + +/* We need to override the tc-sh.h settings of HANDLE_ALIGN and + MAX_MEM_FOR_RS_ALIGN_CODE; we might need to put in SHmedia NOP:s, not + SHcompact NOP:s. */ +#undef HANDLE_ALIGN +#define HANDLE_ALIGN(frag) sh64_handle_align (frag) +extern void sh64_handle_align PARAMS ((fragS *)); + +#undef MAX_MEM_FOR_RS_ALIGN_CODE +#define MAX_MEM_FOR_RS_ALIGN_CODE sh64_max_mem_for_rs_align_code () +extern int sh64_max_mem_for_rs_align_code PARAMS ((void)); + +#undef LISTING_HEADER +#define LISTING_HEADER \ + (target_big_endian ? \ + "Hitachi SHcompact/SHmedia Big Endian GAS" \ + : "Hitachi SHcompact/SHmedia Little Endian GAS") + +/* We need to record the new frag position after an .align. */ +extern void sh64_do_align PARAMS ((int, const char *, int, int)); +#define md_do_align(n, fill, len, max, l) \ + do { sh64_do_align (n, fill, len, max); goto l; } while (0) + +struct sh64_segment_info_type +{ + /* The type of the section is initialized when the range_start_symbol + member is non-NULL. */ + symbolS *mode_start_symbol; + subsegT mode_start_subseg; + + /* A stored symbol indicating location of last call of + "md_flush_pending_output". It is NULLed when we actually use it; + otherwise the contents is just filled in with segment, frag and + offset within frag. */ + symbolS *last_contents_mark; + + unsigned int emitted_ranges; + enum sh64_elf_cr_type contents_type; + + /* This is used by the SH1-4 parts; we set it to 0 for SHmedia code and + data. */ + unsigned int in_code : 1; +}; + +#undef TC_SEGMENT_INFO_TYPE +#define TC_SEGMENT_INFO_TYPE struct sh64_segment_info_type + +#undef TARGET_FORMAT +#define TARGET_FORMAT sh64_target_format () +extern const char *sh64_target_format PARAMS ((void)); + +#define TARGET_MACH sh64_target_mach () +extern int sh64_target_mach PARAMS ((void)); + +#undef TC_RELOC_RTSYM_LOC_FIXUP +#define TC_RELOC_RTSYM_LOC_FIXUP(FIX) \ + ((FIX)->fx_r_type != BFD_RELOC_32_PLT_PCREL \ + && (FIX)->fx_r_type != BFD_RELOC_SH_PLT_LOW16 \ + && (FIX)->fx_r_type != BFD_RELOC_SH_PLT_MEDLOW16 \ + && (FIX)->fx_r_type != BFD_RELOC_SH_PLT_MEDHI16 \ + && (FIX)->fx_r_type != BFD_RELOC_SH_PLT_HI16 \ + && (FIX)->fx_r_type != BFD_RELOC_32_GOT_PCREL \ + && (FIX)->fx_r_type != BFD_RELOC_SH_GOT_LOW16 \ + && (FIX)->fx_r_type != BFD_RELOC_SH_GOT_MEDLOW16 \ + && (FIX)->fx_r_type != BFD_RELOC_SH_GOT_MEDHI16 \ + && (FIX)->fx_r_type != BFD_RELOC_SH_GOT_HI16 \ + && (FIX)->fx_r_type != BFD_RELOC_SH_GOT10BY4 \ + && (FIX)->fx_r_type != BFD_RELOC_SH_GOT10BY8 \ + && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPLT32 \ + && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPLT_LOW16 \ + && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPLT_MEDLOW16 \ + && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPLT_MEDHI16 \ + && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPLT_HI16 \ + && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPLT10BY4 \ + && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPLT10BY8 \ + && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPC \ + && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPC_LOW16 \ + && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPC_MEDLOW16 \ + && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPC_MEDHI16 \ + && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPC_HI16 \ + && ((FIX)->fx_addsy == NULL \ + || (! S_IS_EXTERNAL ((FIX)->fx_addsy) \ + && ! S_IS_WEAK ((FIX)->fx_addsy) \ + && S_IS_DEFINED ((FIX)->fx_addsy) \ + && ! S_IS_COMMON ((FIX)->fx_addsy)))) + +/* Note the kludge: we want to put back C, and we also want to consume the + expression, since we have handled it ourselves. FIXME: What we really + need is a new GAS infrastructure feature: md_qualifier. */ +#undef md_parse_name +#define md_parse_name(NAME, EXP, CP) \ + sh64_consume_datalabel (NAME, EXP, CP, operand) +extern int sh64_consume_datalabel + PARAMS ((const char *, expressionS *, char *, segT (*) (expressionS *))); + +/* Saying "$" is the same as saying ".". */ +#define DOLLAR_DOT + +#define MD_PCREL_FROM_SECTION(FIXP, SEC) \ + shmedia_md_pcrel_from_section (FIXP, SEC) + +extern valueT shmedia_md_pcrel_from_section PARAMS ((struct fix *, segT)); + +/* We need to mark this symbol as a BranchTarget; setting st_other for it + and adding 1 to its value (temporarily). */ +extern void sh64_frob_label PARAMS ((symbolS *)); + +#undef tc_frob_label +#define tc_frob_label(sym) \ + do { sh_frob_label (); sh64_frob_label (sym); } while (0) + +#define tc_symbol_new_hook(s) sh64_frob_label (s) + +/* We use this to mark our "datalabel" symbol copies. The "mark" is NULL + for an ordinary symbol, and the pointer to the "ordinary" symbol for a + datalabel symbol. */ +#define TC_SYMFIELD_TYPE symbolS * + +#define tc_frob_symbol(symp, punt) \ + do \ + { \ + punt = sh64_exclude_symbol (symp); \ + } \ + while (0) + +extern int sh64_exclude_symbol PARAMS ((symbolS *)); + +extern void sh64_adjust_symtab PARAMS ((void)); +#define tc_adjust_symtab sh64_adjust_symtab + +#undef md_flush_pending_output +#define md_flush_pending_output() sh64_flush_pending_output () +extern void sh64_flush_pending_output PARAMS ((void)); + +/* Note that tc-sh.c has a sh_frob_section, but it's called from + tc_frob_file_before_adjust. */ +#define tc_frob_section(sec) shmedia_frob_section_type (sec) +extern void shmedia_frob_section_type PARAMS ((asection *)); + +#define ELF_TC_SPECIAL_SECTIONS \ + { ".cranges", SHT_PROGBITS, 0 }, + +/* We need to emit fixups relative to the frag in which the instruction + resides. Safest way without calculating max fragment growth or making + it a fixed number is to provide a pointer to the opcode frag. + + We also need to emit the right NOP pattern in .align frags. This is + done after the text-to-bits assembly pass, so we need to mark it with + the ISA setting at the time the .align was assembled. */ +#define TC_FRAG_TYPE struct sh64_tc_frag_data + +enum sh64_isa_values + { + sh64_isa_unspecified, + sh64_isa_shcompact, + sh64_isa_shmedia, + + /* Special guard value used in contexts when we don't know which ISA it + is, just that it's specified (not sh64_isa_unspecified). */ + sh64_isa_sh5_guard + }; + +struct sh64_tc_frag_data +{ + fragS *opc_frag; + enum sh64_isa_values isa; +}; + +extern enum sh64_isa_values sh64_isa_mode; + +#define TC_FRAG_INIT(FRAGP) \ + do \ + { \ + (FRAGP)->tc_frag_data.opc_frag = sh64_last_insn_frag; \ + (FRAGP)->tc_frag_data.isa = sh64_isa_mode; \ + } \ + while (0) + +/* This variable is set whenever we generate (or grow) a new opcode frag + in shmedia_build_Mytes. */ +extern fragS *sh64_last_insn_frag; + +#define md_end() shmedia_md_end () +void shmedia_md_end PARAMS ((void)); + +/* Because we make .debug_line hold the SHmedia instruction address | 1, + we have to say we only have minimum byte-size insns. */ +#undef DWARF2_LINE_MIN_INSN_LENGTH +#define DWARF2_LINE_MIN_INSN_LENGTH 1 diff -uprN binutils-2.11.93.0.2/gas/config/tc-sparc.c binutils-2.12.90.0.1/gas/config/tc-sparc.c --- binutils-2.11.93.0.2/gas/config/tc-sparc.c Sun Feb 3 11:22:31 2002 +++ binutils-2.12.90.0.1/gas/config/tc-sparc.c Thu Mar 7 11:52:37 2002 @@ -1,6 +1,6 @@ /* tc-sparc.c -- Assemble for the SPARC Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001 + 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -32,6 +32,12 @@ #include "dwarf2dbg.h" #endif +/* Some ancient Sun C compilers would not take such hex constants as + unsigned, and would end up sign-extending them to form an offsetT, + so use these constants instead. */ +#define U0xffffffff ((((unsigned long) 1 << 16) << 16) - 1) +#define U0x80000000 ((((unsigned long) 1 << 16) << 15)) + static struct sparc_arch *lookup_arch PARAMS ((char *)); static void init_default_arch PARAMS ((void)); static int sparc_ip PARAMS ((char *, const struct sparc_opcode **)); @@ -916,7 +922,7 @@ in_signed_range (val, max) if (sparc_arch_size == 32) { bfd_signed_vma sign = (bfd_signed_vma) 1 << 31; - val = ((val & 0xffffffff) ^ sign) - sign; + val = ((val & U0xffffffff) ^ sign) - sign; } if (val > max) return 0; @@ -1019,14 +1025,14 @@ synthetize_setuw (insn) { if (sizeof (offsetT) > 4 && (the_insn.exp.X_add_number < 0 - || the_insn.exp.X_add_number > (offsetT) 0xffffffff)) + || the_insn.exp.X_add_number > (offsetT) U0xffffffff)) as_warn (_("set: number not in 0..4294967295 range")); } else { if (sizeof (offsetT) > 4 - && (the_insn.exp.X_add_number < -(offsetT) 0x80000000 - || the_insn.exp.X_add_number > (offsetT) 0xffffffff)) + && (the_insn.exp.X_add_number < -(offsetT) U0x80000000 + || the_insn.exp.X_add_number > (offsetT) U0xffffffff)) as_warn (_("set: number not in -2147483648..4294967295 range")); the_insn.exp.X_add_number = (int) the_insn.exp.X_add_number; } @@ -1085,8 +1091,8 @@ synthetize_setsw (insn) } if (sizeof (offsetT) > 4 - && (the_insn.exp.X_add_number < -(offsetT) 0x80000000 - || the_insn.exp.X_add_number > (offsetT) 0xffffffff)) + && (the_insn.exp.X_add_number < -(offsetT) U0x80000000 + || the_insn.exp.X_add_number > (offsetT) U0xffffffff)) as_warn (_("setsw: number not in -2147483648..4294967295 range")); low32 = the_insn.exp.X_add_number; @@ -1128,7 +1134,7 @@ synthetize_setx (insn) int need_hh22_p = 0, need_hm10_p = 0, need_hi22_p = 0, need_lo10_p = 0; int need_xor10_p = 0; -#define SIGNEXT32(x) ((((x) & 0xffffffff) ^ 0x80000000) - 0x80000000) +#define SIGNEXT32(x) ((((x) & U0xffffffff) ^ U0x80000000) - U0x80000000) lower32 = SIGNEXT32 (the_insn.exp.X_add_number); upper32 = SIGNEXT32 (BSR (the_insn.exp.X_add_number, 32)); #undef SIGNEXT32 diff -uprN binutils-2.11.93.0.2/gas/config/tc-tic54x.c binutils-2.12.90.0.1/gas/config/tc-tic54x.c --- binutils-2.11.93.0.2/gas/config/tc-tic54x.c Sun Feb 3 11:22:31 2002 +++ binutils-2.12.90.0.1/gas/config/tc-tic54x.c Thu Mar 7 11:52:37 2002 @@ -1,5 +1,5 @@ /* tc-tic54x.c -- Assembly code for the Texas Instruments TMS320C54X - Copyright 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Contributed by Timothy Wall (twall@cygnus.com) This file is part of GAS, the GNU Assembler. @@ -42,8 +42,7 @@ TI sets labels to be data type 4 (T_INT); GAS uses T_NULL. COFF1 limits section names to 8 characters. - Some of the default behavior changed from COFF1 to COFF2. -*/ + Some of the default behavior changed from COFF1 to COFF2. */ #include #include @@ -58,45 +57,61 @@ #include "obj-coff.h" #include -#define MAX_LINE 256 /* Lines longer than this are truncated by TI's asm. */ -const char comment_chars[] = ";"; -const char line_comment_chars[] = ";*#"; /* At column zero only. */ -const char line_separator_chars[] = ""; /* Not permitted. */ +static struct stag +{ + symbolS *sym; /* Symbol for this stag; value is offset. */ + const char *name; /* Shortcut to symbol name. */ + bfd_vma size; /* Size of struct/union. */ + int current_bitfield_offset; /* Temporary for tracking fields. */ + int is_union; + struct stag_field /* List of fields. */ + { + const char *name; + bfd_vma offset; /* Of start of this field. */ + int bitfield_offset; /* Of start of this field. */ + struct stag *stag; /* If field is struct/union. */ + struct stag_field *next; + } *field; + /* For nesting; used only in stag construction. */ + struct stag *inner; /* Enclosed .struct. */ + struct stag *outer; /* Enclosing .struct. */ +} *current_stag = NULL; -/* Characters which indicate that this is a floating point constant. */ -const char FLT_CHARS[] = "fF"; +#define MAX_LINE 256 /* Lines longer than this are truncated by TI's asm. */ -/* Characters that can be used to separate mantissa from exp in FP - nums. */ -const char EXP_CHARS[] = "eE"; +typedef struct _tic54x_insn +{ + const template *tm; /* Opcode template. */ -/* Only word (et al.), align, or conditionals are allowed within - .struct/.union. */ -#define ILLEGAL_WITHIN_STRUCT() \ - do \ - if (current_stag != NULL) \ - { \ - as_bad (_("pseudo-op illegal within .struct/.union")); \ - return; \ - } \ - while (0) + char mnemonic[MAX_LINE]; /* Opcode name/mnemonic. */ + char parmnemonic[MAX_LINE]; /* 2nd mnemonic of parallel insn. */ -void -md_show_usage (stream) - FILE *stream; -{ - fprintf (stream, _("C54x-specific command line options:\n")); - fprintf (stream, _("-mfar-mode | -mf Use extended addressing\n")); - fprintf (stream, _("-mcpu= Specify the CPU version\n")); -#if 0 - fprintf (stream, _("-mcoff-version={0|1|2} Select COFF version\n")); -#endif - fprintf (stream, _("-merrors-to-file \n")); - fprintf (stream, _("-me Redirect errors to a file\n")); -} + int opcount; + struct opstruct + { + char buf[MAX_LINE]; + enum optype type; + expressionS exp; + } operands[MAX_OPERANDS]; -const char *md_shortopts = ""; + int paropcount; + struct opstruct paroperands[MAX_OPERANDS]; + + int is_lkaddr; + int lkoperand; + int words; /* Size of insn in 16-bit words. */ + int using_default_dst; /* Do we need to explicitly set an + omitted OP_DST operand? */ + struct + { + unsigned short word; /* Final encoded opcode data. */ + int unresolved; + int r_nchars; /* Relocation size. */ + bfd_reloc_code_real_type r_type; /* Relocation type. */ + expressionS addr_expr; /* Storage for unresolved expressions. */ + } opcode[3]; +} tic54x_insn; enum cpu_version { @@ -110,6 +125,24 @@ enum address_mode far_mode /* >16-bit addresses. */ }; +static segT stag_saved_seg; +static subsegT stag_saved_subseg; + +const char comment_chars[] = ";"; +const char line_comment_chars[] = ";*#"; /* At column zero only. */ +const char line_separator_chars[] = ""; /* Not permitted. */ + +int emitting_long = 0; + +/* Characters which indicate that this is a floating point constant. */ +const char FLT_CHARS[] = "fF"; + +/* Characters that can be used to separate mantissa from exp in FP + nums. */ +const char EXP_CHARS[] = "eE"; + +const char *md_shortopts = ""; + #define OPTION_ADDRESS_MODE (OPTION_MD_BASE) #define OPTION_CPU_VERSION (OPTION_ADDRESS_MODE + 1) #define OPTION_COFF_VERSION (OPTION_CPU_VERSION + 1) @@ -117,15 +150,15 @@ enum address_mode struct option md_longopts[] = { - { "mfar-mode", no_argument, NULL, OPTION_ADDRESS_MODE }, - { "mf", no_argument, NULL, OPTION_ADDRESS_MODE }, - { "mcpu", required_argument, NULL, OPTION_CPU_VERSION }, + { "mfar-mode", no_argument, NULL, OPTION_ADDRESS_MODE }, + { "mf", no_argument, NULL, OPTION_ADDRESS_MODE }, + { "mcpu", required_argument, NULL, OPTION_CPU_VERSION }, #if 0 { "mcoff-version", required_argument, NULL, OPTION_COFF_VERSION }, #endif { "merrors-to-file", required_argument, NULL, OPTION_STDERR_TO_FILE }, - { "me", required_argument, NULL, OPTION_STDERR_TO_FILE }, - { NULL, no_argument, NULL, 0}, + { "me", required_argument, NULL, OPTION_STDERR_TO_FILE }, + { NULL, no_argument, NULL, 0}, }; size_t md_longopts_size = sizeof (md_longopts); @@ -182,64 +215,152 @@ static struct hash_control *cc3_hash; static struct hash_control *sbit_hash; static struct hash_control *misc_symbol_hash; -static char *subsym_substitute PARAMS ((char *line, int forced)); -static char *subsym_lookup PARAMS ((char *name, int nest_level)); -static void subsym_create_or_replace PARAMS ((char *name, char *value)); -static float math_ceil PARAMS ((float, float)); -static float math_cvi PARAMS ((float, float)); -static float math_floor PARAMS ((float, float)); -static float math_fmod PARAMS ((float, float)); -static float math_int PARAMS ((float, float)); -static float math_round PARAMS ((float, float)); -static float math_sgn PARAMS ((float, float)); -static float math_trunc PARAMS ((float, float)); -static float math_acos PARAMS ((float, float)); -static float math_asin PARAMS ((float, float)); -static float math_atan PARAMS ((float, float)); -static float math_atan2 PARAMS ((float, float)); -static float math_cosh PARAMS ((float, float)); -static float math_cos PARAMS ((float, float)); -static float math_cvf PARAMS ((float, float)); -static float math_exp PARAMS ((float, float)); -static float math_fabs PARAMS ((float, float)); -static float math_ldexp PARAMS ((float, float)); -static float math_log10 PARAMS ((float, float)); -static float math_log PARAMS ((float, float)); -static float math_max PARAMS ((float, float)); -static float math_pow PARAMS ((float, float)); -static float math_sin PARAMS ((float, float)); -static float math_sinh PARAMS ((float, float)); -static float math_sqrt PARAMS ((float, float)); -static float math_tan PARAMS ((float, float)); -static float math_tanh PARAMS ((float, float)); +/* Only word (et al.), align, or conditionals are allowed within + .struct/.union. */ +#define ILLEGAL_WITHIN_STRUCT() \ + do \ + if (current_stag != NULL) \ + { \ + as_bad (_("pseudo-op illegal within .struct/.union")); \ + return; \ + } \ + while (0) -static struct stag -{ - symbolS *sym; /* Symbol for this stag; value is offset. */ - const char *name; /* Shortcut to symbol name. */ - bfd_vma size; /* Size of struct/union. */ - int current_bitfield_offset; /* Temporary for tracking fields. */ - int is_union; - struct stag_field /* List of fields. */ - { - const char *name; - bfd_vma offset; /* Of start of this field. */ - int bitfield_offset; /* Of start of this field. */ - struct stag *stag; /* If field is struct/union. */ - struct stag_field *next; - } *field; - /* For nesting; used only in stag construction. */ - struct stag *inner; /* Enclosed .struct. */ - struct stag *outer; /* Enclosing .struct. */ -} *current_stag = NULL; +static void tic54x_emit_char PARAMS ((char)); +static fragS * frag_prev PARAMS ((fragS *, segT)); +static fragS * bit_offset_frag PARAMS ((fragS *, segT)); +static int frag_bit_offset PARAMS ((fragS *, segT)); +static char * parse_expression PARAMS ((char *, expressionS *)); +static void tic54x_asg PARAMS ((int)); +static void tic54x_eval PARAMS ((int)); +static void tic54x_bss PARAMS ((int)); +static void stag_add_field_symbols PARAMS ((struct stag *, const char *, bfd_vma, symbolS *, const char *)); +static void stag_add_field PARAMS ((struct stag *, const char *, bfd_vma, struct stag *)); +static void tic54x_struct PARAMS ((int)); +static void tic54x_endstruct PARAMS ((int)); +static void tic54x_tag PARAMS ((int)); +static void tic54x_struct_field PARAMS ((int)); +static void tic54x_cons PARAMS ((int)); +static void tic54x_remove_local_label PARAMS ((const char *, PTR)); +static void tic54x_clear_local_labels PARAMS ((int)); +static void tic54x_sect PARAMS ((int)); +static void tic54x_space PARAMS ((int)); +static void tic54x_usect PARAMS ((int)); +static enum cpu_version lookup_version PARAMS ((const char *)); +static void set_cpu PARAMS ((enum cpu_version)); +static void tic54x_version PARAMS ((int)); +static void tic54x_float_cons PARAMS ((int)); +static void tic54x_stringer PARAMS ((int)); +static void tic54x_p2align PARAMS ((int)); +static void tic54x_align_words PARAMS ((int)); +static void tic54x_field PARAMS ((int)); +static int tic54x_initialized_section PARAMS ((segT)); +static void tic54x_clink PARAMS ((int)); +static void tic54x_set_default_include PARAMS ((int)); +static void tic54x_include PARAMS ((int)); +static void tic54x_message PARAMS ((int)); +static void tic54x_label PARAMS ((int)); +static void tic54x_mmregs PARAMS ((int)); +static void tic54x_loop PARAMS ((int)); +static void tic54x_endloop PARAMS ((int)); +static void tic54x_break PARAMS ((int)); +static void set_address_mode PARAMS ((int)); +static void tic54x_address_mode PARAMS ((int)); +static void tic54x_sblock PARAMS ((int)); +static void tic54x_set PARAMS ((int)); +static void tic54x_fclist PARAMS ((int)); +static void tic54x_sslist PARAMS ((int)); +static void tic54x_var PARAMS ((int)); +static void tic54x_mlib PARAMS ((int)); +static int subsym_symlen PARAMS ((char *, char *)); +static int subsym_symcmp PARAMS ((char *, char *)); +static int subsym_firstch PARAMS ((char *, char *)); +static int subsym_lastch PARAMS ((char *, char *)); +static int subsym_isdefed PARAMS ((char *, char *)); +static int subsym_ismember PARAMS ((char *, char *)); +static int subsym_iscons PARAMS ((char *, char *)); +static int subsym_isname PARAMS ((char *, char *)); +static int subsym_isreg PARAMS ((char *, char *)); +static int subsym_structsz PARAMS ((char *, char *)); +static int subsym_structacc PARAMS ((char *, char *)); +static float math_ceil PARAMS ((float, float)); +static float math_cvi PARAMS ((float, float)); +static float math_floor PARAMS ((float, float)); +static float math_fmod PARAMS ((float, float)); +static float math_int PARAMS ((float, float)); +static float math_round PARAMS ((float, float)); +static float math_sgn PARAMS ((float, float)); +static float math_trunc PARAMS ((float, float)); +static float math_acos PARAMS ((float, float)); +static float math_asin PARAMS ((float, float)); +static float math_atan PARAMS ((float, float)); +static float math_atan2 PARAMS ((float, float)); +static float math_cosh PARAMS ((float, float)); +static float math_cos PARAMS ((float, float)); +static float math_cvf PARAMS ((float, float)); +static float math_exp PARAMS ((float, float)); +static float math_fabs PARAMS ((float, float)); +static float math_ldexp PARAMS ((float, float)); +static float math_log10 PARAMS ((float, float)); +static float math_log PARAMS ((float, float)); +static float math_max PARAMS ((float, float)); +static float math_min PARAMS ((float, float)); +static float math_pow PARAMS ((float, float)); +static float math_sin PARAMS ((float, float)); +static float math_sinh PARAMS ((float, float)); +static float math_sqrt PARAMS ((float, float)); +static float math_tan PARAMS ((float, float)); +static float math_tanh PARAMS ((float, float)); +static int is_accumulator PARAMS ((struct opstruct *)); +static int get_operands PARAMS ((struct opstruct operands[], char *)); +static int is_immediate PARAMS ((struct opstruct *)); +static int is_absolute PARAMS ((struct opstruct *)); +static int is_indirect PARAMS ((struct opstruct *)); +static int is_dual PARAMS ((struct opstruct *)); +static int is_mmreg PARAMS ((struct opstruct *)); +static int is_type PARAMS ((struct opstruct *, enum optype)); +static int operands_match PARAMS ((tic54x_insn *, struct opstruct *, int, const enum optype *, int, int)); +static int encode_dmad PARAMS ((tic54x_insn *, struct opstruct *, int)); +static int encode_address PARAMS ((tic54x_insn *, struct opstruct *)); +static int encode_indirect PARAMS ((tic54x_insn *, struct opstruct *)); +static int encode_integer PARAMS ((tic54x_insn *, struct opstruct *, int, int, int, unsigned short)); +static int encode_condition PARAMS ((tic54x_insn *, struct opstruct *)); +static int encode_cc3 PARAMS ((tic54x_insn *, struct opstruct *)); +static int encode_arx PARAMS ((tic54x_insn *, struct opstruct *)); +static int encode_cc2 PARAMS ((tic54x_insn *, struct opstruct *)); +static int encode_operand PARAMS ((tic54x_insn *, enum optype, struct opstruct *)); +static void emit_insn PARAMS ((tic54x_insn *)); +static int build_insn PARAMS ((tic54x_insn *)); +static int optimize_insn PARAMS ((tic54x_insn *)); +static int tic54x_parse_insn PARAMS ((tic54x_insn *, char *)); +static int next_line_shows_parallel PARAMS ((char *)); +static int tic54x_parse_parallel_insn_firstline PARAMS ((tic54x_insn *, char *)); +static int tic54x_parse_parallel_insn_lastline PARAMS ((tic54x_insn *, char *)); +static char * subsym_get_arg PARAMS ((char *, char *, char **, int)); +static void subsym_create_or_replace PARAMS ((char *, char *)); +static char * subsym_lookup PARAMS ((char *, int)); +static char * subsym_substitute PARAMS ((char *, int)); -static segT stag_saved_seg; -static subsegT stag_saved_subseg; + +void +md_show_usage (stream) + FILE *stream; +{ + fprintf (stream, _("C54x-specific command line options:\n")); + fprintf (stream, _("-mfar-mode | -mf Use extended addressing\n")); + fprintf (stream, _("-mcpu= Specify the CPU version\n")); +#if 0 + fprintf (stream, _("-mcoff-version={0|1|2} Select COFF version\n")); +#endif + fprintf (stream, _("-merrors-to-file \n")); + fprintf (stream, _("-me Redirect errors to a file\n")); +} /* Output a single character (upper octect is zero). */ static void -tic54x_emit_char (char c) +tic54x_emit_char (c) + char c; { expressionS exp; @@ -251,7 +372,9 @@ tic54x_emit_char (char c) /* Walk backwards in the frag chain. */ static fragS * -frag_prev (fragS *frag, segT seg) +frag_prev (frag, seg) + fragS *frag; + segT seg; { segment_info_type *seginfo = seg_info (seg); fragS *fragp; @@ -264,7 +387,9 @@ frag_prev (fragS *frag, segT seg) } static fragS * -bit_offset_frag (fragS *frag, segT seg) +bit_offset_frag (frag, seg) + fragS *frag; + segT seg; { while (frag != NULL) { @@ -282,7 +407,9 @@ bit_offset_frag (fragS *frag, segT seg) none. .field/.space/.bes may leave words partially allocated. */ static int -frag_bit_offset (fragS *frag, segT seg) +frag_bit_offset (frag, seg) + fragS *frag; + segT seg; { frag = bit_offset_frag (frag, seg); @@ -296,7 +423,9 @@ frag_bit_offset (fragS *frag, segT seg) expression. */ static char * -parse_expression (char *str, expressionS * exp) +parse_expression (str, exp) + char *str; + expressionS * exp; { char *s; char *tmp; @@ -316,7 +445,8 @@ parse_expression (char *str, expressionS unsupported. */ static void -tic54x_asg (int x ATTRIBUTE_UNUSED) +tic54x_asg (x) + int x ATTRIBUTE_UNUSED; { int c; char *name; @@ -377,7 +507,8 @@ tic54x_asg (int x ATTRIBUTE_UNUSED) table, since that's what works best. */ static void -tic54x_eval (int x ATTRIBUTE_UNUSED) +tic54x_eval (x) + int x ATTRIBUTE_UNUSED; { char c; int value; @@ -453,7 +584,8 @@ tic54x_eval (int x ATTRIBUTE_UNUSED) (not yet implemented). */ static void -tic54x_bss (int x ATTRIBUTE_UNUSED) +tic54x_bss (x) + int x ATTRIBUTE_UNUSED; { char c; char *name; @@ -542,11 +674,12 @@ tic54x_bss (int x ATTRIBUTE_UNUSED) } static void -stag_add_field_symbols (struct stag *stag, - const char *path, - bfd_vma base_offset, - symbolS *rootsym, - const char *root_stag_name) +stag_add_field_symbols (stag, path, base_offset, rootsym, root_stag_name) + struct stag *stag; + const char *path; + bfd_vma base_offset; + symbolS *rootsym; + const char *root_stag_name; { char prefix[strlen (path) + 2]; struct stag_field *field = stag->field; @@ -599,10 +732,11 @@ stag_add_field_symbols (struct stag *sta complete dereferencing symbols to the symbol table. */ static void -stag_add_field (struct stag *parent, - const char *name, - bfd_vma offset, - struct stag *stag) +stag_add_field (parent, name, offset, stag) + struct stag *parent; + const char *name; + bfd_vma offset; + struct stag *stag; { struct stag_field *sfield = xmalloc (sizeof (struct stag_field)); @@ -634,7 +768,8 @@ stag_add_field (struct stag *parent, Start defining structure offsets (symbols in absolute section). */ static void -tic54x_struct (int arg) +tic54x_struct (arg) + int arg; { int start_offset = 0; int is_union = arg; @@ -714,7 +849,8 @@ tic54x_struct (int arg) of the structure. */ static void -tic54x_endstruct (int is_union) +tic54x_endstruct (is_union) + int is_union; { int size; const char *path = @@ -779,7 +915,8 @@ tic54x_endstruct (int is_union) format on the existing allocated space. */ static void -tic54x_tag (int ignore ATTRIBUTE_UNUSED) +tic54x_tag (ignore) + int ignore ATTRIBUTE_UNUSED; { char *name = input_line_pointer; int c = get_symbol_end (); @@ -812,6 +949,7 @@ tic54x_tag (int ignore ATTRIBUTE_UNUSED) else { symbolS *sym = symbol_find (label); + if (!sym) { as_bad (_(".tag target '%s' undefined"), label); @@ -837,7 +975,8 @@ tic54x_tag (int ignore ATTRIBUTE_UNUSED) and .word. */ static void -tic54x_struct_field (int type) +tic54x_struct_field (type) + int type; { int size; int count = 1; @@ -895,9 +1034,7 @@ tic54x_struct_field (int type) new_bitfield_offset = count - 16; } else - { - new_bitfield_offset = count; - } + new_bitfield_offset = count; } else { @@ -925,6 +1062,7 @@ tic54x_struct_field (int type) { static int fieldno = 0; char fake[] = ".fake_fieldNNNNN"; + sprintf (fake, ".fake_field%d", fieldno++); stag_add_field (current_stag, fake, abs_section_offset - S_GET_VALUE (current_stag->sym), @@ -933,6 +1071,7 @@ tic54x_struct_field (int type) else { char label[strlen (S_GET_NAME (line_label) + 1)]; + strcpy (label, S_GET_NAME (line_label)); stag_add_field (current_stag, label, abs_section_offset - S_GET_VALUE (current_stag->sym), @@ -955,11 +1094,11 @@ tic54x_struct_field (int type) /* Handle .byte, .word. .int, .long and all variants. */ -int emitting_long = 0; static void -tic54x_cons (int type) +tic54x_cons (type) + int type; { - register unsigned int c; + unsigned int c; int octets; /* If we're within a .struct construct, don't actually allocate space. */ @@ -1095,7 +1234,8 @@ tic54x_cons (int type) these, so we ignore the type here. */ void -tic54x_global (int type) +tic54x_global (type) + int type; { char *name; int c; @@ -1129,8 +1269,9 @@ tic54x_global (int type) /* Remove the symbol from the local label hash lookup. */ static void -tic54x_remove_local_label (const char *key, - PTR value ATTRIBUTE_UNUSED) +tic54x_remove_local_label (key, value) + const char *key; + PTR value ATTRIBUTE_UNUSED; { PTR *elem = hash_delete (local_label_hash[macro_level], key); free (elem); @@ -1139,7 +1280,8 @@ tic54x_remove_local_label (const char *k /* Reset all local labels. */ static void -tic54x_clear_local_labels (int ignored ATTRIBUTE_UNUSED) +tic54x_clear_local_labels (ignored) + int ignored ATTRIBUTE_UNUSED; { hash_traverse (local_label_hash[macro_level], tic54x_remove_local_label); } @@ -1158,7 +1300,8 @@ tic54x_clear_local_labels (int ignored A */ static void -tic54x_sect (int arg) +tic54x_sect (arg) + int arg; { ILLEGAL_WITHIN_STRUCT (); @@ -1173,6 +1316,7 @@ tic54x_sect (int arg) { char *name = NULL; int len; + /* If there are quotes, remove them. */ if (*input_line_pointer == '"') { @@ -1191,7 +1335,7 @@ tic54x_sect (int arg) demand_empty_rest_of_line (); } /* Make sure all named initialized sections flagged properly. If we - encounter instructions, we'll flag it with SEC_CODE as well. */ + encounter instructions, we'll flag it with SEC_CODE as well. */ strcat (name, ",\"w\"\n"); input_scrub_insert_line (name); obj_coff_section (0); @@ -1218,7 +1362,8 @@ tic54x_sect (int arg) cribbed from s_space. */ static void -tic54x_space (int arg) +tic54x_space (arg) + int arg; { expressionS exp; char *p = 0; @@ -1265,6 +1410,7 @@ tic54x_space (int arg) if (bit_offset != 0 && bit_offset < 16) { int spare_bits = bits_per_byte - bit_offset; + if (spare_bits >= exp.X_add_number) { /* Don't have to do anything; sufficient bits have already been @@ -1348,7 +1494,8 @@ tic54x_space (int arg) Has no effect on the current section. */ static void -tic54x_usect (int x ATTRIBUTE_UNUSED) +tic54x_usect (x) + int x ATTRIBUTE_UNUSED; { char c; char *name; @@ -1444,7 +1591,8 @@ tic54x_usect (int x ATTRIBUTE_UNUSED) } static enum cpu_version -lookup_version (const char *ver) +lookup_version (ver) + const char *ver; { enum cpu_version version = VNONE; @@ -1465,7 +1613,8 @@ lookup_version (const char *ver) } static void -set_cpu (enum cpu_version version) +set_cpu (version) + enum cpu_version version; { cpu = version; if (version == V545LP || version == V546LP) @@ -1492,7 +1641,8 @@ set_cpu (enum cpu_version version) static int cpu_needs_set = 1; static void -tic54x_version (int x ATTRIBUTE_UNUSED) +tic54x_version (x) + int x ATTRIBUTE_UNUSED; { enum cpu_version version = VNONE; enum cpu_version old_version = cpu; @@ -1535,7 +1685,8 @@ tic54x_version (int x ATTRIBUTE_UNUSED) /* 'f' = float, 'x' = xfloat, 'd' = double, 'l' = ldouble. */ static void -tic54x_float_cons (int type) +tic54x_float_cons (type) + int type; { if (current_stag != 0) tic54x_struct_field ('f'); @@ -1565,9 +1716,10 @@ tic54x_float_cons (int type) and encoded into the correct octets. */ static void -tic54x_stringer (int type) +tic54x_stringer (type) + int type; { - register unsigned int c; + unsigned int c; char *start; int append_zero = type == 'S' || type == 'P'; int packed = type == 'p' || type == 'P'; @@ -1652,13 +1804,15 @@ tic54x_stringer (int type) } static void -tic54x_p2align (int arg ATTRIBUTE_UNUSED) +tic54x_p2align (arg) + int arg ATTRIBUTE_UNUSED; { as_bad (_("p2align not supported on this target")); } static void -tic54x_align_words (int arg) +tic54x_align_words (arg) + int arg; { /* Only ".align" with no argument is allowed within .struct/.union. */ int count = arg; @@ -1690,7 +1844,8 @@ tic54x_align_words (int arg) /* Initialize multiple-bit fields withing a single word of memory. */ static void -tic54x_field (int ignore ATTRIBUTE_UNUSED) +tic54x_field (ignore) + int ignore ATTRIBUTE_UNUSED; { expressionS exp; int size = 16; @@ -1736,6 +1891,7 @@ tic54x_field (int ignore ATTRIBUTE_UNUSE else { unsigned long fmask = (size == 32) ? 0xFFFFFFFF : (1ul << size) - 1; + value = exp.X_add_number; exp.X_add_number &= fmask; if (value != (valueT) exp.X_add_number) @@ -1752,6 +1908,7 @@ tic54x_field (int ignore ATTRIBUTE_UNUSE if (size > 0) { int bit_offset = frag_bit_offset (frag_now, now_seg); + fragS *alloc_frag = bit_offset_frag (frag_now, now_seg); if (bit_offset == -1) { @@ -1759,6 +1916,7 @@ tic54x_field (int ignore ATTRIBUTE_UNUSE /* We don't know the previous offset at this time, so store the info we need and figure it out later. */ expressionS size_exp; + size_exp.X_op = O_constant; size_exp.X_add_number = size; bi->seg = now_seg; @@ -1810,7 +1968,8 @@ tic54x_field (int ignore ATTRIBUTE_UNUSE available yet. seg_info ()->bss is the next best thing. */ static int -tic54x_initialized_section (segT seg) +tic54x_initialized_section (seg) + segT seg; { return !seg_info (seg)->bss; } @@ -1823,7 +1982,8 @@ tic54x_initialized_section (segT seg) Name is required for uninitialized sections. */ static void -tic54x_clink (int ignored ATTRIBUTE_UNUSED) +tic54x_clink (ignored) + int ignored ATTRIBUTE_UNUSED; { segT seg = now_seg; @@ -1833,6 +1993,7 @@ tic54x_clink (int ignored ATTRIBUTE_UNUS { char *section_name = ++input_line_pointer; char *name; + while (is_a_char (next_char_of_string ())) ; know (input_line_pointer[-1] == '\"'); @@ -1869,7 +2030,8 @@ tic54x_clink (int ignored ATTRIBUTE_UNUS set to "." instead. */ static void -tic54x_set_default_include (int dot) +tic54x_set_default_include (dot) + int dot; { char *dir = "."; char *tmp = NULL; @@ -1886,6 +2048,7 @@ tic54x_set_default_include (int dot) if (tmp != NULL) { int len; + *tmp = '\0'; len = strlen (dir); if (include_dir_count == 0) @@ -1913,7 +2076,8 @@ tic54x_set_default_include (int dot) Entering/exiting included/copied file clears all local labels. */ static void -tic54x_include (int ignored ATTRIBUTE_UNUSED) +tic54x_include (ignored) + int ignored ATTRIBUTE_UNUSED; { char newblock[] = " .newblock\n"; char *filename; @@ -1956,7 +2120,8 @@ tic54x_include (int ignored ATTRIBUTE_UN } static void -tic54x_message (int type) +tic54x_message (type) + int type; { char *msg; char c; @@ -2002,7 +2167,8 @@ tic54x_message (int type) run address (vma). */ static void -tic54x_label (int ignored ATTRIBUTE_UNUSED) +tic54x_label (ignored) + int ignored ATTRIBUTE_UNUSED; { char *name = input_line_pointer; symbolS *symbolP; @@ -2023,7 +2189,8 @@ tic54x_label (int ignored ATTRIBUTE_UNUS absolute local symbols. */ static void -tic54x_mmregs (int ignored ATTRIBUTE_UNUSED) +tic54x_mmregs (ignored) + int ignored ATTRIBUTE_UNUSED; { symbol *sym; @@ -2042,7 +2209,8 @@ tic54x_mmregs (int ignored ATTRIBUTE_UNU Count defaults to 1024. */ static void -tic54x_loop (int count) +tic54x_loop (count) + int count; { ILLEGAL_WITHIN_STRUCT (); @@ -2056,7 +2224,8 @@ tic54x_loop (int count) /* Normally, endloop gets eaten by the preceding loop. */ static void -tic54x_endloop (int ignore ATTRIBUTE_UNUSED) +tic54x_endloop (ignore) + int ignore ATTRIBUTE_UNUSED; { as_bad (_("ENDLOOP without corresponding LOOP")); ignore_rest_of_line (); @@ -2065,7 +2234,8 @@ tic54x_endloop (int ignore ATTRIBUTE_UNU /* .break [condition]. */ static void -tic54x_break (int ignore ATTRIBUTE_UNUSED) +tic54x_break (ignore) + int ignore ATTRIBUTE_UNUSED; { int cond = 1; @@ -2080,7 +2250,8 @@ tic54x_break (int ignore ATTRIBUTE_UNUSE } static void -set_address_mode (int mode) +set_address_mode (mode) + int mode; { amode = mode; if (mode == far_mode) @@ -2093,8 +2264,10 @@ set_address_mode (int mode) } static int address_mode_needs_set = 1; + static void -tic54x_address_mode (int mode) +tic54x_address_mode (mode) + int mode; { if (assembly_begun && amode != (unsigned) mode) { @@ -2117,7 +2290,8 @@ tic54x_address_mode (int mode) Designate initialized sections for blocking. */ static void -tic54x_sblock (int ignore ATTRIBUTE_UNUSED) +tic54x_sblock (ignore) + int ignore ATTRIBUTE_UNUSED; { int c = ','; @@ -2131,11 +2305,13 @@ tic54x_sblock (int ignore ATTRIBUTE_UNUS if (*input_line_pointer == '"') { int len; + name = demand_copy_C_string (&len); } else { char *section_name = input_line_pointer; + c = get_symbol_end (); name = xmalloc (strlen (section_name) + 1); strcpy (name, section_name); @@ -2172,7 +2348,8 @@ tic54x_sblock (int ignore ATTRIBUTE_UNUS symbols assigned with .set/.equ may not be redefined. */ static void -tic54x_set (int ignore ATTRIBUTE_UNUSED) +tic54x_set (ignore) + int ignore ATTRIBUTE_UNUSED; { symbolS *symbolP; char *name; @@ -2206,7 +2383,8 @@ tic54x_set (int ignore ATTRIBUTE_UNUSED) List false conditional blocks. */ static void -tic54x_fclist (int show) +tic54x_fclist (show) + int show; { if (show) listing &= ~LISTING_NOCOND; @@ -2216,7 +2394,8 @@ tic54x_fclist (int show) } static void -tic54x_sslist (int show) +tic54x_sslist (show) + int show; { ILLEGAL_WITHIN_STRUCT (); @@ -2227,7 +2406,8 @@ tic54x_sslist (int show) Define a substitution string to be local to a macro. */ static void -tic54x_var (int ignore ATTRIBUTE_UNUSED) +tic54x_var (ignore) + int ignore ATTRIBUTE_UNUSED; { static char empty[] = ""; char *name; @@ -2275,7 +2455,8 @@ tic54x_var (int ignore ATTRIBUTE_UNUSED) FIXME need to try the source file directory as well. */ static void -tic54x_mlib (int ignore ATTRIBUTE_UNUSED) +tic54x_mlib (ignore) + int ignore ATTRIBUTE_UNUSED; { char *filename; char *path; @@ -2308,9 +2489,11 @@ tic54x_mlib (int ignore ATTRIBUTE_UNUSED tic54x_set_default_include (0); path = xmalloc ((unsigned long) len + include_dir_maxlen + 5); + for (i = 0; i < include_dir_count; i++) { FILE *try; + strcpy (path, include_dirs[i]); strcat (path, "/"); strcat (path, filename); @@ -2320,6 +2503,7 @@ tic54x_mlib (int ignore ATTRIBUTE_UNUSED break; } } + if (i >= include_dir_count) { free (path); @@ -2500,6 +2684,7 @@ md_parse_option (c, arg) case OPTION_COFF_VERSION: { int version = atoi (arg); + if (version != 0 && version != 1 && version != 2) as_fatal (_("Bad COFF version '%s'"), arg); /* FIXME -- not yet implemented. */ @@ -2521,6 +2706,7 @@ md_parse_option (c, arg) { char *filename = arg; FILE *fp = fopen (filename, "w+"); + if (fp == NULL) as_fatal (_("Can't redirect stderr to the file '%s'"), filename); fclose (fp); @@ -2578,6 +2764,7 @@ tic54x_macro_info (info) entry->name.ptr, entry->name.len); char *value = strncpy (xmalloc (entry->actual.len + 1), entry->actual.ptr, entry->actual.len); + name[entry->name.len] = '\0'; value[entry->actual.len] = '\0'; hash_insert (subsym_hash[macro_level], name, value); @@ -2597,7 +2784,9 @@ tic54x_macro_end () } static int -subsym_symlen (char *a, char *ignore ATTRIBUTE_UNUSED) +subsym_symlen (a, ignore) + char *a; + char *ignore ATTRIBUTE_UNUSED; { return strlen (a); } @@ -2605,7 +2794,9 @@ subsym_symlen (char *a, char *ignore ATT /* Compare symbol A to string B. */ static int -subsym_symcmp (char *a, char *b) +subsym_symcmp (a, b) + char *a; + char *b; { return strcmp (a, b); } @@ -2614,7 +2805,9 @@ subsym_symcmp (char *a, char *b) assumes b is an integer char value as a string. Index is one-based. */ static int -subsym_firstch (char *a, char *b) +subsym_firstch (a, b) + char *a; + char *b; { int val = atoi (b); char *tmp = strchr (a, val); @@ -2625,7 +2818,9 @@ subsym_firstch (char *a, char *b) /* Similar to firstch, but returns index of last occurrence of B in A. */ static int -subsym_lastch (char *a, char *b) +subsym_lastch (a, b) + char *a; + char *b; { int val = atoi (b); char *tmp = strrchr (a, val); @@ -2637,7 +2832,9 @@ subsym_lastch (char *a, char *b) symbol table). */ static int -subsym_isdefed (char *a, char *ignore ATTRIBUTE_UNUSED) +subsym_isdefed (a, ignore) + char *a; + char *ignore ATTRIBUTE_UNUSED; { symbolS *symbolP = symbol_find (a); @@ -2649,7 +2846,9 @@ subsym_isdefed (char *a, char *ignore AT symbols, unsubstituted. */ static int -subsym_ismember (char *sym, char *list) +subsym_ismember (sym, list) + char *sym; + char *list; { char *elem, *ptr, *listv; @@ -2687,7 +2886,9 @@ subsym_ismember (char *sym, char *list) 5 if decimal. */ static int -subsym_iscons (char *a, char *ignore ATTRIBUTE_UNUSED) +subsym_iscons (a, ignore) + char *a; + char *ignore ATTRIBUTE_UNUSED; { expressionS exp; @@ -2726,7 +2927,9 @@ subsym_iscons (char *a, char *ignore ATT /* Return 1 if A is a valid symbol name. Expects string input. */ static int -subsym_isname (char *a, char *ignore ATTRIBUTE_UNUSED) +subsym_isname (a, ignore) + char *a; + char *ignore ATTRIBUTE_UNUSED; { if (!is_name_beginner (*a)) return 0; @@ -2744,7 +2947,9 @@ subsym_isname (char *a, char *ignore ATT Note this does not recognize "A" or "B" accumulators. */ static int -subsym_isreg (char *a, char *ignore ATTRIBUTE_UNUSED) +subsym_isreg (a, ignore) + char *a; + char *ignore ATTRIBUTE_UNUSED; { if (hash_find (reg_hash, a)) return 1; @@ -2756,9 +2961,12 @@ subsym_isreg (char *a, char *ignore ATTR /* Return the structrure size, given the stag. */ static int -subsym_structsz (char *name, char *ignore ATTRIBUTE_UNUSED) +subsym_structsz (name, ignore) + char *name; + char *ignore ATTRIBUTE_UNUSED; { struct stag *stag = (struct stag *) hash_find (stag_hash, name); + if (stag) return stag->size; @@ -2773,8 +2981,9 @@ subsym_structsz (char *name, char *ignor return zero, we punt and return zero. */ static int -subsym_structacc (char *stag_name ATTRIBUTE_UNUSED, - char *ignore ATTRIBUTE_UNUSED) +subsym_structacc (stag_name, ignore) + char *stag_name ATTRIBUTE_UNUSED; + char *ignore ATTRIBUTE_UNUSED; { return 0; } @@ -2804,7 +3013,9 @@ math_floor (arg1, ignore) } static float -math_fmod (float arg1, float arg2) +math_fmod (arg1, arg2) + float arg1; + float arg2; { return (int) arg1 % (int) arg2; } @@ -2866,7 +3077,9 @@ math_atan (arg1, ignore) } static float -math_atan2 (float arg1, float arg2) +math_atan2 (arg1, arg2) + float arg1; + float arg2; { return (float) atan2 (arg1, arg2); } @@ -2914,7 +3127,9 @@ math_fabs (arg1, ignore) /* expr1 * 2^expr2. */ static float -math_ldexp (float arg1, float arg2) +math_ldexp (arg1, arg2) + float arg1; + float arg2; { return arg1 * (float) pow (2.0, arg2); } @@ -2936,19 +3151,25 @@ math_log (arg1, ignore) } static float -math_max (float arg1, float arg2) +math_max (arg1, arg2) + float arg1; + float arg2; { return (arg1 > arg2) ? arg1 : arg2; } static float -math_min (float arg1, float arg2) +math_min (arg1, arg2) + float arg1; + float arg2; { return (arg1 < arg2) ? arg1 : arg2; } static float -math_pow (float arg1, float arg2) +math_pow (arg1, arg2) + float arg1; + float arg2; { return (float) pow (arg1, arg2); } @@ -2997,7 +3218,7 @@ math_tanh (arg1, ignore) typedef struct { char *name; - int (*proc) (char *, char *); + int (*proc) PARAMS ((char *, char *)); int nargs; } subsym_proc_entry; @@ -3021,7 +3242,7 @@ static const subsym_proc_entry subsym_pr typedef struct { char *name; - float (*proc) (float, float); + float (*proc) PARAMS ((float, float)); int nargs; int int_return; } math_proc_entry; @@ -3076,13 +3297,15 @@ md_begin () local_label_id = 0; - /* Look for A_DIR and add it to the include list. a */ + /* Look for A_DIR and add it to the include list. */ if (A_DIR != NULL) { char *tmp = xstrdup (A_DIR); + do { char *next = strchr (tmp, ';'); + if (next) *next++ = '\0'; add_include_dir (tmp); @@ -3125,43 +3348,36 @@ md_begin () hash_err = hash_insert (reg_hash, sym->name, (char *) sym); mmreg_hash = hash_new (); for (sym = (symbol *) mmregs; sym->name; sym++) - { - hash_err = hash_insert (mmreg_hash, sym->name, (char *) sym); - } + hash_err = hash_insert (mmreg_hash, sym->name, (char *) sym); + cc_hash = hash_new (); for (sym = (symbol *) condition_codes; sym->name; sym++) - { - hash_err = hash_insert (cc_hash, sym->name, (char *) sym); - } + hash_err = hash_insert (cc_hash, sym->name, (char *) sym); + cc2_hash = hash_new (); for (sym = (symbol *) cc2_codes; sym->name; sym++) - { - hash_err = hash_insert (cc2_hash, sym->name, (char *) sym); - } + hash_err = hash_insert (cc2_hash, sym->name, (char *) sym); + cc3_hash = hash_new (); for (sym = (symbol *) cc3_codes; sym->name; sym++) - { - hash_err = hash_insert (cc3_hash, sym->name, (char *) sym); - } + hash_err = hash_insert (cc3_hash, sym->name, (char *) sym); + sbit_hash = hash_new (); for (sym = (symbol *) status_bits; sym->name; sym++) - { - hash_err = hash_insert (sbit_hash, sym->name, (char *) sym); - } + hash_err = hash_insert (sbit_hash, sym->name, (char *) sym); + misc_symbol_hash = hash_new (); for (symname = (char **) misc_symbols; *symname; symname++) - { - hash_err = hash_insert (misc_symbol_hash, *symname, *symname); - } + hash_err = hash_insert (misc_symbol_hash, *symname, *symname); + /* Only the base substitution table and local label table are initialized; the others (for local macro substitution) get instantiated as needed. */ local_label_hash[0] = hash_new (); subsym_hash[0] = hash_new (); for (subsym_proc = subsym_procs; subsym_proc->name; subsym_proc++) - { - hash_err = hash_insert (subsym_hash[0], subsym_proc->name, - (char *) subsym_proc); - } + hash_err = hash_insert (subsym_hash[0], subsym_proc->name, + (char *) subsym_proc); + math_hash = hash_new (); for (math_proc = math_procs; math_proc->name; math_proc++) { @@ -3176,48 +3392,9 @@ md_begin () stag_hash = hash_new (); } -typedef struct _tic54x_insn -{ - const template *tm; /* Opcode template. */ - - char mnemonic[MAX_LINE]; /* Opcode name/mnemonic. */ - char parmnemonic[MAX_LINE]; /* 2nd mnemonic of parallel insn. */ - - int opcount; - struct opstruct - { - char buf[MAX_LINE]; - enum optype type; - expressionS exp; - } operands[MAX_OPERANDS]; - - int paropcount; - struct opstruct paroperands[MAX_OPERANDS]; - - int is_lkaddr; - int lkoperand; - int words; /* Size of insn in 16-bit words. */ - int using_default_dst; /* Do we need to explicitly set an - omitted OP_DST operand? */ - struct - { - unsigned short word; /* Final encoded opcode data. */ - int unresolved; - int r_nchars; /* Relocation size. */ - bfd_reloc_code_real_type r_type; /* Relocation type. */ - expressionS addr_expr; /* Storage for unresolved expressions. */ - } opcode[3]; -} tic54x_insn; - -static int encode_operand (tic54x_insn *, enum optype, struct opstruct *); -static int encode_dmad (tic54x_insn *, struct opstruct *, int); -static int operands_match (tic54x_insn *, struct opstruct *, int, - const enum optype *, int, int); -static int encode_address (tic54x_insn *, struct opstruct *); -static int is_accumulator (struct opstruct *); - static int -is_accumulator (struct opstruct *operand) +is_accumulator (operand) + struct opstruct *operand; { return strcasecmp (operand->buf, "a") == 0 || strcasecmp (operand->buf, "b") == 0; @@ -3228,7 +3405,9 @@ is_accumulator (struct opstruct *operand the next array. */ static int -get_operands (struct opstruct operands[], char *line) +get_operands (operands, line) + struct opstruct operands[]; + char *line; { char *lptr = line; int numexp = 0; @@ -3239,6 +3418,7 @@ get_operands (struct opstruct operands[] { int paren_not_balanced = 0; char *op_start, *op_end; + while (*lptr && ISSPACE (*lptr)) ++lptr; op_start = lptr; @@ -3264,6 +3444,7 @@ get_operands (struct opstruct operands[] if (op_end != op_start) { int len = op_end - op_start; + strncpy (operands[numexp].buf, op_start, len); operands[numexp].buf[len] = 0; /* Trim trailing spaces; while the preprocessor gets rid of most, @@ -3319,6 +3500,7 @@ get_operands (struct opstruct operands[] { /* Indirect. */ char *paren = strchr (operands[i].buf, '('); + /* Allow immediate syntax in the inner expression. */ if (paren && paren[1] == '#') *++paren = '('; @@ -3329,6 +3511,7 @@ get_operands (struct opstruct operands[] int len = strlen (paren); char *end = paren + len; int c; + while (end[-1] != ')') if (--end <= paren) { @@ -3353,7 +3536,8 @@ get_operands (struct opstruct operands[] /* Predicates for different operand types. */ static int -is_immediate (struct opstruct *operand) +is_immediate (operand) + struct opstruct *operand; { return *operand->buf == '#'; } @@ -3362,7 +3546,8 @@ is_immediate (struct opstruct *operand) and must *not* have the '#' prefix. */ static int -is_absolute (struct opstruct *operand) +is_absolute (operand) + struct opstruct *operand; { return operand->exp.X_op == O_constant && !is_immediate (operand); } @@ -3370,7 +3555,8 @@ is_absolute (struct opstruct *operand) /* Is this an indirect operand? */ static int -is_indirect (struct opstruct *operand) +is_indirect (operand) + struct opstruct *operand; { return operand->buf[0] == '*'; } @@ -3378,7 +3564,8 @@ is_indirect (struct opstruct *operand) /* Is this a valid dual-memory operand? */ static int -is_dual (struct opstruct *operand) +is_dual (operand) + struct opstruct *operand; { if (is_indirect (operand) && strncasecmp (operand->buf, "*ar", 3) == 0) { @@ -3398,7 +3585,8 @@ is_dual (struct opstruct *operand) } static int -is_mmreg (struct opstruct *operand) +is_mmreg (operand) + struct opstruct *operand; { return (is_absolute (operand) || is_immediate (operand) @@ -3406,7 +3594,9 @@ is_mmreg (struct opstruct *operand) } static int -is_type (struct opstruct *operand, enum optype type) +is_type (operand, type) + struct opstruct *operand; + enum optype type; { switch (type) { @@ -3515,14 +3705,13 @@ operands_match (insn, operands, opcount, struct opstruct *operands; int opcount; const enum optype *refoptype; - int minops, maxops; + int minops; + int maxops; { int op = 0, refop = 0; if (opcount == 0 && minops == 0) - { - return 1; - } + return 1; while (op <= maxops && refop <= maxops) { @@ -3599,6 +3788,7 @@ encode_dmad (insn, operand, xpc_code) if (insn->opcode[op].addr_expr.X_op == O_constant) { valueT value = insn->opcode[op].addr_expr.X_add_number; + if (xpc_code == 1) { insn->opcode[0].word &= 0xFF80; @@ -3654,9 +3844,8 @@ encode_address (insn, operand) insn->opcode[0].word |= (operand->exp.X_add_number & 0x7F); else { - if (operand->exp.X_op == O_register) { - as_bad(_("Use the .mmregs directive to use memory-mapped register names such as '%s'"), operand->buf); - } + if (operand->exp.X_op == O_register) + as_bad (_("Use the .mmregs directive to use memory-mapped register names such as '%s'"), operand->buf); /* Do the fixup later; just store the expression. */ insn->opcode[0].r_nchars = 1; insn->opcode[0].r_type = BFD_RELOC_TIC54X_PARTLS7; @@ -3667,7 +3856,9 @@ encode_address (insn, operand) } static int -encode_indirect (tic54x_insn *insn, struct opstruct *operand) +encode_indirect (insn, operand) + tic54x_insn *insn; + struct opstruct *operand; { int arf; int mod; @@ -3739,9 +3930,13 @@ encode_indirect (tic54x_insn *insn, stru } static int -encode_integer (tic54x_insn *insn, - struct opstruct *operand, - int which, int min, int max, unsigned short mask) +encode_integer (insn, operand, which, min, max, mask) + tic54x_insn *insn; + struct opstruct *operand; + int which; + int min; + int max; + unsigned short mask; { long parse, integer; @@ -3796,7 +3991,9 @@ encode_integer (tic54x_insn *insn, } static int -encode_condition (tic54x_insn *insn, struct opstruct *operand) +encode_condition (insn, operand) + tic54x_insn *insn; + struct opstruct *operand; { symbol *cc = (symbol *) hash_find (cc_hash, operand->buf); if (!cc) @@ -3842,9 +4039,9 @@ encode_condition (tic54x_insn *insn, str return 0; } } - else if (((insn->opcode[0].word & CATG_A2) && (cc->value & CATG_A2)) || - ((insn->opcode[0].word & CATG_B2) && (cc->value & CATG_B2)) || - ((insn->opcode[0].word & CATG_C2) && (cc->value & CATG_C2))) + else if ( ((insn->opcode[0].word & CATG_A2) && (cc->value & CATG_A2)) + || ((insn->opcode[0].word & CATG_B2) && (cc->value & CATG_B2)) + || ((insn->opcode[0].word & CATG_C2) && (cc->value & CATG_C2))) { as_bad (_("Duplicate %s conditional"), operand->buf); return 0; @@ -3856,7 +4053,9 @@ encode_condition (tic54x_insn *insn, str } static int -encode_cc3 (tic54x_insn *insn, struct opstruct *operand) +encode_cc3 (insn, operand) + tic54x_insn *insn; + struct opstruct *operand; { symbol *cc3 = (symbol *) hash_find (cc3_hash, operand->buf); int value = cc3 ? cc3->value : operand->exp.X_add_number << 8; @@ -3871,9 +4070,12 @@ encode_cc3 (tic54x_insn *insn, struct op } static int -encode_arx (tic54x_insn *insn, struct opstruct *operand) +encode_arx (insn, operand) + tic54x_insn *insn; + struct opstruct *operand; { int arf = strlen (operand->buf) >= 3 ? operand->buf[2] - '0' : -1; + if (strncasecmp ("ar", operand->buf, 2) || arf < 0 || arf > 7) { as_bad (_("Invalid auxiliary register (use AR0-AR7)")); @@ -3884,9 +4086,12 @@ encode_arx (tic54x_insn *insn, struct op } static int -encode_cc2 (tic54x_insn *insn, struct opstruct *operand) +encode_cc2 (insn, operand) + tic54x_insn *insn; + struct opstruct *operand; { symbol *cc2 = (symbol *) hash_find (cc2_hash, operand->buf); + if (!cc2) { as_bad (_("Unrecognized condition code \"%s\""), operand->buf); @@ -4123,7 +4328,8 @@ encode_operand (insn, type, operand) } static void -emit_insn (tic54x_insn *insn) +emit_insn (insn) + tic54x_insn *insn; { int i; flagword oldflags = bfd_get_section_flags (stdoutput, now_seg); @@ -4156,7 +4362,8 @@ emit_insn (tic54x_insn *insn) return the total number of words used by the instruction. */ static int -build_insn (tic54x_insn *insn) +build_insn (insn) + tic54x_insn *insn; { int i; @@ -4187,6 +4394,7 @@ build_insn (tic54x_insn *insn) for (i = 0; i < insn->opcount; i++) { enum optype type = insn->operands[i].type; + if (!encode_operand (insn, type, &insn->operands[i])) return 0; } @@ -4194,6 +4402,7 @@ build_insn (tic54x_insn *insn) for (i = 0; i < insn->paropcount; i++) { enum optype partype = insn->paroperands[i].type; + if (!encode_operand (insn, partype, &insn->paroperands[i])) return 0; } @@ -4204,7 +4413,8 @@ build_insn (tic54x_insn *insn) } static int -optimize_insn (tic54x_insn *insn) +optimize_insn (insn) + tic54x_insn *insn; { /* Optimize some instructions, helping out the brain-dead programmer. */ #define is_zero(op) ((op).exp.X_op == O_constant && (op).exp.X_add_number == 0) @@ -4279,10 +4489,10 @@ optimize_insn (tic54x_insn *insn) return 1; } - if (((OPTYPE (insn->tm->operand_types[0]) == OP_Smem + if ( ((OPTYPE (insn->tm->operand_types[0]) == OP_Smem && OPTYPE (insn->tm->operand_types[1]) == OP_SHIFT) || (OPTYPE (insn->tm->operand_types[0]) == OP_Xmem - && OPTYPE (insn->tm->operand_types[1]) == OP_SHFT)) + && OPTYPE (insn->tm->operand_types[1]) == OP_SHFT)) && is_zero (insn->operands[1]) && insn->opcount == 3) { @@ -4297,7 +4507,9 @@ optimize_insn (tic54x_insn *insn) /* Find a matching template if possible, and get the operand strings. */ static int -tic54x_parse_insn (tic54x_insn *insn, char *line) +tic54x_parse_insn (insn, line) + tic54x_insn *insn; + char *line; { insn->tm = (template *) hash_find (op_hash, insn->mnemonic); if (!insn->tm) @@ -4344,7 +4556,8 @@ static int parallel_on_next_line_hint = Look for a subsequent line starting with "||". */ static int -next_line_shows_parallel (char *next_line) +next_line_shows_parallel (next_line) + char *next_line; { /* Look for the second half. */ while (ISSPACE (*next_line)) @@ -4355,7 +4568,9 @@ next_line_shows_parallel (char *next_lin } static int -tic54x_parse_parallel_insn_firstline (tic54x_insn *insn, char *line) +tic54x_parse_parallel_insn_firstline (insn, line) + tic54x_insn *insn; + char *line; { insn->tm = (template *) hash_find (parop_hash, insn->mnemonic); if (!insn->tm) @@ -4386,7 +4601,9 @@ tic54x_parse_parallel_insn_firstline (ti /* Parse the second line of a two-line parallel instruction. */ static int -tic54x_parse_parallel_insn_lastline (tic54x_insn *insn, char *line) +tic54x_parse_parallel_insn_lastline (insn, line) + tic54x_insn *insn; + char *line; { int valid_mnemonic = 0; @@ -4397,15 +4614,14 @@ tic54x_parse_parallel_insn_lastline (tic if (strcasecmp (insn->tm->parname, insn->parmnemonic) == 0) { valid_mnemonic = 1; + if (insn->paropcount >= insn->tm->minops && insn->paropcount <= insn->tm->maxops && operands_match (insn, insn->paroperands, insn->paropcount, insn->tm->paroperand_types, insn->tm->minops, insn->tm->maxops)) - { - return 1; - } + return 1; } ++(insn->tm); } @@ -4425,7 +4641,11 @@ tic54x_parse_parallel_insn_lastline (tic replacement on the value. */ static char * -subsym_get_arg (char *line, char *terminators, char **str, int nosub) +subsym_get_arg (line, terminators, str, nosub) + char *line; + char *terminators; + char **str; + int nosub; { char *ptr = line; char *endp; @@ -4445,6 +4665,7 @@ subsym_get_arg (char *line, char *termin { char *savedp = input_line_pointer; int len; + input_line_pointer = ptr; *str = demand_copy_C_string (&len); endp = input_line_pointer; @@ -4532,7 +4753,9 @@ subsym_lookup (name, nest_level) If FORCED is set, look for forced substitutions of the form ':SYMBOL:'. */ static char * -subsym_substitute (char *line, int forced) +subsym_substitute (line, forced) + char * line; + int forced; { /* For each apparent symbol, see if it's a substitution symbol, and if so, replace it in the input. */ @@ -4560,9 +4783,7 @@ subsym_substitute (char *line, int force if (strstr (line, ".if") || strstr (line, ".elseif") || strstr (line, ".break")) - { - line_conditional = 1; - } + line_conditional = 1; /* Watch out for .eval, so that we avoid doing substitution on the symbol being assigned a value. */ @@ -4663,6 +4884,7 @@ subsym_substitute (char *line, int force { char digit[11]; char *namecopy = strcpy (xmalloc (strlen (name) + 1), name); + value = strcpy (xmalloc (strlen (name) + sizeof (digit) + 1), name); if (*value != '$') @@ -4728,6 +4950,7 @@ subsym_substitute (char *line, int force int val; int arg_type[2] = { *ptr == '"' , 0 }; int ismember = !strcmp (entry->name, "$ismember"); + /* Parse one or two args, which must be a substitution symbol, string or a character-string constant. */ /* For all functions, a string or substitution symbol may be @@ -5308,9 +5531,14 @@ tc_gen_reloc (section, fixP) /* Handle cons expressions. */ void -tic54x_cons_fix_new (fragS *frag, int where, int octets, expressionS *exp) +tic54x_cons_fix_new (frag, where, octets, exp) + fragS *frag; + int where; + int octets; + expressionS *exp; { bfd_reloc_code_real_type r; + switch (octets) { default: @@ -5486,6 +5714,7 @@ tic54x_relax_frag (frag, stretch) if (bit_offset != 0 && available >= size) { char *p = prev_frag->fr_literal; + valueT value = bi->value; value <<= available - size; value |= ((unsigned short) p[1] << 8) | p[0]; @@ -5502,6 +5731,7 @@ tic54x_relax_frag (frag, stretch) else { char *p = frag->fr_literal; + valueT value = bi->value << (16 - size); md_number_to_chars (p, value, 2); if ((frag->tc_frag_data = size) == 16) @@ -5588,6 +5818,7 @@ tic54x_start_label (c, rest) if (c != ':') { char *label = rest; + while (!is_end_of_line[(int) label[-1]]) --label; if (*label == '.') diff -uprN binutils-2.11.93.0.2/gas/config/tc-xstormy16.h binutils-2.12.90.0.1/gas/config/tc-xstormy16.h --- binutils-2.11.93.0.2/gas/config/tc-xstormy16.h Sun Feb 3 11:22:31 2002 +++ binutils-2.12.90.0.1/gas/config/tc-xstormy16.h Thu Mar 7 11:52:37 2002 @@ -1,5 +1,5 @@ /* tc-xstormy16.h -- Header file for tc-xstormy16.c. - Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -67,3 +67,6 @@ extern long md_pcrel_from_section PARAMS extern void xstormy16_cons_fix_new PARAMS ((fragS *f, int, int, expressionS *)); #define md_cgen_record_fixup_exp xstormy16_cgen_record_fixup_exp + +/* Minimum instruction is two bytes. */ +#define DWARF2_LINE_MIN_INSN_LENGTH 2 diff -uprN binutils-2.11.93.0.2/gas/config.in binutils-2.12.90.0.1/gas/config.in --- binutils-2.11.93.0.2/gas/config.in Fri Oct 19 23:57:49 2001 +++ binutils-2.12.90.0.1/gas/config.in Thu Mar 7 11:52:37 2002 @@ -130,6 +130,9 @@ /* Define if you have the header file. */ #undef HAVE_SYS_PARAM_H +/* Define if you have the header file. */ +#undef HAVE_SYS_STAT_H + /* Define if you have the header file. */ #undef HAVE_SYS_TYPES_H diff -uprN binutils-2.11.93.0.2/gas/configure binutils-2.12.90.0.1/gas/configure --- binutils-2.11.93.0.2/gas/configure Sun Feb 3 11:22:31 2002 +++ binutils-2.12.90.0.1/gas/configure Thu Mar 7 11:52:37 2002 @@ -1544,7 +1544,7 @@ irix5* | irix6*) # This must be Linux ELF. linux-gnu*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB( .*|) (shared object|dynamic lib )' lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` ;; @@ -2289,6 +2289,7 @@ for this_target in $target $canon_target rs6000*) cpu_type=ppc ;; s390x*) cpu_type=s390 arch=s390x ;; s390*) cpu_type=s390 arch=s390 ;; + sh64*) cpu_type=sh64 endian=big;; sh*le) cpu_type=sh endian=little ;; sh*) cpu_type=sh endian=big ;; sparclite*) cpu_type=sparc arch=sparclite ;; @@ -2574,6 +2575,7 @@ EOF sh-*-rtemself*) fmt=elf ;; sh-*-rtems*) fmt=coff bfd_gas=yes;; + sh64-*-elf*) fmt=elf ;; ns32k-pc532-mach* | ns32k-pc532-ux*) fmt=aout em=pc532mach ;; ns32k-pc532-netbsd* | ns32k-pc532-lites*) fmt=aout em=nbsd532 ;; ns32k-pc532-openbsd*) fmt=aout em=nbsd532 ;; @@ -3132,7 +3134,7 @@ EOF # 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:3136: checking for $ac_word" >&5 +echo "configure:3138: 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 @@ -3162,7 +3164,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:3166: checking for $ac_word" >&5 +echo "configure:3168: 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 @@ -3213,7 +3215,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:3217: checking for $ac_word" >&5 +echo "configure:3219: 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 @@ -3245,7 +3247,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:3249: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:3251: 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. @@ -3256,12 +3258,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 3260 "configure" +#line 3262 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:3265: \"$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 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 @@ -3287,12 +3289,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:3291: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:3293: 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:3296: checking whether we are using GNU C" >&5 +echo "configure:3298: 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 @@ -3301,7 +3303,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:3305: \"$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:3307: \"$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 @@ -3320,7 +3322,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:3324: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:3326: 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 @@ -3357,7 +3359,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3361: checking for $ac_word" >&5 +echo "configure:3363: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3388,7 +3390,7 @@ done test -n "$YACC" || YACC="yacc" echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:3392: checking how to run the C preprocessor" >&5 +echo "configure:3394: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -3403,13 +3405,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3413: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3415: \"$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 : @@ -3420,13 +3422,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3430: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3432: \"$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 : @@ -3437,13 +3439,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3447: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3449: \"$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 : @@ -3473,7 +3475,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3477: checking for $ac_word" >&5 +echo "configure:3479: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3501,12 +3503,12 @@ fi test -n "$LEX" && break done -test -n "$LEX" || LEX=""$missing_dir/missing flex"" +test -n "$LEX" || LEX="$missing_dir/missing flex" # Extract the first word of "flex", so it can be a program name with args. set dummy flex; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3510: checking for $ac_word" >&5 +echo "configure:3512: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3540,7 +3542,7 @@ then *) ac_lib=l ;; esac echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6 -echo "configure:3544: checking for yywrap in -l$ac_lib" >&5 +echo "configure:3546: checking for yywrap in -l$ac_lib" >&5 ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3548,7 +3550,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$ac_lib $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3565: \"$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 @@ -3582,7 +3584,7 @@ fi fi echo $ac_n "checking lex output file root""... $ac_c" 1>&6 -echo "configure:3586: checking lex output file root" >&5 +echo "configure:3588: checking lex output file root" >&5 if eval "test \"`echo '$''{'ac_cv_prog_lex_root'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3603,7 +3605,7 @@ echo "$ac_t""$ac_cv_prog_lex_root" 1>&6 LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root echo $ac_n "checking whether yytext is a pointer""... $ac_c" 1>&6 -echo "configure:3607: checking whether yytext is a pointer" >&5 +echo "configure:3609: checking whether yytext is a pointer" >&5 if eval "test \"`echo '$''{'ac_cv_prog_lex_yytext_pointer'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3615,14 +3617,14 @@ echo 'extern char *yytext;' >>$LEX_OUTPU ac_save_LIBS="$LIBS" LIBS="$LIBS $LEXLIB" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3628: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_prog_lex_yytext_pointer=yes else @@ -3644,11 +3646,11 @@ EOF fi -ALL_LINGUAS="fr tr" +ALL_LINGUAS="fr tr es" # 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:3652: checking for $ac_word" >&5 +echo "configure:3654: 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 @@ -3676,12 +3678,12 @@ else fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:3680: checking for ANSI C header files" >&5 +echo "configure:3682: 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 < #include @@ -3689,7 +3691,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3693: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3695: \"$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* @@ -3706,7 +3708,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 @@ -3724,7 +3726,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 @@ -3745,7 +3747,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -3756,7 +3758,7 @@ if (XOR (islower (i), ISLOWER (i)) || to exit (0); } EOF -if { (eval echo configure:3760: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3762: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -3780,12 +3782,12 @@ EOF fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:3784: checking for working const" >&5 +echo "configure:3786: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3840: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -3855,21 +3857,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:3859: checking for inline" >&5 +echo "configure:3861: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3875: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -3895,12 +3897,12 @@ EOF esac echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:3899: checking for off_t" >&5 +echo "configure:3901: 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 < #if STDC_HEADERS @@ -3928,12 +3930,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:3932: checking for size_t" >&5 +echo "configure:3934: 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 < #if STDC_HEADERS @@ -3963,19 +3965,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:3967: checking for working alloca.h" >&5 +echo "configure:3969: 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 < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:3979: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3981: \"$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 @@ -3996,12 +3998,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:4000: checking for alloca" >&5 +echo "configure:4002: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4035: \"$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 @@ -4061,12 +4063,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:4065: checking whether alloca needs Cray hooks" >&5 +echo "configure:4067: 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 <&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:4095: checking for $ac_func" >&5 +echo "configure:4097: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4125: \"$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 @@ -4146,7 +4148,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:4150: checking stack direction for C alloca" >&5 +echo "configure:4152: 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 @@ -4154,7 +4156,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4179: \"$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 @@ -4198,17 +4200,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:4202: checking for $ac_hdr" >&5 +echo "configure:4204: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4212: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4214: \"$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* @@ -4237,12 +4239,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4241: checking for $ac_func" >&5 +echo "configure:4243: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4271: \"$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 @@ -4290,7 +4292,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:4294: checking for working mmap" >&5 +echo "configure:4296: 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 @@ -4298,7 +4300,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4444: \"$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 @@ -4466,17 +4468,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:4470: checking for $ac_hdr" >&5 +echo "configure:4472: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4480: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4482: \"$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* @@ -4506,12 +4508,12 @@ done __argz_count __argz_stringify __argz_next do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4510: checking for $ac_func" >&5 +echo "configure:4512: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4540: \"$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 @@ -4563,12 +4565,12 @@ done for ac_func in stpcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4567: checking for $ac_func" >&5 +echo "configure:4569: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4597: \"$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 @@ -4625,19 +4627,19 @@ EOF if test $ac_cv_header_locale_h = yes; then echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:4629: checking for LC_MESSAGES" >&5 +echo "configure:4631: 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 < int main() { return LC_MESSAGES ; return 0; } EOF -if { (eval echo configure:4641: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4643: \"$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 @@ -4658,7 +4660,7 @@ EOF fi fi echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 -echo "configure:4662: checking whether NLS is requested" >&5 +echo "configure:4664: 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" @@ -4678,7 +4680,7 @@ fi EOF echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 -echo "configure:4682: checking whether included gettext is requested" >&5 +echo "configure:4684: 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" @@ -4697,17 +4699,17 @@ fi ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 -echo "configure:4701: checking for libintl.h" >&5 +echo "configure:4703: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4711: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4713: \"$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* @@ -4724,19 +4726,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:4728: checking for gettext in libc" >&5 +echo "configure:4730: 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 < int main() { return (int) gettext ("") ; return 0; } EOF -if { (eval echo configure:4740: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4742: \"$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 @@ -4752,7 +4754,7 @@ echo "$ac_t""$gt_cv_func_gettext_libc" 1 if test "$gt_cv_func_gettext_libc" != "yes"; then echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6 -echo "configure:4756: checking for bindtextdomain in -lintl" >&5 +echo "configure:4758: 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 @@ -4760,7 +4762,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4777: \"$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 @@ -4787,19 +4789,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:4791: checking for gettext in libintl" >&5 +echo "configure:4793: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4805: \"$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 @@ -4827,7 +4829,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:4831: checking for $ac_word" >&5 +echo "configure:4833: 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 @@ -4861,12 +4863,12 @@ fi for ac_func in dcgettext do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4865: checking for $ac_func" >&5 +echo "configure:4867: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4895: \"$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 @@ -4916,7 +4918,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:4920: checking for $ac_word" >&5 +echo "configure:4922: 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 @@ -4952,7 +4954,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:4956: checking for $ac_word" >&5 +echo "configure:4958: 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 @@ -4984,7 +4986,7 @@ else fi cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4998: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* CATOBJEXT=.gmo DATADIRNAME=share @@ -5024,7 +5026,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:5028: checking for $ac_word" >&5 +echo "configure:5030: 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 @@ -5058,7 +5060,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:5062: checking for $ac_word" >&5 +echo "configure:5064: 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 @@ -5094,7 +5096,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:5098: checking for $ac_word" >&5 +echo "configure:5100: 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 @@ -5184,7 +5186,7 @@ fi LINGUAS= else echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 -echo "configure:5188: checking for catalogs to be installed" >&5 +echo "configure:5190: checking for catalogs to be installed" >&5 NEW_LINGUAS= for lang in ${LINGUAS=$ALL_LINGUAS}; do case "$ALL_LINGUAS" in @@ -5212,17 +5214,17 @@ echo "configure:5188: checking for catal 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:5216: checking for linux/version.h" >&5 +echo "configure:5218: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5226: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5228: \"$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* @@ -5285,7 +5287,7 @@ fi echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:5289: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:5291: 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" @@ -5310,7 +5312,7 @@ fi echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:5314: checking for executable suffix" >&5 +echo "configure:5316: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5320,7 +5322,7 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:5324: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:5326: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in *.c | *.o | *.obj) ;; @@ -5345,17 +5347,17 @@ for ac_hdr in string.h stdlib.h memory.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5349: checking for $ac_hdr" >&5 +echo "configure:5351: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5359: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5361: \"$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* @@ -5385,7 +5387,7 @@ done # Put this here so that autoconf's "cross-compiling" message doesn't confuse # people who are not cross-compiling but are compiling cross-assemblers. echo $ac_n "checking whether compiling a cross-assembler""... $ac_c" 1>&6 -echo "configure:5389: checking whether compiling a cross-assembler" >&5 +echo "configure:5391: checking whether compiling a cross-assembler" >&5 if test "${host}" = "${target}"; then cross_gas=no else @@ -5400,19 +5402,19 @@ echo "$ac_t""$cross_gas" 1>&6 # 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:5404: checking for working alloca.h" >&5 +echo "configure:5406: 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 < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:5416: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5418: \"$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 @@ -5433,12 +5435,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:5437: checking for alloca" >&5 +echo "configure:5439: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5472: \"$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 @@ -5498,12 +5500,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:5502: checking whether alloca needs Cray hooks" >&5 +echo "configure:5504: 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 <&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:5532: checking for $ac_func" >&5 +echo "configure:5534: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5562: \"$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 @@ -5583,7 +5585,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:5587: checking stack direction for C alloca" >&5 +echo "configure:5589: 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 @@ -5591,7 +5593,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5616: \"$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 @@ -5632,21 +5634,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:5636: checking for inline" >&5 +echo "configure:5638: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5652: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -5676,12 +5678,12 @@ esac for ac_func in unlink remove do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5680: checking for $ac_func" >&5 +echo "configure:5682: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5710: \"$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 @@ -5733,12 +5735,12 @@ done for ac_func in sbrk do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5737: checking for $ac_func" >&5 +echo "configure:5739: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5767: \"$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 @@ -5796,7 +5798,7 @@ case $host in ;; *-ncr-sysv4.3*) echo $ac_n "checking for _mwvalidcheckl in -lmw""... $ac_c" 1>&6 -echo "configure:5800: checking for _mwvalidcheckl in -lmw" >&5 +echo "configure:5802: checking for _mwvalidcheckl in -lmw" >&5 ac_lib_var=`echo mw'_'_mwvalidcheckl | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5804,7 +5806,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lmw $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5821: \"$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 @@ -5836,7 +5838,7 @@ else fi echo $ac_n "checking for main in -lm""... $ac_c" 1>&6 -echo "configure:5840: checking for main in -lm" >&5 +echo "configure:5842: checking for main in -lm" >&5 ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5844,14 +5846,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5857: \"$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 @@ -5874,7 +5876,7 @@ fi ;; *) echo $ac_n "checking for main in -lm""... $ac_c" 1>&6 -echo "configure:5878: checking for main in -lm" >&5 +echo "configure:5880: checking for main in -lm" >&5 ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5882,14 +5884,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5895: \"$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 @@ -5920,12 +5922,12 @@ esac # enough, but on some of those systems, the assert macro relies on requoting # working properly! echo $ac_n "checking for working assert macro""... $ac_c" 1>&6 -echo "configure:5924: checking for working assert macro" >&5 +echo "configure:5926: checking for working assert macro" >&5 if eval "test \"`echo '$''{'gas_cv_assert_ok'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -5941,7 +5943,7 @@ assert (a == b ; return 0; } EOF -if { (eval echo configure:5945: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5947: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gas_cv_assert_ok=yes else @@ -5982,12 +5984,12 @@ gas_test_headers=" " echo $ac_n "checking whether declaration is required for strstr""... $ac_c" 1>&6 -echo "configure:5986: checking whether declaration is required for strstr" >&5 +echo "configure:5988: checking whether declaration is required for strstr" >&5 if eval "test \"`echo '$''{'gas_cv_decl_needed_strstr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6004: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gas_cv_decl_needed_strstr=no else @@ -6019,12 +6021,12 @@ fi echo $ac_n "checking whether declaration is required for malloc""... $ac_c" 1>&6 -echo "configure:6023: checking whether declaration is required for malloc" >&5 +echo "configure:6025: checking whether declaration is required for malloc" >&5 if eval "test \"`echo '$''{'gas_cv_decl_needed_malloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6041: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gas_cv_decl_needed_malloc=no else @@ -6056,12 +6058,12 @@ fi echo $ac_n "checking whether declaration is required for free""... $ac_c" 1>&6 -echo "configure:6060: checking whether declaration is required for free" >&5 +echo "configure:6062: checking whether declaration is required for free" >&5 if eval "test \"`echo '$''{'gas_cv_decl_needed_free'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6078: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gas_cv_decl_needed_free=no else @@ -6093,12 +6095,12 @@ fi echo $ac_n "checking whether declaration is required for sbrk""... $ac_c" 1>&6 -echo "configure:6097: checking whether declaration is required for sbrk" >&5 +echo "configure:6099: checking whether declaration is required for sbrk" >&5 if eval "test \"`echo '$''{'gas_cv_decl_needed_sbrk'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6115: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gas_cv_decl_needed_sbrk=no else @@ -6130,12 +6132,12 @@ fi echo $ac_n "checking whether declaration is required for environ""... $ac_c" 1>&6 -echo "configure:6134: checking whether declaration is required for environ" >&5 +echo "configure:6136: checking whether declaration is required for environ" >&5 if eval "test \"`echo '$''{'gas_cv_decl_needed_environ'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6152: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gas_cv_decl_needed_environ=no else @@ -6170,12 +6172,12 @@ fi # for it? echo $ac_n "checking whether declaration is required for errno""... $ac_c" 1>&6 -echo "configure:6174: checking whether declaration is required for errno" >&5 +echo "configure:6176: checking whether declaration is required for errno" >&5 if eval "test \"`echo '$''{'gas_cv_decl_needed_errno'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6196: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gas_cv_decl_needed_errno=no else diff -uprN binutils-2.11.93.0.2/gas/configure.in binutils-2.12.90.0.1/gas/configure.in --- binutils-2.11.93.0.2/gas/configure.in Sun Feb 3 11:22:31 2002 +++ binutils-2.12.90.0.1/gas/configure.in Thu Mar 7 11:52:37 2002 @@ -145,6 +145,7 @@ changequote([,])dnl rs6000*) cpu_type=ppc ;; s390x*) cpu_type=s390 arch=s390x ;; s390*) cpu_type=s390 arch=s390 ;; + sh64*) cpu_type=sh64 endian=big;; sh*le) cpu_type=sh endian=little ;; sh*) cpu_type=sh endian=big ;; sparclite*) cpu_type=sparc arch=sparclite ;; @@ -425,6 +426,7 @@ changequote([,])dnl sh-*-rtemself*) fmt=elf ;; sh-*-rtems*) fmt=coff bfd_gas=yes;; + sh64-*-elf*) fmt=elf ;; ns32k-pc532-mach* | ns32k-pc532-ux*) fmt=aout em=pc532mach ;; ns32k-pc532-netbsd* | ns32k-pc532-lites*) fmt=aout em=nbsd532 ;; ns32k-pc532-openbsd*) fmt=aout em=nbsd532 ;; @@ -875,7 +877,7 @@ AC_PROG_CC AC_PROG_YACC AM_PROG_LEX -ALL_LINGUAS="fr tr" +ALL_LINGUAS="fr tr es" CY_GNU_GETTEXT AM_MAINTAINER_MODE diff -uprN binutils-2.11.93.0.2/gas/doc/Makefile.am binutils-2.12.90.0.1/gas/doc/Makefile.am --- binutils-2.11.93.0.2/gas/doc/Makefile.am Sun Feb 3 11:22:31 2002 +++ binutils-2.12.90.0.1/gas/doc/Makefile.am Thu Mar 7 11:52:37 2002 @@ -15,7 +15,9 @@ POD2MAN = pod2man --center="GNU Developm man_MANS = as.1 -info_TEXINFOS = as.texinfo gasp.texi +# The gasp.texi file is now deprecated, as GASP has been deprecated. +# It will disappear in a future release. +info_TEXINFOS = as.texinfo asconfig.texi: $(CONFIG).texi rm -f asconfig.texi @@ -25,9 +27,11 @@ asconfig.texi: $(CONFIG).texi CPU_DOCS = \ c-a29k.texi \ + c-alpha.texi \ c-arc.texi \ c-arm.texi \ c-d10v.texi \ + c-cris.texi \ c-h8300.texi \ c-h8500.texi \ c-hppa.texi \ @@ -46,6 +50,7 @@ CPU_DOCS = \ c-pj.texi \ c-ppc.texi \ c-sh.texi \ + c-sh64.texi \ c-sparc.texi \ c-tic54x.texi \ c-vax.texi \ @@ -65,7 +70,7 @@ install: install-info # This one isn't ready for prime time yet. Not even a little bit. -noinst_TEXINFOS = internals.texi +noinst_TEXINFOS = internals.texi gasp.texi DISTCLEANFILES = asconfig.texi diff -uprN binutils-2.11.93.0.2/gas/doc/Makefile.in binutils-2.12.90.0.1/gas/doc/Makefile.in --- binutils-2.11.93.0.2/gas/doc/Makefile.in Sun Feb 3 11:22:31 2002 +++ binutils-2.12.90.0.1/gas/doc/Makefile.in Thu Mar 7 11:52:37 2002 @@ -132,13 +132,17 @@ POD2MAN = pod2man --center="GNU Developm man_MANS = as.1 -info_TEXINFOS = as.texinfo gasp.texi +# The gasp.texi file is now deprecated, as GASP has been deprecated. +# It will disappear in a future release. +info_TEXINFOS = as.texinfo CPU_DOCS = \ c-a29k.texi \ + c-alpha.texi \ c-arc.texi \ c-arm.texi \ c-d10v.texi \ + c-cris.texi \ c-h8300.texi \ c-h8500.texi \ c-hppa.texi \ @@ -157,6 +161,7 @@ CPU_DOCS = \ c-pj.texi \ c-ppc.texi \ c-sh.texi \ + c-sh64.texi \ c-sparc.texi \ c-tic54x.texi \ c-vax.texi \ @@ -166,7 +171,7 @@ CPU_DOCS = \ # This one isn't ready for prime time yet. Not even a little bit. -noinst_TEXINFOS = internals.texi +noinst_TEXINFOS = internals.texi gasp.texi DISTCLEANFILES = asconfig.texi @@ -176,9 +181,9 @@ CONFIG_HEADER = ../config.h CONFIG_CLEAN_FILES = TEXI2DVI = `if test -f $(top_srcdir)/../texinfo/util/texi2dvi; then echo $(top_srcdir)/../texinfo/util/texi2dvi; else echo texi2dvi; fi` TEXINFO_TEX = $(top_srcdir)/../texinfo/texinfo.tex -INFO_DEPS = as.info gasp.info -DVIS = as.dvi gasp.dvi -TEXINFOS = as.texinfo gasp.texi +INFO_DEPS = as.info +DVIS = as.dvi +TEXINFOS = as.texinfo man1dir = $(mandir)/man1 MANS = $(man_MANS) @@ -205,10 +210,6 @@ as.info: as.texinfo as.dvi: as.texinfo -gasp.info: gasp.texi -gasp.dvi: gasp.texi - - DVIPS = dvips .texi.info: @@ -301,10 +302,7 @@ dist-info: $(INFO_DEPS) mostlyclean-aminfo: -rm -f as.aux as.cp as.cps as.dvi as.fn as.fns as.ky as.kys as.ps \ as.log as.pg as.toc as.tp as.tps as.vr as.vrs as.op as.tr \ - as.cv as.cn gasp.aux gasp.cp gasp.cps gasp.dvi gasp.fn \ - gasp.fns gasp.ky gasp.kys gasp.ps gasp.log gasp.pg gasp.toc \ - gasp.tp gasp.tps gasp.vr gasp.vrs gasp.op gasp.tr gasp.cv \ - gasp.cn + as.cv as.cn clean-aminfo: diff -uprN binutils-2.11.93.0.2/gas/doc/all.texi binutils-2.12.90.0.1/gas/doc/all.texi --- binutils-2.11.93.0.2/gas/doc/all.texi Fri Nov 16 14:05:52 2001 +++ binutils-2.12.90.0.1/gas/doc/all.texi Thu Mar 7 11:52:37 2002 @@ -1,4 +1,4 @@ -@c Copyright 1992, 1993, 1994, 1996, 1997, 1999, 2000, 2001 +@c Copyright 1992, 1993, 1994, 1996, 1997, 1999, 2000, 2001, 2002 @c Free Software Foundation, Inc. @c This file is part of the documentation for the GAS manual @@ -27,8 +27,10 @@ @c CPUs of interest @c ================ @set A29K +@set ALPHA @set ARC @set ARM +@set CRIS @set D10V @set D30V @set H8/300 diff -uprN binutils-2.11.93.0.2/gas/doc/as.texinfo binutils-2.12.90.0.1/gas/doc/as.texinfo --- binutils-2.11.93.0.2/gas/doc/as.texinfo Sun Feb 3 11:22:31 2002 +++ binutils-2.12.90.0.1/gas/doc/as.texinfo Thu Mar 7 11:52:37 2002 @@ -29,8 +29,10 @@ @set TARGET TARGET @set GENERIC @set A29K +@set ALPHA @set ARC @set ARM +@set CRIS @set D10V @set D30V @set H8/300 @@ -40,6 +42,7 @@ @set I80386 @set I860 @set I960 +@set IA-64 @set M32R @set M68HC11 @set M680X0 @@ -116,6 +119,7 @@ @format START-INFO-DIR-ENTRY * As: (as). The GNU assembler. +* Gas: (as). The GNU assembler. END-INFO-DIR-ENTRY @end format @end ifinfo @@ -265,6 +269,14 @@ gcc(1), ld(1), and the Info entries for @ifset A29K @c am29k has no machine-dependent assembler options @end ifset +@ifset ALPHA + +@emph{Target Alpha options:} + [@b{-m@var{cpu}}] + [@b{-mdebug} | @b{-no-mdebug}] + [@b{-relax}] [@b{-g}] [@b{-G@var{size}}] + [@b{-F}] [@b{-32addr}] +@end ifset @ifset ARC @emph{Target ARC options:} @@ -284,6 +296,15 @@ gcc(1), ld(1), and the Info entries for @b{-mapcs-reentrant}] [@b{-mthumb-interwork}] [@b{-moabi}] [@b{-k}] @end ifset +@ifset CRIS + +@emph{Target CRIS options:} + [@b{--underscore} | @b{--no-underscore}] + [@b{--pic}] [@b{-N}] + [@b{--emulation=criself} | @b{--emulation=crisaout}] +@c Deprecated -- deliberately not documented. +@c [@b{-h}] [@b{-H}] +@end ifset @ifset D10V @emph{Target D10V options:} @@ -313,11 +334,19 @@ gcc(1), ld(1), and the Info entries for @b{-AKC}|@b{-AMC}] [@b{-b}] [@b{-no-relax}] @end ifset +@ifset IA64 + +@emph{Target IA-64 options:} + [@b{-mconstant-gp}|@b{-mauto-pic}] + [@b{-milp32}|@b{-milp64}|@b{-mlp64}|@b{-mp64}] + [@b{-mle}|@b{mbe}] + [@b{-x}|@b{-xexplicit}] [@b{-xauto}] [@b{-xdebug}] +@end ifset @ifset M32R @emph{Target M32R options:} [@b{--m32rx}|@b{--[no-]warn-explicit-parallel-conflicts}| - @b{--W[n]p}] + @b{--W[n]p}] @end ifset @ifset M680X0 @@ -582,6 +611,10 @@ Specify that PIC code has been generated @end table @end ifset +@ifset CRIS +See the info pages for documentation of the CRIS-specific options. +@end ifset + @ifset D10V The following options are available when @value{AS} is configured for a D10V processor. @@ -5572,12 +5605,18 @@ subject, see the hardware manufacturer's @ifset A29K * AMD29K-Dependent:: AMD 29K Dependent Features @end ifset +@ifset ALPHA +* Alpha-Dependent:: Alpha Dependent Features +@end ifset @ifset ARC * ARC-Dependent:: ARC Dependent Features @end ifset @ifset ARM * ARM-Dependent:: ARM Dependent Features @end ifset +@ifset CRIS +* CRIS-Dependent:: CRIS Dependent Features +@end ifset @ifset D10V * D10V-Dependent:: D10V Dependent Features @end ifset @@ -5625,6 +5664,7 @@ subject, see the hardware manufacturer's @end ifset @ifset SH * SH-Dependent:: Hitachi SH Dependent Features +* SH64-Dependent:: Hitachi SH64 Dependent Features @end ifset @ifset PDP11 * PDP-11-Dependent:: PDP-11 Dependent Features @@ -5663,18 +5703,26 @@ subject, see the hardware manufacturer's @c node and sectioning commands; hence the repetition of @chapter BLAH @c in both conditional blocks. -@ifset ARC -@include c-arc.texi -@end ifset - @ifset A29K @include c-a29k.texi @end ifset +@ifset ALPHA +@include c-alpha.texi +@end ifset + +@ifset ARC +@include c-arc.texi +@end ifset + @ifset ARM @include c-arm.texi @end ifset +@ifset CRIS +@include c-cris.texi +@end ifset + @ifset Hitachi-all @ifclear GENERIC @node Machine Dependencies @@ -5730,6 +5778,10 @@ family. @include c-i960.texi @end ifset +@ifset IA64 +@include c-ia64.texi +@end ifset + @ifset M32R @include c-m32r.texi @end ifset @@ -5772,6 +5824,7 @@ family. @ifset SH @include c-sh.texi +@include c-sh64.texi @end ifset @ifset SPARC diff -uprN binutils-2.11.93.0.2/gas/doc/c-alpha.texi binutils-2.12.90.0.1/gas/doc/c-alpha.texi --- binutils-2.11.93.0.2/gas/doc/c-alpha.texi Wed Dec 31 16:00:00 1969 +++ binutils-2.12.90.0.1/gas/doc/c-alpha.texi Thu Mar 7 11:52:37 2002 @@ -0,0 +1,396 @@ +@c Copyright 2002 +@c Free Software Foundation, Inc. +@c This is part of the GAS manual. +@c For copying conditions, see the file as.texinfo. + +@ifset GENERIC +@page +@node Alpha-Dependent +@chapter Alpha Dependent Features +@end ifset + +@ifclear GENERIC +@node Machine Dependencies +@chapter Alpha Dependent Features +@end ifclear + +@cindex Alpha support +@menu +* Alpha Notes:: Notes +* Alpha Options:: Options +* Alpha Syntax:: Syntax +* Alpha Floating Point:: Floating Point +* Alpha Directives:: Alpha Machine Directives +* Alpha Opcodes:: Opcodes +@end menu + +@node Alpha Notes +@section Notes +@cindex Alpha notes +@cindex notes for Alpha + +The documentation here is primarily for the ELF object format. +@code{@value{AS}} also supports the ECOFF and EVAX formats, but +features specific to these formats are not yet documented. + +@node Alpha Options +@section Options +@cindex Alpha options +@cindex options for Alpha + +@table @option +@cindex @code{-m@var{cpu}} command line option, Alpha +@item -m@var{cpu} +This option specifies the target processor. If an attempt is made to +assemble an instruction which will not execute on the target processor, +the assembler may either expand the instruction as a macro or issue an +error message. This option is equivalent to the @code{.arch} directive. + +The following processor names are recognized: +@code{21064}, +@code{21064a}, +@code{21066}, +@code{21068}, +@code{21164}, +@code{21164a}, +@code{21164pc}, +@code{21264}, +@code{ev4}, +@code{ev5}, +@code{lca45}, +@code{ev5}, +@code{ev56}, +@code{pca56}, +@code{ev6}. +The special name @code{all} may be used to allow the assembler to accept +instructions valid for any Alpha processor. + +In order to support existing practice in OSF/1 with respect to @code{.arch}, +and existing practice within @command{MILO} (the Linux ARC bootloader), the +numbered processor names (e.g.@: 21064) enable the processor-specific PALcode +instructions, while the ``electro-vlasic'' names (e.g.@: @code{ev4}) do not. + +@cindex @code{-mdebug} command line option, Alpha +@cindex @code{-no-mdebug} command line option, Alpha +@item -mdebug +@itemx -no-mdebug +Enables or disables the generation of @code{.mdebug} encapsulation for +stabs directives and procedure descriptors. The default is to automatically +enable @code{.mdebug} when the first stabs directive is seen. + +@cindex @code{-relax} command line option, Alpha +@item -relax +This option forces all relocations to be put into the object file, instead +of saving space and resolving some relocations at assembly time. Note that +this option does not propagate all symbol arithmetic into the object file, +because not all symbol arithmetic can be represented. However, the option +can still be useful in specific applications. + +@cindex @code{-g} command line option, Alpha +@item -g +This option is used when the compiler generates debug information. When +@command{gcc} is using @command{mips-tfile} to generate debug +information for ECOFF, local labels must be passed through to the object +file. Otherwise this option has no effect. + +@cindex @code{-G} command line option, Alpha +@item -G@var{size} +A local common symbol larger than @var{size} is placed in @code{.bss}, +while smaller symbols are placed in @code{.sbss}. + +@cindex @code{-F} command line option, Alpha +@cindex @code{-32addr} command line option, Alpha +@item -F +@itemx -32addr +These options are ignored for backward compatibility. +@end table + +@cindex Alpha Syntax +@node Alpha Syntax +@section Syntax +The assembler syntax closely follow the Alpha Reference Manual; +assembler directives and general syntax closely follow the OSF/1 and +OpenVMS syntax, with a few differences for ELF. + +@menu +* Alpha-Chars:: Special Characters +* Alpha-Regs:: Register Names +* Alpha-Relocs:: Relocations +@end menu + +@node Alpha-Chars +@subsection Special Characters + +@cindex line comment character, Alpha +@cindex Alpha line comment character +@samp{#} is the line comment character. + +@cindex line separator, Alpha +@cindex statement separator, Alpha +@cindex Alpha line separator +@samp{;} can be used instead of a newline to separate statements. + +@node Alpha-Regs +@subsection Register Names +@cindex Alpha registers +@cindex register names, Alpha + +The 32 integer registers are refered to as @samp{$@var{n}} or +@samp{$r@var{n}}. In addition, registers 15, 28, 29, and 30 may +be refered to by the symbols @samp{$fp}, @samp{$at}, @samp{$gp}, +and @samp{$sp} respectively. + +The 32 floating-point registers are refered to as @samp{$f@var{n}}. + +@node Alpha-Relocs +@subsection Relocations +@cindex Alpha relocations +@cindex relocations, Alpha + +Some of these relocations are available for ECOFF, but mostly +only for ELF. They are modeled after the relocation format +introduced in Digial Unix 4.0, but there are additions. + +The format is @samp{!@var{tag}} or @samp{!@var{tag}!@var{number}} +where @var{tag} is the name of the relocation. In some cases +@var{number} is used to relate specific instructions. + +The relocation is placed at the end of the instruction like so: + +@example +ldah $0,a($29) !gprelhigh +lda $0,a($0) !gprellow +ldq $1,b($29) !literal!100 +ldl $2,0($1) !lituse_base!100 +@end example + +@table @code +@item !literal +@itemx !literal!@var{N} +Used with an @code{ldq} instruction to load the address of a symbol +from the GOT. + +A sequence number @var{N} is optional, and if present is used to pair +@code{lituse} relocations with this @code{literal} relocation. The +@code{lituse} relocations are used by the linker to optimize the code +based on the final location of the symbol. + +Note that these optimizations are dependent on the data flow of the +program. Therefore, if @emph{any} @code{lituse} is paired with a +@code{literal} relocation, then @emph{all} uses of the register set by +the @code{literal} instruction must also be marked with @code{lituse} +relocations. This is because the original @code{literal} instruction +may be deleted or transformed into another instruction. + +Also note that there may be a one-to-many relationship between +@code{literal} and @code{lituse}, but not a many-to-one. That is, if +there are two code paths that load up the same address and feed the +value to a single use, then the use may not use a @code{lituse} +relocation. + +@item !lituse_base!@var{N} +Used with any memory format instruction (e.g.@: @code{ldl}) to indicate +that the literal is used for an address load. The offset field of the +instruction must be zero. During relaxation, the code may be altered +to use a gp-relative load. + +@item !lituse_jsr!@var{N} +Used with a register branch format instruction (e.g.@: @code{jsr}) to +indicate that the literal is used for a call. During relaxation, the +code may be altered to use a direct branch (e.g.@: @code{bsr}). + +@item !lituse_bytoff!@var{N} +Used with a byte mask instruction (e.g.@: @code{extbl}) to indicate +that only the low 3 bits of the address are relevant. During relaxation, +the code may be altered to use an immediate instead of a register shift. + +@item !lituse_addr!@var{N} +Used with any other instruction to indicate that the original address +is in fact used, and the original @code{ldq} instruction may not be +altered or deleted. This is useful in conjunction with @code{lituse_jsr} +to test whether a weak symbol is defined. + +@example +ldq $27,foo($29) !literal!1 +beq $27,is_undef !lituse_addr!1 +jsr $26,($27),foo !lituse_jsr!1 +@end example + +@item !gpdisp!@var{N} +Used with @code{ldah} and @code{lda} to load the GP from the current +address, a-la the @code{ldgp} macro. The source register for the +@code{ldah} instruction must contain the address of the @code{ldah} +instruction. There must be exactly one @code{lda} instruction paired +with the @code{ldah} instruction, though it may appear anywhere in +the instruction stream. The immediate operands must be zero. + +@example +bsr $26,foo +ldah $29,0($26) !gpdisp!1 +lda $29,0($29) !gpdisp!1 +@end example + +@item !gprelhigh +Used with an @code{ldah} instruction to add the high 16 bits of a +32-bit displacement from the GP. + +@item !gprellow +Used with any memory format instruction to add the low 16 bits of a +32-bit displacement from the GP. + +@item !gprel +Used with any memory format instruction to add a 16-bit displacement +from the GP. + +@item !samegp +Used with any branch format instruction to skip the GP load at the +target address. The referenced symbol must have the same GP as the +source object file, and it must be declared to either not use @code{$27} +or perform a standard GP load in the first two instructions via the +@code{.prologue} directive. +@end table + +@node Alpha Floating Point +@section Floating Point +@cindex floating point, Alpha (@sc{ieee}) +@cindex Alpha floating point (@sc{ieee}) +The Alpha family uses both @sc{ieee} and VAX floating-point numbers. + +@node Alpha Directives +@section Alpha Assembler Directives + +@command{@value{AS}} for the Alpha supports many additional directives for +compatibility with the native assembler. This section describes them only +briefly. + +@cindex Alpha-only directives +These are the additional directives in @code{@value{AS}} for the Alpha: + +@table @code +@item .arch @var{cpu} +Specifies the target processor. This is equivalent to the +@option{-m@var{cpu}} command-line option. @xref{Alpha Options, Options}, +for a list of values for @var{cpu}. + +@item .ent @var{function}[, @var{n}] +Mark the beginning of @var{function}. An optional number may follow for +compatibility with the OSF/1 assembler, but is ignored. When generating +@code{.mdebug} information, this will create a procedure descriptor for +the function. In ELF, it will mark the symbol as a function a-la the +generic @code{.type} directive. + +@item .end @var{function} +Mark the end of @var{function}. In ELF, it will set the size of the symbol +a-la the generic @code{.size} directive. + +@item .mask @var{mask}, @var{offset} +Indicate which of the integer registers are saved in the current +function's stack frame. @var{mask} is interpreted a bit mask in which +bit @var{n} set indicates that register @var{n} is saved. The registers +are saved in a block located @var{offset} bytes from the @dfn{canonical +frame address} (CFA) which is the value of the stack pointer on entry to +the function. The registers are saved sequentially, except that the +return address register (normally @code{$26}) is saved first. + +This and the other directives that describe the stack frame are +currently only used when generating @code{.mdebug} information. They +may in the future be used to generate DWARF2 @code{.debug_frame} unwind +information for hand written assembly. + +@item .fmask @var{mask}, @var{offset} +Indicate which of the floating-point registers are saved in the current +stack frame. The @var{mask} and @var{offset} parameters are interpreted +as with @code{.mask}. + +@item .frame @var{framereg}, @var{frameoffset}, @var{retreg}[, @var{argoffset}] +Describes the shape of the stack frame. The frame pointer in use is +@var{framereg}; normally this is either @code{$fp} or @code{$sp}. The +frame pointer is @var{frameoffset} bytes below the CFA. The return +address is initially located in @var{retreg} until it is saved as +indicated in @code{.mask}. For compatibility with OSF/1 an optional +@var{argoffset} parameter is accepted and ignored. It is believed to +indicate the offset from the CFA to the saved argument registers. + +@item .prologue @var{n} +Indicate that the stack frame is set up and all registers have been +spilled. The argument @var{n} indicates whether and how the function +uses the incoming @dfn{procedure vector} (the address of the called +function) in @code{$27}. 0 indicates that @code{$27} is not used; 1 +indicates that the first two instructions of the function use @code{$27} +to perform a load of the GP register; 2 indicates that @code{$27} is +used in some non-standard way and so the linker cannot elide the load of +the procedure vector during relaxation. + +@item .gprel32 @var{expression} +Computes the difference between the address in @var{expression} and the +GP for the current object file, and stores it in 4 bytes. In addition +to being smaller than a full 8 byte address, this also does not require +a dynamic relocation when used in a shared library. + +@item .t_floating @var{expression} +Stores @var{expression} as an @sc{ieee} double precision value. + +@item .s_floating @var{expression} +Stores @var{expression} as an @sc{ieee} single precision value. + +@item .f_floating @var{expression} +Stores @var{expression} as a VAX F format value. + +@item .g_floating @var{expression} +Stores @var{expression} as a VAX G format value. + +@item .d_floating @var{expression} +Stores @var{expression} as a VAX D format value. + +@item .set @var{feature} +Enables or disables various assembler features. Using the positive +name of the feature enables while using @samp{no@var{feature}} disables. + +@table @code +@item at +Indicates that macro expansions may clobber the @dfn{assembler +temporary} (@code{$at} or @code{$28}) register. Some macros may not be +expanded without this and will generate an error message if @code{noat} +is in effect. When @code{at} is in effect, a warning will be generated +if @code{$at} is used by the programmer. + +@item macro +Enables the expasion of macro instructions. Note that variants of real +instructions, such as @code{br label} vs @code{br $31,label} are +considered alternate forms and not macros. + +@item move +@itemx reorder +@itemx volatile +These control whether and how the assembler may re-order instructions. +Accepted for compatibility with the OSF/1 assembler, but @command{@value{AS}} +does not do instruction scheduling, so these features are ignored. +@end table +@end table + +The following directives are recognized for compatibility with the OSF/1 +assembler but are ignored. + +@example +.proc .aproc +.reguse .livereg +.option .aent +.ugen .eflag +.alias .noalias +@end example + +@node Alpha Opcodes +@section Opcodes +For detailed information on the Alpha machine instruction set, see the +@c Attempt to work around a very overfull hbox. +@iftex +Alpha Architecture Handbook located at +@smallfonts +@example +ftp://ftp.digital.com/pub/Digital/info/semiconductor/literature/alphaahb.pdf +@end example +@textfonts +@end iftex +@ifnottex +@uref{ftp://ftp.digital.com/pub/Digital/info/semiconductor/literature/alphaahb.pdf,Alpha Architecture Handbook}. +@end ifnottex diff -uprN binutils-2.11.93.0.2/gas/doc/c-cris.texi binutils-2.12.90.0.1/gas/doc/c-cris.texi --- binutils-2.11.93.0.2/gas/doc/c-cris.texi Wed Dec 31 16:00:00 1969 +++ binutils-2.12.90.0.1/gas/doc/c-cris.texi Thu Mar 7 11:52:37 2002 @@ -0,0 +1,293 @@ +@c Copyright 2002 Free Software Foundation, Inc. +@c This is part of the GAS manual. +@c For copying conditions, see the file as.texinfo. +@c CRIS description contributed by Axis Communications. +@ifset GENERIC +@page +@node CRIS-Dependent +@chapter CRIS Dependent Features +@end ifset +@ifclear GENERIC +@node Machine Dependencies +@chapter CRIS Dependent Features +@end ifclear + +@cindex CRIS support +@menu +* CRIS-Opts:: Command-line Options +* CRIS-Expand:: Instruction expansion +* CRIS-Syntax:: Syntax +@end menu + +@node CRIS-Opts +@section Command-line Options + +@cindex options, CRIS +@cindex CRIS options +The CRIS version of @code{@value{AS}} has these +machine-dependent command-line options. + +@cindex @option{--emulation=criself} command line option, CRIS +@cindex @option{--emulation=crisaout} command line option, CRIS +@cindex CRIS @option{--emulation=criself} command line option +@cindex CRIS @option{--emulation=crisaout} command line option + +The format of the generated object files can be either ELF or +a.out, specified by the command-line options +@option{--emulation=crisaout} and @option{--emulation=criself}. +The default is ELF (criself), unless @code{@value{AS}} has been +configured specifically for a.out by using the configuration +name @code{cris-axis-aout}. + +@cindex @option{--underscore} command line option, CRIS +@cindex @option{--no-underscore} command line option, CRIS +@cindex CRIS @option{--underscore} command line option +@cindex CRIS @option{--no-underscore} command line option +There are two different link-incompatible ELF object file +variants for CRIS, for use in environments where symbols are +expected to be prefixed by a leading @samp{_} character and for +environments without such a symbol prefix. The variant used for +GNU/Linux port has no symbol prefix. Which variant to produce +is specified by either of the options @option{--underscore} and +@option{--no-underscore}. The default is @option{--underscore}. +Since symbols in CRIS a.out objects are expected to have a +@samp{_} prefix, specifying @option{--no-underscore} when +generating a.out objects is an error. Besides the object format +difference, the effect of this option is to parse register names +differently (@pxref{crisnous}). The @option{--no-underscore} +option makes a @samp{$} register prefix mandatory. + +@cindex @option{--pic} command line option, CRIS +@cindex CRIS @option{--pic} command line option +@cindex Position-independent code, CRIS +@cindex CRIS position-independent code +The option @option{--pic} must be passed to @code{@value{AS}} in +order to recognize the symbol syntax used for ELF (SVR4 PIC) +position-independent-code (@pxref{crispic}). This will also +affect expansion of instructions. The expansion with +@option{--pic} will use PC-relative rather than (slightly +faster) absolute addresses in those expansions. + +@cindex @option{-N} command line option, CRIS +@cindex CRIS @option{-N} command line option +When @option{-N} is specified, @code{@value{AS}} will emit a +warning when a 16-bit branch instruction is expanded into a +32-bit multiple-instruction construct (@pxref{CRIS-Expand}). + +@node CRIS-Expand +@section Instruction expansion + +@cindex instruction expansion, CRIS +@cindex CRIS instruction expansion +@code{@value{AS}} will silently choose an instruction that fits +the operand size for @samp{[register+constant]} operands. For +example, the offset @code{127} in @code{move.d [r3+127],r4} fits +in an instruction using a signed-byte offset. Similarly, +@code{move.d [r2+32767],r1} will generate an instruction using a +16-bit offset. For symbolic expressions and constants that do +not fit in 16 bits including the sign bit, a 32-bit offset is +generated. + +For branches, @code{@value{AS}} will expand from a 16-bit branch +instruction into a sequence of instructions that can reach a +full 32-bit address. Since this does not correspond to a single +instruction, such expansions can optionally be warned about. +@xref{CRIS-Opts}. + +@node CRIS-Syntax +@section Syntax + +There are different aspects of the CRIS assembly syntax. + +@menu +* CRIS-Chars:: Special Characters +* CRIS-Pic:: Position-Independent Code Symbols +* CRIS-Regs:: Register Names +* CRIS-Pseudos:: Assembler Directives +@end menu + +@node CRIS-Chars +@subsection Special Characters +@cindex line comment characters, CRIS +@cindex CRIS line comment characters + +The character @samp{#} is a line comment character. It starts a +comment if and only if it is placed at the beginning of a line. + +A @samp{;} character starts a comment anywhere on the line, +causing all characters up to the end of the line to be ignored. + +A @samp{@@} character is handled as a line separator equivalent +to a logical new-line character (except in a comment), so +separate instructions can be specified on a single line. + +@node CRIS-Pic +@subsection Symbols in position-independent code +@cindex Symbols in position-independent code, CRIS +@cindex CRIS symbols in position-independent code +@cindex Position-independent code, symbols in, CRIS + +When generating @anchor{crispic}position-independent code (SVR4 +PIC) for use in cris-axis-linux-gnu shared libraries, symbol +suffixes are used to specify what kind of run-time symbol lookup +will be used, expressed in the object as different +@emph{relocation types}. Usually, all absolute symbol values +must be located in a table, the @emph{global offset table}, +leaving the code position-independent; independent of values of +global symbols and independent of the address of the code. The +suffix modifies the value of the symbol, into for example an +index into the global offset table where the real symbol value +is entered, or a PC-relative value, or a value relative to the +start of the global offset table. All symbol suffixes start +with the character @samp{:} (omitted in the list below). Every +symbol use in code or a read-only section must therefore have a +PIC suffix to enable a useful shared library to be created. +Usually, these constructs must not be used with an additive +constant offset as is usually allowed, i.e.@: no 4 as in +@code{symbol + 4} is allowed. This restriction is checked at +link-time, not at assembly-time. + +@table @code +@item GOT + +Attaching this suffix to a symbol in an instruction causes the +symbol to be entered into the global offset table. The value is +a 32-bit index for that symbol into the global offset table. +The name of the corresponding relocation is +@samp{R_CRIS_32_GOT}. Example: @code{move.d +[$r0+extsym:GOT],$r9} + +@item GOT16 + +Same as for @samp{GOT}, but the value is a 16-bit index into the +global offset table. The corresponding relocation is +@samp{R_CRIS_16_GOT}. Example: @code{move.d +[$r0+asymbol:GOT16],$r10} + +@item PLT + +This suffix is used for function symbols. It causes a +@emph{procedure linkage table}, an array of code stubs, to be +created at the time the shared object is created or linked +against, together with a global offset table entry. The value +is a pc-relative offset to the corresponding stub code in the +procedure linkage table. This arrangement causes the run-time +symbol resolver to be called to look up and set the value of the +symbol the first time the function is called (at latest; +depending environment variables). It is only safe to leave the +symbol unresolved this way if all references are function calls. +The name of the relocation is @samp{R_CRIS_32_PLT_PCREL}. +Example: @code{add.d fnname:PLT,$pc} + +@item PLTG + +Like PLT, but the value is relative to the beginning of the +global offset table. The relocation is +@samp{R_CRIS_32_PLT_GOTREL}. Example: @code{move.d +fnname:PLTG,$r3} + +@item GOTPLT + +Similar to @samp{PLT}, but the value of the symbol is a 32-bit +index into the global offset table. This is somewhat of a mix +between the effect of the @samp{GOT} and the @samp{PLT} suffix; +the difference to @samp{GOT} is that there will be a procedure +linkage table entry created, and that the symbol is assumed to +be a function entry and will be resolved by the run-time +resolver as with @samp{PLT}. The relocation is +@samp{R_CRIS_32_GOTPLT}. Example: @code{jsr +[$r0+fnname:GOTPLT]} + +@item GOTPLT16 + +A variant of @samp{GOTPLT} giving a 16-bit value. Its +relocation name is @samp{R_CRIS_16_GOTPLT}. Example: @code{jsr +[$r0+fnname:GOTPLT16]} + +@item GOTOFF + +This suffix must only be attached to a local symbol, but may be +used in an expression adding an offset. The value is the +address of the symbol relative to the start of the global offset +table. The relocation name is @samp{R_CRIS_32_GOTREL}. +Example: @code{move.d [$r0+localsym:GOTOFF],r3} +@end table + +@node CRIS-Regs +@subsection Register names +@cindex register names, CRIS +@cindex CRIS register names + +A @samp{$} character may always prefix a general or special +register name in an instruction operand but is mandatory when +the option @option{--no-underscore} is specified or when the +@code{.syntax register_prefix} directive is in effect +(@pxref{crisnous}). Register names are case-insensitive. + +@node CRIS-Pseudos +@subsection Assembler Directives +@cindex assembler directives, CRIS +@cindex pseudo-ops, CRIS +@cindex CRIS assembler directives +@cindex CRIS pseudo-ops + +There are a few CRIS-specific pseudo-directives in addition to +the generic ones. @xref{Pseudo Ops}. Constants emitted by +pseudo-directives are in little-endian order for CRIS. There is +no support for floating-point-specific directives for CRIS. + +@table @code +@item .dword EXPRESSIONS +@cindex assembler directive .dword, CRIS +@cindex pseudo-op .dword, CRIS +@cindex CRIS assembler directive .dword +@cindex CRIS pseudo-op .dword + +The @code{.dword} directive is a synonym for @code{.int}, +expecting zero or more EXPRESSIONS, separated by commas. For +each expression, a 32-bit little-endian constant is emitted. + +@item .syntax ARGUMENT +@cindex assembler directive .syntax, CRIS +@cindex pseudo-op .syntax, CRIS +@cindex CRIS assembler directive .syntax +@cindex CRIS pseudo-op .syntax +The @code{.syntax} directive takes as ARGUMENT one of the +following case-sensitive choices. + +@table @code +@item no_register_prefix + +The @code{.syntax no_register_prefix} @anchor{crisnous}directive +makes a @samp{$} character prefix on all registers optional. It +overrides a previous setting, including the corresponding effect +of the option @option{--no-underscore}. If this directive is +used when ordinary symbols do not have a @samp{_} character +prefix, care must be taken to avoid ambiguities whether an +operand is a register or a symbol; using symbols with names the +same as general or special registers then invoke undefined +behavior. + +@item register_prefix + +This directive makes a @samp{$} character prefix on all +registers mandatory. It overrides a previous setting, including +the corresponding effect of the option @option{--underscore}. + +@item leading_underscore + +This is an assertion directive, emitting an error if the +@option{--no-underscore} option is in effect. + +@item no_leading_underscore + +This is the opposite of the @code{.syntax leading_underscore} +directive and emits an error if the option @option{--underscore} +is in effect. +@end table + +@c If you compare with md_pseudo_table, you see that we don't +@c document ".file" and ".loc" here. This is because we're just +@c wrapping the corresponding ELF function and emitting an error for +@c a.out. +@end table diff -uprN binutils-2.11.93.0.2/gas/doc/c-ia64.texi binutils-2.12.90.0.1/gas/doc/c-ia64.texi --- binutils-2.11.93.0.2/gas/doc/c-ia64.texi Wed Dec 31 16:00:00 1969 +++ binutils-2.12.90.0.1/gas/doc/c-ia64.texi Thu Mar 7 11:52:37 2002 @@ -0,0 +1,157 @@ +@c Copyright 2002 +@c Free Software Foundation, Inc. +@c Contributed by David Mosberger-Tang +@c This is part of the GAS manual. +@c For copying conditions, see the file as.texinfo. + +@ifset GENERIC +@page +@node IA-64-Dependent +@chapter IA-64 Dependent Features +@end ifset + +@ifclear GENERIC +@node Machine Dependencies +@chapter IA-64 Dependent Features +@end ifclear + +@cindex IA-64 support +@menu +* IA-64 Options:: Options +* IA-64 Syntax:: Syntax +@c * IA-64 Floating Point:: Floating Point // to be written +@c * IA-64 Directives:: IA-64 Machine Directives // to be written +* IA-64 Opcodes:: Opcodes +@end menu + +@node IA-64 Options +@section Options +@cindex IA-64 options +@cindex options for IA-64 + +@table @option +@cindex @code{-mconstant-gp} command line option, IA-64 + +@item -mconstant-gp +This option instructs the assembler to mark the resulting object file +as using the ``constant GP'' model. With this model, it is assumed +that the entire program uses a single global pointer (GP) value. Note +that this option does not in any fashion affect the machine code +emitted by the assembler. All it does is turn on the EF_IA_64_CONS_GP +flag in the ELF file header. + +@item -mauto-pic +This option instructs the assembler to mark the resulting object file +as using the ``constant GP without function descriptor'' data model. +This model is like the ``constant GP'' model, except that it +additionaly does away with function descriptors. What this means is +that the address of a function refers directly to the function's code +entry-point. Normally, such an address would refer to a function +descriptor, which contains both the code entry-point and the GP-value +needed by the function. Note that this option does not in any fashion +affect the machine code emitted by the assembler. All it does is +turn on the EF_IA_64_NOFUNCDESC_CONS_GP flag in the ELF file header. + +@item -milp32 +@item -milp64 +@item -mlp64 +@item -mp64 +These options select the data model. The assembler defaults to @code{-mlp64} +(LP64 data model). + +@item -mle +@item -mbe +These options select the byte order. The @code{-mle} option selects little-endian +byte order (default) and @code{-mbe} selects big-endian byte order. Note that +IA-64 machine code always uses little-endian byte order. + +@item -x +@item -xexplicit +These options turn on dependency violation checking. This checking is turned on by +default. + +@item -xauto +This option instructs the assembler to automatically insert stop bits where necessary +to remove dependency violations. + +@item -xdebug +This turns on debug output intended to help tracking down bugs in the dependency +violation checker. + +@end table + +@cindex IA-64 Syntax +@node IA-64 Syntax +@section Syntax +The assembler syntax closely follows the IA-64 Assembly Language +Reference Guide. + +@menu +* IA-64-Chars:: Special Characters +* IA-64-Regs:: Register Names +* IA-64-Bits:: Bit Names +* IA-64-Relocs:: Relocations +@end menu + +@node IA-64-Chars +@subsection Special Characters + +@cindex line comment character, IA-64 +@cindex IA-64 line comment character +@samp{//} is the line comment token. + +@cindex line separator, IA-64 +@cindex statement separator, IA-64 +@cindex IA-64 line separator +@samp{;} can be used instead of a newline to separate statements. + +@node IA-64-Regs +@subsection Register Names +@cindex IA-64 registers +@cindex register names, IA-64 + +The 128 integer registers are refered to as @samp{r@var{n}}. +The 128 floating-point registers are refered to as @samp{f@var{n}}. +The 128 application registers are refered to as @samp{ar@var{n}}. +The 128 control registers are refered to as @samp{cr@var{n}}. +The 64 one-bit predicate registers are refered to as @samp{p@var{n}}. +The 8 branch registers are refered to as @samp{b@var{n}}. +In addition, the assembler defines a number of aliases: +@samp{gp} (@samp{r1}), @samp{sp} (@samp{r12}), @samp{rp} (@samp{b0}), +@samp{ret0} (@samp{r8}), @samp{ret1} (@samp{r9}), @samp{ret2} (@samp{r10}), +@samp{ret3} (@samp{r9}), @samp{farg@var{n}} (@samp{f8+@var{n}}), and +@samp{fret@var{n}} (@samp{f8+@var{n}}). + +For convenience, the assembler also defines aliases for all named application +and control registers. For example, @samp{ar.bsp} refers to the register +backing store pointer (@samp{ar17}). Similarly, @samp{cr.eoi} refers to +the end-of-interrupt register (@samp{cr67}). + +@node IA-64-Bits +@subsection IA-64 Processor-Status-Register (PSR) Bit Names +@cindex IA-64 Processor-status-Register bit names +@cindex PSR bits +@cindex bit names, IA-64 + +The assembler defines bit masks for each of the bits in the IA-64 +processor status register. For example, @samp{psr.ic} corresponds to +a value of 0x2000. These masks are primarily intended for use with +the @sample{ssm}/@sample{sum} and @sample{rsm}/@sample{rum} +instructions, but they can be used anywhere else where an integer +constant is expected. + +@node IA-64 Opcodes +@section Opcodes +For detailed information on the IA-64 machine instruction set, see the +@c Attempt to work around a very overfull hbox. +@iftex +IA-64 Assembly Language Reference Guide available at +@smallfonts +@example +http://developer.intel.com/design/itanium/arch_spec.htm +@end example +@textfonts +@end iftex +@ifnottex +@uref{http://developer.intel.com/design/itanium/arch_spec.htm,IA-64 Architecture Handbook}. +@end ifnottex diff -uprN binutils-2.11.93.0.2/gas/doc/c-ppc.texi binutils-2.12.90.0.1/gas/doc/c-ppc.texi --- binutils-2.11.93.0.2/gas/doc/c-ppc.texi Mon Oct 15 21:27:23 2001 +++ binutils-2.12.90.0.1/gas/doc/c-ppc.texi Thu Mar 7 11:52:37 2002 @@ -1,4 +1,4 @@ -@c Copyright 2001 +@c Copyright 2001, 2002 @c Free Software Foundation, Inc. @c This is part of the GAS manual. @c For copying conditions, see the file as.texinfo. @@ -34,31 +34,40 @@ The following table lists all available @table @code @item -mpwrx | -mpwr2 -Generate code for IBM POWER/2 (RIOS2). +Generate code for POWER/2 (RIOS2). @item -mpwr -Generate code for IBM POWER (RIOS1) +Generate code for POWER (RIOS1) @item -m601 -Generate code for Motorola PowerPC 601. +Generate code for PowerPC 601. @item -mppc, -mppc32, -m603, -m604 -Generate code for Motorola PowerPC 603/604. +Generate code for PowerPC 603/604. @item -m403, -m405 -Generate code for Motorola PowerPC 403/405. +Generate code for PowerPC 403/405. + +@item -m7400, -m7410, -m7450, -m7455 +Generate code for PowerPC 7400/7410/7450/7455. @item -mppc64, -m620 -Generate code for Motorola PowerPC 620. +Generate code for PowerPC 620/625/630. @item -mppc64bridge Generate code for PowerPC 64, including bridge insns. @item -mbooke64 -Generate code for 64-bit Motorola BookE. +Generate code for 64-bit BookE. @item -mbooke, mbooke32 -Generate code for 32-bit Motorola BookE. +Generate code for 32-bit BookE. + +@item -maltivec +Generate code for processors with AltiVec instructions. + +@item -mpower4 +Generate code for Power4 architecture. @item -mcom Generate code Power/PowerPC common instructions. diff -uprN binutils-2.11.93.0.2/gas/doc/c-sh64.texi binutils-2.12.90.0.1/gas/doc/c-sh64.texi --- binutils-2.11.93.0.2/gas/doc/c-sh64.texi Wed Dec 31 16:00:00 1969 +++ binutils-2.12.90.0.1/gas/doc/c-sh64.texi Thu Mar 7 11:52:37 2002 @@ -0,0 +1,207 @@ +@c Copyright (C) 2001, 2002 Free Software Foundation, Inc. +@c This is part of the GAS manual. +@c For copying conditions, see the file as.texinfo. +@page +@node SH64-Dependent +@chapter Hitachi SH64 Dependent Features + +@cindex SH64 support +@menu +* SH64 Options:: Options +* SH64 Syntax:: Syntax +* SH64 Directives:: SH64 Machine Directives +* SH64 Opcodes:: Opcodes +@end menu + +@node SH64 Options +@section Options + +@cindex SH64 options +@cindex options, SH64 +@table @code + +@cindex SH64 ISA options +@cindex ISA options, SH64 +@item -isa=shmedia | -isa=shcompact +Specify the default instruction set. @code{SHmedia} specifies the +32-bit opcodes, and @code{SHcompact} specifies the 16-bit opcodes +compatible with previous SH families. The default depends on the ABI +selected; the default for the 64-bit ABI is SHmedia, and the default for +the 32-bit ABI is SHcompact. If neither the ABI nor the ISA is +specified, the default is 32-bit SHcompact. + +Note that the @code{.mode} pseudo-op is not permitted if the ISA is not +specified on the command line. + +@cindex SH64 ABI options +@cindex ABI options, SH64 +@item -abi=32 | -abi=64 +Specify the default ABI. If the ISA is specified and the ABI is not, +the default ABI depends on the ISA, with SHmedia defaulting to 64-bit +and SHcompact defaulting to 32-bit. + +Note that the @code{.abi} pseudo-op is not permitted if the ABI is not +specified on the command line. When the ABI is specified on the command +line, any @code{.abi} pseudo-ops in the source must match it. + +@item -shcompact-const-crange +Emit code-range descriptors for constants in SHcompact code sections. + +@item -no-mix +Disallow SHmedia code in the same section as constants and SHcompact +code. + +@item -no-expand +Do not expand MOVI, PT, PTA or PTB instructions. + +@item -expand-pt32 +With -abi=64, expand PT, PTA and PTB instructions to 32 bits only. + +@end table + +@node SH64 Syntax +@section Syntax + +@menu +* SH64-Chars:: Special Characters +* SH64-Regs:: Register Names +* SH64-Addressing:: Addressing Modes +@end menu + +@node SH64-Chars +@subsection Special Characters + +@cindex line comment character, SH64 +@cindex SH64 line comment character +@samp{!} is the line comment character. + +@cindex line separator, SH64 +@cindex statement separator, SH64 +@cindex SH64 line separator +You can use @samp{;} instead of a newline to separate statements. + +@cindex symbol names, @samp{$} in +@cindex @code{$} in symbol names +Since @samp{$} has no special meaning, you may use it in symbol names. + +@node SH64-Regs +@subsection Register Names + +@cindex SH64 registers +@cindex registers, SH64 +You can use the predefined symbols @samp{r0} through @samp{r63} to refer +to the SH64 general registers, @samp{cr0} through @code{cr63} for +control registers, @samp{tr0} through @samp{tr7} for target address +registers, @samp{fr0} through @samp{fr63} for single-precision floating +point registers, @samp{dr0} through @samp{dr62} (even numbered registers +only) for double-precision floating point registers, @samp{fv0} through +@samp{fv60} (multiples of four only) for single-precision floating point +vectors, @samp{fp0} through @samp{fp62} (even numbered registers only) +for single-precision floating point pairs, @samp{mtrx0} through +@samp{mtrx48} (multiples of 16 only) for 4x4 matrices of +single-precision floating point registers, @samp{pc} for the program +counter, and @samp{fpscr} for the floating point status and control +register. + +You can also refer to the control registers by the mnemonics @samp{sr}, +@samp{ssr}, @samp{pssr}, @samp{intevt}, @samp{expevt}, @samp{pexpevt}, +@samp{tra}, @samp{spc}, @samp{pspc}, @samp{resvec}, @samp{vbr}, +@samp{tea}, @samp{dcr}, @samp{kcr0}, @samp{kcr1}, @samp{ctc}, and +@samp{usr}. + +@node SH64-Addressing +@subsection Addressing Modes + +@cindex addressing modes, SH64 +@cindex SH64 addressing modes + +SH64 operands consist of either a register or immediate value. The +immediate value can be a constant or label reference (or portion of a +label reference), as in this example: + +@example + movi 4,r2 + pt function, tr4 + movi (function >> 16) & 65535,r0 + shori function & 65535, r0 + ld.l r0,4,r0 +@end example + +@cindex datalabel, SH64 +Instruction label references can reference labels in either SHmedia or +SHcompact. To differentiate between the two, labels in SHmedia sections +will always have the least significant bit set (i.e. they will be odd), +which SHcompact labels will have the least significant bit reset +(i.e. they will be even). If you need to reference the actual address +of a label, you can use the @code{datalabel} modifier, as in this +example: + +@example + .long function + .long datalabel function +@end example + +In that example, the first longword may or may not have the least +significant bit set depending on whether the label is an SHmedia label +or an SHcompact label. The second longword will be the actual address +of the label, regardless of what type of lable it is. + +@node SH64 Directives +@section SH64 Machine Directives + +In addition to the SH directives, the SH64 provides the following +directives: + +@cindex SH64 machine directives +@cindex machine directives, SH64 + +@table @code + +@item .mode [shmedia|shcompact] +@itemx .isa [shmedia|shcompact] +Specify the ISA for the following instructions (the two directives are +equivalent). Note that programs such as @code{objdump} rely on symbolic +labels to determine when such mode switches occur (by checking the least +significant bit of the label's address), so such mode/isa changes should +always be followed by a label (in practice, this is true anyway). Note +that you cannot use these directives if you didn't specify an ISA on the +command line. + +@item .abi [32|64] +Specify the ABI for the following instructions. Note that you cannot use +this directive unless you specified an ABI on the command line, and the +ABIs specified must match. + +@item .uaquad +Like .uaword and .ualong, this allows you to specify an intenionally +unaligned quadword (64 bit word). + +@end table + +@node SH64 Opcodes +@section Opcodes + +@cindex SH64 opcode summary +@cindex opcode summary, SH64 +@cindex mnemonics, SH64 +@cindex instruction summary, SH64 +For detailed information on the SH64 machine instruction set, see +@cite{SuperH 64 bit RISC Series Architecture Manual} (SuperH, Inc.). + +@code{@value{AS}} implements all the standard SH64 opcodes. In +addition, the following pseudo-opcodes may be expanded into one or more +alternate opcodes: + +@table @code + +@item movi +If the value doesn't fit into a standard @code{movi} opcode, +@code{@value{AS}} will replace the @code{movi} with a sequence of +@code{movi} and @code{shori} opcodes. + +@item pt +This expands to a sequence of @code{movi} and @code{shori} opcode, +followed by a @code{ptrel} opcode, or to a @code{pta} or @code{ptb} +opcode, depending on the label referenced. + +@end table diff -uprN binutils-2.11.93.0.2/gas/doc/gasp.texi binutils-2.12.90.0.1/gas/doc/gasp.texi --- binutils-2.11.93.0.2/gas/doc/gasp.texi Fri Mar 9 11:17:15 2001 +++ binutils-2.12.90.0.1/gas/doc/gasp.texi Thu Mar 7 11:52:37 2002 @@ -3,7 +3,7 @@ @c @c This file documents the assembly preprocessor "GASP" @c -@c Copyright 1994, 1995, 2000 Free Software Foundation, Inc. +@c Copyright 1994, 1995, 2000, 2002 Free Software Foundation, Inc. @c @c Permission is granted to copy, distribute and/or modify this document @c under the terms of the GNU Free Documentation License, Version 1.1 @@ -41,7 +41,7 @@ END-INFO-DIR-ENTRY @end tex @vskip 0pt plus 1filll -Copyright @copyright{} 1994, 1995, 2000 Free Software Foundation, Inc. +Copyright @copyright{} 1994, 1995, 2000, 2002 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 @@ -53,7 +53,7 @@ Copyright @copyright{} 1994, 1995, 2000 @end titlepage @ifinfo -Copyright @copyright{} 1994, 1995, 2000 Free Software Foundation, Inc. +Copyright @copyright{} 1994, 1995, 2000, 2002 Free Software Foundation, Inc. @ignore Permission is granted to process this file through TeX and print the @@ -108,6 +108,11 @@ flexibility: you can use it with hand-co penalty of added complexity in the assembler you use for compiler output. +@emph{Note} The use of @sc{gasp} has now been deprecated. Anything +that it could do can now be done by the macro facilities built into +@sc{gas} itself. At some point in the future the @{gasp} sources will +be removed entirely from the binutils distribution. + Here is a small example to give the flavor of @sc{gasp}. This input to @sc{gasp} @@ -943,6 +948,11 @@ character matches those you can specify base 2, @samp{Q} for base 8, @samp{D} for base 10, and @samp{H} for base 16. (You can write this character in lower case if you prefer.) +You can write floating point constants using the same syntax recognised +by GAS @ref{Flonums,,Flonums,as,The GNU Assembler.}. A constraint is +that these constants will be interpreted as decimal values irrespective +of the currently selected base. + @c FIXME! What are rules for recognizing number in deflt base? Whatever @c is left over after parsing other things?? diff -uprN binutils-2.11.93.0.2/gas/gasp.c binutils-2.12.90.0.1/gas/gasp.c --- binutils-2.11.93.0.2/gas/gasp.c Sun Feb 3 11:22:31 2002 +++ binutils-2.12.90.0.1/gas/gasp.c Thu Mar 7 11:52:37 2002 @@ -48,6 +48,7 @@ suitable for gas to consume. #include "config.h" #include "bin-bugs.h" +#include #include #include #include @@ -66,6 +67,7 @@ extern char *malloc (); #include "sb.h" #include "macro.h" #include "asintl.h" +#include "xregex.h" char *program_version = "1.2"; @@ -227,6 +229,8 @@ static void hash_add_to_string_table PAR static void hash_add_to_int_table PARAMS ((hash_table *, sb *, int)); static hash_entry *hash_lookup PARAMS ((hash_table *, sb *)); static void checkconst PARAMS ((int, exp_t *)); +static int is_flonum PARAMS ((int, sb *)); +static int chew_flonum PARAMS ((int, sb *, sb *)); static int sb_strtol PARAMS ((int, sb *, int, int *)); static int level_0 PARAMS ((int, sb *, exp_t *)); static int level_1 PARAMS ((int, sb *, exp_t *)); @@ -522,6 +526,62 @@ checkconst (op, term) } } +/* Chew the flonum from the string starting at idx. Adjust idx to + point to the next character after the flonum. */ + +static int +chew_flonum (idx, string, out) + int idx; + sb *string; + sb *out; +{ + sb buf; + regex_t reg; + regmatch_t match; + + /* Duplicate and null terminate `string'. */ + sb_new (&buf); + sb_add_sb (&buf, string); + sb_add_char (&buf, '\0'); + + if (regcomp (®, "([0-9]*\\.[0-9]+([eE][+-]?[0-9]+)?)", REG_EXTENDED) != 0) + return idx; + if (regexec (®, &buf.ptr[idx], 1, &match, 0) != 0) + return idx; + + /* Copy the match to the output. */ + assert (match.rm_eo >= match.rm_so); + sb_add_buffer (out, &buf.ptr[idx], match.rm_eo - match.rm_so); + + sb_kill (&buf); + regfree (®); + idx += match.rm_eo; + return idx; +} + +static int +is_flonum (idx, string) + int idx; + sb *string; +{ + sb buf; + regex_t reg; + int rc; + + /* Duplicate and null terminate `string'. */ + sb_new (&buf); + sb_add_sb (&buf, string); + sb_add_char (&buf, '\0'); + + if (regcomp (®, "^[0-9]*\\.[0-9]+([eE][+-]?[0-9]+)?", REG_EXTENDED) != 0) + return 0; + + rc = regexec (®, &buf.ptr[idx], 0, NULL, 0); + sb_kill (&buf); + regfree (®); + return (rc == 0); +} + /* Turn the number in string at idx into a number of base, fill in ptr, and return the index of the first character not in the number. */ @@ -1132,6 +1192,10 @@ change_base (idx, in, out) idx++; } } + else if (is_flonum (idx, in)) + { + idx = chew_flonum (idx, in, out); + } else if (ISDIGIT (in->ptr[idx])) { int value; diff -uprN binutils-2.11.93.0.2/gas/po/POTFILES.in binutils-2.12.90.0.1/gas/po/POTFILES.in --- binutils-2.11.93.0.2/gas/po/POTFILES.in Sun Feb 3 11:22:32 2002 +++ binutils-2.12.90.0.1/gas/po/POTFILES.in Thu Mar 7 11:52:37 2002 @@ -108,6 +108,8 @@ config/tc-s390.c config/tc-s390.h config/tc-sh.c config/tc-sh.h +config/tc-sh64.c +config/tc-sh64.h config/tc-sparc.c config/tc-sparc.h config/tc-tahoe.c diff -uprN binutils-2.11.93.0.2/gas/po/es.po binutils-2.12.90.0.1/gas/po/es.po --- binutils-2.11.93.0.2/gas/po/es.po Wed Dec 31 16:00:00 1969 +++ binutils-2.12.90.0.1/gas/po/es.po Thu Mar 7 11:52:37 2002 @@ -0,0 +1,10236 @@ +# Mensajes en español para gas-2.12-pre020121. +# Copyright (C) 2002 Free Software Foundation, Inc. +# Cristian Othón Martíne Vera , 2002. +# +msgid "" +msgstr "" +"Project-Id-Version: gas 2.12-pre020121\n" +"POT-Creation-Date: 2002-01-17 12:56+0000\n" +"PO-Revision-Date: 2002-02-25 11:04-0600\n" +"Last-Translator: Cristian Othón Martínez Vera \n" +"Language-Team: Spanish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8-bit\n" + +#: app.c:476 app.c:490 +msgid "end of file in comment" +msgstr "fin de fichero en el comentario" + +#: app.c:569 +msgid "end of file in string; inserted '\"'" +msgstr "fin de fichero en la cadena; se insertó '\"'" + +#: app.c:635 +#, c-format +msgid "unknown escape '\\%c' in string; ignored" +msgstr "escape '\\%c' desconocido en la cadena; se ignora" + +#: app.c:644 +msgid "end of file in string; '\"' inserted" +msgstr "fin de fichero en la cadena; se insertó '\"'" + +#: app.c:764 +msgid "end of file not at end of a line; newline inserted" +msgstr "el fin de fichero no está al final de una línea: se insertó línea nueva" + +#: app.c:923 +msgid "end of file in multiline comment" +msgstr "fin de fichero en comentario multilíneas" + +#: app.c:987 +msgid "end of file after a one-character quote; \\0 inserted" +msgstr "fin de fichero después de una comilla de un carácter; se insertó \\0" + +#: app.c:995 +msgid "end of file in escape character" +msgstr "fin de fichero en carácter de escape" + +#: app.c:1007 +msgid "missing close quote; (assumed)" +msgstr "falta la comilla que cierra; (se asume)" + +#: app.c:1075 app.c:1129 app.c:1139 app.c:1204 +msgid "end of file in comment; newline inserted" +msgstr "fin de fichero en comentario; se insertó una línea nueva" + +#: as.c:148 +msgid "missing emulation mode name" +msgstr "falta el nombre del modo de emulación" + +#: as.c:163 +#, c-format +msgid "unrecognized emulation name `%s'" +msgstr "nombre de emulación `%s' no reconocido" + +#: as.c:210 +#, c-format +msgid "GNU assembler version %s (%s) using BFD version %s" +msgstr "GNU ensamblador versión %s (%s) utilizando BFD versión %s" + +#: as.c:213 +#, c-format +msgid "GNU assembler version %s (%s)" +msgstr "GNU ensamblador versión %s (%s)" + +#: as.c:222 +#, c-format +msgid "Usage: %s [option...] [asmfile...]\n" +msgstr "Modo de empleo: %s [opción...] [ficheroasm...]\n" + +#: as.c:224 +msgid "" +"Options:\n" +" -a[sub-option...]\t turn on listings\n" +" \t Sub-options [default hls]:\n" +" \t c omit false conditionals\n" +" \t d omit debugging directives\n" +" \t h include high-level source\n" +" \t l include assembly\n" +" \t m include macro expansions\n" +" \t n omit forms processing\n" +" \t s include symbols\n" +" \t =FILE list to FILE (must be last sub-option)\n" +msgstr "" +"Opciones:\n" +" -a[sub-opción...]\t activa listados\n" +" \t Sub-opciones [por omisión hls]:\n" +" \t c omite condicionales falsos\n" +" \t d omite directivas de depuración\n" +" \t h incluye código de alto nivel\n" +" \t l incluye ensamblador\n" +" \t m incluye expansiones de macros\n" +" \t n omite el procesamiento de formas\n" +" \t s incluye símbolos\n" +" \t =FICH listar a FICHero (debe ser la última sub-opción)\n" + +#: as.c:237 +msgid " -D produce assembler debugging messages\n" +msgstr " -D produce mensajes de depuración de ensamblador\n" + +#: as.c:239 +msgid " --defsym SYM=VAL define symbol SYM to given value\n" +msgstr " --defsym SIM=VAL define el símbolo SIM al valor dado\n" + +#: as.c:255 +#, c-format +msgid " emulate output (default %s)\n" +msgstr " emula la salida (por omisión %s)\n" + +#: as.c:259 +msgid " -f skip whitespace and comment preprocessing\n" +msgstr " -f salta espacios en blanco y comentarios de preprocesamiento\n" + +#: as.c:261 +msgid " --gstabs generate stabs debugging information\n" +msgstr " --gstabs genera información de depuración de cabos\n" + +#: as.c:263 +msgid " --gdwarf2 generate DWARF2 debugging information\n" +msgstr " --gdwarf2 genera información de depuración DWARF2\n" + +#: as.c:265 +msgid " --help show this message and exit\n" +msgstr " --help muestra este mensaje y termina\n" + +#: as.c:267 +msgid " --target-help show target specific options\n" +msgstr " --target-help muestra las opciones específicas del objetivo\n" + +#: as.c:269 +msgid " -I DIR add DIR to search list for .include directives\n" +msgstr " -I DIR agrega DIR a la lista de búsqueda para directivas .include\n" + +#: as.c:271 +msgid " -J don't warn about signed overflow\n" +msgstr " -J no avisa sobre desbordamiento con signo\n" + +#: as.c:273 +msgid " -K warn when differences altered for long displacements\n" +msgstr " -K avisa cuando hay diferencias alteradas por desubicaciones largas\n" + +#: as.c:275 +msgid " -L,--keep-locals keep local symbols (e.g. starting with `L')\n" +msgstr " -L,--keep-locals conserva los símbolos locales (p.e. inician con `L')\n" + +#: as.c:277 +msgid " -M,--mri assemble in MRI compatibility mode\n" +msgstr " -M,--mri ensambla en modo de compatibilidad MRI\n" + +#: as.c:279 +msgid " --MD FILE write dependency information in FILE (default none)\n" +msgstr " --MD FICHERO escribe la información de dependencias en el FICHERO (por omisión ninguno)\n" + +#: as.c:281 +msgid " -nocpp ignored\n" +msgstr " -nocpp ignorado\n" + +#: as.c:283 +msgid " -o OBJFILE name the object-file output OBJFILE (default a.out)\n" +msgstr " -o FICHOBJ nombra la salida del objeto fichero FICHOBJ (por omisión a.out)\n" + +#: as.c:285 +msgid " -R fold data section into text section\n" +msgstr " -R pliega la sección de datos en la sección de texto\n" + +#: as.c:287 +msgid " --statistics print various measured statistics from execution\n" +msgstr " --statistics muestra varias estadísticas medidas de la ejecución\n" + +#: as.c:289 +msgid " --strip-local-absolute strip local absolute symbols\n" +msgstr " --strip-local-absolute remueve los símbolos locales absolutos\n" + +#: as.c:291 +msgid " --traditional-format Use same format as native assembler when possible\n" +msgstr " --traditional-format Usa el mismo formato que el ensamblador nativo en lo posible\n" + +#: as.c:293 +msgid " --version print assembler version number and exit\n" +msgstr " --version muestra el número de versión del ensamblador y termina\n" + +#: as.c:295 +msgid " -W --no-warn suppress warnings\n" +msgstr " -W --no-warn suprime los avisos\n" + +#: as.c:297 +msgid " --warn don't suppress warnings\n" +msgstr " --warn no suprime los avisos\n" + +#: as.c:299 +msgid " --fatal-warnings treat warnings as errors\n" +msgstr " --fatal-warnings trata los avisos como errores\n" + +#: as.c:301 +msgid "" +" --itbl INSTTBL extend instruction set to include instructions\n" +" matching the specifications defined in file INSTTBL\n" +msgstr "" +" --itbl INSTTBL extiende el conjunto de instrucciones para incluir\n" +" instrucciones que coincidan con las especificaciones\n" +" definidas en el fichero INSTTBL\n" + +#: as.c:304 +msgid " -w ignored\n" +msgstr " -w ignorado\n" + +#: as.c:306 +msgid " -X ignored\n" +msgstr " -X ignorado\n" + +#: as.c:308 +msgid " -Z generate object file even after errors\n" +msgstr " -Z genera el fichero objeto aún después de errores\n" + +#: as.c:310 +msgid "" +" --listing-lhs-width set the width in words of the output data column of\n" +" the listing\n" +msgstr "" +" --listing-lhs-width establece la anchura en palabras de la columna de\n" +" datos de salida en el listado\n" + +#: as.c:313 +msgid "" +" --listing-lhs-width2 set the width in words of the continuation lines\n" +" of the output data column; ignored if smaller than\n" +" the width of the first line\n" +msgstr "" +" --listing-lhs-width2 establece el ancho en palabras de las líneas de\n" +" continuación de la columna de datos de salida; se\n" +" ignora si es más pequeño que la anchura de la\n" +" primera línea\n" + +#: as.c:317 +msgid "" +" --listing-rhs-width set the max width in characters of the lines from\n" +" the source file\n" +msgstr "" +" --listing-rhs-width establece la anchura máxima en caracteres de las\n" +" líneas del fichero fuente\n" + +#: as.c:320 +msgid "" +" --listing-cont-lines set the maximum number of continuation lines used\n" +" for the output data column of the listing\n" +msgstr "" +" --listing-cont-lines establece el número máximo de líneas de continuación\n" +" utilizadas para la columna de datos de salida del\n" +" listado\n" + +#: as.c:327 gasp.c:3528 +#, c-format +msgid "Report bugs to %s\n" +msgstr "Reportar bichos a %s\n" + +#. This output is intended to follow the GNU standards document. +#: as.c:527 +#, c-format +msgid "GNU assembler %s\n" +msgstr "GNU ensamblador %s\n" + +#: as.c:528 +msgid "Copyright 2001 Free Software Foundation, Inc.\n" +msgstr "Copyright 2001 Free Software Foundation, Inc.\n" + +#: as.c:529 gasp.c:3627 +msgid "" +"This program is free software; you may redistribute it under the terms of\n" +"the GNU General Public License. This program has absolutely no warranty.\n" +msgstr "" +"Este programa es software libre; se puede redistribuir bajo los términos de\n" +"la Licencia Pública General de GNU. Este programa no tiene ninguna garantía.\n" + +#: as.c:532 +#, c-format +msgid "This assembler was configured for a target of `%s'.\n" +msgstr "Este ensamblador se configuró para un objetivo `%s'.\n" + +#: as.c:539 +msgid "multiple emulation names specified" +msgstr "se especificaron múltiples nombres de emulación" + +#: as.c:541 +msgid "emulations not handled in this configuration" +msgstr "las emulaciones no se manejan en esta configuración" + +#: as.c:546 +#, c-format +msgid "alias = %s\n" +msgstr "alias = %s\n" + +#: as.c:547 +#, c-format +msgid "canonical = %s\n" +msgstr "canónico = %s\n" + +#: as.c:548 +#, c-format +msgid "cpu-type = %s\n" +msgstr "tipo-cpu = %s\n" + +#: as.c:550 +#, c-format +msgid "format = %s\n" +msgstr "formato = %s\n" + +#: as.c:553 +#, c-format +msgid "bfd-target = %s\n" +msgstr "objetivo-bfd = %s\n" + +#: as.c:566 +msgid "bad defsym; format is --defsym name=value" +msgstr "defsym erróneo; el formato es --defsym nombre=valor" + +#: as.c:590 +msgid "no file name following -t option" +msgstr "no hay un nombre de fichero a continuación de la opción -t" + +#: as.c:605 +#, c-format +msgid "failed to read instruction table %s\n" +msgstr "falló la lectura de la tabla de instrucciones %s\n" + +#: as.c:720 +#, c-format +msgid "invalid listing option `%c'" +msgstr "opción de listado `%c' inválida" + +#: as.c:928 +#, c-format +msgid "%d warnings, treating warnings as errors" +msgstr "%d avisos, tratando los avisos como errores" + +#: as.c:959 +#, c-format +msgid "%s: total time in assembly: %ld.%06ld\n" +msgstr "%s: tiempo total en ensamblado: %ld.%06ld\n" + +#: as.c:962 +#, c-format +msgid "%s: data size %ld\n" +msgstr "%s: tamaño de datos %ld\n" + +#: as.h:216 +#, c-format +msgid "Case value %ld unexpected at line %d of file \"%s\"\n" +msgstr "Valor de case %ld inesperado en la línea %d del fichero \"%s\"\n" + +#. +#. * We have a GROSS internal error. +#. * This should never happen. +#. +#: atof-generic.c:437 config/tc-m68k.c:2879 +msgid "failed sanity check" +msgstr "falló la prueba de sanidad" + +#: cond.c:79 +msgid "invalid identifier for \".ifdef\"" +msgstr "identificador inválido para \".ifdef\"" + +#: cond.c:133 +msgid "non-constant expression in \".if\" statement" +msgstr "expresión no constante en la declaración \".if\"" + +#: cond.c:229 +msgid "bad format for ifc or ifnc" +msgstr "formato erróneo para ifc ó ifnc" + +#: cond.c:260 +msgid "\".elseif\" without matching \".if\"" +msgstr "\".elseif\" sin un \".if\" coincidente" + +#: cond.c:264 +msgid "\".elseif\" after \".else\"" +msgstr "\".elseif\" después de \".else\"" + +#: cond.c:267 cond.c:375 +msgid "here is the previous \"else\"" +msgstr "aquí está el \"else\" anterior" + +#: cond.c:270 cond.c:378 +msgid "here is the previous \"if\"" +msgstr "aquí está el \"if\" anterior" + +#: cond.c:299 +msgid "non-constant expression in \".elseif\" statement" +msgstr "expresión no constante en la declaración \".elseif\"" + +#: cond.c:338 +msgid "\".endif\" without \".if\"" +msgstr "\".endif\" sin \".if\"" + +#: cond.c:368 +msgid "\".else\" without matching \".if\"" +msgstr "\".else\" sin un \".if\" coincidente" + +#: cond.c:372 +msgid "duplicate \"else\"" +msgstr "\"else\" duplicado" + +#: cond.c:424 +msgid ".ifeqs syntax error" +msgstr "error sintáctico .ifeqs" + +#: cond.c:507 +msgid "end of macro inside conditional" +msgstr "fin de macro dentro de un condicional" + +#: cond.c:509 +msgid "end of file inside conditional" +msgstr "fin de fichero dentro de un condicional" + +#: cond.c:512 +msgid "here is the start of the unterminated conditional" +msgstr "aquí es el inicio del condicional sin terminar" + +#: cond.c:516 +msgid "here is the \"else\" of the unterminated conditional" +msgstr "aquí está el \"else\" del condicional sin terminar" + +#: config/obj-aout.c:162 +#, c-format +msgid "Attempt to put a common symbol into set %s" +msgstr "Se intentó poner un símbolo común en el conjunto %s" + +#: config/obj-aout.c:166 +#, c-format +msgid "Attempt to put an undefined symbol into set %s" +msgstr "Se intentó poner un símbolo indefinido en el conjunto %s" + +#: config/obj-aout.c:197 config/obj-coff.c:1274 +#, c-format +msgid "Symbol `%s' can not be both weak and common" +msgstr "El símbolo `%s' no puede ser débil y común al mismo tiempo" + +#: config/obj-aout.c:255 config/obj-coff.c:2010 +msgid "unresolved relocation" +msgstr "reubicación sin resolver" + +#: config/obj-aout.c:257 config/obj-coff.c:2012 +#, c-format +msgid "bad relocation: symbol `%s' not in symbol table" +msgstr "reubicación errónea: el símbolo `%s' no está en la tabla de símbolos" + +#: config/obj-aout.c:344 +#, c-format +msgid "%s: bad type for weak symbol" +msgstr "%s: tipo erróneo para un símbolo débil" + +#: config/obj-aout.c:458 config/obj-coff.c:2940 write.c:1933 +#, c-format +msgid "%s: global symbols not supported in common sections" +msgstr "%s: los símbolos globales no tienen soporte en las secciones comunes" + +#: config/obj-aout.c:524 +#, c-format +msgid "Local symbol %s never defined." +msgstr "El símbolo local %s nunca se definió." + +#: config/obj-aout.c:612 +msgid "subsegment index too high" +msgstr "índice de subsegmento demasiado alto" + +#: config/obj-bout.c:319 config/obj-vms.c:562 +#, c-format +msgid "Local symbol %s never defined" +msgstr "El símbolo local %s nunca se definió" + +#: config/obj-coff.c:166 +#, c-format +msgid "Inserting \"%s\" into structure table failed: %s" +msgstr "Falló la inserción de \"%s\" en la tabla de estructuras: %s" + +#. Zero is used as an end marker in the file. +#: config/obj-coff.c:469 +msgid "Line numbers must be positive integers\n" +msgstr "Los números de línea deben ser enteros positivos\n" + +#: config/obj-coff.c:503 config/obj-coff.c:2355 +msgid ".ln pseudo-op inside .def/.endef: ignored." +msgstr "pseudo-operador .ln dentro de .def/.endef: ignorado." + +#: config/obj-coff.c:546 ecoff.c:3280 +msgid ".loc outside of .text" +msgstr ".loc fuera de .text" + +#: config/obj-coff.c:553 +msgid ".loc pseudo-op inside .def/.endef: ignored." +msgstr "pseudo-operador .loc dentro de .def/.endef: ignorado." + +#: config/obj-coff.c:641 config/obj-coff.c:2412 +msgid ".def pseudo-op used inside of .def/.endef: ignored." +msgstr "pseudo-operador .def usado dentro de .def/.endef: ignorado." + +#: config/obj-coff.c:687 config/obj-coff.c:2464 +msgid ".endef pseudo-op used outside of .def/.endef: ignored." +msgstr "pseudo-operador .endef usado fuera de .def/.endef: ignorado." + +#: config/obj-coff.c:725 +#, c-format +msgid "`%s' symbol without preceding function" +msgstr "símbolo `%s' sin una función precedente" + +#: config/obj-coff.c:812 config/obj-coff.c:2539 +#, c-format +msgid "unexpected storage class %d" +msgstr "clase de almacenamiento %d inesperada" + +#: config/obj-coff.c:925 config/obj-coff.c:2646 +msgid ".dim pseudo-op used outside of .def/.endef: ignored." +msgstr "pseudo-operador .dim usado fuera de .def/.endef: ignorado." + +#: config/obj-coff.c:945 config/obj-coff.c:2666 +msgid "badly formed .dim directive ignored" +msgstr "directiva .dim formada erróneamente ignorada" + +#: config/obj-coff.c:996 config/obj-coff.c:2729 +msgid ".size pseudo-op used outside of .def/.endef ignored." +msgstr "pseudo-operador .size usado fuera de .def/.endef ignorado." + +#: config/obj-coff.c:1012 config/obj-coff.c:2745 +msgid ".scl pseudo-op used outside of .def/.endef ignored." +msgstr "pseudo-operador .scl usado fuera de .def/.endef ignorado." + +#: config/obj-coff.c:1030 config/obj-coff.c:2763 +msgid ".tag pseudo-op used outside of .def/.endef ignored." +msgstr "pseudo-operador .tag usado fuera de .def/.endef ignorado." + +#: config/obj-coff.c:1049 config/obj-coff.c:2781 +#, c-format +msgid "tag not found for .tag %s" +msgstr "no se encontró una marca para .tag %s" + +#: config/obj-coff.c:1064 config/obj-coff.c:2796 +msgid ".type pseudo-op used outside of .def/.endef ignored." +msgstr "pseudo-operador .type usado fuera de .def/.endef ignorado." + +#: config/obj-coff.c:1086 config/obj-coff.c:2818 +msgid ".val pseudo-op used outside of .def/.endef ignored." +msgstr "pseudo-operador .val usado fuera de .def/.endef ignorado." + +#: config/obj-coff.c:1231 config/obj-coff.c:3013 +msgid "mismatched .eb" +msgstr ".eb sin coincidencia" + +#: config/obj-coff.c:1252 config/obj-coff.c:3053 +msgid "C_EFCN symbol out of scope" +msgstr "símbolo C_EFCN fuera de ámbito" + +#. STYP_INFO +#. STYP_LIB +#. STYP_OVER +#: config/obj-coff.c:1476 +#, c-format +msgid "unsupported section attribute '%c'" +msgstr "atributo de sección '%c' sin soporte" + +#: config/obj-coff.c:1481 config/obj-coff.c:3758 config/tc-ppc.c:4211 +#, c-format +msgid "unknown section attribute '%c'" +msgstr "atributo de sección '%c' desconocido" + +#: config/obj-coff.c:1511 config/tc-ppc.c:4229 config/tc-tic54x.c:4130 read.c:2555 +#, c-format +msgid "error setting flags for \"%s\": %s" +msgstr "error al establecer las opciones para \"%s\": %s" + +#: config/obj-coff.c:1522 +#, c-format +msgid "Ignoring changed section attributes for %s" +msgstr "Ignorando los atributos de sección cambiados para %s" + +#: config/obj-coff.c:1658 +#, c-format +msgid "0x%lx: \"%s\" type = %ld, class = %d, segment = %d\n" +msgstr "0x%lx: \"%s\" tipo = %ld, clase = %d, segmento = %d\n" + +#: config/obj-coff.c:1838 config/obj-ieee.c:69 +msgid "Out of step\n" +msgstr "Fuera del paso\n" + +#: config/obj-coff.c:2271 +msgid "bfd_coff_swap_scnhdr_out failed" +msgstr "falló bfd_coff_swap_scnhdr_out" + +#: config/obj-coff.c:2496 +msgid "`.bf' symbol without preceding function\n" +msgstr "símbolo `.bf' sin una función precedente\n" + +#: config/obj-coff.c:3450 config/obj-ieee.c:507 +#, c-format +msgid "FATAL: Can't create %s" +msgstr "FATAL: No se puede crear %s" + +#: config/obj-coff.c:3632 +#, c-format +msgid "Can't close %s: %s" +msgstr "No se puede cerrar %s: %s" + +#: config/obj-coff.c:3666 +#, c-format +msgid "Too many new sections; can't add \"%s\"" +msgstr "Demasiadas secciones nuevas; no se puede agregar \"%s\"" + +#: config/obj-coff.c:4073 config/tc-sparc.c:3537 +msgid "Expected comma after name" +msgstr "Se esperaba una coma después del nombre" + +#: config/obj-coff.c:4079 +msgid "Missing size expression" +msgstr "Falta una expresión de tamaño" + +#: config/obj-coff.c:4085 +#, c-format +msgid "lcomm length (%d.) <0! Ignored." +msgstr "¡longitud de lcomm (%d.) <0! Ignorada." + +#: config/obj-coff.c:4113 +#, c-format +msgid "Symbol %s already defined" +msgstr "El símbolo %s ya está definido" + +#: config/obj-coff.c:4208 config/tc-i960.c:3206 +#, c-format +msgid "No 'bal' entry point for leafproc %s" +msgstr "No hay un punto de entrada 'bal' para el proceso hoja %s" + +#: config/obj-coff.c:4287 +#, c-format +msgid "Negative of non-absolute symbol %s" +msgstr "Negativo de un símbolo %s que no es absoluto" + +#: config/obj-coff.c:4308 +msgid "callj to difference of 2 symbols" +msgstr "callj para diferenciar a 2 símbolos" + +#: config/obj-coff.c:4354 +#, c-format +msgid "Can't emit reloc {- %s-seg symbol \"%s\"} @ file address %ld." +msgstr "No se puede emitir la reubicación {- %s-seg símbolo \"%s\"} @ dirección del fichero %ld." + +#. This is a COBR instruction. They have only a 13-bit +#. displacement and are only to be used for local branches: +#. flag as error, don't generate relocation. +#: config/obj-coff.c:4443 config/tc-i960.c:3226 write.c:2826 +msgid "can't use COBR format with external label" +msgstr "no se puede utilizar el formato COBR con una etiqueta externa" + +#: config/obj-coff.c:4518 +#, c-format +msgid "Value of %ld too large for field of %d bytes at 0x%lx" +msgstr "El valor de %ld es demasiado grande para el campo de %d bytes en 0x%lx" + +#: config/obj-coff.c:4532 +#, c-format +msgid "Signed .word overflow; switch may be too large; %ld at 0x%lx" +msgstr "Desbordamiento con signo de .word; el interruptor puede ser demasiado grande; %ld en 0x%lx" + +#: config/obj-ecoff.c:227 +msgid "Can't set GP value" +msgstr "No se puede establecer el valor GP" + +#: config/obj-ecoff.c:234 +msgid "Can't set register masks" +msgstr "No se pueden establecer las máscaras de registro" + +#: config/obj-elf.c:308 +msgid "expected comma after symbol-name" +msgstr "se esperaba una coma después del nombre del símbolo" + +#: config/obj-elf.c:315 config/tc-sparc.c:3690 +#, c-format +msgid ".COMMon length (%d.) <0! Ignored." +msgstr "¡longitud de .COMM (%d.) <0! Ignorada." + +#: config/obj-elf.c:325 ecoff.c:3399 read.c:1403 read.c:1504 read.c:2137 read.c:2226 read.c:2856 read.c:4937 symbols.c:361 symbols.c:460 +#, c-format +msgid "symbol `%s' is already defined" +msgstr "el símbolo `%s' ya está definido" + +#: config/obj-elf.c:333 +#, c-format +msgid "length of .comm \"%s\" is already %ld; not changed to %d" +msgstr "la longitud de .comm \"%s\" ya es %ld; no se cambia a %d" + +#: config/obj-elf.c:356 +msgid "common alignment negative; 0 assumed" +msgstr "alineación común negativa; se asume 0" + +#: config/obj-elf.c:375 +msgid "common alignment not a power of 2" +msgstr "la alineación común no es una potencia de 2" + +#: config/obj-elf.c:438 config/tc-sparc.c:3832 config/tc-v850.c:565 +#, c-format +msgid "bad .common segment %s" +msgstr "segmento .common %s erróneo" + +#: config/obj-elf.c:668 +#, c-format +msgid "setting incorrect section type for %s" +msgstr "se establece un tipo de sección incorrecto para %s" + +#: config/obj-elf.c:672 +#, c-format +msgid "ignoring incorrect section type for %s" +msgstr "se ignora un tipo de sección incorrecto para %s" + +#: config/obj-elf.c:685 +#, c-format +msgid "setting incorrect section attributes for %s" +msgstr "se establecen atributos de sección incorrectos para %s" + +#: config/obj-elf.c:732 +#, c-format +msgid "ignoring changed section attributes for %s" +msgstr "se ignoran los atributos de sección cambiados para %s" + +#: config/obj-elf.c:734 +#, c-format +msgid "ignoring changed section entity size for %s" +msgstr "se ignoran el tamaño de entidad de sección cambiado para %s" + +#: config/obj-elf.c:737 +#, c-format +msgid "ignoring new section group for %s" +msgstr "se ignora un grupo de sección nuevo para %s" + +#: config/obj-elf.c:788 +msgid "unrecognized .section attribute: want a,w,x,M,S,G" +msgstr "atributo de .section no reconocido: se quiere a,w,x,M,S,G" + +#: config/obj-elf.c:828 +msgid "unrecognized section attribute" +msgstr "atributo de sección no reconocido" + +#: config/obj-elf.c:850 read.c:2538 +msgid "unrecognized section type" +msgstr "tipo de sección no reconocido" + +#: config/obj-elf.c:880 +msgid "missing name" +msgstr "falta un nombre" + +#: config/obj-elf.c:987 +msgid "invalid merge entity size" +msgstr "tamaño de entidad de mezcla inválido" + +#: config/obj-elf.c:994 +msgid "entity size for SHF_MERGE not specified" +msgstr "no se especificó el tamaño de entidad para SHF_MERGE" + +#: config/obj-elf.c:1007 +msgid "group name for SHF_GROUP not specified" +msgstr "no se especificó el tamaño de entidad para SHF_GROUP" + +#: config/obj-elf.c:1020 +msgid "character following name is not '#'" +msgstr "el carácter a continuación del nombre no es '#'" + +#: config/obj-elf.c:1121 +msgid ".previous without corresponding .section; ignored" +msgstr ".previous sin .section correspondiente; ignorado" + +#: config/obj-elf.c:1148 +msgid ".popsection without corresponding .pushsection; ignored" +msgstr ".popsection sin .pushsection correspondiente; ignorado" + +#: config/obj-elf.c:1202 +msgid "expected comma after name in .symver" +msgstr "se esperaba una coma después del nombre en .symver" + +#: config/obj-elf.c:1225 +#, c-format +msgid "missing version name in `%s' for symbol `%s'" +msgstr "falta el nombre de versión en `%s' para el símbolo `%s'" + +#: config/obj-elf.c:1236 +#, c-format +msgid "multiple versions [`%s'|`%s'] for symbol `%s'" +msgstr "versiones múltiples [`%s'|`%s'] para el símbolo `%s'" + +#: config/obj-elf.c:1470 +msgid "expected quoted string" +msgstr "se esperaba una cadena entre comillas" + +#: config/obj-elf.c:1491 +#, c-format +msgid "expected comma after name `%s' in .size directive" +msgstr "se esperaba una coma después del nombre `%s' en la directiva .size" + +#: config/obj-elf.c:1500 +msgid "missing expression in .size directive" +msgstr "falta una expresión en la directiva .size" + +#: config/obj-elf.c:1583 +#, c-format +msgid "unrecognized symbol type \"%s\"" +msgstr "tipo de símbolo \"%s\" no reconocido" + +#: config/obj-elf.c:1764 +msgid ".size expression too complicated to fix up" +msgstr "la expresión .size es demasiado complicada para componerla" + +#: config/obj-elf.c:1796 +#, c-format +msgid "invalid attempt to declare external version name as default in symbol `%s'" +msgstr "intento inválido de declarar un nombre de versión externo como valor por omisión en el símbolo `%s'" + +#: config/obj-elf.c:1855 ecoff.c:3644 +#, c-format +msgid "symbol `%s' can not be both weak and common" +msgstr "el símbolo `%s' no puede ser débil y común al mismo tiempo" + +#: config/obj-elf.c:1971 +#, c-format +msgid "can't create group: %s" +msgstr "no se puede crear un grupo: %s" + +#: config/obj-elf.c:2068 +#, c-format +msgid "failed to set up debugging information: %s" +msgstr "falló al establecer la información de depuración: %s" + +#: config/obj-elf.c:2088 +#, c-format +msgid "can't start writing .mdebug section: %s" +msgstr "no se puede iniciar la escritura de la sección .mdebug: %s" + +#: config/obj-elf.c:2096 +#, c-format +msgid "could not write .mdebug section: %s" +msgstr "no se puede escribir la sección .mdebug: %s" + +#: config/obj-ieee.c:455 +msgid "too many sections" +msgstr "demasiadas secciones" + +#: config/obj-som.c:138 +msgid "Only one .version pseudo-op per file!" +msgstr "¡Sólo un pseudo-operador .version por fichero!" + +#: config/obj-som.c:155 config/obj-som.c:201 +msgid "Expected quoted string" +msgstr "Se esperaba una cadena entre comillas" + +#: config/obj-som.c:164 +#, c-format +msgid "FATAL: Attaching version header %s" +msgstr "FATAL: Adjuntando el encabezado de versión %s" + +#: config/obj-som.c:184 +msgid "Only one .copyright pseudo-op per file!" +msgstr "¡Sólo un pseudo-operador .copyright por fichero!" + +#: config/obj-som.c:210 +#, c-format +msgid "FATAL: Attaching copyright header %s" +msgstr "FATAL: Adjuntando el encabezado de copyright %s" + +#: config/obj-vms.c:463 +#, c-format +msgid "compiler emitted zero-size common symbol `%s' already defined" +msgstr "el símbolo común de tamaño cero emitido por el compilador `%s' ya está definido" + +#: config/obj-vms.c:473 +#, c-format +msgid "compiler redefined zero-size common symbol `%s'" +msgstr "símbolo común de tamaño cero `%s' redefinido por el compilador" + +#: config/obj-vms.c:592 +#, c-format +msgid "Couldn't create VMS object file \"%s\"" +msgstr "No se puede crear el fichero objeto VMS \"%s\"" + +#: config/obj-vms.c:617 +msgid "I/O error writing VMS object file (length prefix)" +msgstr "Error de E/S al escribir el fichero objeto VMS (longitud del prefijo)" + +#: config/obj-vms.c:631 +msgid "I/O error writing VMS object file" +msgstr "Error de E/S al escribir el fichero objeto VMS" + +#: config/obj-vms.c:1221 +#, c-format +msgid "Couldn't find source file \"%s\", status=%%X%x" +msgstr "No se puede encontrar el fichero fuente \"%s\", estado=%%X%x" + +#: config/obj-vms.c:1719 config/obj-vms.c:2895 +#, c-format +msgid "debugger forward reference error, dbx type %d" +msgstr "error de referencia hacia adelante del depurador, tipo dbx %d" + +#: config/obj-vms.c:1794 +#, c-format +msgid "Variable descriptor %d too complicated. Defined as `void *'." +msgstr "El descriptor de variable %d es demasiado complicado. Se define como `void *'." + +#: config/obj-vms.c:2108 +msgid "" +"***Warning - the assembly code generated by the compiler has placed \n" +" global constant(s) in the text psect. These will not be available to \n" +" other modules, since this is not the correct way to handle this. You \n" +" have two options: 1) get a patched compiler that does not put global \n" +" constants in the text psect, or 2) remove the 'const' keyword from \n" +" definitions of global variables in your source module(s). Don't say \n" +" I didn't warn you! \n" +msgstr "" +"***Aviso - el código ensamblador generado por el compilador ha colocado \n" +" constante(s) global(es) en la psect de texto. Éstas no estarán disponibles \n" +" para otros módulos, ya que no es la forma correcta de manejarlo. Tiene \n" +" dos opciones: 1) obtener un compilador parchado que no coloque constantes \n" +" globales en la psect de texto, o 2) quitar la palabra clave 'const' de \n" +" las definiciones de las variables globales en el(los) módulo(s) fuente. \n" +" ¡No diga que no se le advirtió! \n" + +#: config/obj-vms.c:2422 +#, c-format +msgid "debugginer output: %d is an unknown untyped variable." +msgstr "salida del depurador: %d es una variable sin tipo desconocido." + +#: config/obj-vms.c:2640 +#, c-format +msgid "debugger output: structure element `%s' has undefined type" +msgstr "salida del depurador: el elmento de la estructura `%s' tiene un tipo indefinido" + +#: config/obj-vms.c:2751 +#, c-format +msgid "debugger output: %d is an unknown type of variable." +msgstr "salida del depurador: %d es un tipo desconocido de variable." + +#: config/obj-vms.c:2884 +#, c-format +msgid "debugger output: Unable to resolve %d circular references." +msgstr "salida del depurador: No se pueden resolver %d referencias circulares." + +#: config/obj-vms.c:3086 +#, c-format +msgid "Module name truncated: %s\n" +msgstr "Nombre de módulo truncado: %s\n" + +#: config/obj-vms.c:3364 +#, c-format +msgid "Symbol %s replaced by %s\n" +msgstr "El símbolo %s se reemplazó por %s\n" + +#. impossible +#: config/obj-vms.c:3647 +#, c-format +msgid "Unknown VMS psect type (%ld)" +msgstr "Tipo psect VMS desconocido (%ld)" + +#: config/obj-vms.c:3688 +#, c-format +msgid "Globalsymbol attribute for symbol %s was unexpected." +msgstr "El atributo de globalsymbol para el símbolo %s era inesperado." + +#: config/obj-vms.c:3837 +msgid "Invalid data type for globalvalue" +msgstr "Tipo de dato inválido para globalvalue" + +#: config/obj-vms.c:3849 +#, c-format +msgid "Invalid globalvalue of %s" +msgstr "Globalvalue inválido de %s" + +#: config/obj-vms.c:4199 +msgid "Couldn't find fixup fragment when checking for indirect reference" +msgstr "No se puede encontrar el fragmento de compostura al revisar por referencias indirectas" + +#: config/obj-vms.c:4542 config/obj-vms.c:4683 +msgid "Fixup data addsy and subsy don't have the same type" +msgstr "Los datos de compostura addsy y subsy no tienen el mismo tipo" + +#: config/obj-vms.c:4546 config/obj-vms.c:4687 +msgid "Fixup data addsy and subsy don't have an appropriate type" +msgstr "Los datos de compostura addsy y subsy no tienen un tipo apropiado" + +#: config/obj-vms.c:4549 config/obj-vms.c:4690 +msgid "Fixup data is erroneously \"pcrel\"" +msgstr "Los datos de compostura son \"pcrel\" erróneamente" + +#: config/obj-vms.c:4565 config/obj-vms.c:4709 +msgid "Fixup datum is not a longword" +msgstr "El dato de compostura no es un longword" + +#: config/obj-vms.c:4569 config/obj-vms.c:4713 +msgid "Fixup datum is not \"fixP->fx_addsy\"" +msgstr "El dato de compostura no es \"fixP->fx_addsy\"" + +#: config/obj-vms.c:4784 +#, c-format +msgid "" +"g++ wrote an extern reference to `%s' as a routine.\n" +"I will fix it, but I hope that it was note really a routine." +msgstr "" +"g++ escribió una referencia externa a `%s' como una rutina.\n" +"Se compondrá, pero se espera que no sea realmente una rutina." + +#: config/obj-vms.c:4916 +msgid "Can't handle global xtors symbols yet." +msgstr "No se pueden manejar símbolos xtors globales aún." + +#: config/obj-vms.c:4919 +#, c-format +msgid "Unknown %s" +msgstr "%s desconocido" + +#. +#. * Error otherwise. +#. +#: config/obj-vms.c:5004 +#, c-format +msgid "unhandled stab type %d" +msgstr "tipo de cabo %d sin manejar" + +#: config/tc-a29k.c:160 config/tc-sparc.c:3884 +msgid "Unknown segment type" +msgstr "Tipo de segmento desconocido" + +#. Probably a memory allocation problem? Give up now. +#: config/tc-a29k.c:330 config/tc-hppa.c:1462 config/tc-mips.c:1251 config/tc-mips.c:1293 config/tc-sparc.c:847 +msgid "Broken assembler. No assembly attempted." +msgstr "Ensamblador descompuesto. No se intentó ensamblar." + +#: config/tc-a29k.c:375 config/tc-avr.c:1131 config/tc-d10v.c:540 config/tc-d30v.c:552 config/tc-h8300.c:313 config/tc-h8500.c:284 config/tc-mcore.c:655 config/tc-mmix.c:468 config/tc-mn10200.c:940 config/tc-mn10300.c:1311 config/tc-ppc.c:2106 config/tc-s390.c:1054 config/tc-sh.c:869 config/tc-tic80.c:283 config/tc-v850.c:2073 config/tc-w65.c:241 config/tc-z8k.c:343 +msgid "missing operand" +msgstr "operando faltante" + +#: config/tc-a29k.c:414 config/tc-cris.c:950 config/tc-cris.c:958 config/tc-hppa.c:1598 config/tc-i860.c:431 config/tc-i860.c:448 config/tc-sparc.c:1409 config/tc-sparc.c:1415 +#, c-format +msgid "Unknown opcode: `%s'" +msgstr "Código de operación desconocido: `%s'" + +#: config/tc-a29k.c:419 +#, c-format +msgid "Unknown opcode `%s'." +msgstr "Código de operación desconocido `%s'." + +#: config/tc-a29k.c:451 +#, c-format +msgid "Too many operands: %s" +msgstr "Demasiados operandos: %s" + +#: config/tc-a29k.c:473 config/tc-a29k.c:504 +#, c-format +msgid "Immediate value of %ld is too large" +msgstr "El valor inmediato de %ld es demasiado grande" + +#: config/tc-a29k.c:543 config/tc-i860.c:340 config/tc-i860.c:832 config/tc-m68k.c:3181 config/tc-m68k.c:3210 config/tc-sparc.c:2544 +msgid "failed sanity check." +msgstr "falló la prueba de sanidad." + +#: config/tc-a29k.c:889 +#, c-format +msgid "bad relocation type: 0x%02x" +msgstr "tipo de reubicación erróneo: 0x%02x" + +#: config/tc-a29k.c:916 +#, c-format +msgid "need %o3\n" +msgstr "se necesita %o3\n" + +#: config/tc-a29k.c:932 +msgid "a29k_convert_frag\n" +msgstr "a29k_convert_frag\n" + +#: config/tc-a29k.c:941 +msgid "a29k_estimate_size_before_relax\n" +msgstr "a29k_estimate_size_before_relax\n" + +#: config/tc-a29k.c:1092 +#, c-format +msgid "label \"$%d\" redefined" +msgstr "se redefinió la etiqueta \"$%d\"" + +#: config/tc-a29k.c:1165 +#, c-format +msgid "Invalid expression after %%%%\n" +msgstr "Expresión inválida después de %%%%\n" + +#: config/tc-a29k.c:1176 +msgid "Invalid register in & expression" +msgstr "Registro inválido en la expresión &" + +#: config/tc-alpha.c:789 +#, c-format +msgid "internal error: can't hash opcode `%s': %s" +msgstr "error interno: no se puede dispersar el código de operación `%s': %s" + +#: config/tc-alpha.c:824 +#, c-format +msgid "internal error: can't hash macro `%s': %s" +msgstr "error interno: no se puede dispersar la macro `%s': %s" + +#: config/tc-alpha.c:906 config/tc-i960.c:2701 +msgid "syntax error" +msgstr "error sintáctico" + +#: config/tc-alpha.c:980 config/tc-h8300.c:1413 config/tc-h8500.c:1187 config/tc-hppa.c:4017 config/tc-i860.c:931 config/tc-m68hc11.c:500 config/tc-m68k.c:4201 config/tc-m88k.c:1011 config/tc-ns32k.c:1663 config/tc-sparc.c:2831 config/tc-z8k.c:1321 +msgid "Bad call to MD_ATOF()" +msgstr "Llamada errónea a MD_ATOF()" + +#: config/tc-alpha.c:1030 +#, c-format +msgid "Unknown CPU identifier `%s'" +msgstr "Identificador de CPU `%s' desconocido" + +#: config/tc-alpha.c:1074 +msgid "" +"Alpha options:\n" +"-32addr\t\t\ttreat addresses as 32-bit values\n" +"-F\t\t\tlack floating point instructions support\n" +"-mev4 | -mev45 | -mev5 | -mev56 | -mpca56 | -mev6 | -mall\n" +"\t\t\tspecify variant of Alpha architecture\n" +"-m21064 | -m21066 | -m21164 | -m21164a | -m21164pc | -m21264\n" +"\t\t\tthese variants include PALcode opcodes\n" +msgstr "" +"Opciones Alpha:\n" +"-32addr\t\t\ttrata direcciones como valores de 32-bit\n" +"-F\t\t\tfalta el soporte de instrucciones de coma flotante\n" +"-mev4 | -mev45 | -mev5 | -mev56 | -mpca56 | -mev6 | -mall\n" +"\t\t\tvariantes específicas de la arquitectura Alpha\n" +"-m21064 | -m21066 | -m21164 | -m21164a | -m21164pc | -m21264\n" +"\t\t\testas variantes incluyen códigos de operación PALcode\n" + +#: config/tc-alpha.c:1084 +msgid "" +"VMS options:\n" +"-+\t\t\thash encode (don't truncate) names longer than 64 characters\n" +"-H\t\t\tshow new symbol after hash truncation\n" +msgstr "" +"Opciones VMS:\n" +"-+\t\t\tcodificar por dispersión (no truncar) nombres más largos que 64 caracteres\n" +"-H\t\t\tmostrar el símbolo nuevo después del truncado por dispersión\n" + +#: config/tc-alpha.c:1242 +#, c-format +msgid "unhandled relocation type %s" +msgstr "tipo de reubicación %s sin manejar" + +#: config/tc-alpha.c:1255 +msgid "non-absolute expression in constant field" +msgstr "expresión no absoluta en campo constante" + +#: config/tc-alpha.c:1269 +#, c-format +msgid "type %d reloc done?\n" +msgstr "¿tipo %d de reubicación hecha?\n" + +#: config/tc-alpha.c:1317 config/tc-alpha.c:1324 config/tc-mips.c:7965 +msgid "Used $at without \".set noat\"" +msgstr "Se usó $at sin \".set noat\"" + +#: config/tc-alpha.c:1481 +#, c-format +msgid "cannot represent `%s' relocation in object file" +msgstr "no se puede representar la reubicación `%s' en el fichero objeto" + +#: config/tc-alpha.c:1488 +#, c-format +msgid "internal error? cannot generate `%s' relocation" +msgstr "¿error interno? no se puede generar la reubicación `%s'" + +#: config/tc-alpha.c:1543 +#, c-format +msgid "frame reg expected, using $%d." +msgstr "se esperaba un marco de registro, se usa $%d." + +#: config/tc-alpha.c:1646 +#, c-format +msgid "No !literal!%ld was found" +msgstr "No se encontró una !literal!%ld" + +#: config/tc-alpha.c:1654 +#, c-format +msgid "No ldah !gpdisp!%ld was found" +msgstr "No se encontró un ldah !gpdisp!%ld" + +#: config/tc-alpha.c:1705 +#, c-format +msgid "No lda !gpdisp!%ld was found" +msgstr "No se encontró un lda !gpdisp!%ld" + +#. only support one relocation op per insn +#: config/tc-alpha.c:1841 +msgid "More than one relocation op per insn" +msgstr "Más de un operador de reubicación por insn" + +#: config/tc-alpha.c:1857 +msgid "No relocation operand" +msgstr "No hay un operando de reubicación" + +#: config/tc-alpha.c:1867 +#, c-format +msgid "Unknown relocation operand: !%s" +msgstr "Operando de reubicación desconocido: !%s" + +#: config/tc-alpha.c:1877 +#, c-format +msgid "no sequence number after !%s" +msgstr "no hay un número de secuencia después de !%s" + +#: config/tc-alpha.c:1887 +#, c-format +msgid "!%s does not use a sequence number" +msgstr "!%s no utiliza un número de secuencia" + +#: config/tc-alpha.c:1897 +#, c-format +msgid "Bad sequence number: !%s!%s" +msgstr "Secuencia de números errónea: !%s!%s" + +#: config/tc-alpha.c:2224 +#, c-format +msgid "operand out of range (%s not between %d and %d)" +msgstr "operador fuera de rango (%s no está entre %d y %d)" + +#: config/tc-alpha.c:2338 config/tc-alpha.c:2362 config/tc-d10v.c:629 config/tc-d30v.c:640 config/tc-mn10200.c:995 config/tc-mn10300.c:1382 config/tc-ppc.c:2072 config/tc-ppc.c:2256 config/tc-ppc.c:2268 config/tc-s390.c:1064 config/tc-s390.c:1121 config/tc-v850.c:1853 config/tc-v850.c:1876 config/tc-v850.c:2096 +msgid "too many fixups" +msgstr "demasiadas composturas" + +#: config/tc-alpha.c:2374 +msgid "invalid relocation for instruction" +msgstr "reubicación inválida para la instrucción" + +#: config/tc-alpha.c:2385 +msgid "invalid relocation for field" +msgstr "reubicación inválida para el campo" + +#: config/tc-alpha.c:2484 +#, c-format +msgid "too many ldah insns for !gpdisp!%ld" +msgstr "demasiadas instrucciones ldah para !gpdisp!%ld" + +#: config/tc-alpha.c:2486 config/tc-alpha.c:2498 +#, c-format +msgid "both insns for !gpdisp!%ld must be in the same section" +msgstr "ambas instrucciones para !gpdisp!%ld deben estar en la misma sección" + +#: config/tc-alpha.c:2496 +#, c-format +msgid "too many lda insns for !gpdisp!%ld" +msgstr "demasiadas instrucciones lda para !gpdisp!%ld" + +#: config/tc-alpha.c:2577 config/tc-alpha.c:2647 +#, c-format +msgid "inappropriate arguments for opcode `%s'" +msgstr "argumentos inapropiados para el código de operación `%s'" + +#: config/tc-alpha.c:2579 config/tc-alpha.c:2649 +#, c-format +msgid "opcode `%s' not supported for target %s" +msgstr "el código de operación `%s' no tiene soporte para el objetivo %s" + +#: config/tc-alpha.c:2583 config/tc-alpha.c:2653 config/tc-avr.c:1097 +#, c-format +msgid "unknown opcode `%s'" +msgstr "código de operación `%s' desconocido" + +#: config/tc-alpha.c:2701 +msgid "can not resolve expression" +msgstr "no se puede resolver la expresión" + +#: config/tc-alpha.c:2845 config/tc-alpha.c:3024 +msgid "overflow in literal (.lita) table" +msgstr "desbordamiento en la tabla (.lita) literal" + +#: config/tc-alpha.c:2852 config/tc-alpha.c:2875 config/tc-alpha.c:3037 config/tc-alpha.c:3252 config/tc-alpha.c:3297 config/tc-alpha.c:3371 config/tc-alpha.c:3463 config/tc-alpha.c:3712 config/tc-alpha.c:3813 +msgid "macro requires $at register while noat in effect" +msgstr "la macro requiere el registro $at mientras noat está en efecto" + +#: config/tc-alpha.c:2854 config/tc-alpha.c:2877 config/tc-alpha.c:3039 +msgid "macro requires $at while $at in use" +msgstr "la macro requiere $at mientras $at está en uso" + +#: config/tc-alpha.c:2985 +msgid "bignum invalid; zero assumed" +msgstr "bignum inválido; se asume cero" + +#: config/tc-alpha.c:2987 +msgid "floating point number invalid; zero assumed" +msgstr "número de coma flotante inválido; se asume cero" + +#: config/tc-alpha.c:2992 +msgid "can't handle expression" +msgstr "no se puede manejar la expresión" + +#: config/tc-alpha.c:3030 +msgid "overflow in literal (.lit8) table" +msgstr "desbordamiento en la tabla (.lit8) literal" + +#: config/tc-alpha.c:4042 config/tc-ppc.c:1579 config/tc-ppc.c:3974 +#, c-format +msgid ".COMMon length (%ld.) <0! Ignored." +msgstr "¡longitud de .COMM (%ld.) <0! Ignorada." + +#: config/tc-alpha.c:4071 config/tc-sparc.c:3700 config/tc-v850.c:283 +msgid "Ignoring attempt to re-define symbol" +msgstr "Se ignora el intento de redefinir el símbolo" + +#: config/tc-alpha.c:4080 config/tc-alpha.c:4089 config/tc-ppc.c:4011 +#, c-format +msgid "Length of .comm \"%s\" is already %ld. Not changed to %ld." +msgstr "La longitud de .comm \"%s\" ya es %ld. No se cambia a %ld." + +#: config/tc-alpha.c:4191 ecoff.c:3084 +msgid ".ent directive has no name" +msgstr "la directiva .ent no tiene nombre" + +#: config/tc-alpha.c:4199 +msgid "nested .ent directives" +msgstr "directivas .ent anidadas" + +#: config/tc-alpha.c:4235 ecoff.c:3034 +msgid ".end directive has no name" +msgstr "la directiva .end no tiene nombre" + +#: config/tc-alpha.c:4244 +msgid ".end directive names different symbol than .ent" +msgstr "la directiva .end nombra un símbolo diferente de .ent" + +#: config/tc-alpha.c:4321 +#, c-format +msgid "Invalid argument %d to .prologue." +msgstr "Argumento inválido %d para .prologue." + +#: config/tc-alpha.c:4413 +msgid "ECOFF debugging is disabled." +msgstr "La depuración ECOFF está desactivada." + +#: config/tc-alpha.c:4434 +msgid "Unknown section directive" +msgstr "Directiva de sección desconocida" + +#: config/tc-alpha.c:4470 +msgid ".ent directive has no symbol" +msgstr "la directiva .ent no tiene símbolo" + +#: config/tc-alpha.c:4497 +msgid "Bad .frame directive 1./2. param" +msgstr "Parámetro 1./2. de directiva .frame erróneo" + +#: config/tc-alpha.c:4509 +msgid "Bad .frame directive 3./4. param" +msgstr "Parámetro 3./4. de directiva .frame erróneo" + +#: config/tc-alpha.c:4534 +msgid ".pdesc directive not in link (.link) section" +msgstr "la directiva .pdesc no está en la sección de enlace (.link)" + +#: config/tc-alpha.c:4542 +msgid ".pdesc has no matching .ent" +msgstr ".pdesc no tiene un .ent coincidente" + +#: config/tc-alpha.c:4553 +msgid ".pdesc directive has no entry symbol" +msgstr "la directiva .pdesc no tiene un símbolo de entrada" + +#: config/tc-alpha.c:4566 +msgid "No comma after .pdesc " +msgstr "No hay una coma después de .pdesc " + +#: config/tc-alpha.c:4589 +msgid "unknown procedure kind" +msgstr "tipo de procedimiento desconocido" + +#: config/tc-alpha.c:4682 +msgid ".name directive not in link (.link) section" +msgstr "la directiva .name no está en la sección de enlace (.link)" + +#: config/tc-alpha.c:4690 +msgid ".name directive has no symbol" +msgstr "la directiva .name no tiene símbolo" + +#: config/tc-alpha.c:4724 +msgid "No symbol after .linkage" +msgstr "No hay un símbolo después de .linkage" + +#: config/tc-alpha.c:4752 +msgid "No symbol after .code_address" +msgstr "No hay un símbolo después de .code_address" + +#: config/tc-alpha.c:4785 +msgid "Bad .mask directive" +msgstr "Directiva .mask errónea" + +#: config/tc-alpha.c:4806 +msgid "Bad .fmask directive" +msgstr "Directiva .fmask errónea" + +#: config/tc-alpha.c:4976 +#, c-format +msgid "Expected comma after name \"%s\"" +msgstr "Se esperaba una coma después del nombre \"%s\"" + +#. *symbol_get_obj (symbolP) = (signed char) temp; +#: config/tc-alpha.c:4987 +#, c-format +msgid "unhandled: .proc %s,%d" +msgstr "sin manejar: .proc %s,%d" + +#: config/tc-alpha.c:5022 +#, c-format +msgid "Tried to .set unrecognized mode `%s'" +msgstr "Se intento hacer .set del modo `%s' no reconocido" + +#. not fatal, but it might not work in the end +#: config/tc-alpha.c:5039 +msgid "File overrides no-base-register option." +msgstr "El fichero se impone a la opción no-base-register." + +#: config/tc-alpha.c:5056 +#, c-format +msgid "Bad base register, using $%d." +msgstr "Registro base erróneo, utilizando $%d." + +#: config/tc-alpha.c:5078 +#, c-format +msgid "Alignment too large: %d. assumed" +msgstr "Alineación demasiado grande: se asume %d." + +#: config/tc-alpha.c:5082 config/tc-d30v.c:2214 +msgid "Alignment negative: 0 assumed" +msgstr "Alineación negativa: se asume 0" + +#: config/tc-alpha.c:5394 +#, c-format +msgid "Chose GP value of %lx\n" +msgstr "Valor GP escogido de %lx\n" + +#: config/tc-alpha.c:5410 config/tc-ia64.c:932 +msgid "Bad .section directive: want a,s,w,x,M,S in string" +msgstr "Directiva .section errónea: se quiere a,s,w,x,M,S en la cadena" + +#: config/tc-arc.c:1616 config/tc-arm.c:10246 +msgid "md_estimate_size_before_relax\n" +msgstr "md_estimate_size_before_relax\n" + +#: config/tc-arc.c:1628 +msgid "md_convert_frag\n" +msgstr "md_convert_frag\n" + +#: config/tc-arm.c:664 +msgid "ARM register expected" +msgstr "se esperaba un registro ARM" + +#: config/tc-arm.c:665 config/tc-arm.c:2814 +msgid "bad or missing co-processor number" +msgstr "número de co-procesador erróneo o faltante" + +#. In the few cases where we might be able to accept something else +#. this error can be overridden. +#: config/tc-arm.c:666 config/tc-arm.c:2869 +msgid "co-processor register expected" +msgstr "se esperaba un registro de co-procesador" + +#: config/tc-arm.c:667 +msgid "FPA register expected" +msgstr "se esperaba un registro FPA" + +#: config/tc-arm.c:668 +msgid "VFP single precision register expected" +msgstr "Se esperaba un registro de precisión simple VFP" + +#: config/tc-arm.c:669 +msgid "VFP double precision register expected" +msgstr "Se esperaba un registro de precisión doble VFP" + +#: config/tc-arm.c:670 +msgid "Maverick MVF register expected" +msgstr "se esperaba un registro Maverick MVF" + +#: config/tc-arm.c:671 +msgid "Maverick MVD register expected" +msgstr "se esperaba un registro Maverick MVD" + +#: config/tc-arm.c:672 config/tc-arm.c:673 +msgid "Maverick MVFX register expected" +msgstr "se esperaba un registro Maverick MVFX" + +#: config/tc-arm.c:674 +msgid "Maverick MVAX register expected" +msgstr "se esperaba un registro Maverick MVAX" + +#: config/tc-arm.c:675 +msgid "Maverick DSPSC register expected" +msgstr "se esperaba un registro Maverick DSPSC" + +#: config/tc-arm.c:2013 +msgid "bad arguments to instruction" +msgstr "argumentos erróneos para la instrucción" + +#: config/tc-arm.c:2014 +msgid "r15 not allowed here" +msgstr "no se permite r15 aquí" + +#: config/tc-arm.c:2015 +msgid "instruction is not conditional" +msgstr "la instrucción no es condicional" + +#: config/tc-arm.c:2016 +msgid "acc0 expected" +msgstr "se esperaba acc0" + +#: config/tc-arm.c:2155 +msgid "literal pool overflow" +msgstr "desbordamiento de conjunto literal" + +#: config/tc-arm.c:2297 +msgid "invalid syntax for .req directive" +msgstr "sintaxis inválida para la directiva .req." + +#: config/tc-arm.c:2372 +#, c-format +msgid "alignment too large: %d assumed" +msgstr "alineación demasiado grande: se asume %d" + +#: config/tc-arm.c:2375 +msgid "alignment negative. 0 assumed." +msgstr "alineación negativa. Se asume 0." + +#: config/tc-arm.c:2459 +#, c-format +msgid "expected comma after name \"%s\"" +msgstr "se esperaba una coma después del nombre \"%s\"" + +#: config/tc-arm.c:2509 config/tc-m32r.c:418 +#, c-format +msgid "symbol `%s' already defined" +msgstr "el símbolo `%s' ya está definido" + +#: config/tc-arm.c:2580 +msgid "selected processor does not support THUMB opcodes" +msgstr "el procesador seleccionado no tiene soporte para códigos de operación THUMB" + +#: config/tc-arm.c:2593 +msgid "selected processor does not support ARM opcodes" +msgstr "el procesador seleccionado no tiene soporte para códigos de operación ARM" + +#: config/tc-arm.c:2605 +#, c-format +msgid "invalid instruction size selected (%d)" +msgstr "tamaño de instrucción seleccionado inválido (%d)" + +#: config/tc-arm.c:2640 +#, c-format +msgid "invalid operand to .code directive (%d) (expecting 16 or 32)" +msgstr "operando inválido para la directiva .code (%d) (se esperaba 16 o 32)" + +#: config/tc-arm.c:2651 +msgid "garbage following instruction" +msgstr "basura a continuación de la instrucción" + +#. In the few cases where we might be able to accept something else +#. this error can be overridden. +#: config/tc-arm.c:2701 +#, c-format +msgid "register expected, not '%.100s'" +msgstr "se esperaba un registro, no '%.100s'" + +#. In the few cases where we might be able to accept +#. something else this error can be overridden. +#: config/tc-arm.c:2773 +msgid "flag for {c}psr instruction expected" +msgstr "se esperaba una opción para la instrucción {c}psr" + +#: config/tc-arm.c:2807 +msgid "illegal co-processor number" +msgstr "número de co-procesador ilegal" + +#: config/tc-arm.c:2839 config/tc-arm.c:3877 config/tc-arm.c:4059 +msgid "bad or missing expression" +msgstr "expresión errónea o faltante" + +#: config/tc-arm.c:2845 +msgid "immediate co-processor expression too large" +msgstr "expresión de co-procesador inmediata demasiado grande" + +#. In the few cases where we might be able to accept something else +#. this error can be overridden. +#: config/tc-arm.c:2892 +msgid "floating point register expected" +msgstr "se esperaba un registro de coma flotante" + +#: config/tc-arm.c:2909 +msgid "immediate expression expected" +msgstr "se esperaba una expresión inmediata" + +#: config/tc-arm.c:2924 +msgid "co-processor address must be word aligned" +msgstr "la dirección del co-procesador debe ser alineada con word" + +#: config/tc-arm.c:2930 +msgid "offset too large" +msgstr "desplazamiento demasiado grande" + +#: config/tc-arm.c:2979 +msgid "pc may not be used in post-increment" +msgstr "el pc no se puede usar en post-incremento" + +#: config/tc-arm.c:2995 config/tc-arm.c:3440 config/tc-arm.c:4228 config/tc-arm.c:5095 config/tc-arm.c:5429 +msgid "pre-indexed expression expected" +msgstr "se esperaba una expresión pre-indizada" + +#: config/tc-arm.c:3008 config/tc-arm.c:3453 config/tc-arm.c:4239 config/tc-arm.c:5107 config/tc-arm.c:5441 config/tc-arm.c:5790 config/tc-arm.c:8452 config/tc-arm.c:8467 +msgid "missing ]" +msgstr "falta un ]" + +#: config/tc-arm.c:3018 +msgid "pc may not be used with write-back" +msgstr "el pc no se puede usar con escritura hacia atrás" + +#: config/tc-arm.c:3070 +msgid "comma expected after register name" +msgstr "se esperaba una coma después del nombre de registro" + +#: config/tc-arm.c:3089 +msgid "CPSR or SPSR expected" +msgstr "se esperaba CPSR ó SPSR" + +#: config/tc-arm.c:3115 +msgid "comma missing after psr flags" +msgstr "falta una coma después de las opciones psr" + +#: config/tc-arm.c:3131 config/tc-arm.c:3141 +msgid "only a register or immediate value can follow a psr flag" +msgstr "sólo un registro o un valor inmediato puede seguir a una opción psr" + +#: config/tc-arm.c:3152 +msgid "immediate value cannot be used to set this field" +msgstr "no se puede usar un valor inmediato para establecer este campo" + +#: config/tc-arm.c:3170 config/tc-arm.c:4455 config/tc-arm.c:4735 config/tc-arm.c:4755 config/tc-i960.c:1924 +msgid "invalid constant" +msgstr "constante inválida" + +#: config/tc-arm.c:3218 +msgid "rdhi, rdlo and rm must all be different" +msgstr "rdhi, rdlo y rm deben ser todos diferentes" + +#: config/tc-arm.c:3272 +msgid "rd and rm should be different in mul" +msgstr "rd y rm deben ser diferentes en mul" + +#: config/tc-arm.c:3326 +msgid "rd and rm should be different in mla" +msgstr "rd y rm deben ser diferentes en mla" + +#: config/tc-arm.c:3374 +#, c-format +msgid "acc0 expected, not '%.100s'" +msgstr "se esperaba acc0, no '%.100s'" + +#: config/tc-arm.c:3552 +msgid "rdhi and rdlo must be different" +msgstr "rdhi y rdlo deben ser diferentes" + +#: config/tc-arm.c:3660 +msgid "Warning: instruction unpredictable when using r15" +msgstr "Aviso: la instrucción es impredecible cuando se utiliza r15" + +#: config/tc-arm.c:3886 config/tc-arm.c:4068 config/tc-arm.c:7395 config/tc-arm.c:7428 config/tc-arm.c:7438 +msgid "immediate value out of range" +msgstr "valor inmediato fuera de rango" + +#: config/tc-arm.c:4191 +msgid "'[' expected after PLD mnemonic" +msgstr "se esperaba '[' después del mnemónico PLD" + +#: config/tc-arm.c:4213 +msgid "post-indexed expression used in preload instruction" +msgstr "se usó una expresión post-indizada en la instrucción de precarga" + +#: config/tc-arm.c:4218 config/tc-arm.c:4248 +msgid "writeback used in preload instruction" +msgstr "se usó escritura hacia atrás en la instrucción de precarga" + +#: config/tc-arm.c:4290 +msgid "destination register must be even" +msgstr "el registro de destino debe ser par" + +#: config/tc-arm.c:4296 +msgid "r14 not allowed here" +msgstr "no se permite r14 aquí" + +#: config/tc-arm.c:4303 +msgid "pre/post-indexing used when modified address register is destination" +msgstr "se usó pre/post-indizado cuando el registro de dirección modificado es el destino" + +#: config/tc-arm.c:4313 +msgid "ldrd destination registers must not overlap index register" +msgstr "los registros destino ldrd no deben quedar sobre el registro índice" + +#: config/tc-arm.c:4439 +msgid "bad_segment" +msgstr "segmento_erróneo" + +#: config/tc-arm.c:4476 expr.c:1314 read.c:2198 +msgid "bad expression" +msgstr "expresión errónea" + +#: config/tc-arm.c:4499 config/tc-arm.c:4510 +msgid "shift expression expected" +msgstr "se esperaba una expresión de desplazamiento" + +#: config/tc-arm.c:4534 +msgid "shift requires register or #expression" +msgstr "el desplazamiento requiere un registro o una #expresión" + +#: config/tc-arm.c:4535 +msgid "shift requires #expression" +msgstr "el desplazamiento requiere una #expresión" + +#: config/tc-arm.c:4565 +msgid "shift of 0 ignored." +msgstr "se ignora un desplazamiento de 0." + +#: config/tc-arm.c:4571 +msgid "invalid immediate shift" +msgstr "desplazamiento inmediato inválido" + +#: config/tc-arm.c:4726 config/tc-arm.c:5143 config/tc-arm.c:5478 config/tc-arm.c:6087 config/tc-v850.c:1956 config/tc-v850.c:1977 +msgid "constant expression expected" +msgstr "se esperaba una expresión constante" + +#: config/tc-arm.c:4768 +msgid "register or shift expression expected" +msgstr "se esperaba un registro o una expresión de desplazamiento" + +#: config/tc-arm.c:4821 +msgid "invalid floating point immediate expression" +msgstr "expresión inmediata de coma flotante inválida" + +#: config/tc-arm.c:4825 +msgid "floating point register or immediate expression expected" +msgstr "se esperaba un registro de coma flotante o una expresión inmediata" + +#: config/tc-arm.c:4979 config/tc-arm.c:5309 +msgid "address offset too large" +msgstr "dirección de desplazamiento demasiado grande" + +#: config/tc-arm.c:5037 config/tc-arm.c:5227 config/tc-arm.c:5369 +msgid "address expected" +msgstr "se esperaba una dirección" + +#: config/tc-arm.c:5067 config/tc-arm.c:5079 config/tc-arm.c:5116 config/tc-arm.c:5245 config/tc-arm.c:5399 config/tc-arm.c:5413 config/tc-arm.c:5450 +#, c-format +msgid "%s register same as write-back base" +msgstr "el registro %s es el mismo que la base de escritura-hacia-atrás" + +#: config/tc-arm.c:5069 config/tc-arm.c:5081 config/tc-arm.c:5118 config/tc-arm.c:5247 config/tc-arm.c:5401 config/tc-arm.c:5415 config/tc-arm.c:5452 +msgid "destination" +msgstr "destino" + +#: config/tc-arm.c:5069 config/tc-arm.c:5081 config/tc-arm.c:5118 config/tc-arm.c:5247 config/tc-arm.c:5401 config/tc-arm.c:5415 config/tc-arm.c:5452 +msgid "source" +msgstr "fuente" + +#: config/tc-arm.c:5128 config/tc-arm.c:5462 config/tc-arm.c:7699 +msgid "invalid pseudo operation" +msgstr "pseudo operación inválida" + +#: config/tc-arm.c:5180 config/tc-arm.c:5513 +msgid "literal pool insertion failed" +msgstr "falló la inserción en el conjunto de literales" + +#: config/tc-arm.c:5275 config/tc-arm.c:5281 +msgid "post-indexed expression expected" +msgstr "se esperaba una expresión post-indizada" + +#: config/tc-arm.c:5579 +msgid "bad range in register list" +msgstr "rango erróneo en la lista de registros" + +#: config/tc-arm.c:5587 config/tc-arm.c:5596 config/tc-arm.c:5638 +#, c-format +msgid "Warning: duplicated register (r%d) in register list" +msgstr "Aviso: registro duplicado (r%d) en la lista de registros" + +#: config/tc-arm.c:5599 +msgid "Warning: register range not in ascending order" +msgstr "Aviso: el rango de registros no está en orden ascendente" + +#: config/tc-arm.c:5611 +msgid "missing `}'" +msgstr "falta un `}'" + +#: config/tc-arm.c:5627 +msgid "invalid register mask" +msgstr "máscara de registro inválida" + +#: config/tc-arm.c:5648 config/tc-arm.c:8709 config/tc-arm.c:8809 config/tc-avr.c:860 config/tc-cris.c:3006 config/tc-d10v.c:1563 config/tc-d30v.c:1863 config/tc-mips.c:3641 config/tc-mips.c:4630 config/tc-mips.c:5486 config/tc-mips.c:6091 config/tc-ppc.c:5143 config/tc-v850.c:2376 +msgid "expression too complex" +msgstr "expresión demasiado compleja" + +#: config/tc-arm.c:5686 +msgid "r15 not allowed as base register" +msgstr "no se permite r15 como registro base" + +#: config/tc-arm.c:5750 config/tc-arm.c:5764 +msgid "r15 not allowed in swap" +msgstr "no se permite r15 en el intercambio" + +#: config/tc-arm.c:5859 +msgid "use of r15 in bx in ARM mode is not really useful" +msgstr "el uso de r15 en bx en modo ARM no es realmente útil" + +#: config/tc-arm.c:6093 +msgid "constant value required for number of registers" +msgstr "se requiere un valor constante para el número de registros" + +#: config/tc-arm.c:6101 +msgid "number of registers must be in the range [1:4]" +msgstr "el número de registros debe estar en el rango [1:4]" + +#: config/tc-arm.c:6162 +msgid "r15 not allowed as base register with write-back" +msgstr "no se permite r15 como registro base con escritura-hacia-atrás" + +#: config/tc-arm.c:6544 +msgid "only two consecutive VFP SP registers allowed here" +msgstr "solamente se permiten dos registros SP VFP consecutivos aquí" + +#: config/tc-arm.c:6712 +msgid "VFP system register expected" +msgstr "se esperaba un registro de sistema VFP" + +#: config/tc-arm.c:6850 config/tc-arm.c:6889 config/tc-arm.c:6902 config/tc-arm.c:6963 config/tc-arm.c:7002 config/tc-arm.c:7015 config/tc-mips.c:9060 config/tc-mips.c:9090 +msgid "invalid register list" +msgstr "lista de registros inválida" + +#: config/tc-arm.c:6856 config/tc-arm.c:6969 +msgid "register list not in ascending order" +msgstr "la lista de registros no está en orden ascendente" + +#: config/tc-arm.c:6881 config/tc-arm.c:6994 +msgid "register range not in ascending order" +msgstr "el rango de registros no está en orden ascendente" + +#: config/tc-arm.c:6919 config/tc-arm.c:7032 +msgid "non-contiguous register range" +msgstr "el rango de registro no es contiguo" + +#: config/tc-arm.c:7062 config/tc-arm.c:7099 +msgid "this addressing mode requires base-register writeback" +msgstr "este modo de direccionamiento requiere escritura hacia atrás del registro-base" + +#: config/tc-arm.c:7259 +msgid "lo register required" +msgstr "se requiere el registro lo" + +#: config/tc-arm.c:7267 +msgid "hi register required" +msgstr "se requiere el registro hi" + +#: config/tc-arm.c:7337 config/tc-arm.c:8541 +msgid "dest and source1 must be the same register" +msgstr "dest y source1 debe ser el mismo registro" + +#: config/tc-arm.c:7344 +msgid "subtract valid only on lo regs" +msgstr "subtract válido sólo en registros lo" + +#: config/tc-arm.c:7368 +msgid "invalid Hi register with immediate" +msgstr "registro Hi inválido con el inmediato" + +#: config/tc-arm.c:7406 +msgid "invalid immediate value for stack adjust" +msgstr "valor inmediato inválido para el ajuste de la pila" + +#: config/tc-arm.c:7417 +msgid "invalid immediate for address calculation" +msgstr "inmediato inválido para el cálculo de dirección" + +#: config/tc-arm.c:7504 +msgid "source1 and dest must be same register" +msgstr "source1 y dest debe ser el mismo registro" + +#: config/tc-arm.c:7538 +msgid "invalid immediate for shift" +msgstr "inmediato inválido para el desplazamiento" + +#: config/tc-arm.c:7617 +msgid "only lo regs allowed with immediate" +msgstr "sólo se permiten registros lo con inmediatos" + +#: config/tc-arm.c:7636 +msgid "invalid immediate" +msgstr "inmediato inválido" + +#: config/tc-arm.c:7690 +msgid "expected ']'" +msgstr "se esperaba ']'" + +#: config/tc-arm.c:7763 +msgid "byte or halfword not valid for base register" +msgstr "byte o halfword no válido para el registro base" + +#: config/tc-arm.c:7768 +msgid "r15 based store not allowed" +msgstr "no se permite el almacenamiento basado en r15" + +#: config/tc-arm.c:7773 +msgid "invalid base register for register offset" +msgstr "registro base inválido para el desplazamiento del registro" + +#: config/tc-arm.c:7791 config/tc-arm.c:7826 +msgid "invalid offset" +msgstr "desplazamiento inválido" + +#: config/tc-arm.c:7802 +msgid "invalid base register in load/store" +msgstr "registro base inválido en carga/almacenamiento" + +#: config/tc-arm.c:8345 +msgid "expecting immediate, 7bit operand" +msgstr "se espera un operando inmediato de 7 bits" + +#: config/tc-arm.c:8360 +msgid "immediate out of range" +msgstr "inmediato fuera de rango" + +#: config/tc-arm.c:8403 +msgid "offset expected" +msgstr "se esperaba un desplazamiento" + +#: config/tc-arm.c:8412 config/tc-pj.c:528 config/tc-sh.c:3030 +msgid "offset out of range" +msgstr "desplazamiento fuera de rango" + +#: config/tc-arm.c:8549 +msgid "Rs and Rd must be different in MUL" +msgstr "Rs y Rd deben ser diferentes en MUL" + +#: config/tc-arm.c:8693 +msgid "inserted missing '!': load/store multiple always writes back base register" +msgstr "se insertó un '!' faltante: los load/store múltiples siempre escribe hacia atrás el registro base" + +#: config/tc-arm.c:8715 +msgid "only lo-regs valid in load/store multiple" +msgstr "sólo los registros lo son válidos en carga/almacenamiento múltiple" + +#: config/tc-arm.c:8761 +msgid "syntax: ldrs[b] Rd, [Rb, Ro]" +msgstr "sintaxis: ldrs[b] Rd, [Rb, Ro]" + +#: config/tc-arm.c:8825 +msgid "invalid register list to push/pop instruction" +msgstr "lista de registros inválida para la instrucción push/pop" + +#: config/tc-arm.c:8937 config/tc-arm.c:9115 +msgid "virtual memory exhausted" +msgstr "memoria agotada" + +#: config/tc-arm.c:9018 +#, c-format +msgid "register '%s' does not exist\n" +msgstr "el registro '%s' no existe\n" + +#: config/tc-arm.c:9022 +#, c-format +msgid "ignoring redefinition of register alias '%s' to non-existant register '%s'" +msgstr "se ignora la redefinición del alias de registro '%s' al registro no existente '%s'" + +#: config/tc-arm.c:9031 +#, c-format +msgid "ignoring redefinition of register alias '%s'" +msgstr "se ignora la redefinición del alias de registro '%s'" + +#: config/tc-arm.c:9037 +msgid "ignoring incomplete .req pseuso op" +msgstr "se ignora el pseudo operador incompleto .req" + +#: config/tc-arm.c:9312 +msgid "bad call to MD_ATOF()" +msgstr "llamada errónea a MD_ATOF()" + +#: config/tc-arm.c:9542 +#, c-format +msgid "invalid constant (%lx) after fixup" +msgstr "constante inválidoa (%lx) después de la compostura" + +#: config/tc-arm.c:9578 +#, c-format +msgid "unable to compute ADRL instructions for PC offset of 0x%lx" +msgstr "no se pueden calcular las instrucciones ADRL para el desplazamiento de PC de 0x%lx" + +#: config/tc-arm.c:9608 +#, c-format +msgid "bad immediate value for offset (%ld)" +msgstr "valor inmediato erróneo para el desplazamiento (%ld)" + +#: config/tc-arm.c:9630 config/tc-arm.c:9652 +msgid "invalid literal constant: pool needs to be closer" +msgstr "constante literal inválida: el conjunto necesita estar más cerca" + +#: config/tc-arm.c:9632 +#, c-format +msgid "bad immediate value for half-word offset (%ld)" +msgstr "valor inmediato erróneo para el desplazamiento half-word (%ld)" + +#: config/tc-arm.c:9669 +msgid "shift expression is too large" +msgstr "la expresión de desplazamiento es demasiado grande" + +#: config/tc-arm.c:9688 config/tc-arm.c:9697 +msgid "invalid swi expression" +msgstr "expresión swi inválida" + +#: config/tc-arm.c:9707 +msgid "invalid expression in load/store multiple" +msgstr "expresión inválida en load/store múltiples" + +#: config/tc-arm.c:9760 +msgid "GAS can't handle same-section branch dest >= 0x04000000" +msgstr "GAS no puede manejar un destino de ramificación en la misma sección >= 0x04000000" + +#: config/tc-arm.c:9769 +msgid "out of range branch" +msgstr "ramificación fuera de rango" + +#: config/tc-arm.c:9802 config/tc-arm.c:9818 +msgid "branch out of range" +msgstr "ramificación fuera de rango" + +#: config/tc-arm.c:9841 +msgid "branch with link out of range" +msgstr "ramificación con enlace fuera de rango" + +#: config/tc-arm.c:9917 +msgid "illegal value for co-processor offset" +msgstr "valor ilegal para el desplazamiento del co-procesador" + +#: config/tc-arm.c:9941 +#, c-format +msgid "invalid offset, target not word aligned (0x%08X)" +msgstr "desplazamiento inválido, el objetivo no está alineado a word (0x%08X)" + +#: config/tc-arm.c:9947 config/tc-arm.c:9956 config/tc-arm.c:9963 config/tc-arm.c:9970 config/tc-arm.c:9977 +#, c-format +msgid "invalid offset, value too big (0x%08lX)" +msgstr "desplazamiento inválido, valor demasiado grande (0x%08lX)" + +#: config/tc-arm.c:10016 +msgid "invalid immediate for stack address calculation" +msgstr "inmediato inválido para el cálculo de la dirección de la pila" + +#: config/tc-arm.c:10025 +#, c-format +msgid "invalid immediate for address calculation (value = 0x%08lX)" +msgstr "inmediato inválido para el cálculo de la dirección (valor = 0x%08lX)" + +#: config/tc-arm.c:10035 +msgid "invalid 8bit immediate" +msgstr "inmediato de 8bit inválido" + +#: config/tc-arm.c:10043 +msgid "invalid 3bit immediate" +msgstr "inmediato de 3bit inválido" + +#: config/tc-arm.c:10059 +#, c-format +msgid "invalid immediate: %ld is too large" +msgstr "inmediato inválido: %ld es demasiado grande" + +#: config/tc-arm.c:10074 +#, c-format +msgid "illegal Thumb shift value: %ld" +msgstr "valor de desplazamiento Thumb ilegal: %ld" + +#: config/tc-arm.c:10088 +#, c-format +msgid "bad relocation fixup type (%d)" +msgstr "tipo de compostura de reubicación inválido (%d)" + +#: config/tc-arm.c:10159 +msgid "literal referenced across section boundary (Implicit dump?)" +msgstr "se referencía una literal a través de un límite de sección (¿Volcado implícito?)" + +#: config/tc-arm.c:10172 +#, c-format +msgid "internal relocation (type %d) not fixed up (IMMEDIATE)" +msgstr "reubicación_interna (tipo %d) no compuesta (IMMEDIATE)" + +#: config/tc-arm.c:10178 +msgid "ADRL used for a symbol not defined in the same file" +msgstr "se utiliza ADRL para un símbolo que no está definido en el mismo fichero" + +#: config/tc-arm.c:10183 +#, c-format +msgid "internal_relocation (type %d) not fixed up (OFFSET_IMM)" +msgstr "reubicación_interna (tipo %d) no compuesta (OFFSET_IMM)" + +#: config/tc-arm.c:10204 config/tc-cris.c:2940 config/tc-mcore.c:2104 config/tc-mmix.c:2840 config/tc-ns32k.c:2350 +msgid "" +msgstr "" + +#: config/tc-arm.c:10207 config/tc-arm.c:10228 +#, c-format +msgid "cannot represent %s relocation in this object file format" +msgstr "no se puede representar la reubicación %s en este formato de fichero objeto" + +#: config/tc-arm.c:10325 +#, c-format +msgid "no operator -- statement `%s'\n" +msgstr "no hay operador -- declaración `%s'\n" + +#: config/tc-arm.c:10343 config/tc-arm.c:10368 +#, c-format +msgid "selected processor does not support `%s'" +msgstr "el procesador seleccionado no tiene soporte para `%s'" + +#: config/tc-arm.c:10385 +#, c-format +msgid "bad instruction `%s'" +msgstr "instrucción `%s' errónea" + +#: config/tc-arm.c:10583 +#, c-format +msgid "unrecognised APCS switch -m%s" +msgstr "interruptor APCS -m%s no reconocido" + +#: config/tc-arm.c:10738 config/tc-arm.c:10751 config/tc-arm.c:10764 config/tc-arm.c:10777 config/tc-arm.c:10783 +#, c-format +msgid "invalid architecture variant -m%s" +msgstr "variante de arquitectura -m%s inválida" + +#: config/tc-arm.c:10790 +#, c-format +msgid "invalid processor variant -m%s" +msgstr "variante de procesador -m%s inválida" + +#: config/tc-arm.c:10813 +msgid "" +" ARM Specific Assembler Options:\n" +" -m[arm][] select processor variant\n" +" -m[arm]v[2|2a|3|3m|4|4t|5[t][e]] select architecture variant\n" +" -marm9e allow Cirrus/DSP instructions\n" +" -mthumb only allow Thumb instructions\n" +" -mthumb-interwork mark the assembled code as supporting interworking\n" +" -mall allow any instruction\n" +" -mfpa10, -mfpa11 select floating point architecture\n" +" -mfpe-old don't allow floating-point multiple instructions\n" +" -mvfpxd allow vfp single-precision instructions\n" +" -mvfp allow all vfp instructions\n" +" -mno-fpu don't allow any floating-point instructions.\n" +" -k generate PIC code.\n" +msgstr "" +" Opciones Específicas del Ensamblador de ARM:\n" +" -m[arm][] selecciona la variante de procesador\n" +" -m[arm]v[2|2a|3|3m|4|4t|5[t][e]] selecciona la variante de arquitectura\n" +" -marm9e permite instrucciones Cirrus/DSP\n" +" -mthumb sólo permite instrucciones Thumb\n" +" -mthumb-interwork marca el código ensamblado con soporte para interoperación\n" +" -mall permite cualquier instrucción\n" +" -mfpa10, -mfpa11 selecciona la arquitectura de coma flotante\n" +" -mfpe-old no permite instrucciones múltiples de coma flotante\n" +" -mvfpxd permite instrucciones vfp de precisión sencilla\n" +" -mvfp permite todas las instrucciones vfp\n" +" -mno-fpu no permite ninguna instrucción de coma flotante.\n" +" -k genera código PIC.\n" + +#: config/tc-arm.c:10828 +msgid "" +" -mapcs-32, -mapcs-26 specify which ARM Procedure Calling Standard to use\n" +" -matpcs use ARM/Thumb Procedure Calling Standard\n" +" -mapcs-float floating point args are passed in FP regs\n" +" -mapcs-reentrant the code is position independent/reentrant\n" +msgstr "" +" -mapcs-32, -mapcs-26 especifica el Estándar de Llamada de Procedimiento de ARM a utilizar\n" +" -matpcs utiliza el Estándar de Llamada de Procedimiento ARM/Thumb\n" +" -mapcs-float los argumentos de coma flotante se pasan en registros FP\n" +" -mapcs-reentrant el código es independiente de posición/reentrante\n" + +#: config/tc-arm.c:10835 +msgid " -moabi support the old ELF ABI\n" +msgstr " -moabi soporta el ABI ELF antiguo\n" + +#: config/tc-arm.c:10839 +msgid "" +" -EB assemble code for a big endian cpu\n" +" -EL assemble code for a little endian cpu\n" +msgstr "" +" -EB ensambla código para un cpu big endian\n" +" -EL ensambla código para un cpu little endian\n" + +#: config/tc-arm.c:11023 +#, c-format +msgid "%s: unexpected function type: %d" +msgstr "%s: tipo de función inesperado: %d" + +#: config/tc-arm.c:11389 +msgid "alignments greater than 32 bytes not supported in .text sections." +msgstr "las alineaciones más grandes que 32 bytes no tienen soporte en la sección text." + +#: config/tc-arm.h:98 +msgid "arm convert_frag\n" +msgstr "convert_frag de arm\n" + +#: config/tc-avr.c:197 +msgid "Known MCU names:" +msgstr "Nombres MCU conocidos:" + +#: config/tc-avr.c:266 +msgid "" +"AVR options:\n" +" -mmcu=[avr-name] select microcontroller variant\n" +" [avr-name] can be:\n" +" avr1 - AT90S1200, ATtiny1x, ATtiny28\n" +" avr2 - AT90S2xxx, AT90S4xxx, AT90S8xxx, ATtiny22\n" +" avr3 - ATmega103, ATmega603\n" +" avr4 - ATmega83, ATmega85\n" +" avr5 - ATmega161, ATmega163, ATmega32, AT94K\n" +" or immediate microcontroller name.\n" +msgstr "" +"Opciones AVR:\n" +" -mmcu=[nombre-avr] escoge la variante de microcontrolador\n" +" [nombre-avr] puede ser:\n" +" avr1 - AT90S1200, ATtiny1x, ATtiny28\n" +" avr2 - AT90S2xxx, AT90S4xxx, AT90S8xxx, ATtiny22\n" +" avr3 - ATmega103, ATmega603\n" +" avr4 - ATmega83, ATmega85\n" +" avr5 - ATmega161, ATmega163, ATmega32, AT94K\n" +" o el nombre inmediato del microcontrolador.\n" + +#: config/tc-avr.c:276 +msgid "" +" -mall-opcodes accept all AVR opcodes, even if not supported by MCU\n" +" -mno-skip-bug disable warnings for skipping two-word instructions\n" +" (default for avr4, avr5)\n" +" -mno-wrap reject rjmp/rcall instructions with 8K wrap-around\n" +" (default for avr3, avr5)\n" +msgstr "" +" -mall-opcodes acepta todos los códigos de operación AVR, aún si no\n" +" tienen soporte por el MCU\n" +" -mno-skip-bug desactiva los avisos para las instrucciones que saltan\n" +" dos palabras (por omisión para avr4, avr5)\n" +" -mno-wrap rechaza las instrucciones rjmp/rcall con envoltura de 8K\n" +" (por omisión para avr3, avr5)\n" + +#: config/tc-avr.c:324 +#, c-format +msgid "unknown MCU: %s\n" +msgstr "MCU desconocido: %s\n" + +#: config/tc-avr.c:333 +#, c-format +msgid "redefinition of mcu type `%s' to `%s'" +msgstr "redefinición del tipo de mcu `%s' a `%s'" + +#: config/tc-avr.c:384 config/tc-d10v.c:314 config/tc-d30v.c:366 config/tc-mips.c:9586 config/tc-mmix.c:2233 config/tc-mn10200.c:361 config/tc-pj.c:357 config/tc-ppc.c:4803 config/tc-sh.c:2090 config/tc-v850.c:1292 +msgid "bad call to md_atof" +msgstr "llamada errónea a md_atof" + +#: config/tc-avr.c:447 +msgid "constant value required" +msgstr "se requiere un valor constante" + +#: config/tc-avr.c:450 +#, c-format +msgid "number must be less than %d" +msgstr "el número debe ser menor que %d" + +#: config/tc-avr.c:502 +msgid "`,' required" +msgstr "se requiere `,'" + +#: config/tc-avr.c:521 +msgid "undefined combination of operands" +msgstr "combinación indefinida de operandos" + +#: config/tc-avr.c:530 +msgid "skipping two-word instruction" +msgstr "instrucción que salta dos palabras" + +#: config/tc-avr.c:592 +msgid "register r16-r23 required" +msgstr "se requiere los registros r16-r23" + +#: config/tc-avr.c:598 +msgid "register number above 15 required" +msgstr "se requiere un número de registro superior a 15" + +#: config/tc-avr.c:604 +msgid "even register number required" +msgstr "se requieren números de registro par" + +#: config/tc-avr.c:610 +msgid "register r24, r26, r28 or r30 required" +msgstr "se requieren los registros r24, r26, r28 o r30" + +#: config/tc-avr.c:616 +msgid "register name or number from 0 to 31 required" +msgstr "se requiere un nombre de registro o un número del 0 al 31" + +#: config/tc-avr.c:634 +msgid "pointer register (X, Y or Z) required" +msgstr "se requiere un registro apuntador (X, Y o Z)" + +#: config/tc-avr.c:641 +msgid "cannot both predecrement and postincrement" +msgstr "no se puede predecrementar y postincrementar" + +#: config/tc-avr.c:649 +msgid "addressing mode not supported" +msgstr "el modo de direccionamiento no tiene soporte" + +#: config/tc-avr.c:655 +msgid "can't predecrement" +msgstr "no se puede predecrementar" + +#: config/tc-avr.c:658 +msgid "pointer register Z required" +msgstr "se requiere el registro apuntador Z" + +#: config/tc-avr.c:676 +msgid "pointer register (Y or Z) required" +msgstr "se requiere un registro apuntador (Y o Z)" + +#: config/tc-avr.c:781 +#, c-format +msgid "unknown constraint `%c'" +msgstr "restricción `%c' desconocida" + +#: config/tc-avr.c:890 config/tc-avr.c:906 config/tc-avr.c:1007 +#, c-format +msgid "odd address operand: %ld" +msgstr "operando de direccón impar: %ld" + +#: config/tc-avr.c:898 config/tc-avr.c:917 +#, c-format +msgid "operand out of range: %ld" +msgstr "operando fuera de rango: %ld" + +#: config/tc-avr.c:1016 config/tc-d10v.c:1634 config/tc-d30v.c:1987 +#, c-format +msgid "line %d: unknown relocation type: 0x%x" +msgstr "línea %d: tipo de reubicación desconocido: 0x%x" + +#: config/tc-avr.c:1030 +msgid "only constant expression allowed" +msgstr "sólo se permite una expresión constante" + +#: config/tc-avr.c:1067 config/tc-d10v.c:1498 config/tc-d30v.c:1807 config/tc-mn10200.c:1240 config/tc-mn10300.c:1774 config/tc-ppc.c:5534 config/tc-v850.c:2296 +#, c-format +msgid "reloc %d not supported by object file format" +msgstr "la reubicación %d no tiene soporte por el formato del fichero objeto" + +#: config/tc-avr.c:1091 config/tc-d10v.c:1100 config/tc-d10v.c:1114 config/tc-h8300.c:1275 config/tc-h8500.c:1088 config/tc-mcore.c:988 config/tc-pj.c:266 config/tc-sh.c:1670 config/tc-z8k.c:1192 +msgid "can't find opcode " +msgstr "no se puede encontrar el código de operación " + +#: config/tc-avr.c:1108 +#, c-format +msgid "illegal opcode %s for mcu %s" +msgstr "código de operación %s ilegal para el mcu %s" + +#: config/tc-avr.c:1116 +msgid "garbage at end of line" +msgstr "basura al final de la línea" + +#: config/tc-avr.c:1180 read.c:3219 +msgid "illegal expression" +msgstr "expresión ilegal" + +#: config/tc-avr.c:1206 config/tc-avr.c:1272 +msgid "`)' required" +msgstr "se requiere `)'" + +#: config/tc-avr.c:1226 +#, c-format +msgid "constant out of 8-bit range: %d" +msgstr "constante fuera del rango de 8-bit: %d" + +#: config/tc-avr.c:1229 +msgid "expression possibly out of 8-bit range" +msgstr "expresión posiblemente fuera del rango de 8-bit" + +#: config/tc-avr.c:1300 config/tc-avr.c:1307 +#, c-format +msgid "illegal %srelocation size: %d" +msgstr "%s ilegal tamaño de reubicación: %d" + +#: config/tc-cris.c:681 +msgid "Virtual memory exhausted" +msgstr "Memoria agotada" + +#: config/tc-cris.c:689 +#, c-format +msgid "Can't hash `%s': %s\n" +msgstr "No se puede dispersar `%s': %s\n" + +#: config/tc-cris.c:690 +msgid "(unknown reason)" +msgstr "(razón desconocida)" + +#: config/tc-cris.c:694 +#, c-format +msgid "Buggy opcode: `%s' \"%s\"\n" +msgstr "Código de operación defectuoso: `%s' \"%s\"\n" + +#: config/tc-cris.c:1039 +#, c-format +msgid "Immediate value not in 5 bit unsigned range: %ld" +msgstr "El valor inmediato no está en el rango de 5 bit sin signo: %ld" + +#: config/tc-cris.c:1055 +#, c-format +msgid "Immediate value not in 4 bit unsigned range: %ld" +msgstr "El valor inmediato no está en el rango de 4 bit sin signo: %ld" + +#: config/tc-cris.c:1094 +#, c-format +msgid "Immediate value not in 6 bit range: %ld" +msgstr "El valor inmediato no está en el rango de 6 bit: %ld" + +#: config/tc-cris.c:1109 +#, c-format +msgid "Immediate value not in 6 bit unsigned range: %ld" +msgstr "El valor inmediato no está en el rango de 6 bit sin signo: %ld" + +#. Others have a generic warning. +#: config/tc-cris.c:1199 +#, c-format +msgid "Unimplemented register `%s' specified" +msgstr "Se especificó el registro sin implementar `%s'" + +#. We've come to the end of instructions with this +#. opcode, so it must be an error. +#: config/tc-cris.c:1358 +msgid "Illegal operands" +msgstr "Operandos ilegales" + +#: config/tc-cris.c:1389 config/tc-cris.c:1420 +#, c-format +msgid "Immediate value not in 8 bit range: %ld" +msgstr "El valor inmediato no está en el rango de 8 bit: %ld" + +#: config/tc-cris.c:1399 config/tc-cris.c:1427 +#, c-format +msgid "Immediate value not in 16 bit range: %ld" +msgstr "El valor inmediato no está en el rango de 16 bit: %ld" + +#: config/tc-cris.c:1448 +msgid "PIC relocation size does not match operand size" +msgstr "el tamaño de la reubicación PIC no coincide con el tamaño del operando" + +#: config/tc-cris.c:2447 +msgid "32-bit conditional branch generated" +msgstr "se generó una ramificación condicional de 32-bit" + +#: config/tc-cris.c:2501 +msgid "Complex expression not supported" +msgstr "Las expresiones complejas no tienen soporte" + +#. FIXME: Is this function mentioned in the internals.texi manual? If +#. not, add it. +#: config/tc-cris.c:2622 +msgid "Bad call to md_atof () - floating point formats are not supported" +msgstr "Llamada errónea a md_atof () - no tienen soporte los formatos de coma flotante" + +#: config/tc-cris.c:2669 +msgid "PC-relative relocation must be trivially resolved" +msgstr "La reubicación relativa al PC debe ser resuelta trivialmente" + +#: config/tc-cris.c:2712 +#, c-format +msgid "Value not in 16 bit range: %ld" +msgstr "El valor no está en el rango de 16 bit: %ld" + +#: config/tc-cris.c:2723 +#, c-format +msgid "Value not in 8 bit range: %ld" +msgstr "El valor no está en el rango de 8 bit: %ld" + +#: config/tc-cris.c:2730 +#, c-format +msgid "Value not in 4 bit unsigned range: %ld" +msgstr "El valor no está en el rango de 4 bit sin signo: %ld" + +#: config/tc-cris.c:2737 +#, c-format +msgid "Value not in 5 bit unsigned range: %ld" +msgstr "El valor no está en el rango de 5 bit sin signo: %ld" + +#: config/tc-cris.c:2744 +#, c-format +msgid "Value not in 6 bit range: %ld" +msgstr "El valor no está en el rango de 6 bit: %ld" + +#: config/tc-cris.c:2751 +#, c-format +msgid "Value not in 6 bit unsigned range: %ld" +msgstr "El valor no está en el rango de 6 bit sin signo: %ld" + +#: config/tc-cris.c:2799 +msgid "Please use --help to see usage and options for this assembler.\n" +msgstr "Por favor utilice --help para ver el modo de empleo y opciones para este ensamblador.\n" + +#: config/tc-cris.c:2811 +msgid "--no-underscore is invalid with a.out format" +msgstr "--no-underscore esn inválido con el formato a.out" + +#: config/tc-cris.c:2887 +msgid "Semantics error. This type of operand can not be relocated, it must be an assembly-time constant" +msgstr "Error de semántica. Este tipo de operando no se puede reubicar, debe ser una constante en el momento de ensamblado" + +#: config/tc-cris.c:2941 +#, c-format +msgid "Cannot generate relocation type for symbol %s, code %s" +msgstr "No se puede generar el tipo de reubicación para el símbolo %s, código %s" + +#. The messages are formatted to line up with the generic options. +#: config/tc-cris.c:2955 +msgid "CRIS-specific options:\n" +msgstr "Opciones específicas de CRIS:\n" + +#: config/tc-cris.c:2957 +msgid " -h, -H Don't execute, print this help text. Deprecated.\n" +msgstr " -h, -H No ejecutar, muestra este texto de ayuda. Deprecado.\n" + +#: config/tc-cris.c:2959 +msgid " -N Warn when branches are expanded to jumps.\n" +msgstr " -N Avisar cuando las ramificaciones se expanden a saltos.\n" + +#: config/tc-cris.c:2961 +msgid " --underscore User symbols are normally prepended with underscore.\n" +msgstr " --underscore Los símbolos de usuario generalmente se preceden con subrayado.\n" + +#: config/tc-cris.c:2963 +msgid " Registers will not need any prefix.\n" +msgstr " Los registros no necesitarán ningún prefijo.\n" + +#: config/tc-cris.c:2965 +msgid " --no-underscore User symbols do not have any prefix.\n" +msgstr " --no-underscore Los símbolos de usuario no tienen ningún prefijo.\n" + +#: config/tc-cris.c:2967 +msgid " Registers will require a `$'-prefix.\n" +msgstr " Los registros requerirán un prefijo `$'.\n" + +#: config/tc-cris.c:2969 +msgid " --pic\t\t\tEnable generation of position-independent code.\n" +msgstr " --pic\t\t\tActiva la generación de código independiente de posición.\n" + +#: config/tc-cris.c:2992 +msgid "Invalid relocation" +msgstr "Reubicación inválida" + +#: config/tc-cris.c:3033 +msgid "Invalid pc-relative relocation" +msgstr "Reubicación relativa a pc inválida" + +#: config/tc-cris.c:3084 +#, c-format +msgid "Adjusted signed .word (%ld) overflows: `switch'-statement too large." +msgstr "El .word (%ld) con signo ajustado se desborda: la sentencia `switch' es demasiado grande." + +#: config/tc-cris.c:3111 +#, c-format +msgid ".syntax %s requires command-line option `--underscore'" +msgstr ".syntax %s requiere de la opción de línea de comandos `--underscore'" + +#: config/tc-cris.c:3120 +#, c-format +msgid ".syntax %s requires command-line option `--no-underscore'" +msgstr ".syntax %s requiere de la opción de línea de comandos `--no-underscore'" + +#: config/tc-cris.c:3158 +msgid "Unknown .syntax operand" +msgstr "Operando .syntax inválido" + +#: config/tc-cris.c:3169 +msgid "Pseudodirective .file is only valid when generating ELF" +msgstr "La pseudodirectiva .file es válida solamente cuando se genera ELF" + +#: config/tc-cris.c:3182 +msgid "Pseudodirective .loc is only valid when generating ELF" +msgstr "La pseudodirectiva .loc es válida solamente cuando se genera ELF" + +#: config/tc-d10v.c:247 +msgid "" +"D10V options:\n" +"-O Optimize. Will do some operations in parallel.\n" +"--gstabs-packing Pack adjacent short instructions together even\n" +" when --gstabs is specified. On by default.\n" +"--no-gstabs-packing If --gstabs is specified, do not pack adjacent\n" +" instructions together.\n" +msgstr "" +"Opciones D10V:\n" +"-O Optimizar. Hará algunas operaciones en paralelo.\n" +"--gstabs-packing Empaquetar juntas las instrucciones short adyacentes aún\n" +" cuando se especifique --gstabs. Activado por omisión.\n" +"--no-gstabs-packing Si se especifica --gstabs, no empaqueta juntas\n" +" las instrucciones adjacentes.\n" + +#: config/tc-d10v.c:538 config/tc-d30v.c:550 config/tc-mn10200.c:937 config/tc-mn10300.c:1308 config/tc-ppc.c:2104 config/tc-s390.c:1052 config/tc-tic80.c:279 config/tc-v850.c:2070 +msgid "illegal operand" +msgstr "operando ilegal" + +#: config/tc-d10v.c:581 config/tc-d10v.c:663 config/tc-d30v.c:656 +#, c-format +msgid "operand out of range: %d" +msgstr "operando fuera de rango: %d" + +#: config/tc-d10v.c:724 +msgid "Instruction must be executed in parallel with another instruction." +msgstr "La instrucción debe ser ejecutada en paralelo con otra instrucción." + +#: config/tc-d10v.c:780 +msgid "Instruction must be executed in parallel" +msgstr "La instrucción debe ser ejecutada en paralelo" + +#: config/tc-d10v.c:783 +msgid "Long instructions may not be combined." +msgstr "Las instrucciones long no se pueden combinar." + +#: config/tc-d10v.c:817 +msgid "One of these instructions may not be executed in parallel." +msgstr "Una de estas instrucciones no se puede ejecutar en paralelo." + +#: config/tc-d10v.c:821 config/tc-d30v.c:877 +msgid "Two IU instructions may not be executed in parallel" +msgstr "Dos instrucciones IU no se pueden ejecutar en paralelo" + +#: config/tc-d10v.c:823 config/tc-d10v.c:831 config/tc-d10v.c:844 config/tc-d10v.c:859 config/tc-d30v.c:878 config/tc-d30v.c:887 +msgid "Swapping instruction order" +msgstr "Intercambiando el orden de la instrucción" + +#: config/tc-d10v.c:829 config/tc-d30v.c:884 +msgid "Two MU instructions may not be executed in parallel" +msgstr "Dos instrucciones MU no se pueden ejecutar en paralelo" + +#: config/tc-d10v.c:848 config/tc-d30v.c:904 +msgid "IU instruction may not be in the left container" +msgstr "Una instrucción IU no puede estar en el contenedor izquierdo" + +# Parece que R es 'right' y L es 'left'. Revisar el código para comprobar +# y mejorar esta traducción. cfuga +#: config/tc-d10v.c:850 config/tc-d10v.c:865 +msgid "Instruction in R container is squashed by flow control instruction in L container." +msgstr "La instrucción en el contenedor R es aplastada por la instrucción de control de flujo en el contenedor L." + +#: config/tc-d10v.c:863 config/tc-d30v.c:915 +msgid "MU instruction may not be in the right container" +msgstr "Una instrucción MU no puede estar en el contenedor derecho" + +#: config/tc-d10v.c:869 config/tc-d30v.c:927 +msgid "unknown execution type passed to write_2_short()" +msgstr "tipo de ejecución desconocido pasado a write_2_short()" + +#: config/tc-d10v.c:1128 config/tc-d10v.c:1149 config/tc-d30v.c:1411 +msgid "Unable to mix instructions as specified" +msgstr "No se pueden mezclar las instrucciones como se especificó" + +#: config/tc-d10v.c:1196 config/tc-d30v.c:1548 +#, c-format +msgid "unknown opcode: %s" +msgstr "código de operación desconocido: %s" + +#: config/tc-d10v.c:1279 config/tc-d10v.c:1451 config/tc-tic80.c:536 +msgid "bad opcode or operands" +msgstr "código de operación u operandos erróneos" + +#: config/tc-d10v.c:1352 config/tc-m68k.c:4310 +msgid "value out of range" +msgstr "valor fuera de rango" + +#: config/tc-d10v.c:1426 +msgid "illegal operand - register name found where none expected" +msgstr "operando ilegal - se encontró un nombre de registro donde no se esperaba ninguno" + +#: config/tc-d10v.c:1462 config/tc-tic80.c:547 +msgid "Register number must be EVEN" +msgstr "El número de registro debe ser PAR" + +#: config/tc-d10v.c:1465 +msgid "Unsupported use of sp" +msgstr "Uso sin soporte de sp" + +#: config/tc-d10v.c:1614 +#, c-format +msgid "line %d: rep or repi must include at least 4 instructions" +msgstr "línea %d: rep o repi debe incluir por lo menos 4 instrucciones" + +#: config/tc-d30v.c:192 +#, c-format +msgid "Register name %s conflicts with symbol of the same name" +msgstr "El nombre de registro %s tiene conflictos con el símbolo del mismo nombre" + +#: config/tc-d30v.c:288 +msgid "" +"\n" +"D30V options:\n" +"-O Make adjacent short instructions parallel if possible.\n" +"-n Warn about all NOPs inserted by the assembler.\n" +"-N\t\t\tWarn about NOPs inserted after word multiplies.\n" +"-c Warn about symbols whoes names match register names.\n" +"-C Opposite of -C. -c is the default.\n" +msgstr "" +"\n" +"Opciones D30V:\n" +"-O Hacer adjacentes las instrucciones paralelas short si es posible.\n" +"-n Avisar sobre todos los NOPs insertados por el ensamblador.\n" +"-N\t\t\tAvisar sobre los NOPs insertados después de los múltiplos de word.\n" +"-c Avisar sobre los símbolos cuyos nombres coincidan con nombres de registros.\n" +"-C Opuesto de -C. -c es por omisión.\n" + +#: config/tc-d30v.c:462 +msgid "unexpected 12-bit reloc type" +msgstr "tipo de reubicación de 12-bit inesperado" + +#: config/tc-d30v.c:469 +msgid "unexpected 18-bit reloc type" +msgstr "tipo de reubicación de 18-bit inesperado" + +#: config/tc-d30v.c:720 +#, c-format +msgid "%s NOP inserted" +msgstr "%s NOP insertados" + +#: config/tc-d30v.c:721 +msgid "sequential" +msgstr "secuencial" + +#: config/tc-d30v.c:721 +msgid "parallel" +msgstr "paralelo" + +#: config/tc-d30v.c:873 +msgid "Instructions may not be executed in parallel" +msgstr "Las instrucciones no se pueden ejecutar en paralelo" + +#: config/tc-d30v.c:886 +#, c-format +msgid "Executing %s in IU may not work" +msgstr "Ejecutar %s en IU podría no funcionar" + +#: config/tc-d30v.c:893 +#, c-format +msgid "Executing %s in IU may not work in parallel execution" +msgstr "Ejecutar %s en IU podría no funcionar en ejecución paralela" + +#: config/tc-d30v.c:906 +#, c-format +msgid "special left instruction `%s' kills instruction `%s' in right container" +msgstr "la instrucción especial izquierda `%s' mata a la instrucción `%s' en el contenedor derecho" + +#: config/tc-d30v.c:917 +#, c-format +msgid "Executing %s in reverse serial with %s may not work" +msgstr "Ejecutar %s en serie reversa con %s podría no funcionar" + +#: config/tc-d30v.c:920 +#, c-format +msgid "Executing %s in IU in reverse serial may not work" +msgstr "Ejecutar %s en IU en serie reversa podría no funcionar" + +#: config/tc-d30v.c:1290 config/tc-d30v.c:1307 +msgid "Cannot assemble instruction" +msgstr "No se puede ensamblar la instrucción" + +#: config/tc-d30v.c:1292 +msgid "First opcode is long. Unable to mix instructions as specified." +msgstr "El primer código de operación es long. No se pueden mezclar las instrucciones como se especificó." + +#: config/tc-d30v.c:1361 +msgid "word of NOPs added between word multiply and load" +msgstr "word de NOPs agregados entre múltiplos de word y load" + +#: config/tc-d30v.c:1363 +msgid "word of NOPs added between word multiply and 16-bit multiply" +msgstr "word de NOPs agregados entre múltiplos de word y múltiplos de 16-bit" + +#: config/tc-d30v.c:1395 +msgid "Instruction uses long version, so it cannot be mixed as specified" +msgstr "La instrucción usa una versión long, así que no se puede mezclar como se especificó" + +#: config/tc-d30v.c:1478 config/tc-d30v.c:1516 +#, c-format +msgid "unknown condition code: %s" +msgstr "código de condición desconocido: %s" + +#: config/tc-d30v.c:1509 +#, c-format +msgid "cmpu doesn't support condition code %s" +msgstr "cmpu no tiene soporte para el código de condición %s" + +#: config/tc-d30v.c:1559 +#, c-format +msgid "operands for opcode `%s' do not match any valid format" +msgstr "los operandos para el código de operación `%s' no coincide con ningún formato válido" + +#: config/tc-d30v.c:1777 +msgid "Odd numbered register used as target of multi-register instruction" +msgstr "Los registros numerados nones se usan como objetivo para una instrucción multi-registro" + +#: config/tc-d30v.c:1876 +#, c-format +msgid "line %d: unable to place address of symbol '%s' into a byte" +msgstr "línea %d: no se puede colocar la dirección del símbolo '%s' en un byte" + +#: config/tc-d30v.c:1879 +#, c-format +msgid "line %d: unable to place value %x into a byte" +msgstr "línea %d: no se puede colocar el valor %x en un byte" + +#: config/tc-d30v.c:1887 +#, c-format +msgid "line %d: unable to place address of symbol '%s' into a short" +msgstr "línea %d: no se puede colocar la dirección del símbolo '%s' en un short" + +#: config/tc-d30v.c:1890 +#, c-format +msgid "line %d: unable to place value %x into a short" +msgstr "línea %d: no se puede colocar el valor %x en un short" + +#: config/tc-d30v.c:1898 +#, c-format +msgid "line %d: unable to place address of symbol '%s' into a quad" +msgstr "línea %d: no se puede colocar la dirección del símbolo '%s' en un quad" + +#: config/tc-d30v.c:2067 +#, c-format +msgid "value too large to fit in %d bits" +msgstr "valor demasiado grande para caber en %d bits" + +#: config/tc-d30v.c:2210 +#, c-format +msgid "Alignment too large: %d assumed" +msgstr "Alineación demasiado grande: se asume %d" + +#: config/tc-fr30.c:84 +msgid " FR30 specific command line options:\n" +msgstr " Opciones de línea de comando específicas de FR30:\n" + +#: config/tc-fr30.c:143 config/tc-openrisc.c:150 +#, c-format +msgid "Instruction %s not allowed in a delay slot." +msgstr "No se permite la instrucción %s en una ranura de retardo." + +#: config/tc-fr30.c:383 config/tc-m32r.c:1559 +msgid "Addend to unresolved symbol not on word boundary." +msgstr "La adición para un símbolo sin resolver no está en un límite de word." + +#: config/tc-fr30.c:540 config/tc-i960.c:773 config/tc-m32r.c:1867 config/tc-openrisc.c:468 +msgid "Bad call to md_atof()" +msgstr "Llamada errónea a md_atof()" + +#: config/tc-h8300.c:64 config/tc-h8300.c:75 config/tc-h8300.c:134 config/tc-hppa.c:1422 config/tc-hppa.c:6915 config/tc-hppa.c:6921 config/tc-hppa.c:6927 config/tc-hppa.c:6933 config/tc-mn10300.c:900 config/tc-mn10300.c:2164 +msgid "could not set architecture and machine" +msgstr "no se pueden establecer la arquitectura y la máquina" + +#: config/tc-h8300.c:262 config/tc-h8300.c:270 +msgid "Reg not valid for H8/300" +msgstr "El registro no es válido para H8/300" + +#: config/tc-h8300.c:430 config/tc-h8300.c:433 config/tc-h8300.c:436 config/tc-h8300.c:440 +msgid "Invalid register list for ldm/stm\n" +msgstr "Lista de registros inválida para ldm/stm\n" + +#: config/tc-h8300.c:492 config/tc-h8300.c:554 config/tc-h8300.c:561 +msgid "Wrong size pointer register for architecture." +msgstr "Tamaño de apuntador a registro erróneo para la arquitectura." + +#: config/tc-h8300.c:519 config/tc-h8300.c:528 config/tc-h8300.c:538 +msgid "expected @(exp, reg16)" +msgstr "se esperaba @(exp, reg16)" + +#: config/tc-h8300.c:617 +msgid "expect :8 or :16 here" +msgstr "se esperaba :8 ó :16 aquí" + +#: config/tc-h8300.c:818 +#, c-format +msgid "operand %s0x%lx out of range." +msgstr "operando %s0x%lx fuera de rango." + +#: config/tc-h8300.c:906 +msgid "Can't work out size of operand.\n" +msgstr "No se puede obtener el tamaño del operando.\n" + +#: config/tc-h8300.c:954 +#, c-format +msgid "Opcode `%s' with these operand types not available in H8/300 mode" +msgstr "El código de operación `%s' con esos tipos de operando no están disponibles en el modo H8/300" + +#: config/tc-h8300.c:1005 config/tc-h8300.c:1025 +msgid "Need #1 or #2 here" +msgstr "Se necesita #1 ó #2 aquí" + +#: config/tc-h8300.c:1020 +msgid "#4 not valid on H8/300." +msgstr "#4 no es válido en H8/300" + +#: config/tc-h8300.c:1107 config/tc-h8300.c:1157 +#, c-format +msgid "branch operand has odd offset (%lx)\n" +msgstr "el operando de ramificación tiene un desplazamiento non (%lx)\n" + +#: config/tc-h8300.c:1195 +msgid "destination operand must be 16 bit register" +msgstr "el operando de destino debe ser un registro de 16 bit" + +#: config/tc-h8300.c:1204 +msgid "source operand must be 8 bit register" +msgstr "el operando de origen debe ser un registro de 8 bit" + +#: config/tc-h8300.c:1212 +msgid "destination operand must be 16bit absolute address" +msgstr "el operando de destino debe ser una dirección absoluta de 16bit" + +#: config/tc-h8300.c:1219 +msgid "destination operand must be 8 bit register" +msgstr "el operando de destino debe ser un registro de 8 bit" + +#: config/tc-h8300.c:1227 +msgid "source operand must be 16bit absolute address" +msgstr "el operando de origen debe ser una dirección absoluta de 16bit" + +#. This seems more sane than saying "too many operands". We'll +#. get here only if the trailing trash starts with a comma. +#: config/tc-h8300.c:1235 config/tc-mmix.c:452 config/tc-mmix.c:464 config/tc-mmix.c:2485 config/tc-mmix.c:2509 config/tc-mmix.c:2774 +msgid "invalid operands" +msgstr "operandos inválidos" + +#: config/tc-h8300.c:1286 config/tc-h8500.c:1094 config/tc-mips.c:8649 config/tc-sh.c:1907 config/tc-w65.c:733 config/tc-z8k.c:1202 +msgid "unknown opcode" +msgstr "código de operación desconocido" + +#: config/tc-h8300.c:1332 +msgid "mismatch between opcode size and operand size" +msgstr "no hay coincidencia entre el tamaño del código de operación y el tamaño del operando" + +#: config/tc-h8300.c:1344 config/tc-h8500.c:1121 config/tc-sh.c:2045 config/tc-w65.c:763 config/tc-z8k.c:1255 +msgid "call to tc_crawl_symbol_chain \n" +msgstr "llamada a tc_crawl_symbol_chain \n" + +#: config/tc-h8300.c:1360 config/tc-h8500.c:1135 config/tc-sh.c:2052 config/tc-w65.c:777 config/tc-z8k.c:1269 +msgid "call to tc_headers_hook \n" +msgstr "llamada a tc_headers_hook \n" + +#: config/tc-h8300.c:1452 config/tc-h8500.c:1225 config/tc-z8k.c:1383 +msgid "call to tc_aout_fix_to_chars \n" +msgstr "llamada a tc_aout_fix_to_chars \n" + +#: config/tc-h8300.c:1466 config/tc-z8k.c:1393 +msgid "call to md_convert_frag \n" +msgstr "llamada a md_convert_frag \n" + +#: config/tc-h8300.c:1528 config/tc-z8k.c:1479 +msgid "call tomd_estimate_size_before_relax \n" +msgstr "llamada a tomd_estimate_size_before_relax \n" + +#: config/tc-h8300.c:1649 config/tc-mcore.c:2413 config/tc-pj.c:572 config/tc-sh.c:3367 +#, c-format +msgid "Cannot represent relocation type %s" +msgstr "No se puede representar el tipo de reubicación %s" + +#: config/tc-h8500.c:323 +msgid ":24 not valid for this opcode" +msgstr ":24 no es válido para este código de operación" + +#: config/tc-h8500.c:330 +msgid "expect :8,:16 or :24" +msgstr "se esperaba :8,:16 ó :24" + +#: config/tc-h8500.c:387 +msgid "syntax error in reg list" +msgstr "error sintáctico en la lista de registros" + +#: config/tc-h8500.c:405 +msgid "missing final register in range" +msgstr "falta el registro final en el rango" + +#: config/tc-h8500.c:492 config/tc-h8500.c:499 config/tc-h8500.c:505 +msgid "expected @(exp, Rn)" +msgstr "se esperaba @(exp, Rn)" + +#: config/tc-h8500.c:521 +msgid "@Rn+ needs word register" +msgstr "@Rn+ necesita un registro word" + +#: config/tc-h8500.c:531 +msgid "@Rn needs word register" +msgstr "@Rn necesita un registro word" + +#: config/tc-h8500.c:828 config/tc-sh.c:1403 +#, c-format +msgid "unhandled %d\n" +msgstr "%d sin manejar\n" + +#: config/tc-h8500.c:856 +#, c-format +msgid "operand must be absolute in range %d..%d" +msgstr "el operando debe ser absoluto en el rango %d..%d" + +#: config/tc-h8500.c:945 config/tc-sh.c:1610 +#, c-format +msgid "failed for %d\n" +msgstr "falló para %d\n" + +#: config/tc-h8500.c:1110 config/tc-sh.c:1711 config/tc-sh.c:1956 config/tc-w65.c:752 +msgid "invalid operands for opcode" +msgstr "operandos inválidos para el código de operación" + +#. Simple range checking for FIELD againt HIGH and LOW bounds. +#. IGNORE is used to suppress the error message. +#: config/tc-hppa.c:1155 config/tc-hppa.c:1169 +#, c-format +msgid "Field out of range [%d..%d] (%d)." +msgstr "Campo fuera de rango [%d..%d] (%d)." + +#. Simple alignment checking for FIELD againt ALIGN (a power of two). +#. IGNORE is used to suppress the error message. +#: config/tc-hppa.c:1183 +#, c-format +msgid "Field not properly aligned [%d] (%d)." +msgstr "Campo no alineado adecuadamente [%d] (%d)." + +#: config/tc-hppa.c:1212 +msgid "Missing .exit\n" +msgstr "Falta un .exit\n" + +#: config/tc-hppa.c:1215 +msgid "Missing .procend\n" +msgstr "Falta un .procend\n" + +#: config/tc-hppa.c:1395 +#, c-format +msgid "Invalid field selector. Assuming F%%." +msgstr "Selector de campo inválido. Se asume F%%." + +#: config/tc-hppa.c:1428 +msgid "-R option not supported on this target." +msgstr "la opción -R no tiene soporte en este objetivo." + +#: config/tc-hppa.c:1444 config/tc-sparc.c:803 config/tc-sparc.c:839 +#, c-format +msgid "Internal error: can't hash `%s': %s\n" +msgstr "Error interno: no se puede dispersar `%s': %s\n" + +#: config/tc-hppa.c:1452 config/tc-i860.c:190 +#, c-format +msgid "internal error: losing opcode: `%s' \"%s\"\n" +msgstr "error interno: se pierde el código de operación: `%s' \"%s\"\n" + +#: config/tc-hppa.c:1523 config/tc-hppa.c:7054 config/tc-hppa.c:7111 +msgid "Missing function name for .PROC (corrupted label chain)" +msgstr "Falta el nombre de función para .PROC (cadena de etiquetas corrupta)" + +#: config/tc-hppa.c:1526 config/tc-hppa.c:7114 +msgid "Missing function name for .PROC" +msgstr "Falta el nombre de función para .PROC" + +#: config/tc-hppa.c:1633 config/tc-hppa.c:4911 +msgid "could not update architecture and machine" +msgstr "no se puede actualizar la arquitectura y la máquina" + +#: config/tc-hppa.c:1841 +msgid "Invalid Indexed Load Completer." +msgstr "Completador de Carga Indizado Inválido." + +#: config/tc-hppa.c:1846 +msgid "Invalid Indexed Load Completer Syntax." +msgstr "Sintaxis de Completador de Carga Indizado Inválido." + +#: config/tc-hppa.c:1883 +msgid "Invalid Short Load/Store Completer." +msgstr "Completador Short de Load/Store Inválido." + +#: config/tc-hppa.c:1943 config/tc-hppa.c:1948 +msgid "Invalid Store Bytes Short Completer" +msgstr "Completador de Store Bytes Short Inválido." + +#: config/tc-hppa.c:2259 config/tc-hppa.c:2265 +msgid "Invalid left/right combination completer" +msgstr "Completador de combinación derecha/izquierda inválido" + +#: config/tc-hppa.c:2314 config/tc-hppa.c:2321 +msgid "Invalid permutation completer" +msgstr "Completador de permutación inválido" + +#: config/tc-hppa.c:2422 +#, c-format +msgid "Invalid Add Condition: %s" +msgstr "Condición de Adición Inválida: %s" + +#: config/tc-hppa.c:2433 config/tc-hppa.c:2443 +msgid "Invalid Add and Branch Condition" +msgstr "Condición de Adición y Ramificación Inválida" + +#: config/tc-hppa.c:2464 config/tc-hppa.c:2602 +msgid "Invalid Compare/Subtract Condition" +msgstr "Condición de Comparación/Sustracción Inválida" + +#: config/tc-hppa.c:2504 +#, c-format +msgid "Invalid Bit Branch Condition: %c" +msgstr "Condición de Ramificación de Bit Inválida: %c" + +#: config/tc-hppa.c:2590 +#, c-format +msgid "Invalid Compare/Subtract Condition: %s" +msgstr "Condición de Comparación/Sustracción Inválida: %s" + +#: config/tc-hppa.c:2617 +msgid "Invalid Compare and Branch Condition" +msgstr "Condición de Comparación y Ramificación Inválida" + +#: config/tc-hppa.c:2713 +msgid "Invalid Logical Instruction Condition." +msgstr "Condición de Instrucción Lógica Inválida." + +#: config/tc-hppa.c:2768 +msgid "Invalid Shift/Extract/Deposit Condition." +msgstr "Condición Desplazar/Extraer/Depositar Inválida." + +#: config/tc-hppa.c:2880 +msgid "Invalid Unit Instruction Condition." +msgstr "Condición de Instrucción Unit Inválida." + +#: config/tc-hppa.c:3257 config/tc-hppa.c:3289 config/tc-hppa.c:3320 config/tc-hppa.c:3350 +msgid "Branch to unaligned address" +msgstr "Ramificación a dirección sin alinear" + +#: config/tc-hppa.c:3528 +msgid "Invalid SFU identifier" +msgstr "Identificador SFU inválido" + +#: config/tc-hppa.c:3578 +msgid "Invalid COPR identifier" +msgstr "Identificador COPR inválido" + +#: config/tc-hppa.c:3707 +msgid "Invalid Floating Point Operand Format." +msgstr "Formato de Operando de Coma Flotante Inválido." + +#: config/tc-hppa.c:3824 config/tc-hppa.c:3844 config/tc-hppa.c:3864 config/tc-hppa.c:3884 config/tc-hppa.c:3904 +msgid "Invalid register for single precision fmpyadd or fmpysub" +msgstr "Registro inválido para fmpyadd ó fmpysub de precisión simple" + +#: config/tc-hppa.c:3961 +#, c-format +msgid "Invalid operands %s" +msgstr "Operandos inválidos %s" + +#: config/tc-hppa.c:4079 +msgid "Cannot handle fixup" +msgstr "No se puede manejar la compostura" + +#: config/tc-hppa.c:4380 +msgid " -Q ignored\n" +msgstr " -Q ignorado\n" + +#: config/tc-hppa.c:4384 +msgid " -c print a warning if a comment is found\n" +msgstr " -c mostrar un aviso si se encuentra un comentario\n" + +#: config/tc-hppa.c:4455 +#, c-format +msgid "no hppa_fixup entry for fixup type 0x%x" +msgstr "no hay una entrada hppa_fixup para el tipo de compostura 0x%x" + +#: config/tc-hppa.c:4633 +msgid "Unknown relocation encountered in md_apply_fix." +msgstr "Se encontró una reubicación desconocida en md_apply_fix." + +#: config/tc-hppa.c:4775 config/tc-hppa.c:4800 +#, c-format +msgid "Undefined register: '%s'." +msgstr "Registro indefinido: '%s'." + +#: config/tc-hppa.c:4834 +#, c-format +msgid "Non-absolute symbol: '%s'." +msgstr "Símbolo no absoluto: '%s'." + +#: config/tc-hppa.c:4849 +#, c-format +msgid "Undefined absolute constant: '%s'." +msgstr "Constante absoluta indefinida: '%s'." + +#: config/tc-hppa.c:4950 +#, c-format +msgid "Invalid FP Compare Condition: %s" +msgstr "Condición de Comparación de FP Inválida: %s" + +#: config/tc-hppa.c:5006 +#, c-format +msgid "Invalid FTEST completer: %s" +msgstr "Completador FTEST inválido: %s" + +#: config/tc-hppa.c:5073 config/tc-hppa.c:5111 +#, c-format +msgid "Invalid FP Operand Format: %3s" +msgstr "Formato de Operando FP Inválido: %3s" + +#: config/tc-hppa.c:5190 +msgid "Bad segment in expression." +msgstr "Segmento erróneo en la expresión." + +#: config/tc-hppa.c:5249 +msgid "Bad segment (should be absolute)." +msgstr "Segmento erróneo (debe ser absoluto)." + +#: config/tc-hppa.c:5292 +#, c-format +msgid "Invalid argument location: %s\n" +msgstr "Ubicación de argumento inválida: %s\n" + +#: config/tc-hppa.c:5323 +#, c-format +msgid "Invalid argument description: %d" +msgstr "Descripción de argumento inválida: %d" + +#: config/tc-hppa.c:5346 +#, c-format +msgid "Invalid Nullification: (%c)" +msgstr "Nulificación Inválida: (%c)" + +#: config/tc-hppa.c:6066 +#, c-format +msgid "Invalid .CALL argument: %s" +msgstr "Argumento de .CALL inválido: %s" + +#: config/tc-hppa.c:6188 +msgid ".callinfo is not within a procedure definition" +msgstr ".callinfo no está dentro de una definición de procedimiento" + +#: config/tc-hppa.c:6208 +#, c-format +msgid "FRAME parameter must be a multiple of 8: %d\n" +msgstr "El parámetro FRAM debe ser un múltiplo de 8: %d\n" + +#: config/tc-hppa.c:6227 +msgid "Value for ENTRY_GR must be in the range 3..18\n" +msgstr "El valor para ENTRY_GR debe estar en el rango 3..18\n" + +#: config/tc-hppa.c:6239 +msgid "Value for ENTRY_FR must be in the range 12..21\n" +msgstr "El valor para ENTRY_FR debe estar en el rango 12..21\n" + +#: config/tc-hppa.c:6249 +msgid "Value for ENTRY_SR must be 3\n" +msgstr "El valor para ENTRY_SR debe ser 3\n" + +#: config/tc-hppa.c:6305 +#, c-format +msgid "Invalid .CALLINFO argument: %s" +msgstr "Argumento de .CALLINFO inválido: %s" + +#: config/tc-hppa.c:6416 +msgid "The .ENTER pseudo-op is not supported" +msgstr "El pseudo-operador .ENTER no tiene soporte" + +#: config/tc-hppa.c:6432 +msgid "Misplaced .entry. Ignored." +msgstr ".entry mal colocado. Ignorado." + +#: config/tc-hppa.c:6436 +msgid "Missing .callinfo." +msgstr "Falta un .callinfo." + +#: config/tc-hppa.c:6502 +msgid ".REG expression must be a register" +msgstr "la expresión .REG debe ser un registro" + +#: config/tc-hppa.c:6518 +msgid "bad or irreducible absolute expression; zero assumed" +msgstr "expresión absoluta errónea o irreducible; se asume cero" + +#: config/tc-hppa.c:6529 +msgid ".REG must use a label" +msgstr ".REG debe usar una etiqueta" + +#: config/tc-hppa.c:6531 +msgid ".EQU must use a label" +msgstr ".EQU debe usar una etiqueta" + +#: config/tc-hppa.c:6584 +msgid ".EXIT must appear within a procedure" +msgstr ".EXIT debe aparecer dentro de un procedimiento" + +#: config/tc-hppa.c:6588 +msgid "Missing .callinfo" +msgstr "Falta un .callinfo" + +#: config/tc-hppa.c:6592 +msgid "No .ENTRY for this .EXIT" +msgstr "No hay .ENTRY para este .EXIT" + +#: config/tc-hppa.c:6619 +#, c-format +msgid "Cannot define export symbol: %s\n" +msgstr "No se puede definir el símbolo de exportación: %s\n" + +#: config/tc-hppa.c:6677 +#, c-format +msgid "Using ENTRY rather than CODE in export directive for %s" +msgstr "Utilizando ENTRY en lugar de CODE en la directiva de exportación para %s" + +#: config/tc-hppa.c:6794 +#, c-format +msgid "Undefined .EXPORT/.IMPORT argument (ignored): %s" +msgstr "Argumento de .EXPORT/.IMPORT indefinido (ignorado): %s" + +#: config/tc-hppa.c:6876 +msgid "Missing label name on .LABEL" +msgstr "Falta el nombre de etiqueta en .LABEL" + +#: config/tc-hppa.c:6881 +msgid "extra .LABEL arguments ignored." +msgstr "se ignoran los argumentos extra de .LABEL." + +#: config/tc-hppa.c:6898 +msgid "The .LEAVE pseudo-op is not supported" +msgstr "El pseudo-operador .LEAVE no tiene soporte" + +#: config/tc-hppa.c:6937 +msgid "Unrecognized .LEVEL argument\n" +msgstr "No se reconoce el argumento de .LEVEL\n" + +#: config/tc-hppa.c:6973 +#, c-format +msgid "Cannot define static symbol: %s\n" +msgstr "No se puede definir el símbolo estático: %s\n" + +#: config/tc-hppa.c:7008 +msgid "Nested procedures" +msgstr "Procedimientos anidados" + +#: config/tc-hppa.c:7018 +msgid "Cannot allocate unwind descriptor\n" +msgstr "No se puede asignar un descriptor de desenredo\n" + +#: config/tc-hppa.c:7118 +msgid "misplaced .procend" +msgstr ".procend mal colocado" + +#: config/tc-hppa.c:7121 +msgid "Missing .callinfo for this procedure" +msgstr "Falta un .callinfo para este procedimiento" + +#: config/tc-hppa.c:7124 +msgid "Missing .EXIT for a .ENTRY" +msgstr "Falta un .EXIT para un .ENTRY" + +#: config/tc-hppa.c:7162 +msgid "Not in a space.\n" +msgstr "No está en un espacio.\n" + +#: config/tc-hppa.c:7165 +msgid "Not in a subspace.\n" +msgstr "No está en un subespacio.\n" + +#: config/tc-hppa.c:7256 +msgid "Invalid .SPACE argument" +msgstr "Argumento de .SPACE inválido" + +#: config/tc-hppa.c:7303 +msgid "Can't change spaces within a procedure definition. Ignored" +msgstr "No se pueden cambiar espacios dentro de una definición de procedimiento. Ignorado" + +#: config/tc-hppa.c:7432 +#, c-format +msgid "Undefined space: '%s' Assuming space number = 0." +msgstr "Espacio indefinido: '%s' Se asume que el número de espacio = 0." + +#: config/tc-hppa.c:7456 +msgid "Must be in a space before changing or declaring subspaces.\n" +msgstr "Debe estar en un espacio antes de cambiar o declarar subespacios.\n" + +#: config/tc-hppa.c:7460 +msgid "Can't change subspaces within a procedure definition. Ignored" +msgstr "No se pueden cambiar subespacios dentro de una definición de procedimiento. Ignorado" + +#: config/tc-hppa.c:7495 +msgid "Parameters of an existing subspace can't be modified" +msgstr "No se pueden modificar los parámetros de un subespacio existente" + +#: config/tc-hppa.c:7546 +msgid "Alignment must be a power of 2" +msgstr "La alineación debe ser una potencia de 2" + +#: config/tc-hppa.c:7588 +msgid "FIRST not supported as a .SUBSPACE argument" +msgstr "FIRST no tiene soporte como un argumento de .SUBSPACE" + +#: config/tc-hppa.c:7590 +msgid "Invalid .SUBSPACE argument" +msgstr "Argumento de .SUBSPACE inválido" + +#: config/tc-hppa.c:7770 +#, c-format +msgid "Internal error: Unable to find containing space for %s." +msgstr "Error interno: No se puede encontrar el espacio contenedor para %s." + +#: config/tc-hppa.c:7809 +#, c-format +msgid "Out of memory: could not allocate new space chain entry: %s\n" +msgstr "Memoria agotada: no se puede asignar una nueva entrada de cadena de espacio: %s\n" + +#: config/tc-hppa.c:7895 +#, c-format +msgid "Out of memory: could not allocate new subspace chain entry: %s\n" +msgstr "Memoria agotada: no se puede asignar una nueva entrada de cadena de subespacio: %s\n" + +#: config/tc-hppa.c:8589 +#, c-format +msgid "Symbol '%s' could not be created." +msgstr "No se puede crear el símbolo '%s'." + +#: config/tc-hppa.c:8593 +msgid "No memory for symbol name." +msgstr "No hay memoria para el nombre del símbolo." + +#: config/tc-i386.c:594 +#, c-format +msgid "%s shortened to %s" +msgstr "%s reducido a %s" + +#: config/tc-i386.c:649 +msgid "same type of prefix used twice" +msgstr "se utilizó dos veces el mismo tipo de prefijo" + +#: config/tc-i386.c:667 +msgid "64bit mode not supported on this CPU." +msgstr "el modo de 64bit no tiene soporte en este CPU." + +#: config/tc-i386.c:671 +msgid "32bit mode not supported on this CPU." +msgstr "el modo de 32bit no tiene soporte en este CPU." + +#: config/tc-i386.c:704 +msgid "bad argument to syntax directive." +msgstr "argumento erróneo para la directiva de sintaxis." + +#: config/tc-i386.c:748 +#, c-format +msgid "no such architecture: `%s'" +msgstr "no hay tal arquitectura: `%s'" + +#: config/tc-i386.c:753 +msgid "missing cpu architecture" +msgstr "falta la arquitectura de cpu" + +#: config/tc-i386.c:767 +#, c-format +msgid "no such architecture modifier: `%s'" +msgstr "no hay tal modificador de arquitectura: `%s'" + +#: config/tc-i386.c:821 config/tc-i386.c:4628 +msgid "Unknown architecture" +msgstr "Arquitectura desconocida" + +#: config/tc-i386.c:856 config/tc-i386.c:879 config/tc-m68k.c:3826 +#, c-format +msgid "Internal Error: Can't hash %s: %s" +msgstr "Error Interno: No se puede dispersar %s: %s" + +#: config/tc-i386.c:1132 +msgid "There are no unsigned pc-relative relocations" +msgstr "No hay reubicaciones relativas a pc sin signo" + +#: config/tc-i386.c:1139 config/tc-i386.c:4827 +#, c-format +msgid "can not do %d byte pc-relative relocation" +msgstr "no se puede hacer la reubicación relativa a pc de %d bytes" + +#: config/tc-i386.c:1156 +#, c-format +msgid "can not do %s %d byte relocation" +msgstr "no se puede hacer la reubicación %s de %d byte" + +#: config/tc-i386.c:1263 config/tc-i386.c:1357 +#, c-format +msgid "no such instruction: `%s'" +msgstr "no hay tal instrucción: `%s'" + +#: config/tc-i386.c:1273 config/tc-i386.c:1389 +#, c-format +msgid "invalid character %s in mnemonic" +msgstr "carácter inválido %s en el mnemónico" + +#: config/tc-i386.c:1280 +msgid "expecting prefix; got nothing" +msgstr "se esperaba un prefijo; se obtuvo nada" + +#: config/tc-i386.c:1282 +msgid "expecting mnemonic; got nothing" +msgstr "se esperaba un mnemónico; se obtuvo nada" + +#: config/tc-i386.c:1300 +#, c-format +msgid "redundant %s prefix" +msgstr "prefijo %s redundante" + +#: config/tc-i386.c:1398 +#, c-format +msgid "`%s' is not supported on `%s'" +msgstr "`%s' no tiene soporte en `%s'" + +#: config/tc-i386.c:1403 +msgid "use .code16 to ensure correct addressing mode" +msgstr "use .code16 para asegurar el modo de direccionamiento correcto" + +#: config/tc-i386.c:1410 +#, c-format +msgid "expecting string instruction after `%s'" +msgstr "se espera una instrucción de cadena después de `%s'" + +#: config/tc-i386.c:1431 +#, c-format +msgid "invalid character %s before operand %d" +msgstr "caracter inválido %s antes del operando %d" + +#: config/tc-i386.c:1445 +#, c-format +msgid "unbalanced parenthesis in operand %d." +msgstr "paréntesis sin balancear en el operando %d." + +#: config/tc-i386.c:1448 +#, c-format +msgid "unbalanced brackets in operand %d." +msgstr "llaves sin balancear en el operando %d." + +#: config/tc-i386.c:1457 +#, c-format +msgid "invalid character %s in operand %d" +msgstr "carácter inválido %s en el operando %d" + +#: config/tc-i386.c:1484 +#, c-format +msgid "spurious operands; (%d operands/instruction max)" +msgstr "operandos espurios; (%d operandos/instrucción máximo)" + +#: config/tc-i386.c:1507 +msgid "expecting operand after ','; got nothing" +msgstr "se esperaba un operando después de ','; se obtuvo nada" + +#: config/tc-i386.c:1512 +msgid "expecting operand before ','; got nothing" +msgstr "se esperaba un operando antes de ','; se obtuvo nada" + +#. We found no match. +#: config/tc-i386.c:1856 +#, c-format +msgid "suffix or operands invalid for `%s'" +msgstr "sufijo u operandos inválidos para `%s'" + +#: config/tc-i386.c:1867 +#, c-format +msgid "indirect %s without `*'" +msgstr "%s indirecto sin `*'" + +#. Warn them that a data or address size prefix doesn't +#. affect assembly of the next line of code. +#: config/tc-i386.c:1875 +#, c-format +msgid "stand-alone `%s' prefix" +msgstr "prefijo `%s' por sí solo" + +#: config/tc-i386.c:1911 config/tc-i386.c:1926 +#, c-format +msgid "`%s' operand %d must use `%%es' segment" +msgstr "`%s' operando %d debe usar el segmento `%%es'" + +#. Prohibit these changes in the 64bit mode, since +#. the lowering is more complicated. +#: config/tc-i386.c:1999 config/tc-i386.c:2053 config/tc-i386.c:2068 config/tc-i386.c:2096 config/tc-i386.c:2124 +#, c-format +msgid "Incorrect register `%%%s' used with`%c' suffix" +msgstr "Se utilizó el registro incorrecto `%%%s' con el sufijo `%c'" + +#: config/tc-i386.c:2005 config/tc-i386.c:2058 config/tc-i386.c:2129 +#, c-format +msgid "using `%%%s' instead of `%%%s' due to `%c' suffix" +msgstr "utilizando `%%%s' en lugar de `%%%s' debido al sufijo `%c'" + +#: config/tc-i386.c:2021 config/tc-i386.c:2039 config/tc-i386.c:2083 config/tc-i386.c:2110 +#, c-format +msgid "`%%%s' not allowed with `%s%c'" +msgstr "no se permite `%%%s' con `%s%c'" + +#: config/tc-i386.c:2170 +msgid "no instruction mnemonic suffix given; can't determine immediate size" +msgstr "no se dio un sufijo mnemónico de instrucción; no se puede determinar el tamaño inmediato" + +#: config/tc-i386.c:2196 +#, c-format +msgid "no instruction mnemonic suffix given; can't determine immediate size %x %c" +msgstr "no se dio un sufijo mnemónico de instrucción; no se puede determinar el tamaño inmediato %x %c" + +#: config/tc-i386.c:2221 +msgid "no instruction mnemonic suffix given and no register operands; can't size instruction" +msgstr "no se dio un sufijo mnemónico de instrucción y ningún operando de registro; no se puede determinar el tamaño de la instrucción" + +#: config/tc-i386.c:2269 +msgid "64bit operations available only in 64bit modes." +msgstr "las operaciones de 64bit solamente están disponibles en modos de 64bit." + +#. Reversed arguments on faddp, fsubp, etc. +#: config/tc-i386.c:2337 +#, c-format +msgid "translating to `%s %%%s,%%%s'" +msgstr "traduciendo a `%s %%%s,%%%s'" + +#. Extraneous `l' suffix on fp insn. +#: config/tc-i386.c:2344 +#, c-format +msgid "translating to `%s %%%s'" +msgstr "traduciendo a `%s %%%s'" + +#: config/tc-i386.c:2617 +#, c-format +msgid "you can't `pop %%cs'" +msgstr "no se puede hacer `pop %%cs'" + +#. UnixWare fsub no args is alias for fsubp, fadd -> faddp, etc. +#: config/tc-i386.c:2650 +#, c-format +msgid "translating to `%sp'" +msgstr "traduciendo a `%sp'" + +#: config/tc-i386.c:2693 +#, c-format +msgid "Can't encode registers '%%%s' in the instruction requiring REX prefix.\n" +msgstr "No se pueden codificar los registros '%%%s' en la instrucción que requiere el prefijo REX.\n" + +#: config/tc-i386.c:2755 config/tc-i386.c:2845 config/tc-i386.c:2881 +msgid "skipping prefixes on this instruction" +msgstr "saltando los prefijos en esta instrucción" + +#: config/tc-i386.c:2901 +msgid "16-bit jump out of range" +msgstr "salto de 16-bit fuera de rango" + +#: config/tc-i386.c:2910 +#, c-format +msgid "can't handle non absolute segment in `%s'" +msgstr "no se puede manejar un segmento no absoluto en `%s'" + +#: config/tc-i386.c:3217 +#, c-format +msgid "@%s reloc is not supported in %s bit mode" +msgstr "las reubicaciones @%s no tienen soporte en modo de %s bits" + +#: config/tc-i386.c:3293 +msgid "only 1 or 2 immediate operands are allowed" +msgstr "sólo se permiten 1 ó dos operandos inmediatos" + +#: config/tc-i386.c:3316 config/tc-i386.c:3504 +#, c-format +msgid "junk `%s' after expression" +msgstr "basura `%s' después de la expresión" + +#. Missing or bad expr becomes absolute 0. +#: config/tc-i386.c:3327 +#, c-format +msgid "missing or invalid immediate expression `%s' taken as 0" +msgstr "la expresión inmediata faltante o inválida `%s' se toma como 0" + +#: config/tc-i386.c:3358 config/tc-i386.c:3565 +#, c-format +msgid "unimplemented segment %s in operand" +msgstr "segmento %s sin implementar en el operando" + +#: config/tc-i386.c:3360 config/tc-i386.c:3567 +#, c-format +msgid "unimplemented segment type %d in operand" +msgstr "tipo de segmento %d sin implementar en el operando" + +#: config/tc-i386.c:3404 config/tc-i386.c:5588 +#, c-format +msgid "expecting scale factor of 1, 2, 4, or 8: got `%s'" +msgstr "se esperaba un factor de escala de 1, 2, 4, u 8: se obtuvo `%s'" + +#: config/tc-i386.c:3411 +#, c-format +msgid "scale factor of %d without an index register" +msgstr "factor de escala de %d sin un registro índice" + +#: config/tc-i386.c:3524 +#, c-format +msgid "bad expression used with @%s" +msgstr "se utilizó una expresión errónea con @%s" + +#. Missing or bad expr becomes absolute 0. +#: config/tc-i386.c:3546 +#, c-format +msgid "missing or invalid displacement expression `%s' taken as 0" +msgstr "la expresión de desubicación faltante o inválida `%s' se toma como 0" + +#: config/tc-i386.c:3652 +#, c-format +msgid "`%s' is not a valid base/index expression" +msgstr "`%s' no es una expresión base/índice válida" + +#: config/tc-i386.c:3656 +#, c-format +msgid "`%s' is not a valid %s bit base/index expression" +msgstr "`%s' no es una expresión de %s bit base/índice válida" + +#: config/tc-i386.c:3731 +#, c-format +msgid "bad memory operand `%s'" +msgstr "operando de memoria `%s' erróneo" + +#: config/tc-i386.c:3746 +#, c-format +msgid "junk `%s' after register" +msgstr "basura `%s' después del registro" + +#: config/tc-i386.c:3755 config/tc-i386.c:3870 config/tc-i386.c:3908 +#, c-format +msgid "bad register name `%s'" +msgstr "nombre de registro `%s' erróneo" + +#: config/tc-i386.c:3763 +msgid "immediate operand illegal with absolute jump" +msgstr "operando inmediato ilegal con salto absoluto" + +#: config/tc-i386.c:3785 +#, c-format +msgid "too many memory references for `%s'" +msgstr "demasiadas referencias a memoria para `%s'" + +#: config/tc-i386.c:3863 +#, c-format +msgid "expecting `,' or `)' after index register in `%s'" +msgstr "se esperaba `,' ó `)' después del registro índice en `%s'" + +#: config/tc-i386.c:3887 +#, c-format +msgid "expecting `)' after scale factor in `%s'" +msgstr "se esperaba `)' después del factor de escala en `%s'" + +#: config/tc-i386.c:3894 +#, c-format +msgid "expecting index register or scale factor after `,'; got '%c'" +msgstr "se esperaba un registro índice o un factor de escala después de `,'; se obtuvo '%c'" + +#: config/tc-i386.c:3901 +#, c-format +msgid "expecting `,' or `)' after base register in `%s'" +msgstr "se esperaba `,' ó `)' después del registro base en `%s'" + +#. It's not a memory operand; argh! +#: config/tc-i386.c:3942 +#, c-format +msgid "invalid char %s beginning operand %d `%s'" +msgstr "caracter inválido %s al inicio del operando %d `%s'" + +#: config/tc-i386.c:4117 +msgid "long jump required" +msgstr "se requiere un salto largo" + +#: config/tc-i386.c:4417 +msgid "Bad call to md_atof ()" +msgstr "Llamada errónea a md_atof ()" + +#: config/tc-i386.c:4581 +msgid "No compiled in support for x86_64" +msgstr "No se compiló el soporte para x86_64" + +#: config/tc-i386.c:4602 +msgid "" +" -Q ignored\n" +" -V print assembler version number\n" +" -k ignored\n" +" -q quieten some warnings\n" +" -s ignored\n" +msgstr "" +" -Q ignorado\n" +" -V muestra el número de versión del ensamblador\n" +" -k ignorado\n" +" -q omite algunos avisos\n" +" -s ignorado\n" + +#: config/tc-i386.c:4609 +msgid " -q quieten some warnings\n" +msgstr " -q omite algunos avisos\n" + +#: config/tc-i386.c:4710 config/tc-s390.c:1592 +msgid "GOT already in symbol table" +msgstr "GOT ya está en la tabla de símbolos" + +#: config/tc-i386.c:4842 +#, c-format +msgid "can not do %d byte relocation" +msgstr "no se puede hacer la reubicación de %d bytes" + +#: config/tc-i386.c:4894 config/tc-s390.c:1957 +#, c-format +msgid "cannot represent relocation type %s" +msgstr "no se puede representar el tipo de reubicación %s" + +#: config/tc-i386.c:5190 +#, c-format +msgid "too many memory references for '%s'" +msgstr "demasiadas referencias a memoria para '%s'" + +#: config/tc-i386.c:5353 +#, c-format +msgid "Unknown operand modifier `%s'\n" +msgstr "Modificador de operando `%s' desconocido\n" + +#: config/tc-i386.c:5560 +#, c-format +msgid "`%s' is not a valid segment register" +msgstr "`%s' no es un registro de segmento válido" + +#: config/tc-i386.c:5570 config/tc-i386.c:5691 +msgid "Register scaling only allowed in memory operands." +msgstr "El escalamiento de registros sólo se permite en operandos de memoria." + +#: config/tc-i386.c:5601 +msgid "Too many register references in memory operand.\n" +msgstr "Demasiadas referencias a registros en un operando de memoria.\n" + +#: config/tc-i386.c:5670 +#, c-format +msgid "Syntax error. Expecting a constant. Got `%s'.\n" +msgstr "Error sintáctico. Se esperaba una constante. Se obtuvo `%s'.\n" + +#: config/tc-i386.c:5740 +#, c-format +msgid "Unrecognized token '%s'" +msgstr "Elemento '%s' no reconocido" + +#: config/tc-i386.c:5757 +#, c-format +msgid "Unexpected token `%s'\n" +msgstr "Elemento `%s' inesperado\n" + +#: config/tc-i386.c:5901 +#, c-format +msgid "Unrecognized token `%s'\n" +msgstr "Elemento `%s' no reconocido\n" + +#: config/tc-i860.c:154 config/tc-i860.c:158 +msgid "Unknown temporary pseudo register" +msgstr "Pseudo registro temporal desconocido" + +#: config/tc-i860.c:181 config/tc-mips.c:1248 +#, c-format +msgid "internal error: can't hash `%s': %s\n" +msgstr "error interno: no se puede dispersar `%s': %s\n" + +#: config/tc-i860.c:201 +msgid "Defective assembler. No assembly attempted." +msgstr "Ensamblador defectuoso. No se intentó ensamblar." + +#: config/tc-i860.c:347 +#, c-format +msgid "Expanded opcode after delayed branch: `%s'" +msgstr "Código de operación expandido después de la ramificación retardada: `%s'" + +#: config/tc-i860.c:351 +#, c-format +msgid "Expanded opcode in dual mode: `%s'" +msgstr "Código de operación expandido en modo dual: `%s'" + +#: config/tc-i860.c:355 +#, c-format +msgid "An instruction was expanded (%s)" +msgstr "Se expandió una instrucción (%s)" + +# ¿pipeline tiene traducción al español? cfuga +#: config/tc-i860.c:613 +msgid "Pipelined instruction: fsrc1 = fdest" +msgstr "Instrucción en `pipeline': fsrc1 = fdest" + +#: config/tc-i860.c:776 config/tc-i860.c:783 config/tc-i860.c:790 +msgid "Assembler does not yet support PIC" +msgstr "El ensamblador aún no tiene soporte para PIC" + +#: config/tc-i860.c:849 +#, c-format +msgid "Illegal operands for %s" +msgstr "Operandos ilegales para %s" + +#: config/tc-i860.c:873 config/tc-sparc.c:2731 +msgid "bad segment" +msgstr "segmento erróneo" + +#: config/tc-i860.c:965 +msgid "md_number_to_disp\n" +msgstr "md_number_to_disp\n" + +#: config/tc-i860.c:975 +msgid "i860_number_to_field\n" +msgstr "i860_number_to_field\n" + +#: config/tc-i860.c:984 +msgid "i860_estimate_size_before_relax\n" +msgstr "i860_estimate_size_before_relax\n" + +#: config/tc-i860.c:1075 +msgid "" +" -EL\t\t\t generate code for little endian mode (default)\n" +" -EB\t\t\t generate code for big endian mode\n" +" -mwarn-expand\t\t warn if pseudo operations are expanded\n" +msgstr "" +" -EL\t\t\t generar código para el modo little endian (por omisión)\n" +" -EB\t\t\t generar código para el modo big endian\n" +" -mwarn-expand\t\t avisar si se expanden las pseudo operaciones\n" + +#. SVR4 compatibility flags. +#: config/tc-i860.c:1081 +msgid "" +" -V\t\t\t print assembler version number\n" +" -Qy, -Qn\t\t ignored\n" +msgstr "" +" -V\t\t\t mostrar el número de versión del ensamblador\n" +" -Qy, -Qn\t\t ignorado\n" + +#: config/tc-i860.c:1150 +msgid "This immediate requires 0 MOD 2 alignment" +msgstr "Este inmediato requiere alineación 0 MOD 2" + +#: config/tc-i860.c:1153 +msgid "This immediate requires 0 MOD 4 alignment" +msgstr "Este inmediato requiere alineación 0 MOD 4" + +#: config/tc-i860.c:1156 +msgid "This immediate requires 0 MOD 8 alignment" +msgstr "Este inmediato requiere alineación 0 MOD 8" + +#: config/tc-i860.c:1159 +msgid "This immediate requires 0 MOD 16 alignment" +msgstr "Este inmediato requiere alineación 0 MOD 16" + +#: config/tc-i860.c:1257 +msgid "5-bit immediate too large" +msgstr "el inmediato de 5-bit es demasiado grande" + +#: config/tc-i860.c:1260 +msgid "5-bit field must be absolute" +msgstr "el campo de 5-bit debe ser absoluto" + +#: config/tc-i860.c:1305 config/tc-i860.c:1328 +msgid "A branch offset requires 0 MOD 4 alignment" +msgstr "Un desplazamiento de ramificación requiere alineación 0 MOD 4" + +#: config/tc-i860.c:1349 +#, c-format +msgid "Unrecognized fix-up (0x%08x)" +msgstr "Compostura no reconocida (0x%08x)" + +#: config/tc-i860.h:80 +msgid "i860_convert_frag\n" +msgstr "i860_convert_frag\n" + +#: config/tc-i960.c:550 +#, c-format +msgid "Hashing returned \"%s\"." +msgstr "La dispersión devolvió \"%s\"." + +#. Offset of last character in opcode mnemonic +#: config/tc-i960.c:584 +msgid "branch prediction invalid on this opcode" +msgstr "predicción de ramificación inválida en este código de operación" + +#: config/tc-i960.c:624 +#, c-format +msgid "invalid opcode, \"%s\"." +msgstr "código de operación inválido, \"%s\"." + +#: config/tc-i960.c:629 +#, c-format +msgid "improper number of operands. expecting %d, got %d" +msgstr "número impropio de operandos. se esperaban %d, se obtuvieron %d" + +#: config/tc-i960.c:861 +#, c-format +msgid "Fixup of %ld too large for field width of %d" +msgstr "La compostura de %ld es demasiado grande para el campo de anchura %d" + +#: config/tc-i960.c:978 +#, c-format +msgid "invalid architecture %s" +msgstr "arquitectura %s inválida" + +#: config/tc-i960.c:998 +msgid "I960 options:\n" +msgstr "opciones de I960:\n" + +#: config/tc-i960.c:1001 +msgid "" +"\n" +"\t\t\tspecify variant of 960 architecture\n" +"-b\t\t\tadd code to collect statistics about branches taken\n" +"-link-relax\t\tpreserve individual alignment directives so linker\n" +"\t\t\tcan do relaxing (b.out format only)\n" +"-no-relax\t\tdon't alter compare-and-branch instructions for\n" +"\t\t\tlong displacements\n" +msgstr "" +"\n" +"\t\t\tespecifica la variante de la arquitectura 960\n" +"-b\t\t\tagrega código para recolectar estadísticas sobre las ramificaciones tomadas\n" +"-link-relax\t\tpreserva las directivas de alineación individuales del enlazador so\n" +"\t\t\tse puede relajar (sólo en el formato b.out)\n" +"-no-relax\t\tno alterar las instrucciones comparar-y-ramificar para\n" +"\t\t\tdesubicaciones largas\n" + +#: config/tc-i960.c:1404 +msgid "too many operands" +msgstr "demasiados operandos" + +#: config/tc-i960.c:1463 config/tc-i960.c:1690 +msgid "expression syntax error" +msgstr "error sintáctico en la expresión" + +#: config/tc-i960.c:1501 +msgid "attempt to branch into different segment" +msgstr "se intentó ramificar en un segmento diferente" + +#: config/tc-i960.c:1505 +#, c-format +msgid "target of %s instruction must be a label" +msgstr "el objetivo de la instrucción %s debe ser una etiqueta" + +#: config/tc-i960.c:1544 +msgid "unmatched '['" +msgstr "'[' desemparejado" + +#: config/tc-i960.c:1555 +msgid "garbage after index spec ignored" +msgstr "se ignora la basura después de la especificación del índice" + +#. We never moved: there was no opcode either! +#: config/tc-i960.c:1621 +msgid "missing opcode" +msgstr "falta el código de operación" + +#: config/tc-i960.c:2036 +msgid "invalid index register" +msgstr "registro índice inválido" + +#: config/tc-i960.c:2059 +msgid "invalid scale factor" +msgstr "factor de escala inválido" + +#: config/tc-i960.c:2242 +msgid "unaligned register" +msgstr "registro sin alinear" + +#: config/tc-i960.c:2265 +msgid "no such sfr in this architecture" +msgstr "no hay un sfr en esta arquitectura" + +#: config/tc-i960.c:2303 +msgid "illegal literal" +msgstr "literal ilegal" + +#. Should not happen: see block comment above +#: config/tc-i960.c:2533 +#, c-format +msgid "Trying to 'bal' to %s" +msgstr "Tratando de hacer 'bal' a %s" + +#: config/tc-i960.c:2544 +msgid "Looks like a proc, but can't tell what kind.\n" +msgstr "Se ve como un proc, no se puede saber de qué tipo.\n" + +#: config/tc-i960.c:2575 +msgid "should have 1 or 2 operands" +msgstr "debe tener 1 o 2 operandos" + +#: config/tc-i960.c:2584 config/tc-i960.c:2603 +#, c-format +msgid "Redefining leafproc %s" +msgstr "Redefiniendo el proceso hoja %s" + +#: config/tc-i960.c:2634 +msgid "should have two operands" +msgstr "debe tener dos operandos" + +#: config/tc-i960.c:2644 +msgid "'entry_num' must be absolute number in [0,31]" +msgstr "'entry_num' debe ser un número absoluto en [0,31]" + +#: config/tc-i960.c:2653 +#, c-format +msgid "Redefining entrynum for sysproc %s" +msgstr "Redefiniendo el número de entrada para el proceso del sistema %s" + +#: config/tc-i960.c:2760 +msgid "architecture of opcode conflicts with that of earlier instruction(s)" +msgstr "la arquitectura del código de operación tiene conflictos con alguno de una(s) instrucción(es) anterior(es)" + +#: config/tc-i960.c:2781 +msgid "big endian mode is not supported" +msgstr "el modo big endian no tiene soporte" + +#: config/tc-i960.c:2783 +#, c-format +msgid "ignoring unrecognized .endian type `%s'" +msgstr "se ignora el tipo .endian `%s' no reconocido" + +#: config/tc-i960.c:3055 +#, c-format +msgid "leafproc symbol '%s' undefined" +msgstr "símolo de proceso hoja '%s' indefinido" + +#: config/tc-i960.c:3065 +#, c-format +msgid "Warning: making leafproc entries %s and %s both global\n" +msgstr "Aviso: haciendo globales las entradas de proceso hoja %s y %s\n" + +#: config/tc-i960.c:3174 +msgid "option --link-relax is only supported in b.out format" +msgstr "la opción --link-relax solamente tiene soporte en el formato b.out" + +#: config/tc-i960.c:3217 write.c:2670 +msgid "callj to difference of two symbols" +msgstr "callj para diferenciar dos símbolos" + +#: config/tc-ia64.c:1052 +msgid "Unwind directive not followed by an instruction." +msgstr "La directiva de desenredo no está seguida por una instrucción." + +#: config/tc-ia64.c:4416 +msgid "Register name expected" +msgstr "Se esperaba un nombre de registro" + +#: config/tc-ia64.c:4421 config/tc-ia64.c:4707 +msgid "Comma expected" +msgstr "Se esperaba una coma" + +#: config/tc-ia64.c:4429 +msgid "Register value annotation ignored" +msgstr "Se ignora la anotación del valor del registro" + +#: config/tc-ia64.c:4453 +msgid "Directive invalid within a bundle" +msgstr "Directiva inválida dentro de una agrupación" + +#: config/tc-ia64.c:4520 +msgid "Missing predicate relation type" +msgstr "Falta el tipo de relación del predicado" + +#: config/tc-ia64.c:4536 +msgid "Unrecognized predicate relation type" +msgstr "Tipo de relación de predicado no reconocido" + +#: config/tc-ia64.c:4556 config/tc-ia64.c:4581 +msgid "Predicate register expected" +msgstr "Se esperaba un registro de predicado" + +#: config/tc-ia64.c:4568 +msgid "Duplicate predicate register ignored" +msgstr "Se ignora el registro de predicado duplicado" + +#: config/tc-ia64.c:4590 +msgid "Bad register range" +msgstr "Rango de registro erróneo" + +#: config/tc-ia64.c:4618 +msgid "Predicate source and target required" +msgstr "Se requiere el predicado fuente y destino" + +#: config/tc-ia64.c:4620 config/tc-ia64.c:4632 +msgid "Use of p0 is not valid in this context" +msgstr "El uso de p0 no es válido en este contexto" + +#: config/tc-ia64.c:4627 +msgid "At least two PR arguments expected" +msgstr "Se esperaban al menos dos argumentos PR" + +#: config/tc-ia64.c:4641 +msgid "At least one PR argument expected" +msgstr "Se esperaba al menos un argumento PR" + +#: config/tc-ia64.c:4677 +#, c-format +msgid "Inserting \"%s\" into entry hint table failed: %s" +msgstr "Falló la inserción de \"%s\" en la tabla de entrada de pistas: %s" + +#. FIXME -- need 62-bit relocation type +#: config/tc-ia64.c:5147 +msgid "62-bit relocation not yet implemented" +msgstr "la reubicación de 62-bits aún no está implementada" + +#. XXX technically, this is wrong: we should not be issuing warning +#. messages until we're sure this instruction pattern is going to +#. be used! +#: config/tc-ia64.c:5220 +msgid "lower 16 bits of mask ignored" +msgstr "se ignoran los 16 bits inferiores de la máscara" + +#: config/tc-ia64.c:5775 +msgid "Value truncated to 62 bits" +msgstr "Valor truncado a 62 bits" + +#: config/tc-ia64.c:6126 +msgid "Additional NOP may be necessary to workaround Itanium processor A/B step errata" +msgstr "Pueden ser necesario un NOP adiciona para evitar el error de paso A/B del procesador Itanium" + +#: config/tc-ia64.c:6309 +#, c-format +msgid "Unrecognized option '-x%s'" +msgstr "Opción '-x%s' no reconocida" + +#: config/tc-ia64.c:6337 +msgid "" +"IA-64 options:\n" +" -milp32|-milp64|-mlp64|-mp64\tselect data model (default -mlp64)\n" +" -mle | -mbe\t\t select little- or big-endian byte order (default -mle)\n" +" -x | -xexplicit\t turn on dependency violation checking (default)\n" +" -xauto\t\t automagically remove dependency violations\n" +" -xdebug\t\t debug dependency violation checker\n" +msgstr "" +"Opciones de IA-64:\n" +" -milp32|-milp64|-mlp64|-mp64\tseleccionar el modelo de datos (-mlp64 por omisión)\n" +" -mle | -mbe\t\t seleccionar el orden de bytes little- o big-endian (-mle por omisión)\n" +" -x | -xexplicit\t activar la revisión de violaciones de dependencias (por omisión)\n" +" -xauto\t\t borrar automágicamente las violaciones de dependencias\n" +" -xdebug\t\t depurar el revisor de violaciones de dependencias\n" + +#: config/tc-ia64.c:6351 +msgid "--gstabs is not supported for ia64" +msgstr "--gstabs no tiene soporte para ia64" + +#: config/tc-ia64.c:6618 config/tc-mips.c:1227 +msgid "Could not set architecture and machine" +msgstr "No se pueden establecer la arquitectura y la máquina" + +#: config/tc-ia64.c:6725 +msgid "Explicit stops are ignored in auto mode" +msgstr "Se ignoran las paradas explícitas en modo automático" + +#: config/tc-ia64.c:6775 +msgid "Found '{' after explicit switch to automatic mode" +msgstr "Se encontró '{' después del cambio explícito al modo automático" + +#: config/tc-ia64.c:7222 +#, c-format +msgid "Unhandled dependency %s for %s (%s), note %d" +msgstr "Dependencia sin manejar %s para %s (%s), nota %d" + +#: config/tc-ia64.c:8498 +#, c-format +msgid "Unrecognized dependency specifier %d\n" +msgstr "Especificador de dependencia %d no reconocido\n" + +#: config/tc-ia64.c:9300 +msgid "Only the first path encountering the conflict is reported" +msgstr "Solamente se reporta la primera ruta donde se encuentra el conflicto" + +#: config/tc-ia64.c:9303 +msgid "This is the location of the conflicting usage" +msgstr "Esta es la ubicación del uso conflictivo" + +#. Pretend that we do not recognise this option. +#: config/tc-m32r.c:231 +msgid "Unrecognised option: -hidden" +msgstr "Opción no reconocida: -hidden" + +#: config/tc-m32r.c:265 +msgid " M32R specific command line options:\n" +msgstr "Opciones de la línea de comandos específicas de M32R:\n" + +#: config/tc-m32r.c:267 +msgid " -m32r disable support for the m32rx instruction set\n" +msgstr " -m32r desactiva el soporte para el conjunto de instrucciones m32rx\n" + +#: config/tc-m32r.c:269 +msgid " -m32rx support the extended m32rx instruction set\n" +msgstr " -m32rx da soporte al conjunto extendido de instrucciones m32rx\n" + +#: config/tc-m32r.c:271 +msgid " -O try to combine instructions in parallel\n" +msgstr " -O intenta combinar instrucciones en paralelo\n" + +#: config/tc-m32r.c:274 +msgid " -warn-explicit-parallel-conflicts warn when parallel instructions\n" +msgstr " -warn-explicit-parallel-conflicts avisa cuando hay instrucciones paralelas\n" + +#: config/tc-m32r.c:276 +msgid " violate contraints\n" +msgstr " que violan las restricciones\n" + +#: config/tc-m32r.c:278 +msgid " -no-warn-explicit-parallel-conflicts do not warn when parallel\n" +msgstr " -no-warn-explicit-parallel-conflicts no avisa cuando las instrucciones\n" + +#: config/tc-m32r.c:280 +msgid " instructions violate contraints\n" +msgstr " paralelas violan restricciones\n" + +#: config/tc-m32r.c:282 +msgid " -Wp synonym for -warn-explicit-parallel-conflicts\n" +msgstr " -Wp sinónimo para -warn-explicit-parallel-conflicts\n" + +#: config/tc-m32r.c:284 +msgid " -Wnp synonym for -no-warn-explicit-parallel-conflicts\n" +msgstr " -Wnp sinónimo para -no-warn-explicit-parallel-conflicts\n" + +#: config/tc-m32r.c:287 +msgid " -warn-unmatched-high warn when an (s)high reloc has no matching low reloc\n" +msgstr " -warn-unmatched-high avisa cundo una reubicación (s)high no tiene una reubicación low correspondiente\n" + +#: config/tc-m32r.c:289 +msgid " -no-warn-unmatched-high do not warn about missing low relocs\n" +msgstr " -no-warn-unmatched-high no avisa cuando faltan reubicaciones low\n" + +#: config/tc-m32r.c:291 +msgid " -Wuh synonym for -warn-unmatched-high\n" +msgstr " -Wuh sinónimo para -warn-unmatched-high\n" + +#: config/tc-m32r.c:293 +msgid " -Wnuh synonym for -no-warn-unmatched-high\n" +msgstr " -Wnuh sinónimo para -no-warn-unmatched-high\n" + +#: config/tc-m32r.c:297 +msgid " -relax create linker relaxable code\n" +msgstr " -relax crea código relajable para el enlazados\n" + +#: config/tc-m32r.c:299 +msgid " -cpu-desc provide runtime cpu description file\n" +msgstr " -cpu-desc provee el fichero de descripción del cpu en tiempo de ejecución\n" + +#: config/tc-m32r.c:691 +msgid "Instructions write to the same destination register." +msgstr "Las instrucciones escriben al mismo registro de destino." + +#: config/tc-m32r.c:699 +msgid "Instructions do not use parallel execution pipelines." +msgstr "Las instrucciones no usan tuberías de ejecución paralela." + +#: config/tc-m32r.c:706 +msgid "Instructions share the same execution pipeline" +msgstr "Las instrucciones comparten la misma tubería de ejecución" + +#: config/tc-m32r.c:776 config/tc-m32r.c:872 +#, c-format +msgid "not a 16 bit instruction '%s'" +msgstr "no hay una instrucción 16 bit '%s'" + +#: config/tc-m32r.c:783 config/tc-m32r.c:879 config/tc-m32r.c:1035 +#, c-format +msgid "unknown instruction '%s'" +msgstr "instrucción '%s' desconocida" + +#: config/tc-m32r.c:792 config/tc-m32r.c:886 config/tc-m32r.c:1042 +#, c-format +msgid "instruction '%s' is for the M32RX only" +msgstr "la instrucción '%s' sólo es para el M32RX" + +#: config/tc-m32r.c:801 config/tc-m32r.c:895 +#, c-format +msgid "instruction '%s' cannot be executed in parallel." +msgstr "la instrucción '%s' no se puede ejecutar en paralelo." + +#: config/tc-m32r.c:856 config/tc-m32r.c:920 config/tc-m32r.c:1092 +msgid "internal error: lookup/get operands failed" +msgstr "error interno: los operandos lookup/get fallaron." + +#: config/tc-m32r.c:905 +#, c-format +msgid "'%s': only the NOP instruction can be issued in parallel on the m32r" +msgstr "'%s': solamente las instrucciones NOP se puede ejecutar en paralelo en el m32r" + +#: config/tc-m32r.c:934 +#, c-format +msgid "%s: output of 1st instruction is the same as an input to 2nd instruction - is this intentional ?" +msgstr "%s: la salida de la 1a instrucción es la misma que una entrada a la 2a instrucción - ¿Esto es intencional?" + +#: config/tc-m32r.c:938 +#, c-format +msgid "%s: output of 2nd instruction is the same as an input to 1st instruction - is this intentional ?" +msgstr "%s: la salida de la 2a instrucción es la misma que una entrada a la 1a instrucción - ¿Esto es intencional?" + +#: config/tc-m32r.c:1252 config/tc-ppc.c:1571 config/tc-ppc.c:3966 +msgid "Expected comma after symbol-name: rest of line ignored." +msgstr "Se esperaba coma después del nombre del símbolo: se ingnora el resto de la línea." + +#: config/tc-m32r.c:1262 +#, c-format +msgid ".SCOMMon length (%ld.) <0! Ignored." +msgstr "longitud SCOMMon (%ld.) <0!. Se ignora." + +#: config/tc-m32r.c:1276 config/tc-ppc.c:1593 config/tc-ppc.c:2615 config/tc-ppc.c:3990 +msgid "ignoring bad alignment" +msgstr "se ignora la alineación errónea" + +#: config/tc-m32r.c:1288 config/tc-ppc.c:1630 config/tc-v850.c:383 +msgid "Common alignment not a power of 2" +msgstr "La alineación común no es una potencia de 2" + +#: config/tc-m32r.c:1303 config/tc-ppc.c:1604 config/tc-ppc.c:4002 +#, c-format +msgid "Ignoring attempt to re-define symbol `%s'." +msgstr "Se ignora el intento de redefinir el símbolo `%s'." + +#: config/tc-m32r.c:1312 +#, c-format +msgid "Length of .scomm \"%s\" is already %ld. Not changed to %ld." +msgstr "La longitud de .scomm \"%s\" ya está %ld. No ha cambiado a %ld." + +#: config/tc-m32r.c:1789 +msgid "Unmatched high/shigh reloc" +msgstr "Reubicación high/shigh sin coincidencia" + +#: config/tc-m68hc11.c:327 +#, c-format +msgid "" +"Motorola 68HC11/68HC12 options:\n" +" -m68hc11 | -m68hc12 specify the processor [default %s]\n" +" --force-long-branchs always turn relative branchs into absolute ones\n" +" -S,--short-branchs do not turn relative branchs into absolute ones\n" +" when the offset is out of range\n" +" --strict-direct-mode do not turn the direct mode into extended mode\n" +" when the instruction does not support direct mode\n" +" --print-insn-syntax print the syntax of instruction in case of error\n" +" --print-opcodes print the list of instructions with syntax\n" +" --generate-example generate an example of each instruction\n" +" (used for testing)\n" +msgstr "" +"Opciones para Motorola 68HC11/68HC12:\n" +" -m68hc11 | -m68hc12 especifica el procesador [por omisión %s]\n" +" --force-long-branchs siempre convierte las ramificaciones relativas en\n" +" absolutas\n" +" -S,--short-branchs no convierte las ramificaciones relativas en\n" +" absolutas cuando el desplazamiento está fuera de rango\n" +" --strict-direct-mode no convierte el modo directo en modo extendido\n" +" cuando la instrucción no tiene soporte para modo\n" +" directo\n" +" --print-insn-syntax muestra la sintaxis de la instrucción en caso de\n" +" error\n" +" --print-opcodes muestra la lista de instrucciones con sintaxis\n" +" --generate-example genera un ejemplo de cada instrucción\n" +" (utilizado para pruebas)\n" + +#: config/tc-m68hc11.c:368 +#, c-format +msgid "Default target `%s' is not supported." +msgstr "El objetivo por omisión `%s' no tiene soporte." + +#. Dump the opcode statistics table. +#: config/tc-m68hc11.c:387 +msgid "Name # Modes Min ops Max ops Modes mask # Used\n" +msgstr "Nombre # Modos Min ops Max ops Masc. modos # Usado\n" + +#: config/tc-m68hc11.c:437 +#, c-format +msgid "Option `%s' is not recognized." +msgstr "No se reconoce la opción `%s'." + +#: config/tc-m68hc11.c:658 +msgid "#" +msgstr "#" + +#: config/tc-m68hc11.c:667 +msgid "#" +msgstr "#" + +#: config/tc-m68hc11.c:676 config/tc-m68hc11.c:685 +msgid ",X" +msgstr ",X" + +#: config/tc-m68hc11.c:703 +msgid "*" +msgstr "*" + +#: config/tc-m68hc11.c:715 +msgid "#" +msgstr "#" + +#: config/tc-m68hc11.c:725 +#, c-format +msgid "symbol%d" +msgstr "símbolo%d" + +#: config/tc-m68hc11.c:727 +msgid "" +msgstr "" + +#: config/tc-m68hc11.c:746 +msgid "