summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2002-04-12 19:33:52 +0000
committerobrien <obrien@FreeBSD.org>2002-04-12 19:33:52 +0000
commit18ff9f4f1bddd11c341a37177885ac89fcccedd9 (patch)
treeb6180daa6d6e558ce86214f98d103e01ff4e70ff /contrib
parent1d1ccbf8e10277966ecf3c150370a50c9e184b35 (diff)
downloadFreeBSD-src-18ff9f4f1bddd11c341a37177885ac89fcccedd9.zip
FreeBSD-src-18ff9f4f1bddd11c341a37177885ac89fcccedd9.tar.gz
Import of Binutils from the FSF 2.12 branch.
(this fixes several linker problems and coredumps) These bits are taken from the FSF anoncvs repo on 10-April-2002 13:24 Zulu
Diffstat (limited to 'contrib')
-rw-r--r--contrib/binutils/bfd/ChangeLog299
-rw-r--r--contrib/binutils/bfd/Makefile.am17
-rw-r--r--contrib/binutils/bfd/Makefile.in25
-rw-r--r--contrib/binutils/bfd/aclocal.m416
-rw-r--r--contrib/binutils/bfd/aout-tic30.c121
-rw-r--r--contrib/binutils/bfd/aoutx.h15
-rw-r--r--contrib/binutils/bfd/archive.c8
-rw-r--r--contrib/binutils/bfd/archures.c7
-rw-r--r--contrib/binutils/bfd/bfd-in2.h4
-rw-r--r--contrib/binutils/bfd/coff-arm.c7
-rw-r--r--contrib/binutils/bfd/coff-mips.c113
-rw-r--r--contrib/binutils/bfd/coff-tic30.c52
-rw-r--r--contrib/binutils/bfd/coff-z8k.c163
-rw-r--r--contrib/binutils/bfd/coffcode.h10
-rw-r--r--contrib/binutils/bfd/cofflink.c20
-rw-r--r--contrib/binutils/bfd/config.in6
-rwxr-xr-xcontrib/binutils/bfd/configure4
-rw-r--r--contrib/binutils/bfd/configure.in4
-rw-r--r--contrib/binutils/bfd/cpu-i386.c2
-rw-r--r--contrib/binutils/bfd/cpu-mips.c108
-rw-r--r--contrib/binutils/bfd/cpu-sparc.c39
-rw-r--r--contrib/binutils/bfd/cpu-v850.c39
-rw-r--r--contrib/binutils/bfd/cpu-z8k.c9
-rw-r--r--contrib/binutils/bfd/dep-in.sed4
-rw-r--r--contrib/binutils/bfd/doc/ChangeLog4
-rw-r--r--contrib/binutils/bfd/doc/Makefile.in8
-rw-r--r--contrib/binutils/bfd/dwarf2.c64
-rw-r--r--contrib/binutils/bfd/ecoff.c15
-rw-r--r--contrib/binutils/bfd/elf-bfd.h2
-rw-r--r--contrib/binutils/bfd/elf.c112
-rw-r--r--contrib/binutils/bfd/elf32-arm.h16
-rw-r--r--contrib/binutils/bfd/elf32-i386.c21
-rw-r--r--contrib/binutils/bfd/elf32-mips.c3104
-rw-r--r--contrib/binutils/bfd/elf32-sparc.c120
-rw-r--r--contrib/binutils/bfd/elf32-v850.c269
-rw-r--r--contrib/binutils/bfd/elf64-alpha.c113
-rw-r--r--contrib/binutils/bfd/elf64-mips.c5968
-rw-r--r--contrib/binutils/bfd/elf64-ppc.c15
-rw-r--r--contrib/binutils/bfd/elf64-sparc.c176
-rw-r--r--contrib/binutils/bfd/elf64-x86-64.c3
-rw-r--r--contrib/binutils/bfd/elflink.c5
-rw-r--r--contrib/binutils/bfd/elflink.h506
-rw-r--r--contrib/binutils/bfd/elfxx-ia64.c12
-rw-r--r--contrib/binutils/bfd/elfxx-target.h14
-rw-r--r--contrib/binutils/bfd/i386linux.c5
-rw-r--r--contrib/binutils/bfd/ihex.c5
-rw-r--r--contrib/binutils/bfd/libbfd.c7
-rw-r--r--contrib/binutils/bfd/libbfd.h2
-rw-r--r--contrib/binutils/bfd/libpei.h140
-rw-r--r--contrib/binutils/bfd/linker.c5
-rw-r--r--contrib/binutils/bfd/merge.c3
-rw-r--r--contrib/binutils/bfd/mipsbsd.c411
-rw-r--r--contrib/binutils/bfd/pe-mips.c140
-rw-r--r--contrib/binutils/bfd/peicode.h179
-rw-r--r--contrib/binutils/bfd/sparclinux.c5
-rw-r--r--contrib/binutils/bfd/srec.c69
-rw-r--r--contrib/binutils/bfd/sunos.c3
-rw-r--r--contrib/binutils/bfd/syms.c35
-rw-r--r--contrib/binutils/bfd/version.h2
-rw-r--r--contrib/binutils/bfd/xcoff-target.h1
-rw-r--r--contrib/binutils/bfd/xcofflink.c2252
-rw-r--r--contrib/binutils/binutils/ChangeLog12
-rw-r--r--contrib/binutils/binutils/Makefile.am39
-rw-r--r--contrib/binutils/binutils/Makefile.in39
-rw-r--r--contrib/binutils/binutils/aclocal.m434
-rwxr-xr-xcontrib/binutils/binutils/configure903
-rw-r--r--contrib/binutils/binutils/configure.in2
-rw-r--r--contrib/binutils/binutils/dep-in.sed2
-rw-r--r--contrib/binutils/binutils/unwind-ia64.c2
-rw-r--r--contrib/binutils/gas/ChangeLog121
-rw-r--r--contrib/binutils/gas/Makefile.am67
-rw-r--r--contrib/binutils/gas/Makefile.in83
-rw-r--r--contrib/binutils/gas/aclocal.m420
-rw-r--r--contrib/binutils/gas/as.c4
-rw-r--r--contrib/binutils/gas/config.in3
-rw-r--r--contrib/binutils/gas/config/atof-vax.c59
-rw-r--r--contrib/binutils/gas/config/obj-elf.c27
-rw-r--r--contrib/binutils/gas/config/tc-arm.c2
-rw-r--r--contrib/binutils/gas/config/tc-i386.c3974
-rw-r--r--contrib/binutils/gas/config/tc-i386.h20
-rw-r--r--contrib/binutils/gas/config/tc-ia64.c33
-rw-r--r--contrib/binutils/gas/config/tc-ia64.h2
-rw-r--r--contrib/binutils/gas/config/tc-tic30.c39
-rw-r--r--contrib/binutils/gas/config/tc-v850.c553
-rw-r--r--contrib/binutils/gas/config/tc-v850.h18
-rw-r--r--contrib/binutils/gas/config/tc-z8k.c34
-rw-r--r--contrib/binutils/gas/dep-in.sed3
-rw-r--r--contrib/binutils/gas/doc/Makefile.in6
-rw-r--r--contrib/binutils/gas/doc/c-sh.texi33
-rw-r--r--contrib/binutils/gas/write.c4
-rw-r--r--contrib/binutils/include/opcode/mips.h602
-rw-r--r--contrib/binutils/include/opcode/v850.h3
-rw-r--r--contrib/binutils/ld/ChangeLog51
-rw-r--r--contrib/binutils/ld/Makefile.am15
-rw-r--r--contrib/binutils/ld/Makefile.in25
-rw-r--r--contrib/binutils/ld/configure.host145
-rw-r--r--contrib/binutils/ld/dep-in.sed3
-rw-r--r--contrib/binutils/ld/emulparams/elf32bmip.sh20
-rwxr-xr-xcontrib/binutils/ld/emulparams/elf32bmipn32.sh48
-rwxr-xr-xcontrib/binutils/ld/emulparams/elf32bsmip.sh31
-rw-r--r--contrib/binutils/ld/emulparams/elf32ebmip.sh28
-rw-r--r--contrib/binutils/ld/emulparams/elf32elmip.sh28
-rw-r--r--contrib/binutils/ld/emulparams/elf32lmip.sh31
-rwxr-xr-xcontrib/binutils/ld/emulparams/elf32lsmip.sh31
-rwxr-xr-xcontrib/binutils/ld/emulparams/elf64bmip.sh69
-rwxr-xr-xcontrib/binutils/ld/emulparams/shelf.sh5
-rw-r--r--contrib/binutils/ld/emulparams/shelf_linux.sh14
-rw-r--r--contrib/binutils/ld/emulparams/shl.sh5
-rwxr-xr-xcontrib/binutils/ld/emulparams/shlelf.sh17
-rwxr-xr-xcontrib/binutils/ld/genscripts.sh2
-rw-r--r--contrib/binutils/ld/ldlang.c90
-rw-r--r--contrib/binutils/ld/ldmain.c14
-rw-r--r--contrib/binutils/ld/scripttempl/elf.sc17
-rw-r--r--contrib/binutils/ld/scripttempl/v850.sc8
-rw-r--r--contrib/binutils/opcodes/ChangeLog34
-rw-r--r--contrib/binutils/opcodes/Makefile.am43
-rw-r--r--contrib/binutils/opcodes/Makefile.in51
-rw-r--r--contrib/binutils/opcodes/aclocal.m434
-rw-r--r--contrib/binutils/opcodes/config.in9
-rwxr-xr-xcontrib/binutils/opcodes/configure758
-rw-r--r--contrib/binutils/opcodes/dep-in.sed2
-rw-r--r--contrib/binutils/opcodes/ppc-opc.c26
-rw-r--r--contrib/binutils/opcodes/v850-dis.c5
-rw-r--r--contrib/binutils/opcodes/v850-opc.c67
-rw-r--r--contrib/binutils/opcodes/z8k-dis.c153
-rw-r--r--contrib/binutils/opcodes/z8k-opc.h509
-rw-r--r--contrib/binutils/opcodes/z8kgen.c130
127 files changed, 15556 insertions, 8608 deletions
diff --git a/contrib/binutils/bfd/ChangeLog b/contrib/binutils/bfd/ChangeLog
index 5f9f0d8..f58ffce 100644
--- a/contrib/binutils/bfd/ChangeLog
+++ b/contrib/binutils/bfd/ChangeLog
@@ -1,3 +1,302 @@
+2002-04-06 Hans-Peter Nilsson <hp@axis.com>
+
+ * elf32-cris.c (cris_elf_howto_table) <R_CRIS_16_PCREL,
+ R_CRIS_32_PCREL>: Fix typo in name.
+ (cris_elf_check_relocs): Always create .rela.got here when
+ R_CRIS_16_GOTPLT or R_CRIS_32_GOTPLT is seen.
+ (elf_cris_adjust_gotplt_to_got): Don't create .rela.got here;
+ assume it's created.
+
+2002-04-04 Alan Modra <amodra@bigpond.net.au>
+
+ * configure.in: Bump version to 2.12.1 and comment out is_release.
+ * configure: Regenerate.
+ * dep-in.sed: Cope with absolute paths.
+ * Makefile.am (dep.sed): Subst TOPDIR, and not INCDIR.
+ Run "make dep-am".
+ * Makefile.in: Regenerate.
+
+ Merge from mainline
+ 2002-04-04 Alan Modra <amodra@bigpond.net.au>
+ * srec.c (MAXCHUNK, Chunk): Revise comments.
+ (srec_write_record): Correct buffer size.
+ (srec_write_header): Do without intermediate buffer.
+ (srec_write_section): Validate Chunk.
+ (srec_write_terminator): Pass NULL instead of dummy buffer.
+ (srec_write_symbols): Pass file and symbol names directly to
+ bfd_bwrite so sprintf won't overflow buffer.
+
+ 2002-04-03 Jakub Jelinek <jakub@redhat.com>
+ * elf32-sparc.c (elf32_sparc_relocate_section): Don't emit dynamic
+ PC relative relocs against hidden symbols.
+ * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
+
+ 2002-04-03 Alan Modra <amodra@bigpond.net.au>
+ * elf.c (_bfd_elf_make_section_from_shdr): When setting section
+ LMAs, loop over segments until p_vaddr and p_memsz specify an
+ extent enclosing the section.
+
+ 2002-04-02 Nick Clifton <nickc@cambridge.redhat.com>
+ * ihex.c (ihex_write_object_contents): Do not allow records to
+ cross a 64K boundary - wrap if necessary.
+
+ 2002-03-28 Alan Modra <amodra@bigpond.net.au>
+ * linker.c (link_action): Ignore duplicate warning syms.
+ (_bfd_generic_link_write_global_symbol): Follow warning symbol link.
+ * elflink.h (elf_adjust_dynstr_offsets): Likewise.
+ (elf_adjust_dynamic_symbol): Likewise.
+ (elf_export_symbol): Likewise.
+ (elf_link_find_version_dependencies): Likewise.
+ (elf_link_assign_sym_version): Likewise.
+ (elf_link_sec_merge_syms): Likewise.
+ (elf_link_output_extsym): Likewise.
+ (elf_gc_sweep_symbol): Likewise.
+ (elf_gc_propagate_vtable_entries_used): Likewise.
+ (elf_gc_smash_unused_vtentry_relocs): Likewise.
+ (elf_gc_allocate_got_offsets): Likewise.
+ (elf_collect_hash_codes): Likewise.
+ * elflink.c (elf_link_renumber_hash_table_dynsyms): Likewise.
+ * elf-hppa.h (elf_hppa_unmark_useless_dynamic_symbols): Likewise.
+ (elf_hppa_remark_useless_dynamic_symbols): Likewise.
+ * elf-m10300.c (elf32_mn10300_finish_hash_table_entry): Likewise.
+ * elf32-arm.h (elf32_arm_discard_copies): Likewise.
+ * elf32-cris.c (elf_cris_adjust_gotplt_to_got): Likewise.
+ (elf_cris_discard_excess_dso_dynamics): Likewise.
+ * elf32-hppa.c (clobber_millicode_symbols): Likewise.
+ (mark_PIC_calls): Likewise.
+ (allocate_plt_static): Likewise.
+ (allocate_dynrelocs): Likewise.
+ (readonly_dynrelocs): Likewise.
+ * elf32-i386.c (allocate_dynrelocs): Likewise.
+ (readonly_dynrelocs): Likewise.
+ * elf32-i370.c (i370_elf_adjust_dynindx): Likewise.
+ * elf32-m68k.c (elf_m68k_discard_copies): Likewise.
+ * elf32-mips.c (mips_elf_output_extsym): Likewise.
+ (mips_elf_sort_hash_table_f): Likewise.
+ (mips_elf_check_mips16_stubs): Likewise.
+ * elf32-s390.c (allocate_dynrelocs): Likewise.
+ (readonly_dynrelocs): Likewise.
+ * elf32-sh.c (sh_elf_discard_copies): Likewise.
+ * elf32-xstormy16.c (xstormy16_relax_plt_check): Likewise.
+ (xstormy16_relax_plt_realloc): Likewise.
+ * elf64-alpha.c (elf64_alpha_calc_got_offsets_for_symbol): Likewise.
+ (elf64_alpha_output_extsym): Likewise.
+ * elf64-hppa.c (elf64_hppa_mark_exported_functions): Likewise.
+ * elf64-mips.c (mips_elf64_sort_hash_table_f): Likewise.
+ (mips_elf64_check_mips16_stubs): Likewise.
+ (mips_elf64_output_extsym): Likewise.
+ * elf64-ppc.c (func_desc_adjust): Likewise.
+ (allocate_dynrelocs): Likewise.
+ (readonly_dynrelocs): Likewise.
+ * elf64-s390.c (allocate_dynrelocs): Likewise.
+ (readonly_dynrelocs): Likewise.
+ * elf64-sh64.c (sh64_elf64_discard_copies): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_discard_copies): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_global_dyn_sym_thunk): Likewise.
+ * aoutx.h (aout_link_write_other_symbol): Likewise.
+ * cofflink.c (_bfd_coff_write_task_globals): Likewise.
+ (_bfd_coff_write_global_sym): Likewise.
+ * i386linux.c (linux_tally_symbols): Likewise.
+ * m68klinux.c (linux_tally_symbols): Likewise.
+ * sparclinux.c (linux_tally_symbols): Likewise.
+ * pdp11.c (aout_link_write_other_symbol): Likewise.
+ * sunos.c (sunos_scan_dynamic_symbol): Likewise.
+ * xcofflink.c (xcoff_build_ldsyms): Likewise.
+ (xcoff_write_global_symbol): Likewise.
+ * cofflink.c (_bfd_coff_final_link): Formatting.
+ * elf32-i386.c (elf_i386_check_relocs): Formatting.
+ * elf32-sh.c (sh_elf_size_dynamic_sections): Likewise.
+ * elf64-alpha.c (elf64_alpha_output_extsym): Likewise.
+ * elf64-mips.c (mips_elf64_sort_hash_table): Likewise.
+ (mips_elf64_final_link): Likewise.
+ * elflink.h (elf_link_find_version_dependencies): Remove duplicate
+ prototype.
+
+ 2002-03-21 Richard Earnshaw <rearnsha@arm.com>
+ * elf32-arm.h (elf32_arm_final_link_relocate <case R_ARM_GOTOFF>,
+ <case R_ARM_GOT>): Handle relocations to Thumb functions.
+
+ 2002-03-19 Hans-Peter Nilsson <hp@bitrange.com>
+ * elflink.h (NAME(bfd_elf,record_link_assignment)): Don't set
+ STT_NOTYPE symbols to STT_OBJECT.
+
+ 2002-03-13 Alan Modra <amodra@bigpond.net.au>
+ * archures.c (bfd_default_compatible): Test bits_per_word.
+ * cpu-i386.c (i386_compatible): Remove. Replace occurrences with
+ bfd_default_compatible.
+ * cpu-i370.c (i370_compatible): Likewise.
+ * cpu-sparc.c (sparc_compatible): Likewise.
+ * cpu-h8300.c (compatible): Test in->arch == out->arch.
+
+ 2002-02-19 Martin Schwidefsky <schwidefsky@de.ibm.com>
+ * 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-04-03 Alan Modra <amodra@bigpond.net.au>
+
+ Merge from mainline.
+ 2002-03-28 Alan Modra <amodra@bigpond.net.au>
+ * cpu-mips.c (mips_compatible): Make static, prototype.
+
+ 2002-03-14 Alan Modra <amodra@bigpond.net.au>
+ * cpu-mips.c (mips_compatible): New. Don't check bits_per_word.
+ (N): Use the above.
+
+2002-04-01 Nathan Williams <nathanw@wasabisystems.com>
+
+ * elf.c (elfcore_netbsd_get_lwpid): Fix off-by-one error
+ which caused the returned LWP ID to always be 0.
+
+2002-04-01 Richard Henderson <rth@redhat.com>
+
+ * elf32-sparc.c (WILL_CALL_FINISH_DYNAMIC_SYMBOL): New.
+ (elf32_sparc_relocate_section): Use it to figure out when to
+ initialize .got entries.
+ * elf64-sparc.c: Similarly.
+
+2002-03-28 Alan Modra <amodra@bigpond.net.au>
+
+ * aclocal.m4: Regenerate.
+ * config.in: Regenerate.
+ * Makefile.am: Run "make dep-am".
+ * Makefile.in: Regenerate.
+
+ Merge from mainline
+ 2002-03-27 Gregory Steuck <greg@nest.cx>
+ * elf.c (_bfd_elf_get_symtab_upper_bound): Leave space for
+ terminating NULL if empty symbol table.
+ (_bfd_elf_get_dynamic_symtab_upper_bound): Likewise.
+
+ 2002-03-26 Alan Modra <amodra@bigpond.net.au>
+ * elflink.h (elf_gc_mark): Don't recurse into non-ELF sections.
+
+ 2002-03-23 Alan Modra <amodra@bigpond.net.au>
+ * elf.c (_bfd_elf_make_section_from_shdr): Don't set lma based on
+ section file offset for !SEC_LOAD sections.
+
+ 2002-03-20 Daniel Jacobowitz <drow@mvista.com>
+ * dwarf2.c (struct funcinfo): Move up.
+ (lookup_address_in_function_table): New argument function_ptr.
+ Set it.
+ (lookup_address_in_line_table): New argument function. If function
+ is non-NULL, use it to handle ``addr'' before the first line note of
+ the function.
+ (comp_unit_find_nearest_line): Update and swap calls to
+ lookup_address_in_function_table and lookup_address_in_line_table.
+ * syms.c (_bfd_stab_section_find_nearest_line): Use the first
+ N_SLINE encountered if we see an N_FUN before any N_SLINE.
+
+ 2002-03-18 Alan Modra <amodra@bigpond.net.au>
+ * libbfd.c (bfd_write_bigendian_4byte_int): Return true iff success.
+ * libbfd.h: Regenerate.
+ * archive.c (coff_write_armap): Pass on failures from
+ bfd_write_bigendian_4byte_int.
+
+ 2002-03-14 H.J. Lu <hjl@gnu.org>
+ * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Set the BFD
+ error to bfd_error_nonrepresentable_section for reinit_array
+ section in DSO.
+
+ 2002-03-14 Nick Clifton <nickc@cambridge.redhat.com>
+ * coffcode.h (coff_slurp_symbol_table): When adding BSF_WEAK flag,
+ OR it in rather than replacing previously selected flags.
+ * elfxx-target.h (TARGET_BIG_SYM): Set ar_max_namelen to 15.
+ (TARGET_LITTLE_SYM): Set ar_max_namelen to 15.
+
+ 2002-03-14 Alan Modra <amodra@bigpond.net.au>
+ * elflink.h (elf_bfd_final_link): Revert last change. Instead,
+ ensure reloc size matches before calling elf_link_input_bfd.
+ Add an assert to check reloc size when counting output relocs.
+
+ 2002-03-14 Nick Clifton <nickc@cambridge.redhat.com>
+ * mmo.c (mmo_get_loc): Return NULL rather than false.
+
+ 2002-03-13 Alan Modra <amodra@bigpond.net.au>
+ * elflink.h: Formatting fixes.
+ (elf_link_output_extsym): Merge undefined and undef weak cases.
+ * elflink.h (elf_bfd_final_link): Only call elf_link_input_bfd
+ when word size of input matches output word size.
+
+ 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 <dave@hiauly1.hia.nrc.ca>
+ * 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 <jakub@redhat.com>
+ * merge.c (_bfd_merge_sections): Don't segfault if there
+ is nothing to merge due to GC.
+
+ 2002-03-05 Alan Modra <amodra@bigpond.net.au>
+ * 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 <hjl@gnu.org>
+ * 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-01 David Mosberger <davidm@hpl.hp.com>
+ * 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-19 Frank Ch. Eigler <fche@redhat.com>
+ * syms.c (stt[]): Sorted. Added .init/.fini -> "t" mapping.
+
+ 2002-02-13 Nick Clifton <nickc@cambridge.redhat.com>
+ * 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-11 Michael Snyder <msnyder@redhat.com>
+ * 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-03-20 Tom Rix <trix@redhat.com>
* coff-rs6000.c (_bfd_xcoff_stat_arch_elt): Renamed from
diff --git a/contrib/binutils/bfd/Makefile.am b/contrib/binutils/bfd/Makefile.am
index 18438b3..411351b 100644
--- a/contrib/binutils/bfd/Makefile.am
+++ b/contrib/binutils/bfd/Makefile.am
@@ -700,8 +700,8 @@ DEP1: $(CFILES)
dep.sed: dep-in.sed config.status
sed <$(srcdir)/dep-in.sed >dep.sed \
-e 's!@BFD_H@!$(BFD_H)!' \
- -e 's!@INCDIR@!$(INCDIR)!' \
- -e 's!@SRCDIR@!$(srcdir)!'
+ -e 's!@SRCDIR@!$(srcdir)!' \
+ -e 's!@TOPDIR@!'`echo $(srcdir) | sed -e s,/bfd$$,,`'!'
dep: DEP
sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile
@@ -1141,12 +1141,9 @@ elf32-ppc.lo: elf32-ppc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.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 elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h $(srcdir)/../opcodes/sh64-opc.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
+ $(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 \
@@ -1426,6 +1423,10 @@ elf64-s390.lo: elf64-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 \
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 --git a/contrib/binutils/bfd/Makefile.in b/contrib/binutils/bfd/Makefile.in
index 98c3435..643196a 100644
--- a/contrib/binutils/bfd/Makefile.in
+++ b/contrib/binutils/bfd/Makefile.in
@@ -1,6 +1,6 @@
-# Makefile.in generated automatically by automake 1.4 from Makefile.am
+# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
-# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -750,7 +750,7 @@ configure.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-TAR = gtar
+TAR = tar
GZIP_ENV = --best
SOURCES = $(libbfd_a_SOURCES) $(libbfd_la_SOURCES)
OBJECTS = $(libbfd_a_OBJECTS) $(libbfd_la_OBJECTS)
@@ -917,7 +917,7 @@ maintainer-clean-recursive:
dot_seen=no; \
rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
rev="$$subdir $$rev"; \
- test "$$subdir" = "." && dot_seen=yes; \
+ test "$$subdir" != "." || dot_seen=yes; \
done; \
test "$$dot_seen" = "no" && rev=". $$rev"; \
target=`echo $@ | sed s/-recursive//`; \
@@ -1258,8 +1258,8 @@ DEP1: $(CFILES)
dep.sed: dep-in.sed config.status
sed <$(srcdir)/dep-in.sed >dep.sed \
-e 's!@BFD_H@!$(BFD_H)!' \
- -e 's!@INCDIR@!$(INCDIR)!' \
- -e 's!@SRCDIR@!$(srcdir)!'
+ -e 's!@SRCDIR@!$(srcdir)!' \
+ -e 's!@TOPDIR@!'`echo $(srcdir) | sed -e s,/bfd$$,,`'!'
dep: DEP
sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile
@@ -1685,12 +1685,9 @@ elf32-ppc.lo: elf32-ppc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.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 elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h $(srcdir)/../opcodes/sh64-opc.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
+ $(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 \
@@ -1970,6 +1967,10 @@ elf64-s390.lo: elf64-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 \
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 --git a/contrib/binutils/bfd/aclocal.m4 b/contrib/binutils/bfd/aclocal.m4
index 9f18aaf..4446fc1 100644
--- a/contrib/binutils/bfd/aclocal.m4
+++ b/contrib/binutils/bfd/aclocal.m4
@@ -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 --git a/contrib/binutils/bfd/aout-tic30.c b/contrib/binutils/bfd/aout-tic30.c
index a3e977d..e3c74fa 100644
--- a/contrib/binutils/bfd/aout-tic30.c
+++ b/contrib/binutils/bfd/aout-tic30.c
@@ -1,5 +1,5 @@
/* BFD back-end for TMS320C30 a.out binaries.
- Copyright 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au)
This file is part of BFD, the Binary File Descriptor library.
@@ -28,9 +28,12 @@
#define DEFAULT_ARCH bfd_arch_tic30
#define ARCH_SIZE 32
-#define MY(OP) CAT(tic30_aout_,OP)
+/* Do not "beautify" the CONCAT* macro args. Traditional C will not
+ remove whitespace added here, and thus will fail to concatenate
+ the tokens. */
+#define MY(OP) CONCAT2 (tic30_aout_,OP)
#define TARGETNAME "a.out-tic30"
-#define NAME(x,y) CAT3(tic30_aout,_32_,y)
+#define NAME(x,y) CONCAT3 (tic30_aout,_32_,y)
#include "bfd.h"
#include "sysdep.h"
@@ -56,8 +59,19 @@ static bfd_reloc_status_type tic30_aout_final_link_relocate
static const bfd_target *tic30_aout_object_p PARAMS ((bfd *));
static boolean tic30_aout_write_object_contents PARAMS ((bfd *));
static boolean tic30_aout_set_sizes PARAMS ((bfd *));
-
-#define MY_reloc_howto(BFD,REL,IN,EX,PC) tic30_aout_reloc_howto(BFD,REL,&IN,&EX,&PC)
+static const bfd_target * tic30_aout_callback PARAMS ((bfd *));
+static boolean MY_bfd_copy_private_section_data
+ PARAMS ((bfd *, asection *, bfd *, asection *));
+static boolean MY_bfd_final_link PARAMS ((bfd *, struct bfd_link_info *));
+reloc_howto_type * tic30_aout_reloc_type_lookup
+ PARAMS ((bfd *, bfd_reloc_code_real_type));
+enum machine_type tic30_aout_machine_type
+ PARAMS ((enum bfd_architecture, unsigned long, boolean *));
+boolean tic30_aout_set_arch_mach
+ PARAMS ((bfd *, enum bfd_architecture, unsigned long));
+
+#define MY_reloc_howto(BFD, REL, IN, EX, PC) \
+ tic30_aout_reloc_howto(BFD, REL, &IN, &EX, &PC)
#define MY_final_link_relocate tic30_aout_final_link_relocate
#define MY_object_p tic30_aout_object_p
#define MY_mkobject NAME(aout,mkobject)
@@ -101,7 +115,7 @@ static boolean tic30_aout_set_sizes PARAMS ((bfd *));
#define MY_finish_dynamic_link 0
#endif
-static CONST struct aout_backend_data tic30_aout_backend_data =
+static const struct aout_backend_data tic30_aout_backend_data =
{
MY_zmagic_contiguous,
MY_text_includes_header,
@@ -130,26 +144,27 @@ static CONST struct aout_backend_data tic30_aout_backend_data =
2) to get the 32-bit addresses in the format the TMS320C30 likes
it. */
reloc_howto_type tic30_aout_howto_table[] =
-{
- EMPTY_HOWTO (-1),
- HOWTO (1, 2, 1, 16, false, 0, 0, tic30_aout_fix_16,
- "16", false, 0x0000FFFF, 0x0000FFFF, false),
- HOWTO (2, 2, 2, 24, false, 0, complain_overflow_bitfield, NULL,
- "24", false, 0x00FFFFFF, 0x00FFFFFF, false),
- HOWTO (3, 18, 3, 24, false, 0, complain_overflow_bitfield, NULL,
- "LDP", false, 0x00FF0000, 0x000000FF, false),
- HOWTO (4, 2, 4, 32, false, 0, complain_overflow_bitfield, tic30_aout_fix_32,
- "32", false, 0xFFFFFFFF, 0xFFFFFFFF, false),
- HOWTO (5, 2, 1, 16, true, 0, complain_overflow_signed,
- tic30_aout_fix_pcrel_16, "PCREL", true, 0x0000FFFF, 0x0000FFFF, true),
- EMPTY_HOWTO (-1),
- EMPTY_HOWTO (-1),
- EMPTY_HOWTO (-1),
- EMPTY_HOWTO (-1),
- EMPTY_HOWTO (-1)
-};
-
-extern reloc_howto_type *NAME (aout, reloc_type_lookup) ();
+ {
+ EMPTY_HOWTO (-1),
+ HOWTO (1, 2, 1, 16, false, 0, 0, tic30_aout_fix_16,
+ "16", false, 0x0000FFFF, 0x0000FFFF, false),
+ HOWTO (2, 2, 2, 24, false, 0, complain_overflow_bitfield, NULL,
+ "24", false, 0x00FFFFFF, 0x00FFFFFF, false),
+ HOWTO (3, 18, 3, 24, false, 0, complain_overflow_bitfield, NULL,
+ "LDP", false, 0x00FF0000, 0x000000FF, false),
+ HOWTO (4, 2, 4, 32, false, 0, complain_overflow_bitfield, tic30_aout_fix_32,
+ "32", false, 0xFFFFFFFF, 0xFFFFFFFF, false),
+ HOWTO (5, 2, 1, 16, true, 0, complain_overflow_signed,
+ tic30_aout_fix_pcrel_16, "PCREL", true, 0x0000FFFF, 0x0000FFFF, true),
+ EMPTY_HOWTO (-1),
+ EMPTY_HOWTO (-1),
+ EMPTY_HOWTO (-1),
+ EMPTY_HOWTO (-1),
+ EMPTY_HOWTO (-1)
+ };
+
+extern reloc_howto_type *NAME (aout, reloc_type_lookup)
+ PARAMS ((bfd *, bfd_reloc_code_real_type));
reloc_howto_type *
tic30_aout_reloc_type_lookup (abfd, code)
@@ -317,10 +332,10 @@ tic30_aout_callback (abfd)
unsigned int arch_align_power;
unsigned long arch_align;
- /* Calculate the file positions of the parts of a newly read aout header */
+ /* Calculate the file positions of the parts of a newly read aout header. */
obj_textsec (abfd)->_raw_size = N_TXTSIZE (*execp);
- /* The virtual memory addresses of the sections */
+ /* The virtual memory addresses of the sections. */
obj_textsec (abfd)->vma = N_TXTADDR (*execp);
obj_datasec (abfd)->vma = N_DATADDR (*execp);
obj_bsssec (abfd)->vma = N_BSSADDR (*execp);
@@ -329,11 +344,11 @@ tic30_aout_callback (abfd)
obj_datasec (abfd)->lma = obj_datasec (abfd)->vma;
obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma;
- /* The file offsets of the sections */
+ /* The file offsets of the sections. */
obj_textsec (abfd)->filepos = N_TXTOFF (*execp);
obj_datasec (abfd)->filepos = N_DATOFF (*execp);
- /* The file offsets of the relocation info */
+ /* The file offsets of the relocation info. */
obj_textsec (abfd)->rel_filepos = N_TRELOFF (*execp);
obj_datasec (abfd)->rel_filepos = N_DRELOFF (*execp);
@@ -345,7 +360,7 @@ tic30_aout_callback (abfd)
#ifdef SET_ARCH_MACH
SET_ARCH_MACH (abfd, *execp);
#else
- bfd_default_set_arch_mach (abfd, DEFAULT_ARCH, 0);
+ bfd_default_set_arch_mach (abfd, DEFAULT_ARCH, 0L);
#endif
/* Now that we know the architecture, set the alignments of the
@@ -429,7 +444,9 @@ tic30_aout_relocate_contents (howto, input_bfd, relocation, location)
x = bfd_get_32 (input_bfd, location);
break;
}
+
overflow = false;
+
if (howto->complain_on_overflow != complain_overflow_dont)
{
bfd_vma check;
@@ -487,7 +504,9 @@ tic30_aout_relocate_contents (howto, input_bfd, relocation, location)
case complain_overflow_bitfield:
{
bfd_vma reloc_bits = (((1 << (howto->bitsize - 1)) - 1) << 1) | 1;
- if ((check & ~reloc_bits) != 0 && (((bfd_vma) signed_check & ~reloc_bits) != (-1 & ~reloc_bits)))
+ if ((check & ~reloc_bits) != 0
+ && (((bfd_vma) signed_check & ~reloc_bits)
+ != ((bfd_vma) -1 & ~reloc_bits)))
overflow = true;
}
break;
@@ -520,18 +539,18 @@ tic30_aout_relocate_contents (howto, input_bfd, relocation, location)
return overflow ? bfd_reloc_overflow : bfd_reloc_ok;
}
-/* Finish up the reading of an a.out file header */
+/* Finish up the reading of an a.out file header. */
static const bfd_target *
tic30_aout_object_p (abfd)
bfd *abfd;
{
- struct external_exec exec_bytes; /* Raw exec header from file */
- struct internal_exec exec; /* Cleaned-up exec header */
+ struct external_exec exec_bytes; /* Raw exec header from file. */
+ struct internal_exec exec; /* Cleaned-up exec header. */
const bfd_target *target;
+ bfd_size_type amt = EXEC_BYTES_SIZE;
- if (bfd_read ((PTR) & exec_bytes, 1, EXEC_BYTES_SIZE, abfd)
- != EXEC_BYTES_SIZE)
+ if (bfd_bread ((PTR) &exec_bytes, amt, abfd) != amt)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
@@ -541,7 +560,7 @@ tic30_aout_object_p (abfd)
#ifdef SWAP_MAGIC
exec.a_info = SWAP_MAGIC (exec_bytes.e_info);
#else
- exec.a_info = bfd_h_get_32 (abfd, exec_bytes.e_info);
+ exec.a_info = H_GET_32 (abfd, exec_bytes.e_info);
#endif /* SWAP_MAGIC */
if (N_BADMAG (exec))
@@ -562,10 +581,10 @@ tic30_aout_object_p (abfd)
#ifdef ENTRY_CAN_BE_ZERO
/* The NEWSOS3 entry-point is/was 0, which (amongst other lossage)
- * means that it isn't obvious if EXEC_P should be set.
- * All of the following must be true for an executable:
- * There must be no relocations, the bfd can be neither an
- * archive nor an archive element, and the file must be executable. */
+ means that it isn't obvious if EXEC_P should be set.
+ All of the following must be true for an executable:
+ There must be no relocations, the bfd can be neither an
+ archive nor an archive element, and the file must be executable. */
if (exec.a_trsize + exec.a_drsize == 0
&& bfd_get_format (abfd) == bfd_object && abfd->my_archive == NULL)
@@ -614,8 +633,9 @@ tic30_aout_write_object_contents (abfd)
obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
{
- bfd_size_type text_size; /* dummy vars */
+ bfd_size_type text_size; /* Dummy vars. */
file_ptr text_end;
+
if (adata (abfd).magic == undecided_magic)
NAME (aout, adjust_sizes_and_vmas) (abfd, &text_size, &text_end);
@@ -628,13 +648,15 @@ tic30_aout_write_object_contents (abfd)
if (adata (abfd).exec_bytes_size > 0)
{
+ bfd_size_type amt;
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
return false;
- if (bfd_write ((PTR) & exec_bytes, 1, adata (abfd).exec_bytes_size, abfd) != adata (abfd).exec_bytes_size)
+ amt = adata (abfd).exec_bytes_size;
+ if (bfd_bwrite ((PTR) &exec_bytes, amt, abfd) != amt)
return false;
}
- /* Now write out reloc info, followed by syms and strings */
+ /* Now write out reloc info, followed by syms and strings. */
if (bfd_get_outsymbols (abfd) != (asymbol **) NULL
&& bfd_get_symcount (abfd) != 0)
{
@@ -745,10 +767,10 @@ MY_bfd_final_link (abfd, info)
{
obj_datasec (abfd)->vma = BFD_ALIGN (vma, 4);
}
+
if (obj_datasec (abfd)->vma < vma)
- {
- obj_datasec (abfd)->vma = BFD_ALIGN (vma, 4);
- }
+ obj_datasec (abfd)->vma = BFD_ALIGN (vma, 4);
+
obj_datasec (abfd)->user_set_vma = 1;
vma = obj_datasec (abfd)->vma;
obj_datasec (abfd)->filepos = vma + adata (abfd).exec_bytes_size;
@@ -940,6 +962,9 @@ tic30_aout_set_arch_mach (abfd, arch, machine)
#ifndef MY_bfd_gc_sections
#define MY_bfd_gc_sections bfd_generic_gc_sections
#endif
+#ifndef MY_bfd_merge_sections
+#define MY_bfd_merge_sections bfd_generic_merge_sections
+#endif
#ifndef MY_bfd_reloc_type_lookup
#define MY_bfd_reloc_type_lookup tic30_aout_reloc_type_lookup
#endif
diff --git a/contrib/binutils/bfd/aoutx.h b/contrib/binutils/bfd/aoutx.h
index 0a3c05a..3c9cd4f 100644
--- a/contrib/binutils/bfd/aoutx.h
+++ b/contrib/binutils/bfd/aoutx.h
@@ -1,6 +1,6 @@
/* BFD semi-generic back-end for a.out binaries.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
- 2001
+ 2001, 2002
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -4577,6 +4577,13 @@ aout_link_write_other_symbol (h, data)
bfd_size_type indx;
bfd_size_type amt;
+ if (h->root.type == bfd_link_hash_warning)
+ {
+ h = (struct aout_link_hash_entry *) h->root.u.i.link;
+ if (h->root.type == bfd_link_hash_new)
+ return true;
+ }
+
output_bfd = finfo->output_bfd;
if (aout_backend_info (output_bfd)->write_dynamic_symbol != NULL)
@@ -4605,6 +4612,7 @@ aout_link_write_other_symbol (h, data)
switch (h->root.type)
{
default:
+ case bfd_link_hash_warning:
abort ();
/* Avoid variable not initialized warnings. */
return true;
@@ -4646,9 +4654,8 @@ aout_link_write_other_symbol (h, data)
type = N_WEAKU;
val = 0;
case bfd_link_hash_indirect:
- case bfd_link_hash_warning:
- /* FIXME: Ignore these for now. The circumstances under which
- they should be written out are not clear to me. */
+ /* We ignore these symbols, since the indirected symbol is
+ already in the hash table. */
return true;
}
diff --git a/contrib/binutils/bfd/archive.c b/contrib/binutils/bfd/archive.c
index fc2ba45..e9e07c5 100644
--- a/contrib/binutils/bfd/archive.c
+++ b/contrib/binutils/bfd/archive.c
@@ -1,6 +1,6 @@
/* BFD back-end for archive files (libraries).
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001
+ 2000, 2001, 2002
Free Software Foundation, Inc.
Written by Cygnus Support. Mostly Gumby Henkel-Wallace's fault.
@@ -2190,7 +2190,8 @@ coff_write_armap (arch, elength, map, symbol_count, stridx)
!= sizeof (struct ar_hdr))
return false;
- bfd_write_bigendian_4byte_int (arch, symbol_count);
+ if (!bfd_write_bigendian_4byte_int (arch, symbol_count))
+ return false;
/* Two passes, first write the file offsets for each symbol -
remembering that each offset is on a two byte boundary. */
@@ -2207,7 +2208,8 @@ coff_write_armap (arch, elength, map, symbol_count, stridx)
while (count < symbol_count && map[count].u.abfd == current)
{
- bfd_write_bigendian_4byte_int (arch, archive_member_file_ptr);
+ if (!bfd_write_bigendian_4byte_int (arch, archive_member_file_ptr))
+ return false;
count++;
}
/* Add size of this archive entry. */
diff --git a/contrib/binutils/bfd/archures.c b/contrib/binutils/bfd/archures.c
index 1caac7f..9a91424 100644
--- a/contrib/binutils/bfd/archures.c
+++ b/contrib/binutils/bfd/archures.c
@@ -259,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,
@@ -722,6 +722,9 @@ bfd_default_compatible (a, b)
if (a->arch != b->arch)
return NULL;
+ if (a->bits_per_word != b->bits_per_word)
+ return NULL;
+
if (a->mach > b->mach)
return a;
diff --git a/contrib/binutils/bfd/bfd-in2.h b/contrib/binutils/bfd/bfd-in2.h
index ff4ba0d..93696ae 100644
--- a/contrib/binutils/bfd/bfd-in2.h
+++ b/contrib/binutils/bfd/bfd-in2.h
@@ -1638,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,
diff --git a/contrib/binutils/bfd/coff-arm.c b/contrib/binutils/bfd/coff-arm.c
index ca08131..798cd49 100644
--- a/contrib/binutils/bfd/coff-arm.c
+++ b/contrib/binutils/bfd/coff-arm.c
@@ -1,6 +1,6 @@
/* BFD back-end for ARM COFF files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001
+ 2000, 2001, 2002
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -900,6 +900,11 @@ coff_arm_reloc_type_lookup (abfd, code)
#define BADMAG(x) ARMBADMAG(x)
#define ARM 1 /* Customize coffcode.h */
+/* Make sure that the 'r_offset' field is copied properly
+ so that identical binaries will compare the same. */
+#define SWAP_IN_RELOC_OFFSET H_GET_32
+#define SWAP_OUT_RELOC_OFFSET H_PUT_32
+
/* Extend the coff_link_hash_table structure with a few ARM specific fields.
This allows us to store global data here without actually creating any
global variables, which is a no-no in the BFD world. */
diff --git a/contrib/binutils/bfd/coff-mips.c b/contrib/binutils/bfd/coff-mips.c
index bb4b15e..672b07f 100644
--- a/contrib/binutils/bfd/coff-mips.c
+++ b/contrib/binutils/bfd/coff-mips.c
@@ -1,5 +1,6 @@
/* BFD back-end for MIPS Extended-Coff files.
- Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+ 2000, 2001
Free Software Foundation, Inc.
Original version by Per Bothner.
Full support added by Ian Lance Taylor, ian@cygnus.com.
@@ -115,7 +116,6 @@ static boolean mips_relax_pcrel16 PARAMS ((struct bfd_link_info *, bfd *,
bfd_byte *, bfd_vma));
static reloc_howto_type *mips_bfd_reloc_type_lookup
PARAMS ((bfd *, bfd_reloc_code_real_type));
-
/* ECOFF has COFF sections, but the debugging information is stored in
a completely different format. ECOFF targets use some of the
@@ -366,7 +366,7 @@ static reloc_howto_type mips_howto_table[] =
#define MIPS_HOWTO_COUNT \
(sizeof mips_howto_table / sizeof mips_howto_table[0])
-/* When the linker is doing relaxing, it may change a external PCREL16
+/* When the linker is doing relaxing, it may change an external PCREL16
reloc. This typically represents an instruction like
bal foo
We change it to
@@ -426,7 +426,7 @@ mips_ecoff_swap_reloc_in (abfd, ext_ptr, intern)
{
const RELOC *ext = (RELOC *) ext_ptr;
- intern->r_vaddr = bfd_h_get_32 (abfd, (bfd_byte *) ext->r_vaddr);
+ intern->r_vaddr = H_GET_32 (abfd, ext->r_vaddr);
if (bfd_header_big_endian (abfd))
{
intern->r_symndx = (((int) ext->r_bits[0]
@@ -503,7 +503,7 @@ mips_ecoff_swap_reloc_out (abfd, intern, dst)
r_symndx = intern->r_offset & 0xffffff;
}
- bfd_h_put_32 (abfd, intern->r_vaddr, (bfd_byte *) ext->r_vaddr);
+ H_PUT_32 (abfd, intern->r_vaddr, ext->r_vaddr);
if (bfd_header_big_endian (abfd))
{
ext->r_bits[0] = r_symndx >> RELOC_BITS0_SYMNDX_SH_LEFT_BIG;
@@ -691,7 +691,7 @@ mips_refhi_reloc (abfd,
return bfd_reloc_outofrange;
/* Save the information, and let REFLO do the actual relocation. */
- n = (struct mips_hi *) bfd_malloc (sizeof *n);
+ n = (struct mips_hi *) bfd_malloc ((bfd_size_type) sizeof *n);
if (n == NULL)
return bfd_reloc_outofrange;
n->addr = (bfd_byte *) data + reloc_entry->address;
@@ -758,8 +758,8 @@ mips_reflo_reloc (abfd,
if ((val & 0x8000) != 0)
val += 0x10000;
- insn = (insn &~ 0xffff) | ((val >> 16) & 0xffff);
- bfd_put_32 (abfd, insn, l->addr);
+ insn = (insn &~ (unsigned) 0xffff) | ((val >> 16) & 0xffff);
+ bfd_put_32 (abfd, (bfd_vma) insn, l->addr);
next = l->next;
free (l);
@@ -854,7 +854,7 @@ mips_gprel_reloc (abfd,
{
for (i = 0; i < count; i++, sym++)
{
- register CONST char *name;
+ register const char *name;
name = bfd_asymbol_name (*sym);
if (*name == '_' && strcmp (name, "_gp") == 0)
@@ -903,14 +903,14 @@ mips_gprel_reloc (abfd,
|| (symbol->flags & BSF_SECTION_SYM) != 0)
val += relocation - gp;
- insn = (insn &~ 0xffff) | (val & 0xffff);
- bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address);
+ insn = (insn &~ (unsigned) 0xffff) | (val & 0xffff);
+ bfd_put_32 (abfd, (bfd_vma) insn, (bfd_byte *) data + reloc_entry->address);
if (relocateable != false)
reloc_entry->address += input_section->output_offset;
/* Make sure it fit in 16 bits. */
- if (val >= 0x8000 && val < 0xffff8000)
+ if ((long) val >= 0x8000 || (long) val < -0x8000)
return bfd_reloc_overflow;
return bfd_reloc_ok;
@@ -982,7 +982,7 @@ mips_relhi_reloc (abfd,
return bfd_reloc_outofrange;
/* Save the information, and let RELLO do the actual relocation. */
- n = (struct mips_hi *) bfd_malloc (sizeof *n);
+ n = (struct mips_hi *) bfd_malloc ((bfd_size_type) sizeof *n);
if (n == NULL)
return bfd_reloc_outofrange;
n->addr = (bfd_byte *) data + reloc_entry->address;
@@ -1059,8 +1059,8 @@ mips_rello_reloc (abfd,
if ((val & 0x8000) != 0)
val += 0x10000;
- insn = (insn &~ 0xffff) | ((val >> 16) & 0xffff);
- bfd_put_32 (abfd, insn, l->addr);
+ insn = (insn &~ (unsigned) 0xffff) | ((val >> 16) & 0xffff);
+ bfd_put_32 (abfd, (bfd_vma) insn, l->addr);
next = l->next;
free (l);
@@ -1100,7 +1100,6 @@ mips_rello_reloc (abfd,
requires special handling when relaxing. We don't want
bfd_perform_relocation to tamper with it at all. */
-/*ARGSUSED*/
static bfd_reloc_status_type
mips_switch_reloc (abfd,
reloc_entry,
@@ -1147,7 +1146,7 @@ mips_bfd_reloc_type_lookup (abfd, code)
case BFD_RELOC_LO16:
mips_type = MIPS_R_REFLO;
break;
- case BFD_RELOC_MIPS_GPREL:
+ case BFD_RELOC_GPREL16:
mips_type = MIPS_R_GPREL;
break;
case BFD_RELOC_MIPS_LITERAL:
@@ -1195,7 +1194,7 @@ mips_relocate_hi (refhi, reflo, input_bfd, input_section, contents, adjust,
if (refhi == NULL)
return;
-
+
insn = bfd_get_32 (input_bfd,
contents + adjust + refhi->r_vaddr - input_section->vma);
if (reflo == NULL)
@@ -1204,7 +1203,7 @@ mips_relocate_hi (refhi, reflo, input_bfd, input_section, contents, adjust,
vallo = (bfd_get_32 (input_bfd,
contents + adjust + reflo->r_vaddr - input_section->vma)
& 0xffff);
-
+
val = ((insn & 0xffff) << 16) + vallo;
val += relocation;
@@ -1224,7 +1223,7 @@ mips_relocate_hi (refhi, reflo, input_bfd, input_section, contents, adjust,
if ((val & 0x8000) != 0)
val += 0x10000;
- insn = (insn &~ 0xffff) | ((val >> 16) & 0xffff);
+ insn = (insn &~ (unsigned) 0xffff) | ((val >> 16) & 0xffff);
bfd_put_32 (input_bfd, (bfd_vma) insn,
contents + adjust + refhi->r_vaddr - input_section->vma);
}
@@ -1252,6 +1251,7 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section,
unsigned int i;
boolean got_lo;
struct internal_reloc lo_int_rel;
+ bfd_size_type amt;
BFD_ASSERT (input_bfd->xvec->byteorder
== output_bfd->xvec->byteorder);
@@ -1262,10 +1262,8 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section,
symndx_to_section = ecoff_data (input_bfd)->symndx_to_section;
if (symndx_to_section == (asection **) NULL)
{
- symndx_to_section = ((asection **)
- bfd_alloc (input_bfd,
- (NUM_RELOC_SECTIONS
- * sizeof (asection *))));
+ amt = NUM_RELOC_SECTIONS * sizeof (asection *);
+ symndx_to_section = (asection **) bfd_alloc (input_bfd, amt);
if (!symndx_to_section)
return false;
@@ -1432,7 +1430,7 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section,
if (gp_undefined)
{
if (! ((*info->callbacks->reloc_dangerous)
- (info, _("GP relative relocation when GP not defined"),
+ (info, _("GP relative relocation used when GP not defined"),
input_bfd, input_section,
int_rel.r_vaddr - input_section->vma)))
return false;
@@ -1505,7 +1503,7 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section,
memmove (here + PCREL16_EXPANSION_ADJUSTMENT, here,
(size_t) (input_section->_raw_size
- (int_rel.r_vaddr - input_section->vma)));
-
+
/* Generate the new instructions. */
if (! mips_relax_pcrel16 (info, input_bfd, input_section,
h, here,
@@ -1626,7 +1624,7 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section,
int_rel.r_symndx = RELOC_SECTION_TEXT;
break;
}
-
+
if (int_rel.r_symndx == -1)
abort ();
@@ -1881,12 +1879,13 @@ mips_read_relocs (abfd, sec)
asection *sec;
{
struct ecoff_section_tdata *section_tdata;
+ bfd_size_type amt;
section_tdata = ecoff_section_data (abfd, sec);
if (section_tdata == (struct ecoff_section_tdata *) NULL)
{
- sec->used_by_bfd =
- (PTR) bfd_alloc (abfd, sizeof (struct ecoff_section_tdata));
+ amt = sizeof (struct ecoff_section_tdata);
+ sec->used_by_bfd = (PTR) bfd_alloc (abfd, amt);
if (sec->used_by_bfd == NULL)
return false;
@@ -1898,20 +1897,14 @@ mips_read_relocs (abfd, sec)
if (section_tdata->external_relocs == NULL)
{
- bfd_size_type external_relocs_size;
-
- external_relocs_size = (ecoff_backend (abfd)->external_reloc_size
- * sec->reloc_count);
-
- section_tdata->external_relocs =
- (PTR) bfd_alloc (abfd, external_relocs_size);
- if (section_tdata->external_relocs == NULL && external_relocs_size != 0)
+ amt = ecoff_backend (abfd)->external_reloc_size;
+ amt *= sec->reloc_count;
+ section_tdata->external_relocs = (PTR) bfd_alloc (abfd, amt);
+ if (section_tdata->external_relocs == NULL && amt != 0)
return false;
if (bfd_seek (abfd, sec->rel_filepos, SEEK_SET) != 0
- || (bfd_read (section_tdata->external_relocs, 1,
- external_relocs_size, abfd)
- != external_relocs_size))
+ || bfd_bread (section_tdata->external_relocs, amt, abfd) != amt)
return false;
}
@@ -2010,6 +2003,7 @@ mips_relax_section (abfd, sec, info, again)
struct ecoff_link_hash_entry **adj_h_ptr;
struct ecoff_link_hash_entry **adj_h_ptr_end;
struct ecoff_value_adjust *adjust;
+ bfd_size_type amt;
/* If we have already expanded this reloc, we certainly don't
need to do it again. */
@@ -2086,7 +2080,7 @@ mips_relax_section (abfd, sec, info, again)
if (info->keep_memory)
contents = (bfd_byte *) bfd_alloc (abfd, sec->_raw_size);
else
- contents = (bfd_byte *) bfd_malloc ((size_t) sec->_raw_size);
+ contents = (bfd_byte *) bfd_malloc (sec->_raw_size);
if (contents == (bfd_byte *) NULL)
goto error_return;
if (! bfd_get_section_contents (abfd, sec, (PTR) contents,
@@ -2104,7 +2098,7 @@ mips_relax_section (abfd, sec, info, again)
somebody felt it were important. Ignoring this reloc will
presumably cause a reloc overflow error later on. */
if (bfd_get_32 (abfd, contents + int_rel.r_vaddr - sec->vma)
- != 0x0411ffff) /* bgezal $0,. == bal . */
+ != 0x0411ffff) /* bgezal $0,. == bal . */
continue;
/* Bother. We need to expand this reloc, and we will need to
@@ -2119,13 +2113,13 @@ mips_relax_section (abfd, sec, info, again)
if (offsets == (long *) NULL)
{
- size_t size;
+ bfd_size_type size;
- size = sec->reloc_count * sizeof (long);
+ size = (bfd_size_type) sec->reloc_count * sizeof (long);
offsets = (long *) bfd_alloc (abfd, size);
if (offsets == (long *) NULL)
goto error_return;
- memset (offsets, 0, size);
+ memset (offsets, 0, (size_t) size);
section_tdata->offsets = offsets;
}
@@ -2180,7 +2174,7 @@ mips_relax_section (abfd, sec, info, again)
mips_ecoff_swap_reloc_in (abfd, (PTR) (adj_ext_rel + 1), &rello);
BFD_ASSERT (rello.r_type == MIPS_R_RELLO);
-
+
addhi = bfd_get_32 (abfd,
contents + adj_int_rel.r_vaddr - sec->vma);
addhi &= 0xffff;
@@ -2298,8 +2292,8 @@ mips_relax_section (abfd, sec, info, again)
/* Add an entry to the symbol value adjust list. This is used
by bfd_ecoff_debug_accumulate to adjust the values of
internal symbols and FDR's. */
- adjust = ((struct ecoff_value_adjust *)
- bfd_alloc (abfd, sizeof (struct ecoff_value_adjust)));
+ amt = sizeof (struct ecoff_value_adjust);
+ adjust = (struct ecoff_value_adjust *) bfd_alloc (abfd, amt);
if (adjust == (struct ecoff_value_adjust *) NULL)
goto error_return;
@@ -2352,15 +2346,17 @@ mips_relax_pcrel16 (info, input_bfd, input_section, h, location, address)
if ((relocation & 0x8000) != 0)
relocation += 0x10000;
- bfd_put_32 (input_bfd, 0x04110001, location); /* bal .+8 */
+ bfd_put_32 (input_bfd, (bfd_vma) 0x04110001, location); /* bal .+8 */
bfd_put_32 (input_bfd,
0x3c010000 | ((relocation >> 16) & 0xffff), /* lui $at,XX */
location + 4);
bfd_put_32 (input_bfd,
0x24210000 | (relocation & 0xffff), /* addiu $at,$at,XX */
location + 8);
- bfd_put_32 (input_bfd, 0x003f0821, location + 12); /* addu $at,$at,$ra */
- bfd_put_32 (input_bfd, 0x0020f809, location + 16); /* jalr $at */
+ bfd_put_32 (input_bfd,
+ (bfd_vma) 0x003f0821, location + 12); /* addu $at,$at,$ra */
+ bfd_put_32 (input_bfd,
+ (bfd_vma) 0x0020f809, location + 16); /* jalr $at */
return true;
}
@@ -2387,6 +2383,7 @@ bfd_mips_ecoff_create_embedded_relocs (abfd, info, datasec, relsec, errmsg)
struct external_reloc *ext_rel;
struct external_reloc *ext_rel_end;
bfd_byte *p;
+ bfd_size_type amt;
BFD_ASSERT (! info->relocateable);
@@ -2400,7 +2397,8 @@ bfd_mips_ecoff_create_embedded_relocs (abfd, info, datasec, relsec, errmsg)
if (! mips_read_relocs (abfd, datasec))
return false;
- relsec->contents = (bfd_byte *) bfd_alloc (abfd, datasec->reloc_count * 4);
+ amt = (bfd_size_type) datasec->reloc_count * 4;
+ relsec->contents = (bfd_byte *) bfd_alloc (abfd, amt);
if (relsec->contents == NULL)
return false;
@@ -2505,7 +2503,7 @@ static const struct ecoff_backend_data mips_ecoff_backend_data =
(unsigned (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* reloc_out */
mips_ecoff_swap_filehdr_out, mips_ecoff_swap_aouthdr_out,
mips_ecoff_swap_scnhdr_out,
- FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, FILNMLEN, true, false, 4,
+ FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, FILNMLEN, true, false, 4, false, 2,
mips_ecoff_swap_filehdr_in, mips_ecoff_swap_aouthdr_in,
mips_ecoff_swap_scnhdr_in, NULL,
mips_ecoff_bad_format_hook, _bfd_ecoff_set_arch_mach_hook,
@@ -2601,6 +2599,9 @@ static const struct ecoff_backend_data mips_ecoff_backend_data =
/* GC of sections is not done. */
#define _bfd_ecoff_bfd_gc_sections bfd_generic_gc_sections
+/* Merging of sections is not done. */
+#define _bfd_ecoff_bfd_merge_sections bfd_generic_merge_sections
+
extern const bfd_target ecoff_big_vec;
const bfd_target ecoff_little_vec =
@@ -2643,7 +2644,7 @@ const bfd_target ecoff_little_vec =
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
& ecoff_big_vec,
-
+
(PTR) &mips_ecoff_backend_data
};
@@ -2686,7 +2687,7 @@ const bfd_target ecoff_big_vec =
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
& ecoff_little_vec,
-
+
(PTR) &mips_ecoff_backend_data
};
@@ -2730,6 +2731,6 @@ const bfd_target ecoff_biglittle_vec =
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
-
+
(PTR) &mips_ecoff_backend_data
};
diff --git a/contrib/binutils/bfd/coff-tic30.c b/contrib/binutils/bfd/coff-tic30.c
index 5b8ffd4..a3bbc4c 100644
--- a/contrib/binutils/bfd/coff-tic30.c
+++ b/contrib/binutils/bfd/coff-tic30.c
@@ -1,5 +1,5 @@
/* BFD back-end for TMS320C30 coff binaries.
- Copyright 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au)
This file is part of BFD, the Binary File Descriptor library.
@@ -27,22 +27,28 @@
#include "coff/internal.h"
#include "libcoff.h"
+static int coff_tic30_select_reloc PARAMS ((reloc_howto_type *));
+static void rtype2howto PARAMS ((arelent *, struct internal_reloc *));
+static void reloc_processing PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *));
+
+reloc_howto_type * tic30_coff_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type));
+
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (1)
reloc_howto_type tic30_coff_howto_table[] =
-{
- HOWTO (R_TIC30_ABS16, 2, 1, 16, false, 0, 0, NULL,
- "16", false, 0x0000FFFF, 0x0000FFFF, false),
- HOWTO (R_TIC30_ABS24, 2, 2, 24, false, 8, complain_overflow_bitfield, NULL,
- "24", false, 0xFFFFFF00, 0xFFFFFF00, false),
- HOWTO (R_TIC30_LDP, 18, 0, 24, false, 0, complain_overflow_bitfield, NULL,
- "LDP", false, 0x00FF0000, 0x000000FF, false),
- HOWTO (R_TIC30_ABS32, 2, 2, 32, false, 0, complain_overflow_bitfield, NULL,
- "32", false, 0xFFFFFFFF, 0xFFFFFFFF, false),
- HOWTO (R_TIC30_PC16, 2, 1, 16, true, 0, complain_overflow_signed, NULL,
- "PCREL", false, 0x0000FFFF, 0x0000FFFF, false),
- EMPTY_HOWTO (-1)
-};
+ {
+ HOWTO (R_TIC30_ABS16, 2, 1, 16, false, 0, 0, NULL,
+ "16", false, 0x0000FFFF, 0x0000FFFF, false),
+ HOWTO (R_TIC30_ABS24, 2, 2, 24, false, 8, complain_overflow_bitfield, NULL,
+ "24", false, 0xFFFFFF00, 0xFFFFFF00, false),
+ HOWTO (R_TIC30_LDP, 18, 0, 24, false, 0, complain_overflow_bitfield, NULL,
+ "LDP", false, 0x00FF0000, 0x000000FF, false),
+ HOWTO (R_TIC30_ABS32, 2, 2, 32, false, 0, complain_overflow_bitfield, NULL,
+ "32", false, 0xFFFFFFFF, 0xFFFFFFFF, false),
+ HOWTO (R_TIC30_PC16, 2, 1, 16, true, 0, complain_overflow_signed, NULL,
+ "PCREL", false, 0x0000FFFF, 0x0000FFFF, false),
+ EMPTY_HOWTO (-1)
+ };
#ifndef coff_bfd_reloc_type_lookup
#define coff_bfd_reloc_type_lookup tic30_coff_reloc_type_lookup
@@ -50,6 +56,7 @@ reloc_howto_type tic30_coff_howto_table[] =
/* For the case statement use the code values used in tc_gen_reloc to
map to the howto table entries that match those in both the aout
and coff implementations. */
+
reloc_howto_type *
tic30_coff_reloc_type_lookup (abfd, code)
bfd *abfd ATTRIBUTE_UNUSED;
@@ -75,7 +82,7 @@ tic30_coff_reloc_type_lookup (abfd, code)
#endif
-/* Turn a howto into a reloc number */
+/* Turn a howto into a reloc number. */
static int
coff_tic30_select_reloc (howto)
@@ -91,8 +98,8 @@ coff_tic30_select_reloc (howto)
#define __A_MAGIC_SET__
/* Code to swap in the reloc */
-#define SWAP_IN_RELOC_OFFSET bfd_h_get_32
-#define SWAP_OUT_RELOC_OFFSET bfd_h_put_32
+#define SWAP_IN_RELOC_OFFSET H_GET_32
+#define SWAP_OUT_RELOC_OFFSET H_PUT_32
#define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) dst->r_stuff[0] = 'S'; \
dst->r_stuff[1] = 'C';
@@ -126,7 +133,7 @@ rtype2howto (internal, dst)
}
}
-#define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry)
+#define RTYPE2HOWTO(internal, relocentry) rtype2howto (internal, relocentry)
/* Perform any necessary magic to the addend in a reloc entry */
@@ -148,13 +155,10 @@ reloc_processing (relent, reloc, symbols, abfd, section)
rtype2howto (relent, reloc);
if (reloc->r_symndx > 0)
- {
- relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx];
- }
+ relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx];
else
- {
- relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
- }
+ relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
+
relent->addend = reloc->r_offset;
relent->address -= section->vma;
}
diff --git a/contrib/binutils/bfd/coff-z8k.c b/contrib/binutils/bfd/coff-z8k.c
index 817b6dc..c626cd7 100644
--- a/contrib/binutils/bfd/coff-z8k.c
+++ b/contrib/binutils/bfd/coff-z8k.c
@@ -28,15 +28,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "coff/internal.h"
#include "libcoff.h"
+static void extra_case PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *, bfd_byte *, unsigned int *, unsigned int *));
+static void reloc_processing PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *));
+static void rtype2howto PARAMS ((arelent *, struct internal_reloc *));
+static int coff_z8k_select_reloc PARAMS ((reloc_howto_type *));
+
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (1)
static reloc_howto_type r_imm32 =
-HOWTO (R_IMM32, 0, 1, 32, false, 0,
+HOWTO (R_IMM32, 0, 2, 32, false, 0,
complain_overflow_bitfield, 0, "r_imm32", true, 0xffffffff,
0xffffffff, false);
static reloc_howto_type r_imm4l =
-HOWTO (R_IMM4L, 0, 1, 4, false, 0,
+HOWTO (R_IMM4L, 0, 0, 4, false, 0,
complain_overflow_bitfield, 0, "r_imm4l", true, 0xf, 0xf, false);
static reloc_howto_type r_da =
@@ -45,14 +50,27 @@ HOWTO (R_IMM16, 0, 1, 16, false, 0,
false);
static reloc_howto_type r_imm8 =
-HOWTO (R_IMM8, 0, 1, 8, false, 0,
+HOWTO (R_IMM8, 0, 0, 8, false, 0,
complain_overflow_bitfield, 0, "r_imm8", true, 0x000000ff, 0x000000ff,
false);
+static reloc_howto_type r_rel16 =
+HOWTO (R_REL16, 0, 1, 16, false, 0,
+ complain_overflow_bitfield, 0, "r_rel16", true, 0x0000ffff, 0x0000ffff,
+ true);
+
static reloc_howto_type r_jr =
-HOWTO (R_JR, 0, 1, 8, true, 0, complain_overflow_signed, 0,
+HOWTO (R_JR, 0, 0, 8, true, 0, complain_overflow_signed, 0,
"r_jr", true, 0, 0, true);
+static reloc_howto_type r_disp7 =
+HOWTO (R_DISP7, 0, 0, 7, true, 0, complain_overflow_bitfield, 0,
+ "r_disp7", true, 0, 0, true);
+
+static reloc_howto_type r_callr =
+HOWTO (R_CALLR, 0, 1, 12, true, 0, complain_overflow_signed, 0,
+ "r_callr", true, 0xfff, 0xfff, true);
+
/* Turn a howto into a reloc number */
static int
@@ -68,15 +86,14 @@ coff_z8k_select_reloc (howto)
#define Z8K 1 /* Customize coffcode.h */
#define __A_MAGIC_SET__
-/* Code to swap in the reloc */
-#define SWAP_IN_RELOC_OFFSET bfd_h_get_32
-#define SWAP_OUT_RELOC_OFFSET bfd_h_put_32
+/* Code to swap in the reloc. */
+#define SWAP_IN_RELOC_OFFSET H_GET_32
+#define SWAP_OUT_RELOC_OFFSET H_PUT_32
#define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) \
dst->r_stuff[0] = 'S'; \
dst->r_stuff[1] = 'C';
-/* Code to turn a r_type into a howto ptr, uses the above howto table
- */
+/* Code to turn a r_type into a howto ptr, uses the above howto table. */
static void
rtype2howto (internal, dst)
@@ -97,6 +114,15 @@ rtype2howto (internal, dst)
case R_JR:
internal->howto = &r_jr;
break;
+ case R_DISP7:
+ internal->howto = &r_disp7;
+ break;
+ case R_CALLR:
+ internal->howto = &r_callr;
+ break;
+ case R_REL16:
+ internal->howto = &r_rel16;
+ break;
case R_IMM32:
internal->howto = &r_imm32;
break;
@@ -106,9 +132,9 @@ rtype2howto (internal, dst)
}
}
-#define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry)
+#define RTYPE2HOWTO(internal, relocentry) rtype2howto (internal, relocentry)
-/* Perform any necessary magic to the addend in a reloc entry */
+/* Perform any necessary magic to the addend in a reloc entry. */
#define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \
cache_ptr->addend = ext_reloc.r_offset;
@@ -119,7 +145,7 @@ rtype2howto (internal, dst)
static void
reloc_processing (relent, reloc, symbols, abfd, section)
arelent * relent;
- struct internal_reloc *reloc;
+ struct internal_reloc * reloc;
asymbol ** symbols;
bfd * abfd;
asection * section;
@@ -128,13 +154,9 @@ reloc_processing (relent, reloc, symbols, abfd, section)
rtype2howto (relent, reloc);
if (reloc->r_symndx > 0)
- {
- relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx];
- }
+ relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx];
else
- {
- relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
- }
+ relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
relent->addend = reloc->r_offset;
relent->address -= section->vma;
@@ -142,15 +164,15 @@ reloc_processing (relent, reloc, symbols, abfd, section)
static void
extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)
- bfd *in_abfd;
- struct bfd_link_info *link_info;
- struct bfd_link_order *link_order;
- arelent *reloc;
- bfd_byte *data;
- unsigned int *src_ptr;
- unsigned int *dst_ptr;
+ bfd * in_abfd;
+ struct bfd_link_info * link_info;
+ struct bfd_link_order * link_order;
+ arelent * reloc;
+ bfd_byte * data;
+ unsigned int * src_ptr;
+ unsigned int * dst_ptr;
{
- asection *input_section = link_order->u.indirect.section;
+ asection * input_section = link_order->u.indirect.section;
switch (reloc->howto->type)
{
@@ -164,7 +186,8 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)
case R_IMM32:
bfd_put_32 (in_abfd,
- bfd_coff_reloc16_get_value (reloc, link_info, input_section),
+ /* 0x80000000 indicates a long segmented address. */
+ bfd_coff_reloc16_get_value (reloc, link_info, input_section) | 0x80000000,
data + *dst_ptr);
(*dst_ptr) += 4;
(*src_ptr) += 4;
@@ -196,8 +219,8 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)
bfd_vma dot = (link_order->offset
+ *dst_ptr
+ input_section->output_section->vma);
- int gap = dst - dot - 1;/* -1 since were in the odd byte of the
- word and the pc's been incremented */
+ int gap = dst - dot - 1; /* -1, since we're in the odd byte of the
+ word and the pc's been incremented. */
if (gap & 1)
abort ();
@@ -215,6 +238,88 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)
(*src_ptr)++;
break;
}
+
+ case R_DISP7:
+ {
+ bfd_vma dst = bfd_coff_reloc16_get_value (reloc, link_info,
+ input_section);
+ bfd_vma dot = (link_order->offset
+ + *dst_ptr
+ + input_section->output_section->vma);
+ int gap = dst - dot - 1; /* -1, since we're in the odd byte of the
+ word and the pc's been incremented. */
+
+ if (gap & 1)
+ abort ();
+ gap /= 2;
+
+ if (gap > 0 || gap < -128)
+ {
+ if (! ((*link_info->callbacks->reloc_overflow)
+ (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr),
+ reloc->howto->name, reloc->addend, input_section->owner,
+ input_section, reloc->address)))
+ abort ();
+ }
+ bfd_put_8 (in_abfd,
+ (bfd_get_8 ( in_abfd, data + *dst_ptr) & 0x80) + (-gap & 0x7f),
+ data + *dst_ptr);
+ (*dst_ptr)++;
+ (*src_ptr)++;
+ break;
+ }
+
+ case R_CALLR:
+ {
+ bfd_vma dst = bfd_coff_reloc16_get_value (reloc, link_info,
+ input_section);
+ bfd_vma dot = (link_order->offset
+ + *dst_ptr
+ + input_section->output_section->vma);
+ int gap = dst - dot - 2;
+
+ if (gap & 1)
+ abort ();
+ gap /= 2;
+ if (gap > 8191 || gap < -8192)
+ {
+ if (! ((*link_info->callbacks->reloc_overflow)
+ (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr),
+ reloc->howto->name, reloc->addend, input_section->owner,
+ input_section, reloc->address)))
+ abort ();
+ }
+ bfd_put_16 (in_abfd,
+ (bfd_get_16 ( in_abfd, data + *dst_ptr) & 0xf000) | (-gap & 0x0fff),
+ data + *dst_ptr);
+ (*dst_ptr) += 2;
+ (*src_ptr) += 2;
+ break;
+ }
+
+ case R_REL16:
+ {
+ bfd_vma dst = bfd_coff_reloc16_get_value (reloc, link_info,
+ input_section);
+ bfd_vma dot = (link_order->offset
+ + *dst_ptr
+ + input_section->output_section->vma);
+ int gap = dst - dot - 2;
+
+ if (gap > 32767 || gap < -32768)
+ {
+ if (! ((*link_info->callbacks->reloc_overflow)
+ (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr),
+ reloc->howto->name, reloc->addend, input_section->owner,
+ input_section, reloc->address)))
+ abort ();
+ }
+ bfd_put_16 (in_abfd, (bfd_vma) gap, data + *dst_ptr);
+ (*dst_ptr) += 2;
+ (*src_ptr) += 2;
+ break;
+ }
+
default:
abort ();
}
diff --git a/contrib/binutils/bfd/coffcode.h b/contrib/binutils/bfd/coffcode.h
index f0a2c5e..72690d5 100644
--- a/contrib/binutils/bfd/coffcode.h
+++ b/contrib/binutils/bfd/coffcode.h
@@ -4443,16 +4443,14 @@ coff_slurp_symbol_table (abfd)
#ifdef COFF_WITH_PE
if (src->u.syment.n_sclass == C_NT_WEAK)
- dst->symbol.flags = BSF_WEAK;
+ dst->symbol.flags |= BSF_WEAK;
+
if (src->u.syment.n_sclass == C_SECTION
&& src->u.syment.n_scnum > 0)
- {
- dst->symbol.flags = BSF_LOCAL;
- }
+ dst->symbol.flags = BSF_LOCAL;
#endif
-
if (src->u.syment.n_sclass == C_WEAKEXT)
- dst->symbol.flags = BSF_WEAK;
+ dst->symbol.flags |= BSF_WEAK;
break;
diff --git a/contrib/binutils/bfd/cofflink.c b/contrib/binutils/bfd/cofflink.c
index 00a5289..8a80c14 100644
--- a/contrib/binutils/bfd/cofflink.c
+++ b/contrib/binutils/bfd/cofflink.c
@@ -1,5 +1,5 @@
/* COFF specific linker code.
- 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.
@@ -1005,7 +1005,8 @@ _bfd_coff_final_link (abfd, info)
if (info->task_link)
{
finfo.failed = false;
- coff_link_hash_traverse (coff_hash_table (info), _bfd_coff_write_task_globals,
+ coff_link_hash_traverse (coff_hash_table (info),
+ _bfd_coff_write_task_globals,
(PTR) &finfo);
if (finfo.failed)
goto error_return;
@@ -1013,7 +1014,8 @@ _bfd_coff_final_link (abfd, info)
/* Write out the global symbols. */
finfo.failed = false;
- coff_link_hash_traverse (coff_hash_table (info), _bfd_coff_write_global_sym,
+ coff_link_hash_traverse (coff_hash_table (info),
+ _bfd_coff_write_global_sym,
(PTR) &finfo);
if (finfo.failed)
goto error_return;
@@ -2497,6 +2499,13 @@ _bfd_coff_write_global_sym (h, data)
output_bfd = finfo->output_bfd;
+ if (h->root.type == bfd_link_hash_warning)
+ {
+ h = (struct coff_link_hash_entry *) h->root.u.i.link;
+ if (h->root.type == bfd_link_hash_new)
+ return true;
+ }
+
if (h->indx >= 0)
return true;
@@ -2512,6 +2521,7 @@ _bfd_coff_write_global_sym (h, data)
{
default:
case bfd_link_hash_new:
+ case bfd_link_hash_warning:
abort ();
return false;
@@ -2544,7 +2554,6 @@ _bfd_coff_write_global_sym (h, data)
break;
case bfd_link_hash_indirect:
- case bfd_link_hash_warning:
/* Just ignore these. They can't be handled anyhow. */
return true;
}
@@ -2699,6 +2708,9 @@ _bfd_coff_write_task_globals (h, data)
boolean rtnval = true;
boolean save_global_to_static;
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct coff_link_hash_entry *) h->root.u.i.link;
+
if (h->indx < 0)
{
switch (h->root.type)
diff --git a/contrib/binutils/bfd/config.in b/contrib/binutils/bfd/config.in
index 9440d71..e0b0c20 100644
--- a/contrib/binutils/bfd/config.in
+++ b/contrib/binutils/bfd/config.in
@@ -160,9 +160,15 @@
/* Define if you have the <sys/procfs.h> header file. */
#undef HAVE_SYS_PROCFS_H
+/* Define if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
/* Define if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
+/* Define if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
/* Define if you have the <time.h> header file. */
#undef HAVE_TIME_H
diff --git a/contrib/binutils/bfd/configure b/contrib/binutils/bfd/configure
index c6f7871..9bbf34d 100755
--- a/contrib/binutils/bfd/configure
+++ b/contrib/binutils/bfd/configure
@@ -1116,7 +1116,7 @@ fi
PACKAGE=bfd
-VERSION=2.12
+VERSION=2.12.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; }
@@ -1199,7 +1199,7 @@ fi
# Uncomment the next line to remove the date from the reported bfd version
-is_release=y
+#is_release=y
bfd_version=`echo "${VERSION}" | sed -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$/\1\2\3\4\5/'`
diff --git a/contrib/binutils/bfd/configure.in b/contrib/binutils/bfd/configure.in
index 5bedc01..999847a 100644
--- a/contrib/binutils/bfd/configure.in
+++ b/contrib/binutils/bfd/configure.in
@@ -7,9 +7,9 @@ AC_INIT(libbfd.c)
AC_CANONICAL_SYSTEM
AC_ISC_POSIX
-AM_INIT_AUTOMAKE(bfd, 2.12)
+AM_INIT_AUTOMAKE(bfd, 2.12.1)
# Uncomment the next line to remove the date from the reported bfd version
-is_release=y
+#is_release=y
changequote(,)dnl
bfd_version=`echo "${VERSION}" | sed -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$/\1\2\3\4\5/'`
diff --git a/contrib/binutils/bfd/cpu-i386.c b/contrib/binutils/bfd/cpu-i386.c
index be8de44..f492827 100644
--- a/contrib/binutils/bfd/cpu-i386.c
+++ b/contrib/binutils/bfd/cpu-i386.c
@@ -1,5 +1,5 @@
/* BFD support for the Intel 386 architecture.
- Copyright 1992, 1994, 1995, 1996, 1998, 2000, 2001
+ Copyright 1992, 1994, 1995, 1996, 1998, 2000, 2001, 2002
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
diff --git a/contrib/binutils/bfd/cpu-mips.c b/contrib/binutils/bfd/cpu-mips.c
index a933b8c..d54b0a5 100644
--- a/contrib/binutils/bfd/cpu-mips.c
+++ b/contrib/binutils/bfd/cpu-mips.c
@@ -1,5 +1,6 @@
/* bfd back-end for mips support
- Copyright (C) 1990, 91-97, 1998 Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2002
+ Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -22,6 +23,29 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "sysdep.h"
#include "libbfd.h"
+static const bfd_arch_info_type *mips_compatible
+ PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
+
+/* The default routine tests bits_per_word, which is wrong on mips as
+ mips word size doesn't correlate with reloc size. */
+
+static const bfd_arch_info_type *
+mips_compatible (a, b)
+ const bfd_arch_info_type *a;
+ const bfd_arch_info_type *b;
+{
+ if (a->arch != b->arch)
+ return NULL;
+
+ if (a->mach > b->mach)
+ return a;
+
+ if (b->mach > a->mach)
+ return b;
+
+ return a;
+}
+
#define N(BITS_WORD, BITS_ADDR, NUMBER, PRINT, DEFAULT, NEXT) \
{ \
BITS_WORD, /* bits in a word */ \
@@ -33,51 +57,59 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
PRINT, \
3, \
DEFAULT, \
- bfd_default_compatible, \
+ mips_compatible, \
bfd_default_scan, \
NEXT, \
}
-enum {
-I_mips3000,
-I_mips3900,
-I_mips4000,
-I_mips4010,
-I_mips4100,
-I_mips4111,
-I_mips4300,
-I_mips4400,
-I_mips4600,
-I_mips4650,
-I_mips5000,
-I_mips6000,
-I_mips8000,
-I_mips10000,
-I_mips16
+enum
+{
+ I_mips3000,
+ I_mips3900,
+ I_mips4000,
+ I_mips4010,
+ I_mips4100,
+ I_mips4111,
+ I_mips4300,
+ I_mips4400,
+ I_mips4600,
+ I_mips4650,
+ I_mips5000,
+ I_mips6000,
+ I_mips8000,
+ I_mips10000,
+ I_mips12000,
+ I_mips16,
+ I_mips5,
+ I_mipsisa32,
+ I_mipsisa64,
+ I_sb1,
};
+#define NN(index) (&arch_info_struct[(index) + 1])
-#define NN(index) (&arch_info_struct[(index)+1])
-
-static const bfd_arch_info_type arch_info_struct[] =
+static const bfd_arch_info_type arch_info_struct[] =
{
- N (32, 32, bfd_mach_mips3000, "mips:3000", false, NN(I_mips3000)),
- N (32, 32, bfd_mach_mips3900, "mips:3900", false, NN(I_mips3900)),
- N (64, 64, bfd_mach_mips4000, "mips:4000", false, NN(I_mips4000)),
- N (64, 64, bfd_mach_mips4010, "mips:4010", false, NN(I_mips4010)),
- N (64, 64, bfd_mach_mips4100, "mips:4100", false, NN(I_mips4100)),
- N (64, 64, bfd_mach_mips4111, "mips:4111", false, NN(I_mips4111)),
- N (64, 64, bfd_mach_mips4300, "mips:4300", false, NN(I_mips4300)),
- N (64, 64, bfd_mach_mips4400, "mips:4400", false, NN(I_mips4400)),
- N (64, 64, bfd_mach_mips4600, "mips:4600", false, NN(I_mips4600)),
- N (64, 64, bfd_mach_mips4650, "mips:4650", false, NN(I_mips4650)),
- N (64, 64, bfd_mach_mips5000, "mips:5000", false, NN(I_mips5000)),
- N (32, 32, bfd_mach_mips6000, "mips:6000", false, NN(I_mips6000)),
- N (64, 64, bfd_mach_mips8000, "mips:8000", false, NN(I_mips8000)),
- N (64, 64, bfd_mach_mips10000, "mips:10000", false, NN(I_mips10000)),
-
-
- N (64, 64, bfd_mach_mips16, "mips:16", false, 0),
+ N (32, 32, bfd_mach_mips3000, "mips:3000", false, NN(I_mips3000)),
+ N (32, 32, bfd_mach_mips3900, "mips:3900", false, NN(I_mips3900)),
+ N (64, 64, bfd_mach_mips4000, "mips:4000", false, NN(I_mips4000)),
+ N (64, 64, bfd_mach_mips4010, "mips:4010", false, NN(I_mips4010)),
+ N (64, 64, bfd_mach_mips4100, "mips:4100", false, NN(I_mips4100)),
+ N (64, 64, bfd_mach_mips4111, "mips:4111", false, NN(I_mips4111)),
+ N (64, 64, bfd_mach_mips4300, "mips:4300", false, NN(I_mips4300)),
+ N (64, 64, bfd_mach_mips4400, "mips:4400", false, NN(I_mips4400)),
+ N (64, 64, bfd_mach_mips4600, "mips:4600", false, NN(I_mips4600)),
+ N (64, 64, bfd_mach_mips4650, "mips:4650", false, NN(I_mips4650)),
+ N (64, 64, bfd_mach_mips5000, "mips:5000", false, NN(I_mips5000)),
+ N (32, 32, bfd_mach_mips6000, "mips:6000", false, NN(I_mips6000)),
+ N (64, 64, bfd_mach_mips8000, "mips:8000", false, NN(I_mips8000)),
+ N (64, 64, bfd_mach_mips10000,"mips:10000", false, NN(I_mips10000)),
+ N (64, 64, bfd_mach_mips12000,"mips:12000", false, NN(I_mips12000)),
+ N (64, 64, bfd_mach_mips16, "mips:16", false, NN(I_mips16)),
+ N (64, 64, bfd_mach_mips5, "mips:mips5", false, NN(I_mips5)),
+ N (32, 32, bfd_mach_mipsisa32, "mips:isa32", false, NN(I_mipsisa32)),
+ N (64, 64, bfd_mach_mipsisa64, "mips:isa64", false, NN(I_mipsisa64)),
+ N (64, 64, bfd_mach_mips_sb1, "mips:sb1", false, 0),
};
/* The default architecture is mips:3000, but with a machine number of
diff --git a/contrib/binutils/bfd/cpu-sparc.c b/contrib/binutils/bfd/cpu-sparc.c
index dbc83ba..e3b8ecb 100644
--- a/contrib/binutils/bfd/cpu-sparc.c
+++ b/contrib/binutils/bfd/cpu-sparc.c
@@ -1,5 +1,6 @@
/* BFD support for the SPARC architecture.
- Copyright 1992, 1995, 1996, 1998, 2000 Free Software Foundation, Inc.
+ Copyright 1992, 1995, 1996, 1998, 2000, 2002
+ Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -21,22 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "sysdep.h"
#include "libbfd.h"
-/* Don't mix 32 bit and 64 bit files. */
-
-static const bfd_arch_info_type *sparc_compatible
- PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
-
-static const bfd_arch_info_type *
-sparc_compatible (a, b)
- const bfd_arch_info_type *a;
- const bfd_arch_info_type *b;
-{
- if (a->bits_per_word != b->bits_per_word)
- return NULL;
-
- return bfd_default_compatible (a, b);
-}
-
static const bfd_arch_info_type arch_info_struct[] =
{
{
@@ -49,7 +34,7 @@ static const bfd_arch_info_type arch_info_struct[] =
"sparc:sparclet",
3,
false,
- sparc_compatible,
+ bfd_default_compatible,
bfd_default_scan,
&arch_info_struct[1],
},
@@ -63,7 +48,7 @@ static const bfd_arch_info_type arch_info_struct[] =
"sparc:sparclite",
3,
false,
- sparc_compatible,
+ bfd_default_compatible,
bfd_default_scan,
&arch_info_struct[2],
},
@@ -77,7 +62,7 @@ static const bfd_arch_info_type arch_info_struct[] =
"sparc:v8plus",
3,
false,
- sparc_compatible,
+ bfd_default_compatible,
bfd_default_scan,
&arch_info_struct[3],
},
@@ -91,7 +76,7 @@ static const bfd_arch_info_type arch_info_struct[] =
"sparc:v8plusa",
3,
false,
- sparc_compatible,
+ bfd_default_compatible,
bfd_default_scan,
&arch_info_struct[4],
},
@@ -105,7 +90,7 @@ static const bfd_arch_info_type arch_info_struct[] =
"sparc:sparclite_le",
3,
false,
- sparc_compatible,
+ bfd_default_compatible,
bfd_default_scan,
&arch_info_struct[5],
},
@@ -119,7 +104,7 @@ static const bfd_arch_info_type arch_info_struct[] =
"sparc:v9",
3,
false,
- sparc_compatible,
+ bfd_default_compatible,
bfd_default_scan,
&arch_info_struct[6],
},
@@ -133,7 +118,7 @@ static const bfd_arch_info_type arch_info_struct[] =
"sparc:v9a",
3,
false,
- sparc_compatible,
+ bfd_default_compatible,
bfd_default_scan,
&arch_info_struct[7],
},
@@ -147,7 +132,7 @@ static const bfd_arch_info_type arch_info_struct[] =
"sparc:v8plusb",
3,
false,
- sparc_compatible,
+ bfd_default_compatible,
bfd_default_scan,
&arch_info_struct[8],
},
@@ -161,7 +146,7 @@ static const bfd_arch_info_type arch_info_struct[] =
"sparc:v9b",
3,
false,
- sparc_compatible,
+ bfd_default_compatible,
bfd_default_scan,
0,
}
@@ -178,7 +163,7 @@ const bfd_arch_info_type bfd_sparc_arch =
"sparc",
3,
true, /* the default */
- sparc_compatible,
+ bfd_default_compatible,
bfd_default_scan,
&arch_info_struct[0],
};
diff --git a/contrib/binutils/bfd/cpu-v850.c b/contrib/binutils/bfd/cpu-v850.c
index 5eb5b74..8836362 100644
--- a/contrib/binutils/bfd/cpu-v850.c
+++ b/contrib/binutils/bfd/cpu-v850.c
@@ -1,5 +1,5 @@
/* BFD support for the NEC V850 processor
- Copyright 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+ Copyright 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -20,8 +20,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
+#include "safe-ctype.h"
-#include <ctype.h>
+static boolean scan PARAMS ((const struct bfd_arch_info *, const char *));
static boolean
scan (info, string)
@@ -33,38 +34,34 @@ scan (info, string)
unsigned long number;
enum bfd_architecture arch;
- /* First test for an exact match */
+ /* First test for an exact match. */
if (strcasecmp (string, info->printable_name) == 0)
return true;
/* See how much of the supplied string matches with the
architecture, eg the string m68k:68020 would match the m68k entry
- up to the :, then we get left with the machine number */
-
+ up to the :, then we get left with the machine number. */
for (ptr_src = string, ptr_tst = info->arch_name;
*ptr_src && *ptr_tst;
ptr_src++, ptr_tst++)
- {
- if (*ptr_src != *ptr_tst) break;
- }
+ if (*ptr_src != *ptr_tst)
+ break;
- /* Chewed up as much of the architecture as will match, skip any
- colons */
+ /* Chewed up as much of the architecture as will match;
+ if there is a colon present skip it. */
if (*ptr_src == ':')
- ptr_src++;
+ ptr_src ++;
if (*ptr_src == 0)
- {
- /* nothing more, then only keep this one if it is the default
- machine for this architecture */
- return info->the_default;
- }
+ /* Nothing more, then only keep this one if it is
+ the default machine for this architecture. */
+ return info->the_default;
number = 0;
- while (isdigit ((unsigned char) *ptr_src))
+ while (ISDIGIT (*ptr_src))
{
number = number * 10 + * ptr_src - '0';
- ptr_src++;
+ ptr_src ++;
}
switch (number)
@@ -92,12 +89,12 @@ scan (info, string)
static const bfd_arch_info_type arch_info_struct[] =
{
- N (bfd_mach_v850e, "v850e", false, &arch_info_struct[1]),
+ N (bfd_mach_v850e, "v850e", false, & arch_info_struct[1]),
N (bfd_mach_v850ea, "v850ea", false, NULL)
};
-#undef NEXT
-#define NEXT &arch_info_struct[0]
+#undef NEXT
+#define NEXT & arch_info_struct[0]
const bfd_arch_info_type bfd_v850_arch =
N (bfd_mach_v850, "v850", true, NEXT);
diff --git a/contrib/binutils/bfd/cpu-z8k.c b/contrib/binutils/bfd/cpu-z8k.c
index 643932a..0afdfc7 100644
--- a/contrib/binutils/bfd/cpu-z8k.c
+++ b/contrib/binutils/bfd/cpu-z8k.c
@@ -1,5 +1,5 @@
/* BFD library support routines for the Z800n architecture.
- Copyright 1992, 1993, 1994, 2000 Free Software Foundation, Inc.
+ Copyright 1992, 1993, 1994, 2000, 2001 Free Software Foundation, Inc.
Hacked by Steve Chamberlain of Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -22,6 +22,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "sysdep.h"
#include "libbfd.h"
+static boolean scan_mach
+ PARAMS ((const struct bfd_arch_info *, const char *));
+static const bfd_arch_info_type *compatible
+ PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
+
#if 0 /* not used currently */
/*
Relocations for the Z8K
@@ -148,8 +153,6 @@ local_bfd_reloc_type_lookup (arch, code)
}
#endif
-int bfd_default_scan_num_mach ();
-
static boolean
scan_mach (info, string)
const struct bfd_arch_info *info;
diff --git a/contrib/binutils/bfd/dep-in.sed b/contrib/binutils/bfd/dep-in.sed
index 4a706aa..ce8b79b 100644
--- a/contrib/binutils/bfd/dep-in.sed
+++ b/contrib/binutils/bfd/dep-in.sed
@@ -5,8 +5,10 @@ t loop
s!\.o:!.lo:!
s! @BFD_H@!!g
-s!@INCDIR@!$(INCDIR)!g
+s!@SRCDIR@/../include!$(INCDIR)!g
+s!@TOPDIR@/include!$(INCDIR)!g
s!@SRCDIR@/../opcodes!$(srcdir)/../opcodes!g
+s!@TOPDIR@/opcodes!$(srcdir)/../opcodes!g
s!@SRCDIR@/!!g
s! hosts/[^ ]*\.h! !g
s! sysdep.h!!g
diff --git a/contrib/binutils/bfd/doc/ChangeLog b/contrib/binutils/bfd/doc/ChangeLog
index 3ddeee9..9f69475 100644
--- a/contrib/binutils/bfd/doc/ChangeLog
+++ b/contrib/binutils/bfd/doc/ChangeLog
@@ -1,3 +1,7 @@
+2002-03-28 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.in: Regenerate.
+
2002-02-01 Alan Modra <amodra@bigpond.net.au>
* chew.c (WORD): Eliminate.
diff --git a/contrib/binutils/bfd/doc/Makefile.in b/contrib/binutils/bfd/doc/Makefile.in
index e0ce81f..0036c0b 100644
--- a/contrib/binutils/bfd/doc/Makefile.in
+++ b/contrib/binutils/bfd/doc/Makefile.in
@@ -1,6 +1,6 @@
-# Makefile.in generated automatically by automake 1.4 from Makefile.am
+# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
-# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -242,7 +242,7 @@ DIST_COMMON = ChangeLog Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-TAR = gtar
+TAR = tar
GZIP_ENV = --best
all: all-redirect
.SUFFIXES:
@@ -328,7 +328,7 @@ uninstall-info:
else ii=; fi; \
list='$(INFO_DEPS)'; \
for file in $$list; do \
- test -z "$ii" \
+ test -z "$$ii" \
|| install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \
done
@$(NORMAL_UNINSTALL)
diff --git a/contrib/binutils/bfd/dwarf2.c b/contrib/binutils/bfd/dwarf2.c
index 550f005..f129e0b 100644
--- a/contrib/binutils/bfd/dwarf2.c
+++ b/contrib/binutils/bfd/dwarf2.c
@@ -240,9 +240,10 @@ static void arange_add PARAMS ((struct comp_unit *, bfd_vma, bfd_vma));
static struct line_info_table *decode_line_info
PARAMS ((struct comp_unit *, struct dwarf2_debug *));
static boolean lookup_address_in_line_info_table
- PARAMS ((struct line_info_table *, bfd_vma, const char **, unsigned int *));
+ PARAMS ((struct line_info_table *, bfd_vma, struct funcinfo *,
+ const char **, unsigned int *));
static boolean lookup_address_in_function_table
- PARAMS ((struct funcinfo *, bfd_vma, const char **));
+ PARAMS ((struct funcinfo *, bfd_vma, struct funcinfo **, const char **));
static boolean scan_unit_for_functions PARAMS ((struct comp_unit *));
static bfd_vma find_rela_addend
PARAMS ((bfd *, asection *, bfd_size_type, asymbol**));
@@ -808,6 +809,14 @@ struct line_info_table
struct line_info* last_line;
};
+struct funcinfo
+{
+ struct funcinfo *prev_func;
+ char* name;
+ bfd_vma low;
+ bfd_vma high;
+};
+
static void
add_line_info (table, address, filename, line, column, end_sequence)
struct line_info_table* table;
@@ -1215,10 +1224,12 @@ decode_line_info (unit, stash)
static boolean
lookup_address_in_line_info_table (table,
addr,
+ function,
filename_ptr,
linenumber_ptr)
struct line_info_table* table;
bfd_vma addr;
+ struct funcinfo *function;
const char **filename_ptr;
unsigned int *linenumber_ptr;
{
@@ -1235,35 +1246,53 @@ lookup_address_in_line_info_table (table,
if (!each_line->end_sequence
&& addr >= each_line->address && addr < next_line->address)
{
- *filename_ptr = each_line->filename;
- *linenumber_ptr = each_line->line;
+ /* If this line appears to span functions, and addr is in the
+ later function, return the first line of that function instead
+ of the last line of the earlier one. This check is for GCC
+ 2.95, which emits the first line number for a function late. */
+ if (function != NULL
+ && each_line->address < function->low
+ && next_line->address > function->low)
+ {
+ *filename_ptr = next_line->filename;
+ *linenumber_ptr = next_line->line;
+ }
+ else
+ {
+ *filename_ptr = each_line->filename;
+ *linenumber_ptr = each_line->line;
+ }
return true;
}
next_line = each_line;
each_line = each_line->prev_line;
}
+ /* At this point each_line is NULL but next_line is not. If we found the
+ containing function in this compilation unit, return the first line we
+ have a number for. This is also for compatibility with GCC 2.95. */
+ if (function != NULL)
+ {
+ *filename_ptr = next_line->filename;
+ *linenumber_ptr = next_line->line;
+ return true;
+ }
+
return false;
}
/* Function table functions. */
-struct funcinfo
-{
- struct funcinfo *prev_func;
- char* name;
- bfd_vma low;
- bfd_vma high;
-};
-
/* If ADDR is within TABLE, set FUNCTIONNAME_PTR, and return true. */
static boolean
lookup_address_in_function_table (table,
addr,
+ function_ptr,
functionname_ptr)
struct funcinfo* table;
bfd_vma addr;
+ struct funcinfo** function_ptr;
const char **functionname_ptr;
{
struct funcinfo* each_func;
@@ -1275,6 +1304,7 @@ lookup_address_in_function_table (table,
if (addr >= each_func->low && addr < each_func->high)
{
*functionname_ptr = each_func->name;
+ *function_ptr = each_func;
return true;
}
}
@@ -1636,6 +1666,7 @@ comp_unit_find_nearest_line (unit, addr,
{
boolean line_p;
boolean func_p;
+ struct funcinfo *function;
if (unit->error)
return false;
@@ -1664,13 +1695,16 @@ comp_unit_find_nearest_line (unit, addr,
}
}
+ function = NULL;
+ func_p = lookup_address_in_function_table (unit->function_table,
+ addr,
+ &function,
+ functionname_ptr);
line_p = lookup_address_in_line_info_table (unit->line_table,
addr,
+ function,
filename_ptr,
linenumber_ptr);
- func_p = lookup_address_in_function_table (unit->function_table,
- addr,
- functionname_ptr);
return line_p || func_p;
}
diff --git a/contrib/binutils/bfd/ecoff.c b/contrib/binutils/bfd/ecoff.c
index 1e3b6a9..70224cb 100644
--- a/contrib/binutils/bfd/ecoff.c
+++ b/contrib/binutils/bfd/ecoff.c
@@ -1,5 +1,5 @@
/* Generic ECOFF (Extended-COFF) routines.
- Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
+ Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
Original version by Per Bothner.
Full support added by Ian Lance Taylor, ian@cygnus.com.
@@ -4393,6 +4393,13 @@ ecoff_link_write_external (h, data)
bfd *output_bfd = einfo->abfd;
boolean strip;
+ if (h->root.type == bfd_link_hash_warning)
+ {
+ h = (struct ecoff_link_hash_entry *) h->root.u.i.link;
+ if (h->root.type == bfd_link_hash_new)
+ return true;
+ }
+
/* We need to check if this symbol is being stripped. */
if (h->root.type == bfd_link_hash_undefined
|| h->root.type == bfd_link_hash_undefweak)
@@ -4474,6 +4481,7 @@ ecoff_link_write_external (h, data)
switch (h->root.type)
{
default:
+ case bfd_link_hash_warning:
case bfd_link_hash_new:
abort ();
case bfd_link_hash_undefined:
@@ -4502,9 +4510,8 @@ ecoff_link_write_external (h, data)
h->esym.asym.value = h->root.u.c.size;
break;
case bfd_link_hash_indirect:
- case bfd_link_hash_warning:
- /* FIXME: Ignore these for now. The circumstances under which
- they should be written out are not clear to me. */
+ /* We ignore these symbols, since the indirected symbol is
+ already in the hash table. */
return true;
}
diff --git a/contrib/binutils/bfd/elf-bfd.h b/contrib/binutils/bfd/elf-bfd.h
index 0bd559f..4439daa 100644
--- a/contrib/binutils/bfd/elf-bfd.h
+++ b/contrib/binutils/bfd/elf-bfd.h
@@ -1531,6 +1531,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 --git a/contrib/binutils/bfd/elf.c b/contrib/binutils/bfd/elf.c
index 8c6da10..67d9add 100644
--- a/contrib/binutils/bfd/elf.c
+++ b/contrib/binutils/bfd/elf.c
@@ -652,27 +652,44 @@ _bfd_elf_make_section_from_shdr (abfd, hdr, name)
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 on 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)
&& ((flags & SEC_LOAD) == 0
- || (phdr->p_offset + phdr->p_filesz
- >= hdr->sh_offset + hdr->sh_size)))
+ || (hdr->sh_offset + hdr->sh_size
+ <= phdr->p_offset + phdr->p_filesz)))
{
- /* We used to do a relative adjustment here, but
- that doesn't work if the segment is packed with
- code from multiple VMAs. Instead we calculate
- the LMA absoultely, based on the LMA of the
- segment (it is assumed that the segment will
- contain sections with contiguous LMAs, even if
- the VMAs are not). */
- newsect->lma = phdr->p_paddr
- + hdr->sh_offset - phdr->p_offset;
- break;
+ if ((flags & SEC_LOAD) == 0)
+ newsect->lma = (phdr->p_paddr
+ + hdr->sh_addr - phdr->p_vaddr);
+ else
+ /* We used to use the same adjustment for SEC_LOAD
+ sections, but that doesn't work if the segment
+ is packed with code from multiple VMAs.
+ Instead we calculate the section LMA based on
+ the segment LMA. It is assumed that the
+ segment will contain sections with contiguous
+ LMAs, even if the VMAs are not. */
+ newsect->lma = (phdr->p_paddr
+ + hdr->sh_offset - phdr->p_offset);
+
+ /* With contiguous segments, we can't tell from file
+ offsets whether a section with zero size should
+ be placed at the end of one segment or the
+ beginning of the next. Decide based on vaddr. */
+ if (hdr->sh_addr >= phdr->p_vaddr
+ && (hdr->sh_addr + hdr->sh_size
+ <= phdr->p_vaddr + phdr->p_memsz))
+ break;
}
}
}
@@ -1558,6 +1575,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 */
@@ -2172,6 +2192,12 @@ elf_fake_sections (abfd, asect, failedptrarg)
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
@@ -5096,7 +5122,9 @@ _bfd_elf_get_symtab_upper_bound (abfd)
Elf_Internal_Shdr *hdr = &elf_tdata (abfd)->symtab_hdr;
symcount = hdr->sh_size / get_elf_backend_data (abfd)->s->sizeof_sym;
- symtab_size = (symcount - 1 + 1) * (sizeof (asymbol *));
+ symtab_size = (symcount + 1) * (sizeof (asymbol *));
+ if (symcount > 0)
+ symtab_size -= sizeof (asymbol *);
return symtab_size;
}
@@ -5116,7 +5144,9 @@ _bfd_elf_get_dynamic_symtab_upper_bound (abfd)
}
symcount = hdr->sh_size / get_elf_backend_data (abfd)->s->sizeof_sym;
- symtab_size = (symcount - 1 + 1) * (sizeof (asymbol *));
+ symtab_size = (symcount + 1) * (sizeof (asymbol *));
+ if (symcount > 0)
+ symtab_size -= sizeof (asymbol *);
return symtab_size;
}
@@ -6149,6 +6179,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 +6218,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;
@@ -6416,7 +6450,7 @@ elfcore_netbsd_get_lwpid (note, lwpidp)
cp = strchr (note->namedata, '@');
if (cp != NULL)
{
- *lwpidp = atoi(cp);
+ *lwpidp = atoi(cp + 1);
return true;
}
return false;
@@ -6599,6 +6633,38 @@ elfcore_write_prstatus (abfd, buf, bufsiz, pid, cursig, gregs)
}
#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 +6678,11 @@ elfcore_write_pstatus (abfd, buf, bufsiz, pid, cursig, gregs)
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 --git a/contrib/binutils/bfd/elf32-arm.h b/contrib/binutils/bfd/elf32-arm.h
index a452465e..d420e5b 100644
--- a/contrib/binutils/bfd/elf32-arm.h
+++ b/contrib/binutils/bfd/elf32-arm.h
@@ -1560,6 +1560,12 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
if (sgot == NULL)
return bfd_reloc_notsupported;
+ /* If we are addressing a Thumb function, we need to adjust the
+ address by one, so that attempts to call the function pointer will
+ correctly interpret it as Thumb code. */
+ if (sym_flags == STT_ARM_TFUNC)
+ value += 1;
+
/* Note that sgot->output_offset is not involved in this
calculation. We always want the start of .got. If we
define _GLOBAL_OFFSET_TABLE in a different way, as is
@@ -1612,6 +1618,13 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
off &= ~1;
else
{
+ /* If we are addressing a Thumb function, we need to
+ adjust the address by one, so that attempts to
+ call the function pointer will correctly
+ interpret it as Thumb code. */
+ if (sym_flags == STT_ARM_TFUNC)
+ value |= 1;
+
bfd_put_32 (output_bfd, value, sgot->contents + off);
h->got.offset |= 1;
}
@@ -3275,6 +3288,9 @@ elf32_arm_discard_copies (h, ignore)
{
struct elf32_arm_pcrel_relocs_copied * s;
+ if (h->root.root.type == bfd_link_hash_warning)
+ h = (struct elf32_arm_link_hash_entry *) h->root.root.u.i.link;
+
/* We only discard relocs for symbols defined in a regular object. */
if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
return true;
diff --git a/contrib/binutils/bfd/elf32-i386.c b/contrib/binutils/bfd/elf32-i386.c
index 7e6588c..d74f6ee 100644
--- a/contrib/binutils/bfd/elf32-i386.c
+++ b/contrib/binutils/bfd/elf32-i386.c
@@ -1,5 +1,5 @@
/* Intel 80386/80486-specific support for 32-bit ELF
- 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.
This file is part of BFD, the Binary File Descriptor library.
@@ -847,11 +847,10 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
{
const char *name;
bfd *dynobj;
+ unsigned int strndx = elf_elfheader (abfd)->e_shstrndx;
+ unsigned int shnam = elf_section_data (sec)->rel_hdr.sh_name;
- name = (bfd_elf_string_from_elf_section
- (abfd,
- elf_elfheader (abfd)->e_shstrndx,
- elf_section_data (sec)->rel_hdr.sh_name));
+ name = bfd_elf_string_from_elf_section (abfd, strndx, shnam);
if (name == NULL)
return false;
@@ -1251,10 +1250,15 @@ allocate_dynrelocs (h, inf)
struct elf_i386_link_hash_entry *eh;
struct elf_i386_dyn_relocs *p;
- if (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
+ if (h->root.type == bfd_link_hash_indirect)
return true;
+ if (h->root.type == bfd_link_hash_warning)
+ /* When warning symbols are created, they **replace** the "real"
+ entry in the hash table, thus we never get to see the real
+ symbol in a hash traversal. So look at it now. */
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
info = (struct bfd_link_info *) inf;
htab = elf_i386_hash_table (info);
@@ -1421,6 +1425,9 @@ readonly_dynrelocs (h, inf)
struct elf_i386_link_hash_entry *eh;
struct elf_i386_dyn_relocs *p;
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
eh = (struct elf_i386_link_hash_entry *) h;
for (p = eh->dyn_relocs; p != NULL; p = p->next)
{
diff --git a/contrib/binutils/bfd/elf32-mips.c b/contrib/binutils/bfd/elf32-mips.c
index e7e1c2a..e7b4701 100644
--- a/contrib/binutils/bfd/elf32-mips.c
+++ b/contrib/binutils/bfd/elf32-mips.c
@@ -1,10 +1,13 @@
/* MIPS-specific support for 32-bit ELF
- Copyright 1993, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Free Software Foundation, Inc.
Most of the information added by Ian Lance Taylor, Cygnus Support,
<ian@cygnus.com>.
N32/64 ABI support added by Mark Mitchell, CodeSourcery, LLC.
<mark@codesourcery.com>
+ Traditional MIPS targets support added by Koundinya.K, Dansk Data
+ Elektronik & Operations Research Group. <kk@ddeorg.soft.net>
This file is part of BFD, the Binary File Descriptor library.
@@ -40,7 +43,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "coff/internal.h"
#include "coff/ecoff.h"
#include "coff/mips.h"
-#define ECOFF_32
+#define ECOFF_SIGNED_32
#include "ecoffswap.h"
/* This structure is used to hold .got information when linking. It
@@ -70,13 +73,23 @@ struct mips_elf_link_hash_entry
EXTR esym;
/* Number of R_MIPS_32, R_MIPS_REL32, or R_MIPS_64 relocs against
- this symbol. */
+ this symbol. */
unsigned int possibly_dynamic_relocs;
+ /* If the R_MIPS_32, R_MIPS_REL32, or R_MIPS_64 reloc is against
+ a readonly section. */
+ boolean readonly_reloc;
+
/* The index of the first dynamic relocation (in the .rel.dyn
section) against this symbol. */
unsigned int min_dyn_reloc_index;
+ /* We must not create a stub for a symbol that has relocations
+ related to taking the function's address, i.e. any but
+ R_MIPS_CALL*16 ones -- see "MIPS ABI Supplement, 3rd Edition",
+ p. 4-20. */
+ boolean no_fn_stub;
+
/* If there is a stub that 32 bit functions should use to call this
16 bit function, this points to the section containing the stub. */
asection *fn_stub;
@@ -109,7 +122,7 @@ static void bfd_mips_elf32_swap_gptab_in
static void bfd_mips_elf32_swap_gptab_out
PARAMS ((bfd *, const Elf32_gptab *, Elf32_External_gptab *));
#if 0
-static void bfd_mips_elf_swap_msym_in
+static void bfd_mips_elf_swap_msym_in
PARAMS ((bfd *, const Elf32_External_Msym *, Elf32_Internal_Msym *));
#endif
static void bfd_mips_elf_swap_msym_out
@@ -119,7 +132,7 @@ static boolean mips_elf_create_procedure_table
PARAMS ((PTR, bfd *, struct bfd_link_info *, asection *,
struct ecoff_debug_info *));
static INLINE int elf_mips_isa PARAMS ((flagword));
-static INLINE int elf_mips_mach PARAMS ((flagword));
+static INLINE unsigned long elf_mips_mach PARAMS ((flagword));
static INLINE char* elf_mips_abi_name PARAMS ((bfd *));
static boolean mips_elf_is_local_label_name
PARAMS ((bfd *, const char *));
@@ -139,9 +152,9 @@ static bfd_reloc_status_type mips_elf_final_gp
static bfd_byte *elf32_mips_get_relocated_section_contents
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
bfd_byte *, boolean, asymbol **));
-static asection *mips_elf_create_msym_section
+static asection *mips_elf_create_msym_section
PARAMS ((bfd *));
-static void mips_elf_irix6_finish_dynamic_symbol
+static void mips_elf_irix6_finish_dynamic_symbol
PARAMS ((bfd *, const char *, Elf_Internal_Sym *));
static bfd_vma mips_elf_sign_extend PARAMS ((bfd_vma, int));
static boolean mips_elf_overflow_p PARAMS ((bfd_vma, int));
@@ -154,13 +167,13 @@ static bfd_vma mips_elf_local_got_index
PARAMS ((bfd *, struct bfd_link_info *, bfd_vma));
static bfd_vma mips_elf_got_offset_from_index
PARAMS ((bfd *, bfd *, bfd_vma));
-static boolean mips_elf_record_global_got_symbol
+static boolean mips_elf_record_global_got_symbol
PARAMS ((struct elf_link_hash_entry *, struct bfd_link_info *,
struct mips_got_info *));
static bfd_vma mips_elf_got_page
PARAMS ((bfd *, struct bfd_link_info *, bfd_vma, bfd_vma *));
static const Elf_Internal_Rela *mips_elf_next_relocation
- PARAMS ((unsigned int, const Elf_Internal_Rela *,
+ PARAMS ((unsigned int, const Elf_Internal_Rela *,
const Elf_Internal_Rela *));
static bfd_reloc_status_type mips_elf_calculate_relocation
PARAMS ((bfd *, bfd *, asection *, struct bfd_link_info *,
@@ -170,31 +183,55 @@ static bfd_reloc_status_type mips_elf_calculate_relocation
static bfd_vma mips_elf_obtain_contents
PARAMS ((reloc_howto_type *, const Elf_Internal_Rela *, bfd *, bfd_byte *));
static boolean mips_elf_perform_relocation
- PARAMS ((struct bfd_link_info *, reloc_howto_type *,
+ PARAMS ((struct bfd_link_info *, reloc_howto_type *,
const Elf_Internal_Rela *, bfd_vma,
bfd *, asection *, bfd_byte *, boolean));
static boolean mips_elf_assign_gp PARAMS ((bfd *, bfd_vma *));
-static boolean mips_elf_sort_hash_table_f
+static boolean mips_elf_sort_hash_table_f
PARAMS ((struct mips_elf_link_hash_entry *, PTR));
-static boolean mips_elf_sort_hash_table
+static boolean mips_elf_sort_hash_table
PARAMS ((struct bfd_link_info *, unsigned long));
static asection * mips_elf_got_section PARAMS ((bfd *));
-static struct mips_got_info *mips_elf_got_info
+static struct mips_got_info *mips_elf_got_info
PARAMS ((bfd *, asection **));
static boolean mips_elf_local_relocation_p
- PARAMS ((bfd *, const Elf_Internal_Rela *, asection **));
-static bfd_vma mips_elf_create_local_got_entry
+ PARAMS ((bfd *, const Elf_Internal_Rela *, asection **, boolean));
+static bfd_vma mips_elf_create_local_got_entry
PARAMS ((bfd *, struct mips_got_info *, asection *, bfd_vma));
-static bfd_vma mips_elf_got16_entry
- PARAMS ((bfd *, struct bfd_link_info *, bfd_vma));
-static boolean mips_elf_create_dynamic_relocation
+static bfd_vma mips_elf_got16_entry
+ PARAMS ((bfd *, struct bfd_link_info *, bfd_vma, boolean));
+static boolean mips_elf_create_dynamic_relocation
PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Rela *,
struct mips_elf_link_hash_entry *, asection *,
bfd_vma, bfd_vma *, asection *));
-static void mips_elf_allocate_dynamic_relocations
+static void mips_elf_allocate_dynamic_relocations
PARAMS ((bfd *, unsigned int));
-static boolean mips_elf_stub_section_p
+static boolean mips_elf_stub_section_p
PARAMS ((bfd *, asection *));
+static int sort_dynamic_relocs
+ PARAMS ((const void *, const void *));
+static void _bfd_mips_elf_hide_symbol
+ PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, boolean));
+static void _bfd_mips_elf_copy_indirect_symbol
+ PARAMS ((struct elf_link_hash_entry *,
+ struct elf_link_hash_entry *));
+static boolean _bfd_elf32_mips_grok_prstatus
+ PARAMS ((bfd *, Elf_Internal_Note *));
+static boolean _bfd_elf32_mips_grok_psinfo
+ PARAMS ((bfd *, Elf_Internal_Note *));
+static boolean _bfd_elf32_mips_discard_info
+ PARAMS ((bfd *, struct elf_reloc_cookie *, struct bfd_link_info *));
+static boolean _bfd_elf32_mips_ignore_discarded_relocs
+ PARAMS ((asection *));
+static boolean _bfd_elf32_mips_write_section
+ PARAMS ((bfd *, asection *, bfd_byte *));
+
+extern const bfd_target bfd_elf32_tradbigmips_vec;
+extern const bfd_target bfd_elf32_tradlittlemips_vec;
+#ifdef BFD64
+extern const bfd_target bfd_elf64_tradbigmips_vec;
+extern const bfd_target bfd_elf64_tradlittlemips_vec;
+#endif
/* The level of IRIX compatibility we're striving for. */
@@ -204,25 +241,37 @@ typedef enum {
ict_irix6
} irix_compat_t;
+/* This will be used when we sort the dynamic relocation records. */
+static bfd *reldyn_sorting_bfd;
+
/* Nonzero if ABFD is using the N32 ABI. */
#define ABI_N32_P(abfd) \
((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI2) != 0)
-/* Nonzero if ABFD is using the 64-bit ABI. FIXME: This is never
- true, yet. */
+/* Nonzero if ABFD is using the 64-bit ABI. */
#define ABI_64_P(abfd) \
((elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS64) != 0)
-/* What version of Irix we are trying to be compatible with. FIXME:
- At the moment, we never generate "normal" MIPS ELF ABI executables;
- we always use some version of Irix. */
-
+/* Depending on the target vector we generate some version of Irix
+ executables or "normal" MIPS ELF ABI executables. */
+#ifdef BFD64
+#define IRIX_COMPAT(abfd) \
+ (((abfd->xvec == &bfd_elf64_tradbigmips_vec) || \
+ (abfd->xvec == &bfd_elf64_tradlittlemips_vec) || \
+ (abfd->xvec == &bfd_elf32_tradbigmips_vec) || \
+ (abfd->xvec == &bfd_elf32_tradlittlemips_vec)) ? ict_none : \
+ ((ABI_N32_P (abfd) || ABI_64_P (abfd)) ? ict_irix6 : ict_irix5))
+#else
#define IRIX_COMPAT(abfd) \
- ((ABI_N32_P (abfd) || ABI_64_P (abfd)) ? ict_irix6 : ict_irix5)
+ (((abfd->xvec == &bfd_elf32_tradbigmips_vec) || \
+ (abfd->xvec == &bfd_elf32_tradlittlemips_vec)) ? ict_none : \
+ ((ABI_N32_P (abfd) || ABI_64_P (abfd)) ? ict_irix6 : ict_irix5))
+#endif
-/* Whether we are trying to be compatible with IRIX at all. */
+#define NEWABI_P(abfd) (ABI_N32_P(abfd) || ABI_64_P(abfd))
+/* Whether we are trying to be compatible with IRIX at all. */
#define SGI_COMPAT(abfd) \
(IRIX_COMPAT (abfd) != ict_none)
@@ -275,15 +324,15 @@ typedef enum {
/* Add a dynamic symbol table-entry. */
#ifdef BFD64
-#define MIPS_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \
- (ABI_64_P (elf_hash_table (info)->dynobj) \
- ? bfd_elf64_add_dynamic_entry (info, tag, val) \
- : bfd_elf32_add_dynamic_entry (info, tag, val))
+#define MIPS_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \
+ (ABI_64_P (elf_hash_table (info)->dynobj) \
+ ? bfd_elf64_add_dynamic_entry (info, (bfd_vma) tag, (bfd_vma) val) \
+ : bfd_elf32_add_dynamic_entry (info, (bfd_vma) tag, (bfd_vma) val))
#else
-#define MIPS_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \
- (ABI_64_P (elf_hash_table (info)->dynobj) \
- ? (abort (), false) \
- : bfd_elf32_add_dynamic_entry (info, tag, val))
+#define MIPS_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \
+ (ABI_64_P (elf_hash_table (info)->dynobj) \
+ ? (boolean) (abort (), false) \
+ : bfd_elf32_add_dynamic_entry (info, (bfd_vma) tag, (bfd_vma) val))
#endif
/* The number of local .got entries we reserve. */
@@ -297,10 +346,12 @@ typedef enum {
? (ABI_64_P (abfd) \
? 0xdf998010 /* ld t9,0x8010(gp) */ \
: 0x8f998010) /* lw t9,0x8010(gp) */ \
- : 0x8f998000) /* lw t9,0x8000(gp) */
-#define STUB_MOVE 0x03e07825 /* move t7,ra */
-#define STUB_JALR 0x0320f809 /* jal t9 */
-#define STUB_LI16 0x34180000 /* ori t8,zero,0 */
+ : 0x8f998010) /* lw t9,0x8000(gp) */
+#define STUB_MOVE(abfd) \
+ (SGI_COMPAT (abfd) ? 0x03e07825 : 0x03e07821) /* move t7,ra */
+#define STUB_JALR 0x0320f809 /* jal t9 */
+#define STUB_LI16(abfd) \
+ (SGI_COMPAT (abfd) ? 0x34180000 : 0x24180000) /* ori t8,zero,0 */
#define MIPS_FUNCTION_STUB_SIZE (16)
#if 0
@@ -370,7 +421,7 @@ typedef struct
typedef struct
{
unsigned int ctype : 1; /* 1: long 0: short format. See below. */
- unsigned int rtype : 4; /* Relocation types. See below. */
+ unsigned int rtype : 4; /* Relocation types. See below. */
unsigned int dist2to : 8;
unsigned int relvaddr : 19; /* (VADDR - vaddr of the previous entry)/ 4 */
unsigned long konst; /* KONST field. See below. */
@@ -380,7 +431,7 @@ typedef struct
typedef struct
{
unsigned int ctype : 1; /* 1: long 0: short format. See below. */
- unsigned int rtype : 4; /* Relocation types. See below. */
+ unsigned int rtype : 4; /* Relocation types. See below. */
unsigned int dist2to : 8;
unsigned int relvaddr : 19; /* (VADDR - vaddr of the previous entry)/ 4 */
unsigned long konst; /* KONST field. See below. */
@@ -441,13 +492,13 @@ static void bfd_elf32_swap_compact_rel_out
static void bfd_elf32_swap_crinfo_out
PARAMS ((bfd *, const Elf32_crinfo *, Elf32_External_crinfo *));
-#define USE_REL 1 /* MIPS uses REL relocations instead of RELA */
-
/* In case we're on a 32-bit machine, construct a 64-bit "-1" value
from smaller values. Start with zero, widen, *then* decrement. */
#define MINUS_ONE (((bfd_vma)0) - 1)
-static reloc_howto_type elf_mips_howto_table[] =
+/* The relocation table used for SHT_REL sections. */
+
+static reloc_howto_type elf_mips_howto_table_rel[] =
{
/* No relocation. */
HOWTO (R_MIPS_NONE, /* type */
@@ -467,16 +518,16 @@ static reloc_howto_type elf_mips_howto_table[] =
/* 16 bit relocation. */
HOWTO (R_MIPS_16, /* type */
0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_16", /* name */
true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
/* 32 bit relocation. */
@@ -486,7 +537,7 @@ static reloc_howto_type elf_mips_howto_table[] =
32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_32", /* name */
true, /* partial_inplace */
@@ -501,7 +552,7 @@ static reloc_howto_type elf_mips_howto_table[] =
32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_REL32", /* name */
true, /* partial_inplace */
@@ -509,7 +560,7 @@ static reloc_howto_type elf_mips_howto_table[] =
0xffffffff, /* dst_mask */
false), /* pcrel_offset */
- /* 26 bit branch address. */
+ /* 26 bit jump address. */
HOWTO (R_MIPS_26, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
@@ -519,12 +570,12 @@ static reloc_howto_type elf_mips_howto_table[] =
complain_overflow_dont, /* complain_on_overflow */
/* This needs complex overflow
detection, because the upper four
- bits must match the PC. */
+ bits must match the PC + 4. */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_26", /* name */
true, /* partial_inplace */
- 0x3ffffff, /* src_mask */
- 0x3ffffff, /* dst_mask */
+ 0x03ffffff, /* src_mask */
+ 0x03ffffff, /* dst_mask */
false), /* pcrel_offset */
/* High 16 bits of symbol value. */
@@ -538,8 +589,8 @@ static reloc_howto_type elf_mips_howto_table[] =
_bfd_mips_elf_hi16_reloc, /* special_function */
"R_MIPS_HI16", /* name */
true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
/* Low 16 bits of symbol value. */
@@ -553,8 +604,8 @@ static reloc_howto_type elf_mips_howto_table[] =
_bfd_mips_elf_lo16_reloc, /* special_function */
"R_MIPS_LO16", /* name */
true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
/* GP relative reference. */
@@ -568,8 +619,8 @@ static reloc_howto_type elf_mips_howto_table[] =
_bfd_mips_elf_gprel16_reloc, /* special_function */
"R_MIPS_GPREL16", /* name */
true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
/* Reference to literal section. */
@@ -583,8 +634,8 @@ static reloc_howto_type elf_mips_howto_table[] =
_bfd_mips_elf_gprel16_reloc, /* special_function */
"R_MIPS_LITERAL", /* name */
true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
/* Reference to global offset table. */
@@ -597,9 +648,9 @@ static reloc_howto_type elf_mips_howto_table[] =
complain_overflow_signed, /* complain_on_overflow */
_bfd_mips_elf_got16_reloc, /* special_function */
"R_MIPS_GOT16", /* name */
- false, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
+ true, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
/* 16 bit PC relative reference. */
@@ -613,8 +664,8 @@ static reloc_howto_type elf_mips_howto_table[] =
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_PC16", /* name */
true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
true), /* pcrel_offset */
/* 16 bit call through global offset table. */
@@ -627,9 +678,9 @@ static reloc_howto_type elf_mips_howto_table[] =
complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_CALL16", /* name */
- false, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
+ true, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
/* 32 bit GP relative reference. */
@@ -639,7 +690,7 @@ static reloc_howto_type elf_mips_howto_table[] =
32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_dont, /* complain_on_overflow */
_bfd_mips_elf_gprel32_reloc, /* special_function */
"R_MIPS_GPREL32", /* name */
true, /* partial_inplace */
@@ -647,11 +698,11 @@ static reloc_howto_type elf_mips_howto_table[] =
0xffffffff, /* dst_mask */
false), /* pcrel_offset */
- /* The remaining relocs are defined on Irix 5, although they are
- not defined by the ABI. */
- EMPTY_HOWTO (13),
- EMPTY_HOWTO (14),
- EMPTY_HOWTO (15),
+ /* The remaining relocs are defined on Irix 5, although they are
+ not defined by the ABI. */
+ EMPTY_HOWTO (13),
+ EMPTY_HOWTO (14),
+ EMPTY_HOWTO (15),
/* A 5 bit shift field. */
HOWTO (R_MIPS_SHIFT5, /* type */
@@ -692,7 +743,7 @@ static reloc_howto_type elf_mips_howto_table[] =
64, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_dont, /* complain_on_overflow */
mips32_64bit_reloc, /* special_function */
"R_MIPS_64", /* name */
true, /* partial_inplace */
@@ -707,7 +758,7 @@ static reloc_howto_type elf_mips_howto_table[] =
16, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_GOT_DISP", /* name */
true, /* partial_inplace */
@@ -722,7 +773,7 @@ static reloc_howto_type elf_mips_howto_table[] =
16, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_GOT_PAGE", /* name */
true, /* partial_inplace */
@@ -737,7 +788,7 @@ static reloc_howto_type elf_mips_howto_table[] =
16, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_GOT_OFST", /* name */
true, /* partial_inplace */
@@ -782,7 +833,7 @@ static reloc_howto_type elf_mips_howto_table[] =
64, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_SUB", /* name */
true, /* partial_inplace */
@@ -806,8 +857,8 @@ static reloc_howto_type elf_mips_howto_table[] =
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_HIGHER", /* name */
true, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
/* Get the highest value of a 64 bit addend. */
@@ -821,8 +872,8 @@ static reloc_howto_type elf_mips_howto_table[] =
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_HIGHEST", /* name */
true, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
/* High 16 bits of displacement in global offset table. */
@@ -865,7 +916,7 @@ static reloc_howto_type elf_mips_howto_table[] =
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_SCN_DISP", /* name */
- false, /* partial_inplace */
+ true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
false), /* pcrel_offset */
@@ -875,12 +926,12 @@ static reloc_howto_type elf_mips_howto_table[] =
EMPTY_HOWTO (R_MIPS_PJUMP),
EMPTY_HOWTO (R_MIPS_RELGOT),
- /* Protected jump conversion. This is an optimization hint. No
+ /* Protected jump conversion. This is an optimization hint. No
relocation is required for correctness. */
HOWTO (R_MIPS_JALR, /* type */
0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
@@ -892,6 +943,535 @@ static reloc_howto_type elf_mips_howto_table[] =
false), /* pcrel_offset */
};
+/* The relocation table used for SHT_RELA sections. */
+
+static reloc_howto_type elf_mips_howto_table_rela[] =
+{
+ /* No relocation. */
+ HOWTO (R_MIPS_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 */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_MIPS_NONE", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* 16 bit relocation. */
+ HOWTO (R_MIPS_16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_MIPS_16", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0x0000, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* 32 bit relocation. */
+ HOWTO (R_MIPS_32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_MIPS_32", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* 32 bit symbol relative relocation. */
+ HOWTO (R_MIPS_REL32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_MIPS_REL32", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* 26 bit jump address. */
+ HOWTO (R_MIPS_26, /* type */
+ 2, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 26, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ /* This needs complex overflow
+ detection, because the upper 36
+ bits must match the PC + 4. */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_MIPS_26", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0x03ffffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* R_MIPS_HI16 and R_MIPS_LO16 are unsupported for 64 bit REL. */
+ /* High 16 bits of symbol value. */
+ HOWTO (R_MIPS_HI16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_MIPS_HI16", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Low 16 bits of symbol value. */
+ HOWTO (R_MIPS_LO16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_MIPS_LO16", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* GP relative reference. */
+ HOWTO (R_MIPS_GPREL16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ _bfd_mips_elf_gprel16_reloc, /* special_function */
+ "R_MIPS_GPREL16", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Reference to literal section. */
+ HOWTO (R_MIPS_LITERAL, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ _bfd_mips_elf_gprel16_reloc, /* special_function */
+ "R_MIPS_LITERAL", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Reference to global offset table. */
+ /* FIXME: This is not handled correctly. */
+ HOWTO (R_MIPS_GOT16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_MIPS_GOT16", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* 16 bit PC relative reference. */
+ HOWTO (R_MIPS_PC16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_MIPS_PC16", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* 16 bit call through global offset table. */
+ /* FIXME: This is not handled correctly. */
+ HOWTO (R_MIPS_CALL16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_MIPS_CALL16", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* 32 bit GP relative reference. */
+ HOWTO (R_MIPS_GPREL32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ _bfd_mips_elf_gprel32_reloc, /* special_function */
+ "R_MIPS_GPREL32", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ EMPTY_HOWTO (13),
+ EMPTY_HOWTO (14),
+ EMPTY_HOWTO (15),
+
+ /* A 5 bit shift field. */
+ HOWTO (R_MIPS_SHIFT5, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 5, /* bitsize */
+ false, /* pc_relative */
+ 6, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_MIPS_SHIFT5", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0x000007c0, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* A 6 bit shift field. */
+ /* FIXME: Not handled correctly. */
+ HOWTO (R_MIPS_SHIFT6, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 6, /* bitsize */
+ false, /* pc_relative */
+ 6, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_MIPS_SHIFT6", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0x000007c4, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* 64 bit relocation. */
+ HOWTO (R_MIPS_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_MIPS_64", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ MINUS_ONE, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Displacement in the global offset table. */
+ /* FIXME: Not handled correctly. */
+ HOWTO (R_MIPS_GOT_DISP, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_MIPS_GOT_DISP", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Displacement to page pointer in the global offset table. */
+ /* FIXME: Not handled correctly. */
+ HOWTO (R_MIPS_GOT_PAGE, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_MIPS_GOT_PAGE", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Offset from page pointer in the global offset table. */
+ /* FIXME: Not handled correctly. */
+ HOWTO (R_MIPS_GOT_OFST, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_MIPS_GOT_OFST", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* High 16 bits of displacement in global offset table. */
+ /* FIXME: Not handled correctly. */
+ HOWTO (R_MIPS_GOT_HI16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_MIPS_GOT_HI16", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Low 16 bits of displacement in global offset table. */
+ /* FIXME: Not handled correctly. */
+ HOWTO (R_MIPS_GOT_LO16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_MIPS_GOT_LO16", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* 64 bit substraction. */
+ /* FIXME: Not handled correctly. */
+ HOWTO (R_MIPS_SUB, /* 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_MIPS_SUB", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ MINUS_ONE, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Insert the addend as an instruction. */
+ /* FIXME: Not handled correctly. */
+ HOWTO (R_MIPS_INSERT_A, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_MIPS_INSERT_A", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Insert the addend as an instruction, and change all relocations
+ to refer to the old instruction at the address. */
+ /* FIXME: Not handled correctly. */
+ HOWTO (R_MIPS_INSERT_B, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_MIPS_INSERT_B", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Delete a 32 bit instruction. */
+ /* FIXME: Not handled correctly. */
+ HOWTO (R_MIPS_DELETE, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_MIPS_DELETE", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Get the higher value of a 64 bit addend. */
+ HOWTO (R_MIPS_HIGHER, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_MIPS_HIGHER", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Get the highest value of a 64 bit addend. */
+ HOWTO (R_MIPS_HIGHEST, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_MIPS_HIGHEST", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* High 16 bits of displacement in global offset table. */
+ /* FIXME: Not handled correctly. */
+ HOWTO (R_MIPS_CALL_HI16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_MIPS_CALL_HI16", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Low 16 bits of displacement in global offset table. */
+ /* FIXME: Not handled correctly. */
+ HOWTO (R_MIPS_CALL_LO16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_MIPS_CALL_LO16", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Section displacement, used by an associated event location section. */
+ /* FIXME: Not handled correctly. */
+ HOWTO (R_MIPS_SCN_DISP, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_MIPS_SCN_DISP", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO (R_MIPS_REL16, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_MIPS_REL16", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* These two are obsolete. */
+ EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE),
+ EMPTY_HOWTO (R_MIPS_PJUMP),
+
+ /* Similiar to R_MIPS_REL32, but used for relocations in a GOT section.
+ It must be used for multigot GOT's (and only there). */
+ HOWTO (R_MIPS_RELGOT, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_MIPS_RELGOT", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Protected jump conversion. This is an optimization hint. No
+ relocation is required for correctness. */
+ HOWTO (R_MIPS_JALR, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_MIPS_JALR", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ false), /* pcrel_offset */
+};
+
/* The reloc used for BFD_RELOC_CTOR when doing a 64 bit link. This
is a hack to make the linker think that we need 64 bit values. */
static reloc_howto_type elf_mips_ctor64_howto =
@@ -944,7 +1524,6 @@ static reloc_howto_type elf_mips16_gprel_howto =
0x07ff001f, /* dst_mask */
false); /* pcrel_offset */
-
/* GNU extensions for embedded-pic. */
/* High 16 bits of symbol value, pc-relative. */
static reloc_howto_type elf_mips_gnu_rel_hi16 =
@@ -1061,11 +1640,17 @@ static reloc_howto_type elf_mips_gnu_vtentry_howto =
/* Do a R_MIPS_HI16 relocation. This has to be done in combination
with a R_MIPS_LO16 reloc, because there is a carry from the LO16 to
the HI16. Here we just save the information we need; we do the
- actual relocation when we see the LO16. MIPS ELF requires that the
- LO16 immediately follow the HI16. As a GNU extension, we permit an
+ actual relocation when we see the LO16.
+
+ MIPS ELF requires that the LO16 immediately follow the HI16. As a
+ GNU extension, for non-pc-relative relocations, we permit an
arbitrary number of HI16 relocs to be associated with a single LO16
reloc. This extension permits gcc to output the HI and LO relocs
- itself. */
+ itself.
+
+ This cannot be done for PC-relative relocations because both the HI16
+ and LO16 parts of the relocations must be done relative to the LO16
+ part, and there can be carry to or borrow from the HI16 part. */
struct mips_hi16
{
@@ -1153,7 +1738,7 @@ _bfd_mips_elf_hi16_reloc (abfd,
return bfd_reloc_outofrange;
/* Save the information, and let LO16 do the actual relocation. */
- n = (struct mips_hi16 *) bfd_malloc (sizeof *n);
+ n = (struct mips_hi16 *) bfd_malloc ((bfd_size_type) sizeof *n);
if (n == NULL)
return bfd_reloc_outofrange;
n->addr = (bfd_byte *) data + reloc_entry->address;
@@ -1205,24 +1790,30 @@ _bfd_mips_elf_lo16_reloc (abfd,
to know anything about the LO16 itself, except where to
find the low 16 bits of the addend needed by the LO16. */
insn = bfd_get_32 (abfd, l->addr);
- vallo = (bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address)
- & 0xffff);
+ vallo = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
+
+ /* The low order 16 bits are always treated as a signed
+ value. */
+ vallo = ((vallo & 0xffff) ^ 0x8000) - 0x8000;
val = ((insn & 0xffff) << 16) + vallo;
val += l->addend;
- /* The low order 16 bits are always treated as a signed
- value. Therefore, a negative value in the low order bits
- requires an adjustment in the high order bits. We need
- to make this adjustment in two ways: once for the bits we
- took from the data, and once for the bits we are putting
- back in to the data. */
- if ((vallo & 0x8000) != 0)
- val -= 0x10000;
- if ((val & 0x8000) != 0)
- val += 0x10000;
-
- insn = (insn &~ 0xffff) | ((val >> 16) & 0xffff);
- bfd_put_32 (abfd, insn, l->addr);
+ /* If PC-relative, we need to subtract out the address of the LO
+ half of the HI/LO. (The actual relocation is relative
+ to that instruction.) */
+ if (reloc_entry->howto->pc_relative)
+ val -= reloc_entry->address;
+
+ /* At this point, "val" has the value of the combined HI/LO
+ pair. If the low order 16 bits (which will be used for
+ the LO16 insn) are negative, then we will need an
+ adjustment for the high order 16 bits. */
+ val += 0x8000;
+ val = (val >> 16) & 0xffff;
+
+ insn &= ~ (bfd_vma) 0xffff;
+ insn |= val;
+ bfd_put_32 (abfd, (bfd_vma) insn, l->addr);
if (strcmp (bfd_asymbol_name (symbol), "_gp_disp") == 0)
{
@@ -1345,7 +1936,7 @@ mips_elf_assign_gp (output_bfd, pgp)
{
for (i = 0; i < count; i++, sym++)
{
- register CONST char *name;
+ register const char *name;
name = bfd_asymbol_name (*sym);
if (*name == '_' && strcmp (name, "_gp") == 0)
@@ -1513,14 +2104,14 @@ gprel16_with_gp (abfd, symbol, reloc_entry, input_section, relocateable, data,
|| (symbol->flags & BSF_SECTION_SYM) != 0)
val += relocation - gp;
- insn = (insn &~ 0xffff) | (val & 0xffff);
+ insn = (insn & ~0xffff) | (val & 0xffff);
bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address);
if (relocateable)
reloc_entry->address += input_section->output_offset;
/* Make sure it fit in 16 bits. */
- if (val >= 0x8000 && val < 0xffff8000)
+ if ((long) val >= 0x8000 || (long) val < -0x8000)
return bfd_reloc_overflow;
return bfd_reloc_ok;
@@ -1629,7 +2220,7 @@ gprel32_with_gp (abfd, symbol, reloc_entry, input_section, relocateable, data,
|| (symbol->flags & BSF_SECTION_SYM) != 0)
val += relocation - gp;
- bfd_put_32 (abfd, val, (bfd_byte *) data + reloc_entry->address);
+ bfd_put_32 (abfd, (bfd_vma) val, (bfd_byte *) data + reloc_entry->address);
if (relocateable)
reloc_entry->address += input_section->output_offset;
@@ -1638,7 +2229,7 @@ gprel32_with_gp (abfd, symbol, reloc_entry, input_section, relocateable, data,
}
/* Handle a 64 bit reloc in a 32 bit MIPS ELF file. These are
- generated when addreses are 64 bits. The upper 32 bits are a simle
+ generated when addresses are 64 bits. The upper 32 bits are a simple
sign extension. */
static bfd_reloc_status_type
@@ -1666,7 +2257,7 @@ mips32_64bit_reloc (abfd, reloc_entry, symbol, data, input_section,
reloc32 = *reloc_entry;
if (bfd_big_endian (abfd))
reloc32.address += 4;
- reloc32.howto = &elf_mips_howto_table[R_MIPS_32];
+ reloc32.howto = &elf_mips_howto_table_rel[R_MIPS_32];
r = bfd_perform_relocation (abfd, &reloc32, data, input_section,
output_bfd, error_message);
@@ -1679,7 +2270,7 @@ mips32_64bit_reloc (abfd, reloc_entry, symbol, data, input_section,
addr = reloc_entry->address;
if (bfd_little_endian (abfd))
addr += 4;
- bfd_put_32 (abfd, val, (bfd_byte *) data + addr);
+ bfd_put_32 (abfd, (bfd_vma) val, (bfd_byte *) data + addr);
return r;
}
@@ -1773,9 +2364,9 @@ mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section,
/* Stuff the current addend back as a 32 bit value, do the usual
relocation, and then clean up. */
bfd_put_32 (abfd,
- (((extend & 0x1f) << 11)
- | (extend & 0x7e0)
- | (insn & 0x1f)),
+ (bfd_vma) (((extend & 0x1f) << 11)
+ | (extend & 0x7e0)
+ | (insn & 0x1f)),
(bfd_byte *) data + reloc_entry->address);
ret = gprel16_with_gp (abfd, symbol, reloc_entry, input_section,
@@ -1783,13 +2374,13 @@ mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section,
final = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
bfd_put_16 (abfd,
- ((extend & 0xf800)
- | ((final >> 11) & 0x1f)
- | (final & 0x7e0)),
+ (bfd_vma) ((extend & 0xf800)
+ | ((final >> 11) & 0x1f)
+ | (final & 0x7e0)),
(bfd_byte *) data + reloc_entry->address);
bfd_put_16 (abfd,
- ((insn & 0xffe0)
- | (final & 0x1f)),
+ (bfd_vma) ((insn & 0xffe0)
+ | (final & 0x1f)),
(bfd_byte *) data + reloc_entry->address + 2);
return ret;
@@ -1811,13 +2402,19 @@ elf_mips_isa (flags)
return 3;
case E_MIPS_ARCH_4:
return 4;
+ case E_MIPS_ARCH_5:
+ return 5;
+ case E_MIPS_ARCH_32:
+ return 32;
+ case E_MIPS_ARCH_64:
+ return 64;
}
return 4;
}
/* Return the MACH for a MIPS e_flags value. */
-static INLINE int
+static INLINE unsigned long
elf_mips_mach (flags)
flagword flags;
{
@@ -1838,6 +2435,9 @@ elf_mips_mach (flags)
case E_MIPS_MACH_4650:
return bfd_mach_mips4650;
+ case E_MIPS_MACH_SB1:
+ return bfd_mach_mips_sb1;
+
default:
switch (flags & EF_MIPS_ARCH)
{
@@ -1857,30 +2457,42 @@ elf_mips_mach (flags)
case E_MIPS_ARCH_4:
return bfd_mach_mips8000;
break;
+
+ case E_MIPS_ARCH_5:
+ return bfd_mach_mips5;
+ break;
+
+ case E_MIPS_ARCH_32:
+ return bfd_mach_mipsisa32;
+ break;
+
+ case E_MIPS_ARCH_64:
+ return bfd_mach_mipsisa64;
+ break;
}
}
return 0;
}
-/* Return printable name for ABI. */
+/* Return printable name for ABI. */
-static INLINE char*
+static INLINE char *
elf_mips_abi_name (abfd)
bfd *abfd;
{
flagword flags;
- if (ABI_N32_P (abfd))
- return "N32";
- else if (ABI_64_P (abfd))
- return "64";
-
flags = elf_elfheader (abfd)->e_flags;
switch (flags & EF_MIPS_ABI)
{
case 0:
- return "none";
+ if (ABI_N32_P (abfd))
+ return "N32";
+ else if (ABI_64_P (abfd))
+ return "64";
+ else
+ return "none";
case E_MIPS_ABI_O32:
return "O32";
case E_MIPS_ABI_O64:
@@ -1901,7 +2513,7 @@ struct elf_reloc_map {
enum elf_mips_reloc_type elf_reloc_val;
};
-static CONST struct elf_reloc_map mips_reloc_map[] =
+static const struct elf_reloc_map mips_reloc_map[] =
{
{ BFD_RELOC_NONE, R_MIPS_NONE, },
{ BFD_RELOC_16, R_MIPS_16 },
@@ -1910,12 +2522,12 @@ static CONST struct elf_reloc_map mips_reloc_map[] =
{ BFD_RELOC_MIPS_JMP, R_MIPS_26 },
{ BFD_RELOC_HI16_S, R_MIPS_HI16 },
{ BFD_RELOC_LO16, R_MIPS_LO16 },
- { BFD_RELOC_MIPS_GPREL, R_MIPS_GPREL16 },
+ { BFD_RELOC_GPREL16, R_MIPS_GPREL16 },
{ BFD_RELOC_MIPS_LITERAL, R_MIPS_LITERAL },
{ BFD_RELOC_MIPS_GOT16, R_MIPS_GOT16 },
{ BFD_RELOC_16_PCREL, R_MIPS_PC16 },
{ BFD_RELOC_MIPS_CALL16, R_MIPS_CALL16 },
- { BFD_RELOC_MIPS_GPREL32, R_MIPS_GPREL32 },
+ { BFD_RELOC_GPREL32, R_MIPS_GPREL32 },
{ BFD_RELOC_MIPS_GOT_HI16, R_MIPS_GOT_HI16 },
{ BFD_RELOC_MIPS_GOT_LO16, R_MIPS_GOT_LO16 },
{ BFD_RELOC_MIPS_CALL_HI16, R_MIPS_CALL_HI16 },
@@ -1938,7 +2550,7 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code)
for (i = 0; i < sizeof (mips_reloc_map) / sizeof (struct elf_reloc_map); i++)
{
if (mips_reloc_map[i].bfd_reloc_val == code)
- return &elf_mips_howto_table[(int) mips_reloc_map[i].elf_reloc_val];
+ return &elf_mips_howto_table_rel[(int) mips_reloc_map[i].elf_reloc_val];
}
switch (code)
@@ -1952,7 +2564,7 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code)
Select the right relocation (R_MIPS_32 or R_MIPS_64) based on the
size of addresses on this architecture. */
if (bfd_arch_bits_per_address (abfd) == 32)
- return &elf_mips_howto_table[(int) R_MIPS_32];
+ return &elf_mips_howto_table_rel[(int) R_MIPS_32];
else
return &elf_mips_ctor64_howto;
@@ -2015,7 +2627,7 @@ mips_rtype_to_howto (r_type)
default:
BFD_ASSERT (r_type < (unsigned int) R_MIPS_max);
- return &elf_mips_howto_table[r_type];
+ return &elf_mips_howto_table_rel[r_type];
break;
}
}
@@ -2070,12 +2682,12 @@ bfd_mips_elf32_swap_reginfo_in (abfd, ex, in)
const Elf32_External_RegInfo *ex;
Elf32_RegInfo *in;
{
- in->ri_gprmask = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_gprmask);
- in->ri_cprmask[0] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[0]);
- in->ri_cprmask[1] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[1]);
- in->ri_cprmask[2] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[2]);
- in->ri_cprmask[3] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[3]);
- in->ri_gp_value = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_gp_value);
+ in->ri_gprmask = H_GET_32 (abfd, ex->ri_gprmask);
+ in->ri_cprmask[0] = H_GET_32 (abfd, ex->ri_cprmask[0]);
+ in->ri_cprmask[1] = H_GET_32 (abfd, ex->ri_cprmask[1]);
+ in->ri_cprmask[2] = H_GET_32 (abfd, ex->ri_cprmask[2]);
+ in->ri_cprmask[3] = H_GET_32 (abfd, ex->ri_cprmask[3]);
+ in->ri_gp_value = H_GET_32 (abfd, ex->ri_gp_value);
}
void
@@ -2084,18 +2696,12 @@ bfd_mips_elf32_swap_reginfo_out (abfd, in, ex)
const Elf32_RegInfo *in;
Elf32_External_RegInfo *ex;
{
- bfd_h_put_32 (abfd, (bfd_vma) in->ri_gprmask,
- (bfd_byte *) ex->ri_gprmask);
- bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[0],
- (bfd_byte *) ex->ri_cprmask[0]);
- bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[1],
- (bfd_byte *) ex->ri_cprmask[1]);
- bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[2],
- (bfd_byte *) ex->ri_cprmask[2]);
- bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[3],
- (bfd_byte *) ex->ri_cprmask[3]);
- bfd_h_put_32 (abfd, (bfd_vma) in->ri_gp_value,
- (bfd_byte *) ex->ri_gp_value);
+ H_PUT_32 (abfd, in->ri_gprmask, ex->ri_gprmask);
+ H_PUT_32 (abfd, in->ri_cprmask[0], ex->ri_cprmask[0]);
+ H_PUT_32 (abfd, in->ri_cprmask[1], ex->ri_cprmask[1]);
+ H_PUT_32 (abfd, in->ri_cprmask[2], ex->ri_cprmask[2]);
+ H_PUT_32 (abfd, in->ri_cprmask[3], ex->ri_cprmask[3]);
+ H_PUT_32 (abfd, in->ri_gp_value, ex->ri_gp_value);
}
/* In the 64 bit ABI, the .MIPS.options section holds register
@@ -2110,13 +2716,13 @@ bfd_mips_elf64_swap_reginfo_in (abfd, ex, in)
const Elf64_External_RegInfo *ex;
Elf64_Internal_RegInfo *in;
{
- in->ri_gprmask = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_gprmask);
- in->ri_pad = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_pad);
- in->ri_cprmask[0] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[0]);
- in->ri_cprmask[1] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[1]);
- in->ri_cprmask[2] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[2]);
- in->ri_cprmask[3] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[3]);
- in->ri_gp_value = bfd_h_get_64 (abfd, (bfd_byte *) ex->ri_gp_value);
+ in->ri_gprmask = H_GET_32 (abfd, ex->ri_gprmask);
+ in->ri_pad = H_GET_32 (abfd, ex->ri_pad);
+ in->ri_cprmask[0] = H_GET_32 (abfd, ex->ri_cprmask[0]);
+ in->ri_cprmask[1] = H_GET_32 (abfd, ex->ri_cprmask[1]);
+ in->ri_cprmask[2] = H_GET_32 (abfd, ex->ri_cprmask[2]);
+ in->ri_cprmask[3] = H_GET_32 (abfd, ex->ri_cprmask[3]);
+ in->ri_gp_value = H_GET_64 (abfd, ex->ri_gp_value);
}
void
@@ -2125,20 +2731,13 @@ bfd_mips_elf64_swap_reginfo_out (abfd, in, ex)
const Elf64_Internal_RegInfo *in;
Elf64_External_RegInfo *ex;
{
- bfd_h_put_32 (abfd, (bfd_vma) in->ri_gprmask,
- (bfd_byte *) ex->ri_gprmask);
- bfd_h_put_32 (abfd, (bfd_vma) in->ri_pad,
- (bfd_byte *) ex->ri_pad);
- bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[0],
- (bfd_byte *) ex->ri_cprmask[0]);
- bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[1],
- (bfd_byte *) ex->ri_cprmask[1]);
- bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[2],
- (bfd_byte *) ex->ri_cprmask[2]);
- bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[3],
- (bfd_byte *) ex->ri_cprmask[3]);
- bfd_h_put_64 (abfd, (bfd_vma) in->ri_gp_value,
- (bfd_byte *) ex->ri_gp_value);
+ H_PUT_32 (abfd, in->ri_gprmask, ex->ri_gprmask);
+ H_PUT_32 (abfd, in->ri_pad, ex->ri_pad);
+ H_PUT_32 (abfd, in->ri_cprmask[0], ex->ri_cprmask[0]);
+ H_PUT_32 (abfd, in->ri_cprmask[1], ex->ri_cprmask[1]);
+ H_PUT_32 (abfd, in->ri_cprmask[2], ex->ri_cprmask[2]);
+ H_PUT_32 (abfd, in->ri_cprmask[3], ex->ri_cprmask[3]);
+ H_PUT_64 (abfd, in->ri_gp_value, ex->ri_gp_value);
}
/* Swap an entry in a .gptab section. Note that these routines rely
@@ -2150,8 +2749,8 @@ bfd_mips_elf32_swap_gptab_in (abfd, ex, in)
const Elf32_External_gptab *ex;
Elf32_gptab *in;
{
- in->gt_entry.gt_g_value = bfd_h_get_32 (abfd, ex->gt_entry.gt_g_value);
- in->gt_entry.gt_bytes = bfd_h_get_32 (abfd, ex->gt_entry.gt_bytes);
+ in->gt_entry.gt_g_value = H_GET_32 (abfd, ex->gt_entry.gt_g_value);
+ in->gt_entry.gt_bytes = H_GET_32 (abfd, ex->gt_entry.gt_bytes);
}
static void
@@ -2160,10 +2759,8 @@ bfd_mips_elf32_swap_gptab_out (abfd, in, ex)
const Elf32_gptab *in;
Elf32_External_gptab *ex;
{
- bfd_h_put_32 (abfd, (bfd_vma) in->gt_entry.gt_g_value,
- ex->gt_entry.gt_g_value);
- bfd_h_put_32 (abfd, (bfd_vma) in->gt_entry.gt_bytes,
- ex->gt_entry.gt_bytes);
+ H_PUT_32 (abfd, in->gt_entry.gt_g_value, ex->gt_entry.gt_g_value);
+ H_PUT_32 (abfd, in->gt_entry.gt_bytes, ex->gt_entry.gt_bytes);
}
static void
@@ -2172,12 +2769,12 @@ bfd_elf32_swap_compact_rel_out (abfd, in, ex)
const Elf32_compact_rel *in;
Elf32_External_compact_rel *ex;
{
- bfd_h_put_32 (abfd, (bfd_vma) in->id1, ex->id1);
- bfd_h_put_32 (abfd, (bfd_vma) in->num, ex->num);
- bfd_h_put_32 (abfd, (bfd_vma) in->id2, ex->id2);
- bfd_h_put_32 (abfd, (bfd_vma) in->offset, ex->offset);
- bfd_h_put_32 (abfd, (bfd_vma) in->reserved0, ex->reserved0);
- bfd_h_put_32 (abfd, (bfd_vma) in->reserved1, ex->reserved1);
+ H_PUT_32 (abfd, in->id1, ex->id1);
+ H_PUT_32 (abfd, in->num, ex->num);
+ H_PUT_32 (abfd, in->id2, ex->id2);
+ H_PUT_32 (abfd, in->offset, ex->offset);
+ H_PUT_32 (abfd, in->reserved0, ex->reserved0);
+ H_PUT_32 (abfd, in->reserved1, ex->reserved1);
}
static void
@@ -2192,9 +2789,9 @@ bfd_elf32_swap_crinfo_out (abfd, in, ex)
| ((in->rtype & CRINFO_RTYPE) << CRINFO_RTYPE_SH)
| ((in->dist2to & CRINFO_DIST2TO) << CRINFO_DIST2TO_SH)
| ((in->relvaddr & CRINFO_RELVADDR) << CRINFO_RELVADDR_SH));
- bfd_h_put_32 (abfd, (bfd_vma) l, ex->info);
- bfd_h_put_32 (abfd, (bfd_vma) in->konst, ex->konst);
- bfd_h_put_32 (abfd, (bfd_vma) in->vaddr, ex->vaddr);
+ H_PUT_32 (abfd, l, ex->info);
+ H_PUT_32 (abfd, in->konst, ex->konst);
+ H_PUT_32 (abfd, in->vaddr, ex->vaddr);
}
/* Swap in an options header. */
@@ -2205,10 +2802,10 @@ bfd_mips_elf_swap_options_in (abfd, ex, in)
const Elf_External_Options *ex;
Elf_Internal_Options *in;
{
- in->kind = bfd_h_get_8 (abfd, ex->kind);
- in->size = bfd_h_get_8 (abfd, ex->size);
- in->section = bfd_h_get_16 (abfd, ex->section);
- in->info = bfd_h_get_32 (abfd, ex->info);
+ in->kind = H_GET_8 (abfd, ex->kind);
+ in->size = H_GET_8 (abfd, ex->size);
+ in->section = H_GET_16 (abfd, ex->section);
+ in->info = H_GET_32 (abfd, ex->info);
}
/* Swap out an options header. */
@@ -2219,10 +2816,10 @@ bfd_mips_elf_swap_options_out (abfd, in, ex)
const Elf_Internal_Options *in;
Elf_External_Options *ex;
{
- bfd_h_put_8 (abfd, in->kind, ex->kind);
- bfd_h_put_8 (abfd, in->size, ex->size);
- bfd_h_put_16 (abfd, in->section, ex->section);
- bfd_h_put_32 (abfd, in->info, ex->info);
+ H_PUT_8 (abfd, in->kind, ex->kind);
+ H_PUT_8 (abfd, in->size, ex->size);
+ H_PUT_16 (abfd, in->section, ex->section);
+ H_PUT_32 (abfd, in->info, ex->info);
}
#if 0
/* Swap in an MSYM entry. */
@@ -2233,8 +2830,8 @@ bfd_mips_elf_swap_msym_in (abfd, ex, in)
const Elf32_External_Msym *ex;
Elf32_Internal_Msym *in;
{
- in->ms_hash_value = bfd_h_get_32 (abfd, ex->ms_hash_value);
- in->ms_info = bfd_h_get_32 (abfd, ex->ms_info);
+ in->ms_hash_value = H_GET_32 (abfd, ex->ms_hash_value);
+ in->ms_info = H_GET_32 (abfd, ex->ms_info);
}
#endif
/* Swap out an MSYM entry. */
@@ -2245,10 +2842,9 @@ bfd_mips_elf_swap_msym_out (abfd, in, ex)
const Elf32_Internal_Msym *in;
Elf32_External_Msym *ex;
{
- bfd_h_put_32 (abfd, in->ms_hash_value, ex->ms_hash_value);
- bfd_h_put_32 (abfd, in->ms_info, ex->ms_info);
+ H_PUT_32 (abfd, in->ms_hash_value, ex->ms_hash_value);
+ H_PUT_32 (abfd, in->ms_info, ex->ms_info);
}
-
/* Determine whether a symbol is global for the purposes of splitting
the symbol table into global symbols and local symbols. At least
@@ -2256,13 +2852,17 @@ bfd_mips_elf_swap_msym_out (abfd, in, ex)
symbols. On most ELF targets the split is between static symbols
and externally visible symbols. */
-/*ARGSUSED*/
static boolean
mips_elf_sym_is_global (abfd, sym)
bfd *abfd ATTRIBUTE_UNUSED;
asymbol *sym;
{
- return (sym->flags & BSF_SECTION_SYM) == 0 ? true : false;
+ if (SGI_COMPAT (abfd))
+ return (sym->flags & BSF_SECTION_SYM) == 0;
+ else
+ return ((sym->flags & (BSF_GLOBAL | BSF_WEAK)) != 0
+ || bfd_is_und_section (bfd_get_section (sym))
+ || bfd_is_com_section (bfd_get_section (sym)));
}
/* Set the right machine number for a MIPS ELF file. This is used for
@@ -2272,10 +2872,11 @@ boolean
_bfd_mips_elf_object_p (abfd)
bfd *abfd;
{
- /* Irix 5 and 6 is broken. Object file symbol tables are not always
+ /* Irix 5 and 6 are broken. Object file symbol tables are not always
sorted correctly such that local symbols precede global symbols,
and the sh_info field in the symbol table is not always right. */
- elf_bad_symtab (abfd) = true;
+ if (SGI_COMPAT(abfd))
+ elf_bad_symtab (abfd) = true;
bfd_default_set_arch_mach (abfd, bfd_arch_mips,
elf_mips_mach (elf_elfheader (abfd)->e_flags));
@@ -2286,7 +2887,6 @@ _bfd_mips_elf_object_p (abfd)
file. This gets the MIPS architecture right based on the machine
number. This is used by both the 32-bit and the 64-bit ABI. */
-/*ARGSUSED*/
void
_bfd_mips_elf_final_write_processing (abfd, linker)
bfd *abfd;
@@ -2315,6 +2915,8 @@ _bfd_mips_elf_final_write_processing (abfd, linker)
case bfd_mach_mips4000:
case bfd_mach_mips4300:
+ case bfd_mach_mips4400:
+ case bfd_mach_mips4600:
val = E_MIPS_ARCH_3;
break;
@@ -2334,18 +2936,36 @@ _bfd_mips_elf_final_write_processing (abfd, linker)
val = E_MIPS_ARCH_3 | E_MIPS_MACH_4650;
break;
+ case bfd_mach_mips5000:
case bfd_mach_mips8000:
+ case bfd_mach_mips10000:
+ case bfd_mach_mips12000:
val = E_MIPS_ARCH_4;
break;
+
+ case bfd_mach_mips5:
+ val = E_MIPS_ARCH_5;
+ break;
+
+ case bfd_mach_mips_sb1:
+ val = E_MIPS_ARCH_64 | E_MIPS_MACH_SB1;
+ break;
+
+ case bfd_mach_mipsisa32:
+ val = E_MIPS_ARCH_32;
+ break;
+
+ case bfd_mach_mipsisa64:
+ val = E_MIPS_ARCH_64;
}
- elf_elfheader (abfd)->e_flags &= ~ (EF_MIPS_ARCH | EF_MIPS_MACH);
+ elf_elfheader (abfd)->e_flags &= ~(EF_MIPS_ARCH | EF_MIPS_MACH);
elf_elfheader (abfd)->e_flags |= val;
/* Set the sh_info field for .gptab sections and other appropriate
info for each special section. */
for (i = 1, hdrpp = elf_elfsections (abfd) + 1;
- i < elf_elfheader (abfd)->e_shnum;
+ i < elf_numsections (abfd);
i++, hdrpp++)
{
switch ((*hdrpp)->sh_type)
@@ -2411,7 +3031,7 @@ _bfd_mips_elf_final_write_processing (abfd, linker)
}
}
-/* Function to keep MIPS specific file flags like as EF_MIPS_PIC. */
+/* Function to keep MIPS specific file flags like as EF_MIPS_PIC. */
boolean
_bfd_mips_elf_set_private_flags (abfd, flags)
@@ -2426,27 +3046,6 @@ _bfd_mips_elf_set_private_flags (abfd, flags)
return true;
}
-/* Copy backend specific data from one object module to another */
-
-boolean
-_bfd_mips_elf_copy_private_bfd_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_gp (obfd) = elf_gp (ibfd);
- elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags;
- elf_flags_init (obfd) = true;
- return true;
-}
-
/* Merge backend specific data from an object file to the output
object file when linking. */
@@ -2458,23 +3057,12 @@ _bfd_mips_elf_merge_private_bfd_data (ibfd, obfd)
flagword old_flags;
flagword new_flags;
boolean ok;
+ boolean null_input_bfd = true;
+ asection *sec;
/* Check if we have the same endianess */
- if (ibfd->xvec->byteorder != obfd->xvec->byteorder
- && obfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN)
- {
- const char *msg;
-
- if (bfd_big_endian (ibfd))
- msg = _("%s: compiled for a big endian system and target is little endian");
- else
- msg = _("%s: compiled for a little endian system and target is big endian");
-
- (*_bfd_error_handler) (msg, bfd_get_filename (ibfd));
-
- bfd_set_error (bfd_error_wrong_format);
- return false;
- }
+ 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)
@@ -2488,7 +3076,7 @@ _bfd_mips_elf_merge_private_bfd_data (ibfd, obfd)
{
elf_flags_init (obfd) = true;
elf_elfheader (obfd)->e_flags = new_flags;
- elf_elfheader (obfd)->e_ident[EI_CLASS]
+ elf_elfheader (obfd)->e_ident[EI_CLASS]
= elf_elfheader (ibfd)->e_ident[EI_CLASS];
if (bfd_get_arch (obfd) == bfd_get_arch (ibfd)
@@ -2510,6 +3098,27 @@ _bfd_mips_elf_merge_private_bfd_data (ibfd, obfd)
if (new_flags == old_flags)
return true;
+ /* Check to see if the input BFD actually contains any sections.
+ If not, its flags may not have been initialised either, but it cannot
+ actually cause any incompatibility. */
+ for (sec = ibfd->sections; sec != NULL; sec = sec->next)
+ {
+ /* Ignore synthetic sections and empty .text, .data and .bss sections
+ which are automatically generated by gas. */
+ if (strcmp (sec->name, ".reginfo")
+ && strcmp (sec->name, ".mdebug")
+ && ((!strcmp (sec->name, ".text")
+ || !strcmp (sec->name, ".data")
+ || !strcmp (sec->name, ".bss"))
+ && sec->_raw_size != 0))
+ {
+ null_input_bfd = false;
+ break;
+ }
+ }
+ if (null_input_bfd)
+ return true;
+
ok = true;
if ((new_flags & EF_MIPS_PIC) != (old_flags & EF_MIPS_PIC))
@@ -2518,7 +3127,7 @@ _bfd_mips_elf_merge_private_bfd_data (ibfd, obfd)
old_flags &= ~EF_MIPS_PIC;
(*_bfd_error_handler)
(_("%s: linking PIC files with non-PIC files"),
- bfd_get_filename (ibfd));
+ bfd_archive_filename (ibfd));
ok = false;
}
@@ -2528,11 +3137,11 @@ _bfd_mips_elf_merge_private_bfd_data (ibfd, obfd)
old_flags &= ~EF_MIPS_CPIC;
(*_bfd_error_handler)
(_("%s: linking abicalls files with non-abicalls files"),
- bfd_get_filename (ibfd));
+ bfd_archive_filename (ibfd));
ok = false;
}
- /* Compare the ISA's. */
+ /* Compare the ISA's. */
if ((new_flags & (EF_MIPS_ARCH | EF_MIPS_MACH))
!= (old_flags & (EF_MIPS_ARCH | EF_MIPS_MACH)))
{
@@ -2542,55 +3151,67 @@ _bfd_mips_elf_merge_private_bfd_data (ibfd, obfd)
int old_isa = elf_mips_isa (old_flags);
/* If either has no machine specified, just compare the general isa's.
- Some combinations of machines are ok, if the isa's match. */
- if (! new_mach
+ Some combinations of machines are ok, if the isa's match. */
+ if (! new_mach
|| ! old_mach
|| new_mach == old_mach
)
{
- /* Don't warn about mixing -mips1 and -mips2 code, or mixing -mips3
- and -mips4 code. They will normally use the same data sizes and
- calling conventions. */
+ /* Don't warn about mixing code using 32-bit ISAs, or mixing code
+ using 64-bit ISAs. They will normally use the same data sizes
+ and calling conventions. */
- if ((new_isa == 1 || new_isa == 2)
- ? (old_isa != 1 && old_isa != 2)
- : (old_isa == 1 || old_isa == 2))
+ if (( (new_isa == 1 || new_isa == 2 || new_isa == 32)
+ ^ (old_isa == 1 || old_isa == 2 || old_isa == 32)) != 0)
{
(*_bfd_error_handler)
(_("%s: ISA mismatch (-mips%d) with previous modules (-mips%d)"),
- bfd_get_filename (ibfd), new_isa, old_isa);
+ bfd_archive_filename (ibfd), new_isa, old_isa);
ok = false;
}
- }
+ else
+ {
+ /* Do we need to update the mach field? */
+ if (old_mach == 0 && new_mach != 0)
+ elf_elfheader (obfd)->e_flags |= new_mach;
+ /* Do we need to update the ISA field? */
+ if (new_isa > old_isa)
+ {
+ elf_elfheader (obfd)->e_flags &= ~EF_MIPS_ARCH;
+ elf_elfheader (obfd)->e_flags
+ |= new_flags & EF_MIPS_ARCH;
+ }
+ }
+ }
else
{
(*_bfd_error_handler)
(_("%s: ISA mismatch (%d) with previous modules (%d)"),
- bfd_get_filename (ibfd),
+ bfd_archive_filename (ibfd),
elf_mips_mach (new_flags),
elf_mips_mach (old_flags));
ok = false;
}
- new_flags &= ~ (EF_MIPS_ARCH | EF_MIPS_MACH);
- old_flags &= ~ (EF_MIPS_ARCH | EF_MIPS_MACH);
+ new_flags &= ~(EF_MIPS_ARCH | EF_MIPS_MACH);
+ old_flags &= ~(EF_MIPS_ARCH | EF_MIPS_MACH);
}
/* Compare ABI's. The 64-bit ABI does not use EF_MIPS_ABI. But, it
does set EI_CLASS differently from any 32-bit ABI. */
if ((new_flags & EF_MIPS_ABI) != (old_flags & EF_MIPS_ABI)
- || (elf_elfheader (ibfd)->e_ident[EI_CLASS]
+ || (elf_elfheader (ibfd)->e_ident[EI_CLASS]
!= elf_elfheader (obfd)->e_ident[EI_CLASS]))
{
- /* Only error if both are set (to different values). */
+ /* Only error if both are set (to different values). */
if (((new_flags & EF_MIPS_ABI) && (old_flags & EF_MIPS_ABI))
- || (elf_elfheader (ibfd)->e_ident[EI_CLASS]
+ || (elf_elfheader (ibfd)->e_ident[EI_CLASS]
!= elf_elfheader (obfd)->e_ident[EI_CLASS]))
{
(*_bfd_error_handler)
(_("%s: ABI mismatch: linking %s module with previous %s modules"),
- bfd_get_filename (ibfd),
+ bfd_archive_filename (ibfd),
elf_mips_abi_name (ibfd),
elf_mips_abi_name (obfd));
ok = false;
@@ -2604,7 +3225,7 @@ _bfd_mips_elf_merge_private_bfd_data (ibfd, obfd)
{
(*_bfd_error_handler)
(_("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"),
- bfd_get_filename (ibfd), (unsigned long) new_flags,
+ bfd_archive_filename (ibfd), (unsigned long) new_flags,
(unsigned long) old_flags);
ok = false;
}
@@ -2631,40 +3252,46 @@ _bfd_mips_elf_print_private_bfd_data (abfd, ptr)
_bfd_elf_print_private_bfd_data (abfd, ptr);
/* 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_MIPS_ABI) == E_MIPS_ABI_O32)
- fprintf (file, _ (" [abi=O32]"));
+ fprintf (file, _(" [abi=O32]"));
else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_O64)
- fprintf (file, _ (" [abi=O64]"));
+ fprintf (file, _(" [abi=O64]"));
else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_EABI32)
- fprintf (file, _ (" [abi=EABI32]"));
+ fprintf (file, _(" [abi=EABI32]"));
else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_EABI64)
- fprintf (file, _ (" [abi=EABI64]"));
+ fprintf (file, _(" [abi=EABI64]"));
else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI))
- fprintf (file, _ (" [abi unknown]"));
+ fprintf (file, _(" [abi unknown]"));
else if (ABI_N32_P (abfd))
- fprintf (file, _ (" [abi=N32]"));
+ fprintf (file, _(" [abi=N32]"));
else if (ABI_64_P (abfd))
- fprintf (file, _ (" [abi=64]"));
+ fprintf (file, _(" [abi=64]"));
else
- fprintf (file, _ (" [no abi set]"));
+ fprintf (file, _(" [no abi set]"));
if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_1)
- fprintf (file, _ (" [mips1]"));
+ fprintf (file, _(" [mips1]"));
else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_2)
- fprintf (file, _ (" [mips2]"));
+ fprintf (file, _(" [mips2]"));
else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_3)
- fprintf (file, _ (" [mips3]"));
+ fprintf (file, _(" [mips3]"));
else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_4)
- fprintf (file, _ (" [mips4]"));
+ fprintf (file, _(" [mips4]"));
+ else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_5)
+ fprintf (file, _(" [mips5]"));
+ else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_32)
+ fprintf (file, _(" [mips32]"));
+ else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_64)
+ fprintf (file, _(" [mips64]"));
else
- fprintf (file, _ (" [unknown ISA]"));
+ fprintf (file, _(" [unknown ISA]"));
if (elf_elfheader (abfd)->e_flags & EF_MIPS_32BITMODE)
- fprintf (file, _ (" [32bitmode]"));
+ fprintf (file, _(" [32bitmode]"));
else
- fprintf (file, _ (" [not 32bitmode]"));
+ fprintf (file, _(" [not 32bitmode]"));
fputc ('\n', file);
@@ -2778,7 +3405,8 @@ _bfd_mips_elf_section_from_shdr (abfd, hdr, name)
Elf32_RegInfo s;
if (! bfd_get_section_contents (abfd, hdr->bfd_section, (PTR) &ext,
- (file_ptr) 0, sizeof ext))
+ (file_ptr) 0,
+ (bfd_size_type) sizeof ext))
return false;
bfd_mips_elf32_swap_reginfo_in (abfd, &ext, &s);
elf_gp (abfd) = s.ri_gp_value;
@@ -2884,17 +3512,23 @@ _bfd_mips_elf_fake_sections (abfd, hdr, sec)
hdr->sh_type = SHT_MIPS_REGINFO;
/* In a shared object on Irix 5.3, the .reginfo section has an
entsize of 0x18. FIXME: Does this matter? */
- if (SGI_COMPAT (abfd) && (abfd->flags & DYNAMIC) != 0)
- hdr->sh_entsize = sizeof (Elf32_External_RegInfo);
+ if (SGI_COMPAT (abfd))
+ {
+ if ((abfd->flags & DYNAMIC) != 0)
+ hdr->sh_entsize = sizeof (Elf32_External_RegInfo);
+ else
+ hdr->sh_entsize = 1;
+ }
else
- hdr->sh_entsize = 1;
+ hdr->sh_entsize = sizeof (Elf32_External_RegInfo);
}
else if (SGI_COMPAT (abfd)
&& (strcmp (name, ".hash") == 0
|| strcmp (name, ".dynamic") == 0
|| strcmp (name, ".dynstr") == 0))
{
- hdr->sh_entsize = 0;
+ if (SGI_COMPAT (abfd))
+ hdr->sh_entsize = 0;
#if 0
/* This isn't how the Irix 6 linker behaves. */
hdr->sh_info = SIZEOF_MIPS_DYNSYM_SECNAMES;
@@ -2949,15 +3583,23 @@ _bfd_mips_elf_fake_sections (abfd, hdr, sec)
/* 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.<section> 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);
esd = elf_section_data (sec);
BFD_ASSERT (esd->rel_hdr2 == NULL);
- esd->rel_hdr2
- = (Elf_Internal_Shdr *) bfd_zalloc (abfd, sizeof (Elf_Internal_Shdr));
+ esd->rel_hdr2 = (Elf_Internal_Shdr *) bfd_zalloc (abfd, amt);
if (!esd->rel_hdr2)
return false;
_bfd_elf_init_reloc_shdr (abfd, esd->rel_hdr2, sec,
@@ -2974,9 +3616,8 @@ _bfd_mips_elf_fake_sections (abfd, hdr, sec)
the .scommon section. */
boolean
-_bfd_mips_elf_section_from_bfd_section (abfd, hdr, sec, retval)
+_bfd_mips_elf_section_from_bfd_section (abfd, sec, retval)
bfd *abfd ATTRIBUTE_UNUSED;
- Elf32_Internal_Shdr *hdr ATTRIBUTE_UNUSED;
asection *sec;
int *retval;
{
@@ -3011,8 +3652,8 @@ _bfd_mips_elf_set_section_contents (abfd, section, location, offset, count)
if (elf_section_data (section) == NULL)
{
- section->used_by_bfd =
- (PTR) bfd_zalloc (abfd, sizeof (struct bfd_elf_section_data));
+ bfd_size_type amt = sizeof (struct bfd_elf_section_data);
+ section->used_by_bfd = (PTR) bfd_zalloc (abfd, amt);
if (elf_section_data (section) == NULL)
return false;
}
@@ -3031,7 +3672,7 @@ _bfd_mips_elf_set_section_contents (abfd, section, location, offset, count)
elf_section_data (section)->tdata = (PTR) c;
}
- memcpy (c + offset, location, count);
+ memcpy (c + offset, location, (size_t) count);
}
return _bfd_elf_set_section_contents (abfd, section, location, offset,
@@ -3058,10 +3699,10 @@ _bfd_mips_elf_section_processing (abfd, hdr)
if (bfd_seek (abfd,
hdr->sh_offset + sizeof (Elf32_External_RegInfo) - 4,
- SEEK_SET) == -1)
+ SEEK_SET) != 0)
return false;
- bfd_h_put_32 (abfd, (bfd_vma) elf_gp (abfd), buf);
- if (bfd_write (buf, (bfd_size_type) 1, (bfd_size_type) 4, abfd) != 4)
+ H_PUT_32 (abfd, elf_gp (abfd), buf);
+ if (bfd_bwrite (buf, (bfd_size_type) 4, abfd) != 4)
return false;
}
@@ -3097,10 +3738,10 @@ _bfd_mips_elf_section_processing (abfd, hdr)
+ (l - contents)
+ sizeof (Elf_External_Options)
+ (sizeof (Elf64_External_RegInfo) - 8)),
- SEEK_SET) == -1)
+ SEEK_SET) != 0)
return false;
- bfd_h_put_64 (abfd, elf_gp (abfd), buf);
- if (bfd_write (buf, 1, 8, abfd) != 8)
+ H_PUT_64 (abfd, elf_gp (abfd), buf);
+ if (bfd_bwrite (buf, (bfd_size_type) 8, abfd) != 8)
return false;
}
else if (intopt.kind == ODK_REGINFO)
@@ -3112,10 +3753,10 @@ _bfd_mips_elf_section_processing (abfd, hdr)
+ (l - contents)
+ sizeof (Elf_External_Options)
+ (sizeof (Elf32_External_RegInfo) - 4)),
- SEEK_SET) == -1)
+ SEEK_SET) != 0)
return false;
- bfd_h_put_32 (abfd, elf_gp (abfd), buf);
- if (bfd_write (buf, 1, 4, abfd) != 4)
+ H_PUT_32 (abfd, elf_gp (abfd), buf);
+ if (bfd_bwrite (buf, (bfd_size_type) 4, abfd) != 4)
return false;
}
l += intopt.size;
@@ -3163,7 +3804,6 @@ _bfd_mips_elf_section_processing (abfd, hdr)
return true;
}
-
/* MIPS ELF uses two common sections. One is the usual one, and the
other is for small objects. All the small objects are kept
@@ -3181,18 +3821,6 @@ static asection mips_elf_acom_section;
static asymbol mips_elf_acom_symbol;
static asymbol *mips_elf_acom_symbol_ptr;
-/* The Irix 5 support uses two virtual sections, which represent
- text/data symbols defined in dynamic objects. */
-static asection mips_elf_text_section;
-static asection *mips_elf_text_section_ptr;
-static asymbol mips_elf_text_symbol;
-static asymbol *mips_elf_text_symbol_ptr;
-
-static asection mips_elf_data_section;
-static asection *mips_elf_data_section_ptr;
-static asymbol mips_elf_data_symbol;
-static asymbol *mips_elf_data_symbol_ptr;
-
/* Handle the special MIPS section numbers that a symbol may use.
This is used for both the 32-bit and the 64-bit ABI. */
@@ -3279,9 +3907,6 @@ _bfd_mips_elf_additional_program_headers (abfd)
asection *s;
int ret = 0;
- if (!SGI_COMPAT (abfd))
- return 0;
-
/* See if we need a PT_MIPS_REGINFO segment. */
s = bfd_get_section_by_name (abfd, ".reginfo");
if (s && (s->flags & SEC_LOAD))
@@ -3289,7 +3914,7 @@ _bfd_mips_elf_additional_program_headers (abfd)
/* See if we need a PT_MIPS_OPTIONS segment. */
if (IRIX_COMPAT (abfd) == ict_irix6
- && bfd_get_section_by_name (abfd,
+ && bfd_get_section_by_name (abfd,
MIPS_ELF_OPTIONS_SECTION_NAME (abfd)))
++ret;
@@ -3310,9 +3935,7 @@ _bfd_mips_elf_modify_segment_map (abfd)
{
asection *s;
struct elf_segment_map *m, **pm;
-
- if (! SGI_COMPAT (abfd))
- return true;
+ bfd_size_type amt;
/* If there is a .reginfo section, we need a PT_MIPS_REGINFO
segment. */
@@ -3324,7 +3947,8 @@ _bfd_mips_elf_modify_segment_map (abfd)
break;
if (m == NULL)
{
- m = (struct elf_segment_map *) bfd_zalloc (abfd, sizeof *m);
+ amt = sizeof *m;
+ m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
if (m == NULL)
return false;
@@ -3350,8 +3974,6 @@ _bfd_mips_elf_modify_segment_map (abfd)
table. */
if (IRIX_COMPAT (abfd) == ict_irix6)
{
- asection *s;
-
for (s = abfd->sections; s; s = s->next)
if (elf_section_data (s)->this_hdr.sh_type == SHT_MIPS_OPTIONS)
break;
@@ -3364,14 +3986,14 @@ _bfd_mips_elf_modify_segment_map (abfd)
there's not (like when running the `ld' testsuite). So,
if there's no program header table, we just put the
options segement at the end. */
- for (pm = &elf_tdata (abfd)->segment_map;
+ for (pm = &elf_tdata (abfd)->segment_map;
*pm != NULL;
pm = &(*pm)->next)
if ((*pm)->p_type == PT_PHDR)
break;
- options_segment = bfd_zalloc (abfd,
- sizeof (struct elf_segment_map));
+ amt = sizeof (struct elf_segment_map);
+ options_segment = bfd_zalloc (abfd, amt);
options_segment->next = *pm;
options_segment->p_type = PT_MIPS_OPTIONS;
options_segment->p_flags = PF_R;
@@ -3383,61 +4005,78 @@ _bfd_mips_elf_modify_segment_map (abfd)
}
else
{
- /* If there are .dynamic and .mdebug sections, we make a room
- for the RTPROC header. FIXME: Rewrite without section names. */
- if (bfd_get_section_by_name (abfd, ".interp") == NULL
- && bfd_get_section_by_name (abfd, ".dynamic") != NULL
- && bfd_get_section_by_name (abfd, ".mdebug") != NULL)
+ if (IRIX_COMPAT (abfd) == ict_irix5)
{
- for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
- if (m->p_type == PT_MIPS_RTPROC)
- break;
- if (m == NULL)
+ /* If there are .dynamic and .mdebug sections, we make a room
+ for the RTPROC header. FIXME: Rewrite without section names. */
+ if (bfd_get_section_by_name (abfd, ".interp") == NULL
+ && bfd_get_section_by_name (abfd, ".dynamic") != NULL
+ && bfd_get_section_by_name (abfd, ".mdebug") != NULL)
{
- m = (struct elf_segment_map *) bfd_zalloc (abfd, sizeof *m);
+ for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
+ if (m->p_type == PT_MIPS_RTPROC)
+ break;
if (m == NULL)
- return false;
+ {
+ amt = sizeof *m;
+ m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
+ if (m == NULL)
+ return false;
- m->p_type = PT_MIPS_RTPROC;
+ m->p_type = PT_MIPS_RTPROC;
- s = bfd_get_section_by_name (abfd, ".rtproc");
- if (s == NULL)
- {
- m->count = 0;
- m->p_flags = 0;
- m->p_flags_valid = 1;
- }
- else
- {
- m->count = 1;
- m->sections[0] = s;
- }
+ s = bfd_get_section_by_name (abfd, ".rtproc");
+ if (s == NULL)
+ {
+ m->count = 0;
+ m->p_flags = 0;
+ m->p_flags_valid = 1;
+ }
+ else
+ {
+ m->count = 1;
+ m->sections[0] = s;
+ }
- /* We want to put it after the DYNAMIC segment. */
- pm = &elf_tdata (abfd)->segment_map;
- while (*pm != NULL && (*pm)->p_type != PT_DYNAMIC)
- pm = &(*pm)->next;
- if (*pm != NULL)
- pm = &(*pm)->next;
+ /* We want to put it after the DYNAMIC segment. */
+ pm = &elf_tdata (abfd)->segment_map;
+ while (*pm != NULL && (*pm)->p_type != PT_DYNAMIC)
+ pm = &(*pm)->next;
+ if (*pm != NULL)
+ pm = &(*pm)->next;
- m->next = *pm;
- *pm = m;
+ m->next = *pm;
+ *pm = m;
+ }
}
}
-
/* On Irix 5, the PT_DYNAMIC segment includes the .dynamic,
.dynstr, .dynsym, and .hash sections, and everything in
between. */
- for (pm = &elf_tdata (abfd)->segment_map; *pm != NULL; pm = &(*pm)->next)
+ for (pm = &elf_tdata (abfd)->segment_map; *pm != NULL;
+ pm = &(*pm)->next)
if ((*pm)->p_type == PT_DYNAMIC)
break;
m = *pm;
+ if (m != NULL && IRIX_COMPAT (abfd) == ict_none)
+ {
+ /* For a normal mips executable the permissions for the PT_DYNAMIC
+ segment are read, write and execute. We do that here since
+ the code in elf.c sets only the read permission. This matters
+ sometimes for the dynamic linker. */
+ if (bfd_get_section_by_name (abfd, ".dynamic") != NULL)
+ {
+ m->p_flags = PF_R | PF_W | PF_X;
+ m->p_flags_valid = 1;
+ }
+ }
if (m != NULL
- && m->count == 1
- && strcmp (m->sections[0]->name, ".dynamic") == 0)
+ && m->count == 1 && strcmp (m->sections[0]->name, ".dynamic") == 0)
{
static const char *sec_names[] =
- { ".dynamic", ".dynstr", ".dynsym", ".hash" };
+ {
+ ".dynamic", ".dynstr", ".dynsym", ".hash"
+ };
bfd_vma low, high;
unsigned int i, c;
struct elf_segment_map *n;
@@ -3466,12 +4105,12 @@ _bfd_mips_elf_modify_segment_map (abfd)
if ((s->flags & SEC_LOAD) != 0
&& s->vma >= low
&& ((s->vma
- + (s->_cooked_size != 0 ? s->_cooked_size : s->_raw_size))
- <= high))
+ + (s->_cooked_size !=
+ 0 ? s->_cooked_size : s->_raw_size)) <= high))
++c;
- n = ((struct elf_segment_map *)
- bfd_zalloc (abfd, sizeof *n + (c - 1) * sizeof (asection *)));
+ amt = sizeof *n + (bfd_size_type) (c - 1) * sizeof (asection *);
+ n = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
if (n == NULL)
return false;
*n = *m;
@@ -3484,8 +4123,7 @@ _bfd_mips_elf_modify_segment_map (abfd)
&& s->vma >= low
&& ((s->vma
+ (s->_cooked_size != 0 ?
- s->_cooked_size : s->_raw_size))
- <= high))
+ s->_cooked_size : s->_raw_size)) <= high))
{
n->sections[i] = s;
++i;
@@ -3515,7 +4153,7 @@ typedef struct runtime_pdr {
long reserved;
struct exception_info *exception_info;/* pointer to exception array */
} RPDR, *pRPDR;
-#define cbRPDR sizeof(RPDR)
+#define cbRPDR sizeof (RPDR)
#define rpdNil ((pRPDR) 0)
/* Swap RPDR (runtime procedure table entry) for output. */
@@ -3529,20 +4167,20 @@ ecoff_swap_rpdr_out (abfd, in, ex)
const RPDR *in;
struct rpdr_ext *ex;
{
- /* ecoff_put_off was defined in ecoffswap.h. */
- ecoff_put_off (abfd, in->adr, (bfd_byte *) ex->p_adr);
- bfd_h_put_32 (abfd, in->regmask, (bfd_byte *) ex->p_regmask);
- bfd_h_put_32 (abfd, in->regoffset, (bfd_byte *) ex->p_regoffset);
- bfd_h_put_32 (abfd, in->fregmask, (bfd_byte *) ex->p_fregmask);
- bfd_h_put_32 (abfd, in->fregoffset, (bfd_byte *) ex->p_fregoffset);
- bfd_h_put_32 (abfd, in->frameoffset, (bfd_byte *) ex->p_frameoffset);
-
- bfd_h_put_16 (abfd, in->framereg, (bfd_byte *) ex->p_framereg);
- bfd_h_put_16 (abfd, in->pcreg, (bfd_byte *) ex->p_pcreg);
-
- bfd_h_put_32 (abfd, in->irpss, (bfd_byte *) ex->p_irpss);
+ /* ECOFF_PUT_OFF was defined in ecoffswap.h. */
+ ECOFF_PUT_OFF (abfd, in->adr, ex->p_adr);
+ H_PUT_32 (abfd, in->regmask, ex->p_regmask);
+ H_PUT_32 (abfd, in->regoffset, ex->p_regoffset);
+ H_PUT_32 (abfd, in->fregmask, ex->p_fregmask);
+ H_PUT_32 (abfd, in->fregoffset, ex->p_fregoffset);
+ H_PUT_32 (abfd, in->frameoffset, ex->p_frameoffset);
+
+ H_PUT_16 (abfd, in->framereg, ex->p_framereg);
+ H_PUT_16 (abfd, in->pcreg, ex->p_pcreg);
+
+ H_PUT_32 (abfd, in->irpss, ex->p_irpss);
#if 0 /* FIXME */
- ecoff_put_off (abfd, in->exception_info, (bfd_byte *) ex->p_exception_info);
+ ECOFF_PUT_OFF (abfd, in->exception_info, ex->p_exception_info);
#endif
}
@@ -3560,9 +4198,9 @@ _bfd_mips_elf_read_ecoff_info (abfd, section, debug)
char *ext_hdr = NULL;
swap = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap;
- memset (debug, 0, sizeof(*debug));
+ memset (debug, 0, sizeof (*debug));
- ext_hdr = (char *) bfd_malloc ((size_t) swap->external_hdr_size);
+ ext_hdr = (char *) bfd_malloc (swap->external_hdr_size);
if (ext_hdr == NULL && swap->external_hdr_size != 0)
goto error_return;
@@ -3581,12 +4219,12 @@ _bfd_mips_elf_read_ecoff_info (abfd, section, debug)
debug->ptr = NULL; \
else \
{ \
- debug->ptr = (type) bfd_malloc ((size_t) (size * symhdr->count)); \
+ bfd_size_type amt = (bfd_size_type) size * symhdr->count; \
+ debug->ptr = (type) bfd_malloc (amt); \
if (debug->ptr == NULL) \
goto error_return; \
if (bfd_seek (abfd, (file_ptr) symhdr->offset, SEEK_SET) != 0 \
- || (bfd_read (debug->ptr, size, symhdr->count, \
- abfd) != size * symhdr->count)) \
+ || bfd_bread (debug->ptr, amt, abfd) != amt) \
goto error_return; \
}
@@ -3639,7 +4277,6 @@ _bfd_mips_elf_read_ecoff_info (abfd, section, debug)
/* MIPS ELF local labels start with '$', not 'L'. */
-/*ARGSUSED*/
static boolean
mips_elf_is_local_label_name (abfd, name)
bfd *abfd;
@@ -3682,8 +4319,9 @@ _bfd_mips_elf_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
filename_ptr, functionname_ptr,
- line_ptr,
- ABI_64_P (abfd) ? 8 : 0))
+ line_ptr,
+ (unsigned) (ABI_64_P (abfd) ? 8 : 0),
+ &elf_tdata (abfd)->dwarf2_find_line_info))
return true;
msec = bfd_get_section_by_name (abfd, ".mdebug");
@@ -3708,9 +4346,9 @@ _bfd_mips_elf_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
char *fraw_src;
char *fraw_end;
struct fdr *fdr_ptr;
+ bfd_size_type amt = sizeof (struct mips_elf_find_line);
- fi = ((struct mips_elf_find_line *)
- bfd_zalloc (abfd, sizeof (struct mips_elf_find_line)));
+ fi = (struct mips_elf_find_line *) bfd_zalloc (abfd, amt);
if (fi == NULL)
{
msec->flags = origflags;
@@ -3724,10 +4362,8 @@ _bfd_mips_elf_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
}
/* Swap in the FDR information. */
- fi->d.fdr = ((struct fdr *)
- bfd_alloc (abfd,
- (fi->d.symbolic_header.ifdMax *
- sizeof (struct fdr))));
+ amt = fi->d.symbolic_header.ifdMax * sizeof (struct fdr);
+ fi->d.fdr = (struct fdr *) bfd_alloc (abfd, amt);
if (fi->d.fdr == NULL)
{
msec->flags = origflags;
@@ -3822,11 +4458,11 @@ struct mips_elf_link_hash_table
/* The size of the .compact_rel section (if SGI_COMPAT). */
bfd_size_type compact_rel_size;
/* This flag indicates that the value of DT_MIPS_RLD_MAP dynamic
- entry is set to the address of __rld_obj_head as in Irix 5. */
+ entry is set to the address of __rld_obj_head as in Irix 5. */
boolean use_rld_obj_head;
/* This is the value of the __rld_map or __rld_obj_head symbol. */
bfd_vma rld_value;
- /* This is set if we see any mips16 stub sections. */
+ /* This is set if we see any mips16 stub sections. */
boolean mips16_stubs_seen;
};
@@ -3885,7 +4521,9 @@ mips_elf_link_hash_newfunc (entry, table, string)
not been set. -1 means there is no associated ifd. */
ret->esym.ifd = -2;
ret->possibly_dynamic_relocs = 0;
+ ret->readonly_reloc = false;
ret->min_dyn_reloc_index = 0;
+ ret->no_fn_stub = false;
ret->fn_stub = NULL;
ret->need_fn_stub = false;
ret->call_stub = NULL;
@@ -3895,6 +4533,28 @@ mips_elf_link_hash_newfunc (entry, table, string)
return (struct bfd_hash_entry *) ret;
}
+static void
+_bfd_mips_elf_hide_symbol (info, entry, force_local)
+ struct bfd_link_info *info;
+ struct elf_link_hash_entry *entry;
+ boolean force_local;
+{
+ bfd *dynobj;
+ asection *got;
+ struct mips_got_info *g;
+ struct mips_elf_link_hash_entry *h;
+ h = (struct mips_elf_link_hash_entry *) entry;
+ dynobj = elf_hash_table (info)->dynobj;
+ got = bfd_get_section_by_name (dynobj, ".got");
+ g = (struct mips_got_info *) elf_section_data (got)->tdata;
+
+ _bfd_elf_link_hash_hide_symbol (info, &h->root, force_local);
+
+ /* FIXME: Do we allocate too much GOT space here? */
+ g->local_gotno++;
+ got->_raw_size += MIPS_ELF_GOT_SIZE (dynobj);
+}
+
/* Create a MIPS ELF linker hash table. */
struct bfd_link_hash_table *
@@ -3902,9 +4562,9 @@ _bfd_mips_elf_link_hash_table_create (abfd)
bfd *abfd;
{
struct mips_elf_link_hash_table *ret;
+ bfd_size_type amt = sizeof (struct mips_elf_link_hash_table);
- ret = ((struct mips_elf_link_hash_table *)
- bfd_alloc (abfd, sizeof (struct mips_elf_link_hash_table)));
+ ret = (struct mips_elf_link_hash_table *) bfd_alloc (abfd, amt);
if (ret == (struct mips_elf_link_hash_table *) NULL)
return NULL;
@@ -3932,7 +4592,6 @@ _bfd_mips_elf_link_hash_table_create (abfd)
/* Hook called by the linker routine which adds symbols from an object
file. We must handle the special MIPS section numbers here. */
-/*ARGSUSED*/
boolean
_bfd_mips_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
bfd *abfd;
@@ -3969,48 +4628,82 @@ _bfd_mips_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
case SHN_MIPS_TEXT:
/* This section is used in a shared object. */
- if (mips_elf_text_section_ptr == NULL)
+ if (elf_tdata (abfd)->elf_text_section == NULL)
{
+ asymbol *elf_text_symbol;
+ asection *elf_text_section;
+ bfd_size_type amt = sizeof (asection);
+
+ elf_text_section = bfd_zalloc (abfd, amt);
+ if (elf_text_section == NULL)
+ return false;
+
+ amt = sizeof (asymbol);
+ elf_text_symbol = bfd_zalloc (abfd, amt);
+ if (elf_text_symbol == NULL)
+ return false;
+
/* Initialize the section. */
- mips_elf_text_section.name = ".text";
- mips_elf_text_section.flags = SEC_NO_FLAGS;
- mips_elf_text_section.output_section = NULL;
- mips_elf_text_section.symbol = &mips_elf_text_symbol;
- mips_elf_text_section.symbol_ptr_ptr = &mips_elf_text_symbol_ptr;
- mips_elf_text_symbol.name = ".text";
- mips_elf_text_symbol.flags = BSF_SECTION_SYM | BSF_DYNAMIC;
- mips_elf_text_symbol.section = &mips_elf_text_section;
- mips_elf_text_symbol_ptr = &mips_elf_text_symbol;
- mips_elf_text_section_ptr = &mips_elf_text_section;
+
+ elf_tdata (abfd)->elf_text_section = elf_text_section;
+ elf_tdata (abfd)->elf_text_symbol = elf_text_symbol;
+
+ elf_text_section->symbol = elf_text_symbol;
+ elf_text_section->symbol_ptr_ptr = &elf_tdata (abfd)->elf_text_symbol;
+
+ elf_text_section->name = ".text";
+ elf_text_section->flags = SEC_NO_FLAGS;
+ elf_text_section->output_section = NULL;
+ elf_text_section->owner = abfd;
+ elf_text_symbol->name = ".text";
+ elf_text_symbol->flags = BSF_SECTION_SYM | BSF_DYNAMIC;
+ elf_text_symbol->section = elf_text_section;
}
/* This code used to do *secp = bfd_und_section_ptr if
info->shared. I don't know why, and that doesn't make sense,
so I took it out. */
- *secp = mips_elf_text_section_ptr;
+ *secp = elf_tdata (abfd)->elf_text_section;
break;
case SHN_MIPS_ACOMMON:
/* Fall through. XXX Can we treat this as allocated data? */
case SHN_MIPS_DATA:
/* This section is used in a shared object. */
- if (mips_elf_data_section_ptr == NULL)
+ if (elf_tdata (abfd)->elf_data_section == NULL)
{
+ asymbol *elf_data_symbol;
+ asection *elf_data_section;
+ bfd_size_type amt = sizeof (asection);
+
+ elf_data_section = bfd_zalloc (abfd, amt);
+ if (elf_data_section == NULL)
+ return false;
+
+ amt = sizeof (asymbol);
+ elf_data_symbol = bfd_zalloc (abfd, amt);
+ if (elf_data_symbol == NULL)
+ return false;
+
/* Initialize the section. */
- mips_elf_data_section.name = ".data";
- mips_elf_data_section.flags = SEC_NO_FLAGS;
- mips_elf_data_section.output_section = NULL;
- mips_elf_data_section.symbol = &mips_elf_data_symbol;
- mips_elf_data_section.symbol_ptr_ptr = &mips_elf_data_symbol_ptr;
- mips_elf_data_symbol.name = ".data";
- mips_elf_data_symbol.flags = BSF_SECTION_SYM | BSF_DYNAMIC;
- mips_elf_data_symbol.section = &mips_elf_data_section;
- mips_elf_data_symbol_ptr = &mips_elf_data_symbol;
- mips_elf_data_section_ptr = &mips_elf_data_section;
+
+ elf_tdata (abfd)->elf_data_section = elf_data_section;
+ elf_tdata (abfd)->elf_data_symbol = elf_data_symbol;
+
+ elf_data_section->symbol = elf_data_symbol;
+ elf_data_section->symbol_ptr_ptr = &elf_tdata (abfd)->elf_data_symbol;
+
+ elf_data_section->name = ".data";
+ elf_data_section->flags = SEC_NO_FLAGS;
+ elf_data_section->output_section = NULL;
+ elf_data_section->owner = abfd;
+ elf_data_symbol->name = ".data";
+ elf_data_symbol->flags = BSF_SECTION_SYM | BSF_DYNAMIC;
+ elf_data_symbol->section = elf_data_section;
}
/* This code used to do *secp = bfd_und_section_ptr if
info->shared. I don't know why, and that doesn't make sense,
so I took it out. */
- *secp = mips_elf_data_section_ptr;
+ *secp = elf_tdata (abfd)->elf_data_section;
break;
case SHN_MIPS_SUNDEFINED:
@@ -4033,7 +4726,7 @@ _bfd_mips_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
get_elf_backend_data (abfd)->collect,
(struct bfd_link_hash_entry **) &h)))
return false;
- h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF;
+ h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF;
h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
h->type = STT_OBJECT;
@@ -4086,6 +4779,9 @@ mips_elf_output_extsym (h, data)
boolean strip;
asection *sec, *output_section;
+ if (h->root.root.type == bfd_link_hash_warning)
+ h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link;
+
if (h->root.indx == -2)
strip = false;
else if (((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
@@ -4115,9 +4811,8 @@ mips_elf_output_extsym (h, data)
h->esym.asym.value = 0;
h->esym.asym.st = stGlobal;
- if (SGI_COMPAT (einfo->abfd)
- && (h->root.root.type == bfd_link_hash_undefined
- || h->root.root.type == bfd_link_hash_undefweak))
+ if (h->root.root.type == bfd_link_hash_undefined
+ || h->root.root.type == bfd_link_hash_undefweak)
{
const char *name;
@@ -4212,24 +4907,36 @@ mips_elf_output_extsym (h, data)
}
else if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
{
- /* Set type and value for a symbol with a function stub. */
- h->esym.asym.st = stProc;
- sec = h->root.root.u.def.section;
- if (sec == NULL)
- h->esym.asym.value = 0;
- else
+ struct mips_elf_link_hash_entry *hd = h;
+ boolean no_fn_stub = h->no_fn_stub;
+
+ while (hd->root.root.type == bfd_link_hash_indirect)
{
- output_section = sec->output_section;
- if (output_section != NULL)
- h->esym.asym.value = (h->root.plt.offset
- + sec->output_offset
- + output_section->vma);
- else
- h->esym.asym.value = 0;
+ hd = (struct mips_elf_link_hash_entry *)h->root.root.u.i.link;
+ no_fn_stub = no_fn_stub || hd->no_fn_stub;
}
+
+ if (!no_fn_stub)
+ {
+ /* Set type and value for a symbol with a function stub. */
+ h->esym.asym.st = stProc;
+ sec = hd->root.root.u.def.section;
+ if (sec == NULL)
+ h->esym.asym.value = 0;
+ else
+ {
+ output_section = sec->output_section;
+ if (output_section != NULL)
+ h->esym.asym.value = (hd->root.plt.offset
+ + sec->output_offset
+ + output_section->vma);
+ else
+ h->esym.asym.value = 0;
+ }
#if 0 /* FIXME? */
- h->esym.ifd = 0;
+ h->esym.ifd = 0;
#endif
+ }
}
if (! bfd_ecoff_debug_one_external (einfo->abfd, einfo->debug, einfo->swap,
@@ -4262,7 +4969,8 @@ mips_elf_create_procedure_table (handle, abfd, info, s, debug)
struct sym_ext *esym;
char *ss, **sv;
char *str;
- unsigned long size, count;
+ bfd_size_type size;
+ bfd_size_type count;
unsigned long sindex;
unsigned long i;
PDR pdr;
@@ -4295,7 +5003,8 @@ mips_elf_create_procedure_table (handle, abfd, info, s, debug)
if (rpdr == NULL)
goto error_return;
- sv = (char **) bfd_malloc (sizeof (char *) * count);
+ size = sizeof (char *);
+ sv = (char **) bfd_malloc (size * count);
if (sv == NULL)
goto error_return;
@@ -4316,7 +5025,7 @@ mips_elf_create_procedure_table (handle, abfd, info, s, debug)
goto error_return;
count = hdr->ipdMax;
- for (i = 0; i < count; i++, rp++)
+ for (i = 0; i < (unsigned long) count; i++, rp++)
{
(*swap->swap_pdr_in) (abfd, (PTR) (epdr + i), &pdr);
(*swap->swap_sym_in) (abfd, (PTR) &esym[pdr.isym], &sym);
@@ -4357,7 +5066,7 @@ mips_elf_create_procedure_table (handle, abfd, info, s, debug)
strcpy (str, sv[i]);
str += strlen (sv[i]) + 1;
}
- ecoff_put_off (abfd, (bfd_vma) -1, (bfd_byte *) (erp + count)->p_adr);
+ ECOFF_PUT_OFF (abfd, -1, (erp + count)->p_adr);
/* Set the size and contents of .rtproc section. */
s->_raw_size = size;
@@ -4427,6 +5136,21 @@ _bfd_mips_elf_final_link (abfd, info)
= get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap;
HDRR *symhdr = &debug.symbolic_header;
PTR mdebug_handle = NULL;
+ asection *s;
+ EXTR esym;
+ unsigned int i;
+ bfd_size_type amt;
+
+ static const char * const secname[] =
+ {
+ ".text", ".init", ".fini", ".data",
+ ".rodata", ".sdata", ".sbss", ".bss"
+ };
+ static const int sc[] =
+ {
+ scText, scInit, scFini, scData,
+ scRData, scSData, scSBss, scBss
+ };
/* If all the things we linked together were PIC, but we're
producing an executable (rather than a shared object), then the
@@ -4455,10 +5179,10 @@ _bfd_mips_elf_final_link (abfd, info)
adds these symbols when building a shared object. Note that
we count the sections after (possibly) removing the .options
section above. */
- if (!mips_elf_sort_hash_table (info, (info->shared
+ if (!mips_elf_sort_hash_table (info, (info->shared
? bfd_count_sections (abfd) + 1
: 1)))
- return false;
+ return false;
/* Make sure we didn't grow the global .got region. */
dynobj = elf_hash_table (info)->dynobj;
@@ -4475,18 +5199,18 @@ _bfd_mips_elf_final_link (abfd, info)
include it, even though we don't process it quite right. (Some
entries are supposed to be merged.) Empirically, we seem to be
better off including it then not. */
- if (IRIX_COMPAT (abfd) == ict_irix5)
+ if (IRIX_COMPAT (abfd) == ict_irix5 || IRIX_COMPAT (abfd) == ict_none)
for (secpp = &abfd->sections; *secpp != NULL; secpp = &(*secpp)->next)
{
if (strcmp ((*secpp)->name, MIPS_ELF_OPTIONS_SECTION_NAME (abfd)) == 0)
{
for (p = (*secpp)->link_order_head; p != NULL; p = p->next)
if (p->type == bfd_indirect_link_order)
- p->u.indirect.section->flags &=~ SEC_HAS_CONTENTS;
+ p->u.indirect.section->flags &= ~SEC_HAS_CONTENTS;
(*secpp)->link_order_head = NULL;
- *secpp = (*secpp)->next;
+ bfd_section_list_remove (abfd, secpp);
--abfd->section_count;
-
+
break;
}
}
@@ -4509,7 +5233,7 @@ _bfd_mips_elf_final_link (abfd, info)
/* Find the GP-relative section with the lowest offset. */
lo = (bfd_vma) -1;
for (o = abfd->sections; o != (asection *) NULL; o = o->next)
- if (o->vma < lo
+ if (o->vma < lo
&& (elf_section_data (o)->this_hdr.sh_flags & SHF_MIPS_GPREL))
lo = o->vma;
@@ -4566,7 +5290,7 @@ _bfd_mips_elf_final_link (abfd, info)
if (! bfd_get_section_contents (input_bfd, input_section,
(PTR) &ext,
(file_ptr) 0,
- sizeof ext))
+ (bfd_size_type) sizeof ext))
return false;
bfd_mips_elf32_swap_reginfo_in (input_bfd, &ext, &sub);
@@ -4583,7 +5307,7 @@ _bfd_mips_elf_final_link (abfd, info)
/* Hack: reset the SEC_HAS_CONTENTS flag so that
elf_link_input_bfd ignores this section. */
- input_section->flags &=~ SEC_HAS_CONTENTS;
+ input_section->flags &= ~SEC_HAS_CONTENTS;
}
/* Size has been set in mips_elf_always_size_sections */
@@ -4599,6 +5323,7 @@ _bfd_mips_elf_final_link (abfd, info)
if (strcmp (o->name, ".mdebug") == 0)
{
struct extsym_info einfo;
+ bfd_vma last;
/* We have found the .mdebug section in the output file.
Look through all the link_orders comprising it and merge
@@ -4637,44 +5362,30 @@ _bfd_mips_elf_final_link (abfd, info)
if (mdebug_handle == (PTR) NULL)
return false;
- if (SGI_COMPAT (abfd))
+ esym.jmptbl = 0;
+ esym.cobol_main = 0;
+ esym.weakext = 0;
+ esym.reserved = 0;
+ esym.ifd = ifdNil;
+ esym.asym.iss = issNil;
+ esym.asym.st = stLocal;
+ esym.asym.reserved = 0;
+ esym.asym.index = indexNil;
+ last = 0;
+ for (i = 0; i < sizeof (secname) / sizeof (secname[0]); i++)
{
- asection *s;
- EXTR esym;
- bfd_vma last;
- unsigned int i;
- static const char * const name[] =
- { ".text", ".init", ".fini", ".data",
- ".rodata", ".sdata", ".sbss", ".bss" };
- static const int sc[] = { scText, scInit, scFini, scData,
- scRData, scSData, scSBss, scBss };
-
- esym.jmptbl = 0;
- esym.cobol_main = 0;
- esym.weakext = 0;
- esym.reserved = 0;
- esym.ifd = ifdNil;
- esym.asym.iss = issNil;
- esym.asym.st = stLocal;
- esym.asym.reserved = 0;
- esym.asym.index = indexNil;
- last = 0;
- for (i = 0; i < 8; i++)
+ esym.asym.sc = sc[i];
+ s = bfd_get_section_by_name (abfd, secname[i]);
+ if (s != NULL)
{
- esym.asym.sc = sc[i];
- s = bfd_get_section_by_name (abfd, name[i]);
- if (s != NULL)
- {
- esym.asym.value = s->vma;
- last = s->vma + s->_raw_size;
- }
- else
- esym.asym.value = last;
-
- if (! bfd_ecoff_debug_one_external (abfd, &debug, swap,
- name[i], &esym))
- return false;
+ esym.asym.value = s->vma;
+ last = s->vma + s->_raw_size;
}
+ else
+ esym.asym.value = last;
+ if (!bfd_ecoff_debug_one_external (abfd, &debug, swap,
+ secname[i], &esym))
+ return false;
}
for (p = o->link_order_head;
@@ -4778,7 +5489,7 @@ _bfd_mips_elf_final_link (abfd, info)
/* Hack: reset the SEC_HAS_CONTENTS flag so that
elf_link_input_bfd ignores this section. */
- input_section->flags &=~ SEC_HAS_CONTENTS;
+ input_section->flags &= ~SEC_HAS_CONTENTS;
}
if (SGI_COMPAT (abfd) && info->shared)
@@ -4830,7 +5541,7 @@ _bfd_mips_elf_final_link (abfd, info)
unsigned int c;
Elf32_gptab *tab;
Elf32_External_gptab *ext_tab;
- unsigned int i;
+ unsigned int j;
/* The .gptab.sdata and .gptab.sbss sections hold
information describing how the small data area would
@@ -4838,8 +5549,6 @@ _bfd_mips_elf_final_link (abfd, info)
not used in executables files. */
if (! info->relocateable)
{
- asection **secpp;
-
for (p = o->link_order_head;
p != (struct bfd_link_order *) NULL;
p = p->next)
@@ -4857,7 +5566,7 @@ _bfd_mips_elf_final_link (abfd, info)
/* Hack: reset the SEC_HAS_CONTENTS flag so that
elf_link_input_bfd ignores this section. */
- input_section->flags &=~ SEC_HAS_CONTENTS;
+ input_section->flags &= ~SEC_HAS_CONTENTS;
}
/* Skip this section later on (I don't think this
@@ -4869,7 +5578,7 @@ _bfd_mips_elf_final_link (abfd, info)
*secpp != o;
secpp = &(*secpp)->next)
;
- *secpp = (*secpp)->next;
+ bfd_section_list_remove (abfd, secpp);
--abfd->section_count;
continue;
@@ -4908,7 +5617,8 @@ _bfd_mips_elf_final_link (abfd, info)
/* Set up the first entry. */
c = 1;
- tab = (Elf32_gptab *) bfd_malloc (c * sizeof (Elf32_gptab));
+ amt = c * sizeof (Elf32_gptab);
+ tab = (Elf32_gptab *) bfd_malloc (amt);
if (tab == NULL)
return false;
tab[0].gt_header.gt_current_g_value = elf_gp_size (abfd);
@@ -4953,7 +5663,8 @@ _bfd_mips_elf_final_link (abfd, info)
if (! (bfd_get_section_contents
(input_bfd, input_section, (PTR) &ext_gptab,
- gpentry, sizeof (Elf32_External_gptab))))
+ (file_ptr) gpentry,
+ (bfd_size_type) sizeof (Elf32_External_gptab))))
{
free (tab);
return false;
@@ -4980,9 +5691,8 @@ _bfd_mips_elf_final_link (abfd, info)
unsigned int max;
/* We need a new table entry. */
- new_tab = ((Elf32_gptab *)
- bfd_realloc ((PTR) tab,
- (c + 1) * sizeof (Elf32_gptab)));
+ amt = (bfd_size_type) (c + 1) * sizeof (Elf32_gptab);
+ new_tab = (Elf32_gptab *) bfd_realloc ((PTR) tab, amt);
if (new_tab == NULL)
{
free (tab);
@@ -5016,7 +5726,7 @@ _bfd_mips_elf_final_link (abfd, info)
/* Hack: reset the SEC_HAS_CONTENTS flag so that
elf_link_input_bfd ignores this section. */
- input_section->flags &=~ SEC_HAS_CONTENTS;
+ input_section->flags &= ~SEC_HAS_CONTENTS;
}
/* The table must be sorted by -G value. */
@@ -5024,16 +5734,16 @@ _bfd_mips_elf_final_link (abfd, info)
qsort (tab + 1, c - 1, sizeof (tab[0]), gptab_compare);
/* Swap out the table. */
- ext_tab = ((Elf32_External_gptab *)
- bfd_alloc (abfd, c * sizeof (Elf32_External_gptab)));
+ amt = (bfd_size_type) c * sizeof (Elf32_External_gptab);
+ ext_tab = (Elf32_External_gptab *) bfd_alloc (abfd, amt);
if (ext_tab == NULL)
{
free (tab);
return false;
}
- for (i = 0; i < c; i++)
- bfd_mips_elf32_swap_gptab_out (abfd, tab + i, ext_tab + i);
+ for (j = 0; j < c; j++)
+ bfd_mips_elf32_swap_gptab_out (abfd, tab + j, ext_tab + j);
free (tab);
o->_raw_size = c * sizeof (Elf32_External_gptab);
@@ -5067,7 +5777,7 @@ _bfd_mips_elf_final_link (abfd, info)
bfd_mips_elf32_swap_reginfo_out (abfd, &reginfo, &ext);
if (! bfd_set_section_contents (abfd, reginfo_sec, (PTR) &ext,
- (file_ptr) 0, sizeof ext))
+ (file_ptr) 0, (bfd_size_type) sizeof ext))
return false;
}
@@ -5116,6 +5826,26 @@ _bfd_mips_elf_final_link (abfd, info)
return true;
}
+/* This function is called via qsort() to sort the dynamic relocation
+ entries by increasing r_symndx value. */
+
+static int
+sort_dynamic_relocs (arg1, arg2)
+ const PTR arg1;
+ const PTR arg2;
+{
+ const Elf32_External_Rel *ext_reloc1 = (const Elf32_External_Rel *) arg1;
+ const Elf32_External_Rel *ext_reloc2 = (const Elf32_External_Rel *) arg2;
+
+ Elf_Internal_Rel int_reloc1;
+ Elf_Internal_Rel int_reloc2;
+
+ bfd_elf32_swap_reloc_in (reldyn_sorting_bfd, ext_reloc1, &int_reloc1);
+ bfd_elf32_swap_reloc_in (reldyn_sorting_bfd, ext_reloc2, &int_reloc2);
+
+ return (ELF32_R_SYM (int_reloc1.r_info) - ELF32_R_SYM (int_reloc2.r_info));
+}
+
/* Returns the GOT section for ABFD. */
static asection *
@@ -5126,7 +5856,7 @@ mips_elf_got_section (abfd)
}
/* Returns the GOT information associated with the link indicated by
- INFO. If SGOTP is non-NULL, it is filled in with the GOT
+ INFO. If SGOTP is non-NULL, it is filled in with the GOT
section. */
static struct mips_got_info *
@@ -5151,24 +5881,42 @@ mips_elf_got_info (abfd, sgotp)
/* Return whether a relocation is against a local symbol. */
static boolean
-mips_elf_local_relocation_p (input_bfd, relocation, local_sections)
+mips_elf_local_relocation_p (input_bfd, relocation, local_sections,
+ check_forced)
bfd *input_bfd;
const Elf_Internal_Rela *relocation;
asection **local_sections;
+ boolean check_forced;
{
unsigned long r_symndx;
Elf_Internal_Shdr *symtab_hdr;
+ struct mips_elf_link_hash_entry *h;
+ size_t extsymoff;
r_symndx = ELF32_R_SYM (relocation->r_info);
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
- if (! elf_bad_symtab (input_bfd))
- return r_symndx < symtab_hdr->sh_info;
- else
+ extsymoff = (elf_bad_symtab (input_bfd)) ? 0 : symtab_hdr->sh_info;
+
+ if (r_symndx < extsymoff)
+ return true;
+ if (elf_bad_symtab (input_bfd) && local_sections[r_symndx] != NULL)
+ return true;
+
+ if (check_forced)
{
- /* The symbol table does not follow the rule that local symbols
- must come before globals. */
- return local_sections[r_symndx] != NULL;
+ /* Look up the hash table to check whether the symbol
+ was forced local. */
+ h = (struct mips_elf_link_hash_entry *)
+ elf_sym_hashes (input_bfd) [r_symndx - extsymoff];
+ /* Find the real hash-table entry for this symbol. */
+ while (h->root.root.type == bfd_link_hash_indirect
+ || h->root.root.type == bfd_link_hash_warning)
+ h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link;
+ if ((h->root.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
+ return true;
}
+
+ return false;
}
/* Sign-extend VALUE, which has the indicated number of BITS. */
@@ -5178,10 +5926,10 @@ mips_elf_sign_extend (value, bits)
bfd_vma value;
int bits;
{
- if (value & ((bfd_vma)1 << (bits - 1)))
+ if (value & ((bfd_vma) 1 << (bits - 1)))
/* VALUE is negative. */
- value |= ((bfd_vma) - 1) << bits;
-
+ value |= ((bfd_vma) - 1) << bits;
+
return value;
}
@@ -5202,7 +5950,7 @@ mips_elf_overflow_p (value, bits)
else if (svalue < -(1 << (bits - 1)))
/* The value is too small. */
return true;
-
+
/* All is well. */
return false;
}
@@ -5232,7 +5980,7 @@ mips_elf_higher (value)
/* Calculate the %highest function. */
-static bfd_vma
+static bfd_vma
mips_elf_highest (value)
bfd_vma value ATTRIBUTE_UNUSED;
{
@@ -5246,7 +5994,7 @@ mips_elf_highest (value)
/* Returns the GOT index for the global symbol indicated by H. */
-static bfd_vma
+static bfd_vma
mips_elf_global_got_index (abfd, h)
bfd *abfd;
struct elf_link_hash_entry *h;
@@ -5262,7 +6010,7 @@ mips_elf_global_got_index (abfd, h)
indices into the GOT. That makes it easy to calculate the GOT
offset. */
BFD_ASSERT (h->dynindx >= g->global_gotsym->dynindx);
- index = ((h->dynindx - g->global_gotsym->dynindx + g->local_gotno)
+ index = ((h->dynindx - g->global_gotsym->dynindx + g->local_gotno)
* MIPS_ELF_GOT_SIZE (abfd));
BFD_ASSERT (index < sgot->_raw_size);
@@ -5283,7 +6031,7 @@ mips_elf_got_offset_from_index (dynobj, output_bfd, index)
sgot = mips_elf_got_section (dynobj);
gp = _bfd_get_gp_value (output_bfd);
- return (sgot->output_section->vma + sgot->output_offset + index -
+ return (sgot->output_section->vma + sgot->output_offset + index -
gp);
}
@@ -5302,22 +6050,23 @@ mips_elf_record_global_got_symbol (h, info, g)
if (h->dynindx == -1
&& !bfd_elf32_link_record_dynamic_symbol (info, h))
return false;
-
- /* If we've already marked this entry as need GOT space, we don't
+
+ /* If we've already marked this entry as needing GOT space, we don't
need to do it again. */
- if (h->got.offset != (bfd_vma) - 1)
+ if (h->got.offset != (bfd_vma) -1)
return true;
/* By setting this to a value other than -1, we are indicating that
- there needs to be a GOT entry for H. */
- h->got.offset = 0;
+ there needs to be a GOT entry for H. Avoid using zero, as the
+ generic ELF copy_indirect_symbol tests for <= 0. */
+ h->got.offset = 1;
return true;
}
/* This structure is passed to mips_elf_sort_hash_table_f when sorting
the dynamic symbols. */
-
+
struct mips_elf_hash_sort_data
{
/* The symbol in the global GOT with the lowest dynamic symbol table
@@ -5332,7 +6081,7 @@ struct mips_elf_hash_sort_data
};
/* If H needs a GOT entry, assign it the highest available dynamic
- index. Otherwise, assign it the lowest available dynamic
+ index. Otherwise, assign it the lowest available dynamic
index. */
static boolean
@@ -5340,15 +6089,18 @@ mips_elf_sort_hash_table_f (h, data)
struct mips_elf_link_hash_entry *h;
PTR data;
{
- struct mips_elf_hash_sort_data *hsd
+ struct mips_elf_hash_sort_data *hsd
= (struct mips_elf_hash_sort_data *) data;
+ if (h->root.root.type == bfd_link_hash_warning)
+ h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link;
+
/* Symbols without dynamic symbol table entries aren't interesting
at all. */
if (h->root.dynindx == -1)
return true;
- if (h->root.got.offset != 0)
+ if (h->root.got.offset != 1)
h->root.dynindx = hsd->max_non_got_dynindx++;
else
{
@@ -5380,14 +6132,14 @@ mips_elf_sort_hash_table (info, max_local)
hsd.low = NULL;
hsd.min_got_dynindx = elf_hash_table (info)->dynsymcount;
hsd.max_non_got_dynindx = max_local;
- mips_elf_link_hash_traverse (((struct mips_elf_link_hash_table *)
- elf_hash_table (info)),
- mips_elf_sort_hash_table_f,
+ mips_elf_link_hash_traverse (((struct mips_elf_link_hash_table *)
+ elf_hash_table (info)),
+ mips_elf_sort_hash_table_f,
&hsd);
- /* There shoud have been enough room in the symbol table to
+ /* There should have been enough room in the symbol table to
accomodate both the GOT and non-GOT symbols. */
- BFD_ASSERT (hsd.min_got_dynindx == hsd.max_non_got_dynindx);
+ BFD_ASSERT (hsd.max_non_got_dynindx <= hsd.min_got_dynindx);
/* Now we know which dynamic symbol has the lowest dynamic symbol
table index in the GOT. */
@@ -5417,7 +6169,7 @@ mips_elf_create_local_got_entry (abfd, g, sgot, value)
}
MIPS_ELF_PUT_WORD (abfd, value,
- (sgot->contents
+ (sgot->contents
+ MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno));
return MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno++;
}
@@ -5439,8 +6191,8 @@ mips_elf_local_got_index (abfd, info, value)
g = mips_elf_got_info (elf_hash_table (info)->dynobj, &sgot);
/* Look to see if we already have an appropriate entry. */
- for (entry = (sgot->contents
- + MIPS_ELF_GOT_SIZE (abfd) * MIPS_RESERVED_GOTNO);
+ for (entry = (sgot->contents
+ + MIPS_ELF_GOT_SIZE (abfd) * MIPS_RESERVED_GOTNO);
entry != sgot->contents + MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno;
entry += MIPS_ELF_GOT_SIZE (abfd))
{
@@ -5476,7 +6228,7 @@ mips_elf_got_page (abfd, info, value, offsetp)
/* Look to see if we aleady have an appropriate entry. */
last_entry = sgot->contents + MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno;
- for (entry = (sgot->contents
+ for (entry = (sgot->contents
+ MIPS_ELF_GOT_SIZE (abfd) * MIPS_RESERVED_GOTNO);
entry != last_entry;
entry += MIPS_ELF_GOT_SIZE (abfd))
@@ -5509,10 +6261,11 @@ mips_elf_got_page (abfd, info, value, offsetp)
for value. Return the index into the GOT for this entry. */
static bfd_vma
-mips_elf_got16_entry (abfd, info, value)
+mips_elf_got16_entry (abfd, info, value, external)
bfd *abfd;
struct bfd_link_info *info;
bfd_vma value;
+ boolean external;
{
asection *sgot;
struct mips_got_info *g;
@@ -5521,24 +6274,29 @@ mips_elf_got16_entry (abfd, info, value)
bfd_vma index = 0;
bfd_vma address;
- /* Although the ABI says that it is "the high-order 16 bits" that we
- want, it is really the %high value. The complete value is
- calculated with a `addiu' of a LO16 relocation, just as with a
- HI16/LO16 pair. */
- value = mips_elf_high (value) << 16;
+ if (! external)
+ {
+ /* Although the ABI says that it is "the high-order 16 bits" that we
+ want, it is really the %high value. The complete value is
+ calculated with a `addiu' of a LO16 relocation, just as with a
+ HI16/LO16 pair. */
+ value = mips_elf_high (value) << 16;
+ }
+
g = mips_elf_got_info (elf_hash_table (info)->dynobj, &sgot);
/* Look to see if we already have an appropriate entry. */
last_entry = sgot->contents + MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno;
- for (entry = (sgot->contents
+ for (entry = (sgot->contents
+ MIPS_ELF_GOT_SIZE (abfd) * MIPS_RESERVED_GOTNO);
entry != last_entry;
entry += MIPS_ELF_GOT_SIZE (abfd))
{
address = MIPS_ELF_GET_WORD (abfd, entry);
- if ((address & 0xffff0000) == value)
+ if (address == value)
{
- /* This entry has the right high-order 16 bits. */
+ /* This entry has the right high-order 16 bits, and the low-order
+ 16 bits are set to zero. */
index = entry - sgot->contents;
break;
}
@@ -5581,7 +6339,7 @@ mips_elf_next_relocation (r_type, relocation, relend)
/* Create a rel.dyn relocation for the dynamic linker to resolve. REL
is the original relocation, which is now being transformed into a
- dyanmic relocation. The ADDENDP is adjusted if necessary; the
+ dynamic relocation. The ADDENDP is adjusted if necessary; the
caller should store the result in place of the original addend. */
static boolean
@@ -5604,37 +6362,24 @@ mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec,
r_type = ELF32_R_TYPE (rel->r_info);
dynobj = elf_hash_table (info)->dynobj;
- sreloc
+ sreloc
= bfd_get_section_by_name (dynobj,
MIPS_ELF_REL_DYN_SECTION_NAME (output_bfd));
BFD_ASSERT (sreloc != NULL);
+ BFD_ASSERT (sreloc->contents != NULL);
+ BFD_ASSERT (sreloc->reloc_count * MIPS_ELF_REL_SIZE (output_bfd)
+ < sreloc->_raw_size);
skip = false;
-
- /* We begin by assuming that the offset for the dynamic relocation
- is the same as for the original relocation. We'll adjust this
- later to reflect the correct output offsets. */
- if (elf_section_data (input_section)->stab_info == NULL)
- outrel.r_offset = rel->r_offset;
- else
- {
- /* Except that in a stab section things are more complex.
- Because we compress stab information, the offset given in the
- relocation may not be the one we want; we must let the stabs
- machinery tell us the offset. */
- outrel.r_offset
- = (_bfd_stab_section_offset
- (output_bfd, &elf_hash_table (info)->stab_info,
- input_section,
- &elf_section_data (input_section)->stab_info,
- rel->r_offset));
- /* If we didn't need the relocation at all, this value will be
- -1. */
- if (outrel.r_offset == (bfd_vma) -1)
- skip = true;
- }
-
- /* If we've decided to skip this relocation, just output an emtpy
+ outrel.r_offset =
+ _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
is a way of setting R_TYPE to R_MIPS_NONE. */
if (skip)
@@ -5651,7 +6396,10 @@ mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec,
& ELF_LINK_HASH_DEF_REGULAR) == 0))
{
indx = h->root.dynindx;
- BFD_ASSERT (indx != -1);
+ /* h->root.dynindx may be -1 if this symbol was marked to
+ become local. */
+ if (indx == -1)
+ indx = 0;
}
else
{
@@ -5675,15 +6423,16 @@ mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec,
/* The relocation we're building is section-relative.
Therefore, the original addend must be adjusted by the
section offset. */
- *addendp += symbol - sec->output_section->vma;
+ *addendp += section_offset;
/* Now, the relocation is just against the section. */
symbol = sec->output_section->vma;
}
-
- /* If the relocation was previously an absolute relocation, we
- must adjust it by the value we give it in the dynamic symbol
- table. */
- if (r_type != R_MIPS_REL32)
+
+ /* If the relocation was previously an absolute relocation and
+ this symbol will not be referred to by the relocation, we must
+ adjust it by the value we give it in the dynamic symbol table.
+ Otherwise leave the job up to the dynamic linker. */
+ if (!indx && r_type != R_MIPS_REL32)
*addendp += symbol;
/* The relocation is always an REL32 relocation because we don't
@@ -5703,7 +6452,7 @@ mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec,
{
(*get_elf_backend_data (output_bfd)->s->swap_reloc_out)
(output_bfd, &outrel,
- (sreloc->contents
+ (sreloc->contents
+ sreloc->reloc_count * sizeof (Elf64_Mips_External_Rel)));
}
else
@@ -5715,7 +6464,7 @@ mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec,
/* Record the index of the first relocation referencing H. This
information is later emitted in the .msym section. */
if (h != NULL
- && (h->min_dyn_reloc_index == 0
+ && (h->min_dyn_reloc_index == 0
|| sreloc->reloc_count < h->min_dyn_reloc_index))
h->min_dyn_reloc_index = sreloc->reloc_count;
@@ -5730,7 +6479,7 @@ mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec,
/* On IRIX5, make an entry of compact relocation info. */
if (! skip && IRIX_COMPAT (output_bfd) == ict_irix5)
{
- asection* scpt = bfd_get_section_by_name (dynobj, ".compact_rel");
+ asection *scpt = bfd_get_section_by_name (dynobj, ".compact_rel");
bfd_byte *cr;
if (scpt)
@@ -5774,7 +6523,7 @@ mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec,
overflow occurs, and bfd_reloc_ok to indicate success. */
static bfd_reloc_status_type
-mips_elf_calculate_relocation (abfd,
+mips_elf_calculate_relocation (abfd,
input_bfd,
input_section,
info,
@@ -5785,7 +6534,7 @@ mips_elf_calculate_relocation (abfd,
local_sections,
valuep,
namep,
- require_jalxp)
+ require_jalxp)
bfd *abfd;
bfd *input_bfd;
asection *input_section;
@@ -5819,7 +6568,7 @@ mips_elf_calculate_relocation (abfd,
/* The section in which the symbol referenced by the relocation is
located. */
asection *sec = NULL;
- struct mips_elf_link_hash_entry* h = NULL;
+ struct mips_elf_link_hash_entry *h = NULL;
/* True if the symbol referred to by this relocation is a local
symbol. */
boolean local_p;
@@ -5838,7 +6587,7 @@ mips_elf_calculate_relocation (abfd,
/* Parse the relocation. */
r_symndx = ELF32_R_SYM (relocation->r_info);
r_type = ELF32_R_TYPE (relocation->r_info);
- p = (input_section->output_section->vma
+ p = (input_section->output_section->vma
+ input_section->output_offset
+ relocation->r_offset);
@@ -5849,7 +6598,7 @@ mips_elf_calculate_relocation (abfd,
used in the array of hash table entries. */
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
local_p = mips_elf_local_relocation_p (input_bfd, relocation,
- local_sections);
+ local_sections, false);
if (! elf_bad_symtab (input_bfd))
extsymoff = symtab_hdr->sh_info;
else
@@ -5858,7 +6607,7 @@ mips_elf_calculate_relocation (abfd,
must come before globals. */
extsymoff = 0;
}
-
+
/* Figure out the value of the symbol. */
if (local_p)
{
@@ -5887,13 +6636,13 @@ mips_elf_calculate_relocation (abfd,
else
{
/* For global symbols we look up the symbol in the hash-table. */
- h = ((struct mips_elf_link_hash_entry *)
+ h = ((struct mips_elf_link_hash_entry *)
elf_sym_hashes (input_bfd) [r_symndx - extsymoff]);
/* Find the real hash-table entry for this symbol. */
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
+ while (h->root.root.type == bfd_link_hash_indirect
+ || h->root.root.type == bfd_link_hash_warning)
h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link;
-
+
/* Record the name of this symbol, for our caller. */
*namep = h->root.root.root.string;
@@ -5918,7 +6667,7 @@ mips_elf_calculate_relocation (abfd,
{
sec = h->root.root.u.def.section;
if (sec->output_section)
- symbol = (h->root.root.u.def.value
+ symbol = (h->root.root.u.def.value
+ sec->output_section->vma
+ sec->output_offset);
else
@@ -5930,13 +6679,17 @@ mips_elf_calculate_relocation (abfd,
and check to see if they exist by looking at their
addresses. */
symbol = 0;
- else if (info->shared && !info->symbolic && !info->no_undefined
+ else if (info->shared
+ && (!info->symbolic || info->allow_shlib_undefined)
+ && !info->no_undefined
&& ELF_ST_VISIBILITY (h->root.other) == STV_DEFAULT)
symbol = 0;
- else if (strcmp (h->root.root.root.string, "_DYNAMIC_LINK") == 0)
+ else if (strcmp (h->root.root.root.string, "_DYNAMIC_LINK") == 0 ||
+ strcmp (h->root.root.root.string, "_DYNAMIC_LINKING") == 0)
{
/* If this is a dynamic link, we should have created a
- _DYNAMIC_LINK symbol in mips_elf_create_dynamic_sections.
+ _DYNAMIC_LINK symbol or _DYNAMIC_LINKING(for normal mips) symbol
+ in in mips_elf_create_dynamic_sections.
Otherwise, we should define the symbol with a value of 0.
FIXME: It should probably get into the symbol table
somehow as well. */
@@ -5957,7 +6710,7 @@ mips_elf_calculate_relocation (abfd,
target_is_16_bit_code_p = (h->root.other == STO_MIPS16);
}
-
+
/* If this is a 32-bit call to a 16-bit function with a stub, we
need to redirect the call to the stub, unless we're already *in*
a stub. */
@@ -5983,7 +6736,7 @@ mips_elf_calculate_relocation (abfd,
/* If this is a 16-bit call to a 32-bit function with a stub, we
need to redirect the call to the stub. */
else if (r_type == R_MIPS16_26 && !info->relocateable
- && h != NULL
+ && h != NULL
&& (h->call_stub != NULL || h->call_fp_stub != NULL)
&& !target_is_16_bit_code_p)
{
@@ -6019,7 +6772,11 @@ mips_elf_calculate_relocation (abfd,
/* Calls from 16-bit code to 32-bit code and vice versa require the
special jalx instruction. */
*require_jalxp = (!info->relocateable
- && ((r_type == R_MIPS16_26) != target_is_16_bit_code_p));
+ && (((r_type == R_MIPS16_26) && !target_is_16_bit_code_p)
+ || ((r_type == R_MIPS_26) && target_is_16_bit_code_p)));
+
+ local_p = mips_elf_local_relocation_p (input_bfd, relocation,
+ local_sections, true);
/* If we haven't already determined the GOT offset, or the GP value,
and we're going to need it, get it now. */
@@ -6036,11 +6793,24 @@ mips_elf_calculate_relocation (abfd,
if (!local_p)
{
BFD_ASSERT (addend == 0);
- g = mips_elf_global_got_index
+ g = mips_elf_global_got_index
(elf_hash_table (info)->dynobj,
- (struct elf_link_hash_entry*) h);
+ (struct elf_link_hash_entry *) h);
+ if (! elf_hash_table(info)->dynamic_sections_created
+ || (info->shared
+ && (info->symbolic || h->root.dynindx == -1)
+ && (h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
+ {
+ /* This is a static link or a -Bsymbolic link. The
+ symbol is defined locally, or was forced to be local.
+ We must initialize this entry in the GOT. */
+ asection *sgot = mips_elf_got_section(elf_hash_table
+ (info)->dynobj);
+ MIPS_ELF_PUT_WORD (elf_hash_table (info)->dynobj,
+ symbol + addend, sgot->contents + g);
+ }
}
- else if (r_type == R_MIPS_GOT16)
+ else if (r_type == R_MIPS_GOT16 || r_type == R_MIPS_CALL16)
/* There's no need to create a local GOT entry here; the
calculation for a local GOT16 entry does not involve G. */
break;
@@ -6048,16 +6818,17 @@ mips_elf_calculate_relocation (abfd,
{
g = mips_elf_local_got_index (abfd, info, symbol + addend);
if (g == (bfd_vma) -1)
- return false;
+ return bfd_reloc_outofrange;
}
/* Convert GOT indices to actual offsets. */
g = mips_elf_got_offset_from_index (elf_hash_table (info)->dynobj,
abfd, g);
break;
-
+
case R_MIPS_HI16:
case R_MIPS_LO16:
+ case R_MIPS16_GPREL:
case R_MIPS_GPREL16:
case R_MIPS_GPREL32:
case R_MIPS_LITERAL:
@@ -6086,8 +6857,11 @@ mips_elf_calculate_relocation (abfd,
if ((info->shared
|| (elf_hash_table (info)->dynamic_sections_created
&& h != NULL
- && ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)
- == 0)))
+ && ((h->root.elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_DYNAMIC) != 0)
+ && ((h->root.elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0)))
+ && r_symndx != 0
&& (input_section->flags & SEC_ALLOC) != 0)
{
/* If we're creating a shared library, or this relocation is
@@ -6096,15 +6870,15 @@ mips_elf_calculate_relocation (abfd,
record in the output, and leave the job up to the dynamic
linker. */
value = addend;
- if (!mips_elf_create_dynamic_relocation (abfd,
- info,
+ if (!mips_elf_create_dynamic_relocation (abfd,
+ info,
relocation,
h,
sec,
symbol,
&value,
input_section))
- return false;
+ return bfd_reloc_undefined;
}
else
{
@@ -6130,19 +6904,24 @@ mips_elf_calculate_relocation (abfd,
break;
case R_MIPS_GNU_REL_HI16:
+ /* Instead of subtracting 'p' here, we should be subtracting the
+ equivalent value for the LO part of the reloc, since the value
+ here is relative to that address. Because that's not easy to do,
+ we adjust 'addend' in _bfd_mips_elf_relocate_section(). See also
+ the comment there for more information. */
value = mips_elf_high (addend + symbol - p);
value &= howto->dst_mask;
break;
case R_MIPS16_26:
- /* The calculation for R_MIPS_26 is just the same as for an
+ /* The calculation for R_MIPS16_26 is just the same as for an
R_MIPS_26. It's only the storage of the relocated field into
the output file that's different. That's handled in
mips_elf_perform_relocation. So, we just fall through to the
R_MIPS_26 case here. */
case R_MIPS_26:
if (local_p)
- value = (((addend << 2) | (p & 0xf0000000)) + symbol) >> 2;
+ value = (((addend << 2) | ((p + 4) & 0xf0000000)) + symbol) >> 2;
else
value = (mips_elf_sign_extend (addend << 2, 28) + symbol) >> 2;
value &= howto->dst_mask;
@@ -6206,14 +6985,22 @@ mips_elf_calculate_relocation (abfd,
value = mips_elf_sign_extend (addend, 16) + symbol - gp;
overflowed_p = mips_elf_overflow_p (value, 16);
break;
-
+
case R_MIPS_GOT16:
+ case R_MIPS_CALL16:
if (local_p)
{
- value = mips_elf_got16_entry (abfd, info, symbol + addend);
+ boolean forced;
+
+ /* The special case is when the symbol is forced to be local. We
+ need the full address in the GOT since no R_MIPS_LO16 relocation
+ follows. */
+ forced = ! mips_elf_local_relocation_p (input_bfd, relocation,
+ local_sections, false);
+ value = mips_elf_got16_entry (abfd, info, symbol + addend, forced);
if (value == (bfd_vma) -1)
- return false;
- value
+ return bfd_reloc_outofrange;
+ value
= mips_elf_got_offset_from_index (elf_hash_table (info)->dynobj,
abfd,
value);
@@ -6223,7 +7010,6 @@ mips_elf_calculate_relocation (abfd,
/* Fall through. */
- case R_MIPS_CALL16:
case R_MIPS_GOT_DISP:
value = g;
overflowed_p = mips_elf_overflow_p (value, 16);
@@ -6235,8 +7021,8 @@ mips_elf_calculate_relocation (abfd,
case R_MIPS_PC16:
value = mips_elf_sign_extend (addend, 16) + symbol - p;
- value = (bfd_vma) ((bfd_signed_vma) value / 4);
overflowed_p = mips_elf_overflow_p (value, 16);
+ value = (bfd_vma) ((bfd_signed_vma) value / 4);
break;
case R_MIPS_GOT_HI16:
@@ -6257,13 +7043,13 @@ mips_elf_calculate_relocation (abfd,
case R_MIPS_GOT_PAGE:
value = mips_elf_got_page (abfd, info, symbol + addend, NULL);
if (value == (bfd_vma) -1)
- return false;
+ return bfd_reloc_outofrange;
value = mips_elf_got_offset_from_index (elf_hash_table (info)->dynobj,
abfd,
value);
overflowed_p = mips_elf_overflow_p (value, 16);
break;
-
+
case R_MIPS_GOT_OFST:
mips_elf_got_page (abfd, info, symbol + addend, &value);
overflowed_p = mips_elf_overflow_p (value, 16);
@@ -6283,7 +7069,7 @@ mips_elf_calculate_relocation (abfd,
value = mips_elf_highest (addend + symbol);
value &= howto->dst_mask;
break;
-
+
case R_MIPS_SCN_DISP:
value = symbol + addend - sec->output_offset;
value &= howto->dst_mask;
@@ -6323,7 +7109,7 @@ mips_elf_obtain_contents (howto, relocation, input_bfd, contents)
bfd_byte *location = contents + relocation->r_offset;
/* Obtain the bytes. */
- x = bfd_get (8 * bfd_get_reloc_size (howto), input_bfd, location);
+ x = bfd_get (((bfd_vma)(8 * bfd_get_reloc_size (howto))), input_bfd, location);
if ((ELF32_R_TYPE (relocation->r_info) == R_MIPS16_26
|| ELF32_R_TYPE (relocation->r_info) == R_MIPS16_GPREL)
@@ -6346,7 +7132,7 @@ mips_elf_obtain_contents (howto, relocation, input_bfd, contents)
static boolean
mips_elf_perform_relocation (info, howto, relocation, value,
- input_bfd, input_section,
+ input_bfd, input_section,
contents, require_jalx)
struct bfd_link_info *info;
reloc_howto_type *howto;
@@ -6385,7 +7171,7 @@ mips_elf_perform_relocation (info, howto, relocation, value,
+--------------+--------------------------------+
! Immediate 15:0 !
+-----------------------------------------------+
-
+
JALX is the 5-bit value 00011. X is 0 for jal, 1 for jalx.
Note that the immediate value in the first word is swapped.
@@ -6410,14 +7196,14 @@ mips_elf_perform_relocation (info, howto, relocation, value,
To put it in MIPS ABI terms, the relocation field is T-targ26-16,
defined as
-
+
big-endian:
+--------+----------------------+
| | |
| | targ26-16 |
|31 26|25 0|
+--------+----------------------+
-
+
little-endian:
+----------+------+-------------+
| | | |
@@ -6426,19 +7212,18 @@ mips_elf_perform_relocation (info, howto, relocation, value,
+----------+--------------------+
where targ26-16 is sub1 followed by sub2 (i.e., the addend field A is
((sub1 << 16) | sub2)).
-
+
When producing a relocateable object file, the calculation is
- (((A < 2) | (P & 0xf0000000) + S) >> 2)
+ (((A < 2) | ((P + 4) & 0xf0000000) + S) >> 2)
When producing a fully linked file, the calculation is
- let R = (((A < 2) | (P & 0xf0000000) + S) >> 2)
+ let R = (((A < 2) | ((P + 4) & 0xf0000000) + S) >> 2)
((R & 0x1f0000) << 5) | ((R & 0x3e00000) >> 5) | (R & 0xffff) */
if (!info->relocateable)
/* Shuffle the bits according to the formula above. */
- value = (((value & 0x1f0000) << 5)
- | ((value & 0x3e00000) >> 5)
+ value = (((value & 0x1f0000) << 5)
+ | ((value & 0x3e00000) >> 5)
| (value & 0xffff));
-
}
else if (r_type == R_MIPS16_GPREL)
{
@@ -6450,13 +7235,13 @@ mips_elf_perform_relocation (info, howto, relocation, value,
+--------------+--------------------------------+
! Major ! rx ! ry ! Imm 4:0 !
+--------------+--------------------------------+
-
+
EXTEND is the five bit value 11110. Major is the instruction
opcode.
-
+
This is handled exactly like R_MIPS_GPREL16, except that the
addend is retrieved and stored as shown in this diagram; that
- is, the Imm fields above replace the V-rel16 field.
+ is, the Imm fields above replace the V-rel16 field.
All we need to do here is shuffle the bits appropriately. As
above, the two 16-bit halves must be swapped on a
@@ -6493,7 +7278,7 @@ mips_elf_perform_relocation (info, howto, relocation, value,
{
(*_bfd_error_handler)
(_("%s: %s+0x%lx: jump to stub routine which is not jal"),
- bfd_get_filename (input_bfd),
+ bfd_archive_filename (input_bfd),
input_section->name,
(unsigned long) relocation->r_offset);
bfd_set_error (bfd_error_bad_value);
@@ -6509,7 +7294,7 @@ mips_elf_perform_relocation (info, howto, relocation, value,
if ((r_type == R_MIPS16_GPREL || r_type == R_MIPS16_26)
&& bfd_little_endian (input_bfd))
x = (((x & 0xffff) << 16) | ((x & 0xffff0000) >> 16));
-
+
/* Put the value into the output. */
bfd_put (8 * bfd_get_reloc_size (howto), input_bfd, x, location);
return true;
@@ -6560,23 +7345,24 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
/* True if the relocation is a RELA relocation, rather than a
REL relocation. */
boolean rela_relocation_p = true;
- int r_type = ELF32_R_TYPE (rel->r_info);
+ unsigned int r_type = ELF32_R_TYPE (rel->r_info);
+ const char * msg = (const char *) NULL;
/* Find the relocation howto for this relocation. */
if (r_type == R_MIPS_64 && !ABI_64_P (output_bfd))
{
/* Some 32-bit code uses R_MIPS_64. In particular, people use
- 64-bit code, but make sure all their addresses are in the
+ 64-bit code, but make sure all their addresses are in the
lowermost or uppermost 32-bit section of the 64-bit address
space. Thus, when they use an R_MIPS_64 they mean what is
usually meant by R_MIPS_32, with the exception that the
stored value is sign-extended to 64 bits. */
- howto = elf_mips_howto_table + R_MIPS_32;
+ howto = elf_mips_howto_table_rel + R_MIPS_32;
/* On big-endian systems, we need to lie about the position
of the reloc. */
if (bfd_big_endian (input_bfd))
- rel->r_offset += 4;
+ rel->r_offset += 4;
}
else
howto = mips_rtype_to_howto (r_type);
@@ -6593,8 +7379,7 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
REL_HDR is read before its REL_HDR2. */
rel_hdr = &elf_section_data (input_section)->rel_hdr;
if ((size_t) (rel - relocs)
- >= (rel_hdr->sh_size / rel_hdr->sh_entsize
- * bed->s->int_rels_per_ext_rel))
+ >= (NUM_SHDR_ENTRIES (rel_hdr) * bed->s->int_rels_per_ext_rel))
rel_hdr = elf_section_data (input_section)->rel_hdr2;
if (rel_hdr->sh_entsize == MIPS_ELF_REL_SIZE (input_bfd))
{
@@ -6602,7 +7387,7 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
rela_relocation_p = false;
/* Get the addend, which is stored in the input file. */
- addend = mips_elf_obtain_contents (howto,
+ addend = mips_elf_obtain_contents (howto,
rel,
input_bfd,
contents);
@@ -6615,26 +7400,26 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
|| r_type == R_MIPS_GNU_REL_HI16
|| (r_type == R_MIPS_GOT16
&& mips_elf_local_relocation_p (input_bfd, rel,
- local_sections)))
+ local_sections, false)))
{
bfd_vma l;
const Elf_Internal_Rela *lo16_relocation;
reloc_howto_type *lo16_howto;
- int lo;
+ unsigned int lo;
/* The combined value is the sum of the HI16 addend,
left-shifted by sixteen bits, and the LO16
addend, sign extended. (Usually, the code does
a `lui' of the HI16 value, and then an `addiu' of
- the LO16 value.)
+ the LO16 value.)
Scan ahead to find a matching LO16 relocation. */
if (r_type == R_MIPS_GNU_REL_HI16)
lo = R_MIPS_GNU_REL_LO16;
else
lo = R_MIPS_LO16;
- lo16_relocation
- = mips_elf_next_relocation (lo, rel, relend);
+ lo16_relocation
+ = mips_elf_next_relocation (lo, rel, relend);
if (lo16_relocation == NULL)
return false;
@@ -6650,6 +7435,16 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
/* Compute the combined addend. */
addend += l;
+
+ /* If PC-relative, subtract the difference between the
+ address of the LO part of the reloc and the address of
+ the HI part. The relocation is relative to the LO
+ part, but mips_elf_calculate_relocation() doesn't know
+ it address or the difference from the HI part, so
+ we subtract that difference here. See also the
+ comment in mips_elf_calculate_relocation(). */
+ if (r_type == R_MIPS_GNU_REL_HI16)
+ addend -= (lo16_relocation->r_offset - rel->r_offset);
}
else if (r_type == R_MIPS16_GPREL)
{
@@ -6681,11 +7476,12 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
relative in which case we need to adjust by the amount
that we're adjusting GP in this relocateable object. */
- if (!mips_elf_local_relocation_p (input_bfd, rel, local_sections))
+ if (!mips_elf_local_relocation_p (input_bfd, rel, local_sections,
+ false))
/* There's nothing to do for non-local relocations. */
continue;
- if (r_type == R_MIPS16_GPREL
+ if (r_type == R_MIPS16_GPREL
|| r_type == R_MIPS_GPREL16
|| r_type == R_MIPS_GPREL32
|| r_type == R_MIPS_LITERAL)
@@ -6704,7 +7500,7 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
/* Adjust the addend appropriately. */
addend += local_sections[r_symndx]->output_offset;
-
+
/* If the relocation is for a R_MIPS_HI16 or R_MIPS_GOT16,
then we only want to write out the high-order 16 bits.
The subsequent R_MIPS_LO16 will handle the low-order bits. */
@@ -6740,12 +7536,16 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
bfd_vma sign_bits;
bfd_vma low_bits;
bfd_vma high_bits;
-
- if (addend & 0x80000000u)
- sign_bits = 0xffffffffu;
+
+ if (addend & ((bfd_vma) 1 << 31))
+#ifdef BFD64
+ sign_bits = ((bfd_vma) 1 << 32) - 1;
+#else
+ sign_bits = -1;
+#endif
else
sign_bits = 0;
-
+
/* If we don't know that we have a 64-bit type,
do two separate stores. */
if (bfd_big_endian (input_bfd))
@@ -6760,15 +7560,15 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
low_bits = addend;
high_bits = sign_bits;
}
- bfd_put_32 (input_bfd, low_bits,
+ bfd_put_32 (input_bfd, low_bits,
contents + rel->r_offset);
- bfd_put_32 (input_bfd, high_bits,
+ bfd_put_32 (input_bfd, high_bits,
contents + rel->r_offset + 4);
continue;
}
if (!mips_elf_perform_relocation (info, howto, rel, addend,
- input_bfd, input_section,
+ input_bfd, input_section,
contents, false))
return false;
}
@@ -6781,7 +7581,7 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
relocations for the same offset. In that case we are
supposed to treat the output of each relocation as the addend
for the next. */
- if (rel + 1 < relend
+ if (rel + 1 < relend
&& rel->r_offset == rel[1].r_offset
&& ELF32_R_TYPE (rel[1].r_info) != R_MIPS_NONE)
use_saved_addend_p = true;
@@ -6789,7 +7589,7 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
use_saved_addend_p = false;
/* Figure out what value we are supposed to relocate. */
- switch (mips_elf_calculate_relocation (output_bfd,
+ switch (mips_elf_calculate_relocation (output_bfd,
input_bfd,
input_section,
info,
@@ -6814,8 +7614,10 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
continue;
case bfd_reloc_notsupported:
- abort ();
- break;
+ msg = _("internal error: unsupported relocation error");
+ info->callbacks->warning
+ (info, msg, name, input_bfd, input_section, rel->r_offset);
+ return false;
case bfd_reloc_overflow:
if (use_saved_addend_p)
@@ -6861,8 +7663,12 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
bfd_vma low_bits;
bfd_vma high_bits;
- if (value & 0x80000000u)
- sign_bits = 0xffffffffu;
+ if (value & ((bfd_vma) 1 << 31))
+#ifdef BFD64
+ sign_bits = ((bfd_vma) 1 << 32) - 1;
+#else
+ sign_bits = -1;
+#endif
else
sign_bits = 0;
@@ -6882,15 +7688,15 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
low_bits = value;
high_bits = sign_bits;
}
- bfd_put_32 (input_bfd, low_bits,
+ bfd_put_32 (input_bfd, low_bits,
contents + rel->r_offset);
- bfd_put_32 (input_bfd, high_bits,
+ bfd_put_32 (input_bfd, high_bits,
contents + rel->r_offset + 4);
continue;
}
/* Actually perform the relocation. */
- if (!mips_elf_perform_relocation (info, howto, rel, value, input_bfd,
+ if (!mips_elf_perform_relocation (info, howto, rel, value, input_bfd,
input_section, contents,
require_jalx))
return false;
@@ -6903,7 +7709,6 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
symbol. We mark symbols as small common if appropriate. This is
also where we undo the increment of the value for a mips16 symbol. */
-/*ARGSIGNORED*/
boolean
_bfd_mips_elf_link_output_symbol_hook (abfd, info, name, sym, input_sec)
bfd *abfd ATTRIBUTE_UNUSED;
@@ -6969,9 +7774,9 @@ _bfd_mips_elf_create_dynamic_sections (abfd, info)
if (IRIX_COMPAT (abfd) == ict_irix6
&& !mips_elf_create_msym_section (abfd))
return false;
-
+
/* Create .stub section. */
- if (bfd_get_section_by_name (abfd,
+ if (bfd_get_section_by_name (abfd,
MIPS_ELF_STUB_SECTION_NAME (abfd)) == NULL)
{
s = bfd_make_section (abfd, MIPS_ELF_STUB_SECTION_NAME (abfd));
@@ -6982,13 +7787,13 @@ _bfd_mips_elf_create_dynamic_sections (abfd, info)
return false;
}
- if (IRIX_COMPAT (abfd) == ict_irix5
+ if ((IRIX_COMPAT (abfd) == ict_irix5 || IRIX_COMPAT (abfd) == ict_none)
&& !info->shared
&& bfd_get_section_by_name (abfd, ".rld_map") == NULL)
{
s = bfd_make_section (abfd, ".rld_map");
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags & ~SEC_READONLY)
+ || ! bfd_set_section_flags (abfd, s, flags &~ (flagword) SEC_READONLY)
|| ! bfd_set_section_alignment (abfd, s,
MIPS_ELF_LOG_FILE_ALIGN (abfd)))
return false;
@@ -7009,7 +7814,7 @@ _bfd_mips_elf_create_dynamic_sections (abfd, info)
get_elf_backend_data (abfd)->collect,
(struct bfd_link_hash_entry **) &h)))
return false;
- h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF;
+ h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF;
h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
h->type = STT_SECTION;
@@ -7018,8 +7823,11 @@ _bfd_mips_elf_create_dynamic_sections (abfd, info)
}
/* We need to create a .compact_rel section. */
- if (! mips_elf_create_compact_rel_section (abfd, info))
- return false;
+ if (SGI_COMPAT (abfd))
+ {
+ if (!mips_elf_create_compact_rel_section (abfd, info))
+ return false;
+ }
/* Change aligments of some sections. */
s = bfd_get_section_by_name (abfd, ".hash");
@@ -7042,13 +7850,26 @@ _bfd_mips_elf_create_dynamic_sections (abfd, info)
if (!info->shared)
{
h = NULL;
- if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, "_DYNAMIC_LINK", BSF_GLOBAL, bfd_abs_section_ptr,
- (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_NON_ELF;
+ if (SGI_COMPAT (abfd))
+ {
+ if (!(_bfd_generic_link_add_one_symbol
+ (info, abfd, "_DYNAMIC_LINK", BSF_GLOBAL, bfd_abs_section_ptr,
+ (bfd_vma) 0, (const char *) NULL, false,
+ get_elf_backend_data (abfd)->collect,
+ (struct bfd_link_hash_entry **) &h)))
+ return false;
+ }
+ else
+ {
+ /* For normal mips it is _DYNAMIC_LINKING. */
+ if (!(_bfd_generic_link_add_one_symbol
+ (info, abfd, "_DYNAMIC_LINKING", BSF_GLOBAL,
+ bfd_abs_section_ptr, (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_NON_ELF;
h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
h->type = STT_SECTION;
@@ -7065,13 +7886,26 @@ _bfd_mips_elf_create_dynamic_sections (abfd, info)
BFD_ASSERT (s != NULL);
h = NULL;
- if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, "__rld_map", 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_NON_ELF;
+ if (SGI_COMPAT (abfd))
+ {
+ if (!(_bfd_generic_link_add_one_symbol
+ (info, abfd, "__rld_map", BSF_GLOBAL, s,
+ (bfd_vma) 0, (const char *) NULL, false,
+ get_elf_backend_data (abfd)->collect,
+ (struct bfd_link_hash_entry **) &h)))
+ return false;
+ }
+ else
+ {
+ /* For normal mips the symbol is __RLD_MAP. */
+ if (!(_bfd_generic_link_add_one_symbol
+ (info, abfd, "__RLD_MAP", 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_NON_ELF;
h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
h->type = STT_OBJECT;
@@ -7111,7 +7945,7 @@ mips_elf_create_compact_rel_section (abfd, info)
return true;
}
-/* Create the .got section to hold the global offset table. */
+/* Create the .got section to hold the global offset table. */
static boolean
mips_elf_create_got_section (abfd, info)
@@ -7122,6 +7956,7 @@ mips_elf_create_got_section (abfd, info)
register asection *s;
struct elf_link_hash_entry *h;
struct mips_got_info *g;
+ bfd_size_type amt;
/* This function may be called more than once. */
if (mips_elf_got_section (abfd))
@@ -7146,7 +7981,7 @@ mips_elf_create_got_section (abfd, info)
get_elf_backend_data (abfd)->collect,
(struct bfd_link_hash_entry **) &h)))
return false;
- h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF;
+ h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF;
h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
h->type = STT_OBJECT;
@@ -7157,8 +7992,8 @@ mips_elf_create_got_section (abfd, info)
/* The first several global offset table entries are reserved. */
s->_raw_size = MIPS_RESERVED_GOTNO * MIPS_ELF_GOT_SIZE (abfd);
- g = (struct mips_got_info *) bfd_alloc (abfd,
- sizeof (struct mips_got_info));
+ amt = sizeof (struct mips_got_info);
+ g = (struct mips_got_info *) bfd_alloc (abfd, amt);
if (g == NULL)
return false;
g->global_gotsym = NULL;
@@ -7166,13 +8001,13 @@ mips_elf_create_got_section (abfd, info)
g->assigned_gotno = MIPS_RESERVED_GOTNO;
if (elf_section_data (s) == NULL)
{
- s->used_by_bfd =
- (PTR) bfd_zalloc (abfd, sizeof (struct bfd_elf_section_data));
+ amt = sizeof (struct bfd_elf_section_data);
+ s->used_by_bfd = (PTR) bfd_zalloc (abfd, amt);
if (elf_section_data (s) == NULL)
return false;
}
elf_section_data (s)->tdata = (PTR) g;
- elf_section_data (s)->this_hdr.sh_flags
+ elf_section_data (s)->this_hdr.sh_flags
|= SHF_ALLOC | SHF_WRITE | SHF_MIPS_GPREL;
return true;
@@ -7188,15 +8023,15 @@ mips_elf_create_msym_section (abfd)
asection *s;
s = bfd_get_section_by_name (abfd, MIPS_ELF_MSYM_SECTION_NAME (abfd));
- if (!s)
+ if (!s)
{
s = bfd_make_section (abfd, MIPS_ELF_MSYM_SECTION_NAME (abfd));
if (!s
- || !bfd_set_section_flags (abfd, s,
+ || !bfd_set_section_flags (abfd, s,
SEC_ALLOC
| SEC_LOAD
| SEC_HAS_CONTENTS
- | SEC_LINKER_CREATED
+ | SEC_LINKER_CREATED
| SEC_READONLY)
|| !bfd_set_section_alignment (abfd, s,
MIPS_ELF_LOG_FILE_ALIGN (abfd)))
@@ -7217,10 +8052,10 @@ mips_elf_allocate_dynamic_relocations (abfd, n)
s = bfd_get_section_by_name (abfd, MIPS_ELF_REL_DYN_SECTION_NAME (abfd));
BFD_ASSERT (s != NULL);
-
+
if (s->_raw_size == 0)
{
- /* Make room for a null element. */
+ /* Make room for a null element. */
s->_raw_size += MIPS_ELF_REL_SIZE (abfd);
++s->reloc_count;
}
@@ -7325,18 +8160,19 @@ _bfd_mips_elf_check_relocs (abfd, info, sec, relocs)
}
/* Record this stub in an array of local symbol stubs for
- this BFD. */
+ this BFD. */
if (elf_tdata (abfd)->local_stubs == NULL)
{
unsigned long symcount;
asection **n;
+ bfd_size_type amt;
if (elf_bad_symtab (abfd))
- symcount = symtab_hdr->sh_size / symtab_hdr->sh_entsize;
+ symcount = NUM_SHDR_ENTRIES (symtab_hdr);
else
symcount = symtab_hdr->sh_info;
- n = (asection **) bfd_zalloc (abfd,
- symcount * sizeof (asection *));
+ amt = symcount * sizeof (asection *);
+ n = (asection **) bfd_zalloc (abfd, amt);
if (n == NULL)
return false;
elf_tdata (abfd)->local_stubs = n;
@@ -7439,7 +8275,7 @@ _bfd_mips_elf_check_relocs (abfd, info, sec, relocs)
for (rel = relocs; rel < rel_end; ++rel)
{
unsigned long r_symndx;
- int r_type;
+ unsigned int r_type;
struct elf_link_hash_entry *h;
r_symndx = ELF32_R_SYM (rel->r_info);
@@ -7447,6 +8283,14 @@ _bfd_mips_elf_check_relocs (abfd, info, sec, relocs)
if (r_symndx < extsymoff)
h = NULL;
+ else if (r_symndx >= extsymoff + NUM_SHDR_ENTRIES (symtab_hdr))
+ {
+ (*_bfd_error_handler)
+ (_("%s: Malformed reloc detected for section %s"),
+ bfd_archive_filename (abfd), name);
+ bfd_set_error (bfd_error_bad_value);
+ return false;
+ }
else
{
h = sym_hashes[r_symndx - extsymoff];
@@ -7501,10 +8345,10 @@ _bfd_mips_elf_check_relocs (abfd, info, sec, relocs)
/* We may need a local GOT entry for this relocation. We
don't count R_MIPS_GOT_PAGE because we can estimate the
maximum number of pages needed by looking at the size of
- the segment. Similar comments apply to R_MIPS_GOT16. We
- don't count R_MIPS_GOT_HI16, or R_MIPS_CALL_HI16 because
- these are always followed by an R_MIPS_GOT_LO16 or
- R_MIPS_CALL_LO16.
+ the segment. Similar comments apply to R_MIPS_GOT16 and
+ R_MIPS_CALL16. We don't count R_MIPS_GOT_HI16, or
+ R_MIPS_CALL_HI16 because these are always followed by an
+ R_MIPS_GOT_LO16 or R_MIPS_CALL_LO16.
This estimation is very conservative since we can merge
duplicate entries in the GOT. In order to be less
@@ -7521,7 +8365,7 @@ _bfd_mips_elf_check_relocs (abfd, info, sec, relocs)
{
(*_bfd_error_handler)
(_("%s: CALL16 reloc at 0x%lx not against global symbol"),
- bfd_get_filename (abfd), (unsigned long) rel->r_offset);
+ bfd_archive_filename (abfd), (unsigned long) rel->r_offset);
bfd_set_error (bfd_error_bad_value);
return false;
}
@@ -7560,12 +8404,12 @@ _bfd_mips_elf_check_relocs (abfd, info, sec, relocs)
{
if (sreloc == NULL)
{
- const char *name = MIPS_ELF_REL_DYN_SECTION_NAME (dynobj);
+ const char *dname = MIPS_ELF_REL_DYN_SECTION_NAME (dynobj);
- sreloc = bfd_get_section_by_name (dynobj, name);
+ sreloc = bfd_get_section_by_name (dynobj, dname);
if (sreloc == NULL)
{
- sreloc = bfd_make_section (dynobj, name);
+ sreloc = bfd_make_section (dynobj, dname);
if (sreloc == NULL
|| ! bfd_set_section_flags (dynobj, sreloc,
(SEC_ALLOC
@@ -7579,12 +8423,20 @@ _bfd_mips_elf_check_relocs (abfd, info, sec, relocs)
return false;
}
}
+#define MIPS_READONLY_SECTION (SEC_ALLOC | SEC_LOAD | SEC_READONLY)
if (info->shared)
- /* When creating a shared object, we must copy these
- reloc types into the output file as R_MIPS_REL32
- relocs. We make room for this reloc in the
- .rel.dyn reloc section. */
- mips_elf_allocate_dynamic_relocations (dynobj, 1);
+ {
+ /* When creating a shared object, we must copy these
+ reloc types into the output file as R_MIPS_REL32
+ relocs. We make room for this reloc in the
+ .rel.dyn reloc section. */
+ mips_elf_allocate_dynamic_relocations (dynobj, 1);
+ if ((sec->flags & MIPS_READONLY_SECTION)
+ == MIPS_READONLY_SECTION)
+ /* We tell the dynamic linker that there are
+ relocations against the text segment. */
+ info->flags |= DF_TEXTREL;
+ }
else
{
struct mips_elf_link_hash_entry *hmips;
@@ -7593,8 +8445,13 @@ _bfd_mips_elf_check_relocs (abfd, info, sec, relocs)
defined in a dynamic object. */
hmips = (struct mips_elf_link_hash_entry *) h;
++hmips->possibly_dynamic_relocs;
+ if ((sec->flags & MIPS_READONLY_SECTION)
+ == MIPS_READONLY_SECTION)
+ /* We need it to tell the dynamic linker if there
+ are relocations against the text segment. */
+ hmips->readonly_reloc = true;
}
-
+
/* Even though we don't directly need a GOT entry for
this symbol, a symbol must have a dynamic symbol
table index greater that DT_MIPS_GOTSYM if there are
@@ -7604,7 +8461,7 @@ _bfd_mips_elf_check_relocs (abfd, info, sec, relocs)
return false;
}
- if (SGI_COMPAT (dynobj))
+ if (SGI_COMPAT (abfd))
mips_elf_hash_table (info)->compact_rel_size +=
sizeof (Elf32_External_crinfo);
break;
@@ -7613,7 +8470,7 @@ _bfd_mips_elf_check_relocs (abfd, info, sec, relocs)
case R_MIPS_GPREL16:
case R_MIPS_LITERAL:
case R_MIPS_GPREL32:
- if (SGI_COMPAT (dynobj))
+ if (SGI_COMPAT (abfd))
mips_elf_hash_table (info)->compact_rel_size +=
sizeof (Elf32_External_crinfo);
break;
@@ -7636,9 +8493,28 @@ _bfd_mips_elf_check_relocs (abfd, info, sec, relocs)
break;
}
+ /* We must not create a stub for a symbol that has relocations
+ related to taking the function's address. */
+ switch (r_type)
+ {
+ default:
+ if (h != NULL)
+ {
+ struct mips_elf_link_hash_entry *mh;
+
+ mh = (struct mips_elf_link_hash_entry *) h;
+ mh->no_fn_stub = true;
+ }
+ break;
+ case R_MIPS_CALL16:
+ case R_MIPS_CALL_HI16:
+ case R_MIPS_CALL_LO16:
+ break;
+ }
+
/* If this reloc is not a 16 bit call, and it has a global
symbol, then we will need the fn_stub if there is one.
- References from a stub section do not count. */
+ References from a stub section do not count. */
if (h != NULL
&& r_type != R_MIPS16_26
&& strncmp (bfd_get_section_name (abfd, sec), FN_STUB,
@@ -7696,13 +8572,7 @@ _bfd_mips_elf_gc_mark_hook (abfd, info, rel, h, sym)
}
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 bfd_section_from_elf_index (abfd, sym->st_shndx);
}
return NULL;
@@ -7742,7 +8612,7 @@ _bfd_mips_elf_gc_sweep_hook (abfd, info, sec, relocs)
/* ??? It would seem that the existing MIPS code does no sort
of reference counting or whatnot on its GOT and PLT entries,
so it is not possible to garbage collect them at this time. */
- break;
+ break;
default:
break;
@@ -7752,6 +8622,34 @@ _bfd_mips_elf_gc_sweep_hook (abfd, info, sec, relocs)
return true;
}
+/* Copy data from a MIPS ELF indirect symbol to its direct symbol,
+ hiding the old indirect symbol. Process additional relocation
+ information. Also called for weakdefs, in which case we just let
+ _bfd_elf_link_hash_copy_indirect copy the flags for us. */
+
+static void
+_bfd_mips_elf_copy_indirect_symbol (dir, ind)
+ struct elf_link_hash_entry *dir, *ind;
+{
+ struct mips_elf_link_hash_entry *dirmips, *indmips;
+
+ _bfd_elf_link_hash_copy_indirect (dir, ind);
+
+ if (ind->root.type != bfd_link_hash_indirect)
+ return;
+
+ dirmips = (struct mips_elf_link_hash_entry *) dir;
+ indmips = (struct mips_elf_link_hash_entry *) ind;
+ dirmips->possibly_dynamic_relocs += indmips->possibly_dynamic_relocs;
+ if (indmips->readonly_reloc)
+ dirmips->readonly_reloc = true;
+ if (dirmips->min_dyn_reloc_index == 0
+ || (indmips->min_dyn_reloc_index != 0
+ && indmips->min_dyn_reloc_index < dirmips->min_dyn_reloc_index))
+ dirmips->min_dyn_reloc_index = indmips->min_dyn_reloc_index;
+ if (indmips->no_fn_stub)
+ dirmips->no_fn_stub = true;
+}
/* Adjust a symbol defined by a dynamic object and referenced by a
regular object. The current definition is in some section of the
@@ -7787,13 +8685,21 @@ _bfd_mips_elf_adjust_dynamic_symbol (info, h)
hmips = (struct mips_elf_link_hash_entry *) h;
if (! info->relocateable
&& hmips->possibly_dynamic_relocs != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- mips_elf_allocate_dynamic_relocations (dynobj,
- hmips->possibly_dynamic_relocs);
+ && (h->root.type == bfd_link_hash_defweak
+ || (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0))
+ {
+ mips_elf_allocate_dynamic_relocations (dynobj,
+ hmips->possibly_dynamic_relocs);
+ if (hmips->readonly_reloc)
+ /* We tell the dynamic linker that there are relocations
+ against the text segment. */
+ info->flags |= DF_TEXTREL;
+ }
- /* For a function, create a stub, if needed. */
- if (h->type == STT_FUNC
- || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
+ /* For a function, create a stub, if allowed. */
+ if (! hmips->no_fn_stub
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
{
if (! elf_hash_table (info)->dynamic_sections_created)
return true;
@@ -7805,7 +8711,7 @@ _bfd_mips_elf_adjust_dynamic_symbol (info, h)
if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
{
/* We need .stub section. */
- s = bfd_get_section_by_name (dynobj,
+ s = bfd_get_section_by_name (dynobj,
MIPS_ELF_STUB_SECTION_NAME (dynobj));
BFD_ASSERT (s != NULL);
@@ -7823,6 +8729,14 @@ _bfd_mips_elf_adjust_dynamic_symbol (info, h)
return true;
}
}
+ else if ((h->type == STT_FUNC)
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) == 0)
+ {
+ /* This will set the entry for this symbol in the GOT to 0, and
+ the dynamic linker will take care of this. */
+ h->root.u.def.value = 0;
+ 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
@@ -7859,7 +8773,8 @@ _bfd_mips_elf_always_size_sections (output_bfd, info)
/* The .reginfo section has a fixed size. */
ri = bfd_get_section_by_name (output_bfd, ".reginfo");
if (ri != NULL)
- bfd_set_section_size (output_bfd, ri, sizeof (Elf32_External_RegInfo));
+ bfd_set_section_size (output_bfd, ri,
+ (bfd_size_type) sizeof (Elf32_External_RegInfo));
if (info->relocateable
|| ! mips_elf_hash_table (info)->mips16_stubs_seen)
@@ -7875,12 +8790,14 @@ _bfd_mips_elf_always_size_sections (output_bfd, info)
/* Check the mips16 stubs for a particular symbol, and see if we can
discard them. */
-/*ARGSUSED*/
static boolean
mips_elf_check_mips16_stubs (h, data)
struct mips_elf_link_hash_entry *h;
PTR data ATTRIBUTE_UNUSED;
{
+ if (h->root.root.type == bfd_link_hash_warning)
+ h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link;
+
if (h->fn_stub != NULL
&& ! h->need_fn_stub)
{
@@ -7889,7 +8806,7 @@ mips_elf_check_mips16_stubs (h, data)
being included in the link. */
h->fn_stub->_raw_size = 0;
h->fn_stub->_cooked_size = 0;
- h->fn_stub->flags &= ~ SEC_RELOC;
+ h->fn_stub->flags &= ~SEC_RELOC;
h->fn_stub->reloc_count = 0;
h->fn_stub->flags |= SEC_EXCLUDE;
}
@@ -7902,7 +8819,7 @@ mips_elf_check_mips16_stubs (h, data)
to 0 to prevent it from being included in the link. */
h->call_stub->_raw_size = 0;
h->call_stub->_cooked_size = 0;
- h->call_stub->flags &= ~ SEC_RELOC;
+ h->call_stub->flags &= ~SEC_RELOC;
h->call_stub->reloc_count = 0;
h->call_stub->flags |= SEC_EXCLUDE;
}
@@ -7915,7 +8832,7 @@ mips_elf_check_mips16_stubs (h, data)
to 0 to prevent it from being included in the link. */
h->call_fp_stub->_raw_size = 0;
h->call_fp_stub->_cooked_size = 0;
- h->call_fp_stub->flags &= ~ SEC_RELOC;
+ h->call_fp_stub->flags &= ~SEC_RELOC;
h->call_fp_stub->reloc_count = 0;
h->call_fp_stub->flags |= SEC_EXCLUDE;
}
@@ -7945,9 +8862,9 @@ _bfd_mips_elf_size_dynamic_sections (output_bfd, info)
{
s = bfd_get_section_by_name (dynobj, ".interp");
BFD_ASSERT (s != NULL);
- s->_raw_size
+ s->_raw_size
= strlen (ELF_DYNAMIC_INTERPRETER (output_bfd)) + 1;
- s->contents
+ s->contents
= (bfd_byte *) ELF_DYNAMIC_INTERPRETER (output_bfd);
}
}
@@ -8002,13 +8919,13 @@ _bfd_mips_elf_size_dynamic_sections (output_bfd, info)
if ((target != NULL
&& (target->flags & SEC_READONLY) != 0
&& (target->flags & SEC_ALLOC) != 0)
- || strcmp (outname,
+ || strcmp (outname,
MIPS_ELF_REL_DYN_SECTION_NAME (output_bfd)) == 0)
reltext = true;
/* We use the reloc_count field as a counter if we need
to copy relocs into the output file. */
- if (strcmp (name,
+ if (strcmp (name,
MIPS_ELF_REL_DYN_SECTION_NAME (output_bfd)) != 0)
s->reloc_count = 0;
}
@@ -8016,49 +8933,50 @@ _bfd_mips_elf_size_dynamic_sections (output_bfd, info)
else if (strncmp (name, ".got", 4) == 0)
{
int i;
- bfd_size_type loadable_size = 0;
- bfd_size_type local_gotno;
- struct _bfd *sub;
+ bfd_size_type loadable_size = 0;
+ bfd_size_type local_gotno;
+ bfd *sub;
- BFD_ASSERT (elf_section_data (s) != NULL);
+ BFD_ASSERT (elf_section_data (s) != NULL);
g = (struct mips_got_info *) elf_section_data (s)->tdata;
- BFD_ASSERT (g != NULL);
-
- /* Calculate the total loadable size of the output. That
- will give us the maximum number of GOT_PAGE entries
- required. */
- for (sub = info->input_bfds; sub; sub = sub->link_next)
- {
- asection *subsection;
-
- for (subsection = sub->sections;
- subsection;
- subsection = subsection->next)
- {
- if ((subsection->flags & SEC_ALLOC) == 0)
- continue;
- loadable_size += (subsection->_raw_size + 0xf) & ~0xf;
- }
- }
- loadable_size += MIPS_FUNCTION_STUB_SIZE;
-
- /* Assume there are two loadable segments consisting of
- contiguous sections. Is 5 enough? */
- local_gotno = (loadable_size >> 16) + 5;
+ BFD_ASSERT (g != NULL);
+
+ /* Calculate the total loadable size of the output. That
+ will give us the maximum number of GOT_PAGE entries
+ required. */
+ for (sub = info->input_bfds; sub; sub = sub->link_next)
+ {
+ asection *subsection;
+
+ for (subsection = sub->sections;
+ subsection;
+ subsection = subsection->next)
+ {
+ if ((subsection->flags & SEC_ALLOC) == 0)
+ continue;
+ loadable_size += ((subsection->_raw_size + 0xf)
+ &~ (bfd_size_type) 0xf);
+ }
+ }
+ loadable_size += MIPS_FUNCTION_STUB_SIZE;
+
+ /* Assume there are two loadable segments consisting of
+ contiguous sections. Is 5 enough? */
+ local_gotno = (loadable_size >> 16) + 5;
if (IRIX_COMPAT (output_bfd) == ict_irix6)
/* It's possible we will need GOT_PAGE entries as well as
GOT16 entries. Often, these will be able to share GOT
entries, but not always. */
local_gotno *= 2;
- g->local_gotno += local_gotno;
- s->_raw_size += local_gotno * MIPS_ELF_GOT_SIZE (dynobj);
+ g->local_gotno += local_gotno;
+ s->_raw_size += local_gotno * MIPS_ELF_GOT_SIZE (dynobj);
- /* There has to be a global GOT entry for every symbol with
- a dynamic symbol table index of DT_MIPS_GOTSYM or
- higher. Therefore, it make sense to put those symbols
- that need GOT entries at the end of the symbol table. We
- do that here. */
+ /* There has to be a global GOT entry for every symbol with
+ a dynamic symbol table index of DT_MIPS_GOTSYM or
+ higher. Therefore, it make sense to put those symbols
+ that need GOT entries at the end of the symbol table. We
+ do that here. */
if (!mips_elf_sort_hash_table (info, 1))
return false;
@@ -8090,7 +9008,7 @@ _bfd_mips_elf_size_dynamic_sections (output_bfd, info)
s->_raw_size += mips_elf_hash_table (info)->compact_rel_size;
else if (strcmp (name, MIPS_ELF_MSYM_SECTION_NAME (output_bfd))
== 0)
- s->_raw_size = (sizeof (Elf32_External_Msym)
+ s->_raw_size = (sizeof (Elf32_External_Msym)
* (elf_hash_table (info)->dynsymcount
+ bfd_count_sections (output_bfd)));
else if (strncmp (name, ".init", 5) != 0)
@@ -8123,19 +9041,30 @@ _bfd_mips_elf_size_dynamic_sections (output_bfd, info)
dynamic linker and used by the debugger. */
if (! info->shared)
{
- if (SGI_COMPAT (output_bfd))
+ /* SGI object has the equivalence of DT_DEBUG in the
+ DT_MIPS_RLD_MAP entry. */
+ if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_MAP, 0))
+ return false;
+ if (!SGI_COMPAT (output_bfd))
{
- /* SGI object has the equivalence of DT_DEBUG in the
- DT_MIPS_RLD_MAP entry. */
- if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_MAP, 0))
+ if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0))
+ return false;
+ }
+ }
+ else
+ {
+ /* Shared libraries on traditional mips have DT_DEBUG. */
+ if (!SGI_COMPAT (output_bfd))
+ {
+ if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0))
return false;
}
- else
- if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0))
- return false;
}
- if (reltext)
+ if (reltext && SGI_COMPAT (output_bfd))
+ info->flags |= DF_TEXTREL;
+
+ if ((info->flags & DF_TEXTREL) != 0)
{
if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_TEXTREL, 0))
return false;
@@ -8157,11 +9086,17 @@ _bfd_mips_elf_size_dynamic_sections (output_bfd, info)
return false;
}
- if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_CONFLICTNO, 0))
- return false;
+ if (SGI_COMPAT (output_bfd))
+ {
+ if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_CONFLICTNO, 0))
+ return false;
+ }
- if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_LIBLISTNO, 0))
- return false;
+ if (SGI_COMPAT (output_bfd))
+ {
+ if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_LIBLISTNO, 0))
+ return false;
+ }
if (bfd_get_section_by_name (dynobj, ".conflict") != NULL)
{
@@ -8217,12 +9152,12 @@ _bfd_mips_elf_size_dynamic_sections (output_bfd, info)
return false;
if (IRIX_COMPAT (dynobj) == ict_irix6
- && (bfd_get_section_by_name
+ && (bfd_get_section_by_name
(dynobj, MIPS_ELF_OPTIONS_SECTION_NAME (dynobj)))
&& !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_OPTIONS, 0))
return false;
- if (bfd_get_section_by_name (dynobj,
+ if (bfd_get_section_by_name (dynobj,
MIPS_ELF_MSYM_SECTION_NAME (dynobj))
&& !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_MSYM, 0))
return false;
@@ -8263,7 +9198,7 @@ mips_elf_irix6_finish_dynamic_symbol (abfd, name, sym)
int i;
for (i = 0; i < 2; ++i)
- for (p = (i == 0) ? text_section_symbols : data_section_symbols;
+ for (p = (i == 0) ? text_section_symbols : data_section_symbols;
*p;
++p)
if (strcmp (*p, name) == 0)
@@ -8271,13 +9206,13 @@ mips_elf_irix6_finish_dynamic_symbol (abfd, name, sym)
/* All of these symbols are given type STT_SECTION by the
IRIX6 linker. */
sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION);
-
+
/* The IRIX linker puts these symbols in special sections. */
if (i == 0)
sym->st_shndx = SHN_MIPS_TEXT;
else
sym->st_shndx = SHN_MIPS_DATA;
-
+
break;
}
}
@@ -8314,24 +9249,24 @@ _bfd_mips_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
BFD_ASSERT (h->dynindx != -1);
- s = bfd_get_section_by_name (dynobj,
+ s = bfd_get_section_by_name (dynobj,
MIPS_ELF_STUB_SECTION_NAME (dynobj));
BFD_ASSERT (s != NULL);
/* Fill the stub. */
p = stub;
- bfd_put_32 (output_bfd, STUB_LW(output_bfd), p);
+ bfd_put_32 (output_bfd, (bfd_vma) STUB_LW (output_bfd), p);
p += 4;
- bfd_put_32 (output_bfd, STUB_MOVE, p);
+ bfd_put_32 (output_bfd, (bfd_vma) STUB_MOVE (output_bfd), p);
p += 4;
/* FIXME: Can h->dynindex be more than 64K? */
if (h->dynindx & 0xffff0000)
return false;
- bfd_put_32 (output_bfd, STUB_JALR, p);
+ bfd_put_32 (output_bfd, (bfd_vma) STUB_JALR, p);
p += 4;
- bfd_put_32 (output_bfd, STUB_LI16 + h->dynindx, p);
+ bfd_put_32 (output_bfd, (bfd_vma) STUB_LI16 (output_bfd) + h->dynindx, p);
BFD_ASSERT (h->plt.offset <= s->_raw_size);
memcpy (s->contents + h->plt.offset, stub, MIPS_FUNCTION_STUB_SIZE);
@@ -8347,7 +9282,8 @@ _bfd_mips_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
sym->st_value = gval;
}
- BFD_ASSERT (h->dynindx != -1);
+ BFD_ASSERT (h->dynindx != -1
+ || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0);
sgot = mips_elf_got_section (dynobj);
BFD_ASSERT (sgot != NULL);
@@ -8366,19 +9302,24 @@ _bfd_mips_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
if (sym->st_value)
value = sym->st_value;
else
- /* For an entity defined in a shared object, this will be
- NULL. (For functions in shared objects for
- which we have created stubs, ST_VALUE will be non-NULL.
- That's because such the functions are now no longer defined
- in a shared object.) */
- value = h->root.u.def.value;
-
+ {
+ /* For an entity defined in a shared object, this will be
+ NULL. (For functions in shared objects for
+ which we have created stubs, ST_VALUE will be non-NULL.
+ That's because such the functions are now no longer defined
+ in a shared object.) */
+
+ if (info->shared && h->root.type == bfd_link_hash_undefined)
+ value = 0;
+ else
+ value = h->root.u.def.value;
+ }
offset = mips_elf_global_got_index (dynobj, h);
MIPS_ELF_PUT_WORD (output_bfd, value, sgot->contents + offset);
}
/* Create a .msym entry, if appropriate. */
- smsym = bfd_get_section_by_name (dynobj,
+ smsym = bfd_get_section_by_name (dynobj,
MIPS_ELF_MSYM_SECTION_NAME (dynobj));
if (smsym)
{
@@ -8388,7 +9329,7 @@ _bfd_mips_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
/* It is undocumented what the `1' indicates, but IRIX6 uses
this value. */
msym.ms_info = ELF32_MS_INFO (mh->min_dyn_reloc_index, 1);
- bfd_mips_elf_swap_msym_out
+ bfd_mips_elf_swap_msym_out
(dynobj, &msym,
((Elf32_External_Msym *) smsym->contents) + h->dynindx);
}
@@ -8398,22 +9339,23 @@ _bfd_mips_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
if (strcmp (name, "_DYNAMIC") == 0
|| strcmp (name, "_GLOBAL_OFFSET_TABLE_") == 0)
sym->st_shndx = SHN_ABS;
- else if (strcmp (name, "_DYNAMIC_LINK") == 0)
+ else if (strcmp (name, "_DYNAMIC_LINK") == 0
+ || strcmp (name, "_DYNAMIC_LINKING") == 0)
{
sym->st_shndx = SHN_ABS;
sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION);
sym->st_value = 1;
}
+ else if (strcmp (name, "_gp_disp") == 0)
+ {
+ sym->st_shndx = SHN_ABS;
+ sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION);
+ sym->st_value = elf_gp (output_bfd);
+ }
else if (SGI_COMPAT (output_bfd))
{
- if (strcmp (name, "_gp_disp") == 0)
- {
- sym->st_shndx = SHN_ABS;
- sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION);
- sym->st_value = elf_gp (output_bfd);
- }
- else if (strcmp (name, mips_elf_dynsym_rtproc_names[0]) == 0
- || strcmp (name, mips_elf_dynsym_rtproc_names[1]) == 0)
+ if (strcmp (name, mips_elf_dynsym_rtproc_names[0]) == 0
+ || strcmp (name, mips_elf_dynsym_rtproc_names[1]) == 0)
{
sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION);
sym->st_other = STO_PROTECTED;
@@ -8440,11 +9382,11 @@ _bfd_mips_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
if (IRIX_COMPAT (output_bfd) == ict_irix6)
mips_elf_irix6_finish_dynamic_symbol (output_bfd, name, sym);
- if (SGI_COMPAT (output_bfd)
- && ! info->shared)
+ if (! info->shared)
{
if (! mips_elf_hash_table (info)->use_rld_obj_head
- && strcmp (name, "__rld_map") == 0)
+ && (strcmp (name, "__rld_map") == 0
+ || strcmp (name, "__RLD_MAP") == 0))
{
asection *s = bfd_get_section_by_name (dynobj, ".rld_map");
BFD_ASSERT (s != NULL);
@@ -8457,8 +9399,9 @@ _bfd_mips_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
&& strcmp (name, "__rld_obj_head") == 0)
{
/* IRIX6 does not use a .rld_map section. */
- if (IRIX_COMPAT (output_bfd) == ict_irix5)
- BFD_ASSERT (bfd_get_section_by_name (dynobj, ".rld_map")
+ if (IRIX_COMPAT (output_bfd) == ict_irix5
+ || IRIX_COMPAT (output_bfd) == ict_none)
+ BFD_ASSERT (bfd_get_section_by_name (dynobj, ".rld_map")
!= NULL);
mips_elf_hash_table (info)->rld_value = sym->st_value;
}
@@ -8517,14 +9460,14 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info)
/* Read in the current dynamic entry. */
(*get_elf_backend_data (dynobj)->s->swap_dyn_in) (dynobj, b, &dyn);
-
+
/* Assume that we're going to modify it and write it out. */
swap_out_p = true;
switch (dyn.d_tag)
{
case DT_RELENT:
- s = (bfd_get_section_by_name
+ s = (bfd_get_section_by_name
(dynobj,
MIPS_ELF_REL_DYN_SECTION_NAME (dynobj)));
BFD_ASSERT (s != NULL);
@@ -8534,7 +9477,7 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info)
case DT_STRSZ:
/* Rewrite DT_STRSZ. */
dyn.d_un.d_val =
- _bfd_stringtab_size (elf_hash_table (info)->dynstr);
+ _bfd_elf_strtab_size (elf_hash_table (info)->dynstr);
break;
case DT_PLTGOT:
@@ -8577,7 +9520,7 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info)
dyn.d_un.d_val = s->_raw_size / elemsize;
}
else
- dyn.d_un.d_val = 0;
+ dyn.d_un.d_val = 0;
break;
case DT_MIPS_TIME_STAMP:
@@ -8597,7 +9540,7 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info)
case DT_MIPS_BASE_ADDRESS:
s = output_bfd->sections;
BFD_ASSERT (s != NULL);
- dyn.d_un.d_ptr = s->vma & ~(0xffff);
+ dyn.d_un.d_ptr = s->vma & ~(bfd_vma) 0xffff;
break;
case DT_MIPS_LOCAL_GOTNO:
@@ -8642,13 +9585,13 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info)
break;
case DT_MIPS_OPTIONS:
- s = (bfd_get_section_by_name
+ s = (bfd_get_section_by_name
(output_bfd, MIPS_ELF_OPTIONS_SECTION_NAME (output_bfd)));
dyn.d_un.d_ptr = s->vma;
break;
case DT_MIPS_MSYM:
- s = (bfd_get_section_by_name
+ s = (bfd_get_section_by_name
(output_bfd, MIPS_ELF_MSYM_SECTION_NAME (output_bfd)));
dyn.d_un.d_ptr = s->vma;
break;
@@ -8659,18 +9602,18 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info)
}
if (swap_out_p)
- (*get_elf_backend_data (dynobj)->s->swap_dyn_out)
+ (*get_elf_backend_data (dynobj)->s->swap_dyn_out)
(dynobj, &dyn, b);
}
}
/* The first entry of the global offset table will be filled at
runtime. The second entry will be used by some runtime loaders.
- This isn't the case of Irix rld. */
+ This isn't the case of Irix rld. */
if (sgot != NULL && sgot->_raw_size > 0)
{
MIPS_ELF_PUT_WORD (output_bfd, (bfd_vma) 0, sgot->contents);
- MIPS_ELF_PUT_WORD (output_bfd, (bfd_vma) 0x80000000,
+ MIPS_ELF_PUT_WORD (output_bfd, (bfd_vma) 0x80000000,
sgot->contents + MIPS_ELF_GOT_SIZE (output_bfd));
}
@@ -8687,7 +9630,7 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info)
_bfd_elf_final_link. SGI sets the STT_NOTYPE attribute for these
symbols. Should we do so? */
- smsym = bfd_get_section_by_name (dynobj,
+ smsym = bfd_get_section_by_name (dynobj,
MIPS_ELF_MSYM_SECTION_NAME (dynobj));
if (smsym != NULL)
{
@@ -8700,7 +9643,7 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info)
{
long dynindx = elf_section_data (s)->dynindx;
- bfd_mips_elf_swap_msym_out
+ bfd_mips_elf_swap_msym_out
(output_bfd, &msym,
(((Elf32_External_Msym *) smsym->contents)
+ dynindx));
@@ -8725,7 +9668,7 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info)
s->contents));
/* Clean up a dummy stub function entry in .text. */
- s = bfd_get_section_by_name (dynobj,
+ s = bfd_get_section_by_name (dynobj,
MIPS_ELF_STUB_SECTION_NAME (dynobj));
if (s != NULL)
{
@@ -8739,8 +9682,25 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info)
}
}
+ /* We need to sort the entries of the dynamic relocation section. */
+
+ if (!ABI_64_P (output_bfd))
+ {
+ asection *reldyn;
+
+ reldyn = bfd_get_section_by_name (dynobj,
+ MIPS_ELF_REL_DYN_SECTION_NAME (dynobj));
+ if (reldyn != NULL && reldyn->reloc_count > 2)
+ {
+ reldyn_sorting_bfd = output_bfd;
+ qsort ((Elf32_External_Rel *) reldyn->contents + 1,
+ (size_t) reldyn->reloc_count - 1,
+ sizeof (Elf32_External_Rel), sort_dynamic_relocs);
+ }
+ }
+
/* Clean up a first relocation in .rel.dyn. */
- s = bfd_get_section_by_name (dynobj,
+ s = bfd_get_section_by_name (dynobj,
MIPS_ELF_REL_DYN_SECTION_NAME (dynobj));
if (s != NULL && s->_raw_size > 0)
memset (s->contents, 0, MIPS_ELF_REL_SIZE (dynobj));
@@ -8749,6 +9709,354 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info)
return true;
}
+/* Support for core dump NOTE sections */
+static boolean
+_bfd_elf32_mips_grok_prstatus (abfd, note)
+ bfd *abfd;
+ Elf_Internal_Note *note;
+{
+ int offset;
+ unsigned int raw_size;
+
+ switch (note->descsz)
+ {
+ default:
+ return false;
+
+ case 256: /* Linux/MIPS */
+ /* pr_cursig */
+ elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+
+ /* pr_pid */
+ elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
+
+ /* pr_reg */
+ offset = 72;
+ raw_size = 180;
+
+ break;
+ }
+
+ /* Make a ".reg/999" section. */
+ return _bfd_elfcore_make_pseudosection (abfd, ".reg",
+ raw_size, note->descpos + offset);
+}
+
+static boolean
+_bfd_elf32_mips_grok_psinfo (abfd, note)
+ bfd *abfd;
+ Elf_Internal_Note *note;
+{
+ switch (note->descsz)
+ {
+ default:
+ return false;
+
+ case 128: /* Linux/MIPS elf_prpsinfo */
+ elf_tdata (abfd)->core_program
+ = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16);
+ elf_tdata (abfd)->core_command
+ = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80);
+ }
+
+ /* Note that for some reason, a spurious space is tacked
+ onto the end of the args in some (at least one anyway)
+ implementations, so strip it off if it exists. */
+
+ {
+ char *command = elf_tdata (abfd)->core_command;
+ int n = strlen (command);
+
+ if (0 < n && command[n - 1] == ' ')
+ command[n - 1] = '\0';
+ }
+
+ return true;
+}
+
+#define PDR_SIZE 32
+
+static boolean
+_bfd_elf32_mips_discard_info (abfd, cookie, info)
+ bfd *abfd;
+ struct elf_reloc_cookie *cookie;
+ struct bfd_link_info *info;
+{
+ asection *o;
+ struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ boolean ret = false;
+ unsigned char *tdata;
+ size_t i, skip;
+
+ o = bfd_get_section_by_name (abfd, ".pdr");
+ if (! o)
+ return false;
+ if (o->_raw_size == 0)
+ return false;
+ if (o->_raw_size % PDR_SIZE != 0)
+ return false;
+ if (o->output_section != NULL
+ && bfd_is_abs_section (o->output_section))
+ return false;
+
+ tdata = bfd_zmalloc (o->_raw_size / PDR_SIZE);
+ if (! tdata)
+ return false;
+
+ cookie->rels = _bfd_elf32_link_read_relocs (abfd, o, (PTR) NULL,
+ (Elf_Internal_Rela *) NULL,
+ info->keep_memory);
+ if (!cookie->rels)
+ {
+ free (tdata);
+ return false;
+ }
+
+ cookie->rel = cookie->rels;
+ cookie->relend =
+ cookie->rels + o->reloc_count * bed->s->int_rels_per_ext_rel;
+
+ for (i = 0, skip = 0; i < o->_raw_size; i ++)
+ {
+ if (_bfd_elf32_reloc_symbol_deleted_p (i * PDR_SIZE, cookie))
+ {
+ tdata[i] = 1;
+ skip ++;
+ }
+ }
+
+ if (skip != 0)
+ {
+ elf_section_data (o)->tdata = tdata;
+ o->_cooked_size = o->_raw_size - skip * PDR_SIZE;
+ ret = true;
+ }
+ else
+ free (tdata);
+
+ if (! info->keep_memory)
+ free (cookie->rels);
+
+ return ret;
+}
+
+static boolean
+_bfd_elf32_mips_ignore_discarded_relocs (sec)
+ asection *sec;
+{
+ if (strcmp (sec->name, ".pdr") == 0)
+ return true;
+ return false;
+}
+
+static boolean
+_bfd_elf32_mips_write_section (output_bfd, sec, contents)
+ bfd *output_bfd;
+ asection *sec;
+ bfd_byte *contents;
+{
+ bfd_byte *to, *from, *end;
+ int i;
+
+ if (strcmp (sec->name, ".pdr") != 0)
+ return false;
+
+ if (elf_section_data (sec)->tdata == NULL)
+ return false;
+
+ to = contents;
+ end = contents + sec->_raw_size;
+ for (from = contents, i = 0;
+ from < end;
+ from += PDR_SIZE, i++)
+ {
+ if (((unsigned char *)elf_section_data (sec)->tdata)[i] == 1)
+ continue;
+ if (to != from)
+ memcpy (to, from, PDR_SIZE);
+ to += PDR_SIZE;
+ }
+ bfd_set_section_contents (output_bfd, sec->output_section, contents,
+ (file_ptr) sec->output_offset,
+ sec->_cooked_size);
+ return true;
+}
+
+/* Given a data section and an in-memory embedded reloc section, store
+ relocation information into the embedded reloc section which can be
+ used at runtime to relocate the data section. This is called by the
+ linker when the --embedded-relocs switch is used. This is called
+ after the add_symbols entry point has been called for all the
+ objects, and before the final_link entry point is called. */
+
+boolean
+bfd_mips_elf32_create_embedded_relocs (abfd, info, datasec, relsec, errmsg)
+ bfd *abfd;
+ struct bfd_link_info *info;
+ asection *datasec;
+ asection *relsec;
+ char **errmsg;
+{
+ Elf_Internal_Shdr *symtab_hdr;
+ Elf_Internal_Shdr *shndx_hdr;
+ Elf32_External_Sym *extsyms;
+ Elf32_External_Sym *free_extsyms = NULL;
+ Elf_External_Sym_Shndx *shndx_buf = NULL;
+ Elf_Internal_Rela *internal_relocs;
+ Elf_Internal_Rela *free_relocs = NULL;
+ Elf_Internal_Rela *irel, *irelend;
+ bfd_byte *p;
+ bfd_size_type amt;
+
+ BFD_ASSERT (! info->relocateable);
+
+ *errmsg = NULL;
+
+ if (datasec->reloc_count == 0)
+ return true;
+
+ symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+ /* Read this BFD's symbols if we haven't done so already, or get the cached
+ copy if it exists. */
+ if (symtab_hdr->contents != NULL)
+ extsyms = (Elf32_External_Sym *) symtab_hdr->contents;
+ else
+ {
+ /* Go get them off disk. */
+ if (info->keep_memory)
+ extsyms = ((Elf32_External_Sym *)
+ bfd_alloc (abfd, symtab_hdr->sh_size));
+ else
+ extsyms = ((Elf32_External_Sym *)
+ bfd_malloc (symtab_hdr->sh_size));
+ if (extsyms == NULL)
+ goto error_return;
+ if (! info->keep_memory)
+ free_extsyms = extsyms;
+ if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0
+ || (bfd_bread (extsyms, symtab_hdr->sh_size, abfd)
+ != symtab_hdr->sh_size))
+ goto error_return;
+ if (info->keep_memory)
+ symtab_hdr->contents = (unsigned char *) extsyms;
+ }
+
+ shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr;
+ if (shndx_hdr->sh_size != 0)
+ {
+ amt = symtab_hdr->sh_info * sizeof (Elf_External_Sym_Shndx);
+ shndx_buf = (Elf_External_Sym_Shndx *) bfd_malloc (amt);
+ if (shndx_buf == NULL)
+ goto error_return;
+ if (bfd_seek (abfd, shndx_hdr->sh_offset, SEEK_SET) != 0
+ || bfd_bread ((PTR) shndx_buf, amt, abfd) != amt)
+ goto error_return;
+ }
+
+ /* Get a copy of the native relocations. */
+ internal_relocs = (_bfd_elf32_link_read_relocs
+ (abfd, datasec, (PTR) NULL, (Elf_Internal_Rela *) NULL,
+ info->keep_memory));
+ if (internal_relocs == NULL)
+ goto error_return;
+ if (! info->keep_memory)
+ free_relocs = internal_relocs;
+
+ relsec->contents = (bfd_byte *) bfd_alloc (abfd, datasec->reloc_count * 12);
+ if (relsec->contents == NULL)
+ goto error_return;
+
+ p = relsec->contents;
+
+ irelend = internal_relocs + datasec->reloc_count;
+
+ for (irel = internal_relocs; irel < irelend; irel++, p += 12)
+ {
+ asection *targetsec;
+
+ /* We are going to write a four byte longword into the runtime
+ reloc section. The longword will be the address in the data
+ section which must be relocated. It is followed by the name
+ of the target section NUL-padded or truncated to 8
+ characters. */
+
+ /* We can only relocate absolute longword relocs at run time. */
+ if ((ELF32_R_TYPE (irel->r_info) != (int) R_MIPS_32) &&
+ (ELF32_R_TYPE (irel->r_info) != (int) R_MIPS_64))
+ {
+ *errmsg = _("unsupported reloc type");
+ bfd_set_error (bfd_error_bad_value);
+ goto error_return;
+ }
+ /* Get the target section referred to by the reloc. */
+ if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info)
+ {
+ Elf32_External_Sym *esym;
+ Elf_External_Sym_Shndx *shndx;
+ Elf_Internal_Sym isym;
+
+ /* A local symbol. */
+ esym = extsyms + ELF32_R_SYM (irel->r_info);
+ shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irel->r_info) : 0);
+ bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym);
+
+ targetsec = bfd_section_from_elf_index (abfd, isym.st_shndx);
+ }
+ else
+ {
+ unsigned long indx;
+ struct elf_link_hash_entry *h;
+
+ /* An external symbol. */
+ indx = ELF32_R_SYM (irel->r_info);
+ h = elf_sym_hashes (abfd)[indx];
+ targetsec = NULL;
+ /*
+ * For some reason, in certain programs, the symbol will
+ * not be in the hash table. It seems to happen when you
+ * declare a static table of pointers to const external structures.
+ * In this case, the relocs are relative to data, not
+ * text, so just treating it like an undefined link
+ * should be sufficient.
+ */
+ BFD_ASSERT(h != NULL);
+ if (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ targetsec = h->root.u.def.section;
+ }
+
+
+ /*
+ * Set the low bit of the relocation offset if it's a MIPS64 reloc.
+ * Relocations will always be on (at least) 32-bit boundaries.
+ */
+
+ bfd_put_32 (abfd, ((irel->r_offset + datasec->output_offset) +
+ ((ELF32_R_TYPE (irel->r_info) == (int) R_MIPS_64) ? 1 : 0)),
+ p);
+ memset (p + 4, 0, 8);
+ if (targetsec != NULL)
+ strncpy (p + 4, targetsec->output_section->name, 8);
+ }
+
+ if (shndx_buf != NULL)
+ free (shndx_buf);
+ if (free_extsyms != NULL)
+ free (free_extsyms);
+ if (free_relocs != NULL)
+ free (free_relocs);
+ return true;
+
+ error_return:
+ if (shndx_buf != NULL)
+ free (shndx_buf);
+ if (free_extsyms != NULL)
+ free (free_extsyms);
+ if (free_relocs != NULL)
+ free (free_relocs);
+ return false;
+}
+
/* This is almost identical to bfd_generic_get_... except that some
MIPS relocations need to be handled specially. Sigh. */
@@ -8773,7 +10081,7 @@ elf32_mips_get_relocated_section_contents (abfd, link_info, link_order, data,
if (reloc_size < 0)
goto error_return;
- reloc_vector = (arelent **) bfd_malloc (reloc_size);
+ reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size);
if (reloc_vector == NULL && reloc_size != 0)
goto error_return;
@@ -8781,7 +10089,7 @@ elf32_mips_get_relocated_section_contents (abfd, link_info, link_order, data,
if (!bfd_get_section_contents (input_bfd,
input_section,
(PTR) data,
- 0,
+ (file_ptr) 0,
input_section->_raw_size))
goto error_return;
@@ -8932,13 +10240,13 @@ error_return:
free (reloc_vector);
return NULL;
}
+
#define bfd_elf32_bfd_get_relocated_section_contents \
elf32_mips_get_relocated_section_contents
/* ECOFF swapping routines. These are used when dealing with the
.mdebug section, which is in the ECOFF debugging format. */
-static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap =
-{
+static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
/* Symbol table magic number. */
magicSym,
/* Alignment of debugging information. E.g., 4. */
@@ -8978,10 +10286,6 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap =
_bfd_mips_elf_read_ecoff_info
};
-#define TARGET_LITTLE_SYM bfd_elf32_littlemips_vec
-#define TARGET_LITTLE_NAME "elf32-littlemips"
-#define TARGET_BIG_SYM bfd_elf32_bigmips_vec
-#define TARGET_BIG_NAME "elf32-bigmips"
#define ELF_ARCH bfd_arch_mips
#define ELF_MACHINE_CODE EM_MIPS
@@ -8992,24 +10296,19 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap =
#define elf_backend_collect true
#define elf_backend_type_change_ok true
#define elf_backend_can_gc_sections true
-#define elf_backend_sign_extend_vma true
#define elf_info_to_howto mips_info_to_howto_rela
#define elf_info_to_howto_rel mips_info_to_howto_rel
#define elf_backend_sym_is_global mips_elf_sym_is_global
#define elf_backend_object_p _bfd_mips_elf_object_p
+#define elf_backend_symbol_processing _bfd_mips_elf_symbol_processing
+#define elf_backend_section_processing _bfd_mips_elf_section_processing
#define elf_backend_section_from_shdr _bfd_mips_elf_section_from_shdr
#define elf_backend_fake_sections _bfd_mips_elf_fake_sections
#define elf_backend_section_from_bfd_section \
_bfd_mips_elf_section_from_bfd_section
-#define elf_backend_section_processing _bfd_mips_elf_section_processing
-#define elf_backend_symbol_processing _bfd_mips_elf_symbol_processing
-#define elf_backend_additional_program_headers \
- _bfd_mips_elf_additional_program_headers
-#define elf_backend_modify_segment_map _bfd_mips_elf_modify_segment_map
-#define elf_backend_final_write_processing \
- _bfd_mips_elf_final_write_processing
-#define elf_backend_ecoff_debug_swap &mips_elf32_ecoff_debug_swap
#define elf_backend_add_symbol_hook _bfd_mips_elf_add_symbol_hook
+#define elf_backend_link_output_symbol_hook \
+ _bfd_mips_elf_link_output_symbol_hook
#define elf_backend_create_dynamic_sections \
_bfd_mips_elf_create_dynamic_sections
#define elf_backend_check_relocs _bfd_mips_elf_check_relocs
@@ -9020,17 +10319,35 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap =
#define elf_backend_size_dynamic_sections \
_bfd_mips_elf_size_dynamic_sections
#define elf_backend_relocate_section _bfd_mips_elf_relocate_section
-#define elf_backend_link_output_symbol_hook \
- _bfd_mips_elf_link_output_symbol_hook
#define elf_backend_finish_dynamic_symbol \
_bfd_mips_elf_finish_dynamic_symbol
#define elf_backend_finish_dynamic_sections \
_bfd_mips_elf_finish_dynamic_sections
+#define elf_backend_final_write_processing \
+ _bfd_mips_elf_final_write_processing
+#define elf_backend_additional_program_headers \
+ _bfd_mips_elf_additional_program_headers
+#define elf_backend_modify_segment_map _bfd_mips_elf_modify_segment_map
#define elf_backend_gc_mark_hook _bfd_mips_elf_gc_mark_hook
#define elf_backend_gc_sweep_hook _bfd_mips_elf_gc_sweep_hook
+#define elf_backend_copy_indirect_symbol \
+ _bfd_mips_elf_copy_indirect_symbol
+#define elf_backend_hide_symbol _bfd_mips_elf_hide_symbol
+#define elf_backend_grok_prstatus _bfd_elf32_mips_grok_prstatus
+#define elf_backend_grok_psinfo _bfd_elf32_mips_grok_psinfo
+#define elf_backend_ecoff_debug_swap &mips_elf32_ecoff_debug_swap
-#define elf_backend_got_header_size (4*MIPS_RESERVED_GOTNO)
+#define elf_backend_got_header_size (4 * MIPS_RESERVED_GOTNO)
#define elf_backend_plt_header_size 0
+#define elf_backend_may_use_rel_p 1
+#define elf_backend_may_use_rela_p 0
+#define elf_backend_default_use_rela_p 0
+#define elf_backend_sign_extend_vma true
+
+#define elf_backend_discard_info _bfd_elf32_mips_discard_info
+#define elf_backend_ignore_discarded_relocs \
+ _bfd_elf32_mips_ignore_discarded_relocs
+#define elf_backend_write_section _bfd_elf32_mips_write_section
#define bfd_elf32_bfd_is_local_label_name \
mips_elf_is_local_label_name
@@ -9039,11 +10356,32 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap =
#define bfd_elf32_bfd_link_hash_table_create \
_bfd_mips_elf_link_hash_table_create
#define bfd_elf32_bfd_final_link _bfd_mips_elf_final_link
-#define bfd_elf32_bfd_copy_private_bfd_data \
- _bfd_mips_elf_copy_private_bfd_data
#define bfd_elf32_bfd_merge_private_bfd_data \
_bfd_mips_elf_merge_private_bfd_data
#define bfd_elf32_bfd_set_private_flags _bfd_mips_elf_set_private_flags
#define bfd_elf32_bfd_print_private_bfd_data \
_bfd_mips_elf_print_private_bfd_data
+
+/* Support for SGI-ish mips targets. */
+#define TARGET_LITTLE_SYM bfd_elf32_littlemips_vec
+#define TARGET_LITTLE_NAME "elf32-littlemips"
+#define TARGET_BIG_SYM bfd_elf32_bigmips_vec
+#define TARGET_BIG_NAME "elf32-bigmips"
+
+#include "elf32-target.h"
+
+/* Support for traditional mips targets. */
+#define INCLUDED_TARGET_FILE /* More a type of flag. */
+
+#undef TARGET_LITTLE_SYM
+#undef TARGET_LITTLE_NAME
+#undef TARGET_BIG_SYM
+#undef TARGET_BIG_NAME
+
+#define TARGET_LITTLE_SYM bfd_elf32_tradlittlemips_vec
+#define TARGET_LITTLE_NAME "elf32-tradlittlemips"
+#define TARGET_BIG_SYM bfd_elf32_tradbigmips_vec
+#define TARGET_BIG_NAME "elf32-tradbigmips"
+
+/* Include the target file again for this target */
#include "elf32-target.h"
diff --git a/contrib/binutils/bfd/elf32-sparc.c b/contrib/binutils/bfd/elf32-sparc.c
index e944f00..a11db81 100644
--- a/contrib/binutils/bfd/elf32-sparc.c
+++ b/contrib/binutils/bfd/elf32-sparc.c
@@ -1084,6 +1084,17 @@ elf32_sparc_relax_section (abfd, section, link_info, again)
return true;
}
+/* This is the condition under which 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 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))
+
/* Relocate a SPARC ELF section. */
static boolean
@@ -1133,9 +1144,10 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
struct elf_link_hash_entry *h;
Elf_Internal_Sym *sym;
asection *sec;
- bfd_vma relocation;
+ bfd_vma relocation, off;
bfd_reloc_status_type r;
boolean is_plt = false;
+ boolean unresolved_reloc;
r_type = ELF32_R_TYPE (rel->r_info);
@@ -1175,6 +1187,7 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
h = NULL;
sym = NULL;
sec = NULL;
+ unresolved_reloc = false;
if (r_symndx < symtab_hdr->sh_info)
{
sym = local_syms + r_symndx;
@@ -1187,71 +1200,30 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
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;
+
+ relocation = 0;
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_SPARC_WPLT30
- || r_type == R_SPARC_PLT32)
- && h->plt.offset != (bfd_vma) -1)
- || ((r_type == R_SPARC_GOT10
- || r_type == R_SPARC_GOT13
- || r_type == R_SPARC_GOT22)
- && 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_SPARC_8
- || r_type == R_SPARC_16
- || r_type == R_SPARC_32
- || r_type == R_SPARC_DISP8
- || r_type == R_SPARC_DISP16
- || r_type == R_SPARC_DISP32
- || r_type == R_SPARC_WDISP30
- || r_type == R_SPARC_WDISP22
- || r_type == R_SPARC_WDISP19
- || r_type == R_SPARC_WDISP16
- || r_type == R_SPARC_HI22
- || r_type == R_SPARC_22
- || r_type == R_SPARC_13
- || r_type == R_SPARC_LO10
- || r_type == R_SPARC_UA16
- || r_type == R_SPARC_UA32
- || ((r_type == R_SPARC_PC10
- || r_type == R_SPARC_PC22)
- && strcmp (h->root.root.string,
- "_GLOBAL_OFFSET_TABLE_") != 0))
- && ((input_section->flags & SEC_ALLOC) != 0
- /* DWARF will emit R_SPARC_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;
- }
+ if (sec->output_section == NULL)
+ /* 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;
else
relocation = (h->root.u.def.value
+ sec->output_section->vma
+ sec->output_offset);
}
else if (h->root.type == bfd_link_hash_undefweak)
- relocation = 0;
+ ;
else if (info->shared
&& (!info->symbolic || info->allow_shlib_undefined)
&& !info->no_undefined
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
- relocation = 0;
+ ;
else
{
if (! ((*info->callbacks->undefined_symbol)
@@ -1260,7 +1232,6 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
(!info->shared || info->no_undefined
|| ELF_ST_VISIBILITY (h->other)))))
return false;
- relocation = 0;
}
}
@@ -1279,14 +1250,17 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
if (h != NULL)
{
- bfd_vma off;
+ boolean dyn;
off = h->got.offset;
BFD_ASSERT (off != (bfd_vma) -1);
+ dyn = elf_hash_table (info)->dynamic_sections_created;
- if (! elf_hash_table (info)->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
@@ -1310,13 +1284,11 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
h->got.offset |= 1;
}
}
-
- relocation = sgot->output_offset + off - got_base;
+ else
+ unresolved_reloc = false;
}
else
{
- bfd_vma off;
-
BFD_ASSERT (local_got_offsets != NULL
&& local_got_offsets[r_symndx] != (bfd_vma) -1);
@@ -1355,10 +1327,8 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
local_got_offsets[r_symndx] |= 1;
}
-
- relocation = sgot->output_offset + off - got_base;
}
-
+ relocation = sgot->output_offset + off - got_base;
break;
case R_SPARC_PLT32:
@@ -1396,6 +1366,7 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
relocation = (splt->output_section->vma
+ splt->output_offset
+ h->plt.offset);
+ unresolved_reloc = false;
if (r_type == R_SPARC_PLT32)
{
r_type = R_SPARC_32;
@@ -1496,6 +1467,17 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
if (!(outrel.r_offset & 3))
r_type = R_SPARC_32;
break;
+ case R_SPARC_DISP8:
+ case R_SPARC_DISP16:
+ case R_SPARC_DISP32:
+ /* If the symbol is not dynamic, we should not keep
+ a dynamic relocation. But an .rela.* slot has been
+ allocated for it, output R_SPARC_NONE.
+ FIXME: Add code tracking needed dynamic relocs as
+ e.g. i386 has. */
+ if (h->dynindx == -1)
+ skip = true, relocate = true;
+ break;
}
if (skip)
@@ -1582,6 +1564,18 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
break;
}
+ /* ??? Copied from elf32-i386.c, debugging section check and all. */
+ 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_reloc_continue;
if (r_type == R_SPARC_WDISP16)
{
diff --git a/contrib/binutils/bfd/elf32-v850.c b/contrib/binutils/bfd/elf32-v850.c
index 3df0914..ae0a0c4 100644
--- a/contrib/binutils/bfd/elf32-v850.c
+++ b/contrib/binutils/bfd/elf32-v850.c
@@ -27,9 +27,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/v850.h"
+#include "libiberty.h"
-/* sign-extend a 24-bit number */
-#define SEXT24(x) ((((x) & 0xffffff) ^ (~ 0x7fffff)) + 0x800000)
+/* Sign-extend a 24-bit number. */
+#define SEXT24(x) ((((x) & 0xffffff) ^ 0x800000) - 0x800000)
static reloc_howto_type *v850_elf_reloc_type_lookup
PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
@@ -45,7 +46,7 @@ static boolean v850_elf_relocate_section
PARAMS((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
static bfd_reloc_status_type v850_elf_perform_relocation
- PARAMS ((bfd *, int, bfd_vma, bfd_byte *));
+ PARAMS ((bfd *, unsigned int, bfd_vma, bfd_byte *));
static boolean v850_elf_check_relocs
PARAMS ((bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *));
static void remember_hi16s_reloc
@@ -63,14 +64,12 @@ static void v850_elf_final_write_processing
PARAMS ((bfd *, boolean));
static boolean v850_elf_set_private_flags
PARAMS ((bfd *, flagword));
-static boolean v850_elf_copy_private_bfd_data
- PARAMS ((bfd *, bfd *));
static boolean v850_elf_merge_private_bfd_data
PARAMS ((bfd *, bfd *));
static boolean v850_elf_print_private_bfd_data
PARAMS ((bfd *, PTR));
static boolean v850_elf_section_from_bfd_section
- PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *, int *));
+ PARAMS ((bfd *, asection *, int *));
static void v850_elf_symbol_processing
PARAMS ((bfd *, asymbol *));
static boolean v850_elf_add_symbol_hook
@@ -81,9 +80,16 @@ static boolean v850_elf_link_output_symbol_hook
Elf_Internal_Sym *, asection *));
static boolean v850_elf_section_from_shdr
PARAMS ((bfd *, Elf_Internal_Shdr *, char *));
-
-/* Note: It is REQUIRED that the 'type' value of each entry in this array
- match the index of the entry in the array. */
+static boolean v850_elf_gc_sweep_hook
+ PARAMS ((bfd *, struct bfd_link_info *, asection *,
+ const Elf_Internal_Rela *));
+static asection * v850_elf_gc_mark_hook
+ PARAMS ((bfd *, struct bfd_link_info *,
+ Elf_Internal_Rela *, struct elf_link_hash_entry *,
+ Elf_Internal_Sym *));
+
+/* Note: It is REQUIRED that the 'type' value of each entry
+ in this array match the index of the entry in the array. */
static reloc_howto_type v850_elf_howto_table[] =
{
/* This reloc does nothing. */
@@ -470,7 +476,7 @@ struct v850_elf_reloc_map
/* BFD_RELOC_V850_CALLT_16_16_OFFSET is 258, which will not fix in an
unsigned char. */
bfd_reloc_code_real_type bfd_reloc_val;
- unsigned char elf_reloc_val;
+ unsigned int elf_reloc_val;
};
static const struct v850_elf_reloc_map v850_elf_reloc_map[] =
@@ -503,7 +509,8 @@ static const struct v850_elf_reloc_map v850_elf_reloc_map[] =
};
-/* Map a bfd relocation into the appropriate howto structure */
+/* Map a bfd relocation into the appropriate howto structure. */
+
static reloc_howto_type *
v850_elf_reloc_type_lookup (abfd, code)
bfd * abfd ATTRIBUTE_UNUSED;
@@ -511,22 +518,21 @@ v850_elf_reloc_type_lookup (abfd, code)
{
unsigned int i;
- for (i = 0;
- i < sizeof (v850_elf_reloc_map) / sizeof (struct v850_elf_reloc_map);
- i++)
- {
- if (v850_elf_reloc_map[i].bfd_reloc_val == code)
- {
- BFD_ASSERT (v850_elf_howto_table[v850_elf_reloc_map[i].elf_reloc_val].type == v850_elf_reloc_map[i].elf_reloc_val);
+ for (i = ARRAY_SIZE (v850_elf_reloc_map); i --;)
+ if (v850_elf_reloc_map[i].bfd_reloc_val == code)
+ {
+ unsigned int elf_reloc_val = v850_elf_reloc_map[i].elf_reloc_val;
- return & v850_elf_howto_table[v850_elf_reloc_map[i].elf_reloc_val];
- }
- }
+ BFD_ASSERT (v850_elf_howto_table[elf_reloc_val].type == elf_reloc_val);
+
+ return v850_elf_howto_table + elf_reloc_val;
+ }
return NULL;
}
/* Set the howto pointer for an V850 ELF reloc. */
+
static void
v850_elf_info_to_howto_rel (abfd, cache_ptr, dst)
bfd * abfd ATTRIBUTE_UNUSED;
@@ -582,7 +588,7 @@ v850_elf_check_relocs (abfd, info, sec, relocs)
#ifdef DEBUG
fprintf (stderr, "v850_elf_check_relocs called for section %s in %s\n",
bfd_get_section_name (abfd, sec),
- bfd_get_filename (abfd));
+ bfd_archive_filename (abfd));
#endif
dynobj = elf_hash_table (info)->dynobj;
@@ -626,8 +632,8 @@ v850_elf_check_relocs (abfd, info, sec, relocs)
return false;
break;
- /* This relocation describes which C++ vtable entries are actually
- used. Record for later use during GC. */
+ /* This relocation describes which C++ vtable entries
+ are actually used. Record for later use during GC. */
case R_V850_GNU_VTENTRY:
if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_addend))
return false;
@@ -662,7 +668,8 @@ v850_elf_check_relocs (abfd, info, sec, relocs)
small_data_common:
if (h)
{
- h->other |= other; /* flag which type of relocation was used */
+ /* Flag which type of relocation was used. */
+ h->other |= other;
if ((h->other & V850_OTHER_MASK) != (other & V850_OTHER_MASK)
&& (h->other & V850_OTHER_ERROR) == 0)
{
@@ -690,7 +697,8 @@ v850_elf_check_relocs (abfd, info, sec, relocs)
sprintf (buff, msg, h->root.root.string);
info->callbacks->warning (info, buff, h->root.root.string,
- abfd, h->root.u.def.section, 0);
+ abfd, h->root.u.def.section,
+ (bfd_vma) 0);
bfd_set_error (bfd_error_bad_value);
h->other |= V850_OTHER_ERROR;
@@ -702,7 +710,9 @@ v850_elf_check_relocs (abfd, info, sec, relocs)
&& h->root.u.c.p
&& !strcmp (bfd_get_section_name (abfd, h->root.u.c.p->section), "COMMON"))
{
- asection *section = h->root.u.c.p->section = bfd_make_section_old_way (abfd, common);
+ asection * section;
+
+ section = h->root.u.c.p->section = bfd_make_section_old_way (abfd, common);
section->flags |= SEC_IS_COMMON;
}
@@ -719,20 +729,18 @@ v850_elf_check_relocs (abfd, info, sec, relocs)
return ret;
}
-/*
- * In the old version, when an entry was checked out from the table,
- * it was deleted. This produced an error if the entry was needed
- * more than once, as the second attempted retry failed.
- *
- * In the current version, the entry is not deleted, instead we set
- * the field 'found' to true. If a second lookup matches the same
- * entry, then we know that the hi16s reloc has already been updated
- * and does not need to be updated a second time.
- *
- * TODO - TOFIX: If it is possible that we need to restore 2 different
- * addresses from the same table entry, where the first generates an
- * overflow, whilst the second do not, then this code will fail.
- */
+/* In the old version, when an entry was checked out from the table,
+ it was deleted. This produced an error if the entry was needed
+ more than once, as the second attempted retry failed.
+
+ In the current version, the entry is not deleted, instead we set
+ the field 'found' to true. If a second lookup matches the same
+ entry, then we know that the hi16s reloc has already been updated
+ and does not need to be updated a second time.
+
+ TODO - TOFIX: If it is possible that we need to restore 2 different
+ addresses from the same table entry, where the first generates an
+ overflow, whilst the second do not, then this code will fail. */
typedef struct hi16s_location
{
@@ -755,10 +763,11 @@ remember_hi16s_reloc (abfd, addend, address)
bfd_byte * address;
{
hi16s_location * entry = NULL;
+ bfd_size_type amt = sizeof (* free_hi16s);
/* Find a free structure. */
if (free_hi16s == NULL)
- free_hi16s = (hi16s_location *) bfd_zalloc (abfd, sizeof (* free_hi16s));
+ free_hi16s = (hi16s_location *) bfd_zalloc (abfd, amt);
entry = free_hi16s;
free_hi16s = free_hi16s->next;
@@ -825,12 +834,13 @@ find_remembered_hi16s_reloc (addend, already_found)
/* FIXME: The code here probably ought to be removed and the code in reloc.c
allowed to do its stuff instead. At least for most of the relocs, anwyay. */
+
static bfd_reloc_status_type
v850_elf_perform_relocation (abfd, r_type, addend, address)
- bfd * abfd;
- int r_type;
- bfd_vma addend;
- bfd_byte * address;
+ bfd *abfd;
+ unsigned int r_type;
+ bfd_vma addend;
+ bfd_byte *address;
{
unsigned long insn;
bfd_signed_vma saddend = (bfd_signed_vma) addend;
@@ -855,7 +865,7 @@ v850_elf_perform_relocation (abfd, r_type, addend, address)
insn = bfd_get_32 (abfd, address);
insn &= ~0xfffe003f;
insn |= (((addend & 0xfffe) << 16) | ((addend & 0x3f0000) >> 16));
- bfd_put_32 (abfd, insn, address);
+ bfd_put_32 (abfd, (bfd_vma) insn, address);
return bfd_reloc_ok;
case R_V850_9_PCREL:
@@ -1029,9 +1039,7 @@ v850_elf_perform_relocation (abfd, r_type, addend, address)
0x00000000
+ 0x00006fff (bit 15 not set, so the top half is zero)
------------
- 0x00006fff which is wrong (assuming that fred is at 0xffff)
- */
-
+ 0x00006fff which is wrong (assuming that fred is at 0xffff). */
{
long result;
@@ -1056,7 +1064,7 @@ v850_elf_perform_relocation (abfd, r_type, addend, address)
{
insn = bfd_get_16 (abfd, hi16s_address);
insn += 1;
- bfd_put_16 (abfd, insn, hi16s_address);
+ bfd_put_16 (abfd, (bfd_vma) insn, hi16s_address);
}
}
else
@@ -1122,7 +1130,7 @@ v850_elf_perform_relocation (abfd, r_type, addend, address)
if (addend & 1)
return bfd_reloc_dangerous;
- insn = (addend & ~1) | (insn & 1);
+ insn = (addend &~ (bfd_vma) 1) | (insn & 1);
break;
case R_V850_TDA_6_8_OFFSET:
@@ -1211,9 +1219,9 @@ v850_elf_perform_relocation (abfd, r_type, addend, address)
insn &= 0x0001ffdf;
insn |= (addend & 1) << 5;
- insn |= (addend & ~1) << 16;
+ insn |= (addend &~ (bfd_vma) 1) << 16;
- bfd_put_32 (abfd, insn, address);
+ bfd_put_32 (abfd, (bfd_vma) insn, address);
return bfd_reloc_ok;
case R_V850_CALLT_6_7_OFFSET:
@@ -1238,11 +1246,12 @@ v850_elf_perform_relocation (abfd, r_type, addend, address)
}
- bfd_put_16 (abfd, insn, address);
+ bfd_put_16 (abfd, (bfd_vma) insn, address);
return bfd_reloc_ok;
}
/* Insert the addend into the instruction. */
+
static bfd_reloc_status_type
v850_elf_reloc (abfd, reloc, symbol, data, isection, obfd, err)
bfd * abfd ATTRIBUTE_UNUSED;
@@ -1258,7 +1267,7 @@ v850_elf_reloc (abfd, reloc, symbol, data, isection, obfd, err)
/* If there is an output BFD,
and the symbol is not a section name (which is only defined at final link time),
and either we are not putting the addend into the instruction
- or the addend is zero, so there is nothing to add into the instruction
+ or the addend is zero, so there is nothing to add into the instruction
then just fixup the address and return. */
if (obfd != (bfd *) NULL
&& (symbol->flags & BSF_SECTION_SYM) == 0
@@ -1270,9 +1279,7 @@ v850_elf_reloc (abfd, reloc, symbol, data, isection, obfd, err)
}
#if 0
else if (obfd != NULL)
- {
- return bfd_reloc_continue;
- }
+ return bfd_reloc_continue;
#endif
/* Catch relocs involving undefined symbols. */
@@ -1308,21 +1315,20 @@ v850_elf_reloc (abfd, reloc, symbol, data, isection, obfd, err)
.text
.globl _start
nop
- _start:
+ _start:
jr foo
.section ".foo","ax"
nop
foo:
- nop
- */
+ nop */
if (reloc->howto->pc_relative == true)
{
/* Here the variable relocation holds the final address of the
symbol we are relocating against, plus any addend. */
relocation -= isection->output_section->vma + isection->output_offset;
- /* Deal with pcrel_offset */
+ /* Deal with pcrel_offset. */
relocation -= reloc->address;
}
#endif
@@ -1340,6 +1346,7 @@ v850_elf_is_local_label_name (abfd, name)
}
/* Perform a relocation as part of a final link. */
+
static bfd_reloc_status_type
v850_elf_final_link_relocate (howto, input_bfd, output_bfd,
input_section, contents, offset, value,
@@ -1356,7 +1363,7 @@ v850_elf_final_link_relocate (howto, input_bfd, output_bfd,
asection * sym_sec;
int is_local ATTRIBUTE_UNUSED;
{
- unsigned long r_type = howto->type;
+ unsigned int r_type = howto->type;
bfd_byte * hit_data = contents + offset;
/* Adjust the value according to the relocation. */
@@ -1377,7 +1384,8 @@ v850_elf_final_link_relocate (howto, input_bfd, output_bfd,
if (((value & 0xff000000) != 0x0) && ((value & 0xff000000) != 0xff000000))
return bfd_reloc_overflow;
- value = SEXT24 (value); /* Only the bottom 24 bits of the PC are valid */
+ /* Only the bottom 24 bits of the PC are valid */
+ value = SEXT24 (value);
break;
case R_V850_HI16_S:
@@ -1436,7 +1444,8 @@ v850_elf_final_link_relocate (howto, input_bfd, output_bfd,
h = bfd_link_hash_lookup (info->hash, "__ep", false, false, true);
if (h == (struct bfd_link_hash_entry *) NULL
|| h->type != bfd_link_hash_defined)
- return bfd_reloc_continue; /* Actually this indicates that __ep could not be found. */
+ /* Actually this indicates that __ep could not be found. */
+ return bfd_reloc_continue;
ep = (h->u.def.value
+ h->u.def.section->output_section->vma
@@ -1455,7 +1464,8 @@ v850_elf_final_link_relocate (howto, input_bfd, output_bfd,
h = bfd_link_hash_lookup (info->hash, "__ctbp", false, false, true);
if (h == (struct bfd_link_hash_entry *) NULL
|| h->type != bfd_link_hash_defined)
- return (bfd_reloc_dangerous + 1); /* Actually this indicates that __ctbp could not be found. */
+ /* Actually this indicates that __ctbp could not be found. */
+ return bfd_reloc_dangerous + 1;
ctbp = (h->u.def.value
+ h->u.def.section->output_section->vma
@@ -1501,6 +1511,7 @@ v850_elf_final_link_relocate (howto, input_bfd, output_bfd,
}
/* Relocate an V850 ELF section. */
+
static boolean
v850_elf_relocate_section (output_bfd, info, input_bfd, input_section,
contents, relocs, local_syms, local_sections)
@@ -1524,7 +1535,8 @@ v850_elf_relocate_section (output_bfd, info, input_bfd, input_section,
if (sym_hashes == NULL)
{
info->callbacks->warning
- (info, "no hash table available", NULL, input_bfd, input_section, 0);
+ (info, "no hash table available",
+ NULL, input_bfd, input_section, (bfd_vma) 0);
return false;
}
@@ -1583,17 +1595,16 @@ v850_elf_relocate_section (output_bfd, info, input_bfd, input_section,
{
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
- relocation = (sec->output_section->vma
- + sec->output_offset
- + sym->st_value);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
#if 0
{
char * name;
+
name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name);
name = (name == NULL) ? "<none>" : name;
-fprintf (stderr, "local: sec: %s, sym: %s (%d), value: %x + %x + %x addend %x\n",
- sec->name, name, sym->st_name,
- sec->output_section->vma, sec->output_offset, sym->st_value, rel->r_addend);
+ fprintf (stderr, "local: sec: %s, sym: %s (%d), value: %x + %x + %x addend %x\n",
+ sec->name, name, sym->st_name,
+ sec->output_section->vma, sec->output_offset, sym->st_value, rel->r_addend);
}
#endif
}
@@ -1613,15 +1624,15 @@ fprintf (stderr, "local: sec: %s, sym: %s (%d), value: %x + %x + %x addend %x\n"
+ sec->output_section->vma
+ sec->output_offset);
#if 0
-fprintf (stderr, "defined: sec: %s, name: %s, value: %x + %x + %x gives: %x\n",
- sec->name, h->root.root.string, h->root.u.def.value, sec->output_section->vma, sec->output_offset, relocation);
+ fprintf (stderr, "defined: sec: %s, name: %s, value: %x + %x + %x gives: %x\n",
+ sec->name, h->root.root.string, h->root.u.def.value, sec->output_section->vma, sec->output_offset, relocation);
#endif
}
else if (h->root.type == bfd_link_hash_undefweak)
{
#if 0
-fprintf (stderr, "undefined: sec: %s, name: %s\n",
- sec->name, h->root.root.string);
+ fprintf (stderr, "undefined: sec: %s, name: %s\n",
+ sec->name, h->root.root.string);
#endif
relocation = 0;
}
@@ -1632,14 +1643,13 @@ fprintf (stderr, "undefined: sec: %s, name: %s\n",
input_section, rel->r_offset, true)))
return false;
#if 0
-fprintf (stderr, "unknown: name: %s\n", h->root.root.string);
+ fprintf (stderr, "unknown: name: %s\n", h->root.root.string);
#endif
relocation = 0;
}
}
- /* FIXME: We should use the addend, but the COFF relocations
- don't. */
+ /* FIXME: We should use the addend, but the COFF relocations don't. */
r = v850_elf_final_link_relocate (howto, input_bfd, output_bfd,
input_section,
contents, rel->r_offset,
@@ -1725,7 +1735,7 @@ v850_elf_gc_sweep_hook (abfd, info, sec, relocs)
asection *sec ATTRIBUTE_UNUSED;
const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED;
{
- /* No got and plt entries for v850-elf */
+ /* No got and plt entries for v850-elf. */
return true;
}
@@ -1762,17 +1772,14 @@ v850_elf_gc_mark_hook (abfd, info, rel, h, sym)
}
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 bfd_section_from_elf_index (abfd, sym->st_shndx);
+ }
+
return NULL;
}
+
/* Set the right machine number. */
+
static boolean
v850_elf_object_p (abfd)
bfd *abfd;
@@ -1788,6 +1795,7 @@ v850_elf_object_p (abfd)
}
/* Store the machine number in the flags field. */
+
static void
v850_elf_final_write_processing (abfd, linker)
bfd * abfd;
@@ -1808,6 +1816,7 @@ v850_elf_final_write_processing (abfd, linker)
}
/* Function to keep V850 specific file flags. */
+
static boolean
v850_elf_set_private_flags (abfd, flags)
bfd * abfd;
@@ -1821,28 +1830,8 @@ v850_elf_set_private_flags (abfd, flags)
return true;
}
-/* Copy backend specific data from one object module to another */
-static boolean
-v850_elf_copy_private_bfd_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_gp (obfd) = elf_gp (ibfd);
- elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags;
- elf_flags_init (obfd) = true;
- return true;
-}
-
-/* Merge backend specific data from an object file to the output
- object file when linking. */
+/* Merge backend specific data from an object file
+ to the output object file when linking. */
static boolean
v850_elf_merge_private_bfd_data (ibfd, obfd)
bfd * ibfd;
@@ -1874,9 +1863,7 @@ v850_elf_merge_private_bfd_data (ibfd, obfd)
if (bfd_get_arch (obfd) == bfd_get_arch (ibfd)
&& bfd_get_arch_info (obfd)->the_default)
- {
- return bfd_set_arch_mach (obfd, bfd_get_arch (ibfd), bfd_get_mach (ibfd));
- }
+ return bfd_set_arch_mach (obfd, bfd_get_arch (ibfd), bfd_get_mach (ibfd));
return true;
}
@@ -1888,11 +1875,12 @@ v850_elf_merge_private_bfd_data (ibfd, obfd)
if ((in_flags & EF_V850_ARCH) != (out_flags & EF_V850_ARCH)
&& (in_flags & EF_V850_ARCH) != E_V850_ARCH)
_bfd_error_handler (_("%s: Architecture mismatch with previous modules"),
- bfd_get_filename (ibfd));
+ bfd_archive_filename (ibfd));
return true;
}
-/* Display the flags field */
+
+/* Display the flags field. */
static boolean
v850_elf_print_private_bfd_data (abfd, ptr)
@@ -1938,13 +1926,12 @@ static asection v850_elf_zcom_section;
static asymbol v850_elf_zcom_symbol;
static asymbol * v850_elf_zcom_symbol_ptr;
-/* Given a BFD section, try to locate the corresponding ELF section
- index. */
+/* Given a BFD section, try to locate the
+ corresponding ELF section index. */
static boolean
-v850_elf_section_from_bfd_section (abfd, hdr, sec, retval)
+v850_elf_section_from_bfd_section (abfd, sec, retval)
bfd * abfd ATTRIBUTE_UNUSED;
- Elf32_Internal_Shdr * hdr ATTRIBUTE_UNUSED;
asection * sec;
int * retval;
{
@@ -1968,9 +1955,9 @@ v850_elf_symbol_processing (abfd, asym)
asymbol * asym;
{
elf_symbol_type * elfsym = (elf_symbol_type *) asym;
- unsigned short index;
+ unsigned int indx;
- index = elfsym->internal_elf_sym.st_shndx;
+ indx = elfsym->internal_elf_sym.st_shndx;
/* If the section index is an "ordinary" index, then it may
refer to a v850 specific section created by the assembler.
@@ -1978,26 +1965,26 @@ v850_elf_symbol_processing (abfd, asym)
FIXME: Should we alter the st_shndx field as well ? */
- if (index < elf_elfheader(abfd)[0].e_shnum)
- switch (elf_elfsections(abfd)[index]->sh_type)
+ if (indx < elf_numsections (abfd))
+ switch (elf_elfsections(abfd)[indx]->sh_type)
{
case SHT_V850_SCOMMON:
- index = SHN_V850_SCOMMON;
+ indx = SHN_V850_SCOMMON;
break;
case SHT_V850_TCOMMON:
- index = SHN_V850_TCOMMON;
+ indx = SHN_V850_TCOMMON;
break;
case SHT_V850_ZCOMMON:
- index = SHN_V850_ZCOMMON;
+ indx = SHN_V850_ZCOMMON;
break;
default:
break;
}
- switch (index)
+ switch (indx)
{
case SHN_V850_SCOMMON:
if (v850_elf_scom_section.name == NULL)
@@ -2068,7 +2055,7 @@ v850_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
asection ** secp;
bfd_vma * valp;
{
- int index = sym->st_shndx;
+ unsigned int indx = sym->st_shndx;
/* If the section index is an "ordinary" index, then it may
refer to a v850 specific section created by the assembler.
@@ -2076,26 +2063,26 @@ v850_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
FIXME: Should we alter the st_shndx field as well ? */
- if (index < elf_elfheader(abfd)[0].e_shnum)
- switch (elf_elfsections(abfd)[index]->sh_type)
+ if (indx < elf_numsections (abfd))
+ switch (elf_elfsections(abfd)[indx]->sh_type)
{
case SHT_V850_SCOMMON:
- index = SHN_V850_SCOMMON;
+ indx = SHN_V850_SCOMMON;
break;
case SHT_V850_TCOMMON:
- index = SHN_V850_TCOMMON;
+ indx = SHN_V850_TCOMMON;
break;
case SHT_V850_ZCOMMON:
- index = SHN_V850_ZCOMMON;
+ indx = SHN_V850_ZCOMMON;
break;
default:
break;
}
- switch (index)
+ switch (indx)
{
case SHN_V850_SCOMMON:
*secp = bfd_make_section_old_way (abfd, ".scommon");
@@ -2119,7 +2106,6 @@ v850_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
return true;
}
-/*ARGSIGNORED*/
static boolean
v850_elf_link_output_symbol_hook (abfd, info, name, sym, input_sec)
bfd * abfd ATTRIBUTE_UNUSED;
@@ -2173,8 +2159,9 @@ v850_elf_section_from_shdr (abfd, hdr, name)
return true;
}
-/* Set the correct type for a V850 ELF section. We do this by the
- section name, which is a hack, but ought to work. */
+/* Set the correct type for a V850 ELF section. We do this
+ by the section name, which is a hack, but ought to work. */
+
static boolean
v850_elf_fake_sections (abfd, hdr, sec)
bfd * abfd ATTRIBUTE_UNUSED;
@@ -2202,7 +2189,8 @@ v850_elf_fake_sections (abfd, hdr, sec)
#define TARGET_LITTLE_SYM bfd_elf32_v850_vec
#define TARGET_LITTLE_NAME "elf32-v850"
#define ELF_ARCH bfd_arch_v850
-#define ELF_MACHINE_CODE EM_CYGNUS_V850
+#define ELF_MACHINE_CODE EM_V850
+#define ELF_MACHINE_ALT1 EM_CYGNUS_V850
#define ELF_MAXPAGESIZE 0x1000
#define elf_info_to_howto v850_elf_info_to_howto_rela
@@ -2225,7 +2213,6 @@ v850_elf_fake_sections (abfd, hdr, sec)
#define bfd_elf32_bfd_is_local_label_name v850_elf_is_local_label_name
#define bfd_elf32_bfd_reloc_type_lookup v850_elf_reloc_type_lookup
-#define bfd_elf32_bfd_copy_private_bfd_data v850_elf_copy_private_bfd_data
#define bfd_elf32_bfd_merge_private_bfd_data v850_elf_merge_private_bfd_data
#define bfd_elf32_bfd_set_private_flags v850_elf_set_private_flags
#define bfd_elf32_bfd_print_private_bfd_data v850_elf_print_private_bfd_data
diff --git a/contrib/binutils/bfd/elf64-alpha.c b/contrib/binutils/bfd/elf64-alpha.c
index ae19873..550de53 100644
--- a/contrib/binutils/bfd/elf64-alpha.c
+++ b/contrib/binutils/bfd/elf64-alpha.c
@@ -2120,18 +2120,21 @@ elf64_alpha_output_extsym (h, data)
boolean strip;
asection *sec, *output_section;
+ if (h->root.root.type == bfd_link_hash_warning)
+ h = (struct alpha_elf_link_hash_entry *) h->root.root.u.i.link;
+
if (h->root.indx == -2)
strip = false;
else if (((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- || (h->root.elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0)
- && (h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
- && (h->root.elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0)
+ || (h->root.elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0)
+ && (h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
+ && (h->root.elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0)
strip = true;
else if (einfo->info->strip == strip_all
- || (einfo->info->strip == strip_some
- && bfd_hash_lookup (einfo->info->keep_hash,
- h->root.root.root.string,
- false, false) == NULL))
+ || (einfo->info->strip == strip_some
+ && bfd_hash_lookup (einfo->info->keep_hash,
+ h->root.root.root.string,
+ false, false) == NULL))
strip = true;
else
strip = false;
@@ -2150,44 +2153,44 @@ elf64_alpha_output_extsym (h, data)
h->esym.asym.st = stGlobal;
if (h->root.root.type != bfd_link_hash_defined
- && h->root.root.type != bfd_link_hash_defweak)
- h->esym.asym.sc = scAbs;
+ && h->root.root.type != bfd_link_hash_defweak)
+ h->esym.asym.sc = scAbs;
else
- {
- const char *name;
-
- sec = h->root.root.u.def.section;
- output_section = sec->output_section;
-
- /* When making a shared library and symbol h is the one from
- the another shared library, OUTPUT_SECTION may be null. */
- if (output_section == NULL)
- h->esym.asym.sc = scUndefined;
- else
- {
- name = bfd_section_name (output_section->owner, output_section);
-
- if (strcmp (name, ".text") == 0)
- h->esym.asym.sc = scText;
- else if (strcmp (name, ".data") == 0)
- h->esym.asym.sc = scData;
- else if (strcmp (name, ".sdata") == 0)
- h->esym.asym.sc = scSData;
- else if (strcmp (name, ".rodata") == 0
- || strcmp (name, ".rdata") == 0)
- h->esym.asym.sc = scRData;
- else if (strcmp (name, ".bss") == 0)
- h->esym.asym.sc = scBss;
- else if (strcmp (name, ".sbss") == 0)
- h->esym.asym.sc = scSBss;
- else if (strcmp (name, ".init") == 0)
- h->esym.asym.sc = scInit;
- else if (strcmp (name, ".fini") == 0)
- h->esym.asym.sc = scFini;
- else
- h->esym.asym.sc = scAbs;
- }
- }
+ {
+ const char *name;
+
+ sec = h->root.root.u.def.section;
+ output_section = sec->output_section;
+
+ /* When making a shared library and symbol h is the one from
+ the another shared library, OUTPUT_SECTION may be null. */
+ if (output_section == NULL)
+ h->esym.asym.sc = scUndefined;
+ else
+ {
+ name = bfd_section_name (output_section->owner, output_section);
+
+ if (strcmp (name, ".text") == 0)
+ h->esym.asym.sc = scText;
+ else if (strcmp (name, ".data") == 0)
+ h->esym.asym.sc = scData;
+ else if (strcmp (name, ".sdata") == 0)
+ h->esym.asym.sc = scSData;
+ else if (strcmp (name, ".rodata") == 0
+ || strcmp (name, ".rdata") == 0)
+ h->esym.asym.sc = scRData;
+ else if (strcmp (name, ".bss") == 0)
+ h->esym.asym.sc = scBss;
+ else if (strcmp (name, ".sbss") == 0)
+ h->esym.asym.sc = scSBss;
+ else if (strcmp (name, ".init") == 0)
+ h->esym.asym.sc = scInit;
+ else if (strcmp (name, ".fini") == 0)
+ h->esym.asym.sc = scFini;
+ else
+ h->esym.asym.sc = scAbs;
+ }
+ }
h->esym.asym.reserved = 0;
h->esym.asym.index = indexNil;
@@ -2199,18 +2202,18 @@ elf64_alpha_output_extsym (h, data)
|| h->root.root.type == bfd_link_hash_defweak)
{
if (h->esym.asym.sc == scCommon)
- h->esym.asym.sc = scBss;
+ h->esym.asym.sc = scBss;
else if (h->esym.asym.sc == scSCommon)
- h->esym.asym.sc = scSBss;
+ h->esym.asym.sc = scSBss;
sec = h->root.root.u.def.section;
output_section = sec->output_section;
if (output_section != NULL)
- h->esym.asym.value = (h->root.root.u.def.value
- + sec->output_offset
- + output_section->vma);
+ h->esym.asym.value = (h->root.root.u.def.value
+ + sec->output_offset
+ + output_section->vma);
else
- h->esym.asym.value = 0;
+ h->esym.asym.value = 0;
}
else if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
{
@@ -2232,8 +2235,8 @@ elf64_alpha_output_extsym (h, data)
}
if (! bfd_ecoff_debug_one_external (einfo->abfd, einfo->debug, einfo->swap,
- h->root.root.root.string,
- &h->esym))
+ h->root.root.root.string,
+ &h->esym))
{
einfo->failed = true;
return false;
@@ -2861,6 +2864,9 @@ elf64_alpha_calc_got_offsets_for_symbol (h, arg)
{
struct alpha_elf_got_entry *gotent;
+ if (h->root.root.type == bfd_link_hash_warning)
+ h = (struct alpha_elf_link_hash_entry *) h->root.root.u.i.link;
+
for (gotent = h->got_entries; gotent; gotent = gotent->next)
if (gotent->use_count > 0)
{
@@ -3038,6 +3044,9 @@ elf64_alpha_calc_dynrel_sizes (h, info)
struct alpha_elf_link_hash_entry *h;
struct bfd_link_info *info;
{
+ if (h->root.root.type == bfd_link_hash_warning)
+ h = (struct alpha_elf_link_hash_entry *) h->root.root.u.i.link;
+
/* If the symbol was defined as a common symbol in a regular object
file, and there was no definition in any dynamic object, then the
linker will have allocated space for the symbol in a common
diff --git a/contrib/binutils/bfd/elf64-mips.c b/contrib/binutils/bfd/elf64-mips.c
index 6fc0dcd..f2f5dcbc 100644
--- a/contrib/binutils/bfd/elf64-mips.c
+++ b/contrib/binutils/bfd/elf64-mips.c
@@ -1,5 +1,6 @@
/* MIPS-specific support for 64-bit ELF
- Copyright 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Free Software Foundation, Inc.
Ian Lance Taylor, Cygnus Support
Linker support added by Mark Mitchell, CodeSourcery, LLC.
<mark@codesourcery.com>
@@ -24,9 +25,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
The MIPS 64-bit ELF ABI uses an unusual reloc format. This file
overrides the usual ELF reloc handling, and handles reading and
- writing the relocations here.
-
- The MIPS 64-bit ELF ABI also uses an unusual archive map format. */
+ writing the relocations here. */
+
+/* TODO: Many things are unsupported, even if there is some code for it
+ . (which was mostly stolen from elf32-mips.c and slightly adapted).
+ .
+ . - Relocation handling for REL relocs is wrong in many cases and
+ . generally untested.
+ . - Relocation handling for RELA relocs related to GOT support are
+ . also likely to be wrong.
+ . - Support for MIPS16 is only partially implemented.
+ . - Embedded PIC is only partially implemented (is it needed?).
+ . - Combined relocs with RSS_* entries are unsupported.
+ . - The whole GOT handling for NewABI is missing, some parts of
+ . the OldABI version is still lying around and shold be removed.
+ */
#include "bfd.h"
#include "sysdep.h"
@@ -45,9 +58,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "coff/ecoff.h"
/* The 64 bit versions of the mdebug data structures are in alpha.h. */
#include "coff/alpha.h"
-#define ECOFF_64
+#define ECOFF_SIGNED_64
#include "ecoffswap.h"
+struct mips_elf64_link_hash_entry;
+
static void mips_elf64_swap_reloc_in
PARAMS ((bfd *, const Elf64_Mips_External_Rel *,
Elf64_Mips_Internal_Rel *));
@@ -68,17 +83,152 @@ static void mips_elf64_be_swap_reloca_in
PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));
static void mips_elf64_be_swap_reloca_out
PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
+static bfd_vma mips_elf64_high PARAMS ((bfd_vma));
+static bfd_vma mips_elf64_higher PARAMS ((bfd_vma));
+static bfd_vma mips_elf64_highest PARAMS ((bfd_vma));
static reloc_howto_type *mips_elf64_reloc_type_lookup
PARAMS ((bfd *, bfd_reloc_code_real_type));
+static void mips_elf64_info_to_howto_rel
+ PARAMS ((bfd *, arelent *, Elf64_Internal_Rel *));
+static void mips_elf64_info_to_howto_rela
+ PARAMS ((bfd *, arelent *, Elf64_Internal_Rela *));
static long mips_elf64_get_reloc_upper_bound PARAMS ((bfd *, asection *));
static boolean mips_elf64_slurp_one_reloc_table
PARAMS ((bfd *, asection *, asymbol **, const Elf_Internal_Shdr *));
static boolean mips_elf64_slurp_reloc_table
PARAMS ((bfd *, asection *, asymbol **, boolean));
static void mips_elf64_write_relocs PARAMS ((bfd *, asection *, PTR));
-static boolean mips_elf64_slurp_armap PARAMS ((bfd *));
-static boolean mips_elf64_write_armap
- PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
+static void mips_elf64_write_rel
+ PARAMS((bfd *, asection *, Elf_Internal_Shdr *, int *, PTR));
+static void mips_elf64_write_rela
+ PARAMS((bfd *, asection *, Elf_Internal_Shdr *, int *, PTR));
+static struct bfd_hash_entry *mips_elf64_link_hash_newfunc
+ PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
+static bfd_reloc_status_type mips_elf64_hi16_reloc
+ PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static bfd_reloc_status_type mips_elf64_higher_reloc
+ PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static bfd_reloc_status_type mips_elf64_highest_reloc
+ PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static bfd_reloc_status_type mips_elf64_gprel16_reloc
+ PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static bfd_reloc_status_type mips_elf64_gprel16_reloca
+ PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static bfd_reloc_status_type mips_elf64_literal_reloc
+ PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static bfd_reloc_status_type mips_elf64_gprel32_reloc
+ PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static bfd_reloc_status_type mips_elf64_shift6_reloc
+ PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static bfd_reloc_status_type mips_elf64_got16_reloc
+ PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static boolean mips_elf64_assign_gp PARAMS ((bfd *, bfd_vma *));
+static bfd_reloc_status_type mips_elf64_final_gp
+ PARAMS ((bfd *, asymbol *, boolean, char **, bfd_vma *));
+static bfd_reloc_status_type gprel16_with_gp
+ PARAMS ((bfd *, asymbol *, arelent *, asection *, boolean, PTR, bfd_vma));
+static int mips_elf64_additional_program_headers PARAMS ((bfd *));
+static struct bfd_link_hash_table *mips_elf64_link_hash_table_create
+ PARAMS((bfd *));
+static bfd_vma mips_elf64_got_offset_from_index
+ PARAMS ((bfd *, bfd *, bfd_vma));
+static struct mips_elf64_got_info *_mips_elf64_got_info
+ PARAMS ((bfd *, asection **));
+static bfd_vma mips_elf64_sign_extend PARAMS ((bfd_vma, int));
+static boolean mips_elf64_overflow_p PARAMS ((bfd_vma, int));
+static bfd_vma mips_elf64_global_got_index
+ PARAMS ((bfd *, struct elf_link_hash_entry *));
+static boolean mips_elf64_sort_hash_table_f
+ PARAMS ((struct mips_elf64_link_hash_entry *, PTR));
+static boolean mips_elf64_sort_hash_table
+ PARAMS ((struct bfd_link_info *, unsigned long));
+static void mips_elf64_swap_msym_out
+ PARAMS ((bfd *, const Elf32_Internal_Msym *, Elf32_External_Msym *));
+static bfd_vma mips_elf64_create_local_got_entry
+ PARAMS ((bfd *abfd, struct mips_elf64_got_info *, asection *,
+ bfd_vma value));
+static bfd_vma mips_elf64_local_got_index
+ PARAMS ((bfd *, struct bfd_link_info *, bfd_vma));
+static bfd_vma mips_elf64_got_page
+ PARAMS ((bfd *, struct bfd_link_info *, bfd_vma, bfd_vma *));
+static bfd_vma mips_elf64_got16_entry
+ PARAMS ((bfd *, struct bfd_link_info *, bfd_vma, boolean));
+static boolean mips_elf64_local_relocation_p
+ PARAMS ((bfd *, const Elf_Internal_Rela *, asection **, boolean));
+static const Elf_Internal_Rela *mips_elf64_next_relocation
+ PARAMS ((unsigned int, const Elf_Internal_Rela *,
+ const Elf_Internal_Rela *));
+static boolean mips_elf64_create_dynamic_relocation
+ PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Rela *,
+ struct mips_elf64_link_hash_entry *, asection *, bfd_vma,
+ bfd_vma *, asection *));
+static bfd_reloc_status_type mips_elf64_calculate_relocation
+ PARAMS ((bfd *, bfd *, asection *, struct bfd_link_info *,
+ const Elf_Internal_Rela *, bfd_vma, reloc_howto_type *,
+ Elf_Internal_Sym *, asection **, bfd_vma *, const char **,
+ boolean *));
+static bfd_vma mips_elf64_obtain_contents
+ PARAMS ((reloc_howto_type *, const Elf_Internal_Rela *, bfd *, bfd_byte *));
+static boolean mips_elf64_perform_relocation
+ PARAMS ((struct bfd_link_info *, reloc_howto_type *,
+ const Elf_Internal_Rela *, bfd_vma,
+ bfd *, asection *, bfd_byte *, boolean));
+static boolean mips_elf64_relocate_section
+ PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
+ Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
+boolean mips_elf64_create_dynamic_sections
+ PARAMS ((bfd *, struct bfd_link_info *));
+boolean mips_elf64_adjust_dynamic_symbol
+ PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *h));
+boolean mips_elf64_always_size_sections
+ PARAMS ((bfd *, struct bfd_link_info *));
+static boolean mips_elf64_check_mips16_stubs
+ PARAMS ((struct mips_elf64_link_hash_entry *, PTR));
+boolean mips_elf64_size_dynamic_sections
+ PARAMS ((bfd *, struct bfd_link_info *));
+boolean mips_elf64_finish_dynamic_symbol
+ PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
+ Elf_Internal_Sym *));
+boolean mips_elf64_finish_dynamic_sections
+ PARAMS ((bfd *, struct bfd_link_info *info));
+asection *mips_elf64_gc_mark_hook
+ PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *,
+ struct elf_link_hash_entry *, Elf_Internal_Sym *));
+boolean mips_elf64_gc_sweep_hook
+ PARAMS ((bfd *, struct bfd_link_info *, asection *,
+ const Elf_Internal_Rela *));
+static boolean mips_elf64_create_got_section
+ PARAMS ((bfd *, struct bfd_link_info *));
+static boolean mips_elf64_record_global_got_symbol
+ PARAMS ((struct elf_link_hash_entry *, struct bfd_link_info *,
+ struct mips_elf64_got_info *));
+static asection *mips_elf64_create_msym_section PARAMS((bfd *));
+static void mips_elf64_allocate_dynamic_relocations
+ PARAMS ((bfd *, unsigned int));
+static boolean mips_elf64_stub_section_p PARAMS ((bfd *, asection *));
+boolean mips_elf64_check_relocs
+ PARAMS ((bfd *, struct bfd_link_info *, asection *,
+ const Elf_Internal_Rela *));
+static boolean mips_elf64_output_extsym
+ PARAMS ((struct mips_elf64_link_hash_entry *, PTR));
+static void mips_elf64_swap_gptab_in
+ PARAMS ((bfd *, const Elf32_External_gptab *, Elf32_gptab *));
+static void mips_elf64_swap_gptab_out
+ PARAMS ((bfd *, const Elf32_gptab *, Elf32_External_gptab *));
+static int gptab_compare PARAMS ((const PTR, const PTR));
+boolean mips_elf64_final_link PARAMS ((bfd *, struct bfd_link_info *));
+
+extern const bfd_target bfd_elf64_bigmips_vec;
+extern const bfd_target bfd_elf64_littlemips_vec;
+
+static bfd_vma prev_reloc_addend = 0;
+static bfd_size_type prev_reloc_address = 0;
+
+/* Whether we are trying to be compatible with IRIX6 (or little endianers
+ which are otherwise IRIX-ABI compliant). */
+#define SGI_COMPAT(abfd) \
+ ((abfd->xvec == &bfd_elf64_bigmips_vec) \
+ || (abfd->xvec == &bfd_elf64_littlemips_vec) ? true : false)
/* In case we're on a 32-bit machine, construct a 64-bit "-1" value
from smaller values. Start with zero, widen, *then* decrement. */
@@ -87,8 +237,18 @@ static boolean mips_elf64_write_armap
/* The number of local .got entries we reserve. */
#define MIPS_RESERVED_GOTNO (2)
+/* Instructions which appear in a stub. */
+#define ELF_MIPS_GP_OFFSET(abfd) 0x7ff0
+#define STUB_LW 0xdf998010 /* ld t9,0x8010(gp) */
+#define STUB_MOVE 0x03e07825 /* move t7,ra */
+#define STUB_JALR 0x0320f809 /* jal t9 */
+#define STUB_LI16 0x34180000 /* ori t8,zero,0 */
+#define MIPS_FUNCTION_STUB_SIZE (16)
+
/* The relocation table used for SHT_REL sections. */
+#define UNUSED_RELOC(num) { num, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
+
static reloc_howto_type mips_elf64_howto_table_rel[] =
{
/* No relocation. */
@@ -109,16 +269,16 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
/* 16 bit relocation. */
HOWTO (R_MIPS_16, /* type */
0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_16", /* name */
true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
/* 32 bit relocation. */
@@ -128,7 +288,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_32", /* name */
true, /* partial_inplace */
@@ -143,7 +303,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_REL32", /* name */
true, /* partial_inplace */
@@ -151,7 +311,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
0xffffffff, /* dst_mask */
false), /* pcrel_offset */
- /* 26 bit branch address. */
+ /* 26 bit jump address. */
HOWTO (R_MIPS_26, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
@@ -159,14 +319,14 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
- /* This needs complex overflow
- detection, because the upper four
- bits must match the PC. */
+ /* This needs complex overflow
+ detection, because the upper 36
+ bits must match the PC + 4. */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_26", /* name */
true, /* partial_inplace */
- 0x3ffffff, /* src_mask */
- 0x3ffffff, /* dst_mask */
+ 0x03ffffff, /* src_mask */
+ 0x03ffffff, /* dst_mask */
false), /* pcrel_offset */
/* High 16 bits of symbol value. */
@@ -177,11 +337,11 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_hi16_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_MIPS_HI16", /* name */
true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
/* Low 16 bits of symbol value. */
@@ -192,11 +352,11 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
- _bfd_mips_elf_lo16_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_MIPS_LO16", /* name */
true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
/* GP relative reference. */
@@ -207,11 +367,11 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
false, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_gprel16_reloc, /* special_function */
+ mips_elf64_gprel16_reloc, /* special_function */
"R_MIPS_GPREL16", /* name */
true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
/* Reference to literal section. */
@@ -222,11 +382,11 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
false, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_gprel16_reloc, /* special_function */
+ mips_elf64_literal_reloc, /* special_function */
"R_MIPS_LITERAL", /* name */
true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
/* Reference to global offset table. */
@@ -237,11 +397,11 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
false, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_got16_reloc, /* special_function */
+ mips_elf64_got16_reloc, /* special_function */
"R_MIPS_GOT16", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
+ true, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
/* 16 bit PC relative reference. */
@@ -255,9 +415,9 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_PC16", /* name */
true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ true), /* pcrel_offset */
/* 16 bit call through global offset table. */
/* FIXME: This is not handled correctly. */
@@ -270,9 +430,9 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_CALL16", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
+ true, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
/* 32 bit GP relative reference. */
@@ -282,17 +442,17 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- _bfd_mips_elf_gprel32_reloc, /* special_function */
+ complain_overflow_dont, /* complain_on_overflow */
+ mips_elf64_gprel32_reloc, /* special_function */
"R_MIPS_GPREL32", /* name */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
false), /* pcrel_offset */
- { 13 },
- { 14 },
- { 15 },
+ UNUSED_RELOC (13),
+ UNUSED_RELOC (14),
+ UNUSED_RELOC (15),
/* A 5 bit shift field. */
HOWTO (R_MIPS_SHIFT5, /* type */
@@ -310,8 +470,6 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
false), /* pcrel_offset */
/* A 6 bit shift field. */
- /* FIXME: This is not handled correctly; a special function is
- needed to put the most significant bit in the right place. */
HOWTO (R_MIPS_SHIFT6, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
@@ -319,7 +477,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
false, /* pc_relative */
6, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
+ mips_elf64_shift6_reloc, /* special_function */
"R_MIPS_SHIFT6", /* name */
true, /* partial_inplace */
0x000007c4, /* src_mask */
@@ -333,7 +491,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
64, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_64", /* name */
true, /* partial_inplace */
@@ -349,7 +507,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
16, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_GOT_DISP", /* name */
true, /* partial_inplace */
@@ -365,7 +523,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
16, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_GOT_PAGE", /* name */
true, /* partial_inplace */
@@ -381,7 +539,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
16, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_GOT_OFST", /* name */
true, /* partial_inplace */
@@ -429,7 +587,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
64, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_SUB", /* name */
true, /* partial_inplace */
@@ -441,16 +599,16 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
/* FIXME: Not handled correctly. */
HOWTO (R_MIPS_INSERT_A, /* type */
0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_INSERT_A", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
+ true, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
false), /* pcrel_offset */
/* Insert the addend as an instruction, and change all relocations
@@ -458,36 +616,35 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
/* FIXME: Not handled correctly. */
HOWTO (R_MIPS_INSERT_B, /* type */
0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_INSERT_B", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
+ true, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
false), /* pcrel_offset */
/* Delete a 32 bit instruction. */
/* FIXME: Not handled correctly. */
HOWTO (R_MIPS_DELETE, /* type */
0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_DELETE", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
+ true, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
false), /* pcrel_offset */
/* Get the higher value of a 64 bit addend. */
- /* FIXME: Not handled correctly. */
HOWTO (R_MIPS_HIGHER, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
@@ -495,15 +652,14 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
+ mips_elf64_higher_reloc, /* special_function */
"R_MIPS_HIGHER", /* name */
true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
/* Get the highest value of a 64 bit addend. */
- /* FIXME: Not handled correctly. */
HOWTO (R_MIPS_HIGHEST, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
@@ -511,11 +667,11 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
+ mips_elf64_highest_reloc, /* special_function */
"R_MIPS_HIGHEST", /* name */
true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
/* High 16 bits of displacement in global offset table. */
@@ -550,92 +706,69 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
- /* I'm not sure what the remaining relocs are, but they are defined
- on Irix 6. */
-
+ /* Section displacement, used by an associated event location section. */
+ /* FIXME: Not handled correctly. */
HOWTO (R_MIPS_SCN_DISP, /* type */
0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_SCN_DISP", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
+ true, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
false), /* pcrel_offset */
HOWTO (R_MIPS_REL16, /* type */
0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
+ complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_REL16", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- false), /* pcrel_offset */
-
- HOWTO (R_MIPS_ADD_IMMEDIATE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_MIPS_ADD_IMMEDIATE", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
+ true, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
false), /* pcrel_offset */
- HOWTO (R_MIPS_PJUMP, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_MIPS_PJUMP", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- false), /* pcrel_offset */
+ /* These two are obsolete. */
+ EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE),
+ EMPTY_HOWTO (R_MIPS_PJUMP),
+ /* Similiar to R_MIPS_REL32, but used for relocations in a GOT section.
+ It must be used for multigot GOT's (and only there). */
HOWTO (R_MIPS_RELGOT, /* type */
0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_RELGOT", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
+ true, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
false), /* pcrel_offset */
- /* Protected jump conversion. This is an optimization hint. No
+ /* Protected jump conversion. This is an optimization hint. No
relocation is required for correctness. */
HOWTO (R_MIPS_JALR, /* type */
0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_JALR", /* name */
false, /* partial_inplace */
- 0x00000000, /* src_mask */
+ 0, /* src_mask */
0x00000000, /* dst_mask */
false), /* pcrel_offset */
};
@@ -662,16 +795,16 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
/* 16 bit relocation. */
HOWTO (R_MIPS_16, /* type */
0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_16", /* name */
- true, /* partial_inplace */
+ false, /* partial_inplace */
0, /* src_mask */
- 0xffff, /* dst_mask */
+ 0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
/* 32 bit relocation. */
@@ -681,10 +814,10 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_32", /* name */
- true, /* partial_inplace */
+ false, /* partial_inplace */
0, /* src_mask */
0xffffffff, /* dst_mask */
false), /* pcrel_offset */
@@ -696,15 +829,15 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_REL32", /* name */
- true, /* partial_inplace */
+ false, /* partial_inplace */
0, /* src_mask */
0xffffffff, /* dst_mask */
false), /* pcrel_offset */
- /* 26 bit branch address. */
+ /* 26 bit jump address. */
HOWTO (R_MIPS_26, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
@@ -712,16 +845,17 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
- /* This needs complex overflow
- detection, because the upper four
- bits must match the PC. */
+ /* This needs complex overflow
+ detection, because the upper 36
+ bits must match the PC + 4. */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_26", /* name */
- true, /* partial_inplace */
+ false, /* partial_inplace */
0, /* src_mask */
- 0x3ffffff, /* dst_mask */
+ 0x03ffffff, /* dst_mask */
false), /* pcrel_offset */
+ /* R_MIPS_HI16 and R_MIPS_LO16 are unsupported for 64 bit REL. */
/* High 16 bits of symbol value. */
HOWTO (R_MIPS_HI16, /* type */
0, /* rightshift */
@@ -732,9 +866,9 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_HI16", /* name */
- true, /* partial_inplace */
+ false, /* partial_inplace */
0, /* src_mask */
- 0xffff, /* dst_mask */
+ 0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
/* Low 16 bits of symbol value. */
@@ -747,9 +881,9 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_LO16", /* name */
- true, /* partial_inplace */
+ false, /* partial_inplace */
0, /* src_mask */
- 0xffff, /* dst_mask */
+ 0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
/* GP relative reference. */
@@ -760,11 +894,11 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
false, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_gprel16_reloc, /* special_function */
+ mips_elf64_gprel16_reloca, /* special_function */
"R_MIPS_GPREL16", /* name */
- true, /* partial_inplace */
+ false, /* partial_inplace */
0, /* src_mask */
- 0xffff, /* dst_mask */
+ 0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
/* Reference to literal section. */
@@ -775,11 +909,11 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
false, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
- _bfd_mips_elf_gprel16_reloc, /* special_function */
+ mips_elf64_literal_reloc, /* special_function */
"R_MIPS_LITERAL", /* name */
- true, /* partial_inplace */
+ false, /* partial_inplace */
0, /* src_mask */
- 0xffff, /* dst_mask */
+ 0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
/* Reference to global offset table. */
@@ -791,11 +925,11 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
false, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_MIPS_GOT16", /* name */
false, /* partial_inplace */
0, /* src_mask */
- 0xffff, /* dst_mask */
+ 0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
/* 16 bit PC relative reference. */
@@ -808,10 +942,10 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_PC16", /* name */
- true, /* partial_inplace */
+ false, /* partial_inplace */
0, /* src_mask */
- 0xffff, /* dst_mask */
- false), /* pcrel_offset */
+ 0x0000ffff, /* dst_mask */
+ true), /* pcrel_offset */
/* 16 bit call through global offset table. */
/* FIXME: This is not handled correctly. */
@@ -826,7 +960,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
"R_MIPS_CALL16", /* name */
false, /* partial_inplace */
0, /* src_mask */
- 0xffff, /* dst_mask */
+ 0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
/* 32 bit GP relative reference. */
@@ -836,17 +970,17 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- _bfd_mips_elf_gprel32_reloc, /* special_function */
+ complain_overflow_dont, /* complain_on_overflow */
+ mips_elf64_gprel32_reloc, /* special_function */
"R_MIPS_GPREL32", /* name */
- true, /* partial_inplace */
+ false, /* partial_inplace */
0, /* src_mask */
0xffffffff, /* dst_mask */
false), /* pcrel_offset */
- { 13 },
- { 14 },
- { 15 },
+ UNUSED_RELOC (13),
+ UNUSED_RELOC (14),
+ UNUSED_RELOC (15),
/* A 5 bit shift field. */
HOWTO (R_MIPS_SHIFT5, /* type */
@@ -858,14 +992,12 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_SHIFT5", /* name */
- true, /* partial_inplace */
+ false, /* partial_inplace */
0, /* src_mask */
0x000007c0, /* dst_mask */
false), /* pcrel_offset */
/* A 6 bit shift field. */
- /* FIXME: This is not handled correctly; a special function is
- needed to put the most significant bit in the right place. */
HOWTO (R_MIPS_SHIFT6, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
@@ -873,9 +1005,9 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
false, /* pc_relative */
6, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
+ mips_elf64_shift6_reloc, /* special_function */
"R_MIPS_SHIFT6", /* name */
- true, /* partial_inplace */
+ false, /* partial_inplace */
0, /* src_mask */
0x000007c4, /* dst_mask */
false), /* pcrel_offset */
@@ -887,10 +1019,10 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
64, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_64", /* name */
- true, /* partial_inplace */
+ false, /* partial_inplace */
0, /* src_mask */
MINUS_ONE, /* dst_mask */
false), /* pcrel_offset */
@@ -903,10 +1035,10 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
16, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_GOT_DISP", /* name */
- true, /* partial_inplace */
+ false, /* partial_inplace */
0, /* src_mask */
0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
@@ -919,10 +1051,10 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
16, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_GOT_PAGE", /* name */
- true, /* partial_inplace */
+ false, /* partial_inplace */
0, /* src_mask */
0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
@@ -935,10 +1067,10 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
16, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_GOT_OFST", /* name */
- true, /* partial_inplace */
+ false, /* partial_inplace */
0, /* src_mask */
0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
@@ -954,7 +1086,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_GOT_HI16", /* name */
- true, /* partial_inplace */
+ false, /* partial_inplace */
0, /* src_mask */
0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
@@ -970,7 +1102,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_GOT_LO16", /* name */
- true, /* partial_inplace */
+ false, /* partial_inplace */
0, /* src_mask */
0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
@@ -983,10 +1115,10 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
64, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
+ complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_SUB", /* name */
- true, /* partial_inplace */
+ false, /* partial_inplace */
0, /* src_mask */
MINUS_ONE, /* dst_mask */
false), /* pcrel_offset */
@@ -995,8 +1127,8 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
/* FIXME: Not handled correctly. */
HOWTO (R_MIPS_INSERT_A, /* type */
0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
@@ -1004,7 +1136,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
"R_MIPS_INSERT_A", /* name */
false, /* partial_inplace */
0, /* src_mask */
- 0, /* dst_mask */
+ 0xffffffff, /* dst_mask */
false), /* pcrel_offset */
/* Insert the addend as an instruction, and change all relocations
@@ -1012,8 +1144,8 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
/* FIXME: Not handled correctly. */
HOWTO (R_MIPS_INSERT_B, /* type */
0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
@@ -1021,15 +1153,15 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
"R_MIPS_INSERT_B", /* name */
false, /* partial_inplace */
0, /* src_mask */
- 0, /* dst_mask */
+ 0xffffffff, /* dst_mask */
false), /* pcrel_offset */
/* Delete a 32 bit instruction. */
/* FIXME: Not handled correctly. */
HOWTO (R_MIPS_DELETE, /* type */
0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
@@ -1037,11 +1169,10 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
"R_MIPS_DELETE", /* name */
false, /* partial_inplace */
0, /* src_mask */
- 0, /* dst_mask */
+ 0xffffffff, /* dst_mask */
false), /* pcrel_offset */
/* Get the higher value of a 64 bit addend. */
- /* FIXME: Not handled correctly. */
HOWTO (R_MIPS_HIGHER, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
@@ -1049,15 +1180,14 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_MIPS_HIGHER", /* name */
- true, /* partial_inplace */
+ false, /* partial_inplace */
0, /* src_mask */
- 0xffff, /* dst_mask */
+ 0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
/* Get the highest value of a 64 bit addend. */
- /* FIXME: Not handled correctly. */
HOWTO (R_MIPS_HIGHEST, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
@@ -1065,11 +1195,11 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
+ bfd_elf_generic_reloc, /* special_function */
"R_MIPS_HIGHEST", /* name */
- true, /* partial_inplace */
+ false, /* partial_inplace */
0, /* src_mask */
- 0xffff, /* dst_mask */
+ 0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
/* High 16 bits of displacement in global offset table. */
@@ -1083,7 +1213,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_CALL_HI16", /* name */
- true, /* partial_inplace */
+ false, /* partial_inplace */
0, /* src_mask */
0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
@@ -1099,18 +1229,17 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_CALL_LO16", /* name */
- true, /* partial_inplace */
+ false, /* partial_inplace */
0, /* src_mask */
0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
- /* I'm not sure what the remaining relocs are, but they are defined
- on Irix 6. */
-
+ /* Section displacement, used by an associated event location section. */
+ /* FIXME: Not handled correctly. */
HOWTO (R_MIPS_SCN_DISP, /* type */
0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
@@ -1118,55 +1247,33 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
"R_MIPS_SCN_DISP", /* name */
false, /* partial_inplace */
0, /* src_mask */
- 0, /* dst_mask */
+ 0xffffffff, /* dst_mask */
false), /* pcrel_offset */
HOWTO (R_MIPS_REL16, /* type */
0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
+ complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_REL16", /* name */
false, /* partial_inplace */
0, /* src_mask */
- 0, /* dst_mask */
+ 0xffff, /* dst_mask */
false), /* pcrel_offset */
- HOWTO (R_MIPS_ADD_IMMEDIATE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_MIPS_ADD_IMMEDIATE", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- false), /* pcrel_offset */
-
- HOWTO (R_MIPS_PJUMP, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_MIPS_PJUMP", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- false), /* pcrel_offset */
+ /* These two are obsolete. */
+ EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE),
+ EMPTY_HOWTO (R_MIPS_PJUMP),
+ /* Similiar to R_MIPS_REL32, but used for relocations in a GOT section.
+ It must be used for multigot GOT's (and only there). */
HOWTO (R_MIPS_RELGOT, /* type */
0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
@@ -1174,22 +1281,22 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
"R_MIPS_RELGOT", /* name */
false, /* partial_inplace */
0, /* src_mask */
- 0, /* dst_mask */
+ 0xffffffff, /* dst_mask */
false), /* pcrel_offset */
- /* Protected jump conversion. This is an optimization hint. No
+ /* Protected jump conversion. This is an optimization hint. No
relocation is required for correctness. */
HOWTO (R_MIPS_JALR, /* type */
0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MIPS_JALR", /* name */
false, /* partial_inplace */
- 0x00000000, /* src_mask */
+ 0, /* src_mask */
0x00000000, /* dst_mask */
false), /* pcrel_offset */
};
@@ -1202,12 +1309,12 @@ mips_elf64_swap_reloc_in (abfd, src, dst)
const Elf64_Mips_External_Rel *src;
Elf64_Mips_Internal_Rel *dst;
{
- dst->r_offset = bfd_h_get_64 (abfd, (bfd_byte *) src->r_offset);
- dst->r_sym = bfd_h_get_32 (abfd, (bfd_byte *) src->r_sym);
- dst->r_ssym = bfd_h_get_8 (abfd, (bfd_byte *) src->r_ssym);
- dst->r_type3 = bfd_h_get_8 (abfd, (bfd_byte *) src->r_type3);
- dst->r_type2 = bfd_h_get_8 (abfd, (bfd_byte *) src->r_type2);
- dst->r_type = bfd_h_get_8 (abfd, (bfd_byte *) src->r_type);
+ dst->r_offset = H_GET_64 (abfd, src->r_offset);
+ dst->r_sym = H_GET_32 (abfd, src->r_sym);
+ dst->r_ssym = H_GET_8 (abfd, src->r_ssym);
+ dst->r_type3 = H_GET_8 (abfd, src->r_type3);
+ dst->r_type2 = H_GET_8 (abfd, src->r_type2);
+ dst->r_type = H_GET_8 (abfd, src->r_type);
}
/* Swap in a MIPS 64-bit Rela reloc. */
@@ -1218,13 +1325,13 @@ mips_elf64_swap_reloca_in (abfd, src, dst)
const Elf64_Mips_External_Rela *src;
Elf64_Mips_Internal_Rela *dst;
{
- dst->r_offset = bfd_h_get_64 (abfd, (bfd_byte *) src->r_offset);
- dst->r_sym = bfd_h_get_32 (abfd, (bfd_byte *) src->r_sym);
- dst->r_ssym = bfd_h_get_8 (abfd, (bfd_byte *) src->r_ssym);
- dst->r_type3 = bfd_h_get_8 (abfd, (bfd_byte *) src->r_type3);
- dst->r_type2 = bfd_h_get_8 (abfd, (bfd_byte *) src->r_type2);
- dst->r_type = bfd_h_get_8 (abfd, (bfd_byte *) src->r_type);
- dst->r_addend = bfd_h_get_signed_64 (abfd, (bfd_byte *) src->r_addend);
+ dst->r_offset = H_GET_64 (abfd, src->r_offset);
+ dst->r_sym = H_GET_32 (abfd, src->r_sym);
+ dst->r_ssym = H_GET_8 (abfd, src->r_ssym);
+ dst->r_type3 = H_GET_8 (abfd, src->r_type3);
+ dst->r_type2 = H_GET_8 (abfd, src->r_type2);
+ dst->r_type = H_GET_8 (abfd, src->r_type);
+ dst->r_addend = H_GET_S64 (abfd, src->r_addend);
}
/* Swap out a MIPS 64-bit Rel reloc. */
@@ -1235,12 +1342,12 @@ mips_elf64_swap_reloc_out (abfd, src, dst)
const Elf64_Mips_Internal_Rel *src;
Elf64_Mips_External_Rel *dst;
{
- bfd_h_put_64 (abfd, src->r_offset, (bfd_byte *) dst->r_offset);
- bfd_h_put_32 (abfd, src->r_sym, (bfd_byte *) dst->r_sym);
- bfd_h_put_8 (abfd, src->r_ssym, (bfd_byte *) dst->r_ssym);
- bfd_h_put_8 (abfd, src->r_type3, (bfd_byte *) dst->r_type3);
- bfd_h_put_8 (abfd, src->r_type2, (bfd_byte *) dst->r_type2);
- bfd_h_put_8 (abfd, src->r_type, (bfd_byte *) dst->r_type);
+ H_PUT_64 (abfd, src->r_offset, dst->r_offset);
+ H_PUT_32 (abfd, src->r_sym, dst->r_sym);
+ H_PUT_8 (abfd, src->r_ssym, dst->r_ssym);
+ H_PUT_8 (abfd, src->r_type3, dst->r_type3);
+ H_PUT_8 (abfd, src->r_type2, dst->r_type2);
+ H_PUT_8 (abfd, src->r_type, dst->r_type);
}
/* Swap out a MIPS 64-bit Rela reloc. */
@@ -1251,13 +1358,13 @@ mips_elf64_swap_reloca_out (abfd, src, dst)
const Elf64_Mips_Internal_Rela *src;
Elf64_Mips_External_Rela *dst;
{
- bfd_h_put_64 (abfd, src->r_offset, (bfd_byte *) dst->r_offset);
- bfd_h_put_32 (abfd, src->r_sym, (bfd_byte *) dst->r_sym);
- bfd_h_put_8 (abfd, src->r_ssym, (bfd_byte *) dst->r_ssym);
- bfd_h_put_8 (abfd, src->r_type3, (bfd_byte *) dst->r_type3);
- bfd_h_put_8 (abfd, src->r_type2, (bfd_byte *) dst->r_type2);
- bfd_h_put_8 (abfd, src->r_type, (bfd_byte *) dst->r_type);
- bfd_h_put_64 (abfd, src->r_addend, (bfd_byte *) dst->r_addend);
+ H_PUT_64 (abfd, src->r_offset, dst->r_offset);
+ H_PUT_32 (abfd, src->r_sym, dst->r_sym);
+ H_PUT_8 (abfd, src->r_ssym, dst->r_ssym);
+ H_PUT_8 (abfd, src->r_type3, dst->r_type3);
+ H_PUT_8 (abfd, src->r_type2, dst->r_type2);
+ H_PUT_8 (abfd, src->r_type, dst->r_type);
+ H_PUT_S64 (abfd, src->r_addend, dst->r_addend);
}
/* Swap in a MIPS 64-bit Rel reloc. */
@@ -1270,16 +1377,16 @@ mips_elf64_be_swap_reloc_in (abfd, src, dst)
{
Elf64_Mips_Internal_Rel mirel;
- mips_elf64_swap_reloc_in (abfd,
+ mips_elf64_swap_reloc_in (abfd,
(const Elf64_Mips_External_Rel *) src,
&mirel);
dst[0].r_offset = mirel.r_offset;
- dst[0].r_info = ELF32_R_INFO (mirel.r_sym, mirel.r_type);
+ dst[0].r_info = ELF64_R_INFO (mirel.r_sym, mirel.r_type);
dst[1].r_offset = mirel.r_offset;
- dst[1].r_info = ELF32_R_INFO (mirel.r_ssym, mirel.r_type2);
+ dst[1].r_info = ELF64_R_INFO (mirel.r_ssym, mirel.r_type2);
dst[2].r_offset = mirel.r_offset;
- dst[2].r_info = ELF32_R_INFO (STN_UNDEF, mirel.r_type3);
+ dst[2].r_info = ELF64_R_INFO (STN_UNDEF, mirel.r_type3);
}
/* Swap in a MIPS 64-bit Rela reloc. */
@@ -1292,18 +1399,18 @@ mips_elf64_be_swap_reloca_in (abfd, src, dst)
{
Elf64_Mips_Internal_Rela mirela;
- mips_elf64_swap_reloca_in (abfd,
+ mips_elf64_swap_reloca_in (abfd,
(const Elf64_Mips_External_Rela *) src,
&mirela);
dst[0].r_offset = mirela.r_offset;
- dst[0].r_info = ELF32_R_INFO (mirela.r_sym, mirela.r_type);
+ dst[0].r_info = ELF64_R_INFO (mirela.r_sym, mirela.r_type);
dst[0].r_addend = mirela.r_addend;
dst[1].r_offset = mirela.r_offset;
- dst[1].r_info = ELF32_R_INFO (mirela.r_ssym, mirela.r_type2);
+ dst[1].r_info = ELF64_R_INFO (mirela.r_ssym, mirela.r_type2);
dst[1].r_addend = 0;
dst[2].r_offset = mirela.r_offset;
- dst[2].r_info = ELF32_R_INFO (STN_UNDEF, mirela.r_type3);
+ dst[2].r_info = ELF64_R_INFO (STN_UNDEF, mirela.r_type3);
dst[2].r_addend = 0;
}
@@ -1317,14 +1424,17 @@ mips_elf64_be_swap_reloc_out (abfd, src, dst)
{
Elf64_Mips_Internal_Rel mirel;
- mirel.r_offset = src->r_offset;
- mirel.r_type = ELF32_R_TYPE (src->r_info);
- mirel.r_sym = ELF32_R_SYM (src->r_info);
- mirel.r_type2 = R_MIPS_NONE;
- mirel.r_ssym = STN_UNDEF;
- mirel.r_type3 = R_MIPS_NONE;
+ mirel.r_offset = src[0].r_offset;
+ BFD_ASSERT(src[0].r_offset == src[1].r_offset);
+ BFD_ASSERT(src[0].r_offset == src[2].r_offset);
- mips_elf64_swap_reloc_out (abfd, &mirel,
+ mirel.r_type = ELF64_MIPS_R_TYPE (src[0].r_info);
+ mirel.r_sym = ELF64_R_SYM (src[0].r_info);
+ mirel.r_type2 = ELF64_MIPS_R_TYPE2 (src[1].r_info);
+ mirel.r_ssym = ELF64_MIPS_R_SSYM (src[1].r_info);
+ mirel.r_type3 = ELF64_MIPS_R_TYPE3 (src[2].r_info);
+
+ mips_elf64_swap_reloc_out (abfd, &mirel,
(Elf64_Mips_External_Rel *) dst);
}
@@ -1338,74 +1448,758 @@ mips_elf64_be_swap_reloca_out (abfd, src, dst)
{
Elf64_Mips_Internal_Rela mirela;
- mirela.r_offset = src->r_offset;
- mirela.r_type = ELF32_R_TYPE (src->r_info);
- mirela.r_addend = src->r_addend;
- mirela.r_sym = ELF32_R_SYM (src->r_info);
- mirela.r_type2 = R_MIPS_NONE;
- mirela.r_ssym = STN_UNDEF;
- mirela.r_type3 = R_MIPS_NONE;
+ mirela.r_offset = src[0].r_offset;
+ BFD_ASSERT(src[0].r_offset == src[1].r_offset);
+ BFD_ASSERT(src[0].r_offset == src[2].r_offset);
+
+ mirela.r_type = ELF64_MIPS_R_TYPE (src[0].r_info);
+ mirela.r_sym = ELF64_R_SYM (src[0].r_info);
+ mirela.r_addend = src[0].r_addend;
+ BFD_ASSERT(src[1].r_addend == 0);
+ BFD_ASSERT(src[2].r_addend == 0);
- mips_elf64_swap_reloca_out (abfd, &mirela,
+ mirela.r_type2 = ELF64_MIPS_R_TYPE2 (src[1].r_info);
+ mirela.r_ssym = ELF64_MIPS_R_SSYM (src[1].r_info);
+ mirela.r_type3 = ELF64_MIPS_R_TYPE3 (src[2].r_info);
+
+ mips_elf64_swap_reloca_out (abfd, &mirela,
(Elf64_Mips_External_Rela *) dst);
}
-/* A mapping from BFD reloc types to MIPS ELF reloc types. */
+/* Calculate the %high function. */
-struct elf_reloc_map
+static bfd_vma
+mips_elf64_high (value)
+ bfd_vma value;
{
- bfd_reloc_code_real_type bfd_reloc_val;
- enum elf_mips_reloc_type elf_reloc_val;
-};
+ return ((value + (bfd_vma) 0x8000) >> 16) & 0xffff;
+}
-static CONST struct elf_reloc_map mips_reloc_map[] =
-{
- { BFD_RELOC_NONE, R_MIPS_NONE, },
- { BFD_RELOC_16, R_MIPS_16 },
- { BFD_RELOC_32, R_MIPS_32 },
- { BFD_RELOC_64, R_MIPS_64 },
- { BFD_RELOC_CTOR, R_MIPS_64 },
- { BFD_RELOC_32_PCREL, R_MIPS_REL32 },
- { BFD_RELOC_MIPS_JMP, R_MIPS_26 },
- { BFD_RELOC_HI16_S, R_MIPS_HI16 },
- { BFD_RELOC_LO16, R_MIPS_LO16 },
- { BFD_RELOC_MIPS_GPREL, R_MIPS_GPREL16 },
- { BFD_RELOC_MIPS_LITERAL, R_MIPS_LITERAL },
- { BFD_RELOC_MIPS_GOT16, R_MIPS_GOT16 },
- { BFD_RELOC_16_PCREL, R_MIPS_PC16 },
- { BFD_RELOC_MIPS_CALL16, R_MIPS_CALL16 },
- { BFD_RELOC_MIPS_GPREL32, R_MIPS_GPREL32 },
- { BFD_RELOC_MIPS_GOT_HI16, R_MIPS_GOT_HI16 },
- { BFD_RELOC_MIPS_GOT_LO16, R_MIPS_GOT_LO16 },
- { BFD_RELOC_MIPS_CALL_HI16, R_MIPS_CALL_HI16 },
- { BFD_RELOC_MIPS_CALL_LO16, R_MIPS_CALL_LO16 },
- { BFD_RELOC_MIPS_SUB, R_MIPS_SUB },
- { BFD_RELOC_MIPS_GOT_PAGE, R_MIPS_GOT_PAGE },
- { BFD_RELOC_MIPS_GOT_OFST, R_MIPS_GOT_OFST },
- { BFD_RELOC_MIPS_GOT_DISP, R_MIPS_GOT_DISP }
-};
+/* Calculate the %higher function. */
-/* Given a BFD reloc type, return a howto structure. */
+static bfd_vma
+mips_elf64_higher (value)
+ bfd_vma value;
+{
+ return ((value + (bfd_vma) 0x80008000) >> 32) & 0xffff;
+}
-static reloc_howto_type *
-mips_elf64_reloc_type_lookup (abfd, code)
+/* Calculate the %highest function. */
+
+static bfd_vma
+mips_elf64_highest (value)
+ bfd_vma value;
+{
+ return ((value + (bfd_vma) 0x800080008000) >> 48) & 0xffff;
+}
+
+/* Do a R_MIPS_HI16 relocation. */
+
+bfd_reloc_status_type
+mips_elf64_hi16_reloc (abfd,
+ reloc_entry,
+ symbol,
+ data,
+ input_section,
+ output_bfd,
+ error_message)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ arelent *reloc_entry;
+ asymbol *symbol;
+ PTR data ATTRIBUTE_UNUSED;
+ asection *input_section;
+ bfd *output_bfd;
+ char **error_message ATTRIBUTE_UNUSED;
+{
+ /* If we're relocating, and this is an external symbol, we don't
+ want to change anything. */
+ if (output_bfd != (bfd *) NULL
+ && (symbol->flags & BSF_SECTION_SYM) == 0
+ && (! reloc_entry->howto->partial_inplace
+ || reloc_entry->addend == 0))
+ {
+ reloc_entry->address += input_section->output_offset;
+ return bfd_reloc_ok;
+ }
+
+ if (((reloc_entry->addend & 0xffff) + 0x8000) & ~0xffff)
+ reloc_entry->addend += 0x8000;
+
+ return bfd_reloc_continue;
+}
+
+/* Do a R_MIPS_HIGHER relocation. */
+
+bfd_reloc_status_type
+mips_elf64_higher_reloc (abfd,
+ reloc_entry,
+ symbol,
+ data,
+ input_section,
+ output_bfd,
+ error_message)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ arelent *reloc_entry;
+ asymbol *symbol;
+ PTR data ATTRIBUTE_UNUSED;
+ asection *input_section;
+ bfd *output_bfd;
+ char **error_message ATTRIBUTE_UNUSED;
+{
+ /* If we're relocating, and this is an external symbol, we don't
+ want to change anything. */
+ if (output_bfd != (bfd *) NULL
+ && (symbol->flags & BSF_SECTION_SYM) == 0
+ && (! reloc_entry->howto->partial_inplace
+ || reloc_entry->addend == 0))
+ {
+ reloc_entry->address += input_section->output_offset;
+ return bfd_reloc_ok;
+ }
+
+ if (((reloc_entry->addend & 0xffffffff) + 0x80008000)
+ & ~0xffffffff)
+ reloc_entry->addend += 0x80008000;
+
+ return bfd_reloc_continue;
+}
+
+/* Do a R_MIPS_HIGHEST relocation. */
+
+bfd_reloc_status_type
+mips_elf64_highest_reloc (abfd,
+ reloc_entry,
+ symbol,
+ data,
+ input_section,
+ output_bfd,
+ error_message)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ arelent *reloc_entry;
+ asymbol *symbol;
+ PTR data ATTRIBUTE_UNUSED;
+ asection *input_section;
+ bfd *output_bfd;
+ char **error_message ATTRIBUTE_UNUSED;
+{
+ /* If we're relocating, and this is an external symbol, we don't
+ want to change anything. */
+ if (output_bfd != (bfd *) NULL
+ && (symbol->flags & BSF_SECTION_SYM) == 0
+ && (! reloc_entry->howto->partial_inplace
+ || reloc_entry->addend == 0))
+ {
+ reloc_entry->address += input_section->output_offset;
+ return bfd_reloc_ok;
+ }
+
+ if (((reloc_entry->addend & 0xffffffffffff) + 0x800080008000)
+ & ~0xffffffffffff)
+ reloc_entry->addend += 0x800080008000;
+
+ return bfd_reloc_continue;
+}
+
+/* Do a R_MIPS_GOT16 reloc. This is a reloc against the global offset
+ table used for PIC code. If the symbol is an external symbol, the
+ instruction is modified to contain the offset of the appropriate
+ entry in the global offset table. If the symbol is a section
+ symbol, the next reloc is a R_MIPS_LO16 reloc. The two 16 bit
+ addends are combined to form the real addend against the section
+ symbol; the GOT16 is modified to contain the offset of an entry in
+ the global offset table, and the LO16 is modified to offset it
+ appropriately. Thus an offset larger than 16 bits requires a
+ modified value in the global offset table.
+
+ This implementation suffices for the assembler, but the linker does
+ not yet know how to create global offset tables. */
+
+bfd_reloc_status_type
+mips_elf64_got16_reloc (abfd,
+ reloc_entry,
+ symbol,
+ data,
+ input_section,
+ output_bfd,
+ error_message)
bfd *abfd;
- bfd_reloc_code_real_type code;
+ arelent *reloc_entry;
+ asymbol *symbol;
+ PTR data;
+ asection *input_section;
+ bfd *output_bfd;
+ char **error_message;
{
+ /* If we're relocating, and this an external symbol, we don't want
+ to change anything. */
+ if (output_bfd != (bfd *) NULL
+ && (symbol->flags & BSF_SECTION_SYM) == 0
+ && reloc_entry->addend == 0)
+ {
+ reloc_entry->address += input_section->output_offset;
+ return bfd_reloc_ok;
+ }
+
+ /* If we're relocating, and this is a local symbol, we can handle it
+ just like HI16. */
+ if (output_bfd != (bfd *) NULL
+ && (symbol->flags & BSF_SECTION_SYM) != 0)
+ return mips_elf64_hi16_reloc (abfd, reloc_entry, symbol, data,
+ input_section, output_bfd, error_message);
+
+ abort ();
+}
+
+/* Set the GP value for OUTPUT_BFD. Returns false if this is a
+ dangerous relocation. */
+
+static boolean
+mips_elf64_assign_gp (output_bfd, pgp)
+ bfd *output_bfd;
+ bfd_vma *pgp;
+{
+ unsigned int count;
+ asymbol **sym;
unsigned int i;
- for (i = 0; i < sizeof (mips_reloc_map) / sizeof (struct elf_reloc_map); i++)
+ /* If we've already figured out what GP will be, just return it. */
+ *pgp = _bfd_get_gp_value (output_bfd);
+ if (*pgp)
+ return true;
+
+ count = bfd_get_symcount (output_bfd);
+ sym = bfd_get_outsymbols (output_bfd);
+
+ /* The linker script will have created a symbol named `_gp' with the
+ appropriate value. */
+ if (sym == (asymbol **) NULL)
+ i = count;
+ else
{
- if (mips_reloc_map[i].bfd_reloc_val == code)
+ for (i = 0; i < count; i++, sym++)
{
- int v;
+ register CONST char *name;
- v = (int) mips_reloc_map[i].elf_reloc_val;
- return &mips_elf64_howto_table_rel[v];
+ name = bfd_asymbol_name (*sym);
+ if (*name == '_' && strcmp (name, "_gp") == 0)
+ {
+ *pgp = bfd_asymbol_value (*sym);
+ _bfd_set_gp_value (output_bfd, *pgp);
+ break;
+ }
}
}
- return NULL;
+ if (i >= count)
+ {
+ /* Only get the error once. */
+ *pgp = 4;
+ _bfd_set_gp_value (output_bfd, *pgp);
+ return false;
+ }
+
+ return true;
+}
+
+/* We have to figure out the gp value, so that we can adjust the
+ symbol value correctly. We look up the symbol _gp in the output
+ BFD. If we can't find it, we're stuck. We cache it in the ELF
+ target data. We don't need to adjust the symbol value for an
+ external symbol if we are producing relocateable output. */
+
+static bfd_reloc_status_type
+mips_elf64_final_gp (output_bfd, symbol, relocateable, error_message, pgp)
+ bfd *output_bfd;
+ asymbol *symbol;
+ boolean relocateable;
+ char **error_message;
+ bfd_vma *pgp;
+{
+ if (bfd_is_und_section (symbol->section)
+ && ! relocateable)
+ {
+ *pgp = 0;
+ return bfd_reloc_undefined;
+ }
+
+ *pgp = _bfd_get_gp_value (output_bfd);
+ if (*pgp == 0
+ && (! relocateable
+ || (symbol->flags & BSF_SECTION_SYM) != 0))
+ {
+ if (relocateable)
+ {
+ /* Make up a value. */
+ *pgp = symbol->section->output_section->vma + 0x4000;
+ _bfd_set_gp_value (output_bfd, *pgp);
+ }
+ else if (!mips_elf64_assign_gp (output_bfd, pgp))
+ {
+ *error_message =
+ (char *) _("GP relative relocation when _gp not defined");
+ return bfd_reloc_dangerous;
+ }
+ }
+
+ return bfd_reloc_ok;
+}
+
+/* Do a R_MIPS_GPREL16 relocation. This is a 16 bit value which must
+ become the offset from the gp register. */
+
+bfd_reloc_status_type
+mips_elf64_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section,
+ output_bfd, error_message)
+ bfd *abfd;
+ arelent *reloc_entry;
+ asymbol *symbol;
+ PTR data;
+ asection *input_section;
+ bfd *output_bfd;
+ char **error_message;
+{
+ boolean relocateable;
+ bfd_reloc_status_type ret;
+ bfd_vma gp;
+
+ /* If we're relocating, and this is an external symbol with no
+ addend, we don't want to change anything. We will only have an
+ addend if this is a newly created reloc, not read from an ELF
+ file. */
+ if (output_bfd != (bfd *) NULL
+ && (symbol->flags & BSF_SECTION_SYM) == 0
+ && reloc_entry->addend == 0)
+ {
+ reloc_entry->address += input_section->output_offset;
+ return bfd_reloc_ok;
+ }
+
+ if (output_bfd != (bfd *) NULL)
+ relocateable = true;
+ else
+ {
+ relocateable = false;
+ output_bfd = symbol->section->output_section->owner;
+ }
+
+ ret = mips_elf64_final_gp (output_bfd, symbol, relocateable, error_message,
+ &gp);
+ if (ret != bfd_reloc_ok)
+ return ret;
+
+ return gprel16_with_gp (abfd, symbol, reloc_entry, input_section,
+ relocateable, data, gp);
+}
+
+static bfd_reloc_status_type
+gprel16_with_gp (abfd, symbol, reloc_entry, input_section, relocateable, data,
+ gp)
+ bfd *abfd;
+ asymbol *symbol;
+ arelent *reloc_entry;
+ asection *input_section;
+ boolean relocateable;
+ PTR data;
+ bfd_vma gp;
+{
+ bfd_vma relocation;
+ unsigned long insn;
+ unsigned long val;
+
+ if (bfd_is_com_section (symbol->section))
+ relocation = 0;
+ else
+ relocation = symbol->value;
+
+ relocation += symbol->section->output_section->vma;
+ relocation += symbol->section->output_offset;
+
+ if (reloc_entry->address > input_section->_cooked_size)
+ return bfd_reloc_outofrange;
+
+ insn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
+
+ /* Set val to the offset into the section or symbol. */
+ if (reloc_entry->howto->src_mask == 0)
+ {
+ /* This case occurs with the 64-bit MIPS ELF ABI. */
+ val = reloc_entry->addend;
+ }
+ else
+ {
+ val = ((insn & 0xffff) + reloc_entry->addend) & 0xffff;
+ if (val & 0x8000)
+ val -= 0x10000;
+ }
+
+ /* Adjust val for the final section location and GP value. If we
+ are producing relocateable output, we don't want to do this for
+ an external symbol. */
+ if (! relocateable
+ || (symbol->flags & BSF_SECTION_SYM) != 0)
+ val += relocation - gp;
+
+ insn = (insn & ~0xffff) | (val & 0xffff);
+ bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address);
+
+ if (relocateable)
+ reloc_entry->address += input_section->output_offset;
+
+ else if ((long) val >= 0x8000 || (long) val < -0x8000)
+ return bfd_reloc_overflow;
+
+ return bfd_reloc_ok;
+}
+
+/* Do a R_MIPS_GPREL16 RELA relocation. */
+
+bfd_reloc_status_type
+mips_elf64_gprel16_reloca (abfd, reloc_entry, symbol, data, input_section,
+ output_bfd, error_message)
+ bfd *abfd;
+ arelent *reloc_entry;
+ asymbol *symbol;
+ PTR data ATTRIBUTE_UNUSED;
+ asection *input_section;
+ bfd *output_bfd;
+ char **error_message;
+{
+ boolean relocateable;
+ bfd_vma gp;
+
+ /* This works only for NewABI. */
+ BFD_ASSERT (reloc_entry->howto->src_mask == 0);
+
+ /* If we're relocating, and this is an external symbol with no
+ addend, we don't want to change anything. We will only have an
+ addend if this is a newly created reloc, not read from an ELF
+ file. */
+ if (output_bfd != (bfd *) NULL
+ && (symbol->flags & BSF_SECTION_SYM) == 0
+ && reloc_entry->addend == 0)
+ {
+ reloc_entry->address += input_section->output_offset;
+ return bfd_reloc_ok;
+ }
+
+ if (output_bfd != (bfd *) NULL)
+ relocateable = true;
+ else
+ {
+ relocateable = false;
+ output_bfd = symbol->section->output_section->owner;
+ }
+
+ if (prev_reloc_address != reloc_entry->address)
+ prev_reloc_address = reloc_entry->address;
+ else
+ {
+ mips_elf64_final_gp (output_bfd, symbol, relocateable, error_message,
+ &gp);
+ prev_reloc_addend = reloc_entry->addend + reloc_entry->address - gp;
+ if (symbol->flags & BSF_LOCAL)
+ prev_reloc_addend += _bfd_get_gp_value (abfd);
+/*fprintf(stderr, "Addend: %lx, Next Addend: %lx\n", reloc_entry->addend, prev_reloc_addend);*/
+ }
+
+ return bfd_reloc_ok;
+}
+
+/* Do a R_MIPS_LITERAL relocation. */
+
+bfd_reloc_status_type
+mips_elf64_literal_reloc (abfd, reloc_entry, symbol, data, input_section,
+ output_bfd, error_message)
+ bfd *abfd;
+ arelent *reloc_entry;
+ asymbol *symbol;
+ PTR data;
+ asection *input_section;
+ bfd *output_bfd;
+ char **error_message;
+{
+ /* If we're relocating, and this is an external symbol, we don't
+ want to change anything. */
+ if (output_bfd != (bfd *) NULL
+ && (symbol->flags & BSF_SECTION_SYM) == 0
+ && (! reloc_entry->howto->partial_inplace
+ || reloc_entry->addend == 0))
+ {
+ reloc_entry->address += input_section->output_offset;
+ return bfd_reloc_ok;
+ }
+
+ /* FIXME: The entries in the .lit8 and .lit4 sections should be merged.
+ Currently we simply call mips_elf64_gprel16_reloc. */
+ return mips_elf64_gprel16_reloc (abfd, reloc_entry, symbol, data,
+ input_section, output_bfd, error_message);
+}
+
+/* Do a R_MIPS_GPREL32 relocation. Is this 32 bit value the offset
+ from the gp register? XXX */
+
+bfd_reloc_status_type
+mips_elf64_gprel32_reloc (abfd,
+ reloc_entry,
+ symbol,
+ data,
+ input_section,
+ output_bfd,
+ error_message)
+ bfd *abfd;
+ arelent *reloc_entry;
+ asymbol *symbol;
+ PTR data;
+ asection *input_section;
+ bfd *output_bfd;
+ char **error_message;
+{
+ boolean relocateable;
+ bfd_reloc_status_type ret;
+ bfd_vma gp;
+ bfd_vma relocation;
+ unsigned long val;
+
+ /* If we're relocating, and this is an external symbol with no
+ addend, we don't want to change anything. We will only have an
+ addend if this is a newly created reloc, not read from an ELF
+ file. */
+ if (output_bfd != (bfd *) NULL
+ && (symbol->flags & BSF_SECTION_SYM) == 0
+ && reloc_entry->addend == 0)
+ {
+ *error_message = (char *)
+ _("32bits gp relative relocation occurs for an external symbol");
+ return bfd_reloc_outofrange;
+ }
+
+ if (output_bfd != (bfd *) NULL)
+ {
+ relocateable = true;
+ gp = _bfd_get_gp_value (output_bfd);
+ }
+ else
+ {
+ relocateable = false;
+ output_bfd = symbol->section->output_section->owner;
+
+ ret = mips_elf64_final_gp (output_bfd, symbol, relocateable,
+ error_message, &gp);
+ if (ret != bfd_reloc_ok)
+ return ret;
+ }
+
+ if (bfd_is_com_section (symbol->section))
+ relocation = 0;
+ else
+ relocation = symbol->value;
+
+ relocation += symbol->section->output_section->vma;
+ relocation += symbol->section->output_offset;
+
+ if (reloc_entry->address > input_section->_cooked_size)
+ return bfd_reloc_outofrange;
+
+ if (reloc_entry->howto->src_mask == 0)
+ {
+ /* This case arises with the 64-bit MIPS ELF ABI. */
+ val = 0;
+ }
+ else
+ val = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
+
+ /* Set val to the offset into the section or symbol. */
+ val += reloc_entry->addend;
+
+ /* Adjust val for the final section location and GP value. If we
+ are producing relocateable output, we don't want to do this for
+ an external symbol. */
+ if (! relocateable
+ || (symbol->flags & BSF_SECTION_SYM) != 0)
+ val += relocation - gp;
+
+ bfd_put_32 (abfd, val, (bfd_byte *) data + reloc_entry->address);
+
+ if (relocateable)
+ reloc_entry->address += input_section->output_offset;
+
+ return bfd_reloc_ok;
+}
+
+/* Do a R_MIPS_SHIFT6 relocation. The MSB of the shift is stored at bit 2,
+ the rest is at bits 6-10. The bitpos alredy got right by the howto. */
+
+bfd_reloc_status_type
+mips_elf64_shift6_reloc (abfd, reloc_entry, symbol, data, input_section,
+ output_bfd, error_message)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ arelent *reloc_entry;
+ asymbol *symbol;
+ PTR data ATTRIBUTE_UNUSED;
+ asection *input_section;
+ bfd *output_bfd;
+ char **error_message ATTRIBUTE_UNUSED;
+{
+ /* If we're relocating, and this is an external symbol, we don't
+ want to change anything. */
+ if (output_bfd != (bfd *) NULL
+ && (symbol->flags & BSF_SECTION_SYM) == 0
+ && (! reloc_entry->howto->partial_inplace
+ || reloc_entry->addend == 0))
+ {
+ reloc_entry->address += input_section->output_offset;
+ return bfd_reloc_ok;
+ }
+
+ reloc_entry->addend = (reloc_entry->addend & 0x00007c0)
+ | (reloc_entry->addend & 0x00000800) >> 9;
+
+ return bfd_reloc_continue;
+}
+
+static int
+mips_elf64_additional_program_headers (abfd)
+ bfd *abfd;
+{
+ int ret = 0;
+
+ /* See if we need a PT_MIPS_OPTIONS segment. */
+ if (bfd_get_section_by_name (abfd, ".MIPS.options"))
+ ++ret;
+
+ return ret;
+}
+
+/* Given a BFD reloc type, return a howto structure. */
+
+static reloc_howto_type *
+mips_elf64_reloc_type_lookup (abfd, code)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ bfd_reloc_code_real_type code;
+{
+ /* FIXME: We default to RELA here instead of choosing the right
+ relocation variant. */
+ reloc_howto_type *howto_table = mips_elf64_howto_table_rela;
+
+ switch (code)
+ {
+ case BFD_RELOC_NONE:
+ return &howto_table[R_MIPS_NONE];
+ case BFD_RELOC_16:
+ return &howto_table[R_MIPS_16];
+ case BFD_RELOC_32:
+ return &howto_table[R_MIPS_32];
+ case BFD_RELOC_64:
+ case BFD_RELOC_CTOR:
+ /* We need to handle these specially. Select the right
+ relocation (R_MIPS_32 or R_MIPS_64) based on the
+ size of addresses on this architecture. */
+ if (bfd_arch_bits_per_address (abfd) == 32)
+ return &howto_table[R_MIPS_32];
+ else
+ return &howto_table[R_MIPS_64];
+
+ case BFD_RELOC_16_PCREL:
+ return &howto_table[R_MIPS_PC16];
+ case BFD_RELOC_HI16_S:
+ return &howto_table[R_MIPS_HI16];
+ case BFD_RELOC_LO16:
+ return &howto_table[R_MIPS_LO16];
+ case BFD_RELOC_GPREL16:
+ return &howto_table[R_MIPS_GPREL16];
+ case BFD_RELOC_GPREL32:
+ return &howto_table[R_MIPS_GPREL32];
+ case BFD_RELOC_MIPS_JMP:
+ return &howto_table[R_MIPS_26];
+ case BFD_RELOC_MIPS_LITERAL:
+ return &howto_table[R_MIPS_LITERAL];
+ case BFD_RELOC_MIPS_GOT16:
+ return &howto_table[R_MIPS_GOT16];
+ case BFD_RELOC_MIPS_CALL16:
+ return &howto_table[R_MIPS_CALL16];
+ case BFD_RELOC_MIPS_SHIFT5:
+ return &howto_table[R_MIPS_SHIFT5];
+ case BFD_RELOC_MIPS_SHIFT6:
+ return &howto_table[R_MIPS_SHIFT6];
+ case BFD_RELOC_MIPS_GOT_DISP:
+ return &howto_table[R_MIPS_GOT_DISP];
+ case BFD_RELOC_MIPS_GOT_PAGE:
+ return &howto_table[R_MIPS_GOT_PAGE];
+ case BFD_RELOC_MIPS_GOT_OFST:
+ return &howto_table[R_MIPS_GOT_OFST];
+ case BFD_RELOC_MIPS_GOT_HI16:
+ return &howto_table[R_MIPS_GOT_HI16];
+ case BFD_RELOC_MIPS_GOT_LO16:
+ return &howto_table[R_MIPS_GOT_LO16];
+ case BFD_RELOC_MIPS_SUB:
+ return &howto_table[R_MIPS_SUB];
+ case BFD_RELOC_MIPS_INSERT_A:
+ return &howto_table[R_MIPS_INSERT_A];
+ case BFD_RELOC_MIPS_INSERT_B:
+ return &howto_table[R_MIPS_INSERT_B];
+ case BFD_RELOC_MIPS_DELETE:
+ return &howto_table[R_MIPS_DELETE];
+ case BFD_RELOC_MIPS_HIGHEST:
+ return &howto_table[R_MIPS_HIGHEST];
+ case BFD_RELOC_MIPS_HIGHER:
+ return &howto_table[R_MIPS_HIGHER];
+ case BFD_RELOC_MIPS_CALL_HI16:
+ return &howto_table[R_MIPS_CALL_HI16];
+ case BFD_RELOC_MIPS_CALL_LO16:
+ return &howto_table[R_MIPS_CALL_LO16];
+ case BFD_RELOC_MIPS_SCN_DISP:
+ return &howto_table[R_MIPS_SCN_DISP];
+ case BFD_RELOC_MIPS_REL16:
+ return &howto_table[R_MIPS_REL16];
+ /* Use of R_MIPS_ADD_IMMEDIATE and R_MIPS_PJUMP is deprecated. */
+ case BFD_RELOC_MIPS_RELGOT:
+ return &howto_table[R_MIPS_RELGOT];
+ case BFD_RELOC_MIPS_JALR:
+ return &howto_table[R_MIPS_JALR];
+/*
+ case BFD_RELOC_MIPS16_JMP:
+ return &elf_mips16_jump_howto;
+ case BFD_RELOC_MIPS16_GPREL:
+ return &elf_mips16_gprel_howto;
+ case BFD_RELOC_VTABLE_INHERIT:
+ return &elf_mips_gnu_vtinherit_howto;
+ case BFD_RELOC_VTABLE_ENTRY:
+ return &elf_mips_gnu_vtentry_howto;
+ case BFD_RELOC_PCREL_HI16_S:
+ return &elf_mips_gnu_rel_hi16;
+ case BFD_RELOC_PCREL_LO16:
+ return &elf_mips_gnu_rel_lo16;
+ case BFD_RELOC_16_PCREL_S2:
+ return &elf_mips_gnu_rel16_s2;
+ case BFD_RELOC_64_PCREL:
+ return &elf_mips_gnu_pcrel64;
+ case BFD_RELOC_32_PCREL:
+ return &elf_mips_gnu_pcrel32;
+*/
+ default:
+ bfd_set_error (bfd_error_bad_value);
+ return NULL;
+ }
+}
+
+/* Prevent relocation handling by bfd for MIPS ELF64. */
+
+static void
+mips_elf64_info_to_howto_rel (abfd, cache_ptr, dst)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ arelent *cache_ptr ATTRIBUTE_UNUSED;
+ Elf64_Internal_Rel *dst ATTRIBUTE_UNUSED;
+{
+ BFD_ASSERT (0);
+}
+
+static void
+mips_elf64_info_to_howto_rela (abfd, cache_ptr, dst)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ arelent *cache_ptr ATTRIBUTE_UNUSED;
+ Elf64_Internal_Rela *dst ATTRIBUTE_UNUSED;
+{
+ BFD_ASSERT (0);
}
/* Since each entry in an SHT_REL or SHT_RELA section can represent up
@@ -1413,7 +2207,7 @@ mips_elf64_reloc_type_lookup (abfd, code)
static long
mips_elf64_get_reloc_upper_bound (abfd, sec)
- bfd *abfd;
+ bfd *abfd ATTRIBUTE_UNUSED;
asection *sec;
{
return (sec->reloc_count * 3 + 1) * sizeof (arelent *);
@@ -1432,17 +2226,17 @@ mips_elf64_slurp_one_reloc_table (abfd, asect, symbols, rel_hdr)
bfd_byte *native_relocs;
arelent *relents;
arelent *relent;
- unsigned int count;
- unsigned int i;
+ bfd_vma count;
+ bfd_vma i;
int entsize;
reloc_howto_type *howto_table;
allocated = (PTR) bfd_malloc (rel_hdr->sh_size);
if (allocated == NULL)
- goto error_return;
+ return false;
if (bfd_seek (abfd, rel_hdr->sh_offset, SEEK_SET) != 0
- || (bfd_read (allocated, 1, rel_hdr->sh_size, abfd) != rel_hdr->sh_size))
+ || (bfd_bread (allocated, rel_hdr->sh_size, abfd) != rel_hdr->sh_size))
goto error_return;
native_relocs = (bfd_byte *) allocated;
@@ -1631,6 +2425,7 @@ mips_elf64_slurp_reloc_table (abfd, asect, symbols, dynamic)
asymbol **symbols;
boolean dynamic;
{
+ bfd_size_type amt;
struct bfd_elf_section_data * const d = elf_section_data (asect);
if (dynamic)
@@ -1645,9 +2440,9 @@ mips_elf64_slurp_reloc_table (abfd, asect, symbols, dynamic)
return true;
/* Allocate space for 3 arelent structures for each Rel structure. */
- asect->relocation = ((arelent *)
- bfd_alloc (abfd,
- asect->reloc_count * 3 * sizeof (arelent)));
+ amt = asect->reloc_count;
+ amt *= 3 * sizeof (arelent);
+ asect->relocation = (arelent *) bfd_alloc (abfd, amt);
if (asect->relocation == NULL)
return false;
@@ -1675,12 +2470,9 @@ mips_elf64_write_relocs (abfd, sec, data)
PTR data;
{
boolean *failedp = (boolean *) data;
- unsigned int count;
- Elf_Internal_Shdr *rela_hdr;
- Elf64_Mips_External_Rela *ext_rela;
+ int count;
+ Elf_Internal_Shdr *rel_hdr;
unsigned int idx;
- asymbol *last_sym = 0;
- int last_sym_idx = 0;
/* If we have already failed, don't do anything. */
if (*failedp)
@@ -1725,9 +2517,132 @@ mips_elf64_write_relocs (abfd, sec, data)
}
}
- rela_hdr = &elf_section_data (sec)->rel_hdr;
+ rel_hdr = &elf_section_data (sec)->rel_hdr;
+
+ /* Do the actual relocation. */
+
+ if (rel_hdr->sh_entsize == sizeof(Elf64_Mips_External_Rel))
+ mips_elf64_write_rel (abfd, sec, rel_hdr, &count, data);
+ else if (rel_hdr->sh_entsize == sizeof(Elf64_Mips_External_Rela))
+ mips_elf64_write_rela (abfd, sec, rel_hdr, &count, data);
+ else
+ BFD_ASSERT (0);
+}
+
+static void
+mips_elf64_write_rel (abfd, sec, rel_hdr, count, data)
+ bfd *abfd;
+ asection *sec;
+ Elf_Internal_Shdr *rel_hdr;
+ int *count;
+ PTR data;
+{
+ boolean *failedp = (boolean *) data;
+ Elf64_Mips_External_Rel *ext_rel;
+ unsigned int idx;
+ asymbol *last_sym = 0;
+ int last_sym_idx = 0;
+
+ rel_hdr->sh_size = (bfd_vma)(rel_hdr->sh_entsize * *count);
+ rel_hdr->contents = (PTR) bfd_alloc (abfd, rel_hdr->sh_size);
+ if (rel_hdr->contents == NULL)
+ {
+ *failedp = true;
+ return;
+ }
+
+ ext_rel = (Elf64_Mips_External_Rel *) rel_hdr->contents;
+ for (idx = 0; idx < sec->reloc_count; idx++, ext_rel++)
+ {
+ arelent *ptr;
+ Elf64_Mips_Internal_Rel int_rel;
+ asymbol *sym;
+ int n;
+ unsigned int i;
+
+ ptr = sec->orelocation[idx];
+
+ /* The address of an ELF reloc is section relative for an object
+ file, and absolute for an executable file or shared library.
+ The address of a BFD reloc is always section relative. */
+ if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0)
+ int_rel.r_offset = ptr->address;
+ else
+ int_rel.r_offset = ptr->address + sec->vma;
+
+ sym = *ptr->sym_ptr_ptr;
+ if (sym == last_sym)
+ n = last_sym_idx;
+ else
+ {
+ last_sym = sym;
+ n = _bfd_elf_symbol_from_bfd_symbol (abfd, &sym);
+ if (n < 0)
+ {
+ *failedp = true;
+ return;
+ }
+ last_sym_idx = n;
+ }
+
+ int_rel.r_sym = n;
+ int_rel.r_ssym = RSS_UNDEF;
+
+ if ((*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec
+ && ! _bfd_elf_validate_reloc (abfd, ptr))
+ {
+ *failedp = true;
+ return;
+ }
+
+ int_rel.r_type = ptr->howto->type;
+ int_rel.r_type2 = (int) R_MIPS_NONE;
+ int_rel.r_type3 = (int) R_MIPS_NONE;
+
+ for (i = 0; i < 2; i++)
+ {
+ arelent *r;
+
+ if (idx + 1 >= sec->reloc_count)
+ break;
+ r = sec->orelocation[idx + 1];
+ if (r->address != ptr->address
+ || ! bfd_is_abs_section ((*r->sym_ptr_ptr)->section)
+ || (*r->sym_ptr_ptr)->value != 0)
+ break;
+
+ /* We can merge the reloc at IDX + 1 with the reloc at IDX. */
+
+ if (i == 0)
+ int_rel.r_type2 = r->howto->type;
+ else
+ int_rel.r_type3 = r->howto->type;
+
+ ++idx;
+ }
+
+ mips_elf64_swap_reloc_out (abfd, &int_rel, ext_rel);
+ }
+
+ BFD_ASSERT (ext_rel - (Elf64_Mips_External_Rel *) rel_hdr->contents
+ == *count);
+}
+
+static void
+mips_elf64_write_rela (abfd, sec, rela_hdr, count, data)
+ bfd *abfd;
+ asection *sec;
+ Elf_Internal_Shdr *rela_hdr;
+ int *count;
+ PTR data;
+{
+ boolean *failedp = (boolean *) data;
+ Elf64_Mips_External_Rela *ext_rela;
+ unsigned int idx;
+ asymbol *last_sym = 0;
+ int last_sym_idx = 0;
- rela_hdr->sh_size = rela_hdr->sh_entsize * count;
+ rela_hdr->sh_size = (bfd_vma)(rela_hdr->sh_entsize * *count);
rela_hdr->contents = (PTR) bfd_alloc (abfd, rela_hdr->sh_size);
if (rela_hdr->contents == NULL)
{
@@ -1770,9 +2685,7 @@ mips_elf64_write_relocs (abfd, sec, data)
}
int_rela.r_sym = n;
-
int_rela.r_addend = ptr->addend;
-
int_rela.r_ssym = RSS_UNDEF;
if ((*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec
@@ -1812,213 +2725,4176 @@ mips_elf64_write_relocs (abfd, sec, data)
}
BFD_ASSERT (ext_rela - (Elf64_Mips_External_Rela *) rela_hdr->contents
- == count);
+ == *count);
}
-/* Irix 6 defines a brand new archive map format, so that they can
- have archives more than 4 GB in size. */
+/* This structure is used to hold .got information when linking. It
+ is stored in the tdata field of the bfd_elf_section_data structure. */
-/* Read an Irix 6 armap. */
+struct mips_elf64_got_info
+{
+ /* The global symbol in the GOT with the lowest index in the dynamic
+ symbol table. */
+ struct elf_link_hash_entry *global_gotsym;
+ /* The number of global .got entries. */
+ unsigned int global_gotno;
+ /* The number of local .got entries. */
+ unsigned int local_gotno;
+ /* The number of local .got entries we have used. */
+ unsigned int assigned_gotno;
+};
+
+/* The MIPS ELF64 linker needs additional information for each symbol in
+ the global hash table. */
+
+struct mips_elf64_link_hash_entry
+{
+ struct elf_link_hash_entry root;
+
+ /* External symbol information. */
+ EXTR esym;
+
+ /* Number of R_MIPS_32, R_MIPS_REL32, or R_MIPS_64 relocs against
+ this symbol. */
+ unsigned int possibly_dynamic_relocs;
+
+ /* If the R_MIPS_32, R_MIPS_REL32, or R_MIPS_64 reloc is against
+ a readonly section. */
+ boolean readonly_reloc;
+
+ /* The index of the first dynamic relocation (in the .rel.dyn
+ section) against this symbol. */
+ unsigned int min_dyn_reloc_index;
+
+ /* We must not create a stub for a symbol that has relocations
+ related to taking the function's address, i.e. any but
+ R_MIPS_CALL*16 ones -- see "MIPS ABI Supplement, 3rd Edition",
+ p. 4-20. */
+ boolean no_fn_stub;
+
+ /* If there is a stub that 32 bit functions should use to call this
+ 16 bit function, this points to the section containing the stub. */
+ asection *fn_stub;
+
+ /* Whether we need the fn_stub; this is set if this symbol appears
+ in any relocs other than a 16 bit call. */
+ boolean need_fn_stub;
+
+ /* If there is a stub that 16 bit functions should use to call this
+ 32 bit function, this points to the section containing the stub. */
+ asection *call_stub;
+
+ /* This is like the call_stub field, but it is used if the function
+ being called returns a floating point value. */
+ asection *call_fp_stub;
+};
+
+ /* The mips16 compiler uses a couple of special sections to handle
+ floating point arguments.
+
+ Section names that look like .mips16.fn.FNNAME contain stubs that
+ copy floating point arguments from the fp regs to the gp regs and
+ then jump to FNNAME. If any 32 bit function calls FNNAME, the
+ call should be redirected to the stub instead. If no 32 bit
+ function calls FNNAME, the stub should be discarded. We need to
+ consider any reference to the function, not just a call, because
+ if the address of the function is taken we will need the stub,
+ since the address might be passed to a 32 bit function.
+
+ Section names that look like .mips16.call.FNNAME contain stubs
+ that copy floating point arguments from the gp regs to the fp
+ regs and then jump to FNNAME. If FNNAME is a 32 bit function,
+ then any 16 bit function that calls FNNAME should be redirected
+ to the stub instead. If FNNAME is not a 32 bit function, the
+ stub should be discarded.
+
+ .mips16.call.fp.FNNAME sections are similar, but contain stubs
+ which call FNNAME and then copy the return value from the fp regs
+ to the gp regs. These stubs store the return value in $18 while
+ calling FNNAME; any function which might call one of these stubs
+ must arrange to save $18 around the call. (This case is not
+ needed for 32 bit functions that call 16 bit functions, because
+ 16 bit functions always return floating point values in both
+ $f0/$f1 and $2/$3.)
+
+ Note that in all cases FNNAME might be defined statically.
+ Therefore, FNNAME is not used literally. Instead, the relocation
+ information will indicate which symbol the section is for.
+
+ We record any stubs that we find in the symbol table. */
+
+#define FN_STUB ".mips16.fn."
+#define CALL_STUB ".mips16.call."
+#define CALL_FP_STUB ".mips16.call.fp."
+
+/* MIPS ELF64 linker hash table. */
+
+struct mips_elf64_link_hash_table
+{
+ struct elf_link_hash_table root;
+ /* This is set if we see any mips16 stub sections. */
+ boolean mips16_stubs_seen;
+};
+
+/* Look up an entry in a MIPS ELF64 linker hash table. */
+
+#define mips_elf64_link_hash_lookup(table, string, create, copy, follow) \
+ ((struct mips_elf64_link_hash_entry *) \
+ elf_link_hash_lookup (&(table)->root, (string), (create), \
+ (copy), (follow)))
+
+/* Traverse a MIPS ELF linker hash table. */
+
+#define mips_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 MIPS ELF64 linker hash table from a link_info structure. */
+
+#define mips_elf64_hash_table(p) \
+ ((struct mips_elf64_link_hash_table *) ((p)->hash))
+
+/* Create an entry in a MIPS ELF64 linker hash table. */
+
+static struct bfd_hash_entry *
+mips_elf64_link_hash_newfunc (entry, table, string)
+ struct bfd_hash_entry *entry;
+ struct bfd_hash_table *table;
+ const char *string;
+{
+ struct mips_elf64_link_hash_entry *ret =
+ (struct mips_elf64_link_hash_entry *) entry;
+
+ /* Allocate the structure if it has not already been allocated by a
+ subclass. */
+ if (ret == (struct mips_elf64_link_hash_entry *) NULL)
+ ret = ((struct mips_elf64_link_hash_entry *)
+ bfd_hash_allocate (table,
+ sizeof (struct mips_elf64_link_hash_entry)));
+ if (ret == (struct mips_elf64_link_hash_entry *) NULL)
+ return (struct bfd_hash_entry *) ret;
+
+ /* Call the allocation method of the superclass. */
+ ret = ((struct mips_elf64_link_hash_entry *)
+ _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret,
+ table, string));
+ if (ret != (struct mips_elf64_link_hash_entry *) NULL)
+ {
+ /* Set local fields. */
+ memset (&ret->esym, 0, sizeof (EXTR));
+ /* We use -2 as a marker to indicate that the information has
+ not been set. -1 means there is no associated ifd. */
+ ret->esym.ifd = -2;
+ ret->possibly_dynamic_relocs = 0;
+ ret->readonly_reloc = false;
+ ret->min_dyn_reloc_index = 0;
+ ret->no_fn_stub = false;
+ ret->fn_stub = NULL;
+ ret->need_fn_stub = false;
+ ret->call_stub = NULL;
+ ret->call_fp_stub = NULL;
+ }
+
+ return (struct bfd_hash_entry *) ret;
+}
+
+/* Create a MIPS ELF64 linker hash table. */
+
+struct bfd_link_hash_table *
+mips_elf64_link_hash_table_create (abfd)
+ bfd *abfd;
+{
+ struct mips_elf64_link_hash_table *ret;
+
+ ret = ((struct mips_elf64_link_hash_table *)
+ bfd_alloc (abfd, sizeof (struct mips_elf64_link_hash_table)));
+ if (ret == (struct mips_elf64_link_hash_table *) NULL)
+ return NULL;
+
+ if (! _bfd_elf_link_hash_table_init (&ret->root, abfd,
+ mips_elf64_link_hash_newfunc))
+ {
+ bfd_release (abfd, ret);
+ return NULL;
+ }
+
+ ret->mips16_stubs_seen = false;
+
+ return &ret->root.root;
+}
+
+/* Returns the offset for the entry at the INDEXth position
+ in the GOT. */
+
+static bfd_vma
+mips_elf64_got_offset_from_index (dynobj, output_bfd, index)
+ bfd *dynobj;
+ bfd *output_bfd;
+ bfd_vma index;
+{
+ asection *sgot;
+ bfd_vma gp;
+
+ sgot = bfd_get_section_by_name (dynobj, ".got");
+ gp = _bfd_get_gp_value (output_bfd);
+ return (sgot->output_section->vma + sgot->output_offset + index -
+ gp);
+}
+
+/* Returns the GOT information associated with the link indicated by
+ INFO. If SGOTP is non-NULL, it is filled in with the GOT
+ section. */
+
+static struct mips_elf64_got_info *
+_mips_elf64_got_info (abfd, sgotp)
+ bfd *abfd;
+ asection **sgotp;
+{
+ asection *sgot;
+ struct mips_elf64_got_info *g;
+
+ sgot = bfd_get_section_by_name (abfd, ".got");
+ BFD_ASSERT (sgot != NULL);
+ BFD_ASSERT (elf_section_data (sgot) != NULL);
+ g = (struct mips_elf64_got_info *) elf_section_data (sgot)->tdata;
+ BFD_ASSERT (g != NULL);
+
+ if (sgotp)
+ *sgotp = sgot;
+ return g;
+}
+
+/* Sign-extend VALUE, which has the indicated number of BITS. */
+
+static bfd_vma
+mips_elf64_sign_extend (value, bits)
+ bfd_vma value;
+ int bits;
+{
+ if (value & ((bfd_vma)1 << (bits - 1)))
+ /* VALUE is negative. */
+ value |= ((bfd_vma) - 1) << bits;
+
+ return value;
+}
+
+/* Return non-zero if the indicated VALUE has overflowed the maximum
+ range expressable by a signed number with the indicated number of
+ BITS. */
+
+static boolean
+mips_elf64_overflow_p (value, bits)
+ bfd_vma value;
+ int bits;
+{
+ bfd_signed_vma svalue = (bfd_signed_vma) value;
+
+ if (svalue > (1 << (bits - 1)) - 1)
+ /* The value is too big. */
+ return true;
+ else if (svalue < -(1 << (bits - 1)))
+ /* The value is too small. */
+ return true;
+
+ /* All is well. */
+ return false;
+}
+
+/* Returns the GOT index for the global symbol indicated by H. */
+
+static bfd_vma
+mips_elf64_global_got_index (abfd, h)
+ bfd *abfd;
+ struct elf_link_hash_entry *h;
+{
+ bfd_vma index;
+ asection *sgot;
+ struct mips_elf64_got_info *g;
+
+ g = _mips_elf64_got_info (abfd, &sgot);
+
+ /* Once we determine the global GOT entry with the lowest dynamic
+ symbol table index, we must put all dynamic symbols with greater
+ indices into the GOT. That makes it easy to calculate the GOT
+ offset. */
+ BFD_ASSERT (h->dynindx >= g->global_gotsym->dynindx);
+ index = ((h->dynindx - g->global_gotsym->dynindx + g->local_gotno)
+ * (get_elf_backend_data (abfd)->s->arch_size / 8));
+ BFD_ASSERT (index < sgot->_raw_size);
+
+ return index;
+}
+
+struct mips_elf64_hash_sort_data
+{
+ /* The symbol in the global GOT with the lowest dynamic symbol table
+ index. */
+ struct elf_link_hash_entry *low;
+ /* The least dynamic symbol table index corresponding to a symbol
+ with a GOT entry. */
+ long min_got_dynindx;
+ /* The greatest dynamic symbol table index not corresponding to a
+ symbol without a GOT entry. */
+ long max_non_got_dynindx;
+};
+
+/* If H needs a GOT entry, assign it the highest available dynamic
+ index. Otherwise, assign it the lowest available dynamic
+ index. */
+
+static boolean
+mips_elf64_sort_hash_table_f (h, data)
+ struct mips_elf64_link_hash_entry *h;
+ PTR data;
+{
+ struct mips_elf64_hash_sort_data *hsd
+ = (struct mips_elf64_hash_sort_data *) data;
+
+ if (h->root.root.type == bfd_link_hash_warning)
+ h = (struct mips_elf64_link_hash_entry *) h->root.root.u.i.link;
+
+ /* Symbols without dynamic symbol table entries aren't interesting
+ at all. */
+ if (h->root.dynindx == -1)
+ return true;
+
+ if (h->root.got.offset != 1)
+ h->root.dynindx = hsd->max_non_got_dynindx++;
+ else
+ {
+ h->root.dynindx = --hsd->min_got_dynindx;
+ hsd->low = (struct elf_link_hash_entry *) h;
+ }
+
+ return true;
+}
+
+/* Sort the dynamic symbol table so that symbols that need GOT entries
+ appear towards the end. This reduces the amount of GOT space
+ required. MAX_LOCAL is used to set the number of local symbols
+ known to be in the dynamic symbol table. During
+ mips_elf64_size_dynamic_sections, this value is 1. Afterward, the
+ section symbols are added and the count is higher. */
static boolean
-mips_elf64_slurp_armap (abfd)
+mips_elf64_sort_hash_table (info, max_local)
+ struct bfd_link_info *info;
+ unsigned long max_local;
+{
+ struct mips_elf64_hash_sort_data hsd;
+ struct mips_elf64_got_info *g;
+ bfd *dynobj;
+
+ dynobj = elf_hash_table (info)->dynobj;
+
+ hsd.low = NULL;
+ hsd.min_got_dynindx = elf_hash_table (info)->dynsymcount;
+ hsd.max_non_got_dynindx = max_local;
+ mips_elf64_link_hash_traverse (((struct mips_elf64_link_hash_table *)
+ elf_hash_table (info)),
+ mips_elf64_sort_hash_table_f,
+ &hsd);
+
+ /* There shoud have been enough room in the symbol table to
+ accomodate both the GOT and non-GOT symbols. */
+ BFD_ASSERT (hsd.max_non_got_dynindx <= hsd.min_got_dynindx);
+
+ /* Now we know which dynamic symbol has the lowest dynamic symbol
+ table index in the GOT. */
+ g = _mips_elf64_got_info (dynobj, NULL);
+ g->global_gotsym = hsd.low;
+
+ return true;
+}
+
+#if 0
+/* Swap in an MSYM entry. */
+
+static void
+mips_elf64_swap_msym_in (abfd, ex, in)
+ bfd *abfd;
+ const Elf32_External_Msym *ex;
+ Elf32_Internal_Msym *in;
+{
+ in->ms_hash_value = H_GET_32 (abfd, ex->ms_hash_value);
+ in->ms_info = H_GET_32 (abfd, ex->ms_info);
+}
+#endif
+/* Swap out an MSYM entry. */
+
+static void
+mips_elf64_swap_msym_out (abfd, in, ex)
bfd *abfd;
+ const Elf32_Internal_Msym *in;
+ Elf32_External_Msym *ex;
{
- struct artdata *ardata = bfd_ardata (abfd);
- char nextname[17];
- file_ptr arhdrpos;
- bfd_size_type i, parsed_size, nsymz, stringsize, carsym_size, ptrsize;
- struct areltdata *mapdata;
- bfd_byte int_buf[8];
- char *stringbase;
- bfd_byte *raw_armap = NULL;
- carsym *carsyms;
-
- ardata->symdefs = NULL;
-
- /* Get the name of the first element. */
- arhdrpos = bfd_tell (abfd);
- i = bfd_read ((PTR) nextname, 1, 16, abfd);
- if (i == 0)
+ H_PUT_32 (abfd, in->ms_hash_value, ex->ms_hash_value);
+ H_PUT_32 (abfd, in->ms_info, ex->ms_info);
+}
+
+/* Create a local GOT entry for VALUE. Return the index of the entry,
+ or -1 if it could not be created. */
+
+static bfd_vma
+mips_elf64_create_local_got_entry (abfd, g, sgot, value)
+ bfd *abfd;
+ struct mips_elf64_got_info *g;
+ asection *sgot;
+ bfd_vma value;
+{
+ CONST bfd_vma got_size = get_elf_backend_data (abfd)->s->arch_size / 8;
+
+ if (g->assigned_gotno >= g->local_gotno)
+ {
+ /* We didn't allocate enough space in the GOT. */
+ (*_bfd_error_handler)
+ (_("not enough GOT space for local GOT entries"));
+ bfd_set_error (bfd_error_bad_value);
+ return (bfd_vma) -1;
+ }
+
+ bfd_put_64 (abfd, value, (sgot->contents + got_size * g->assigned_gotno));
+ return got_size * g->assigned_gotno++;
+}
+
+/* Returns the GOT offset at which the indicated address can be found.
+ If there is not yet a GOT entry for this value, create one. Returns
+ -1 if no satisfactory GOT offset can be found. */
+
+static bfd_vma
+mips_elf64_local_got_index (abfd, info, value)
+ bfd *abfd;
+ struct bfd_link_info *info;
+ bfd_vma value;
+{
+ CONST bfd_vma got_size = get_elf_backend_data (abfd)->s->arch_size / 8;
+ asection *sgot;
+ struct mips_elf64_got_info *g;
+ bfd_byte *entry;
+
+ g = _mips_elf64_got_info (elf_hash_table (info)->dynobj, &sgot);
+
+ /* Look to see if we already have an appropriate entry. */
+ for (entry = (sgot->contents + got_size * MIPS_RESERVED_GOTNO);
+ entry != sgot->contents + got_size * g->assigned_gotno;
+ entry += got_size)
+ {
+ bfd_vma address = bfd_get_64 (abfd, entry);
+ if (address == value)
+ return entry - sgot->contents;
+ }
+
+ return mips_elf64_create_local_got_entry (abfd, g, sgot, value);
+}
+
+/* Find a GOT entry that is within 32KB of the VALUE. These entries
+ are supposed to be placed at small offsets in the GOT, i.e.,
+ within 32KB of GP. Return the index into the GOT for this page,
+ and store the offset from this entry to the desired address in
+ OFFSETP, if it is non-NULL. */
+
+static bfd_vma
+mips_elf64_got_page (abfd, info, value, offsetp)
+ bfd *abfd;
+ struct bfd_link_info *info;
+ bfd_vma value;
+ bfd_vma *offsetp;
+{
+ CONST bfd_vma got_size = get_elf_backend_data (abfd)->s->arch_size / 8;
+ asection *sgot;
+ struct mips_elf64_got_info *g;
+ bfd_byte *entry;
+ bfd_byte *last_entry;
+ bfd_vma index = 0;
+ bfd_vma address;
+
+ g = _mips_elf64_got_info (elf_hash_table (info)->dynobj, &sgot);
+
+ /* Look to see if we aleady have an appropriate entry. */
+ last_entry = sgot->contents + got_size * g->assigned_gotno;
+ for (entry = (sgot->contents + got_size * MIPS_RESERVED_GOTNO);
+ entry != last_entry;
+ entry += got_size)
+ {
+ address = bfd_get_64 (abfd, entry);
+
+ if (!mips_elf64_overflow_p (value - address, 16))
+ {
+ /* This entry will serve as the page pointer. We can add a
+ 16-bit number to it to get the actual address. */
+ index = entry - sgot->contents;
+ break;
+ }
+ }
+
+ /* If we didn't have an appropriate entry, we create one now. */
+ if (entry == last_entry)
+ index = mips_elf64_create_local_got_entry (abfd, g, sgot, value);
+
+ if (offsetp)
+ {
+ address = bfd_get_64 (abfd, entry);
+ *offsetp = value - address;
+ }
+
+ return index;
+}
+
+/* Find a GOT entry whose higher-order 16 bits are the same as those
+ for value. Return the index into the GOT for this entry. */
+
+static bfd_vma
+mips_elf64_got16_entry (abfd, info, value, external)
+ bfd *abfd;
+ struct bfd_link_info *info;
+ bfd_vma value;
+ boolean external;
+{
+ CONST bfd_vma got_size = get_elf_backend_data (abfd)->s->arch_size / 8;
+ asection *sgot;
+ struct mips_elf64_got_info *g;
+ bfd_byte *entry;
+ bfd_byte *last_entry;
+ bfd_vma index = 0;
+ bfd_vma address;
+
+ if (! external)
+ {
+ /* Although the ABI says that it is "the high-order 16 bits" that we
+ want, it is really the %high value. The complete value is
+ calculated with a `addiu' of a LO16 relocation, just as with a
+ HI16/LO16 pair. */
+ value = mips_elf64_high (value) << 16;
+ }
+
+ g = _mips_elf64_got_info (elf_hash_table (info)->dynobj, &sgot);
+
+ /* Look to see if we already have an appropriate entry. */
+ last_entry = sgot->contents + got_size * g->assigned_gotno;
+ for (entry = (sgot->contents + got_size * MIPS_RESERVED_GOTNO);
+ entry != last_entry;
+ entry += got_size)
+ {
+ address = bfd_get_64 (abfd, entry);
+ if (address == value)
+ {
+ /* This entry has the right high-order 16 bits, and the low-order
+ 16 bits are set to zero. */
+ index = entry - sgot->contents;
+ break;
+ }
+ }
+
+ /* If we didn't have an appropriate entry, we create one now. */
+ if (entry == last_entry)
+ index = mips_elf64_create_local_got_entry (abfd, g, sgot, value);
+
+ return index;
+}
+
+/* Return whether a relocation is against a local symbol. */
+
+static boolean
+mips_elf64_local_relocation_p (input_bfd, relocation, local_sections,
+ check_forced)
+ bfd *input_bfd;
+ const Elf_Internal_Rela *relocation;
+ asection **local_sections;
+ boolean check_forced;
+{
+ unsigned long r_symndx;
+ Elf_Internal_Shdr *symtab_hdr;
+ struct mips_elf64_link_hash_entry* h;
+ size_t extsymoff;
+
+ r_symndx = ELF64_R_SYM (relocation->r_info);
+ symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+ extsymoff = (elf_bad_symtab (input_bfd)) ? 0 : symtab_hdr->sh_info;
+
+ if (r_symndx < extsymoff)
+ return true;
+ if (elf_bad_symtab (input_bfd) && local_sections[r_symndx] != NULL)
return true;
- if (i != 16)
+
+ if (check_forced)
+ {
+ /* Look up the hash table to check whether the symbol
+ was forced local. */
+ h = (struct mips_elf64_link_hash_entry *)
+ elf_sym_hashes (input_bfd) [r_symndx - extsymoff];
+ /* Find the real hash-table entry for this symbol. */
+ while (h->root.root.type == bfd_link_hash_indirect
+ || h->root.root.type == bfd_link_hash_warning)
+ h = (struct mips_elf64_link_hash_entry *) h->root.root.u.i.link;
+ if ((h->root.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
+ return true;
+ }
+
+ return false;
+}
+
+/* Returns the first relocation of type r_type found, beginning with
+ RELOCATION. RELEND is one-past-the-end of the relocation table. */
+
+static const Elf_Internal_Rela *
+mips_elf64_next_relocation (r_type, relocation, relend)
+ unsigned int r_type;
+ const Elf_Internal_Rela *relocation;
+ const Elf_Internal_Rela *relend;
+{
+ /* According to the MIPS ELF ABI, the R_MIPS_LO16 relocation must be
+ immediately following. However, for the IRIX6 ABI, the next
+ relocation may be a composed relocation consisting of several
+ relocations for the same address. In that case, the R_MIPS_LO16
+ relocation may occur as one of these. We permit a similar
+ extension in general, as that is useful for GCC. */
+ while (relocation < relend)
+ {
+ if (ELF64_MIPS_R_TYPE (relocation->r_info) == r_type)
+ return relocation;
+
+ ++relocation;
+ }
+
+ /* We didn't find it. */
+ bfd_set_error (bfd_error_bad_value);
+ return NULL;
+}
+
+/* Create a rel.dyn relocation for the dynamic linker to resolve. REL
+ is the original relocation, which is now being transformed into a
+ dynamic relocation. The ADDENDP is adjusted if necessary; the
+ caller should store the result in place of the original addend. */
+
+static boolean
+mips_elf64_create_dynamic_relocation (output_bfd, info, rel, h, sec,
+ symbol, addendp, input_section)
+ bfd *output_bfd;
+ struct bfd_link_info *info;
+ const Elf_Internal_Rela *rel;
+ struct mips_elf64_link_hash_entry *h;
+ asection *sec;
+ bfd_vma symbol;
+ bfd_vma *addendp;
+ asection *input_section;
+{
+ Elf_Internal_Rel outrel[3];
+ boolean skip;
+ asection *sreloc;
+ bfd *dynobj;
+ int r_type;
+
+ r_type = ELF64_MIPS_R_TYPE (rel->r_info);
+ dynobj = elf_hash_table (info)->dynobj;
+ sreloc = bfd_get_section_by_name (dynobj, ".rel.dyn");
+ BFD_ASSERT (sreloc != NULL);
+ BFD_ASSERT (sreloc->contents != NULL);
+ BFD_ASSERT ((sreloc->reloc_count
+ * get_elf_backend_data (output_bfd)->s->sizeof_rel)
+ < sreloc->_raw_size);
+
+ skip = false;
+ 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
+ later to reflect the correct output offsets. */
+ if (elf_section_data (input_section)->sec_info_type != ELF_INFO_TYPE_STABS)
+ {
+ outrel[1].r_offset = rel[1].r_offset;
+ outrel[2].r_offset = rel[2].r_offset;
+ }
+ else
+ {
+ /* Except that in a stab section things are more complex.
+ Because we compress stab information, the offset given in the
+ relocation may not be the one we want; we must let the stabs
+ machinery tell us the offset. */
+ outrel[1].r_offset = outrel[0].r_offset;
+ outrel[2].r_offset = outrel[0].r_offset;
+ /* If we didn't need the relocation at all, this value will be
+ -1. */
+ if (outrel[0].r_offset == (bfd_vma) -1)
+ skip = true;
+ }
+
+ /* 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
+ is a way of setting R_TYPE to R_MIPS_NONE. */
+ if (skip)
+ memset (outrel, 0, sizeof (Elf_Internal_Rel) * 3);
+ else
+ {
+ long indx;
+ bfd_vma section_offset;
+
+ /* We must now calculate the dynamic symbol table index to use
+ in the relocation. */
+ if (h != NULL
+ && (! info->symbolic || (h->root.elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0))
+ {
+ indx = h->root.dynindx;
+ /* h->root.dynindx may be -1 if this symbol was marked to
+ become local. */
+ if (indx == -1)
+ indx = 0;
+ }
+ else
+ {
+ if (sec != NULL && bfd_is_abs_section (sec))
+ indx = 0;
+ else if (sec == NULL || sec->owner == NULL)
+ {
+ bfd_set_error (bfd_error_bad_value);
+ return false;
+ }
+ else
+ {
+ indx = elf_section_data (sec->output_section)->dynindx;
+ if (indx == 0)
+ abort ();
+ }
+
+ /* Figure out how far the target of the relocation is from
+ the beginning of its section. */
+ section_offset = symbol - sec->output_section->vma;
+ /* The relocation we're building is section-relative.
+ Therefore, the original addend must be adjusted by the
+ section offset. */
+ *addendp += section_offset;
+ /* Now, the relocation is just against the section. */
+ symbol = sec->output_section->vma;
+ }
+
+ /* If the relocation was previously an absolute relocation and
+ this symbol will not be referred to by the relocation, we must
+ adjust it by the value we give it in the dynamic symbol table.
+ Otherwise leave the job up to the dynamic linker. */
+ if (!indx && r_type != R_MIPS_REL32)
+ *addendp += symbol;
+
+ /* The relocation is always an REL32 relocation because we don't
+ know where the shared library will wind up at load-time. */
+ outrel[0].r_info = ELF64_R_INFO (indx, R_MIPS_REL32);
+
+ /* Adjust the output offset of the relocation to reference the
+ correct location in the output file. */
+ outrel[0].r_offset += (input_section->output_section->vma
+ + input_section->output_offset);
+ outrel[1].r_offset += (input_section->output_section->vma
+ + input_section->output_offset);
+ outrel[2].r_offset += (input_section->output_section->vma
+ + input_section->output_offset);
+ }
+
+ /* Put the relocation back out. */
+ mips_elf64_be_swap_reloc_out (output_bfd, outrel,
+ (sreloc->contents
+ + sreloc->reloc_count
+ * sizeof (Elf64_Mips_External_Rel)));
+
+ /* Record the index of the first relocation referencing H. This
+ information is later emitted in the .msym section. */
+ if (h != NULL
+ && (h->min_dyn_reloc_index == 0
+ || sreloc->reloc_count < h->min_dyn_reloc_index))
+ h->min_dyn_reloc_index = sreloc->reloc_count;
+
+ /* We've now added another relocation. */
+ ++sreloc->reloc_count;
+
+ /* Make sure the output section is writable. The dynamic linker
+ will be writing to it. */
+ elf_section_data (input_section->output_section)->this_hdr.sh_flags
+ |= SHF_WRITE;
+
+ return true;
+}
+
+/* Calculate the value produced by the RELOCATION (which comes from
+ the INPUT_BFD). The ADDEND is the addend to use for this
+ RELOCATION; RELOCATION->R_ADDEND is ignored.
+
+ The result of the relocation calculation is stored in VALUEP.
+ REQUIRE_JALXP indicates whether or not the opcode used with this
+ relocation must be JALX.
+
+ This function returns bfd_reloc_continue if the caller need take no
+ further action regarding this relocation, bfd_reloc_notsupported if
+ something goes dramatically wrong, bfd_reloc_overflow if an
+ overflow occurs, and bfd_reloc_ok to indicate success. */
+
+static bfd_reloc_status_type
+mips_elf64_calculate_relocation (abfd, input_bfd, input_section, info,
+ relocation, addend, howto, local_syms,
+ local_sections, valuep, namep, require_jalxp)
+ bfd *abfd;
+ bfd *input_bfd;
+ asection *input_section;
+ struct bfd_link_info *info;
+ const Elf_Internal_Rela *relocation;
+ bfd_vma addend;
+ reloc_howto_type *howto;
+ Elf_Internal_Sym *local_syms;
+ asection **local_sections;
+ bfd_vma *valuep;
+ const char **namep;
+ boolean *require_jalxp;
+{
+ /* The eventual value we will return. */
+ bfd_vma value;
+ /* The address of the symbol against which the relocation is
+ occurring. */
+ bfd_vma symbol = 0;
+ /* The final GP value to be used for the relocatable, executable, or
+ shared object file being produced. */
+ bfd_vma gp = (bfd_vma) - 1;
+ /* The place (section offset or address) of the storage unit being
+ relocated. */
+ bfd_vma p;
+ /* The value of GP used to create the relocatable object. */
+ bfd_vma gp0 = (bfd_vma) - 1;
+ /* The offset into the global offset table at which the address of
+ the relocation entry symbol, adjusted by the addend, resides
+ during execution. */
+ bfd_vma g = (bfd_vma) - 1;
+ /* The section in which the symbol referenced by the relocation is
+ located. */
+ asection *sec = NULL;
+ struct mips_elf64_link_hash_entry* h = NULL;
+ /* True if the symbol referred to by this relocation is a local
+ symbol. */
+ boolean local_p;
+ Elf_Internal_Shdr *symtab_hdr;
+ size_t extsymoff;
+ unsigned long r_symndx;
+ int r_type;
+ /* True if overflow occurred during the calculation of the
+ relocation value. */
+ boolean overflowed_p;
+ /* True if this relocation refers to a MIPS16 function. */
+ boolean target_is_16_bit_code_p = false;
+
+ /* Parse the relocation. */
+ r_symndx = ELF64_R_SYM (relocation->r_info);
+ r_type = ELF64_MIPS_R_TYPE (relocation->r_info);
+ p = (input_section->output_section->vma
+ + input_section->output_offset
+ + relocation->r_offset);
+
+ /* Assume that there will be no overflow. */
+ overflowed_p = false;
+
+ /* Figure out whether or not the symbol is local, and get the offset
+ used in the array of hash table entries. */
+ symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+ local_p = mips_elf64_local_relocation_p (input_bfd, relocation,
+ local_sections, false);
+ if (! elf_bad_symtab (input_bfd))
+ extsymoff = symtab_hdr->sh_info;
+ else
+ {
+ /* The symbol table does not follow the rule that local symbols
+ must come before globals. */
+ extsymoff = 0;
+ }
+
+ /* Figure out the value of the symbol. */
+ if (local_p)
+ {
+ Elf_Internal_Sym *sym;
+
+ sym = local_syms + r_symndx;
+ sec = local_sections[r_symndx];
+
+ symbol = sec->output_section->vma + sec->output_offset;
+ if (ELF_ST_TYPE (sym->st_info) != STT_SECTION)
+ symbol += sym->st_value;
+
+ /* MIPS16 text labels should be treated as odd. */
+ if (sym->st_other == STO_MIPS16)
+ ++symbol;
+
+ /* Record the name of this symbol, for our caller. */
+ *namep = bfd_elf_string_from_elf_section (input_bfd,
+ symtab_hdr->sh_link,
+ sym->st_name);
+ if (*namep == '\0')
+ *namep = bfd_section_name (input_bfd, sec);
+
+ target_is_16_bit_code_p = (sym->st_other == STO_MIPS16);
+ }
+ else
+ {
+ /* For global symbols we look up the symbol in the hash-table. */
+ h = ((struct mips_elf64_link_hash_entry *)
+ elf_sym_hashes (input_bfd) [r_symndx - extsymoff]);
+ /* Find the real hash-table entry for this symbol. */
+ while (h->root.root.type == bfd_link_hash_indirect
+ || h->root.root.type == bfd_link_hash_warning)
+ h = (struct mips_elf64_link_hash_entry *) h->root.root.u.i.link;
+
+ /* Record the name of this symbol, for our caller. */
+ *namep = h->root.root.root.string;
+
+ /* If this symbol is defined, calculate its address. */
+ if ((h->root.root.type == bfd_link_hash_defined
+ || h->root.root.type == bfd_link_hash_defweak)
+ && h->root.root.u.def.section)
+ {
+ sec = h->root.root.u.def.section;
+ if (sec->output_section)
+ symbol = (h->root.root.u.def.value
+ + sec->output_section->vma
+ + sec->output_offset);
+ else
+ symbol = h->root.root.u.def.value;
+ }
+ else if (h->root.root.type == bfd_link_hash_undefweak)
+ /* We allow relocations against undefined weak symbols, giving
+ it the value zero, so that you can undefined weak functions
+ and check to see if they exist by looking at their
+ addresses. */
+ symbol = 0;
+ else if (info->shared
+ && (!info->symbolic || info->allow_shlib_undefined)
+ && !info->no_undefined
+ && ELF_ST_VISIBILITY (h->root.other) == STV_DEFAULT)
+ symbol = 0;
+ else if (strcmp (h->root.root.root.string, "_DYNAMIC_LINK") == 0 ||
+ strcmp (h->root.root.root.string, "_DYNAMIC_LINKING") == 0)
+ {
+ /* If this is a dynamic link, we should have created a
+ _DYNAMIC_LINK symbol or _DYNAMIC_LINKING(for normal mips) symbol
+ in in mips_elf64_create_dynamic_sections.
+ Otherwise, we should define the symbol with a value of 0.
+ FIXME: It should probably get into the symbol table
+ somehow as well. */
+ BFD_ASSERT (! info->shared);
+ BFD_ASSERT (bfd_get_section_by_name (abfd, ".dynamic") == NULL);
+ symbol = 0;
+ }
+ else
+ {
+ if (! ((*info->callbacks->undefined_symbol)
+ (info, h->root.root.root.string, input_bfd,
+ input_section, relocation->r_offset,
+ (!info->shared || info->no_undefined
+ || ELF_ST_VISIBILITY (h->root.other)))))
+ return bfd_reloc_undefined;
+ symbol = 0;
+ }
+
+ target_is_16_bit_code_p = (h->root.other == STO_MIPS16);
+ }
+
+ /* If this is a 64-bit call to a 16-bit function with a stub, we
+ need to redirect the call to the stub, unless we're already *in*
+ a stub. */
+ if (r_type != R_MIPS16_26 && !info->relocateable
+ && ((h != NULL && h->fn_stub != NULL)
+ || (local_p && elf_tdata (input_bfd)->local_stubs != NULL
+ && elf_tdata (input_bfd)->local_stubs[r_symndx] != NULL))
+ && !mips_elf64_stub_section_p (input_bfd, input_section))
+ {
+ /* This is a 64-bit call to a 16-bit function. We should
+ have already noticed that we were going to need the
+ stub. */
+ if (local_p)
+ sec = elf_tdata (input_bfd)->local_stubs[r_symndx];
+ else
+ {
+ BFD_ASSERT (h->need_fn_stub);
+ sec = h->fn_stub;
+ }
+
+ symbol = sec->output_section->vma + sec->output_offset;
+ }
+ /* If this is a 16-bit call to a 64-bit function with a stub, we
+ need to redirect the call to the stub. */
+ else if (r_type == R_MIPS16_26 && !info->relocateable
+ && h != NULL
+ && (h->call_stub != NULL || h->call_fp_stub != NULL)
+ && !target_is_16_bit_code_p)
+ {
+ /* If both call_stub and call_fp_stub are defined, we can figure
+ out which one to use by seeing which one appears in the input
+ file. */
+ if (h->call_stub != NULL && h->call_fp_stub != NULL)
+ {
+ asection *o;
+
+ sec = NULL;
+ for (o = input_bfd->sections; o != NULL; o = o->next)
+ {
+ if (strncmp (bfd_get_section_name (input_bfd, o),
+ CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0)
+ {
+ sec = h->call_fp_stub;
+ break;
+ }
+ }
+ if (sec == NULL)
+ sec = h->call_stub;
+ }
+ else if (h->call_stub != NULL)
+ sec = h->call_stub;
+ else
+ sec = h->call_fp_stub;
+
+ BFD_ASSERT (sec->_raw_size > 0);
+ symbol = sec->output_section->vma + sec->output_offset;
+ }
+
+ /* Calls from 16-bit code to 32-bit code and vice versa require the
+ special jalx instruction. */
+ *require_jalxp = (!info->relocateable
+ && ((r_type == R_MIPS16_26) != target_is_16_bit_code_p));
+
+ local_p = mips_elf64_local_relocation_p (input_bfd, relocation,
+ local_sections, true);
+
+ /* If we haven't already determined the GOT offset, or the GP value,
+ and we're going to need it, get it now. */
+ switch (r_type)
+ {
+ case R_MIPS_CALL16:
+ case R_MIPS_GOT16:
+ case R_MIPS_GOT_DISP:
+ case R_MIPS_GOT_HI16:
+ case R_MIPS_CALL_HI16:
+ case R_MIPS_GOT_LO16:
+ case R_MIPS_CALL_LO16:
+ /* Find the index into the GOT where this value is located. */
+ if (!local_p)
+ {
+ BFD_ASSERT (addend == 0);
+ g = mips_elf64_global_got_index (elf_hash_table (info)->dynobj,
+ (struct elf_link_hash_entry*) h);
+ if (! elf_hash_table(info)->dynamic_sections_created
+ || (info->shared
+ && (info->symbolic || h->root.dynindx == -1)
+ && (h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
+ {
+ /* This is a static link or a -Bsymbolic link. The
+ symbol is defined locally, or was forced to be local.
+ We must initialize this entry in the GOT. */
+ bfd *tmpbfd = elf_hash_table (info)->dynobj;
+
+ asection *sgot = bfd_get_section_by_name (tmpbfd, ".got");
+ bfd_put_64 (tmpbfd, symbol + addend, sgot->contents + g);
+ }
+ }
+ else if (r_type == R_MIPS_GOT16 || r_type == R_MIPS_CALL16)
+ /* There's no need to create a local GOT entry here; the
+ calculation for a local GOT16 entry does not involve G. */
+ break;
+ else
+ {
+ g = mips_elf64_local_got_index (abfd, info, symbol + addend);
+ if (g == (bfd_vma) -1)
+ return false;
+ }
+
+ /* Convert GOT indices to actual offsets. */
+ g = mips_elf64_got_offset_from_index (elf_hash_table (info)->dynobj,
+ abfd, g);
+ break;
+
+ case R_MIPS_HI16:
+ case R_MIPS_LO16:
+ case R_MIPS_GPREL16:
+ case R_MIPS_GPREL32:
+ case R_MIPS_LITERAL:
+ gp0 = _bfd_get_gp_value (input_bfd);
+ gp = _bfd_get_gp_value (abfd);
+ break;
+
+ default:
+ break;
+ }
+
+ /* Figure out what kind of relocation is being performed. */
+ switch (r_type)
+ {
+ case R_MIPS_NONE:
+ return bfd_reloc_continue;
+
+ case R_MIPS_16:
+ value = symbol + mips_elf64_sign_extend (addend, 16);
+ overflowed_p = mips_elf64_overflow_p (value, 16);
+ break;
+
+ case R_MIPS_32:
+ case R_MIPS_REL32:
+ case R_MIPS_64:
+ if ((info->shared
+ || (elf_hash_table (info)->dynamic_sections_created
+ && h != NULL
+ && ((h->root.elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_DYNAMIC) != 0)
+ && ((h->root.elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0)))
+ && r_symndx != 0
+ && (input_section->flags & SEC_ALLOC) != 0)
+ {
+ /* If we're creating a shared library, or this relocation is
+ against a symbol in a shared library, then we can't know
+ where the symbol will end up. So, we create a relocation
+ record in the output, and leave the job up to the dynamic
+ linker. */
+ value = addend;
+ if (!mips_elf64_create_dynamic_relocation (abfd, info, relocation,
+ h, sec, symbol, &value,
+ input_section))
+ return false;
+ }
+ else
+ {
+ if (r_type != R_MIPS_REL32)
+ value = symbol + addend;
+ else
+ value = addend;
+ }
+ value &= howto->dst_mask;
+ break;
+
+ case R_MIPS_PC32:
+ case R_MIPS_PC64:
+ case R_MIPS_GNU_REL_LO16:
+ value = symbol + addend - p;
+ value &= howto->dst_mask;
+ break;
+
+ case R_MIPS_GNU_REL16_S2:
+ value = symbol + mips_elf64_sign_extend (addend << 2, 18) - p;
+ overflowed_p = mips_elf64_overflow_p (value, 18);
+ value = (value >> 2) & howto->dst_mask;
+ break;
+
+ case R_MIPS_GNU_REL_HI16:
+ value = mips_elf64_high (addend + symbol - p);
+ value &= howto->dst_mask;
+ break;
+
+ case R_MIPS16_26:
+ /* The calculation for R_MIPS16_26 is just the same as for an
+ R_MIPS_26. It's only the storage of the relocated field into
+ the output file that's different. That's handled in
+ mips_elf_perform_relocation. So, we just fall through to the
+ R_MIPS_26 case here. */
+ case R_MIPS_26:
+ if (local_p)
+ value = (((addend << 2) | ((p + 4) & 0xf0000000)) + symbol) >> 2;
+ else
+ value = (mips_elf64_sign_extend (addend << 2, 28) + symbol) >> 2;
+ value &= howto->dst_mask;
+ break;
+
+ case R_MIPS_HI16:
+ value = mips_elf64_high (addend + symbol);
+ value &= howto->dst_mask;
+ break;
+
+ case R_MIPS_LO16:
+ value = (addend + symbol) & 0xffff;
+ value &= howto->dst_mask;
+ break;
+
+ case R_MIPS_LITERAL:
+ /* Because we don't merge literal sections, we can handle this
+ just like R_MIPS_GPREL16. In the long run, we should merge
+ shared literals, and then we will need to additional work
+ here. */
+
+ /* Fall through. */
+
+ case R_MIPS_GPREL16:
+ if (local_p)
+ value = mips_elf64_sign_extend (addend, 16) + symbol + gp0 - gp;
+ else
+ value = mips_elf64_sign_extend (addend, 16) + symbol - gp;
+ overflowed_p = mips_elf64_overflow_p (value, 16);
+ break;
+
+ case R_MIPS_PC16:
+ value = mips_elf64_sign_extend (addend, 16) + symbol - p;
+ overflowed_p = mips_elf64_overflow_p (value, 16);
+ value = (bfd_vma) ((bfd_signed_vma) value / 4);
+ break;
+
+ case R_MIPS_GOT16:
+ case R_MIPS_CALL16:
+ if (local_p)
+ {
+ boolean forced;
+
+ /* The special case is when the symbol is forced to be local. We
+ need the full address in the GOT since no R_MIPS_LO16 relocation
+ follows. */
+ forced = ! mips_elf64_local_relocation_p (input_bfd, relocation,
+ local_sections, false);
+ value = mips_elf64_got16_entry (abfd, info, symbol + addend, forced);
+ if (value == (bfd_vma) -1)
+ return false;
+ value
+ = mips_elf64_got_offset_from_index (elf_hash_table (info)->dynobj,
+ abfd,
+ value);
+ overflowed_p = mips_elf64_overflow_p (value, 16);
+ break;
+ }
+
+ /* Fall through. */
+
+ case R_MIPS_GOT_DISP:
+ value = g;
+ overflowed_p = mips_elf64_overflow_p (value, 16);
+ break;
+
+ case R_MIPS_GPREL32:
+ value = (addend + symbol + gp0 - gp) & howto->dst_mask;
+ break;
+
+ case R_MIPS_GOT_HI16:
+ case R_MIPS_CALL_HI16:
+ /* We're allowed to handle these two relocations identically.
+ The dynamic linker is allowed to handle the CALL relocations
+ differently by creating a lazy evaluation stub. */
+ value = g;
+ value = mips_elf64_high (value);
+ value &= howto->dst_mask;
+ break;
+
+ case R_MIPS_GOT_LO16:
+ case R_MIPS_CALL_LO16:
+ value = g & howto->dst_mask;
+ break;
+
+ case R_MIPS_GOT_PAGE:
+ value = mips_elf64_got_page (abfd, info, symbol + addend, NULL);
+ if (value == (bfd_vma) -1)
+ return false;
+ value = mips_elf64_got_offset_from_index (elf_hash_table (info)->dynobj,
+ abfd,
+ value);
+ overflowed_p = mips_elf64_overflow_p (value, 16);
+ break;
+
+ case R_MIPS_GOT_OFST:
+ mips_elf64_got_page (abfd, info, symbol + addend, &value);
+ overflowed_p = mips_elf64_overflow_p (value, 16);
+ break;
+
+ case R_MIPS_SUB:
+ value = symbol - addend;
+ value &= howto->dst_mask;
+ break;
+
+ case R_MIPS_HIGHER:
+ value = mips_elf64_higher (addend + symbol);
+ value &= howto->dst_mask;
+ break;
+
+ case R_MIPS_HIGHEST:
+ value = mips_elf64_highest (addend + symbol);
+ value &= howto->dst_mask;
+ break;
+
+ case R_MIPS_SCN_DISP:
+ value = symbol + addend - sec->output_offset;
+ value &= howto->dst_mask;
+ break;
+
+ case R_MIPS_PJUMP:
+ case R_MIPS_JALR:
+ /* Both of these may be ignored. R_MIPS_JALR is an optimization
+ hint; we could improve performance by honoring that hint. */
+ return bfd_reloc_continue;
+
+ case R_MIPS_GNU_VTINHERIT:
+ case R_MIPS_GNU_VTENTRY:
+ /* We don't do anything with these at present. */
+ return bfd_reloc_continue;
+
+ default:
+ /* An unrecognized relocation type. */
+ return bfd_reloc_notsupported;
+ }
+
+ /* Store the VALUE for our caller. */
+ *valuep = value;
+ return overflowed_p ? bfd_reloc_overflow : bfd_reloc_ok;
+}
+
+/* Obtain the field relocated by RELOCATION. */
+
+static bfd_vma
+mips_elf64_obtain_contents (howto, relocation, input_bfd, contents)
+ reloc_howto_type *howto;
+ const Elf_Internal_Rela *relocation;
+ bfd *input_bfd;
+ bfd_byte *contents;
+{
+ bfd_byte *location = contents + relocation->r_offset;
+
+ /* Obtain the bytes. */
+ return bfd_get (8 * bfd_get_reloc_size (howto), input_bfd, location);
+}
+
+/* It has been determined that the result of the RELOCATION is the
+ VALUE. Use HOWTO to place VALUE into the output file at the
+ appropriate position. The SECTION is the section to which the
+ relocation applies. If REQUIRE_JALX is true, then the opcode used
+ for the relocation must be either JAL or JALX, and it is
+ unconditionally converted to JALX.
+
+ Returns false if anything goes wrong. */
+
+static boolean
+mips_elf64_perform_relocation (info, howto, relocation, value,
+ input_bfd, input_section,
+ contents, require_jalx)
+ struct bfd_link_info *info;
+ reloc_howto_type *howto;
+ const Elf_Internal_Rela *relocation;
+ bfd_vma value;
+ bfd *input_bfd;
+ asection *input_section;
+ bfd_byte *contents;
+ boolean require_jalx;
+{
+ bfd_vma x;
+ bfd_byte *location;
+ int r_type = ELF32_R_TYPE (relocation->r_info);
+
+ /* Figure out where the relocation is occurring. */
+ location = contents + relocation->r_offset;
+
+ /* Obtain the current value. */
+ x = mips_elf64_obtain_contents (howto, relocation, input_bfd, contents);
+
+ /* Clear the field we are setting. */
+ x &= ~howto->dst_mask;
+
+ /* If this is the R_MIPS16_26 relocation, we must store the
+ value in a funny way. */
+ if (r_type == R_MIPS16_26)
+ {
+ /* R_MIPS16_26 is used for the mips16 jal and jalx instructions.
+ Most mips16 instructions are 16 bits, but these instructions
+ are 32 bits.
+
+ The format of these instructions is:
+
+ +--------------+--------------------------------+
+ ! JALX ! X! Imm 20:16 ! Imm 25:21 !
+ +--------------+--------------------------------+
+ ! Immediate 15:0 !
+ +-----------------------------------------------+
+
+ JALX is the 5-bit value 00011. X is 0 for jal, 1 for jalx.
+ Note that the immediate value in the first word is swapped.
+
+ When producing a relocateable object file, R_MIPS16_26 is
+ handled mostly like R_MIPS_26. In particular, the addend is
+ stored as a straight 26-bit value in a 32-bit instruction.
+ (gas makes life simpler for itself by never adjusting a
+ R_MIPS16_26 reloc to be against a section, so the addend is
+ always zero). However, the 32 bit instruction is stored as 2
+ 16-bit values, rather than a single 32-bit value. In a
+ big-endian file, the result is the same; in a little-endian
+ file, the two 16-bit halves of the 32 bit value are swapped.
+ This is so that a disassembler can recognize the jal
+ instruction.
+
+ When doing a final link, R_MIPS16_26 is treated as a 32 bit
+ instruction stored as two 16-bit values. The addend A is the
+ contents of the targ26 field. The calculation is the same as
+ R_MIPS_26. When storing the calculated value, reorder the
+ immediate value as shown above, and don't forget to store the
+ value as two 16-bit values.
+
+ To put it in MIPS ABI terms, the relocation field is T-targ26-16,
+ defined as
+
+ big-endian:
+ +--------+----------------------+
+ | | |
+ | | targ26-16 |
+ |31 26|25 0|
+ +--------+----------------------+
+
+ little-endian:
+ +----------+------+-------------+
+ | | | |
+ | sub1 | | sub2 |
+ |0 9|10 15|16 31|
+ +----------+--------------------+
+ where targ26-16 is sub1 followed by sub2 (i.e., the addend field A is
+ ((sub1 << 16) | sub2)).
+
+ When producing a relocateable object file, the calculation is
+ (((A < 2) | ((P + 4) & 0xf0000000) + S) >> 2)
+ When producing a fully linked file, the calculation is
+ let R = (((A < 2) | ((P + 4) & 0xf0000000) + S) >> 2)
+ ((R & 0x1f0000) << 5) | ((R & 0x3e00000) >> 5) | (R & 0xffff) */
+
+ if (!info->relocateable)
+ /* Shuffle the bits according to the formula above. */
+ value = (((value & 0x1f0000) << 5)
+ | ((value & 0x3e00000) >> 5)
+ | (value & 0xffff));
+ }
+ else if (r_type == R_MIPS16_GPREL)
+ {
+ /* R_MIPS16_GPREL is used for GP-relative addressing in mips16
+ mode. A typical instruction will have a format like this:
+
+ +--------------+--------------------------------+
+ ! EXTEND ! Imm 10:5 ! Imm 15:11 !
+ +--------------+--------------------------------+
+ ! Major ! rx ! ry ! Imm 4:0 !
+ +--------------+--------------------------------+
+
+ EXTEND is the five bit value 11110. Major is the instruction
+ opcode.
+
+ This is handled exactly like R_MIPS_GPREL16, except that the
+ addend is retrieved and stored as shown in this diagram; that
+ is, the Imm fields above replace the V-rel16 field.
+
+ All we need to do here is shuffle the bits appropriately. As
+ above, the two 16-bit halves must be swapped on a
+ little-endian system. */
+ value = (((value & 0x7e0) << 16)
+ | ((value & 0xf800) << 5)
+ | (value & 0x1f));
+ }
+
+ /* Set the field. */
+ x |= (value & howto->dst_mask);
+
+ /* If required, turn JAL into JALX. */
+ if (require_jalx)
+ {
+ boolean ok;
+ bfd_vma opcode = x >> 26;
+ bfd_vma jalx_opcode;
+
+ /* Check to see if the opcode is already JAL or JALX. */
+ if (r_type == R_MIPS16_26)
+ {
+ ok = ((opcode == 0x6) || (opcode == 0x7));
+ jalx_opcode = 0x7;
+ }
+ else
+ {
+ ok = ((opcode == 0x3) || (opcode == 0x1d));
+ jalx_opcode = 0x1d;
+ }
+
+ /* If the opcode is not JAL or JALX, there's a problem. */
+ if (!ok)
+ {
+ (*_bfd_error_handler)
+ (_("%s: %s+0x%lx: jump to stub routine which is not jal"),
+ bfd_archive_filename (input_bfd),
+ input_section->name,
+ (unsigned long) relocation->r_offset);
+ bfd_set_error (bfd_error_bad_value);
+ return false;
+ }
+
+ /* Make this the JALX opcode. */
+ x = (x & ~(0x3f << 26)) | (jalx_opcode << 26);
+ }
+
+ /* Swap the high- and low-order 16 bits on little-endian systems
+ when doing a MIPS16 relocation. */
+ if ((r_type == R_MIPS16_GPREL || r_type == R_MIPS16_26)
+ && bfd_little_endian (input_bfd))
+ x = (((x & 0xffff) << 16) | ((x & 0xffff0000) >> 16));
+
+ /* Put the value into the output. */
+ bfd_put (8 * bfd_get_reloc_size (howto), input_bfd, x, location);
+ return true;
+}
+
+/* Returns true if SECTION is a MIPS16 stub section. */
+
+static boolean
+mips_elf64_stub_section_p (abfd, section)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ asection *section;
+{
+ const char *name = bfd_get_section_name (abfd, section);
+
+ return (strncmp (name, FN_STUB, sizeof FN_STUB - 1) == 0
+ || strncmp (name, CALL_STUB, sizeof CALL_STUB - 1) == 0
+ || strncmp (name, CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0);
+}
+
+/* Relocate a MIPS ELF64 section. */
+
+static boolean
+mips_elf64_relocate_section (output_bfd, info, input_bfd, input_section,
+ contents, relocs, local_syms, local_sections)
+ bfd *output_bfd;
+ struct bfd_link_info *info;
+ bfd *input_bfd;
+ asection *input_section;
+ bfd_byte *contents;
+ Elf_Internal_Rela *relocs;
+ Elf_Internal_Sym *local_syms;
+ asection **local_sections;
+{
+ Elf_Internal_Rela *rel;
+ const Elf_Internal_Rela *relend;
+ bfd_vma addend = 0;
+ boolean use_saved_addend_p = false;
+ struct elf_backend_data *bed;
+
+ bed = get_elf_backend_data (output_bfd);
+ relend = relocs + input_section->reloc_count * bed->s->int_rels_per_ext_rel;
+ for (rel = relocs; rel < relend; ++rel)
+ {
+ const char *name;
+ bfd_vma value;
+ reloc_howto_type *howto;
+ boolean require_jalx;
+ /* True if the relocation is a RELA relocation, rather than a
+ REL relocation. */
+ boolean rela_relocation_p = true;
+ int r_type = ELF64_MIPS_R_TYPE (rel->r_info);
+ const char *msg = (const char *) NULL;
+
+ /* Find the relocation howto for this relocation. */
+ howto = &mips_elf64_howto_table_rela[r_type];
+
+ if (!use_saved_addend_p)
+ {
+ Elf_Internal_Shdr *rel_hdr;
+
+ /* If these relocations were originally of the REL variety,
+ we must pull the addend out of the field that will be
+ relocated. Otherwise, we simply use the contents of the
+ RELA relocation. To determine which flavor or relocation
+ this is, we depend on the fact that the INPUT_SECTION's
+ REL_HDR is read before its REL_HDR2. */
+ rel_hdr = &elf_section_data (input_section)->rel_hdr;
+ if ((size_t) (rel - relocs)
+ >= (NUM_SHDR_ENTRIES (rel_hdr) * bed->s->int_rels_per_ext_rel))
+ rel_hdr = elf_section_data (input_section)->rel_hdr2;
+ if (rel_hdr->sh_entsize
+ == (get_elf_backend_data (input_bfd)->s->sizeof_rel))
+ {
+ /* Note that this is a REL relocation. */
+ rela_relocation_p = false;
+
+ /* Find the relocation howto for this relocation. */
+ howto = &mips_elf64_howto_table_rel[r_type];
+
+ /* Get the addend, which is stored in the input file. */
+ addend = mips_elf64_obtain_contents (howto,
+ rel,
+ input_bfd,
+ contents);
+ addend &= howto->src_mask;
+
+ /* For some kinds of relocations, the ADDEND is a
+ combination of the addend stored in two different
+ relocations. */
+ if (r_type == R_MIPS_HI16
+ || r_type == R_MIPS_GNU_REL_HI16
+ || (r_type == R_MIPS_GOT16
+ && mips_elf64_local_relocation_p (input_bfd, rel,
+ local_sections, false)))
+ {
+ bfd_vma l;
+ const Elf_Internal_Rela *lo16_relocation;
+ reloc_howto_type *lo16_howto;
+ int lo;
+
+ /* The combined value is the sum of the HI16 addend,
+ left-shifted by sixteen bits, and the LO16
+ addend, sign extended. (Usually, the code does
+ a `lui' of the HI16 value, and then an `addiu' of
+ the LO16 value.)
+
+ Scan ahead to find a matching LO16 relocation. */
+ if (r_type == R_MIPS_GNU_REL_HI16)
+ lo = R_MIPS_GNU_REL_LO16;
+ else
+ lo = R_MIPS_LO16;
+ lo16_relocation
+ = mips_elf64_next_relocation (lo, rel, relend);
+ if (lo16_relocation == NULL)
+ return false;
+
+ /* Obtain the addend kept there. */
+ if (rela_relocation_p == false)
+ lo16_howto = &mips_elf64_howto_table_rel[lo];
+ else
+ lo16_howto = &mips_elf64_howto_table_rela[lo];
+ l = mips_elf64_obtain_contents (lo16_howto,
+ lo16_relocation,
+ input_bfd, contents);
+ l &= lo16_howto->src_mask;
+ l = mips_elf64_sign_extend (l, 16);
+
+ addend <<= 16;
+
+ /* Compute the combined addend. */
+ addend += l;
+ }
+ }
+ else
+ addend = rel->r_addend;
+ }
+
+ if (info->relocateable)
+ {
+ Elf_Internal_Sym *sym;
+ unsigned long r_symndx;
+
+ /* Since we're just relocating, all we need to do is copy
+ the relocations back out to the object file, unless
+ they're against a section symbol, in which case we need
+ to adjust by the section offset, or unless they're GP
+ relative in which case we need to adjust by the amount
+ that we're adjusting GP in this relocateable object. */
+
+ if (!mips_elf64_local_relocation_p (input_bfd, rel, local_sections,
+ false))
+ /* There's nothing to do for non-local relocations. */
+ continue;
+
+ if (r_type == R_MIPS_GPREL16
+ || r_type == R_MIPS_GPREL32
+ || r_type == R_MIPS_LITERAL)
+ addend -= (_bfd_get_gp_value (output_bfd)
+ - _bfd_get_gp_value (input_bfd));
+ else if (r_type == R_MIPS_26 || r_type == R_MIPS_GNU_REL16_S2)
+ /* The addend is stored without its two least
+ significant bits (which are always zero.) In a
+ non-relocateable link, calculate_relocation will do
+ this shift; here, we must do it ourselves. */
+ addend <<= 2;
+
+ r_symndx = ELF64_R_SYM (rel->r_info);
+ sym = local_syms + r_symndx;
+ if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+ /* Adjust the addend appropriately. */
+ addend += local_sections[r_symndx]->output_offset;
+
+#if 0
+ /* If the relocation is for a R_MIPS_HI16 or R_MIPS_GOT16,
+ then we only want to write out the high-order 16 bits.
+ The subsequent R_MIPS_LO16 will handle the low-order bits. */
+ if (r_type == R_MIPS_HI16 || r_type == R_MIPS_GOT16
+ || r_type == R_MIPS_GNU_REL_HI16)
+ addend = mips_elf64_high (addend);
+ else if (r_type == R_MIPS_HIGHER)
+ addend = mips_elf64_higher (addend);
+ else if (r_type == R_MIPS_HIGHEST)
+ addend = mips_elf64_highest (addend);
+#endif
+ /* If the relocation is for an R_MIPS_26 relocation, then
+ the two low-order bits are not stored in the object file;
+ they are implicitly zero. */
+ if (r_type == R_MIPS_26 || r_type == R_MIPS_GNU_REL16_S2)
+ addend >>= 2;
+
+ if (rela_relocation_p)
+ /* If this is a RELA relocation, just update the addend.
+ We have to cast away constness for REL. */
+ rel->r_addend = addend;
+ else
+ {
+ /* Otherwise, we have to write the value back out. Note
+ that we use the source mask, rather than the
+ destination mask because the place to which we are
+ writing will be source of the addend in the final
+ link. */
+ addend &= howto->src_mask;
+
+ if (!mips_elf64_perform_relocation (info, howto, rel, addend,
+ input_bfd, input_section,
+ contents, false))
+ return false;
+ }
+
+ /* Go on to the next relocation. */
+ continue;
+ }
+
+ /* In the N32 and 64-bit ABIs there may be multiple consecutive
+ relocations for the same offset. In that case we are
+ supposed to treat the output of each relocation as the addend
+ for the next. */
+ if (rel + 1 < relend
+ && rel->r_offset == rel[1].r_offset
+ && ELF64_MIPS_R_TYPE (rel[1].r_info) != R_MIPS_NONE)
+ use_saved_addend_p = true;
+ else
+ use_saved_addend_p = false;
+
+ /* Figure out what value we are supposed to relocate. */
+ switch (mips_elf64_calculate_relocation (output_bfd, input_bfd,
+ input_section, info, rel,
+ addend, howto, local_syms,
+ local_sections, &value, &name,
+ &require_jalx))
+ {
+ case bfd_reloc_continue:
+ /* There's nothing to do. */
+ continue;
+
+ case bfd_reloc_undefined:
+ /* mips_elf64_calculate_relocation already called the
+ undefined_symbol callback. There's no real point in
+ trying to perform the relocation at this point, so we
+ just skip ahead to the next relocation. */
+ continue;
+
+ case bfd_reloc_notsupported:
+ msg = _("internal error: unsupported relocation error");
+ info->callbacks->warning
+ (info, msg, name, input_bfd, input_section, rel->r_offset);
+ return false;
+
+ case bfd_reloc_overflow:
+ if (use_saved_addend_p)
+ /* Ignore overflow until we reach the last relocation for
+ a given location. */
+ ;
+ else
+ {
+ BFD_ASSERT (name != NULL);
+ if (! ((*info->callbacks->reloc_overflow)
+ (info, name, howto->name, (bfd_vma) 0,
+ input_bfd, input_section, rel->r_offset)))
+ return false;
+ }
+ break;
+
+ case bfd_reloc_ok:
+ break;
+
+ default:
+ abort ();
+ break;
+ }
+
+ /* If we've got another relocation for the address, keep going
+ until we reach the last one. */
+ if (use_saved_addend_p)
+ {
+ addend = value;
+ continue;
+ }
+
+ /* Actually perform the relocation. */
+ if (!mips_elf64_perform_relocation (info, howto, rel, value, input_bfd,
+ input_section, contents,
+ require_jalx))
+ return false;
+ }
+
+ return true;
+}
+
+/* Create dynamic sections when linking against a dynamic object. */
+
+boolean
+mips_elf64_create_dynamic_sections (abfd, info)
+ bfd *abfd;
+ struct bfd_link_info *info;
+{
+ flagword flags;
+ register asection *s;
+
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED | SEC_READONLY);
+
+ /* Mips ABI requests the .dynamic section to be read only. */
+ s = bfd_get_section_by_name (abfd, ".dynamic");
+ if (s != NULL)
+ {
+ if (! bfd_set_section_flags (abfd, s, flags))
+ return false;
+ }
+
+ /* We need to create .got section. */
+ if (! mips_elf64_create_got_section (abfd, info))
return false;
- if (bfd_seek (abfd, (file_ptr) - 16, SEEK_CUR) != 0)
+ /* Create the .msym section on IRIX6. It is used by the dynamic
+ linker to speed up dynamic relocations, and to avoid computing
+ the ELF hash for symbols. */
+ if (!mips_elf64_create_msym_section (abfd))
return false;
- /* Archives with traditional armaps are still permitted. */
- if (strncmp (nextname, "/ ", 16) == 0)
- return bfd_slurp_armap (abfd);
+ /* Create .stub section. */
+ if (bfd_get_section_by_name (abfd, ".MIPS.stubs") == NULL)
+ {
+ s = bfd_make_section (abfd, ".MIPS.stubs");
+ if (s == NULL
+ || ! bfd_set_section_flags (abfd, s, flags | SEC_CODE)
+ || ! bfd_set_section_alignment (abfd, s, 3))
+ 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. */
+
+boolean
+mips_elf64_adjust_dynamic_symbol (info, h)
+ struct bfd_link_info *info;
+ struct elf_link_hash_entry *h;
+{
+ bfd *dynobj;
+ struct mips_elf64_link_hash_entry *hmips;
+ asection *s;
+
+ 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 symbol is defined in a dynamic object, we need to copy
+ any R_MIPS_32 or R_MIPS_REL32 relocs against it into the output
+ file. */
+ hmips = (struct mips_elf64_link_hash_entry *) h;
+ if (! info->relocateable
+ && hmips->possibly_dynamic_relocs != 0
+ && (h->root.type == bfd_link_hash_defweak
+ || (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0))
+ {
+ mips_elf64_allocate_dynamic_relocations (dynobj,
+ hmips->possibly_dynamic_relocs);
+ if (hmips->readonly_reloc)
+ /* We tell the dynamic linker that there are relocations
+ against the text segment. */
+ info->flags |= DF_TEXTREL;
+ }
+
+ /* For a function, create a stub, if allowed. */
+ if (! hmips->no_fn_stub
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
+ {
+ if (! elf_hash_table (info)->dynamic_sections_created)
+ return true;
+
+ /* If this symbol is not defined in a regular file, then set
+ the symbol to the stub location. This is required to make
+ function pointers compare as equal between the normal
+ executable and the shared library. */
+ if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+ {
+ /* We need .stub section. */
+ s = bfd_get_section_by_name (dynobj, ".MIPS.stubs");
+ BFD_ASSERT (s != NULL);
+
+ h->root.u.def.section = s;
+ h->root.u.def.value = s->_raw_size;
+
+ /* XXX Write this stub address somewhere. */
+ h->plt.offset = s->_raw_size;
- if (strncmp (nextname, "/SYM64/ ", 16) != 0)
+ /* Make room for this stub code. */
+ s->_raw_size += MIPS_FUNCTION_STUB_SIZE;
+
+ /* The last half word of the stub will be filled with the index
+ of this symbol in .dynsym section. */
+ return true;
+ }
+ }
+ else if ((h->type == STT_FUNC)
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) == 0)
{
- bfd_has_map (abfd) = false;
+ /* This will set the entry for this symbol in the GOT to 0, and
+ the dynamic linker will take care of this. */
+ h->root.u.def.value = 0;
return true;
}
- mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
- if (mapdata == NULL)
- return false;
- parsed_size = mapdata->parsed_size;
- bfd_release (abfd, (PTR) mapdata);
+ /* 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. */
+
+ return true;
+}
+
+/* This function is called after all the input files have been read,
+ and the input sections have been assigned to output sections. */
+
+boolean
+mips_elf64_always_size_sections (output_bfd, info)
+ bfd *output_bfd ATTRIBUTE_UNUSED;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
+{
+ if (info->relocateable
+ || ! mips_elf64_hash_table (info)->mips16_stubs_seen)
+ return true;
+
+ mips_elf64_link_hash_traverse (mips_elf64_hash_table (info),
+ mips_elf64_check_mips16_stubs,
+ (PTR) NULL);
- if (bfd_read (int_buf, 1, 8, abfd) != 8)
+ return true;
+}
+
+/* Check the mips16 stubs for a particular symbol, and see if we can
+ discard them. */
+
+static boolean
+mips_elf64_check_mips16_stubs (h, data)
+ struct mips_elf64_link_hash_entry *h;
+ PTR data ATTRIBUTE_UNUSED;
+{
+ if (h->root.root.type == bfd_link_hash_warning)
+ h = (struct mips_elf64_link_hash_entry *) h->root.root.u.i.link;
+
+ if (h->fn_stub != NULL
+ && ! h->need_fn_stub)
{
- if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_malformed_archive);
- return false;
+ /* We don't need the fn_stub; the only references to this symbol
+ are 16 bit calls. Clobber the size to 0 to prevent it from
+ being included in the link. */
+ h->fn_stub->_raw_size = 0;
+ h->fn_stub->_cooked_size = 0;
+ h->fn_stub->flags &= ~SEC_RELOC;
+ h->fn_stub->reloc_count = 0;
+ h->fn_stub->flags |= SEC_EXCLUDE;
}
- nsymz = bfd_getb64 (int_buf);
- stringsize = parsed_size - 8 * nsymz - 8;
+ if (h->call_stub != NULL
+ && h->root.other == STO_MIPS16)
+ {
+ /* We don't need the call_stub; this is a 16 bit function, so
+ calls from other 16 bit functions are OK. Clobber the size
+ to 0 to prevent it from being included in the link. */
+ h->call_stub->_raw_size = 0;
+ h->call_stub->_cooked_size = 0;
+ h->call_stub->flags &= ~SEC_RELOC;
+ h->call_stub->reloc_count = 0;
+ h->call_stub->flags |= SEC_EXCLUDE;
+ }
- carsym_size = nsymz * sizeof (carsym);
- ptrsize = 8 * nsymz;
+ if (h->call_fp_stub != NULL
+ && h->root.other == STO_MIPS16)
+ {
+ /* We don't need the call_stub; this is a 16 bit function, so
+ calls from other 16 bit functions are OK. Clobber the size
+ to 0 to prevent it from being included in the link. */
+ h->call_fp_stub->_raw_size = 0;
+ h->call_fp_stub->_cooked_size = 0;
+ h->call_fp_stub->flags &= ~SEC_RELOC;
+ h->call_fp_stub->reloc_count = 0;
+ h->call_fp_stub->flags |= SEC_EXCLUDE;
+ }
- ardata->symdefs = (carsym *) bfd_zalloc (abfd, carsym_size + stringsize + 1);
- if (ardata->symdefs == NULL)
- return false;
- carsyms = ardata->symdefs;
- stringbase = ((char *) ardata->symdefs) + carsym_size;
+ return true;
+}
- raw_armap = (bfd_byte *) bfd_alloc (abfd, ptrsize);
- if (raw_armap == NULL)
- goto error_return;
+/* Set the sizes of the dynamic sections. */
+
+boolean
+mips_elf64_size_dynamic_sections (output_bfd, info)
+ bfd *output_bfd;
+ struct bfd_link_info *info;
+{
+ bfd *dynobj;
+ asection *s;
+ boolean reltext;
+ struct mips_elf64_got_info *g = NULL;
+
+ 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 = strlen ("/usr/lib64/libc.so.1") + 1;
+ s->contents = (bfd_byte *) "/usr/lib64/libc.so.1";
+ }
+ }
+
+ /* The check_relocs and adjust_dynamic_symbol entry points have
+ determined the sizes of the various dynamic sections. Allocate
+ memory for them. */
+ reltext = false;
+ for (s = dynobj->sections; s != NULL; s = s->next)
+ {
+ const char *name;
+ boolean strip;
+
+ /* 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);
+
+ if ((s->flags & SEC_LINKER_CREATED) == 0)
+ continue;
+
+ strip = false;
+
+ if (strncmp (name, ".rel", 4) == 0)
+ {
+ if (s->_raw_size == 0)
+ {
+ /* We only strip the section if the output section name
+ has the same name. Otherwise, there might be several
+ input sections for this output section. FIXME: This
+ code is probably not needed these days anyhow, since
+ the linker now does not create empty output sections. */
+ if (s->output_section != NULL
+ && strcmp (name,
+ bfd_get_section_name (s->output_section->owner,
+ s->output_section)) == 0)
+ strip = true;
+ }
+ else
+ {
+ const char *outname;
+ asection *target;
+
+ /* If this relocation section applies to a read only
+ section, then we probably need a DT_TEXTREL entry.
+ If the relocation section is .rel.dyn, we always
+ assert a DT_TEXTREL entry rather than testing whether
+ there exists a relocation to a read only section or
+ not. */
+ outname = bfd_get_section_name (output_bfd,
+ s->output_section);
+ target = bfd_get_section_by_name (output_bfd, outname + 4);
+ if ((target != NULL
+ && (target->flags & SEC_READONLY) != 0
+ && (target->flags & SEC_ALLOC) != 0)
+ || strcmp (outname, "rel.dyn") == 0)
+ reltext = true;
+
+ /* We use the reloc_count field as a counter if we need
+ to copy relocs into the output file. */
+ if (strcmp (name, "rel.dyn") != 0)
+ s->reloc_count = 0;
+ }
+ }
+ else if (strncmp (name, ".got", 4) == 0)
+ {
+ int i;
+ bfd_size_type loadable_size = 0;
+ bfd_size_type local_gotno;
+ bfd *sub;
+
+ BFD_ASSERT (elf_section_data (s) != NULL);
+ g = (struct mips_elf64_got_info *) elf_section_data (s)->tdata;
+ BFD_ASSERT (g != NULL);
+
+ /* Calculate the total loadable size of the output. That
+ will give us the maximum number of GOT_PAGE entries
+ required. */
+ for (sub = info->input_bfds; sub; sub = sub->link_next)
+ {
+ asection *subsection;
+
+ for (subsection = sub->sections;
+ subsection;
+ subsection = subsection->next)
+ {
+ if ((subsection->flags & SEC_ALLOC) == 0)
+ continue;
+ loadable_size += (subsection->_raw_size + 0xf) & ~0xf;
+ }
+ }
+ loadable_size += MIPS_FUNCTION_STUB_SIZE;
+
+ /* Assume there are two loadable segments consisting of
+ contiguous sections. Is 5 enough? */
+ local_gotno = (loadable_size >> 16) + 5;
+ /* It's possible we will need GOT_PAGE entries as well as
+ GOT16 entries. Often, these will be able to share GOT
+ entries, but not always. */
+ local_gotno *= 2;
+
+ g->local_gotno += local_gotno;
+ s->_raw_size += local_gotno * 8;
+
+ /* There has to be a global GOT entry for every symbol with
+ a dynamic symbol table index of DT_MIPS_GOTSYM or
+ higher. Therefore, it make sense to put those symbols
+ that need GOT entries at the end of the symbol table. We
+ do that here. */
+ if (!mips_elf64_sort_hash_table (info, 1))
+ return false;
+
+ if (g->global_gotsym != NULL)
+ i = elf_hash_table (info)->dynsymcount - g->global_gotsym->dynindx;
+ else
+ /* If there are no global symbols, or none requiring
+ relocations, then GLOBAL_GOTSYM will be NULL. */
+ i = 0;
+ g->global_gotno = i;
+ s->_raw_size += i * 8;
+ }
+ else if (strcmp (name, ".MIPS.stubs") == 0)
+ {
+ /* Irix rld assumes that the function stub isn't at the end
+ of .text section. So put a dummy. XXX */
+ s->_raw_size += MIPS_FUNCTION_STUB_SIZE;
+ }
+ else if (strcmp (name, ".msym")
+ == 0)
+ s->_raw_size = (sizeof (Elf32_External_Msym)
+ * (elf_hash_table (info)->dynsymcount
+ + bfd_count_sections (output_bfd)));
+ else if (strncmp (name, ".init", 5) != 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_zalloc (dynobj, s->_raw_size);
+ if (s->contents == NULL && s->_raw_size != 0)
+ {
+ bfd_set_error (bfd_error_no_memory);
+ return false;
+ }
+ }
+
+ if (elf_hash_table (info)->dynamic_sections_created)
+ {
+ /* Add some entries to the .dynamic section. We fill in the
+ values later, in elf_mips_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)
+ {
+ /* SGI object has the equivalence of DT_DEBUG in the
+ DT_MIPS_RLD_MAP entry. */
+ if (!bfd_elf64_add_dynamic_entry (info, DT_MIPS_RLD_MAP, 0))
+ return false;
+ if (!SGI_COMPAT (output_bfd))
+ {
+ if (!bfd_elf64_add_dynamic_entry (info, DT_DEBUG, 0))
+ return false;
+ }
+ }
+ else
+ {
+ /* Shared libraries on traditional mips have DT_DEBUG. */
+ if (!SGI_COMPAT (output_bfd))
+ {
+ if (!bfd_elf64_add_dynamic_entry (info, DT_DEBUG, 0))
+ return false;
+ }
+ }
+
+ if (reltext && SGI_COMPAT (output_bfd))
+ info->flags |= DF_TEXTREL;
+
+ if ((info->flags & DF_TEXTREL) != 0)
+ {
+ if (! bfd_elf64_add_dynamic_entry (info, DT_TEXTREL, 0))
+ return false;
+ }
+
+ if (! bfd_elf64_add_dynamic_entry (info, DT_PLTGOT, 0))
+ return false;
+
+ if (bfd_get_section_by_name (dynobj, "rel.dyn"))
+ {
+ if (! bfd_elf64_add_dynamic_entry (info, DT_REL, 0))
+ return false;
+
+ if (! bfd_elf64_add_dynamic_entry (info, DT_RELSZ, 0))
+ return false;
+
+ if (! bfd_elf64_add_dynamic_entry (info, DT_RELENT, 0))
+ return false;
+ }
+
+ if (SGI_COMPAT (output_bfd))
+ {
+ if (!bfd_elf64_add_dynamic_entry (info, DT_MIPS_CONFLICTNO, 0))
+ return false;
+ }
+
+ if (SGI_COMPAT (output_bfd))
+ {
+ if (!bfd_elf64_add_dynamic_entry (info, DT_MIPS_LIBLISTNO, 0))
+ return false;
+ }
+
+ if (bfd_get_section_by_name (dynobj, ".conflict") != NULL)
+ {
+ if (! bfd_elf64_add_dynamic_entry (info, DT_MIPS_CONFLICT, 0))
+ return false;
+
+ s = bfd_get_section_by_name (dynobj, ".liblist");
+ BFD_ASSERT (s != NULL);
+
+ if (! bfd_elf64_add_dynamic_entry (info, DT_MIPS_LIBLIST, 0))
+ return false;
+ }
+
+ if (! bfd_elf64_add_dynamic_entry (info, DT_MIPS_RLD_VERSION, 0))
+ return false;
+
+ if (! bfd_elf64_add_dynamic_entry (info, DT_MIPS_FLAGS, 0))
+ return false;
+
+#if 0
+ /* Time stamps in executable files are a bad idea. */
+ if (! bfd_elf64_add_dynamic_entry (info, DT_MIPS_TIME_STAMP, 0))
+ return false;
+#endif
+
+#if 0 /* FIXME */
+ if (! bfd_elf64_add_dynamic_entry (info, DT_MIPS_ICHECKSUM, 0))
+ return false;
+#endif
+
+#if 0 /* FIXME */
+ if (! bfd_elf64_add_dynamic_entry (info, DT_MIPS_IVERSION, 0))
+ return false;
+#endif
+
+ if (! bfd_elf64_add_dynamic_entry (info, DT_MIPS_BASE_ADDRESS, 0))
+ return false;
- if (bfd_read (raw_armap, 1, ptrsize, abfd) != ptrsize
- || bfd_read (stringbase, 1, stringsize, abfd) != stringsize)
+ if (! bfd_elf64_add_dynamic_entry (info, DT_MIPS_LOCAL_GOTNO, 0))
+ return false;
+
+ if (! bfd_elf64_add_dynamic_entry (info, DT_MIPS_SYMTABNO, 0))
+ return false;
+
+ if (! bfd_elf64_add_dynamic_entry (info, DT_MIPS_UNREFEXTNO, 0))
+ return false;
+
+ if (! bfd_elf64_add_dynamic_entry (info, DT_MIPS_GOTSYM, 0))
+ return false;
+
+ if ((bfd_get_section_by_name(dynobj, ".MIPS.options"))
+ && !bfd_elf64_add_dynamic_entry (info, DT_MIPS_OPTIONS, 0))
+ return false;
+
+ if (bfd_get_section_by_name (dynobj, ".msym")
+ && !bfd_elf64_add_dynamic_entry (info, DT_MIPS_MSYM, 0))
+ return false;
+ }
+
+ return true;
+}
+
+/* Finish up dynamic symbol handling. We set the contents of various
+ dynamic sections here. */
+
+boolean
+mips_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;
+ bfd_vma gval;
+ asection *sgot;
+ asection *smsym;
+ struct mips_elf64_got_info *g;
+ const char *name;
+ struct mips_elf64_link_hash_entry *mh;
+
+ dynobj = elf_hash_table (info)->dynobj;
+ gval = sym->st_value;
+ mh = (struct mips_elf64_link_hash_entry *) h;
+
+ if (h->plt.offset != (bfd_vma) -1)
+ {
+ asection *s;
+ bfd_byte stub[MIPS_FUNCTION_STUB_SIZE];
+
+ /* This symbol has a stub. Set it up. */
+
+ BFD_ASSERT (h->dynindx != -1);
+
+ s = bfd_get_section_by_name (dynobj, ".MIPS.stubs");
+ BFD_ASSERT (s != NULL);
+
+ /* FIXME: Can h->dynindex be more than 64K? */
+ if (h->dynindx & 0xffff0000)
+ return false;
+
+ /* Fill the stub. */
+ bfd_put_32 (output_bfd, STUB_LW, stub);
+ bfd_put_32 (output_bfd, STUB_MOVE, stub + 4);
+ bfd_put_32 (output_bfd, STUB_JALR, stub + 8);
+ bfd_put_32 (output_bfd, STUB_LI16 + h->dynindx, stub + 12);
+
+ BFD_ASSERT (h->plt.offset <= s->_raw_size);
+ memcpy (s->contents + h->plt.offset, stub, MIPS_FUNCTION_STUB_SIZE);
+
+ /* Mark the symbol as undefined. plt.offset != -1 occurs
+ only for the referenced symbol. */
+ sym->st_shndx = SHN_UNDEF;
+
+ /* The run-time linker uses the st_value field of the symbol
+ to reset the global offset table entry for this external
+ to its stub address when unlinking a shared object. */
+ gval = s->output_section->vma + s->output_offset + h->plt.offset;
+ sym->st_value = gval;
+ }
+
+ BFD_ASSERT (h->dynindx != -1
+ || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0);
+
+ sgot = bfd_get_section_by_name (dynobj, ".got");
+ BFD_ASSERT (sgot != NULL);
+ BFD_ASSERT (elf_section_data (sgot) != NULL);
+ g = (struct mips_elf64_got_info *) elf_section_data (sgot)->tdata;
+ BFD_ASSERT (g != NULL);
+
+ /* Run through the global symbol table, creating GOT entries for all
+ the symbols that need them. */
+ if (g->global_gotsym != NULL
+ && h->dynindx >= g->global_gotsym->dynindx)
+ {
+ bfd_vma offset;
+ bfd_vma value;
+
+ if (sym->st_value)
+ value = sym->st_value;
+ else
+ {
+ /* For an entity defined in a shared object, this will be
+ NULL. (For functions in shared objects for
+ which we have created stubs, ST_VALUE will be non-NULL.
+ That's because such the functions are now no longer defined
+ in a shared object.) */
+
+ if (info->shared && h->root.type == bfd_link_hash_undefined)
+ value = 0;
+ else
+ value = h->root.u.def.value;
+ }
+ offset = mips_elf64_global_got_index (dynobj, h);
+ bfd_put_64 (output_bfd, value, sgot->contents + offset);
+ }
+
+ /* Create a .msym entry, if appropriate. */
+ smsym = bfd_get_section_by_name (dynobj, ".msym");
+ if (smsym)
{
- if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_malformed_archive);
- goto error_return;
+ Elf32_Internal_Msym msym;
+
+ msym.ms_hash_value = bfd_elf_hash (h->root.root.string);
+ /* It is undocumented what the `1' indicates, but IRIX6 uses
+ this value. */
+ msym.ms_info = ELF32_MS_INFO (mh->min_dyn_reloc_index, 1);
+ mips_elf64_swap_msym_out
+ (dynobj, &msym,
+ ((Elf32_External_Msym *) smsym->contents) + h->dynindx);
}
- for (i = 0; i < nsymz; i++)
+ /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
+ name = h->root.root.string;
+ if (strcmp (name, "_DYNAMIC") == 0
+ || strcmp (name, "_GLOBAL_OFFSET_TABLE_") == 0)
+ sym->st_shndx = SHN_ABS;
+ else if (strcmp (name, "_DYNAMIC_LINK") == 0
+ || strcmp (name, "_DYNAMIC_LINKING") == 0)
+ {
+ sym->st_shndx = SHN_ABS;
+ sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION);
+ sym->st_value = 1;
+ }
+ else if (sym->st_shndx != SHN_UNDEF && sym->st_shndx != SHN_ABS)
{
- carsyms->file_offset = bfd_getb64 (raw_armap + i * 8);
- carsyms->name = stringbase;
- stringbase += strlen (stringbase) + 1;
- ++carsyms;
+ if (h->type == STT_FUNC)
+ sym->st_shndx = SHN_MIPS_TEXT;
+ else if (h->type == STT_OBJECT)
+ sym->st_shndx = SHN_MIPS_DATA;
}
- *stringbase = '\0';
- ardata->symdef_count = nsymz;
- ardata->first_file_filepos = arhdrpos + sizeof (struct ar_hdr) + parsed_size;
+ /* Handle the IRIX6-specific symbols. */
- bfd_has_map (abfd) = true;
- bfd_release (abfd, raw_armap);
+ {
+ /* The linker script takes care of providing names and values for
+ these, but we must place them into the right sections. */
+ static const char* const text_section_symbols[] = {
+ "_ftext",
+ "_etext",
+ "__dso_displacement",
+ "__elf_header",
+ "__program_header_table",
+ NULL
+ };
+
+ static const char* const data_section_symbols[] = {
+ "_fdata",
+ "_edata",
+ "_end",
+ "_fbss",
+ NULL
+ };
+
+ const char* const *p;
+ int i;
+
+ for (i = 0; i < 2; ++i)
+ for (p = (i == 0) ? text_section_symbols : data_section_symbols;
+ *p;
+ ++p)
+ if (strcmp (*p, name) == 0)
+ {
+ /* All of these symbols are given type STT_SECTION by the
+ IRIX6 linker. */
+ sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION);
+
+ /* The IRIX linker puts these symbols in special sections. */
+ if (i == 0)
+ sym->st_shndx = SHN_MIPS_TEXT;
+ else
+ sym->st_shndx = SHN_MIPS_DATA;
+
+ break;
+ }
+ }
return true;
+}
- error_return:
- if (raw_armap != NULL)
- bfd_release (abfd, raw_armap);
- if (ardata->symdefs != NULL)
- bfd_release (abfd, ardata->symdefs);
- return false;
+/* Finish up the dynamic sections. */
+
+boolean
+mips_elf64_finish_dynamic_sections (output_bfd, info)
+ bfd *output_bfd;
+ struct bfd_link_info *info;
+{
+ bfd *dynobj;
+ asection *sdyn;
+ asection *sgot;
+ struct mips_elf64_got_info *g;
+
+ dynobj = elf_hash_table (info)->dynobj;
+
+ sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
+
+ sgot = bfd_get_section_by_name (dynobj, ".got");
+ if (sgot == NULL)
+ g = NULL;
+ else
+ {
+ BFD_ASSERT (elf_section_data (sgot) != NULL);
+ g = (struct mips_elf64_got_info *) elf_section_data (sgot)->tdata;
+ BFD_ASSERT (g != NULL);
+ }
+
+ if (elf_hash_table (info)->dynamic_sections_created)
+ {
+ bfd_byte *b;
+
+ BFD_ASSERT (sdyn != NULL);
+ BFD_ASSERT (g != NULL);
+
+ for (b = sdyn->contents;
+ b < sdyn->contents + sdyn->_raw_size;
+ b += get_elf_backend_data (dynobj)->s->sizeof_dyn)
+ {
+ Elf_Internal_Dyn dyn;
+ const char *name;
+ size_t elemsize;
+ asection *s;
+ boolean swap_out_p;
+
+ /* Read in the current dynamic entry. */
+ (*get_elf_backend_data (dynobj)->s->swap_dyn_in) (dynobj, b, &dyn);
+
+ /* Assume that we're going to modify it and write it out. */
+ swap_out_p = true;
+
+ switch (dyn.d_tag)
+ {
+ case DT_RELENT:
+ s = bfd_get_section_by_name(dynobj, "rel.dyn");
+ BFD_ASSERT (s != NULL);
+ dyn.d_un.d_val = get_elf_backend_data (dynobj)->s->sizeof_rel;
+ break;
+
+ case DT_STRSZ:
+ /* Rewrite DT_STRSZ. */
+ dyn.d_un.d_val =
+ _bfd_elf_strtab_size (elf_hash_table (info)->dynstr);
+ break;
+
+ case DT_PLTGOT:
+ name = ".got";
+ goto get_vma;
+ case DT_MIPS_CONFLICT:
+ name = ".conflict";
+ goto get_vma;
+ case DT_MIPS_LIBLIST:
+ name = ".liblist";
+ get_vma:
+ s = bfd_get_section_by_name (output_bfd, name);
+ BFD_ASSERT (s != NULL);
+ dyn.d_un.d_ptr = s->vma;
+ break;
+
+ case DT_MIPS_RLD_VERSION:
+ dyn.d_un.d_val = 1; /* XXX */
+ break;
+
+ case DT_MIPS_FLAGS:
+ dyn.d_un.d_val = RHF_NOTPOT; /* XXX */
+ break;
+
+ case DT_MIPS_CONFLICTNO:
+ name = ".conflict";
+ elemsize = sizeof (Elf32_Conflict);
+ goto set_elemno;
+
+ case DT_MIPS_LIBLISTNO:
+ name = ".liblist";
+ elemsize = sizeof (Elf32_Lib);
+ set_elemno:
+ s = bfd_get_section_by_name (output_bfd, name);
+ if (s != NULL)
+ {
+ if (s->_cooked_size != 0)
+ dyn.d_un.d_val = s->_cooked_size / elemsize;
+ else
+ dyn.d_un.d_val = s->_raw_size / elemsize;
+ }
+ else
+ dyn.d_un.d_val = 0;
+ break;
+
+ case DT_MIPS_TIME_STAMP:
+ time ((time_t *) &dyn.d_un.d_val);
+ break;
+
+ case DT_MIPS_ICHECKSUM:
+ /* XXX FIXME: */
+ swap_out_p = false;
+ break;
+
+ case DT_MIPS_IVERSION:
+ /* XXX FIXME: */
+ swap_out_p = false;
+ break;
+
+ case DT_MIPS_BASE_ADDRESS:
+ s = output_bfd->sections;
+ BFD_ASSERT (s != NULL);
+ dyn.d_un.d_ptr = s->vma & ~(0xffff);
+ break;
+
+ case DT_MIPS_LOCAL_GOTNO:
+ dyn.d_un.d_val = g->local_gotno;
+ break;
+
+ case DT_MIPS_UNREFEXTNO:
+ /* The index into the dynamic symbol table which is the
+ entry of the first external symbol that is not
+ referenced within the same object. */
+ dyn.d_un.d_val = bfd_count_sections (output_bfd) + 1;
+ break;
+
+ case DT_MIPS_GOTSYM:
+ if (g->global_gotsym)
+ {
+ dyn.d_un.d_val = g->global_gotsym->dynindx;
+ break;
+ }
+ /* In case if we don't have global got symbols we default
+ to setting DT_MIPS_GOTSYM to the same value as
+ DT_MIPS_SYMTABNO, so we just fall through. */
+
+ case DT_MIPS_SYMTABNO:
+ name = ".dynsym";
+ elemsize = get_elf_backend_data (output_bfd)->s->sizeof_sym;
+ s = bfd_get_section_by_name (output_bfd, name);
+ BFD_ASSERT (s != NULL);
+
+ if (s->_cooked_size != 0)
+ dyn.d_un.d_val = s->_cooked_size / elemsize;
+ else
+ dyn.d_un.d_val = s->_raw_size / elemsize;
+ break;
+
+ case DT_MIPS_HIPAGENO:
+ dyn.d_un.d_val = g->local_gotno - MIPS_RESERVED_GOTNO;
+ break;
+
+ case DT_MIPS_OPTIONS:
+ s = bfd_get_section_by_name(output_bfd, ".MIPS.options");
+ dyn.d_un.d_ptr = s->vma;
+ break;
+
+ case DT_MIPS_MSYM:
+ s = bfd_get_section_by_name(output_bfd, ".msym");
+ dyn.d_un.d_ptr = s->vma;
+ break;
+
+ default:
+ swap_out_p = false;
+ break;
+ }
+
+ if (swap_out_p)
+ (*get_elf_backend_data (dynobj)->s->swap_dyn_out)
+ (dynobj, &dyn, b);
+ }
+ }
+
+ /* The first entry of the global offset table will be filled at
+ runtime. The second entry will be used by some runtime loaders.
+ This isn't the case of Irix rld. */
+ if (sgot != NULL && sgot->_raw_size > 0)
+ {
+ bfd_put_64 (output_bfd, (bfd_vma) 0, sgot->contents);
+ bfd_put_64 (output_bfd, (bfd_vma) 0x80000000, sgot->contents + 8);
+ }
+
+ if (sgot != NULL)
+ elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 8;
+
+ {
+ asection *smsym;
+ asection *s;
+
+ /* ??? The section symbols for the output sections were set up in
+ _bfd_elf_final_link. SGI sets the STT_NOTYPE attribute for these
+ symbols. Should we do so? */
+
+ smsym = bfd_get_section_by_name (dynobj, ".msym");
+ if (smsym != NULL)
+ {
+ Elf32_Internal_Msym msym;
+
+ msym.ms_hash_value = 0;
+ msym.ms_info = ELF32_MS_INFO (0, 1);
+
+ for (s = output_bfd->sections; s != NULL; s = s->next)
+ {
+ long dynindx = elf_section_data (s)->dynindx;
+
+ mips_elf64_swap_msym_out
+ (output_bfd, &msym,
+ (((Elf32_External_Msym *) smsym->contents)
+ + dynindx));
+ }
+ }
+
+ /* Clean up a first relocation in .rel.dyn. */
+ s = bfd_get_section_by_name (dynobj, "rel.dyn");
+ if (s != NULL && s->_raw_size > 0)
+ memset (s->contents, 0, get_elf_backend_data (dynobj)->s->sizeof_rel);
+ }
+
+ return true;
}
-/* Write out an Irix 6 armap. The Irix 6 tools are supposed to be
- able to handle ordinary ELF armaps, but at least on Irix 6.2 the
- linker crashes. */
+/* Return the section that should be marked against GC for a given
+ relocation. */
+
+asection *
+mips_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_MIPS_GNU_VTINHERIT:
+ case R_MIPS_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
+ {
+ return bfd_section_from_elf_index (abfd, sym->st_shndx);
+ }
+
+ return NULL;
+}
+
+/* Update the got entry reference counts for the section being removed. */
+
+boolean
+mips_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;
+{
+#if 0
+ Elf_Internal_Shdr *symtab_hdr;
+ struct elf_link_hash_entry **sym_hashes;
+ bfd_signed_vma *local_got_refcounts;
+ const Elf_Internal_Rela *rel, *relend;
+ unsigned long r_symndx;
+ struct elf_link_hash_entry *h;
+
+ symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+ sym_hashes = elf_sym_hashes (abfd);
+ local_got_refcounts = elf_local_got_refcounts (abfd);
+
+ relend = relocs + sec->reloc_count;
+ for (rel = relocs; rel < relend; rel++)
+ switch (ELF64_R_TYPE (rel->r_info))
+ {
+ case R_MIPS_GOT16:
+ case R_MIPS_CALL16:
+ case R_MIPS_CALL_HI16:
+ case R_MIPS_CALL_LO16:
+ case R_MIPS_GOT_HI16:
+ case R_MIPS_GOT_LO16:
+ /* ??? It would seem that the existing MIPS code does no sort
+ of reference counting or whatnot on its GOT and PLT entries,
+ so it is not possible to garbage collect them at this time. */
+ break;
+
+ default:
+ break;
+ }
+#endif
+
+ return true;
+}
+
+/* Create the .got section to hold the global offset table. */
static boolean
-mips_elf64_write_armap (arch, elength, map, symbol_count, stridx)
- bfd *arch;
- unsigned int elength;
- struct orl *map;
- unsigned int symbol_count;
- int stridx;
-{
- unsigned int ranlibsize = (symbol_count * 8) + 8;
- unsigned int stringsize = stridx;
- unsigned int mapsize = stringsize + ranlibsize;
- file_ptr archive_member_file_ptr;
- bfd *current = arch->archive_head;
- unsigned int count;
- struct ar_hdr hdr;
- unsigned int i;
- int padding;
- bfd_byte buf[8];
-
- padding = BFD_ALIGN (mapsize, 8) - mapsize;
- mapsize += padding;
-
- /* work out where the first object file will go in the archive */
- archive_member_file_ptr = (mapsize
- + elength
- + sizeof (struct ar_hdr)
- + SARMAG);
-
- memset ((char *) (&hdr), 0, sizeof (struct ar_hdr));
- strcpy (hdr.ar_name, "/SYM64/");
- sprintf (hdr.ar_size, "%-10d", (int) mapsize);
- sprintf (hdr.ar_date, "%ld", (long) time (NULL));
- /* This, at least, is what Intel coff sets the values to.: */
- sprintf ((hdr.ar_uid), "%d", 0);
- sprintf ((hdr.ar_gid), "%d", 0);
- sprintf ((hdr.ar_mode), "%-7o", (unsigned) 0);
- strncpy (hdr.ar_fmag, ARFMAG, 2);
-
- for (i = 0; i < sizeof (struct ar_hdr); i++)
- if (((char *) (&hdr))[i] == '\0')
- (((char *) (&hdr))[i]) = ' ';
-
- /* Write the ar header for this item and the number of symbols */
-
- if (bfd_write ((PTR) &hdr, 1, sizeof (struct ar_hdr), arch)
- != sizeof (struct ar_hdr))
+mips_elf64_create_got_section (abfd, info)
+ bfd *abfd;
+ struct bfd_link_info *info;
+{
+ flagword flags;
+ register asection *s;
+ struct elf_link_hash_entry *h;
+ struct mips_elf64_got_info *g;
+
+ /* This function may be called more than once. */
+ if (bfd_get_section_by_name (abfd, ".got"))
+ return true;
+
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED);
+
+ s = bfd_make_section (abfd, ".got");
+ if (s == NULL
+ || ! bfd_set_section_flags (abfd, s, flags)
+ || ! bfd_set_section_alignment (abfd, s, 4))
return false;
- bfd_putb64 (symbol_count, buf);
- if (bfd_write (buf, 1, 8, arch) != 8)
+ /* Define the symbol _GLOBAL_OFFSET_TABLE_. We don't do this in the
+ linker script because we don't want to define the symbol if we
+ are not creating a global offset table. */
+ h = NULL;
+ if (! (_bfd_generic_link_add_one_symbol
+ (info, abfd, "_GLOBAL_OFFSET_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_NON_ELF;
+ h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
+ h->type = STT_OBJECT;
- /* Two passes, first write the file offsets for each symbol -
- remembering that each offset is on a two byte boundary. */
+ if (info->shared
+ && ! bfd_elf64_link_record_dynamic_symbol (info, h))
+ return false;
- /* Write out the file offset for the file associated with each
- symbol, and remember to keep the offsets padded out. */
+ /* The first several global offset table entries are reserved. */
+ s->_raw_size = MIPS_RESERVED_GOTNO * (get_elf_backend_data (abfd)->s->arch_size / 8);
- current = arch->archive_head;
- count = 0;
- while (current != (bfd *) NULL && count < symbol_count)
+ g = (struct mips_elf64_got_info *) bfd_alloc (abfd,
+ sizeof (struct mips_elf64_got_info));
+ if (g == NULL)
+ return false;
+ g->global_gotsym = NULL;
+ g->local_gotno = MIPS_RESERVED_GOTNO;
+ g->assigned_gotno = MIPS_RESERVED_GOTNO;
+ if (elf_section_data (s) == NULL)
+ {
+ s->used_by_bfd =
+ (PTR) bfd_zalloc (abfd, sizeof (struct bfd_elf_section_data));
+ if (elf_section_data (s) == NULL)
+ return false;
+ }
+ elf_section_data (s)->tdata = (PTR) g;
+ elf_section_data (s)->this_hdr.sh_flags
+ |= SHF_ALLOC | SHF_WRITE | SHF_MIPS_GPREL;
+
+ return true;
+}
+
+/* If H is a symbol that needs a global GOT entry, but has a dynamic
+ symbol table index lower than any we've seen to date, record it for
+ posterity. */
+
+static boolean
+mips_elf64_record_global_got_symbol (h, info, g)
+ struct elf_link_hash_entry *h;
+ struct bfd_link_info *info;
+ struct mips_elf64_got_info *g ATTRIBUTE_UNUSED;
+{
+ /* A global symbol in the GOT must also be in the dynamic symbol
+ table. */
+ if (h->dynindx == -1
+ && !bfd_elf64_link_record_dynamic_symbol (info, h))
+ return false;
+
+ /* If we've already marked this entry as needing GOT space, we don't
+ need to do it again. */
+ if (h->got.offset != (bfd_vma) - 1)
+ return true;
+
+ /* By setting this to a value other than -1, we are indicating that
+ there needs to be a GOT entry for H. Avoid using zero, as the
+ generic ELF copy_indirect_symbol tests for <= 0. */
+ h->got.offset = 1;
+
+ return true;
+}
+
+/* Returns the .msym section for ABFD, creating it if it does not
+ already exist. Returns NULL to indicate error. */
+
+static asection *
+mips_elf64_create_msym_section (abfd)
+ bfd *abfd;
+{
+ asection *s;
+
+ s = bfd_get_section_by_name (abfd, ".msym");
+ if (!s)
+ {
+ s = bfd_make_section (abfd, ".msym");
+ if (!s
+ || !bfd_set_section_flags (abfd, s,
+ SEC_ALLOC
+ | SEC_LOAD
+ | SEC_HAS_CONTENTS
+ | SEC_LINKER_CREATED
+ | SEC_READONLY)
+ || !bfd_set_section_alignment (abfd, s, 3))
+ return NULL;
+ }
+
+ return s;
+}
+
+/* Add room for N relocations to the .rel.dyn section in ABFD. */
+
+static void
+mips_elf64_allocate_dynamic_relocations (abfd, n)
+ bfd *abfd;
+ unsigned int n;
+{
+ asection *s;
+
+ s = bfd_get_section_by_name (abfd, ".rel.dyn");
+ BFD_ASSERT (s != NULL);
+
+ if (s->_raw_size == 0)
+ {
+ /* Make room for a null element. */
+ s->_raw_size += get_elf_backend_data (abfd)->s->sizeof_rel;
+ ++s->reloc_count;
+ }
+ s->_raw_size += n * get_elf_backend_data (abfd)->s->sizeof_rel;
+}
+
+/* Look through the relocs for a section during the first phase, and
+ allocate space in the global offset table. */
+
+boolean
+mips_elf64_check_relocs (abfd, info, sec, relocs)
+ bfd *abfd;
+ struct bfd_link_info *info;
+ asection *sec;
+ const Elf_Internal_Rela *relocs;
+{
+ const char *name;
+ bfd *dynobj;
+ Elf_Internal_Shdr *symtab_hdr;
+ struct elf_link_hash_entry **sym_hashes;
+ struct mips_elf64_got_info *g;
+ size_t extsymoff;
+ const Elf_Internal_Rela *rel;
+ const Elf_Internal_Rela *rel_end;
+ asection *sgot;
+ asection *sreloc;
+ struct elf_backend_data *bed;
+
+ if (info->relocateable)
+ return true;
+
+ dynobj = elf_hash_table (info)->dynobj;
+ symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+ sym_hashes = elf_sym_hashes (abfd);
+ extsymoff = (elf_bad_symtab (abfd)) ? 0 : symtab_hdr->sh_info;
+
+ /* Check for the mips16 stub sections. */
+
+ name = bfd_get_section_name (abfd, sec);
+ if (strncmp (name, FN_STUB, sizeof FN_STUB - 1) == 0)
{
- /* For each symbol which is used defined in this object, write out
- the object file's address in the archive */
+ unsigned long r_symndx;
- while (((bfd *) (map[count]).pos) == current)
+ /* Look at the relocation information to figure out which symbol
+ this is for. */
+
+ r_symndx = ELF64_R_SYM (relocs->r_info);
+
+ if (r_symndx < extsymoff
+ || sym_hashes[r_symndx - extsymoff] == NULL)
+ {
+ asection *o;
+
+ /* This stub is for a local symbol. This stub will only be
+ needed if there is some relocation in this BFD, other
+ than a 16 bit function call, which refers to this symbol. */
+ for (o = abfd->sections; o != NULL; o = o->next)
+ {
+ Elf_Internal_Rela *sec_relocs;
+ const Elf_Internal_Rela *r, *rend;
+
+ /* We can ignore stub sections when looking for relocs. */
+ if ((o->flags & SEC_RELOC) == 0
+ || o->reloc_count == 0
+ || strncmp (bfd_get_section_name (abfd, o), FN_STUB,
+ sizeof FN_STUB - 1) == 0
+ || strncmp (bfd_get_section_name (abfd, o), CALL_STUB,
+ sizeof CALL_STUB - 1) == 0
+ || strncmp (bfd_get_section_name (abfd, o), CALL_FP_STUB,
+ sizeof CALL_FP_STUB - 1) == 0)
+ continue;
+
+ sec_relocs = (_bfd_elf64_link_read_relocs
+ (abfd, o, (PTR) NULL,
+ (Elf_Internal_Rela *) NULL,
+ info->keep_memory));
+ if (sec_relocs == NULL)
+ return false;
+
+ rend = sec_relocs + o->reloc_count;
+ for (r = sec_relocs; r < rend; r++)
+ if (ELF64_R_SYM (r->r_info) == r_symndx
+ && ELF64_R_TYPE (r->r_info) != R_MIPS16_26)
+ break;
+
+ if (! info->keep_memory)
+ free (sec_relocs);
+
+ if (r < rend)
+ break;
+ }
+
+ if (o == NULL)
+ {
+ /* There is no non-call reloc for this stub, so we do
+ not need it. Since this function is called before
+ the linker maps input sections to output sections, we
+ can easily discard it by setting the SEC_EXCLUDE
+ flag. */
+ sec->flags |= SEC_EXCLUDE;
+ return true;
+ }
+
+ /* Record this stub in an array of local symbol stubs for
+ this BFD. */
+ if (elf_tdata (abfd)->local_stubs == NULL)
+ {
+ unsigned long symcount;
+ asection **n;
+ bfd_size_type amt;
+
+ if (elf_bad_symtab (abfd))
+ symcount = NUM_SHDR_ENTRIES (symtab_hdr);
+ else
+ symcount = symtab_hdr->sh_info;
+ amt = symcount * sizeof (asection *);
+ n = (asection **) bfd_zalloc (abfd, amt);
+ if (n == NULL)
+ return false;
+ elf_tdata (abfd)->local_stubs = n;
+ }
+
+ elf_tdata (abfd)->local_stubs[r_symndx] = sec;
+
+ /* We don't need to set mips16_stubs_seen in this case.
+ That flag is used to see whether we need to look through
+ the global symbol table for stubs. We don't need to set
+ it here, because we just have a local stub. */
+ }
+ else
+ {
+ struct mips_elf64_link_hash_entry *h;
+
+ h = ((struct mips_elf64_link_hash_entry *)
+ sym_hashes[r_symndx - extsymoff]);
+
+ /* H is the symbol this stub is for. */
+
+ h->fn_stub = sec;
+ mips_elf64_hash_table (info)->mips16_stubs_seen = true;
+ }
+ }
+ else if (strncmp (name, CALL_STUB, sizeof CALL_STUB - 1) == 0
+ || strncmp (name, CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0)
+ {
+ unsigned long r_symndx;
+ struct mips_elf64_link_hash_entry *h;
+ asection **loc;
+
+ /* Look at the relocation information to figure out which symbol
+ this is for. */
+
+ r_symndx = ELF64_R_SYM (relocs->r_info);
+
+ if (r_symndx < extsymoff
+ || sym_hashes[r_symndx - extsymoff] == NULL)
+ {
+ /* This stub was actually built for a static symbol defined
+ in the same file. We assume that all static symbols in
+ mips16 code are themselves mips16, so we can simply
+ discard this stub. Since this function is called before
+ the linker maps input sections to output sections, we can
+ easily discard it by setting the SEC_EXCLUDE flag. */
+ sec->flags |= SEC_EXCLUDE;
+ return true;
+ }
+
+ h = ((struct mips_elf64_link_hash_entry *)
+ sym_hashes[r_symndx - extsymoff]);
+
+ /* H is the symbol this stub is for. */
+
+ if (strncmp (name, CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0)
+ loc = &h->call_fp_stub;
+ else
+ loc = &h->call_stub;
+
+ /* If we already have an appropriate stub for this function, we
+ don't need another one, so we can discard this one. Since
+ this function is called before the linker maps input sections
+ to output sections, we can easily discard it by setting the
+ SEC_EXCLUDE flag. We can also discard this section if we
+ happen to already know that this is a mips16 function; it is
+ not necessary to check this here, as it is checked later, but
+ it is slightly faster to check now. */
+ if (*loc != NULL || h->root.other == STO_MIPS16)
+ {
+ sec->flags |= SEC_EXCLUDE;
+ return true;
+ }
+
+ *loc = sec;
+ mips_elf64_hash_table (info)->mips16_stubs_seen = true;
+ }
+
+ if (dynobj == NULL)
+ {
+ sgot = NULL;
+ g = NULL;
+ }
+ else
+ {
+ sgot = bfd_get_section_by_name (dynobj, ".got");
+ if (sgot == NULL)
+ g = NULL;
+ else
+ {
+ BFD_ASSERT (elf_section_data (sgot) != NULL);
+ g = (struct mips_elf64_got_info *) elf_section_data (sgot)->tdata;
+ BFD_ASSERT (g != NULL);
+ }
+ }
+
+ sreloc = NULL;
+ bed = get_elf_backend_data (abfd);
+ rel_end = relocs + sec->reloc_count * bed->s->int_rels_per_ext_rel;
+ for (rel = relocs; rel < rel_end; ++rel)
+ {
+ unsigned long r_symndx;
+ int r_type;
+ struct elf_link_hash_entry *h;
+
+ r_symndx = ELF64_R_SYM (rel->r_info);
+ r_type = ELF64_MIPS_R_TYPE (rel->r_info);
+
+ if (r_symndx < extsymoff)
+ h = NULL;
+ else if (r_symndx >= extsymoff + NUM_SHDR_ENTRIES (symtab_hdr))
+ {
+ (*_bfd_error_handler)
+ (_("%s: Malformed reloc detected for section %s"),
+ bfd_archive_filename (abfd), name);
+ bfd_set_error (bfd_error_bad_value);
+ return false;
+ }
+ else
+ {
+ h = sym_hashes[r_symndx - extsymoff];
+
+ /* This may be an indirect symbol created because of a version. */
+ if (h != NULL)
+ {
+ while (h->root.type == bfd_link_hash_indirect)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ }
+ }
+
+ /* Some relocs require a global offset table. */
+ if (dynobj == NULL || sgot == NULL)
+ {
+ switch (r_type)
+ {
+ case R_MIPS_GOT16:
+ case R_MIPS_CALL16:
+ case R_MIPS_CALL_HI16:
+ case R_MIPS_CALL_LO16:
+ case R_MIPS_GOT_HI16:
+ case R_MIPS_GOT_LO16:
+ case R_MIPS_GOT_PAGE:
+ case R_MIPS_GOT_OFST:
+ case R_MIPS_GOT_DISP:
+ if (dynobj == NULL)
+ elf_hash_table (info)->dynobj = dynobj = abfd;
+ if (! mips_elf64_create_got_section (dynobj, info))
+ return false;
+ g = _mips_elf64_got_info (dynobj, &sgot);
+ break;
+
+ case R_MIPS_32:
+ case R_MIPS_REL32:
+ case R_MIPS_64:
+ if (dynobj == NULL
+ && (info->shared || h != NULL)
+ && (sec->flags & SEC_ALLOC) != 0)
+ elf_hash_table (info)->dynobj = dynobj = abfd;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if (!h && (r_type == R_MIPS_CALL_LO16
+ || r_type == R_MIPS_GOT_LO16
+ || r_type == R_MIPS_GOT_DISP))
{
- bfd_putb64 (archive_member_file_ptr, buf);
- if (bfd_write (buf, 1, 8, arch) != 8)
+ /* We may need a local GOT entry for this relocation. We
+ don't count R_MIPS_GOT_PAGE because we can estimate the
+ maximum number of pages needed by looking at the size of
+ the segment. Similar comments apply to R_MIPS_GOT16 and
+ R_MIPS_CALL16. We don't count R_MIPS_GOT_HI16, or
+ R_MIPS_CALL_HI16 because these are always followed by an
+ R_MIPS_GOT_LO16 or R_MIPS_CALL_LO16.
+
+ This estimation is very conservative since we can merge
+ duplicate entries in the GOT. In order to be less
+ conservative, we could actually build the GOT here,
+ rather than in relocate_section. */
+ g->local_gotno++;
+ sgot->_raw_size += get_elf_backend_data (dynobj)->s->arch_size / 8;
+ }
+
+ switch (r_type)
+ {
+ case R_MIPS_CALL16:
+ if (h == NULL)
+ {
+ (*_bfd_error_handler)
+ (_("%s: CALL16 reloc at 0x%lx not against global symbol"),
+ bfd_archive_filename (abfd), (unsigned long) rel->r_offset);
+ bfd_set_error (bfd_error_bad_value);
+ return false;
+ }
+ /* Fall through. */
+
+ case R_MIPS_CALL_HI16:
+ case R_MIPS_CALL_LO16:
+ if (h != NULL)
+ {
+ /* This symbol requires a global offset table entry. */
+ if (!mips_elf64_record_global_got_symbol (h, info, g))
+ return false;
+
+ /* We need a stub, not a plt entry for the undefined
+ function. But we record it as if it needs plt. See
+ elf_adjust_dynamic_symbol in elflink.h. */
+ h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+ h->type = STT_FUNC;
+ }
+ break;
+
+ case R_MIPS_GOT16:
+ case R_MIPS_GOT_HI16:
+ case R_MIPS_GOT_LO16:
+ case R_MIPS_GOT_DISP:
+ /* This symbol requires a global offset table entry. */
+ if (h && !mips_elf64_record_global_got_symbol (h, info, g))
+ return false;
+ break;
+
+ case R_MIPS_32:
+ case R_MIPS_REL32:
+ case R_MIPS_64:
+ if ((info->shared || h != NULL)
+ && (sec->flags & SEC_ALLOC) != 0)
+ {
+ if (sreloc == NULL)
+ {
+ const char *name = ".rel.dyn";
+
+ sreloc = bfd_get_section_by_name (dynobj, name);
+ if (sreloc == NULL)
+ {
+ sreloc = bfd_make_section (dynobj, name);
+ if (sreloc == NULL
+ || ! bfd_set_section_flags (dynobj, sreloc,
+ (SEC_ALLOC
+ | SEC_LOAD
+ | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED
+ | SEC_READONLY))
+ || ! bfd_set_section_alignment (dynobj, sreloc,
+ 4))
+ return false;
+ }
+ }
+#define MIPS_READONLY_SECTION (SEC_ALLOC | SEC_LOAD | SEC_READONLY)
+ if (info->shared)
+ {
+ /* When creating a shared object, we must copy these
+ reloc types into the output file as R_MIPS_REL32
+ relocs. We make room for this reloc in the
+ .rel.dyn reloc section. */
+ mips_elf64_allocate_dynamic_relocations (dynobj, 1);
+ if ((sec->flags & MIPS_READONLY_SECTION)
+ == MIPS_READONLY_SECTION)
+ /* We tell the dynamic linker that there are
+ relocations against the text segment. */
+ info->flags |= DF_TEXTREL;
+ }
+ else
+ {
+ struct mips_elf64_link_hash_entry *hmips;
+
+ /* We only need to copy this reloc if the symbol is
+ defined in a dynamic object. */
+ hmips = (struct mips_elf64_link_hash_entry *) h;
+ ++hmips->possibly_dynamic_relocs;
+ if ((sec->flags & MIPS_READONLY_SECTION)
+ == MIPS_READONLY_SECTION)
+ /* We need it to tell the dynamic linker if there
+ are relocations against the text segment. */
+ hmips->readonly_reloc = true;
+ }
+
+ /* Even though we don't directly need a GOT entry for
+ this symbol, a symbol must have a dynamic symbol
+ table index greater that DT_MIPS_GOTSYM if there are
+ dynamic relocations against it. */
+ if (h != NULL
+ && !mips_elf64_record_global_got_symbol (h, info, g))
+ return false;
+ }
+ break;
+
+ case R_MIPS_26:
+ case R_MIPS_GPREL16:
+ case R_MIPS_LITERAL:
+ case R_MIPS_GPREL32:
+ break;
+
+ /* This relocation describes the C++ object vtable hierarchy.
+ Reconstruct it for later use during GC. */
+ case R_MIPS_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_MIPS_GNU_VTENTRY:
+ if (!_bfd_elf64_gc_record_vtentry (abfd, sec, h, rel->r_offset))
return false;
- count++;
+ break;
+
+ default:
+ break;
}
- /* Add size of this archive entry */
- archive_member_file_ptr += (arelt_size (current)
- + sizeof (struct ar_hdr));
- /* remember about the even alignment */
- archive_member_file_ptr += archive_member_file_ptr % 2;
- current = current->next;
}
- /* now write the strings themselves */
- for (count = 0; count < symbol_count; count++)
+ return true;
+}
+
+/* Structure used to pass information to mips_elf64_output_extsym. */
+
+struct extsym_info
+{
+ bfd *abfd;
+ struct bfd_link_info *info;
+ struct ecoff_debug_info *debug;
+ const struct ecoff_debug_swap *swap;
+ boolean failed;
+};
+
+/* This routine is used to write out ECOFF debugging external symbol
+ information. It is called via mips_elf64_link_hash_traverse. The
+ ECOFF external symbol information must match the ELF external
+ symbol information. Unfortunately, at this point we don't know
+ whether a symbol is required by reloc information, so the two
+ tables may wind up being different. We must sort out the external
+ symbol information before we can set the final size of the .mdebug
+ section, and we must set the size of the .mdebug section before we
+ can relocate any sections, and we can't know which symbols are
+ required by relocation until we relocate the sections.
+ Fortunately, it is relatively unlikely that any symbol will be
+ stripped but required by a reloc. In particular, it can not happen
+ when generating a final executable. */
+
+static boolean
+mips_elf64_output_extsym (h, data)
+ struct mips_elf64_link_hash_entry *h;
+ PTR data;
+{
+ struct extsym_info *einfo = (struct extsym_info *) data;
+ boolean strip;
+ asection *sec, *output_section;
+
+ if (h->root.root.type == bfd_link_hash_warning)
+ h = (struct mips_elf64_link_hash_entry *) h->root.root.u.i.link;
+
+ if (h->root.indx == -2)
+ strip = false;
+ else if (((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+ || (h->root.elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0)
+ && (h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
+ && (h->root.elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0)
+ strip = true;
+ else if (einfo->info->strip == strip_all
+ || (einfo->info->strip == strip_some
+ && bfd_hash_lookup (einfo->info->keep_hash,
+ h->root.root.root.string,
+ false, false) == NULL))
+ strip = true;
+ else
+ strip = false;
+
+ if (strip)
+ return true;
+
+ if (h->esym.ifd == -2)
+ {
+ h->esym.jmptbl = 0;
+ h->esym.cobol_main = 0;
+ h->esym.weakext = 0;
+ h->esym.reserved = 0;
+ h->esym.ifd = ifdNil;
+ h->esym.asym.value = 0;
+ h->esym.asym.st = stGlobal;
+
+ if (h->root.root.type == bfd_link_hash_undefined
+ || h->root.root.type == bfd_link_hash_undefweak)
+ {
+ const char *name;
+
+ /* Use undefined class. Also, set class and type for some
+ special symbols. */
+ name = h->root.root.root.string;
+ h->esym.asym.sc = scUndefined;
+ }
+ else if (h->root.root.type != bfd_link_hash_defined
+ && h->root.root.type != bfd_link_hash_defweak)
+ h->esym.asym.sc = scAbs;
+ else
+ {
+ const char *name;
+
+ sec = h->root.root.u.def.section;
+ output_section = sec->output_section;
+
+ /* When making a shared library and symbol h is the one from
+ the another shared library, OUTPUT_SECTION may be null. */
+ if (output_section == NULL)
+ h->esym.asym.sc = scUndefined;
+ else
+ {
+ name = bfd_section_name (output_section->owner, output_section);
+
+ if (strcmp (name, ".text") == 0)
+ h->esym.asym.sc = scText;
+ else if (strcmp (name, ".data") == 0)
+ h->esym.asym.sc = scData;
+ else if (strcmp (name, ".sdata") == 0)
+ h->esym.asym.sc = scSData;
+ else if (strcmp (name, ".rodata") == 0
+ || strcmp (name, ".rdata") == 0)
+ h->esym.asym.sc = scRData;
+ else if (strcmp (name, ".bss") == 0)
+ h->esym.asym.sc = scBss;
+ else if (strcmp (name, ".sbss") == 0)
+ h->esym.asym.sc = scSBss;
+ else if (strcmp (name, ".init") == 0)
+ h->esym.asym.sc = scInit;
+ else if (strcmp (name, ".fini") == 0)
+ h->esym.asym.sc = scFini;
+ else
+ h->esym.asym.sc = scAbs;
+ }
+ }
+
+ h->esym.asym.reserved = 0;
+ h->esym.asym.index = indexNil;
+ }
+
+ if (h->root.root.type == bfd_link_hash_common)
+ h->esym.asym.value = h->root.root.u.c.size;
+ else if (h->root.root.type == bfd_link_hash_defined
+ || h->root.root.type == bfd_link_hash_defweak)
+ {
+ if (h->esym.asym.sc == scCommon)
+ h->esym.asym.sc = scBss;
+ else if (h->esym.asym.sc == scSCommon)
+ h->esym.asym.sc = scSBss;
+
+ sec = h->root.root.u.def.section;
+ output_section = sec->output_section;
+ if (output_section != NULL)
+ h->esym.asym.value = (h->root.root.u.def.value
+ + sec->output_offset
+ + output_section->vma);
+ else
+ h->esym.asym.value = 0;
+ }
+ else if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
+ {
+ struct mips_elf64_link_hash_entry *hd = h;
+ boolean no_fn_stub = h->no_fn_stub;
+
+ while (hd->root.root.type == bfd_link_hash_indirect)
+ {
+ hd = (struct mips_elf64_link_hash_entry *)h->root.root.u.i.link;
+ no_fn_stub = no_fn_stub || hd->no_fn_stub;
+ }
+
+ if (!no_fn_stub)
+ {
+ /* Set type and value for a symbol with a function stub. */
+ h->esym.asym.st = stProc;
+ sec = hd->root.root.u.def.section;
+ if (sec == NULL)
+ h->esym.asym.value = 0;
+ else
+ {
+ output_section = sec->output_section;
+ if (output_section != NULL)
+ h->esym.asym.value = (hd->root.plt.offset
+ + sec->output_offset
+ + output_section->vma);
+ else
+ h->esym.asym.value = 0;
+ }
+#if 0 /* FIXME? */
+ h->esym.ifd = 0;
+#endif
+ }
+ }
+
+ if (! bfd_ecoff_debug_one_external (einfo->abfd, einfo->debug, einfo->swap,
+ h->root.root.root.string,
+ &h->esym))
+ {
+ einfo->failed = true;
+ return false;
+ }
+
+ return true;
+}
+
+/* Swap an entry in a .gptab section. Note that these routines rely
+ on the equivalence of the two elements of the union. */
+
+static void
+mips_elf64_swap_gptab_in (abfd, ex, in)
+ bfd *abfd;
+ const Elf32_External_gptab *ex;
+ Elf32_gptab *in;
+{
+ in->gt_entry.gt_g_value = H_GET_32 (abfd, ex->gt_entry.gt_g_value);
+ in->gt_entry.gt_bytes = H_GET_32 (abfd, ex->gt_entry.gt_bytes);
+}
+
+static void
+mips_elf64_swap_gptab_out (abfd, in, ex)
+ bfd *abfd;
+ const Elf32_gptab *in;
+ Elf32_External_gptab *ex;
+{
+ H_PUT_32 (abfd, (bfd_vma) in->gt_entry.gt_g_value,
+ ex->gt_entry.gt_g_value);
+ H_PUT_32 (abfd, (bfd_vma) in->gt_entry.gt_bytes,
+ ex->gt_entry.gt_bytes);
+}
+
+/* A comparison routine used to sort .gptab entries. */
+
+static int
+gptab_compare (p1, p2)
+ const PTR p1;
+ const PTR p2;
+{
+ const Elf32_gptab *a1 = (const Elf32_gptab *) p1;
+ const Elf32_gptab *a2 = (const Elf32_gptab *) p2;
+
+ return a1->gt_entry.gt_g_value - a2->gt_entry.gt_g_value;
+}
+
+/* We need to use a special link routine to handle the .mdebug section.
+ We need to merge all instances of this section together, not write
+ them all out sequentially. */
+
+boolean
+mips_elf64_final_link (abfd, info)
+ bfd *abfd;
+ struct bfd_link_info *info;
+{
+ asection **secpp;
+ asection *o;
+ struct bfd_link_order *p;
+ asection *mdebug_sec, *gptab_data_sec, *gptab_bss_sec;
+ struct ecoff_debug_info debug;
+ const struct ecoff_debug_swap *swap
+ = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap;
+ HDRR *symhdr = &debug.symbolic_header;
+ PTR mdebug_handle = NULL;
+ asection *s;
+ EXTR esym;
+ unsigned int i;
+ static const char * const secname[] =
+ { ".text", ".init", ".fini", ".data",
+ ".rodata", ".sdata", ".sbss", ".bss" };
+ static const int sc[] = { scText, scInit, scFini, scData,
+ scRData, scSData, scSBss, scBss };
+
+ /* If all the things we linked together were PIC, but we're
+ producing an executable (rather than a shared object), then the
+ resulting file is CPIC (i.e., it calls PIC code.) */
+ if (!info->shared
+ && !info->relocateable
+ && elf_elfheader (abfd)->e_flags & EF_MIPS_PIC)
+ {
+ elf_elfheader (abfd)->e_flags &= ~EF_MIPS_PIC;
+ elf_elfheader (abfd)->e_flags |= EF_MIPS_CPIC;
+ }
+
+ /* We'd carefully arranged the dynamic symbol indices, and then the
+ generic size_dynamic_sections renumbered them out from under us.
+ Rather than trying somehow to prevent the renumbering, just do
+ the sort again. */
+ if (elf_hash_table (info)->dynamic_sections_created)
+ {
+ bfd *dynobj;
+ asection *got;
+ struct mips_elf64_got_info *g;
+
+ /* When we resort, we must tell mips_elf64_sort_hash_table what
+ the lowest index it may use is. That's the number of section
+ symbols we're going to add. The generic ELF linker only
+ adds these symbols when building a shared object. Note that
+ we count the sections after (possibly) removing the .options
+ section above. */
+ if (!mips_elf64_sort_hash_table (info, (info->shared
+ ? bfd_count_sections (abfd) + 1
+ : 1)))
+ return false;
+
+ /* Make sure we didn't grow the global .got region. */
+ dynobj = elf_hash_table (info)->dynobj;
+ got = bfd_get_section_by_name (dynobj, ".got");
+ g = (struct mips_elf64_got_info *) elf_section_data (got)->tdata;
+
+ if (g->global_gotsym != NULL)
+ BFD_ASSERT ((elf_hash_table (info)->dynsymcount
+ - g->global_gotsym->dynindx)
+ <= g->global_gotno);
+ }
+
+ /* We include .MIPS.options, even though we don't process it quite right.
+ (Some entries are supposed to be merged.) At IRIX6 empirically we seem
+ to be better off including it than not. */
+ for (secpp = &abfd->sections; *secpp != NULL; secpp = &(*secpp)->next)
+ {
+ if (strcmp ((*secpp)->name, ".MIPS.options") == 0)
+ {
+ for (p = (*secpp)->link_order_head; p != NULL; p = p->next)
+ if (p->type == bfd_indirect_link_order)
+ p->u.indirect.section->flags &=~ SEC_HAS_CONTENTS;
+ (*secpp)->link_order_head = NULL;
+ bfd_section_list_remove (abfd, secpp);
+ --abfd->section_count;
+
+ break;
+ }
+ }
+
+ /* Get a value for the GP register. */
+ if (elf_gp (abfd) == 0)
+ {
+ struct bfd_link_hash_entry *h;
+
+ h = bfd_link_hash_lookup (info->hash, "_gp", false, false, true);
+ if (h != (struct bfd_link_hash_entry *) NULL
+ && h->type == bfd_link_hash_defined)
+ elf_gp (abfd) = (h->u.def.value
+ + h->u.def.section->output_section->vma
+ + h->u.def.section->output_offset);
+ else if (info->relocateable)
+ {
+ bfd_vma lo = MINUS_ONE;
+
+ /* Find the GP-relative section with the lowest offset. */
+ for (o = abfd->sections; o != NULL; o = o->next)
+ if (o->vma < lo
+ && (elf_section_data (o)->this_hdr.sh_flags & SHF_MIPS_GPREL))
+ lo = o->vma;
+
+ /* And calculate GP relative to that. */
+ elf_gp (abfd) = (lo + 0x7ff0);
+ }
+ else
+ {
+ /* If the relocate_section function needs to do a reloc
+ involving the GP value, it should make a reloc_dangerous
+ callback to warn that GP is not defined. */
+ }
+ }
+
+ /* Go through the sections and collect the .mdebug information. */
+ mdebug_sec = NULL;
+ gptab_data_sec = NULL;
+ gptab_bss_sec = NULL;
+ for (o = abfd->sections; o != (asection *) NULL; o = o->next)
+ {
+ if (strcmp (o->name, ".mdebug") == 0)
+ {
+ struct extsym_info einfo;
+ bfd_vma last;
+
+ /* We have found the .mdebug section in the output file.
+ Look through all the link_orders comprising it and merge
+ the information together. */
+ symhdr->magic = swap->sym_magic;
+ /* FIXME: What should the version stamp be? */
+ symhdr->vstamp = 0;
+ symhdr->ilineMax = 0;
+ symhdr->cbLine = 0;
+ symhdr->idnMax = 0;
+ symhdr->ipdMax = 0;
+ symhdr->isymMax = 0;
+ symhdr->ioptMax = 0;
+ symhdr->iauxMax = 0;
+ symhdr->issMax = 0;
+ symhdr->issExtMax = 0;
+ symhdr->ifdMax = 0;
+ symhdr->crfd = 0;
+ symhdr->iextMax = 0;
+
+ /* We accumulate the debugging information itself in the
+ debug_info structure. */
+ debug.line = NULL;
+ debug.external_dnr = NULL;
+ debug.external_pdr = NULL;
+ debug.external_sym = NULL;
+ debug.external_opt = NULL;
+ debug.external_aux = NULL;
+ debug.ss = NULL;
+ debug.ssext = debug.ssext_end = NULL;
+ debug.external_fdr = NULL;
+ debug.external_rfd = NULL;
+ debug.external_ext = debug.external_ext_end = NULL;
+
+ mdebug_handle = bfd_ecoff_debug_init (abfd, &debug, swap, info);
+ if (mdebug_handle == (PTR) NULL)
+ return false;
+
+ esym.jmptbl = 0;
+ esym.cobol_main = 0;
+ esym.weakext = 0;
+ esym.reserved = 0;
+ esym.ifd = ifdNil;
+ esym.asym.iss = issNil;
+ esym.asym.st = stLocal;
+ esym.asym.reserved = 0;
+ esym.asym.index = indexNil;
+ last = 0;
+ for (i = 0; i < sizeof (secname) / sizeof (secname[0]); i++)
+ {
+ esym.asym.sc = sc[i];
+ s = bfd_get_section_by_name (abfd, secname[i]);
+ if (s != NULL)
+ {
+ esym.asym.value = s->vma;
+ last = s->vma + s->_raw_size;
+ }
+ else
+ esym.asym.value = last;
+ if (!bfd_ecoff_debug_one_external (abfd, &debug, swap,
+ secname[i], &esym))
+ return false;
+ }
+
+ for (p = o->link_order_head;
+ p != (struct bfd_link_order *) NULL;
+ p = p->next)
+ {
+ asection *input_section;
+ bfd *input_bfd;
+ const struct ecoff_debug_swap *input_swap;
+ struct ecoff_debug_info input_debug;
+ char *eraw_src;
+ char *eraw_end;
+
+ if (p->type != bfd_indirect_link_order)
+ {
+ if (p->type == bfd_fill_link_order)
+ continue;
+ abort ();
+ }
+
+ input_section = p->u.indirect.section;
+ input_bfd = input_section->owner;
+
+ if (bfd_get_flavour (input_bfd) != bfd_target_elf_flavour
+ || (get_elf_backend_data (input_bfd)
+ ->elf_backend_ecoff_debug_swap) == NULL)
+ {
+ /* I don't know what a non MIPS ELF bfd would be
+ doing with a .mdebug section, but I don't really
+ want to deal with it. */
+ continue;
+ }
+
+ input_swap = (get_elf_backend_data (input_bfd)
+ ->elf_backend_ecoff_debug_swap);
+
+ BFD_ASSERT (p->size == input_section->_raw_size);
+
+ /* The ECOFF linking code expects that we have already
+ read in the debugging information and set up an
+ ecoff_debug_info structure, so we do that now. */
+ if (! _bfd_mips_elf_read_ecoff_info (input_bfd, input_section,
+ &input_debug))
+ return false;
+
+ if (! (bfd_ecoff_debug_accumulate
+ (mdebug_handle, abfd, &debug, swap, input_bfd,
+ &input_debug, input_swap, info)))
+ return false;
+
+ /* Loop through the external symbols. For each one with
+ interesting information, try to find the symbol in
+ the linker global hash table and save the information
+ for the output external symbols. */
+ eraw_src = input_debug.external_ext;
+ eraw_end = (eraw_src
+ + (input_debug.symbolic_header.iextMax
+ * input_swap->external_ext_size));
+ for (;
+ eraw_src < eraw_end;
+ eraw_src += input_swap->external_ext_size)
+ {
+ EXTR ext;
+ const char *name;
+ struct mips_elf64_link_hash_entry *h;
+
+ (*input_swap->swap_ext_in) (input_bfd, (PTR) eraw_src, &ext);
+ if (ext.asym.sc == scNil
+ || ext.asym.sc == scUndefined
+ || ext.asym.sc == scSUndefined)
+ continue;
+
+ name = input_debug.ssext + ext.asym.iss;
+ h = mips_elf64_link_hash_lookup (mips_elf64_hash_table (info),
+ name, false, false, true);
+ if (h == NULL || h->esym.ifd != -2)
+ continue;
+
+ if (ext.ifd != -1)
+ {
+ BFD_ASSERT (ext.ifd
+ < input_debug.symbolic_header.ifdMax);
+ ext.ifd = input_debug.ifdmap[ext.ifd];
+ }
+
+ h->esym = ext;
+ }
+
+ /* Free up the information we just read. */
+ free (input_debug.line);
+ free (input_debug.external_dnr);
+ free (input_debug.external_pdr);
+ free (input_debug.external_sym);
+ free (input_debug.external_opt);
+ free (input_debug.external_aux);
+ free (input_debug.ss);
+ free (input_debug.ssext);
+ free (input_debug.external_fdr);
+ free (input_debug.external_rfd);
+ free (input_debug.external_ext);
+
+ /* Hack: reset the SEC_HAS_CONTENTS flag so that
+ elf_link_input_bfd ignores this section. */
+ input_section->flags &=~ SEC_HAS_CONTENTS;
+ }
+
+ /* Build the external symbol information. */
+ einfo.abfd = abfd;
+ einfo.info = info;
+ einfo.debug = &debug;
+ einfo.swap = swap;
+ einfo.failed = false;
+ mips_elf64_link_hash_traverse (mips_elf64_hash_table (info),
+ mips_elf64_output_extsym,
+ (PTR) &einfo);
+ if (einfo.failed)
+ return false;
+
+ /* Set the size of the .mdebug section. */
+ o->_raw_size = bfd_ecoff_debug_size (abfd, &debug, swap);
+
+ /* Skip this section later on (I don't think this currently
+ matters, but someday it might). */
+ o->link_order_head = (struct bfd_link_order *) NULL;
+
+ mdebug_sec = o;
+ }
+
+ if (strncmp (o->name, ".gptab.", sizeof ".gptab." - 1) == 0)
+ {
+ const char *subname;
+ unsigned int c;
+ Elf32_gptab *tab;
+ Elf32_External_gptab *ext_tab;
+ unsigned int i;
+
+ /* The .gptab.sdata and .gptab.sbss sections hold
+ information describing how the small data area would
+ change depending upon the -G switch. These sections
+ not used in executables files. */
+ if (! info->relocateable)
+ {
+ asection **secpp;
+
+ for (p = o->link_order_head;
+ p != (struct bfd_link_order *) NULL;
+ p = p->next)
+ {
+ asection *input_section;
+
+ if (p->type != bfd_indirect_link_order)
+ {
+ if (p->type == bfd_fill_link_order)
+ continue;
+ abort ();
+ }
+
+ input_section = p->u.indirect.section;
+
+ /* Hack: reset the SEC_HAS_CONTENTS flag so that
+ elf_link_input_bfd ignores this section. */
+ input_section->flags &=~ SEC_HAS_CONTENTS;
+ }
+
+ /* Skip this section later on (I don't think this
+ currently matters, but someday it might). */
+ o->link_order_head = (struct bfd_link_order *) NULL;
+
+ /* Really remove the section. */
+ for (secpp = &abfd->sections;
+ *secpp != o;
+ secpp = &(*secpp)->next)
+ ;
+ bfd_section_list_remove (abfd, secpp);
+ --abfd->section_count;
+
+ continue;
+ }
+
+ /* There is one gptab for initialized data, and one for
+ uninitialized data. */
+ if (strcmp (o->name, ".gptab.sdata") == 0)
+ gptab_data_sec = o;
+ else if (strcmp (o->name, ".gptab.sbss") == 0)
+ gptab_bss_sec = o;
+ else
+ {
+ (*_bfd_error_handler)
+ (_("%s: illegal section name `%s'"),
+ bfd_archive_filename (abfd), o->name);
+ bfd_set_error (bfd_error_nonrepresentable_section);
+ return false;
+ }
+
+ /* The linker script always combines .gptab.data and
+ .gptab.sdata into .gptab.sdata, and likewise for
+ .gptab.bss and .gptab.sbss. It is possible that there is
+ no .sdata or .sbss section in the output file, in which
+ case we must change the name of the output section. */
+ subname = o->name + sizeof ".gptab" - 1;
+ if (bfd_get_section_by_name (abfd, subname) == NULL)
+ {
+ if (o == gptab_data_sec)
+ o->name = ".gptab.data";
+ else
+ o->name = ".gptab.bss";
+ subname = o->name + sizeof ".gptab" - 1;
+ BFD_ASSERT (bfd_get_section_by_name (abfd, subname) != NULL);
+ }
+
+ /* Set up the first entry. */
+ c = 1;
+ tab = (Elf32_gptab *) bfd_malloc (c * sizeof (Elf32_gptab));
+ if (tab == NULL)
+ return false;
+ tab[0].gt_header.gt_current_g_value = elf_gp_size (abfd);
+ tab[0].gt_header.gt_unused = 0;
+
+ /* Combine the input sections. */
+ for (p = o->link_order_head;
+ p != (struct bfd_link_order *) NULL;
+ p = p->next)
+ {
+ asection *input_section;
+ bfd *input_bfd;
+ bfd_size_type size;
+ unsigned long last;
+ bfd_size_type gpentry;
+
+ if (p->type != bfd_indirect_link_order)
+ {
+ if (p->type == bfd_fill_link_order)
+ continue;
+ abort ();
+ }
+
+ input_section = p->u.indirect.section;
+ input_bfd = input_section->owner;
+
+ /* Combine the gptab entries for this input section one
+ by one. We know that the input gptab entries are
+ sorted by ascending -G value. */
+ size = bfd_section_size (input_bfd, input_section);
+ last = 0;
+ for (gpentry = sizeof (Elf32_External_gptab);
+ gpentry < size;
+ gpentry += sizeof (Elf32_External_gptab))
+ {
+ Elf32_External_gptab ext_gptab;
+ Elf32_gptab int_gptab;
+ unsigned long val;
+ unsigned long add;
+ boolean exact;
+ unsigned int look;
+
+ if (! (bfd_get_section_contents
+ (input_bfd, input_section, (PTR) &ext_gptab,
+ gpentry, sizeof (Elf32_External_gptab))))
+ {
+ free (tab);
+ return false;
+ }
+
+ mips_elf64_swap_gptab_in (input_bfd, &ext_gptab,
+ &int_gptab);
+ val = int_gptab.gt_entry.gt_g_value;
+ add = int_gptab.gt_entry.gt_bytes - last;
+
+ exact = false;
+ for (look = 1; look < c; look++)
+ {
+ if (tab[look].gt_entry.gt_g_value >= val)
+ tab[look].gt_entry.gt_bytes += add;
+
+ if (tab[look].gt_entry.gt_g_value == val)
+ exact = true;
+ }
+
+ if (! exact)
+ {
+ Elf32_gptab *new_tab;
+ unsigned int max;
+
+ /* We need a new table entry. */
+ new_tab = ((Elf32_gptab *)
+ bfd_realloc ((PTR) tab,
+ (c + 1) * sizeof (Elf32_gptab)));
+ if (new_tab == NULL)
+ {
+ free (tab);
+ return false;
+ }
+ tab = new_tab;
+ tab[c].gt_entry.gt_g_value = val;
+ tab[c].gt_entry.gt_bytes = add;
+
+ /* Merge in the size for the next smallest -G
+ value, since that will be implied by this new
+ value. */
+ max = 0;
+ for (look = 1; look < c; look++)
+ {
+ if (tab[look].gt_entry.gt_g_value < val
+ && (max == 0
+ || (tab[look].gt_entry.gt_g_value
+ > tab[max].gt_entry.gt_g_value)))
+ max = look;
+ }
+ if (max != 0)
+ tab[c].gt_entry.gt_bytes +=
+ tab[max].gt_entry.gt_bytes;
+
+ ++c;
+ }
+
+ last = int_gptab.gt_entry.gt_bytes;
+ }
+
+ /* Hack: reset the SEC_HAS_CONTENTS flag so that
+ elf_link_input_bfd ignores this section. */
+ input_section->flags &=~ SEC_HAS_CONTENTS;
+ }
+
+ /* The table must be sorted by -G value. */
+ if (c > 2)
+ qsort (tab + 1, c - 1, sizeof (tab[0]), gptab_compare);
+
+ /* Swap out the table. */
+ ext_tab = ((Elf32_External_gptab *)
+ bfd_alloc (abfd, c * sizeof (Elf32_External_gptab)));
+ if (ext_tab == NULL)
+ {
+ free (tab);
+ return false;
+ }
+
+ for (i = 0; i < c; i++)
+ mips_elf64_swap_gptab_out (abfd, tab + i, ext_tab + i);
+ free (tab);
+
+ o->_raw_size = c * sizeof (Elf32_External_gptab);
+ o->contents = (bfd_byte *) ext_tab;
+
+ /* Skip this section later on (I don't think this currently
+ matters, but someday it might). */
+ o->link_order_head = (struct bfd_link_order *) NULL;
+ }
+ }
+
+ /* Invoke the regular ELF backend linker to do all the work. */
+ if (!bfd_elf64_bfd_final_link (abfd, info))
+ return false;
+
+ /* Now write out the computed sections. */
+ if (mdebug_sec != (asection *) NULL)
{
- size_t len = strlen (*map[count].name) + 1;
+ BFD_ASSERT (abfd->output_has_begun);
+ if (! bfd_ecoff_write_accumulated_debug (mdebug_handle, abfd, &debug,
+ swap, info,
+ mdebug_sec->filepos))
+ return false;
- if (bfd_write (*map[count].name, 1, len, arch) != len)
+ bfd_ecoff_debug_free (mdebug_handle, abfd, &debug, swap, info);
+ }
+ if (gptab_data_sec != (asection *) NULL)
+ {
+ if (! bfd_set_section_contents (abfd, gptab_data_sec,
+ gptab_data_sec->contents,
+ (file_ptr) 0,
+ gptab_data_sec->_raw_size))
return false;
}
- /* The spec says that this should be padded to an 8 byte boundary.
- However, the Irix 6.2 tools do not appear to do this. */
- while (padding != 0)
+ if (gptab_bss_sec != (asection *) NULL)
{
- if (bfd_write ("", 1, 1, arch) != 1)
+ if (! bfd_set_section_contents (abfd, gptab_bss_sec,
+ gptab_bss_sec->contents,
+ (file_ptr) 0,
+ gptab_bss_sec->_raw_size))
return false;
- --padding;
}
return true;
@@ -2101,10 +6977,6 @@ const struct elf_size_info mips_elf64_size_info =
mips_elf64_be_swap_reloca_out
};
-#define TARGET_LITTLE_SYM bfd_elf64_littlemips_vec
-#define TARGET_LITTLE_NAME "elf64-littlemips"
-#define TARGET_BIG_SYM bfd_elf64_bigmips_vec
-#define TARGET_BIG_NAME "elf64-bigmips"
#define ELF_ARCH bfd_arch_mips
#define ELF_MACHINE_CODE EM_MIPS
@@ -2113,53 +6985,59 @@ const struct elf_size_info mips_elf64_size_info =
#define elf_backend_collect true
#define elf_backend_type_change_ok true
#define elf_backend_can_gc_sections true
-#define elf_backend_size_info mips_elf64_size_info
+#define elf_info_to_howto mips_elf64_info_to_howto_rela
+#define elf_info_to_howto_rel mips_elf64_info_to_howto_rel
#define elf_backend_object_p _bfd_mips_elf_object_p
+#define elf_backend_symbol_processing _bfd_mips_elf_symbol_processing
+#define elf_backend_section_processing _bfd_mips_elf_section_processing
#define elf_backend_section_from_shdr _bfd_mips_elf_section_from_shdr
#define elf_backend_fake_sections _bfd_mips_elf_fake_sections
#define elf_backend_section_from_bfd_section \
_bfd_mips_elf_section_from_bfd_section
-#define elf_backend_section_processing _bfd_mips_elf_section_processing
-#define elf_backend_symbol_processing _bfd_mips_elf_symbol_processing
-#define elf_backend_additional_program_headers \
- _bfd_mips_elf_additional_program_headers
-#define elf_backend_modify_segment_map _bfd_mips_elf_modify_segment_map
-#define elf_backend_final_write_processing \
- _bfd_mips_elf_final_write_processing
-#define elf_backend_ecoff_debug_swap &mips_elf64_ecoff_debug_swap
#define elf_backend_add_symbol_hook _bfd_mips_elf_add_symbol_hook
+#define elf_backend_link_output_symbol_hook \
+ _bfd_mips_elf_link_output_symbol_hook
#define elf_backend_create_dynamic_sections \
- _bfd_mips_elf_create_dynamic_sections
-#define elf_backend_check_relocs _bfd_mips_elf_check_relocs
+ mips_elf64_create_dynamic_sections
+#define elf_backend_check_relocs mips_elf64_check_relocs
#define elf_backend_adjust_dynamic_symbol \
- _bfd_mips_elf_adjust_dynamic_symbol
+ mips_elf64_adjust_dynamic_symbol
#define elf_backend_always_size_sections \
- _bfd_mips_elf_always_size_sections
+ mips_elf64_always_size_sections
#define elf_backend_size_dynamic_sections \
- _bfd_mips_elf_size_dynamic_sections
-#define elf_backend_relocate_section _bfd_mips_elf_relocate_section
-#define elf_backend_link_output_symbol_hook \
- _bfd_mips_elf_link_output_symbol_hook
+ mips_elf64_size_dynamic_sections
+#define elf_backend_relocate_section mips_elf64_relocate_section
#define elf_backend_finish_dynamic_symbol \
- _bfd_mips_elf_finish_dynamic_symbol
+ mips_elf64_finish_dynamic_symbol
#define elf_backend_finish_dynamic_sections \
- _bfd_mips_elf_finish_dynamic_sections
-#define elf_backend_gc_mark_hook _bfd_mips_elf_gc_mark_hook
-#define elf_backend_gc_sweep_hook _bfd_mips_elf_gc_sweep_hook
-#define elf_backend_got_header_size (4*MIPS_RESERVED_GOTNO)
+ mips_elf64_finish_dynamic_sections
+#define elf_backend_final_write_processing \
+ _bfd_mips_elf_final_write_processing
+#define elf_backend_additional_program_headers \
+ mips_elf64_additional_program_headers
+#define elf_backend_modify_segment_map _bfd_mips_elf_modify_segment_map
+#define elf_backend_gc_mark_hook mips_elf64_gc_mark_hook
+#define elf_backend_gc_sweep_hook mips_elf64_gc_sweep_hook
+#define elf_backend_ecoff_debug_swap &mips_elf64_ecoff_debug_swap
+#define elf_backend_size_info mips_elf64_size_info
+
+#define elf_backend_got_header_size (4 * MIPS_RESERVED_GOTNO)
#define elf_backend_plt_header_size 0
-#define elf_backend_may_use_rel_p 1
-/* We don't set bfd_elf64_bfd_is_local_label_name because the 32-bit
+/* MIPS ELF64 can use a mixture of REL and RELA, but some Relocations
+ * work better/work only in RELA, so we default to this. */
+#define elf_backend_may_use_rel_p 1
+#define elf_backend_may_use_rela_p 1
+#define elf_backend_default_use_rela_p 1
+
+/* We don't set bfd_elf64_bfd_is_local_label_name because the 32-bit
MIPS-specific function only applies to IRIX5, which had no 64-bit
ABI. */
#define bfd_elf64_find_nearest_line _bfd_mips_elf_find_nearest_line
#define bfd_elf64_set_section_contents _bfd_mips_elf_set_section_contents
#define bfd_elf64_bfd_link_hash_table_create \
- _bfd_mips_elf_link_hash_table_create
-#define bfd_elf64_bfd_final_link _bfd_mips_elf_final_link
-#define bfd_elf64_bfd_copy_private_bfd_data \
- _bfd_mips_elf_copy_private_bfd_data
+ mips_elf64_link_hash_table_create
+#define bfd_elf64_bfd_final_link mips_elf64_final_link
#define bfd_elf64_bfd_merge_private_bfd_data \
_bfd_mips_elf_merge_private_bfd_data
#define bfd_elf64_bfd_set_private_flags _bfd_mips_elf_set_private_flags
@@ -2169,14 +7047,16 @@ const struct elf_size_info mips_elf64_size_info =
#define bfd_elf64_get_reloc_upper_bound mips_elf64_get_reloc_upper_bound
#define bfd_elf64_bfd_reloc_type_lookup mips_elf64_reloc_type_lookup
#define bfd_elf64_archive_functions
-#define bfd_elf64_archive_slurp_armap mips_elf64_slurp_armap
+extern boolean bfd_elf64_archive_slurp_armap
+ PARAMS((bfd *));
+extern boolean bfd_elf64_archive_write_armap
+ PARAMS((bfd *, unsigned int, struct orl *, unsigned int, int));
#define bfd_elf64_archive_slurp_extended_name_table \
_bfd_archive_coff_slurp_extended_name_table
#define bfd_elf64_archive_construct_extended_name_table \
_bfd_archive_coff_construct_extended_name_table
#define bfd_elf64_archive_truncate_arname \
_bfd_archive_coff_truncate_arname
-#define bfd_elf64_archive_write_armap mips_elf64_write_armap
#define bfd_elf64_archive_read_ar_hdr _bfd_archive_coff_read_ar_hdr
#define bfd_elf64_archive_openr_next_archived_file \
_bfd_archive_coff_openr_next_archived_file
@@ -2187,4 +7067,26 @@ const struct elf_size_info mips_elf64_size_info =
#define bfd_elf64_archive_update_armap_timestamp \
_bfd_archive_coff_update_armap_timestamp
+/* The SGI style (n)64 NewABI. */
+#define TARGET_LITTLE_SYM bfd_elf64_littlemips_vec
+#define TARGET_LITTLE_NAME "elf64-littlemips"
+#define TARGET_BIG_SYM bfd_elf64_bigmips_vec
+#define TARGET_BIG_NAME "elf64-bigmips"
+
+#include "elf64-target.h"
+
+#define INCLUDED_TARGET_FILE /* More a type of flag. */
+
+/* The SYSV-style 'traditional' (n)64 NewABI. */
+#undef TARGET_LITTLE_SYM
+#undef TARGET_LITTLE_NAME
+#undef TARGET_BIG_SYM
+#undef TARGET_BIG_NAME
+
+#define TARGET_LITTLE_SYM bfd_elf64_tradlittlemips_vec
+#define TARGET_LITTLE_NAME "elf64-tradlittlemips"
+#define TARGET_BIG_SYM bfd_elf64_tradbigmips_vec
+#define TARGET_BIG_NAME "elf64-tradbigmips"
+
+/* Include the target file again for this target. */
#include "elf64-target.h"
diff --git a/contrib/binutils/bfd/elf64-ppc.c b/contrib/binutils/bfd/elf64-ppc.c
index 2e5933a..6adc202 100644
--- a/contrib/binutils/bfd/elf64-ppc.c
+++ b/contrib/binutils/bfd/elf64-ppc.c
@@ -2501,10 +2501,12 @@ func_desc_adjust (h, inf)
struct bfd_link_info *info;
struct ppc_link_hash_table *htab;
- if (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
+ if (h->root.type == bfd_link_hash_indirect)
return true;
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
info = (struct bfd_link_info *) inf;
htab = ppc_hash_table (info);
@@ -2875,10 +2877,12 @@ allocate_dynrelocs (h, inf)
struct ppc_link_hash_entry *eh;
struct ppc_dyn_relocs *p;
- if (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
+ if (h->root.type == bfd_link_hash_indirect)
return true;
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
info = (struct bfd_link_info *) inf;
htab = ppc_hash_table (info);
@@ -3034,6 +3038,9 @@ readonly_dynrelocs (h, inf)
struct ppc_link_hash_entry *eh;
struct ppc_dyn_relocs *p;
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
eh = (struct ppc_link_hash_entry *) h;
for (p = eh->dyn_relocs; p != NULL; p = p->next)
{
diff --git a/contrib/binutils/bfd/elf64-sparc.c b/contrib/binutils/bfd/elf64-sparc.c
index 0f81fa2..78d2a56 100644
--- a/contrib/binutils/bfd/elf64-sparc.c
+++ b/contrib/binutils/bfd/elf64-sparc.c
@@ -1881,6 +1881,17 @@ sparc64_elf_relax_section (abfd, section, link_info, again)
return true;
}
+/* This is the condition under which 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 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))
+
/* Relocate a SPARC64 ELF section. */
static boolean
@@ -1928,9 +1939,10 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
struct elf_link_hash_entry *h;
Elf_Internal_Sym *sym;
asection *sec;
- bfd_vma relocation;
+ bfd_vma relocation, off;
bfd_reloc_status_type r;
boolean is_plt = false;
+ boolean unresolved_reloc;
r_type = ELF64_R_TYPE_ID (rel->r_info);
if (r_type < 0 || r_type >= (int) R_SPARC_max_std)
@@ -1965,6 +1977,7 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
h = NULL;
sym = NULL;
sec = NULL;
+ unresolved_reloc = false;
if (r_symndx < symtab_hdr->sh_info)
{
sym = local_syms + r_symndx;
@@ -1977,116 +1990,30 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
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;
+
+ relocation = 0;
if (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
{
- boolean skip_it = false;
sec = h->root.u.def.section;
-
- switch (r_type)
- {
- case R_SPARC_WPLT30:
- case R_SPARC_PLT32:
- case R_SPARC_HIPLT22:
- case R_SPARC_LOPLT10:
- case R_SPARC_PCPLT32:
- case R_SPARC_PCPLT22:
- case R_SPARC_PCPLT10:
- case R_SPARC_PLT64:
- if (h->plt.offset != (bfd_vma) -1)
- skip_it = true;
- break;
-
- case R_SPARC_GOT10:
- case R_SPARC_GOT13:
- case R_SPARC_GOT22:
- 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)))
- skip_it = true;
- break;
-
- case R_SPARC_PC10:
- case R_SPARC_PC22:
- case R_SPARC_PC_HH22:
- case R_SPARC_PC_HM10:
- case R_SPARC_PC_LM22:
- if (!strcmp(h->root.root.string, "_GLOBAL_OFFSET_TABLE_"))
- break;
- /* FALLTHRU */
-
- case R_SPARC_8:
- case R_SPARC_16:
- case R_SPARC_32:
- case R_SPARC_DISP8:
- case R_SPARC_DISP16:
- case R_SPARC_DISP32:
- case R_SPARC_WDISP30:
- case R_SPARC_WDISP22:
- case R_SPARC_HI22:
- case R_SPARC_22:
- case R_SPARC_13:
- case R_SPARC_LO10:
- case R_SPARC_UA32:
- case R_SPARC_10:
- case R_SPARC_11:
- case R_SPARC_64:
- case R_SPARC_OLO10:
- case R_SPARC_HH22:
- case R_SPARC_HM10:
- case R_SPARC_LM22:
- case R_SPARC_WDISP19:
- case R_SPARC_WDISP16:
- case R_SPARC_7:
- case R_SPARC_5:
- case R_SPARC_6:
- case R_SPARC_DISP64:
- case R_SPARC_HIX22:
- case R_SPARC_LOX10:
- case R_SPARC_H44:
- case R_SPARC_M44:
- case R_SPARC_L44:
- case R_SPARC_UA64:
- case R_SPARC_UA16:
- if (info->shared
- && ((!info->symbolic && h->dynindx != -1)
- || !(h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR))
- && ((input_section->flags & SEC_ALLOC) != 0
- /* DWARF will emit R_SPARC_{32,64} 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)))
- skip_it = true;
- break;
- }
-
- if (skip_it)
- {
- /* 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;
- }
+ if (sec->output_section == NULL)
+ /* 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;
else
- {
- relocation = (h->root.u.def.value
- + sec->output_section->vma
- + sec->output_offset);
- }
+ relocation = (h->root.u.def.value
+ + sec->output_section->vma
+ + sec->output_offset);
}
else if (h->root.type == bfd_link_hash_undefweak)
- relocation = 0;
+ ;
else if (info->shared
&& (!info->symbolic || info->allow_shlib_undefined)
&& !info->no_undefined
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
- relocation = 0;
+ ;
else
{
if (! ((*info->callbacks->undefined_symbol)
@@ -2107,7 +2034,7 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
}
}
-do_dynreloc:
+ do_dynreloc:
/* When generating a shared object, these relocations are copied
into the output file to be resolved at run time. */
if (info->shared && r_symndx != 0 && (input_section->flags & SEC_ALLOC))
@@ -2126,11 +2053,11 @@ do_dynreloc:
case R_SPARC_DISP8:
case R_SPARC_DISP16:
case R_SPARC_DISP32:
+ case R_SPARC_DISP64:
case R_SPARC_WDISP30:
case R_SPARC_WDISP22:
case R_SPARC_WDISP19:
case R_SPARC_WDISP16:
- case R_SPARC_DISP64:
if (h == NULL)
break;
/* Fall through. */
@@ -2219,6 +2146,18 @@ do_dynreloc:
case R_SPARC_UA64:
if (!(outrel.r_offset & 7)) r_type = R_SPARC_64;
break;
+ case R_SPARC_DISP8:
+ case R_SPARC_DISP16:
+ case R_SPARC_DISP32:
+ case R_SPARC_DISP64:
+ /* If the symbol is not dynamic, we should not keep
+ a dynamic relocation. But an .rela.* slot has been
+ allocated for it, output R_SPARC_NONE.
+ FIXME: Add code tracking needed dynamic relocs as
+ e.g. i386 has. */
+ if (h->dynindx == -1)
+ skip = true, relocate = true;
+ break;
}
if (skip)
@@ -2326,14 +2265,18 @@ do_dynreloc:
if (h != NULL)
{
- bfd_vma off = h->got.offset;
+ boolean dyn;
+
+ off = h->got.offset;
BFD_ASSERT (off != (bfd_vma) -1);
+ dyn = elf_hash_table (info)->dynamic_sections_created;
- if (! elf_hash_table (info)->dynamic_sections_created
+ if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h)
|| (info->shared
- && (info->symbolic || h->dynindx == -1)
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR)))
+ && (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
link and the symbol is defined locally, or the symbol
@@ -2356,12 +2299,11 @@ do_dynreloc:
h->got.offset |= 1;
}
}
- relocation = sgot->output_offset + off - got_base;
+ else
+ unresolved_reloc = false;
}
else
{
- bfd_vma off;
-
BFD_ASSERT (local_got_offsets != NULL);
off = local_got_offsets[r_symndx];
BFD_ASSERT (off != (bfd_vma) -1);
@@ -2407,8 +2349,8 @@ do_dynreloc:
else
bfd_put_64 (output_bfd, relocation, sgot->contents + off);
}
- relocation = sgot->output_offset + off - got_base;
}
+ relocation = sgot->output_offset + off - got_base;
goto do_default;
case R_SPARC_WPLT30:
@@ -2440,6 +2382,7 @@ do_dynreloc:
relocation = (splt->output_section->vma
+ splt->output_offset
+ sparc64_elf_plt_entry_offset (h->plt.offset));
+ unresolved_reloc = false;
if (r_type == R_SPARC_WPLT30)
goto do_wplt30;
if (r_type == R_SPARC_PLT32 || r_type == R_SPARC_PLT64)
@@ -2623,6 +2566,17 @@ do_dynreloc:
break;
}
+ 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);
+
switch (r)
{
case bfd_reloc_ok:
diff --git a/contrib/binutils/bfd/elf64-x86-64.c b/contrib/binutils/bfd/elf64-x86-64.c
index 87e5dbb..61d2c6e 100644
--- a/contrib/binutils/bfd/elf64-x86-64.c
+++ b/contrib/binutils/bfd/elf64-x86-64.c
@@ -1118,6 +1118,9 @@ elf64_x86_64_discard_copies (h, inf)
struct elf64_x86_64_pcrel_relocs_copied *s;
struct bfd_link_info *info = (struct bfd_link_info *) inf;
+ if (h->root.root.type == bfd_link_hash_warning)
+ h = (struct elf64_x86_64_link_hash_entry *) h->root.root.u.i.link;
+
/* 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. */
diff --git a/contrib/binutils/bfd/elflink.c b/contrib/binutils/bfd/elflink.c
index 2032efa..e74fae9 100644
--- a/contrib/binutils/bfd/elflink.c
+++ b/contrib/binutils/bfd/elflink.c
@@ -1,5 +1,5 @@
/* ELF linking support for BFD.
- 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.
@@ -330,6 +330,9 @@ elf_link_renumber_hash_table_dynsyms (h, data)
{
size_t *count = (size_t *) data;
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
if (h->dynindx != -1)
h->dynindx = ++(*count);
diff --git a/contrib/binutils/bfd/elflink.h b/contrib/binutils/bfd/elflink.h
index 76dbb19..d43d861 100644
--- a/contrib/binutils/bfd/elflink.h
+++ b/contrib/binutils/bfd/elflink.h
@@ -57,8 +57,6 @@ static boolean elf_adjust_dynamic_symbol
PARAMS ((struct elf_link_hash_entry *, PTR));
static boolean elf_link_find_version_dependencies
PARAMS ((struct elf_link_hash_entry *, PTR));
-static boolean elf_link_find_version_dependencies
- PARAMS ((struct elf_link_hash_entry *, PTR));
static boolean elf_link_assign_sym_version
PARAMS ((struct elf_link_hash_entry *, PTR));
static boolean elf_collect_hash_codes
@@ -592,7 +590,7 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash,
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:
@@ -702,10 +700,10 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash,
&& 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,
@@ -755,10 +753,10 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash,
*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;
@@ -817,7 +815,7 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash,
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;
@@ -829,11 +827,11 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash,
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;
}
@@ -856,7 +854,7 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash,
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;
@@ -890,8 +888,8 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash,
&& 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)
@@ -900,9 +898,9 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash,
| 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;
}
@@ -1047,7 +1045,7 @@ elf_add_default_symbol (abfd, info, h, name, sym, sec, value,
}
/* Now set HI to H, so that the following code will set the
- other fields correctly. */
+ other fields correctly. */
hi = h;
}
@@ -1133,7 +1131,7 @@ elf_add_default_symbol (abfd, info, h, name, sym, sec, value,
& (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. */
@@ -1259,8 +1257,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;
}
@@ -1284,7 +1282,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;
}
}
@@ -1315,7 +1313,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;
@@ -1373,10 +1371,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
@@ -1411,7 +1409,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;
}
@@ -1531,7 +1529,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;
@@ -1623,7 +1621,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;
@@ -1764,10 +1762,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)))
{
@@ -1866,10 +1864,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;
@@ -1950,10 +1948,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;
@@ -1983,8 +1981,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;
@@ -2071,7 +2069,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;
@@ -2167,10 +2165,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)
{
@@ -2795,10 +2793,6 @@ NAME(bfd_elf,record_link_assignment) (output_bfd, info, name, provide)
h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
- /* When possible, keep the original type of the symbol. */
- if (h->type == STT_NOTYPE)
- h->type = STT_OBJECT;
-
if (((h->elf_link_hash_flags & (ELF_LINK_HASH_DEF_DYNAMIC
| ELF_LINK_HASH_REF_DYNAMIC)) != 0
|| info->shared)
@@ -3140,11 +3134,11 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
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;
}
@@ -3200,6 +3194,53 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
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;
+ }
+
+ bfd_set_error (bfd_error_nonrepresentable_section);
+ 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
@@ -3239,7 +3280,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
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. */
@@ -3633,10 +3674,10 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
/* 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;
@@ -3644,6 +3685,9 @@ elf_adjust_dynstr_offsets (h, data)
{
struct elf_strtab_hash *dynstr = (struct elf_strtab_hash *) data;
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
if (h->dynindx != -1)
h->dynstr_index = _bfd_elf_strtab_offset (dynstr, h->dynstr_index);
return true;
@@ -3716,7 +3760,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
@@ -3746,7 +3790,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
@@ -3824,11 +3868,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
@@ -3923,6 +3967,17 @@ elf_adjust_dynamic_symbol (h, data)
bfd *dynobj;
struct elf_backend_data *bed;
+ if (h->root.type == bfd_link_hash_warning)
+ {
+ h->plt.offset = (bfd_vma) -1;
+ h->got.offset = (bfd_vma) -1;
+
+ /* When warning symbols are created, they **replace** the "real"
+ entry in the hash table, thus we never get to see the real
+ symbol in a hash traversal. So look at it now. */
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ }
+
/* Ignore indirect symbols. These are added by the versioning code. */
if (h->root.type == bfd_link_hash_indirect)
return true;
@@ -4039,6 +4094,9 @@ elf_export_symbol (h, data)
if (h->root.type == bfd_link_hash_indirect)
return true;
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
if (h->dynindx == -1
&& (h->elf_link_hash_flags
& (ELF_LINK_HASH_DEF_REGULAR | ELF_LINK_HASH_REF_REGULAR)) != 0)
@@ -4068,14 +4126,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;
@@ -4096,6 +4154,9 @@ elf_link_find_version_dependencies (h, data)
Elf_Internal_Vernaux *a;
bfd_size_type amt;
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
/* We only care about symbols defined in shared objects with version
information. */
if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
@@ -4176,6 +4237,9 @@ elf_link_assign_sym_version (h, data)
sinfo = (struct elf_assign_sym_version_info *) data;
info = sinfo->info;
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
/* Fix the symbol flags. */
eif.failed = false;
eif.info = info;
@@ -4201,7 +4265,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)
{
@@ -4229,11 +4293,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;
@@ -4247,7 +4311,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)
@@ -4272,14 +4336,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;
@@ -4315,7 +4379,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);
@@ -4337,8 +4401,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)
{
@@ -4858,8 +4922,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;
@@ -4929,7 +4993,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;
@@ -4937,8 +5001,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);
@@ -5040,10 +5104,20 @@ elf_bfd_final_link (abfd, info)
= elf_section_data (output_section);
unsigned int *rel_count;
unsigned int *rel_count2;
+ bfd_size_type entsize;
+ bfd_size_type entsize2;
- /* We must be careful to add the relocation froms the
+ /* We must be careful to add the relocations from the
input section to the right output count. */
- if (esdi->rel_hdr.sh_entsize == esdo->rel_hdr.sh_entsize)
+ entsize = esdi->rel_hdr.sh_entsize;
+ entsize2 = esdi->rel_hdr2 ? esdi->rel_hdr2->sh_entsize : 0;
+ BFD_ASSERT ((entsize == sizeof (Elf_External_Rel)
+ || entsize == sizeof (Elf_External_Rela))
+ && entsize2 != entsize
+ && (entsize2 == 0
+ || entsize2 == sizeof (Elf_External_Rel)
+ || entsize2 == sizeof (Elf_External_Rela)));
+ if (entsize == esdo->rel_hdr.sh_entsize)
{
rel_count = &esdo->rel_count;
rel_count2 = &esdo->rel_count2;
@@ -5273,9 +5347,19 @@ elf_bfd_final_link (abfd, info)
{
for (p = o->link_order_head; p != NULL; p = p->next)
{
+ Elf_Internal_Shdr *rhdr;
+
if (p->type == bfd_indirect_link_order
&& (bfd_get_flavour (p->u.indirect.section->owner)
- == bfd_target_elf_flavour))
+ == bfd_target_elf_flavour)
+ && (((rhdr = &elf_section_data (p->u.indirect.section)->rel_hdr)
+ ->sh_entsize == 0)
+ || rhdr->sh_entsize == sizeof (Elf_External_Rel)
+ || rhdr->sh_entsize == sizeof (Elf_External_Rela))
+ && (((rhdr = elf_section_data (p->u.indirect.section)->rel_hdr2)
+ == NULL)
+ || rhdr->sh_entsize == sizeof (Elf_External_Rel)
+ || rhdr->sh_entsize == sizeof (Elf_External_Rela)))
{
sub = p->u.indirect.section->owner;
if (! sub->output_has_begun)
@@ -5299,28 +5383,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);
@@ -5372,8 +5453,8 @@ 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_UNDEF
&& (e->isym.st_shndx < SHN_LORESERVE
@@ -5550,6 +5631,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;
@@ -5622,7 +5731,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
@@ -5638,7 +5747,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,
@@ -5694,7 +5803,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;
@@ -5745,7 +5854,7 @@ elf_link_output_sym (finfo, name, elfsym, input_sec)
{
Elf_External_Sym *dest;
Elf_External_Sym_Shndx *destshndx;
-
+
boolean (*output_symbol_hook) PARAMS ((bfd *,
struct bfd_link_info *info,
const char *,
@@ -5841,6 +5950,9 @@ elf_link_sec_merge_syms (h, data)
{
asection *sec;
+ if (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)->flags & SEC_MERGE)
@@ -5876,6 +5988,13 @@ elf_link_output_extsym (h, data)
Elf_Internal_Sym sym;
asection *input_sec;
+ if (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_new)
+ return true;
+ }
+
/* Decide whether to output this symbol in this pass. */
if (eoinfo->localsyms)
{
@@ -5953,14 +6072,11 @@ elf_link_output_extsym (h, data)
{
default:
case bfd_link_hash_new:
+ case bfd_link_hash_warning:
abort ();
return false;
case bfd_link_hash_undefined:
- input_sec = bfd_und_section_ptr;
- sym.st_shndx = SHN_UNDEF;
- break;
-
case bfd_link_hash_undefweak:
input_sec = bfd_und_section_ptr;
sym.st_shndx = SHN_UNDEF;
@@ -6011,29 +6127,22 @@ 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. */
- if (h->root.u.i.link->type == bfd_link_hash_new)
- return true;
- return (elf_link_output_extsym
- ((struct elf_link_hash_entry *) h->root.u.i.link, 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;
@@ -6287,8 +6396,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))
@@ -6404,10 +6513,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)
@@ -6482,9 +6591,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
@@ -6794,23 +6903,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);
+ }
}
}
@@ -6910,7 +7019,7 @@ elf_reloc_link_order (output_bfd, info, output_section, link_order)
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,
@@ -6925,8 +7034,8 @@ elf_reloc_link_order (output_bfd, info, output_section, link_order)
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)
@@ -7399,7 +7508,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;
@@ -7461,11 +7570,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)
@@ -7483,11 +7592,15 @@ elf_gc_mark (info, sec, gc_mark_hook)
}
if (rsec && !rsec->gc_mark)
- if (!elf_gc_mark (info, rsec, gc_mark_hook))
- {
- ret = false;
- goto out2;
- }
+ {
+ if (bfd_get_flavour (rsec->owner) != bfd_target_elf_flavour)
+ rsec->gc_mark = 1;
+ else if (!elf_gc_mark (info, rsec, gc_mark_hook))
+ {
+ ret = false;
+ goto out2;
+ }
+ }
}
out2:
@@ -7586,6 +7699,9 @@ elf_gc_sweep_symbol (h, idxptr)
{
int *idx = (int *) idxptr;
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
if (h->dynindx != -1
&& ((h->root.type != bfd_link_hash_defined
&& h->root.type != bfd_link_hash_defweak)
@@ -7603,6 +7719,9 @@ elf_gc_propagate_vtable_entries_used (h, okp)
struct elf_link_hash_entry *h;
PTR okp;
{
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
/* Those that are not vtables. */
if (h->vtable_parent == NULL)
return true;
@@ -7636,9 +7755,9 @@ elf_gc_propagate_vtable_entries_used (h, okp)
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--)
@@ -7665,6 +7784,9 @@ elf_gc_smash_unused_vtentry_relocs (h, okp)
struct elf_backend_data *bed;
int file_align;
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
/* Take care of both those symbols that do not describe vtables as
well as those that are not loaded. */
if (h->vtable_parent == NULL)
@@ -7715,7 +7837,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
@@ -7749,7 +7871,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;
}
}
@@ -7952,6 +8074,9 @@ elf_gc_allocate_got_offsets (h, offarg)
{
bfd_vma *off = (bfd_vma *) offarg;
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
if (h->got.refcount > 0)
{
h->got.offset = off[0];
@@ -7992,6 +8117,9 @@ elf_collect_hash_codes (h, data)
unsigned long ha;
char *alc = NULL;
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
/* Ignore indirect symbols. These are added by the versioning code. */
if (h->dynindx == -1)
return true;
@@ -8144,7 +8272,8 @@ elf_bfd_discard_info (output_bfd, info)
}
stab = strip ? NULL : bfd_get_section_by_name (abfd, ".stab");
- if ((! stab || elf_section_data(stab)->sec_info_type != ELF_INFO_TYPE_STABS)
+ if ((! stab
+ || elf_section_data(stab)->sec_info_type != ELF_INFO_TYPE_STABS)
&& ! eh
&& (strip || ! bed->elf_backend_discard_info))
continue;
@@ -8169,24 +8298,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)
@@ -8232,8 +8361,7 @@ elf_bfd_discard_info (output_bfd, info)
cookie.relend = NULL;
if (eh->reloc_count)
cookie.rels = (NAME(_bfd_elf,link_read_relocs)
- (abfd, eh, (PTR) NULL,
- (Elf_Internal_Rela *) NULL,
+ (abfd, eh, (PTR) NULL, (Elf_Internal_Rela *) NULL,
info->keep_memory));
if (cookie.rels)
{
@@ -8262,9 +8390,7 @@ elf_bfd_discard_info (output_bfd, info)
free (freesyms);
}
- if (ehdr
- && _bfd_elf_discard_section_eh_frame_hdr (output_bfd,
- info, ehdr))
+ if (ehdr && _bfd_elf_discard_section_eh_frame_hdr (output_bfd, info, ehdr))
ret = true;
return ret;
}
@@ -8273,6 +8399,8 @@ static boolean
elf_section_ignore_discarded_relocs (sec)
asection *sec;
{
+ struct elf_backend_data *bed;
+
switch (elf_section_data (sec)->sec_info_type)
{
case ELF_INFO_TYPE_STABS:
@@ -8281,10 +8409,10 @@ elf_section_ignore_discarded_relocs (sec)
default:
break;
}
- if ((get_elf_backend_data (sec->owner)->elf_backend_ignore_discarded_relocs
- != NULL)
- && (*get_elf_backend_data (sec->owner)
- ->elf_backend_ignore_discarded_relocs) (sec))
+
+ bed = get_elf_backend_data (sec->owner);
+ if (bed->elf_backend_ignore_discarded_relocs != NULL
+ && (*bed->elf_backend_ignore_discarded_relocs) (sec))
return true;
return false;
diff --git a/contrib/binutils/bfd/elfxx-ia64.c b/contrib/binutils/bfd/elfxx-ia64.c
index e458477..aadb963 100644
--- a/contrib/binutils/bfd/elfxx-ia64.c
+++ b/contrib/binutils/bfd/elfxx-ia64.c
@@ -1016,9 +1016,6 @@ elfNN_ia64_section_from_shdr (abfd, hdr, name)
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)
@@ -1719,6 +1710,9 @@ elfNN_ia64_global_dyn_sym_thunk (xentry, xdata)
= (struct elfNN_ia64_dyn_sym_traverse_data *) xdata;
struct elfNN_ia64_dyn_sym_info *dyn_i;
+ if (entry->root.root.type == bfd_link_hash_warning)
+ entry = (struct elfNN_ia64_link_hash_entry *) entry->root.root.u.i.link;
+
for (dyn_i = entry->info; dyn_i; dyn_i = dyn_i->next)
if (! (*data->func) (dyn_i, data->data))
return false;
diff --git a/contrib/binutils/bfd/elfxx-target.h b/contrib/binutils/bfd/elfxx-target.h
index fda0f0d..25ddd0e 100644
--- a/contrib/binutils/bfd/elfxx-target.h
+++ b/contrib/binutils/bfd/elfxx-target.h
@@ -1,5 +1,5 @@
/* Target definitions for NN-bit ELF
- 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.
This file is part of BFD, the Binary File Descriptor library.
@@ -523,9 +523,9 @@ const bfd_target TARGET_BIG_SYM =
/* ar_max_namelen: maximum number of characters in an archive header
FIXME: this really has nothing to do with ELF, this is a characteristic
- of the archiver and should be independently tunable. This value is
- a WAG (wild a** guess) */
- 14,
+ of the archiver and should be independently tunable. The System V ABI,
+ Chapter 7 (Formats & Protocols), Archive section sets this as 15. */
+ 15,
/* Routines to byte-swap various sized integers from the data sections */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
@@ -619,9 +619,9 @@ const bfd_target TARGET_LITTLE_SYM =
/* ar_max_namelen: maximum number of characters in an archive header
FIXME: this really has nothing to do with ELF, this is a characteristic
- of the archiver and should be independently tunable. This value is
- a WAG (wild a** guess) */
- 14,
+ of the archiver and should be independently tunable. The System V ABI,
+ Chapter 7 (Formats & Protocols), Archive section sets this as 15. */
+ 15,
/* Routines to byte-swap various sized integers from the data sections */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
diff --git a/contrib/binutils/bfd/i386linux.c b/contrib/binutils/bfd/i386linux.c
index bb93650..755b456 100644
--- a/contrib/binutils/bfd/i386linux.c
+++ b/contrib/binutils/bfd/i386linux.c
@@ -1,5 +1,5 @@
/* BFD back-end for linux flavored i386 a.out binaries.
- Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2001
+ Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2001, 2002
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -438,6 +438,9 @@ linux_tally_symbols (h, data)
struct linux_link_hash_entry *h1, *h2;
boolean exists;
+ if (h->root.root.type == bfd_link_hash_warning)
+ h = (struct linux_link_hash_entry *) h->root.root.u.i.link;
+
if (h->root.root.type == bfd_link_hash_undefined
&& strncmp (h->root.root.root.string, NEEDS_SHRLIB,
sizeof NEEDS_SHRLIB - 1) == 0)
diff --git a/contrib/binutils/bfd/ihex.c b/contrib/binutils/bfd/ihex.c
index 0b02e6d..613eaf3 100644
--- a/contrib/binutils/bfd/ihex.c
+++ b/contrib/binutils/bfd/ihex.c
@@ -873,6 +873,11 @@ ihex_write_object_contents (abfd)
}
rec_addr = where - (extbase + segbase);
+
+ /* Output records shouldn't cross 64K boundaries. */
+ if (rec_addr + now > 0xfffff)
+ now = 0xffff - rec_addr;
+
if (! ihex_write_record (abfd, now, rec_addr, 0, p))
return false;
diff --git a/contrib/binutils/bfd/libbfd.c b/contrib/binutils/bfd/libbfd.c
index 8560d2f..a397d82 100644
--- a/contrib/binutils/bfd/libbfd.c
+++ b/contrib/binutils/bfd/libbfd.c
@@ -593,7 +593,7 @@ INTERNAL_FUNCTION
bfd_write_bigendian_4byte_int
SYNOPSIS
- void bfd_write_bigendian_4byte_int (bfd *, unsigned int);
+ boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int);
DESCRIPTION
Write a 4 byte integer @var{i} to the output BFD @var{abfd}, in big
@@ -601,15 +601,14 @@ DESCRIPTION
archives.
*/
-void
+boolean
bfd_write_bigendian_4byte_int (abfd, i)
bfd *abfd;
unsigned int i;
{
bfd_byte buffer[4];
bfd_putb32 ((bfd_vma) i, buffer);
- if (bfd_bwrite ((PTR) buffer, (bfd_size_type) 4, abfd) != 4)
- abort ();
+ return bfd_bwrite ((PTR) buffer, (bfd_size_type) 4, abfd) == 4;
}
bfd_vma
diff --git a/contrib/binutils/bfd/libbfd.h b/contrib/binutils/bfd/libbfd.h
index d864b22..e7ba1c5 100644
--- a/contrib/binutils/bfd/libbfd.h
+++ b/contrib/binutils/bfd/libbfd.h
@@ -586,7 +586,7 @@ extern boolean _bfd_sh_align_load_span
/* And more follows */
-void
+boolean
bfd_write_bigendian_4byte_int PARAMS ((bfd *, unsigned int));
unsigned int
diff --git a/contrib/binutils/bfd/libpei.h b/contrib/binutils/bfd/libpei.h
index 5b9cc04..6b232b4 100644
--- a/contrib/binutils/bfd/libpei.h
+++ b/contrib/binutils/bfd/libpei.h
@@ -58,153 +58,167 @@ PE/PEI rearrangement (and code added): Donn Terry
#ifndef GET_FCN_LNNOPTR
#define GET_FCN_LNNOPTR(abfd, ext) \
- bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
+ H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
#endif
#ifndef GET_FCN_ENDNDX
-#define GET_FCN_ENDNDX(abfd, ext) \
- bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx)
+#define GET_FCN_ENDNDX(abfd, ext) \
+ H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_endndx)
#endif
#ifndef PUT_FCN_LNNOPTR
-#define PUT_FCN_LNNOPTR(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
+#define PUT_FCN_LNNOPTR(abfd, in, ext) \
+ H_PUT_32(abfd, in, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
#endif
#ifndef PUT_FCN_ENDNDX
-#define PUT_FCN_ENDNDX(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx)
+#define PUT_FCN_ENDNDX(abfd, in, ext) \
+ H_PUT_32(abfd, in, ext->x_sym.x_fcnary.x_fcn.x_endndx)
#endif
#ifndef GET_LNSZ_LNNO
-#define GET_LNSZ_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_lnno)
+#define GET_LNSZ_LNNO(abfd, ext) \
+ H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_lnno)
#endif
#ifndef GET_LNSZ_SIZE
-#define GET_LNSZ_SIZE(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_size)
+#define GET_LNSZ_SIZE(abfd, ext) \
+ H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_size)
#endif
#ifndef PUT_LNSZ_LNNO
-#define PUT_LNSZ_LNNO(abfd, in, ext) bfd_h_put_16(abfd, in, (bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_lnno)
+#define PUT_LNSZ_LNNO(abfd, in, ext) \
+ H_PUT_16(abfd, in, ext->x_sym.x_misc.x_lnsz.x_lnno)
#endif
#ifndef PUT_LNSZ_SIZE
-#define PUT_LNSZ_SIZE(abfd, in, ext) bfd_h_put_16(abfd, in, (bfd_byte*) ext->x_sym.x_misc.x_lnsz.x_size)
+#define PUT_LNSZ_SIZE(abfd, in, ext) \
+ H_PUT_16(abfd, in, ext->x_sym.x_misc.x_lnsz.x_size)
#endif
#ifndef GET_SCN_SCNLEN
-#define GET_SCN_SCNLEN(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_scn.x_scnlen)
+#define GET_SCN_SCNLEN(abfd, ext) \
+ H_GET_32 (abfd, ext->x_scn.x_scnlen)
#endif
#ifndef GET_SCN_NRELOC
-#define GET_SCN_NRELOC(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *)ext->x_scn.x_nreloc)
+#define GET_SCN_NRELOC(abfd, ext) \
+ H_GET_16 (abfd, ext->x_scn.x_nreloc)
#endif
#ifndef GET_SCN_NLINNO
-#define GET_SCN_NLINNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *)ext->x_scn.x_nlinno)
+#define GET_SCN_NLINNO(abfd, ext) \
+ H_GET_16 (abfd, ext->x_scn.x_nlinno)
#endif
#ifndef PUT_SCN_SCNLEN
-#define PUT_SCN_SCNLEN(abfd,in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_scn.x_scnlen)
+#define PUT_SCN_SCNLEN(abfd, in, ext) \
+ H_PUT_32(abfd, in, ext->x_scn.x_scnlen)
#endif
#ifndef PUT_SCN_NRELOC
-#define PUT_SCN_NRELOC(abfd,in, ext) bfd_h_put_16(abfd, in, (bfd_byte *)ext->x_scn.x_nreloc)
+#define PUT_SCN_NRELOC(abfd, in, ext) \
+ H_PUT_16(abfd, in, ext->x_scn.x_nreloc)
#endif
#ifndef PUT_SCN_NLINNO
-#define PUT_SCN_NLINNO(abfd,in, ext) bfd_h_put_16(abfd,in, (bfd_byte *) ext->x_scn.x_nlinno)
+#define PUT_SCN_NLINNO(abfd, in, ext) \
+ H_PUT_16(abfd,in, ext->x_scn.x_nlinno)
#endif
#ifndef GET_LINENO_LNNO
-#define GET_LINENO_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) (ext->l_lnno));
+#define GET_LINENO_LNNO(abfd, ext) \
+ H_GET_16 (abfd, ext->l_lnno);
#endif
#ifndef PUT_LINENO_LNNO
-#define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_16(abfd,val, (bfd_byte *) (ext->l_lnno));
+#define PUT_LINENO_LNNO(abfd, val, ext) \
+ H_PUT_16(abfd,val, ext->l_lnno);
#endif
/* The f_symptr field in the filehdr is sometimes 64 bits. */
#ifndef GET_FILEHDR_SYMPTR
-#define GET_FILEHDR_SYMPTR bfd_h_get_32
+#define GET_FILEHDR_SYMPTR H_GET_32
#endif
#ifndef PUT_FILEHDR_SYMPTR
-#define PUT_FILEHDR_SYMPTR bfd_h_put_32
+#define PUT_FILEHDR_SYMPTR H_PUT_32
#endif
/* Some fields in the aouthdr are sometimes 64 bits. */
#ifndef GET_AOUTHDR_TSIZE
-#define GET_AOUTHDR_TSIZE bfd_h_get_32
+#define GET_AOUTHDR_TSIZE H_GET_32
#endif
#ifndef PUT_AOUTHDR_TSIZE
-#define PUT_AOUTHDR_TSIZE bfd_h_put_32
+#define PUT_AOUTHDR_TSIZE H_PUT_32
#endif
#ifndef GET_AOUTHDR_DSIZE
-#define GET_AOUTHDR_DSIZE bfd_h_get_32
+#define GET_AOUTHDR_DSIZE H_GET_32
#endif
#ifndef PUT_AOUTHDR_DSIZE
-#define PUT_AOUTHDR_DSIZE bfd_h_put_32
+#define PUT_AOUTHDR_DSIZE H_PUT_32
#endif
#ifndef GET_AOUTHDR_BSIZE
-#define GET_AOUTHDR_BSIZE bfd_h_get_32
+#define GET_AOUTHDR_BSIZE H_GET_32
#endif
#ifndef PUT_AOUTHDR_BSIZE
-#define PUT_AOUTHDR_BSIZE bfd_h_put_32
+#define PUT_AOUTHDR_BSIZE H_PUT_32
#endif
#ifndef GET_AOUTHDR_ENTRY
-#define GET_AOUTHDR_ENTRY bfd_h_get_32
+#define GET_AOUTHDR_ENTRY H_GET_32
#endif
#ifndef PUT_AOUTHDR_ENTRY
-#define PUT_AOUTHDR_ENTRY bfd_h_put_32
+#define PUT_AOUTHDR_ENTRY H_PUT_32
#endif
#ifndef GET_AOUTHDR_TEXT_START
-#define GET_AOUTHDR_TEXT_START bfd_h_get_32
+#define GET_AOUTHDR_TEXT_START H_GET_32
#endif
#ifndef PUT_AOUTHDR_TEXT_START
-#define PUT_AOUTHDR_TEXT_START bfd_h_put_32
+#define PUT_AOUTHDR_TEXT_START H_PUT_32
#endif
#ifndef GET_AOUTHDR_DATA_START
-#define GET_AOUTHDR_DATA_START bfd_h_get_32
+#define GET_AOUTHDR_DATA_START H_GET_32
#endif
#ifndef PUT_AOUTHDR_DATA_START
-#define PUT_AOUTHDR_DATA_START bfd_h_put_32
+#define PUT_AOUTHDR_DATA_START H_PUT_32
#endif
/* Some fields in the scnhdr are sometimes 64 bits. */
#ifndef GET_SCNHDR_PADDR
-#define GET_SCNHDR_PADDR bfd_h_get_32
+#define GET_SCNHDR_PADDR H_GET_32
#endif
#ifndef PUT_SCNHDR_PADDR
-#define PUT_SCNHDR_PADDR bfd_h_put_32
+#define PUT_SCNHDR_PADDR H_PUT_32
#endif
#ifndef GET_SCNHDR_VADDR
-#define GET_SCNHDR_VADDR bfd_h_get_32
+#define GET_SCNHDR_VADDR H_GET_32
#endif
#ifndef PUT_SCNHDR_VADDR
-#define PUT_SCNHDR_VADDR bfd_h_put_32
+#define PUT_SCNHDR_VADDR H_PUT_32
#endif
#ifndef GET_SCNHDR_SIZE
-#define GET_SCNHDR_SIZE bfd_h_get_32
+#define GET_SCNHDR_SIZE H_GET_32
#endif
#ifndef PUT_SCNHDR_SIZE
-#define PUT_SCNHDR_SIZE bfd_h_put_32
+#define PUT_SCNHDR_SIZE H_PUT_32
#endif
#ifndef GET_SCNHDR_SCNPTR
-#define GET_SCNHDR_SCNPTR bfd_h_get_32
+#define GET_SCNHDR_SCNPTR H_GET_32
#endif
#ifndef PUT_SCNHDR_SCNPTR
-#define PUT_SCNHDR_SCNPTR bfd_h_put_32
+#define PUT_SCNHDR_SCNPTR H_PUT_32
#endif
#ifndef GET_SCNHDR_RELPTR
-#define GET_SCNHDR_RELPTR bfd_h_get_32
+#define GET_SCNHDR_RELPTR H_GET_32
#endif
#ifndef PUT_SCNHDR_RELPTR
-#define PUT_SCNHDR_RELPTR bfd_h_put_32
+#define PUT_SCNHDR_RELPTR H_PUT_32
#endif
#ifndef GET_SCNHDR_LNNOPTR
-#define GET_SCNHDR_LNNOPTR bfd_h_get_32
+#define GET_SCNHDR_LNNOPTR H_GET_32
#endif
#ifndef PUT_SCNHDR_LNNOPTR
-#define PUT_SCNHDR_LNNOPTR bfd_h_put_32
+#define PUT_SCNHDR_LNNOPTR H_PUT_32
#endif
#ifdef COFF_WITH_pep
-#define GET_OPTHDR_IMAGE_BASE bfd_h_get_64
-#define PUT_OPTHDR_IMAGE_BASE bfd_h_put_64
-#define GET_OPTHDR_SIZE_OF_STACK_RESERVE bfd_h_get_64
-#define PUT_OPTHDR_SIZE_OF_STACK_RESERVE bfd_h_put_64
-#define GET_OPTHDR_SIZE_OF_STACK_COMMIT bfd_h_get_64
-#define PUT_OPTHDR_SIZE_OF_STACK_COMMIT bfd_h_put_64
-#define GET_OPTHDR_SIZE_OF_HEAP_RESERVE bfd_h_get_64
-#define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE bfd_h_put_64
-#define GET_OPTHDR_SIZE_OF_HEAP_COMMIT bfd_h_get_64
-#define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT bfd_h_put_64
+#define GET_OPTHDR_IMAGE_BASE H_GET_64
+#define PUT_OPTHDR_IMAGE_BASE H_PUT_64
+#define GET_OPTHDR_SIZE_OF_STACK_RESERVE H_GET_64
+#define PUT_OPTHDR_SIZE_OF_STACK_RESERVE H_PUT_64
+#define GET_OPTHDR_SIZE_OF_STACK_COMMIT H_GET_64
+#define PUT_OPTHDR_SIZE_OF_STACK_COMMIT H_PUT_64
+#define GET_OPTHDR_SIZE_OF_HEAP_RESERVE H_GET_64
+#define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE H_PUT_64
+#define GET_OPTHDR_SIZE_OF_HEAP_COMMIT H_GET_64
+#define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT H_PUT_64
#define GET_PDATA_ENTRY bfd_get_64
#define _bfd_XX_bfd_copy_private_bfd_data_common _bfd_pep_bfd_copy_private_bfd_data_common
@@ -227,16 +241,16 @@ PE/PEI rearrangement (and code added): Donn Terry
#else /* !COFF_WITH_pep */
-#define GET_OPTHDR_IMAGE_BASE bfd_h_get_32
-#define PUT_OPTHDR_IMAGE_BASE bfd_h_put_32
-#define GET_OPTHDR_SIZE_OF_STACK_RESERVE bfd_h_get_32
-#define PUT_OPTHDR_SIZE_OF_STACK_RESERVE bfd_h_put_32
-#define GET_OPTHDR_SIZE_OF_STACK_COMMIT bfd_h_get_32
-#define PUT_OPTHDR_SIZE_OF_STACK_COMMIT bfd_h_put_32
-#define GET_OPTHDR_SIZE_OF_HEAP_RESERVE bfd_h_get_32
-#define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE bfd_h_put_32
-#define GET_OPTHDR_SIZE_OF_HEAP_COMMIT bfd_h_get_32
-#define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT bfd_h_put_32
+#define GET_OPTHDR_IMAGE_BASE H_GET_32
+#define PUT_OPTHDR_IMAGE_BASE H_PUT_32
+#define GET_OPTHDR_SIZE_OF_STACK_RESERVE H_GET_32
+#define PUT_OPTHDR_SIZE_OF_STACK_RESERVE H_PUT_32
+#define GET_OPTHDR_SIZE_OF_STACK_COMMIT H_GET_32
+#define PUT_OPTHDR_SIZE_OF_STACK_COMMIT H_PUT_32
+#define GET_OPTHDR_SIZE_OF_HEAP_RESERVE H_GET_32
+#define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE H_PUT_32
+#define GET_OPTHDR_SIZE_OF_HEAP_COMMIT H_GET_32
+#define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT H_PUT_32
#define GET_PDATA_ENTRY bfd_get_32
#define _bfd_XX_bfd_copy_private_bfd_data_common _bfd_pe_bfd_copy_private_bfd_data_common
diff --git a/contrib/binutils/bfd/linker.c b/contrib/binutils/bfd/linker.c
index e382895..135f46d 100644
--- a/contrib/binutils/bfd/linker.c
+++ b/contrib/binutils/bfd/linker.c
@@ -1419,7 +1419,7 @@ static const enum link_action link_action[8][8] =
/* DEFW_ROW */ {DEFW, DEFW, DEFW, NOACT, NOACT, NOACT, NOACT, CYCLE },
/* COMMON_ROW */ {COM, COM, COM, CREF, COM, BIG, REFC, WARNC },
/* INDR_ROW */ {IND, IND, IND, MDEF, IND, CIND, MIND, CYCLE },
- /* WARN_ROW */ {MWARN, WARN, WARN, CWARN, CWARN, WARN, CWARN, MWARN },
+ /* WARN_ROW */ {MWARN, WARN, WARN, CWARN, CWARN, WARN, CWARN, NOACT },
/* SET_ROW */ {SET, SET, SET, SET, SET, SET, CYCLE, CYCLE }
};
@@ -2456,6 +2456,9 @@ _bfd_generic_link_write_global_symbol (h, data)
(struct generic_write_global_symbol_info *) data;
asymbol *sym;
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct generic_link_hash_entry *) h->root.u.i.link;
+
if (h->written)
return true;
diff --git a/contrib/binutils/bfd/merge.c b/contrib/binutils/bfd/merge.c
index 7b06c10..e175efd 100644
--- a/contrib/binutils/bfd/merge.c
+++ b/contrib/binutils/bfd/merge.c
@@ -804,6 +804,9 @@ _bfd_merge_sections (abfd, xsinfo, remove_hook)
if (secinfo)
continue;
+ if (sinfo->htab->first == NULL)
+ continue;
+
if (sinfo->htab->strings)
merge_strings (sinfo);
else
diff --git a/contrib/binutils/bfd/mipsbsd.c b/contrib/binutils/bfd/mipsbsd.c
index 7a680fb..85cf0ef 100644
--- a/contrib/binutils/bfd/mipsbsd.c
+++ b/contrib/binutils/bfd/mipsbsd.c
@@ -1,5 +1,6 @@
/* BFD backend for MIPS BSD (a.out) binaries.
- Copyright (C) 1993, 94, 95, 97, 98, 1999 Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001
+ Free Software Foundation, Inc.
Written by Ralph Campbell.
This file is part of BFD, the Binary File Descriptor library.
@@ -35,7 +36,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|| (mtype) == M_MIPS1 || (mtype) == M_MIPS2)
#define MY_symbol_leading_char '\0'
-#define MY(OP) CAT(mipsbsd_,OP)
+/* Do not "beautify" the CONCAT* macro args. Traditional C will not
+ remove whitespace added here, and thus will fail to concatenate
+ the tokens. */
+#define MY(OP) CONCAT2 (mipsbsd_,OP)
#include "bfd.h"
#include "sysdep.h"
@@ -43,15 +47,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "libaout.h"
#define SET_ARCH_MACH(ABFD, EXEC) \
- MY(set_arch_mach)(ABFD, N_MACHTYPE (EXEC)); \
- MY(choose_reloc_size)(ABFD);
-static void MY(set_arch_mach) PARAMS ((bfd *abfd, int machtype));
+ MY(set_arch_mach) (ABFD, N_MACHTYPE (EXEC)); \
+ MY(choose_reloc_size) (ABFD);
+static void MY(set_arch_mach) PARAMS ((bfd *abfd, unsigned long machtype));
static void MY(choose_reloc_size) PARAMS ((bfd *abfd));
#define MY_write_object_contents MY(write_object_contents)
static boolean MY(write_object_contents) PARAMS ((bfd *abfd));
-/* We can't use MY(x) here because it leads to a recursive call to CAT
+/* We can't use MY(x) here because it leads to a recursive call to CONCAT2
when expanded inside JUMP_TABLE. */
#define MY_bfd_reloc_type_lookup mipsbsd_reloc_howto_type_lookup
#define MY_canonicalize_reloc mipsbsd_canonicalize_reloc
@@ -66,50 +70,60 @@ static boolean MY(write_object_contents) PARAMS ((bfd *abfd));
#include "aout-target.h"
+static bfd_reloc_status_type mips_fix_jmp_addr
+ PARAMS ((bfd *, arelent *, struct symbol_cache_entry *, PTR, asection *,
+ bfd *, char **));
+static reloc_howto_type *MY(reloc_howto_type_lookup)
+ PARAMS ((bfd *, bfd_reloc_code_real_type));
+
+long MY(canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **, asymbol **));
+
static void
MY(set_arch_mach) (abfd, machtype)
bfd *abfd;
- int machtype;
+ unsigned long machtype;
{
enum bfd_architecture arch;
- long machine;
-
- /* Determine the architecture and machine type of the object file. */
- switch (machtype) {
-
- case M_MIPS1:
- arch = bfd_arch_mips;
- machine = 3000;
- break;
-
- case M_MIPS2:
- arch = bfd_arch_mips;
- machine = 4000;
- break;
-
- default:
- arch = bfd_arch_obscure;
- machine = 0;
- break;
- }
- bfd_set_arch_mach(abfd, arch, machine);
+ unsigned int machine;
+
+ /* Determine the architecture and machine type of the object file. */
+ switch (machtype)
+ {
+ case M_MIPS1:
+ arch = bfd_arch_mips;
+ machine = 3000;
+ break;
+
+ case M_MIPS2:
+ arch = bfd_arch_mips;
+ machine = 4000;
+ break;
+
+ default:
+ arch = bfd_arch_obscure;
+ machine = 0;
+ break;
+ }
+
+ bfd_set_arch_mach (abfd, arch, machine);
}
/* Determine the size of a relocation entry, based on the architecture */
static void
-MY(choose_reloc_size) (abfd)
+MY (choose_reloc_size) (abfd)
bfd *abfd;
{
- switch (bfd_get_arch(abfd)) {
- case bfd_arch_sparc:
- case bfd_arch_a29k:
- case bfd_arch_mips:
- obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE;
- break;
- default:
- obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
- break;
- }
+ switch (bfd_get_arch (abfd))
+ {
+ case bfd_arch_sparc:
+ case bfd_arch_a29k:
+ case bfd_arch_mips:
+ obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE;
+ break;
+ default:
+ obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
+ break;
+ }
}
/* Write an object file in BSD a.out format.
@@ -117,59 +131,60 @@ MY(choose_reloc_size) (abfd)
file header, symbols, and relocation. */
static boolean
-MY(write_object_contents) (abfd)
+MY (write_object_contents) (abfd)
bfd *abfd;
{
struct external_exec exec_bytes;
struct internal_exec *execp = exec_hdr (abfd);
/* Magic number, maestro, please! */
- switch (bfd_get_arch(abfd)) {
- case bfd_arch_m68k:
- switch (bfd_get_mach(abfd)) {
- case bfd_mach_m68010:
- N_SET_MACHTYPE(*execp, M_68010);
+ switch (bfd_get_arch (abfd))
+ {
+ case bfd_arch_m68k:
+ switch (bfd_get_mach (abfd))
+ {
+ case bfd_mach_m68010:
+ N_SET_MACHTYPE (*execp, M_68010);
+ break;
+ default:
+ case bfd_mach_m68020:
+ N_SET_MACHTYPE (*execp, M_68020);
+ break;
+ }
break;
- default:
- case bfd_mach_m68020:
- N_SET_MACHTYPE(*execp, M_68020);
+ case bfd_arch_sparc:
+ N_SET_MACHTYPE (*execp, M_SPARC);
break;
- }
- break;
- case bfd_arch_sparc:
- N_SET_MACHTYPE(*execp, M_SPARC);
- break;
- case bfd_arch_i386:
- N_SET_MACHTYPE(*execp, M_386);
- break;
- case bfd_arch_a29k:
- N_SET_MACHTYPE(*execp, M_29K);
- break;
- case bfd_arch_mips:
- switch (bfd_get_mach(abfd)) {
- case 4000:
- case 6000:
- N_SET_MACHTYPE(*execp, M_MIPS2);
+ case bfd_arch_i386:
+ N_SET_MACHTYPE (*execp, M_386);
break;
- default:
- N_SET_MACHTYPE(*execp, M_MIPS1);
+ case bfd_arch_a29k:
+ N_SET_MACHTYPE (*execp, M_29K);
+ break;
+ case bfd_arch_mips:
+ switch (bfd_get_mach (abfd))
+ {
+ case 4000:
+ case 6000:
+ N_SET_MACHTYPE (*execp, M_MIPS2);
+ break;
+ default:
+ N_SET_MACHTYPE (*execp, M_MIPS1);
+ break;
+ }
break;
+ default:
+ N_SET_MACHTYPE (*execp, M_UNKNOWN);
}
- break;
- default:
- N_SET_MACHTYPE(*execp, M_UNKNOWN);
- }
- MY(choose_reloc_size)(abfd);
+ MY (choose_reloc_size) (abfd);
- WRITE_HEADERS(abfd, execp);
+ WRITE_HEADERS (abfd, execp);
return true;
}
-/*
- * MIPS relocation types.
- */
+/* MIPS relocation types. */
#define MIPS_RELOC_32 0
#define MIPS_RELOC_JMP 1
#define MIPS_RELOC_WDISP16 2
@@ -177,26 +192,27 @@ MY(write_object_contents) (abfd)
#define MIPS_RELOC_HI16_S 4
#define MIPS_RELOC_LO16 5
-/*
- * This is only called when performing a BFD_RELOC_MIPS_JMP relocation.
- * The jump destination address is formed from the upper 4 bits of the
- * "current" program counter concatenated with the jump instruction's
- * 26 bit field and two trailing zeros.
- * If the destination address is not in the same segment as the "current"
- * program counter, then we need to signal an error.
- */
+/* This is only called when performing a BFD_RELOC_MIPS_JMP relocation.
+ The jump destination address is formed from the upper 4 bits of the
+ "current" program counter concatenated with the jump instruction's
+ 26 bit field and two trailing zeros.
+ If the destination address is not in the same segment as the "current"
+ program counter, then we need to signal an error. */
+
static bfd_reloc_status_type
-mips_fix_jmp_addr (abfd,reloc_entry,symbol,data,input_section,output_bfd)
+mips_fix_jmp_addr (abfd, reloc_entry, symbol, data, input_section, output_bfd,
+ error_message)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *reloc_entry;
struct symbol_cache_entry *symbol;
PTR data ATTRIBUTE_UNUSED;
asection *input_section;
bfd *output_bfd;
+ char **error_message ATTRIBUTE_UNUSED;
{
bfd_vma relocation, pc;
-
- /* If this is a partial relocation, just continue. */
+
+ /* If this is a partial relocation, just continue. */
if (output_bfd != (bfd *)NULL)
return bfd_reloc_continue;
@@ -205,10 +221,8 @@ mips_fix_jmp_addr (abfd,reloc_entry,symbol,data,input_section,output_bfd)
&& (symbol->flags & BSF_WEAK) == 0)
return bfd_reloc_undefined;
- /*
- * Work out which section the relocation is targetted at and the
- * initial relocation command value.
- */
+ /* Work out which section the relocation is targetted at and the
+ initial relocation command value. */
if (bfd_is_com_section (symbol->section))
relocation = 0;
else
@@ -227,12 +241,11 @@ mips_fix_jmp_addr (abfd,reloc_entry,symbol,data,input_section,output_bfd)
return bfd_reloc_continue;
}
-/*
- * This is only called when performing a BFD_RELOC_HI16_S relocation.
- * We need to see if bit 15 is set in the result. If it is, we add
- * 0x10000 and continue normally. This will compensate for the sign extension
- * when the low bits are added at run time.
- */
+/* This is only called when performing a BFD_RELOC_HI16_S relocation.
+ We need to see if bit 15 is set in the result. If it is, we add
+ 0x10000 and continue normally. This will compensate for the sign extension
+ when the low bits are added at run time. */
+
static bfd_reloc_status_type
mips_fix_hi16_s PARAMS ((bfd *, arelent *, asymbol *, PTR,
asection *, bfd *, char **));
@@ -249,20 +262,18 @@ mips_fix_hi16_s (abfd, reloc_entry, symbol, data, input_section,
char **error_message ATTRIBUTE_UNUSED;
{
bfd_vma relocation;
-
- /* If this is a partial relocation, just continue. */
+
+ /* If this is a partial relocation, just continue. */
if (output_bfd != (bfd *)NULL)
return bfd_reloc_continue;
- /* If this is an undefined symbol, return error */
+ /* If this is an undefined symbol, return error. */
if (bfd_is_und_section (symbol->section)
&& (symbol->flags & BSF_WEAK) == 0)
return bfd_reloc_undefined;
- /*
- * Work out which section the relocation is targetted at and the
- * initial relocation command value.
- */
+ /* Work out which section the relocation is targetted at and the
+ initial relocation command value. */
if (bfd_is_com_section (symbol->section))
relocation = 0;
else
@@ -324,12 +335,10 @@ MY(reloc_howto_type_lookup) (abfd, code)
}
}
-/*
- * This is just like the standard aoutx.h version but we need to do our
- * own mapping of external reloc type values to howto entries.
- */
+/* This is just like the standard aoutx.h version but we need to do our
+ own mapping of external reloc type values to howto entries. */
long
-MY(canonicalize_reloc)(abfd, section, relptr, symbols)
+MY(canonicalize_reloc) (abfd, section, relptr, symbols)
bfd *abfd;
sec_ptr section;
arelent **relptr;
@@ -339,30 +348,34 @@ MY(canonicalize_reloc)(abfd, section, relptr, symbols)
unsigned int count, c;
extern reloc_howto_type NAME(aout,ext_howto_table)[];
- /* If we have already read in the relocation table, return the values. */
- if (section->flags & SEC_CONSTRUCTOR) {
- arelent_chain *chain = section->constructor_chain;
+ /* If we have already read in the relocation table, return the values. */
+ if (section->flags & SEC_CONSTRUCTOR)
+ {
+ arelent_chain *chain = section->constructor_chain;
+
+ for (count = 0; count < section->reloc_count; count++)
+ {
+ *relptr++ = &chain->relent;
+ chain = chain->next;
+ }
+ *relptr = 0;
+ return section->reloc_count;
+ }
- for (count = 0; count < section->reloc_count; count++) {
- *relptr++ = &chain->relent;
- chain = chain->next;
+ if (tblptr && section->reloc_count)
+ {
+ for (count = 0; count++ < section->reloc_count;)
+ *relptr++ = tblptr++;
+ *relptr = 0;
+ return section->reloc_count;
}
- *relptr = 0;
- return section->reloc_count;
- }
- if (tblptr && section->reloc_count) {
- for (count = 0; count++ < section->reloc_count;)
- *relptr++ = tblptr++;
- *relptr = 0;
- return section->reloc_count;
- }
- if (!NAME(aout,slurp_reloc_table)(abfd, section, symbols))
+ if (!NAME(aout,slurp_reloc_table) (abfd, section, symbols))
return -1;
tblptr = section->relocation;
- /* fix up howto entries */
- for (count = 0; count++ < section->reloc_count;)
+ /* fix up howto entries. */
+ for (count = 0; count++ < section->reloc_count;)
{
c = tblptr->howto - NAME(aout,ext_howto_table);
tblptr->howto = &mips_howto_table_ext[c];
@@ -373,7 +386,7 @@ MY(canonicalize_reloc)(abfd, section, relptr, symbols)
return section->reloc_count;
}
-static CONST struct aout_backend_data MY(backend_data) = {
+static const struct aout_backend_data MY(backend_data) = {
0, /* zmagic contiguous */
1, /* text incl header */
0, /* entry is text address */
@@ -392,83 +405,83 @@ static CONST struct aout_backend_data MY(backend_data) = {
extern const bfd_target aout_mips_big_vec;
const bfd_target aout_mips_little_vec =
-{
- "a.out-mips-little", /* name */
- bfd_target_aout_flavour,
- BFD_ENDIAN_LITTLE, /* target byte order (little) */
- BFD_ENDIAN_LITTLE, /* target headers byte order (little) */
- (HAS_RELOC | EXEC_P | /* object flags */
- HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
- MY_symbol_leading_char,
- ' ', /* ar_pad_char */
- 15, /* ar_max_namelen */
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
+ {
+ "a.out-mips-little", /* name */
+ bfd_target_aout_flavour,
+ BFD_ENDIAN_LITTLE, /* target byte order (little) */
+ BFD_ENDIAN_LITTLE, /* target headers byte order (little) */
+ (HAS_RELOC | EXEC_P | /* object flags */
+ HAS_LINENO | HAS_DEBUG |
+ HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
+ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
+ MY_symbol_leading_char,
+ ' ', /* ar_pad_char */
+ 15, /* ar_max_namelen */
+ bfd_getl64, bfd_getl_signed_64, bfd_putl64,
+ bfd_getl32, bfd_getl_signed_32, bfd_putl32,
+ bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
+ bfd_getl64, bfd_getl_signed_64, bfd_putl64,
+ bfd_getl32, bfd_getl_signed_32, bfd_putl32,
+ bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
{_bfd_dummy_target, MY_object_p, /* bfd_check_format */
- bfd_generic_archive_p, MY_core_file_p},
+ bfd_generic_archive_p, MY_core_file_p},
{bfd_false, MY_mkobject, /* bfd_set_format */
- _bfd_generic_mkarchive, bfd_false},
+ _bfd_generic_mkarchive, bfd_false},
{bfd_false, MY_write_object_contents, /* bfd_write_contents */
- _bfd_write_archive_contents, bfd_false},
-
- BFD_JUMP_TABLE_GENERIC (MY),
- BFD_JUMP_TABLE_COPY (MY),
- BFD_JUMP_TABLE_CORE (MY),
- BFD_JUMP_TABLE_ARCHIVE (MY),
- BFD_JUMP_TABLE_SYMBOLS (MY),
- BFD_JUMP_TABLE_RELOCS (MY),
- BFD_JUMP_TABLE_WRITE (MY),
- BFD_JUMP_TABLE_LINK (MY),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
- & aout_mips_big_vec,
-
- (PTR) MY_backend_data
-};
+ _bfd_write_archive_contents, bfd_false},
+
+ BFD_JUMP_TABLE_GENERIC (MY),
+ BFD_JUMP_TABLE_COPY (MY),
+ BFD_JUMP_TABLE_CORE (MY),
+ BFD_JUMP_TABLE_ARCHIVE (MY),
+ BFD_JUMP_TABLE_SYMBOLS (MY),
+ BFD_JUMP_TABLE_RELOCS (MY),
+ BFD_JUMP_TABLE_WRITE (MY),
+ BFD_JUMP_TABLE_LINK (MY),
+ BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
+
+ & aout_mips_big_vec,
+
+ (PTR) MY_backend_data
+ };
const bfd_target aout_mips_big_vec =
-{
- "a.out-mips-big", /* name */
- bfd_target_aout_flavour,
- BFD_ENDIAN_BIG, /* target byte order (big) */
- BFD_ENDIAN_BIG, /* target headers byte order (big) */
- (HAS_RELOC | EXEC_P | /* object flags */
- HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
- MY_symbol_leading_char,
- ' ', /* ar_pad_char */
- 15, /* ar_max_namelen */
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
+ {
+ "a.out-mips-big", /* name */
+ bfd_target_aout_flavour,
+ BFD_ENDIAN_BIG, /* target byte order (big) */
+ BFD_ENDIAN_BIG, /* target headers byte order (big) */
+ (HAS_RELOC | EXEC_P | /* object flags */
+ HAS_LINENO | HAS_DEBUG |
+ HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
+ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
+ MY_symbol_leading_char,
+ ' ', /* ar_pad_char */
+ 15, /* ar_max_namelen */
+ bfd_getb64, bfd_getb_signed_64, bfd_putb64,
+ bfd_getb32, bfd_getb_signed_32, bfd_putb32,
+ bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
+ bfd_getb64, bfd_getb_signed_64, bfd_putb64,
+ bfd_getb32, bfd_getb_signed_32, bfd_putb32,
+ bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
{_bfd_dummy_target, MY_object_p, /* bfd_check_format */
- bfd_generic_archive_p, MY_core_file_p},
+ bfd_generic_archive_p, MY_core_file_p},
{bfd_false, MY_mkobject, /* bfd_set_format */
- _bfd_generic_mkarchive, bfd_false},
+ _bfd_generic_mkarchive, bfd_false},
{bfd_false, MY_write_object_contents, /* bfd_write_contents */
- _bfd_write_archive_contents, bfd_false},
-
- BFD_JUMP_TABLE_GENERIC (MY),
- BFD_JUMP_TABLE_COPY (MY),
- BFD_JUMP_TABLE_CORE (MY),
- BFD_JUMP_TABLE_ARCHIVE (MY),
- BFD_JUMP_TABLE_SYMBOLS (MY),
- BFD_JUMP_TABLE_RELOCS (MY),
- BFD_JUMP_TABLE_WRITE (MY),
- BFD_JUMP_TABLE_LINK (MY),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
-
- & aout_mips_little_vec,
-
- (PTR) MY_backend_data
-};
+ _bfd_write_archive_contents, bfd_false},
+
+ BFD_JUMP_TABLE_GENERIC (MY),
+ BFD_JUMP_TABLE_COPY (MY),
+ BFD_JUMP_TABLE_CORE (MY),
+ BFD_JUMP_TABLE_ARCHIVE (MY),
+ BFD_JUMP_TABLE_SYMBOLS (MY),
+ BFD_JUMP_TABLE_RELOCS (MY),
+ BFD_JUMP_TABLE_WRITE (MY),
+ BFD_JUMP_TABLE_LINK (MY),
+ BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
+
+ & aout_mips_little_vec,
+
+ (PTR) MY_backend_data
+ };
diff --git a/contrib/binutils/bfd/pe-mips.c b/contrib/binutils/bfd/pe-mips.c
index 9b89369..c78726d 100644
--- a/contrib/binutils/bfd/pe-mips.c
+++ b/contrib/binutils/bfd/pe-mips.c
@@ -1,5 +1,6 @@
/* BFD back-end for MIPS PE COFF files.
- Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+ 2000, 2001 Free Software Foundation, Inc.
Modified from coff-i386.c by DJ Delorie, dj@cygnus.com
This file is part of BFD, the Binary File Descriptor library.
@@ -34,7 +35,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "libcoff.h"
-static bfd_reloc_status_type coff_mips_reloc
+static bfd_reloc_status_type coff_mips_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
static reloc_howto_type *coff_mips_rtype_to_howto
PARAMS ((bfd *, asection *, struct internal_reloc *,
@@ -53,6 +54,15 @@ static void mips_adjust_reloc_in PARAMS ((bfd *,
static void mips_adjust_reloc_out PARAMS ((bfd *, const arelent *,
struct internal_reloc *));
#endif
+
+static boolean in_reloc_p PARAMS ((bfd *, reloc_howto_type *));
+static reloc_howto_type * coff_mips_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type));
+static void mips_swap_reloc_in PARAMS ((bfd *, PTR, PTR));
+static unsigned int mips_swap_reloc_out PARAMS ((bfd *, PTR, PTR));
+static boolean coff_pe_mips_relocate_section
+ PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
+ struct internal_reloc *, struct internal_syment *, asection **));
+
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
/* The page size is a guess based on ELF. */
@@ -143,7 +153,7 @@ coff_mips_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
{
short x = bfd_get_16 (abfd, addr);
DOIT (x);
- bfd_put_16 (abfd, x, addr);
+ bfd_put_16 (abfd, (bfd_vma) x, addr);
}
break;
@@ -151,7 +161,7 @@ coff_mips_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
{
long x = bfd_get_32 (abfd, addr);
DOIT (x);
- bfd_put_32 (abfd, x, addr);
+ bfd_put_32 (abfd, (bfd_vma) x, addr);
}
break;
@@ -166,21 +176,22 @@ coff_mips_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
#ifdef COFF_WITH_PE
/* Return true if this relocation should
- appear in the output .reloc section. */
+ appear in the output .reloc section. */
-static boolean in_reloc_p(abfd, howto)
+static boolean
+in_reloc_p (abfd, howto)
bfd * abfd ATTRIBUTE_UNUSED;
reloc_howto_type *howto;
{
return ! howto->pc_relative && howto->type != MIPS_R_RVA;
-}
+}
#endif
#ifndef PCRELOFFSET
#define PCRELOFFSET false
#endif
-static reloc_howto_type howto_table[] =
+static reloc_howto_type howto_table[] =
{
/* Reloc type 0 is ignored. The reloc reading code ensures that
this is a reference to the .abs section, which will cause
@@ -336,33 +347,33 @@ static reloc_howto_type howto_table[] =
EMPTY_HOWTO (31),
EMPTY_HOWTO (32),
EMPTY_HOWTO (33),
- HOWTO (MIPS_R_RVA, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (MIPS_R_RVA, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- coff_mips_reloc, /* special_function */
- "rva32", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
+ coff_mips_reloc, /* special_function */
+ "rva32", /* name */
+ true, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
false), /* pcrel_offset */
EMPTY_HOWTO (35),
EMPTY_HOWTO (36),
- HOWTO (MIPS_R_PAIR, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (MIPS_R_PAIR, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- coff_mips_reloc, /* special_function */
- "PAIR", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
+ coff_mips_reloc, /* special_function */
+ "PAIR", /* name */
+ true, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
false), /* pcrel_offset */
};
@@ -408,7 +419,6 @@ static reloc_howto_type howto_table[] =
cache_ptr->addend += asect->vma; \
}
-
/* Convert an rtype to howto for the COFF backend linker. */
static reloc_howto_type *
@@ -439,7 +449,7 @@ coff_mips_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
function will be adding in the final value of the symbol. We
need to subtract out the current size in order to get the
correct result. */
-
+
BFD_ASSERT (h != NULL);
#ifndef COFF_WITH_PE
@@ -458,7 +468,7 @@ coff_mips_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
/* If the output symbol is common (in which case this must be a
relocateable link), we need to add in the final size of the
common symbol. */
- if (h != NULL && h->root.type == bfd_link_hash_common)
+ if (h != NULL && h->root.type == bfd_link_hash_common)
*addendp += h->root.u.c.size;
#endif
@@ -488,11 +498,8 @@ coff_mips_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
#define coff_rtype_to_howto coff_mips_rtype_to_howto
-
#define coff_bfd_reloc_type_lookup coff_mips_reloc_type_lookup
-
-
/* Get the howto structure for a generic reloc type. */
static reloc_howto_type *
@@ -520,7 +527,7 @@ coff_mips_reloc_type_lookup (abfd, code)
case BFD_RELOC_LO16:
mips_type = MIPS_R_REFLO;
break;
- case BFD_RELOC_MIPS_GPREL:
+ case BFD_RELOC_GPREL16:
mips_type = MIPS_R_GPREL;
break;
case BFD_RELOC_MIPS_LITERAL:
@@ -560,10 +567,9 @@ mips_swap_reloc_in (abfd, src, dst)
RELOC *reloc_src = (RELOC *) src;
struct internal_reloc *reloc_dst = (struct internal_reloc *) dst;
- reloc_dst->r_vaddr = bfd_h_get_32(abfd, (bfd_byte *)reloc_src->r_vaddr);
- reloc_dst->r_symndx =
- bfd_h_get_signed_32(abfd, (bfd_byte *) reloc_src->r_symndx);
- reloc_dst->r_type = bfd_h_get_16(abfd, (bfd_byte *) reloc_src->r_type);
+ reloc_dst->r_vaddr = H_GET_32 (abfd, reloc_src->r_vaddr);
+ reloc_dst->r_symndx = H_GET_S32 (abfd, reloc_src->r_symndx);
+ reloc_dst->r_type = H_GET_16 (abfd, reloc_src->r_type);
reloc_dst->r_size = 0;
reloc_dst->r_extern = 0;
reloc_dst->r_offset = 0;
@@ -577,7 +583,7 @@ mips_swap_reloc_in (abfd, src, dst)
reloc_dst->r_offset = reloc_dst->r_symndx;
if (reloc_dst->r_offset & 0x8000)
reloc_dst->r_offset -= 0x10000;
- /*printf("dj: pair offset is %08x\n", reloc_dst->r_offset);*/
+ /*printf ("dj: pair offset is %08x\n", reloc_dst->r_offset);*/
reloc_dst->r_symndx = pair_prev.r_symndx;
break;
}
@@ -607,23 +613,18 @@ mips_swap_reloc_out (abfd, src, dst)
the same address as a REFHI, we assume this is the matching
PAIR reloc and output it accordingly. The symndx is really
the low 16 bits of the addend */
- bfd_h_put_32 (abfd, reloc_src->r_vaddr,
- (bfd_byte *) reloc_dst->r_vaddr);
- bfd_h_put_32 (abfd, reloc_src->r_symndx,
- (bfd_byte *) reloc_dst->r_symndx);
-
- bfd_h_put_16(abfd, MIPS_R_PAIR, (bfd_byte *)
- reloc_dst->r_type);
+ H_PUT_32 (abfd, reloc_src->r_vaddr, reloc_dst->r_vaddr);
+ H_PUT_32 (abfd, reloc_src->r_symndx, reloc_dst->r_symndx);
+ H_PUT_16 (abfd, MIPS_R_PAIR, reloc_dst->r_type);
return RELSZ;
}
break;
}
- bfd_h_put_32(abfd, reloc_src->r_vaddr, (bfd_byte *) reloc_dst->r_vaddr);
- bfd_h_put_32(abfd, reloc_src->r_symndx, (bfd_byte *) reloc_dst->r_symndx);
+ H_PUT_32 (abfd, reloc_src->r_vaddr, reloc_dst->r_vaddr);
+ H_PUT_32 (abfd, reloc_src->r_symndx, reloc_dst->r_symndx);
- bfd_h_put_16(abfd, reloc_src->r_type, (bfd_byte *)
- reloc_dst->r_type);
+ H_PUT_16 (abfd, reloc_src->r_type, reloc_dst->r_type);
return RELSZ;
}
@@ -654,9 +655,9 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd,
if (info->relocateable)
{
- (*_bfd_error_handler)(_("\
+ (*_bfd_error_handler) (_("\
%s: `ld -r' not supported with PE MIPS objects\n"),
- bfd_get_filename (input_bfd));
+ bfd_archive_filename (input_bfd));
bfd_set_error (bfd_error_bad_value);
return false;
}
@@ -665,7 +666,7 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd,
== output_bfd->xvec->byteorder);
#if 0
- printf("dj: relocate %s(%s) %08x\n",
+ printf ("dj: relocate %s(%s) %08x\n",
input_bfd->filename, input_section->name,
input_section->output_section->vma + input_section->output_offset);
#endif
@@ -700,7 +701,7 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd,
sym = NULL;
}
else
- {
+ {
h = obj_coff_sym_hashes (input_bfd)[symndx];
sym = syms + symndx;
}
@@ -715,7 +716,6 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd,
else
addend = 0;
-
howto = bfd_coff_rtype_to_howto (input_bfd, input_section, rel, h,
sym, &addend);
if (howto == NULL)
@@ -779,7 +779,7 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd,
src = rel->r_vaddr + input_section->output_section->vma
+ input_section->output_offset;
#if 0
- printf("dj: reloc %02x %-8s a=%08x/%08x(%08x) v=%08x+%08x %s\n",
+ printf ("dj: reloc %02x %-8s a=%08x/%08x(%08x) v=%08x+%08x %s\n",
rel->r_type, howto_table[rel->r_type].name,
src, rel->r_vaddr, *(unsigned long *)mem, val, rel->r_offset,
h?h->root.root.string:"(none)");
@@ -791,8 +791,8 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd,
val = VMA of what we need to refer to
*/
-#define UI(x) (*_bfd_error_handler)(_("%s: unimplemented %s\n"), \
- bfd_get_filename (input_bfd), x); \
+#define UI(x) (*_bfd_error_handler) (_("%s: unimplemented %s\n"), \
+ bfd_archive_filename (input_bfd), x); \
bfd_set_error (bfd_error_bad_value);
switch (rel->r_type)
@@ -807,7 +807,7 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd,
case MIPS_R_REFWORD:
tmp = bfd_get_32(input_bfd, mem);
- /* printf("refword: src=%08x targ=%08x+%08x\n", src, tmp, val); */
+ /* printf ("refword: src=%08x targ=%08x+%08x\n", src, tmp, val); */
tmp += val;
bfd_put_32(input_bfd, tmp, mem);
break;
@@ -817,8 +817,8 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd,
targ = val + (tmp&0x03ffffff)*4;
if ((src & 0xf0000000) != (targ & 0xf0000000))
{
- (*_bfd_error_handler)(_("%s: jump too far away\n"),
- bfd_get_filename (input_bfd));
+ (*_bfd_error_handler) (_("%s: jump too far away\n"),
+ bfd_archive_filename (input_bfd));
bfd_set_error (bfd_error_bad_value);
return false;
}
@@ -844,8 +844,8 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd,
targ = val + low + ((tmp & 0xffff) << 16);
break;
default:
- (*_bfd_error_handler)(_("%s: bad pair/reflo after refhi\n"),
- bfd_get_filename (input_bfd));
+ (*_bfd_error_handler) (_("%s: bad pair/reflo after refhi\n"),
+ bfd_archive_filename (input_bfd));
bfd_set_error (bfd_error_bad_value);
return false;
}
@@ -857,7 +857,7 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd,
case MIPS_R_REFLO:
tmp = bfd_get_32(input_bfd, mem);
targ = val + (tmp & 0xffff);
- /* printf("refword: src=%08x targ=%08x\n", src, targ); */
+ /* printf ("refword: src=%08x targ=%08x\n", src, targ); */
tmp &= 0xffff0000;
tmp |= targ & 0xffff;
bfd_put_32(input_bfd, tmp, mem);
@@ -886,7 +886,7 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd,
case MIPS_R_RVA:
tmp = bfd_get_32 (input_bfd, mem);
- /* printf("rva: src=%08x targ=%08x+%08x\n", src, tmp, val); */
+ /* printf ("rva: src=%08x targ=%08x+%08x\n", src, tmp, val); */
tmp += val
- pe_data (input_section->output_section->owner)->pe_opthdr.ImageBase;
bfd_put_32 (input_bfd, tmp, mem);
@@ -974,7 +974,7 @@ const bfd_target
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
-/* Note that we allow an object file to be treated as a core file as well. */
+/* Note that we allow an object file to be treated as a core file as well. */
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
bfd_generic_archive_p, coff_object_p},
{bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
@@ -993,6 +993,6 @@ const bfd_target
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
-
+
COFF_SWAP_TABLE
};
diff --git a/contrib/binutils/bfd/peicode.h b/contrib/binutils/bfd/peicode.h
index 20fe01c..323b30d 100644
--- a/contrib/binutils/bfd/peicode.h
+++ b/contrib/binutils/bfd/peicode.h
@@ -139,7 +139,7 @@ static void pe_ILF_make_a_reloc PARAMS ((pe_ILF_vars *, bfd_vm
static void pe_ILF_make_a_symbol PARAMS ((pe_ILF_vars *, const char *, const char *, asection_ptr, flagword));
static void pe_ILF_save_relocs PARAMS ((pe_ILF_vars *, asection_ptr));
static void pe_ILF_make_a_symbol_reloc PARAMS ((pe_ILF_vars *, bfd_vma, bfd_reloc_code_real_type, struct symbol_cache_entry **, unsigned int));
-static boolean pe_ILF_build_a_bfd PARAMS ((bfd *, unsigned short, bfd_byte *, bfd_byte *, unsigned int, unsigned int));
+static boolean pe_ILF_build_a_bfd PARAMS ((bfd *, unsigned int, bfd_byte *, bfd_byte *, unsigned int, unsigned int));
static const bfd_target * pe_ILF_object_p PARAMS ((bfd *));
static const bfd_target * pe_bfd_object_p PARAMS ((bfd *));
#endif /* COFF_IMAGE_WITH_PE */
@@ -156,14 +156,13 @@ coff_swap_reloc_in (abfd, src, dst)
RELOC *reloc_src = (RELOC *) src;
struct internal_reloc *reloc_dst = (struct internal_reloc *) dst;
- reloc_dst->r_vaddr = bfd_h_get_32(abfd, (bfd_byte *)reloc_src->r_vaddr);
- reloc_dst->r_symndx = bfd_h_get_signed_32(abfd, (bfd_byte *) reloc_src->r_symndx);
+ reloc_dst->r_vaddr = H_GET_32 (abfd, reloc_src->r_vaddr);
+ reloc_dst->r_symndx = H_GET_S32 (abfd, reloc_src->r_symndx);
- reloc_dst->r_type = bfd_h_get_16(abfd, (bfd_byte *) reloc_src->r_type);
+ reloc_dst->r_type = H_GET_16 (abfd, reloc_src->r_type);
#ifdef SWAP_IN_RELOC_OFFSET
- reloc_dst->r_offset = SWAP_IN_RELOC_OFFSET(abfd,
- (bfd_byte *) reloc_src->r_offset);
+ reloc_dst->r_offset = SWAP_IN_RELOC_OFFSET (abfd, reloc_src->r_offset);
#endif
}
@@ -175,19 +174,16 @@ coff_swap_reloc_out (abfd, src, dst)
{
struct internal_reloc *reloc_src = (struct internal_reloc *)src;
struct external_reloc *reloc_dst = (struct external_reloc *)dst;
- bfd_h_put_32(abfd, reloc_src->r_vaddr, (bfd_byte *) reloc_dst->r_vaddr);
- bfd_h_put_32(abfd, reloc_src->r_symndx, (bfd_byte *) reloc_dst->r_symndx);
+ H_PUT_32 (abfd, reloc_src->r_vaddr, reloc_dst->r_vaddr);
+ H_PUT_32 (abfd, reloc_src->r_symndx, reloc_dst->r_symndx);
- bfd_h_put_16(abfd, reloc_src->r_type, (bfd_byte *)
- reloc_dst->r_type);
+ H_PUT_16 (abfd, reloc_src->r_type, reloc_dst->r_type);
#ifdef SWAP_OUT_RELOC_OFFSET
- SWAP_OUT_RELOC_OFFSET(abfd,
- reloc_src->r_offset,
- (bfd_byte *) reloc_dst->r_offset);
+ SWAP_OUT_RELOC_OFFSET (abfd, reloc_src->r_offset, reloc_dst->r_offset);
#endif
#ifdef SWAP_OUT_RELOC_EXTRA
- SWAP_OUT_RELOC_EXTRA(abfd,reloc_src, reloc_dst);
+ SWAP_OUT_RELOC_EXTRA(abfd, reloc_src, reloc_dst);
#endif
return RELSZ;
}
@@ -201,13 +197,13 @@ coff_swap_filehdr_in (abfd, src, dst)
{
FILHDR *filehdr_src = (FILHDR *) src;
struct internal_filehdr *filehdr_dst = (struct internal_filehdr *) dst;
- filehdr_dst->f_magic = bfd_h_get_16(abfd, (bfd_byte *) filehdr_src->f_magic);
- filehdr_dst->f_nscns = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_nscns);
- filehdr_dst->f_timdat = bfd_h_get_32(abfd, (bfd_byte *)filehdr_src-> f_timdat);
+ filehdr_dst->f_magic = H_GET_16 (abfd, filehdr_src->f_magic);
+ filehdr_dst->f_nscns = H_GET_16 (abfd, filehdr_src-> f_nscns);
+ filehdr_dst->f_timdat = H_GET_32 (abfd, filehdr_src-> f_timdat);
- filehdr_dst->f_nsyms = bfd_h_get_32(abfd, (bfd_byte *)filehdr_src-> f_nsyms);
- filehdr_dst->f_flags = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_flags);
- filehdr_dst->f_symptr = bfd_h_get_32 (abfd, (bfd_byte *) filehdr_src->f_symptr);
+ filehdr_dst->f_nsyms = H_GET_32 (abfd, filehdr_src-> f_nsyms);
+ filehdr_dst->f_flags = H_GET_16 (abfd, filehdr_src-> f_flags);
+ filehdr_dst->f_symptr = H_GET_32 (abfd, filehdr_src->f_symptr);
/* Other people's tools sometimes generate headers with an nsyms but
a zero symptr. */
@@ -217,8 +213,7 @@ coff_swap_filehdr_in (abfd, src, dst)
filehdr_dst->f_flags |= F_LSYMS;
}
- filehdr_dst->f_opthdr = bfd_h_get_16(abfd,
- (bfd_byte *)filehdr_src-> f_opthdr);
+ filehdr_dst->f_opthdr = H_GET_16 (abfd, filehdr_src-> f_opthdr);
}
#ifdef COFF_IMAGE_WITH_PE
@@ -237,33 +232,24 @@ coff_swap_scnhdr_in (abfd, ext, in)
struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
memcpy(scnhdr_int->s_name, scnhdr_ext->s_name, sizeof (scnhdr_int->s_name));
- scnhdr_int->s_vaddr =
- GET_SCNHDR_VADDR (abfd, (bfd_byte *) scnhdr_ext->s_vaddr);
- scnhdr_int->s_paddr =
- GET_SCNHDR_PADDR (abfd, (bfd_byte *) scnhdr_ext->s_paddr);
- scnhdr_int->s_size =
- GET_SCNHDR_SIZE (abfd, (bfd_byte *) scnhdr_ext->s_size);
- scnhdr_int->s_scnptr =
- GET_SCNHDR_SCNPTR (abfd, (bfd_byte *) scnhdr_ext->s_scnptr);
- scnhdr_int->s_relptr =
- GET_SCNHDR_RELPTR (abfd, (bfd_byte *) scnhdr_ext->s_relptr);
- scnhdr_int->s_lnnoptr =
- GET_SCNHDR_LNNOPTR (abfd, (bfd_byte *) scnhdr_ext->s_lnnoptr);
- scnhdr_int->s_flags = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_flags);
+ scnhdr_int->s_vaddr = GET_SCNHDR_VADDR (abfd, scnhdr_ext->s_vaddr);
+ scnhdr_int->s_paddr = GET_SCNHDR_PADDR (abfd, scnhdr_ext->s_paddr);
+ scnhdr_int->s_size = GET_SCNHDR_SIZE (abfd, scnhdr_ext->s_size);
+ scnhdr_int->s_scnptr = GET_SCNHDR_SCNPTR (abfd, scnhdr_ext->s_scnptr);
+ scnhdr_int->s_relptr = GET_SCNHDR_RELPTR (abfd, scnhdr_ext->s_relptr);
+ scnhdr_int->s_lnnoptr = GET_SCNHDR_LNNOPTR (abfd, scnhdr_ext->s_lnnoptr);
+ scnhdr_int->s_flags = H_GET_32 (abfd, scnhdr_ext->s_flags);
/* MS handles overflow of line numbers by carrying into the reloc
field (it appears). Since it's supposed to be zero for PE
*IMAGE* format, that's safe. This is still a bit iffy. */
#ifdef COFF_IMAGE_WITH_PE
- scnhdr_int->s_nlnno =
- (bfd_h_get_16 (abfd, (bfd_byte *) scnhdr_ext->s_nlnno)
- + (bfd_h_get_16 (abfd, (bfd_byte *) scnhdr_ext->s_nreloc) << 16));
+ scnhdr_int->s_nlnno = (H_GET_16 (abfd, scnhdr_ext->s_nlnno)
+ + (H_GET_16 (abfd, scnhdr_ext->s_nreloc) << 16));
scnhdr_int->s_nreloc = 0;
#else
- scnhdr_int->s_nreloc = bfd_h_get_16 (abfd,
- (bfd_byte *) scnhdr_ext->s_nreloc);
- scnhdr_int->s_nlnno = bfd_h_get_16 (abfd,
- (bfd_byte *) scnhdr_ext->s_nlnno);
+ scnhdr_int->s_nreloc = H_GET_16 (abfd, scnhdr_ext->s_nreloc);
+ scnhdr_int->s_nlnno = H_GET_16 (abfd, scnhdr_ext->s_nlnno);
#endif
if (scnhdr_int->s_vaddr != 0)
@@ -292,8 +278,9 @@ pe_mkobject (abfd)
bfd * abfd;
{
pe_data_type *pe;
- abfd->tdata.pe_obj_data =
- (struct pe_tdata *) bfd_zalloc (abfd, sizeof (pe_data_type));
+ bfd_size_type amt = sizeof (pe_data_type);
+
+ abfd->tdata.pe_obj_data = (struct pe_tdata *) bfd_zalloc (abfd, amt);
if (abfd->tdata.pe_obj_data == 0)
return false;
@@ -541,7 +528,7 @@ pe_ILF_save_relocs (pe_ILF_vars * vars,
vars->int_reltab += vars->relcount;
vars->relcount = 0;
- BFD_ASSERT ((bfd_byte *)vars->int_reltab < (bfd_byte *)vars->string_table);
+ BFD_ASSERT ((bfd_byte *) vars->int_reltab < (bfd_byte *) vars->string_table);
}
/* Create a global symbol and add it to the relevant tables. */
@@ -587,8 +574,9 @@ pe_ILF_make_a_symbol (pe_ILF_vars * vars,
section = (asection_ptr) & bfd_und_section;
/* Initialise the external symbol. */
- bfd_h_put_32 (vars->abfd, vars->string_ptr - vars->string_table, (bfd_byte *) esym->e.e.e_offset);
- bfd_h_put_16 (vars->abfd, section->target_index, (bfd_byte *) esym->e_scnum);
+ H_PUT_32 (vars->abfd, vars->string_ptr - vars->string_table,
+ esym->e.e.e_offset);
+ H_PUT_16 (vars->abfd, section->target_index, esym->e_scnum);
esym->e_sclass[0] = sclass;
/* The following initialisations are unnecessary - the memory is
@@ -666,7 +654,7 @@ pe_ILF_make_a_section (pe_ILF_vars * vars,
/* Set the section size and contents. The actual
contents are filled in by our parent. */
- bfd_set_section_size (vars->abfd, sec, size);
+ bfd_set_section_size (vars->abfd, sec, (bfd_size_type) size);
sec->contents = vars->data;
sec->target_index = vars->sec_index ++;
@@ -767,7 +755,7 @@ static jump_table jtab[] =
/* Build a full BFD from the information supplied in a ILF object. */
static boolean
pe_ILF_build_a_bfd (bfd * abfd,
- unsigned short magic,
+ unsigned int magic,
bfd_byte * symbol_name,
bfd_byte * source_dll,
unsigned int ordinal,
@@ -795,12 +783,12 @@ pe_ILF_build_a_bfd (bfd * abfd,
case IMPORT_CONST:
/* XXX code yet to be written. */
_bfd_error_handler (_("%s: Unhandled import type; %x"),
- bfd_get_filename (abfd), import_type);
+ bfd_archive_filename (abfd), import_type);
return false;
default:
_bfd_error_handler (_("%s: Unrecognised import type; %x"),
- bfd_get_filename (abfd), import_type);
+ bfd_archive_filename (abfd), import_type);
return false;
}
@@ -814,7 +802,7 @@ pe_ILF_build_a_bfd (bfd * abfd,
default:
_bfd_error_handler (_("%s: Unrecognised import name type; %x"),
- bfd_get_filename (abfd), import_name_type);
+ bfd_archive_filename (abfd), import_name_type);
return false;
}
@@ -825,7 +813,7 @@ pe_ILF_build_a_bfd (bfd * abfd,
We are going to construct the contents of the BFD in memory,
so allocate all the space that we will need right now. */
- ptr = bfd_zalloc (abfd, ILF_DATA_SIZE);
+ ptr = bfd_zalloc (abfd, (bfd_size_type) ILF_DATA_SIZE);
if (ptr == NULL)
return false;
@@ -933,11 +921,11 @@ pe_ILF_build_a_bfd (bfd * abfd,
if (import_name_type != IMPORT_ORDINAL)
{
- pe_ILF_make_a_reloc (& vars, 0, BFD_RELOC_RVA, id6);
- pe_ILF_save_relocs (& vars, id4);
+ pe_ILF_make_a_reloc (&vars, (bfd_vma) 0, BFD_RELOC_RVA, id6);
+ pe_ILF_save_relocs (&vars, id4);
- pe_ILF_make_a_reloc (& vars, 0, BFD_RELOC_RVA, id6);
- pe_ILF_save_relocs (& vars, id5);
+ pe_ILF_make_a_reloc (&vars, (bfd_vma) 0, BFD_RELOC_RVA, id6);
+ pe_ILF_save_relocs (&vars, id5);
}
/* Create extra sections depending upon the type of import we are dealing with. */
@@ -976,16 +964,19 @@ pe_ILF_build_a_bfd (bfd * abfd,
#ifdef MIPS_ARCH_MAGIC_WINCE
if (magic == MIPS_ARCH_MAGIC_WINCE)
{
- pe_ILF_make_a_symbol_reloc (& vars, 0, BFD_RELOC_HI16_S,
- (struct symbol_cache_entry **) imp_sym, imp_index);
- pe_ILF_make_a_reloc (& vars, 0, BFD_RELOC_LO16, text);
- pe_ILF_make_a_symbol_reloc (& vars, 4, BFD_RELOC_LO16,
- (struct symbol_cache_entry **) imp_sym, imp_index);
+ pe_ILF_make_a_symbol_reloc (&vars, (bfd_vma) 0, BFD_RELOC_HI16_S,
+ (struct symbol_cache_entry **) imp_sym,
+ imp_index);
+ pe_ILF_make_a_reloc (&vars, (bfd_vma) 0, BFD_RELOC_LO16, text);
+ pe_ILF_make_a_symbol_reloc (&vars, (bfd_vma) 4, BFD_RELOC_LO16,
+ (struct symbol_cache_entry **) imp_sym,
+ imp_index);
}
else
#endif
- pe_ILF_make_a_symbol_reloc (& vars, jtab[i].offset, BFD_RELOC_32,
- (asymbol **) imp_sym, imp_index);
+ pe_ILF_make_a_symbol_reloc (&vars, (bfd_vma) jtab[i].offset,
+ BFD_RELOC_32, (asymbol **) imp_sym,
+ imp_index);
pe_ILF_save_relocs (& vars, text);
break;
@@ -1006,7 +997,7 @@ pe_ILF_build_a_bfd (bfd * abfd,
internal_f.f_nsyms = 0;
internal_f.f_flags = F_AR32WR | F_LNNO; /* XXX is this correct ? */
- if ( ! bfd_set_start_address (abfd, 0)
+ if ( ! bfd_set_start_address (abfd, (bfd_vma) 0)
|| ! bfd_coff_set_arch_mach_hook (abfd, & internal_f))
return false;
@@ -1031,8 +1022,6 @@ pe_ILF_build_a_bfd (bfd * abfd,
/* Now create a symbol describing the imported value. */
switch (import_type)
{
- bfd_byte * ptr;
-
case IMPORT_CODE:
pe_ILF_make_a_symbol (& vars, "", symbol_name, text,
BSF_NOT_AT_END | BSF_FUNCTION);
@@ -1087,23 +1076,23 @@ pe_ILF_object_p (bfd * abfd)
bfd_byte * symbol_name;
bfd_byte * source_dll;
unsigned int machine;
- unsigned long size;
+ bfd_size_type size;
unsigned int ordinal;
unsigned int types;
- unsigned short magic;
+ unsigned int magic;
/* Upon entry the first four buyes of the ILF header have
already been read. Now read the rest of the header. */
- if (bfd_read (buffer, 1, 16, abfd) != 16)
+ if (bfd_bread (buffer, (bfd_size_type) 16, abfd) != 16)
return NULL;
ptr = buffer;
/* We do not bother to check the version number.
- version = bfd_h_get_16 (abfd, ptr); */
+ version = H_GET_16 (abfd, ptr); */
ptr += 2;
- machine = bfd_h_get_16 (abfd, ptr);
+ machine = H_GET_16 (abfd, ptr);
ptr += 2;
/* Check that the machine type is recognised. */
@@ -1171,7 +1160,7 @@ pe_ILF_object_p (bfd * abfd)
_bfd_error_handler
(
_("%s: Unrecognised machine type (0x%x) in Import Library Format archive"),
- bfd_get_filename (abfd), machine);
+ bfd_archive_filename (abfd), machine);
bfd_set_error (bfd_error_malformed_archive);
return NULL;
@@ -1183,33 +1172,33 @@ _("%s: Unrecognised machine type (0x%x) in Import Library Format archive"),
_bfd_error_handler
(
_("%s: Recognised but unhandled machine type (0x%x) in Import Library Format archive"),
- bfd_get_filename (abfd), machine);
+ bfd_archive_filename (abfd), machine);
bfd_set_error (bfd_error_wrong_format);
return NULL;
}
/* We do not bother to check the date.
- date = bfd_h_get_32 (abfd, ptr); */
+ date = H_GET_32 (abfd, ptr); */
ptr += 4;
- size = bfd_h_get_32 (abfd, ptr);
+ size = H_GET_32 (abfd, ptr);
ptr += 4;
if (size == 0)
{
_bfd_error_handler
(_("%s: size field is zero in Import Library Format header"),
- bfd_get_filename (abfd));
+ bfd_archive_filename (abfd));
bfd_set_error (bfd_error_malformed_archive);
return NULL;
}
- ordinal = bfd_h_get_16 (abfd, ptr);
+ ordinal = H_GET_16 (abfd, ptr);
ptr += 2;
- types = bfd_h_get_16 (abfd, ptr);
+ types = H_GET_16 (abfd, ptr);
/* ptr += 2; */
/* Now read in the two strings that follow. */
@@ -1217,7 +1206,7 @@ _("%s: Recognised but unhandled machine type (0x%x) in Import Library Format arc
if (ptr == NULL)
return NULL;
- if (bfd_read (ptr, 1, size, abfd) != size)
+ if (bfd_bread (ptr, size, abfd) != size)
return NULL;
symbol_name = ptr;
@@ -1228,7 +1217,7 @@ _("%s: Recognised but unhandled machine type (0x%x) in Import Library Format arc
{
_bfd_error_handler
(_("%s: string not null terminated in ILF object file."),
- bfd_get_filename (abfd));
+ bfd_archive_filename (abfd));
bfd_set_error (bfd_error_malformed_archive);
return NULL;
@@ -1251,19 +1240,19 @@ pe_bfd_object_p (bfd * abfd)
file_ptr offset;
/* Detect if this a Microsoft Import Library Format element. */
- if (bfd_seek (abfd, 0x00, SEEK_SET) != 0
- || bfd_read (buffer, 1, 4, abfd) != 4)
+ if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
+ || bfd_bread (buffer, (bfd_size_type) 4, abfd) != 4)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
return NULL;
}
- if (bfd_h_get_32 (abfd, buffer) == 0xffff0000)
+ if (H_GET_32 (abfd, buffer) == 0xffff0000)
return pe_ILF_object_p (abfd);
- if (bfd_seek (abfd, 0x00, SEEK_SET) != 0
- || bfd_read (&dos_hdr, 1, sizeof (dos_hdr), abfd)
+ if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
+ || bfd_bread (&dos_hdr, (bfd_size_type) sizeof (dos_hdr), abfd)
!= sizeof (dos_hdr))
{
if (bfd_get_error () != bfd_error_system_call)
@@ -1281,24 +1270,23 @@ pe_bfd_object_p (bfd * abfd)
correctly for a PEI file, check the e_magic number here, and, if
it doesn't match, clobber the f_magic number so that we don't get
a false match. */
- if (bfd_h_get_16 (abfd, (bfd_byte *) dos_hdr.e_magic) != DOSMAGIC)
+ if (H_GET_16 (abfd, dos_hdr.e_magic) != DOSMAGIC)
{
bfd_set_error (bfd_error_wrong_format);
return NULL;
}
- offset = bfd_h_get_32 (abfd, (bfd_byte *) dos_hdr.e_lfanew);
- if (bfd_seek (abfd, (file_ptr) offset, SEEK_SET) != 0
- || bfd_read (&image_hdr, 1, sizeof (image_hdr), abfd)
- != sizeof (image_hdr))
+ offset = H_GET_32 (abfd, dos_hdr.e_lfanew);
+ if (bfd_seek (abfd, offset, SEEK_SET) != 0
+ || (bfd_bread (&image_hdr, (bfd_size_type) sizeof (image_hdr), abfd)
+ != sizeof (image_hdr)))
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
return NULL;
}
- if (bfd_h_get_32 (abfd, (bfd_byte *) image_hdr.nt_signature)
- != 0x4550)
+ if (H_GET_32 (abfd, image_hdr.nt_signature) != 0x4550)
{
bfd_set_error (bfd_error_wrong_format);
return NULL;
@@ -1307,10 +1295,7 @@ pe_bfd_object_p (bfd * abfd)
/* Here is the hack. coff_object_p wants to read filhsz bytes to
pick up the COFF header for PE, see "struct external_PEI_filehdr"
in include/coff/pe.h. We adjust so that that will work. */
- if (bfd_seek (abfd,
- (file_ptr) (offset - sizeof (dos_hdr)),
- SEEK_SET)
- != 0)
+ if (bfd_seek (abfd, (file_ptr) (offset - sizeof (dos_hdr)), SEEK_SET) != 0)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
diff --git a/contrib/binutils/bfd/sparclinux.c b/contrib/binutils/bfd/sparclinux.c
index 28ff8c8..a8b4792 100644
--- a/contrib/binutils/bfd/sparclinux.c
+++ b/contrib/binutils/bfd/sparclinux.c
@@ -1,5 +1,5 @@
/* BFD back-end for linux flavored sparc a.out binaries.
- Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2001
+ Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -439,6 +439,9 @@ linux_tally_symbols (h, data)
struct linux_link_hash_entry *h1, *h2;
boolean exists;
+ if (h->root.root.type == bfd_link_hash_warning)
+ h = (struct linux_link_hash_entry *) h->root.root.u.i.link;
+
if (h->root.root.type == bfd_link_hash_undefined
&& strncmp (h->root.root.root.string, NEEDS_SHRLIB,
sizeof NEEDS_SHRLIB - 1) == 0)
diff --git a/contrib/binutils/bfd/srec.c b/contrib/binutils/bfd/srec.c
index 5dfad88..41d9871 100644
--- a/contrib/binutils/bfd/srec.c
+++ b/contrib/binutils/bfd/srec.c
@@ -167,13 +167,13 @@ srec_init ()
}
}
-/* The maximum number of bytes on a line is FF. */
+/* The maximum number of address+data+crc bytes on a line is FF. */
#define MAXCHUNK 0xff
/* Default size for a CHUNK. */
#define DEFAULT_CHUNK 16
-/* The number of bytes we actually fit onto a line on output.
+/* The number of data bytes we actually fit onto a line on output.
This variable can be modified by objcopy's --srec-len parameter.
For a 0x75 byte record you should set --srec-len=0x70. */
unsigned int Chunk = DEFAULT_CHUNK;
@@ -936,7 +936,7 @@ srec_write_record (abfd, type, address, data, end)
const bfd_byte *data;
const bfd_byte *end;
{
- char buffer[MAXCHUNK];
+ char buffer[2 * MAXCHUNK + 6];
unsigned int check_sum = 0;
const bfd_byte *src = data;
char *dst = buffer;
@@ -994,15 +994,14 @@ static boolean
srec_write_header (abfd)
bfd *abfd;
{
- bfd_byte buffer[MAXCHUNK];
- bfd_byte *dst = buffer;
- unsigned int i;
+ unsigned int len = strlen (abfd->filename);
/* I'll put an arbitary 40 char limit on header size. */
- for (i = 0; i < 40 && abfd->filename[i]; i++)
- *dst++ = abfd->filename[i];
+ if (len > 40)
+ len = 40;
- return srec_write_record (abfd, 0, (bfd_vma) 0, buffer, dst);
+ return srec_write_record (abfd, 0, (bfd_vma) 0,
+ abfd->filename, abfd->filename + len);
}
static boolean
@@ -1014,6 +1013,17 @@ srec_write_section (abfd, tdata, list)
unsigned int octets_written = 0;
bfd_byte *location = list->data;
+ /* Validate number of data bytes to write. The srec length byte
+ counts the address, data and crc bytes. S1 (tdata->type == 1)
+ records have two address bytes, S2 (tdata->type == 2) records
+ have three, and S3 (tdata->type == 3) records have four.
+ The total length can't exceed 255, and a zero data length will
+ spin for a long time. */
+ if (Chunk == 0)
+ Chunk = 1;
+ else if (Chunk > MAXCHUNK - tdata->type - 2)
+ Chunk = MAXCHUNK - tdata->type - 2;
+
while (octets_written < list->size)
{
bfd_vma address;
@@ -1043,17 +1053,14 @@ srec_write_terminator (abfd, tdata)
bfd *abfd;
tdata_type *tdata;
{
- bfd_byte buffer[2];
-
return srec_write_record (abfd, 10 - tdata->type,
- abfd->start_address, buffer, buffer);
+ abfd->start_address, NULL, NULL);
}
static boolean
srec_write_symbols (abfd)
bfd *abfd;
{
- char buffer[MAXCHUNK];
/* Dump out the symbols of a bfd. */
int i;
int count = bfd_get_symcount (abfd);
@@ -1062,10 +1069,10 @@ srec_write_symbols (abfd)
{
bfd_size_type len;
asymbol **table = bfd_get_outsymbols (abfd);
- sprintf (buffer, "$$ %s\r\n", abfd->filename);
-
- len = strlen (buffer);
- if (bfd_bwrite (buffer, len, abfd) != len)
+ len = strlen (abfd->filename);
+ if (bfd_bwrite ("$$ ", (bfd_size_type) 3, abfd) != 3
+ || bfd_bwrite (abfd->filename, len, abfd) != len
+ || bfd_bwrite ("\r\n", (bfd_size_type) 2, abfd) != 2)
return false;
for (i = 0; i < count; i++)
@@ -1075,23 +1082,29 @@ srec_write_symbols (abfd)
&& (s->flags & BSF_DEBUGGING) == 0)
{
/* Just dump out non debug symbols. */
- char buf2[40], *p;
+ char buf[42], *p;
+
+ len = strlen (s->name);
+ if (bfd_bwrite (" ", (bfd_size_type) 2, abfd) != 2
+ || bfd_bwrite (s->name, len, abfd) != len)
+ return false;
- sprintf_vma (buf2,
- s->value + s->section->output_section->lma
- + s->section->output_offset);
- p = buf2;
+ sprintf_vma (buf + 1, (s->value
+ + s->section->output_section->lma
+ + s->section->output_offset));
+ p = buf + 1;
while (p[0] == '0' && p[1] != 0)
p++;
- sprintf (buffer, " %s $%s\r\n", s->name, p);
- len = strlen (buffer);
- if (bfd_bwrite (buffer, len, abfd) != len)
+ len = strlen (p);
+ p[len] = '\r';
+ p[len + 1] = '\n';
+ *--p = ' ';
+ len += 3;
+ if (bfd_bwrite (p, len, abfd) != len)
return false;
}
}
- sprintf (buffer, "$$ \r\n");
- len = strlen (buffer);
- if (bfd_bwrite (buffer, len, abfd) != len)
+ if (bfd_bwrite ("$$ \r\n", (bfd_size_type) 5, abfd) != 5)
return false;
}
diff --git a/contrib/binutils/bfd/sunos.c b/contrib/binutils/bfd/sunos.c
index 30fd019..cb23fe1 100644
--- a/contrib/binutils/bfd/sunos.c
+++ b/contrib/binutils/bfd/sunos.c
@@ -2052,6 +2052,9 @@ sunos_scan_dynamic_symbol (h, data)
{
struct bfd_link_info *info = (struct bfd_link_info *) data;
+ if (h->root.root.type == bfd_link_hash_warning)
+ h = (struct sunos_link_hash_entry *) h->root.root.u.i.link;
+
/* Set the written flag for symbols we do not want to write out as
part of the regular symbol table. This is all symbols which are
not defined in a regular object file. For some reason symbols
diff --git a/contrib/binutils/bfd/syms.c b/contrib/binutils/bfd/syms.c
index b25306e..4309c0d 100644
--- a/contrib/binutils/bfd/syms.c
+++ b/contrib/binutils/bfd/syms.c
@@ -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}
};
@@ -1236,9 +1238,11 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
for (; stab < (indexentry+1)->stab; stab += STABSIZE)
{
- boolean done;
+ boolean done, saw_line, saw_func;
bfd_vma val;
+ saw_line = false;
+ saw_func = false;
done = false;
switch (stab[TYPEOFF])
@@ -1259,7 +1263,11 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
/* A line number. The value is relative to the start of the
current function. */
val = indexentry->val + bfd_get_32 (abfd, stab + VALOFF);
- if (val <= offset)
+ /* If this line starts before our desired offset, or if it's
+ the first line we've been able to find, use it. The
+ !saw_line check works around a bug in GCC 2.95.3, which emits
+ the first N_SLINE late. */
+ if (!saw_line || val <= offset)
{
*pline = bfd_get_16 (abfd, stab + DESCOFF);
@@ -1272,11 +1280,14 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
}
if (val > offset)
done = true;
+ saw_line = true;
break;
case N_FUN:
case N_SO:
- done = true;
+ if (saw_func || saw_line)
+ done = true;
+ saw_func = true;
break;
}
diff --git a/contrib/binutils/bfd/version.h b/contrib/binutils/bfd/version.h
index 959429c..6af6920 100644
--- a/contrib/binutils/bfd/version.h
+++ b/contrib/binutils/bfd/version.h
@@ -1 +1 @@
-#define BFD_VERSION_DATE 20020209
+#define BFD_VERSION_DATE 20020412
diff --git a/contrib/binutils/bfd/xcoff-target.h b/contrib/binutils/bfd/xcoff-target.h
index a3cc0c0..0787b8d 100644
--- a/contrib/binutils/bfd/xcoff-target.h
+++ b/contrib/binutils/bfd/xcoff-target.h
@@ -97,6 +97,7 @@ extern int lynx_core_file_failing_signal PARAMS ((bfd *abfd));
coff_bfd_get_relocated_section_contents
#define _bfd_xcoff_bfd_relax_section coff_bfd_relax_section
#define _bfd_xcoff_bfd_gc_sections coff_bfd_gc_sections
+#define _bfd_xcoff_bfd_merge_sections coff_bfd_merge_sections
#define _bfd_xcoff_bfd_link_split_section coff_bfd_link_split_section
/* XCOFF archives do not have anything which corresponds to an
diff --git a/contrib/binutils/bfd/xcofflink.c b/contrib/binutils/bfd/xcofflink.c
index 5580e9b..a939b5c 100644
--- a/contrib/binutils/bfd/xcofflink.c
+++ b/contrib/binutils/bfd/xcofflink.c
@@ -1,5 +1,5 @@
/* POWER/PowerPC XCOFF linker support.
- Copyright 1995, 1996, 1997, 1998, 1999, 2000
+ Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com>, Cygnus Support.
@@ -24,189 +24,23 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfdlink.h"
#include "libbfd.h"
#include "coff/internal.h"
+#include "coff/xcoff.h"
#include "libcoff.h"
+#include "libxcoff.h"
/* This file holds the XCOFF linker code. */
#define STRING_SIZE_SIZE (4)
-/* Get the XCOFF hash table entries for a BFD. */
-#define obj_xcoff_sym_hashes(bfd) \
- ((struct xcoff_link_hash_entry **) obj_coff_sym_hashes (bfd))
-
-/* XCOFF relocation types. These probably belong in a header file
- somewhere. The relocations are described in the function
- _bfd_ppc_xcoff_relocate_section in this file. */
-
-#define R_POS (0x00)
-#define R_NEG (0x01)
-#define R_REL (0x02)
-#define R_TOC (0x03)
-#define R_RTB (0x04)
-#define R_GL (0x05)
-#define R_TCL (0x06)
-#define R_BA (0x08)
-#define R_BR (0x0a)
-#define R_RL (0x0c)
-#define R_RLA (0x0d)
-#define R_REF (0x0f)
-#define R_TRL (0x12)
-#define R_TRLA (0x13)
-#define R_RRTBI (0x14)
-#define R_RRTBA (0x15)
-#define R_CAI (0x16)
-#define R_CREL (0x17)
-#define R_RBA (0x18)
-#define R_RBAC (0x19)
-#define R_RBR (0x1a)
-#define R_RBRC (0x1b)
-
-/* The first word of global linkage code. This must be modified by
- filling in the correct TOC offset. */
-
-#define XCOFF_GLINK_FIRST (0x81820000) /* lwz r12,0(r2) */
-
-/* The remaining words of global linkage code. */
-
-static unsigned long xcoff_glink_code[] = {
- 0x90410014, /* stw r2,20(r1) */
- 0x800c0000, /* lwz r0,0(r12) */
- 0x804c0004, /* lwz r2,4(r12) */
- 0x7c0903a6, /* mtctr r0 */
- 0x4e800420, /* bctr */
- 0x0, /* start of traceback table */
- 0x000c8000, /* traceback table */
- 0x0 /* traceback table */
-};
-
-#define XCOFF_GLINK_SIZE \
- (((sizeof xcoff_glink_code / sizeof xcoff_glink_code[0]) * 4) + 4)
-
/* We reuse the SEC_ROM flag as a mark flag for garbage collection.
This flag will only be used on input sections. */
#define SEC_MARK (SEC_ROM)
-/* The ldhdr structure. This appears at the start of the .loader
- section. */
-
-struct internal_ldhdr {
- /* The version number: currently always 1. */
- unsigned long l_version;
- /* The number of symbol table entries. */
- bfd_size_type l_nsyms;
- /* The number of relocation table entries. */
- bfd_size_type l_nreloc;
- /* The length of the import file string table. */
- bfd_size_type l_istlen;
- /* The number of import files. */
- bfd_size_type l_nimpid;
- /* The offset from the start of the .loader section to the first
- entry in the import file table. */
- bfd_size_type l_impoff;
- /* The length of the string table. */
- bfd_size_type l_stlen;
- /* The offset from the start of the .loader section to the first
- entry in the string table. */
- bfd_size_type l_stoff;
-};
-
-struct external_ldhdr {
- bfd_byte l_version[4];
- bfd_byte l_nsyms[4];
- bfd_byte l_nreloc[4];
- bfd_byte l_istlen[4];
- bfd_byte l_nimpid[4];
- bfd_byte l_impoff[4];
- bfd_byte l_stlen[4];
- bfd_byte l_stoff[4];
-};
-
-#define LDHDRSZ (8 * 4)
-
-/* The ldsym structure. This is used to represent a symbol in the
- .loader section. */
-
-struct internal_ldsym {
- union {
- /* The symbol name if <= SYMNMLEN characters. */
- char _l_name[SYMNMLEN];
- struct {
- /* Zero if the symbol name is more than SYMNMLEN characters. */
- long _l_zeroes;
- /* The offset in the string table if the symbol name is more
- than SYMNMLEN characters. */
- long _l_offset;
- } _l_l;
- } _l;
- /* The symbol value. */
- bfd_vma l_value;
- /* The symbol section number. */
- short l_scnum;
- /* The symbol type and flags. */
- char l_smtype;
- /* The symbol storage class. */
- char l_smclas;
- /* The import file ID. */
- bfd_size_type l_ifile;
- /* Offset to the parameter type check string. */
- bfd_size_type l_parm;
-};
-
-struct external_ldsym {
- union {
- bfd_byte _l_name[SYMNMLEN];
- struct {
- bfd_byte _l_zeroes[4];
- bfd_byte _l_offset[4];
- } _l_l;
- } _l;
- bfd_byte l_value[4];
- bfd_byte l_scnum[2];
- bfd_byte l_smtype[1];
- bfd_byte l_smclas[1];
- bfd_byte l_ifile[4];
- bfd_byte l_parm[4];
-};
-
-#define LDSYMSZ (8 + 3 * 4 + 2 + 2)
-
-/* These flags are for the l_smtype field (the lower three bits are an
- XTY_* value). */
-
-/* Imported symbol. */
-#define L_IMPORT (0x40)
-/* Entry point. */
-#define L_ENTRY (0x20)
-/* Exported symbol. */
-#define L_EXPORT (0x10)
-
-/* The ldrel structure. This is used to represent a reloc in the
- .loader section. */
-
-struct internal_ldrel {
- /* The reloc address. */
- bfd_vma l_vaddr;
- /* The symbol table index in the .loader section symbol table. */
- bfd_size_type l_symndx;
- /* The relocation type and size. */
- short l_rtype;
- /* The section number this relocation applies to. */
- short l_rsecnm;
-};
-
-struct external_ldrel {
- bfd_byte l_vaddr[4];
- bfd_byte l_symndx[4];
- bfd_byte l_rtype[2];
- bfd_byte l_rsecnm[2];
-};
-
-#define LDRELSZ (2 * 4 + 2 * 2)
-
/* The list of import files. */
-struct xcoff_import_file {
+struct xcoff_import_file
+{
/* The next entry in the list. */
struct xcoff_import_file *next;
/* The path. */
@@ -217,138 +51,11 @@ struct xcoff_import_file {
const char *member;
};
-/* An entry in the XCOFF linker hash table. */
-
-struct xcoff_link_hash_entry {
- struct bfd_link_hash_entry root;
-
- /* Symbol index in output file. Set to -1 initially. Set to -2 if
- there is a reloc against this symbol. */
- long indx;
-
- /* If we have created a TOC entry for this symbol, this is the .tc
- section which holds it. */
- asection *toc_section;
-
- union {
- /* If we have created a TOC entry (the XCOFF_SET_TOC flag is set),
- this is the offset in toc_section. */
- bfd_vma toc_offset;
- /* If the TOC entry comes from an input file, this is set to the
- symbol index of the C_HIDEXT XMC_TC or XMC_TD symbol. */
- long toc_indx;
- } u;
-
- /* If this symbol is a function entry point which is called, this
- field holds a pointer to the function descriptor. If this symbol
- is a function descriptor, this field holds a pointer to the
- function entry point. */
- struct xcoff_link_hash_entry *descriptor;
-
- /* The .loader symbol table entry, if there is one. */
- struct internal_ldsym *ldsym;
-
- /* If XCOFF_BUILT_LDSYM is set, this is the .loader symbol table
- index. If XCOFF_BUILD_LDSYM is clear, and XCOFF_IMPORT is set,
- this is the l_ifile value. */
- long ldindx;
-
- /* Some linker flags. */
- unsigned short flags;
- /* Symbol is referenced by a regular object. */
-#define XCOFF_REF_REGULAR (01)
- /* Symbol is defined by a regular object. */
-#define XCOFF_DEF_REGULAR (02)
- /* Symbol is defined by a dynamic object. */
-#define XCOFF_DEF_DYNAMIC (04)
- /* Symbol is used in a reloc being copied into the .loader section. */
-#define XCOFF_LDREL (010)
- /* Symbol is the entry point. */
-#define XCOFF_ENTRY (020)
- /* Symbol is called; this is, it appears in a R_BR reloc. */
-#define XCOFF_CALLED (040)
- /* Symbol needs the TOC entry filled in. */
-#define XCOFF_SET_TOC (0100)
- /* Symbol is explicitly imported. */
-#define XCOFF_IMPORT (0200)
- /* Symbol is explicitly exported. */
-#define XCOFF_EXPORT (0400)
- /* Symbol has been processed by xcoff_build_ldsyms. */
-#define XCOFF_BUILT_LDSYM (01000)
- /* Symbol is mentioned by a section which was not garbage collected. */
-#define XCOFF_MARK (02000)
- /* Symbol size is recorded in size_list list from hash table. */
-#define XCOFF_HAS_SIZE (04000)
- /* Symbol is a function descriptor. */
-#define XCOFF_DESCRIPTOR (010000)
- /* Multiple definitions have been for the symbol. */
-#define XCOFF_MULTIPLY_DEFINED (020000)
-
- /* The storage mapping class. */
- unsigned char smclas;
-};
-
-/* The XCOFF linker hash table. */
-
-struct xcoff_link_hash_table {
- struct bfd_link_hash_table root;
-
- /* The .debug string hash table. We need to compute this while
- reading the input files, so that we know how large the .debug
- section will be before we assign section positions. */
- struct bfd_strtab_hash *debug_strtab;
-
- /* The .debug section we will use for the final output. */
- asection *debug_section;
-
- /* The .loader section we will use for the final output. */
- asection *loader_section;
-
- /* A count of non TOC relative relocs which will need to be
- allocated in the .loader section. */
- size_t ldrel_count;
-
- /* The .loader section header. */
- struct internal_ldhdr ldhdr;
-
- /* The .gl section we use to hold global linkage code. */
- asection *linkage_section;
-
- /* The .tc section we use to hold toc entries we build for global
- linkage code. */
- asection *toc_section;
-
- /* The .ds section we use to hold function descriptors which we
- create for exported symbols. */
- asection *descriptor_section;
-
- /* The list of import files. */
- struct xcoff_import_file *imports;
-
- /* Required alignment of sections within the output file. */
- unsigned long file_align;
-
- /* Whether the .text section must be read-only. */
- boolean textro;
-
- /* Whether garbage collection was done. */
- boolean gc;
-
- /* A linked list of symbols for which we have size information. */
- struct xcoff_link_size_list {
- struct xcoff_link_size_list *next;
- struct xcoff_link_hash_entry *h;
- bfd_size_type size;
- } *size_list;
-
- /* Magic sections: _text, _etext, _data, _edata, _end, end. */
- asection *special_sections[6];
-};
-
/* Information we keep for each section in the output file during the
final link phase. */
-struct xcoff_link_section_info {
+struct xcoff_link_section_info
+{
/* The relocs to be output. */
struct internal_reloc *relocs;
/* For each reloc against a global symbol whose index was not known
@@ -367,7 +74,8 @@ struct xcoff_link_section_info {
/* Information that we pass around while doing the final link step. */
-struct xcoff_final_link_info {
+struct xcoff_final_link_info
+{
/* General link information. */
struct bfd_link_info *info;
/* Output BFD. */
@@ -384,9 +92,9 @@ struct xcoff_final_link_info {
/* Symbol index of TOC symbol. */
long toc_symindx;
/* Start of .loader symbols. */
- struct external_ldsym *ldsym;
+ bfd_byte *ldsym;
/* Next .loader reloc to swap out. */
- struct external_ldrel *ldrel;
+ bfd_byte *ldrel;
/* File position of start of line numbers. */
file_ptr line_filepos;
/* Buffer large enough to hold swapped symbols of any input file. */
@@ -405,18 +113,6 @@ struct xcoff_final_link_info {
bfd_byte *external_relocs;
};
-static void xcoff_swap_ldhdr_in
- PARAMS ((bfd *, const struct external_ldhdr *, struct internal_ldhdr *));
-static void xcoff_swap_ldhdr_out
- PARAMS ((bfd *, const struct internal_ldhdr *, struct external_ldhdr *));
-static void xcoff_swap_ldsym_in
- PARAMS ((bfd *, const struct external_ldsym *, struct internal_ldsym *));
-static void xcoff_swap_ldsym_out
- PARAMS ((bfd *, const struct internal_ldsym *, struct external_ldsym *));
-static void xcoff_swap_ldrel_in
- PARAMS ((bfd *, const struct external_ldrel *, struct internal_ldrel *));
-static void xcoff_swap_ldrel_out
- PARAMS ((bfd *, const struct internal_ldrel *, struct external_ldrel *));
static struct bfd_hash_entry *xcoff_link_hash_newfunc
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
static boolean xcoff_get_section_contents PARAMS ((bfd *, asection *));
@@ -451,121 +147,7 @@ static boolean xcoff_reloc_link_order
struct bfd_link_order *));
static int xcoff_sort_relocs PARAMS ((const PTR, const PTR));
-/* Routines to swap information in the XCOFF .loader section. If we
- ever need to write an XCOFF loader, this stuff will need to be
- moved to another file shared by the linker (which XCOFF calls the
- ``binder'') and the loader. */
-
-/* Swap in the ldhdr structure. */
-
-static void
-xcoff_swap_ldhdr_in (abfd, src, dst)
- bfd *abfd;
- const struct external_ldhdr *src;
- struct internal_ldhdr *dst;
-{
- dst->l_version = bfd_get_32 (abfd, src->l_version);
- dst->l_nsyms = bfd_get_32 (abfd, src->l_nsyms);
- dst->l_nreloc = bfd_get_32 (abfd, src->l_nreloc);
- dst->l_istlen = bfd_get_32 (abfd, src->l_istlen);
- dst->l_nimpid = bfd_get_32 (abfd, src->l_nimpid);
- dst->l_impoff = bfd_get_32 (abfd, src->l_impoff);
- dst->l_stlen = bfd_get_32 (abfd, src->l_stlen);
- dst->l_stoff = bfd_get_32 (abfd, src->l_stoff);
-}
-
-/* Swap out the ldhdr structure. */
-
-static void
-xcoff_swap_ldhdr_out (abfd, src, dst)
- bfd *abfd;
- const struct internal_ldhdr *src;
- struct external_ldhdr *dst;
-{
- bfd_put_32 (abfd, src->l_version, dst->l_version);
- bfd_put_32 (abfd, src->l_nsyms, dst->l_nsyms);
- bfd_put_32 (abfd, src->l_nreloc, dst->l_nreloc);
- bfd_put_32 (abfd, src->l_istlen, dst->l_istlen);
- bfd_put_32 (abfd, src->l_nimpid, dst->l_nimpid);
- bfd_put_32 (abfd, src->l_impoff, dst->l_impoff);
- bfd_put_32 (abfd, src->l_stlen, dst->l_stlen);
- bfd_put_32 (abfd, src->l_stoff, dst->l_stoff);
-}
-
-/* Swap in the ldsym structure. */
-
-static void
-xcoff_swap_ldsym_in (abfd, src, dst)
- bfd *abfd;
- const struct external_ldsym *src;
- struct internal_ldsym *dst;
-{
- if (bfd_get_32 (abfd, src->_l._l_l._l_zeroes) != 0)
- memcpy (dst->_l._l_name, src->_l._l_name, SYMNMLEN);
- else
- {
- dst->_l._l_l._l_zeroes = 0;
- dst->_l._l_l._l_offset = bfd_get_32 (abfd, src->_l._l_l._l_offset);
- }
- dst->l_value = bfd_get_32 (abfd, src->l_value);
- dst->l_scnum = bfd_get_16 (abfd, src->l_scnum);
- dst->l_smtype = bfd_get_8 (abfd, src->l_smtype);
- dst->l_smclas = bfd_get_8 (abfd, src->l_smclas);
- dst->l_ifile = bfd_get_32 (abfd, src->l_ifile);
- dst->l_parm = bfd_get_32 (abfd, src->l_parm);
-}
-
-/* Swap out the ldsym structure. */
-
-static void
-xcoff_swap_ldsym_out (abfd, src, dst)
- bfd *abfd;
- const struct internal_ldsym *src;
- struct external_ldsym *dst;
-{
- if (src->_l._l_l._l_zeroes != 0)
- memcpy (dst->_l._l_name, src->_l._l_name, SYMNMLEN);
- else
- {
- bfd_put_32 (abfd, 0, dst->_l._l_l._l_zeroes);
- bfd_put_32 (abfd, src->_l._l_l._l_offset, dst->_l._l_l._l_offset);
- }
- bfd_put_32 (abfd, src->l_value, dst->l_value);
- bfd_put_16 (abfd, src->l_scnum, dst->l_scnum);
- bfd_put_8 (abfd, src->l_smtype, dst->l_smtype);
- bfd_put_8 (abfd, src->l_smclas, dst->l_smclas);
- bfd_put_32 (abfd, src->l_ifile, dst->l_ifile);
- bfd_put_32 (abfd, src->l_parm, dst->l_parm);
-}
-
-/* Swap in the ldrel structure. */
-
-static void
-xcoff_swap_ldrel_in (abfd, src, dst)
- bfd *abfd;
- const struct external_ldrel *src;
- struct internal_ldrel *dst;
-{
- dst->l_vaddr = bfd_get_32 (abfd, src->l_vaddr);
- dst->l_symndx = bfd_get_32 (abfd, src->l_symndx);
- dst->l_rtype = bfd_get_16 (abfd, src->l_rtype);
- dst->l_rsecnm = bfd_get_16 (abfd, src->l_rsecnm);
-}
-/* Swap out the ldrel structure. */
-
-static void
-xcoff_swap_ldrel_out (abfd, src, dst)
- bfd *abfd;
- const struct internal_ldrel *src;
- struct external_ldrel *dst;
-{
- bfd_put_32 (abfd, src->l_vaddr, dst->l_vaddr);
- bfd_put_32 (abfd, src->l_symndx, dst->l_symndx);
- bfd_put_16 (abfd, src->l_rtype, dst->l_rtype);
- bfd_put_16 (abfd, src->l_rsecnm, dst->l_rsecnm);
-}
-
/* Routines to read XCOFF dynamic information. This don't really
belong here, but we already have the ldsym manipulation routines
here. */
@@ -577,18 +159,19 @@ xcoff_get_section_contents (abfd, sec)
bfd *abfd;
asection *sec;
{
+
if (coff_section_data (abfd, sec) == NULL)
{
- sec->used_by_bfd = bfd_zalloc (abfd,
- sizeof (struct coff_section_tdata));
+ bfd_size_type amt = sizeof (struct coff_section_tdata);
+ sec->used_by_bfd = bfd_zalloc (abfd, amt);
if (sec->used_by_bfd == NULL)
return false;
}
if (coff_section_data (abfd, sec)->contents == NULL)
{
- coff_section_data (abfd, sec)->contents =
- (bfd_byte *) bfd_malloc (sec->_raw_size);
+ coff_section_data (abfd, sec)->contents = ((bfd_byte *)
+ bfd_malloc (sec->_raw_size));
if (coff_section_data (abfd, sec)->contents == NULL)
return false;
@@ -628,7 +211,7 @@ _bfd_xcoff_get_dynamic_symtab_upper_bound (abfd)
return -1;
contents = coff_section_data (abfd, lsec)->contents;
- xcoff_swap_ldhdr_in (abfd, (struct external_ldhdr *) contents, &ldhdr);
+ bfd_xcoff_swap_ldhdr_in (abfd, (PTR) contents, &ldhdr);
return (ldhdr.l_nsyms + 1) * sizeof (asymbol *);
}
@@ -644,7 +227,7 @@ _bfd_xcoff_canonicalize_dynamic_symtab (abfd, psyms)
bfd_byte *contents;
struct internal_ldhdr ldhdr;
const char *strings;
- struct external_ldsym *elsym, *elsymend;
+ bfd_byte *elsym, *elsymend;
coff_symbol_type *symbuf;
if ((abfd->flags & DYNAMIC) == 0)
@@ -666,7 +249,7 @@ _bfd_xcoff_canonicalize_dynamic_symtab (abfd, psyms)
coff_section_data (abfd, lsec)->keep_contents = true;
- xcoff_swap_ldhdr_in (abfd, (struct external_ldhdr *) contents, &ldhdr);
+ bfd_xcoff_swap_ldhdr_in (abfd, contents, &ldhdr);
strings = (char *) contents + ldhdr.l_stoff;
@@ -675,13 +258,14 @@ _bfd_xcoff_canonicalize_dynamic_symtab (abfd, psyms)
if (symbuf == NULL)
return -1;
- elsym = (struct external_ldsym *) (contents + LDHDRSZ);
- elsymend = elsym + ldhdr.l_nsyms;
- for (; elsym < elsymend; elsym++, symbuf++, psyms++)
+ elsym = contents + bfd_xcoff_loader_symbol_offset(abfd, &ldhdr);
+
+ elsymend = elsym + ldhdr.l_nsyms * bfd_xcoff_ldsymsz(abfd);
+ for (; elsym < elsymend; elsym += bfd_xcoff_ldsymsz(abfd), symbuf++, psyms++)
{
struct internal_ldsym ldsym;
- xcoff_swap_ldsym_in (abfd, elsym, &ldsym);
+ bfd_xcoff_swap_ldsym_in (abfd, elsym, &ldsym);
symbuf->symbol.the_bfd = abfd;
@@ -689,24 +273,14 @@ _bfd_xcoff_canonicalize_dynamic_symtab (abfd, psyms)
symbuf->symbol.name = strings + ldsym._l._l_l._l_offset;
else
{
- int i;
-
- for (i = 0; i < SYMNMLEN; i++)
- if (ldsym._l._l_name[i] == '\0')
- break;
- if (i < SYMNMLEN)
- symbuf->symbol.name = (char *) elsym->_l._l_name;
- else
- {
- char *c;
-
- c = bfd_alloc (abfd, SYMNMLEN + 1);
- if (c == NULL)
- return -1;
- memcpy (c, ldsym._l._l_name, SYMNMLEN);
- c[SYMNMLEN] = '\0';
- symbuf->symbol.name = c;
- }
+ char *c;
+
+ c = bfd_alloc (abfd, (bfd_size_type) SYMNMLEN + 1);
+ if (c == NULL)
+ return -1;
+ memcpy (c, ldsym._l._l_name, SYMNMLEN);
+ c[SYMNMLEN] = '\0';
+ symbuf->symbol.name = c;
}
if (ldsym.l_smclas == XMC_XO)
@@ -758,28 +332,11 @@ _bfd_xcoff_get_dynamic_reloc_upper_bound (abfd)
return -1;
contents = coff_section_data (abfd, lsec)->contents;
- xcoff_swap_ldhdr_in (abfd, (struct external_ldhdr *) contents, &ldhdr);
+ bfd_xcoff_swap_ldhdr_in (abfd, (struct external_ldhdr *) contents, &ldhdr);
return (ldhdr.l_nreloc + 1) * sizeof (arelent *);
}
-/* The typical dynamic reloc. */
-
-static reloc_howto_type xcoff_dynamic_reloc =
- HOWTO (0, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_POS", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- false); /* pcrel_offset */
-
/* Get the dynamic relocs. */
long
@@ -792,7 +349,7 @@ _bfd_xcoff_canonicalize_dynamic_reloc (abfd, prelocs, syms)
bfd_byte *contents;
struct internal_ldhdr ldhdr;
arelent *relbuf;
- struct external_ldrel *elrel, *elrelend;
+ bfd_byte *elrel, *elrelend;
if ((abfd->flags & DYNAMIC) == 0)
{
@@ -811,20 +368,21 @@ _bfd_xcoff_canonicalize_dynamic_reloc (abfd, prelocs, syms)
return -1;
contents = coff_section_data (abfd, lsec)->contents;
- xcoff_swap_ldhdr_in (abfd, (struct external_ldhdr *) contents, &ldhdr);
+ bfd_xcoff_swap_ldhdr_in (abfd, contents, &ldhdr);
relbuf = (arelent *) bfd_alloc (abfd, ldhdr.l_nreloc * sizeof (arelent));
if (relbuf == NULL)
return -1;
- elrel = ((struct external_ldrel *)
- (contents + LDHDRSZ + ldhdr.l_nsyms * LDSYMSZ));
- elrelend = elrel + ldhdr.l_nreloc;
- for (; elrel < elrelend; elrel++, relbuf++, prelocs++)
+ elrel = contents + bfd_xcoff_loader_reloc_offset(abfd, &ldhdr);
+
+ elrelend = elrel + ldhdr.l_nreloc * bfd_xcoff_ldrelsz(abfd);
+ for (; elrel < elrelend; elrel += bfd_xcoff_ldrelsz(abfd), relbuf++,
+ prelocs++)
{
struct internal_ldrel ldrel;
- xcoff_swap_ldrel_in (abfd, elrel, &ldrel);
+ bfd_xcoff_swap_ldrel_in (abfd, elrel, &ldrel);
if (ldrel.l_symndx >= 3)
relbuf->sym_ptr_ptr = syms + (ldrel.l_symndx - 3);
@@ -865,7 +423,7 @@ _bfd_xcoff_canonicalize_dynamic_reloc (abfd, prelocs, syms)
/* Most dynamic relocs have the same type. FIXME: This is only
correct if ldrel.l_rtype == 0. In other cases, we should use
a different howto. */
- relbuf->howto = &xcoff_dynamic_reloc;
+ relbuf->howto = bfd_xcoff_dynamic_reloc_howto(abfd);
/* FIXME: We have no way to record the l_rsecnm field. */
@@ -922,9 +480,9 @@ _bfd_xcoff_bfd_link_hash_table_create (abfd)
bfd *abfd;
{
struct xcoff_link_hash_table *ret;
+ bfd_size_type amt = sizeof (struct xcoff_link_hash_table);
- ret = ((struct xcoff_link_hash_table *)
- bfd_alloc (abfd, sizeof (struct xcoff_link_hash_table)));
+ ret = (struct xcoff_link_hash_table *) bfd_alloc (abfd, amt);
if (ret == (struct xcoff_link_hash_table *) NULL)
return (struct bfd_link_hash_table *) NULL;
if (! _bfd_link_hash_table_init (&ret->root, abfd, xcoff_link_hash_newfunc))
@@ -955,25 +513,6 @@ _bfd_xcoff_bfd_link_hash_table_create (abfd)
return &ret->root;
}
-/* Look up an entry in an XCOFF link hash table. */
-
-#define xcoff_link_hash_lookup(table, string, create, copy, follow) \
- ((struct xcoff_link_hash_entry *) \
- bfd_link_hash_lookup (&(table)->root, (string), (create), (copy),\
- (follow)))
-
-/* Traverse an XCOFF link hash table. */
-
-#define xcoff_link_hash_traverse(table, func, info) \
- (bfd_link_hash_traverse \
- (&(table)->root, \
- (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
- (info)))
-
-/* Get the XCOFF link hash table from the info structure. This is
- just a cast. */
-
-#define xcoff_hash_table(p) ((struct xcoff_link_hash_table *) ((p)->hash))
/* Read internal relocs for an XCOFF csect. This is a wrapper around
_bfd_coff_read_internal_relocs which tries to take advantage of any
@@ -989,6 +528,7 @@ xcoff_read_internal_relocs (abfd, sec, cache, external_relocs,
boolean require_internal;
struct internal_reloc *internal_relocs;
{
+
if (coff_section_data (abfd, sec) != NULL
&& coff_section_data (abfd, sec)->relocs == NULL
&& xcoff_section_data (abfd, sec) != NULL)
@@ -1018,6 +558,7 @@ xcoff_read_internal_relocs (abfd, sec, cache, external_relocs,
off = ((sec->rel_filepos - enclosing->rel_filepos)
/ bfd_coff_relsz (abfd));
+
if (! require_internal)
return coff_section_data (abfd, enclosing)->relocs + off;
memcpy (internal_relocs,
@@ -1039,6 +580,7 @@ _bfd_xcoff_bfd_link_add_symbols (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
{
+
switch (bfd_get_format (abfd))
{
case bfd_object:
@@ -1095,6 +637,7 @@ xcoff_link_add_object_symbols (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
{
+
if (! _bfd_coff_get_external_symbols (abfd))
return false;
if (! xcoff_link_add_symbols (abfd, info))
@@ -1118,6 +661,7 @@ xcoff_link_check_archive_element (abfd, info, pneeded)
struct bfd_link_info *info;
boolean *pneeded;
{
+
if (! _bfd_coff_get_external_symbols (abfd))
return false;
@@ -1178,6 +722,7 @@ xcoff_link_check_ar_symbols (abfd, info, pneeded)
object file. */
name = _bfd_coff_internal_syment_name (abfd, &sym, buf);
+
if (name == NULL)
return false;
h = bfd_link_hash_lookup (info->hash, name, false, false, true);
@@ -1189,7 +734,7 @@ xcoff_link_check_ar_symbols (abfd, info, pneeded)
undefined references in shared objects. */
if (h != (struct bfd_link_hash_entry *) NULL
&& h->type == bfd_link_hash_undefined
- && (info->hash->creator != abfd->xvec
+ && (info->hash->creator != abfd->xvec
|| (((struct xcoff_link_hash_entry *) h)->flags
& XCOFF_DEF_DYNAMIC) == 0))
{
@@ -1218,10 +763,10 @@ xcoff_link_check_dynamic_ar_symbols (abfd, info, pneeded)
boolean *pneeded;
{
asection *lsec;
- bfd_byte *buf;
+ bfd_byte *contents;
struct internal_ldhdr ldhdr;
const char *strings;
- struct external_ldsym *elsym, *elsymend;
+ bfd_byte *elsym, *elsymend;
*pneeded = false;
@@ -1234,22 +779,23 @@ xcoff_link_check_dynamic_ar_symbols (abfd, info, pneeded)
if (! xcoff_get_section_contents (abfd, lsec))
return false;
- buf = coff_section_data (abfd, lsec)->contents;
+ contents = coff_section_data (abfd, lsec)->contents;
+
+ bfd_xcoff_swap_ldhdr_in (abfd, contents, &ldhdr);
- xcoff_swap_ldhdr_in (abfd, (struct external_ldhdr *) buf, &ldhdr);
+ strings = (char *) contents + ldhdr.l_stoff;
- strings = (char *) buf + ldhdr.l_stoff;
+ elsym = contents + bfd_xcoff_loader_symbol_offset(abfd, &ldhdr);
- elsym = (struct external_ldsym *) (buf + LDHDRSZ);
- elsymend = elsym + ldhdr.l_nsyms;
- for (; elsym < elsymend; elsym++)
+ elsymend = elsym + ldhdr.l_nsyms * bfd_xcoff_ldsymsz(abfd);
+ for (; elsym < elsymend; elsym += bfd_xcoff_ldsymsz(abfd))
{
struct internal_ldsym ldsym;
char nambuf[SYMNMLEN + 1];
const char *name;
struct bfd_link_hash_entry *h;
- xcoff_swap_ldsym_in (abfd, elsym, &ldsym);
+ bfd_xcoff_swap_ldsym_in (abfd, elsym, &ldsym);
/* We are only interested in exported symbols. */
if ((ldsym.l_smtype & L_EXPORT) == 0)
@@ -1283,7 +829,7 @@ xcoff_link_check_dynamic_ar_symbols (abfd, info, pneeded)
/* We do not need this shared object. */
- if (buf != NULL && ! coff_section_data (abfd, lsec)->keep_contents)
+ if (contents != NULL && ! coff_section_data (abfd, lsec)->keep_contents)
{
free (coff_section_data (abfd, lsec)->contents);
coff_section_data (abfd, lsec)->contents = NULL;
@@ -1342,76 +888,37 @@ xcoff_find_reloc (relocs, count, address)
return min;
}
-/* Add all the symbols from an object file to the hash table.
- XCOFF is a weird format. A normal XCOFF .o files will have three
- COFF sections--.text, .data, and .bss--but each COFF section will
- contain many csects. These csects are described in the symbol
- table. From the linker's point of view, each csect must be
- considered a section in its own right. For example, a TOC entry is
- handled as a small XMC_TC csect. The linker must be able to merge
- different TOC entries together, which means that it must be able to
- extract the XMC_TC csects from the .data section of the input .o
- file.
+/* xcoff_link_create_extra_sections
- From the point of view of our linker, this is, of course, a hideous
- nightmare. We cope by actually creating sections for each csect,
- and discarding the original sections. We then have to handle the
- relocation entries carefully, since the only way to tell which
- csect they belong to is to examine the address. */
+ Takes care of creating the .loader, .gl, .ds, .debug and sections. */
static boolean
-xcoff_link_add_symbols (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+xcoff_link_create_extra_sections(bfd * abfd, struct bfd_link_info *info)
{
- unsigned int n_tmask;
- unsigned int n_btshft;
- boolean default_copy;
- bfd_size_type symcount;
- struct xcoff_link_hash_entry **sym_hash;
- asection **csect_cache;
- bfd_size_type linesz;
- asection *o;
- asection *last_real;
- boolean keep_syms;
- asection *csect;
- unsigned int csect_index;
- asection *first_csect;
- bfd_size_type symesz;
- bfd_byte *esym;
- bfd_byte *esym_end;
- struct reloc_info_struct
- {
- struct internal_reloc *relocs;
- asection **csects;
- bfd_byte *linenos;
- } *reloc_info = NULL;
- keep_syms = obj_coff_keep_syms (abfd);
-
- if ((abfd->flags & DYNAMIC) != 0
- && ! info->static_link)
- {
- if (! xcoff_link_add_dynamic_symbols (abfd, info))
- return false;
- }
+ boolean return_value = false;
if (info->hash->creator == abfd->xvec)
{
+
/* We need to build a .loader section, so we do it here. This
won't work if we're producing an XCOFF output file with no
XCOFF input files. FIXME. */
+
if (xcoff_hash_table (info)->loader_section == NULL)
{
asection *lsec;
lsec = bfd_make_section_anyway (abfd, ".loader");
if (lsec == NULL)
- goto error_return;
+ {
+ goto end_return;
+ }
xcoff_hash_table (info)->loader_section = lsec;
lsec->flags |= SEC_HAS_CONTENTS | SEC_IN_MEMORY;
}
+
/* Likewise for the linkage section. */
if (xcoff_hash_table (info)->linkage_section == NULL)
{
@@ -1419,12 +926,16 @@ xcoff_link_add_symbols (abfd, info)
lsec = bfd_make_section_anyway (abfd, ".gl");
if (lsec == NULL)
- goto error_return;
+ {
+ goto end_return;
+ }
+
xcoff_hash_table (info)->linkage_section = lsec;
lsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
| SEC_IN_MEMORY);
lsec->alignment_power = 2;
}
+
/* Likewise for the TOC section. */
if (xcoff_hash_table (info)->toc_section == NULL)
{
@@ -1432,12 +943,16 @@ xcoff_link_add_symbols (abfd, info)
tsec = bfd_make_section_anyway (abfd, ".tc");
if (tsec == NULL)
- goto error_return;
+ {
+ goto end_return;
+ }
+
xcoff_hash_table (info)->toc_section = tsec;
tsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
| SEC_IN_MEMORY);
tsec->alignment_power = 2;
}
+
/* Likewise for the descriptor section. */
if (xcoff_hash_table (info)->descriptor_section == NULL)
{
@@ -1445,12 +960,16 @@ xcoff_link_add_symbols (abfd, info)
dsec = bfd_make_section_anyway (abfd, ".ds");
if (dsec == NULL)
- goto error_return;
+ {
+ goto end_return;
+ }
+
xcoff_hash_table (info)->descriptor_section = dsec;
dsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
| SEC_IN_MEMORY);
dsec->alignment_power = 2;
}
+
/* Likewise for the .debug section. */
if (xcoff_hash_table (info)->debug_section == NULL
&& info->strip != strip_all)
@@ -1459,12 +978,85 @@ xcoff_link_add_symbols (abfd, info)
dsec = bfd_make_section_anyway (abfd, ".debug");
if (dsec == NULL)
- goto error_return;
+ {
+ goto end_return;
+ }
xcoff_hash_table (info)->debug_section = dsec;
dsec->flags |= SEC_HAS_CONTENTS | SEC_IN_MEMORY;
}
}
+ return_value = true;
+
+ end_return:
+
+ return return_value;
+}
+
+/* Add all the symbols from an object file to the hash table.
+
+ XCOFF is a weird format. A normal XCOFF .o files will have three
+ COFF sections--.text, .data, and .bss--but each COFF section will
+ contain many csects. These csects are described in the symbol
+ table. From the linker's point of view, each csect must be
+ considered a section in its own right. For example, a TOC entry is
+ handled as a small XMC_TC csect. The linker must be able to merge
+ different TOC entries together, which means that it must be able to
+ extract the XMC_TC csects from the .data section of the input .o
+ file.
+
+ From the point of view of our linker, this is, of course, a hideous
+ nightmare. We cope by actually creating sections for each csect,
+ and discarding the original sections. We then have to handle the
+ relocation entries carefully, since the only way to tell which
+ csect they belong to is to examine the address. */
+
+static boolean
+xcoff_link_add_symbols (abfd, info)
+ bfd *abfd;
+ struct bfd_link_info *info;
+{
+ unsigned int n_tmask;
+ unsigned int n_btshft;
+ boolean default_copy;
+ bfd_size_type symcount;
+ struct xcoff_link_hash_entry **sym_hash;
+ asection **csect_cache;
+ bfd_size_type linesz;
+ asection *o;
+ asection *last_real;
+ boolean keep_syms;
+ asection *csect;
+ unsigned int csect_index;
+ asection *first_csect;
+ bfd_size_type symesz;
+ bfd_byte *esym;
+ bfd_byte *esym_end;
+ struct reloc_info_struct
+ {
+ struct internal_reloc *relocs;
+ asection **csects;
+ bfd_byte *linenos;
+ } *reloc_info = NULL;
+ bfd_size_type amt;
+
+ keep_syms = obj_coff_keep_syms (abfd);
+
+ if ((abfd->flags & DYNAMIC) != 0
+ && ! info->static_link)
+ {
+ if (! xcoff_link_add_dynamic_symbols (abfd, info))
+ {
+ 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;
+ }
+
if ((abfd->flags & DYNAMIC) != 0
&& ! info->static_link)
return true;
@@ -1485,74 +1077,76 @@ xcoff_link_add_symbols (abfd, info)
/* We keep a list of the linker hash table entries that correspond
to each external symbol. */
- sym_hash = ((struct xcoff_link_hash_entry **)
- bfd_alloc (abfd,
- (symcount
- * sizeof (struct xcoff_link_hash_entry *))));
+ amt = symcount * sizeof (struct xcoff_link_hash_entry *);
+ sym_hash = (struct xcoff_link_hash_entry **) bfd_alloc (abfd, amt);
if (sym_hash == NULL && symcount != 0)
goto error_return;
coff_data (abfd)->sym_hashes = (struct coff_link_hash_entry **) sym_hash;
- memset (sym_hash, 0,
- (size_t) symcount * sizeof (struct xcoff_link_hash_entry *));
+ memset (sym_hash, 0, (size_t) amt);
/* Because of the weird stuff we are doing with XCOFF csects, we can
not easily determine which section a symbol is in, so we store
the information in the tdata for the input file. */
- csect_cache = ((asection **)
- bfd_alloc (abfd, symcount * sizeof (asection *)));
+ amt = symcount * sizeof (asection *);
+ csect_cache = (asection **) bfd_alloc (abfd, amt);
if (csect_cache == NULL && symcount != 0)
goto error_return;
xcoff_data (abfd)->csects = csect_cache;
- memset (csect_cache, 0, (size_t) symcount * sizeof (asection *));
+ memset (csect_cache, 0, (size_t) amt);
/* While splitting sections into csects, we need to assign the
relocs correctly. The relocs and the csects must both be in
order by VMA within a given section, so we handle this by
scanning along the relocs as we process the csects. We index
into reloc_info using the section target_index. */
- reloc_info = ((struct reloc_info_struct *)
- bfd_malloc ((abfd->section_count + 1)
- * sizeof (struct reloc_info_struct)));
+ amt = abfd->section_count + 1;
+ amt *= sizeof (struct reloc_info_struct);
+ reloc_info = (struct reloc_info_struct *) bfd_malloc (amt);
if (reloc_info == NULL)
goto error_return;
- memset ((PTR) reloc_info, 0,
- (abfd->section_count + 1) * sizeof (struct reloc_info_struct));
+ memset ((PTR) reloc_info, 0, (size_t) amt);
/* Read in the relocs and line numbers for each section. */
linesz = bfd_coff_linesz (abfd);
last_real = NULL;
for (o = abfd->sections; o != NULL; o = o->next)
{
+
last_real = o;
if ((o->flags & SEC_RELOC) != 0)
{
+
reloc_info[o->target_index].relocs =
xcoff_read_internal_relocs (abfd, o, true, (bfd_byte *) NULL,
false, (struct internal_reloc *) NULL);
- reloc_info[o->target_index].csects =
- (asection **) bfd_malloc (o->reloc_count * sizeof (asection *));
+ amt = o->reloc_count;
+ amt *= sizeof (asection *);
+ reloc_info[o->target_index].csects = (asection **) bfd_malloc (amt);
if (reloc_info[o->target_index].csects == NULL)
goto error_return;
- memset (reloc_info[o->target_index].csects, 0,
- o->reloc_count * sizeof (asection *));
+ memset (reloc_info[o->target_index].csects, 0, (size_t) amt);
+
}
if ((info->strip == strip_none || info->strip == strip_some)
&& o->lineno_count > 0)
{
+
bfd_byte *linenos;
- linenos = (bfd_byte *) bfd_malloc (o->lineno_count * linesz);
+ amt = linesz * o->lineno_count;
+ linenos = (bfd_byte *) bfd_malloc (amt);
if (linenos == NULL)
goto error_return;
reloc_info[o->target_index].linenos = linenos;
if (bfd_seek (abfd, o->line_filepos, SEEK_SET) != 0
- || (bfd_read (linenos, linesz, o->lineno_count, abfd)
- != linesz * o->lineno_count))
+ || bfd_bread (linenos, amt, abfd) != amt)
goto error_return;
+
}
}
+
/* Don't let the linker relocation routines discard the symbols. */
obj_coff_keep_syms (abfd) = true;
@@ -1564,6 +1158,7 @@ xcoff_link_add_symbols (abfd, info)
BFD_ASSERT (symesz == bfd_coff_auxesz (abfd));
esym = (bfd_byte *) obj_coff_external_syms (abfd);
esym_end = esym + symcount * symesz;
+
while (esym < esym_end)
{
struct internal_syment sym;
@@ -1579,9 +1174,16 @@ xcoff_link_add_symbols (abfd, info)
bfd_coff_swap_sym_in (abfd, (PTR) esym, (PTR) &sym);
/* In this pass we are only interested in symbols with csect
- information. */
+ information. */
if (sym.n_sclass != C_EXT && sym.n_sclass != C_HIDEXT)
{
+
+ /* Set csect_cache,
+ Normally csect is a .pr, .rw etc. created in the loop
+ If C_FILE or first time, handle special
+
+ Advance esym, sym_hash, csect_hash ptr's
+ Keep track of the last_symndx for the current file. */
if (sym.n_sclass == C_FILE && csect != NULL)
{
xcoff_section_data (abfd, csect)->last_symndx =
@@ -1600,10 +1202,12 @@ xcoff_link_add_symbols (abfd, info)
esym += (sym.n_numaux + 1) * symesz;
sym_hash += sym.n_numaux + 1;
csect_cache += sym.n_numaux + 1;
+
continue;
}
name = _bfd_coff_internal_syment_name (abfd, &sym, buf);
+
if (name == NULL)
goto error_return;
@@ -1618,28 +1222,31 @@ xcoff_link_add_symbols (abfd, info)
&& csect != NULL
&& ISFCN (sym.n_type))
{
+
union internal_auxent auxlin;
bfd_coff_swap_aux_in (abfd, (PTR) (esym + symesz),
sym.n_type, sym.n_sclass,
0, sym.n_numaux, (PTR) &auxlin);
+
if (auxlin.x_sym.x_fcnary.x_fcn.x_lnnoptr != 0)
{
asection *enclosing;
- bfd_size_type linoff;
+ bfd_signed_vma linoff;
enclosing = xcoff_section_data (abfd, csect)->enclosing;
if (enclosing == NULL)
{
(*_bfd_error_handler)
(_("%s: `%s' has line numbers but no enclosing section"),
- bfd_get_filename (abfd), name);
+ bfd_archive_filename (abfd), name);
bfd_set_error (bfd_error_bad_value);
goto error_return;
}
linoff = (auxlin.x_sym.x_fcnary.x_fcn.x_lnnoptr
- enclosing->line_filepos);
- if (linoff < enclosing->lineno_count * linesz)
+ /* explict cast to bfd_signed_vma for compiler */
+ if (linoff < (bfd_signed_vma) (enclosing->lineno_count * linesz))
{
struct internal_lineno lin;
bfd_byte *linpstart;
@@ -1668,9 +1275,9 @@ xcoff_link_add_symbols (abfd, info)
}
csect->lineno_count += (linp - linpstart) / linesz;
/* The setting of line_filepos will only be
- useful if all the line number entries for a
- csect are contiguous; this only matters for
- error reporting. */
+ useful if all the line number entries for a
+ csect are contiguous; this only matters for
+ error reporting. */
if (csect->line_filepos == 0)
csect->line_filepos =
auxlin.x_sym.x_fcnary.x_fcn.x_lnnoptr;
@@ -1685,7 +1292,7 @@ xcoff_link_add_symbols (abfd, info)
{
(*_bfd_error_handler)
(_("%s: class %d symbol `%s' has no aux entries"),
- bfd_get_filename (abfd), sym.n_sclass, name);
+ bfd_archive_filename (abfd), sym.n_sclass, name);
bfd_set_error (bfd_error_bad_value);
goto error_return;
}
@@ -1708,7 +1315,7 @@ xcoff_link_add_symbols (abfd, info)
default:
(*_bfd_error_handler)
(_("%s: symbol `%s' has unrecognized csect type %d"),
- bfd_get_filename (abfd), name, smtyp);
+ bfd_archive_filename (abfd), name, smtyp);
bfd_set_error (bfd_error_bad_value);
goto error_return;
@@ -1720,7 +1327,7 @@ xcoff_link_add_symbols (abfd, info)
{
(*_bfd_error_handler)
(_("%s: bad XTY_ER symbol `%s': class %d scnum %d scnlen %d"),
- bfd_get_filename (abfd), name, sym.n_sclass, sym.n_scnum,
+ bfd_archive_filename (abfd), name, sym.n_sclass, sym.n_scnum,
aux.x_csect.x_scnlen.l);
bfd_set_error (bfd_error_bad_value);
goto error_return;
@@ -1739,17 +1346,14 @@ xcoff_link_add_symbols (abfd, info)
case XTY_SD:
/* This is a csect definition. */
-
if (csect != NULL)
{
xcoff_section_data (abfd, csect)->last_symndx =
- ((esym
- - (bfd_byte *) obj_coff_external_syms (abfd))
- / symesz);
+ ((esym - (bfd_byte *) obj_coff_external_syms (abfd)) / symesz);
}
csect = NULL;
- csect_index = -1;
+ csect_index = -(unsigned) 1;
/* When we see a TOC anchor, we record the TOC value. */
if (aux.x_csect.x_smclas == XMC_TC0)
@@ -1759,7 +1363,7 @@ xcoff_link_add_symbols (abfd, info)
{
(*_bfd_error_handler)
(_("%s: XMC_TC0 symbol `%s' is class %d scnlen %d"),
- bfd_get_filename (abfd), name, sym.n_sclass,
+ bfd_archive_filename (abfd), name, sym.n_sclass,
aux.x_csect.x_scnlen.l);
bfd_set_error (bfd_error_bad_value);
goto error_return;
@@ -1769,14 +1373,25 @@ xcoff_link_add_symbols (abfd, info)
/* We must merge TOC entries for the same symbol. We can
merge two TOC entries if they are both C_HIDEXT, they
- both have the same name, they are both 4 bytes long, and
+ both have the same name, they are both 4 or 8 bytes long, and
they both have a relocation table entry for an external
symbol with the same name. Unfortunately, this means
- that we must look through the relocations. Ick. */
+ that we must look through the relocations. Ick.
+
+ Logic for 32 bit vs 64 bit.
+ 32 bit has a csect length of 4 for TOC
+ 64 bit has a csect length of 8 for TOC
+
+ The conditions to get past the if-check are not that bad.
+ They are what is used to create the TOC csects in the first
+ place. */
if (aux.x_csect.x_smclas == XMC_TC
&& sym.n_sclass == C_HIDEXT
- && aux.x_csect.x_scnlen.l == 4
- && info->hash->creator == abfd->xvec)
+ && info->hash->creator == abfd->xvec
+ && ((bfd_xcoff_is_xcoff32 (abfd)
+ && aux.x_csect.x_scnlen.l == 4)
+ || (bfd_xcoff_is_xcoff64 (abfd)
+ && aux.x_csect.x_scnlen.l == 8)))
{
asection *enclosing;
struct internal_reloc *relocs;
@@ -1788,15 +1403,22 @@ xcoff_link_add_symbols (abfd, info)
goto error_return;
relocs = reloc_info[enclosing->target_index].relocs;
- relindx = xcoff_find_reloc (relocs, enclosing->reloc_count,
- sym.n_value);
+ amt = enclosing->reloc_count;
+ relindx = xcoff_find_reloc (relocs, amt, sym.n_value);
rel = relocs + relindx;
+
+ /* 32 bit R_POS r_size is 31
+ 64 bit R_POS r_size is 63 */
if (relindx < enclosing->reloc_count
&& rel->r_vaddr == (bfd_vma) sym.n_value
- && rel->r_size == 31
- && rel->r_type == R_POS)
+ && rel->r_type == R_POS
+ && ((bfd_xcoff_is_xcoff32 (abfd)
+ && rel->r_size == 31)
+ || (bfd_xcoff_is_xcoff64 (abfd)
+ && rel->r_size == 63)))
{
bfd_byte *erelsym;
+
struct internal_syment relsym;
erelsym = ((bfd_byte *) obj_coff_external_syms (abfd)
@@ -1811,16 +1433,18 @@ xcoff_link_add_symbols (abfd, info)
/* At this point we know that the TOC entry is
for an externally visible symbol. */
+
relname = _bfd_coff_internal_syment_name (abfd, &relsym,
relbuf);
if (relname == NULL)
goto error_return;
/* We only merge TOC entries if the TC name is
- the same as the symbol name. This handles
- the normal case, but not common cases like
- SYM.P4 which gcc generates to store SYM + 4
- in the TOC. FIXME. */
+ the same as the symbol name. This handles
+ the normal case, but not common cases like
+ SYM.P4 which gcc generates to store SYM + 4
+ in the TOC. FIXME. */
+
if (strcmp (name, relname) == 0)
{
copy = (! info->keep_memory
@@ -1859,41 +1483,31 @@ xcoff_link_add_symbols (abfd, info)
/* We are about to create a TOC entry for
this symbol. */
set_toc = h;
- }
- }
- }
- }
+ } /* merge toc reloc */
+ } /* c_ext */
+ } /* reloc */
+ } /* merge toc */
- /* We need to create a new section. We get the name from
- the csect storage mapping class, so that the linker can
- accumulate similar csects together. */
{
- static const char *csect_name_by_class[] = {
- ".pr", ".ro", ".db", ".tc", ".ua", ".rw", ".gl", ".xo",
- ".sv", ".bs", ".ds", ".uc", ".ti", ".tb", NULL, ".tc0",
- ".td"
- };
- const char *csect_name;
+
asection *enclosing;
- if ((aux.x_csect.x_smclas >=
- sizeof csect_name_by_class / sizeof csect_name_by_class[0])
- || csect_name_by_class[aux.x_csect.x_smclas] == NULL)
+ /* We need to create a new section. We get the name from
+ the csect storage mapping class, so that the linker can
+ accumulate similar csects together. */
+
+ csect = bfd_xcoff_create_csect_from_smclas(abfd, &aux, name);
+ if (NULL == csect)
{
- (*_bfd_error_handler)
- (_("%s: symbol `%s' has unrecognized smclas %d"),
- bfd_get_filename (abfd), name, aux.x_csect.x_smclas);
- bfd_set_error (bfd_error_bad_value);
goto error_return;
}
- csect_name = csect_name_by_class[aux.x_csect.x_smclas];
- csect = bfd_make_section_anyway (abfd, csect_name);
- if (csect == NULL)
- goto error_return;
+ /* The enclosing section is the main section : .data, .text
+ or .bss that the csect is coming from. */
enclosing = coff_section_from_bfd_index (abfd, sym.n_scnum);
if (enclosing == NULL)
goto error_return;
+
if (! bfd_is_abs_section (enclosing)
&& ((bfd_vma) sym.n_value < enclosing->vma
|| ((bfd_vma) sym.n_value + aux.x_csect.x_scnlen.l
@@ -1901,7 +1515,7 @@ xcoff_link_add_symbols (abfd, info)
{
(*_bfd_error_handler)
(_("%s: csect `%s' not in enclosing section"),
- bfd_get_filename (abfd), name);
+ bfd_archive_filename (abfd), name);
bfd_set_error (bfd_error_bad_value);
goto error_return;
}
@@ -1915,12 +1529,12 @@ xcoff_link_add_symbols (abfd, info)
/* Record the enclosing section in the tdata for this new
section. */
- csect->used_by_bfd =
- (PTR) bfd_zalloc (abfd, sizeof (struct coff_section_tdata));
+ amt = sizeof (struct coff_section_tdata);
+ csect->used_by_bfd = (PTR) bfd_zalloc (abfd, amt);
if (csect->used_by_bfd == NULL)
goto error_return;
- coff_section_data (abfd, csect)->tdata =
- bfd_zalloc (abfd, sizeof (struct xcoff_section_tdata));
+ amt = sizeof (struct xcoff_section_tdata);
+ coff_section_data (abfd, csect)->tdata = bfd_zalloc (abfd, amt);
if (coff_section_data (abfd, csect)->tdata == NULL)
goto error_return;
xcoff_section_data (abfd, csect)->enclosing = enclosing;
@@ -1935,17 +1549,20 @@ xcoff_link_add_symbols (abfd, info)
asection **rel_csect;
relocs = reloc_info[enclosing->target_index].relocs;
- relindx = xcoff_find_reloc (relocs, enclosing->reloc_count,
- csect->vma);
+ amt = enclosing->reloc_count;
+ relindx = xcoff_find_reloc (relocs, amt, csect->vma);
+
rel = relocs + relindx;
rel_csect = (reloc_info[enclosing->target_index].csects
+ relindx);
+
csect->rel_filepos = (enclosing->rel_filepos
+ relindx * bfd_coff_relsz (abfd));
while (relindx < enclosing->reloc_count
&& *rel_csect == NULL
&& rel->r_vaddr < csect->vma + csect->_raw_size)
{
+
*rel_csect = csect;
csect->flags |= SEC_RELOC;
++csect->reloc_count;
@@ -1983,9 +1600,9 @@ xcoff_link_add_symbols (abfd, info)
case XTY_LD:
/* This is a label definition. The x_scnlen field is the
- symbol index of the csect. I believe that this must
- always follow the appropriate XTY_SD symbol, so I will
- insist on it. */
+ symbol index of the csect. Usually the XTY_LD symbol will
+ follow its appropriate XTY_SD symbol. The .set pseudo op can
+ cause the XTY_LD to not follow the XTY_SD symbol. */
{
boolean bad;
@@ -2005,11 +1622,11 @@ xcoff_link_add_symbols (abfd, info)
{
(*_bfd_error_handler)
(_("%s: misplaced XTY_LD `%s'"),
- bfd_get_filename (abfd), name);
+ bfd_archive_filename (abfd), name);
bfd_set_error (bfd_error_bad_value);
goto error_return;
}
-
+ csect = section;
value = sym.n_value - csect->vma;
}
break;
@@ -2031,9 +1648,16 @@ xcoff_link_add_symbols (abfd, info)
}
if (aux.x_csect.x_smclas == XMC_TD)
- csect = bfd_make_section_anyway (abfd, ".tocbss");
+ {
+ /* The linker script puts the .td section in the data
+ section after the .tc section. */
+ csect = bfd_make_section_anyway (abfd, ".td");
+
+ }
else
- csect = bfd_make_section_anyway (abfd, ".bss");
+ {
+ csect = bfd_make_section_anyway (abfd, ".bss");
+ }
if (csect == NULL)
goto error_return;
csect->vma = sym.n_value;
@@ -2047,12 +1671,12 @@ xcoff_link_add_symbols (abfd, info)
- (bfd_byte *) obj_coff_external_syms (abfd))
/ symesz);
- csect->used_by_bfd =
- (PTR) bfd_zalloc (abfd, sizeof (struct coff_section_tdata));
+ amt = sizeof (struct coff_section_tdata);
+ csect->used_by_bfd = (PTR) bfd_zalloc (abfd, amt);
if (csect->used_by_bfd == NULL)
goto error_return;
- coff_section_data (abfd, csect)->tdata =
- bfd_zalloc (abfd, sizeof (struct xcoff_section_tdata));
+ amt = sizeof (struct xcoff_section_tdata);
+ coff_section_data (abfd, csect)->tdata = bfd_zalloc (abfd, amt);
if (coff_section_data (abfd, csect)->tdata == NULL)
goto error_return;
xcoff_section_data (abfd, csect)->first_symndx = csect_index;
@@ -2076,27 +1700,31 @@ xcoff_link_add_symbols (abfd, info)
&& aux.x_csect.x_smclas != XMC_TC
&& aux.x_csect.x_smclas != XMC_TD)
{
- int i;
- i = -1;
+ int i = -1;
+
if (name[0] == '_')
{
if (strcmp (name, "_text") == 0)
- i = 0;
+ i = XCOFF_SPECIAL_SECTION_TEXT;
else if (strcmp (name, "_etext") == 0)
- i = 1;
+ i = XCOFF_SPECIAL_SECTION_ETEXT;
else if (strcmp (name, "_data") == 0)
- i = 2;
+ i = XCOFF_SPECIAL_SECTION_DATA;
else if (strcmp (name, "_edata") == 0)
- i = 3;
+ i = XCOFF_SPECIAL_SECTION_EDATA;
else if (strcmp (name, "_end") == 0)
- i = 4;
+ i = XCOFF_SPECIAL_SECTION_END;
}
else if (name[0] == 'e' && strcmp (name, "end") == 0)
- i = 5;
+ {
+ i = XCOFF_SPECIAL_SECTION_END2;
+ }
if (i != -1)
- xcoff_hash_table (info)->special_sections[i] = csect;
+ {
+ xcoff_hash_table (info)->special_sections[i] = csect;
+ }
}
/* Now we have enough information to add the symbol to the
@@ -2140,7 +1768,7 @@ xcoff_link_add_symbols (abfd, info)
shared object, which will cause symbol redefinitions,
although this is an easier case to detect. */
- if (info->hash->creator == abfd->xvec)
+ if (info->hash->creator == abfd->xvec)
{
if (! bfd_is_und_section (section))
*sym_hash = xcoff_link_hash_lookup (xcoff_hash_table (info),
@@ -2222,7 +1850,7 @@ xcoff_link_add_symbols (abfd, info)
not an error. */
if (! ((*info->callbacks->multiple_definition)
(info, (*sym_hash)->root.root.string,
- (bfd *) NULL, (asection *) NULL, 0,
+ (bfd *) NULL, (asection *) NULL, (bfd_vma) 0,
(*sym_hash)->root.u.def.section->owner,
(*sym_hash)->root.u.def.section,
(*sym_hash)->root.u.def.value)))
@@ -2266,7 +1894,7 @@ xcoff_link_add_symbols (abfd, info)
}
}
- if (info->hash->creator == abfd->xvec)
+ if (info->hash->creator == abfd->xvec)
{
int flag;
@@ -2310,13 +1938,15 @@ xcoff_link_add_symbols (abfd, info)
rel = reloc_info[o->target_index].relocs;
rel_csect = reloc_info[o->target_index].csects;
+
for (i = 0; i < o->reloc_count; i++, rel++, rel_csect++)
{
+
if (*rel_csect == NULL)
{
(*_bfd_error_handler)
(_("%s: reloc %s:%d not in csect"),
- bfd_get_filename (abfd), o->name, i);
+ bfd_archive_filename (abfd), o->name, i);
bfd_set_error (bfd_error_bad_value);
goto error_return;
}
@@ -2324,7 +1954,7 @@ xcoff_link_add_symbols (abfd, info)
/* We identify all symbols which are called, so that we
can create glue code for calls to functions imported
from dynamic objects. */
- if (info->hash->creator == abfd->xvec
+ if (info->hash->creator == abfd->xvec
&& *rel_csect != bfd_und_section_ptr
&& (rel->r_type == R_BR
|| rel->r_type == R_RBR)
@@ -2377,7 +2007,7 @@ xcoff_link_add_symbols (abfd, info)
/* Reset SEC_RELOC and the reloc_count, since the reloc
information is now attached to the csects. */
- o->flags &= ~SEC_RELOC;
+ o->flags &=~ SEC_RELOC;
o->reloc_count = 0;
/* If we are not keeping memory, free the reloc information. */
@@ -2416,7 +2046,7 @@ xcoff_link_add_symbols (abfd, info)
if (reloc_info[o->target_index].linenos != NULL)
free (reloc_info[o->target_index].linenos);
}
- free (reloc_info);
+ free (reloc_info);
}
obj_coff_keep_syms (abfd) = keep_syms;
return false;
@@ -2434,10 +2064,10 @@ xcoff_link_add_dynamic_symbols (abfd, info)
struct bfd_link_info *info;
{
asection *lsec;
- bfd_byte *buf;
+ bfd_byte *contents;
struct internal_ldhdr ldhdr;
const char *strings;
- struct external_ldsym *elsym, *elsymend;
+ bfd_byte *elsym, *elsymend;
struct xcoff_import_file *n;
const char *bname;
const char *mname;
@@ -2447,7 +2077,7 @@ xcoff_link_add_dynamic_symbols (abfd, info)
/* We can only handle a dynamic object if we are generating an XCOFF
output file. */
- if (info->hash->creator != abfd->xvec)
+ if (info->hash->creator != abfd->xvec)
{
(*_bfd_error_handler)
(_("%s: XCOFF shared object when not producing XCOFF output"),
@@ -2477,29 +2107,31 @@ xcoff_link_add_dynamic_symbols (abfd, info)
return false;
}
+
if (! xcoff_get_section_contents (abfd, lsec))
return false;
- buf = coff_section_data (abfd, lsec)->contents;
+ contents = coff_section_data (abfd, lsec)->contents;
/* Remove the sections from this object, so that they do not get
included in the link. */
abfd->sections = NULL;
- xcoff_swap_ldhdr_in (abfd, (struct external_ldhdr *) buf, &ldhdr);
+ bfd_xcoff_swap_ldhdr_in (abfd, contents, &ldhdr);
+
+ strings = (char *) contents + ldhdr.l_stoff;
+
+ elsym = contents + bfd_xcoff_loader_symbol_offset(abfd, &ldhdr);
- strings = (char *) buf + ldhdr.l_stoff;
+ elsymend = elsym + ldhdr.l_nsyms * bfd_xcoff_ldsymsz(abfd);
- elsym = (struct external_ldsym *) (buf + LDHDRSZ);
- elsymend = elsym + ldhdr.l_nsyms;
- BFD_ASSERT (sizeof (struct external_ldsym) == LDSYMSZ);
- for (; elsym < elsymend; elsym++)
+ for (; elsym < elsymend; elsym += bfd_xcoff_ldsymsz(abfd))
{
struct internal_ldsym ldsym;
char nambuf[SYMNMLEN + 1];
const char *name;
struct xcoff_link_hash_entry *h;
- xcoff_swap_ldsym_in (abfd, elsym, &ldsym);
+ bfd_xcoff_swap_ldsym_in (abfd, elsym, &ldsym);
/* We are only interested in exported symbols. */
if ((ldsym.l_smtype & L_EXPORT) == 0)
@@ -2576,7 +2208,7 @@ xcoff_link_add_dynamic_symbols (abfd, info)
{
char *dsnm;
- dsnm = bfd_malloc (strlen (name) + 2);
+ dsnm = bfd_malloc ((bfd_size_type) strlen (name) + 2);
if (dsnm == NULL)
return false;
dsnm[0] = '.';
@@ -2618,7 +2250,7 @@ xcoff_link_add_dynamic_symbols (abfd, info)
}
}
- if (buf != NULL && ! coff_section_data (abfd, lsec)->keep_contents)
+ if (contents != NULL && ! coff_section_data (abfd, lsec)->keep_contents)
{
free (coff_section_data (abfd, lsec)->contents);
coff_section_data (abfd, lsec)->contents = NULL;
@@ -2627,7 +2259,7 @@ xcoff_link_add_dynamic_symbols (abfd, info)
/* Record this file in the import files. */
n = ((struct xcoff_import_file *)
- bfd_alloc (abfd, sizeof (struct xcoff_import_file)));
+ bfd_alloc (abfd, (bfd_size_type) sizeof (struct xcoff_import_file)));
if (n == NULL)
return false;
n->next = NULL;
@@ -2676,6 +2308,7 @@ xcoff_mark_symbol (info, h)
struct bfd_link_info *info;
struct xcoff_link_hash_entry *h;
{
+
if ((h->flags & XCOFF_MARK) != 0)
return true;
@@ -2887,6 +2520,7 @@ bfd_xcoff_link_record_set (output_bfd, info, harg, size)
{
struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg;
struct xcoff_link_size_list *n;
+ bfd_size_type amt;
if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour)
return true;
@@ -2895,8 +2529,8 @@ bfd_xcoff_link_record_set (output_bfd, info, harg, size)
per global symbol, so instead the size is kept on a linked list
attached to the hash table. */
- n = ((struct xcoff_link_size_list *)
- bfd_alloc (output_bfd, sizeof (struct xcoff_link_size_list)));
+ amt = sizeof (struct xcoff_link_size_list);
+ n = (struct xcoff_link_size_list *) bfd_alloc (output_bfd, amt);
if (n == NULL)
return false;
n->next = xcoff_hash_table (info)->size_list;
@@ -2913,7 +2547,7 @@ bfd_xcoff_link_record_set (output_bfd, info, harg, size)
boolean
bfd_xcoff_import_symbol (output_bfd, info, harg, val, imppath, impfile,
- impmember)
+ impmember, syscall_flag)
bfd *output_bfd;
struct bfd_link_info *info;
struct bfd_link_hash_entry *harg;
@@ -2921,6 +2555,7 @@ bfd_xcoff_import_symbol (output_bfd, info, harg, val, imppath, impfile,
const char *imppath;
const char *impfile;
const char *impmember;
+ unsigned int syscall_flag;
{
struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg;
@@ -2963,7 +2598,7 @@ bfd_xcoff_import_symbol (output_bfd, info, harg, val, imppath, impfile,
h = hds;
}
- h->flags |= XCOFF_IMPORT;
+ h->flags |= (XCOFF_IMPORT | syscall_flag);
if (val != (bfd_vma) -1)
{
@@ -3009,9 +2644,9 @@ bfd_xcoff_import_symbol (output_bfd, info, harg, val, imppath, impfile,
if (*pp == NULL)
{
struct xcoff_import_file *n;
+ bfd_size_type amt = sizeof (struct xcoff_import_file);
- n = ((struct xcoff_import_file *)
- bfd_alloc (output_bfd, sizeof (struct xcoff_import_file)));
+ n = (struct xcoff_import_file *) bfd_alloc (output_bfd, amt);
if (n == NULL)
return false;
n->next = NULL;
@@ -3030,11 +2665,10 @@ bfd_xcoff_import_symbol (output_bfd, info, harg, val, imppath, impfile,
/* Export a symbol. */
boolean
-bfd_xcoff_export_symbol (output_bfd, info, harg, syscall)
+bfd_xcoff_export_symbol (output_bfd, info, harg)
bfd *output_bfd;
struct bfd_link_info *info;
struct bfd_link_hash_entry *harg;
- boolean syscall ATTRIBUTE_UNUSED;
{
struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg;
@@ -3053,8 +2687,9 @@ bfd_xcoff_export_symbol (output_bfd, info, harg, syscall)
{
char *fnname;
struct xcoff_link_hash_entry *hfn;
+ bfd_size_type amt = strlen (h->root.root.string) + 2;
- fnname = (char *) bfd_malloc (strlen (h->root.root.string) + 2);
+ fnname = (char *) bfd_malloc (amt);
if (fnname == NULL)
return false;
fnname[0] = '.';
@@ -3150,28 +2785,6 @@ bfd_xcoff_record_link_assignment (output_bfd, info, name)
return true;
}
-/* This structure is used to pass information through
- xcoff_link_hash_traverse. */
-
-struct xcoff_loader_info {
- /* Set if a problem occurred. */
- boolean failed;
- /* Output BFD. */
- bfd *output_bfd;
- /* Link information structure. */
- struct bfd_link_info *info;
- /* Whether all defined symbols should be exported. */
- boolean export_defineds;
- /* Number of ldsym structures. */
- size_t ldsym_count;
- /* Size of string table. */
- size_t string_size;
- /* String table. */
- bfd_byte *strings;
- /* Allocated size of string table. */
- size_t string_alc;
-};
-
/* Build the .loader section. This is called by the XCOFF linker
emulation before_allocation routine. We must set the size of the
.loader section before the linker lays out the output file.
@@ -3220,10 +2833,12 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
bfd *sub;
struct bfd_strtab_hash *debug_strtab;
bfd_byte *debug_contents = NULL;
+ bfd_size_type amt;
if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour)
{
- for (i = 0; i < 6; i++)
+
+ for (i = 0; i < XCOFF_NUMBER_OF_SPECIAL_SECTIONS; i++)
special_sections[i] = NULL;
return true;
}
@@ -3245,7 +2860,9 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
xcoff_hash_table (info)->textro = textro;
if (entry == NULL)
- hentry = NULL;
+ {
+ hentry = NULL;
+ }
else
{
hentry = xcoff_link_hash_lookup (xcoff_hash_table (info), entry,
@@ -3254,6 +2871,67 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
hentry->flags |= XCOFF_ENTRY;
}
+ /* __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))
+ {
+ 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;
+ }
+
/* Garbage collect unused sections. */
if (info->relocateable
|| ! gc
@@ -3289,15 +2967,16 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
}
/* Return special sections to the caller. */
- for (i = 0; i < 6; i++)
+ for (i = 0; i < XCOFF_NUMBER_OF_SPECIAL_SECTIONS; i++)
{
- asection *sec;
-
sec = xcoff_hash_table (info)->special_sections[i];
+
if (sec != NULL
&& gc
&& (sec->flags & SEC_MARK) == 0)
- sec = NULL;
+ {
+ sec = NULL;
+ }
special_sections[i] = sec;
}
@@ -3331,14 +3010,14 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
/* Set up the .loader section header. */
ldhdr = &xcoff_hash_table (info)->ldhdr;
- ldhdr->l_version = 1;
+ ldhdr->l_version = bfd_xcoff_ldhdr_version(output_bfd);
ldhdr->l_nsyms = ldinfo.ldsym_count;
ldhdr->l_nreloc = xcoff_hash_table (info)->ldrel_count;
ldhdr->l_istlen = impsize;
ldhdr->l_nimpid = impcount;
- ldhdr->l_impoff = (LDHDRSZ
- + ldhdr->l_nsyms * LDSYMSZ
- + ldhdr->l_nreloc * LDRELSZ);
+ ldhdr->l_impoff = (bfd_xcoff_ldhdrsz(output_bfd)
+ + ldhdr->l_nsyms * bfd_xcoff_ldsymsz(output_bfd)
+ + ldhdr->l_nreloc * bfd_xcoff_ldrelsz(output_bfd));
ldhdr->l_stlen = ldinfo.string_size;
stoff = ldhdr->l_impoff + impsize;
if (ldinfo.string_size == 0)
@@ -3346,6 +3025,14 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
else
ldhdr->l_stoff = stoff;
+ /* 64 bit elements to ldhdr
+ The swap out routine for 32 bit will ignore them.
+ Nothing fancy, symbols come after the header and relocs come
+ after symbols. */
+ ldhdr->l_symoff = bfd_xcoff_ldhdrsz (output_bfd);
+ ldhdr->l_rldoff = (bfd_xcoff_ldhdrsz (output_bfd)
+ + ldhdr->l_nsyms * bfd_xcoff_ldsymsz (output_bfd));
+
/* We now know the final size of the .loader section. Allocate
space for it. */
lsec = xcoff_hash_table (info)->loader_section;
@@ -3355,8 +3042,7 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
goto error_return;
/* Set up the header. */
- xcoff_swap_ldhdr_out (output_bfd, ldhdr,
- (struct external_ldhdr *) lsec->contents);
+ bfd_xcoff_swap_ldhdr_out (output_bfd, ldhdr, lsec->contents);
/* Set up the import file names. */
out = (char *) lsec->contents + ldhdr->l_impoff;
@@ -3395,7 +3081,8 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
symbols are written out in xcoff_link_input_bfd or
xcoff_write_global_symbol. The .loader relocs are written out
when the corresponding normal relocs are handled in
- xcoff_link_input_bfd. */
+ xcoff_link_input_bfd.
+ */
/* Allocate space for the magic sections. */
sec = xcoff_hash_table (info)->linkage_section;
@@ -3532,6 +3219,41 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
return false;
}
+boolean
+bfd_xcoff_link_generate_rtinit (abfd, init, fini)
+ bfd *abfd;
+ const char *init;
+ const char *fini;
+{
+ struct bfd_in_memory *bim;
+
+ bim = ((struct bfd_in_memory *)
+ bfd_malloc ((bfd_size_type) sizeof (struct bfd_in_memory)));
+ if (bim == NULL)
+ return false;
+
+ bim->size = 0;
+ bim->buffer = 0;
+
+ abfd->link_next = 0;
+ abfd->format = bfd_object;
+ abfd->iostream = (PTR) bim;
+ abfd->flags = BFD_IN_MEMORY;
+ abfd->direction = write_direction;
+ abfd->where = 0;
+
+ if (false == bfd_xcoff_generate_rtinit (abfd, init, fini))
+ return false;
+
+ /* need to reset to unknown or it will not be read back in correctly */
+ abfd->format = bfd_unknown;
+ abfd->direction = read_direction;
+ abfd->where = 0;
+
+ return true;
+}
+
+
/* Add a symbol to the .loader symbols, if necessary. */
static boolean
@@ -3540,7 +3262,19 @@ xcoff_build_ldsyms (h, p)
PTR p;
{
struct xcoff_loader_info *ldinfo = (struct xcoff_loader_info *) p;
- size_t len;
+ bfd_size_type amt;
+
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct xcoff_link_hash_entry *) h->root.u.i.link;
+
+ /* __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. */
+ 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
@@ -3638,7 +3372,7 @@ xcoff_build_ldsyms (h, p)
h->root.u.def.value = sec->_raw_size;
h->smclas = XMC_GL;
h->flags |= XCOFF_DEF_REGULAR;
- sec->_raw_size += XCOFF_GLINK_SIZE;
+ sec->_raw_size += bfd_xcoff_glink_code_size(ldinfo->output_bfd);
/* The global linkage code requires a TOC entry for the
descriptor. */
@@ -3649,16 +3383,34 @@ xcoff_build_ldsyms (h, p)
hds->flags |= XCOFF_MARK;
if (hds->toc_section == NULL)
{
+ int byte_size;
+
+ /* 32 vs 64
+ 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;
+ }
+ else if (bfd_xcoff_is_xcoff32 (ldinfo->output_bfd))
+ {
+ byte_size = 4;
+ }
+ else
+ {
+ return false;
+ }
+
hds->toc_section = xcoff_hash_table (ldinfo->info)->toc_section;
hds->u.toc_offset = hds->toc_section->_raw_size;
- hds->toc_section->_raw_size += 4;
+ hds->toc_section->_raw_size += byte_size;
++xcoff_hash_table (ldinfo->info)->ldrel_count;
++hds->toc_section->reloc_count;
hds->indx = -2;
hds->flags |= XCOFF_SET_TOC | XCOFF_LDREL;
/* We need to call xcoff_build_ldsyms recursively here,
- because we may already have passed hds on the traversal. */
+ because we may already have passed hds on the traversal. */
xcoff_build_ldsyms (hds, p);
}
}
@@ -3689,15 +3441,19 @@ xcoff_build_ldsyms (h, p)
h->root.u.def.value = sec->_raw_size;
h->smclas = XMC_DS;
h->flags |= XCOFF_DEF_REGULAR;
- sec->_raw_size += 12;
+
+ /* The size of the function descriptor depends if this is an
+ xcoff32 (12) or xcoff64 (24). */
+ sec->_raw_size +=
+ bfd_xcoff_function_descriptor_size(ldinfo->output_bfd);
/* A function descriptor uses two relocs: one for the
- associated code, and one for the TOC address. */
+ associated code, and one for the TOC address. */
xcoff_hash_table (ldinfo->info)->ldrel_count += 2;
sec->reloc_count += 2;
/* We handle writing out the contents of the descriptor in
- xcoff_write_global_symbol. */
+ xcoff_write_global_symbol. */
}
else
{
@@ -3754,9 +3510,8 @@ xcoff_build_ldsyms (h, p)
/* We need to add this symbol to the .loader symbols. */
BFD_ASSERT (h->ldsym == NULL);
- h->ldsym = ((struct internal_ldsym *)
- bfd_zalloc (ldinfo->output_bfd,
- sizeof (struct internal_ldsym)));
+ amt = sizeof (struct internal_ldsym);
+ h->ldsym = (struct internal_ldsym *) bfd_zalloc (ldinfo->output_bfd, amt);
if (h->ldsym == NULL)
{
ldinfo->failed = true;
@@ -3767,44 +3522,16 @@ xcoff_build_ldsyms (h, p)
h->ldsym->l_ifile = h->ldindx;
/* The first 3 symbol table indices are reserved to indicate the
- sections. */
+ data, text and bss sections. */
h->ldindx = ldinfo->ldsym_count + 3;
++ldinfo->ldsym_count;
- len = strlen (h->root.root.string);
- if (len <= SYMNMLEN)
- strncpy (h->ldsym->_l._l_name, h->root.root.string, SYMNMLEN);
- else
+ if (false == bfd_xcoff_put_ldsymbol_name (ldinfo->output_bfd, ldinfo,
+ h->ldsym,
+ h->root.root.string))
{
- if (ldinfo->string_size + len + 3 > ldinfo->string_alc)
- {
- size_t newalc;
- bfd_byte *newstrings;
-
- newalc = ldinfo->string_alc * 2;
- if (newalc == 0)
- newalc = 32;
- while (ldinfo->string_size + len + 3 > newalc)
- newalc *= 2;
-
- newstrings = ((bfd_byte *)
- bfd_realloc ((PTR) ldinfo->strings, newalc));
- if (newstrings == NULL)
- {
- ldinfo->failed = true;
- return false;
- }
- ldinfo->string_alc = newalc;
- ldinfo->strings = newstrings;
- }
-
- bfd_put_16 (ldinfo->output_bfd, len + 1,
- ldinfo->strings + ldinfo->string_size);
- strcpy (ldinfo->strings + ldinfo->string_size + 2, h->root.root.string);
- h->ldsym->_l._l_l._l_zeroes = 0;
- h->ldsym->_l._l_l._l_offset = ldinfo->string_size + 2;
- ldinfo->string_size += len + 3;
+ return false;
}
h->flags |= XCOFF_BUILT_LDSYM;
@@ -3823,11 +3550,11 @@ _bfd_xcoff_bfd_final_link (abfd, info)
struct xcoff_final_link_info finfo;
asection *o;
struct bfd_link_order *p;
- size_t max_contents_size;
- size_t max_sym_count;
- size_t max_lineno_count;
- size_t max_reloc_count;
- size_t max_output_reloc_count;
+ bfd_size_type max_contents_size;
+ bfd_size_type max_sym_count;
+ bfd_size_type max_lineno_count;
+ bfd_size_type max_reloc_count;
+ bfd_size_type max_output_reloc_count;
file_ptr rel_filepos;
unsigned int relsz;
file_ptr line_filepos;
@@ -3835,6 +3562,8 @@ _bfd_xcoff_bfd_final_link (abfd, info)
bfd *sub;
bfd_byte *external_relocs = NULL;
char strbuf[STRING_SIZE_SIZE];
+ file_ptr pos;
+ bfd_size_type amt;
if (info->shared)
abfd->flags |= DYNAMIC;
@@ -3854,13 +3583,12 @@ _bfd_xcoff_bfd_final_link (abfd, info)
finfo.contents = NULL;
finfo.external_relocs = NULL;
- finfo.ldsym = ((struct external_ldsym *)
- (xcoff_hash_table (info)->loader_section->contents
- + LDHDRSZ));
- finfo.ldrel = ((struct external_ldrel *)
- (xcoff_hash_table (info)->loader_section->contents
- + LDHDRSZ
- + xcoff_hash_table (info)->ldhdr.l_nsyms * LDSYMSZ));
+ finfo.ldsym = (xcoff_hash_table (info)->loader_section->contents
+ + bfd_xcoff_ldhdrsz (abfd));
+ finfo.ldrel = (xcoff_hash_table (info)->loader_section->contents
+ + bfd_xcoff_ldhdrsz(abfd)
+ + (xcoff_hash_table (info)->ldhdr.l_nsyms
+ * bfd_xcoff_ldsymsz(abfd)));
xcoff_data (abfd)->coff.link_info = info;
@@ -3933,7 +3661,7 @@ _bfd_xcoff_bfd_final_link (abfd, info)
int indx;
asection **op;
file_ptr sofar;
-
+
/* Insert .pad sections before every section which has
contents and is loaded, if it is preceded by some other
section which has contents and is loaded. */
@@ -3949,20 +3677,27 @@ _bfd_xcoff_bfd_final_link (abfd, info)
saw_contents = true;
else
{
- asection *n, *hold;
-
- hold = *op;
- *op = NULL;
+ asection *n, **st;
+
+ /* Create a pad section and place it before the section
+ that needs padding. This requires unlinking and
+ relinking the bfd's section list. */
+
+ st = abfd->section_tail;
n = bfd_make_section_anyway (abfd, ".pad");
- BFD_ASSERT (*op == n);
- n->next = hold;
n->flags = SEC_HAS_CONTENTS;
- n->alignment_power = 0;
+ n->alignment_power = 0;
+
+ BFD_ASSERT (*st == n);
+ bfd_section_list_remove (abfd, st);
+ bfd_section_list_insert (abfd, op, n);
+
+ op = &n->next;
saw_contents = false;
}
}
}
-
+
/* Reset the section indices after inserting the new
sections. */
indx = 0;
@@ -3981,7 +3716,11 @@ _bfd_xcoff_bfd_final_link (abfd, info)
sofar += bfd_coff_aoutsz (abfd);
sofar += abfd->section_count * bfd_coff_scnhsz (abfd);
for (o = abfd->sections; o != NULL; o = o->next)
- if (o->reloc_count >= 0xffff || o->lineno_count >= 0xffff)
+ if ((bfd_xcoff_is_reloc_count_overflow
+ (abfd, (bfd_vma) o->reloc_count))
+ || (bfd_xcoff_is_lineno_count_overflow
+ (abfd, (bfd_vma) o->lineno_count)))
+ /* 64 does not overflow, need to check if 32 does */
sofar += bfd_coff_scnhsz (abfd);
for (o = abfd->sections; o != NULL; o = o->next)
@@ -4018,10 +3757,9 @@ _bfd_xcoff_bfd_final_link (abfd, info)
/* We use section_count + 1, rather than section_count, because
the target_index fields are 1 based. */
- finfo.section_info =
- ((struct xcoff_link_section_info *)
- bfd_malloc ((abfd->section_count + 1)
- * sizeof (struct xcoff_link_section_info)));
+ amt = abfd->section_count + 1;
+ amt *= sizeof (struct xcoff_link_section_info);
+ finfo.section_info = (struct xcoff_link_section_info *) bfd_malloc (amt);
if (finfo.section_info == NULL)
goto error_return;
for (i = 0; i <= abfd->section_count; i++)
@@ -4067,13 +3805,16 @@ _bfd_xcoff_bfd_final_link (abfd, info)
memory until the end of the link. This wastes memory.
We could backpatch the file later, I suppose, although it
would be slow. */
+ amt = o->reloc_count;
+ amt *= sizeof (struct internal_reloc);
finfo.section_info[o->target_index].relocs =
- ((struct internal_reloc *)
- bfd_malloc (o->reloc_count * sizeof (struct internal_reloc)));
+ (struct internal_reloc *) bfd_malloc (amt);
+
+ amt = o->reloc_count;
+ amt *= sizeof (struct xcoff_link_hash_entry *);
finfo.section_info[o->target_index].rel_hashes =
- ((struct xcoff_link_hash_entry **)
- bfd_malloc (o->reloc_count
- * sizeof (struct xcoff_link_hash_entry *)));
+ (struct xcoff_link_hash_entry **) bfd_malloc (amt);
+
if (finfo.section_info[o->target_index].relocs == NULL
|| finfo.section_info[o->target_index].rel_hashes == NULL)
goto error_return;
@@ -4113,7 +3854,7 @@ _bfd_xcoff_bfd_final_link (abfd, info)
max_sym_count = 6;
for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
{
- size_t sz;
+ bfd_size_type sz;
sub->output_has_begun = false;
sz = obj_raw_syment_count (sub);
@@ -4122,16 +3863,24 @@ _bfd_xcoff_bfd_final_link (abfd, info)
}
/* Allocate some buffers used while linking. */
- finfo.internal_syms = ((struct internal_syment *)
- bfd_malloc (max_sym_count
- * sizeof (struct internal_syment)));
- finfo.sym_indices = (long *) bfd_malloc (max_sym_count * sizeof (long));
- finfo.outsyms = ((bfd_byte *)
- bfd_malloc ((size_t) ((max_sym_count + 1) * symesz)));
- finfo.linenos = (bfd_byte *) bfd_malloc (max_lineno_count
- * bfd_coff_linesz (abfd));
- finfo.contents = (bfd_byte *) bfd_malloc (max_contents_size);
- finfo.external_relocs = (bfd_byte *) bfd_malloc (max_reloc_count * relsz);
+ amt = max_sym_count * sizeof (struct internal_syment);
+ finfo.internal_syms = (struct internal_syment *) bfd_malloc (amt);
+
+ amt = max_sym_count * sizeof (long);
+ finfo.sym_indices = (long *) bfd_malloc (amt);
+
+ amt = (max_sym_count + 1) * symesz;
+ finfo.outsyms = (bfd_byte *) bfd_malloc (amt);
+
+ amt = max_lineno_count * bfd_coff_linesz (abfd);
+ finfo.linenos = (bfd_byte *) bfd_malloc (amt);
+
+ amt = max_contents_size;
+ finfo.contents = (bfd_byte *) bfd_malloc (amt);
+
+ amt = max_reloc_count * relsz;
+ finfo.external_relocs = (bfd_byte *) bfd_malloc (amt);
+
if ((finfo.internal_syms == NULL && max_sym_count > 0)
|| (finfo.sym_indices == NULL && max_sym_count > 0)
|| finfo.outsyms == NULL
@@ -4177,6 +3926,7 @@ _bfd_xcoff_bfd_final_link (abfd, info)
}
}
+
/* Free up the buffers used by xcoff_link_input_bfd. */
if (finfo.internal_syms != NULL)
@@ -4209,14 +3959,12 @@ _bfd_xcoff_bfd_final_link (abfd, info)
it out again. */
if (finfo.last_file_index != -1)
{
- finfo.last_file.n_value = -1;
+ finfo.last_file.n_value = -(bfd_vma) 1;
bfd_coff_swap_sym_out (abfd, (PTR) &finfo.last_file,
(PTR) finfo.outsyms);
- if (bfd_seek (abfd,
- (obj_sym_filepos (abfd)
- + finfo.last_file_index * symesz),
- SEEK_SET) != 0
- || bfd_write (finfo.outsyms, symesz, 1, abfd) != symesz)
+ pos = obj_sym_filepos (abfd) + finfo.last_file_index * symesz;
+ if (bfd_seek (abfd, pos, SEEK_SET) != 0
+ || bfd_bwrite (finfo.outsyms, symesz, abfd) != symesz)
goto error_return;
}
@@ -4235,7 +3983,8 @@ _bfd_xcoff_bfd_final_link (abfd, info)
/* Now that we have written out all the global symbols, we know the
symbol indices to use for relocs against them, and we can finally
write out the relocs. */
- external_relocs = (bfd_byte *) bfd_malloc (max_output_reloc_count * relsz);
+ amt = max_output_reloc_count * relsz;
+ external_relocs = (bfd_byte *) bfd_malloc (amt);
if (external_relocs == NULL && max_output_reloc_count != 0)
goto error_return;
@@ -4246,6 +3995,7 @@ _bfd_xcoff_bfd_final_link (abfd, info)
struct xcoff_link_hash_entry **rel_hash;
struct xcoff_toc_rel_hash *toc_rel_hash;
bfd_byte *erel;
+ bfd_size_type rel_size;
/* A stripped file has no relocs. */
if (info->strip == strip_all)
@@ -4292,10 +4042,10 @@ _bfd_xcoff_bfd_final_link (abfd, info)
}
/* XCOFF requires that the relocs be sorted by address. We tend
- to produce them in the order in which their containing csects
- appear in the symbol table, which is not necessarily by
- address. So we sort them here. There may be a better way to
- do this. */
+ to produce them in the order in which their containing csects
+ appear in the symbol table, which is not necessarily by
+ address. So we sort them here. There may be a better way to
+ do this. */
qsort ((PTR) finfo.section_info[o->target_index].relocs,
o->reloc_count, sizeof (struct internal_reloc),
xcoff_sort_relocs);
@@ -4306,9 +4056,9 @@ _bfd_xcoff_bfd_final_link (abfd, info)
for (; irel < irelend; irel++, rel_hash++, erel += relsz)
bfd_coff_swap_reloc_out (abfd, (PTR) irel, (PTR) erel);
+ rel_size = relsz * o->reloc_count;
if (bfd_seek (abfd, o->rel_filepos, SEEK_SET) != 0
- || bfd_write ((PTR) external_relocs, relsz, o->reloc_count,
- abfd) != relsz * o->reloc_count)
+ || bfd_bwrite ((PTR) external_relocs, rel_size, abfd) != rel_size)
goto error_return;
}
@@ -4339,38 +4089,39 @@ _bfd_xcoff_bfd_final_link (abfd, info)
== (xcoff_hash_table (info)->loader_section->contents
+ xcoff_hash_table (info)->ldhdr.l_impoff));
o = xcoff_hash_table (info)->loader_section;
- if (! bfd_set_section_contents (abfd, o->output_section,
- o->contents, o->output_offset,
- o->_raw_size))
+ if (! bfd_set_section_contents (abfd, o->output_section, o->contents,
+ (file_ptr) o->output_offset, o->_raw_size))
goto error_return;
/* Write out the magic sections. */
o = xcoff_hash_table (info)->linkage_section;
if (o->_raw_size > 0
&& ! bfd_set_section_contents (abfd, o->output_section, o->contents,
- o->output_offset, o->_raw_size))
+ (file_ptr) o->output_offset,
+ o->_raw_size))
goto error_return;
o = xcoff_hash_table (info)->toc_section;
if (o->_raw_size > 0
&& ! bfd_set_section_contents (abfd, o->output_section, o->contents,
- o->output_offset, o->_raw_size))
+ (file_ptr) o->output_offset,
+ o->_raw_size))
goto error_return;
o = xcoff_hash_table (info)->descriptor_section;
if (o->_raw_size > 0
&& ! bfd_set_section_contents (abfd, o->output_section, o->contents,
- o->output_offset, o->_raw_size))
+ (file_ptr) o->output_offset,
+ o->_raw_size))
goto error_return;
/* Write out the string table. */
- if (bfd_seek (abfd,
- (obj_sym_filepos (abfd)
- + obj_raw_syment_count (abfd) * symesz),
- SEEK_SET) != 0)
+ pos = obj_sym_filepos (abfd) + obj_raw_syment_count (abfd) * symesz;
+ if (bfd_seek (abfd, pos, SEEK_SET) != 0)
goto error_return;
- bfd_h_put_32 (abfd,
- _bfd_stringtab_size (finfo.strtab) + STRING_SIZE_SIZE,
- (bfd_byte *) strbuf);
- if (bfd_write (strbuf, 1, STRING_SIZE_SIZE, abfd) != STRING_SIZE_SIZE)
+ H_PUT_32 (abfd,
+ _bfd_stringtab_size (finfo.strtab) + STRING_SIZE_SIZE,
+ strbuf);
+ amt = STRING_SIZE_SIZE;
+ if (bfd_bwrite (strbuf, amt, abfd) != amt)
goto error_return;
if (! _bfd_stringtab_emit (abfd, finfo.strtab))
goto error_return;
@@ -4386,9 +4137,8 @@ _bfd_xcoff_bfd_final_link (abfd, info)
debug_strtab = xcoff_hash_table (info)->debug_strtab;
BFD_ASSERT (o->output_section->_raw_size - o->output_offset
>= _bfd_stringtab_size (debug_strtab));
- if (bfd_seek (abfd,
- o->output_section->filepos + o->output_offset,
- SEEK_SET) != 0)
+ pos = o->output_section->filepos + o->output_offset;
+ if (bfd_seek (abfd, pos, SEEK_SET) != 0)
goto error_return;
if (! _bfd_stringtab_emit (abfd, debug_strtab))
goto error_return;
@@ -4403,6 +4153,7 @@ _bfd_xcoff_bfd_final_link (abfd, info)
error_return:
if (finfo.strtab != NULL)
_bfd_stringtab_free (finfo.strtab);
+
if (finfo.section_info != NULL)
{
unsigned int i;
@@ -4416,6 +4167,7 @@ _bfd_xcoff_bfd_final_link (abfd, info)
}
free (finfo.section_info);
}
+
if (finfo.internal_syms != NULL)
free (finfo.internal_syms);
if (finfo.sym_indices != NULL)
@@ -4510,6 +4262,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
while (esym < esym_end)
{
+
struct internal_syment isym;
union internal_auxent aux;
int smtyp = 0;
@@ -4529,6 +4282,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
isymp->n_type, isymp->n_sclass,
isymp->n_numaux - 1, isymp->n_numaux,
(PTR) &aux);
+
smtyp = SMTYP_SMTYP (aux.x_csect.x_smtyp);
}
@@ -4613,17 +4367,20 @@ xcoff_link_input_bfd (finfo, input_bfd)
ldsym->l_parm = 0;
BFD_ASSERT (h->ldindx >= 0);
- BFD_ASSERT (LDSYMSZ == sizeof (struct external_ldsym));
- xcoff_swap_ldsym_out (finfo->output_bfd, ldsym,
- finfo->ldsym + h->ldindx - 3);
+ bfd_xcoff_swap_ldsym_out (finfo->output_bfd, ldsym,
+ (finfo->ldsym
+ + ((h->ldindx - 3)
+ * bfd_xcoff_ldsymsz (finfo->output_bfd))));
h->ldsym = NULL;
/* Fill in snentry now that we know the target_index. */
if ((h->flags & XCOFF_ENTRY) != 0
&& (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak))
- xcoff_data (output_bfd)->snentry =
- h->root.u.def.section->output_section->target_index;
+ {
+ xcoff_data (output_bfd)->snentry =
+ h->root.u.def.section->output_section->target_index;
+ }
}
*indexp = -1;
@@ -4678,7 +4435,6 @@ xcoff_link_input_bfd (finfo, input_bfd)
inp != NULL;
inp = inp->link_next)
{
- asection *o;
for (o = inp->sections; o != NULL; o = o->next)
if (strcmp (o->name, ".tocbss") == 0)
@@ -4716,6 +4472,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
xcoff_data (finfo->output_bfd)->sntoc =
(*csectpp)->output_section->target_index;
require = true;
+
}
}
@@ -4771,6 +4528,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
char buf[SYMNMLEN + 1];
name = _bfd_coff_internal_syment_name (input_bfd, &isym, buf);
+
if (name == NULL)
return false;
@@ -4811,6 +4569,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
name = _bfd_coff_internal_syment_name (input_bfd, &isym,
(char *) NULL);
+
if (name == NULL)
return false;
indx = _bfd_stringtab_add (finfo->strtab, name, hash, copy);
@@ -4839,7 +4598,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
if (isym.n_sclass == C_FILE)
{
if (finfo->last_file_index != -1
- && finfo->last_file.n_value != (long) output_index)
+ && finfo->last_file.n_value != (bfd_vma) output_index)
{
/* We must correct the value of the last C_FILE entry. */
finfo->last_file.n_value = output_index;
@@ -4858,14 +4617,16 @@ xcoff_link_input_bfd (finfo, input_bfd)
/* We have already written out the last C_FILE
symbol. We need to write it out again. We
borrow *outsym temporarily. */
+ file_ptr pos;
+
bfd_coff_swap_sym_out (output_bfd,
(PTR) &finfo->last_file,
(PTR) outsym);
- if (bfd_seek (output_bfd,
- (obj_sym_filepos (output_bfd)
- + finfo->last_file_index * osymesz),
- SEEK_SET) != 0
- || (bfd_write (outsym, osymesz, 1, output_bfd)
+
+ pos = obj_sym_filepos (output_bfd);
+ pos += finfo->last_file_index * osymesz;
+ if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
+ || (bfd_bwrite (outsym, osymesz, output_bfd)
!= osymesz))
return false;
}
@@ -4956,7 +4717,8 @@ xcoff_link_input_bfd (finfo, input_bfd)
if (isymp->n_sclass == C_BSTAT)
{
struct internal_syment isym;
- unsigned long indx;
+
+ bfd_vma indx;
/* The value of a C_BSTAT symbol is the symbol table
index of the containing csect. */
@@ -5018,6 +4780,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
|| isymp->n_sclass == C_HIDEXT)
&& i + 1 == isymp->n_numaux)
{
+
/* We don't support type checking. I don't know if
anybody does. */
aux.x_csect.x_parmhash = 0;
@@ -5025,6 +4788,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
better clobber them just in case. */
aux.x_csect.x_stab = 0;
aux.x_csect.x_snstab = 0;
+
if (SMTYP_SMTYP (aux.x_csect.x_smtyp) == XTY_LD)
{
unsigned long indx;
@@ -5036,9 +4800,13 @@ xcoff_link_input_bfd (finfo, input_bfd)
symindx = finfo->sym_indices[indx];
if (symindx < 0)
- aux.x_sym.x_tagndx.l = 0;
+ {
+ aux.x_csect.x_scnlen.l = 0;
+ }
else
- aux.x_sym.x_tagndx.l = symindx;
+ {
+ aux.x_csect.x_scnlen.l = symindx;
+ }
}
}
}
@@ -5067,6 +4835,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
else
indx = finfo->sym_indices[indx];
aux.x_sym.x_fcnary.x_fcn.x_endndx.l = indx;
+
}
}
@@ -5081,6 +4850,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
else
aux.x_sym.x_tagndx.l = symindx;
}
+
}
/* Copy over the line numbers, unless we are stripping
@@ -5100,7 +4870,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
{
asection *enclosing;
unsigned int enc_count;
- bfd_size_type linoff;
+ bfd_signed_vma linoff;
struct internal_lineno lin;
o = *csectpp;
@@ -5108,12 +4878,11 @@ xcoff_link_input_bfd (finfo, input_bfd)
enc_count = xcoff_section_data (abfd, o)->lineno_count;
if (oline != enclosing)
{
- if (bfd_seek (input_bfd,
- enclosing->line_filepos,
- SEEK_SET) != 0
- || (bfd_read (finfo->linenos, linesz,
- enc_count, input_bfd)
- != linesz * enc_count))
+ file_ptr pos = enclosing->line_filepos;
+ bfd_size_type amt = linesz * enc_count;
+ if (bfd_seek (input_bfd, pos, SEEK_SET) != 0
+ || (bfd_bread (finfo->linenos, amt, input_bfd)
+ != amt))
return false;
oline = enclosing;
}
@@ -5171,8 +4940,8 @@ xcoff_link_input_bfd (finfo, input_bfd)
if (bfd_seek (output_bfd,
aux.x_sym.x_fcnary.x_fcn.x_lnnoptr,
SEEK_SET) != 0
- || (bfd_write (finfo->linenos + linoff,
- linesz, count, output_bfd)
+ || (bfd_bwrite (finfo->linenos + linoff,
+ linesz * count, output_bfd)
!= linesz * count))
return false;
@@ -5199,7 +4968,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
&& (iisp->n_sclass == C_BINCL
|| iisp->n_sclass == C_EINCL)
&& ((bfd_size_type) iisp->n_value
- >= enclosing->line_filepos + linoff)
+ >= (bfd_size_type)(enclosing->line_filepos + linoff))
&& ((bfd_size_type) iisp->n_value
< (enclosing->line_filepos
+ enc_count * linesz)))
@@ -5261,12 +5030,10 @@ xcoff_link_input_bfd (finfo, input_bfd)
/* Write the modified symbols to the output file. */
if (outsym > finfo->outsyms)
{
- if (bfd_seek (output_bfd,
- obj_sym_filepos (output_bfd) + syment_base * osymesz,
- SEEK_SET) != 0
- || (bfd_write (finfo->outsyms, outsym - finfo->outsyms, 1,
- output_bfd)
- != (bfd_size_type) (outsym - finfo->outsyms)))
+ file_ptr pos = obj_sym_filepos (output_bfd) + syment_base * osymesz;
+ bfd_size_type amt = outsym - finfo->outsyms;
+ if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
+ || bfd_bwrite (finfo->outsyms, amt, output_bfd) != amt)
return false;
BFD_ASSERT ((obj_raw_syment_count (output_bfd)
@@ -5283,6 +5050,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
/* Relocate the contents of each section. */
for (o = input_bfd->sections; o != NULL; o = o->next)
{
+
bfd_byte *contents;
if (! o->linker_mark)
@@ -5297,17 +5065,16 @@ xcoff_link_input_bfd (finfo, input_bfd)
continue;
/* We have set filepos correctly for the sections we created to
- represent csects, so bfd_get_section_contents should work. */
+ represent csects, so bfd_get_section_contents should work. */
if (coff_section_data (input_bfd, o) != NULL
&& coff_section_data (input_bfd, o)->contents != NULL)
contents = coff_section_data (input_bfd, o)->contents;
- else
- {
- if (! bfd_get_section_contents (input_bfd, o, finfo->contents,
- (file_ptr) 0, o->_raw_size))
- return false;
- contents = finfo->contents;
- }
+ else {
+ if (! bfd_get_section_contents (input_bfd, o, finfo->contents,
+ (file_ptr) 0, o->_raw_size))
+ return false;
+ contents = finfo->contents;
+ }
if ((o->flags & SEC_RELOC) != 0)
{
@@ -5330,7 +5097,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
return false;
/* Call processor specific code to relocate the section
- contents. */
+ contents. */
if (! bfd_coff_relocate_section (output_bfd, finfo->info,
input_bfd, o,
contents,
@@ -5374,10 +5141,10 @@ xcoff_link_input_bfd (finfo, input_bfd)
|| irel->r_type == R_TRLA))
{
/* This is a TOC relative reloc with a symbol
- attached. The symbol should be the one which
- this reloc is for. We want to make this
- reloc against the TOC address of the symbol,
- not the symbol itself. */
+ attached. The symbol should be the one which
+ this reloc is for. We want to make this
+ reloc against the TOC address of the symbol,
+ not the symbol itself. */
BFD_ASSERT (h->toc_section != NULL);
BFD_ASSERT ((h->flags & XCOFF_SET_TOC) == 0);
if (h->u.toc_indx != -1)
@@ -5386,10 +5153,11 @@ xcoff_link_input_bfd (finfo, input_bfd)
{
struct xcoff_toc_rel_hash *n;
struct xcoff_link_section_info *si;
+ bfd_size_type amt;
+ amt = sizeof (struct xcoff_toc_rel_hash);
n = ((struct xcoff_toc_rel_hash *)
- bfd_alloc (finfo->output_bfd,
- sizeof (struct xcoff_toc_rel_hash)));
+ bfd_alloc (finfo->output_bfd, amt));
if (n == NULL)
return false;
si = finfo->section_info + target_index;
@@ -5456,7 +5224,9 @@ xcoff_link_input_bfd (finfo, input_bfd)
irel->r_symndx = indx;
else
{
+
struct internal_syment *is;
+
const char *name;
char buf[SYMNMLEN + 1];
@@ -5467,6 +5237,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
name = (_bfd_coff_internal_syment_name
(input_bfd, is, buf));
+
if (name == NULL)
return false;
@@ -5496,7 +5267,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
section. */
ldrel.l_vaddr = irel->r_vaddr;
if (r_symndx == -1)
- ldrel.l_symndx = -1;
+ ldrel.l_symndx = -(bfd_size_type ) 1;
else if (h == NULL
|| (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak
@@ -5522,7 +5293,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
{
(*_bfd_error_handler)
(_("%s: loader reloc in unrecognized section `%s'"),
- bfd_get_filename (input_bfd),
+ bfd_archive_filename (input_bfd),
sec->name);
bfd_set_error (bfd_error_nonrepresentable_section);
return false;
@@ -5544,7 +5315,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
{
(*_bfd_error_handler)
(_("%s: `%s' in loader reloc but not loader sym"),
- bfd_get_filename (input_bfd),
+ bfd_archive_filename (input_bfd),
h->root.root.string);
bfd_set_error (bfd_error_bad_value);
return false;
@@ -5559,16 +5330,16 @@ xcoff_link_input_bfd (finfo, input_bfd)
{
(*_bfd_error_handler)
(_("%s: loader reloc in read-only section %s"),
- bfd_get_filename (input_bfd),
+ bfd_archive_filename (input_bfd),
bfd_get_section_name (finfo->output_bfd,
o->output_section));
bfd_set_error (bfd_error_invalid_operation);
return false;
}
- xcoff_swap_ldrel_out (output_bfd, &ldrel,
- finfo->ldrel);
- BFD_ASSERT (sizeof (struct external_ldrel) == LDRELSZ);
- ++finfo->ldrel;
+ bfd_xcoff_swap_ldrel_out (output_bfd, &ldrel,
+ finfo->ldrel);
+
+ finfo->ldrel += bfd_xcoff_ldrelsz(output_bfd);
break;
case R_TOC:
@@ -5587,7 +5358,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
/* Write out the modified section contents. */
if (! bfd_set_section_contents (output_bfd, o->output_section,
- contents, o->output_offset,
+ contents, (file_ptr) o->output_offset,
(o->_cooked_size != 0
? o->_cooked_size
: o->_raw_size)))
@@ -5610,20 +5381,31 @@ xcoff_link_input_bfd (finfo, input_bfd)
/* Write out a non-XCOFF global symbol. */
+
static boolean
-xcoff_write_global_symbol (h, p)
+xcoff_write_global_symbol (h, inf)
struct xcoff_link_hash_entry *h;
- PTR p;
+ PTR inf;
{
- struct xcoff_final_link_info *finfo = (struct xcoff_final_link_info *) p;
+ struct xcoff_final_link_info *finfo = (struct xcoff_final_link_info *) inf;
bfd *output_bfd;
bfd_byte *outsym;
struct internal_syment isym;
union internal_auxent aux;
+ boolean result;
+ file_ptr pos;
+ bfd_size_type amt;
output_bfd = finfo->output_bfd;
outsym = finfo->outsyms;
+ if (h->root.type == bfd_link_hash_warning)
+ {
+ h = (struct xcoff_link_hash_entry *) h->root.u.i.link;
+ if (h->root.type == bfd_link_hash_new)
+ return true;
+ }
+
/* If this symbol was garbage collected, just skip it. */
if (xcoff_hash_table (finfo->info)->gc
&& (h->flags & XCOFF_MARK) == 0)
@@ -5640,14 +5422,17 @@ xcoff_write_global_symbol (h, p)
if (h->root.type == bfd_link_hash_undefined
|| h->root.type == bfd_link_hash_undefweak)
{
+
ldsym->l_value = 0;
ldsym->l_scnum = N_UNDEF;
ldsym->l_smtype = XTY_ER;
impbfd = h->root.u.undef.abfd;
+
}
else if (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
{
+
asection *sec;
sec = h->root.u.def.section;
@@ -5657,6 +5442,7 @@ xcoff_write_global_symbol (h, p)
ldsym->l_scnum = sec->output_section->target_index;
ldsym->l_smtype = XTY_SD;
impbfd = sec->owner;
+
}
else
abort ();
@@ -5664,24 +5450,70 @@ xcoff_write_global_symbol (h, p)
if (((h->flags & XCOFF_DEF_REGULAR) == 0
&& (h->flags & XCOFF_DEF_DYNAMIC) != 0)
|| (h->flags & XCOFF_IMPORT) != 0)
- ldsym->l_smtype |= L_IMPORT;
+ {
+ /* Clear l_smtype
+ Import symbols are defined so the check above will make
+ the l_smtype XTY_SD. But this is not correct, it should
+ be cleared. */
+ ldsym->l_smtype |= L_IMPORT;
+ }
+
if (((h->flags & XCOFF_DEF_REGULAR) != 0
&& (h->flags & XCOFF_DEF_DYNAMIC) != 0)
|| (h->flags & XCOFF_EXPORT) != 0)
- ldsym->l_smtype |= L_EXPORT;
+ {
+ ldsym->l_smtype |= L_EXPORT;
+ }
+
if ((h->flags & XCOFF_ENTRY) != 0)
- ldsym->l_smtype |= L_ENTRY;
+ {
+ ldsym->l_smtype |= L_ENTRY;
+ }
+
+ if ((h->flags & XCOFF_RTINIT) != 0)
+ {
+ ldsym->l_smtype = XTY_SD;
+ }
ldsym->l_smclas = h->smclas;
- if (ldsym->l_ifile == (bfd_size_type) -1)
- ldsym->l_ifile = 0;
+ if (ldsym->l_smtype & L_IMPORT)
+ {
+ if ((h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && (h->root.u.def.value != 0))
+ {
+ ldsym->l_smclas = XMC_XO;
+ }
+ else if ((h->flags & (XCOFF_SYSCALL32 | XCOFF_SYSCALL64)) ==
+ (XCOFF_SYSCALL32 | XCOFF_SYSCALL64))
+ {
+ ldsym->l_smclas = XMC_SV3264;
+ }
+ else if (h->flags & XCOFF_SYSCALL32)
+ {
+ ldsym->l_smclas = XMC_SV;
+ }
+ else if (h->flags & XCOFF_SYSCALL64)
+ {
+ ldsym->l_smclas = XMC_SV64;
+ }
+ }
+
+ if (ldsym->l_ifile == -(bfd_size_type) 1)
+ {
+ ldsym->l_ifile = 0;
+ }
else if (ldsym->l_ifile == 0)
{
if ((ldsym->l_smtype & L_IMPORT) == 0)
- ldsym->l_ifile = 0;
+ {
+ ldsym->l_ifile = 0;
+ }
else if (impbfd == NULL)
- ldsym->l_ifile = 0;
+ {
+ ldsym->l_ifile = 0;
+ }
else
{
BFD_ASSERT (impbfd->xvec == output_bfd->xvec);
@@ -5692,8 +5524,11 @@ xcoff_write_global_symbol (h, p)
ldsym->l_parm = 0;
BFD_ASSERT (h->ldindx >= 0);
- BFD_ASSERT (LDSYMSZ == sizeof (struct external_ldsym));
- xcoff_swap_ldsym_out (output_bfd, ldsym, finfo->ldsym + h->ldindx - 3);
+
+ bfd_xcoff_swap_ldsym_out (output_bfd, ldsym,
+ (finfo->ldsym +
+ (h->ldindx - 3)
+ * bfd_xcoff_ldsymsz(finfo->output_bfd)));
h->ldsym = NULL;
}
@@ -5709,17 +5544,32 @@ xcoff_write_global_symbol (h, p)
p = h->root.u.def.section->contents + h->root.u.def.value;
/* The first instruction in the global linkage code loads a
- specific TOC element. */
+ specific TOC element. */
tocoff = (h->descriptor->toc_section->output_section->vma
+ h->descriptor->toc_section->output_offset
- xcoff_data (output_bfd)->toc);
+
if ((h->descriptor->flags & XCOFF_SET_TOC) != 0)
- tocoff += h->descriptor->u.toc_offset;
- bfd_put_32 (output_bfd, XCOFF_GLINK_FIRST | (tocoff & 0xffff), p);
- for (i = 0, p += 4;
- i < sizeof xcoff_glink_code / sizeof xcoff_glink_code[0];
- i++, p += 4)
- bfd_put_32 (output_bfd, xcoff_glink_code[i], p);
+ {
+ tocoff += h->descriptor->u.toc_offset;
+ }
+
+
+ /* The first instruction in the glink code needs to be
+ cooked to to hold the correct offset in the toc. The
+ rest are just output raw. */
+ bfd_put_32 (output_bfd,
+ bfd_xcoff_glink_code(output_bfd, 0) | (tocoff & 0xffff), p);
+
+ /* Start with i == 1 to get past the first instruction done above
+ The /4 is because the glink code is in bytes and we are going
+ 4 at a pop. */
+ for (i = 1; i < bfd_xcoff_glink_code_size(output_bfd) / 4; i++)
+ {
+ bfd_put_32 (output_bfd,
+ (bfd_vma) bfd_xcoff_glink_code(output_bfd, i),
+ &p[4 * i]);
+ }
}
/* If we created a TOC entry for this symbol, write out the required
@@ -5741,46 +5591,69 @@ xcoff_write_global_symbol (h, p)
irel->r_vaddr = (osec->vma
+ tocsec->output_offset
+ h->u.toc_offset);
+
+
if (h->indx >= 0)
- irel->r_symndx = h->indx;
+ {
+ irel->r_symndx = h->indx;
+ }
else
{
h->indx = -2;
irel->r_symndx = obj_raw_syment_count (output_bfd);
}
+
+ BFD_ASSERT (h->ldindx >= 0);
+
+ /* Initialize the aux union here instead of closer to when it is
+ written out below because the length of the csect depends on
+ whether the output is 32 or 64 bit. */
+ memset (&iraux, 0, sizeof iraux);
+ iraux.x_csect.x_smtyp = XTY_SD;
+ /* iraux.x_csect.x_scnlen.l = 4 or 8, see below */
+ iraux.x_csect.x_smclas = XMC_TC;
+
+ /* 32 bit uses a 32 bit R_POS to do the relocations
+ 64 bit uses a 64 bit R_POS to do the relocations
+
+ Also needs to change the csect size : 4 for 32 bit, 8 for 64 bit
+
+ Which one is determined by the backend. */
+ if (bfd_xcoff_is_xcoff64 (output_bfd))
+ {
+ irel->r_size = 63;
+ iraux.x_csect.x_scnlen.l = 8;
+ }
+ else if (bfd_xcoff_is_xcoff32 (output_bfd))
+ {
+ irel->r_size = 31;
+ iraux.x_csect.x_scnlen.l = 4;
+ }
+ else
+ {
+ return false;
+ }
irel->r_type = R_POS;
- irel->r_size = 31;
finfo->section_info[oindx].rel_hashes[osec->reloc_count] = NULL;
++osec->reloc_count;
- BFD_ASSERT (h->ldindx >= 0);
ldrel.l_vaddr = irel->r_vaddr;
ldrel.l_symndx = h->ldindx;
- ldrel.l_rtype = (31 << 8) | R_POS;
+ ldrel.l_rtype = (irel->r_size << 8) | R_POS;
ldrel.l_rsecnm = oindx;
- xcoff_swap_ldrel_out (output_bfd, &ldrel, finfo->ldrel);
- ++finfo->ldrel;
+ bfd_xcoff_swap_ldrel_out (output_bfd, &ldrel, finfo->ldrel);
+ finfo->ldrel += bfd_xcoff_ldrelsz(output_bfd);
- /* We need to emit a symbol to define a csect which holds the
- reloc. */
+ /* We need to emit a symbol to define a csect which holds
+ the reloc. */
if (finfo->info->strip != strip_all)
{
- if (strlen (h->root.root.string) <= SYMNMLEN)
- strncpy (irsym._n._n_name, h->root.root.string, SYMNMLEN);
- else
- {
- boolean hash;
- bfd_size_type indx;
- hash = true;
- if ((output_bfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
- hash = false;
- indx = _bfd_stringtab_add (finfo->strtab, h->root.root.string,
- hash, false);
- if (indx == (bfd_size_type) -1)
- return false;
- irsym._n._n_n._n_zeroes = 0;
- irsym._n._n_n._n_offset = STRING_SIZE_SIZE + indx;
+ result = bfd_xcoff_put_symbol_name (output_bfd, finfo->strtab,
+ &irsym, h->root.root.string);
+ if (false == result)
+ {
+ return false;
}
irsym.n_value = irel->r_vaddr;
@@ -5792,11 +5665,7 @@ xcoff_write_global_symbol (h, p)
bfd_coff_swap_sym_out (output_bfd, (PTR) &irsym, (PTR) outsym);
outsym += bfd_coff_symesz (output_bfd);
- memset (&iraux, 0, sizeof iraux);
- iraux.x_csect.x_smtyp = XTY_SD;
- iraux.x_csect.x_scnlen.l = 4;
- iraux.x_csect.x_smclas = XMC_TC;
-
+ /* note : iraux is initialized above */
bfd_coff_swap_aux_out (output_bfd, (PTR) &iraux, T_NULL, C_HIDEXT,
0, 1, (PTR) outsym);
outsym += bfd_coff_auxesz (output_bfd);
@@ -5805,14 +5674,12 @@ xcoff_write_global_symbol (h, p)
{
/* We aren't going to write out the symbols below, so we
need to write them out now. */
- if (bfd_seek (output_bfd,
- (obj_sym_filepos (output_bfd)
- + (obj_raw_syment_count (output_bfd)
- * bfd_coff_symesz (output_bfd))),
- SEEK_SET) != 0
- || (bfd_write (finfo->outsyms, outsym - finfo->outsyms, 1,
- output_bfd)
- != (bfd_size_type) (outsym - finfo->outsyms)))
+ pos = obj_sym_filepos (output_bfd);
+ pos += (obj_raw_syment_count (output_bfd)
+ * bfd_coff_symesz (output_bfd));
+ amt = outsym - finfo->outsyms;
+ if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
+ || bfd_bwrite (finfo->outsyms, amt, output_bfd) != amt)
return false;
obj_raw_syment_count (output_bfd) +=
(outsym - finfo->outsyms) / bfd_coff_symesz (output_bfd);
@@ -5825,7 +5692,13 @@ xcoff_write_global_symbol (h, p)
/* If this symbol is a specially defined function descriptor, write
it out. The first word is the address of the function code
itself, the second word is the address of the TOC, and the third
- word is zero. */
+ word is zero.
+
+ 32 bit vs 64 bit
+ The addresses for the 32 bit will take 4 bytes and the addresses
+ for 64 bit will take 8 bytes. Similar for the relocs. This type
+ of logic was also done above to create a TOC entry in
+ xcoff_write_global_symbol. */
if ((h->flags & XCOFF_DESCRIPTOR) != 0
&& h->root.type == bfd_link_hash_defined
&& (h->root.u.def.section
@@ -5840,6 +5713,22 @@ xcoff_write_global_symbol (h, p)
struct internal_reloc *irel;
struct internal_ldrel ldrel;
asection *tsec;
+ unsigned int reloc_size, byte_size;
+
+ if (bfd_xcoff_is_xcoff64 (output_bfd))
+ {
+ reloc_size = 63;
+ byte_size = 8;
+ }
+ else if (bfd_xcoff_is_xcoff32 (output_bfd))
+ {
+ reloc_size = 31;
+ byte_size = 4;
+ }
+ else
+ {
+ return false;
+ }
sec = h->root.u.def.section;
osec = sec->output_section;
@@ -5851,11 +5740,6 @@ xcoff_write_global_symbol (h, p)
&& (hentry->root.type == bfd_link_hash_defined
|| hentry->root.type == bfd_link_hash_defweak));
esec = hentry->root.u.def.section;
- bfd_put_32 (output_bfd,
- (esec->output_section->vma
- + esec->output_offset
- + hentry->root.u.def.value),
- p);
irel = finfo->section_info[oindx].relocs + osec->reloc_count;
irel->r_vaddr = (osec->vma
@@ -5863,7 +5747,7 @@ xcoff_write_global_symbol (h, p)
+ h->root.u.def.value);
irel->r_symndx = esec->output_section->target_index;
irel->r_type = R_POS;
- irel->r_size = 31;
+ irel->r_size = reloc_size;
finfo->section_info[oindx].rel_hashes[osec->reloc_count] = NULL;
++osec->reloc_count;
@@ -5883,12 +5767,37 @@ xcoff_write_global_symbol (h, p)
bfd_set_error (bfd_error_nonrepresentable_section);
return false;
}
- ldrel.l_rtype = (31 << 8) | R_POS;
+ ldrel.l_rtype = (reloc_size << 8) | R_POS;
ldrel.l_rsecnm = oindx;
- xcoff_swap_ldrel_out (output_bfd, &ldrel, finfo->ldrel);
- ++finfo->ldrel;
-
- bfd_put_32 (output_bfd, xcoff_data (output_bfd)->toc, p + 4);
+ bfd_xcoff_swap_ldrel_out (output_bfd, &ldrel, finfo->ldrel);
+ finfo->ldrel += bfd_xcoff_ldrelsz(output_bfd);
+
+ /* There are three items to write out,
+ the address of the code
+ the address of the toc anchor
+ the environment pointer.
+ We are ignoring the environment pointer. So set it to zero. */
+ if (bfd_xcoff_is_xcoff64 (output_bfd))
+ {
+ bfd_put_64 (output_bfd,
+ (esec->output_section->vma + esec->output_offset
+ + hentry->root.u.def.value),
+ p);
+ bfd_put_64 (output_bfd, xcoff_data (output_bfd)->toc, p + 8);
+ bfd_put_64 (output_bfd, (bfd_vma) 0, p + 16);
+ }
+ else
+ {
+ /* 32 bit backend
+ This logic was already called above so the error case where
+ the backend is neither has already been checked. */
+ bfd_put_32 (output_bfd,
+ (esec->output_section->vma + esec->output_offset
+ + hentry->root.u.def.value),
+ p);
+ bfd_put_32 (output_bfd, xcoff_data (output_bfd)->toc, p + 4);
+ bfd_put_32 (output_bfd, (bfd_vma) 0, p + 8);
+ }
tsec = coff_section_from_bfd_index (output_bfd,
xcoff_data (output_bfd)->sntoc);
@@ -5897,10 +5806,10 @@ xcoff_write_global_symbol (h, p)
irel->r_vaddr = (osec->vma
+ sec->output_offset
+ h->root.u.def.value
- + 4);
+ + byte_size);
irel->r_symndx = tsec->output_section->target_index;
irel->r_type = R_POS;
- irel->r_size = 31;
+ irel->r_size = reloc_size;
finfo->section_info[oindx].rel_hashes[osec->reloc_count] = NULL;
++osec->reloc_count;
@@ -5920,10 +5829,10 @@ xcoff_write_global_symbol (h, p)
bfd_set_error (bfd_error_nonrepresentable_section);
return false;
}
- ldrel.l_rtype = (31 << 8) | R_POS;
+ ldrel.l_rtype = (reloc_size << 8) | R_POS;
ldrel.l_rsecnm = oindx;
- xcoff_swap_ldrel_out (output_bfd, &ldrel, finfo->ldrel);
- ++finfo->ldrel;
+ bfd_xcoff_swap_ldrel_out (output_bfd, &ldrel, finfo->ldrel);
+ finfo->ldrel += bfd_xcoff_ldrelsz(output_bfd);
}
if (h->indx >= 0 || finfo->info->strip == strip_all)
@@ -5935,9 +5844,8 @@ xcoff_write_global_symbol (h, p)
if (h->indx != -2
&& (finfo->info->strip == strip_all
|| (finfo->info->strip == strip_some
- && (bfd_hash_lookup (finfo->info->keep_hash,
- h->root.root.string, false, false)
- == NULL))))
+ && bfd_hash_lookup (finfo->info->keep_hash, h->root.root.string,
+ false, false) == NULL)))
{
BFD_ASSERT (outsym == finfo->outsyms);
return true;
@@ -5954,22 +5862,11 @@ xcoff_write_global_symbol (h, p)
h->indx = obj_raw_syment_count (output_bfd);
- if (strlen (h->root.root.string) <= SYMNMLEN)
- strncpy (isym._n._n_name, h->root.root.string, SYMNMLEN);
- else
+ result = bfd_xcoff_put_symbol_name (output_bfd, finfo->strtab, &isym,
+ h->root.root.string);
+ if (false == result)
{
- boolean hash;
- bfd_size_type indx;
-
- hash = true;
- if ((output_bfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
- hash = false;
- indx = _bfd_stringtab_add (finfo->strtab, h->root.root.string, hash,
- false);
- if (indx == (bfd_size_type) -1)
- return false;
- isym._n._n_n._n_zeroes = 0;
- isym._n._n_n._n_offset = STRING_SIZE_SIZE + indx;
+ return false;
}
if (h->root.type == bfd_link_hash_undefined
@@ -6035,7 +5932,6 @@ xcoff_write_global_symbol (h, p)
outsym += bfd_coff_symesz (output_bfd);
aux.x_csect.x_smclas = h->smclas;
-
bfd_coff_swap_aux_out (output_bfd, (PTR) &aux, T_NULL, isym.n_sclass, 0, 1,
(PTR) outsym);
outsym += bfd_coff_auxesz (output_bfd);
@@ -6054,19 +5950,16 @@ xcoff_write_global_symbol (h, p)
aux.x_csect.x_smtyp = XTY_LD;
aux.x_csect.x_scnlen.l = obj_raw_syment_count (output_bfd);
-
bfd_coff_swap_aux_out (output_bfd, (PTR) &aux, T_NULL, C_EXT, 0, 1,
(PTR) outsym);
outsym += bfd_coff_auxesz (output_bfd);
}
- if (bfd_seek (output_bfd,
- (obj_sym_filepos (output_bfd)
- + (obj_raw_syment_count (output_bfd)
- * bfd_coff_symesz (output_bfd))),
- SEEK_SET) != 0
- || (bfd_write (finfo->outsyms, outsym - finfo->outsyms, 1, output_bfd)
- != (bfd_size_type) (outsym - finfo->outsyms)))
+ pos = obj_sym_filepos (output_bfd);
+ pos += obj_raw_syment_count (output_bfd) * bfd_coff_symesz (output_bfd);
+ amt = outsym - finfo->outsyms;
+ if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
+ || bfd_bwrite (finfo->outsyms, amt, output_bfd) != amt)
return false;
obj_raw_syment_count (output_bfd) +=
(outsym - finfo->outsyms) / bfd_coff_symesz (output_bfd);
@@ -6253,8 +6146,8 @@ xcoff_reloc_link_order (output_bfd, finfo, output_section, link_order)
ldrel.l_rtype = (irel->r_size << 8) | irel->r_type;
ldrel.l_rsecnm = output_section->target_index;
- xcoff_swap_ldrel_out (output_bfd, &ldrel, finfo->ldrel);
- ++finfo->ldrel;
+ bfd_xcoff_swap_ldrel_out (output_bfd, &ldrel, finfo->ldrel);
+ finfo->ldrel += bfd_xcoff_ldrelsz(output_bfd);
return true;
}
@@ -6277,355 +6170,6 @@ xcoff_sort_relocs (p1, p2)
return 0;
}
-/* This is the relocation function for the RS/6000/POWER/PowerPC.
- This is currently the only processor which uses XCOFF; I hope that
- will never change. */
-
-boolean
-_bfd_ppc_xcoff_relocate_section (output_bfd, info, input_bfd,
- input_section, contents, relocs, syms,
- sections)
- bfd *output_bfd;
- struct bfd_link_info *info;
- bfd *input_bfd;
- asection *input_section;
- bfd_byte *contents;
- struct internal_reloc *relocs;
- struct internal_syment *syms;
- asection **sections;
-{
- struct internal_reloc *rel;
- struct internal_reloc *relend;
-
- rel = relocs;
- relend = rel + input_section->reloc_count;
- for (; rel < relend; rel++)
- {
- long symndx;
- struct xcoff_link_hash_entry *h;
- struct internal_syment *sym;
- bfd_vma addend;
- bfd_vma val;
- struct reloc_howto_struct howto;
- bfd_reloc_status_type rstat;
- /* Relocation type R_REF is a special relocation type which is
- merely used to prevent garbage collection from occurring for
- the csect including the symbol which it references. */
- if (rel->r_type == R_REF)
- continue;
- symndx = rel->r_symndx;
- if (symndx == -1)
- {
- h = NULL;
- sym = NULL;
- addend = 0;
- }
- else
- {
- h = obj_xcoff_sym_hashes (input_bfd)[symndx];
- sym = syms + symndx;
- addend = - sym->n_value;
- }
-
- /* We build the howto information on the fly. */
-
- howto.type = rel->r_type;
- howto.rightshift = 0;
- howto.size = 2;
- howto.bitsize = (rel->r_size & 0x1f) + 1;
- howto.pc_relative = false;
- howto.bitpos = 0;
- if ((rel->r_size & 0x80) != 0)
- howto.complain_on_overflow = complain_overflow_signed;
- else
- howto.complain_on_overflow = complain_overflow_bitfield;
- howto.special_function = NULL;
- howto.name = "internal";
- howto.partial_inplace = true;
- if (howto.bitsize == 32)
- howto.src_mask = howto.dst_mask = 0xffffffff;
- else
- {
- howto.src_mask = howto.dst_mask = (1 << howto.bitsize) - 1;
- if (howto.bitsize == 16)
- howto.size = 1;
- }
- howto.pcrel_offset = false;
-
- val = 0;
-
- if (h == NULL)
- {
- asection *sec;
-
- if (symndx == -1)
- {
- sec = bfd_abs_section_ptr;
- val = 0;
- }
- else
- {
- sec = sections[symndx];
- /* Hack to make sure we use the right TOC anchor value
- if this reloc is against the TOC anchor. */
- if (sec->name[3] == '0'
- && strcmp (sec->name, ".tc0") == 0)
- val = xcoff_data (output_bfd)->toc;
- else
- val = (sec->output_section->vma
- + sec->output_offset
- + sym->n_value
- - sec->vma);
- }
- }
- else
- {
- if (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- {
- asection *sec;
-
- sec = h->root.u.def.section;
- val = (h->root.u.def.value
- + sec->output_section->vma
- + sec->output_offset);
- }
- else if (h->root.type == bfd_link_hash_common)
- {
- asection *sec;
-
- sec = h->root.u.c.p->section;
- val = (sec->output_section->vma
- + sec->output_offset);
- }
- else if ((h->flags & XCOFF_DEF_DYNAMIC) != 0
- || (h->flags & XCOFF_IMPORT) != 0)
- {
- /* Every symbol in a shared object is defined somewhere. */
- val = 0;
- }
- else if (! info->relocateable)
- {
- if (! ((*info->callbacks->undefined_symbol)
- (info, h->root.root.string, input_bfd, input_section,
- rel->r_vaddr - input_section->vma, true)))
- return false;
-
- /* Don't try to process the reloc. It can't help, and
- it may generate another error. */
- continue;
- }
- }
-
- /* I took the relocation type definitions from two documents:
- the PowerPC AIX Version 4 Application Binary Interface, First
- Edition (April 1992), and the PowerOpen ABI, Big-Endian
- 32-Bit Hardware Implementation (June 30, 1994). Differences
- between the documents are noted below. */
-
- switch (rel->r_type)
- {
- case R_RTB:
- case R_RRTBI:
- case R_RRTBA:
- /* These relocs are defined by the PowerPC ABI to be
- relative branches which use half of the difference
- between the symbol and the program counter. I can't
- quite figure out when this is useful. These relocs are
- not defined by the PowerOpen ABI. */
- default:
- (*_bfd_error_handler)
- (_("%s: unsupported relocation type 0x%02x"),
- bfd_get_filename (input_bfd), (unsigned int) rel->r_type);
- bfd_set_error (bfd_error_bad_value);
- return false;
- case R_POS:
- /* Simple positive relocation. */
- break;
- case R_NEG:
- /* Simple negative relocation. */
- val = - val;
- break;
- case R_REL:
- /* Simple PC relative relocation. */
- howto.pc_relative = true;
- break;
- case R_TOC:
- /* TOC relative relocation. The value in the instruction in
- the input file is the offset from the input file TOC to
- the desired location. We want the offset from the final
- TOC to the desired location. We have:
- isym = iTOC + in
- iinsn = in + o
- osym = oTOC + on
- oinsn = on + o
- so we must change insn by on - in.
- */
- case R_GL:
- /* Global linkage relocation. The value of this relocation
- is the address of the entry in the TOC section. */
- case R_TCL:
- /* Local object TOC address. I can't figure out the
- difference between this and case R_GL. */
- case R_TRL:
- /* TOC relative relocation. A TOC relative load instruction
- which may be changed to a load address instruction.
- FIXME: We don't currently implement this optimization. */
- case R_TRLA:
- /* TOC relative relocation. This is a TOC relative load
- address instruction which may be changed to a load
- instruction. FIXME: I don't know if this is the correct
- implementation. */
- if (h != NULL && h->smclas != XMC_TD)
- {
- if (h->toc_section == NULL)
- {
- (*_bfd_error_handler)
- (_("%s: TOC reloc at 0x%x to symbol `%s' with no TOC entry"),
- bfd_get_filename (input_bfd), rel->r_vaddr,
- h->root.root.string);
- bfd_set_error (bfd_error_bad_value);
- return false;
- }
-
- BFD_ASSERT ((h->flags & XCOFF_SET_TOC) == 0);
- val = (h->toc_section->output_section->vma
- + h->toc_section->output_offset);
- }
-
- val = ((val - xcoff_data (output_bfd)->toc)
- - (sym->n_value - xcoff_data (input_bfd)->toc));
- addend = 0;
- break;
- case R_BA:
- /* Absolute branch. We don't want to mess with the lower
- two bits of the instruction. */
- case R_CAI:
- /* The PowerPC ABI defines this as an absolute call which
- may be modified to become a relative call. The PowerOpen
- ABI does not define this relocation type. */
- case R_RBA:
- /* Absolute branch which may be modified to become a
- relative branch. */
- case R_RBAC:
- /* The PowerPC ABI defines this as an absolute branch to a
- fixed address which may be modified to an absolute branch
- to a symbol. The PowerOpen ABI does not define this
- relocation type. */
- case R_RBRC:
- /* The PowerPC ABI defines this as an absolute branch to a
- fixed address which may be modified to a relative branch.
- The PowerOpen ABI does not define this relocation type. */
- howto.src_mask &= ~3;
- howto.dst_mask = howto.src_mask;
- break;
- case R_BR:
- /* Relative branch. We don't want to mess with the lower
- two bits of the instruction. */
- case R_CREL:
- /* The PowerPC ABI defines this as a relative call which may
- be modified to become an absolute call. The PowerOpen
- ABI does not define this relocation type. */
- case R_RBR:
- /* A relative branch which may be modified to become an
- absolute branch. FIXME: We don't implement this,
- although we should for symbols of storage mapping class
- XMC_XO. */
- howto.pc_relative = true;
- howto.src_mask &= ~3;
- howto.dst_mask = howto.src_mask;
- break;
- case R_RL:
- /* The PowerPC AIX ABI describes this as a load which may be
- changed to a load address. The PowerOpen ABI says this
- is the same as case R_POS. */
- break;
- case R_RLA:
- /* The PowerPC AIX ABI describes this as a load address
- which may be changed to a load. The PowerOpen ABI says
- this is the same as R_POS. */
- break;
- }
-
- /* If we see an R_BR or R_RBR reloc which is jumping to global
- linkage code, and it is followed by an appropriate cror nop
- instruction, we replace the cror with lwz r2,20(r1). This
- restores the TOC after the glink code. Contrariwise, if the
- call is followed by a lwz r2,20(r1), but the call is not
- going to global linkage code, we can replace the load with a
- cror. */
- if ((rel->r_type == R_BR || rel->r_type == R_RBR)
- && h != NULL
- && h->root.type == bfd_link_hash_defined
- && (rel->r_vaddr - input_section->vma + 8
- <= input_section->_cooked_size))
- {
- bfd_byte *pnext;
- unsigned long next;
-
- pnext = contents + (rel->r_vaddr - input_section->vma) + 4;
- next = bfd_get_32 (input_bfd, pnext);
-
- /* The _ptrgl function is magic. It is used by the AIX
- compiler to call a function through a pointer. */
- if (h->smclas == XMC_GL
- || strcmp (h->root.root.string, "._ptrgl") == 0)
- {
- if (next == 0x4def7b82 /* cror 15,15,15 */
- || next == 0x4ffffb82 /* cror 31,31,31 */
- || next == 0x60000000) /* ori r0,r0,0 */
- bfd_put_32 (input_bfd, 0x80410014, pnext); /* lwz r1,20(r1) */
- }
- else
- {
- if (next == 0x80410014) /* lwz r1,20(r1) */
- bfd_put_32 (input_bfd, 0x60000000, pnext); /* ori r0,r0,0 */
- }
- }
-
- /* A PC relative reloc includes the section address. */
- if (howto.pc_relative)
- addend += input_section->vma;
-
- rstat = _bfd_final_link_relocate (&howto, input_bfd, input_section,
- contents,
- rel->r_vaddr - input_section->vma,
- val, addend);
-
- switch (rstat)
- {
- default:
- abort ();
- case bfd_reloc_ok:
- break;
- case bfd_reloc_overflow:
- {
- const char *name;
- char buf[SYMNMLEN + 1];
- char howto_name[10];
-
- if (symndx == -1)
- name = "*ABS*";
- else if (h != NULL)
- name = h->root.root.string;
- else
- {
- name = _bfd_coff_internal_syment_name (input_bfd, sym, buf);
- if (name == NULL)
- return false;
- }
- sprintf (howto_name, "0x%02x", rel->r_type);
-
- if (! ((*info->callbacks->reloc_overflow)
- (info, name, howto_name, (bfd_vma) 0, input_bfd,
- input_section, rel->r_vaddr - input_section->vma)))
- return false;
- }
- }
- }
-
- return true;
-}
diff --git a/contrib/binutils/binutils/ChangeLog b/contrib/binutils/binutils/ChangeLog
index 190f7ed..8aa1f51 100644
--- a/contrib/binutils/binutils/ChangeLog
+++ b/contrib/binutils/binutils/ChangeLog
@@ -1,3 +1,15 @@
+2002-04-04 Alan Modra <amodra@bigpond.net.au>
+
+ * dep-in.sed: Cope with absolute paths.
+ * Makefile.am (dep.sed): Subst TOPDIR.
+ Run "make dep-am".
+ * Makefile.in: Regenerate.
+
+2002-03-28 Alan Modra <amodra@bigpond.net.au>
+
+ * aclocal.m4: Regenerate.
+ * configure: Regenerate.
+
2002-03-07 Daniel Jacobowitz <drow@mvista.com>
* README: Update some version numbers.
diff --git a/contrib/binutils/binutils/Makefile.am b/contrib/binutils/binutils/Makefile.am
index 94369cd..ec339b6 100644
--- a/contrib/binutils/binutils/Makefile.am
+++ b/contrib/binutils/binutils/Makefile.am
@@ -307,7 +307,8 @@ dep.sed: dep-in.sed config.status
-e 's!@INCDIR@!$(INCDIR)!' \
-e 's!@BFDDIR@!$(BFDDIR)!' \
-e 's!@SRCDIR@!$(srcdir)!' \
- -e "s!@OBJDIR@!$${objdir}!"
+ -e "s!@OBJDIR@!$${objdir}!" \
+ -e 's!@TOPDIR@!'`echo $(srcdir) | sed -e s,/binutils$$,,`'!'
dep: DEP
sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile
@@ -376,11 +377,13 @@ arsup.o: arsup.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
bucomm.o: bucomm.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h $(INCDIR)/libiberty.h bucomm.h config.h \
$(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h
-coffdump.o: coffdump.c coffgrok.h bucomm.h config.h \
- $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h
-coffgrok.o: coffgrok.c bucomm.h config.h $(INCDIR)/bin-bugs.h \
- $(INCDIR)/fopen-same.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \
- $(INCDIR)/bfdlink.h coffgrok.h
+coffdump.o: coffdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/symcat.h $(INCDIR)/libiberty.h coffgrok.h \
+ bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h
+coffgrok.o: coffgrok.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/symcat.h $(INCDIR)/libiberty.h bucomm.h config.h \
+ $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/coff/internal.h \
+ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h coffgrok.h
debug.o: debug.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
$(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h debug.h
@@ -435,21 +438,24 @@ rddbg.o: rddbg.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
size.o: size.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \
$(INCDIR)/libiberty.h
-srconv.o: srconv.c bucomm.h config.h $(INCDIR)/bin-bugs.h \
- $(INCDIR)/fopen-same.h sysroff.h coffgrok.h $(INCDIR)/coff/internal.h \
- $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h sysroff.c
+srconv.o: srconv.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
+ $(INCDIR)/fopen-same.h sysroff.h coffgrok.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
+ sysroff.c
stabs.o: stabs.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
$(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h \
$(INCDIR)/demangle.h debug.h budbg.h $(INCDIR)/filenames.h \
$(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def
strings.o: strings.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
- $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h
+ $(INCDIR)/symcat.h $(INCDIR)/getopt.h bucomm.h config.h \
+ $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/safe-ctype.h
sysdump.o: sysdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
- $(INCDIR)/fopen-same.h $(INCDIR)/safe-ctype.h sysroff.h \
- sysroff.c
+ $(INCDIR)/fopen-same.h $(INCDIR)/safe-ctype.h $(INCDIR)/libiberty.h \
+ sysroff.h sysroff.c
version.o: version.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
$(INCDIR)/fopen-same.h
@@ -508,7 +514,8 @@ underscore.o: underscore.c
arparse.o: arparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
$(INCDIR)/fopen-same.h arsup.h
-arlex.o: arlex.c $(INCDIR)/libiberty.h arparse.h
+arlex.o: arlex.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
+ arparse.h
sysroff.o: sysroff.c
sysinfo.o: sysinfo.c
syslex.o: syslex.c sysinfo.h
@@ -517,8 +524,8 @@ defparse.o: defparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/fopen-same.h dlltool.h
deflex.o: deflex.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
defparse.h dlltool.h
-nlmheader.o: nlmheader.c $(INCDIR)/safe-ctype.h ../bfd/bfd.h \
- $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
+nlmheader.o: nlmheader.c $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h \
+ ../bfd/bfd.h $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
$(INCDIR)/fopen-same.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \
nlmconv.h
rcparse.o: rcparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
diff --git a/contrib/binutils/binutils/Makefile.in b/contrib/binutils/binutils/Makefile.in
index 3bda86e..a3501cc 100644
--- a/contrib/binutils/binutils/Makefile.in
+++ b/contrib/binutils/binutils/Makefile.in
@@ -1032,7 +1032,8 @@ dep.sed: dep-in.sed config.status
-e 's!@INCDIR@!$(INCDIR)!' \
-e 's!@BFDDIR@!$(BFDDIR)!' \
-e 's!@SRCDIR@!$(srcdir)!' \
- -e "s!@OBJDIR@!$${objdir}!"
+ -e "s!@OBJDIR@!$${objdir}!" \
+ -e 's!@TOPDIR@!'`echo $(srcdir) | sed -e s,/binutils$$,,`'!'
dep: DEP
sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile
@@ -1095,11 +1096,13 @@ arsup.o: arsup.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
bucomm.o: bucomm.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h $(INCDIR)/libiberty.h bucomm.h config.h \
$(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h
-coffdump.o: coffdump.c coffgrok.h bucomm.h config.h \
- $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h
-coffgrok.o: coffgrok.c bucomm.h config.h $(INCDIR)/bin-bugs.h \
- $(INCDIR)/fopen-same.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \
- $(INCDIR)/bfdlink.h coffgrok.h
+coffdump.o: coffdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/symcat.h $(INCDIR)/libiberty.h coffgrok.h \
+ bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h
+coffgrok.o: coffgrok.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/symcat.h $(INCDIR)/libiberty.h bucomm.h config.h \
+ $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/coff/internal.h \
+ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h coffgrok.h
debug.o: debug.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
$(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h debug.h
@@ -1154,21 +1157,24 @@ rddbg.o: rddbg.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
size.o: size.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \
$(INCDIR)/libiberty.h
-srconv.o: srconv.c bucomm.h config.h $(INCDIR)/bin-bugs.h \
- $(INCDIR)/fopen-same.h sysroff.h coffgrok.h $(INCDIR)/coff/internal.h \
- $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h sysroff.c
+srconv.o: srconv.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
+ $(INCDIR)/fopen-same.h sysroff.h coffgrok.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
+ sysroff.c
stabs.o: stabs.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
$(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h \
$(INCDIR)/demangle.h debug.h budbg.h $(INCDIR)/filenames.h \
$(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def
strings.o: strings.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
- $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h
+ $(INCDIR)/symcat.h $(INCDIR)/getopt.h bucomm.h config.h \
+ $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/safe-ctype.h
sysdump.o: sysdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
- $(INCDIR)/fopen-same.h $(INCDIR)/safe-ctype.h sysroff.h \
- sysroff.c
+ $(INCDIR)/fopen-same.h $(INCDIR)/safe-ctype.h $(INCDIR)/libiberty.h \
+ sysroff.h sysroff.c
version.o: version.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
$(INCDIR)/fopen-same.h
@@ -1227,7 +1233,8 @@ underscore.o: underscore.c
arparse.o: arparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
$(INCDIR)/fopen-same.h arsup.h
-arlex.o: arlex.c $(INCDIR)/libiberty.h arparse.h
+arlex.o: arlex.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
+ arparse.h
sysroff.o: sysroff.c
sysinfo.o: sysinfo.c
syslex.o: syslex.c sysinfo.h
@@ -1236,8 +1243,8 @@ defparse.o: defparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/fopen-same.h dlltool.h
deflex.o: deflex.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
defparse.h dlltool.h
-nlmheader.o: nlmheader.c $(INCDIR)/safe-ctype.h ../bfd/bfd.h \
- $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
+nlmheader.o: nlmheader.c $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h \
+ ../bfd/bfd.h $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
$(INCDIR)/fopen-same.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \
nlmconv.h
rcparse.o: rcparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
diff --git a/contrib/binutils/binutils/aclocal.m4 b/contrib/binutils/binutils/aclocal.m4
index a4a2b46..1c78dc1 100644
--- a/contrib/binutils/binutils/aclocal.m4
+++ b/contrib/binutils/binutils/aclocal.m4
@@ -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.
@@ -37,24 +37,6 @@ AC_CHECK_PROGS(LEX, flex lex, [$missing_dir/missing flex])
AC_PROG_LEX
AC_DECL_YYTEXT])
-#serial 1
-# This test replaces the one in autoconf.
-# Currently this macro should have the same name as the autoconf macro
-# because gettext's gettext.m4 (distributed in the automake package)
-# still uses it. Otherwise, the use in gettext.m4 makes autoheader
-# give these diagnostics:
-# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
-# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
-
-undefine([AC_ISC_POSIX])
-
-AC_DEFUN(AC_ISC_POSIX,
- [
- dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
- AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
- ]
-)
-
# Do all the work for Automake. This macro actually does too much --
# some checks are only needed if your package does certain things.
# But this isn't really a big deal.
@@ -64,7 +46,7 @@ AC_DEFUN(AC_ISC_POSIX,
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)
@@ -92,7 +74,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
@@ -133,7 +115,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.
@@ -149,7 +131,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.
@@ -175,7 +157,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,
@@ -192,7 +174,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 --git a/contrib/binutils/binutils/configure b/contrib/binutils/binutils/configure
index 317ef76..c63f2b0 100755
--- a/contrib/binutils/binutils/configure
+++ b/contrib/binutils/binutils/configure
@@ -717,49 +717,249 @@ test "$host_alias" != "$target_alias" &&
NONENONEs,x,x, &&
program_prefix=${target_alias}-
+# 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:724: 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
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="gcc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
- echo $ac_n "checking for strerror in -lcposix""... $ac_c" 1>&6
-echo "configure:723: checking for strerror in -lcposix" >&5
-ac_lib_var=`echo cposix'_'strerror | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+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:754: 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
- ac_save_LIBS="$LIBS"
-LIBS="-lcposix $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 731 "configure"
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_prog_rejected=no
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# -gt 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ set dummy "$ac_dir/$ac_word" "$@"
+ shift
+ ac_cv_prog_CC="$@"
+ fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test -z "$CC"; then
+ case "`uname -s`" in
+ *win32* | *WIN32*)
+ # 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:805: 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
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="cl"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+ ;;
+ esac
+ fi
+ test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:837: 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.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext << EOF
+
+#line 848 "configure"
#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char strerror();
-int main() {
-strerror()
-; return 0; }
+main(){return(0);}
EOF
-if { (eval echo configure:742: \"$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"
+if { (eval echo configure:853: \"$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
+ ac_cv_prog_cc_cross=no
+ else
+ ac_cv_prog_cc_cross=yes
+ fi
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
+ ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+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:879: 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:884: 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
+ cat > conftest.c <<EOF
+#ifdef __GNUC__
+ yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:893: \"$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
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+
+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:912: 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
+ echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+ ac_cv_prog_cc_g=yes
+else
+ ac_cv_prog_cc_g=no
fi
rm -f conftest*
-LIBS="$ac_save_LIBS"
fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+
+echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
+echo "configure:944: checking for POSIXized ISC" >&5
+if test -d /etc/conf/kconfig.d &&
+ grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
+then
echo "$ac_t""yes" 1>&6
- LIBS="$LIBS -lcposix"
+ ISC=yes # If later tests want to check for ISC.
+ cat >> confdefs.h <<\EOF
+#define _POSIX_SOURCE 1
+EOF
+
+ if test "$GCC" = yes; then
+ CC="$CC -posix"
+ else
+ CC="$CC -Xp"
+ fi
else
echo "$ac_t""no" 1>&6
+ ISC=
fi
-
-
BFD_VERSION=`sed -n -e 's/^.._INIT_AUTOMAKE.*,[ ]*\([^ ]*\)[ ]*).*/\1/p' < ${srcdir}/../bfd/configure.in`
# Find a good install program. We prefer a C program (faster),
@@ -774,7 +974,7 @@ BFD_VERSION=`sed -n -e 's/^.._INIT_AUTOMAKE.*,[ ]*\([^ ]*\)[ ]*).*/\1/p' < ${
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:778: checking for a BSD compatible install" >&5
+echo "configure:978: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -827,7 +1027,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:831: checking whether build environment is sane" >&5
+echo "configure:1031: checking whether build environment is sane" >&5
# Just in case
sleep 1
echo timestamp > conftestfile
@@ -884,7 +1084,7 @@ test "$program_suffix" != NONE &&
test "$program_transform_name" = "" && program_transform_name="s,x,x,"
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:888: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:1088: checking whether ${MAKE-make} sets \${MAKE}" >&5
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -930,7 +1130,7 @@ EOF
missing_dir=`cd $ac_aux_dir && pwd`
echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:934: checking for working aclocal" >&5
+echo "configure:1134: checking for working aclocal" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -943,7 +1143,7 @@ else
fi
echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:947: checking for working autoconf" >&5
+echo "configure:1147: checking for working autoconf" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -956,7 +1156,7 @@ else
fi
echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:960: checking for working automake" >&5
+echo "configure:1160: checking for working automake" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -969,7 +1169,7 @@ else
fi
echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:973: checking for working autoheader" >&5
+echo "configure:1173: checking for working autoheader" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -982,7 +1182,7 @@ else
fi
echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:986: checking for working makeinfo" >&5
+echo "configure:1186: checking for working makeinfo" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1065,228 +1265,6 @@ else
enable_fast_install=yes
fi
-# Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1072: 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
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="gcc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-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:1102: 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
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_prog_rejected=no
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-if test $ac_prog_rejected = yes; then
- # We found a bogon in the path, so make sure we never use it.
- set dummy $ac_cv_prog_CC
- shift
- if test $# -gt 0; then
- # We chose a different compiler from the bogus one.
- # However, it has the same basename, so the bogon will be chosen
- # first if we set CC to just the basename; use the full file name.
- shift
- set dummy "$ac_dir/$ac_word" "$@"
- shift
- ac_cv_prog_CC="$@"
- fi
-fi
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- if test -z "$CC"; then
- case "`uname -s`" in
- *win32* | *WIN32*)
- # 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:1153: 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
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="cl"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
- ;;
- esac
- fi
- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1185: 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.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-cat > conftest.$ac_ext << EOF
-
-#line 1196 "configure"
-#include "confdefs.h"
-
-main(){return(0);}
-EOF
-if { (eval echo configure:1201: \"$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
- ac_cv_prog_cc_cross=no
- else
- ac_cv_prog_cc_cross=yes
- fi
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- ac_cv_prog_cc_works=no
-fi
-rm -fr conftest*
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
-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:1227: 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:1232: 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
- cat > conftest.c <<EOF
-#ifdef __GNUC__
- yes;
-#endif
-EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1241: \"$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
-fi
-fi
-
-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
-
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
-else
- GCC=
-fi
-
-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:1260: 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
- echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
- ac_cv_prog_cc_g=yes
-else
- ac_cv_prog_cc_g=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
-if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
-elif test $ac_cv_prog_cc_g = yes; then
- if test "$GCC" = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-g"
- fi
-else
- if test "$GCC" = yes; then
- CFLAGS="-O2"
- else
- CFLAGS=
- fi
-fi
-
# Check whether --with-gnu-ld or --without-gnu-ld was given.
if test "${with_gnu_ld+set}" = set; then
withval="$with_gnu_ld"
@@ -1299,7 +1277,7 @@ ac_prog=ld
if test "$GCC" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
-echo "configure:1303: checking for ld used by GCC" >&5
+echo "configure:1281: checking for ld used by GCC" >&5
case $host in
*-*-mingw*)
# gcc leaves a trailing carriage return which upsets mingw
@@ -1329,10 +1307,10 @@ echo "configure:1303: checking for ld used by GCC" >&5
esac
elif test "$with_gnu_ld" = yes; then
echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
-echo "configure:1333: checking for GNU ld" >&5
+echo "configure:1311: checking for GNU ld" >&5
else
echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
-echo "configure:1336: checking for non-GNU ld" >&5
+echo "configure:1314: checking for non-GNU ld" >&5
fi
if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1367,7 +1345,7 @@ else
fi
test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
-echo "configure:1371: checking if the linker ($LD) is GNU ld" >&5
+echo "configure:1349: checking if the linker ($LD) is GNU ld" >&5
if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1384,7 +1362,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6
-echo "configure:1388: checking for $LD option to reload object files" >&5
+echo "configure:1366: checking for $LD option to reload object files" >&5
if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1396,7 +1374,7 @@ reload_flag=$lt_cv_ld_reload_flag
test -n "$reload_flag" && reload_flag=" $reload_flag"
echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
-echo "configure:1400: checking for BSD-compatible nm" >&5
+echo "configure:1378: checking for BSD-compatible nm" >&5
if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1434,7 +1412,7 @@ NM="$lt_cv_path_NM"
echo "$ac_t""$NM" 1>&6
echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1438: checking whether ln -s works" >&5
+echo "configure:1416: checking whether ln -s works" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1455,7 +1433,7 @@ else
fi
echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6
-echo "configure:1459: checking how to recognise dependant libraries" >&5
+echo "configure:1437: checking how to recognise dependant libraries" >&5
if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1628,13 +1606,13 @@ file_magic_cmd=$lt_cv_file_magic_cmd
deplibs_check_method=$lt_cv_deplibs_check_method
echo $ac_n "checking for object suffix""... $ac_c" 1>&6
-echo "configure:1632: checking for object suffix" >&5
+echo "configure:1610: checking for object suffix" >&5
if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
rm -f conftest*
echo 'int i = 1;' > conftest.$ac_ext
-if { (eval echo configure:1638: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1616: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
for ac_file in conftest.*; do
case $ac_file in
*.c) ;;
@@ -1654,7 +1632,7 @@ ac_objext=$ac_cv_objext
echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:1658: checking for executable suffix" >&5
+echo "configure:1636: checking for executable suffix" >&5
if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1664,7 +1642,7 @@ else
rm -f conftest*
echo 'int main () { return 0; }' > conftest.$ac_ext
ac_cv_exeext=
- if { (eval echo configure:1668: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ if { (eval echo configure:1646: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
for file in conftest.*; do
case $file in
*.c | *.o | *.obj) ;;
@@ -1697,7 +1675,7 @@ case $deplibs_check_method in
file_magic*)
if test "$file_magic_cmd" = '$MAGIC_CMD'; then
echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6
-echo "configure:1701: checking for ${ac_tool_prefix}file" >&5
+echo "configure:1679: checking for ${ac_tool_prefix}file" >&5
if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1759,7 +1737,7 @@ fi
if test -z "$lt_cv_path_MAGIC_CMD"; then
if test -n "$ac_tool_prefix"; then
echo $ac_n "checking for file""... $ac_c" 1>&6
-echo "configure:1763: checking for file" >&5
+echo "configure:1741: checking for file" >&5
if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1830,7 +1808,7 @@ esac
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1834: checking for $ac_word" >&5
+echo "configure:1812: 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
@@ -1862,7 +1840,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1866: checking for $ac_word" >&5
+echo "configure:1844: 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
@@ -1897,7 +1875,7 @@ fi
# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
set dummy ${ac_tool_prefix}strip; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1901: checking for $ac_word" >&5
+echo "configure:1879: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1929,7 +1907,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "strip", so it can be a program name with args.
set dummy strip; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1933: checking for $ac_word" >&5
+echo "configure:1911: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1996,8 +1974,8 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
case $host in
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 2000 "configure"' > conftest.$ac_ext
- if { (eval echo configure:2001: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ echo '#line 1978 "configure"' > conftest.$ac_ext
+ if { (eval echo configure:1979: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
case `/usr/bin/file conftest.$ac_objext` in
*32-bit*)
LD="${LD-ld} -32"
@@ -2016,7 +1994,7 @@ case $host in
ia64-*-hpux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
- if { (eval echo configure:2020: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ if { (eval echo configure:1998: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
case "`/usr/bin/file conftest.o`" in
*ELF-32*)
HPUX_IA64_MODE="32"
@@ -2034,7 +2012,7 @@ ia64-*-hpux*)
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -belf"
echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
-echo "configure:2038: checking whether the C compiler needs -belf" >&5
+echo "configure:2016: checking whether the C compiler needs -belf" >&5
if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2047,14 +2025,14 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a
cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext <<EOF
-#line 2051 "configure"
+#line 2029 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:2058: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2036: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
lt_cv_cc_needs_belf=yes
else
@@ -2227,7 +2205,7 @@ fi
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2231: checking for $ac_word" >&5
+echo "configure:2209: 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
@@ -2257,7 +2235,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:2261: checking for $ac_word" >&5
+echo "configure:2239: 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
@@ -2308,7 +2286,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:2312: checking for $ac_word" >&5
+echo "configure:2290: 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
@@ -2340,7 +2318,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:2344: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:2322: 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.
@@ -2351,12 +2329,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
-#line 2355 "configure"
+#line 2333 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:2360: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2338: \"$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
@@ -2382,12 +2360,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:2386: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:2364: 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:2391: checking whether we are using GNU C" >&5
+echo "configure:2369: 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
@@ -2396,7 +2374,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2400: \"$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:2378: \"$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
@@ -2415,7 +2393,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:2419: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:2397: 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
@@ -2452,7 +2430,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:2456: checking for $ac_word" >&5
+echo "configure:2434: 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
@@ -2483,7 +2461,7 @@ done
test -n "$YACC" || YACC="yacc"
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:2487: checking how to run the C preprocessor" >&5
+echo "configure:2465: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -2498,13 +2476,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 2502 "configure"
+#line 2480 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2508: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2486: \"$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
:
@@ -2515,13 +2493,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 2519 "configure"
+#line 2497 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2525: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2503: \"$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
:
@@ -2532,13 +2510,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 2536 "configure"
+#line 2514 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2542: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2520: \"$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
:
@@ -2568,7 +2546,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:2572: checking for $ac_word" >&5
+echo "configure:2550: 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
@@ -2601,7 +2579,7 @@ 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:2605: checking for $ac_word" >&5
+echo "configure:2583: 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
@@ -2635,7 +2613,7 @@ then
*) ac_lib=l ;;
esac
echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6
-echo "configure:2639: checking for yywrap in -l$ac_lib" >&5
+echo "configure:2617: 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
@@ -2643,7 +2621,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-l$ac_lib $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2647 "configure"
+#line 2625 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2654,7 +2632,7 @@ int main() {
yywrap()
; return 0; }
EOF
-if { (eval echo configure:2658: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2636: \"$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
@@ -2677,7 +2655,7 @@ fi
fi
echo $ac_n "checking lex output file root""... $ac_c" 1>&6
-echo "configure:2681: checking lex output file root" >&5
+echo "configure:2659: 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
@@ -2698,7 +2676,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:2702: checking whether yytext is a pointer" >&5
+echo "configure:2680: 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
@@ -2710,14 +2688,14 @@ echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c
ac_save_LIBS="$LIBS"
LIBS="$LIBS $LEXLIB"
cat > conftest.$ac_ext <<EOF
-#line 2714 "configure"
+#line 2692 "configure"
#include "confdefs.h"
`cat $LEX_OUTPUT_ROOT.c`
int main() {
; return 0; }
EOF
-if { (eval echo configure:2721: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2699: \"$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
@@ -2743,7 +2721,7 @@ ALL_LINGUAS="fr tr ja 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:2747: checking for $ac_word" >&5
+echo "configure:2725: 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
@@ -2771,12 +2749,12 @@ else
fi
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:2775: checking for ANSI C header files" >&5
+echo "configure:2753: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2780 "configure"
+#line 2758 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -2784,7 +2762,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2788: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2766: \"$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*
@@ -2801,7 +2779,7 @@ rm -f conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 2805 "configure"
+#line 2783 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -2819,7 +2797,7 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 2823 "configure"
+#line 2801 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -2840,7 +2818,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 2844 "configure"
+#line 2822 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -2851,7 +2829,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
-if { (eval echo configure:2855: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2833: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@@ -2875,12 +2853,12 @@ EOF
fi
echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:2879: checking for working const" >&5
+echo "configure:2857: checking for working const" >&5
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2884 "configure"
+#line 2862 "configure"
#include "confdefs.h"
int main() {
@@ -2929,7 +2907,7 @@ ccp = (char const *const *) p;
; return 0; }
EOF
-if { (eval echo configure:2933: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2911: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
@@ -2950,21 +2928,21 @@ EOF
fi
echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:2954: checking for inline" >&5
+echo "configure:2932: checking for inline" >&5
if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
cat > conftest.$ac_ext <<EOF
-#line 2961 "configure"
+#line 2939 "configure"
#include "confdefs.h"
int main() {
} $ac_kw foo() {
; return 0; }
EOF
-if { (eval echo configure:2968: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2946: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_inline=$ac_kw; break
else
@@ -2990,12 +2968,12 @@ EOF
esac
echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:2994: checking for off_t" >&5
+echo "configure:2972: checking for off_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2999 "configure"
+#line 2977 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -3023,12 +3001,12 @@ EOF
fi
echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:3027: checking for size_t" >&5
+echo "configure:3005: checking for size_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3032 "configure"
+#line 3010 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -3058,19 +3036,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:3062: checking for working alloca.h" >&5
+echo "configure:3040: checking for working alloca.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3067 "configure"
+#line 3045 "configure"
#include "confdefs.h"
#include <alloca.h>
int main() {
char *p = alloca(2 * sizeof(int));
; return 0; }
EOF
-if { (eval echo configure:3074: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3052: \"$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
@@ -3091,12 +3069,12 @@ EOF
fi
echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:3095: checking for alloca" >&5
+echo "configure:3073: checking for alloca" >&5
if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3100 "configure"
+#line 3078 "configure"
#include "confdefs.h"
#ifdef __GNUC__
@@ -3124,7 +3102,7 @@ int main() {
char *p = (char *) alloca(1);
; return 0; }
EOF
-if { (eval echo configure:3128: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3106: \"$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
@@ -3156,12 +3134,12 @@ EOF
echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:3160: checking whether alloca needs Cray hooks" >&5
+echo "configure:3138: checking whether alloca needs Cray hooks" >&5
if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3165 "configure"
+#line 3143 "configure"
#include "confdefs.h"
#if defined(CRAY) && ! defined(CRAY2)
webecray
@@ -3186,12 +3164,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6
if test $ac_cv_os_cray = yes; then
for ac_func in _getb67 GETB67 getb67; do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3190: checking for $ac_func" >&5
+echo "configure:3168: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3195 "configure"
+#line 3173 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3214,7 +3192,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3218: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3196: \"$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
@@ -3241,7 +3219,7 @@ done
fi
echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:3245: checking stack direction for C alloca" >&5
+echo "configure:3223: 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
@@ -3249,7 +3227,7 @@ else
ac_cv_c_stack_direction=0
else
cat > conftest.$ac_ext <<EOF
-#line 3253 "configure"
+#line 3231 "configure"
#include "confdefs.h"
find_stack_direction ()
{
@@ -3268,7 +3246,7 @@ main ()
exit (find_stack_direction() < 0);
}
EOF
-if { (eval echo configure:3272: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3250: \"$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
@@ -3289,21 +3267,21 @@ EOF
fi
-for ac_hdr in unistd.h
+for ac_hdr in stdlib.h unistd.h sys/stat.h sys/types.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3297: checking for $ac_hdr" >&5
+echo "configure:3275: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3302 "configure"
+#line 3280 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3307: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3285: \"$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*
@@ -3332,12 +3310,12 @@ done
for ac_func in getpagesize
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3336: checking for $ac_func" >&5
+echo "configure:3314: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3341 "configure"
+#line 3319 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3360,7 +3338,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3364: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3342: \"$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
@@ -3385,7 +3363,7 @@ fi
done
echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:3389: checking for working mmap" >&5
+echo "configure:3367: 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
@@ -3393,7 +3371,7 @@ else
ac_cv_func_mmap_fixed_mapped=no
else
cat > conftest.$ac_ext <<EOF
-#line 3397 "configure"
+#line 3375 "configure"
#include "confdefs.h"
/* Thanks to Mike Haertel and Jim Avera for this test.
@@ -3421,11 +3399,24 @@ else
#include <fcntl.h>
#include <sys/mman.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
/* This mess was copied from the GNU getpagesize.h. */
#ifndef HAVE_GETPAGESIZE
-# ifdef HAVE_UNISTD_H
-# include <unistd.h>
-# endif
/* Assume that all systems that can run configure have sys/param.h. */
# ifndef HAVE_SYS_PARAM_H
@@ -3533,7 +3524,7 @@ main()
}
EOF
-if { (eval echo configure:3537: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3528: \"$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
@@ -3561,17 +3552,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:3565: checking for $ac_hdr" >&5
+echo "configure:3556: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3570 "configure"
+#line 3561 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3575: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3566: \"$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*
@@ -3601,12 +3592,12 @@ done
__argz_count __argz_stringify __argz_next
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3605: checking for $ac_func" >&5
+echo "configure:3596: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3610 "configure"
+#line 3601 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3629,7 +3620,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3633: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3624: \"$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
@@ -3658,12 +3649,12 @@ done
for ac_func in stpcpy
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3662: checking for $ac_func" >&5
+echo "configure:3653: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3667 "configure"
+#line 3658 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3686,7 +3677,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3690: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3681: \"$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
@@ -3720,19 +3711,19 @@ EOF
if test $ac_cv_header_locale_h = yes; then
echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
-echo "configure:3724: checking for LC_MESSAGES" >&5
+echo "configure:3715: checking for LC_MESSAGES" >&5
if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3729 "configure"
+#line 3720 "configure"
#include "confdefs.h"
#include <locale.h>
int main() {
return LC_MESSAGES
; return 0; }
EOF
-if { (eval echo configure:3736: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3727: \"$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
@@ -3753,7 +3744,7 @@ EOF
fi
fi
echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6
-echo "configure:3757: checking whether NLS is requested" >&5
+echo "configure:3748: 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"
@@ -3773,7 +3764,7 @@ fi
EOF
echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6
-echo "configure:3777: checking whether included gettext is requested" >&5
+echo "configure:3768: 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"
@@ -3792,17 +3783,17 @@ fi
ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for libintl.h""... $ac_c" 1>&6
-echo "configure:3796: checking for libintl.h" >&5
+echo "configure:3787: checking for libintl.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3801 "configure"
+#line 3792 "configure"
#include "confdefs.h"
#include <libintl.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3806: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3797: \"$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*
@@ -3819,19 +3810,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:3823: checking for gettext in libc" >&5
+echo "configure:3814: checking for gettext in libc" >&5
if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3828 "configure"
+#line 3819 "configure"
#include "confdefs.h"
#include <libintl.h>
int main() {
return (int) gettext ("")
; return 0; }
EOF
-if { (eval echo configure:3835: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3826: \"$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
@@ -3847,7 +3838,7 @@ echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6
if test "$gt_cv_func_gettext_libc" != "yes"; then
echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6
-echo "configure:3851: checking for bindtextdomain in -lintl" >&5
+echo "configure:3842: 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
@@ -3855,7 +3846,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lintl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3859 "configure"
+#line 3850 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -3866,7 +3857,7 @@ int main() {
bindtextdomain()
; return 0; }
EOF
-if { (eval echo configure:3870: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3861: \"$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
@@ -3882,19 +3873,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:3886: checking for gettext in libintl" >&5
+echo "configure:3877: checking for gettext in libintl" >&5
if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3891 "configure"
+#line 3882 "configure"
#include "confdefs.h"
int main() {
return (int) gettext ("")
; return 0; }
EOF
-if { (eval echo configure:3898: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3889: \"$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
@@ -3922,7 +3913,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:3926: checking for $ac_word" >&5
+echo "configure:3917: 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
@@ -3956,12 +3947,12 @@ fi
for ac_func in dcgettext
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3960: checking for $ac_func" >&5
+echo "configure:3951: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3965 "configure"
+#line 3956 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3984,7 +3975,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3988: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3979: \"$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
@@ -4011,7 +4002,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:4015: checking for $ac_word" >&5
+echo "configure:4006: 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
@@ -4047,7 +4038,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:4051: checking for $ac_word" >&5
+echo "configure:4042: 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
@@ -4079,7 +4070,7 @@ else
fi
cat > conftest.$ac_ext <<EOF
-#line 4083 "configure"
+#line 4074 "configure"
#include "confdefs.h"
int main() {
@@ -4087,7 +4078,7 @@ extern int _nl_msg_cat_cntr;
return _nl_msg_cat_cntr
; return 0; }
EOF
-if { (eval echo configure:4091: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4082: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
CATOBJEXT=.gmo
DATADIRNAME=share
@@ -4119,7 +4110,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:4123: checking for $ac_word" >&5
+echo "configure:4114: 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
@@ -4153,7 +4144,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:4157: checking for $ac_word" >&5
+echo "configure:4148: 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
@@ -4189,7 +4180,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:4193: checking for $ac_word" >&5
+echo "configure:4184: 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
@@ -4279,7 +4270,7 @@ fi
LINGUAS=
else
echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6
-echo "configure:4283: checking for catalogs to be installed" >&5
+echo "configure:4274: checking for catalogs to be installed" >&5
NEW_LINGUAS=
for lang in ${LINGUAS=$ALL_LINGUAS}; do
case "$ALL_LINGUAS" in
@@ -4307,17 +4298,17 @@ echo "configure:4283: checking for catalogs to be installed" >&5
if test "$CATOBJEXT" = ".cat"; then
ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6
-echo "configure:4311: checking for linux/version.h" >&5
+echo "configure:4302: checking for linux/version.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4316 "configure"
+#line 4307 "configure"
#include "confdefs.h"
#include <linux/version.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4321: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4312: \"$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*
@@ -4380,7 +4371,7 @@ fi
echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:4384: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo "configure:4375: 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"
@@ -4405,7 +4396,7 @@ fi
echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:4409: checking for executable suffix" >&5
+echo "configure:4400: checking for executable suffix" >&5
if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4415,7 +4406,7 @@ else
rm -f conftest*
echo 'int main () { return 0; }' > conftest.$ac_ext
ac_cv_exeext=
- if { (eval echo configure:4419: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ if { (eval echo configure:4410: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
for file in conftest.*; do
case $file in
*.c | *.o | *.obj) ;;
@@ -4458,7 +4449,7 @@ AR=${AR-ar}
# 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:4462: checking for $ac_word" >&5
+echo "configure:4453: 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
@@ -4497,7 +4488,7 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:4501: checking for a BSD compatible install" >&5
+echo "configure:4492: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4564,7 +4555,7 @@ if test "x$cross_compiling" = "xno"; then
EXEEXT_FOR_BUILD='$(EXEEXT)'
else
echo $ac_n "checking for build system executable suffix""... $ac_c" 1>&6
-echo "configure:4568: checking for build system executable suffix" >&5
+echo "configure:4559: checking for build system executable suffix" >&5
if eval "test \"`echo '$''{'bfd_cv_build_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4599,17 +4590,17 @@ for ac_hdr in string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4603: checking for $ac_hdr" >&5
+echo "configure:4594: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4608 "configure"
+#line 4599 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4613: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4604: \"$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*
@@ -4636,12 +4627,12 @@ fi
done
echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:4640: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo "configure:4631: checking for sys/wait.h that is POSIX.1 compatible" >&5
if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4645 "configure"
+#line 4636 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/wait.h>
@@ -4657,7 +4648,7 @@ wait (&s);
s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
; return 0; }
EOF
-if { (eval echo configure:4661: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4652: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_sys_wait_h=yes
else
@@ -4680,19 +4671,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:4684: checking for working alloca.h" >&5
+echo "configure:4675: checking for working alloca.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4689 "configure"
+#line 4680 "configure"
#include "confdefs.h"
#include <alloca.h>
int main() {
char *p = alloca(2 * sizeof(int));
; return 0; }
EOF
-if { (eval echo configure:4696: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4687: \"$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
@@ -4713,12 +4704,12 @@ EOF
fi
echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:4717: checking for alloca" >&5
+echo "configure:4708: checking for alloca" >&5
if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4722 "configure"
+#line 4713 "configure"
#include "confdefs.h"
#ifdef __GNUC__
@@ -4746,7 +4737,7 @@ int main() {
char *p = (char *) alloca(1);
; return 0; }
EOF
-if { (eval echo configure:4750: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4741: \"$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
@@ -4778,12 +4769,12 @@ EOF
echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:4782: checking whether alloca needs Cray hooks" >&5
+echo "configure:4773: checking whether alloca needs Cray hooks" >&5
if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4787 "configure"
+#line 4778 "configure"
#include "confdefs.h"
#if defined(CRAY) && ! defined(CRAY2)
webecray
@@ -4808,12 +4799,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6
if test $ac_cv_os_cray = yes; then
for ac_func in _getb67 GETB67 getb67; do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4812: checking for $ac_func" >&5
+echo "configure:4803: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4817 "configure"
+#line 4808 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4836,7 +4827,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4840: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4831: \"$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
@@ -4863,7 +4854,7 @@ done
fi
echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:4867: checking stack direction for C alloca" >&5
+echo "configure:4858: 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
@@ -4871,7 +4862,7 @@ else
ac_cv_c_stack_direction=0
else
cat > conftest.$ac_ext <<EOF
-#line 4875 "configure"
+#line 4866 "configure"
#include "confdefs.h"
find_stack_direction ()
{
@@ -4890,7 +4881,7 @@ main ()
exit (find_stack_direction() < 0);
}
EOF
-if { (eval echo configure:4894: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4885: \"$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
@@ -4914,12 +4905,12 @@ fi
for ac_func in sbrk utimes setmode getc_unlocked
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4918: checking for $ac_func" >&5
+echo "configure:4909: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4923 "configure"
+#line 4914 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4942,7 +4933,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4946: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4937: \"$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
@@ -4970,19 +4961,19 @@ done
# Check whether fopen64 is available and whether _LARGEFILE64_SOURCE
# needs to be defined for it
echo $ac_n "checking for fopen64""... $ac_c" 1>&6
-echo "configure:4974: checking for fopen64" >&5
+echo "configure:4965: checking for fopen64" >&5
if eval "test \"`echo '$''{'bu_cv_have_fopen64'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4979 "configure"
+#line 4970 "configure"
#include "confdefs.h"
#include <stdio.h>
int main() {
FILE *f = fopen64 ("/tmp/foo","r");
; return 0; }
EOF
-if { (eval echo configure:4986: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4977: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
bu_cv_have_fopen64=yes
else
@@ -4992,14 +4983,14 @@ else
saved_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
cat > conftest.$ac_ext <<EOF
-#line 4996 "configure"
+#line 4987 "configure"
#include "confdefs.h"
#include <stdio.h>
int main() {
FILE *f = fopen64 ("/tmp/foo","r");
; return 0; }
EOF
-if { (eval echo configure:5003: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4994: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE"
else
@@ -5031,14 +5022,14 @@ fi
# Some systems have frexp only in -lm, not in -lc.
echo $ac_n "checking for library containing frexp""... $ac_c" 1>&6
-echo "configure:5035: checking for library containing frexp" >&5
+echo "configure:5026: checking for library containing frexp" >&5
if eval "test \"`echo '$''{'ac_cv_search_frexp'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_func_search_save_LIBS="$LIBS"
ac_cv_search_frexp="no"
cat > conftest.$ac_ext <<EOF
-#line 5042 "configure"
+#line 5033 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -5049,7 +5040,7 @@ int main() {
frexp()
; return 0; }
EOF
-if { (eval echo configure:5053: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5044: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_search_frexp="none required"
else
@@ -5060,7 +5051,7 @@ rm -f conftest*
test "$ac_cv_search_frexp" = "no" && for i in m; do
LIBS="-l$i $ac_func_search_save_LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5064 "configure"
+#line 5055 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -5071,7 +5062,7 @@ int main() {
frexp()
; return 0; }
EOF
-if { (eval echo configure:5075: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5066: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_search_frexp="-l$i"
break
@@ -5093,19 +5084,19 @@ else :
fi
echo $ac_n "checking for time_t in time.h""... $ac_c" 1>&6
-echo "configure:5097: checking for time_t in time.h" >&5
+echo "configure:5088: checking for time_t in time.h" >&5
if eval "test \"`echo '$''{'bu_cv_decl_time_t_time_h'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5102 "configure"
+#line 5093 "configure"
#include "confdefs.h"
#include <time.h>
int main() {
time_t i;
; return 0; }
EOF
-if { (eval echo configure:5109: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5100: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bu_cv_decl_time_t_time_h=yes
else
@@ -5126,19 +5117,19 @@ EOF
fi
echo $ac_n "checking for time_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:5130: checking for time_t in sys/types.h" >&5
+echo "configure:5121: checking for time_t in sys/types.h" >&5
if eval "test \"`echo '$''{'bu_cv_decl_time_t_types_h'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5135 "configure"
+#line 5126 "configure"
#include "confdefs.h"
#include <sys/types.h>
int main() {
time_t i;
; return 0; }
EOF
-if { (eval echo configure:5142: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5133: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bu_cv_decl_time_t_types_h=yes
else
@@ -5161,12 +5152,12 @@ fi
# Under Next 3.2 <utime.h> apparently does not define struct utimbuf
# by default.
echo $ac_n "checking for utime.h""... $ac_c" 1>&6
-echo "configure:5165: checking for utime.h" >&5
+echo "configure:5156: checking for utime.h" >&5
if eval "test \"`echo '$''{'bu_cv_header_utime_h'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5170 "configure"
+#line 5161 "configure"
#include "confdefs.h"
#include <sys/types.h>
#ifdef HAVE_TIME_H
@@ -5177,7 +5168,7 @@ int main() {
struct utimbuf s;
; return 0; }
EOF
-if { (eval echo configure:5181: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5172: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bu_cv_header_utime_h=yes
else
@@ -5198,12 +5189,12 @@ EOF
fi
echo $ac_n "checking whether fprintf must be declared""... $ac_c" 1>&6
-echo "configure:5202: checking whether fprintf must be declared" >&5
+echo "configure:5193: checking whether fprintf must be declared" >&5
if eval "test \"`echo '$''{'bfd_cv_decl_needed_fprintf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5207 "configure"
+#line 5198 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -5224,7 +5215,7 @@ int main() {
char *(*pfn) = (char *(*)) fprintf
; return 0; }
EOF
-if { (eval echo configure:5228: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5219: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_decl_needed_fprintf=no
else
@@ -5245,12 +5236,12 @@ EOF
fi
echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6
-echo "configure:5249: checking whether strstr must be declared" >&5
+echo "configure:5240: checking whether strstr must be declared" >&5
if eval "test \"`echo '$''{'bfd_cv_decl_needed_strstr'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5254 "configure"
+#line 5245 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -5271,7 +5262,7 @@ int main() {
char *(*pfn) = (char *(*)) strstr
; return 0; }
EOF
-if { (eval echo configure:5275: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5266: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_decl_needed_strstr=no
else
@@ -5292,12 +5283,12 @@ EOF
fi
echo $ac_n "checking whether sbrk must be declared""... $ac_c" 1>&6
-echo "configure:5296: checking whether sbrk must be declared" >&5
+echo "configure:5287: checking whether sbrk must be declared" >&5
if eval "test \"`echo '$''{'bfd_cv_decl_needed_sbrk'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5301 "configure"
+#line 5292 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -5318,7 +5309,7 @@ int main() {
char *(*pfn) = (char *(*)) sbrk
; return 0; }
EOF
-if { (eval echo configure:5322: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5313: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_decl_needed_sbrk=no
else
@@ -5339,12 +5330,12 @@ EOF
fi
echo $ac_n "checking whether getenv must be declared""... $ac_c" 1>&6
-echo "configure:5343: checking whether getenv must be declared" >&5
+echo "configure:5334: checking whether getenv must be declared" >&5
if eval "test \"`echo '$''{'bfd_cv_decl_needed_getenv'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5348 "configure"
+#line 5339 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -5365,7 +5356,7 @@ int main() {
char *(*pfn) = (char *(*)) getenv
; return 0; }
EOF
-if { (eval echo configure:5369: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5360: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_decl_needed_getenv=no
else
@@ -5386,12 +5377,12 @@ EOF
fi
echo $ac_n "checking whether environ must be declared""... $ac_c" 1>&6
-echo "configure:5390: checking whether environ must be declared" >&5
+echo "configure:5381: checking whether environ must be declared" >&5
if eval "test \"`echo '$''{'bfd_cv_decl_needed_environ'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5395 "configure"
+#line 5386 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -5412,7 +5403,7 @@ int main() {
char *(*pfn) = (char *(*)) environ
; return 0; }
EOF
-if { (eval echo configure:5416: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5407: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_decl_needed_environ=no
else
@@ -5731,6 +5722,7 @@ s%@build_alias@%$build_alias%g
s%@build_cpu@%$build_cpu%g
s%@build_vendor@%$build_vendor%g
s%@build_os@%$build_os%g
+s%@CC@%$CC%g
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
@@ -5742,7 +5734,6 @@ s%@AUTOMAKE@%$AUTOMAKE%g
s%@AUTOHEADER@%$AUTOHEADER%g
s%@MAKEINFO@%$MAKEINFO%g
s%@SET_MAKE@%$SET_MAKE%g
-s%@CC@%$CC%g
s%@LN_S@%$LN_S%g
s%@OBJEXT@%$OBJEXT%g
s%@EXEEXT@%$EXEEXT%g
diff --git a/contrib/binutils/binutils/configure.in b/contrib/binutils/binutils/configure.in
index 42381bb..bc6ce94 100644
--- a/contrib/binutils/binutils/configure.in
+++ b/contrib/binutils/binutils/configure.in
@@ -7,7 +7,7 @@ AC_CANONICAL_SYSTEM
AC_ISC_POSIX
changequote(,)dnl
-BFD_VERSION=`sed -n -e 's/^.._INIT_AUTOMAKE.*,[ ]*\([^ ]*\)[ ]*).*/\1/p' < ${srcdir}/../bfd/configure.in`
+BFD_VERSION_STRING=`sed -n -e 's/^.._INIT_AUTOMAKE.*,[ ]*\([^ ]*\)[ ]*).*/\1/p' < ${srcdir}/../bfd/configure.in`
changequote([,])dnl
AM_INIT_AUTOMAKE(binutils, ${BFD_VERSION})
diff --git a/contrib/binutils/binutils/dep-in.sed b/contrib/binutils/binutils/dep-in.sed
index f61921a..0981dfc 100644
--- a/contrib/binutils/binutils/dep-in.sed
+++ b/contrib/binutils/binutils/dep-in.sed
@@ -3,7 +3,9 @@
/\\$/b loop
s!@INCDIR@!$(INCDIR)!g
+s!@TOPDIR@/include!$(INCDIR)!g
s!@BFDDIR@!$(BFDDIR)!g
+s!@TOPDIR@/bfd!$(BFDDIR)!g
s!@SRCDIR@/!!g
s!@OBJDIR@/!!g
diff --git a/contrib/binutils/binutils/unwind-ia64.c b/contrib/binutils/binutils/unwind-ia64.c
index d3f4b61..0873c6f 100644
--- a/contrib/binutils/binutils/unwind-ia64.c
+++ b/contrib/binutils/binutils/unwind-ia64.c
@@ -1071,7 +1071,7 @@ unw_decode_b3_x4 (dp, code, arg)
}
typedef const unsigned char *(*unw_decoder)
- PARAMS ((const unsigned char *, unsigned char, void *));
+ PARAMS ((const unsigned char *, unsigned int, void *));
static unw_decoder unw_decode_table[2][8] =
{
diff --git a/contrib/binutils/gas/ChangeLog b/contrib/binutils/gas/ChangeLog
index 97cc604..fdba914 100644
--- a/contrib/binutils/gas/ChangeLog
+++ b/contrib/binutils/gas/ChangeLog
@@ -1,3 +1,112 @@
+2002-04-10 Alan Modra <amodra@bigpond.net.au>
+
+ * as.c (parse_args <OPTION_VERSION>): Use VERSION is
+ BFD_VERSION_STRING unavailable.
+ * config/tc-i386.c (INLINE): Define (for non-BFD assembler).
+
+2002-04-04 Alan Modra <amodra@bigpond.net.au>
+
+ * dep-in.sed: Cope with absolute paths.
+ * Makefile.am (dep.sed): Subst TOPDIR.
+ Run "make dep-am".
+ * Makefile.in: Regenerate.
+
+2002-04-01 Jessica Han <jessica@cup.hp.com>
+
+ * config/tc-ia64.c (ia64_cons_fix_new): Handle 8 byte iplt reloc
+ in 32-bit mode.
+
+2002-03-28 Alan Modra <amodra@bigpond.net.au>
+
+ * aclocal.m4: Regenerate.
+ * config.in: Regenerate.
+ * Makefile.am: Run "make dep-am".
+ * Makefile.in: Regenerate.
+ * doc/Makefile.in: Regenerate.
+
+ Merge from mainline.
+ 2002-03-12 Andreas Schwab <schwab@suse.de>
+ * config/tc-ia64.c (fixup_unw_records): Clear region when seeing a
+ body record so that an error is given for misplaced .save
+ pseudo-ops.
+
+ 2002-03-09 Alan Modra <amodra@bigpond.net.au>
+ * config/tc-i386.h (REX_OPCODE): Define.
+ (REX_MODE64, REX_EXTX, REX_EXTY, REX_EXTZ): Define.
+ (rex_byte): typedef to int.
+ * config/tc-i386.c: Group prototypes and vars together.
+ Formatting fixes. Remove occurrences of "register" keyword.
+ (true): Delete.
+ (false): Delete.
+ (mode_from_disp_size): Add INLINE keyword to prototype.
+ (fits_in_signed_byte): Likewise.
+ (fits_in_unsigned_byte): Likewise.
+ (fits_in_unsigned_word): Likewise.
+ (fits_in_signed_word): Likewise.
+ (fits_in_unsigned_long): Likewise.
+ (fits_in_signed_long): Likewise.
+ (type_names): Constify.
+ (intel_float_operand): Constify param.
+ (add_prefix): Use REX_OPCODE.
+ (md_assemble): Likewise. Modify for changed rex_byte.
+ (parse_insn): Split out of md_assemble.
+ (parse_operands): Likewise.
+ (swap_operands): Likewise.
+ (optimize_imm): Likewise.
+ (optimize_disp): Likewise.
+ (match_template): Likewise.
+ (check_string): Likewise.
+ (process_suffix): Likewise.
+ (check_byte_reg): Likewise.
+ (check_long_reg): Likewise.
+ (check_qword_reg): Likewise.
+ (check_word_reg): Likewise.
+ (finalize_imm): Likewise.
+ (process_operands): Likewise.
+ (build_modrm_byte): Likewise.
+ (output_insn): Likewise.
+ (output_branch): Likewise.
+ (output_jump): Likewise.
+ (output_interseg_jump): Likewise.
+ (output_disp): Likewise.
+ (output_imm): Likewise.
+
+ 2002-03-06 Alan Modra <amodra@bigpond.net.au>
+ * 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 <dave@hiauly1.hia.nrc.ca>
+ * config/tc-hppa.c (md_apply_fix3): Add cast.
+ (hppa_fix_adjustable): Adjust list of selectors using e_lrsel and
+ e_rrsel.
+
+ 2002-03-04 H.J. Lu <hjl@gnu.org>
+ * 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 <jakub@redhat.com>
+ * config/obj-elf.c (elf_copy_symbol_attributes): Don't copy
+ visibility.
+ (obj_frob_symbol): Copy visibility.
+
+2002-03-27 Andreas Schwab <schwab@suse.de>
+
+ * config/tc-i386.c (md_assemble): Set fx_pcrel_adjust to size of
+ field for pc-relative fixups.
+ (md_estimate_size_before_relax): Likewise.
+ (tc_gen_reloc): Subtract fx_pcrel_adjust instead of fx_size for
+ pc-relative fixups in 64bit mode.
+
+2002-03-20 Albert Chin-A-Young <china@thewrittenword.com>
+
+ * config/tc-arm.c (vfp_dp_reg_required_here): Fix typo
+ (vfp_sp_reg_pos -> vfp_dp_reg_pos).
+
2002-03-19 Alexandre Oliva <aoliva@redhat.com>
* config/tc-mips.c (md_estimate_size_before_relax): Do not modify
@@ -146,7 +255,7 @@ Fri Feb 15 15:18:51 CET 2002 Jan Hubicka <jh@suse.cz>
2002-02-11 Tom Rix <trix@redhat.com>
- * config/tc-ppc.c (md_apply_fix3): Check for insert fop invalid for
+ * config/tc-ppc.c (md_apply_fix3): Check for insert fop invalid for
xcoff64.
2002-02-11 Alexandre Oliva <aoliva@redhat.com>
@@ -364,7 +473,7 @@ Fri Feb 15 15:18:51 CET 2002 Jan Hubicka <jh@suse.cz>
BFD_RELOC_SH_PT_16>: Set lowest bit in field to be relocated to 1.
(shmedia_md_convert_frag) <case C (SH64PCREL16_32, SH64PCREL16) et
al>: Set lowest bit of field to relocate to 1 and rest to empty,
- if reloc is emitted.
+ if reloc is emitted.
2000-12-31 Hans-Peter Nilsson <hpn@cygnus.com>
New options plus bugfixes.
* config/tc-sh.c (md_longopts): New options "-no-expand" and
@@ -673,7 +782,7 @@ Fri Feb 15 15:18:51 CET 2002 Jan Hubicka <jh@suse.cz>
* config/tc-sh.c (parse_at): Install the correct version of
2002-02-04's patch.
-
+
* config/tc-sh.c (md_apply_fix3) <BFD_RELOC_32_PLT_PCREL>: Don't
assume fixP->fx_subsy is non-NULL.
@@ -730,7 +839,7 @@ Fri Feb 15 15:18:51 CET 2002 Jan Hubicka <jh@suse.cz>
Support on-demand global register allocation by passing on
base-plus-offset relocs to the linker.
* config/tc-mmix.c: Tweak and fix typos in comments.
- (allocate_undefined_gregs_in_linker): New variable.
+ (allocate_undefined_gregs_in_linker): New variable.
(OPTION_LINKER_ALLOCATED_GREGS): New option macro.
(md_longopts): Add --linker-allocated-gregs.
(md_parse_option) <case 'x'>: Imply --linker-allocated-gregs.
@@ -846,7 +955,7 @@ Fri Feb 15 15:18:51 CET 2002 Jan Hubicka <jh@suse.cz>
2002-01-21 Jason Thorpe <thorpej@wasabisystems.com>
* configure.in (ia64-*-netbsd*): New target.
- * configure: Regenerate.
+ * configure: Regenerate.
2002-01-21 Hans-Peter Nilsson <hp@bitrange.com>
@@ -885,7 +994,7 @@ Fri Feb 15 15:18:51 CET 2002 Jan Hubicka <jh@suse.cz>
* NEWS: Mention new ARM command-line options and VFP support.
- * config/tc-arm.c (ARM_CEXT_XSCALE): Replaces ARM_EXT_XSCALE. All
+ * config/tc-arm.c (ARM_CEXT_XSCALE): Replaces ARM_EXT_XSCALE. All
uses changed.
(ARM_CEXT_MAVERICK): Similarly.
(ARM_ANY): Now means any core instruction.
diff --git a/contrib/binutils/gas/Makefile.am b/contrib/binutils/gas/Makefile.am
index a0262e8..60e0c2c 100644
--- a/contrib/binutils/gas/Makefile.am
+++ b/contrib/binutils/gas/Makefile.am
@@ -921,7 +921,8 @@ dep.sed: dep-in.sed config.status
sed <$(srcdir)/dep-in.sed >dep.sed \
-e "s!@INCDIR@!$${srcdir}/../include!" \
-e "s!@BFDDIR@!$${srcdir}/../bfd!" \
- -e "s!@SRCDIR@!$${srcdir}!"
+ -e "s!@SRCDIR@!$${srcdir}!" \
+ -e 's!@TOPDIR@!'`echo $(srcdir) | sed -e s,/gas,,`'!'
dep: DEP
sed -e '/^.MKDEP.*WARNING BELOW./,/^.MKDEP.*WARNING ABOVE./d' \
@@ -1084,12 +1085,14 @@ DEPTC_hppa_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \
subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/hppa.h \
dwarf2dbg.h
DEPTC_ia64_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \
- $(srcdir)/config/tc-ia64.h $(INCDIR)/coff/internal.h \
+ $(srcdir)/config/tc-ia64.h $(INCDIR)/opcode/ia64.h \
+ $(INCDIR)/elf/ia64.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/internal.h \
$(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \
dwarf2dbg.h subsegs.h $(INCDIR)/obstack.h
DEPTC_ia64_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-ia64.h \
+ $(INCDIR)/opcode/ia64.h $(INCDIR)/elf/ia64.h $(INCDIR)/elf/reloc-macros.h \
$(INCDIR)/safe-ctype.h dwarf2dbg.h subsegs.h $(INCDIR)/obstack.h
DEPTC_i370_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \
$(srcdir)/config/tc-i370.h $(INCDIR)/coff/internal.h \
@@ -1413,15 +1416,23 @@ DEPTC_w65_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-w65.h \
subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/w65-opc.h
DEPTC_v850_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \
- $(srcdir)/config/tc-v850.h $(INCDIR)/coff/internal.h \
- $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \
- subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/v850.h \
- dwarf2dbg.h
+ $(srcdir)/config/tc-v850.h $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h \
+ $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \
+ $(INCDIR)/opcode/v850.h dwarf2dbg.h
DEPTC_v850_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-v850.h \
- $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \
- $(INCDIR)/opcode/v850.h dwarf2dbg.h
+ $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.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 \
@@ -1787,20 +1798,6 @@ DEPOBJ_sh_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh.h \
$(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \
$(INCDIR)/aout/aout64.h
-DEPTC_sh64_elf = $(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 \
- $(srcdir)/../opcodes/sh64-opc.h $(srcdir)/config/tc-sh.c \
- subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/sh-opc.h \
- struc-symbol.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
- dwarf2dbg.h $(INCDIR)/symcat.h
-DEPOBJ_sh64_elf = $(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 \
- subsegs.h $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h $(INCDIR)/elf/sh.h
-DEP_sh64_elf = $(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
DEPOBJ_sparc_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \
$(srcdir)/config/tc-sparc.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \
$(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h
@@ -1889,6 +1886,17 @@ DEPOBJ_v850_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \
$(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 \
@@ -2193,6 +2201,14 @@ DEP_v850_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-v850.h \
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
@@ -2237,8 +2253,8 @@ input-file.o: input-file.c $(INCDIR)/symcat.h input-file.h \
$(INCDIR)/safe-ctype.h
input-scrub.o: input-scrub.c $(INCDIR)/symcat.h input-file.h \
sb.h
-listing.o: listing.c $(INCDIR)/symcat.h $(INCDIR)/safe-ctype.h \
- input-file.h subsegs.h
+listing.o: listing.c $(INCDIR)/symcat.h $(INCDIR)/obstack.h \
+ $(INCDIR)/safe-ctype.h input-file.h subsegs.h
literal.o: literal.c $(INCDIR)/symcat.h subsegs.h $(INCDIR)/obstack.h
macro.o: macro.c $(INCDIR)/safe-ctype.h sb.h macro.h
messages.o: messages.c $(INCDIR)/symcat.h
@@ -2253,7 +2269,8 @@ symbols.o: symbols.c $(INCDIR)/symcat.h $(INCDIR)/safe-ctype.h \
$(INCDIR)/obstack.h subsegs.h struc-symbol.h
write.o: write.c $(INCDIR)/symcat.h subsegs.h $(INCDIR)/obstack.h \
output-file.h dwarf2dbg.h
-gasp.o: gasp.c $(INCDIR)/safe-ctype.h sb.h macro.h
+gasp.o: gasp.c $(INCDIR)/getopt.h $(INCDIR)/safe-ctype.h \
+ sb.h macro.h
itbl-ops.o: itbl-ops.c itbl-ops.h $(INCDIR)/symcat.h
e-crisaout.o: $(srcdir)/config/e-crisaout.c $(INCDIR)/symcat.h \
emul-target.h
diff --git a/contrib/binutils/gas/Makefile.in b/contrib/binutils/gas/Makefile.in
index a184acf..5c2f439 100644
--- a/contrib/binutils/gas/Makefile.in
+++ b/contrib/binutils/gas/Makefile.in
@@ -1,6 +1,6 @@
-# Makefile.in generated automatically by automake 1.4 from Makefile.am
+# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
-# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -818,13 +818,15 @@ DEPTC_hppa_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \
dwarf2dbg.h
DEPTC_ia64_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \
- $(srcdir)/config/tc-ia64.h $(INCDIR)/coff/internal.h \
+ $(srcdir)/config/tc-ia64.h $(INCDIR)/opcode/ia64.h \
+ $(INCDIR)/elf/ia64.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/internal.h \
$(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \
dwarf2dbg.h subsegs.h $(INCDIR)/obstack.h
DEPTC_ia64_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-ia64.h \
+ $(INCDIR)/opcode/ia64.h $(INCDIR)/elf/ia64.h $(INCDIR)/elf/reloc-macros.h \
$(INCDIR)/safe-ctype.h dwarf2dbg.h subsegs.h $(INCDIR)/obstack.h
DEPTC_i370_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \
@@ -1216,16 +1218,25 @@ DEPTC_w65_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \
subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/w65-opc.h
DEPTC_v850_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \
- $(srcdir)/config/tc-v850.h $(INCDIR)/coff/internal.h \
- $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \
- subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/v850.h \
- dwarf2dbg.h
+ $(srcdir)/config/tc-v850.h $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h \
+ $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \
+ $(INCDIR)/opcode/v850.h dwarf2dbg.h
DEPTC_v850_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-v850.h \
- $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \
- $(INCDIR)/opcode/v850.h dwarf2dbg.h
+ $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.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 \
@@ -1677,23 +1688,6 @@ DEPOBJ_sh_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \
$(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \
$(INCDIR)/aout/aout64.h
-DEPTC_sh64_elf = $(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 \
- $(srcdir)/../opcodes/sh64-opc.h $(srcdir)/config/tc-sh.c \
- subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/sh-opc.h \
- struc-symbol.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
- dwarf2dbg.h $(INCDIR)/symcat.h
-
-DEPOBJ_sh64_elf = $(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 \
- subsegs.h $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h $(INCDIR)/elf/sh.h
-
-DEP_sh64_elf = $(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
-
DEPOBJ_sparc_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \
$(srcdir)/config/tc-sparc.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \
$(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h
@@ -1803,6 +1797,19 @@ DEPOBJ_v850_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.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 \
@@ -2211,6 +2218,16 @@ 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
@@ -2282,7 +2299,7 @@ configure configure.in gdbinit.in itbl-lex.c itbl-parse.c
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-TAR = gtar
+TAR = tar
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)
@@ -2443,7 +2460,7 @@ maintainer-clean-recursive:
dot_seen=no; \
rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
rev="$$subdir $$rev"; \
- test "$$subdir" = "." && dot_seen=yes; \
+ test "$$subdir" != "." || dot_seen=yes; \
done; \
test "$$dot_seen" = "no" && rev=". $$rev"; \
target=`echo $@ | sed s/-recursive//`; \
@@ -3076,7 +3093,8 @@ dep.sed: dep-in.sed config.status
sed <$(srcdir)/dep-in.sed >dep.sed \
-e "s!@INCDIR@!$${srcdir}/../include!" \
-e "s!@BFDDIR@!$${srcdir}/../bfd!" \
- -e "s!@SRCDIR@!$${srcdir}!"
+ -e "s!@SRCDIR@!$${srcdir}!" \
+ -e 's!@TOPDIR@!'`echo $(srcdir) | sed -e s,/gas,,`'!'
dep: DEP
sed -e '/^.MKDEP.*WARNING BELOW./,/^.MKDEP.*WARNING ABOVE./d' \
@@ -3124,8 +3142,8 @@ input-file.o: input-file.c $(INCDIR)/symcat.h input-file.h \
$(INCDIR)/safe-ctype.h
input-scrub.o: input-scrub.c $(INCDIR)/symcat.h input-file.h \
sb.h
-listing.o: listing.c $(INCDIR)/symcat.h $(INCDIR)/safe-ctype.h \
- input-file.h subsegs.h
+listing.o: listing.c $(INCDIR)/symcat.h $(INCDIR)/obstack.h \
+ $(INCDIR)/safe-ctype.h input-file.h subsegs.h
literal.o: literal.c $(INCDIR)/symcat.h subsegs.h $(INCDIR)/obstack.h
macro.o: macro.c $(INCDIR)/safe-ctype.h sb.h macro.h
messages.o: messages.c $(INCDIR)/symcat.h
@@ -3140,7 +3158,8 @@ symbols.o: symbols.c $(INCDIR)/symcat.h $(INCDIR)/safe-ctype.h \
$(INCDIR)/obstack.h subsegs.h struc-symbol.h
write.o: write.c $(INCDIR)/symcat.h subsegs.h $(INCDIR)/obstack.h \
output-file.h dwarf2dbg.h
-gasp.o: gasp.c $(INCDIR)/safe-ctype.h sb.h macro.h
+gasp.o: gasp.c $(INCDIR)/getopt.h $(INCDIR)/safe-ctype.h \
+ sb.h macro.h
itbl-ops.o: itbl-ops.c itbl-ops.h $(INCDIR)/symcat.h
e-crisaout.o: $(srcdir)/config/e-crisaout.c $(INCDIR)/symcat.h \
emul-target.h
diff --git a/contrib/binutils/gas/aclocal.m4 b/contrib/binutils/gas/aclocal.m4
index be1c188..42b344a 100644
--- a/contrib/binutils/gas/aclocal.m4
+++ b/contrib/binutils/gas/aclocal.m4
@@ -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 --git a/contrib/binutils/gas/as.c b/contrib/binutils/gas/as.c
index dab04e9..1a46207 100644
--- a/contrib/binutils/gas/as.c
+++ b/contrib/binutils/gas/as.c
@@ -524,7 +524,11 @@ parse_args (pargc, pargv)
case OPTION_VERSION:
/* This output is intended to follow the GNU standards document. */
+#ifdef BFD_ASSEMBLER
printf (_("GNU assembler %s\n"), BFD_VERSION_STRING);
+#else
+ printf (_("GNU assembler %s\n"), VERSION);
+#endif
printf (_("Copyright 2002 Free Software Foundation, Inc.\n"));
printf (_("\
This program is free software; you may redistribute it under the terms of\n\
diff --git a/contrib/binutils/gas/config.in b/contrib/binutils/gas/config.in
index 6f1311f..621bb74 100644
--- a/contrib/binutils/gas/config.in
+++ b/contrib/binutils/gas/config.in
@@ -130,6 +130,9 @@
/* Define if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
+/* Define if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
/* Define if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
diff --git a/contrib/binutils/gas/config/atof-vax.c b/contrib/binutils/gas/config/atof-vax.c
index 76ff078..7c9f04e 100644
--- a/contrib/binutils/gas/config/atof-vax.c
+++ b/contrib/binutils/gas/config/atof-vax.c
@@ -1,5 +1,5 @@
/* atof_vax.c - turn a Flonum into a VAX floating point number
- Copyright (C) 1987, 1992, 93, 95, 97, 98, 1999
+ Copyright 1987, 1992, 1993, 1995, 1997, 1999, 2000
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -27,20 +27,20 @@ static void make_invalid_floating_point_number PARAMS ((LITTLENUM_TYPE *));
static int what_kind_of_float PARAMS ((int, int *, long *));
static char *atof_vax PARAMS ((char *, int, LITTLENUM_TYPE *));
-/* Precision in LittleNums. */
+/* Precision in LittleNums. */
#define MAX_PRECISION (8)
#define H_PRECISION (8)
#define G_PRECISION (4)
#define D_PRECISION (4)
#define F_PRECISION (2)
-/* Length in LittleNums of guard bits. */
+/* Length in LittleNums of guard bits. */
#define GUARD (2)
int flonum_gen2vax PARAMS ((int format_letter, FLONUM_TYPE * f,
LITTLENUM_TYPE * words));
-/* Number of chars in flonum type 'letter'. */
+/* Number of chars in flonum type 'letter'. */
static int
atof_vax_sizeof (letter)
int letter;
@@ -154,13 +154,13 @@ make_invalid_floating_point_number (words)
*words = 0x8000; /* Floating Reserved Operand Code */
}
-static int /* 0 means letter is OK. */
+static int /* 0 means letter is OK. */
what_kind_of_float (letter, precisionP, exponent_bitsP)
int letter; /* In: lowercase please. What kind of float? */
- int *precisionP; /* Number of 16-bit words in the float. */
- long *exponent_bitsP; /* Number of exponent bits. */
+ int *precisionP; /* Number of 16-bit words in the float. */
+ long *exponent_bitsP; /* Number of exponent bits. */
{
- int retval; /* 0: OK. */
+ int retval; /* 0: OK. */
retval = 0;
switch (letter)
@@ -201,19 +201,19 @@ what_kind_of_float (letter, precisionP, exponent_bitsP)
* *
\***********************************************************************/
-static char * /* Return pointer past text consumed. */
+static char * /* Return pointer past text consumed. */
atof_vax (str, what_kind, words)
- char *str; /* Text to convert to binary. */
+ char *str; /* Text to convert to binary. */
int what_kind; /* 'd', 'f', 'g', 'h' */
- LITTLENUM_TYPE *words; /* Build the binary here. */
+ LITTLENUM_TYPE *words; /* Build the binary here. */
{
FLONUM_TYPE f;
LITTLENUM_TYPE bits[MAX_PRECISION + MAX_PRECISION + GUARD];
- /* Extra bits for zeroed low-order bits. */
+ /* Extra bits for zeroed low-order bits. */
/* The 1st MAX_PRECISION are zeroed, */
- /* the last contain flonum bits. */
+ /* the last contain flonum bits. */
char *return_value;
- int precision; /* Number of 16-bit words in the format. */
+ int precision; /* Number of 16-bit words in the format. */
long exponent_bits;
return_value = str;
@@ -225,7 +225,7 @@ atof_vax (str, what_kind, words)
if (what_kind_of_float (what_kind, &precision, &exponent_bits))
{
- return_value = NULL; /* We lost. */
+ return_value = NULL; /* We lost. */
make_invalid_floating_point_number (words);
}
@@ -235,7 +235,7 @@ atof_vax (str, what_kind, words)
/* Use more LittleNums than seems */
/* necessary: the highest flonum may have */
- /* 15 leading 0 bits, so could be useless. */
+ /* 15 leading 0 bits, so could be useless. */
f.high = f.low + precision - 1 + GUARD;
if (atof_generic (&return_value, ".", "eE", &f))
@@ -259,16 +259,16 @@ atof_vax (str, what_kind, words)
* Out: a vax floating-point bit pattern.
*/
-int /* 0: OK. */
+int /* 0: OK. */
flonum_gen2vax (format_letter, f, words)
- int format_letter; /* One of 'd' 'f' 'g' 'h'. */
+ int format_letter; /* One of 'd' 'f' 'g' 'h'. */
FLONUM_TYPE *f;
- LITTLENUM_TYPE *words; /* Deliver answer here. */
+ LITTLENUM_TYPE *words; /* Deliver answer here. */
{
LITTLENUM_TYPE *lp;
int precision;
long exponent_bits;
- int return_value; /* 0 == OK. */
+ int return_value; /* 0 == OK. */
return_value = what_kind_of_float (format_letter, &precision, &exponent_bits);
@@ -280,7 +280,7 @@ flonum_gen2vax (format_letter, f, words)
{
if (f->low > f->leader)
{
- /* 0.0e0 seen. */
+ /* 0.0e0 seen. */
memset (words, '\0', sizeof (LITTLENUM_TYPE) * precision);
}
else
@@ -340,13 +340,13 @@ flonum_gen2vax (format_letter, f, words)
exponent_skippage++);;
exponent_1 = f->exponent + f->leader + 1 - f->low;
- /* Radix LITTLENUM_RADIX, point just higher than f->leader. */
+ /* Radix LITTLENUM_RADIX, point just higher than f->leader. */
exponent_2 = exponent_1 * LITTLENUM_NUMBER_OF_BITS;
- /* Radix 2. */
+ /* Radix 2. */
exponent_3 = exponent_2 - exponent_skippage;
- /* Forget leading zeros, forget 1st bit. */
+ /* Forget leading zeros, forget 1st bit. */
exponent_4 = exponent_3 + (1 << (exponent_bits - 1));
- /* Offset exponent. */
+ /* Offset exponent. */
if (exponent_4 & ~mask[exponent_bits])
{
@@ -366,14 +366,14 @@ flonum_gen2vax (format_letter, f, words)
{
lp = words;
- /* Word 1. Sign, exponent and perhaps high bits. */
- /* Assume 2's complement integers. */
+ /* Word 1. Sign, exponent and perhaps high bits. */
+ /* Assume 2's complement integers. */
word1 = (((exponent_4 & mask[exponent_bits]) << (15 - exponent_bits))
| ((f->sign == '+') ? 0 : 0x8000)
| next_bits (15 - exponent_bits));
*lp++ = word1;
- /* The rest of the words are just mantissa bits. */
+ /* The rest of the words are just mantissa bits. */
for (; lp < words + precision; lp++)
{
*lp = next_bits (LITTLENUM_NUMBER_OF_BITS);
@@ -426,7 +426,6 @@ flonum_gen2vax (format_letter, f, words)
return (return_value);
} /* flonum_gen2vax() */
-
/* JF this used to be in vax.c but this looks like a better place for it */
/*
@@ -446,7 +445,7 @@ flonum_gen2vax (format_letter, f, words)
* Number of chars we used for the literal.
*/
-#define MAXIMUM_NUMBER_OF_LITTLENUMS (8) /* For .hfloats. */
+#define MAXIMUM_NUMBER_OF_LITTLENUMS (8) /* For .hfloats. */
char *
md_atof (what_statement_type, literalP, sizeP)
diff --git a/contrib/binutils/gas/config/obj-elf.c b/contrib/binutils/gas/config/obj-elf.c
index 13c7482..0597eb7 100644
--- a/contrib/binutils/gas/config/obj-elf.c
+++ b/contrib/binutils/gas/config/obj-elf.c
@@ -595,6 +595,27 @@ static struct special_section const special_sections[] =
{ ".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 --git a/contrib/binutils/gas/config/tc-arm.c b/contrib/binutils/gas/config/tc-arm.c
index 456e8c5..162553f 100644
--- a/contrib/binutils/gas/config/tc-arm.c
+++ b/contrib/binutils/gas/config/tc-arm.c
@@ -6425,7 +6425,7 @@ vfp_sp_reg_required_here (str, pos)
static int
vfp_dp_reg_required_here (str, pos)
char **str;
- enum vfp_sp_reg_pos pos;
+ enum vfp_dp_reg_pos pos;
{
int reg;
char *start = *str;
diff --git a/contrib/binutils/gas/config/tc-i386.c b/contrib/binutils/gas/config/tc-i386.c
index 2b82037..1d874af 100644
--- a/contrib/binutils/gas/config/tc-i386.c
+++ b/contrib/binutils/gas/config/tc-i386.c
@@ -48,20 +48,31 @@
#define SCALE1_WHEN_NO_INDEX 1
#endif
-#ifndef true
-#define true 1
+#ifdef BFD_ASSEMBLER
+#define RELOC_ENUM enum bfd_reloc_code_real
+#else
+#define RELOC_ENUM int
+#endif
+
+#ifndef DEFAULT_ARCH
+#define DEFAULT_ARCH "i386"
+#endif
+
+#ifndef INLINE
+#if __GNUC__ >= 2
+#define INLINE __inline__
+#else
+#define INLINE
#endif
-#ifndef false
-#define false 0
#endif
-static unsigned int mode_from_disp_size PARAMS ((unsigned int));
-static int fits_in_signed_byte PARAMS ((offsetT));
-static int fits_in_unsigned_byte PARAMS ((offsetT));
-static int fits_in_unsigned_word PARAMS ((offsetT));
-static int fits_in_signed_word PARAMS ((offsetT));
-static int fits_in_unsigned_long PARAMS ((offsetT));
-static int fits_in_signed_long PARAMS ((offsetT));
+static INLINE unsigned int mode_from_disp_size PARAMS ((unsigned int));
+static INLINE int fits_in_signed_byte PARAMS ((offsetT));
+static INLINE int fits_in_unsigned_byte PARAMS ((offsetT));
+static INLINE int fits_in_unsigned_word PARAMS ((offsetT));
+static INLINE int fits_in_signed_word PARAMS ((offsetT));
+static INLINE int fits_in_unsigned_long PARAMS ((offsetT));
+static INLINE int fits_in_signed_long PARAMS ((offsetT));
static int smallest_imm_type PARAMS ((offsetT));
static offsetT offset_in_range PARAMS ((offsetT, int));
static int add_prefix PARAMS ((unsigned int));
@@ -69,18 +80,36 @@ static void set_code_flag PARAMS ((int));
static void set_16bit_gcc_code_flag PARAMS ((int));
static void set_intel_syntax PARAMS ((int));
static void set_cpu_arch PARAMS ((int));
-
-#ifdef BFD_ASSEMBLER
-static bfd_reloc_code_real_type reloc
- PARAMS ((int, int, int, bfd_reloc_code_real_type));
-#define RELOC_ENUM enum bfd_reloc_code_real
-#else
-#define RELOC_ENUM int
+static char *output_invalid PARAMS ((int c));
+static int i386_operand PARAMS ((char *operand_string));
+static int i386_intel_operand PARAMS ((char *operand_string, int got_a_float));
+static const reg_entry *parse_register PARAMS ((char *reg_string,
+ char **end_op));
+static char *parse_insn PARAMS ((char *, char *));
+static char *parse_operands PARAMS ((char *, const char *));
+static void swap_operands PARAMS ((void));
+static void optimize_imm PARAMS ((void));
+static void optimize_disp PARAMS ((void));
+static int match_template PARAMS ((void));
+static int check_string PARAMS ((void));
+static int process_suffix PARAMS ((void));
+static int check_byte_reg PARAMS ((void));
+static int check_long_reg PARAMS ((void));
+static int check_qword_reg PARAMS ((void));
+static int check_word_reg PARAMS ((void));
+static int finalize_imm PARAMS ((void));
+static int process_operands PARAMS ((void));
+static const seg_entry *build_modrm_byte PARAMS ((void));
+static void output_insn PARAMS ((void));
+static void output_branch PARAMS ((void));
+static void output_jump PARAMS ((void));
+static void output_interseg_jump PARAMS ((void));
+static void output_imm PARAMS ((void));
+static void output_disp PARAMS ((void));
+#ifndef I386COFF
+static void s_bss PARAMS ((int));
#endif
-#ifndef DEFAULT_ARCH
-#define DEFAULT_ARCH "i386"
-#endif
static const char *default_arch = DEFAULT_ARCH;
/* 'md_assemble ()' gathers together information and puts it into a
@@ -158,17 +187,15 @@ const char extra_symbol_chars[] = "*%-(@";
const char extra_symbol_chars[] = "*%-(";
#endif
+#if (defined (TE_I386AIX) \
+ || ((defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)) \
+ && !defined (TE_LINUX) \
+ && !defined (TE_FreeBSD) \
+ && !defined (TE_NetBSD)))
/* This array holds the chars that always start a comment. If the
pre-processor is disabled, these aren't very useful. */
-#if defined (TE_I386AIX) || ((defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)) && ! defined (TE_LINUX) && !defined(TE_FreeBSD) && !defined(TE_NetBSD))
-/* Putting '/' here makes it impossible to use the divide operator.
- However, we need it for compatibility with SVR4 systems. */
const char comment_chars[] = "#/";
#define PREFIX_SEPARATOR '\\'
-#else
-const char comment_chars[] = "#";
-#define PREFIX_SEPARATOR '/'
-#endif
/* This array holds the chars that only start a comment at the beginning of
a line. If the line seems to have the form '# 123 filename'
@@ -178,9 +205,14 @@ const char comment_chars[] = "#";
#NO_APP at the beginning of its output.
Also note that comments started like this one will always work if
'/' isn't otherwise defined. */
-#if defined (TE_I386AIX) || ((defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)) && ! defined (TE_LINUX) && !defined(TE_FreeBSD) && !defined(TE_NetBSD))
const char line_comment_chars[] = "";
+
#else
+/* Putting '/' here makes it impossible to use the divide operator.
+ However, we need it for compatibility with SVR4 systems. */
+const char comment_chars[] = "#";
+#define PREFIX_SEPARATOR '/'
+
const char line_comment_chars[] = "/";
#endif
@@ -275,12 +307,15 @@ static int quiet_warnings = 0;
static const char *cpu_arch_name = NULL;
/* CPU feature flags. */
-static unsigned int cpu_arch_flags = CpuUnknownFlags|CpuNo64;
+static unsigned int cpu_arch_flags = CpuUnknownFlags | CpuNo64;
/* If set, conditional jumps are not automatically promoted to handle
larger than a byte offset. */
static unsigned int no_cond_jump_promotion = 0;
+/* Pre-defined "_GLOBAL_OFFSET_TABLE_". */
+symbolS *GOT_symbol;
+
/* Interface to relax_segment.
There are 3 major relax states for 386 jump insns because the
different types of jumps add different sizes to frags when we're
@@ -294,9 +329,9 @@ static unsigned int no_cond_jump_promotion = 0;
/* Sizes. */
#define CODE16 1
#define SMALL 0
-#define SMALL16 (SMALL|CODE16)
+#define SMALL16 (SMALL | CODE16)
#define BIG 2
-#define BIG16 (BIG|CODE16)
+#define BIG16 (BIG | CODE16)
#ifndef INLINE
#ifdef __GNUC__
@@ -377,6 +412,43 @@ static const arch_entry cpu_arch[] = {
{NULL, 0 }
};
+const pseudo_typeS md_pseudo_table[] =
+{
+#if !defined(OBJ_AOUT) && !defined(USE_ALIGN_PTWO)
+ {"align", s_align_bytes, 0},
+#else
+ {"align", s_align_ptwo, 0},
+#endif
+ {"arch", set_cpu_arch, 0},
+#ifndef I386COFF
+ {"bss", s_bss, 0},
+#endif
+ {"ffloat", float_cons, 'f'},
+ {"dfloat", float_cons, 'd'},
+ {"tfloat", float_cons, 'x'},
+ {"value", cons, 2},
+ {"noopt", s_ignore, 0},
+ {"optim", s_ignore, 0},
+ {"code16gcc", set_16bit_gcc_code_flag, CODE_16BIT},
+ {"code16", set_code_flag, CODE_16BIT},
+ {"code32", set_code_flag, CODE_32BIT},
+ {"code64", set_code_flag, CODE_64BIT},
+ {"intel_syntax", set_intel_syntax, 1},
+ {"att_syntax", set_intel_syntax, 0},
+ {"file", dwarf2_directive_file, 0},
+ {"loc", dwarf2_directive_loc, 0},
+ {0, 0, 0}
+};
+
+/* For interface with expression (). */
+extern char *input_line_pointer;
+
+/* Hash table for instruction mnemonic lookup. */
+static struct hash_control *op_hash;
+
+/* Hash table for register lookup. */
+static struct hash_control *reg_hash;
+
void
i386_align_code (fragP, count)
fragS *fragP;
@@ -471,18 +543,6 @@ i386_align_code (fragP, count)
}
}
-static char *output_invalid PARAMS ((int c));
-static int i386_operand PARAMS ((char *operand_string));
-static int i386_intel_operand PARAMS ((char *operand_string, int got_a_float));
-static const reg_entry *parse_register PARAMS ((char *reg_string,
- char **end_op));
-
-#ifndef I386COFF
-static void s_bss PARAMS ((int));
-#endif
-
-symbolS *GOT_symbol; /* Pre-defined "_GLOBAL_OFFSET_TABLE_". */
-
static INLINE unsigned int
mode_from_disp_size (t)
unsigned int t;
@@ -610,7 +670,8 @@ add_prefix (prefix)
int ret = 1;
int q;
- if (prefix >= 0x40 && prefix < 0x50 && flag_code == CODE_64BIT)
+ if (prefix >= REX_OPCODE && prefix < REX_OPCODE + 16
+ && flag_code == CODE_64BIT)
q = REX_PREFIX;
else
switch (prefix)
@@ -648,7 +709,7 @@ add_prefix (prefix)
break;
}
- if (i.prefix[q])
+ if (i.prefix[q] != 0)
{
as_bad (_("same type of prefix used twice"));
return 0;
@@ -695,7 +756,7 @@ set_intel_syntax (syntax_flag)
int ask_naked_reg = 0;
SKIP_WHITESPACE ();
- if (! is_end_of_line[(unsigned char) *input_line_pointer])
+ if (!is_end_of_line[(unsigned char) *input_line_pointer])
{
char *string = input_line_pointer;
int e = get_symbol_end ();
@@ -732,7 +793,7 @@ set_cpu_arch (dummy)
{
SKIP_WHITESPACE ();
- if (! is_end_of_line[(unsigned char) *input_line_pointer])
+ if (!is_end_of_line[(unsigned char) *input_line_pointer])
{
char *string = input_line_pointer;
int e = get_symbol_end ();
@@ -758,7 +819,7 @@ set_cpu_arch (dummy)
no_cond_jump_promotion = 0;
if (*input_line_pointer == ','
- && ! is_end_of_line[(unsigned char) input_line_pointer[1]])
+ && !is_end_of_line[(unsigned char) input_line_pointer[1]])
{
char *string = ++input_line_pointer;
int e = get_symbol_end ();
@@ -776,43 +837,6 @@ set_cpu_arch (dummy)
demand_empty_rest_of_line ();
}
-const pseudo_typeS md_pseudo_table[] =
-{
-#if !defined(OBJ_AOUT) && !defined(USE_ALIGN_PTWO)
- {"align", s_align_bytes, 0},
-#else
- {"align", s_align_ptwo, 0},
-#endif
- {"arch", set_cpu_arch, 0},
-#ifndef I386COFF
- {"bss", s_bss, 0},
-#endif
- {"ffloat", float_cons, 'f'},
- {"dfloat", float_cons, 'd'},
- {"tfloat", float_cons, 'x'},
- {"value", cons, 2},
- {"noopt", s_ignore, 0},
- {"optim", s_ignore, 0},
- {"code16gcc", set_16bit_gcc_code_flag, CODE_16BIT},
- {"code16", set_code_flag, CODE_16BIT},
- {"code32", set_code_flag, CODE_32BIT},
- {"code64", set_code_flag, CODE_64BIT},
- {"intel_syntax", set_intel_syntax, 1},
- {"att_syntax", set_intel_syntax, 0},
- {"file", dwarf2_directive_file, 0},
- {"loc", dwarf2_directive_loc, 0},
- {0, 0, 0}
-};
-
-/* For interface with expression (). */
-extern char *input_line_pointer;
-
-/* Hash table for instruction mnemonic lookup. */
-static struct hash_control *op_hash;
-
-/* Hash table for register lookup. */
-static struct hash_control *reg_hash;
-
#ifdef BFD_ASSEMBLER
unsigned long
i386_mach ()
@@ -835,8 +859,8 @@ md_begin ()
op_hash = hash_new ();
{
- register const template *optab;
- register templates *core_optab;
+ const template *optab;
+ templates *core_optab;
/* Setup for loop. */
optab = i386_optab;
@@ -872,7 +896,7 @@ md_begin ()
/* Initialize reg_hash hash table. */
reg_hash = hash_new ();
{
- register const reg_entry *regtab;
+ const reg_entry *regtab;
for (regtab = i386_regtab;
regtab < i386_regtab + sizeof (i386_regtab) / sizeof (i386_regtab[0]);
@@ -888,8 +912,8 @@ md_begin ()
/* Fill in lexical tables: mnemonic_chars, operand_chars. */
{
- register int c;
- register char *p;
+ int c;
+ char *p;
for (c = 0; c < 256; c++)
{
@@ -978,7 +1002,10 @@ pi (line, x)
fprintf (stdout, " sib: base %x index %x scale %x\n",
x->sib.base, x->sib.index, x->sib.scale);
fprintf (stdout, " rex: 64bit %x extX %x extY %x extZ %x\n",
- x->rex.mode64, x->rex.extX, x->rex.extY, x->rex.extZ);
+ (x->rex & REX_MODE64) != 0,
+ (x->rex & REX_EXTX) != 0,
+ (x->rex & REX_EXTY) != 0,
+ (x->rex & REX_EXTZ) != 0);
for (i = 0; i < x->operands; i++)
{
fprintf (stdout, " #%d: ", i + 1);
@@ -1053,7 +1080,7 @@ struct type_name
char *tname;
}
-type_names[] =
+static const type_names[] =
{
{ Reg8, "r8" },
{ Reg16, "r16" },
@@ -1093,7 +1120,7 @@ static void
pt (t)
unsigned int t;
{
- register struct type_name *ty;
+ const struct type_name *ty;
for (ty = type_names; ty->mask; ty++)
if (t & ty->mask)
@@ -1119,6 +1146,8 @@ tc_i386_force_relocation (fixp)
}
#ifdef BFD_ASSEMBLER
+static bfd_reloc_code_real_type reloc
+ PARAMS ((int, int, int, bfd_reloc_code_real_type));
static bfd_reloc_code_real_type
reloc (size, pcrel, sign, other)
@@ -1212,11 +1241,11 @@ tc_i386_fix_adjustable (fixP)
#define BFD_RELOC_X86_64_GOTPCREL 0
#endif
-static int intel_float_operand PARAMS ((char *mnemonic));
+static int intel_float_operand PARAMS ((const char *mnemonic));
static int
intel_float_operand (mnemonic)
- char *mnemonic;
+ const char *mnemonic;
{
if (mnemonic[0] == 'f' && mnemonic[1] == 'i')
return 2;
@@ -1235,11 +1264,7 @@ void
md_assemble (line)
char *line;
{
- /* Points to template once we've found it. */
- const template *t;
-
int j;
-
char mnemonic[MAX_MNEM_SIZE];
/* Initialize globals. */
@@ -1253,1908 +1278,2079 @@ md_assemble (line)
/* First parse an instruction mnemonic & call i386_operand for the operands.
We assume that the scrubber has arranged it so that line[0] is the valid
start of a (possibly prefixed) mnemonic. */
- {
- char *l = line;
- char *token_start = l;
- char *mnem_p;
- /* Non-zero if we found a prefix only acceptable with string insns. */
- const char *expecting_string_instruction = NULL;
+ line = parse_insn (line, mnemonic);
+ if (line == NULL)
+ return;
- while (1)
- {
- mnem_p = mnemonic;
- while ((*mnem_p = mnemonic_chars[(unsigned char) *l]) != 0)
- {
- mnem_p++;
- if (mnem_p >= mnemonic + sizeof (mnemonic))
- {
- as_bad (_("no such instruction: `%s'"), token_start);
- return;
- }
- l++;
- }
- if (!is_space_char (*l)
- && *l != END_OF_INSN
- && *l != PREFIX_SEPARATOR
- && *l != ',')
- {
- as_bad (_("invalid character %s in mnemonic"),
- output_invalid (*l));
- return;
- }
- if (token_start == l)
- {
- if (*l == PREFIX_SEPARATOR)
- as_bad (_("expecting prefix; got nothing"));
- else
- as_bad (_("expecting mnemonic; got nothing"));
- return;
- }
+ line = parse_operands (line, mnemonic);
+ if (line == NULL)
+ return;
- /* Look up instruction (or prefix) via hash table. */
- current_templates = hash_find (op_hash, mnemonic);
+ /* Now we've parsed the mnemonic into a set of templates, and have the
+ operands at hand. */
+
+ /* All intel opcodes have reversed operands except for "bound" and
+ "enter". We also don't reverse intersegment "jmp" and "call"
+ instructions with 2 immediate operands so that the immediate segment
+ precedes the offset, as it does when in AT&T mode. "enter" and the
+ intersegment "jmp" and "call" instructions are the only ones that
+ have two immediate operands. */
+ if (intel_syntax && i.operands > 1
+ && (strcmp (mnemonic, "bound") != 0)
+ && !((i.types[0] & Imm) && (i.types[1] & Imm)))
+ swap_operands ();
+
+ if (i.imm_operands)
+ optimize_imm ();
+
+ if (i.disp_operands)
+ optimize_disp ();
+
+ /* Next, we find a template that matches the given insn,
+ making sure the overlap of the given operands types is consistent
+ with the template operand types. */
- if (*l != END_OF_INSN
- && (! is_space_char (*l) || l[1] != END_OF_INSN)
- && current_templates
- && (current_templates->start->opcode_modifier & IsPrefix))
- {
- /* 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)))
- {
- as_bad (_("redundant %s prefix"),
- current_templates->start->name);
- return;
- }
- /* Add prefix, checking for repeated prefixes. */
- switch (add_prefix (current_templates->start->base_opcode))
- {
- case 0:
- return;
- case 2:
- expecting_string_instruction = current_templates->start->name;
- break;
- }
- /* Skip past PREFIX_SEPARATOR and reset token_start. */
- token_start = ++l;
- }
- else
- break;
- }
+ if (!match_template ())
+ return;
- if (!current_templates)
- {
- /* See if we can get a match by trimming off a suffix. */
- switch (mnem_p[-1])
- {
- case WORD_MNEM_SUFFIX:
- case BYTE_MNEM_SUFFIX:
- case QWORD_MNEM_SUFFIX:
- i.suffix = mnem_p[-1];
- mnem_p[-1] = '\0';
- current_templates = hash_find (op_hash, mnemonic);
- break;
- case SHORT_MNEM_SUFFIX:
- case LONG_MNEM_SUFFIX:
- if (!intel_syntax)
- {
- i.suffix = mnem_p[-1];
- mnem_p[-1] = '\0';
- current_templates = hash_find (op_hash, mnemonic);
- }
- break;
+ /* Undo SYSV386_COMPAT brokenness when in Intel mode. See i386.h */
+ if (SYSV386_COMPAT
+ && intel_syntax
+ && (i.tm.base_opcode & 0xfffffde0) == 0xdce0)
+ i.tm.base_opcode ^= FloatR;
- /* Intel Syntax. */
- case 'd':
- if (intel_syntax)
- {
- if (intel_float_operand (mnemonic))
- i.suffix = SHORT_MNEM_SUFFIX;
- else
- i.suffix = LONG_MNEM_SUFFIX;
- mnem_p[-1] = '\0';
- current_templates = hash_find (op_hash, mnemonic);
- }
- break;
- }
- if (!current_templates)
- {
- as_bad (_("no such instruction: `%s'"), token_start);
- return;
- }
- }
+ if (i.tm.opcode_modifier & FWait)
+ if (!add_prefix (FWAIT_OPCODE))
+ return;
- if (current_templates->start->opcode_modifier & (Jump | JumpByte))
- {
- /* Check for a branch hint. We allow ",pt" and ",pn" for
- predict taken and predict not taken respectively.
- I'm not sure that branch hints actually do anything on loop
- and jcxz insns (JumpByte) for current Pentium4 chips. They
- may work in the future and it doesn't hurt to accept them
- now. */
- if (l[0] == ',' && l[1] == 'p')
- {
- if (l[2] == 't')
- {
- if (! add_prefix (DS_PREFIX_OPCODE))
- return;
- l += 3;
- }
- else if (l[2] == 'n')
- {
- if (! add_prefix (CS_PREFIX_OPCODE))
- return;
- l += 3;
- }
- }
- }
- /* Any other comma loses. */
- if (*l == ',')
- {
- as_bad (_("invalid character %s in mnemonic"),
- output_invalid (*l));
+ /* Check string instruction segment overrides. */
+ if ((i.tm.opcode_modifier & IsString) != 0 && i.mem_operands != 0)
+ {
+ if (!check_string ())
return;
- }
+ }
- /* Check if instruction is supported on specified architecture. */
- if ((current_templates->start->cpu_flags & ~(Cpu64 | CpuNo64))
- & ~(cpu_arch_flags & ~(Cpu64 | CpuNo64)))
- {
- as_warn (_("`%s' is not supported on `%s'"),
- current_templates->start->name, cpu_arch_name);
- }
- else if ((Cpu386 & ~cpu_arch_flags) && (flag_code != CODE_16BIT))
- {
- as_warn (_("use .code16 to ensure correct addressing mode"));
- }
+ if (!process_suffix ())
+ return;
- /* Check for rep/repne without a string instruction. */
- if (expecting_string_instruction
- && !(current_templates->start->opcode_modifier & IsString))
- {
- as_bad (_("expecting string instruction after `%s'"),
- expecting_string_instruction);
+ /* Make still unresolved immediate matches conform to size of immediate
+ given in i.suffix. */
+ if (!finalize_imm ())
+ return;
+
+ if (i.types[0] & Imm1)
+ i.imm_operands = 0; /* kludge for shift insns. */
+ if (i.types[0] & ImplicitRegister)
+ i.reg_operands--;
+ if (i.types[1] & ImplicitRegister)
+ i.reg_operands--;
+ if (i.types[2] & ImplicitRegister)
+ i.reg_operands--;
+
+ if (i.tm.opcode_modifier & ImmExt)
+ {
+ /* These AMD 3DNow! and Intel Katmai New Instructions have an
+ opcode suffix which is coded in the same place as an 8-bit
+ immediate field would be. Here we fake an 8-bit immediate
+ operand from the opcode suffix stored in tm.extension_opcode. */
+
+ expressionS *exp;
+
+ assert (i.imm_operands == 0 && i.operands <= 2 && 2 < MAX_OPERANDS);
+
+ exp = &im_expressions[i.imm_operands++];
+ i.op[i.operands].imms = exp;
+ i.types[i.operands++] = Imm8;
+ exp->X_op = O_constant;
+ exp->X_add_number = i.tm.extension_opcode;
+ i.tm.extension_opcode = None;
+ }
+
+ /* For insns with operands there are more diddles to do to the opcode. */
+ if (i.operands)
+ {
+ if (!process_operands ())
return;
- }
+ }
+ else if (!quiet_warnings && (i.tm.opcode_modifier & Ugh) != 0)
+ {
+ /* UnixWare fsub no args is alias for fsubp, fadd -> faddp, etc. */
+ as_warn (_("translating to `%sp'"), i.tm.name);
+ }
- /* There may be operands to parse. */
- if (*l != END_OF_INSN)
- {
- /* 1 if operand is pending after ','. */
- unsigned int expecting_operand = 0;
+ /* Handle conversion of 'int $3' --> special int3 insn. */
+ if (i.tm.base_opcode == INT_OPCODE && i.op[0].imms->X_add_number == 3)
+ {
+ i.tm.base_opcode = INT3_OPCODE;
+ i.imm_operands = 0;
+ }
- /* Non-zero if operand parens not balanced. */
- unsigned int paren_not_balanced;
+ if ((i.tm.opcode_modifier & (Jump | JumpByte | JumpDword))
+ && i.op[0].disps->X_op == O_constant)
+ {
+ /* Convert "jmp constant" (and "call constant") to a jump (call) to
+ the absolute address given by the constant. Since ix86 jumps and
+ calls are pc relative, we need to generate a reloc. */
+ i.op[0].disps->X_add_symbol = &abs_symbol;
+ i.op[0].disps->X_op = O_symbol;
+ }
- do
- {
- /* Skip optional white space before operand. */
- if (is_space_char (*l))
- ++l;
- if (!is_operand_char (*l) && *l != END_OF_INSN)
- {
- as_bad (_("invalid character %s before operand %d"),
- output_invalid (*l),
- i.operands + 1);
- return;
- }
- token_start = l; /* after white space */
- paren_not_balanced = 0;
- while (paren_not_balanced || *l != ',')
- {
- if (*l == END_OF_INSN)
- {
- if (paren_not_balanced)
- {
- if (!intel_syntax)
- as_bad (_("unbalanced parenthesis in operand %d."),
- i.operands + 1);
- else
- as_bad (_("unbalanced brackets in operand %d."),
- i.operands + 1);
- return;
- }
- else
- break; /* we are done */
- }
- else if (!is_operand_char (*l) && !is_space_char (*l))
- {
- as_bad (_("invalid character %s in operand %d"),
- output_invalid (*l),
- i.operands + 1);
- return;
- }
- if (!intel_syntax)
- {
- if (*l == '(')
- ++paren_not_balanced;
- if (*l == ')')
- --paren_not_balanced;
- }
- else
- {
- if (*l == '[')
- ++paren_not_balanced;
- if (*l == ']')
- --paren_not_balanced;
- }
- l++;
- }
- if (l != token_start)
- { /* Yes, we've read in another operand. */
- unsigned int operand_ok;
- this_operand = i.operands++;
- if (i.operands > MAX_OPERANDS)
- {
- as_bad (_("spurious operands; (%d operands/instruction max)"),
- MAX_OPERANDS);
- return;
- }
- /* Now parse operand adding info to 'i' as we go along. */
- END_STRING_AND_SAVE (l);
-
- if (intel_syntax)
- operand_ok =
- i386_intel_operand (token_start,
- intel_float_operand (mnemonic));
- else
- operand_ok = i386_operand (token_start);
-
- RESTORE_END_STRING (l);
- if (!operand_ok)
- return;
- }
- else
- {
- if (expecting_operand)
- {
- expecting_operand_after_comma:
- as_bad (_("expecting operand after ','; got nothing"));
- return;
- }
- if (*l == ',')
- {
- as_bad (_("expecting operand before ','; got nothing"));
- return;
- }
- }
+ if ((i.tm.opcode_modifier & Rex64) != 0)
+ i.rex |= REX_MODE64;
- /* Now *l must be either ',' or END_OF_INSN. */
- if (*l == ',')
- {
- if (*++l == END_OF_INSN)
- {
- /* Just skip it, if it's \n complain. */
- goto expecting_operand_after_comma;
- }
- expecting_operand = 1;
- }
- }
- while (*l != END_OF_INSN);
- }
- }
+ /* For 8 bit registers we need an empty rex prefix. Also if the
+ instruction already has a prefix, we need to convert old
+ registers to new ones. */
- /* Now we've parsed the mnemonic into a set of templates, and have the
- operands at hand.
+ if (((i.types[0] & Reg8) != 0
+ && (i.op[0].regs->reg_flags & RegRex64) != 0)
+ || ((i.types[1] & Reg8) != 0
+ && (i.op[1].regs->reg_flags & RegRex64) != 0)
+ || (((i.types[0] & Reg8) != 0 || (i.types[1] & Reg8) != 0)
+ && i.rex != 0))
+ {
+ int x;
- Next, we find a template that matches the given insn,
- making sure the overlap of the given operands types is consistent
- with the template operand types. */
+ i.rex |= REX_OPCODE;
+ for (x = 0; x < 2; x++)
+ {
+ /* Look for 8 bit operand that uses old registers. */
+ if ((i.types[x] & Reg8) != 0
+ && (i.op[x].regs->reg_flags & RegRex64) == 0)
+ {
+ /* In case it is "hi" register, give up. */
+ if (i.op[x].regs->reg_num > 3)
+ as_bad (_("can't encode register '%%%s' in an instruction requiring REX prefix.\n"),
+ i.op[x].regs->reg_name);
-#define MATCH(overlap, given, template) \
- ((overlap & ~JumpAbsolute) \
- && ((given) & (BaseIndex|JumpAbsolute)) == ((overlap) & (BaseIndex|JumpAbsolute)))
+ /* Otherwise it is equivalent to the extended register.
+ Since the encoding doesn't change this is merely
+ cosmetic cleanup for debug output. */
- /* If given types r0 and r1 are registers they must be of the same type
- unless the expected operand type register overlap is null.
- Note that Acc in a template matches every size of reg. */
-#define CONSISTENT_REGISTER_MATCH(m0, g0, t0, m1, g1, t1) \
- ( ((g0) & Reg) == 0 || ((g1) & Reg) == 0 || \
- ((g0) & Reg) == ((g1) & Reg) || \
- ((((m0) & Acc) ? Reg : (t0)) & (((m1) & Acc) ? Reg : (t1)) & Reg) == 0 )
+ i.op[x].regs = i.op[x].regs + 8;
+ }
+ }
+ }
- {
- register unsigned int overlap0, overlap1;
- unsigned int overlap2;
- unsigned int found_reverse_match;
- int suffix_check;
-
- /* All intel opcodes have reversed operands except for "bound" and
- "enter". We also don't reverse intersegment "jmp" and "call"
- instructions with 2 immediate operands so that the immediate segment
- precedes the offset, as it does when in AT&T mode. "enter" and the
- intersegment "jmp" and "call" instructions are the only ones that
- have two immediate operands. */
- if (intel_syntax && i.operands > 1
- && (strcmp (mnemonic, "bound") != 0)
- && !((i.types[0] & Imm) && (i.types[1] & Imm)))
- {
- union i386_op temp_op;
- unsigned int temp_type;
- RELOC_ENUM temp_reloc;
- int xchg1 = 0;
- int xchg2 = 0;
+ if (i.rex != 0)
+ add_prefix (REX_OPCODE | i.rex);
- if (i.operands == 2)
- {
- xchg1 = 0;
- xchg2 = 1;
- }
- else if (i.operands == 3)
- {
- xchg1 = 0;
- xchg2 = 2;
- }
- temp_type = i.types[xchg2];
- i.types[xchg2] = i.types[xchg1];
- i.types[xchg1] = temp_type;
- temp_op = i.op[xchg2];
- i.op[xchg2] = i.op[xchg1];
- i.op[xchg1] = temp_op;
- temp_reloc = i.reloc[xchg2];
- i.reloc[xchg2] = i.reloc[xchg1];
- i.reloc[xchg1] = temp_reloc;
-
- if (i.mem_operands == 2)
- {
- const seg_entry *temp_seg;
- temp_seg = i.seg[0];
- i.seg[0] = i.seg[1];
- i.seg[1] = temp_seg;
- }
- }
+ /* We are ready to output the insn. */
+ output_insn ();
+}
- if (i.imm_operands)
- {
- /* Try to ensure constant immediates are represented in the smallest
- opcode possible. */
- char guess_suffix = 0;
- int op;
-
- if (i.suffix)
- guess_suffix = i.suffix;
- else if (i.reg_operands)
- {
- /* Figure out a suffix from the last register operand specified.
- We can't do this properly yet, ie. excluding InOutPortReg,
- but the following works for instructions with immediates.
- In any case, we can't set i.suffix yet. */
- for (op = i.operands; --op >= 0;)
- if (i.types[op] & Reg)
- {
- if (i.types[op] & Reg8)
- guess_suffix = BYTE_MNEM_SUFFIX;
- else if (i.types[op] & Reg16)
- guess_suffix = WORD_MNEM_SUFFIX;
- else if (i.types[op] & Reg32)
- guess_suffix = LONG_MNEM_SUFFIX;
- else if (i.types[op] & Reg64)
- guess_suffix = QWORD_MNEM_SUFFIX;
- break;
- }
- }
- else if ((flag_code == CODE_16BIT) ^ (i.prefix[DATA_PREFIX] != 0))
- guess_suffix = WORD_MNEM_SUFFIX;
+static char *
+parse_insn (line, mnemonic)
+ char *line;
+ char *mnemonic;
+{
+ char *l = line;
+ char *token_start = l;
+ char *mnem_p;
+
+ /* Non-zero if we found a prefix only acceptable with string insns. */
+ const char *expecting_string_instruction = NULL;
- for (op = i.operands; --op >= 0;)
- if (i.types[op] & Imm)
+ while (1)
+ {
+ mnem_p = mnemonic;
+ while ((*mnem_p = mnemonic_chars[(unsigned char) *l]) != 0)
+ {
+ mnem_p++;
+ if (mnem_p >= mnemonic + MAX_MNEM_SIZE)
{
- switch (i.op[op].imms->X_op)
- {
- case O_constant:
- /* If a suffix is given, this operand may be shortened. */
- switch (guess_suffix)
- {
- case LONG_MNEM_SUFFIX:
- i.types[op] |= Imm32 | Imm64;
- break;
- case WORD_MNEM_SUFFIX:
- i.types[op] |= Imm16 | Imm32S | Imm32 | Imm64;
- break;
- case BYTE_MNEM_SUFFIX:
- i.types[op] |= Imm16 | Imm8 | Imm8S | Imm32S | Imm32 | Imm64;
- break;
- }
+ as_bad (_("no such instruction: `%s'"), token_start);
+ return NULL;
+ }
+ l++;
+ }
+ if (!is_space_char (*l)
+ && *l != END_OF_INSN
+ && *l != PREFIX_SEPARATOR
+ && *l != ',')
+ {
+ as_bad (_("invalid character %s in mnemonic"),
+ output_invalid (*l));
+ return NULL;
+ }
+ if (token_start == l)
+ {
+ if (*l == PREFIX_SEPARATOR)
+ as_bad (_("expecting prefix; got nothing"));
+ else
+ as_bad (_("expecting mnemonic; got nothing"));
+ return NULL;
+ }
- /* If this operand is at most 16 bits, convert it
- to a signed 16 bit number before trying to see
- whether it will fit in an even smaller size.
- This allows a 16-bit operand such as $0xffe0 to
- be recognised as within Imm8S range. */
- if ((i.types[op] & Imm16)
- && (i.op[op].imms->X_add_number & ~(offsetT) 0xffff) == 0)
- {
- i.op[op].imms->X_add_number =
- (((i.op[op].imms->X_add_number & 0xffff) ^ 0x8000) - 0x8000);
- }
- if ((i.types[op] & Imm32)
- && (i.op[op].imms->X_add_number & ~(((offsetT) 2 << 31) - 1)) == 0)
- {
- i.op[op].imms->X_add_number =
- (i.op[op].imms->X_add_number ^ ((offsetT) 1 << 31)) - ((addressT) 1 << 31);
- }
- i.types[op] |= smallest_imm_type (i.op[op].imms->X_add_number);
- /* We must avoid matching of Imm32 templates when 64bit only immediate is available. */
- if (guess_suffix == QWORD_MNEM_SUFFIX)
- i.types[op] &= ~Imm32;
- break;
- case O_absent:
- case O_register:
- abort ();
- /* Symbols and expressions. */
- default:
- /* Convert symbolic operand to proper sizes for matching. */
- switch (guess_suffix)
- {
- case QWORD_MNEM_SUFFIX:
- i.types[op] = Imm64 | Imm32S;
- break;
- case LONG_MNEM_SUFFIX:
- i.types[op] = Imm32 | Imm64;
- break;
- case WORD_MNEM_SUFFIX:
- i.types[op] = Imm16 | Imm32 | Imm64;
- break;
- break;
- case BYTE_MNEM_SUFFIX:
- i.types[op] = Imm8 | Imm8S | Imm16 | Imm32S | Imm32;
- break;
- break;
- }
- break;
- }
+ /* Look up instruction (or prefix) via hash table. */
+ current_templates = hash_find (op_hash, mnemonic);
+
+ if (*l != END_OF_INSN
+ && (!is_space_char (*l) || l[1] != END_OF_INSN)
+ && current_templates
+ && (current_templates->start->opcode_modifier & IsPrefix))
+ {
+ /* 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)))
+ {
+ as_bad (_("redundant %s prefix"),
+ current_templates->start->name);
+ return NULL;
}
- }
+ /* Add prefix, checking for repeated prefixes. */
+ switch (add_prefix (current_templates->start->base_opcode))
+ {
+ case 0:
+ return NULL;
+ case 2:
+ expecting_string_instruction = current_templates->start->name;
+ break;
+ }
+ /* Skip past PREFIX_SEPARATOR and reset token_start. */
+ token_start = ++l;
+ }
+ else
+ break;
+ }
- if (i.disp_operands)
- {
- /* Try to use the smallest displacement type too. */
- int op;
+ if (!current_templates)
+ {
+ /* See if we can get a match by trimming off a suffix. */
+ switch (mnem_p[-1])
+ {
+ case WORD_MNEM_SUFFIX:
+ case BYTE_MNEM_SUFFIX:
+ case QWORD_MNEM_SUFFIX:
+ i.suffix = mnem_p[-1];
+ mnem_p[-1] = '\0';
+ current_templates = hash_find (op_hash, mnemonic);
+ break;
+ case SHORT_MNEM_SUFFIX:
+ case LONG_MNEM_SUFFIX:
+ if (!intel_syntax)
+ {
+ i.suffix = mnem_p[-1];
+ mnem_p[-1] = '\0';
+ current_templates = hash_find (op_hash, mnemonic);
+ }
+ break;
- for (op = i.operands; --op >= 0;)
- if ((i.types[op] & Disp)
- && i.op[op].disps->X_op == O_constant)
+ /* Intel Syntax. */
+ case 'd':
+ if (intel_syntax)
{
- offsetT disp = i.op[op].disps->X_add_number;
+ if (intel_float_operand (mnemonic))
+ i.suffix = SHORT_MNEM_SUFFIX;
+ else
+ i.suffix = LONG_MNEM_SUFFIX;
+ mnem_p[-1] = '\0';
+ current_templates = hash_find (op_hash, mnemonic);
+ }
+ break;
+ }
+ if (!current_templates)
+ {
+ as_bad (_("no such instruction: `%s'"), token_start);
+ return NULL;
+ }
+ }
- if (i.types[op] & Disp16)
- {
- /* We know this operand is at most 16 bits, so
- convert to a signed 16 bit number before trying
- to see whether it will fit in an even smaller
- size. */
+ if (current_templates->start->opcode_modifier & (Jump | JumpByte))
+ {
+ /* Check for a branch hint. We allow ",pt" and ",pn" for
+ predict taken and predict not taken respectively.
+ I'm not sure that branch hints actually do anything on loop
+ and jcxz insns (JumpByte) for current Pentium4 chips. They
+ may work in the future and it doesn't hurt to accept them
+ now. */
+ if (l[0] == ',' && l[1] == 'p')
+ {
+ if (l[2] == 't')
+ {
+ if (!add_prefix (DS_PREFIX_OPCODE))
+ return NULL;
+ l += 3;
+ }
+ else if (l[2] == 'n')
+ {
+ if (!add_prefix (CS_PREFIX_OPCODE))
+ return NULL;
+ l += 3;
+ }
+ }
+ }
+ /* Any other comma loses. */
+ if (*l == ',')
+ {
+ as_bad (_("invalid character %s in mnemonic"),
+ output_invalid (*l));
+ return NULL;
+ }
- disp = (((disp & 0xffff) ^ 0x8000) - 0x8000);
- }
- else if (i.types[op] & Disp32)
- {
- /* We know this operand is at most 32 bits, so convert to a
- signed 32 bit number before trying to see whether it will
- fit in an even smaller size. */
- disp &= (((offsetT) 2 << 31) - 1);
- disp = (disp ^ ((offsetT) 1 << 31)) - ((addressT) 1 << 31);
- }
- if (flag_code == CODE_64BIT)
+ /* Check if instruction is supported on specified architecture. */
+ if ((current_templates->start->cpu_flags & ~(Cpu64 | CpuNo64))
+ & ~(cpu_arch_flags & ~(Cpu64 | CpuNo64)))
+ {
+ as_warn (_("`%s' is not supported on `%s'"),
+ current_templates->start->name, cpu_arch_name);
+ }
+ else if ((Cpu386 & ~cpu_arch_flags) && (flag_code != CODE_16BIT))
+ {
+ as_warn (_("use .code16 to ensure correct addressing mode"));
+ }
+
+ /* Check for rep/repne without a string instruction. */
+ if (expecting_string_instruction
+ && !(current_templates->start->opcode_modifier & IsString))
+ {
+ as_bad (_("expecting string instruction after `%s'"),
+ expecting_string_instruction);
+ return NULL;
+ }
+
+ return l;
+}
+
+static char *
+parse_operands (l, mnemonic)
+ char *l;
+ const char *mnemonic;
+{
+ char *token_start;
+
+ /* 1 if operand is pending after ','. */
+ unsigned int expecting_operand = 0;
+
+ /* Non-zero if operand parens not balanced. */
+ unsigned int paren_not_balanced;
+
+ while (*l != END_OF_INSN)
+ {
+ /* Skip optional white space before operand. */
+ if (is_space_char (*l))
+ ++l;
+ if (!is_operand_char (*l) && *l != END_OF_INSN)
+ {
+ as_bad (_("invalid character %s before operand %d"),
+ output_invalid (*l),
+ i.operands + 1);
+ return NULL;
+ }
+ token_start = l; /* after white space */
+ paren_not_balanced = 0;
+ while (paren_not_balanced || *l != ',')
+ {
+ if (*l == END_OF_INSN)
+ {
+ if (paren_not_balanced)
{
- if (fits_in_signed_long (disp))
- i.types[op] |= Disp32S;
- if (fits_in_unsigned_long (disp))
- i.types[op] |= Disp32;
+ if (!intel_syntax)
+ as_bad (_("unbalanced parenthesis in operand %d."),
+ i.operands + 1);
+ else
+ as_bad (_("unbalanced brackets in operand %d."),
+ i.operands + 1);
+ return NULL;
}
- if ((i.types[op] & (Disp32 | Disp32S | Disp16))
- && fits_in_signed_byte (disp))
- i.types[op] |= Disp8;
+ else
+ break; /* we are done */
}
- }
+ else if (!is_operand_char (*l) && !is_space_char (*l))
+ {
+ as_bad (_("invalid character %s in operand %d"),
+ output_invalid (*l),
+ i.operands + 1);
+ return NULL;
+ }
+ if (!intel_syntax)
+ {
+ if (*l == '(')
+ ++paren_not_balanced;
+ if (*l == ')')
+ --paren_not_balanced;
+ }
+ else
+ {
+ if (*l == '[')
+ ++paren_not_balanced;
+ if (*l == ']')
+ --paren_not_balanced;
+ }
+ l++;
+ }
+ if (l != token_start)
+ { /* Yes, we've read in another operand. */
+ unsigned int operand_ok;
+ this_operand = i.operands++;
+ if (i.operands > MAX_OPERANDS)
+ {
+ as_bad (_("spurious operands; (%d operands/instruction max)"),
+ MAX_OPERANDS);
+ return NULL;
+ }
+ /* Now parse operand adding info to 'i' as we go along. */
+ END_STRING_AND_SAVE (l);
- overlap0 = 0;
- overlap1 = 0;
- overlap2 = 0;
- found_reverse_match = 0;
- suffix_check = (i.suffix == BYTE_MNEM_SUFFIX
- ? No_bSuf
- : (i.suffix == WORD_MNEM_SUFFIX
- ? No_wSuf
- : (i.suffix == SHORT_MNEM_SUFFIX
- ? No_sSuf
- : (i.suffix == LONG_MNEM_SUFFIX
- ? No_lSuf
- : (i.suffix == QWORD_MNEM_SUFFIX
- ? No_qSuf
- : (i.suffix == LONG_DOUBLE_MNEM_SUFFIX ? No_xSuf : 0))))));
-
- for (t = current_templates->start;
- t < current_templates->end;
- t++)
- {
- /* Must have right number of operands. */
- if (i.operands != t->operands)
- continue;
+ if (intel_syntax)
+ operand_ok =
+ i386_intel_operand (token_start,
+ intel_float_operand (mnemonic));
+ else
+ operand_ok = i386_operand (token_start);
- /* Check the suffix, except for some instructions in intel mode. */
- if ((t->opcode_modifier & suffix_check)
- && !(intel_syntax
- && (t->opcode_modifier & IgnoreSize))
- && !(intel_syntax
- && t->base_opcode == 0xd9
- && (t->extension_opcode == 5 /* 0xd9,5 "fldcw" */
- || t->extension_opcode == 7))) /* 0xd9,7 "f{n}stcw" */
- continue;
+ RESTORE_END_STRING (l);
+ if (!operand_ok)
+ return NULL;
+ }
+ else
+ {
+ if (expecting_operand)
+ {
+ expecting_operand_after_comma:
+ as_bad (_("expecting operand after ','; got nothing"));
+ return NULL;
+ }
+ if (*l == ',')
+ {
+ as_bad (_("expecting operand before ','; got nothing"));
+ return NULL;
+ }
+ }
- /* Do not verify operands when there are none. */
- else if (!t->operands)
+ /* Now *l must be either ',' or END_OF_INSN. */
+ if (*l == ',')
+ {
+ if (*++l == END_OF_INSN)
+ {
+ /* Just skip it, if it's \n complain. */
+ goto expecting_operand_after_comma;
+ }
+ expecting_operand = 1;
+ }
+ }
+ return l;
+}
+
+static void
+swap_operands ()
+{
+ union i386_op temp_op;
+ unsigned int temp_type;
+ RELOC_ENUM temp_reloc;
+ int xchg1 = 0;
+ int xchg2 = 0;
+
+ if (i.operands == 2)
+ {
+ xchg1 = 0;
+ xchg2 = 1;
+ }
+ else if (i.operands == 3)
+ {
+ xchg1 = 0;
+ xchg2 = 2;
+ }
+ temp_type = i.types[xchg2];
+ i.types[xchg2] = i.types[xchg1];
+ i.types[xchg1] = temp_type;
+ temp_op = i.op[xchg2];
+ i.op[xchg2] = i.op[xchg1];
+ i.op[xchg1] = temp_op;
+ temp_reloc = i.reloc[xchg2];
+ i.reloc[xchg2] = i.reloc[xchg1];
+ i.reloc[xchg1] = temp_reloc;
+
+ if (i.mem_operands == 2)
+ {
+ const seg_entry *temp_seg;
+ temp_seg = i.seg[0];
+ i.seg[0] = i.seg[1];
+ i.seg[1] = temp_seg;
+ }
+}
+
+/* Try to ensure constant immediates are represented in the smallest
+ opcode possible. */
+static void
+optimize_imm ()
+{
+ char guess_suffix = 0;
+ int op;
+
+ if (i.suffix)
+ guess_suffix = i.suffix;
+ else if (i.reg_operands)
+ {
+ /* Figure out a suffix from the last register operand specified.
+ We can't do this properly yet, ie. excluding InOutPortReg,
+ but the following works for instructions with immediates.
+ In any case, we can't set i.suffix yet. */
+ for (op = i.operands; --op >= 0;)
+ if (i.types[op] & Reg)
{
- if (t->cpu_flags & ~cpu_arch_flags)
- continue;
- /* We've found a match; break out of loop. */
+ if (i.types[op] & Reg8)
+ guess_suffix = BYTE_MNEM_SUFFIX;
+ else if (i.types[op] & Reg16)
+ guess_suffix = WORD_MNEM_SUFFIX;
+ else if (i.types[op] & Reg32)
+ guess_suffix = LONG_MNEM_SUFFIX;
+ else if (i.types[op] & Reg64)
+ guess_suffix = QWORD_MNEM_SUFFIX;
break;
}
+ }
+ else if ((flag_code == CODE_16BIT) ^ (i.prefix[DATA_PREFIX] != 0))
+ guess_suffix = WORD_MNEM_SUFFIX;
- overlap0 = i.types[0] & t->operand_types[0];
- switch (t->operands)
+ for (op = i.operands; --op >= 0;)
+ if (i.types[op] & Imm)
+ {
+ switch (i.op[op].imms->X_op)
{
- case 1:
- if (!MATCH (overlap0, i.types[0], t->operand_types[0]))
- continue;
- break;
- case 2:
- case 3:
- overlap1 = i.types[1] & t->operand_types[1];
- if (!MATCH (overlap0, i.types[0], t->operand_types[0])
- || !MATCH (overlap1, i.types[1], t->operand_types[1])
- || !CONSISTENT_REGISTER_MATCH (overlap0, i.types[0],
- t->operand_types[0],
- overlap1, i.types[1],
- t->operand_types[1]))
+ case O_constant:
+ /* If a suffix is given, this operand may be shortened. */
+ switch (guess_suffix)
{
- /* Check if other direction is valid ... */
- if ((t->opcode_modifier & (D|FloatD)) == 0)
- continue;
+ case LONG_MNEM_SUFFIX:
+ i.types[op] |= Imm32 | Imm64;
+ break;
+ case WORD_MNEM_SUFFIX:
+ i.types[op] |= Imm16 | Imm32S | Imm32 | Imm64;
+ break;
+ case BYTE_MNEM_SUFFIX:
+ i.types[op] |= Imm16 | Imm8 | Imm8S | Imm32S | Imm32 | Imm64;
+ break;
+ }
- /* Try reversing direction of operands. */
- overlap0 = i.types[0] & t->operand_types[1];
- overlap1 = i.types[1] & t->operand_types[0];
- if (!MATCH (overlap0, i.types[0], t->operand_types[1])
- || !MATCH (overlap1, i.types[1], t->operand_types[0])
- || !CONSISTENT_REGISTER_MATCH (overlap0, i.types[0],
- t->operand_types[1],
- overlap1, i.types[1],
- t->operand_types[0]))
- {
- /* Does not match either direction. */
- continue;
- }
- /* found_reverse_match holds which of D or FloatDR
- we've found. */
- found_reverse_match = t->opcode_modifier & (D|FloatDR);
+ /* If this operand is at most 16 bits, convert it
+ to a signed 16 bit number before trying to see
+ whether it will fit in an even smaller size.
+ This allows a 16-bit operand such as $0xffe0 to
+ be recognised as within Imm8S range. */
+ if ((i.types[op] & Imm16)
+ && (i.op[op].imms->X_add_number & ~(offsetT) 0xffff) == 0)
+ {
+ i.op[op].imms->X_add_number =
+ (((i.op[op].imms->X_add_number & 0xffff) ^ 0x8000) - 0x8000);
}
- /* Found a forward 2 operand match here. */
- else if (t->operands == 3)
+ if ((i.types[op] & Imm32)
+ && ((i.op[op].imms->X_add_number & ~(((offsetT) 2 << 31) - 1))
+ == 0))
{
- /* Here we make use of the fact that there are no
- reverse match 3 operand instructions, and all 3
- operand instructions only need to be checked for
- register consistency between operands 2 and 3. */
- overlap2 = i.types[2] & t->operand_types[2];
- if (!MATCH (overlap2, i.types[2], t->operand_types[2])
- || !CONSISTENT_REGISTER_MATCH (overlap1, i.types[1],
- t->operand_types[1],
- overlap2, i.types[2],
- t->operand_types[2]))
+ i.op[op].imms->X_add_number = ((i.op[op].imms->X_add_number
+ ^ ((offsetT) 1 << 31))
+ - ((offsetT) 1 << 31));
+ }
+ i.types[op] |= smallest_imm_type (i.op[op].imms->X_add_number);
- continue;
+ /* We must avoid matching of Imm32 templates when 64bit
+ only immediate is available. */
+ if (guess_suffix == QWORD_MNEM_SUFFIX)
+ i.types[op] &= ~Imm32;
+ break;
+
+ case O_absent:
+ case O_register:
+ abort ();
+
+ /* Symbols and expressions. */
+ default:
+ /* Convert symbolic operand to proper sizes for matching. */
+ switch (guess_suffix)
+ {
+ case QWORD_MNEM_SUFFIX:
+ i.types[op] = Imm64 | Imm32S;
+ break;
+ case LONG_MNEM_SUFFIX:
+ i.types[op] = Imm32 | Imm64;
+ break;
+ case WORD_MNEM_SUFFIX:
+ i.types[op] = Imm16 | Imm32 | Imm64;
+ break;
+ break;
+ case BYTE_MNEM_SUFFIX:
+ i.types[op] = Imm8 | Imm8S | Imm16 | Imm32S | Imm32;
+ break;
+ break;
}
- /* Found either forward/reverse 2 or 3 operand match here:
- slip through to break. */
- }
- if (t->cpu_flags & ~cpu_arch_flags)
- {
- found_reverse_match = 0;
- continue;
+ break;
}
- /* We've found a match; break out of loop. */
- break;
- }
- if (t == current_templates->end)
- {
- /* We found no match. */
- as_bad (_("suffix or operands invalid for `%s'"),
- current_templates->start->name);
- return;
}
+}
- if (!quiet_warnings)
+/* Try to use the smallest displacement type too. */
+static void
+optimize_disp ()
+{
+ int op;
+
+ for (op = i.operands; --op >= 0;)
+ if ((i.types[op] & Disp) && i.op[op].disps->X_op == O_constant)
{
- if (!intel_syntax
- && ((i.types[0] & JumpAbsolute)
- != (t->operand_types[0] & JumpAbsolute)))
+ offsetT disp = i.op[op].disps->X_add_number;
+
+ if (i.types[op] & Disp16)
{
- as_warn (_("indirect %s without `*'"), t->name);
- }
+ /* We know this operand is at most 16 bits, so
+ convert to a signed 16 bit number before trying
+ to see whether it will fit in an even smaller
+ size. */
- if ((t->opcode_modifier & (IsPrefix|IgnoreSize))
- == (IsPrefix|IgnoreSize))
+ disp = (((disp & 0xffff) ^ 0x8000) - 0x8000);
+ }
+ else if (i.types[op] & Disp32)
{
- /* Warn them that a data or address size prefix doesn't
- affect assembly of the next line of code. */
- as_warn (_("stand-alone `%s' prefix"), t->name);
+ /* We know this operand is at most 32 bits, so convert to a
+ signed 32 bit number before trying to see whether it will
+ fit in an even smaller size. */
+ disp &= (((offsetT) 2 << 31) - 1);
+ disp = (disp ^ ((offsetT) 1 << 31)) - ((addressT) 1 << 31);
}
+ if (flag_code == CODE_64BIT)
+ {
+ if (fits_in_signed_long (disp))
+ i.types[op] |= Disp32S;
+ if (fits_in_unsigned_long (disp))
+ i.types[op] |= Disp32;
+ }
+ if ((i.types[op] & (Disp32 | Disp32S | Disp16))
+ && fits_in_signed_byte (disp))
+ i.types[op] |= Disp8;
}
+}
- /* Copy the template we found. */
- i.tm = *t;
- if (found_reverse_match)
- {
- /* If we found a reverse match we must alter the opcode
- direction bit. found_reverse_match holds bits to change
- (different for int & float insns). */
+static int
+match_template ()
+{
+ /* Points to template once we've found it. */
+ const template *t;
+ unsigned int overlap0, overlap1, overlap2;
+ unsigned int found_reverse_match;
+ int suffix_check;
- i.tm.base_opcode ^= found_reverse_match;
+#define MATCH(overlap, given, template) \
+ ((overlap & ~JumpAbsolute) \
+ && (((given) & (BaseIndex | JumpAbsolute)) \
+ == ((overlap) & (BaseIndex | JumpAbsolute))))
- i.tm.operand_types[0] = t->operand_types[1];
- i.tm.operand_types[1] = t->operand_types[0];
- }
+ /* If given types r0 and r1 are registers they must be of the same type
+ unless the expected operand type register overlap is null.
+ Note that Acc in a template matches every size of reg. */
+#define CONSISTENT_REGISTER_MATCH(m0, g0, t0, m1, g1, t1) \
+ (((g0) & Reg) == 0 || ((g1) & Reg) == 0 \
+ || ((g0) & Reg) == ((g1) & Reg) \
+ || ((((m0) & Acc) ? Reg : (t0)) & (((m1) & Acc) ? Reg : (t1)) & Reg) == 0 )
+
+ overlap0 = 0;
+ overlap1 = 0;
+ overlap2 = 0;
+ found_reverse_match = 0;
+ suffix_check = (i.suffix == BYTE_MNEM_SUFFIX
+ ? No_bSuf
+ : (i.suffix == WORD_MNEM_SUFFIX
+ ? No_wSuf
+ : (i.suffix == SHORT_MNEM_SUFFIX
+ ? No_sSuf
+ : (i.suffix == LONG_MNEM_SUFFIX
+ ? No_lSuf
+ : (i.suffix == QWORD_MNEM_SUFFIX
+ ? No_qSuf
+ : (i.suffix == LONG_DOUBLE_MNEM_SUFFIX
+ ? No_xSuf : 0))))));
+
+ for (t = current_templates->start;
+ t < current_templates->end;
+ t++)
+ {
+ /* Must have right number of operands. */
+ if (i.operands != t->operands)
+ continue;
+
+ /* Check the suffix, except for some instructions in intel mode. */
+ if ((t->opcode_modifier & suffix_check)
+ && !(intel_syntax
+ && (t->opcode_modifier & IgnoreSize))
+ && !(intel_syntax
+ && t->base_opcode == 0xd9
+ && (t->extension_opcode == 5 /* 0xd9,5 "fldcw" */
+ || t->extension_opcode == 7))) /* 0xd9,7 "f{n}stcw" */
+ continue;
+
+ /* Do not verify operands when there are none. */
+ else if (!t->operands)
+ {
+ if (t->cpu_flags & ~cpu_arch_flags)
+ continue;
+ /* We've found a match; break out of loop. */
+ break;
+ }
+
+ overlap0 = i.types[0] & t->operand_types[0];
+ switch (t->operands)
+ {
+ case 1:
+ if (!MATCH (overlap0, i.types[0], t->operand_types[0]))
+ continue;
+ break;
+ case 2:
+ case 3:
+ overlap1 = i.types[1] & t->operand_types[1];
+ if (!MATCH (overlap0, i.types[0], t->operand_types[0])
+ || !MATCH (overlap1, i.types[1], t->operand_types[1])
+ || !CONSISTENT_REGISTER_MATCH (overlap0, i.types[0],
+ t->operand_types[0],
+ overlap1, i.types[1],
+ t->operand_types[1]))
+ {
+ /* Check if other direction is valid ... */
+ if ((t->opcode_modifier & (D | FloatD)) == 0)
+ continue;
+
+ /* Try reversing direction of operands. */
+ overlap0 = i.types[0] & t->operand_types[1];
+ overlap1 = i.types[1] & t->operand_types[0];
+ if (!MATCH (overlap0, i.types[0], t->operand_types[1])
+ || !MATCH (overlap1, i.types[1], t->operand_types[0])
+ || !CONSISTENT_REGISTER_MATCH (overlap0, i.types[0],
+ t->operand_types[1],
+ overlap1, i.types[1],
+ t->operand_types[0]))
+ {
+ /* Does not match either direction. */
+ continue;
+ }
+ /* found_reverse_match holds which of D or FloatDR
+ we've found. */
+ found_reverse_match = t->opcode_modifier & (D | FloatDR);
+ }
+ /* Found a forward 2 operand match here. */
+ else if (t->operands == 3)
+ {
+ /* Here we make use of the fact that there are no
+ reverse match 3 operand instructions, and all 3
+ operand instructions only need to be checked for
+ register consistency between operands 2 and 3. */
+ overlap2 = i.types[2] & t->operand_types[2];
+ if (!MATCH (overlap2, i.types[2], t->operand_types[2])
+ || !CONSISTENT_REGISTER_MATCH (overlap1, i.types[1],
+ t->operand_types[1],
+ overlap2, i.types[2],
+ t->operand_types[2]))
+
+ continue;
+ }
+ /* Found either forward/reverse 2 or 3 operand match here:
+ slip through to break. */
+ }
+ if (t->cpu_flags & ~cpu_arch_flags)
+ {
+ found_reverse_match = 0;
+ continue;
+ }
+ /* We've found a match; break out of loop. */
+ break;
+ }
- /* Undo SYSV386_COMPAT brokenness when in Intel mode. See i386.h */
- if (SYSV386_COMPAT
- && intel_syntax
- && (i.tm.base_opcode & 0xfffffde0) == 0xdce0)
- i.tm.base_opcode ^= FloatR;
+ if (t == current_templates->end)
+ {
+ /* We found no match. */
+ as_bad (_("suffix or operands invalid for `%s'"),
+ current_templates->start->name);
+ return 0;
+ }
- if (i.tm.opcode_modifier & FWait)
- if (! add_prefix (FWAIT_OPCODE))
- return;
+ if (!quiet_warnings)
+ {
+ if (!intel_syntax
+ && ((i.types[0] & JumpAbsolute)
+ != (t->operand_types[0] & JumpAbsolute)))
+ {
+ as_warn (_("indirect %s without `*'"), t->name);
+ }
- /* Check string instruction segment overrides. */
- if ((i.tm.opcode_modifier & IsString) != 0 && i.mem_operands != 0)
- {
- int mem_op = (i.types[0] & AnyMem) ? 0 : 1;
- if ((i.tm.operand_types[mem_op] & EsSeg) != 0)
- {
- if (i.seg[0] != NULL && i.seg[0] != &es)
- {
- as_bad (_("`%s' operand %d must use `%%es' segment"),
- i.tm.name,
- mem_op + 1);
- return;
- }
- /* There's only ever one segment override allowed per instruction.
- This instruction possibly has a legal segment override on the
- second operand, so copy the segment to where non-string
- instructions store it, allowing common code. */
- i.seg[0] = i.seg[1];
- }
- else if ((i.tm.operand_types[mem_op + 1] & EsSeg) != 0)
- {
- if (i.seg[1] != NULL && i.seg[1] != &es)
+ if ((t->opcode_modifier & (IsPrefix | IgnoreSize))
+ == (IsPrefix | IgnoreSize))
+ {
+ /* Warn them that a data or address size prefix doesn't
+ affect assembly of the next line of code. */
+ as_warn (_("stand-alone `%s' prefix"), t->name);
+ }
+ }
+
+ /* Copy the template we found. */
+ i.tm = *t;
+ if (found_reverse_match)
+ {
+ /* If we found a reverse match we must alter the opcode
+ direction bit. found_reverse_match holds bits to change
+ (different for int & float insns). */
+
+ i.tm.base_opcode ^= found_reverse_match;
+
+ i.tm.operand_types[0] = t->operand_types[1];
+ i.tm.operand_types[1] = t->operand_types[0];
+ }
+
+ return 1;
+}
+
+static int
+check_string ()
+{
+ int mem_op = (i.types[0] & AnyMem) ? 0 : 1;
+ if ((i.tm.operand_types[mem_op] & EsSeg) != 0)
+ {
+ if (i.seg[0] != NULL && i.seg[0] != &es)
+ {
+ as_bad (_("`%s' operand %d must use `%%es' segment"),
+ i.tm.name,
+ mem_op + 1);
+ return 0;
+ }
+ /* There's only ever one segment override allowed per instruction.
+ This instruction possibly has a legal segment override on the
+ second operand, so copy the segment to where non-string
+ instructions store it, allowing common code. */
+ i.seg[0] = i.seg[1];
+ }
+ else if ((i.tm.operand_types[mem_op + 1] & EsSeg) != 0)
+ {
+ if (i.seg[1] != NULL && i.seg[1] != &es)
+ {
+ as_bad (_("`%s' operand %d must use `%%es' segment"),
+ i.tm.name,
+ mem_op + 2);
+ return 0;
+ }
+ }
+ return 1;
+}
+
+static int
+process_suffix ()
+{
+ /* If matched instruction specifies an explicit instruction mnemonic
+ suffix, use it. */
+ if (i.tm.opcode_modifier & (Size16 | Size32 | Size64))
+ {
+ if (i.tm.opcode_modifier & Size16)
+ i.suffix = WORD_MNEM_SUFFIX;
+ else if (i.tm.opcode_modifier & Size64)
+ i.suffix = QWORD_MNEM_SUFFIX;
+ else
+ i.suffix = LONG_MNEM_SUFFIX;
+ }
+ else if (i.reg_operands)
+ {
+ /* If there's no instruction mnemonic suffix we try to invent one
+ based on register operands. */
+ if (!i.suffix)
+ {
+ /* We take i.suffix from the last register operand specified,
+ Destination register type is more significant than source
+ register type. */
+ int op;
+ for (op = i.operands; --op >= 0;)
+ if ((i.types[op] & Reg)
+ && !(i.tm.operand_types[op] & InOutPortReg))
{
- as_bad (_("`%s' operand %d must use `%%es' segment"),
- i.tm.name,
- mem_op + 2);
- return;
+ i.suffix = ((i.types[op] & Reg8) ? BYTE_MNEM_SUFFIX :
+ (i.types[op] & Reg16) ? WORD_MNEM_SUFFIX :
+ (i.types[op] & Reg64) ? QWORD_MNEM_SUFFIX :
+ LONG_MNEM_SUFFIX);
+ break;
}
- }
- }
+ }
+ else if (i.suffix == BYTE_MNEM_SUFFIX)
+ {
+ if (!check_byte_reg ())
+ return 0;
+ }
+ else if (i.suffix == LONG_MNEM_SUFFIX)
+ {
+ if (!check_long_reg ())
+ return 0;
+ }
+ else if (i.suffix == QWORD_MNEM_SUFFIX)
+ {
+ if (!check_qword_reg ())
+ return 0;
+ }
+ else if (i.suffix == WORD_MNEM_SUFFIX)
+ {
+ if (!check_word_reg ())
+ return 0;
+ }
+ else if (intel_syntax && (i.tm.opcode_modifier & IgnoreSize))
+ /* Do nothing if the instruction is going to ignore the prefix. */
+ ;
+ else
+ abort ();
+ }
+ else if ((i.tm.opcode_modifier & DefaultSize) && !i.suffix)
+ {
+ i.suffix = stackop_size;
+ }
+
+ /* Change the opcode based on the operand size given by i.suffix;
+ We need not change things for byte insns. */
- /* If matched instruction specifies an explicit instruction mnemonic
- suffix, use it. */
- if (i.tm.opcode_modifier & (Size16 | Size32 | Size64))
+ if (!i.suffix && (i.tm.opcode_modifier & W))
+ {
+ as_bad (_("no instruction mnemonic suffix given and no register operands; can't size instruction"));
+ return 0;
+ }
+
+ /* For movzx and movsx, need to check the register type. */
+ if (intel_syntax
+ && (i.tm.base_opcode == 0xfb6 || i.tm.base_opcode == 0xfbe))
+ if (i.suffix && i.suffix == BYTE_MNEM_SUFFIX)
{
- if (i.tm.opcode_modifier & Size16)
- i.suffix = WORD_MNEM_SUFFIX;
- else if (i.tm.opcode_modifier & Size64)
- i.suffix = QWORD_MNEM_SUFFIX;
- else
- i.suffix = LONG_MNEM_SUFFIX;
+ unsigned int prefix = DATA_PREFIX_OPCODE;
+
+ if ((i.op[1].regs->reg_type & Reg16) != 0)
+ if (!add_prefix (prefix))
+ return 0;
}
- else if (i.reg_operands)
- {
- /* If there's no instruction mnemonic suffix we try to invent one
- based on register operands. */
- if (!i.suffix)
- {
- /* We take i.suffix from the last register operand specified,
- Destination register type is more significant than source
- register type. */
- int op;
- for (op = i.operands; --op >= 0;)
- if ((i.types[op] & Reg)
- && !(i.tm.operand_types[op] & InOutPortReg))
- {
- i.suffix = ((i.types[op] & Reg8) ? BYTE_MNEM_SUFFIX :
- (i.types[op] & Reg16) ? WORD_MNEM_SUFFIX :
- (i.types[op] & Reg64) ? QWORD_MNEM_SUFFIX :
- LONG_MNEM_SUFFIX);
- break;
- }
- }
- else if (i.suffix == BYTE_MNEM_SUFFIX)
- {
- int op;
- for (op = i.operands; --op >= 0;)
- {
- /* If this is an eight bit register, it's OK. If it's
- the 16 or 32 bit version of an eight bit register,
- we will just use the low portion, and that's OK too. */
- if (i.types[op] & Reg8)
- continue;
- /* movzx and movsx should not generate this warning. */
- if (intel_syntax
- && (i.tm.base_opcode == 0xfb7
- || i.tm.base_opcode == 0xfb6
- || i.tm.base_opcode == 0x63
- || i.tm.base_opcode == 0xfbe
- || i.tm.base_opcode == 0xfbf))
- continue;
+ if (i.suffix && i.suffix != BYTE_MNEM_SUFFIX)
+ {
+ /* It's not a byte, select word/dword operation. */
+ if (i.tm.opcode_modifier & W)
+ {
+ if (i.tm.opcode_modifier & ShortForm)
+ i.tm.base_opcode |= 8;
+ else
+ i.tm.base_opcode |= 1;
+ }
+ /* Now select between word & dword operations via the operand
+ size prefix, except for instructions that will ignore this
+ prefix anyway. */
+ if (i.suffix != QWORD_MNEM_SUFFIX
+ && (i.suffix == LONG_MNEM_SUFFIX) == (flag_code == CODE_16BIT)
+ && !(i.tm.opcode_modifier & IgnoreSize))
+ {
+ unsigned int prefix = DATA_PREFIX_OPCODE;
+ if (i.tm.opcode_modifier & JumpByte) /* jcxz, loop */
+ prefix = ADDR_PREFIX_OPCODE;
+
+ if (!add_prefix (prefix))
+ return 0;
+ }
- if ((i.types[op] & WordReg) && i.op[op].regs->reg_num < 4
+ 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 0;
+ }
+
+ /* Set mode64 for an operand. */
+ if (i.suffix == QWORD_MNEM_SUFFIX
+ && (i.tm.opcode_modifier & NoRex64) == 0)
+ {
+ i.rex |= REX_MODE64;
+ if (flag_code < CODE_64BIT)
+ {
+ as_bad (_("64bit operations available only in 64bit modes."));
+ return 0;
+ }
+ }
+
+ /* Size floating point instruction. */
+ if (i.suffix == LONG_MNEM_SUFFIX)
+ {
+ if (i.tm.opcode_modifier & FloatMF)
+ i.tm.base_opcode ^= 4;
+ }
+ }
+
+ return 1;
+}
+
+static int
+check_byte_reg ()
+{
+ int op;
+ for (op = i.operands; --op >= 0;)
+ {
+ /* If this is an eight bit register, it's OK. If it's the 16 or
+ 32 bit version of an eight bit register, we will just use the
+ low portion, and that's OK too. */
+ if (i.types[op] & Reg8)
+ continue;
+
+ /* movzx and movsx should not generate this warning. */
+ if (intel_syntax
+ && (i.tm.base_opcode == 0xfb7
+ || i.tm.base_opcode == 0xfb6
+ || i.tm.base_opcode == 0x63
+ || i.tm.base_opcode == 0xfbe
+ || i.tm.base_opcode == 0xfbf))
+ continue;
+
+ if ((i.types[op] & WordReg) && i.op[op].regs->reg_num < 4
#if 0
- /* Check that the template allows eight bit regs
- This kills insns such as `orb $1,%edx', which
- maybe should be allowed. */
- && (i.tm.operand_types[op] & (Reg8|InOutPortReg))
+ /* Check that the template allows eight bit regs. This
+ kills insns such as `orb $1,%edx', which maybe should be
+ allowed. */
+ && (i.tm.operand_types[op] & (Reg8 | InOutPortReg))
#endif
- )
- {
- /* Prohibit these changes in the 64bit mode, since
- the lowering is more complicated. */
- if (flag_code == CODE_64BIT
- && (i.tm.operand_types[op] & InOutPortReg) == 0)
- as_bad (_("Incorrect register `%%%s' used with`%c' suffix"),
- i.op[op].regs->reg_name,
- i.suffix);
+ )
+ {
+ /* Prohibit these changes in the 64bit mode, since the
+ lowering is more complicated. */
+ if (flag_code == CODE_64BIT
+ && (i.tm.operand_types[op] & InOutPortReg) == 0)
+ {
+ as_bad (_("Incorrect register `%%%s' used with`%c' suffix"),
+ i.op[op].regs->reg_name,
+ i.suffix);
+ return 0;
+ }
#if REGISTER_WARNINGS
- if (!quiet_warnings
- && (i.tm.operand_types[op] & InOutPortReg) == 0)
- as_warn (_("using `%%%s' instead of `%%%s' due to `%c' suffix"),
- (i.op[op].regs
- + (i.types[op] & Reg16
- ? REGNAM_AL - REGNAM_AX
- : REGNAM_AL - REGNAM_EAX))->reg_name,
- i.op[op].regs->reg_name,
- i.suffix);
+ if (!quiet_warnings
+ && (i.tm.operand_types[op] & InOutPortReg) == 0)
+ as_warn (_("using `%%%s' instead of `%%%s' due to `%c' suffix"),
+ (i.op[op].regs + (i.types[op] & Reg16
+ ? REGNAM_AL - REGNAM_AX
+ : REGNAM_AL - REGNAM_EAX))->reg_name,
+ i.op[op].regs->reg_name,
+ i.suffix);
#endif
- continue;
- }
- /* Any other register is bad. */
- if (i.types[op] & (Reg | RegMMX | RegXMM
- | SReg2 | SReg3
- | Control | Debug | Test
- | FloatReg | FloatAcc))
- {
- as_bad (_("`%%%s' not allowed with `%s%c'"),
- i.op[op].regs->reg_name,
- i.tm.name,
- i.suffix);
- return;
- }
- }
- }
- else if (i.suffix == LONG_MNEM_SUFFIX)
- {
- int op;
+ continue;
+ }
+ /* Any other register is bad. */
+ if (i.types[op] & (Reg | RegMMX | RegXMM
+ | SReg2 | SReg3
+ | Control | Debug | Test
+ | FloatReg | FloatAcc))
+ {
+ as_bad (_("`%%%s' not allowed with `%s%c'"),
+ i.op[op].regs->reg_name,
+ i.tm.name,
+ i.suffix);
+ return 0;
+ }
+ }
+ return 1;
+}
- for (op = i.operands; --op >= 0;)
- /* Reject eight bit registers, except where the template
- requires them. (eg. movzb) */
- if ((i.types[op] & Reg8) != 0
- && (i.tm.operand_types[op] & (Reg16 | Reg32 | Acc)) != 0)
- {
- as_bad (_("`%%%s' not allowed with `%s%c'"),
- i.op[op].regs->reg_name,
- i.tm.name,
- i.suffix);
- return;
- }
- /* Warn if the e prefix on a general reg is missing. */
- else if ((!quiet_warnings || flag_code == CODE_64BIT)
- && (i.types[op] & Reg16) != 0
- && (i.tm.operand_types[op] & (Reg32|Acc)) != 0)
- {
- /* Prohibit these changes in the 64bit mode, since
- the lowering is more complicated. */
- if (flag_code == CODE_64BIT)
- as_bad (_("Incorrect register `%%%s' used with`%c' suffix"),
- i.op[op].regs->reg_name,
- i.suffix);
-#if REGISTER_WARNINGS
- else
- as_warn (_("using `%%%s' instead of `%%%s' due to `%c' suffix"),
- (i.op[op].regs + REGNAM_EAX - REGNAM_AX)->reg_name,
- i.op[op].regs->reg_name,
- i.suffix);
-#endif
- }
- /* Warn if the r prefix on a general reg is missing. */
- else if ((i.types[op] & Reg64) != 0
- && (i.tm.operand_types[op] & (Reg32|Acc)) != 0)
- {
- as_bad (_("Incorrect register `%%%s' used with`%c' suffix"),
- i.op[op].regs->reg_name,
- i.suffix);
- }
- }
- else if (i.suffix == QWORD_MNEM_SUFFIX)
- {
- int op;
+static int
+check_long_reg ()
+{
+ int op;
- for (op = i.operands; --op >= 0; )
- /* Reject eight bit registers, except where the template
- requires them. (eg. movzb) */
- if ((i.types[op] & Reg8) != 0
- && (i.tm.operand_types[op] & (Reg16|Reg32|Acc)) != 0)
- {
- as_bad (_("`%%%s' not allowed with `%s%c'"),
- i.op[op].regs->reg_name,
- i.tm.name,
- i.suffix);
- return;
- }
- /* Warn if the e prefix on a general reg is missing. */
- else if (((i.types[op] & Reg16) != 0
- || (i.types[op] & Reg32) != 0)
- && (i.tm.operand_types[op] & (Reg32|Acc)) != 0)
- {
- /* Prohibit these changes in the 64bit mode, since
- the lowering is more complicated. */
- as_bad (_("Incorrect register `%%%s' used with`%c' suffix"),
- i.op[op].regs->reg_name,
- i.suffix);
- }
- }
- else if (i.suffix == WORD_MNEM_SUFFIX)
- {
- int op;
- for (op = i.operands; --op >= 0;)
- /* Reject eight bit registers, except where the template
- requires them. (eg. movzb) */
- if ((i.types[op] & Reg8) != 0
- && (i.tm.operand_types[op] & (Reg16|Reg32|Acc)) != 0)
- {
- as_bad (_("`%%%s' not allowed with `%s%c'"),
- i.op[op].regs->reg_name,
- i.tm.name,
- i.suffix);
- return;
- }
- /* Warn if the e prefix on a general reg is present. */
- else if ((!quiet_warnings || flag_code == CODE_64BIT)
- && (i.types[op] & Reg32) != 0
- && (i.tm.operand_types[op] & (Reg16|Acc)) != 0)
- {
- /* Prohibit these changes in the 64bit mode, since
- the lowering is more complicated. */
- if (flag_code == CODE_64BIT)
- as_bad (_("Incorrect register `%%%s' used with`%c' suffix"),
- i.op[op].regs->reg_name,
- i.suffix);
- else
-#if REGISTER_WARNINGS
- as_warn (_("using `%%%s' instead of `%%%s' due to `%c' suffix"),
- (i.op[op].regs + REGNAM_AX - REGNAM_EAX)->reg_name,
- i.op[op].regs->reg_name,
- i.suffix);
-#endif
- }
- }
- else if (intel_syntax && (i.tm.opcode_modifier & IgnoreSize))
- /* Do nothing if the instruction is going to ignore the prefix. */
- ;
- else
- abort ();
- }
- else if ((i.tm.opcode_modifier & DefaultSize) && !i.suffix)
+ for (op = i.operands; --op >= 0;)
+ /* Reject eight bit registers, except where the template requires
+ them. (eg. movzb) */
+ if ((i.types[op] & Reg8) != 0
+ && (i.tm.operand_types[op] & (Reg16 | Reg32 | Acc)) != 0)
{
- i.suffix = stackop_size;
+ as_bad (_("`%%%s' not allowed with `%s%c'"),
+ i.op[op].regs->reg_name,
+ i.tm.name,
+ i.suffix);
+ return 0;
}
- /* Make still unresolved immediate matches conform to size of immediate
- given in i.suffix. Note: overlap2 cannot be an immediate! */
- if ((overlap0 & (Imm8 | Imm8S | Imm16 | Imm32 | Imm32S))
- && overlap0 != Imm8 && overlap0 != Imm8S
- && overlap0 != Imm16 && overlap0 != Imm32S
- && overlap0 != Imm32 && overlap0 != Imm64)
+ /* Warn if the e prefix on a general reg is missing. */
+ else if ((!quiet_warnings || flag_code == CODE_64BIT)
+ && (i.types[op] & Reg16) != 0
+ && (i.tm.operand_types[op] & (Reg32 | Acc)) != 0)
{
- if (i.suffix)
- {
- overlap0 &= (i.suffix == BYTE_MNEM_SUFFIX ? (Imm8 | Imm8S) :
- (i.suffix == WORD_MNEM_SUFFIX ? Imm16 :
- (i.suffix == QWORD_MNEM_SUFFIX ? Imm64 | Imm32S : Imm32)));
- }
- else if (overlap0 == (Imm16 | Imm32S | Imm32)
- || overlap0 == (Imm16 | Imm32)
- || overlap0 == (Imm16 | Imm32S))
- {
- overlap0 =
- ((flag_code == CODE_16BIT) ^ (i.prefix[DATA_PREFIX] != 0)) ? Imm16 : Imm32S;
- }
- if (overlap0 != Imm8 && overlap0 != Imm8S
- && overlap0 != Imm16 && overlap0 != Imm32S
- && overlap0 != Imm32 && overlap0 != Imm64)
+ /* Prohibit these changes in the 64bit mode, since the
+ lowering is more complicated. */
+ if (flag_code == CODE_64BIT)
{
- as_bad (_("no instruction mnemonic suffix given; can't determine immediate size"));
- return;
+ as_bad (_("Incorrect register `%%%s' used with`%c' suffix"),
+ i.op[op].regs->reg_name,
+ i.suffix);
+ return 0;
}
+#if REGISTER_WARNINGS
+ else
+ as_warn (_("using `%%%s' instead of `%%%s' due to `%c' suffix"),
+ (i.op[op].regs + REGNAM_EAX - REGNAM_AX)->reg_name,
+ i.op[op].regs->reg_name,
+ i.suffix);
+#endif
}
- if ((overlap1 & (Imm8 | Imm8S | Imm16 | Imm32S | Imm32))
- && overlap1 != Imm8 && overlap1 != Imm8S
- && overlap1 != Imm16 && overlap1 != Imm32S
- && overlap1 != Imm32 && overlap1 != Imm64)
+ /* Warn if the r prefix on a general reg is missing. */
+ else if ((i.types[op] & Reg64) != 0
+ && (i.tm.operand_types[op] & (Reg32 | Acc)) != 0)
{
- if (i.suffix)
- {
- overlap1 &= (i.suffix == BYTE_MNEM_SUFFIX ? (Imm8 | Imm8S) :
- (i.suffix == WORD_MNEM_SUFFIX ? Imm16 :
- (i.suffix == QWORD_MNEM_SUFFIX ? Imm64 | Imm32S : Imm32)));
- }
- else if (overlap1 == (Imm16 | Imm32 | Imm32S)
- || overlap1 == (Imm16 | Imm32)
- || overlap1 == (Imm16 | Imm32S))
- {
- overlap1 =
- ((flag_code == CODE_16BIT) ^ (i.prefix[DATA_PREFIX] != 0)) ? Imm16 : Imm32S;
- }
- if (overlap1 != Imm8 && overlap1 != Imm8S
- && overlap1 != Imm16 && overlap1 != Imm32S
- && overlap1 != Imm32 && overlap1 != Imm64)
- {
- as_bad (_("no instruction mnemonic suffix given; can't determine immediate size %x %c"),overlap1, i.suffix);
- return;
- }
+ as_bad (_("Incorrect register `%%%s' used with`%c' suffix"),
+ i.op[op].regs->reg_name,
+ i.suffix);
+ return 0;
}
- assert ((overlap2 & Imm) == 0);
-
- i.types[0] = overlap0;
- if (overlap0 & ImplicitRegister)
- i.reg_operands--;
- if (overlap0 & Imm1)
- i.imm_operands = 0; /* kludge for shift insns. */
-
- i.types[1] = overlap1;
- if (overlap1 & ImplicitRegister)
- i.reg_operands--;
+ return 1;
+}
- i.types[2] = overlap2;
- if (overlap2 & ImplicitRegister)
- i.reg_operands--;
+static int
+check_qword_reg ()
+{
+ int op;
- /* Finalize opcode. First, we change the opcode based on the operand
- size given by i.suffix: We need not change things for byte insns. */
+ for (op = i.operands; --op >= 0; )
+ /* Reject eight bit registers, except where the template requires
+ them. (eg. movzb) */
+ if ((i.types[op] & Reg8) != 0
+ && (i.tm.operand_types[op] & (Reg16 | Reg32 | Acc)) != 0)
+ {
+ as_bad (_("`%%%s' not allowed with `%s%c'"),
+ i.op[op].regs->reg_name,
+ i.tm.name,
+ i.suffix);
+ return 0;
+ }
+ /* Warn if the e prefix on a general reg is missing. */
+ else if (((i.types[op] & Reg16) != 0
+ || (i.types[op] & Reg32) != 0)
+ && (i.tm.operand_types[op] & (Reg32 | Acc)) != 0)
+ {
+ /* Prohibit these changes in the 64bit mode, since the
+ lowering is more complicated. */
+ as_bad (_("Incorrect register `%%%s' used with`%c' suffix"),
+ i.op[op].regs->reg_name,
+ i.suffix);
+ return 0;
+ }
+ return 1;
+}
- if (!i.suffix && (i.tm.opcode_modifier & W))
+static int
+check_word_reg ()
+{
+ int op;
+ for (op = i.operands; --op >= 0;)
+ /* Reject eight bit registers, except where the template requires
+ them. (eg. movzb) */
+ if ((i.types[op] & Reg8) != 0
+ && (i.tm.operand_types[op] & (Reg16 | Reg32 | Acc)) != 0)
{
- as_bad (_("no instruction mnemonic suffix given and no register operands; can't size instruction"));
- return;
+ as_bad (_("`%%%s' not allowed with `%s%c'"),
+ i.op[op].regs->reg_name,
+ i.tm.name,
+ i.suffix);
+ return 0;
}
+ /* Warn if the e prefix on a general reg is present. */
+ else if ((!quiet_warnings || flag_code == CODE_64BIT)
+ && (i.types[op] & Reg32) != 0
+ && (i.tm.operand_types[op] & (Reg16 | Acc)) != 0)
+ {
+ /* Prohibit these changes in the 64bit mode, since the
+ lowering is more complicated. */
+ if (flag_code == CODE_64BIT)
+ {
+ as_bad (_("Incorrect register `%%%s' used with`%c' suffix"),
+ i.op[op].regs->reg_name,
+ i.suffix);
+ return 0;
+ }
+ else
+#if REGISTER_WARNINGS
+ as_warn (_("using `%%%s' instead of `%%%s' due to `%c' suffix"),
+ (i.op[op].regs + REGNAM_AX - REGNAM_EAX)->reg_name,
+ i.op[op].regs->reg_name,
+ i.suffix);
+#endif
+ }
+ return 1;
+}
- /* For movzx and movsx, need to check the register type. */
- if (intel_syntax
- && (i.tm.base_opcode == 0xfb6 || i.tm.base_opcode == 0xfbe))
- if (i.suffix && i.suffix == BYTE_MNEM_SUFFIX)
- {
- unsigned int prefix = DATA_PREFIX_OPCODE;
+static int
+finalize_imm ()
+{
+ unsigned int overlap0, overlap1, overlap2;
- if ((i.op[1].regs->reg_type & Reg16) != 0)
- if (!add_prefix (prefix))
- return;
+ overlap0 = i.types[0] & i.tm.operand_types[0];
+ if ((overlap0 & (Imm8 | Imm8S | Imm16 | Imm32 | Imm32S))
+ && overlap0 != Imm8 && overlap0 != Imm8S
+ && overlap0 != Imm16 && overlap0 != Imm32S
+ && overlap0 != Imm32 && overlap0 != Imm64)
+ {
+ if (i.suffix)
+ {
+ overlap0 &= (i.suffix == BYTE_MNEM_SUFFIX
+ ? Imm8 | Imm8S
+ : (i.suffix == WORD_MNEM_SUFFIX
+ ? Imm16
+ : (i.suffix == QWORD_MNEM_SUFFIX
+ ? Imm64 | Imm32S
+ : Imm32)));
+ }
+ else if (overlap0 == (Imm16 | Imm32S | Imm32)
+ || overlap0 == (Imm16 | Imm32)
+ || overlap0 == (Imm16 | Imm32S))
+ {
+ overlap0 = ((flag_code == CODE_16BIT) ^ (i.prefix[DATA_PREFIX] != 0)
+ ? Imm16 : Imm32S);
}
+ if (overlap0 != Imm8 && overlap0 != Imm8S
+ && overlap0 != Imm16 && overlap0 != Imm32S
+ && overlap0 != Imm32 && overlap0 != Imm64)
+ {
+ as_bad (_("no instruction mnemonic suffix given; can't determine immediate size"));
+ return 0;
+ }
+ }
+ i.types[0] = overlap0;
- if (i.suffix && i.suffix != BYTE_MNEM_SUFFIX)
- {
- /* It's not a byte, select word/dword operation. */
- if (i.tm.opcode_modifier & W)
- {
- if (i.tm.opcode_modifier & ShortForm)
- i.tm.base_opcode |= 8;
- else
- i.tm.base_opcode |= 1;
- }
- /* Now select between word & dword operations via the operand
- size prefix, except for instructions that will ignore this
- prefix anyway. */
- if (i.suffix != QWORD_MNEM_SUFFIX
- && (i.suffix == LONG_MNEM_SUFFIX) == (flag_code == CODE_16BIT)
- && !(i.tm.opcode_modifier & IgnoreSize))
- {
- unsigned int prefix = DATA_PREFIX_OPCODE;
- if (i.tm.opcode_modifier & JumpByte) /* jcxz, loop */
- prefix = ADDR_PREFIX_OPCODE;
+ overlap1 = i.types[1] & i.tm.operand_types[1];
+ if ((overlap1 & (Imm8 | Imm8S | Imm16 | Imm32S | Imm32))
+ && overlap1 != Imm8 && overlap1 != Imm8S
+ && overlap1 != Imm16 && overlap1 != Imm32S
+ && overlap1 != Imm32 && overlap1 != Imm64)
+ {
+ if (i.suffix)
+ {
+ overlap1 &= (i.suffix == BYTE_MNEM_SUFFIX
+ ? Imm8 | Imm8S
+ : (i.suffix == WORD_MNEM_SUFFIX
+ ? Imm16
+ : (i.suffix == QWORD_MNEM_SUFFIX
+ ? Imm64 | Imm32S
+ : Imm32)));
+ }
+ else if (overlap1 == (Imm16 | Imm32 | Imm32S)
+ || overlap1 == (Imm16 | Imm32)
+ || overlap1 == (Imm16 | Imm32S))
+ {
+ overlap1 = ((flag_code == CODE_16BIT) ^ (i.prefix[DATA_PREFIX] != 0)
+ ? Imm16 : Imm32S);
+ }
+ if (overlap1 != Imm8 && overlap1 != Imm8S
+ && overlap1 != Imm16 && overlap1 != Imm32S
+ && overlap1 != Imm32 && overlap1 != Imm64)
+ {
+ as_bad (_("no instruction mnemonic suffix given; can't determine immediate size %x %c"),overlap1, i.suffix);
+ return 0;
+ }
+ }
+ i.types[1] = overlap1;
- if (! add_prefix (prefix))
- return;
- }
+ overlap2 = i.types[2] & i.tm.operand_types[2];
+ assert ((overlap2 & Imm) == 0);
+ i.types[2] = overlap2;
- 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;
- }
+ return 1;
+}
- /* Set mode64 for an operand. */
- if (i.suffix == QWORD_MNEM_SUFFIX
- && !(i.tm.opcode_modifier & NoRex64))
- {
- i.rex.mode64 = 1;
- if (flag_code < CODE_64BIT)
- {
- as_bad (_("64bit operations available only in 64bit modes."));
- return;
- }
- }
+static int
+process_operands ()
+{
+ /* Default segment register this instruction will use for memory
+ accesses. 0 means unknown. This is only for optimizing out
+ unnecessary segment overrides. */
+ const seg_entry *default_seg = 0;
+
+ /* The imul $imm, %reg instruction is converted into
+ imul $imm, %reg, %reg, and the clr %reg instruction
+ is converted into xor %reg, %reg. */
+ if (i.tm.opcode_modifier & regKludge)
+ {
+ unsigned int first_reg_op = (i.types[0] & Reg) ? 0 : 1;
+ /* Pretend we saw the extra register operand. */
+ assert (i.op[first_reg_op + 1].regs == 0);
+ i.op[first_reg_op + 1].regs = i.op[first_reg_op].regs;
+ i.types[first_reg_op + 1] = i.types[first_reg_op];
+ i.reg_operands = 2;
+ }
- /* Size floating point instruction. */
- if (i.suffix == LONG_MNEM_SUFFIX)
- {
- if (i.tm.opcode_modifier & FloatMF)
- i.tm.base_opcode ^= 4;
- }
- }
+ if (i.tm.opcode_modifier & ShortForm)
+ {
+ /* The register or float register operand is in operand 0 or 1. */
+ unsigned int op = (i.types[0] & (Reg | FloatReg)) ? 0 : 1;
+ /* Register goes in low 3 bits of opcode. */
+ i.tm.base_opcode |= i.op[op].regs->reg_num;
+ if ((i.op[op].regs->reg_flags & RegRex) != 0)
+ i.rex |= REX_EXTZ;
+ if (!quiet_warnings && (i.tm.opcode_modifier & Ugh) != 0)
+ {
+ /* Warn about some common errors, but press on regardless.
+ The first case can be generated by gcc (<= 2.8.1). */
+ if (i.operands == 2)
+ {
+ /* Reversed arguments on faddp, fsubp, etc. */
+ as_warn (_("translating to `%s %%%s,%%%s'"), i.tm.name,
+ i.op[1].regs->reg_name,
+ i.op[0].regs->reg_name);
+ }
+ else
+ {
+ /* Extraneous `l' suffix on fp insn. */
+ as_warn (_("translating to `%s %%%s'"), i.tm.name,
+ i.op[0].regs->reg_name);
+ }
+ }
+ }
+ else if (i.tm.opcode_modifier & Modrm)
+ {
+ /* The opcode is completed (modulo i.tm.extension_opcode which
+ must be put into the modrm byte).
+ Now, we make the modrm & index base bytes based on all the
+ info we've collected. */
- if (i.tm.opcode_modifier & ImmExt)
- {
- /* These AMD 3DNow! and Intel Katmai New Instructions have an
- opcode suffix which is coded in the same place as an 8-bit
- immediate field would be. Here we fake an 8-bit immediate
- operand from the opcode suffix stored in tm.extension_opcode. */
+ default_seg = build_modrm_byte ();
+ }
+ else if (i.tm.opcode_modifier & (Seg2ShortForm | Seg3ShortForm))
+ {
+ if (i.tm.base_opcode == POP_SEG_SHORT
+ && i.op[0].regs->reg_num == 1)
+ {
+ as_bad (_("you can't `pop %%cs'"));
+ return 0;
+ }
+ i.tm.base_opcode |= (i.op[0].regs->reg_num << 3);
+ if ((i.op[0].regs->reg_flags & RegRex) != 0)
+ i.rex |= REX_EXTZ;
+ }
+ else if ((i.tm.base_opcode & ~(D | W)) == MOV_AX_DISP32)
+ {
+ default_seg = &ds;
+ }
+ else if ((i.tm.opcode_modifier & IsString) != 0)
+ {
+ /* For the string instructions that allow a segment override
+ on one of their operands, the default segment is ds. */
+ default_seg = &ds;
+ }
- expressionS *exp;
+ /* If a segment was explicitly specified,
+ and the specified segment is not the default,
+ use an opcode prefix to select it.
+ If we never figured out what the default segment is,
+ then default_seg will be zero at this point,
+ and the specified segment prefix will always be used. */
+ if ((i.seg[0]) && (i.seg[0] != default_seg))
+ {
+ if (!add_prefix (i.seg[0]->seg_prefix))
+ return 0;
+ }
+ return 1;
+}
- assert (i.imm_operands == 0 && i.operands <= 2 && 2 < MAX_OPERANDS);
+static const seg_entry *
+build_modrm_byte ()
+{
+ const seg_entry *default_seg = 0;
- exp = &im_expressions[i.imm_operands++];
- i.op[i.operands].imms = exp;
- i.types[i.operands++] = Imm8;
- exp->X_op = O_constant;
- exp->X_add_number = i.tm.extension_opcode;
- i.tm.extension_opcode = None;
- }
+ /* i.reg_operands MUST be the number of real register operands;
+ implicit registers do not count. */
+ if (i.reg_operands == 2)
+ {
+ unsigned int source, dest;
+ source = ((i.types[0]
+ & (Reg | RegMMX | RegXMM
+ | SReg2 | SReg3
+ | Control | Debug | Test))
+ ? 0 : 1);
+ dest = source + 1;
+
+ i.rm.mode = 3;
+ /* One of the register operands will be encoded in the i.tm.reg
+ field, the other in the combined i.tm.mode and i.tm.regmem
+ fields. If no form of this instruction supports a memory
+ destination operand, then we assume the source operand may
+ sometimes be a memory operand and so we need to store the
+ destination in the i.rm.reg field. */
+ if ((i.tm.operand_types[dest] & AnyMem) == 0)
+ {
+ i.rm.reg = i.op[dest].regs->reg_num;
+ i.rm.regmem = i.op[source].regs->reg_num;
+ if ((i.op[dest].regs->reg_flags & RegRex) != 0)
+ i.rex |= REX_EXTX;
+ if ((i.op[source].regs->reg_flags & RegRex) != 0)
+ i.rex |= REX_EXTZ;
+ }
+ else
+ {
+ i.rm.reg = i.op[source].regs->reg_num;
+ i.rm.regmem = i.op[dest].regs->reg_num;
+ if ((i.op[dest].regs->reg_flags & RegRex) != 0)
+ i.rex |= REX_EXTZ;
+ if ((i.op[source].regs->reg_flags & RegRex) != 0)
+ i.rex |= REX_EXTX;
+ }
+ }
+ else
+ { /* If it's not 2 reg operands... */
+ if (i.mem_operands)
+ {
+ unsigned int fake_zero_displacement = 0;
+ unsigned int op = ((i.types[0] & AnyMem)
+ ? 0
+ : (i.types[1] & AnyMem) ? 1 : 2);
- /* For insns with operands there are more diddles to do to the opcode. */
- if (i.operands)
- {
- /* Default segment register this instruction will use
- for memory accesses. 0 means unknown.
- This is only for optimizing out unnecessary segment overrides. */
- const seg_entry *default_seg = 0;
-
- /* The imul $imm, %reg instruction is converted into
- imul $imm, %reg, %reg, and the clr %reg instruction
- is converted into xor %reg, %reg. */
- if (i.tm.opcode_modifier & regKludge)
- {
- unsigned int first_reg_op = (i.types[0] & Reg) ? 0 : 1;
- /* Pretend we saw the extra register operand. */
- assert (i.op[first_reg_op + 1].regs == 0);
- i.op[first_reg_op + 1].regs = i.op[first_reg_op].regs;
- i.types[first_reg_op + 1] = i.types[first_reg_op];
- i.reg_operands = 2;
- }
+ default_seg = &ds;
- if (i.tm.opcode_modifier & ShortForm)
- {
- /* The register or float register operand is in operand 0 or 1. */
- unsigned int op = (i.types[0] & (Reg | FloatReg)) ? 0 : 1;
- /* Register goes in low 3 bits of opcode. */
- i.tm.base_opcode |= i.op[op].regs->reg_num;
- if (i.op[op].regs->reg_flags & RegRex)
- i.rex.extZ = 1;
- if (!quiet_warnings && (i.tm.opcode_modifier & Ugh) != 0)
- {
- /* Warn about some common errors, but press on regardless.
- The first case can be generated by gcc (<= 2.8.1). */
- if (i.operands == 2)
- {
- /* Reversed arguments on faddp, fsubp, etc. */
- as_warn (_("translating to `%s %%%s,%%%s'"), i.tm.name,
- i.op[1].regs->reg_name,
- i.op[0].regs->reg_name);
- }
- else
- {
- /* Extraneous `l' suffix on fp insn. */
- as_warn (_("translating to `%s %%%s'"), i.tm.name,
- i.op[0].regs->reg_name);
- }
- }
- }
- else if (i.tm.opcode_modifier & Modrm)
- {
- /* The opcode is completed (modulo i.tm.extension_opcode which
- must be put into the modrm byte).
- Now, we make the modrm & index base bytes based on all the
- info we've collected. */
-
- /* i.reg_operands MUST be the number of real register operands;
- implicit registers do not count. */
- if (i.reg_operands == 2)
- {
- unsigned int source, dest;
- source = ((i.types[0]
- & (Reg | RegMMX | RegXMM
- | SReg2 | SReg3
- | Control | Debug | Test))
- ? 0 : 1);
- dest = source + 1;
-
- i.rm.mode = 3;
- /* One of the register operands will be encoded in the
- i.tm.reg field, the other in the combined i.tm.mode
- and i.tm.regmem fields. If no form of this
- instruction supports a memory destination operand,
- then we assume the source operand may sometimes be
- a memory operand and so we need to store the
- destination in the i.rm.reg field. */
- if ((i.tm.operand_types[dest] & AnyMem) == 0)
- {
- i.rm.reg = i.op[dest].regs->reg_num;
- i.rm.regmem = i.op[source].regs->reg_num;
- if (i.op[dest].regs->reg_flags & RegRex)
- i.rex.extX = 1;
- if (i.op[source].regs->reg_flags & RegRex)
- i.rex.extZ = 1;
- }
- else
- {
- i.rm.reg = i.op[source].regs->reg_num;
- i.rm.regmem = i.op[dest].regs->reg_num;
- if (i.op[dest].regs->reg_flags & RegRex)
- i.rex.extZ = 1;
- if (i.op[source].regs->reg_flags & RegRex)
- i.rex.extX = 1;
- }
- }
- else
- { /* If it's not 2 reg operands... */
- if (i.mem_operands)
- {
- unsigned int fake_zero_displacement = 0;
- unsigned int op = ((i.types[0] & AnyMem)
- ? 0
- : (i.types[1] & AnyMem) ? 1 : 2);
-
- default_seg = &ds;
-
- if (! i.base_reg)
- {
- i.rm.mode = 0;
- if (! i.disp_operands)
+ if (i.base_reg == 0)
+ {
+ i.rm.mode = 0;
+ if (!i.disp_operands)
+ fake_zero_displacement = 1;
+ if (i.index_reg == 0)
+ {
+ /* Operand is just <disp> */
+ 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
+ || (i.prefix[ADDR_PREFIX] != 0))
+ {
+ i.rm.regmem = NO_BASE_REGISTER;
+ i.types[op] &= ~Disp;
+ i.types[op] |= Disp32;
+ }
+ else
+ {
+ /* 64bit mode overwrites the 32bit absolute
+ addressing by RIP relative addressing and
+ absolute addressing is encoded by one of the
+ redundant SIB forms. */
+ i.rm.regmem = ESCAPE_TO_TWO_BYTE_ADDRESSING;
+ i.sib.base = NO_BASE_REGISTER;
+ i.sib.index = NO_INDEX_REGISTER;
+ i.types[op] &= ~Disp;
+ i.types[op] |= Disp32S;
+ }
+ }
+ else /* !i.base_reg && i.index_reg */
+ {
+ i.sib.index = i.index_reg->reg_num;
+ i.sib.base = NO_BASE_REGISTER;
+ i.sib.scale = i.log2_scale_factor;
+ i.rm.regmem = ESCAPE_TO_TWO_BYTE_ADDRESSING;
+ i.types[op] &= ~Disp;
+ if (flag_code != CODE_64BIT)
+ i.types[op] |= Disp32; /* Must be 32 bit */
+ else
+ i.types[op] |= Disp32S;
+ if ((i.index_reg->reg_flags & RegRex) != 0)
+ i.rex |= REX_EXTY;
+ }
+ }
+ /* RIP addressing for 64bit mode. */
+ else if (i.base_reg->reg_type == BaseIndex)
+ {
+ i.rm.regmem = NO_BASE_REGISTER;
+ i.types[op] &= ~Disp;
+ i.types[op] |= Disp32S;
+ i.flags[op] = Operand_PCrel;
+ }
+ else if (i.base_reg->reg_type & Reg16)
+ {
+ switch (i.base_reg->reg_num)
+ {
+ case 3: /* (%bx) */
+ if (i.index_reg == 0)
+ i.rm.regmem = 7;
+ else /* (%bx,%si) -> 0, or (%bx,%di) -> 1 */
+ i.rm.regmem = i.index_reg->reg_num - 6;
+ break;
+ case 5: /* (%bp) */
+ default_seg = &ss;
+ if (i.index_reg == 0)
+ {
+ i.rm.regmem = 6;
+ if ((i.types[op] & Disp) == 0)
+ {
+ /* fake (%bp) into 0(%bp) */
+ i.types[op] |= Disp8;
fake_zero_displacement = 1;
- if (! i.index_reg)
- {
- /* Operand is just <disp> */
- 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
- || (i.prefix[ADDR_PREFIX] != 0))
- {
- i.rm.regmem = NO_BASE_REGISTER;
- i.types[op] &= ~Disp;
- i.types[op] |= Disp32;
- }
- else
- {
- /* 64bit mode overwrites the 32bit
- absolute addressing by RIP relative
- addressing and absolute addressing
- is encoded by one of the redundant
- SIB forms. */
-
- i.rm.regmem = ESCAPE_TO_TWO_BYTE_ADDRESSING;
- i.sib.base = NO_BASE_REGISTER;
- i.sib.index = NO_INDEX_REGISTER;
- i.types[op] &= ~Disp;
- i.types[op] |= Disp32S;
- }
- }
- else /* ! i.base_reg && i.index_reg */
- {
- i.sib.index = i.index_reg->reg_num;
- i.sib.base = NO_BASE_REGISTER;
- i.sib.scale = i.log2_scale_factor;
- i.rm.regmem = ESCAPE_TO_TWO_BYTE_ADDRESSING;
- i.types[op] &= ~Disp;
- if (flag_code != CODE_64BIT)
- i.types[op] |= Disp32; /* Must be 32 bit */
- else
- i.types[op] |= Disp32S;
- if (i.index_reg->reg_flags & RegRex)
- i.rex.extY = 1;
- }
- }
- /* RIP addressing for 64bit mode. */
- else if (i.base_reg->reg_type == BaseIndex)
- {
- i.rm.regmem = NO_BASE_REGISTER;
- i.types[op] &= ~Disp;
- i.types[op] |= Disp32S;
- i.flags[op] = Operand_PCrel;
- }
- else if (i.base_reg->reg_type & Reg16)
- {
- switch (i.base_reg->reg_num)
- {
- case 3: /* (%bx) */
- if (! i.index_reg)
- i.rm.regmem = 7;
- else /* (%bx,%si) -> 0, or (%bx,%di) -> 1 */
- i.rm.regmem = i.index_reg->reg_num - 6;
- break;
- case 5: /* (%bp) */
- default_seg = &ss;
- if (! i.index_reg)
- {
- i.rm.regmem = 6;
- if ((i.types[op] & Disp) == 0)
- {
- /* fake (%bp) into 0(%bp) */
- i.types[op] |= Disp8;
- fake_zero_displacement = 1;
- }
- }
- else /* (%bp,%si) -> 2, or (%bp,%di) -> 3 */
- i.rm.regmem = i.index_reg->reg_num - 6 + 2;
- break;
- default: /* (%si) -> 4 or (%di) -> 5 */
- i.rm.regmem = i.base_reg->reg_num - 6 + 4;
- }
- i.rm.mode = mode_from_disp_size (i.types[op]);
- }
- else /* i.base_reg and 32/64 bit mode */
- {
- if (flag_code == CODE_64BIT
- && (i.types[op] & Disp))
- {
- if (i.types[op] & Disp8)
- i.types[op] = Disp8 | Disp32S;
- else
- i.types[op] = Disp32S;
- }
- i.rm.regmem = i.base_reg->reg_num;
- if (i.base_reg->reg_flags & RegRex)
- i.rex.extZ = 1;
- i.sib.base = i.base_reg->reg_num;
- /* x86-64 ignores REX prefix bit here to avoid
- decoder complications. */
- if ((i.base_reg->reg_num & 7) == EBP_REG_NUM)
- {
- default_seg = &ss;
- if (i.disp_operands == 0)
- {
- fake_zero_displacement = 1;
- i.types[op] |= Disp8;
- }
- }
- else if (i.base_reg->reg_num == ESP_REG_NUM)
- {
- default_seg = &ss;
- }
- i.sib.scale = i.log2_scale_factor;
- if (! i.index_reg)
- {
- /* <disp>(%esp) becomes two byte modrm
- with no index register. We've already
- stored the code for esp in i.rm.regmem
- ie. ESCAPE_TO_TWO_BYTE_ADDRESSING. Any
- base register besides %esp will not use
- the extra modrm byte. */
- i.sib.index = NO_INDEX_REGISTER;
-#if ! SCALE1_WHEN_NO_INDEX
- /* Another case where we force the second
- modrm byte. */
- if (i.log2_scale_factor)
- i.rm.regmem = ESCAPE_TO_TWO_BYTE_ADDRESSING;
+ }
+ }
+ else /* (%bp,%si) -> 2, or (%bp,%di) -> 3 */
+ i.rm.regmem = i.index_reg->reg_num - 6 + 2;
+ break;
+ default: /* (%si) -> 4 or (%di) -> 5 */
+ i.rm.regmem = i.base_reg->reg_num - 6 + 4;
+ }
+ i.rm.mode = mode_from_disp_size (i.types[op]);
+ }
+ else /* i.base_reg and 32/64 bit mode */
+ {
+ if (flag_code == CODE_64BIT
+ && (i.types[op] & Disp))
+ {
+ if (i.types[op] & Disp8)
+ i.types[op] = Disp8 | Disp32S;
+ else
+ i.types[op] = Disp32S;
+ }
+ i.rm.regmem = i.base_reg->reg_num;
+ if ((i.base_reg->reg_flags & RegRex) != 0)
+ i.rex |= REX_EXTZ;
+ i.sib.base = i.base_reg->reg_num;
+ /* x86-64 ignores REX prefix bit here to avoid decoder
+ complications. */
+ if ((i.base_reg->reg_num & 7) == EBP_REG_NUM)
+ {
+ default_seg = &ss;
+ if (i.disp_operands == 0)
+ {
+ fake_zero_displacement = 1;
+ i.types[op] |= Disp8;
+ }
+ }
+ else if (i.base_reg->reg_num == ESP_REG_NUM)
+ {
+ default_seg = &ss;
+ }
+ i.sib.scale = i.log2_scale_factor;
+ if (i.index_reg == 0)
+ {
+ /* <disp>(%esp) becomes two byte modrm with no index
+ register. We've already stored the code for esp
+ in i.rm.regmem ie. ESCAPE_TO_TWO_BYTE_ADDRESSING.
+ Any base register besides %esp will not use the
+ extra modrm byte. */
+ i.sib.index = NO_INDEX_REGISTER;
+#if !SCALE1_WHEN_NO_INDEX
+ /* Another case where we force the second modrm byte. */
+ if (i.log2_scale_factor)
+ i.rm.regmem = ESCAPE_TO_TWO_BYTE_ADDRESSING;
#endif
- }
- else
- {
- i.sib.index = i.index_reg->reg_num;
- i.rm.regmem = ESCAPE_TO_TWO_BYTE_ADDRESSING;
- if (i.index_reg->reg_flags & RegRex)
- i.rex.extY = 1;
- }
- i.rm.mode = mode_from_disp_size (i.types[op]);
- }
+ }
+ else
+ {
+ i.sib.index = i.index_reg->reg_num;
+ i.rm.regmem = ESCAPE_TO_TWO_BYTE_ADDRESSING;
+ if ((i.index_reg->reg_flags & RegRex) != 0)
+ i.rex |= REX_EXTY;
+ }
+ i.rm.mode = mode_from_disp_size (i.types[op]);
+ }
- if (fake_zero_displacement)
- {
- /* Fakes a zero displacement assuming that i.types[op]
- holds the correct displacement size. */
- expressionS *exp;
-
- assert (i.op[op].disps == 0);
- exp = &disp_expressions[i.disp_operands++];
- i.op[op].disps = exp;
- exp->X_op = O_constant;
- exp->X_add_number = 0;
- exp->X_add_symbol = (symbolS *) 0;
- exp->X_op_symbol = (symbolS *) 0;
- }
- }
-
- /* Fill in i.rm.reg or i.rm.regmem field with register
- operand (if any) based on i.tm.extension_opcode.
- Again, we must be careful to make sure that
- segment/control/debug/test/MMX registers are coded
- into the i.rm.reg field. */
- if (i.reg_operands)
- {
- unsigned int op =
- ((i.types[0]
- & (Reg | RegMMX | RegXMM
- | SReg2 | SReg3
- | Control | Debug | Test))
- ? 0
- : ((i.types[1]
- & (Reg | RegMMX | RegXMM
- | SReg2 | SReg3
- | Control | Debug | Test))
- ? 1
- : 2));
- /* If there is an extension opcode to put here, the
- register number must be put into the regmem field. */
- if (i.tm.extension_opcode != None)
- {
- i.rm.regmem = i.op[op].regs->reg_num;
- if (i.op[op].regs->reg_flags & RegRex)
- i.rex.extZ = 1;
- }
- else
- {
- i.rm.reg = i.op[op].regs->reg_num;
- if (i.op[op].regs->reg_flags & RegRex)
- i.rex.extX = 1;
- }
+ if (fake_zero_displacement)
+ {
+ /* Fakes a zero displacement assuming that i.types[op]
+ holds the correct displacement size. */
+ expressionS *exp;
+
+ assert (i.op[op].disps == 0);
+ exp = &disp_expressions[i.disp_operands++];
+ i.op[op].disps = exp;
+ exp->X_op = O_constant;
+ exp->X_add_number = 0;
+ exp->X_add_symbol = (symbolS *) 0;
+ exp->X_op_symbol = (symbolS *) 0;
+ }
+ }
- /* Now, if no memory operand has set i.rm.mode = 0, 1, 2
- we must set it to 3 to indicate this is a register
- operand in the regmem field. */
- if (!i.mem_operands)
- i.rm.mode = 3;
- }
+ /* Fill in i.rm.reg or i.rm.regmem field with register operand
+ (if any) based on i.tm.extension_opcode. Again, we must be
+ careful to make sure that segment/control/debug/test/MMX
+ registers are coded into the i.rm.reg field. */
+ if (i.reg_operands)
+ {
+ unsigned int op =
+ ((i.types[0]
+ & (Reg | RegMMX | RegXMM
+ | SReg2 | SReg3
+ | Control | Debug | Test))
+ ? 0
+ : ((i.types[1]
+ & (Reg | RegMMX | RegXMM
+ | SReg2 | SReg3
+ | Control | Debug | Test))
+ ? 1
+ : 2));
+ /* If there is an extension opcode to put here, the register
+ number must be put into the regmem field. */
+ if (i.tm.extension_opcode != None)
+ {
+ i.rm.regmem = i.op[op].regs->reg_num;
+ if ((i.op[op].regs->reg_flags & RegRex) != 0)
+ i.rex |= REX_EXTZ;
+ }
+ else
+ {
+ i.rm.reg = i.op[op].regs->reg_num;
+ if ((i.op[op].regs->reg_flags & RegRex) != 0)
+ i.rex |= REX_EXTX;
+ }
- /* Fill in i.rm.reg field with extension opcode (if any). */
- if (i.tm.extension_opcode != None)
- i.rm.reg = i.tm.extension_opcode;
- }
- }
- else if (i.tm.opcode_modifier & (Seg2ShortForm | Seg3ShortForm))
- {
- if (i.tm.base_opcode == POP_SEG_SHORT
- && i.op[0].regs->reg_num == 1)
- {
- as_bad (_("you can't `pop %%cs'"));
- return;
- }
- i.tm.base_opcode |= (i.op[0].regs->reg_num << 3);
- if (i.op[0].regs->reg_flags & RegRex)
- i.rex.extZ = 1;
- }
- else if ((i.tm.base_opcode & ~(D|W)) == MOV_AX_DISP32)
- {
- default_seg = &ds;
- }
- else if ((i.tm.opcode_modifier & IsString) != 0)
- {
- /* For the string instructions that allow a segment override
- on one of their operands, the default segment is ds. */
- default_seg = &ds;
- }
+ /* Now, if no memory operand has set i.rm.mode = 0, 1, 2 we
+ must set it to 3 to indicate this is a register operand
+ in the regmem field. */
+ if (!i.mem_operands)
+ i.rm.mode = 3;
+ }
- /* If a segment was explicitly specified,
- and the specified segment is not the default,
- use an opcode prefix to select it.
- If we never figured out what the default segment is,
- then default_seg will be zero at this point,
- and the specified segment prefix will always be used. */
- if ((i.seg[0]) && (i.seg[0] != default_seg))
- {
- if (! add_prefix (i.seg[0]->seg_prefix))
- return;
- }
- }
- else if (!quiet_warnings && (i.tm.opcode_modifier & Ugh) != 0)
- {
- /* UnixWare fsub no args is alias for fsubp, fadd -> faddp, etc. */
- as_warn (_("translating to `%sp'"), i.tm.name);
- }
- }
+ /* Fill in i.rm.reg field with extension opcode (if any). */
+ if (i.tm.extension_opcode != None)
+ i.rm.reg = i.tm.extension_opcode;
+ }
+ return default_seg;
+}
- /* Handle conversion of 'int $3' --> special int3 insn. */
- if (i.tm.base_opcode == INT_OPCODE && i.op[0].imms->X_add_number == 3)
+static void
+output_branch ()
+{
+ char *p;
+ int code16;
+ int prefix;
+ relax_substateT subtype;
+ symbolS *sym;
+ offsetT off;
+
+ code16 = 0;
+ if (flag_code == CODE_16BIT)
+ code16 = CODE16;
+
+ prefix = 0;
+ if (i.prefix[DATA_PREFIX] != 0)
{
- i.tm.base_opcode = INT3_OPCODE;
- i.imm_operands = 0;
+ prefix = 1;
+ i.prefixes -= 1;
+ code16 ^= CODE16;
}
-
- if ((i.tm.opcode_modifier & (Jump | JumpByte | JumpDword))
- && i.op[0].disps->X_op == O_constant)
+ /* Pentium4 branch hints. */
+ if (i.prefix[SEG_PREFIX] == CS_PREFIX_OPCODE /* not taken */
+ || i.prefix[SEG_PREFIX] == DS_PREFIX_OPCODE /* taken */)
{
- /* Convert "jmp constant" (and "call constant") to a jump (call) to
- the absolute address given by the constant. Since ix86 jumps and
- calls are pc relative, we need to generate a reloc. */
- i.op[0].disps->X_add_symbol = &abs_symbol;
- i.op[0].disps->X_op = O_symbol;
+ prefix++;
+ i.prefixes--;
+ }
+ if (i.prefix[REX_PREFIX] != 0)
+ {
+ prefix++;
+ i.prefixes--;
}
- if (i.tm.opcode_modifier & Rex64)
- i.rex.mode64 = 1;
+ if (i.prefixes != 0 && !intel_syntax)
+ as_warn (_("skipping prefixes on this instruction"));
+
+ /* It's always a symbol; End frag & setup for relax.
+ Make sure there is enough room in this frag for the largest
+ instruction we may generate in md_convert_frag. This is 2
+ bytes for the opcode and room for the prefix and largest
+ displacement. */
+ frag_grow (prefix + 2 + 4);
+ /* Prefix and 1 opcode byte go in fr_fix. */
+ p = frag_more (prefix + 1);
+ if (i.prefix[DATA_PREFIX] != 0)
+ *p++ = DATA_PREFIX_OPCODE;
+ if (i.prefix[SEG_PREFIX] == CS_PREFIX_OPCODE
+ || i.prefix[SEG_PREFIX] == DS_PREFIX_OPCODE)
+ *p++ = i.prefix[SEG_PREFIX];
+ if (i.prefix[REX_PREFIX] != 0)
+ *p++ = i.prefix[REX_PREFIX];
+ *p = i.tm.base_opcode;
+
+ if ((unsigned char) *p == JUMP_PC_RELATIVE)
+ subtype = ENCODE_RELAX_STATE (UNCOND_JUMP, SMALL);
+ else if ((cpu_arch_flags & Cpu386) != 0)
+ subtype = ENCODE_RELAX_STATE (COND_JUMP, SMALL);
+ else
+ subtype = ENCODE_RELAX_STATE (COND_JUMP86, SMALL);
+ subtype |= code16;
- /* For 8bit registers we would need an empty rex prefix.
- Also in the case instruction is already having prefix,
- we need to convert old registers to new ones. */
+ sym = i.op[0].disps->X_add_symbol;
+ off = i.op[0].disps->X_add_number;
- if (((i.types[0] & Reg8) && (i.op[0].regs->reg_flags & RegRex64))
- || ((i.types[1] & Reg8) && (i.op[1].regs->reg_flags & RegRex64))
- || ((i.rex.mode64 || i.rex.extX || i.rex.extY || i.rex.extZ || i.rex.empty)
- && ((i.types[0] & Reg8) || (i.types[1] & Reg8))))
+ if (i.op[0].disps->X_op != O_constant
+ && i.op[0].disps->X_op != O_symbol)
{
- int x;
- i.rex.empty = 1;
- for (x = 0; x < 2; x++)
- {
- /* Look for 8bit operand that does use old registers. */
- if (i.types[x] & Reg8
- && !(i.op[x].regs->reg_flags & RegRex64))
- {
- /* In case it is "hi" register, give up. */
- if (i.op[x].regs->reg_num > 3)
- as_bad (_("Can't encode registers '%%%s' in the instruction requiring REX prefix.\n"),
- i.op[x].regs->reg_name);
+ /* Handle complex expressions. */
+ sym = make_expr_symbol (i.op[0].disps);
+ off = 0;
+ }
- /* Otherwise it is equivalent to the extended register.
- Since the encoding don't change this is merely cosmetical
- cleanup for debug output. */
+ /* 1 possible extra opcode + 4 byte displacement go in var part.
+ Pass reloc in fr_var. */
+ frag_var (rs_machine_dependent, 5, i.reloc[0], subtype, sym, off, p);
+}
- i.op[x].regs = i.op[x].regs + 8;
- }
+static void
+output_jump ()
+{
+ char *p;
+ int size;
+ fixS *fixP;
+
+ if (i.tm.opcode_modifier & JumpByte)
+ {
+ /* This is a loop or jecxz type instruction. */
+ size = 1;
+ if (i.prefix[ADDR_PREFIX] != 0)
+ {
+ FRAG_APPEND_1_CHAR (ADDR_PREFIX_OPCODE);
+ i.prefixes -= 1;
+ }
+ /* Pentium4 branch hints. */
+ if (i.prefix[SEG_PREFIX] == CS_PREFIX_OPCODE /* not taken */
+ || i.prefix[SEG_PREFIX] == DS_PREFIX_OPCODE /* taken */)
+ {
+ FRAG_APPEND_1_CHAR (i.prefix[SEG_PREFIX]);
+ i.prefixes--;
}
}
+ else
+ {
+ int code16;
- if (i.rex.mode64 || i.rex.extX || i.rex.extY || i.rex.extZ || i.rex.empty)
- add_prefix (0x40
- | (i.rex.mode64 ? 8 : 0)
- | (i.rex.extX ? 4 : 0)
- | (i.rex.extY ? 2 : 0)
- | (i.rex.extZ ? 1 : 0));
+ code16 = 0;
+ if (flag_code == CODE_16BIT)
+ code16 = CODE16;
- /* We are ready to output the insn. */
- {
- register char *p;
+ if (i.prefix[DATA_PREFIX] != 0)
+ {
+ FRAG_APPEND_1_CHAR (DATA_PREFIX_OPCODE);
+ i.prefixes -= 1;
+ code16 ^= CODE16;
+ }
- /* Tie dwarf2 debug info to the address at the start of the insn.
- We can't do this after the insn has been output as the current
- frag may have been closed off. eg. by frag_var. */
- dwarf2_emit_insn (0);
+ size = 4;
+ if (code16)
+ size = 2;
+ }
- /* Output jumps. */
- if (i.tm.opcode_modifier & Jump)
- {
- int code16;
- int prefix;
- relax_substateT subtype;
- symbolS *sym;
- offsetT off;
-
- code16 = 0;
- if (flag_code == CODE_16BIT)
- code16 = CODE16;
-
- prefix = 0;
- if (i.prefix[DATA_PREFIX])
- {
- prefix = 1;
- i.prefixes -= 1;
- code16 ^= CODE16;
- }
- /* Pentium4 branch hints. */
- if (i.prefix[SEG_PREFIX] == CS_PREFIX_OPCODE /* not taken */
- || i.prefix[SEG_PREFIX] == DS_PREFIX_OPCODE /* taken */)
- {
- prefix++;
- i.prefixes--;
- }
- if (i.prefix[REX_PREFIX])
- {
- prefix++;
- i.prefixes--;
- }
+ if (i.prefix[REX_PREFIX] != 0)
+ {
+ FRAG_APPEND_1_CHAR (i.prefix[REX_PREFIX]);
+ i.prefixes -= 1;
+ }
- if (i.prefixes != 0 && !intel_syntax)
- as_warn (_("skipping prefixes on this instruction"));
-
- /* It's always a symbol; End frag & setup for relax.
- Make sure there is enough room in this frag for the largest
- instruction we may generate in md_convert_frag. This is 2
- bytes for the opcode and room for the prefix and largest
- displacement. */
- frag_grow (prefix + 2 + 4);
- /* Prefix and 1 opcode byte go in fr_fix. */
- p = frag_more (prefix + 1);
- if (i.prefix[DATA_PREFIX])
- *p++ = DATA_PREFIX_OPCODE;
- if (i.prefix[SEG_PREFIX] == CS_PREFIX_OPCODE
- || i.prefix[SEG_PREFIX] == DS_PREFIX_OPCODE)
- *p++ = i.prefix[SEG_PREFIX];
- if (i.prefix[REX_PREFIX])
- *p++ = i.prefix[REX_PREFIX];
- *p = i.tm.base_opcode;
-
- if ((unsigned char) *p == JUMP_PC_RELATIVE)
- subtype = ENCODE_RELAX_STATE (UNCOND_JUMP, SMALL);
- else if ((cpu_arch_flags & Cpu386) != 0)
- subtype = ENCODE_RELAX_STATE (COND_JUMP, SMALL);
- else
- subtype = ENCODE_RELAX_STATE (COND_JUMP86, SMALL);
- subtype |= code16;
+ if (i.prefixes != 0 && !intel_syntax)
+ as_warn (_("skipping prefixes on this instruction"));
- sym = i.op[0].disps->X_add_symbol;
- off = i.op[0].disps->X_add_number;
+ p = frag_more (1 + size);
+ *p++ = i.tm.base_opcode;
- if (i.op[0].disps->X_op != O_constant
- && i.op[0].disps->X_op != O_symbol)
- {
- /* Handle complex expressions. */
- sym = make_expr_symbol (i.op[0].disps);
- off = 0;
- }
+ fixP = fix_new_exp (frag_now, p - frag_now->fr_literal, size,
+ i.op[0].disps, 1, reloc (size, 1, 1, i.reloc[0]));
+ fixP->fx_pcrel_adjust = size;
+}
- /* 1 possible extra opcode + 4 byte displacement go in var part.
- Pass reloc in fr_var. */
- frag_var (rs_machine_dependent, 5, i.reloc[0], subtype, sym, off, p);
- }
- else if (i.tm.opcode_modifier & (JumpByte | JumpDword))
- {
- int size;
+static void
+output_interseg_jump ()
+{
+ char *p;
+ int size;
+ int prefix;
+ int code16;
- if (i.tm.opcode_modifier & JumpByte)
- {
- /* This is a loop or jecxz type instruction. */
- size = 1;
- if (i.prefix[ADDR_PREFIX])
- {
- FRAG_APPEND_1_CHAR (ADDR_PREFIX_OPCODE);
- i.prefixes -= 1;
- }
- /* Pentium4 branch hints. */
- if (i.prefix[SEG_PREFIX] == CS_PREFIX_OPCODE /* not taken */
- || i.prefix[SEG_PREFIX] == DS_PREFIX_OPCODE /* taken */)
- {
- FRAG_APPEND_1_CHAR (i.prefix[SEG_PREFIX]);
- i.prefixes--;
- }
- }
- else
- {
- int code16;
+ code16 = 0;
+ if (flag_code == CODE_16BIT)
+ code16 = CODE16;
- code16 = 0;
- if (flag_code == CODE_16BIT)
- code16 = CODE16;
+ prefix = 0;
+ if (i.prefix[DATA_PREFIX] != 0)
+ {
+ prefix = 1;
+ i.prefixes -= 1;
+ code16 ^= CODE16;
+ }
+ if (i.prefix[REX_PREFIX] != 0)
+ {
+ prefix++;
+ i.prefixes -= 1;
+ }
- if (i.prefix[DATA_PREFIX])
- {
- FRAG_APPEND_1_CHAR (DATA_PREFIX_OPCODE);
- i.prefixes -= 1;
- code16 ^= CODE16;
- }
+ size = 4;
+ if (code16)
+ size = 2;
- size = 4;
- if (code16)
- size = 2;
- }
+ if (i.prefixes != 0 && !intel_syntax)
+ as_warn (_("skipping prefixes on this instruction"));
- if (i.prefix[REX_PREFIX])
- {
- FRAG_APPEND_1_CHAR (i.prefix[REX_PREFIX]);
- i.prefixes -= 1;
- }
+ /* 1 opcode; 2 segment; offset */
+ p = frag_more (prefix + 1 + 2 + size);
- if (i.prefixes != 0 && !intel_syntax)
- as_warn (_("skipping prefixes on this instruction"));
+ if (i.prefix[DATA_PREFIX] != 0)
+ *p++ = DATA_PREFIX_OPCODE;
- p = frag_more (1 + size);
- *p++ = i.tm.base_opcode;
+ if (i.prefix[REX_PREFIX] != 0)
+ *p++ = i.prefix[REX_PREFIX];
- fix_new_exp (frag_now, p - frag_now->fr_literal, size,
- i.op[0].disps, 1, reloc (size, 1, 1, i.reloc[0]));
- }
- else if (i.tm.opcode_modifier & JumpInterSegment)
- {
- int size;
- int prefix;
- int code16;
+ *p++ = i.tm.base_opcode;
+ if (i.op[1].imms->X_op == O_constant)
+ {
+ offsetT n = i.op[1].imms->X_add_number;
- code16 = 0;
- if (flag_code == CODE_16BIT)
- code16 = CODE16;
+ if (size == 2
+ && !fits_in_unsigned_word (n)
+ && !fits_in_signed_word (n))
+ {
+ as_bad (_("16-bit jump out of range"));
+ return;
+ }
+ md_number_to_chars (p, n, size);
+ }
+ else
+ fix_new_exp (frag_now, p - frag_now->fr_literal, size,
+ i.op[1].imms, 0, reloc (size, 0, 0, i.reloc[1]));
+ if (i.op[0].imms->X_op != O_constant)
+ as_bad (_("can't handle non absolute segment in `%s'"),
+ i.tm.name);
+ md_number_to_chars (p + size, (valueT) i.op[0].imms->X_add_number, 2);
+}
- prefix = 0;
- if (i.prefix[DATA_PREFIX])
- {
- prefix = 1;
- i.prefixes -= 1;
- code16 ^= CODE16;
- }
- if (i.prefix[REX_PREFIX])
- {
- prefix++;
- i.prefixes -= 1;
- }
+static void
+output_insn ()
+{
+ /* Tie dwarf2 debug info to the address at the start of the insn.
+ We can't do this after the insn has been output as the current
+ frag may have been closed off. eg. by frag_var. */
+ dwarf2_emit_insn (0);
+
+ /* Output jumps. */
+ if (i.tm.opcode_modifier & Jump)
+ output_branch ();
+ else if (i.tm.opcode_modifier & (JumpByte | JumpDword))
+ output_jump ();
+ else if (i.tm.opcode_modifier & JumpInterSegment)
+ output_interseg_jump ();
+ else
+ {
+ /* Output normal instructions here. */
+ char *p;
+ unsigned char *q;
- size = 4;
- if (code16)
- size = 2;
+ /* All opcodes on i386 have either 1 or 2 bytes. We may use third
+ byte for the SSE instructions to specify a prefix they require. */
+ if (i.tm.base_opcode & 0xff0000)
+ add_prefix ((i.tm.base_opcode >> 16) & 0xff);
- if (i.prefixes != 0 && !intel_syntax)
- as_warn (_("skipping prefixes on this instruction"));
+ /* The prefix bytes. */
+ for (q = i.prefix;
+ q < i.prefix + sizeof (i.prefix) / sizeof (i.prefix[0]);
+ q++)
+ {
+ if (*q)
+ {
+ p = frag_more (1);
+ md_number_to_chars (p, (valueT) *q, 1);
+ }
+ }
- /* 1 opcode; 2 segment; offset */
- p = frag_more (prefix + 1 + 2 + size);
+ /* Now the opcode; be careful about word order here! */
+ if (fits_in_unsigned_byte (i.tm.base_opcode))
+ {
+ FRAG_APPEND_1_CHAR (i.tm.base_opcode);
+ }
+ else
+ {
+ p = frag_more (2);
+ /* Put out high byte first: can't use md_number_to_chars! */
+ *p++ = (i.tm.base_opcode >> 8) & 0xff;
+ *p = i.tm.base_opcode & 0xff;
+ }
- if (i.prefix[DATA_PREFIX])
- *p++ = DATA_PREFIX_OPCODE;
+ /* Now the modrm byte and sib byte (if present). */
+ if (i.tm.opcode_modifier & Modrm)
+ {
+ p = frag_more (1);
+ md_number_to_chars (p,
+ (valueT) (i.rm.regmem << 0
+ | i.rm.reg << 3
+ | i.rm.mode << 6),
+ 1);
+ /* If i.rm.regmem == ESP (4)
+ && i.rm.mode != (Register mode)
+ && not 16 bit
+ ==> need second modrm byte. */
+ if (i.rm.regmem == ESCAPE_TO_TWO_BYTE_ADDRESSING
+ && i.rm.mode != 3
+ && !(i.base_reg && (i.base_reg->reg_type & Reg16) != 0))
+ {
+ p = frag_more (1);
+ md_number_to_chars (p,
+ (valueT) (i.sib.base << 0
+ | i.sib.index << 3
+ | i.sib.scale << 6),
+ 1);
+ }
+ }
- if (i.prefix[REX_PREFIX])
- *p++ = i.prefix[REX_PREFIX];
+ if (i.disp_operands)
+ output_disp ();
- *p++ = i.tm.base_opcode;
- if (i.op[1].imms->X_op == O_constant)
- {
- offsetT n = i.op[1].imms->X_add_number;
+ if (i.imm_operands)
+ output_imm ();
+ }
- if (size == 2
- && !fits_in_unsigned_word (n)
- && !fits_in_signed_word (n))
- {
- as_bad (_("16-bit jump out of range"));
- return;
- }
- md_number_to_chars (p, n, size);
- }
- else
- fix_new_exp (frag_now, p - frag_now->fr_literal, size,
- i.op[1].imms, 0, reloc (size, 0, 0, i.reloc[1]));
- if (i.op[0].imms->X_op != O_constant)
- as_bad (_("can't handle non absolute segment in `%s'"),
- i.tm.name);
- md_number_to_chars (p + size, (valueT) i.op[0].imms->X_add_number, 2);
- }
- else
- {
- /* Output normal instructions here. */
- unsigned char *q;
-
- /* All opcodes on i386 have eighter 1 or 2 bytes. We may use third
- byte for the SSE instructions to specify prefix they require. */
- if (i.tm.base_opcode & 0xff0000)
- add_prefix ((i.tm.base_opcode >> 16) & 0xff);
-
- /* The prefix bytes. */
- for (q = i.prefix;
- q < i.prefix + sizeof (i.prefix) / sizeof (i.prefix[0]);
- q++)
- {
- if (*q)
- {
- p = frag_more (1);
- md_number_to_chars (p, (valueT) *q, 1);
- }
- }
+#ifdef DEBUG386
+ if (flag_debug)
+ {
+ pi (line, &i);
+ }
+#endif /* DEBUG386 */
+}
- /* Now the opcode; be careful about word order here! */
- if (fits_in_unsigned_byte (i.tm.base_opcode))
- {
- FRAG_APPEND_1_CHAR (i.tm.base_opcode);
- }
- else
- {
- p = frag_more (2);
- /* Put out high byte first: can't use md_number_to_chars! */
- *p++ = (i.tm.base_opcode >> 8) & 0xff;
- *p = i.tm.base_opcode & 0xff;
- }
+static void
+output_disp ()
+{
+ char *p;
+ unsigned int n;
- /* Now the modrm byte and sib byte (if present). */
- if (i.tm.opcode_modifier & Modrm)
- {
- p = frag_more (1);
- md_number_to_chars (p,
- (valueT) (i.rm.regmem << 0
- | i.rm.reg << 3
- | i.rm.mode << 6),
- 1);
- /* If i.rm.regmem == ESP (4)
- && i.rm.mode != (Register mode)
- && not 16 bit
- ==> need second modrm byte. */
- if (i.rm.regmem == ESCAPE_TO_TWO_BYTE_ADDRESSING
- && i.rm.mode != 3
- && !(i.base_reg && (i.base_reg->reg_type & Reg16) != 0))
- {
- p = frag_more (1);
- md_number_to_chars (p,
- (valueT) (i.sib.base << 0
- | i.sib.index << 3
- | i.sib.scale << 6),
- 1);
- }
- }
+ for (n = 0; n < i.operands; n++)
+ {
+ if (i.types[n] & Disp)
+ {
+ if (i.op[n].disps->X_op == O_constant)
+ {
+ int size;
+ offsetT val;
- if (i.disp_operands)
- {
- register unsigned int n;
+ size = 4;
+ if (i.types[n] & (Disp8 | Disp16 | Disp64))
+ {
+ size = 2;
+ if (i.types[n] & Disp8)
+ size = 1;
+ if (i.types[n] & Disp64)
+ size = 8;
+ }
+ val = offset_in_range (i.op[n].disps->X_add_number,
+ size);
+ p = frag_more (size);
+ md_number_to_chars (p, val, size);
+ }
+ else
+ {
+ int size = 4;
+ int sign = 0;
+ int pcrel = (i.flags[n] & Operand_PCrel) != 0;
+ fixS *fixP;
+
+ /* The PC relative address is computed relative
+ to the instruction boundary, so in case immediate
+ fields follows, we need to adjust the value. */
+ if (pcrel && i.imm_operands)
+ {
+ int imm_size = 4;
+ unsigned int n1;
- for (n = 0; n < i.operands; n++)
- {
- if (i.types[n] & Disp)
- {
- if (i.op[n].disps->X_op == O_constant)
+ for (n1 = 0; n1 < i.operands; n1++)
+ if (i.types[n1] & Imm)
{
- int size;
- offsetT val;
-
- size = 4;
- if (i.types[n] & (Disp8 | Disp16 | Disp64))
+ if (i.types[n1] & (Imm8 | Imm8S | Imm16 | Imm64))
{
- size = 2;
- if (i.types[n] & Disp8)
- size = 1;
- if (i.types[n] & Disp64)
- size = 8;
+ imm_size = 2;
+ if (i.types[n1] & (Imm8 | Imm8S))
+ imm_size = 1;
+ if (i.types[n1] & Imm64)
+ imm_size = 8;
}
- val = offset_in_range (i.op[n].disps->X_add_number,
- size);
- p = frag_more (size);
- md_number_to_chars (p, val, size);
+ break;
}
- else
- {
- int size = 4;
- int sign = 0;
- int pcrel = (i.flags[n] & Operand_PCrel) != 0;
-
- /* The PC relative address is computed relative
- to the instruction boundary, so in case immediate
- fields follows, we need to adjust the value. */
- if (pcrel && i.imm_operands)
- {
- int imm_size = 4;
- register unsigned int n1;
-
- for (n1 = 0; n1 < i.operands; n1++)
- if (i.types[n1] & Imm)
- {
- if (i.types[n1] & (Imm8 | Imm8S | Imm16 | Imm64))
- {
- imm_size = 2;
- if (i.types[n1] & (Imm8 | Imm8S))
- imm_size = 1;
- if (i.types[n1] & Imm64)
- imm_size = 8;
- }
- break;
- }
- /* We should find the immediate. */
- if (n1 == i.operands)
- abort ();
- i.op[n].disps->X_add_number -= imm_size;
- }
+ /* We should find the immediate. */
+ if (n1 == i.operands)
+ abort ();
+ i.op[n].disps->X_add_number -= imm_size;
+ }
- if (i.types[n] & Disp32S)
- sign = 1;
+ if (i.types[n] & Disp32S)
+ sign = 1;
- if (i.types[n] & (Disp16 | Disp64))
- {
- size = 2;
- if (i.types[n] & Disp64)
- size = 8;
- }
+ if (i.types[n] & (Disp16 | Disp64))
+ {
+ size = 2;
+ if (i.types[n] & Disp64)
+ size = 8;
+ }
- p = frag_more (size);
- fix_new_exp (frag_now, p - frag_now->fr_literal, size,
- i.op[n].disps, pcrel,
- reloc (size, pcrel, sign, i.reloc[n]));
- }
- }
- }
- }
+ p = frag_more (size);
+ fixP = fix_new_exp (frag_now, p - frag_now->fr_literal, size,
+ i.op[n].disps, pcrel,
+ reloc (size, pcrel, sign, i.reloc[n]));
+ if (pcrel)
+ fixP->fx_pcrel_adjust = size;
+ }
+ }
+ }
+}
- /* Output immediate. */
- if (i.imm_operands)
- {
- register unsigned int n;
+static void
+output_imm ()
+{
+ char *p;
+ unsigned int n;
- for (n = 0; n < i.operands; n++)
- {
- if (i.types[n] & Imm)
- {
- if (i.op[n].imms->X_op == O_constant)
- {
- int size;
- offsetT val;
+ for (n = 0; n < i.operands; n++)
+ {
+ if (i.types[n] & Imm)
+ {
+ if (i.op[n].imms->X_op == O_constant)
+ {
+ int size;
+ offsetT val;
- size = 4;
- if (i.types[n] & (Imm8 | Imm8S | Imm16 | Imm64))
- {
- size = 2;
- if (i.types[n] & (Imm8 | Imm8S))
- size = 1;
- else if (i.types[n] & Imm64)
- size = 8;
- }
- val = offset_in_range (i.op[n].imms->X_add_number,
- size);
- p = frag_more (size);
- md_number_to_chars (p, val, size);
- }
- else
- {
- /* Not absolute_section.
- Need a 32-bit fixup (don't support 8bit
- non-absolute imms). Try to support other
- sizes ... */
- RELOC_ENUM reloc_type;
- int size = 4;
- int sign = 0;
-
- if ((i.types[n] & (Imm32S))
- && i.suffix == QWORD_MNEM_SUFFIX)
- sign = 1;
- if (i.types[n] & (Imm8 | Imm8S | Imm16 | Imm64))
- {
- size = 2;
- if (i.types[n] & (Imm8 | Imm8S))
- size = 1;
- if (i.types[n] & Imm64)
- size = 8;
- }
+ size = 4;
+ if (i.types[n] & (Imm8 | Imm8S | Imm16 | Imm64))
+ {
+ size = 2;
+ if (i.types[n] & (Imm8 | Imm8S))
+ size = 1;
+ else if (i.types[n] & Imm64)
+ size = 8;
+ }
+ val = offset_in_range (i.op[n].imms->X_add_number,
+ size);
+ p = frag_more (size);
+ md_number_to_chars (p, val, size);
+ }
+ else
+ {
+ /* Not absolute_section.
+ Need a 32-bit fixup (don't support 8bit
+ non-absolute imms). Try to support other
+ sizes ... */
+ RELOC_ENUM reloc_type;
+ int size = 4;
+ int sign = 0;
+
+ if ((i.types[n] & (Imm32S))
+ && i.suffix == QWORD_MNEM_SUFFIX)
+ sign = 1;
+ if (i.types[n] & (Imm8 | Imm8S | Imm16 | Imm64))
+ {
+ size = 2;
+ if (i.types[n] & (Imm8 | Imm8S))
+ size = 1;
+ if (i.types[n] & Imm64)
+ size = 8;
+ }
- p = frag_more (size);
- reloc_type = reloc (size, 0, sign, i.reloc[n]);
+ p = frag_more (size);
+ reloc_type = reloc (size, 0, sign, i.reloc[n]);
#ifdef BFD_ASSEMBLER
- if (reloc_type == BFD_RELOC_32
- && GOT_symbol
- && GOT_symbol == i.op[n].imms->X_add_symbol
- && (i.op[n].imms->X_op == O_symbol
- || (i.op[n].imms->X_op == O_add
- && ((symbol_get_value_expression
- (i.op[n].imms->X_op_symbol)->X_op)
- == O_subtract))))
- {
- /* We don't support dynamic linking on x86-64 yet. */
- if (flag_code == CODE_64BIT)
- abort ();
- reloc_type = BFD_RELOC_386_GOTPC;
- i.op[n].imms->X_add_number += 3;
- }
+ if (reloc_type == BFD_RELOC_32
+ && GOT_symbol
+ && GOT_symbol == i.op[n].imms->X_add_symbol
+ && (i.op[n].imms->X_op == O_symbol
+ || (i.op[n].imms->X_op == O_add
+ && ((symbol_get_value_expression
+ (i.op[n].imms->X_op_symbol)->X_op)
+ == O_subtract))))
+ {
+ /* We don't support dynamic linking on x86-64 yet. */
+ if (flag_code == CODE_64BIT)
+ abort ();
+ reloc_type = BFD_RELOC_386_GOTPC;
+ i.op[n].imms->X_add_number += 3;
+ }
#endif
- fix_new_exp (frag_now, p - frag_now->fr_literal, size,
- i.op[n].imms, 0, reloc_type);
- }
- }
- }
- }
- }
-
-#ifdef DEBUG386
- if (flag_debug)
- {
- pi (line, &i);
- }
-#endif /* DEBUG386 */
- }
+ fix_new_exp (frag_now, p - frag_now->fr_literal, size,
+ i.op[n].imms, 0, reloc_type);
+ }
+ }
+ }
}
#ifndef LEX_AT
@@ -3426,7 +3622,7 @@ i386_scale (scale)
input_line_pointer = save;
return NULL;
}
- if (i.log2_scale_factor != 0 && ! i.index_reg)
+ if (i.log2_scale_factor != 0 && i.index_reg == 0)
{
as_warn (_("scale factor of %d without an index register"),
1 << i.log2_scale_factor);
@@ -3446,7 +3642,7 @@ i386_displacement (disp_start, disp_end)
char *disp_start;
char *disp_end;
{
- register expressionS *exp;
+ expressionS *exp;
segT exp_seg = 0;
char *save_input_line_pointer;
#ifndef LEX_AT
@@ -3456,8 +3652,8 @@ i386_displacement (disp_start, disp_end)
if (flag_code == CODE_64BIT)
{
- if (!i.prefix[ADDR_PREFIX])
- bigdisp = Disp64;
+ if (i.prefix[ADDR_PREFIX] == 0)
+ bigdisp = Disp64;
}
else if ((flag_code == CODE_16BIT) ^ (i.prefix[ADDR_PREFIX] != 0))
bigdisp = Disp16;
@@ -3557,9 +3753,9 @@ i386_displacement (disp_start, disp_end)
exp->X_op = O_subtract;
exp->X_op_symbol = GOT_symbol;
if (i.reloc[this_operand] == BFD_RELOC_X86_64_GOTPCREL)
- i.reloc[this_operand] = BFD_RELOC_32_PCREL;
+ i.reloc[this_operand] = BFD_RELOC_32_PCREL;
else
- i.reloc[this_operand] = BFD_RELOC_32;
+ i.reloc[this_operand] = BFD_RELOC_32;
}
#endif
@@ -3623,8 +3819,8 @@ i386_index_check (operand_string)
&& (i.base_reg->reg_type != BaseIndex
|| i.index_reg))
|| (i.index_reg
- && ((i.index_reg->reg_type & (Reg64|BaseIndex))
- != (Reg64|BaseIndex))))
+ && ((i.index_reg->reg_type & (Reg64 | BaseIndex))
+ != (Reg64 | BaseIndex))))
ok = 0;
}
else
@@ -3633,8 +3829,8 @@ i386_index_check (operand_string)
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))))
+ && ((i.index_reg->reg_type & (Reg32 | BaseIndex | RegRex))
+ != (Reg32 | BaseIndex))))
ok = 0;
}
}
@@ -3644,15 +3840,15 @@ i386_index_check (operand_string)
{
/* 16bit checks. */
if ((i.base_reg
- && ((i.base_reg->reg_type & (Reg16|BaseIndex|RegRex))
- != (Reg16|BaseIndex)))
+ && ((i.base_reg->reg_type & (Reg16 | BaseIndex | RegRex))
+ != (Reg16 | BaseIndex)))
|| (i.index_reg
- && (((i.index_reg->reg_type & (Reg16|BaseIndex))
- != (Reg16|BaseIndex))
- || ! (i.base_reg
- && i.base_reg->reg_num < 6
- && i.index_reg->reg_num >= 6
- && i.log2_scale_factor == 0))))
+ && (((i.index_reg->reg_type & (Reg16 | BaseIndex))
+ != (Reg16 | BaseIndex))
+ || !(i.base_reg
+ && i.base_reg->reg_num < 6
+ && i.index_reg->reg_num >= 6
+ && i.log2_scale_factor == 0))))
ok = 0;
}
else
@@ -3661,8 +3857,8 @@ i386_index_check (operand_string)
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))))
+ && ((i.index_reg->reg_type & (Reg32 | BaseIndex | RegRex))
+ != (Reg32 | BaseIndex))))
ok = 0;
}
}
@@ -3679,8 +3875,8 @@ i386_index_check (operand_string)
FIXME. There doesn't seem to be any real need for separate
Disp16 and Disp32 flags. The same goes for Imm16 and Imm32.
Removing them would probably clean up the code quite a lot. */
- if (i.types[this_operand] & (Disp16|Disp32))
- i.types[this_operand] ^= (Disp16|Disp32);
+ if (i.types[this_operand] & (Disp16 | Disp32))
+ i.types[this_operand] ^= (Disp16 | Disp32);
fudged = 1;
goto tryprefix;
}
@@ -3999,8 +4195,8 @@ i386_operand (operand_string)
int
md_estimate_size_before_relax (fragP, segment)
- register fragS *fragP;
- register segT segment;
+ fragS *fragP;
+ segT segment;
{
/* We've already got fragP->fr_subtype right; all we have to do is
check for un-relaxable symbols. On an ELF system, we can't relax
@@ -4019,6 +4215,7 @@ md_estimate_size_before_relax (fragP, segment)
RELOC_ENUM reloc_type;
unsigned char *opcode;
int old_fr_fix;
+ fixS *fixP;
if (fragP->fr_var != NO_RELOC)
reloc_type = fragP->fr_var;
@@ -4036,10 +4233,11 @@ md_estimate_size_before_relax (fragP, segment)
/* Make jmp (0xeb) a (d)word displacement jump. */
opcode[0] = 0xe9;
fragP->fr_fix += size;
- fix_new (fragP, old_fr_fix, size,
- fragP->fr_symbol,
- fragP->fr_offset, 1,
- reloc_type);
+ fixP = fix_new (fragP, old_fr_fix, size,
+ fragP->fr_symbol,
+ fragP->fr_offset, 1,
+ reloc_type);
+ fixP->fx_pcrel_adjust = size;
break;
case COND_JUMP86:
@@ -4057,10 +4255,11 @@ md_estimate_size_before_relax (fragP, segment)
/* We added two extra opcode bytes, and have a two byte
offset. */
fragP->fr_fix += 2 + 2;
- fix_new (fragP, old_fr_fix + 2, 2,
- fragP->fr_symbol,
- fragP->fr_offset, 1,
- reloc_type);
+ fixP = fix_new (fragP, old_fr_fix + 2, 2,
+ fragP->fr_symbol,
+ fragP->fr_offset, 1,
+ reloc_type);
+ fixP->fx_pcrel_adjust = size;
break;
}
/* Fall through. */
@@ -4075,10 +4274,11 @@ md_estimate_size_before_relax (fragP, segment)
opcode[0] = TWO_BYTE_OPCODE_ESCAPE;
/* We've added an opcode byte. */
fragP->fr_fix += 1 + size;
- fix_new (fragP, old_fr_fix + 1, size,
- fragP->fr_symbol,
- fragP->fr_offset, 1,
- reloc_type);
+ fixP = fix_new (fragP, old_fr_fix + 1, size,
+ fragP->fr_symbol,
+ fragP->fr_offset, 1,
+ reloc_type);
+ fixP->fx_pcrel_adjust = size;
break;
default:
@@ -4113,16 +4313,16 @@ void
md_convert_frag (headers, sec, fragP)
object_headers *headers ATTRIBUTE_UNUSED;
segT sec ATTRIBUTE_UNUSED;
- register fragS *fragP;
+ fragS *fragP;
#else
void
md_convert_frag (abfd, sec, fragP)
bfd *abfd ATTRIBUTE_UNUSED;
segT sec ATTRIBUTE_UNUSED;
- register fragS *fragP;
+ fragS *fragP;
#endif
{
- register unsigned char *opcode;
+ unsigned char *opcode;
unsigned char *where_to_put_displacement = NULL;
offsetT target_address;
offsetT opcode_address;
@@ -4304,10 +4504,10 @@ md_apply_fix3 (fixP, valP, seg)
if ((fseg == seg
|| (symbol_section_p (fixP->fx_addsy)
&& fseg != absolute_section))
- && ! S_IS_EXTERNAL (fixP->fx_addsy)
- && ! S_IS_WEAK (fixP->fx_addsy)
+ && !S_IS_EXTERNAL (fixP->fx_addsy)
+ && !S_IS_WEAK (fixP->fx_addsy)
&& S_IS_DEFINED (fixP->fx_addsy)
- && ! S_IS_COMMON (fixP->fx_addsy))
+ && !S_IS_COMMON (fixP->fx_addsy))
{
/* Yes, we add the values in twice. This is because
bfd_perform_relocation subtracts them out again. I think
@@ -4545,7 +4745,7 @@ parse_register (reg_string, end_op)
}
if (r != NULL
- && r->reg_flags & (RegRex64|RegRex)
+ && (r->reg_flags & (RegRex64 | RegRex)) != 0
&& flag_code != CODE_64BIT)
{
return (const reg_entry *) NULL;
@@ -4599,7 +4799,7 @@ md_parse_option (c, arg)
case 's':
/* -s: On i386 Solaris, this tells the native assembler to use
- .stab instead of .stab.excl. We always use .stab anyhow. */
+ .stab instead of .stab.excl. We always use .stab anyhow. */
break;
case OPTION_64:
@@ -4796,7 +4996,7 @@ static void
s_bss (ignore)
int ignore ATTRIBUTE_UNUSED;
{
- register int temp;
+ int temp;
temp = get_absolute_expression ();
subseg_set (bss_section, (subsegT) temp);
@@ -4882,7 +5082,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;
@@ -4920,7 +5122,7 @@ tc_gen_reloc (section, fixp)
{
rel->addend = fixp->fx_offset;
if (fixp->fx_pcrel)
- rel->addend -= fixp->fx_size;
+ rel->addend -= fixp->fx_pcrel_adjust;
}
rel->howto = bfd_reloc_type_lookup (stdoutput, code);
@@ -4937,7 +5139,7 @@ tc_gen_reloc (section, fixp)
return rel;
}
-#else /* ! BFD_ASSEMBLER */
+#else /* !BFD_ASSEMBLER */
#if (defined(OBJ_AOUT) | defined(OBJ_BOUT))
void
@@ -5003,7 +5205,7 @@ tc_coff_sizemachdep (frag)
#endif /* I386COFF */
-#endif /* ! BFD_ASSEMBLER */
+#endif /* !BFD_ASSEMBLER */
/* Parse operands using Intel syntax. This implements a recursive descent
parser based on the BNF grammar published in Appendix B of the MASM 6.1
diff --git a/contrib/binutils/gas/config/tc-i386.h b/contrib/binutils/gas/config/tc-i386.h
index d5ba043..61b5bb9 100644
--- a/contrib/binutils/gas/config/tc-i386.h
+++ b/contrib/binutils/gas/config/tc-i386.h
@@ -467,15 +467,17 @@ typedef struct
modrm_byte;
/* x86-64 extension prefix. */
-typedef struct
- {
- unsigned int mode64;
- unsigned int extX; /* Used to extend modrm reg field. */
- unsigned int extY; /* Used to extend SIB index field. */
- unsigned int extZ; /* Used to extend modrm reg/mem, SIB base, modrm base fields. */
- unsigned int empty; /* Used to old-style byte registers to new style. */
- }
-rex_byte;
+typedef int rex_byte;
+#define REX_OPCODE 0x40
+
+/* Indicates 64 bit operand size. */
+#define REX_MODE64 8
+/* High extension to reg field of modrm byte. */
+#define REX_EXTX 4
+/* High extension to SIB index field. */
+#define REX_EXTY 2
+/* High extension to base field of modrm or SIB, or reg field of opcode. */
+#define REX_EXTZ 1
/* 386 opcode byte to code indirect addressing. */
typedef struct
diff --git a/contrib/binutils/gas/config/tc-ia64.c b/contrib/binutils/gas/config/tc-ia64.c
index 37d5882..adffb06 100644
--- a/contrib/binutils/gas/config/tc-ia64.c
+++ b/contrib/binutils/gas/config/tc-ia64.c
@@ -2709,7 +2709,11 @@ fixup_unw_records (list)
size = (slot_index (last_addr, last_frag, first_addr, first_frag)
+ dir_len);
rlen = ptr->r.record.r.rlen = size;
- region = ptr;
+ if (ptr->r.type == body)
+ /* End of region. */
+ region = 0;
+ else
+ region = ptr;
break;
}
case epilogue:
@@ -3250,7 +3254,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)
{
@@ -9982,11 +9986,26 @@ ia64_cons_fix_new (f, where, nbytes, exp)
break;
case 8:
- if (target_big_endian)
- code = BFD_RELOC_IA64_DIR64MSB;
- else
- code = BFD_RELOC_IA64_DIR64LSB;
- break;
+ /* In 32-bit mode, data8 could mean function descriptors too. */
+ if (exp->X_op == O_pseudo_fixup
+ && exp->X_op_symbol
+ && S_GET_VALUE (exp->X_op_symbol) == FUNC_IPLT_RELOC
+ && !(md.flags & EF_IA_64_ABI64))
+ {
+ if (target_big_endian)
+ code = BFD_RELOC_IA64_IPLTMSB;
+ else
+ code = BFD_RELOC_IA64_IPLTLSB;
+ exp->X_op = O_symbol;
+ break;
+ }
+ else {
+ if (target_big_endian)
+ code = BFD_RELOC_IA64_DIR64MSB;
+ else
+ code = BFD_RELOC_IA64_DIR64LSB;
+ break;
+ }
case 16:
if (exp->X_op == O_pseudo_fixup
diff --git a/contrib/binutils/gas/config/tc-ia64.h b/contrib/binutils/gas/config/tc-ia64.h
index 53dab86..7b03e26 100644
--- a/contrib/binutils/gas/config/tc-ia64.h
+++ b/contrib/binutils/gas/config/tc-ia64.h
@@ -124,8 +124,6 @@ extern void ia64_after_parse_args PARAMS ((void));
#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 --git a/contrib/binutils/gas/config/tc-tic30.c b/contrib/binutils/gas/config/tc-tic30.c
index 2190a85..1258b13 100644
--- a/contrib/binutils/gas/config/tc-tic30.c
+++ b/contrib/binutils/gas/config/tc-tic30.c
@@ -1,5 +1,5 @@
/* tc-c30.c -- Assembly code for the Texas Instruments TMS320C30
- Copyright 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au)
This file is part of GAS, the GNU Assembler.
@@ -25,6 +25,7 @@
Please help us make it better. */
#include "as.h"
+#include "safe-ctype.h"
#include "opcode/tic30.h"
/* Put here all non-digit non-letter charcters that may occur in an
@@ -188,25 +189,25 @@ md_begin ()
for (c = 0; c < 256; c++)
{
- if (islower (c) || isdigit (c))
+ if (ISLOWER (c) || ISDIGIT (c))
{
opcode_chars[c] = c;
register_chars[c] = c;
}
- else if (isupper (c))
+ else if (ISUPPER (c))
{
- opcode_chars[c] = tolower (c);
+ opcode_chars[c] = TOLOWER (c);
register_chars[c] = opcode_chars[c];
}
else if (c == ')' || c == '(')
{
register_chars[c] = c;
}
- if (isupper (c) || islower (c) || isdigit (c))
+ if (ISUPPER (c) || ISLOWER (c) || ISDIGIT (c))
operand_chars[c] = c;
- if (isdigit (c) || c == '-')
+ if (ISDIGIT (c) || c == '-')
digit_chars[c] = c;
- if (isalpha (c) || c == '_' || c == '.' || isdigit (c))
+ if (ISALPHA (c) || c == '_' || c == '.' || ISDIGIT (c))
identifier_chars[c] = c;
if (c == ' ' || c == '\t')
space_chars[c] = c;
@@ -1267,7 +1268,7 @@ tic30_operand (token)
ind_buffer[0] = *token;
for (count = 1; count < strlen (token); count++)
{ /* Strip operand */
- ind_buffer[buffer_posn] = tolower (*(token + count));
+ ind_buffer[buffer_posn] = TOLOWER (*(token + count));
if ((*(token + count - 1) == 'a' || *(token + count - 1) == 'A') &&
(*(token + count) == 'r' || *(token + count) == 'R'))
{
@@ -1486,12 +1487,12 @@ tic30_find_parallel_insn (current_line, next_line)
{
if (is_opcode_char (c) && search_status == NONE)
{
- opcode[char_ptr++] = tolower (c);
+ opcode[char_ptr++] = TOLOWER (c);
search_status = START_OPCODE;
}
else if (is_opcode_char (c) && search_status == START_OPCODE)
{
- opcode[char_ptr++] = tolower (c);
+ opcode[char_ptr++] = TOLOWER (c);
}
else if (!is_opcode_char (c) && search_status == START_OPCODE)
{
@@ -1558,10 +1559,11 @@ md_convert_frag (abfd, sec, fragP)
debug ("In md_convert_frag()\n");
}
-int
-md_apply_fix (fixP, valP)
+void
+md_apply_fix3 (fixP, valP, seg)
fixS *fixP;
valueT *valP;
+ segT seg ATTRIBUTE_UNUSED;
{
valueT value = *valP;
@@ -1573,15 +1575,18 @@ md_apply_fix (fixP, valP)
debug ("fx_offset = %d\n", (int) fixP->fx_offset);
{
char *buf = fixP->fx_frag->fr_literal + fixP->fx_where;
+
value /= INSN_SIZE;
if (fixP->fx_size == 1)
- { /* Special fix for LDP instruction. */
- value = (value & 0x00FF0000) >> 16;
- }
+ /* Special fix for LDP instruction. */
+ value = (value & 0x00FF0000) >> 16;
+
debug ("new value = %ld\n", (long) value);
md_number_to_chars (buf, value, fixP->fx_size);
}
- return 1;
+
+ if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
+ fixP->fx_done = 1;
}
int
@@ -1868,7 +1873,7 @@ char *
output_invalid (c)
char c;
{
- if (isprint (c))
+ if (ISPRINT (c))
sprintf (output_invalid_buf, "'%c'", c);
else
sprintf (output_invalid_buf, "(0x%x)", (unsigned) c);
diff --git a/contrib/binutils/gas/config/tc-v850.c b/contrib/binutils/gas/config/tc-v850.c
index ce676cd..e0c4936 100644
--- a/contrib/binutils/gas/config/tc-v850.c
+++ b/contrib/binutils/gas/config/tc-v850.c
@@ -1,5 +1,5 @@
/* tc-v850.c -- Assembler code for the NEC V850
- 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.
@@ -20,16 +20,12 @@
Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/v850.h"
#include "dwarf2dbg.h"
-#define AREA_ZDA 0
-#define AREA_SDA 1
-#define AREA_TDA 2
-
/* Sign-extend a 16-bit number. */
#define SEXT16(x) ((((x) & 0xffff) ^ (~0x7fff)) + 0x8000)
@@ -82,20 +78,6 @@ const relax_typeS md_relax_table[] = {
{0x1fffff, -0x200000, 4, 0},
};
-static segT sdata_section = NULL;
-static segT tdata_section = NULL;
-static segT zdata_section = NULL;
-static segT sbss_section = NULL;
-static segT tbss_section = NULL;
-static segT zbss_section = NULL;
-static segT rosdata_section = NULL;
-static segT rozdata_section = NULL;
-static segT scommon_section = NULL;
-static segT tcommon_section = NULL;
-static segT zcommon_section = NULL;
-static segT call_table_data_section = NULL;
-static segT call_table_text_section = NULL;
-
/* Fixups. */
#define MAX_INSN_FIXUPS (5)
struct v850_fixup {
@@ -106,121 +88,108 @@ struct v850_fixup {
struct v850_fixup fixups[MAX_INSN_FIXUPS];
static int fc;
-
-void
-v850_sdata (int ignore ATTRIBUTE_UNUSED)
-{
- obj_elf_section_change_hook ();
-
- subseg_set (sdata_section, (subsegT) get_absolute_expression ());
-
- demand_empty_rest_of_line ();
-}
-
-void
-v850_tdata (int ignore ATTRIBUTE_UNUSED)
-{
- obj_elf_section_change_hook ();
-
- subseg_set (tdata_section, (subsegT) get_absolute_expression ());
-
- demand_empty_rest_of_line ();
-}
-
-void
-v850_zdata (int ignore ATTRIBUTE_UNUSED)
-{
- obj_elf_section_change_hook ();
-
- subseg_set (zdata_section, (subsegT) get_absolute_expression ());
-
- demand_empty_rest_of_line ();
-}
-void
-v850_sbss (int ignore ATTRIBUTE_UNUSED)
+struct v850_seg_entry
{
- obj_elf_section_change_hook ();
-
- subseg_set (sbss_section, (subsegT) get_absolute_expression ());
-
- demand_empty_rest_of_line ();
-}
+ segT s;
+ const char *name;
+ flagword flags;
+};
-void
-v850_tbss (int ignore ATTRIBUTE_UNUSED)
+struct v850_seg_entry v850_seg_table[] =
{
- obj_elf_section_change_hook ();
-
- subseg_set (tbss_section, (subsegT) get_absolute_expression ());
-
- demand_empty_rest_of_line ();
-}
-
-void
-v850_zbss (int ignore ATTRIBUTE_UNUSED)
-{
- obj_elf_section_change_hook ();
-
- subseg_set (zbss_section, (subsegT) get_absolute_expression ());
+ { NULL, ".sdata",
+ SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA | SEC_HAS_CONTENTS
+ | SEC_SMALL_DATA },
+ { NULL, ".tdata",
+ SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA | SEC_HAS_CONTENTS },
+ { NULL, ".zdata",
+ SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA | SEC_HAS_CONTENTS },
+ { NULL, ".sbss",
+ SEC_ALLOC | SEC_SMALL_DATA },
+ { NULL, ".tbss",
+ SEC_ALLOC },
+ { NULL, ".zbss",
+ SEC_ALLOC},
+ { NULL, ".rosdata",
+ SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY | SEC_DATA
+ | SEC_HAS_CONTENTS | SEC_SMALL_DATA },
+ { NULL, ".rozdata",
+ SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY | SEC_DATA
+ | SEC_HAS_CONTENTS },
+ { NULL, ".scommon",
+ SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA | SEC_HAS_CONTENTS
+ | SEC_SMALL_DATA | SEC_IS_COMMON },
+ { NULL, ".tcommon",
+ SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA | SEC_HAS_CONTENTS
+ | SEC_IS_COMMON },
+ { NULL, ".zcommon",
+ SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA | SEC_HAS_CONTENTS
+ | SEC_IS_COMMON },
+ { NULL, ".call_table_data",
+ SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA | SEC_HAS_CONTENTS },
+ { NULL, ".call_table_text",
+ SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY | SEC_CODE
+ | SEC_HAS_CONTENTS},
+ { NULL, ".bss",
+ SEC_ALLOC }
+};
- demand_empty_rest_of_line ();
-}
+#define SDATA_SECTION 0
+#define TDATA_SECTION 1
+#define ZDATA_SECTION 2
+#define SBSS_SECTION 3
+#define TBSS_SECTION 4
+#define ZBSS_SECTION 5
+#define ROSDATA_SECTION 6
+#define ROZDATA_SECTION 7
+#define SCOMMON_SECTION 8
+#define TCOMMON_SECTION 9
+#define ZCOMMON_SECTION 10
+#define CALL_TABLE_DATA_SECTION 11
+#define CALL_TABLE_TEXT_SECTION 12
+#define BSS_SECTION 13
+
+static void do_v850_seg PARAMS ((int, subsegT));
-void
-v850_rosdata (int ignore ATTRIBUTE_UNUSED)
+static void
+do_v850_seg (i, sub)
+ int i;
+ subsegT sub;
{
- obj_elf_section_change_hook ();
+ struct v850_seg_entry *seg = v850_seg_table + i;
- subseg_set (rosdata_section, (subsegT) get_absolute_expression ());
-
- demand_empty_rest_of_line ();
-}
-
-void
-v850_rozdata (int ignore ATTRIBUTE_UNUSED)
-{
obj_elf_section_change_hook ();
-
- subseg_set (rozdata_section, (subsegT) get_absolute_expression ());
-
- demand_empty_rest_of_line ();
+ if (seg->s != NULL)
+ {
+ subseg_set (seg->s, sub);
+ }
+ else
+ {
+ seg->s = subseg_new (seg->name, sub);
+ bfd_set_section_flags (stdoutput, seg->s, seg->flags);
+ if ((seg->flags & SEC_LOAD) == 0)
+ seg_info (seg->s)->bss = 1;
+ }
}
-void
-v850_call_table_data (int ignore ATTRIBUTE_UNUSED)
-{
- obj_elf_section_change_hook ();
-
- subseg_set (call_table_data_section, (subsegT) get_absolute_expression ());
+static void v850_seg PARAMS ((int i));
- demand_empty_rest_of_line ();
-}
-
-void
-v850_call_table_text (int ignore ATTRIBUTE_UNUSED)
+static void
+v850_seg (i)
+ int i;
{
- obj_elf_section_change_hook ();
-
- subseg_set (call_table_text_section, (subsegT) get_absolute_expression ());
+ subsegT sub = get_absolute_expression ();
+ do_v850_seg (i, sub);
demand_empty_rest_of_line ();
}
-void
-v850_bss (int ignore ATTRIBUTE_UNUSED)
-{
- register int temp = get_absolute_expression ();
-
- obj_elf_section_change_hook ();
-
- subseg_set (bss_section, (subsegT) temp);
+static void v850_offset PARAMS ((int));
- demand_empty_rest_of_line ();
-}
-
-void
-v850_offset (int ignore ATTRIBUTE_UNUSED)
+static void
+v850_offset (ignore)
+ int ignore ATTRIBUTE_UNUSED;
{
int temp = get_absolute_expression ();
@@ -234,6 +203,8 @@ v850_offset (int ignore ATTRIBUTE_UNUSED)
/* Copied from obj_elf_common() in gas/config/obj-elf.c. */
+static void v850_comm PARAMS ((int));
+
static void
v850_comm (area)
int area;
@@ -338,37 +309,16 @@ v850_comm (area)
switch (area)
{
- case AREA_SDA:
- if (sbss_section == NULL)
- {
- sbss_section = subseg_new (".sbss", 0);
-
- bfd_set_section_flags (stdoutput, sbss_section, applicable);
-
- seg_info (sbss_section)->bss = 1;
- }
+ case SCOMMON_SECTION:
+ do_v850_seg (SBSS_SECTION, 0);
break;
- case AREA_ZDA:
- if (zbss_section == NULL)
- {
- zbss_section = subseg_new (".zbss", 0);
-
- bfd_set_section_flags (stdoutput, sbss_section, applicable);
-
- seg_info (zbss_section)->bss = 1;
- }
+ case ZCOMMON_SECTION:
+ do_v850_seg (ZBSS_SECTION, 0);
break;
- case AREA_TDA:
- if (tbss_section == NULL)
- {
- tbss_section = subseg_new (".tbss", 0);
-
- bfd_set_section_flags (stdoutput, tbss_section, applicable);
-
- seg_info (tbss_section)->bss = 1;
- }
+ case TCOMMON_SECTION:
+ do_v850_seg (TBSS_SECTION, 0);
break;
}
@@ -388,47 +338,25 @@ v850_comm (area)
else
align = 0;
- switch (area)
- {
- case AREA_SDA:
- record_alignment (sbss_section, align);
- obj_elf_section_change_hook ();
- subseg_set (sbss_section, 0);
- break;
-
- case AREA_ZDA:
- record_alignment (zbss_section, align);
- obj_elf_section_change_hook ();
- subseg_set (zbss_section, 0);
- break;
-
- case AREA_TDA:
- record_alignment (tbss_section, align);
- obj_elf_section_change_hook ();
- subseg_set (tbss_section, 0);
- break;
-
- default:
- abort ();
- }
+ record_alignment (now_seg, align);
if (align)
frag_align (align, 0, 0);
switch (area)
{
- case AREA_SDA:
- if (S_GET_SEGMENT (symbolP) == sbss_section)
+ case SCOMMON_SECTION:
+ if (S_GET_SEGMENT (symbolP) == v850_seg_table[SBSS_SECTION].s)
symbol_get_frag (symbolP)->fr_symbol = 0;
break;
- case AREA_ZDA:
- if (S_GET_SEGMENT (symbolP) == zbss_section)
+ case ZCOMMON_SECTION:
+ if (S_GET_SEGMENT (symbolP) == v850_seg_table[ZBSS_SECTION].s)
symbol_get_frag (symbolP)->fr_symbol = 0;
break;
- case AREA_TDA:
- if (S_GET_SEGMENT (symbolP) == tbss_section)
+ case TCOMMON_SECTION:
+ if (S_GET_SEGMENT (symbolP) == v850_seg_table[TBSS_SECTION].s)
symbol_get_frag (symbolP)->fr_symbol = 0;
break;
@@ -444,16 +372,16 @@ v850_comm (area)
switch (area)
{
- case AREA_SDA:
- S_SET_SEGMENT (symbolP, sbss_section);
+ case SCOMMON_SECTION:
+ S_SET_SEGMENT (symbolP, v850_seg_table[SBSS_SECTION].s);
break;
- case AREA_ZDA:
- S_SET_SEGMENT (symbolP, zbss_section);
+ case ZCOMMON_SECTION:
+ S_SET_SEGMENT (symbolP, v850_seg_table[ZBSS_SECTION].s);
break;
- case AREA_TDA:
- S_SET_SEGMENT (symbolP, tbss_section);
+ case TCOMMON_SECTION:
+ S_SET_SEGMENT (symbolP, v850_seg_table[TBSS_SECTION].s);
break;
default:
@@ -473,54 +401,11 @@ v850_comm (area)
switch (area)
{
- case AREA_SDA:
- if (scommon_section == NULL)
- {
- flagword applicable =
- bfd_applicable_section_flags (stdoutput);
-
- scommon_section = subseg_new (".scommon", 0);
-
- bfd_set_section_flags (stdoutput, scommon_section,
- (applicable
- & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA
- | SEC_HAS_CONTENTS)) | SEC_IS_COMMON);
- }
- S_SET_SEGMENT (symbolP, scommon_section);
- break;
-
- case AREA_ZDA:
- if (zcommon_section == NULL)
- {
- flagword applicable =
- bfd_applicable_section_flags (stdoutput);
-
- zcommon_section = subseg_new (".zcommon", 0);
-
- bfd_set_section_flags (stdoutput, zcommon_section,
- (applicable
- & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA
- | SEC_HAS_CONTENTS)) | SEC_IS_COMMON);
- }
- S_SET_SEGMENT (symbolP, zcommon_section);
- break;
-
- case AREA_TDA:
- if (tcommon_section == NULL)
- {
- flagword applicable =
- bfd_applicable_section_flags (stdoutput);
-
- tcommon_section = subseg_new (".tcommon", 0);
-
- bfd_set_section_flags (stdoutput, tcommon_section,
- ((applicable
- & (SEC_ALLOC | SEC_LOAD
- | SEC_RELOC | SEC_DATA
- | SEC_HAS_CONTENTS))
- | SEC_IS_COMMON));
- }
- S_SET_SEGMENT (symbolP, tcommon_section);
+ case SCOMMON_SECTION:
+ case ZCOMMON_SECTION:
+ case TCOMMON_SECTION:
+ do_v850_seg (area, 0);
+ S_SET_SEGMENT (symbolP, v850_seg_table[area].s);
break;
default:
@@ -570,8 +455,11 @@ v850_comm (area)
}
}
-void
-set_machine (int number)
+static void set_machine PARAMS ((int));
+
+static void
+set_machine (number)
+ int number;
{
machine = number;
bfd_set_arch_mach (stdoutput, TARGET_ARCH, machine);
@@ -586,28 +474,28 @@ set_machine (int number)
/* The target specific pseudo-ops which we support. */
const pseudo_typeS md_pseudo_table[] = {
- {"sdata", v850_sdata, 0},
- {"tdata", v850_tdata, 0},
- {"zdata", v850_zdata, 0},
- {"sbss", v850_sbss, 0},
- {"tbss", v850_tbss, 0},
- {"zbss", v850_zbss, 0},
- {"rosdata", v850_rosdata, 0},
- {"rozdata", v850_rozdata, 0},
- {"bss", v850_bss, 0},
- {"offset", v850_offset, 0},
- {"word", cons, 4},
- {"zcomm", v850_comm, AREA_ZDA},
- {"scomm", v850_comm, AREA_SDA},
- {"tcomm", v850_comm, AREA_TDA},
- {"v850", set_machine, 0},
- {"call_table_data", v850_call_table_data, 0},
- {"call_table_text", v850_call_table_text, 0},
- {"v850e", set_machine, bfd_mach_v850e},
- {"v850ea", set_machine, bfd_mach_v850ea},
- {"file", dwarf2_directive_file, 0},
- {"loc", dwarf2_directive_loc, 0},
- { NULL, NULL, 0}
+ { "sdata", v850_seg, SDATA_SECTION },
+ { "tdata", v850_seg, TDATA_SECTION },
+ { "zdata", v850_seg, ZDATA_SECTION },
+ { "sbss", v850_seg, SBSS_SECTION },
+ { "tbss", v850_seg, TBSS_SECTION },
+ { "zbss", v850_seg, ZBSS_SECTION },
+ { "rosdata", v850_seg, ROSDATA_SECTION },
+ { "rozdata", v850_seg, ROZDATA_SECTION },
+ { "bss", v850_seg, BSS_SECTION },
+ { "offset", v850_offset, 0 },
+ { "word", cons, 4 },
+ { "zcomm", v850_comm, ZCOMMON_SECTION },
+ { "scomm", v850_comm, SCOMMON_SECTION },
+ { "tcomm", v850_comm, TCOMMON_SECTION },
+ { "v850", set_machine, 0 },
+ { "call_table_data", v850_seg, CALL_TABLE_DATA_SECTION },
+ { "call_table_text", v850_seg, CALL_TABLE_TEXT_SECTION },
+ { "v850e", set_machine, bfd_mach_v850e },
+ { "v850ea", set_machine, bfd_mach_v850ea },
+ { "file", dwarf2_directive_file, 0 },
+ { "loc", dwarf2_directive_loc, 0 },
+ { NULL, NULL, 0 }
};
/* Opcode hash table. */
@@ -716,6 +604,9 @@ static const struct reg_name cc_names[] = {
valid regiter name. Return the register number from the array on
success, or -1 on failure. */
+static int reg_name_search
+ PARAMS ((const struct reg_name *, int, const char *, boolean));
+
static int
reg_name_search (regs, regcount, name, accept_numbers)
const struct reg_name *regs;
@@ -770,12 +661,14 @@ reg_name_search (regs, regcount, name, accept_numbers)
*
* in: Input_line_pointer points to 1st char of operand.
*
- * out: A expressionS.
+ * out: An expressionS.
* The operand may have been a register: in this case, X_op == O_register,
* X_add_number is set to the register number, and truth is returned.
* Input_line_pointer->(next non-blank) char after operand, or is in
* its original state. */
+static boolean register_name PARAMS ((expressionS *));
+
static boolean
register_name (expressionP)
expressionS *expressionP;
@@ -825,12 +718,14 @@ register_name (expressionP)
* ACCEPT_LIST_NAMES is true iff the special names PS and SR may be
* accepted.
*
- * out: A expressionS structure in expressionP.
+ * out: An expressionS structure in expressionP.
* The operand may have been a register: in this case, X_op == O_register,
* X_add_number is set to the register number, and truth is returned.
* Input_line_pointer->(next non-blank) char after operand, or is in
* its original state. */
+static boolean system_register_name PARAMS ((expressionS *, boolean, boolean));
+
static boolean
system_register_name (expressionP, accept_numbers, accept_list_names)
expressionS *expressionP;
@@ -858,7 +753,7 @@ system_register_name (expressionP, accept_numbers, accept_list_names)
/* Reset input_line pointer. */
input_line_pointer = start;
- if (isdigit (*input_line_pointer))
+ if (ISDIGIT (*input_line_pointer))
{
reg_number = strtol (input_line_pointer, &input_line_pointer, 10);
@@ -906,12 +801,14 @@ system_register_name (expressionP, accept_numbers, accept_list_names)
*
* in: INPUT_LINE_POINTER points to 1st char of operand.
*
- * out: A expressionS.
+ * out: An expressionS.
* The operand may have been a register: in this case, X_op == O_register,
* X_add_number is set to the register number, and truth is returned.
* Input_line_pointer->(next non-blank) char after operand, or is in
* its original state. */
+static boolean cc_name PARAMS ((expressionS *));
+
static boolean
cc_name (expressionP)
expressionS *expressionP;
@@ -951,8 +848,10 @@ cc_name (expressionP)
}
}
+static void skip_white_space PARAMS ((void));
+
static void
-skip_white_space (void)
+skip_white_space ()
{
while (*input_line_pointer == ' '
|| *input_line_pointer == '\t')
@@ -984,6 +883,9 @@ skip_white_space (void)
* and so on upwards. System registers are considered to be very
* high numbers. */
+static char *parse_register_list
+ PARAMS ((unsigned long *, const struct v850_operand *));
+
static char *
parse_register_list (insn, operand)
unsigned long *insn;
@@ -1374,7 +1276,6 @@ md_begin ()
{
char *prev_name = "";
register const struct v850_opcode *op;
- flagword applicable;
if (strncmp (TARGET_CPU, "v850ea", 6) == 0)
{
@@ -1423,26 +1324,16 @@ md_begin ()
op++;
}
+ v850_seg_table[BSS_SECTION].s = bss_section;
bfd_set_arch_mach (stdoutput, TARGET_ARCH, machine);
-
- applicable = bfd_applicable_section_flags (stdoutput);
-
- call_table_data_section = subseg_new (".call_table_data", 0);
- bfd_set_section_flags (stdoutput, call_table_data_section,
- applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC
- | SEC_DATA | SEC_HAS_CONTENTS));
-
- call_table_text_section = subseg_new (".call_table_text", 0);
- bfd_set_section_flags (stdoutput, call_table_text_section,
- applicable & (SEC_ALLOC | SEC_LOAD | SEC_READONLY
- | SEC_CODE));
-
- /* Restore text section as the current default. */
- subseg_set (text_section, 0);
}
+static bfd_reloc_code_real_type handle_ctoff
+ PARAMS ((const struct v850_operand *));
+
static bfd_reloc_code_real_type
-handle_ctoff (const struct v850_operand *operand)
+handle_ctoff (operand)
+ const struct v850_operand *operand;
{
if (operand == NULL)
return BFD_RELOC_V850_CALLT_16_16_OFFSET;
@@ -1457,8 +1348,12 @@ handle_ctoff (const struct v850_operand *operand)
return BFD_RELOC_V850_CALLT_6_7_OFFSET;
}
+static bfd_reloc_code_real_type handle_sdaoff
+ PARAMS ((const struct v850_operand *));
+
static bfd_reloc_code_real_type
-handle_sdaoff (const struct v850_operand *operand)
+handle_sdaoff (operand)
+ const struct v850_operand *operand;
{
if (operand == NULL)
return BFD_RELOC_V850_SDA_16_16_OFFSET;
@@ -1479,8 +1374,12 @@ handle_sdaoff (const struct v850_operand *operand)
return BFD_RELOC_V850_SDA_16_16_OFFSET;
}
+static bfd_reloc_code_real_type handle_zdaoff
+ PARAMS ((const struct v850_operand *));
+
static bfd_reloc_code_real_type
-handle_zdaoff (const struct v850_operand *operand)
+handle_zdaoff (operand)
+ const struct v850_operand *operand;
{
if (operand == NULL)
return BFD_RELOC_V850_ZDA_16_16_OFFSET;
@@ -1502,8 +1401,12 @@ handle_zdaoff (const struct v850_operand *operand)
return BFD_RELOC_V850_ZDA_16_16_OFFSET;
}
+static bfd_reloc_code_real_type handle_tdaoff
+ PARAMS ((const struct v850_operand *));
+
static bfd_reloc_code_real_type
-handle_tdaoff (const struct v850_operand *operand)
+handle_tdaoff (operand)
+ const struct v850_operand *operand;
{
if (operand == NULL)
/* Data item, not an instruction. */
@@ -1541,8 +1444,12 @@ handle_tdaoff (const struct v850_operand *operand)
in the v850_operands[] array (defined in opcodes/v850-opc.c)
matching the hard coded values contained herein. */
+static bfd_reloc_code_real_type v850_reloc_prefix
+ PARAMS ((const struct v850_operand *));
+
static bfd_reloc_code_real_type
-v850_reloc_prefix (const struct v850_operand *operand)
+v850_reloc_prefix (operand)
+ const struct v850_operand *operand;
{
boolean paren_skipped = false;
@@ -1578,6 +1485,10 @@ v850_reloc_prefix (const struct v850_operand *operand)
/* Insert an operand value into an instruction. */
+static unsigned long v850_insert_operand
+ PARAMS ((unsigned long, const struct v850_operand *, offsetT, char *,
+ unsigned int, char *));
+
static unsigned long
v850_insert_operand (insn, operand, val, file, line, str)
unsigned long insn;
@@ -1711,7 +1622,7 @@ md_assemble (str)
strncpy (copy_of_instruction, str, sizeof (copy_of_instruction) - 1);
/* Get the opcode. */
- for (s = str; *s != '\0' && ! isspace (*s); s++)
+ for (s = str; *s != '\0' && ! ISSPACE (*s); s++)
continue;
if (*s != '\0')
@@ -1728,7 +1639,7 @@ md_assemble (str)
}
str = s;
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
start_of_operands = str;
@@ -2141,7 +2052,7 @@ md_assemble (str)
break;
}
- while (isspace (*str))
+ while (ISSPACE (*str))
++str;
if (*str != '\0')
@@ -2210,7 +2121,7 @@ md_assemble (str)
BFD_RELOC_UNUSED plus the operand index. This lets us easily
handle fixups for any operand type, although that is admittedly
not a very exciting feature. We pick a BFD reloc type in
- md_apply_fix. */
+ md_apply_fix3. */
for (i = 0; i < fc; i++)
{
const struct v850_operand *operand;
@@ -2340,52 +2251,51 @@ v850_pcrel_from_section (fixp, section)
return fixp->fx_frag->fr_address + fixp->fx_where;
}
-int
-md_apply_fix3 (fixp, valuep, seg)
- fixS *fixp;
- valueT *valuep;
+void
+md_apply_fix3 (fixP, valueP, seg)
+ fixS *fixP;
+ valueT *valueP;
segT seg ATTRIBUTE_UNUSED;
{
- valueT value;
+ valueT value = * valueP;
char *where;
- if (fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT
- || fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
+ if (fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT
+ || fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
{
- fixp->fx_done = 0;
- return 1;
+ fixP->fx_done = 0;
+ return;
}
- if (fixp->fx_addsy == (symbolS *) NULL)
- {
- value = *valuep;
- fixp->fx_done = 1;
- }
- else if (fixp->fx_pcrel)
- value = *valuep;
+ if (fixP->fx_addsy == (symbolS *) NULL)
+ fixP->fx_done = 1;
+
+ else if (fixP->fx_pcrel)
+ ;
+
else
{
- value = fixp->fx_offset;
- if (fixp->fx_subsy != (symbolS *) NULL)
+ value = fixP->fx_offset;
+ if (fixP->fx_subsy != (symbolS *) NULL)
{
- if (S_GET_SEGMENT (fixp->fx_subsy) == absolute_section)
- value -= S_GET_VALUE (fixp->fx_subsy);
+ if (S_GET_SEGMENT (fixP->fx_subsy) == absolute_section)
+ value -= S_GET_VALUE (fixP->fx_subsy);
else
{
/* We don't actually support subtracting a symbol. */
- as_bad_where (fixp->fx_file, fixp->fx_line,
+ as_bad_where (fixP->fx_file, fixP->fx_line,
_("expression too complex"));
}
}
}
- if ((int) fixp->fx_r_type >= (int) BFD_RELOC_UNUSED)
+ if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
{
int opindex;
const struct v850_operand *operand;
unsigned long insn;
- opindex = (int) fixp->fx_r_type - (int) BFD_RELOC_UNUSED;
+ opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED;
operand = &v850_operands[opindex];
/* Fetch the instruction, insert the fully resolved operand
@@ -2393,53 +2303,50 @@ md_apply_fix3 (fixp, valuep, seg)
Note the instruction has been stored in little endian
format! */
- where = fixp->fx_frag->fr_literal + fixp->fx_where;
+ where = fixP->fx_frag->fr_literal + fixP->fx_where;
insn = bfd_getl32 ((unsigned char *) where);
insn = v850_insert_operand (insn, operand, (offsetT) value,
- fixp->fx_file, fixp->fx_line, NULL);
+ fixP->fx_file, fixP->fx_line, NULL);
bfd_putl32 ((bfd_vma) insn, (unsigned char *) where);
- if (fixp->fx_done)
- {
- /* Nothing else to do here. */
- return 1;
- }
+ if (fixP->fx_done)
+ /* Nothing else to do here. */
+ return;
/* Determine a BFD reloc value based on the operand information.
We are only prepared to turn a few of the operands into relocs. */
if (operand->bits == 22)
- fixp->fx_r_type = BFD_RELOC_V850_22_PCREL;
+ fixP->fx_r_type = BFD_RELOC_V850_22_PCREL;
else if (operand->bits == 9)
- fixp->fx_r_type = BFD_RELOC_V850_9_PCREL;
+ fixP->fx_r_type = BFD_RELOC_V850_9_PCREL;
else
{
#if 0
fprintf (stderr, "bits: %d, insn: %x\n", operand->bits, insn);
#endif
- as_bad_where (fixp->fx_file, fixp->fx_line,
+ as_bad_where (fixP->fx_file, fixP->fx_line,
_("unresolved expression that must be resolved"));
- fixp->fx_done = 1;
- return 1;
+ fixP->fx_done = 1;
+ return;
}
}
- else if (fixp->fx_done)
+ else if (fixP->fx_done)
{
/* We still have to insert the value into memory! */
- where = fixp->fx_frag->fr_literal + fixp->fx_where;
+ where = fixP->fx_frag->fr_literal + fixP->fx_where;
- if (fixp->fx_size == 1)
+ if (fixP->fx_size == 1)
*where = value & 0xff;
- else if (fixp->fx_size == 2)
+ else if (fixP->fx_size == 2)
bfd_putl16 (value & 0xffff, (unsigned char *) where);
- else if (fixp->fx_size == 4)
+ else if (fixP->fx_size == 4)
bfd_putl32 (value, (unsigned char *) where);
}
- fixp->fx_addnumber = value;
- return 1;
+ fixP->fx_addnumber = value;
}
/* Parse a cons expression. We have to handle hi(), lo(), etc
diff --git a/contrib/binutils/gas/config/tc-v850.h b/contrib/binutils/gas/config/tc-v850.h
index 7ce0491..3de777c 100644
--- a/contrib/binutils/gas/config/tc-v850.h
+++ b/contrib/binutils/gas/config/tc-v850.h
@@ -1,5 +1,5 @@
/* tc-v850.h -- Header file for tc-v850.c.
- Copyright 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+ Copyright 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -34,11 +34,13 @@
/* The target BFD format. */
#define TARGET_FORMAT "elf32-v850"
-#define MD_APPLY_FIX3
#define md_operand(x)
#define obj_fix_adjustable(fixP) v850_fix_adjustable(fixP)
+extern boolean v850_fix_adjustable PARAMS ((struct fix *));
+
#define TC_FORCE_RELOCATION(fixp) v850_force_relocation(fixp)
+extern int v850_force_relocation PARAMS ((struct fix *));
#ifdef OBJ_ELF
/* This arranges for gas/write.c to not apply a relocation if
@@ -46,12 +48,10 @@
#define TC_FIX_ADJUSTABLE(fixP) obj_fix_adjustable (fixP)
#endif
-extern int v850_force_relocation PARAMS ((struct fix *));
-
/* Permit temporary numeric labels. */
#define LOCAL_LABELS_FB 1
-#define DIFF_EXPR_OK /* foo-. gets turned into PC relative relocs */
+#define DIFF_EXPR_OK /* foo-. gets turned into PC relative relocs. */
/* We don't need to handle .word strangely. */
#define WORKING_DOT_WORD
@@ -61,9 +61,13 @@ extern int v850_force_relocation PARAMS ((struct fix *));
/* We need to handle lo(), hi(), etc etc in .hword, .word, etc
directives, so we have to parse "cons" expressions ourselves. */
#define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) parse_cons_expression_v850 (EXP)
+extern void parse_cons_expression_v850 PARAMS ((expressionS *));
+
#define TC_CONS_FIX_NEW cons_fix_new_v850
-extern const struct relax_type md_relax_table[];
+extern void cons_fix_new_v850 PARAMS ((fragS *, int, int, expressionS *));
+
#define TC_GENERIC_RELAX_TABLE md_relax_table
+extern const struct relax_type md_relax_table[];
/* This section must be in the small data area (pointed to by GP). */
#define SHF_V850_GPREL 0x10000000
@@ -88,6 +92,6 @@ extern const struct relax_type md_relax_table[];
{ ".call_table_text", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_EXECINSTR },
#define MD_PCREL_FROM_SECTION(fixP,section) v850_pcrel_from_section (fixP, section)
-extern long v850_pcrel_from_section ();
+extern long v850_pcrel_from_section PARAMS ((struct fix *, asection *));
#define DWARF2_LINE_MIN_INSN_LENGTH 2
diff --git a/contrib/binutils/gas/config/tc-z8k.c b/contrib/binutils/gas/config/tc-z8k.c
index 73666ca..f5b05a6 100644
--- a/contrib/binutils/gas/config/tc-z8k.c
+++ b/contrib/binutils/gas/config/tc-z8k.c
@@ -1,5 +1,5 @@
/* tc-z8k.c -- Assemble code for the Zilog Z800n
- Copyright 1992, 1993, 1994, 1995, 1996, 1998, 2000
+ Copyright 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -24,11 +24,10 @@
#define DEFINE_TABLE
#include <stdio.h>
-#include "opcodes/z8k-opc.h"
-
#include "as.h"
#include "bfd.h"
-#include <ctype.h>
+#include "safe-ctype.h"
+#include "opcodes/z8k-opc.h"
const char comment_chars[] = "!";
const char line_comment_chars[] = "#";
@@ -70,9 +69,9 @@ int
tohex (c)
int c;
{
- if (isdigit (c))
+ if (ISDIGIT (c))
return c - '0';
- if (islower (c))
+ if (ISLOWER (c))
return c - 'a' + 10;
return c - 'A' + 10;
}
@@ -221,7 +220,7 @@ whatreg (reg, src)
int *reg;
char *src;
{
- if (isdigit (src[1]))
+ if (ISDIGIT (src[1]))
{
*reg = (src[0] - '0') * 10 + src[1] - '0';
return src + 2;
@@ -259,7 +258,7 @@ parse_reg (src, mode, reg)
char *res = 0;
char regno;
- if (src[0] == 's' && src[1] == 'p')
+ if (src[0] == 's' && src[1] == 'p' && (src[2] == 0 || src[2] == ','))
{
if (segmented_mode)
{
@@ -277,6 +276,8 @@ parse_reg (src, mode, reg)
{
if (src[1] == 'r')
{
+ if (src[2] < '0' || src[2] > '9')
+ return res; /* Assume no register name but a label starting with 'rr'. */
*mode = CLASS_REG_LONG;
res = whatreg (reg, src + 2);
regno = *reg;
@@ -285,6 +286,8 @@ parse_reg (src, mode, reg)
}
else if (src[1] == 'h')
{
+ if (src[2] < '0' || src[2] > '9')
+ return res; /* Assume no register name but a label starting with 'rh'. */
*mode = CLASS_REG_BYTE;
res = whatreg (reg, src + 2);
regno = *reg;
@@ -293,6 +296,8 @@ parse_reg (src, mode, reg)
}
else if (src[1] == 'l')
{
+ if (src[2] < '0' || src[2] > '9')
+ return res; /* Assume no register name but a label starting with 'rl'. */
*mode = CLASS_REG_BYTE;
res = whatreg (reg, src + 2);
regno = *reg;
@@ -302,6 +307,8 @@ parse_reg (src, mode, reg)
}
else if (src[1] == 'q')
{
+ if (src[2] < '0' || src[2] > '9')
+ return res; /* Assume no register name but a label starting with 'rq'. */
*mode = CLASS_REG_QUAD;
res = whatreg (reg, src + 2);
regno = *reg;
@@ -310,6 +317,8 @@ parse_reg (src, mode, reg)
}
else
{
+ if (src[1] < '0' || src[1] > '9')
+ return res; /* Assume no register name but a label starting with 'r'. */
*mode = CLASS_REG_WORD;
res = whatreg (reg, src + 1);
regno = *reg;
@@ -1396,10 +1405,12 @@ md_section_align (seg, size)
}
void
-md_apply_fix (fixP, val)
+md_apply_fix3 (fixP, valP, segment)
fixS *fixP;
- long val;
+ valueT * valP;
+ segT segment ATTRIBUTE_UNUSED;
{
+ long val = * (long *) valP;
char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
switch (fixP->fx_r_type)
@@ -1455,6 +1466,9 @@ md_apply_fix (fixP, val)
default:
abort ();
}
+
+ if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
+ fixP->fx_done = 1;
}
int
diff --git a/contrib/binutils/gas/dep-in.sed b/contrib/binutils/gas/dep-in.sed
index fd1be2c..7137574 100644
--- a/contrib/binutils/gas/dep-in.sed
+++ b/contrib/binutils/gas/dep-in.sed
@@ -4,9 +4,12 @@
s! \.\./! !g
s!@INCDIR@!$(INCDIR)!g
+s!@TOPDIR@/include!$(INCDIR)!g
s!@BFDDIR@!$(BFDDIR)!g
+s!@TOPDIR@/bfd!$(BFDDIR)!g
s!@SRCDIR@/config!$(srcdir)/config!g
s!@SRCDIR@/\.\./opcodes!$(srcdir)/../opcodes!g
+s!@TOPDIR@/opcodes!$(srcdir)/../opcodes!g
s!@SRCDIR@/!!g
s! \$(INCDIR)/ansidecl\.h!!g
s! \$(INCDIR)/fopen-same\.h!!g
diff --git a/contrib/binutils/gas/doc/Makefile.in b/contrib/binutils/gas/doc/Makefile.in
index 58e08e6..d87c923 100644
--- a/contrib/binutils/gas/doc/Makefile.in
+++ b/contrib/binutils/gas/doc/Makefile.in
@@ -1,6 +1,6 @@
-# Makefile.in generated automatically by automake 1.4 from Makefile.am
+# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
-# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -281,7 +281,7 @@ uninstall-info:
else ii=; fi; \
list='$(INFO_DEPS)'; \
for file in $$list; do \
- test -z "$ii" \
+ test -z "$$ii" \
|| install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \
done
@$(NORMAL_UNINSTALL)
diff --git a/contrib/binutils/gas/doc/c-sh.texi b/contrib/binutils/gas/doc/c-sh.texi
index e20f554..df31844 100644
--- a/contrib/binutils/gas/doc/c-sh.texi
+++ b/contrib/binutils/gas/doc/c-sh.texi
@@ -1,4 +1,5 @@
-@c Copyright (C) 1991, 92, 93, 94, 95, 1997 Free Software Foundation, Inc.
+@c Copyright 1991, 1992, 1993, 1994, 1995, 1997, 2001
+@c Free Software Foundation, Inc.
@c This is part of the GAS manual.
@c For copying conditions, see the file as.texinfo.
@page
@@ -17,11 +18,35 @@
@node SH Options
@section Options
-@cindex SH options (none)
-@cindex options, SH (none)
-@code{@value{AS}} has no additional command-line options for the Hitachi
+@cindex SH options
+@cindex options, SH
+@code{@value{AS}} has following command-line options for the Hitachi
SH family.
+@table @code
+@kindex -little
+@kindex -big
+@kindex -relax
+@kindex -small
+@kindex -dsp
+
+@item -little
+Generate little endian code.
+
+@item -big
+Generate big endian code.
+
+@item -relax
+Alter jump instructions for long displacements.
+
+@item -small
+Align sections to 4 byte boundaries, not 16.
+
+@item -dsp
+Enable sh-dsp insns, and disable sh3e / sh4 insns.
+
+@end table
+
@node SH Syntax
@section Syntax
diff --git a/contrib/binutils/gas/write.c b/contrib/binutils/gas/write.c
index 9b20f90..f4dc2ae 100644
--- a/contrib/binutils/gas/write.c
+++ b/contrib/binutils/gas/write.c
@@ -2923,7 +2923,7 @@ number_to_chars_bigendian (buf, val, n)
valueT val;
int n;
{
- if ((size_t) n > sizeof (val) || n <= 0)
+ if (n <= 0)
abort ();
while (n--)
{
@@ -2938,7 +2938,7 @@ number_to_chars_littleendian (buf, val, n)
valueT val;
int n;
{
- if ((size_t) n > sizeof (val) || n <= 0)
+ if (n <= 0)
abort ();
while (n--)
{
diff --git a/contrib/binutils/include/opcode/mips.h b/contrib/binutils/include/opcode/mips.h
index 68fe57a..1469e10 100644
--- a/contrib/binutils/include/opcode/mips.h
+++ b/contrib/binutils/include/opcode/mips.h
@@ -1,5 +1,6 @@
/* mips.h. Mips opcode list for GDB, the GNU debugger.
- Copyright 1993, 94, 95, 96, 1997 Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+ Free Software Foundation, Inc.
Contributed by Ralph Campbell and OSF
Commented and modified by Ian Lance Taylor, Cygnus Support
@@ -30,9 +31,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
i = (i &~ (OP_MASK_X << OP_SH_X)) | (j << OP_SH_X)
Make sure you use fields that are appropriate for the instruction,
- of course.
+ of course.
- The 'i' format uses OP, RS, RT and IMMEDIATE.
+ The 'i' format uses OP, RS, RT and IMMEDIATE.
The 'j' format uses OP and TARGET.
@@ -48,9 +49,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
breakpoint instruction are not defined; Kane says the breakpoint
code field in BREAK is 20 bits; yet MIPS assemblers and debuggers
only use ten bits). An optional two-operand form of break/sdbbp
- allows the lower ten bits to be set too.
+ allows the lower ten bits to be set too, and MIPS32 and later
+ architectures allow 20 bits to be set with a signal operand
+ (using CODE20).
- The syscall instruction uses SYSCALL.
+ The syscall instruction uses CODE20.
The general coprocessor instructions use COPZ. */
@@ -82,8 +85,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
#define OP_SH_PREFX 11
#define OP_MASK_CCC 0x7
#define OP_SH_CCC 8
-#define OP_MASK_SYSCALL 0xfffff
-#define OP_SH_SYSCALL 6
+#define OP_MASK_CODE20 0xfffff /* 20 bit syscall/breakpoint code. */
+#define OP_SH_CODE20 6
#define OP_MASK_SHAMT 0x1f
#define OP_SH_SHAMT 6
#define OP_MASK_FD 0x1f
@@ -100,17 +103,17 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
#define OP_SH_FUNCT 0
#define OP_MASK_SPEC 0x3f
#define OP_SH_SPEC 0
-#define OP_SH_LOCC 8 /* FP condition code */
-#define OP_SH_HICC 18 /* FP condition code */
+#define OP_SH_LOCC 8 /* FP condition code. */
+#define OP_SH_HICC 18 /* FP condition code. */
#define OP_MASK_CC 0x7
-#define OP_SH_COP1NORM 25 /* Normal COP1 encoding */
-#define OP_MASK_COP1NORM 0x1 /* a single bit */
-#define OP_SH_COP1SPEC 21 /* COP1 encodings */
+#define OP_SH_COP1NORM 25 /* Normal COP1 encoding. */
+#define OP_MASK_COP1NORM 0x1 /* a single bit. */
+#define OP_SH_COP1SPEC 21 /* COP1 encodings. */
#define OP_MASK_COP1SPEC 0xf
#define OP_MASK_COP1SCLR 0x4
#define OP_MASK_COP1CMP 0x3
#define OP_SH_COP1CMP 4
-#define OP_SH_FORMAT 21 /* FP short format field */
+#define OP_SH_FORMAT 21 /* FP short format field. */
#define OP_MASK_FORMAT 0x7
#define OP_SH_TRUE 16
#define OP_MASK_TRUE 0x1
@@ -120,12 +123,16 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
#define OP_MASK_UNSIGNED 0x1
#define OP_SH_HINT 16
#define OP_MASK_HINT 0x1f
-#define OP_SH_MMI 0 /* Multimedia (parallel) op */
-#define OP_MASK_MMI 0x3f
+#define OP_SH_MMI 0 /* Multimedia (parallel) op. */
+#define OP_MASK_MMI 0x3f
#define OP_SH_MMISUB 6
#define OP_MASK_MMISUB 0x1f
-#define OP_MASK_PERFREG 0x1f /* Performance monitoring */
+#define OP_MASK_PERFREG 0x1f /* Performance monitoring. */
#define OP_SH_PERFREG 1
+#define OP_SH_SEL 0 /* Coprocessor select field. */
+#define OP_MASK_SEL 0x7 /* The sel field of mfcZ and mtcZ. */
+#define OP_SH_CODE19 6 /* 19 bit wait code. */
+#define OP_MASK_CODE19 0x7ffff
/* This structure holds information for a particular instruction. */
@@ -181,8 +188,11 @@ struct mips_opcode
"u" 16 bit upper 16 bits of address (OP_*_IMMEDIATE)
"v" 5 bit same register used as both source and destination (OP_*_RS)
"w" 5 bit same register used as both target and destination (OP_*_RT)
+ "U" 5 bit same destination register in both OP_*_RD and OP_*_RT
+ (used by clo and clz)
"C" 25 bit coprocessor function code (OP_*_COPZ)
- "B" 20 bit syscall function code (OP_*_SYSCALL)
+ "B" 20 bit syscall/breakpoint function code (OP_*_CODE20)
+ "J" 19 bit wait function code (OP_*_CODE19)
"x" accept and ignore register name
"z" must be zero register
@@ -199,6 +209,7 @@ struct mips_opcode
Coprocessor instructions:
"E" 5 bit target register (OP_*_RT)
"G" 5 bit destination register (OP_*_RD)
+ "H" 3 bit sel field for (d)mtc* and (d)mfc* (OP_*_SEL)
"P" 5 bit performance-monitor register (OP_*_PERFREG)
Macro instructions:
@@ -215,7 +226,7 @@ struct mips_opcode
Characters used so far, for quick reference when adding more:
"<>(),"
- "ABCDEFGILMNSTRVW"
+ "ABCDEFGHIJLMNPRSTUVW"
"abcdfhijklopqrstuvwxz"
*/
@@ -291,281 +302,310 @@ struct mips_opcode
disassembler, and requires special treatment by the assembler. */
#define INSN_MACRO 0xffffffff
+/* Masks used to mark instructions to indicate which MIPS ISA level
+ they were introduced in. ISAs, as defined below, are logical
+ ORs of these bits, indicatingthat they support the instructions
+ defined at the given level. */
-
-
-
-/* MIPS ISA field--CPU level at which insn is supported. */
-#define INSN_ISA 0x0000000F
-/* An instruction which is not part of any basic MIPS ISA.
- (ie it is a chip specific instruction) */
-#define INSN_NO_ISA 0x00000000
-/* MIPS ISA 1 instruction. */
-#define INSN_ISA1 0x00000001
-/* MIPS ISA 2 instruction (R6000 or R4000). */
-#define INSN_ISA2 0x00000002
-/* MIPS ISA 3 instruction (R4000). */
-#define INSN_ISA3 0x00000003
-/* MIPS ISA 4 instruction (R8000). */
-#define INSN_ISA4 0x00000004
-#define INSN_ISA5 0x00000005
+#define INSN_ISA_MASK 0x00000fff
+#define INSN_ISA1 0x00000010
+#define INSN_ISA2 0x00000020
+#define INSN_ISA3 0x00000040
+#define INSN_ISA4 0x00000080
+#define INSN_ISA5 0x00000100
+#define INSN_ISA32 0x00000200
+#define INSN_ISA64 0x00000400
/* Chip specific instructions. These are bitmasks. */
+
/* MIPS R4650 instruction. */
-#define INSN_4650 0x00000010
+#define INSN_4650 0x00010000
/* LSI R4010 instruction. */
-#define INSN_4010 0x00000020
-/* NEC VR4100 instruction. */
-#define INSN_4100 0x00000040
+#define INSN_4010 0x00020000
+/* NEC VR4100 instruction. */
+#define INSN_4100 0x00040000
/* Toshiba R3900 instruction. */
-#define INSN_3900 0x00000080
-
-/* 32-bit code running on a ISA3+ CPU. */
-#define INSN_GP32 0x00001000
+#define INSN_3900 0x00080000
+/* MIPS R10000 instruction. */
+#define INSN_10000 0x00100000
+/* Broadcom SB-1 instruction. */
+#define INSN_SB1 0x00200000
+
+/* MIPS ISA defines, use instead of hardcoding ISA level. */
+
+#define ISA_UNKNOWN 0 /* Gas internal use. */
+#define ISA_MIPS1 (INSN_ISA1)
+#define ISA_MIPS2 (ISA_MIPS1 | INSN_ISA2)
+#define ISA_MIPS3 (ISA_MIPS2 | INSN_ISA3)
+#define ISA_MIPS4 (ISA_MIPS3 | INSN_ISA4)
+#define ISA_MIPS5 (ISA_MIPS4 | INSN_ISA5)
+#define ISA_MIPS32 (ISA_MIPS2 | INSN_ISA32)
+#define ISA_MIPS64 (ISA_MIPS5 | INSN_ISA32 | INSN_ISA64)
+
+/* CPU defines, use instead of hardcoding processor number. Keep this
+ in sync with bfd/archures.c in order for machine selection to work. */
+#define CPU_UNKNOWN 0 /* Gas internal use. */
+#define CPU_R2000 2000
+#define CPU_R3000 3000
+#define CPU_R3900 3900
+#define CPU_R4000 4000
+#define CPU_R4010 4010
+#define CPU_VR4100 4100
+#define CPU_R4111 4111
+#define CPU_R4300 4300
+#define CPU_R4400 4400
+#define CPU_R4600 4600
+#define CPU_R4650 4650
+#define CPU_R5000 5000
+#define CPU_R6000 6000
+#define CPU_R8000 8000
+#define CPU_R10000 10000
+#define CPU_R12000 12000
+#define CPU_MIPS16 16
+#define CPU_MIPS32 32
+#define CPU_MIPS5 5
+#define CPU_MIPS64 64
+#define CPU_SB1 12310201 /* octal 'SB', 01. */
/* Test for membership in an ISA including chip specific ISAs.
INSN is pointer to an element of the opcode table; ISA is the
specified ISA to test against; and CPU is the CPU specific ISA
- to test, or zero if no CPU specific ISA test is desired.
- The gp32 arg is set when you need to force 32-bit register usage on
- a machine with 64-bit registers; see the documentation under -mgp32
- in the MIPS gas docs. */
-
-#define OPCODE_IS_MEMBER(insn,isa,cpu,gp32) \
- ((((insn)->membership & INSN_ISA) != 0 \
- && ((insn)->membership & INSN_ISA) <= isa \
- && ((insn)->membership & INSN_GP32 ? gp32 : 1)) \
- || (cpu == 4650 \
- && ((insn)->membership & INSN_4650) != 0) \
- || (cpu == 4010 \
- && ((insn)->membership & INSN_4010) != 0) \
- || ((cpu == 4100 \
- || cpu == 4111 \
- ) \
- && ((insn)->membership & INSN_4100) != 0) \
- || (cpu == 3900 \
- && ((insn)->membership & INSN_3900) != 0))
+ to test, or zero if no CPU specific ISA test is desired. */
+
+#define OPCODE_IS_MEMBER(insn, isa, cpu) \
+ (((insn)->membership & isa) != 0 \
+ || (cpu == CPU_R4650 && ((insn)->membership & INSN_4650) != 0) \
+ || (cpu == CPU_R4010 && ((insn)->membership & INSN_4010) != 0) \
+ || ((cpu == CPU_VR4100 || cpu == CPU_R4111) \
+ && ((insn)->membership & INSN_4100) != 0) \
+ || (cpu == CPU_R3900 && ((insn)->membership & INSN_3900) != 0) \
+ || ((cpu == CPU_R10000 || cpu == CPU_R12000) \
+ && ((insn)->membership & INSN_10000) != 0) \
+ || (cpu == CPU_SB1 && ((insn)->membership & INSN_SB1) != 0) \
+ || 0) /* Please keep this term for easier source merging. */
/* This is a list of macro expanded instructions.
- *
- * _I appended means immediate
- * _A appended means address
- * _AB appended means address with base register
- * _D appended means 64 bit floating point constant
- * _S appended means 32 bit floating point constant
- */
-enum {
- M_ABS,
- M_ADD_I,
- M_ADDU_I,
- M_AND_I,
- M_BEQ,
- M_BEQ_I,
- M_BEQL_I,
- M_BGE,
- M_BGEL,
- M_BGE_I,
- M_BGEL_I,
- M_BGEU,
- M_BGEUL,
- M_BGEU_I,
- M_BGEUL_I,
- M_BGT,
- M_BGTL,
- M_BGT_I,
- M_BGTL_I,
- M_BGTU,
- M_BGTUL,
- M_BGTU_I,
- M_BGTUL_I,
- M_BLE,
- M_BLEL,
- M_BLE_I,
- M_BLEL_I,
- M_BLEU,
- M_BLEUL,
- M_BLEU_I,
- M_BLEUL_I,
- M_BLT,
- M_BLTL,
- M_BLT_I,
- M_BLTL_I,
- M_BLTU,
- M_BLTUL,
- M_BLTU_I,
- M_BLTUL_I,
- M_BNE,
- M_BNE_I,
- M_BNEL_I,
- M_DABS,
- M_DADD_I,
- M_DADDU_I,
- M_DDIV_3,
- M_DDIV_3I,
- M_DDIVU_3,
- M_DDIVU_3I,
- M_DIV_3,
- M_DIV_3I,
- M_DIVU_3,
- M_DIVU_3I,
- M_DLA_AB,
- M_DLI,
- M_DMUL,
- M_DMUL_I,
- M_DMULO,
- M_DMULO_I,
- M_DMULOU,
- M_DMULOU_I,
- M_DREM_3,
- M_DREM_3I,
- M_DREMU_3,
- M_DREMU_3I,
- M_DSUB_I,
- M_DSUBU_I,
- M_DSUBU_I_2,
- M_J_A,
- M_JAL_1,
- M_JAL_2,
- M_JAL_A,
- M_L_DOB,
- M_L_DAB,
- M_LA_AB,
- M_LB_A,
- M_LB_AB,
- M_LBU_A,
- M_LBU_AB,
- M_LD_A,
- M_LD_OB,
- M_LD_AB,
- M_LDC1_AB,
- M_LDC2_AB,
- M_LDC3_AB,
- M_LDL_AB,
- M_LDR_AB,
- M_LH_A,
- M_LH_AB,
- M_LHU_A,
- M_LHU_AB,
- M_LI,
- M_LI_D,
- M_LI_DD,
- M_LI_S,
- M_LI_SS,
- M_LL_AB,
- M_LLD_AB,
- M_LS_A,
- M_LW_A,
- M_LW_AB,
- M_LWC0_A,
- M_LWC0_AB,
- M_LWC1_A,
- M_LWC1_AB,
- M_LWC2_A,
- M_LWC2_AB,
- M_LWC3_A,
- M_LWC3_AB,
- M_LWL_A,
- M_LWL_AB,
- M_LWR_A,
- M_LWR_AB,
- M_LWU_AB,
- M_MUL,
- M_MUL_I,
- M_MULO,
- M_MULO_I,
- M_MULOU,
- M_MULOU_I,
- M_NOR_I,
- M_OR_I,
- M_REM_3,
- M_REM_3I,
- M_REMU_3,
- M_REMU_3I,
- M_ROL,
- M_ROL_I,
- M_ROR,
- M_ROR_I,
- M_S_DA,
- M_S_DOB,
- M_S_DAB,
- M_S_S,
- M_SC_AB,
- M_SCD_AB,
- M_SD_A,
- M_SD_OB,
- M_SD_AB,
- M_SDC1_AB,
- M_SDC2_AB,
- M_SDC3_AB,
- M_SDL_AB,
- M_SDR_AB,
- M_SEQ,
- M_SEQ_I,
- M_SGE,
- M_SGE_I,
- M_SGEU,
- M_SGEU_I,
- M_SGT,
- M_SGT_I,
- M_SGTU,
- M_SGTU_I,
- M_SLE,
- M_SLE_I,
- M_SLEU,
- M_SLEU_I,
- M_SLT_I,
- M_SLTU_I,
- M_SNE,
- M_SNE_I,
- M_SB_A,
- M_SB_AB,
- M_SH_A,
- M_SH_AB,
- M_SW_A,
- M_SW_AB,
- M_SWC0_A,
- M_SWC0_AB,
- M_SWC1_A,
- M_SWC1_AB,
- M_SWC2_A,
- M_SWC2_AB,
- M_SWC3_A,
- M_SWC3_AB,
- M_SWL_A,
- M_SWL_AB,
- M_SWR_A,
- M_SWR_AB,
- M_SUB_I,
- M_SUBU_I,
- M_SUBU_I_2,
- M_TEQ_I,
- M_TGE_I,
- M_TGEU_I,
- M_TLT_I,
- M_TLTU_I,
- M_TNE_I,
- M_TRUNCWD,
- M_TRUNCWS,
- M_ULD,
- M_ULD_A,
- M_ULH,
- M_ULH_A,
- M_ULHU,
- M_ULHU_A,
- M_ULW,
- M_ULW_A,
- M_USH,
- M_USH_A,
- M_USW,
- M_USW_A,
- M_USD,
- M_USD_A,
- M_XOR_I,
- M_COP0,
- M_COP1,
- M_COP2,
- M_COP3,
- M_NUM_MACROS
+
+ _I appended means immediate
+ _A appended means address
+ _AB appended means address with base register
+ _D appended means 64 bit floating point constant
+ _S appended means 32 bit floating point constant. */
+
+enum
+{
+ M_ABS,
+ M_ADD_I,
+ M_ADDU_I,
+ M_AND_I,
+ M_BEQ,
+ M_BEQ_I,
+ M_BEQL_I,
+ M_BGE,
+ M_BGEL,
+ M_BGE_I,
+ M_BGEL_I,
+ M_BGEU,
+ M_BGEUL,
+ M_BGEU_I,
+ M_BGEUL_I,
+ M_BGT,
+ M_BGTL,
+ M_BGT_I,
+ M_BGTL_I,
+ M_BGTU,
+ M_BGTUL,
+ M_BGTU_I,
+ M_BGTUL_I,
+ M_BLE,
+ M_BLEL,
+ M_BLE_I,
+ M_BLEL_I,
+ M_BLEU,
+ M_BLEUL,
+ M_BLEU_I,
+ M_BLEUL_I,
+ M_BLT,
+ M_BLTL,
+ M_BLT_I,
+ M_BLTL_I,
+ M_BLTU,
+ M_BLTUL,
+ M_BLTU_I,
+ M_BLTUL_I,
+ M_BNE,
+ M_BNE_I,
+ M_BNEL_I,
+ M_DABS,
+ M_DADD_I,
+ M_DADDU_I,
+ M_DDIV_3,
+ M_DDIV_3I,
+ M_DDIVU_3,
+ M_DDIVU_3I,
+ M_DIV_3,
+ M_DIV_3I,
+ M_DIVU_3,
+ M_DIVU_3I,
+ M_DLA_AB,
+ M_DLI,
+ M_DMUL,
+ M_DMUL_I,
+ M_DMULO,
+ M_DMULO_I,
+ M_DMULOU,
+ M_DMULOU_I,
+ M_DREM_3,
+ M_DREM_3I,
+ M_DREMU_3,
+ M_DREMU_3I,
+ M_DSUB_I,
+ M_DSUBU_I,
+ M_DSUBU_I_2,
+ M_J_A,
+ M_JAL_1,
+ M_JAL_2,
+ M_JAL_A,
+ M_L_DOB,
+ M_L_DAB,
+ M_LA_AB,
+ M_LB_A,
+ M_LB_AB,
+ M_LBU_A,
+ M_LBU_AB,
+ M_LD_A,
+ M_LD_OB,
+ M_LD_AB,
+ M_LDC1_AB,
+ M_LDC2_AB,
+ M_LDC3_AB,
+ M_LDL_AB,
+ M_LDR_AB,
+ M_LH_A,
+ M_LH_AB,
+ M_LHU_A,
+ M_LHU_AB,
+ M_LI,
+ M_LI_D,
+ M_LI_DD,
+ M_LI_S,
+ M_LI_SS,
+ M_LL_AB,
+ M_LLD_AB,
+ M_LS_A,
+ M_LW_A,
+ M_LW_AB,
+ M_LWC0_A,
+ M_LWC0_AB,
+ M_LWC1_A,
+ M_LWC1_AB,
+ M_LWC2_A,
+ M_LWC2_AB,
+ M_LWC3_A,
+ M_LWC3_AB,
+ M_LWL_A,
+ M_LWL_AB,
+ M_LWR_A,
+ M_LWR_AB,
+ M_LWU_AB,
+ M_MOVE,
+ M_MUL,
+ M_MUL_I,
+ M_MULO,
+ M_MULO_I,
+ M_MULOU,
+ M_MULOU_I,
+ M_NOR_I,
+ M_OR_I,
+ M_REM_3,
+ M_REM_3I,
+ M_REMU_3,
+ M_REMU_3I,
+ M_ROL,
+ M_ROL_I,
+ M_ROR,
+ M_ROR_I,
+ M_S_DA,
+ M_S_DOB,
+ M_S_DAB,
+ M_S_S,
+ M_SC_AB,
+ M_SCD_AB,
+ M_SD_A,
+ M_SD_OB,
+ M_SD_AB,
+ M_SDC1_AB,
+ M_SDC2_AB,
+ M_SDC3_AB,
+ M_SDL_AB,
+ M_SDR_AB,
+ M_SEQ,
+ M_SEQ_I,
+ M_SGE,
+ M_SGE_I,
+ M_SGEU,
+ M_SGEU_I,
+ M_SGT,
+ M_SGT_I,
+ M_SGTU,
+ M_SGTU_I,
+ M_SLE,
+ M_SLE_I,
+ M_SLEU,
+ M_SLEU_I,
+ M_SLT_I,
+ M_SLTU_I,
+ M_SNE,
+ M_SNE_I,
+ M_SB_A,
+ M_SB_AB,
+ M_SH_A,
+ M_SH_AB,
+ M_SW_A,
+ M_SW_AB,
+ M_SWC0_A,
+ M_SWC0_AB,
+ M_SWC1_A,
+ M_SWC1_AB,
+ M_SWC2_A,
+ M_SWC2_AB,
+ M_SWC3_A,
+ M_SWC3_AB,
+ M_SWL_A,
+ M_SWL_AB,
+ M_SWR_A,
+ M_SWR_AB,
+ M_SUB_I,
+ M_SUBU_I,
+ M_SUBU_I_2,
+ M_TEQ_I,
+ M_TGE_I,
+ M_TGEU_I,
+ M_TLT_I,
+ M_TLTU_I,
+ M_TNE_I,
+ M_TRUNCWD,
+ M_TRUNCWS,
+ M_ULD,
+ M_ULD_A,
+ M_ULH,
+ M_ULH_A,
+ M_ULHU,
+ M_ULHU_A,
+ M_ULW,
+ M_ULW_A,
+ M_USH,
+ M_USH_A,
+ M_USW,
+ M_USW_A,
+ M_USD,
+ M_USD_A,
+ M_XOR_I,
+ M_COP0,
+ M_COP1,
+ M_COP2,
+ M_COP3,
+ M_NUM_MACROS
};
diff --git a/contrib/binutils/include/opcode/v850.h b/contrib/binutils/include/opcode/v850.h
index 737faf8..2183bc8 100644
--- a/contrib/binutils/include/opcode/v850.h
+++ b/contrib/binutils/include/opcode/v850.h
@@ -1,5 +1,5 @@
/* v850.h -- Header file for NEC V850 opcode table
- Copyright 1996, 1997 Free Software Foundation, Inc.
+ Copyright 1996, 1997, 2001 Free Software Foundation, Inc.
Written by J.T. Conklin, Cygnus Support
This file is part of GDB, GAS, and the GNU binutils.
@@ -153,7 +153,6 @@ extern const struct v850_operand v850_operands[];
/* The register specified must not be r0 */
#define V850_NOT_R0 0x80
-/* CYGNUS LOCAL v850e */
/* push/pop type instruction, V850E specific. */
#define V850E_PUSH_POP 0x100
diff --git a/contrib/binutils/ld/ChangeLog b/contrib/binutils/ld/ChangeLog
index 941ffeb..0848b49 100644
--- a/contrib/binutils/ld/ChangeLog
+++ b/contrib/binutils/ld/ChangeLog
@@ -1,3 +1,51 @@
+2002-04-04 Alan Modra <amodra@bigpond.net.au>
+
+ * dep-in.sed: Cope with absolute paths.
+ * Makefile.am (dep.sed): Subst TOPDIR and BFDDIR.
+ Run "make dep-am".
+ * Makefile.in: Regenerate.
+
+ Merge from mainline.
+ 2002-03-28 Alan Modra <amodra@bigpond.net.au>
+ * configure.host: Set up for generic hosts first, then tweak as
+ necessary in more specific targets.
+ (HOSTING_LIBS): Include libgcc_eh.a if found.
+
+2002-03-28 Alan Modra <amodra@bigpond.net.au>
+
+ Merge from mainline.
+ 2002-03-21 Albert Chin-A-Young <china@thewrittenword.com>
+ * genscripts.sh (LIB_SEARCH_DIRS): Quote path.
+
+ 2002-03-20 Alan Modra <amodra@bigpond.net.au>
+ * ldlang.c (ldlang_add_undef): If the output bfd has been opened,
+ add the symbol to the linker hash table immediately.
+ (lang_place_undefineds): Split symbol creation out..
+ (insert_undefined): ..to here.
+
+ 2002-03-18 Alan Modra <amodra@bigpond.net.au>
+ * ldmain.c (main): Move .text readonly flag fudges from here..
+ * ldlang.c (lang_process): ..to here.
+
+ 2002-03-14 Alan Modra <amodra@bigpond.net.au>
+ * ldlang.c (lang_check): Remove the word size check added in last
+ change. Treat emitrelocations case as for relocatable links.
+
+ 2002-03-13 Alan Modra <amodra@bigpond.net.au>
+ * ldlang.c (lang_check): Do relocatable link checks first, so that
+ warn_mismatch can't override. Check compatible and word size too.
+
+ 2002-03-04 H.J. Lu <hjl@gnu.org>
+ * scripttempl/elf.sc: Put .preinit_array, .init_array and
+ .fini_array in the data segment.
+
+ 2002-03-04 Alan Modra <amodra@bigpond.net.au>
+ * scripttempl/elf.sc: Correct syntax errors in 2002-03-01 commit.
+
+ 2002-03-01 David Mosberger <davidm@hpl.hp.com>
+ * scripttempl/elf.sc (SECTIONS): Add entries for .preinit_array,
+ .init_array, and .fini_array.
+
2002-03-18 David O'Brien <obrien@FreeBSD.org>
* emultempl/elf32.em: Use lbasename vs. basename to fix problem where
@@ -8,10 +56,7 @@ Mon Mar 18 18:07:20 CET 2002 Jan Hubicka <jh@suse.cz>
Andreas Jaeger <aj@suse.de>
Andreas Schwab <schwab@suse.de>
- * cpu-i386.c (bfd_x86_64_arch): Rename to "i386:x86-64"
-
* configure.tgt (x86_64-*-linux-gnu*): Configure i386 as native.
-
* elf_x86_64.sh (ARCH): Set to i386:x86-64
set libraries to default to lib64 paths.
diff --git a/contrib/binutils/ld/Makefile.am b/contrib/binutils/ld/Makefile.am
index bff2045..3959ac5 100644
--- a/contrib/binutils/ld/Makefile.am
+++ b/contrib/binutils/ld/Makefile.am
@@ -1175,7 +1175,9 @@ DEP1: $(CFILES) $(GENERATED_CFILES)
dep.sed: dep-in.sed config.status
sed <$(srcdir)/dep-in.sed >dep.sed \
-e 's!@INCDIR@!$(INCDIR)!' \
- -e 's!@SRCDIR@!$(srcdir)!'
+ -e 's!@BFDDIR@!$(BFDDIR)!' \
+ -e 's!@SRCDIR@!$(srcdir)!' \
+ -e 's!@TOPDIR@!'`echo $(srcdir) | sed -e s,/ld$$,,`'!'
dep: DEP
sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile
@@ -1258,16 +1260,17 @@ pe-dll.o: pe-dll.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h \
ld.h $(INCDIR)/bin-bugs.h ldexp.h ldlang.h ldwrite.h \
ldmisc.h ldgram.h ldmain.h ldfile.h ldemul.h $(INCDIR)/coff/internal.h \
- ../bfd/libcoff.h deffile.h pe-dll.h
+ $(BFDDIR)/libcoff.h deffile.h pe-dll.h
ldgram.o: ldgram.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \
$(INCDIR)/bfdlink.h ld.h $(INCDIR)/bin-bugs.h ldexp.h \
ldver.h ldlang.h ldfile.h ldemul.h ldmisc.h ldmain.h \
mri.h ldctor.h ldlex.h
-ldlex.o: ldlex.c ../bfd/bfd.h $(INCDIR)/symcat.h sysdep.h \
- config.h $(INCDIR)/fopen-same.h $(INCDIR)/safe-ctype.h \
- ld.h $(INCDIR)/bin-bugs.h ldgram.h ldmisc.h ldexp.h \
- ldlang.h ldfile.h ldlex.h ldmain.h $(INCDIR)/libiberty.h
+ldlex.o: ldlex.c $(INCDIR)/ansidecl.h ../bfd/bfd.h \
+ $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \
+ $(INCDIR)/safe-ctype.h ld.h $(INCDIR)/bin-bugs.h ldgram.h \
+ ldmisc.h ldexp.h ldlang.h ldfile.h ldlex.h ldmain.h \
+ $(INCDIR)/libiberty.h
deffilep.o: deffilep.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
$(INCDIR)/safe-ctype.h ../bfd/bfd.h $(INCDIR)/symcat.h \
sysdep.h config.h $(INCDIR)/fopen-same.h ld.h $(INCDIR)/bin-bugs.h \
diff --git a/contrib/binutils/ld/Makefile.in b/contrib/binutils/ld/Makefile.in
index b778681..1521f5e 100644
--- a/contrib/binutils/ld/Makefile.in
+++ b/contrib/binutils/ld/Makefile.in
@@ -1,6 +1,6 @@
-# Makefile.in generated automatically by automake 1.4 from Makefile.am
+# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
-# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -507,7 +507,7 @@ deffilep.c ldgram.c ldlex.c
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-TAR = gtar
+TAR = tar
GZIP_ENV = --best
SOURCES = $(ld_new_SOURCES) $(EXTRA_ld_new_SOURCES)
OBJECTS = $(ld_new_OBJECTS)
@@ -695,7 +695,7 @@ uninstall-info:
else ii=; fi; \
list='$(INFO_DEPS)'; \
for file in $$list; do \
- test -z "$ii" \
+ test -z "$$ii" \
|| install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \
done
@$(NORMAL_UNINSTALL)
@@ -808,7 +808,7 @@ maintainer-clean-recursive:
dot_seen=no; \
rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
rev="$$subdir $$rev"; \
- test "$$subdir" = "." && dot_seen=yes; \
+ test "$$subdir" != "." || dot_seen=yes; \
done; \
test "$$dot_seen" = "no" && rev=". $$rev"; \
target=`echo $@ | sed s/-recursive//`; \
@@ -1870,7 +1870,9 @@ DEP1: $(CFILES) $(GENERATED_CFILES)
dep.sed: dep-in.sed config.status
sed <$(srcdir)/dep-in.sed >dep.sed \
-e 's!@INCDIR@!$(INCDIR)!' \
- -e 's!@SRCDIR@!$(srcdir)!'
+ -e 's!@BFDDIR@!$(BFDDIR)!' \
+ -e 's!@SRCDIR@!$(srcdir)!' \
+ -e 's!@TOPDIR@!'`echo $(srcdir) | sed -e s,/ld$$,,`'!'
dep: DEP
sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile
@@ -1953,16 +1955,17 @@ pe-dll.o: pe-dll.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h \
ld.h $(INCDIR)/bin-bugs.h ldexp.h ldlang.h ldwrite.h \
ldmisc.h ldgram.h ldmain.h ldfile.h ldemul.h $(INCDIR)/coff/internal.h \
- ../bfd/libcoff.h deffile.h pe-dll.h
+ $(BFDDIR)/libcoff.h deffile.h pe-dll.h
ldgram.o: ldgram.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \
$(INCDIR)/bfdlink.h ld.h $(INCDIR)/bin-bugs.h ldexp.h \
ldver.h ldlang.h ldfile.h ldemul.h ldmisc.h ldmain.h \
mri.h ldctor.h ldlex.h
-ldlex.o: ldlex.c ../bfd/bfd.h $(INCDIR)/symcat.h sysdep.h \
- config.h $(INCDIR)/fopen-same.h $(INCDIR)/safe-ctype.h \
- ld.h $(INCDIR)/bin-bugs.h ldgram.h ldmisc.h ldexp.h \
- ldlang.h ldfile.h ldlex.h ldmain.h $(INCDIR)/libiberty.h
+ldlex.o: ldlex.c $(INCDIR)/ansidecl.h ../bfd/bfd.h \
+ $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \
+ $(INCDIR)/safe-ctype.h ld.h $(INCDIR)/bin-bugs.h ldgram.h \
+ ldmisc.h ldexp.h ldlang.h ldfile.h ldlex.h ldmain.h \
+ $(INCDIR)/libiberty.h
deffilep.o: deffilep.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
$(INCDIR)/safe-ctype.h ../bfd/bfd.h $(INCDIR)/symcat.h \
sysdep.h config.h $(INCDIR)/fopen-same.h ld.h $(INCDIR)/bin-bugs.h \
diff --git a/contrib/binutils/ld/configure.host b/contrib/binutils/ld/configure.host
index fc79d83..56a950c 100644
--- a/contrib/binutils/ld/configure.host
+++ b/contrib/binutils/ld/configure.host
@@ -11,11 +11,51 @@
HDEFINES=
HOSTING_CRT0=/lib/crt0.o
-HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc'
+HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ]; then libgcc=../gcc/libgcc.a; else libgcc=\`${CC} -print-libgcc-file-name\`; fi; if [ -f ../gcc/libgcc_eh.a ]; then libgcc="$libgcc ../gcc/libgcc_eh.a"; else libgcc_eh=\`${CC} -print-file-name=libgcc_eh.a\`; if [ x"$libgcc_eh" != xlibgcc_eh.a ]; then libgcc="$libgcc $libgcc_eh"; fi; fi; echo $libgcc -lc $libgcc`'
NATIVE_LIB_DIRS=
+#
+# Generic configurations:
+#
+
+case "${host}" in
+
+*-*-freebsd*)
+ NATIVE_LIB_DIRS=/usr/lib
+ # Older versions of gcc do not use a specs file. In those cases,
+ # gcc -print-file-name=specs will simply print specs. We create a
+ # dummy specs files to handle this.
+ echo "-dynamic-linker `${CC} --print-file-name=ld-elf.so.1`" > specs
+ HOSTING_CRT0='-dynamic-linker `${CC} --print-file-name=ld-elf.so.1` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `${CC} --print-file-name=crtbegin.o`'
+ HOSTING_LIBS='-L`dirname \`${CC} --print-file-name=libc.so\`` '"$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
+ ;;
+
+*-*-linux*aout* | *-*-linux*oldld)
+ HOSTING_CRT0=/usr/lib/crt0.o
+ ;;
+
+*-*-linux*libc1*)
+ HOSTING_CRT0='-dynamic-linker /lib/ld-linux.so.1 /usr/lib/crt1.o /usr/lib/crti.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; elif [ -f /usr/lib/crtbegin.o ]; then echo /usr/lib/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
+ HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; elif [ -f /usr/lib/crtend.o ]; then echo /usr/lib/crtend.o; else ${CC} --print-file-name=crtend.o; fi` /usr/lib/crtn.o'
+ ;;
+
+*-*-linux*)
+ HOSTING_CRT0='-dynamic-linker `egrep "ld[^ ]*\.so" \`${CC} --print-file-name=specs\` | sed -e "s,.*-dynamic-linker[ ][ ]*\(.*/ld[^ ]*\.so..\).*,\1,"` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
+ HOSTING_LIBS='-L`dirname \`${CC} --print-file-name=libc.so\`` '"$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
+ ;;
+
+esac
+
+#
+# Now more specific configurations
+#
+
case "${host}" in
+*-*-linux*aout* | *-*-linux*oldld | *-*-linux*libc1*)
+ # No further tweaking needed
+ ;;
+
alpha*-*-netbsd*)
# The new BSD `make' has a bug: it doesn't pass empty arguments in
# shell commands. So we need to make this value non-empty in order
@@ -26,8 +66,7 @@ alpha*-*-netbsd*)
;;
arm*-*-linux-gnu*)
- HOSTING_CRT0='-p -dynamic-linker `fgrep ld-linux.so \`${CC} --print-file-name=specs\` | sed -e "s,.*-dynamic-linker[ ][ ]*\(.*/ld-linux.so..\).*,\1,"` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
- HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L`dirname \`${CC} --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
+ HOSTING_CRT0='-p '`echo "$HOSTING_CRT0" | sed -e "s,ld\[^ \]*\*,ld-linux,g"`
;;
i[3456]86-*-bsd* | i[34567]86-*-freebsd[12] | i[34567]86-*-freebsd[12]\.* | i[34567]86-*-freebsd*aout* | i[3456]86-*-netbsd*)
@@ -41,23 +80,23 @@ i[3456]86-*-bsd* | i[34567]86-*-freebsd[12] | i[34567]86-*-freebsd[12]\.* | i[34
i[3456]86-*-sysv4*)
HOSTING_CRT0='/usr/ccs/lib/crt1.o /usr/ccs/lib/crti.o /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`'
- HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` /usr/ccs/lib/crtn.o'
+ HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` /usr/ccs/lib/crtn.o'
NATIVE_LIB_DIRS=/usr/ccs/lib
;;
i[3456]86-sequent-ptx* | i[3456]86-sequent-sysv*)
HOSTING_CRT0='/lib/crt0.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`'
- HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi`'
+ HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi`'
;;
i[3456]86-*-sysv*)
HOSTING_CRT0='/lib/crt1.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; fi`'
- HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; fi` /lib/crtn.o'
+ HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; fi` /lib/crtn.o'
;;
i[3456]86-*-solaris*)
HOSTING_CRT0='`if [ -f ../gcc/crt1.o ]; then echo ../gcc/crt1.o; else ${CC} -print-file-name=crt1.o; fi` `if [ -f ../gcc/crti.o ]; then echo ../gcc/crti.o; else ${CC} -print-file-name=crti.o; fi` /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`'
- HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` `if [ -f ../gcc/crtn.o ]; then echo ../gcc/crtn.o; else ${CC} -print-file-name=crtn.o; fi`'
+ HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` `if [ -f ../gcc/crtn.o ]; then echo ../gcc/crtn.o; else ${CC} -print-file-name=crtn.o; fi`'
NATIVE_LIB_DIRS=/usr/ccs/lib
;;
@@ -73,46 +112,31 @@ i[3456]86-*-sco* | i[3456]86-*-isc*)
${CC} -c crtend.c -o crtend.o
rm -f crtend.c
HOSTING_CRT0='/lib/crt1.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`'
- HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` /lib/crtn.o'
- ;;
-
-i[3456]86-*-linux*aout* | i[3456]86-*-linux*oldld)
- HOSTING_CRT0=/usr/lib/crt0.o
- ;;
-
-i[3456]86-*-linux*libc1*)
- HOSTING_CRT0='-dynamic-linker /lib/ld-linux.so.1 /usr/lib/crt1.o /usr/lib/crti.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; elif [ -f /usr/lib/crtbegin.o ]; then echo /usr/lib/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
- HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; elif [ -f /usr/lib/crtend.o ]; then echo /usr/lib/crtend.o; else ${CC} --print-file-name=crtend.o; fi` /usr/lib/crtn.o'
- ;;
-
-i[3456]86-*-linux-gnu*)
- HOSTING_CRT0='-dynamic-linker `fgrep ld-linux.so \`${CC} --print-file-name=specs\` | sed -e "s,.*-dynamic-linker[ ][ ]*\(.*/ld-linux.so..\).*,\1,"` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
- HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L`dirname \`${CC} --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
+ HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` /lib/crtn.o'
;;
i[3456]86-*-lynxos*)
HOSTING_CRT0=/lib/init1.o
- HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc -lm /lib/initn.o'
+ HOSTING_LIBS="$HOSTING_LIBS"' -lm /lib/initn.o'
;;
i[3456]86-pc-interix*)
HOSTING_CRT0='$$INTERIX_ROOT/usr/lib/crt0.o'
NATIVE_LIB_DIRS='$$INTERIX_ROOT/usr/lib/'
- HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L $$X/local_bin -L $$INTERIX_ROOT/usr/lib -lc -lcpsx -lc -lcpsx $$INTERIX_ROOT/usr/lib/psxdll.a $$INTERIX_ROOT/usr/lib/psxdll2.a'
+ HOSTING_LIBS='-L $$X/local_bin -L $$INTERIX_ROOT/usr/lib '"$HOSTING_LIBS"' -lcpsx -lc -lcpsx $$INTERIX_ROOT/usr/lib/psxdll.a $$INTERIX_ROOT/usr/lib/psxdll2.a'
;;
i[3456]86-*-cygwin*)
- HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lcygwin -luser32 -lkernel32 -ladvapi32 -lshell32 `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi`'
+ HOSTING_LIBS="$HOSTING_LIBS"' -lcygwin -luser32 -lkernel32 -ladvapi32 -lshell32 `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi`'
;;
ia64-*-linux-gnu*)
- HOSTING_CRT0='-dynamic-linker `egrep "ld-linux-ia64.so" \`${CC} --print-file-name=specs\` | sed -e "s,.*-dynamic-linker[ ][ ]*\(.*/ld-linux-ia64.so..\).*,\1,"` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
- HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L`dirname \`${CC} --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
+ HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,ld\[^ \]*\*,ld-linux-ia64,g"`
;;
ia64-*-aix*)
HOSTING_CRT0='-dynamic-linker `egrep "libc.so" \`${CC} --print-file-name=specs\` | sed -e "s,.*-dynamic-linker[ ][ ]*\(.*/libc.so..\).*,\1,"` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
- HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L`dirname \`${CC} --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
+ HOSTING_LIBS='-L`dirname \`${CC} --print-file-name=libc.so\`` '"$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
NATIVE_LIB_DIRS=/usr/lib/ia64l64
;;
@@ -120,48 +144,32 @@ mips*-dec-bsd*)
HOSTING_CRT0=/usr/lib/crt0.o
;;
-mips*-sgi-irix4*)
+mips*-sgi-irix4* | mips*-sgi-irix5*)
HOSTING_CRT0=/usr/lib/crt1.o
- HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc /usr/lib/crtn.o'
- ;;
-
-mips*-sgi-irix5*)
- HOSTING_CRT0=/usr/lib/crt1.o
- HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc /usr/lib/crtn.o'
+ HOSTING_LIBS="$HOSTING_LIBS"' /usr/lib/crtn.o'
;;
mips*-sgi-irix6*)
HOSTING_CRT0='/usr/lib32/crt1.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o ; else ${CC} -print-file-name=crtbegin.o; fi`'
- HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L/usr/lib32 -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o ; else ${CC} -print-file-name=crtend.o; fi` /usr/lib32/crtn.o -init __do_global_ctors -fini __do_global_dtors'
+ HOSTING_LIBS='-L/usr/lib32 '"$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o ; else ${CC} -print-file-name=crtend.o; fi` /usr/lib32/crtn.o -init __do_global_ctors -fini __do_global_dtors'
;;
mips*-*-linux-gnu*)
- HOSTING_CRT0='-dynamic-linker /lib/ld.so.1 /usr/lib/crt1.o /usr/lib/crti.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
- HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` /usr/lib/crtn.o'
- ;;
-
-m68*-*-linux*aout*)
- HOSTING_CRT0=/usr/lib/crt0.o
- ;;
-
-m68*-*-linux*libc1*)
- HOSTING_CRT0='-dynamic-linker /lib/ld-linux.so.1 /usr/lib/crt1.o /usr/lib/crti.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; elif [ -f /usr/lib/crtbegin.o ]; then echo /usr/lib/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
- HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; elif [ -f /usr/lib/crtend.o ]; then echo /usr/lib/crtend.o; else ${CC} --print-file-name=crtend.o; fi` /usr/lib/crtn.o'
+ HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`egrep.*\"\\\`,/lib/ld.so.1,"`
;;
m68*-*-linux-gnu*)
- HOSTING_CRT0='-dynamic-linker /lib/ld.so.1 /usr/lib/crt1.o /usr/lib/crti.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
- HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` /usr/lib/crtn.o'
+ HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`egrep.*\"\\\`,/lib/ld.so.1,"`
;;
m68*-*-lynxos*)
HOSTING_CRT0=/lib/init1.o
- HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc -lm /lib/initn.o'
+ HOSTING_LIBS="$HOSTING_LIBS"' -lm /lib/initn.o'
;;
m68*-motorola-sysv)
HOSTING_CRT0='`if [ -f ../gcc/crt0.o ]; then echo ../gcc/crt0.o; elif [ -f \`${CC} -print-file-name=\`crt0.o ]; then echo \`${CC} -print-file-name=\`crt0.o; else echo /lib/crt0.o; fi`'
- HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc881 `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi`'
+ HOSTING_LIBS=`echo "$HOSTING_LIBS" | sed -e "s,-lc,-lc881,"`
;;
m68*-sun-*)
@@ -176,62 +184,43 @@ m88*-*-dgux*)
m88*-motorola-sysv3)
HOSTING_CRT0='/lib/crt0.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`'
- HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi`'
+ HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi`'
;;
powerpc*-*-linux-gnu*)
- HOSTING_CRT0='-dynamic-linker /lib/ld.so.1 /usr/lib/crt1.o /usr/lib/crti.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
- HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` /usr/lib/crtn.o'
+ HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`egrep.*\"\\\`,/lib/ld.so.1,"`
;;
s390x-*-linux-gnu*)
- HOSTING_CRT0='-dynamic-linker /lib/ld64.so.1 `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
- HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L `dirname \`${CC} --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
+ HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`egrep.*\"\\\`,/lib/ld64.so.1,"`
;;
s390-*-linux-gnu*)
- HOSTING_CRT0='-dynamic-linker /lib/ld.so.1 /usr/lib/crt1.o /usr/lib/crti.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; elif [ -f /usr/lib/crtbegin.o ]; then echo /usr/lib/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
- HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; elif [ -f /usr/lib/crtend.o ]; then echo /usr/lib/crtend.o; else ${CC} --print-file-name=crtend.o; fi` /usr/lib/crtn.o'
+ HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`egrep.*\"\\\`,/lib/ld.so.1,"`
;;
sparc*-*-solaris2*)
HOSTING_CRT0='`if [ -f ../gcc/crt1.o ]; then echo ../gcc/crt1.o; else ${CC} -print-file-name=crt1.o; fi` `if [ -f ../gcc/crti.o ]; then echo ../gcc/crti.o; else ${CC} -print-file-name=crti.o; fi` /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`'
- HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` `if [ -f ../gcc/crtn.o ]; then echo ../gcc/crtn.o; else ${CC} -print-file-name=crtn.o; fi`'
+ HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` `if [ -f ../gcc/crtn.o ]; then echo ../gcc/crtn.o; else ${CC} -print-file-name=crtn.o; fi`'
NATIVE_LIB_DIRS=/usr/ccs/lib
;;
sparc-*-linux-gnu*)
- HOSTING_CRT0='-dynamic-linker /lib/ld-linux.so.2 `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
- HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L`dirname \`${CC} --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
+ HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`egrep.*\"\\\`,/lib/ld-linux.so.2,"`
;;
sparc64-*-linux-gnu*)
- HOSTING_CRT0='-dynamic-linker /lib64/ld-linux.so.2 `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
- HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L`dirname \`${CC} --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
+ HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`egrep.*\"\\\`,/lib64/ld-linux.so.2,"`
;;
x86_64-*-linux-gnu*)
- HOSTING_CRT0='-dynamic-linker /lib64/ld-linux-x86-64.so.2 `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
- HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L`dirname \`${CC} --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
+ HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`egrep.*\"\\\`,/lib64/ld-linux-x86-64.so.2,"`
;;
-#
-# Generic configurations:
-#
-
*-*-freebsd*)
- NATIVE_LIB_DIRS=/usr/lib
- # Older versions of gcc do not use a specs file. In those cases,
- # gcc -print-file-name=specs will simply print specs. We create a
- # dummy specs files to handle this.
- echo "-dynamic-linker `${CC} --print-file-name=ld-elf.so.1`" > specs
- HOSTING_CRT0='-dynamic-linker `${CC} --print-file-name=ld-elf.so.1` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `${CC} --print-file-name=crtbegin.o`'
- HOSTING_LIBS='`${CC} -print-libgcc-file-name` -L`dirname \`${CC} --print-file-name=libc.so\`` -lc `${CC} -print-libgcc-file-name` `${CC} --print-file-name=crtend.o` `${CC} --print-file-name=crtn.o`'
;;
*-*-linux*)
- HOSTING_CRT0='-dynamic-linker `egrep "ld[^ ]*\.so" \`${CC} --print-file-name=specs\` | sed -e "s,.*-dynamic-linker[ ][ ]*\(.*/ld[^ ]*.so..\).*,\1,"` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
- HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L`dirname \`${CC} --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
;;
alpha*-*-*)
diff --git a/contrib/binutils/ld/dep-in.sed b/contrib/binutils/ld/dep-in.sed
index 89b1201..aad7d92 100644
--- a/contrib/binutils/ld/dep-in.sed
+++ b/contrib/binutils/ld/dep-in.sed
@@ -3,6 +3,9 @@
/\\$/b loop
s!@INCDIR@!$(INCDIR)!g
+s!@TOPDIR@/include!$(INCDIR)!g
+s!@BFDDIR@!$(BFDDIR)!g
+s!@TOPDIR@/bfd!$(BFDDIR)!g
s!@SRCDIR@/!!g
s! \.\./bfd/hosts/[^ ]*\.h! !g
diff --git a/contrib/binutils/ld/emulparams/elf32bmip.sh b/contrib/binutils/ld/emulparams/elf32bmip.sh
index 473c411..fa7d671 100644
--- a/contrib/binutils/ld/emulparams/elf32bmip.sh
+++ b/contrib/binutils/ld/emulparams/elf32bmip.sh
@@ -1,22 +1,27 @@
+# If you change this file, please also look at files which source this one:
+# elf32b4300.sh elf32bsmip.sh elf32btsmip.sh elf32ebmip.sh elf32lmip.sh
+
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-bigmips"
BIG_OUTPUT_FORMAT="elf32-bigmips"
LITTLE_OUTPUT_FORMAT="elf32-littlemips"
TEXT_START_ADDR=0x0400000
-DATA_ADDR=0x10000000
+test -n "${EMBEDDED}" || DATA_ADDR=0x10000000
MAXPAGESIZE=0x40000
NONPAGED_TEXT_START_ADDR=0x0400000
SHLIB_TEXT_START_ADDR=0x5ffe0000
-TEXT_DYNAMIC=
-INITIAL_READONLY_SECTIONS='.reginfo : { *(.reginfo) }'
+test -n "${EMBEDDED}" || TEXT_DYNAMIC=
+INITIAL_READONLY_SECTIONS="
+ .reginfo ${RELOCATING-0} : { *(.reginfo) }
+"
OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)'
OTHER_GOT_SYMBOLS='
_gp = ALIGN(16) + 0x7ff0;
'
-OTHER_GOT_SECTIONS='
- .lit8 : { *(.lit8) }
- .lit4 : { *(.lit4) }
-'
+OTHER_SDATA_SECTIONS="
+ .lit8 ${RELOCATING-0} : { *(.lit8) }
+ .lit4 ${RELOCATING-0} : { *(.lit4) }
+"
TEXT_START_SYMBOLS='_ftext = . ;'
DATA_START_SYMBOLS='_fdata = . ;'
OTHER_BSS_SYMBOLS='_fbss = .;'
@@ -27,4 +32,5 @@ OTHER_SECTIONS='
ARCH=mips
MACHINE=
TEMPLATE_NAME=elf32
+EXTRA_EM_FILE=mipself
GENERATE_SHLIB_SCRIPT=yes
diff --git a/contrib/binutils/ld/emulparams/elf32bmipn32.sh b/contrib/binutils/ld/emulparams/elf32bmipn32.sh
index 56f42a9..8dc1735 100755
--- a/contrib/binutils/ld/emulparams/elf32bmipn32.sh
+++ b/contrib/binutils/ld/emulparams/elf32bmipn32.sh
@@ -1,3 +1,6 @@
+# If you change this file, please also look at files which source this one:
+# elf64bmip.sh elf64btsmip.sh
+
# This is an ELF platform.
SCRIPT_NAME=elf
@@ -17,11 +20,11 @@ ENTRY=__start
OTHER_GOT_SYMBOLS='
_gp = ALIGN(16) + 0x7ff0;
'
-OTHER_GOT_SECTIONS='
- .lit8 : { *(.lit8) }
- .lit4 : { *(.lit4) }
- .srdata : { *(.srdata) }
-'
+OTHER_SDATA_SECTIONS="
+ .lit8 ${RELOCATING-0} : { *(.lit8) }
+ .lit4 ${RELOCATING-0} : { *(.lit4) }
+ .srdata ${RELOCATING-0} : { *(.srdata) }
+"
# Magic symbols.
TEXT_START_SYMBOLS='_ftext = . ;'
@@ -41,35 +44,28 @@ EXECUTABLE_SYMBOLS="
# segment.
WRITABLE_RODATA=
-OTHER_RELOCATING_SECTIONS='
- .MIPS.events.text :
+OTHER_SECTIONS="
+ .MIPS.events.text ${RELOCATING-0} :
{
- *(.MIPS.events.text)
- *(.MIPS.events.gnu.linkonce.t*)
+ *(.MIPS.events.text${RELOCATING+ .MIPS.events.gnu.linkonce.t*})
}
- .MIPS.content.text :
+ .MIPS.content.text ${RELOCATING-0} :
{
- *(.MIPS.content.text)
- *(.MIPS.content.gnu.linkonce.t*)
+ *(.MIPS.content.text${RELOCATING+ .MIPS.content.gnu.linkonce.t*})
}
- .MIPS.events.data :
+ .MIPS.events.data ${RELOCATING-0} :
{
- *(.MIPS.events.data)
- *(.MIPS.events.gnu.linkonce.d*)
+ *(.MIPS.events.data${RELOCATING+ .MIPS.events.gnu.linkonce.d*})
}
- .MIPS.content.data :
+ .MIPS.content.data ${RELOCATING-0} :
{
- *(.MIPS.content.data)
- *(.MIPS.content.gnu.linkonce.d*)
+ *(.MIPS.content.data${RELOCATING+ .MIPS.content.gnu.linkonce.d*})
}
- .MIPS.events.rodata :
+ .MIPS.events.rodata ${RELOCATING-0} :
{
- *(.MIPS.events.rodata)
- *(.MIPS.events.gnu.linkonce.r*)
+ *(.MIPS.events.rodata${RELOCATING+ .MIPS.events.gnu.linkonce.r*})
}
- .MIPS.content.rodata :
+ .MIPS.content.rodata ${RELOCATING-0} :
{
- *(.MIPS.content.rodata)
- *(.MIPS.content.gnu.linkonce.r*)
- }
-'
+ *(.MIPS.content.rodata${RELOCATING+ .MIPS.content.gnu.linkonce.r*})
+ }"
diff --git a/contrib/binutils/ld/emulparams/elf32bsmip.sh b/contrib/binutils/ld/emulparams/elf32bsmip.sh
index 09f1307..5b2939a 100755
--- a/contrib/binutils/ld/emulparams/elf32bsmip.sh
+++ b/contrib/binutils/ld/emulparams/elf32bsmip.sh
@@ -1,31 +1,2 @@
-SCRIPT_NAME=elf
-OUTPUT_FORMAT="elf32-bigmips"
-BIG_OUTPUT_FORMAT="elf32-bigmips"
-LITTLE_OUTPUT_FORMAT="elf32-littlemips"
-TEXT_START_ADDR=0x0400000
-DATA_ADDR=0x10000000
-MAXPAGESIZE=0x40000
-NONPAGED_TEXT_START_ADDR=0x0400000
-SHLIB_TEXT_START_ADDR=0x5ffe0000
-TEXT_DYNAMIC=
-INITIAL_READONLY_SECTIONS='.reginfo : { *(.reginfo) }'
-OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)'
-OTHER_GOT_SYMBOLS='
- _gp = ALIGN(16) + 0x7ff0;
-'
-OTHER_GOT_SECTIONS='
- .lit8 : { *(.lit8) }
- .lit4 : { *(.lit4) }
-'
-TEXT_START_SYMBOLS='_ftext = . ;'
-DATA_START_SYMBOLS='_fdata = . ;'
-OTHER_BSS_SYMBOLS='_fbss = .;'
-OTHER_SECTIONS='
- .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
- .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
-'
-ARCH=mips
-MACHINE=
-TEMPLATE_NAME=elf32
-GENERATE_SHLIB_SCRIPT=yes
+. ${srcdir}/emulparams/elf32bmip.sh
ENTRY=__start
diff --git a/contrib/binutils/ld/emulparams/elf32ebmip.sh b/contrib/binutils/ld/emulparams/elf32ebmip.sh
index 00ea8fd..704b43e 100644
--- a/contrib/binutils/ld/emulparams/elf32ebmip.sh
+++ b/contrib/binutils/ld/emulparams/elf32ebmip.sh
@@ -1,28 +1,2 @@
-SCRIPT_NAME=elf
-OUTPUT_FORMAT="elf32-bigmips"
-BIG_OUTPUT_FORMAT="elf32-bigmips"
-LITTLE_OUTPUT_FORMAT="elf32-littlemips"
-TEXT_START_ADDR=0x0400000
-MAXPAGESIZE=0x40000
-NONPAGED_TEXT_START_ADDR=0x0400000
-SHLIB_TEXT_START_ADDR=0x5ffe0000
-OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)'
-OTHER_GOT_SYMBOLS='
- _gp = ALIGN(16) + 0x7ff0;
-'
-OTHER_GOT_SECTIONS='
- .lit8 : { *(.lit8) }
- .lit4 : { *(.lit4) }
-'
-TEXT_START_SYMBOLS='_ftext = . ;'
-DATA_START_SYMBOLS='_fdata = . ;'
-OTHER_BSS_SYMBOLS='_fbss = .;'
-OTHER_SECTIONS='
- .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
- .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
-'
-ARCH=mips
-MACHINE=
-TEMPLATE_NAME=elf32
-GENERATE_SHLIB_SCRIPT=yes
EMBEDDED=yes
+. ${srcdir}/emulparams/elf32bmip.sh
diff --git a/contrib/binutils/ld/emulparams/elf32elmip.sh b/contrib/binutils/ld/emulparams/elf32elmip.sh
index cf008c8..c94e503 100644
--- a/contrib/binutils/ld/emulparams/elf32elmip.sh
+++ b/contrib/binutils/ld/emulparams/elf32elmip.sh
@@ -1,28 +1,2 @@
-SCRIPT_NAME=elf
-OUTPUT_FORMAT="elf32-littlemips"
-BIG_OUTPUT_FORMAT="elf32-bigmips"
-LITTLE_OUTPUT_FORMAT="elf32-littlemips"
-TEXT_START_ADDR=0x0400000
-MAXPAGESIZE=0x40000
-NONPAGED_TEXT_START_ADDR=0x0400000
-SHLIB_TEXT_START_ADDR=0x5ffe0000
-OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)'
-OTHER_GOT_SYMBOLS='
- _gp = ALIGN(16) + 0x7ff0;
-'
-OTHER_GOT_SECTIONS='
- .lit8 : { *(.lit8) }
- .lit4 : { *(.lit4) }
-'
-TEXT_START_SYMBOLS='_ftext = . ;'
-DATA_START_SYMBOLS='_fdata = . ;'
-OTHER_BSS_SYMBOLS='_fbss = .;'
-OTHER_SECTIONS='
- .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
- .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
-'
-ARCH=mips
-MACHINE=
-TEMPLATE_NAME=elf32
-GENERATE_SHLIB_SCRIPT=yes
EMBEDDED=yes
+. ${srcdir}/emulparams/elf32lmip.sh
diff --git a/contrib/binutils/ld/emulparams/elf32lmip.sh b/contrib/binutils/ld/emulparams/elf32lmip.sh
index 23312f4..14d4ded 100644
--- a/contrib/binutils/ld/emulparams/elf32lmip.sh
+++ b/contrib/binutils/ld/emulparams/elf32lmip.sh
@@ -1,30 +1,7 @@
-SCRIPT_NAME=elf
+# If you change this file, please also look at files which source this one:
+# elf32elmip.sh elf32lsmip.sh
+
+. ${srcdir}/emulparams/elf32bmip.sh
OUTPUT_FORMAT="elf32-littlemips"
BIG_OUTPUT_FORMAT="elf32-bigmips"
LITTLE_OUTPUT_FORMAT="elf32-littlemips"
-TEXT_START_ADDR=0x0400000
-DATA_ADDR=0x10000000
-MAXPAGESIZE=0x40000
-NONPAGED_TEXT_START_ADDR=0x0400000
-SHLIB_TEXT_START_ADDR=0x5ffe0000
-TEXT_DYNAMIC=
-INITIAL_READONLY_SECTIONS='.reginfo : { *(.reginfo) }'
-OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)'
-OTHER_GOT_SYMBOLS='
- _gp = ALIGN(16) + 0x7ff0;
-'
-OTHER_GOT_SECTIONS='
- .lit8 : { *(.lit8) }
- .lit4 : { *(.lit4) }
-'
-TEXT_START_SYMBOLS='_ftext = . ;'
-DATA_START_SYMBOLS='_fdata = . ;'
-OTHER_BSS_SYMBOLS='_fbss = .;'
-OTHER_SECTIONS='
- .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
- .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
-'
-ARCH=mips
-MACHINE=
-TEMPLATE_NAME=elf32
-GENERATE_SHLIB_SCRIPT=yes
diff --git a/contrib/binutils/ld/emulparams/elf32lsmip.sh b/contrib/binutils/ld/emulparams/elf32lsmip.sh
index 4bdc8a1..62e4f98 100755
--- a/contrib/binutils/ld/emulparams/elf32lsmip.sh
+++ b/contrib/binutils/ld/emulparams/elf32lsmip.sh
@@ -1,31 +1,2 @@
-SCRIPT_NAME=elf
-OUTPUT_FORMAT="elf32-littlemips"
-BIG_OUTPUT_FORMAT="elf32-bigmips"
-LITTLE_OUTPUT_FORMAT="elf32-littlemips"
-TEXT_START_ADDR=0x0400000
-DATA_ADDR=0x10000000
-MAXPAGESIZE=0x40000
-NONPAGED_TEXT_START_ADDR=0x0400000
-SHLIB_TEXT_START_ADDR=0x5ffe0000
-TEXT_DYNAMIC=
-INITIAL_READONLY_SECTIONS='.reginfo : { *(.reginfo) }'
-OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)'
-OTHER_GOT_SYMBOLS='
- _gp = ALIGN(16) + 0x7ff0;
-'
-OTHER_GOT_SECTIONS='
- .lit8 : { *(.lit8) }
- .lit4 : { *(.lit4) }
-'
-TEXT_START_SYMBOLS='_ftext = . ;'
-DATA_START_SYMBOLS='_fdata = . ;'
-OTHER_BSS_SYMBOLS='_fbss = .;'
-OTHER_SECTIONS='
- .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
- .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
-'
-ARCH=mips
-MACHINE=
-TEMPLATE_NAME=elf32
-GENERATE_SHLIB_SCRIPT=yes
+. ${srcdir}/emulparams/elf32lmip.sh
ENTRY=__start
diff --git a/contrib/binutils/ld/emulparams/elf64bmip.sh b/contrib/binutils/ld/emulparams/elf64bmip.sh
index a4852d5..990fcb6 100755
--- a/contrib/binutils/ld/emulparams/elf64bmip.sh
+++ b/contrib/binutils/ld/emulparams/elf64bmip.sh
@@ -1,79 +1,12 @@
-# This is an ELF platform.
-SCRIPT_NAME=elf
-
-# Handle both big- and little-ended 32-bit MIPS objects.
-ARCH=mips
+. ${srcdir}/emulparams/elf32bmipn32.sh
OUTPUT_FORMAT="elf64-bigmips"
BIG_OUTPUT_FORMAT="elf64-bigmips"
LITTLE_OUTPUT_FORMAT="elf64-littlemips"
-
-# Note that the elf32 template is used for 64-bit emulations as well
-# as 32-bit emulations.
ELFSIZE=64
-TEMPLATE_NAME=elf32
-
-TEXT_START_ADDR=0x10000000
-MAXPAGESIZE=0x100000
-ENTRY=__start
-
-# GOT-related settings.
-OTHER_GOT_SYMBOLS='
- _gp = ALIGN(16) + 0x7ff0;
-'
-OTHER_GOT_SECTIONS='
- .lit8 : { *(.lit8) }
- .lit4 : { *(.lit4) }
- .srdata : { *(.srdata) }
-'
-# Magic symbols.
-TEXT_START_SYMBOLS='_ftext = . ;'
-DATA_START_SYMBOLS='_fdata = . ;'
-OTHER_BSS_SYMBOLS='_fbss = .;'
# IRIX6 defines these symbols. 0x40 is the size of the ELF header.
EXECUTABLE_SYMBOLS="
__dso_displacement = 0;
__elf_header = ${TEXT_START_ADDR};
__program_header_table = ${TEXT_START_ADDR} + 0x40;
"
-
-# There are often dynamic relocations against the .rodata section.
-# Setting DT_TEXTREL in the .dynamic section does not convince the
-# IRIX6 linker to permit relocations against the text segment.
-# Following the IRIX linker, we simply put .rodata in the data
-# segment.
-WRITABLE_RODATA=
-
-
-OTHER_RELOCATING_SECTIONS='
- .MIPS.events.text :
- {
- *(.MIPS.events.text)
- *(.MIPS.events.gnu.linkonce.t*)
- }
- .MIPS.content.text :
- {
- *(.MIPS.content.text)
- *(.MIPS.content.gnu.linkonce.t*)
- }
- .MIPS.events.data :
- {
- *(.MIPS.events.data)
- *(.MIPS.events.gnu.linkonce.d*)
- }
- .MIPS.content.data :
- {
- *(.MIPS.content.data)
- *(.MIPS.content.gnu.linkonce.d*)
- }
- .MIPS.events.rodata :
- {
- *(.MIPS.events.rodata)
- *(.MIPS.events.gnu.linkonce.r*)
- }
- .MIPS.content.rodata :
- {
- *(.MIPS.content.rodata)
- *(.MIPS.content.gnu.linkonce.r*)
- }
-'
diff --git a/contrib/binutils/ld/emulparams/shelf.sh b/contrib/binutils/ld/emulparams/shelf.sh
index 95db587..27b73b6 100755
--- a/contrib/binutils/ld/emulparams/shelf.sh
+++ b/contrib/binutils/ld/emulparams/shelf.sh
@@ -1,3 +1,6 @@
+# If you change this file, please also look at files which source this one:
+# shlelf.sh, shelf_nbsd.sh
+
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-sh"
TEXT_START_ADDR=0x1000
@@ -14,4 +17,4 @@ CTOR_START='___ctors = .;'
CTOR_END='___ctors_end = .;'
DTOR_START='___dtors = .;'
DTOR_END='___dtors_end = .;'
-OTHER_RELOCATING_SECTIONS='.stack 0x30000 : { _stack = .; *(.stack) }'
+STACK_ADDR=0x30000
diff --git a/contrib/binutils/ld/emulparams/shelf_linux.sh b/contrib/binutils/ld/emulparams/shelf_linux.sh
index d7b7631..b841bef 100644
--- a/contrib/binutils/ld/emulparams/shelf_linux.sh
+++ b/contrib/binutils/ld/emulparams/shelf_linux.sh
@@ -1,14 +1,2 @@
-SCRIPT_NAME=elf
+. ${srcdir}/emulparams/shlelf_linux.sh
OUTPUT_FORMAT="elf32-shbig-linux"
-TEXT_START_ADDR=0x400000
-MAXPAGESIZE=0x10000
-ARCH=sh
-MACHINE=
-TEMPLATE_NAME=elf32
-GENERATE_SHLIB_SCRIPT=yes
-
-DATA_START_SYMBOLS='__data_start = . ;';
-
-OTHER_READWRITE_SECTIONS='
- .note.ABI-tag : { *(.note.ABI-tag) }
-'
diff --git a/contrib/binutils/ld/emulparams/shl.sh b/contrib/binutils/ld/emulparams/shl.sh
index 360aac8..5fbb165 100644
--- a/contrib/binutils/ld/emulparams/shl.sh
+++ b/contrib/binutils/ld/emulparams/shl.sh
@@ -1,5 +1,2 @@
-SCRIPT_NAME=sh
+. ${srcdir}/emulparams/sh.sh
OUTPUT_FORMAT="coff-shl"
-TEXT_START_ADDR=0x8000
-TARGET_PAGE_SIZE=128
-ARCH=sh
diff --git a/contrib/binutils/ld/emulparams/shlelf.sh b/contrib/binutils/ld/emulparams/shlelf.sh
index bb27f86..e19678b 100755
--- a/contrib/binutils/ld/emulparams/shlelf.sh
+++ b/contrib/binutils/ld/emulparams/shlelf.sh
@@ -1,17 +1,2 @@
-SCRIPT_NAME=elf
+. ${srcdir}/emulparams/shelf.sh
OUTPUT_FORMAT="elf32-shl"
-TEXT_START_ADDR=0x1000
-MAXPAGESIZE=128
-ARCH=sh
-MACHINE=
-TEMPLATE_NAME=elf32
-GENERATE_SHLIB_SCRIPT=yes
-EMBEDDED=yes
-
-# These are for compatibility with the COFF toolchain.
-ENTRY=start
-CTOR_START='___ctors = .;'
-CTOR_END='___ctors_end = .;'
-DTOR_START='___dtors = .;'
-DTOR_END='___dtors_end = .;'
-OTHER_RELOCATING_SECTIONS='.stack 0x30000 : { _stack = .; *(.stack) }'
diff --git a/contrib/binutils/ld/genscripts.sh b/contrib/binutils/ld/genscripts.sh
index 501a68c..fe1fa49 100755
--- a/contrib/binutils/ld/genscripts.sh
+++ b/contrib/binutils/ld/genscripts.sh
@@ -69,7 +69,7 @@ fi
# Always search $(tooldir)/lib, aka /usr/local/TARGET/lib.
LIB_PATH=${LIB_PATH}:${tool_lib}
-LIB_SEARCH_DIRS=`echo ${LIB_PATH} | tr ':' ' ' | sed -e 's/\([^ ][^ ]*\)/SEARCH_DIR(\1);/g'`
+LIB_SEARCH_DIRS=`echo ${LIB_PATH} | tr ':' ' ' | sed -e 's/\([^ ][^ ]*\)/SEARCH_DIR(\\"\1\\");/g'`
# Generate 5 or 6 script files from a master script template in
# ${srcdir}/scripttempl/${SCRIPT_NAME}.sh. Which one of the 5 or 6
diff --git a/contrib/binutils/ld/ldlang.c b/contrib/binutils/ld/ldlang.c
index a5b1dd7..5257547 100644
--- a/contrib/binutils/ld/ldlang.c
+++ b/contrib/binutils/ld/ldlang.c
@@ -92,6 +92,7 @@ static bfd *open_output PARAMS ((const char *));
static void ldlang_open_output PARAMS ((lang_statement_union_type *));
static void open_input_bfds PARAMS ((lang_statement_union_type *, boolean));
static void lang_reasonable_defaults PARAMS ((void));
+static void insert_undefined PARAMS ((const char *));
static void lang_place_undefineds PARAMS ((void));
static void map_input_to_output_sections
PARAMS ((lang_statement_union_type *, const char *,
@@ -2007,7 +2008,11 @@ lang_reasonable_defaults ()
}
/* Add the supplied name to the symbol table as an undefined reference.
- Remove items from the chain as we open input bfds. */
+ This is a two step process as the symbol table doesn't even exist at
+ the time the ld command line is processed. First we put the name
+ on a list, then, once the output file has been opened, transfer the
+ name to the symbol table. */
+
typedef struct ldlang_undef_chain_list
{
struct ldlang_undef_chain_list *next;
@@ -2028,6 +2033,28 @@ ldlang_add_undef (name)
ldlang_undef_chain_list_head = new;
new->name = xstrdup (name);
+
+ if (output_bfd != NULL)
+ insert_undefined (new->name);
+}
+
+/* Insert NAME as undefined in the symbol table. */
+
+static void
+insert_undefined (name)
+ const char *name;
+{
+ struct bfd_link_hash_entry *h;
+
+ h = bfd_link_hash_lookup (link_info.hash, name, true, false, true);
+ if (h == (struct bfd_link_hash_entry *) NULL)
+ einfo (_("%P%F: bfd_link_hash_lookup failed: %E\n"));
+ if (h->type == bfd_link_hash_new)
+ {
+ h->type = bfd_link_hash_undefined;
+ h->u.undef.abfd = NULL;
+ bfd_link_add_undef (link_info.hash, h);
+ }
}
/* Run through the list of undefineds created above and place them
@@ -2043,17 +2070,7 @@ lang_place_undefineds ()
ptr != (ldlang_undef_chain_list_type *) NULL;
ptr = ptr->next)
{
- struct bfd_link_hash_entry *h;
-
- h = bfd_link_hash_lookup (link_info.hash, ptr->name, true, false, true);
- if (h == (struct bfd_link_hash_entry *) NULL)
- einfo (_("%P%F: bfd_link_hash_lookup failed: %E\n"));
- if (h->type == bfd_link_hash_new)
- {
- h->type = bfd_link_hash_undefined;
- h->u.undef.abfd = NULL;
- bfd_link_add_undef (link_info.hash, h);
- }
+ insert_undefined (ptr->name);
}
}
@@ -3517,8 +3534,25 @@ lang_check ()
file = file->input_statement.next)
{
input_bfd = file->input_statement.the_bfd;
- compatible = bfd_arch_get_compatible (input_bfd,
- output_bfd);
+ compatible = bfd_arch_get_compatible (input_bfd, output_bfd);
+
+ /* In general it is not possible to perform a relocatable
+ link between differing object formats when the input
+ file has relocations, because the relocations in the
+ input format may not have equivalent representations in
+ the output format (and besides BFD does not translate
+ relocs for other link purposes than a final link). */
+ if ((link_info.relocateable || link_info.emitrelocations)
+ && (compatible == NULL
+ || bfd_get_flavour (input_bfd) != bfd_get_flavour (output_bfd))
+ && (bfd_get_file_flags (input_bfd) & HAS_RELOC) != 0)
+ {
+ einfo (_("%P%F: Relocatable linking with relocations from format %s (%B) to format %s (%B) is not supported\n"),
+ bfd_get_target (input_bfd), input_bfd,
+ bfd_get_target (output_bfd), output_bfd);
+ /* einfo with %F exits. */
+ }
+
if (compatible == NULL)
{
if (command_line.warn_mismatch)
@@ -3526,18 +3560,6 @@ lang_check ()
bfd_printable_name (input_bfd), input_bfd,
bfd_printable_name (output_bfd));
}
- else if (link_info.relocateable
- /* In general it is not possible to perform a relocatable
- link between differing object formats when the input
- file has relocations, because the relocations in the
- input format may not have equivalent representations in
- the output format (and besides BFD does not translate
- relocs for other link purposes than a final link). */
- && bfd_get_flavour (input_bfd) != bfd_get_flavour (output_bfd)
- && (bfd_get_file_flags (input_bfd) & HAS_RELOC) != 0)
- einfo (_("%P%F: Relocatable linking with relocations from format %s (%B) to format %s (%B) is not supported\n"),
- bfd_get_target (input_bfd), input_bfd,
- bfd_get_target (output_bfd), output_bfd);
else if (bfd_count_sections (input_bfd))
{
/* If the input bfd has no contents, it shouldn't set the
@@ -4141,6 +4163,22 @@ lang_process ()
/* Find any sections not attached explicitly and handle them. */
lang_place_orphans ();
+ if (! link_info.relocateable)
+ {
+ /* Look for a text section and set the readonly attribute in it. */
+ asection *found = bfd_get_section_by_name (output_bfd, ".text");
+
+ if (found != (asection *) NULL)
+ {
+ if (config.text_read_only)
+ found->flags |= SEC_READONLY;
+ else
+ found->flags &= ~SEC_READONLY;
+ }
+ }
+
+ /* Do anything special before sizing sections. This is where ELF
+ and other back-ends size dynamic sections. */
ldemul_before_allocation ();
/* We must record the program headers before we try to fix the
diff --git a/contrib/binutils/ld/ldmain.c b/contrib/binutils/ld/ldmain.c
index 12e31dd..5bda3d3 100644
--- a/contrib/binutils/ld/ldmain.c
+++ b/contrib/binutils/ld/ldmain.c
@@ -404,20 +404,6 @@ main (argc, argv)
/* Print error messages for any missing symbols, for any warning
symbols, and possibly multiple definitions. */
- if (! link_info.relocateable)
- {
- /* Look for a text section and switch the readonly attribute in it. */
- asection *found = bfd_get_section_by_name (output_bfd, ".text");
-
- if (found != (asection *) NULL)
- {
- if (config.text_read_only)
- found->flags |= SEC_READONLY;
- else
- found->flags &= ~SEC_READONLY;
- }
- }
-
if (link_info.relocateable)
output_bfd->flags &= ~EXEC_P;
else
diff --git a/contrib/binutils/ld/scripttempl/elf.sc b/contrib/binutils/ld/scripttempl/elf.sc
index fe8e242..fd31d03 100644
--- a/contrib/binutils/ld/scripttempl/elf.sc
+++ b/contrib/binutils/ld/scripttempl/elf.sc
@@ -272,6 +272,23 @@ cat <<EOF
${CREATE_SHLIB-${RELOCATING+. = ${DATA_ADDR-ALIGN(${MAXPAGESIZE}) + (. & (${MAXPAGESIZE} - 1))};}}
${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_DATA_ADDR-ALIGN(${MAXPAGESIZE}) + (. & (${MAXPAGESIZE} - 1))};}}
+ /* Ensure the __preinit_array_start label is properly aligned. We
+ could instead move the label definition inside the section, but
+ the linker would then create the section even if it turns out to
+ be empty, which isn't pretty. */
+ ${RELOCATING+. = ALIGN(${ALIGNMENT});}
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE (__preinit_array_start = .);}}
+ .preinit_array ${RELOCATING-0} : { *(.preinit_array) }
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE (__preinit_array_end = .);}}
+
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE (__init_array_start = .);}}
+ .init_array ${RELOCATING-0} : { *(.init_array) }
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE (__init_array_end = .);}}
+
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE (__fini_array_start = .);}}
+ .fini_array ${RELOCATING-0} : { *(.fini_array) }
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE (__fini_array_end = .);}}
+
.data ${RELOCATING-0} :
{
${RELOCATING+${DATA_START_SYMBOLS}}
diff --git a/contrib/binutils/ld/scripttempl/v850.sc b/contrib/binutils/ld/scripttempl/v850.sc
index 90731de..8958321 100644
--- a/contrib/binutils/ld/scripttempl/v850.sc
+++ b/contrib/binutils/ld/scripttempl/v850.sc
@@ -42,6 +42,8 @@ SECTIONS
.rela.data : { *(.rela.data) }
.rel.rodata : { *(.rel.rodata) }
.rela.rodata : { *(.rela.rodata) }
+ .rel.gcc_except_table : { *(.rel.gcc_except_table) }
+ .rela.gcc_except_table : { *(.rela.gcc_except_table) }
.rel.got : { *(.rel.got) }
.rela.got : { *(.rela.got) }
.rel.ctors : { *(.rel.ctors) }
@@ -115,6 +117,12 @@ SECTIONS
KEEP (*crtend.o(.dtors))
${CONSTRUCTING+___dtors_end = .;}
}
+ .jcr :
+ {
+ KEEP (*(.jcr))
+ }
+
+ .gcc_except_table : { *(.gcc_except_table) }
.got : { *(.got.plt) *(.got) }
.dynamic : { *(.dynamic) }
diff --git a/contrib/binutils/opcodes/ChangeLog b/contrib/binutils/opcodes/ChangeLog
index 0e69f23..1a37508 100644
--- a/contrib/binutils/opcodes/ChangeLog
+++ b/contrib/binutils/opcodes/ChangeLog
@@ -1,3 +1,37 @@
+2002-04-04 Alan Modra <amodra@bigpond.net.au>
+
+ * dep-in.sed: Cope with absolute paths.
+ * Makefile.am (dep.sed): Subst TOPDIR.
+ Run "make dep-am".
+ * Makefile.in: Regenerate.
+
+ Merge from mainline
+ 2002-02-19 Martin Schwidefsky <schwidefsky@de.ibm.com>
+ * s390-dis.c (init_disasm): Use renamed architecture defines.
+
+2002-03-28 Alan Modra <amodra@bigpond.net.au>
+
+ * aclocal.m4: Regenerate.
+ * config.in: Regenerate.
+ * configure: Regenerate.
+ * Makefile.am: Run "make dep-am".
+ * Makefile.in: Regenerate.
+
+ Merge from mainline.
+ 2002-03-23 matthew green <mrg@redhat.com>
+ * ppc-opc.c (vmaddfp): Fix operand order.
+
+ 2002-03-21 Anton Blanchard <anton@samba.org>
+ * ppc-opc.c: Add optional field to mtmsrd.
+ (MTMSRD_L, XRLARB_MASK): Define.
+
+ 2002-03-13 Alan Modra <amodra@bigpond.net.au>
+ * ppc-opc.c: Add optional `L' field to tlbie.
+ (XRTLRA_MASK): Define.
+
+ 2002-02-20 Tom Rix <trix@redhat.com>
+ * ppc-opc.c (powerpc_operands): Add WS feild. Use for tlbre, tlbwe.
+
2002-02-26 Nick Clifton <nickc@cambridge.redhat.com>
* configure.in (LINGUAS): Add de.po.
diff --git a/contrib/binutils/opcodes/Makefile.am b/contrib/binutils/opcodes/Makefile.am
index c1d5a3d..bc4a665 100644
--- a/contrib/binutils/opcodes/Makefile.am
+++ b/contrib/binutils/opcodes/Makefile.am
@@ -374,7 +374,8 @@ dep.sed: dep-in.sed config.status
-e 's!@BFD_H@!$(BFD_H)!' \
-e 's!@INCDIR@!$(INCDIR)!' \
-e 's!@BFDDIR@!$(BFDDIR)!' \
- -e 's!@SRCDIR@!$(srcdir)!'
+ -e 's!@SRCDIR@!$(srcdir)!' \
+ -e 's!@TOPDIR@!'`echo $(srcdir) | sed -e s,/opcodes$$,,`'!'
dep: DEP
sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile
@@ -404,11 +405,11 @@ alpha-dis.lo: alpha-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
alpha-opc.lo: alpha-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/opcode/alpha.h $(BFD_H) $(INCDIR)/symcat.h \
opintl.h
-arc-dis.lo: arc-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \
- $(INCDIR)/symcat.h $(INCDIR)/opcode/arc.h $(BFDDIR)/elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/arc.h $(INCDIR)/elf/reloc-macros.h \
- opintl.h arc-dis.h arc-ext.h
+arc-dis.lo: arc-dis.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/arc.h \
+ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/arc.h \
+ $(INCDIR)/elf/reloc-macros.h opintl.h arc-dis.h arc-ext.h
arc-opc.lo: arc-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/opcode/arc.h
arc-ext.lo: arc-ext.c sysdep.h config.h $(INCDIR)/ansidecl.h \
@@ -486,19 +487,25 @@ i960-dis.lo: i960-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h
ia64-dis.lo: ia64-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \
$(INCDIR)/ansidecl.h $(INCDIR)/symcat.h $(INCDIR)/opcode/ia64.h
-ia64-opc-a.lo: ia64-opc-a.c ia64-opc.h $(INCDIR)/opcode/ia64.h
-ia64-opc-b.lo: ia64-opc-b.c ia64-opc.h $(INCDIR)/opcode/ia64.h
-ia64-opc-f.lo: ia64-opc-f.c ia64-opc.h $(INCDIR)/opcode/ia64.h
-ia64-opc-i.lo: ia64-opc-i.c ia64-opc.h $(INCDIR)/opcode/ia64.h
-ia64-opc-m.lo: ia64-opc-m.c ia64-opc.h $(INCDIR)/opcode/ia64.h
+ia64-opc-a.lo: ia64-opc-a.c ia64-opc.h $(INCDIR)/opcode/ia64.h \
+ $(BFD_H) $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h
+ia64-opc-b.lo: ia64-opc-b.c ia64-opc.h $(INCDIR)/opcode/ia64.h \
+ $(BFD_H) $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h
+ia64-opc-f.lo: ia64-opc-f.c ia64-opc.h $(INCDIR)/opcode/ia64.h \
+ $(BFD_H) $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h
+ia64-opc-i.lo: ia64-opc-i.c ia64-opc.h $(INCDIR)/opcode/ia64.h \
+ $(BFD_H) $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h
+ia64-opc-m.lo: ia64-opc-m.c ia64-opc.h $(INCDIR)/opcode/ia64.h \
+ $(BFD_H) $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h
ia64-opc-d.lo: ia64-opc-d.c
ia64-opc.lo: ia64-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
sysdep.h config.h ia64-asmtab.h $(INCDIR)/opcode/ia64.h \
- ia64-asmtab.c
+ $(BFD_H) $(INCDIR)/symcat.h ia64-asmtab.c
ia64-gen.lo: ia64-gen.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
$(INCDIR)/safe-ctype.h sysdep.h config.h ia64-opc.h \
- $(INCDIR)/opcode/ia64.h ia64-opc-a.c ia64-opc-i.c ia64-opc-m.c \
- ia64-opc-b.c ia64-opc-f.c ia64-opc-x.c ia64-opc-d.c
+ $(INCDIR)/opcode/ia64.h $(BFD_H) $(INCDIR)/symcat.h \
+ ia64-opc-a.c ia64-opc-i.c ia64-opc-m.c ia64-opc-b.c \
+ ia64-opc-f.c ia64-opc-x.c ia64-opc-d.c
ia64-asmtab.lo: ia64-asmtab.c
m32r-asm.lo: m32r-asm.c sysdep.h config.h $(INCDIR)/ansidecl.h \
$(BFD_H) $(INCDIR)/symcat.h m32r-desc.h $(INCDIR)/opcode/cgen.h \
@@ -526,7 +533,7 @@ m68hc11-opc.lo: m68hc11-opc.c $(INCDIR)/ansidecl.h \
$(INCDIR)/opcode/m68hc11.h
m68k-dis.lo: m68k-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/floatformat.h \
- opintl.h $(INCDIR)/opcode/m68k.h
+ $(INCDIR)/libiberty.h opintl.h $(INCDIR)/opcode/m68k.h
m68k-opc.lo: m68k-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/opcode/m68k.h
m88k-dis.lo: m88k-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
@@ -627,6 +634,12 @@ v850-opc.lo: v850-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \
vax-dis.lo: vax-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/opcode/vax.h $(INCDIR)/dis-asm.h $(BFD_H) \
$(INCDIR)/symcat.h
+sh64-dis.lo: sh64-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \
+ $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h sysdep.h config.h \
+ sh64-opc.h $(INCDIR)/libiberty.h $(BFDDIR)/elf-bfd.h \
+ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h
+sh64-opc.lo: sh64-opc.c sh64-opc.h
w65-dis.lo: w65-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
w65-opc.h $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h
xstormy16-asm.lo: xstormy16-asm.c sysdep.h config.h \
diff --git a/contrib/binutils/opcodes/Makefile.in b/contrib/binutils/opcodes/Makefile.in
index 3e7873d..466acf6 100644
--- a/contrib/binutils/opcodes/Makefile.in
+++ b/contrib/binutils/opcodes/Makefile.in
@@ -1,6 +1,6 @@
-# Makefile.in generated automatically by automake 1.4 from Makefile.am
+# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
-# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -416,7 +416,7 @@ acinclude.m4 aclocal.m4 config.in configure configure.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-TAR = gtar
+TAR = tar
GZIP_ENV = --best
SOURCES = libopcodes.a.c $(libopcodes_la_SOURCES)
OBJECTS = libopcodes.a.$(OBJEXT) $(libopcodes_la_OBJECTS)
@@ -581,7 +581,7 @@ maintainer-clean-recursive:
dot_seen=no; \
rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
rev="$$subdir $$rev"; \
- test "$$subdir" = "." && dot_seen=yes; \
+ test "$$subdir" != "." || dot_seen=yes; \
done; \
test "$$dot_seen" = "no" && rev=". $$rev"; \
target=`echo $@ | sed s/-recursive//`; \
@@ -885,7 +885,8 @@ dep.sed: dep-in.sed config.status
-e 's!@BFD_H@!$(BFD_H)!' \
-e 's!@INCDIR@!$(INCDIR)!' \
-e 's!@BFDDIR@!$(BFDDIR)!' \
- -e 's!@SRCDIR@!$(srcdir)!'
+ -e 's!@SRCDIR@!$(srcdir)!' \
+ -e 's!@TOPDIR@!'`echo $(srcdir) | sed -e s,/opcodes$$,,`'!'
dep: DEP
sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile
@@ -915,11 +916,11 @@ alpha-dis.lo: alpha-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
alpha-opc.lo: alpha-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/opcode/alpha.h $(BFD_H) $(INCDIR)/symcat.h \
opintl.h
-arc-dis.lo: arc-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \
- $(INCDIR)/symcat.h $(INCDIR)/opcode/arc.h $(BFDDIR)/elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/elf/arc.h $(INCDIR)/elf/reloc-macros.h \
- opintl.h arc-dis.h arc-ext.h
+arc-dis.lo: arc-dis.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/arc.h \
+ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/arc.h \
+ $(INCDIR)/elf/reloc-macros.h opintl.h arc-dis.h arc-ext.h
arc-opc.lo: arc-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/opcode/arc.h
arc-ext.lo: arc-ext.c sysdep.h config.h $(INCDIR)/ansidecl.h \
@@ -997,19 +998,25 @@ i960-dis.lo: i960-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h
ia64-dis.lo: ia64-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \
$(INCDIR)/ansidecl.h $(INCDIR)/symcat.h $(INCDIR)/opcode/ia64.h
-ia64-opc-a.lo: ia64-opc-a.c ia64-opc.h $(INCDIR)/opcode/ia64.h
-ia64-opc-b.lo: ia64-opc-b.c ia64-opc.h $(INCDIR)/opcode/ia64.h
-ia64-opc-f.lo: ia64-opc-f.c ia64-opc.h $(INCDIR)/opcode/ia64.h
-ia64-opc-i.lo: ia64-opc-i.c ia64-opc.h $(INCDIR)/opcode/ia64.h
-ia64-opc-m.lo: ia64-opc-m.c ia64-opc.h $(INCDIR)/opcode/ia64.h
+ia64-opc-a.lo: ia64-opc-a.c ia64-opc.h $(INCDIR)/opcode/ia64.h \
+ $(BFD_H) $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h
+ia64-opc-b.lo: ia64-opc-b.c ia64-opc.h $(INCDIR)/opcode/ia64.h \
+ $(BFD_H) $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h
+ia64-opc-f.lo: ia64-opc-f.c ia64-opc.h $(INCDIR)/opcode/ia64.h \
+ $(BFD_H) $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h
+ia64-opc-i.lo: ia64-opc-i.c ia64-opc.h $(INCDIR)/opcode/ia64.h \
+ $(BFD_H) $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h
+ia64-opc-m.lo: ia64-opc-m.c ia64-opc.h $(INCDIR)/opcode/ia64.h \
+ $(BFD_H) $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h
ia64-opc-d.lo: ia64-opc-d.c
ia64-opc.lo: ia64-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
sysdep.h config.h ia64-asmtab.h $(INCDIR)/opcode/ia64.h \
- ia64-asmtab.c
+ $(BFD_H) $(INCDIR)/symcat.h ia64-asmtab.c
ia64-gen.lo: ia64-gen.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
$(INCDIR)/safe-ctype.h sysdep.h config.h ia64-opc.h \
- $(INCDIR)/opcode/ia64.h ia64-opc-a.c ia64-opc-i.c ia64-opc-m.c \
- ia64-opc-b.c ia64-opc-f.c ia64-opc-x.c ia64-opc-d.c
+ $(INCDIR)/opcode/ia64.h $(BFD_H) $(INCDIR)/symcat.h \
+ ia64-opc-a.c ia64-opc-i.c ia64-opc-m.c ia64-opc-b.c \
+ ia64-opc-f.c ia64-opc-x.c ia64-opc-d.c
ia64-asmtab.lo: ia64-asmtab.c
m32r-asm.lo: m32r-asm.c sysdep.h config.h $(INCDIR)/ansidecl.h \
$(BFD_H) $(INCDIR)/symcat.h m32r-desc.h $(INCDIR)/opcode/cgen.h \
@@ -1037,7 +1044,7 @@ m68hc11-opc.lo: m68hc11-opc.c $(INCDIR)/ansidecl.h \
$(INCDIR)/opcode/m68hc11.h
m68k-dis.lo: m68k-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/floatformat.h \
- opintl.h $(INCDIR)/opcode/m68k.h
+ $(INCDIR)/libiberty.h opintl.h $(INCDIR)/opcode/m68k.h
m68k-opc.lo: m68k-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/opcode/m68k.h
m88k-dis.lo: m88k-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
@@ -1138,6 +1145,12 @@ v850-opc.lo: v850-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \
vax-dis.lo: vax-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/opcode/vax.h $(INCDIR)/dis-asm.h $(BFD_H) \
$(INCDIR)/symcat.h
+sh64-dis.lo: sh64-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \
+ $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h sysdep.h config.h \
+ sh64-opc.h $(INCDIR)/libiberty.h $(BFDDIR)/elf-bfd.h \
+ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h
+sh64-opc.lo: sh64-opc.c sh64-opc.h
w65-dis.lo: w65-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
w65-opc.h $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h
xstormy16-asm.lo: xstormy16-asm.c sysdep.h config.h \
diff --git a/contrib/binutils/opcodes/aclocal.m4 b/contrib/binutils/opcodes/aclocal.m4
index 2a4c03d..5858db7 100644
--- a/contrib/binutils/opcodes/aclocal.m4
+++ b/contrib/binutils/opcodes/aclocal.m4
@@ -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.
@@ -28,24 +28,6 @@ AC_DEFUN([CY_WITH_NLS],)
AC_SUBST(INTLLIBS)
])
-#serial 1
-# This test replaces the one in autoconf.
-# Currently this macro should have the same name as the autoconf macro
-# because gettext's gettext.m4 (distributed in the automake package)
-# still uses it. Otherwise, the use in gettext.m4 makes autoheader
-# give these diagnostics:
-# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
-# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
-
-undefine([AC_ISC_POSIX])
-
-AC_DEFUN(AC_ISC_POSIX,
- [
- dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
- AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
- ]
-)
-
# Do all the work for Automake. This macro actually does too much --
# some checks are only needed if your package does certain things.
# But this isn't really a big deal.
@@ -55,7 +37,7 @@ AC_DEFUN(AC_ISC_POSIX,
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)
@@ -83,7 +65,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
@@ -124,7 +106,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.
@@ -140,7 +122,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.
@@ -166,7 +148,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,
@@ -183,7 +165,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 --git a/contrib/binutils/opcodes/config.in b/contrib/binutils/opcodes/config.in
index 5caef55..6355be0 100644
--- a/contrib/binutils/opcodes/config.in
+++ b/contrib/binutils/opcodes/config.in
@@ -25,6 +25,9 @@
/* Define to `long' if <sys/types.h> doesn't define. */
#undef off_t
+/* Define if you need to in order for stat and other things to work. */
+#undef _POSIX_SOURCE
+
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
@@ -106,6 +109,12 @@
/* Define if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
+/* Define if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
diff --git a/contrib/binutils/opcodes/configure b/contrib/binutils/opcodes/configure
index b6ae7a8..2e978ada 100755
--- a/contrib/binutils/opcodes/configure
+++ b/contrib/binutils/opcodes/configure
@@ -719,49 +719,249 @@ test "$host_alias" != "$target_alias" &&
NONENONEs,x,x, &&
program_prefix=${target_alias}-
+# 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:726: 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
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="gcc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
- echo $ac_n "checking for strerror in -lcposix""... $ac_c" 1>&6
-echo "configure:725: checking for strerror in -lcposix" >&5
-ac_lib_var=`echo cposix'_'strerror | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+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:756: 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
- ac_save_LIBS="$LIBS"
-LIBS="-lcposix $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 733 "configure"
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_prog_rejected=no
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# -gt 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ set dummy "$ac_dir/$ac_word" "$@"
+ shift
+ ac_cv_prog_CC="$@"
+ fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test -z "$CC"; then
+ case "`uname -s`" in
+ *win32* | *WIN32*)
+ # 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:807: 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
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="cl"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+ ;;
+ esac
+ fi
+ test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:839: 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.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext << EOF
+
+#line 850 "configure"
#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char strerror();
-int main() {
-strerror()
-; return 0; }
+main(){return(0);}
EOF
-if { (eval echo configure:744: \"$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"
+if { (eval echo configure:855: \"$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
+ ac_cv_prog_cc_cross=no
+ else
+ ac_cv_prog_cc_cross=yes
+ fi
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
+ ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+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:881: 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:886: 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
+ cat > conftest.c <<EOF
+#ifdef __GNUC__
+ yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:895: \"$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
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+
+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:914: 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
+ echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+ ac_cv_prog_cc_g=yes
+else
+ ac_cv_prog_cc_g=no
fi
rm -f conftest*
-LIBS="$ac_save_LIBS"
fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+
+echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
+echo "configure:946: checking for POSIXized ISC" >&5
+if test -d /etc/conf/kconfig.d &&
+ grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
+then
echo "$ac_t""yes" 1>&6
- LIBS="$LIBS -lcposix"
+ ISC=yes # If later tests want to check for ISC.
+ cat >> confdefs.h <<\EOF
+#define _POSIX_SOURCE 1
+EOF
+
+ if test "$GCC" = yes; then
+ CC="$CC -posix"
+ else
+ CC="$CC -Xp"
+ fi
else
echo "$ac_t""no" 1>&6
+ ISC=
fi
-
-
# We currently only use the version number for the name of any shared
# library. For user convenience, we always use the same version
@@ -780,7 +980,7 @@ BFD_VERSION=`sed -n -e 's/^.._INIT_AUTOMAKE.*,[ ]*\([^ ]*\)[ ]*).*/\1/p' < ${
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:784: checking for a BSD compatible install" >&5
+echo "configure:984: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -833,7 +1033,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:837: checking whether build environment is sane" >&5
+echo "configure:1037: checking whether build environment is sane" >&5
# Just in case
sleep 1
echo timestamp > conftestfile
@@ -890,7 +1090,7 @@ test "$program_suffix" != NONE &&
test "$program_transform_name" = "" && program_transform_name="s,x,x,"
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:894: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:1094: checking whether ${MAKE-make} sets \${MAKE}" >&5
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -936,7 +1136,7 @@ EOF
missing_dir=`cd $ac_aux_dir && pwd`
echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:940: checking for working aclocal" >&5
+echo "configure:1140: checking for working aclocal" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -949,7 +1149,7 @@ else
fi
echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:953: checking for working autoconf" >&5
+echo "configure:1153: checking for working autoconf" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -962,7 +1162,7 @@ else
fi
echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:966: checking for working automake" >&5
+echo "configure:1166: checking for working automake" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -975,7 +1175,7 @@ else
fi
echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:979: checking for working autoheader" >&5
+echo "configure:1179: checking for working autoheader" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -988,7 +1188,7 @@ else
fi
echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:992: checking for working makeinfo" >&5
+echo "configure:1192: checking for working makeinfo" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1011,7 +1211,7 @@ fi
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}ar; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1015: checking for $ac_word" >&5
+echo "configure:1215: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1043,7 +1243,7 @@ fi
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1047: checking for $ac_word" >&5
+echo "configure:1247: 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
@@ -1075,7 +1275,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1079: checking for $ac_word" >&5
+echo "configure:1279: 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
@@ -1178,228 +1378,6 @@ else
enable_fast_install=yes
fi
-# Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1185: 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
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="gcc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-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:1215: 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
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_prog_rejected=no
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-if test $ac_prog_rejected = yes; then
- # We found a bogon in the path, so make sure we never use it.
- set dummy $ac_cv_prog_CC
- shift
- if test $# -gt 0; then
- # We chose a different compiler from the bogus one.
- # However, it has the same basename, so the bogon will be chosen
- # first if we set CC to just the basename; use the full file name.
- shift
- set dummy "$ac_dir/$ac_word" "$@"
- shift
- ac_cv_prog_CC="$@"
- fi
-fi
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- if test -z "$CC"; then
- case "`uname -s`" in
- *win32* | *WIN32*)
- # 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:1266: 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
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="cl"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
- ;;
- esac
- fi
- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1298: 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.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-cat > conftest.$ac_ext << EOF
-
-#line 1309 "configure"
-#include "confdefs.h"
-
-main(){return(0);}
-EOF
-if { (eval echo configure:1314: \"$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
- ac_cv_prog_cc_cross=no
- else
- ac_cv_prog_cc_cross=yes
- fi
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- ac_cv_prog_cc_works=no
-fi
-rm -fr conftest*
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
-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:1340: 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:1345: 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
- cat > conftest.c <<EOF
-#ifdef __GNUC__
- yes;
-#endif
-EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1354: \"$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
-fi
-fi
-
-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
-
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
-else
- GCC=
-fi
-
-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:1373: 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
- echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
- ac_cv_prog_cc_g=yes
-else
- ac_cv_prog_cc_g=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
-if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
-elif test $ac_cv_prog_cc_g = yes; then
- if test "$GCC" = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-g"
- fi
-else
- if test "$GCC" = yes; then
- CFLAGS="-O2"
- else
- CFLAGS=
- fi
-fi
-
# Check whether --with-gnu-ld or --without-gnu-ld was given.
if test "${with_gnu_ld+set}" = set; then
withval="$with_gnu_ld"
@@ -1412,7 +1390,7 @@ ac_prog=ld
if test "$GCC" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
-echo "configure:1416: checking for ld used by GCC" >&5
+echo "configure:1394: checking for ld used by GCC" >&5
case $host in
*-*-mingw*)
# gcc leaves a trailing carriage return which upsets mingw
@@ -1442,10 +1420,10 @@ echo "configure:1416: checking for ld used by GCC" >&5
esac
elif test "$with_gnu_ld" = yes; then
echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
-echo "configure:1446: checking for GNU ld" >&5
+echo "configure:1424: checking for GNU ld" >&5
else
echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
-echo "configure:1449: checking for non-GNU ld" >&5
+echo "configure:1427: checking for non-GNU ld" >&5
fi
if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1480,7 +1458,7 @@ else
fi
test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
-echo "configure:1484: checking if the linker ($LD) is GNU ld" >&5
+echo "configure:1462: checking if the linker ($LD) is GNU ld" >&5
if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1497,7 +1475,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6
-echo "configure:1501: checking for $LD option to reload object files" >&5
+echo "configure:1479: checking for $LD option to reload object files" >&5
if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1509,7 +1487,7 @@ reload_flag=$lt_cv_ld_reload_flag
test -n "$reload_flag" && reload_flag=" $reload_flag"
echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
-echo "configure:1513: checking for BSD-compatible nm" >&5
+echo "configure:1491: checking for BSD-compatible nm" >&5
if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1547,7 +1525,7 @@ NM="$lt_cv_path_NM"
echo "$ac_t""$NM" 1>&6
echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1551: checking whether ln -s works" >&5
+echo "configure:1529: checking whether ln -s works" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1568,7 +1546,7 @@ else
fi
echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6
-echo "configure:1572: checking how to recognise dependant libraries" >&5
+echo "configure:1550: checking how to recognise dependant libraries" >&5
if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1741,13 +1719,13 @@ file_magic_cmd=$lt_cv_file_magic_cmd
deplibs_check_method=$lt_cv_deplibs_check_method
echo $ac_n "checking for object suffix""... $ac_c" 1>&6
-echo "configure:1745: checking for object suffix" >&5
+echo "configure:1723: checking for object suffix" >&5
if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
rm -f conftest*
echo 'int i = 1;' > conftest.$ac_ext
-if { (eval echo configure:1751: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1729: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
for ac_file in conftest.*; do
case $ac_file in
*.c) ;;
@@ -1767,7 +1745,7 @@ ac_objext=$ac_cv_objext
echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:1771: checking for executable suffix" >&5
+echo "configure:1749: checking for executable suffix" >&5
if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1777,7 +1755,7 @@ else
rm -f conftest*
echo 'int main () { return 0; }' > conftest.$ac_ext
ac_cv_exeext=
- if { (eval echo configure:1781: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ if { (eval echo configure:1759: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
for file in conftest.*; do
case $file in
*.c | *.o | *.obj) ;;
@@ -1804,7 +1782,7 @@ case $deplibs_check_method in
file_magic*)
if test "$file_magic_cmd" = '$MAGIC_CMD'; then
echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6
-echo "configure:1808: checking for ${ac_tool_prefix}file" >&5
+echo "configure:1786: checking for ${ac_tool_prefix}file" >&5
if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1866,7 +1844,7 @@ fi
if test -z "$lt_cv_path_MAGIC_CMD"; then
if test -n "$ac_tool_prefix"; then
echo $ac_n "checking for file""... $ac_c" 1>&6
-echo "configure:1870: checking for file" >&5
+echo "configure:1848: checking for file" >&5
if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1937,7 +1915,7 @@ esac
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1941: checking for $ac_word" >&5
+echo "configure:1919: 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
@@ -1969,7 +1947,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1973: checking for $ac_word" >&5
+echo "configure:1951: 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
@@ -2004,7 +1982,7 @@ fi
# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
set dummy ${ac_tool_prefix}strip; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2008: checking for $ac_word" >&5
+echo "configure:1986: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2036,7 +2014,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "strip", so it can be a program name with args.
set dummy strip; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2040: checking for $ac_word" >&5
+echo "configure:2018: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2103,8 +2081,8 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
case $host in
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 2107 "configure"' > conftest.$ac_ext
- if { (eval echo configure:2108: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ echo '#line 2085 "configure"' > conftest.$ac_ext
+ if { (eval echo configure:2086: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
case `/usr/bin/file conftest.$ac_objext` in
*32-bit*)
LD="${LD-ld} -32"
@@ -2123,7 +2101,7 @@ case $host in
ia64-*-hpux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
- if { (eval echo configure:2127: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ if { (eval echo configure:2105: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
case "`/usr/bin/file conftest.o`" in
*ELF-32*)
HPUX_IA64_MODE="32"
@@ -2141,7 +2119,7 @@ ia64-*-hpux*)
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -belf"
echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
-echo "configure:2145: checking whether the C compiler needs -belf" >&5
+echo "configure:2123: checking whether the C compiler needs -belf" >&5
if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2154,14 +2132,14 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a
cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext <<EOF
-#line 2158 "configure"
+#line 2136 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:2165: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2143: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
lt_cv_cc_needs_belf=yes
else
@@ -2329,7 +2307,7 @@ if test -z "$target" ; then
fi
echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:2333: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo "configure:2311: 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"
@@ -2354,7 +2332,7 @@ fi
echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:2358: checking for executable suffix" >&5
+echo "configure:2336: checking for executable suffix" >&5
if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2364,7 +2342,7 @@ else
rm -f conftest*
echo 'int main () { return 0; }' > conftest.$ac_ext
ac_cv_exeext=
- if { (eval echo configure:2368: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ if { (eval echo configure:2346: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
for file in conftest.*; do
case $file in
*.c | *.o | *.obj) ;;
@@ -2390,7 +2368,7 @@ ac_exeext=$EXEEXT
# 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:2394: checking for $ac_word" >&5
+echo "configure:2372: 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
@@ -2420,7 +2398,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:2424: checking for $ac_word" >&5
+echo "configure:2402: 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
@@ -2471,7 +2449,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:2475: checking for $ac_word" >&5
+echo "configure:2453: 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
@@ -2503,7 +2481,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:2507: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:2485: 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.
@@ -2514,12 +2492,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
-#line 2518 "configure"
+#line 2496 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:2523: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2501: \"$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
@@ -2545,12 +2523,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:2549: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:2527: 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:2554: checking whether we are using GNU C" >&5
+echo "configure:2532: 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
@@ -2559,7 +2537,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2563: \"$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:2541: \"$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
@@ -2578,7 +2556,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:2582: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:2560: 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
@@ -2612,7 +2590,7 @@ fi
ALL_LINGUAS="fr sv tr es da de"
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:2616: checking how to run the C preprocessor" >&5
+echo "configure:2594: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -2627,13 +2605,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 2631 "configure"
+#line 2609 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2637: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2615: \"$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
:
@@ -2644,13 +2622,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 2648 "configure"
+#line 2626 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2654: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2632: \"$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
:
@@ -2661,13 +2639,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 2665 "configure"
+#line 2643 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2671: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2649: \"$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
:
@@ -2694,7 +2672,7 @@ echo "$ac_t""$CPP" 1>&6
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2698: checking for $ac_word" >&5
+echo "configure:2676: 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
@@ -2722,12 +2700,12 @@ else
fi
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:2726: checking for ANSI C header files" >&5
+echo "configure:2704: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2731 "configure"
+#line 2709 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -2735,7 +2713,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2739: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2717: \"$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*
@@ -2752,7 +2730,7 @@ rm -f conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 2756 "configure"
+#line 2734 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -2770,7 +2748,7 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 2774 "configure"
+#line 2752 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -2791,7 +2769,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 2795 "configure"
+#line 2773 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -2802,7 +2780,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
-if { (eval echo configure:2806: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2784: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@@ -2826,12 +2804,12 @@ EOF
fi
echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:2830: checking for working const" >&5
+echo "configure:2808: checking for working const" >&5
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2835 "configure"
+#line 2813 "configure"
#include "confdefs.h"
int main() {
@@ -2880,7 +2858,7 @@ ccp = (char const *const *) p;
; return 0; }
EOF
-if { (eval echo configure:2884: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2862: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
@@ -2901,21 +2879,21 @@ EOF
fi
echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:2905: checking for inline" >&5
+echo "configure:2883: checking for inline" >&5
if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
cat > conftest.$ac_ext <<EOF
-#line 2912 "configure"
+#line 2890 "configure"
#include "confdefs.h"
int main() {
} $ac_kw foo() {
; return 0; }
EOF
-if { (eval echo configure:2919: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2897: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_inline=$ac_kw; break
else
@@ -2941,12 +2919,12 @@ EOF
esac
echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:2945: checking for off_t" >&5
+echo "configure:2923: checking for off_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2950 "configure"
+#line 2928 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -2974,12 +2952,12 @@ EOF
fi
echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:2978: checking for size_t" >&5
+echo "configure:2956: checking for size_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2983 "configure"
+#line 2961 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -3009,19 +2987,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:3013: checking for working alloca.h" >&5
+echo "configure:2991: checking for working alloca.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3018 "configure"
+#line 2996 "configure"
#include "confdefs.h"
#include <alloca.h>
int main() {
char *p = alloca(2 * sizeof(int));
; return 0; }
EOF
-if { (eval echo configure:3025: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3003: \"$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
@@ -3042,12 +3020,12 @@ EOF
fi
echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:3046: checking for alloca" >&5
+echo "configure:3024: checking for alloca" >&5
if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3051 "configure"
+#line 3029 "configure"
#include "confdefs.h"
#ifdef __GNUC__
@@ -3075,7 +3053,7 @@ int main() {
char *p = (char *) alloca(1);
; return 0; }
EOF
-if { (eval echo configure:3079: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3057: \"$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
@@ -3107,12 +3085,12 @@ EOF
echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:3111: checking whether alloca needs Cray hooks" >&5
+echo "configure:3089: checking whether alloca needs Cray hooks" >&5
if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3116 "configure"
+#line 3094 "configure"
#include "confdefs.h"
#if defined(CRAY) && ! defined(CRAY2)
webecray
@@ -3137,12 +3115,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6
if test $ac_cv_os_cray = yes; then
for ac_func in _getb67 GETB67 getb67; do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3141: checking for $ac_func" >&5
+echo "configure:3119: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3146 "configure"
+#line 3124 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3165,7 +3143,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3169: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3147: \"$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
@@ -3192,7 +3170,7 @@ done
fi
echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:3196: checking stack direction for C alloca" >&5
+echo "configure:3174: 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
@@ -3200,7 +3178,7 @@ else
ac_cv_c_stack_direction=0
else
cat > conftest.$ac_ext <<EOF
-#line 3204 "configure"
+#line 3182 "configure"
#include "confdefs.h"
find_stack_direction ()
{
@@ -3219,7 +3197,7 @@ main ()
exit (find_stack_direction() < 0);
}
EOF
-if { (eval echo configure:3223: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3201: \"$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
@@ -3244,17 +3222,17 @@ for ac_hdr in stdlib.h unistd.h sys/stat.h sys/types.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3248: checking for $ac_hdr" >&5
+echo "configure:3226: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3253 "configure"
+#line 3231 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3258: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3236: \"$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*
@@ -3283,12 +3261,12 @@ done
for ac_func in getpagesize
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3287: checking for $ac_func" >&5
+echo "configure:3265: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3292 "configure"
+#line 3270 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3311,7 +3289,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3315: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3293: \"$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
@@ -3336,7 +3314,7 @@ fi
done
echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:3340: checking for working mmap" >&5
+echo "configure:3318: 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
@@ -3344,7 +3322,7 @@ else
ac_cv_func_mmap_fixed_mapped=no
else
cat > conftest.$ac_ext <<EOF
-#line 3348 "configure"
+#line 3326 "configure"
#include "confdefs.h"
/* Thanks to Mike Haertel and Jim Avera for this test.
@@ -3497,7 +3475,7 @@ main()
}
EOF
-if { (eval echo configure:3501: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3479: \"$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
@@ -3525,17 +3503,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:3529: checking for $ac_hdr" >&5
+echo "configure:3507: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3534 "configure"
+#line 3512 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3539: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3517: \"$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*
@@ -3565,12 +3543,12 @@ done
__argz_count __argz_stringify __argz_next
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3569: checking for $ac_func" >&5
+echo "configure:3547: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3574 "configure"
+#line 3552 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3593,7 +3571,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3597: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3575: \"$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
@@ -3622,12 +3600,12 @@ done
for ac_func in stpcpy
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3626: checking for $ac_func" >&5
+echo "configure:3604: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3631 "configure"
+#line 3609 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3650,7 +3628,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3654: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3632: \"$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
@@ -3684,19 +3662,19 @@ EOF
if test $ac_cv_header_locale_h = yes; then
echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
-echo "configure:3688: checking for LC_MESSAGES" >&5
+echo "configure:3666: checking for LC_MESSAGES" >&5
if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3693 "configure"
+#line 3671 "configure"
#include "confdefs.h"
#include <locale.h>
int main() {
return LC_MESSAGES
; return 0; }
EOF
-if { (eval echo configure:3700: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3678: \"$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
@@ -3717,7 +3695,7 @@ EOF
fi
fi
echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6
-echo "configure:3721: checking whether NLS is requested" >&5
+echo "configure:3699: 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"
@@ -3737,7 +3715,7 @@ fi
EOF
echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6
-echo "configure:3741: checking whether included gettext is requested" >&5
+echo "configure:3719: 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"
@@ -3756,17 +3734,17 @@ fi
ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for libintl.h""... $ac_c" 1>&6
-echo "configure:3760: checking for libintl.h" >&5
+echo "configure:3738: checking for libintl.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3765 "configure"
+#line 3743 "configure"
#include "confdefs.h"
#include <libintl.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3770: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3748: \"$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*
@@ -3783,19 +3761,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:3787: checking for gettext in libc" >&5
+echo "configure:3765: checking for gettext in libc" >&5
if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3792 "configure"
+#line 3770 "configure"
#include "confdefs.h"
#include <libintl.h>
int main() {
return (int) gettext ("")
; return 0; }
EOF
-if { (eval echo configure:3799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3777: \"$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
@@ -3811,7 +3789,7 @@ echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6
if test "$gt_cv_func_gettext_libc" != "yes"; then
echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6
-echo "configure:3815: checking for bindtextdomain in -lintl" >&5
+echo "configure:3793: 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
@@ -3819,7 +3797,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lintl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3823 "configure"
+#line 3801 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -3830,7 +3808,7 @@ int main() {
bindtextdomain()
; return 0; }
EOF
-if { (eval echo configure:3834: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3812: \"$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
@@ -3846,19 +3824,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:3850: checking for gettext in libintl" >&5
+echo "configure:3828: checking for gettext in libintl" >&5
if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3855 "configure"
+#line 3833 "configure"
#include "confdefs.h"
int main() {
return (int) gettext ("")
; return 0; }
EOF
-if { (eval echo configure:3862: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3840: \"$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
@@ -3886,7 +3864,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:3890: checking for $ac_word" >&5
+echo "configure:3868: 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
@@ -3920,12 +3898,12 @@ fi
for ac_func in dcgettext
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3924: checking for $ac_func" >&5
+echo "configure:3902: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3929 "configure"
+#line 3907 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3948,7 +3926,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3952: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3930: \"$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
@@ -3975,7 +3953,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:3979: checking for $ac_word" >&5
+echo "configure:3957: 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
@@ -4011,7 +3989,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:4015: checking for $ac_word" >&5
+echo "configure:3993: 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
@@ -4043,7 +4021,7 @@ else
fi
cat > conftest.$ac_ext <<EOF
-#line 4047 "configure"
+#line 4025 "configure"
#include "confdefs.h"
int main() {
@@ -4051,7 +4029,7 @@ extern int _nl_msg_cat_cntr;
return _nl_msg_cat_cntr
; return 0; }
EOF
-if { (eval echo configure:4055: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4033: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
CATOBJEXT=.gmo
DATADIRNAME=share
@@ -4083,7 +4061,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:4087: checking for $ac_word" >&5
+echo "configure:4065: 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
@@ -4117,7 +4095,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:4121: checking for $ac_word" >&5
+echo "configure:4099: 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
@@ -4153,7 +4131,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:4157: checking for $ac_word" >&5
+echo "configure:4135: 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
@@ -4243,7 +4221,7 @@ fi
LINGUAS=
else
echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6
-echo "configure:4247: checking for catalogs to be installed" >&5
+echo "configure:4225: checking for catalogs to be installed" >&5
NEW_LINGUAS=
for lang in ${LINGUAS=$ALL_LINGUAS}; do
case "$ALL_LINGUAS" in
@@ -4271,17 +4249,17 @@ echo "configure:4247: checking for catalogs to be installed" >&5
if test "$CATOBJEXT" = ".cat"; then
ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6
-echo "configure:4275: checking for linux/version.h" >&5
+echo "configure:4253: checking for linux/version.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4280 "configure"
+#line 4258 "configure"
#include "confdefs.h"
#include <linux/version.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4285: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4263: \"$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*
@@ -4359,7 +4337,7 @@ if test "x$cross_compiling" = "xno"; then
EXEEXT_FOR_BUILD='$(EXEEXT)'
else
echo $ac_n "checking for build system executable suffix""... $ac_c" 1>&6
-echo "configure:4363: checking for build system executable suffix" >&5
+echo "configure:4341: checking for build system executable suffix" >&5
if eval "test \"`echo '$''{'bfd_cv_build_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4396,7 +4374,7 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:4400: checking for a BSD compatible install" >&5
+echo "configure:4378: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4453,17 +4431,17 @@ for ac_hdr in string.h strings.h stdlib.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4457: checking for $ac_hdr" >&5
+echo "configure:4435: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4462 "configure"
+#line 4440 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4467: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4445: \"$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*
@@ -4834,6 +4812,7 @@ s%@build_alias@%$build_alias%g
s%@build_cpu@%$build_cpu%g
s%@build_vendor@%$build_vendor%g
s%@build_os@%$build_os%g
+s%@CC@%$CC%g
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
@@ -4847,7 +4826,6 @@ s%@MAKEINFO@%$MAKEINFO%g
s%@SET_MAKE@%$SET_MAKE%g
s%@AR@%$AR%g
s%@RANLIB@%$RANLIB%g
-s%@CC@%$CC%g
s%@LN_S@%$LN_S%g
s%@OBJEXT@%$OBJEXT%g
s%@EXEEXT@%$EXEEXT%g
diff --git a/contrib/binutils/opcodes/dep-in.sed b/contrib/binutils/opcodes/dep-in.sed
index c30dee5..e373d4c 100644
--- a/contrib/binutils/opcodes/dep-in.sed
+++ b/contrib/binutils/opcodes/dep-in.sed
@@ -6,7 +6,9 @@ t loop
s!\.o:!.lo:!
s! @BFD_H@! $(BFD_H)!g
s!@INCDIR@!$(INCDIR)!g
+s!@TOPDIR@/include!$(INCDIR)!g
s!@BFDDIR@!$(BFDDIR)!g
+s!@TOPDIR@/bfd!$(BFDDIR)!g
s!@SRCDIR@/!!g
s/\\\n */ /g
diff --git a/contrib/binutils/opcodes/ppc-opc.c b/contrib/binutils/opcodes/ppc-opc.c
index ebabb9a..c868ccc 100644
--- a/contrib/binutils/opcodes/ppc-opc.c
+++ b/contrib/binutils/opcodes/ppc-opc.c
@@ -504,6 +504,16 @@ const struct powerpc_operand powerpc_operands[] =
/* The SHB field in a VA form instruction. */
#define SHB UIMM + 1
{ 4, 6, 0, 0, 0 },
+
+ /* The WS field. */
+#define WS SHB + 1
+#define WS_MASK (0x7 << 11)
+ { 3, 11, 0, 0, 0 },
+
+ /* The L field in an mtmsrd instruction */
+#define MTMSRD_L WS + 1
+ { 1, 16, 0, 0, PPC_OPERAND_OPTIONAL },
+
};
/* The functions used to insert and extract complicated operands. */
@@ -1406,9 +1416,15 @@ extract_tbr (insn, dialect, invalid)
/* An X_MASK with the RA and RB fields fixed. */
#define XRARB_MASK (X_MASK | RA_MASK | RB_MASK)
+/* An XRARB_MASK, but with the L bit clear. */
+#define XRLARB_MASK (XRARB_MASK & ~((unsigned long) 1 << 16))
+
/* An X_MASK with the RT and RA fields fixed. */
#define XRTRA_MASK (X_MASK | RT_MASK | RA_MASK)
+/* An XRTRA_MASK, but with L bit clear. */
+#define XRTLRA_MASK (XRTRA_MASK & ~((unsigned long) 1 << 21))
+
/* An X form comparison instruction. */
#define XCMPL(op, xop, l) (X ((op), (xop)) | ((((unsigned long)(l)) & 1) << 21))
@@ -1797,7 +1813,7 @@ const struct powerpc_opcode powerpc_opcodes[] = {
{ "vctuxs", VX(4, 906), VX_MASK, PPCVEC, { VD, VB, UIMM } },
{ "vexptefp", VX(4, 394), VX_MASK, PPCVEC, { VD, VB } },
{ "vlogefp", VX(4, 458), VX_MASK, PPCVEC, { VD, VB } },
-{ "vmaddfp", VXA(4, 46), VXA_MASK, PPCVEC, { VD, VA, VB, VC } },
+{ "vmaddfp", VXA(4, 46), VXA_MASK, PPCVEC, { VD, VA, VC, VB } },
{ "vmaxfp", VX(4, 1034), VX_MASK, PPCVEC, { VD, VA, VB } },
{ "vmaxsb", VX(4, 258), VX_MASK, PPCVEC, { VD, VA, VB } },
{ "vmaxsh", VX(4, 322), VX_MASK, PPCVEC, { VD, VA, VB } },
@@ -2941,7 +2957,7 @@ const struct powerpc_opcode powerpc_opcodes[] = {
{ "wrteei", X(31,163), XE_MASK, PPC403, { E } },
{ "wrteei", X(31,163), XE_MASK, BOOKE, { E } },
-{ "mtmsrd", X(31,178), XRARB_MASK, PPC64, { RS } },
+{ "mtmsrd", X(31,178), XRLARB_MASK, PPC64, { RS, MTMSRD_L } },
{ "stdux", X(31,181), X_MASK, PPC64, { RS, RAS, RB } },
@@ -3065,7 +3081,7 @@ const struct powerpc_opcode powerpc_opcodes[] = {
{ "lhzxe", X(31,287), X_MASK, BOOKE64, { RT, RA, RB } },
-{ "tlbie", X(31,306), XRTRA_MASK, PPC, { RB } },
+{ "tlbie", X(31,306), XRTLRA_MASK, PPC, { RB, L } },
{ "tlbi", X(31,306), XRT_MASK, POWER, { RA, RB } },
{ "eciwx", X(31,310), X_MASK, PPC, { RT, RA, RB } },
@@ -3693,7 +3709,7 @@ const struct powerpc_opcode powerpc_opcodes[] = {
{ "stdxe", X(31,927), X_MASK, BOOKE64, { RS, RA, RB } },
-{ "tlbre", X(31,946), X_MASK, BOOKE, { RT, RA, SH } },
+{ "tlbre", X(31,946), X_MASK, BOOKE, { RT, RA, WS } },
{ "tlbrehi", XTLB(31,946,0), XTLB_MASK, PPC403, { RT, RA } },
{ "tlbrelo", XTLB(31,946,1), XTLB_MASK, PPC403, { RT, RA } },
@@ -3714,7 +3730,7 @@ const struct powerpc_opcode powerpc_opcodes[] = {
{ "tlbwelo", XTLB(31,978,1), XTLB_MASK, PPC403, { RT, RA } },
{ "tlbwe", X(31,978), X_MASK, PPC403, { RS, RA, SH } },
-{ "tlbwe", X(31,978), X_MASK, BOOKE, { RT, RA, SH } },
+{ "tlbwe", X(31,978), X_MASK, BOOKE, { RT, RA, WS } },
{ "icbi", X(31,982), XRT_MASK, PPC, { RA, RB } },
diff --git a/contrib/binutils/opcodes/v850-dis.c b/contrib/binutils/opcodes/v850-dis.c
index 0f68867..e72b1e8 100644
--- a/contrib/binutils/opcodes/v850-dis.c
+++ b/contrib/binutils/opcodes/v850-dis.c
@@ -1,5 +1,5 @@
/* Disassemble V850 instructions.
- Copyright 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+ Copyright 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -41,6 +41,9 @@ static const char *const v850_cc_names[] =
{ "v", "c/l", "z", "nh", "s/n", "t", "lt", "le",
"nv", "nc/nl", "nz", "h", "ns/p", "sa", "ge", "gt" };
+static int disassemble
+ PARAMS ((bfd_vma, struct disassemble_info *, unsigned long));
+
static int
disassemble (memaddr, info, insn)
bfd_vma memaddr;
diff --git a/contrib/binutils/opcodes/v850-opc.c b/contrib/binutils/opcodes/v850-opc.c
index 20a4d6d..43ce2f1 100644
--- a/contrib/binutils/opcodes/v850-opc.c
+++ b/contrib/binutils/opcodes/v850-opc.c
@@ -1,5 +1,5 @@
/* Assemble V850 instructions.
- Copyright 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+ Copyright 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -34,6 +34,28 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* two-word opcodes */
#define two(x,y) ((unsigned int) (x) | ((unsigned int) (y) << 16))
+static long unsigned insert_d9 PARAMS ((long unsigned, long, const char **));
+static long unsigned extract_d9 PARAMS ((long unsigned, int *));
+static long unsigned insert_d22 PARAMS ((long unsigned, long, const char **));
+static long unsigned extract_d22 PARAMS ((long unsigned, int *));
+static long unsigned insert_d16_15 PARAMS ((long unsigned, long, const char **));
+static long unsigned extract_d16_15 PARAMS ((long unsigned, int *));
+static long unsigned insert_d8_7 PARAMS ((long unsigned, long, const char **));
+static long unsigned extract_d8_7 PARAMS ((long unsigned, int *));
+static long unsigned insert_d8_6 PARAMS ((long unsigned, long, const char **));
+static long unsigned extract_d8_6 PARAMS ((long unsigned, int *));
+static long unsigned insert_d5_4 PARAMS ((long unsigned, long, const char **));
+static long unsigned extract_d5_4 PARAMS ((long unsigned, int *));
+static long unsigned insert_d16_16 PARAMS ((long unsigned, long, const char **));
+static long unsigned extract_d16_16 PARAMS ((long unsigned, int *));
+static long unsigned insert_i9 PARAMS ((long unsigned, long, const char **));
+static long unsigned extract_i9 PARAMS ((long unsigned, int *));
+static long unsigned insert_u9 PARAMS ((long unsigned, long, const char **));
+static long unsigned extract_u9 PARAMS ((long unsigned, int *));
+static long unsigned insert_spe PARAMS ((long unsigned, long, const char **));
+static long unsigned extract_spe PARAMS ((long unsigned, int *));
+static long unsigned insert_i5div PARAMS ((long unsigned, long, const char **));
+static long unsigned extract_i5div PARAMS ((long unsigned, int *));
/* The functions used to insert and extract complicated operands. */
@@ -71,7 +93,7 @@ insert_d9 (insn, value, errmsg)
static unsigned long
extract_d9 (insn, invalid)
unsigned long insn;
- int * invalid;
+ int * invalid ATTRIBUTE_UNUSED;
{
unsigned long ret = ((insn & 0xf800) >> 7) | ((insn & 0x0070) >> 3);
@@ -103,7 +125,7 @@ insert_d22 (insn, value, errmsg)
static unsigned long
extract_d22 (insn, invalid)
unsigned long insn;
- int * invalid;
+ int * invalid ATTRIBUTE_UNUSED;
{
signed long ret = ((insn & 0xfffe0000) >> 16) | ((insn & 0x3f) << 16);
@@ -132,7 +154,7 @@ insert_d16_15 (insn, value, errmsg)
static unsigned long
extract_d16_15 (insn, invalid)
unsigned long insn;
- int * invalid;
+ int * invalid ATTRIBUTE_UNUSED;
{
signed long ret = (insn & 0xfffe0000);
@@ -163,7 +185,7 @@ insert_d8_7 (insn, value, errmsg)
static unsigned long
extract_d8_7 (insn, invalid)
unsigned long insn;
- int * invalid;
+ int * invalid ATTRIBUTE_UNUSED;
{
unsigned long ret = (insn & 0x7f);
@@ -194,7 +216,7 @@ insert_d8_6 (insn, value, errmsg)
static unsigned long
extract_d8_6 (insn, invalid)
unsigned long insn;
- int * invalid;
+ int * invalid ATTRIBUTE_UNUSED;
{
unsigned long ret = (insn & 0x7e);
@@ -225,7 +247,7 @@ insert_d5_4 (insn, value, errmsg)
static unsigned long
extract_d5_4 (insn, invalid)
unsigned long insn;
- int * invalid;
+ int * invalid ATTRIBUTE_UNUSED;
{
unsigned long ret = (insn & 0x0f);
@@ -247,7 +269,7 @@ insert_d16_16 (insn, value, errmsg)
static unsigned long
extract_d16_16 (insn, invalid)
unsigned long insn;
- int * invalid;
+ int * invalid ATTRIBUTE_UNUSED;
{
signed long ret = insn & 0xfffe0000;
@@ -273,7 +295,7 @@ insert_i9 (insn, value, errmsg)
static unsigned long
extract_i9 (insn, invalid)
unsigned long insn;
- int * invalid;
+ int * invalid ATTRIBUTE_UNUSED;
{
signed long ret = insn & 0x003c0000;
@@ -286,11 +308,12 @@ extract_i9 (insn, invalid)
}
static unsigned long
-insert_u9 (insn, value, errmsg)
+insert_u9 (insn, v, errmsg)
unsigned long insn;
- unsigned long value;
+ long v;
const char ** errmsg;
{
+ unsigned long value = (unsigned long) v;
if (value > 0x1ff)
* errmsg = _(immediate_out_of_range);
@@ -300,7 +323,7 @@ insert_u9 (insn, value, errmsg)
static unsigned long
extract_u9 (insn, invalid)
unsigned long insn;
- int * invalid;
+ int * invalid ATTRIBUTE_UNUSED;
{
unsigned long ret = insn & 0x003c0000;
@@ -312,11 +335,13 @@ extract_u9 (insn, invalid)
}
static unsigned long
-insert_spe (insn, value, errmsg)
+insert_spe (insn, v, errmsg)
unsigned long insn;
- unsigned long value;
+ long v;
const char ** errmsg;
{
+ unsigned long value = (unsigned long) v;
+
if (value != 3)
* errmsg = _("invalid register for stack adjustment");
@@ -325,18 +350,20 @@ insert_spe (insn, value, errmsg)
static unsigned long
extract_spe (insn, invalid)
- unsigned long insn;
- int * invalid;
+ unsigned long insn ATTRIBUTE_UNUSED;
+ int * invalid ATTRIBUTE_UNUSED;
{
return 3;
}
static unsigned long
-insert_i5div (insn, value, errmsg)
+insert_i5div (insn, v, errmsg)
unsigned long insn;
- unsigned long value;
+ long v;
const char ** errmsg;
{
+ unsigned long value = (unsigned long) v;
+
if (value > 0x1ff)
{
if (value & 1)
@@ -355,7 +382,7 @@ insert_i5div (insn, value, errmsg)
static unsigned long
extract_i5div (insn, invalid)
unsigned long insn;
- int * invalid;
+ int * invalid ATTRIBUTE_UNUSED;
{
unsigned long ret = insn & 0x3c0000;
@@ -369,7 +396,7 @@ extract_i5div (insn, invalid)
/* Warning: code in gas/config/tc-v850.c examines the contents of this array.
If you change any of the values here, be sure to look for side effects in
- that code. */
+ that code. */
const struct v850_operand v850_operands[] =
{
#define UNUSED 0
diff --git a/contrib/binutils/opcodes/z8k-dis.c b/contrib/binutils/opcodes/z8k-dis.c
index 8259500..091d937 100644
--- a/contrib/binutils/opcodes/z8k-dis.c
+++ b/contrib/binutils/opcodes/z8k-dis.c
@@ -1,5 +1,5 @@
/* Disassemble z8000 code.
- Copyright 1992, 1993, 1998, 2000
+ Copyright 1992, 1993, 1998, 2000, 2001
Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -26,8 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <setjmp.h>
-typedef struct
-{
+typedef struct {
/* These are all indexed by nibble number (i.e only every other entry
of bytes is used, and every 4th entry of words). */
unsigned char nibbles[24];
@@ -49,14 +48,16 @@ typedef struct
unsigned long ctrl_code;
unsigned long flags;
unsigned long interrupts;
-}
-instr_data_s;
+} instr_data_s;
+
+static int fetch_data PARAMS ((struct disassemble_info *, int));
+
/* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive)
to ADDR (exclusive) are valid. Returns 1 for success, longjmps
on error. */
#define FETCH_DATA(info, nibble) \
- ((nibble) < ((instr_data_s *)(info->private_data))->max_fetched \
+ ((nibble) < ((instr_data_s *) (info->private_data))->max_fetched \
? 1 : fetch_data ((info), (nibble)))
static int
@@ -105,8 +106,7 @@ fetch_data (info, nibble)
return 1;
}
-static char *codes[16] =
-{
+static char *codes[16] = {
"f",
"lt",
"le",
@@ -125,11 +125,24 @@ static char *codes[16] =
"nc/uge"
};
+static char *ctrl_names[8] = {
+ "<invld>",
+ "flags",
+ "fcw",
+ "refresh",
+ "psapseg",
+ "psapoff",
+ "nspseg",
+ "nspoff"
+};
+
+static int seg_length;
+static int print_insn_z8k PARAMS ((bfd_vma, disassemble_info *, int));
int z8k_lookup_instr PARAMS ((unsigned char *, disassemble_info *));
static void output_instr
PARAMS ((instr_data_s *, unsigned long, disassemble_info *));
static void unpack_instr PARAMS ((instr_data_s *, int, disassemble_info *));
-static void unparse_instr PARAMS ((instr_data_s *));
+static void unparse_instr PARAMS ((instr_data_s *, int));
static int
print_insn_z8k (addr, info, is_segmented)
@@ -150,9 +163,9 @@ print_insn_z8k (addr, info, is_segmented)
if (instr_data.tabl_index > 0)
{
unpack_instr (&instr_data, is_segmented, info);
- unparse_instr (&instr_data);
+ unparse_instr (&instr_data, is_segmented);
output_instr (&instr_data, addr, info);
- return z8k_table[instr_data.tabl_index].length;
+ return z8k_table[instr_data.tabl_index].length + seg_length;
}
else
{
@@ -260,13 +273,12 @@ z8k_lookup_instr (nibbles, info)
tabl_index++;
}
return -1;
-
}
static void
output_instr (instr_data, addr, info)
instr_data_s *instr_data;
- unsigned long addr;
+ unsigned long addr ATTRIBUTE_UNUSED;
disassemble_info *info;
{
int loop, loop_limit;
@@ -275,7 +287,7 @@ output_instr (instr_data, addr, info)
strcpy (out_str, "\t");
- loop_limit = z8k_table[instr_data->tabl_index].length * 2;
+ loop_limit = (z8k_table[instr_data->tabl_index].length + seg_length) * 2;
FETCH_DATA (info, loop_limit);
for (loop = 0; loop < loop_limit; loop++)
{
@@ -302,16 +314,18 @@ unpack_instr (instr_data, is_segmented, info)
int nibl_count, loop;
unsigned short instr_nibl, instr_byte, instr_word;
long instr_long;
- unsigned short tabl_datum, datum_class, datum_value;
+ unsigned int tabl_datum, datum_class;
+ unsigned short datum_value;
nibl_count = 0;
loop = 0;
+ seg_length = 0;
while (z8k_table[instr_data->tabl_index].byte_info[loop] != 0)
{
FETCH_DATA (info, nibl_count + 4 - (nibl_count % 4));
instr_nibl = instr_data->nibbles[nibl_count];
- instr_byte = instr_data->bytes[nibl_count];
- instr_word = instr_data->words[nibl_count];
+ instr_byte = instr_data->bytes[nibl_count & ~1];
+ instr_word = instr_data->words[nibl_count & ~3];
tabl_datum = z8k_table[instr_data->tabl_index].byte_info[loop];
datum_class = tabl_datum & CLASS_MASK;
@@ -319,24 +333,26 @@ unpack_instr (instr_data, is_segmented, info)
switch (datum_class)
{
- case CLASS_X:
- instr_data->address = instr_nibl;
- break;
- case CLASS_BA:
- instr_data->displacement = instr_nibl;
- break;
- case CLASS_BX:
- instr_data->arg_reg[datum_value] = instr_nibl;
- break;
case CLASS_DISP:
switch (datum_value)
{
case ARG_DISP16:
- instr_data->displacement = instr_word;
+ instr_data->displacement = instr_data->insn_start + 4
+ + (signed short) (instr_word & 0xffff);
nibl_count += 3;
break;
case ARG_DISP12:
- instr_data->displacement = instr_word & 0x0fff;
+ if (instr_word & 0x800)
+ {
+ /* neg. 12 bit displacement */
+ instr_data->displacement = instr_data->insn_start + 2
+ - (signed short) ((instr_word & 0xfff) | 0xf000) * 2;
+ }
+ else
+ {
+ instr_data->displacement = instr_data->insn_start + 2
+ - (instr_word & 0x0fff) * 2;
+ }
nibl_count += 2;
break;
default:
@@ -390,10 +406,6 @@ unpack_instr (instr_data, is_segmented, info)
case CLASS_CC:
instr_data->cond_code = instr_nibl;
break;
- case CLASS_CTRL:
- instr_data->ctrl_code = instr_nibl;
- break;
- case CLASS_DA:
case CLASS_ADDRESS:
if (is_segmented)
{
@@ -402,14 +414,15 @@ unpack_instr (instr_data, is_segmented, info)
FETCH_DATA (info, nibl_count + 8);
instr_long = (instr_data->words[nibl_count] << 16)
| (instr_data->words[nibl_count + 4]);
- instr_data->address = ((instr_word & 0x7f00) << 8) +
- (instr_long & 0xffff);
+ instr_data->address = ((instr_word & 0x7f00) << 8)
+ + (instr_long & 0xffff);
nibl_count += 7;
+ seg_length = 2;
}
else
{
- instr_data->address = ((instr_word & 0x7f00) << 8) +
- (instr_word & 0x00ff);
+ instr_data->address = ((instr_word & 0x7f00) << 8)
+ + (instr_word & 0x00ff);
nibl_count += 3;
}
}
@@ -420,17 +433,17 @@ unpack_instr (instr_data, is_segmented, info)
}
break;
case CLASS_0CCC:
- instr_data->cond_code = instr_nibl & 0x7;
- break;
case CLASS_1CCC:
- instr_data->cond_code = instr_nibl & 0x7;
+ instr_data->ctrl_code = instr_nibl & 0x7;
break;
case CLASS_0DISP7:
- instr_data->displacement = instr_byte & 0x7f;
+ instr_data->displacement =
+ instr_data->insn_start + 2 - (instr_byte & 0x7f) * 2;
nibl_count += 1;
break;
case CLASS_1DISP7:
- instr_data->displacement = instr_byte & 0x7f;
+ instr_data->displacement =
+ instr_data->insn_start + 2 - (instr_byte & 0x7f) * 2;
nibl_count += 1;
break;
case CLASS_01II:
@@ -440,10 +453,7 @@ unpack_instr (instr_data, is_segmented, info)
instr_data->interrupts = instr_nibl & 0x3;
break;
case CLASS_BIT:
- /* Do nothing. */
- break;
- case CLASS_IR:
- instr_data->arg_reg[datum_value] = instr_nibl;
+ instr_data->ctrl_code = instr_nibl & 0x7;
break;
case CLASS_FLAGS:
instr_data->flags = instr_nibl;
@@ -451,22 +461,16 @@ unpack_instr (instr_data, is_segmented, info)
case CLASS_REG:
instr_data->arg_reg[datum_value] = instr_nibl;
break;
- case CLASS_REG_BYTE:
- instr_data->arg_reg[datum_value] = instr_nibl;
- break;
- case CLASS_REG_WORD:
- instr_data->arg_reg[datum_value] = instr_nibl;
- break;
- case CLASS_REG_QUAD:
- instr_data->arg_reg[datum_value] = instr_nibl;
- break;
- case CLASS_REG_LONG:
- instr_data->arg_reg[datum_value] = instr_nibl;
- break;
case CLASS_REGN0:
instr_data->arg_reg[datum_value] = instr_nibl;
break;
+ case CLASS_DISP8:
+ instr_data->displacement =
+ instr_data->insn_start + 2 + (signed char) instr_byte * 2;
+ nibl_count += 1;
+ break;
default:
+ abort ();
break;
}
@@ -476,10 +480,12 @@ unpack_instr (instr_data, is_segmented, info)
}
static void
-unparse_instr (instr_data)
+unparse_instr (instr_data, is_segmented)
instr_data_s *instr_data;
+ int is_segmented;
{
- unsigned short tabl_datum, datum_class, datum_value;
+ unsigned short datum_value;
+ unsigned int tabl_datum, datum_class;
int loop, loop_limit;
char out_str[80], tmp_str[25];
@@ -513,7 +519,7 @@ unparse_instr (instr_data)
strcat (out_str, tmp_str);
break;
case CLASS_DISP:
- sprintf (tmp_str, "#0x%0lx", instr_data->displacement);
+ sprintf (tmp_str, "0x%0lx", instr_data->displacement);
strcat (out_str, tmp_str);
break;
case CLASS_IMM:
@@ -525,16 +531,19 @@ unparse_instr (instr_data)
strcat (out_str, tmp_str);
break;
case CLASS_CTRL:
- sprintf (tmp_str, "0x%0lx", instr_data->ctrl_code);
+ sprintf (tmp_str, "%s", ctrl_names[instr_data->ctrl_code]);
strcat (out_str, tmp_str);
break;
case CLASS_DA:
case CLASS_ADDRESS:
- sprintf (tmp_str, "#0x%0lx", instr_data->address);
+ sprintf (tmp_str, "0x%0lx", instr_data->address);
strcat (out_str, tmp_str);
break;
case CLASS_IR:
- sprintf (tmp_str, "@R%ld", instr_data->arg_reg[datum_value]);
+ if (is_segmented)
+ sprintf (tmp_str, "@rr%ld", instr_data->arg_reg[datum_value]);
+ else
+ sprintf (tmp_str, "@r%ld", instr_data->arg_reg[datum_value]);
strcat (out_str, tmp_str);
break;
case CLASS_FLAGS:
@@ -543,14 +552,10 @@ unparse_instr (instr_data)
break;
case CLASS_REG_BYTE:
if (instr_data->arg_reg[datum_value] >= 0x8)
- {
- sprintf (tmp_str, "rl%ld",
- instr_data->arg_reg[datum_value] - 0x8);
- }
+ sprintf (tmp_str, "rl%ld",
+ instr_data->arg_reg[datum_value] - 0x8);
else
- {
- sprintf (tmp_str, "rh%ld", instr_data->arg_reg[datum_value]);
- }
+ sprintf (tmp_str, "rh%ld", instr_data->arg_reg[datum_value]);
strcat (out_str, tmp_str);
break;
case CLASS_REG_WORD:
@@ -565,7 +570,15 @@ unparse_instr (instr_data)
sprintf (tmp_str, "rr%ld", instr_data->arg_reg[datum_value]);
strcat (out_str, tmp_str);
break;
+ case CLASS_PR:
+ if (is_segmented)
+ sprintf (tmp_str, "rr%ld", instr_data->arg_reg[datum_value]);
+ else
+ sprintf (tmp_str, "r%ld", instr_data->arg_reg[datum_value]);
+ strcat (out_str, tmp_str);
+ break;
default:
+ abort ();
break;
}
}
diff --git a/contrib/binutils/opcodes/z8k-opc.h b/contrib/binutils/opcodes/z8k-opc.h
index 379a3a3..c62867c 100644
--- a/contrib/binutils/opcodes/z8k-opc.h
+++ b/contrib/binutils/opcodes/z8k-opc.h
@@ -210,7 +210,7 @@
#define OPC_trtdrb 156
#define OPC_trtib 157
#define OPC_trtirb 158
-#define OPC_trtdb 159
+#define OPC_trtrb 159
#define OPC_tset 160
#define OPC_tsetb 161
#define OPC_xor 162
@@ -236,6 +236,9 @@
#define OPC_rsvdb9 172
#define OPC_rsvdbf 172
#define OPC_outi 173
+#define OPC_ldctlb 174
+#define OPC_sin 175
+#define OPC_trtdb 176
typedef struct {
#ifdef NICENAMES
char *nicename;
@@ -245,7 +248,7 @@ int flags;
#endif
char *name;
unsigned char opcode;
-void (*func)();
+void (*func) PARAMS ((void));
unsigned int arg_info[4];
unsigned int byte_info[10];
int noperands;
@@ -2186,6 +2189,26 @@ opcode_entry_type z8k_table[] = {
{CLASS_BIT+7,CLASS_BIT+0xd,CLASS_REG+(ARG_RD),CLASS_0CCC,0,0,0,0,0,},2,2,192},
+/* 1000 1100 ssss 1001 *** ldctlb ctrl,rbs */
+{
+#ifdef NICENAMES
+"ldctlb ctrl,rbs",32,7,
+0x3f,
+#endif
+"ldctlb",OPC_ldctlb,0,{CLASS_CTRL,CLASS_REG_BYTE+(ARG_RS),},
+ {CLASS_BIT+8,CLASS_BIT+0xc,CLASS_REG+(ARG_RS),CLASS_BIT+9,0,0,0,0,0,},2,2,193},
+
+
+/* 1000 1100 dddd 0001 *** ldctlb rbd,ctrl */
+{
+#ifdef NICENAMES
+"ldctlb rbd,ctrl",32,7,
+0x00,
+#endif
+"ldctlb",OPC_ldctlb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_CTRL,},
+ {CLASS_BIT+8,CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_BIT+1,0,0,0,0,0,},2,2,194},
+
+
/* 1011 1011 ssN0 1001 0000 rrrr ddN0 1000 *** ldd @rd,@rs,rr */
{
#ifdef NICENAMES
@@ -2193,7 +2216,7 @@ opcode_entry_type z8k_table[] = {
0x04,
#endif
"ldd",OPC_ldd,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),},
- {CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,193},
+ {CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,195},
/* 1011 1010 ssN0 1001 0000 rrrr ddN0 1000 *** lddb @rd,@rs,rr */
@@ -2203,7 +2226,7 @@ opcode_entry_type z8k_table[] = {
0x04,
#endif
"lddb",OPC_lddb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),},
- {CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,194},
+ {CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,196},
/* 1011 1011 ssN0 1001 0000 rrrr ddN0 0000 *** lddr @rd,@rs,rr */
@@ -2213,7 +2236,7 @@ opcode_entry_type z8k_table[] = {
0x04,
#endif
"lddr",OPC_lddr,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),},
- {CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,195},
+ {CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,197},
/* 1011 1010 ssN0 1001 0000 rrrr ddN0 0000 *** lddrb @rd,@rs,rr */
@@ -2223,7 +2246,7 @@ opcode_entry_type z8k_table[] = {
0x04,
#endif
"lddrb",OPC_lddrb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),},
- {CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,196},
+ {CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,198},
/* 1011 1011 ssN0 0001 0000 rrrr ddN0 1000 *** ldi @rd,@rs,rr */
@@ -2233,7 +2256,7 @@ opcode_entry_type z8k_table[] = {
0x04,
#endif
"ldi",OPC_ldi,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),},
- {CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,197},
+ {CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,199},
/* 1011 1010 ssN0 0001 0000 rrrr ddN0 1000 *** ldib @rd,@rs,rr */
@@ -2243,7 +2266,7 @@ opcode_entry_type z8k_table[] = {
0x04,
#endif
"ldib",OPC_ldib,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),},
- {CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,198},
+ {CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,200},
/* 1011 1011 ssN0 0001 0000 rrrr ddN0 0000 *** ldir @rd,@rs,rr */
@@ -2253,7 +2276,7 @@ opcode_entry_type z8k_table[] = {
0x04,
#endif
"ldir",OPC_ldir,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),},
- {CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,199},
+ {CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,201},
/* 1011 1010 ssN0 0001 0000 rrrr ddN0 0000 *** ldirb @rd,@rs,rr */
@@ -2263,7 +2286,7 @@ opcode_entry_type z8k_table[] = {
0x04,
#endif
"ldirb",OPC_ldirb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),},
- {CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,200},
+ {CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,202},
/* 1011 1101 dddd imm4 *** ldk rd,imm4 */
@@ -2273,7 +2296,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"ldk",OPC_ldk,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
- {CLASS_BIT+0xb,CLASS_BIT+0xd,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,201},
+ {CLASS_BIT+0xb,CLASS_BIT+0xd,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,203},
/* 0001 1101 ddN0 ssss *** ldl @rd,rrs */
@@ -2283,7 +2306,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"ldl",OPC_ldl,0,{CLASS_IR+(ARG_RD),CLASS_REG_LONG+(ARG_RS),},
- {CLASS_BIT+1,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),0,0,0,0,0,},2,2,202},
+ {CLASS_BIT+1,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),0,0,0,0,0,},2,2,204},
/* 0101 1101 ddN0 ssss address_dst *** ldl address_dst(rd),rrs */
@@ -2293,7 +2316,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"ldl",OPC_ldl,0,{CLASS_X+(ARG_RD),CLASS_REG_LONG+(ARG_RS),},
- {CLASS_BIT+5,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,203},
+ {CLASS_BIT+5,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,205},
/* 0101 1101 0000 ssss address_dst *** ldl address_dst,rrs */
@@ -2303,7 +2326,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"ldl",OPC_ldl,0,{CLASS_DA+(ARG_DST),CLASS_REG_LONG+(ARG_RS),},
- {CLASS_BIT+5,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,204},
+ {CLASS_BIT+5,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,206},
/* 0011 0111 ddN0 ssss imm16 *** ldl rd(imm16),rrs */
@@ -2313,7 +2336,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"ldl",OPC_ldl,0,{CLASS_BA+(ARG_RD),CLASS_REG_LONG+(ARG_RS),},
- {CLASS_BIT+3,CLASS_BIT+7,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,205},
+ {CLASS_BIT+3,CLASS_BIT+7,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,207},
/* 0111 0111 ddN0 ssss 0000 xxxx 0000 0000 *** ldl rd(rx),rrs */
@@ -2323,7 +2346,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"ldl",OPC_ldl,0,{CLASS_BX+(ARG_RD),CLASS_REG_LONG+(ARG_RS),},
- {CLASS_BIT+7,CLASS_BIT+7,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_REG+(ARG_RX),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,206},
+ {CLASS_BIT+7,CLASS_BIT+7,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_REG+(ARG_RX),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,208},
/* 0001 0100 ssN0 dddd *** ldl rrd,@rs */
@@ -2333,7 +2356,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"ldl",OPC_ldl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IR+(ARG_RS),},
- {CLASS_BIT+1,CLASS_BIT+4,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,207},
+ {CLASS_BIT+1,CLASS_BIT+4,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,209},
/* 0101 0100 0000 dddd address_src *** ldl rrd,address_src */
@@ -2343,7 +2366,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"ldl",OPC_ldl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_DA+(ARG_SRC),},
- {CLASS_BIT+5,CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,208},
+ {CLASS_BIT+5,CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,210},
/* 0101 0100 ssN0 dddd address_src *** ldl rrd,address_src(rs) */
@@ -2353,7 +2376,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"ldl",OPC_ldl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_X+(ARG_RS),},
- {CLASS_BIT+5,CLASS_BIT+4,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,209},
+ {CLASS_BIT+5,CLASS_BIT+4,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,211},
/* 0001 0100 0000 dddd imm32 *** ldl rrd,imm32 */
@@ -2363,7 +2386,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"ldl",OPC_ldl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IMM+(ARG_IMM32),},
- {CLASS_BIT+1,CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM32),0,0,0,0,},2,6,210},
+ {CLASS_BIT+1,CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM32),0,0,0,0,},2,6,212},
/* 1001 0100 ssss dddd *** ldl rrd,rrs */
@@ -2373,7 +2396,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"ldl",OPC_ldl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_REG_LONG+(ARG_RS),},
- {CLASS_BIT+9,CLASS_BIT+4,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,211},
+ {CLASS_BIT+9,CLASS_BIT+4,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,213},
/* 0011 0101 ssN0 dddd imm16 *** ldl rrd,rs(imm16) */
@@ -2383,7 +2406,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"ldl",OPC_ldl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_BA+(ARG_RS),},
- {CLASS_BIT+3,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,212},
+ {CLASS_BIT+3,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,214},
/* 0111 0101 ssN0 dddd 0000 xxxx 0000 0000 *** ldl rrd,rs(rx) */
@@ -2393,7 +2416,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"ldl",OPC_ldl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_BX+(ARG_RS),},
- {CLASS_BIT+7,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_REG+(ARG_RX),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,213},
+ {CLASS_BIT+7,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_REG+(ARG_RX),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,215},
/* 0001 1100 ddN0 1001 0000 ssss 0000 nminus1 *** ldm @rd,rs,n */
@@ -2403,7 +2426,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"ldm",OPC_ldm,0,{CLASS_IR+(ARG_RD),CLASS_REG_WORD+(ARG_RS),CLASS_IMM + (ARG_IMMN),},
- {CLASS_BIT+1,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_IMM+(ARG_IMMNMINUS1),0,},3,4,214},
+ {CLASS_BIT+1,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_IMM+(ARG_IMMNMINUS1),0,},3,4,216},
/* 0101 1100 ddN0 1001 0000 ssss 0000 nminus1 address_dst *** ldm address_dst(rd),rs,n */
@@ -2413,7 +2436,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"ldm",OPC_ldm,0,{CLASS_X+(ARG_RD),CLASS_REG_WORD+(ARG_RS),CLASS_IMM + (ARG_IMMN),},
- {CLASS_BIT+5,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_IMM+(ARG_IMMNMINUS1),CLASS_ADDRESS+(ARG_DST),},3,6,215},
+ {CLASS_BIT+5,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_IMM+(ARG_IMMNMINUS1),CLASS_ADDRESS+(ARG_DST),},3,6,217},
/* 0101 1100 0000 1001 0000 ssss 0000 nminus1 address_dst *** ldm address_dst,rs,n */
@@ -2423,7 +2446,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"ldm",OPC_ldm,0,{CLASS_DA+(ARG_DST),CLASS_REG_WORD+(ARG_RS),CLASS_IMM + (ARG_IMMN),},
- {CLASS_BIT+5,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_IMM+(ARG_IMMNMINUS1),CLASS_ADDRESS+(ARG_DST),},3,6,216},
+ {CLASS_BIT+5,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_IMM+(ARG_IMMNMINUS1),CLASS_ADDRESS+(ARG_DST),},3,6,218},
/* 0001 1100 ssN0 0001 0000 dddd 0000 nminus1 *** ldm rd,@rs,n */
@@ -2433,7 +2456,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"ldm",OPC_ldm,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_IMM + (ARG_IMMN),},
- {CLASS_BIT+1,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_IMM+(ARG_IMMNMINUS1),0,},3,4,217},
+ {CLASS_BIT+1,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_IMM+(ARG_IMMNMINUS1),0,},3,4,219},
/* 0101 1100 ssN0 0001 0000 dddd 0000 nminus1 address_src *** ldm rd,address_src(rs),n */
@@ -2443,7 +2466,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"ldm",OPC_ldm,0,{CLASS_REG_WORD+(ARG_RD),CLASS_X+(ARG_RS),CLASS_IMM + (ARG_IMMN),},
- {CLASS_BIT+5,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_IMM+(ARG_IMMNMINUS1),CLASS_ADDRESS+(ARG_SRC),},3,6,218},
+ {CLASS_BIT+5,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_IMM+(ARG_IMMNMINUS1),CLASS_ADDRESS+(ARG_SRC),},3,6,220},
/* 0101 1100 0000 0001 0000 dddd 0000 nminus1 address_src *** ldm rd,address_src,n */
@@ -2453,7 +2476,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"ldm",OPC_ldm,0,{CLASS_REG_WORD+(ARG_RD),CLASS_DA+(ARG_SRC),CLASS_IMM + (ARG_IMMN),},
- {CLASS_BIT+5,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_IMM+(ARG_IMMNMINUS1),CLASS_ADDRESS+(ARG_SRC),},3,6,219},
+ {CLASS_BIT+5,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_IMM+(ARG_IMMNMINUS1),CLASS_ADDRESS+(ARG_SRC),},3,6,221},
/* 0011 1001 ssN0 0000 *** ldps @rs */
@@ -2463,7 +2486,7 @@ opcode_entry_type z8k_table[] = {
0x3f,
#endif
"ldps",OPC_ldps,0,{CLASS_IR+(ARG_RS),},
- {CLASS_BIT+3,CLASS_BIT+9,CLASS_REGN0+(ARG_RS),CLASS_BIT+0,0,0,0,0,0,},1,2,220},
+ {CLASS_BIT+3,CLASS_BIT+9,CLASS_REGN0+(ARG_RS),CLASS_BIT+0,0,0,0,0,0,},1,2,222},
/* 0111 1001 0000 0000 address_src *** ldps address_src */
@@ -2473,7 +2496,7 @@ opcode_entry_type z8k_table[] = {
0x3f,
#endif
"ldps",OPC_ldps,0,{CLASS_DA+(ARG_SRC),},
- {CLASS_BIT+7,CLASS_BIT+9,CLASS_BIT+0,CLASS_BIT+0,CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},1,4,221},
+ {CLASS_BIT+7,CLASS_BIT+9,CLASS_BIT+0,CLASS_BIT+0,CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},1,4,223},
/* 0111 1001 ssN0 0000 address_src *** ldps address_src(rs) */
@@ -2483,7 +2506,7 @@ opcode_entry_type z8k_table[] = {
0x3f,
#endif
"ldps",OPC_ldps,0,{CLASS_X+(ARG_RS),},
- {CLASS_BIT+7,CLASS_BIT+9,CLASS_REGN0+(ARG_RS),CLASS_BIT+0,CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},1,4,222},
+ {CLASS_BIT+7,CLASS_BIT+9,CLASS_REGN0+(ARG_RS),CLASS_BIT+0,CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},1,4,224},
/* 0011 0011 0000 ssss disp16 *** ldr disp16,rs */
@@ -2493,7 +2516,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"ldr",OPC_ldr,0,{CLASS_DISP,CLASS_REG_WORD+(ARG_RS),},
- {CLASS_BIT+3,CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_DISP+(ARG_DISP16),0,0,0,0,},2,4,223},
+ {CLASS_BIT+3,CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_DISP+(ARG_DISP16),0,0,0,0,},2,4,225},
/* 0011 0001 0000 dddd disp16 *** ldr rd,disp16 */
@@ -2503,7 +2526,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"ldr",OPC_ldr,0,{CLASS_REG_WORD+(ARG_RD),CLASS_DISP,},
- {CLASS_BIT+3,CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_DISP+(ARG_DISP16),0,0,0,0,},2,4,224},
+ {CLASS_BIT+3,CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_DISP+(ARG_DISP16),0,0,0,0,},2,4,226},
/* 0011 0010 0000 ssss disp16 *** ldrb disp16,rbs */
@@ -2513,7 +2536,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"ldrb",OPC_ldrb,0,{CLASS_DISP,CLASS_REG_BYTE+(ARG_RS),},
- {CLASS_BIT+3,CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_DISP+(ARG_DISP16),0,0,0,0,},2,4,225},
+ {CLASS_BIT+3,CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_DISP+(ARG_DISP16),0,0,0,0,},2,4,227},
/* 0011 0000 0000 dddd disp16 *** ldrb rbd,disp16 */
@@ -2523,7 +2546,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"ldrb",OPC_ldrb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_DISP,},
- {CLASS_BIT+3,CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_DISP+(ARG_DISP16),0,0,0,0,},2,4,226},
+ {CLASS_BIT+3,CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_DISP+(ARG_DISP16),0,0,0,0,},2,4,228},
/* 0011 0111 0000 ssss disp16 *** ldrl disp16,rrs */
@@ -2533,7 +2556,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"ldrl",OPC_ldrl,0,{CLASS_DISP,CLASS_REG_LONG+(ARG_RS),},
- {CLASS_BIT+3,CLASS_BIT+7,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_DISP+(ARG_DISP16),0,0,0,0,},2,4,227},
+ {CLASS_BIT+3,CLASS_BIT+7,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_DISP+(ARG_DISP16),0,0,0,0,},2,4,229},
/* 0011 0101 0000 dddd disp16 *** ldrl rrd,disp16 */
@@ -2543,7 +2566,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"ldrl",OPC_ldrl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_DISP,},
- {CLASS_BIT+3,CLASS_BIT+5,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_DISP+(ARG_DISP16),0,0,0,0,},2,4,228},
+ {CLASS_BIT+3,CLASS_BIT+5,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_DISP+(ARG_DISP16),0,0,0,0,},2,4,230},
/* 0111 1011 0000 1010 *** mbit */
@@ -2553,7 +2576,7 @@ opcode_entry_type z8k_table[] = {
0x38,
#endif
"mbit",OPC_mbit,0,{0},
- {CLASS_BIT+7,CLASS_BIT+0xb,CLASS_BIT+0,CLASS_BIT+0xa,0,0,0,0,0,},0,2,229},
+ {CLASS_BIT+7,CLASS_BIT+0xb,CLASS_BIT+0,CLASS_BIT+0xa,0,0,0,0,0,},0,2,231},
/* 0111 1011 dddd 1101 *** mreq rd */
@@ -2563,7 +2586,7 @@ opcode_entry_type z8k_table[] = {
0x18,
#endif
"mreq",OPC_mreq,0,{CLASS_REG_WORD+(ARG_RD),},
- {CLASS_BIT+7,CLASS_BIT+0xb,CLASS_REG+(ARG_RD),CLASS_BIT+0xd,0,0,0,0,0,},1,2,230},
+ {CLASS_BIT+7,CLASS_BIT+0xb,CLASS_REG+(ARG_RD),CLASS_BIT+0xd,0,0,0,0,0,},1,2,232},
/* 0111 1011 0000 1001 *** mres */
@@ -2573,7 +2596,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"mres",OPC_mres,0,{0},
- {CLASS_BIT+7,CLASS_BIT+0xb,CLASS_BIT+0,CLASS_BIT+9,0,0,0,0,0,},0,2,231},
+ {CLASS_BIT+7,CLASS_BIT+0xb,CLASS_BIT+0,CLASS_BIT+9,0,0,0,0,0,},0,2,233},
/* 0111 1011 0000 1000 *** mset */
@@ -2583,7 +2606,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"mset",OPC_mset,0,{0},
- {CLASS_BIT+7,CLASS_BIT+0xb,CLASS_BIT+0,CLASS_BIT+8,0,0,0,0,0,},0,2,232},
+ {CLASS_BIT+7,CLASS_BIT+0xb,CLASS_BIT+0,CLASS_BIT+8,0,0,0,0,0,},0,2,234},
/* 0001 1001 ssN0 dddd *** mult rrd,@rs */
@@ -2593,7 +2616,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"mult",OPC_mult,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IR+(ARG_RS),},
- {CLASS_BIT+1,CLASS_BIT+9,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,233},
+ {CLASS_BIT+1,CLASS_BIT+9,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,235},
/* 0101 1001 0000 dddd address_src *** mult rrd,address_src */
@@ -2603,7 +2626,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"mult",OPC_mult,0,{CLASS_REG_LONG+(ARG_RD),CLASS_DA+(ARG_SRC),},
- {CLASS_BIT+5,CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,234},
+ {CLASS_BIT+5,CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,236},
/* 0101 1001 ssN0 dddd address_src *** mult rrd,address_src(rs) */
@@ -2613,7 +2636,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"mult",OPC_mult,0,{CLASS_REG_LONG+(ARG_RD),CLASS_X+(ARG_RS),},
- {CLASS_BIT+5,CLASS_BIT+9,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,235},
+ {CLASS_BIT+5,CLASS_BIT+9,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,237},
/* 0001 1001 0000 dddd imm16 *** mult rrd,imm16 */
@@ -2623,7 +2646,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"mult",OPC_mult,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IMM+(ARG_IMM16),},
- {CLASS_BIT+1,CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,236},
+ {CLASS_BIT+1,CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,238},
/* 1001 1001 ssss dddd *** mult rrd,rs */
@@ -2633,7 +2656,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"mult",OPC_mult,0,{CLASS_REG_LONG+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
- {CLASS_BIT+9,CLASS_BIT+9,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,237},
+ {CLASS_BIT+9,CLASS_BIT+9,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,239},
/* 0001 1000 ssN0 dddd *** multl rqd,@rs */
@@ -2643,7 +2666,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"multl",OPC_multl,0,{CLASS_REG_QUAD+(ARG_RD),CLASS_IR+(ARG_RS),},
- {CLASS_BIT+1,CLASS_BIT+8,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,238},
+ {CLASS_BIT+1,CLASS_BIT+8,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,240},
/* 0101 1000 0000 dddd address_src *** multl rqd,address_src */
@@ -2653,7 +2676,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"multl",OPC_multl,0,{CLASS_REG_QUAD+(ARG_RD),CLASS_DA+(ARG_SRC),},
- {CLASS_BIT+5,CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,239},
+ {CLASS_BIT+5,CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,241},
/* 0101 1000 ssN0 dddd address_src *** multl rqd,address_src(rs) */
@@ -2663,7 +2686,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"multl",OPC_multl,0,{CLASS_REG_QUAD+(ARG_RD),CLASS_X+(ARG_RS),},
- {CLASS_BIT+5,CLASS_BIT+8,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,240},
+ {CLASS_BIT+5,CLASS_BIT+8,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,242},
/* 0001 1000 0000 dddd imm32 *** multl rqd,imm32 */
@@ -2673,7 +2696,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"multl",OPC_multl,0,{CLASS_REG_QUAD+(ARG_RD),CLASS_IMM+(ARG_IMM32),},
- {CLASS_BIT+1,CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM32),0,0,0,0,},2,6,241},
+ {CLASS_BIT+1,CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM32),0,0,0,0,},2,6,243},
/* 1001 1000 ssss dddd *** multl rqd,rrs */
@@ -2683,7 +2706,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"multl",OPC_multl,0,{CLASS_REG_QUAD+(ARG_RD),CLASS_REG_LONG+(ARG_RS),},
- {CLASS_BIT+9,CLASS_BIT+8,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,242},
+ {CLASS_BIT+9,CLASS_BIT+8,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,244},
/* 0000 1101 ddN0 0010 *** neg @rd */
@@ -2693,7 +2716,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"neg",OPC_neg,0,{CLASS_IR+(ARG_RD),},
- {CLASS_BIT+0,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+2,0,0,0,0,0,},1,2,243},
+ {CLASS_BIT+0,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+2,0,0,0,0,0,},1,2,245},
/* 0100 1101 0000 0010 address_dst *** neg address_dst */
@@ -2703,7 +2726,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"neg",OPC_neg,0,{CLASS_DA+(ARG_DST),},
- {CLASS_BIT+4,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+2,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,244},
+ {CLASS_BIT+4,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+2,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,246},
/* 0100 1101 ddN0 0010 address_dst *** neg address_dst(rd) */
@@ -2713,7 +2736,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"neg",OPC_neg,0,{CLASS_X+(ARG_RD),},
- {CLASS_BIT+4,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+2,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,245},
+ {CLASS_BIT+4,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+2,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,247},
/* 1000 1101 dddd 0010 *** neg rd */
@@ -2723,7 +2746,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"neg",OPC_neg,0,{CLASS_REG_WORD+(ARG_RD),},
- {CLASS_BIT+8,CLASS_BIT+0xd,CLASS_REG+(ARG_RD),CLASS_BIT+2,0,0,0,0,0,},1,2,246},
+ {CLASS_BIT+8,CLASS_BIT+0xd,CLASS_REG+(ARG_RD),CLASS_BIT+2,0,0,0,0,0,},1,2,248},
/* 0000 1100 ddN0 0010 *** negb @rd */
@@ -2733,7 +2756,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"negb",OPC_negb,0,{CLASS_IR+(ARG_RD),},
- {CLASS_BIT+0,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+2,0,0,0,0,0,},1,2,247},
+ {CLASS_BIT+0,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+2,0,0,0,0,0,},1,2,249},
/* 0100 1100 0000 0010 address_dst *** negb address_dst */
@@ -2743,7 +2766,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"negb",OPC_negb,0,{CLASS_DA+(ARG_DST),},
- {CLASS_BIT+4,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+2,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,248},
+ {CLASS_BIT+4,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+2,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,250},
/* 0100 1100 ddN0 0010 address_dst *** negb address_dst(rd) */
@@ -2753,7 +2776,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"negb",OPC_negb,0,{CLASS_X+(ARG_RD),},
- {CLASS_BIT+4,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+2,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,249},
+ {CLASS_BIT+4,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+2,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,251},
/* 1000 1100 dddd 0010 *** negb rbd */
@@ -2763,7 +2786,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"negb",OPC_negb,0,{CLASS_REG_BYTE+(ARG_RD),},
- {CLASS_BIT+8,CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_BIT+2,0,0,0,0,0,},1,2,250},
+ {CLASS_BIT+8,CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_BIT+2,0,0,0,0,0,},1,2,252},
/* 1000 1101 0000 0111 *** nop */
@@ -2773,7 +2796,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"nop",OPC_nop,0,{0},
- {CLASS_BIT+8,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+7,0,0,0,0,0,},0,2,251},
+ {CLASS_BIT+8,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+7,0,0,0,0,0,},0,2,253},
/* 0000 0101 ssN0 dddd *** or rd,@rs */
@@ -2783,7 +2806,7 @@ opcode_entry_type z8k_table[] = {
0x38,
#endif
"or",OPC_or,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),},
- {CLASS_BIT+0,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,252},
+ {CLASS_BIT+0,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,254},
/* 0100 0101 0000 dddd address_src *** or rd,address_src */
@@ -2793,7 +2816,7 @@ opcode_entry_type z8k_table[] = {
0x38,
#endif
"or",OPC_or,0,{CLASS_REG_WORD+(ARG_RD),CLASS_DA+(ARG_SRC),},
- {CLASS_BIT+4,CLASS_BIT+5,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,253},
+ {CLASS_BIT+4,CLASS_BIT+5,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,255},
/* 0100 0101 ssN0 dddd address_src *** or rd,address_src(rs) */
@@ -2803,7 +2826,7 @@ opcode_entry_type z8k_table[] = {
0x38,
#endif
"or",OPC_or,0,{CLASS_REG_WORD+(ARG_RD),CLASS_X+(ARG_RS),},
- {CLASS_BIT+4,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,254},
+ {CLASS_BIT+4,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,256},
/* 0000 0101 0000 dddd imm16 *** or rd,imm16 */
@@ -2813,7 +2836,7 @@ opcode_entry_type z8k_table[] = {
0x38,
#endif
"or",OPC_or,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM16),},
- {CLASS_BIT+0,CLASS_BIT+5,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,255},
+ {CLASS_BIT+0,CLASS_BIT+5,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,257},
/* 1000 0101 ssss dddd *** or rd,rs */
@@ -2823,7 +2846,7 @@ opcode_entry_type z8k_table[] = {
0x38,
#endif
"or",OPC_or,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
- {CLASS_BIT+8,CLASS_BIT+5,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,256},
+ {CLASS_BIT+8,CLASS_BIT+5,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,258},
/* 0000 0100 ssN0 dddd *** orb rbd,@rs */
@@ -2833,7 +2856,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"orb",OPC_orb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IR+(ARG_RS),},
- {CLASS_BIT+0,CLASS_BIT+4,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,257},
+ {CLASS_BIT+0,CLASS_BIT+4,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,259},
/* 0100 0100 0000 dddd address_src *** orb rbd,address_src */
@@ -2843,7 +2866,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"orb",OPC_orb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_DA+(ARG_SRC),},
- {CLASS_BIT+4,CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,258},
+ {CLASS_BIT+4,CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,260},
/* 0100 0100 ssN0 dddd address_src *** orb rbd,address_src(rs) */
@@ -2853,7 +2876,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"orb",OPC_orb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_X+(ARG_RS),},
- {CLASS_BIT+4,CLASS_BIT+4,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,259},
+ {CLASS_BIT+4,CLASS_BIT+4,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,261},
/* 0000 0100 0000 dddd imm8 imm8 *** orb rbd,imm8 */
@@ -2863,7 +2886,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"orb",OPC_orb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
- {CLASS_BIT+0,CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,0,},2,4,260},
+ {CLASS_BIT+0,CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,0,},2,4,262},
/* 1000 0100 ssss dddd *** orb rbd,rbs */
@@ -2873,7 +2896,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"orb",OPC_orb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),},
- {CLASS_BIT+8,CLASS_BIT+4,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,261},
+ {CLASS_BIT+8,CLASS_BIT+4,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,263},
/* 0011 1111 ddN0 ssss *** out @rd,rs */
@@ -2883,7 +2906,7 @@ opcode_entry_type z8k_table[] = {
0x04,
#endif
"out",OPC_out,0,{CLASS_IR+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
- {CLASS_BIT+3,CLASS_BIT+0xf,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),0,0,0,0,0,},2,2,262},
+ {CLASS_BIT+3,CLASS_BIT+0xf,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),0,0,0,0,0,},2,2,264},
/* 0011 1011 ssss 0110 imm16 *** out imm16,rs */
@@ -2893,7 +2916,7 @@ opcode_entry_type z8k_table[] = {
0x04,
#endif
"out",OPC_out,0,{CLASS_IMM+(ARG_IMM16),CLASS_REG_WORD+(ARG_RS),},
- {CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REG+(ARG_RS),CLASS_BIT+6,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,263},
+ {CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REG+(ARG_RS),CLASS_BIT+6,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,265},
/* 0011 1110 ddN0 ssss *** outb @rd,rbs */
@@ -2903,7 +2926,7 @@ opcode_entry_type z8k_table[] = {
0x04,
#endif
"outb",OPC_outb,0,{CLASS_IR+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),},
- {CLASS_BIT+3,CLASS_BIT+0xe,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),0,0,0,0,0,},2,2,264},
+ {CLASS_BIT+3,CLASS_BIT+0xe,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),0,0,0,0,0,},2,2,266},
/* 0011 1010 ssss 0110 imm16 *** outb imm16,rbs */
@@ -2913,7 +2936,7 @@ opcode_entry_type z8k_table[] = {
0x04,
#endif
"outb",OPC_outb,0,{CLASS_IMM+(ARG_IMM16),CLASS_REG_BYTE+(ARG_RS),},
- {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REG+(ARG_RS),CLASS_BIT+6,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,265},
+ {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REG+(ARG_RS),CLASS_BIT+6,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,267},
/* 0011 1011 ssN0 1010 0000 aaaa ddN0 1000 *** outd @rd,@rs,ra */
@@ -2923,7 +2946,7 @@ opcode_entry_type z8k_table[] = {
0x04,
#endif
"outd",OPC_outd,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
- {CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,266},
+ {CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,268},
/* 0011 1010 ssN0 1010 0000 aaaa ddN0 1000 *** outdb @rd,@rs,rba */
@@ -2933,7 +2956,7 @@ opcode_entry_type z8k_table[] = {
0x04,
#endif
"outdb",OPC_outdb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_BYTE+(ARG_RA),},
- {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,267},
+ {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,269},
/* 0011 1011 ssN0 0010 0000 aaaa ddN0 1000 *** outi @rd,@rs,ra */
@@ -2943,7 +2966,7 @@ opcode_entry_type z8k_table[] = {
0x04,
#endif
"outi",OPC_outi,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
- {CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,268},
+ {CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,270},
/* 0011 1010 ssN0 0010 0000 aaaa ddN0 1000 *** outib @rd,@rs,ra */
@@ -2953,7 +2976,7 @@ opcode_entry_type z8k_table[] = {
0x04,
#endif
"outib",OPC_outib,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
- {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,269},
+ {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,271},
/* 0011 1010 ssN0 0010 0000 aaaa ddN0 0000 *** outibr @rd,@rs,ra */
@@ -2963,7 +2986,7 @@ opcode_entry_type z8k_table[] = {
0x04,
#endif
"outibr",OPC_outibr,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
- {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,270},
+ {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,272},
/* 0001 0111 ssN0 ddN0 *** pop @rd,@rs */
@@ -2973,7 +2996,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"pop",OPC_pop,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),},
- {CLASS_BIT+1,CLASS_BIT+7,CLASS_REGN0+(ARG_RS),CLASS_REGN0+(ARG_RD),0,0,0,0,0,},2,2,271},
+ {CLASS_BIT+1,CLASS_BIT+7,CLASS_REGN0+(ARG_RS),CLASS_REGN0+(ARG_RD),0,0,0,0,0,},2,2,273},
/* 0101 0111 ssN0 ddN0 address_dst *** pop address_dst(rd),@rs */
@@ -2983,7 +3006,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"pop",OPC_pop,0,{CLASS_X+(ARG_RD),CLASS_IR+(ARG_RS),},
- {CLASS_BIT+5,CLASS_BIT+7,CLASS_REGN0+(ARG_RS),CLASS_REGN0+(ARG_RD),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,272},
+ {CLASS_BIT+5,CLASS_BIT+7,CLASS_REGN0+(ARG_RS),CLASS_REGN0+(ARG_RD),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,274},
/* 0101 0111 ssN0 0000 address_dst *** pop address_dst,@rs */
@@ -2993,7 +3016,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"pop",OPC_pop,0,{CLASS_DA+(ARG_DST),CLASS_IR+(ARG_RS),},
- {CLASS_BIT+5,CLASS_BIT+7,CLASS_REGN0+(ARG_RS),CLASS_BIT+0,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,273},
+ {CLASS_BIT+5,CLASS_BIT+7,CLASS_REGN0+(ARG_RS),CLASS_BIT+0,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,275},
/* 1001 0111 ssN0 dddd *** pop rd,@rs */
@@ -3003,7 +3026,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"pop",OPC_pop,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),},
- {CLASS_BIT+9,CLASS_BIT+7,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,274},
+ {CLASS_BIT+9,CLASS_BIT+7,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,276},
/* 0001 0101 ssN0 ddN0 *** popl @rd,@rs */
@@ -3013,7 +3036,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"popl",OPC_popl,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),},
- {CLASS_BIT+1,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REGN0+(ARG_RD),0,0,0,0,0,},2,2,275},
+ {CLASS_BIT+1,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REGN0+(ARG_RD),0,0,0,0,0,},2,2,277},
/* 0101 0101 ssN0 ddN0 address_dst *** popl address_dst(rd),@rs */
@@ -3023,7 +3046,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"popl",OPC_popl,0,{CLASS_X+(ARG_RD),CLASS_IR+(ARG_RS),},
- {CLASS_BIT+5,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REGN0+(ARG_RD),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,276},
+ {CLASS_BIT+5,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REGN0+(ARG_RD),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,278},
/* 0101 0101 ssN0 0000 address_dst *** popl address_dst,@rs */
@@ -3033,7 +3056,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"popl",OPC_popl,0,{CLASS_DA+(ARG_DST),CLASS_IR+(ARG_RS),},
- {CLASS_BIT+5,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_BIT+0,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,277},
+ {CLASS_BIT+5,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_BIT+0,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,279},
/* 1001 0101 ssN0 dddd *** popl rrd,@rs */
@@ -3043,7 +3066,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"popl",OPC_popl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IR+(ARG_RS),},
- {CLASS_BIT+9,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,278},
+ {CLASS_BIT+9,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,280},
/* 0001 0011 ddN0 ssN0 *** push @rd,@rs */
@@ -3053,7 +3076,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"push",OPC_push,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),},
- {CLASS_BIT+1,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_REGN0+(ARG_RS),0,0,0,0,0,},2,2,279},
+ {CLASS_BIT+1,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_REGN0+(ARG_RS),0,0,0,0,0,},2,2,281},
/* 0101 0011 ddN0 0000 address_src *** push @rd,address_src */
@@ -3063,7 +3086,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"push",OPC_push,0,{CLASS_IR+(ARG_RD),CLASS_DA+(ARG_SRC),},
- {CLASS_BIT+5,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_BIT+0,CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,280},
+ {CLASS_BIT+5,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_BIT+0,CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,282},
/* 0101 0011 ddN0 ssN0 address_src *** push @rd,address_src(rs) */
@@ -3073,7 +3096,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"push",OPC_push,0,{CLASS_IR+(ARG_RD),CLASS_X+(ARG_RS),},
- {CLASS_BIT+5,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_REGN0+(ARG_RS),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,281},
+ {CLASS_BIT+5,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_REGN0+(ARG_RS),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,283},
/* 0000 1101 ddN0 1001 imm16 *** push @rd,imm16 */
@@ -3083,7 +3106,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"push",OPC_push,0,{CLASS_IR+(ARG_RD),CLASS_IMM+(ARG_IMM16),},
- {CLASS_BIT+0,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+9,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,282},
+ {CLASS_BIT+0,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+9,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,284},
/* 1001 0011 ddN0 ssss *** push @rd,rs */
@@ -3093,7 +3116,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"push",OPC_push,0,{CLASS_IR+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
- {CLASS_BIT+9,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),0,0,0,0,0,},2,2,283},
+ {CLASS_BIT+9,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),0,0,0,0,0,},2,2,285},
/* 0001 0001 ddN0 ssN0 *** pushl @rd,@rs */
@@ -3103,7 +3126,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"pushl",OPC_pushl,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),},
- {CLASS_BIT+1,CLASS_BIT+1,CLASS_REGN0+(ARG_RD),CLASS_REGN0+(ARG_RS),0,0,0,0,0,},2,2,284},
+ {CLASS_BIT+1,CLASS_BIT+1,CLASS_REGN0+(ARG_RD),CLASS_REGN0+(ARG_RS),0,0,0,0,0,},2,2,286},
/* 0101 0001 ddN0 0000 address_src *** pushl @rd,address_src */
@@ -3113,7 +3136,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"pushl",OPC_pushl,0,{CLASS_IR+(ARG_RD),CLASS_DA+(ARG_SRC),},
- {CLASS_BIT+5,CLASS_BIT+1,CLASS_REGN0+(ARG_RD),CLASS_BIT+0,CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,285},
+ {CLASS_BIT+5,CLASS_BIT+1,CLASS_REGN0+(ARG_RD),CLASS_BIT+0,CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,287},
/* 0101 0001 ddN0 ssN0 address_src *** pushl @rd,address_src(rs) */
@@ -3123,7 +3146,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"pushl",OPC_pushl,0,{CLASS_IR+(ARG_RD),CLASS_X+(ARG_RS),},
- {CLASS_BIT+5,CLASS_BIT+1,CLASS_REGN0+(ARG_RD),CLASS_REGN0+(ARG_RS),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,286},
+ {CLASS_BIT+5,CLASS_BIT+1,CLASS_REGN0+(ARG_RD),CLASS_REGN0+(ARG_RS),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,288},
/* 1001 0001 ddN0 ssss *** pushl @rd,rrs */
@@ -3133,7 +3156,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"pushl",OPC_pushl,0,{CLASS_IR+(ARG_RD),CLASS_REG_LONG+(ARG_RS),},
- {CLASS_BIT+9,CLASS_BIT+1,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),0,0,0,0,0,},2,2,287},
+ {CLASS_BIT+9,CLASS_BIT+1,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),0,0,0,0,0,},2,2,289},
/* 0010 0011 ddN0 imm4 *** res @rd,imm4 */
@@ -3143,7 +3166,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"res",OPC_res,0,{CLASS_IR+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
- {CLASS_BIT+2,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,288},
+ {CLASS_BIT+2,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,290},
/* 0110 0011 ddN0 imm4 address_dst *** res address_dst(rd),imm4 */
@@ -3153,7 +3176,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"res",OPC_res,0,{CLASS_X+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
- {CLASS_BIT+6,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,289},
+ {CLASS_BIT+6,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,291},
/* 0110 0011 0000 imm4 address_dst *** res address_dst,imm4 */
@@ -3163,7 +3186,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"res",OPC_res,0,{CLASS_DA+(ARG_DST),CLASS_IMM +(ARG_IMM4),},
- {CLASS_BIT+6,CLASS_BIT+3,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,290},
+ {CLASS_BIT+6,CLASS_BIT+3,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,292},
/* 1010 0011 dddd imm4 *** res rd,imm4 */
@@ -3173,7 +3196,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"res",OPC_res,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
- {CLASS_BIT+0xa,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,291},
+ {CLASS_BIT+0xa,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,293},
/* 0010 0011 0000 ssss 0000 dddd 0000 0000 *** res rd,rs */
@@ -3183,7 +3206,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"res",OPC_res,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
- {CLASS_BIT+2,CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,292},
+ {CLASS_BIT+2,CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,294},
/* 0010 0010 ddN0 imm4 *** resb @rd,imm4 */
@@ -3193,7 +3216,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"resb",OPC_resb,0,{CLASS_IR+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
- {CLASS_BIT+2,CLASS_BIT+2,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,293},
+ {CLASS_BIT+2,CLASS_BIT+2,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,295},
/* 0110 0010 ddN0 imm4 address_dst *** resb address_dst(rd),imm4 */
@@ -3203,7 +3226,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"resb",OPC_resb,0,{CLASS_X+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
- {CLASS_BIT+6,CLASS_BIT+2,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,294},
+ {CLASS_BIT+6,CLASS_BIT+2,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,296},
/* 0110 0010 0000 imm4 address_dst *** resb address_dst,imm4 */
@@ -3213,7 +3236,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"resb",OPC_resb,0,{CLASS_DA+(ARG_DST),CLASS_IMM +(ARG_IMM4),},
- {CLASS_BIT+6,CLASS_BIT+2,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,295},
+ {CLASS_BIT+6,CLASS_BIT+2,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,297},
/* 1010 0010 dddd imm4 *** resb rbd,imm4 */
@@ -3223,7 +3246,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"resb",OPC_resb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
- {CLASS_BIT+0xa,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,296},
+ {CLASS_BIT+0xa,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,298},
/* 0010 0010 0000 ssss 0000 dddd 0000 0000 *** resb rbd,rs */
@@ -3233,7 +3256,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"resb",OPC_resb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
- {CLASS_BIT+2,CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,297},
+ {CLASS_BIT+2,CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,299},
/* 1000 1101 flags 0011 *** resflg flags */
@@ -3243,7 +3266,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"resflg",OPC_resflg,0,{CLASS_FLAGS,},
- {CLASS_BIT+8,CLASS_BIT+0xd,CLASS_FLAGS,CLASS_BIT+3,0,0,0,0,0,},1,2,298},
+ {CLASS_BIT+8,CLASS_BIT+0xd,CLASS_FLAGS,CLASS_BIT+3,0,0,0,0,0,},1,2,300},
/* 1001 1110 0000 cccc *** ret cc */
@@ -3253,7 +3276,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"ret",OPC_ret,0,{CLASS_CC,},
- {CLASS_BIT+9,CLASS_BIT+0xe,CLASS_BIT+0,CLASS_CC,0,0,0,0,0,},1,2,299},
+ {CLASS_BIT+9,CLASS_BIT+0xe,CLASS_BIT+0,CLASS_CC,0,0,0,0,0,},1,2,301},
/* 1011 0011 dddd 00I0 *** rl rd,imm1or2 */
@@ -3263,7 +3286,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"rl",OPC_rl,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM1OR2),},
- {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+0,0,0,0,0,0,},2,2,300},
+ {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+0,0,0,0,0,0,},2,2,302},
/* 1011 0010 dddd 00I0 *** rlb rbd,imm1or2 */
@@ -3273,7 +3296,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"rlb",OPC_rlb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM1OR2),},
- {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+0,0,0,0,0,0,},2,2,301},
+ {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+0,0,0,0,0,0,},2,2,303},
/* 1011 0011 dddd 10I0 *** rlc rd,imm1or2 */
@@ -3283,7 +3306,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"rlc",OPC_rlc,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM1OR2),},
- {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+8,0,0,0,0,0,},2,2,302},
+ {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+8,0,0,0,0,0,},2,2,304},
/* 1011 0010 dddd 10I0 *** rlcb rbd,imm1or2 */
@@ -3293,7 +3316,7 @@ opcode_entry_type z8k_table[] = {
0x10,
#endif
"rlcb",OPC_rlcb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM1OR2),},
- {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+8,0,0,0,0,0,},2,2,303},
+ {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+8,0,0,0,0,0,},2,2,305},
/* 1011 1110 aaaa bbbb *** rldb rbb,rba */
@@ -3303,7 +3326,7 @@ opcode_entry_type z8k_table[] = {
0x10,
#endif
"rldb",OPC_rldb,0,{CLASS_REG_BYTE+(ARG_RB),CLASS_REG_BYTE+(ARG_RA),},
- {CLASS_BIT+0xb,CLASS_BIT+0xe,CLASS_REG+(ARG_RA),CLASS_REG+(ARG_RB),0,0,0,0,0,},2,2,304},
+ {CLASS_BIT+0xb,CLASS_BIT+0xe,CLASS_REG+(ARG_RA),CLASS_REG+(ARG_RB),0,0,0,0,0,},2,2,306},
/* 1011 0011 dddd 01I0 *** rr rd,imm1or2 */
@@ -3313,7 +3336,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"rr",OPC_rr,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM1OR2),},
- {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+4,0,0,0,0,0,},2,2,305},
+ {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+4,0,0,0,0,0,},2,2,307},
/* 1011 0010 dddd 01I0 *** rrb rbd,imm1or2 */
@@ -3323,7 +3346,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"rrb",OPC_rrb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM1OR2),},
- {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+4,0,0,0,0,0,},2,2,306},
+ {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+4,0,0,0,0,0,},2,2,308},
/* 1011 0011 dddd 11I0 *** rrc rd,imm1or2 */
@@ -3333,7 +3356,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"rrc",OPC_rrc,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM1OR2),},
- {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+0xc,0,0,0,0,0,},2,2,307},
+ {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+0xc,0,0,0,0,0,},2,2,309},
/* 1011 0010 dddd 11I0 *** rrcb rbd,imm1or2 */
@@ -3343,7 +3366,7 @@ opcode_entry_type z8k_table[] = {
0x10,
#endif
"rrcb",OPC_rrcb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM1OR2),},
- {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+0xc,0,0,0,0,0,},2,2,308},
+ {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+0xc,0,0,0,0,0,},2,2,310},
/* 1011 1100 aaaa bbbb *** rrdb rbb,rba */
@@ -3353,7 +3376,7 @@ opcode_entry_type z8k_table[] = {
0x10,
#endif
"rrdb",OPC_rrdb,0,{CLASS_REG_BYTE+(ARG_RB),CLASS_REG_BYTE+(ARG_RA),},
- {CLASS_BIT+0xb,CLASS_BIT+0xc,CLASS_REG+(ARG_RA),CLASS_REG+(ARG_RB),0,0,0,0,0,},2,2,309},
+ {CLASS_BIT+0xb,CLASS_BIT+0xc,CLASS_REG+(ARG_RA),CLASS_REG+(ARG_RB),0,0,0,0,0,},2,2,311},
/* 0011 0110 imm8 *** rsvd36 */
@@ -3363,7 +3386,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"rsvd36",OPC_rsvd36,0,{0},
- {CLASS_BIT+3,CLASS_BIT+6,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,310},
+ {CLASS_BIT+3,CLASS_BIT+6,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,312},
/* 0011 1000 imm8 *** rsvd38 */
@@ -3373,7 +3396,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"rsvd38",OPC_rsvd38,0,{0},
- {CLASS_BIT+3,CLASS_BIT+8,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,311},
+ {CLASS_BIT+3,CLASS_BIT+8,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,313},
/* 0111 1000 imm8 *** rsvd78 */
@@ -3383,7 +3406,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"rsvd78",OPC_rsvd78,0,{0},
- {CLASS_BIT+7,CLASS_BIT+8,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,312},
+ {CLASS_BIT+7,CLASS_BIT+8,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,314},
/* 0111 1110 imm8 *** rsvd7e */
@@ -3393,7 +3416,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"rsvd7e",OPC_rsvd7e,0,{0},
- {CLASS_BIT+7,CLASS_BIT+0xe,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,313},
+ {CLASS_BIT+7,CLASS_BIT+0xe,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,315},
/* 1001 1101 imm8 *** rsvd9d */
@@ -3403,7 +3426,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"rsvd9d",OPC_rsvd9d,0,{0},
- {CLASS_BIT+9,CLASS_BIT+0xd,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,314},
+ {CLASS_BIT+9,CLASS_BIT+0xd,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,316},
/* 1001 1111 imm8 *** rsvd9f */
@@ -3413,7 +3436,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"rsvd9f",OPC_rsvd9f,0,{0},
- {CLASS_BIT+9,CLASS_BIT+0xf,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,315},
+ {CLASS_BIT+9,CLASS_BIT+0xf,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,317},
/* 1011 1001 imm8 *** rsvdb9 */
@@ -3423,7 +3446,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"rsvdb9",OPC_rsvdb9,0,{0},
- {CLASS_BIT+0xb,CLASS_BIT+9,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,316},
+ {CLASS_BIT+0xb,CLASS_BIT+9,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,318},
/* 1011 1111 imm8 *** rsvdbf */
@@ -3433,7 +3456,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"rsvdbf",OPC_rsvdbf,0,{0},
- {CLASS_BIT+0xb,CLASS_BIT+0xf,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,317},
+ {CLASS_BIT+0xb,CLASS_BIT+0xf,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,319},
/* 1011 0111 ssss dddd *** sbc rd,rs */
@@ -3443,7 +3466,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"sbc",OPC_sbc,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
- {CLASS_BIT+0xb,CLASS_BIT+7,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,318},
+ {CLASS_BIT+0xb,CLASS_BIT+7,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,320},
/* 1011 0110 ssss dddd *** sbcb rbd,rbs */
@@ -3453,7 +3476,7 @@ opcode_entry_type z8k_table[] = {
0x3f,
#endif
"sbcb",OPC_sbcb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),},
- {CLASS_BIT+0xb,CLASS_BIT+6,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,319},
+ {CLASS_BIT+0xb,CLASS_BIT+6,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,321},
/* 0111 1111 imm8 *** sc imm8 */
@@ -3463,7 +3486,7 @@ opcode_entry_type z8k_table[] = {
0x3f,
#endif
"sc",OPC_sc,0,{CLASS_IMM+(ARG_IMM8),},
- {CLASS_BIT+7,CLASS_BIT+0xf,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},1,2,320},
+ {CLASS_BIT+7,CLASS_BIT+0xf,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},1,2,322},
/* 1011 0011 dddd 1011 0000 ssss 0000 0000 *** sda rd,rs */
@@ -3473,7 +3496,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"sda",OPC_sda,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
- {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,321},
+ {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,323},
/* 1011 0010 dddd 1011 0000 ssss 0000 0000 *** sdab rbd,rs */
@@ -3483,7 +3506,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"sdab",OPC_sdab,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
- {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,322},
+ {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,324},
/* 1011 0011 dddd 1111 0000 ssss 0000 0000 *** sdal rrd,rs */
@@ -3493,7 +3516,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"sdal",OPC_sdal,0,{CLASS_REG_LONG+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
- {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+0xf,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,323},
+ {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+0xf,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,325},
/* 1011 0011 dddd 0011 0000 ssss 0000 0000 *** sdl rd,rs */
@@ -3503,7 +3526,7 @@ opcode_entry_type z8k_table[] = {
0x38,
#endif
"sdl",OPC_sdl,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
- {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,324},
+ {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,326},
/* 1011 0010 dddd 0011 0000 ssss 0000 0000 *** sdlb rbd,rs */
@@ -3513,7 +3536,7 @@ opcode_entry_type z8k_table[] = {
0x38,
#endif
"sdlb",OPC_sdlb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
- {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,325},
+ {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,327},
/* 1011 0011 dddd 0111 0000 ssss 0000 0000 *** sdll rrd,rs */
@@ -3523,7 +3546,7 @@ opcode_entry_type z8k_table[] = {
0x38,
#endif
"sdll",OPC_sdll,0,{CLASS_REG_LONG+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
- {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+7,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,326},
+ {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+7,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,328},
/* 0010 0101 ddN0 imm4 *** set @rd,imm4 */
@@ -3533,7 +3556,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"set",OPC_set,0,{CLASS_IR+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
- {CLASS_BIT+2,CLASS_BIT+5,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,327},
+ {CLASS_BIT+2,CLASS_BIT+5,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,329},
/* 0110 0101 ddN0 imm4 address_dst *** set address_dst(rd),imm4 */
@@ -3543,7 +3566,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"set",OPC_set,0,{CLASS_X+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
- {CLASS_BIT+6,CLASS_BIT+5,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,328},
+ {CLASS_BIT+6,CLASS_BIT+5,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,330},
/* 0110 0101 0000 imm4 address_dst *** set address_dst,imm4 */
@@ -3553,7 +3576,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"set",OPC_set,0,{CLASS_DA+(ARG_DST),CLASS_IMM +(ARG_IMM4),},
- {CLASS_BIT+6,CLASS_BIT+5,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,329},
+ {CLASS_BIT+6,CLASS_BIT+5,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,331},
/* 1010 0101 dddd imm4 *** set rd,imm4 */
@@ -3563,7 +3586,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"set",OPC_set,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
- {CLASS_BIT+0xa,CLASS_BIT+5,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,330},
+ {CLASS_BIT+0xa,CLASS_BIT+5,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,332},
/* 0010 0101 0000 ssss 0000 dddd 0000 0000 *** set rd,rs */
@@ -3573,7 +3596,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"set",OPC_set,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
- {CLASS_BIT+2,CLASS_BIT+5,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,331},
+ {CLASS_BIT+2,CLASS_BIT+5,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,333},
/* 0010 0100 ddN0 imm4 *** setb @rd,imm4 */
@@ -3583,7 +3606,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"setb",OPC_setb,0,{CLASS_IR+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
- {CLASS_BIT+2,CLASS_BIT+4,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,332},
+ {CLASS_BIT+2,CLASS_BIT+4,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,334},
/* 0110 0100 ddN0 imm4 address_dst *** setb address_dst(rd),imm4 */
@@ -3593,7 +3616,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"setb",OPC_setb,0,{CLASS_X+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
- {CLASS_BIT+6,CLASS_BIT+4,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,333},
+ {CLASS_BIT+6,CLASS_BIT+4,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,335},
/* 0110 0100 0000 imm4 address_dst *** setb address_dst,imm4 */
@@ -3603,7 +3626,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"setb",OPC_setb,0,{CLASS_DA+(ARG_DST),CLASS_IMM +(ARG_IMM4),},
- {CLASS_BIT+6,CLASS_BIT+4,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,334},
+ {CLASS_BIT+6,CLASS_BIT+4,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,336},
/* 1010 0100 dddd imm4 *** setb rbd,imm4 */
@@ -3613,7 +3636,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"setb",OPC_setb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
- {CLASS_BIT+0xa,CLASS_BIT+4,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,335},
+ {CLASS_BIT+0xa,CLASS_BIT+4,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,337},
/* 0010 0100 0000 ssss 0000 dddd 0000 0000 *** setb rbd,rs */
@@ -3623,7 +3646,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"setb",OPC_setb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
- {CLASS_BIT+2,CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,336},
+ {CLASS_BIT+2,CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,338},
/* 1000 1101 flags 0001 *** setflg flags */
@@ -3633,27 +3656,27 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"setflg",OPC_setflg,0,{CLASS_FLAGS,},
- {CLASS_BIT+8,CLASS_BIT+0xd,CLASS_FLAGS,CLASS_BIT+1,0,0,0,0,0,},1,2,337},
+ {CLASS_BIT+8,CLASS_BIT+0xd,CLASS_FLAGS,CLASS_BIT+1,0,0,0,0,0,},1,2,339},
-/* 0011 1010 dddd 0101 imm16 *** sinb rbd,imm16 */
+/* 0011 1011 dddd 0101 imm16 *** sin rd,imm16 */
{
#ifdef NICENAMES
-"sinb rbd,imm16",8,0,
+"sin rd,imm16",8,0,
0x00,
#endif
-"sinb",OPC_sinb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM16),},
- {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REG+(ARG_RD),CLASS_BIT+5,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,338},
+"sin",OPC_sin,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM16),},
+ {CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REG+(ARG_RD),CLASS_BIT+5,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,340},
-/* 0011 1011 dddd 0101 imm16 *** sinb rd,imm16 */
+/* 0011 1010 dddd 0101 imm16 *** sinb rbd,imm16 */
{
#ifdef NICENAMES
-"sinb rd,imm16",8,0,
+"sinb rbd,imm16",8,0,
0x00,
#endif
-"sinb",OPC_sinb,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM16),},
- {CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REG+(ARG_RD),CLASS_BIT+5,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,339},
+"sinb",OPC_sinb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM16),},
+ {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REG+(ARG_RD),CLASS_BIT+5,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,341},
/* 0011 1011 ssN0 1000 0001 aaaa ddN0 1000 *** sind @rd,@rs,ra */
@@ -3663,7 +3686,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"sind",OPC_sind,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
- {CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+8,CLASS_BIT+1,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,340},
+ {CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+8,CLASS_BIT+1,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,342},
/* 0011 1010 ssN0 1000 0001 aaaa ddN0 1000 *** sindb @rd,@rs,rba */
@@ -3673,7 +3696,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"sindb",OPC_sindb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_BYTE+(ARG_RA),},
- {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+8,CLASS_BIT+1,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,341},
+ {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+8,CLASS_BIT+1,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,343},
/* 0011 1010 ssN0 0001 0000 aaaa ddN0 1000 *** sinib @rd,@rs,ra */
@@ -3683,7 +3706,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"sinib",OPC_sinib,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
- {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,342},
+ {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,344},
/* 0011 1010 ssN0 0001 0000 aaaa ddN0 0000 *** sinibr @rd,@rs,ra */
@@ -3693,7 +3716,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"sinibr",OPC_sinibr,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
- {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,343},
+ {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,345},
/* 1011 0011 dddd 1001 0000 0000 imm8 *** sla rd,imm8 */
@@ -3703,7 +3726,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"sla",OPC_sla,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
- {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_IMM8),0,0,},2,4,344},
+ {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_IMM8),0,0,},2,4,346},
/* 1011 0010 dddd 1001 0000 0000 imm8 *** slab rbd,imm8 */
@@ -3713,7 +3736,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"slab",OPC_slab,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
- {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_IMM8),0,0,},2,4,345},
+ {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_IMM8),0,0,},2,4,347},
/* 1011 0011 dddd 1101 0000 0000 imm8 *** slal rrd,imm8 */
@@ -3723,7 +3746,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"slal",OPC_slal,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
- {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_IMM8),0,0,},2,4,346},
+ {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_IMM8),0,0,},2,4,348},
/* 1011 0011 dddd 0001 0000 0000 imm8 *** sll rd,imm8 */
@@ -3733,7 +3756,7 @@ opcode_entry_type z8k_table[] = {
0x38,
#endif
"sll",OPC_sll,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
- {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+1,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_IMM8),0,0,},2,4,347},
+ {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+1,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_IMM8),0,0,},2,4,349},
/* 1011 0010 dddd 0001 0000 0000 imm8 *** sllb rbd,imm8 */
@@ -3743,7 +3766,7 @@ opcode_entry_type z8k_table[] = {
0x38,
#endif
"sllb",OPC_sllb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
- {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+1,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_IMM8),0,0,},2,4,348},
+ {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+1,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_IMM8),0,0,},2,4,350},
/* 1011 0011 dddd 0101 0000 0000 imm8 *** slll rrd,imm8 */
@@ -3753,7 +3776,7 @@ opcode_entry_type z8k_table[] = {
0x38,
#endif
"slll",OPC_slll,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
- {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+5,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_IMM8),0,0,},2,4,349},
+ {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+5,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_IMM8),0,0,},2,4,351},
/* 0011 1011 ssss 0111 imm16 *** sout imm16,rs */
@@ -3763,7 +3786,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"sout",OPC_sout,0,{CLASS_IMM+(ARG_IMM16),CLASS_REG_WORD+(ARG_RS),},
- {CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REG+(ARG_RS),CLASS_BIT+7,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,350},
+ {CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REG+(ARG_RS),CLASS_BIT+7,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,352},
/* 0011 1010 ssss 0111 imm16 *** soutb imm16,rbs */
@@ -3773,7 +3796,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"soutb",OPC_soutb,0,{CLASS_IMM+(ARG_IMM16),CLASS_REG_BYTE+(ARG_RS),},
- {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REG+(ARG_RS),CLASS_BIT+7,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,351},
+ {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REG+(ARG_RS),CLASS_BIT+7,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,353},
/* 0011 1011 ssN0 1011 0000 aaaa ddN0 1000 *** soutd @rd,@rs,ra */
@@ -3783,7 +3806,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"soutd",OPC_soutd,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
- {CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,352},
+ {CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,354},
/* 0011 1010 ssN0 1011 0000 aaaa ddN0 1000 *** soutdb @rd,@rs,rba */
@@ -3793,7 +3816,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"soutdb",OPC_soutdb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_BYTE+(ARG_RA),},
- {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,353},
+ {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,355},
/* 0011 1010 ssN0 0011 0000 aaaa ddN0 1000 *** soutib @rd,@rs,ra */
@@ -3803,7 +3826,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"soutib",OPC_soutib,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
- {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,354},
+ {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,356},
/* 0011 1010 ssN0 0011 0000 aaaa ddN0 0000 *** soutibr @rd,@rs,ra */
@@ -3813,7 +3836,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"soutibr",OPC_soutibr,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),},
- {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,355},
+ {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,357},
/* 1011 0011 dddd 1001 1111 1111 nim8 *** sra rd,imm8 */
@@ -3823,7 +3846,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"sra",OPC_sra,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
- {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0xf,CLASS_BIT+0xf,CLASS_IMM+(ARG_NIM8),0,0,},2,4,356},
+ {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0xf,CLASS_BIT+0xf,CLASS_IMM+(ARG_NIM8),0,0,},2,4,358},
/* 1011 0010 dddd 1001 0000 0000 nim8 *** srab rbd,imm8 */
@@ -3833,7 +3856,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"srab",OPC_srab,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
- {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_NIM8),0,0,},2,4,357},
+ {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_NIM8),0,0,},2,4,359},
/* 1011 0011 dddd 1101 1111 1111 nim8 *** sral rrd,imm8 */
@@ -3843,7 +3866,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"sral",OPC_sral,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
- {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+0xd,CLASS_BIT+0xf,CLASS_BIT+0xf,CLASS_IMM+(ARG_NIM8),0,0,},2,4,358},
+ {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+0xd,CLASS_BIT+0xf,CLASS_BIT+0xf,CLASS_IMM+(ARG_NIM8),0,0,},2,4,360},
/* 1011 0011 dddd 0001 1111 1111 nim8 *** srl rd,imm8 */
@@ -3853,7 +3876,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"srl",OPC_srl,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
- {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+1,CLASS_BIT+0xf,CLASS_BIT+0xf,CLASS_IMM+(ARG_NIM8),0,0,},2,4,359},
+ {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+1,CLASS_BIT+0xf,CLASS_BIT+0xf,CLASS_IMM+(ARG_NIM8),0,0,},2,4,361},
/* 1011 0010 dddd 0001 0000 0000 nim8 *** srlb rbd,imm8 */
@@ -3863,7 +3886,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"srlb",OPC_srlb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
- {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+1,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_NIM8),0,0,},2,4,360},
+ {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+1,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_NIM8),0,0,},2,4,362},
/* 1011 0011 dddd 0101 1111 1111 nim8 *** srll rrd,imm8 */
@@ -3873,7 +3896,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"srll",OPC_srll,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
- {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+5,CLASS_BIT+0xf,CLASS_BIT+0xf,CLASS_IMM+(ARG_NIM8),0,0,},2,4,361},
+ {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+5,CLASS_BIT+0xf,CLASS_BIT+0xf,CLASS_IMM+(ARG_NIM8),0,0,},2,4,363},
/* 0000 0011 ssN0 dddd *** sub rd,@rs */
@@ -3883,7 +3906,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"sub",OPC_sub,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),},
- {CLASS_BIT+0,CLASS_BIT+3,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,362},
+ {CLASS_BIT+0,CLASS_BIT+3,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,364},
/* 0100 0011 0000 dddd address_src *** sub rd,address_src */
@@ -3893,7 +3916,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"sub",OPC_sub,0,{CLASS_REG_WORD+(ARG_RD),CLASS_DA+(ARG_SRC),},
- {CLASS_BIT+4,CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,363},
+ {CLASS_BIT+4,CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,365},
/* 0100 0011 ssN0 dddd address_src *** sub rd,address_src(rs) */
@@ -3903,7 +3926,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"sub",OPC_sub,0,{CLASS_REG_WORD+(ARG_RD),CLASS_X+(ARG_RS),},
- {CLASS_BIT+4,CLASS_BIT+3,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,364},
+ {CLASS_BIT+4,CLASS_BIT+3,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,366},
/* 0000 0011 0000 dddd imm16 *** sub rd,imm16 */
@@ -3913,7 +3936,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"sub",OPC_sub,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM16),},
- {CLASS_BIT+0,CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,365},
+ {CLASS_BIT+0,CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,367},
/* 1000 0011 ssss dddd *** sub rd,rs */
@@ -3923,7 +3946,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"sub",OPC_sub,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
- {CLASS_BIT+8,CLASS_BIT+3,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,366},
+ {CLASS_BIT+8,CLASS_BIT+3,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,368},
/* 0000 0010 ssN0 dddd *** subb rbd,@rs */
@@ -3933,7 +3956,7 @@ opcode_entry_type z8k_table[] = {
0x3f,
#endif
"subb",OPC_subb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IR+(ARG_RS),},
- {CLASS_BIT+0,CLASS_BIT+2,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,367},
+ {CLASS_BIT+0,CLASS_BIT+2,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,369},
/* 0100 0010 0000 dddd address_src *** subb rbd,address_src */
@@ -3943,7 +3966,7 @@ opcode_entry_type z8k_table[] = {
0x3f,
#endif
"subb",OPC_subb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_DA+(ARG_SRC),},
- {CLASS_BIT+4,CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,368},
+ {CLASS_BIT+4,CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,370},
/* 0100 0010 ssN0 dddd address_src *** subb rbd,address_src(rs) */
@@ -3953,7 +3976,7 @@ opcode_entry_type z8k_table[] = {
0x3f,
#endif
"subb",OPC_subb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_X+(ARG_RS),},
- {CLASS_BIT+4,CLASS_BIT+2,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,369},
+ {CLASS_BIT+4,CLASS_BIT+2,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,371},
/* 0000 0010 0000 dddd imm8 imm8 *** subb rbd,imm8 */
@@ -3963,7 +3986,7 @@ opcode_entry_type z8k_table[] = {
0x3f,
#endif
"subb",OPC_subb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
- {CLASS_BIT+0,CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,0,},2,4,370},
+ {CLASS_BIT+0,CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,0,},2,4,372},
/* 1000 0010 ssss dddd *** subb rbd,rbs */
@@ -3973,7 +3996,7 @@ opcode_entry_type z8k_table[] = {
0x3f,
#endif
"subb",OPC_subb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),},
- {CLASS_BIT+8,CLASS_BIT+2,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,371},
+ {CLASS_BIT+8,CLASS_BIT+2,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,373},
/* 0001 0010 ssN0 dddd *** subl rrd,@rs */
@@ -3983,7 +4006,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"subl",OPC_subl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IR+(ARG_RS),},
- {CLASS_BIT+1,CLASS_BIT+2,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,372},
+ {CLASS_BIT+1,CLASS_BIT+2,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,374},
/* 0101 0010 0000 dddd address_src *** subl rrd,address_src */
@@ -3993,7 +4016,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"subl",OPC_subl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_DA+(ARG_SRC),},
- {CLASS_BIT+5,CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,373},
+ {CLASS_BIT+5,CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,375},
/* 0101 0010 ssN0 dddd address_src *** subl rrd,address_src(rs) */
@@ -4003,7 +4026,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"subl",OPC_subl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_X+(ARG_RS),},
- {CLASS_BIT+5,CLASS_BIT+2,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,374},
+ {CLASS_BIT+5,CLASS_BIT+2,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,376},
/* 0001 0010 0000 dddd imm32 *** subl rrd,imm32 */
@@ -4013,7 +4036,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"subl",OPC_subl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IMM+(ARG_IMM32),},
- {CLASS_BIT+1,CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM32),0,0,0,0,},2,6,375},
+ {CLASS_BIT+1,CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM32),0,0,0,0,},2,6,377},
/* 1001 0010 ssss dddd *** subl rrd,rrs */
@@ -4023,7 +4046,7 @@ opcode_entry_type z8k_table[] = {
0x3c,
#endif
"subl",OPC_subl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_REG_LONG+(ARG_RS),},
- {CLASS_BIT+9,CLASS_BIT+2,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,376},
+ {CLASS_BIT+9,CLASS_BIT+2,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,378},
/* 1010 1111 dddd cccc *** tcc cc,rd */
@@ -4033,7 +4056,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"tcc",OPC_tcc,0,{CLASS_CC,CLASS_REG_WORD+(ARG_RD),},
- {CLASS_BIT+0xa,CLASS_BIT+0xf,CLASS_REG+(ARG_RD),CLASS_CC,0,0,0,0,0,},2,2,377},
+ {CLASS_BIT+0xa,CLASS_BIT+0xf,CLASS_REG+(ARG_RD),CLASS_CC,0,0,0,0,0,},2,2,379},
/* 1010 1110 dddd cccc *** tccb cc,rbd */
@@ -4043,7 +4066,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"tccb",OPC_tccb,0,{CLASS_CC,CLASS_REG_BYTE+(ARG_RD),},
- {CLASS_BIT+0xa,CLASS_BIT+0xe,CLASS_REG+(ARG_RD),CLASS_CC,0,0,0,0,0,},2,2,378},
+ {CLASS_BIT+0xa,CLASS_BIT+0xe,CLASS_REG+(ARG_RD),CLASS_CC,0,0,0,0,0,},2,2,380},
/* 0000 1101 ddN0 0100 *** test @rd */
@@ -4053,7 +4076,7 @@ opcode_entry_type z8k_table[] = {
0x18,
#endif
"test",OPC_test,0,{CLASS_IR+(ARG_RD),},
- {CLASS_BIT+0,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+4,0,0,0,0,0,},1,2,379},
+ {CLASS_BIT+0,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+4,0,0,0,0,0,},1,2,381},
/* 0100 1101 0000 0100 address_dst *** test address_dst */
@@ -4063,7 +4086,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"test",OPC_test,0,{CLASS_DA+(ARG_DST),},
- {CLASS_BIT+4,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+4,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,380},
+ {CLASS_BIT+4,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+4,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,382},
/* 0100 1101 ddN0 0100 address_dst *** test address_dst(rd) */
@@ -4073,7 +4096,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"test",OPC_test,0,{CLASS_X+(ARG_RD),},
- {CLASS_BIT+4,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+4,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,381},
+ {CLASS_BIT+4,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+4,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,383},
/* 1000 1101 dddd 0100 *** test rd */
@@ -4083,7 +4106,7 @@ opcode_entry_type z8k_table[] = {
0x00,
#endif
"test",OPC_test,0,{CLASS_REG_WORD+(ARG_RD),},
- {CLASS_BIT+8,CLASS_BIT+0xd,CLASS_REG+(ARG_RD),CLASS_BIT+4,0,0,0,0,0,},1,2,382},
+ {CLASS_BIT+8,CLASS_BIT+0xd,CLASS_REG+(ARG_RD),CLASS_BIT+4,0,0,0,0,0,},1,2,384},
/* 0000 1100 ddN0 0100 *** testb @rd */
@@ -4093,7 +4116,7 @@ opcode_entry_type z8k_table[] = {
0x1c,
#endif
"testb",OPC_testb,0,{CLASS_IR+(ARG_RD),},
- {CLASS_BIT+0,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+4,0,0,0,0,0,},1,2,383},
+ {CLASS_BIT+0,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+4,0,0,0,0,0,},1,2,385},
/* 0100 1100 0000 0100 address_dst *** testb address_dst */
@@ -4103,7 +4126,7 @@ opcode_entry_type z8k_table[] = {
0x1c,
#endif
"testb",OPC_testb,0,{CLASS_DA+(ARG_DST),},
- {CLASS_BIT+4,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+4,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,384},
+ {CLASS_BIT+4,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+4,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,386},
/* 0100 1100 ddN0 0100 address_dst *** testb address_dst(rd) */
@@ -4113,7 +4136,7 @@ opcode_entry_type z8k_table[] = {
0x1c,
#endif
"testb",OPC_testb,0,{CLASS_X+(ARG_RD),},
- {CLASS_BIT+4,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+4,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,385},
+ {CLASS_BIT+4,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+4,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,387},
/* 1000 1100 dddd 0100 *** testb rbd */
@@ -4123,7 +4146,7 @@ opcode_entry_type z8k_table[] = {
0x1c,
#endif
"testb",OPC_testb,0,{CLASS_REG_BYTE+(ARG_RD),},
- {CLASS_BIT+8,CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_BIT+4,0,0,0,0,0,},1,2,386},
+ {CLASS_BIT+8,CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_BIT+4,0,0,0,0,0,},1,2,388},
/* 0001 1100 ddN0 1000 *** testl @rd */
@@ -4133,7 +4156,7 @@ opcode_entry_type z8k_table[] = {
0x18,
#endif
"testl",OPC_testl,0,{CLASS_IR+(ARG_RD),},
- {CLASS_BIT+1,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,0,0,0,0,},1,2,387},
+ {CLASS_BIT+1,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,0,0,0,0,},1,2,389},
/* 0101 1100 0000 1000 address_dst *** testl address_dst */
@@ -4143,7 +4166,7 @@ opcode_entry_type z8k_table[] = {
0x18,
#endif
"testl",OPC_testl,0,{CLASS_DA+(ARG_DST),},
- {CLASS_BIT+5,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+8,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,388},
+ {CLASS_BIT+5,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+8,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,390},
/* 0101 1100 ddN0 1000 address_dst *** testl address_dst(rd) */
@@ -4153,7 +4176,7 @@ opcode_entry_type z8k_table[] = {
0x18,
#endif
"testl",OPC_testl,0,{CLASS_X+(ARG_RD),},
- {CLASS_BIT+5,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+8,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,389},
+ {CLASS_BIT+5,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+8,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,391},
/* 1001 1100 dddd 1000 *** testl rrd */
@@ -4163,7 +4186,7 @@ opcode_entry_type z8k_table[] = {
0x18,
#endif
"testl",OPC_testl,0,{CLASS_REG_LONG+(ARG_RD),},
- {CLASS_BIT+9,CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_BIT+8,0,0,0,0,0,},1,2,390},
+ {CLASS_BIT+9,CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_BIT+8,0,0,0,0,0,},1,2,392},
/* 1011 1000 ddN0 1000 0000 aaaa ssN0 0000 *** trdb @rd,@rs,rba */
@@ -4173,7 +4196,7 @@ opcode_entry_type z8k_table[] = {
0x1c,
#endif
"trdb",OPC_trdb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_BYTE+(ARG_RA),},
- {CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RD),CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RS),CLASS_BIT+0,0,},3,4,391},
+ {CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RD),CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RS),CLASS_BIT+0,0,},3,4,393},
/* 1011 1000 ddN0 1100 0000 aaaa ssN0 0000 *** trdrb @rd,@rs,rba */
@@ -4183,7 +4206,7 @@ opcode_entry_type z8k_table[] = {
0x1c,
#endif
"trdrb",OPC_trdrb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_BYTE+(ARG_RA),},
- {CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RD),CLASS_BIT+0xc,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RS),CLASS_BIT+0,0,},3,4,392},
+ {CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RD),CLASS_BIT+0xc,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RS),CLASS_BIT+0,0,},3,4,394},
/* 1011 1000 ddN0 0000 0000 rrrr ssN0 0000 *** trib @rd,@rs,rbr */
@@ -4193,7 +4216,7 @@ opcode_entry_type z8k_table[] = {
0x1c,
#endif
"trib",OPC_trib,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_BYTE+(ARG_RR),},
- {CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RD),CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RS),CLASS_BIT+0,0,},3,4,393},
+ {CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RD),CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RS),CLASS_BIT+0,0,},3,4,395},
/* 1011 1000 ddN0 0100 0000 rrrr ssN0 0000 *** trirb @rd,@rs,rbr */
@@ -4203,7 +4226,7 @@ opcode_entry_type z8k_table[] = {
0x1c,
#endif
"trirb",OPC_trirb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_BYTE+(ARG_RR),},
- {CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RD),CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RS),CLASS_BIT+0,0,},3,4,394},
+ {CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RD),CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RS),CLASS_BIT+0,0,},3,4,396},
/* 1011 1000 aaN0 1010 0000 rrrr bbN0 0000 *** trtdb @ra,@rb,rbr */
@@ -4213,7 +4236,7 @@ opcode_entry_type z8k_table[] = {
0x1c,
#endif
"trtdb",OPC_trtdb,0,{CLASS_IR+(ARG_RA),CLASS_IR+(ARG_RB),CLASS_REG_BYTE+(ARG_RR),},
- {CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RA),CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RB),CLASS_BIT+0,0,},3,4,395},
+ {CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RA),CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RB),CLASS_BIT+0,0,},3,4,397},
/* 1011 1000 aaN0 1110 0000 rrrr bbN0 1110 *** trtdrb @ra,@rb,rbr */
@@ -4223,7 +4246,7 @@ opcode_entry_type z8k_table[] = {
0x1c,
#endif
"trtdrb",OPC_trtdrb,0,{CLASS_IR+(ARG_RA),CLASS_IR+(ARG_RB),CLASS_REG_BYTE+(ARG_RR),},
- {CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RA),CLASS_BIT+0xe,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RB),CLASS_BIT+0xe,0,},3,4,396},
+ {CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RA),CLASS_BIT+0xe,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RB),CLASS_BIT+0xe,0,},3,4,398},
/* 1011 1000 aaN0 0010 0000 rrrr bbN0 0000 *** trtib @ra,@rb,rbr */
@@ -4233,7 +4256,7 @@ opcode_entry_type z8k_table[] = {
0x1c,
#endif
"trtib",OPC_trtib,0,{CLASS_IR+(ARG_RA),CLASS_IR+(ARG_RB),CLASS_REG_BYTE+(ARG_RR),},
- {CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RA),CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RB),CLASS_BIT+0,0,},3,4,397},
+ {CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RA),CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RB),CLASS_BIT+0,0,},3,4,399},
/* 1011 1000 aaN0 0110 0000 rrrr bbN0 1110 *** trtirb @ra,@rb,rbr */
@@ -4243,7 +4266,17 @@ opcode_entry_type z8k_table[] = {
0x1c,
#endif
"trtirb",OPC_trtirb,0,{CLASS_IR+(ARG_RA),CLASS_IR+(ARG_RB),CLASS_REG_BYTE+(ARG_RR),},
- {CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RA),CLASS_BIT+6,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RB),CLASS_BIT+0xe,0,},3,4,398},
+ {CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RA),CLASS_BIT+6,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RB),CLASS_BIT+0xe,0,},3,4,400},
+
+
+/* 1011 1000 aaN0 1010 0000 rrrr bbN0 0000 *** trtrb @ra,@rb,rbr */
+{
+#ifdef NICENAMES
+"trtrb @ra,@rb,rbr",8,25,
+0x1c,
+#endif
+"trtrb",OPC_trtrb,0,{CLASS_IR+(ARG_RA),CLASS_IR+(ARG_RB),CLASS_REG_BYTE+(ARG_RR),},
+ {CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RA),CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RB),CLASS_BIT+0,0,},3,4,401},
/* 0000 1101 ddN0 0110 *** tset @rd */
@@ -4253,7 +4286,7 @@ opcode_entry_type z8k_table[] = {
0x08,
#endif
"tset",OPC_tset,0,{CLASS_IR+(ARG_RD),},
- {CLASS_BIT+0,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+6,0,0,0,0,0,},1,2,399},
+ {CLASS_BIT+0,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+6,0,0,0,0,0,},1,2,402},
/* 0100 1101 0000 0110 address_dst *** tset address_dst */
@@ -4263,7 +4296,7 @@ opcode_entry_type z8k_table[] = {
0x08,
#endif
"tset",OPC_tset,0,{CLASS_DA+(ARG_DST),},
- {CLASS_BIT+4,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+6,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,400},
+ {CLASS_BIT+4,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+6,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,403},
/* 0100 1101 ddN0 0110 address_dst *** tset address_dst(rd) */
@@ -4273,7 +4306,7 @@ opcode_entry_type z8k_table[] = {
0x08,
#endif
"tset",OPC_tset,0,{CLASS_X+(ARG_RD),},
- {CLASS_BIT+4,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+6,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,401},
+ {CLASS_BIT+4,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+6,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,404},
/* 1000 1101 dddd 0110 *** tset rd */
@@ -4283,7 +4316,7 @@ opcode_entry_type z8k_table[] = {
0x08,
#endif
"tset",OPC_tset,0,{CLASS_REG_WORD+(ARG_RD),},
- {CLASS_BIT+8,CLASS_BIT+0xd,CLASS_REG+(ARG_RD),CLASS_BIT+6,0,0,0,0,0,},1,2,402},
+ {CLASS_BIT+8,CLASS_BIT+0xd,CLASS_REG+(ARG_RD),CLASS_BIT+6,0,0,0,0,0,},1,2,405},
/* 0000 1100 ddN0 0110 *** tsetb @rd */
@@ -4293,7 +4326,7 @@ opcode_entry_type z8k_table[] = {
0x08,
#endif
"tsetb",OPC_tsetb,0,{CLASS_IR+(ARG_RD),},
- {CLASS_BIT+0,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+6,0,0,0,0,0,},1,2,403},
+ {CLASS_BIT+0,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+6,0,0,0,0,0,},1,2,406},
/* 0100 1100 0000 0110 address_dst *** tsetb address_dst */
@@ -4303,7 +4336,7 @@ opcode_entry_type z8k_table[] = {
0x08,
#endif
"tsetb",OPC_tsetb,0,{CLASS_DA+(ARG_DST),},
- {CLASS_BIT+4,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+6,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,404},
+ {CLASS_BIT+4,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+6,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,407},
/* 0100 1100 ddN0 0110 address_dst *** tsetb address_dst(rd) */
@@ -4313,7 +4346,7 @@ opcode_entry_type z8k_table[] = {
0x08,
#endif
"tsetb",OPC_tsetb,0,{CLASS_X+(ARG_RD),},
- {CLASS_BIT+4,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+6,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,405},
+ {CLASS_BIT+4,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+6,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,408},
/* 1000 1100 dddd 0110 *** tsetb rbd */
@@ -4323,7 +4356,7 @@ opcode_entry_type z8k_table[] = {
0x08,
#endif
"tsetb",OPC_tsetb,0,{CLASS_REG_BYTE+(ARG_RD),},
- {CLASS_BIT+8,CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_BIT+6,0,0,0,0,0,},1,2,406},
+ {CLASS_BIT+8,CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_BIT+6,0,0,0,0,0,},1,2,409},
/* 0000 1001 ssN0 dddd *** xor rd,@rs */
@@ -4333,7 +4366,7 @@ opcode_entry_type z8k_table[] = {
0x18,
#endif
"xor",OPC_xor,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),},
- {CLASS_BIT+0,CLASS_BIT+9,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,407},
+ {CLASS_BIT+0,CLASS_BIT+9,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,410},
/* 0100 1001 0000 dddd address_src *** xor rd,address_src */
@@ -4343,7 +4376,7 @@ opcode_entry_type z8k_table[] = {
0x18,
#endif
"xor",OPC_xor,0,{CLASS_REG_WORD+(ARG_RD),CLASS_DA+(ARG_SRC),},
- {CLASS_BIT+4,CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,408},
+ {CLASS_BIT+4,CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,411},
/* 0100 1001 ssN0 dddd address_src *** xor rd,address_src(rs) */
@@ -4353,7 +4386,7 @@ opcode_entry_type z8k_table[] = {
0x18,
#endif
"xor",OPC_xor,0,{CLASS_REG_WORD+(ARG_RD),CLASS_X+(ARG_RS),},
- {CLASS_BIT+4,CLASS_BIT+9,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,409},
+ {CLASS_BIT+4,CLASS_BIT+9,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,412},
/* 0000 1001 0000 dddd imm16 *** xor rd,imm16 */
@@ -4363,7 +4396,7 @@ opcode_entry_type z8k_table[] = {
0x18,
#endif
"xor",OPC_xor,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM16),},
- {CLASS_BIT+0,CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,410},
+ {CLASS_BIT+0,CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,413},
/* 1000 1001 ssss dddd *** xor rd,rs */
@@ -4373,7 +4406,7 @@ opcode_entry_type z8k_table[] = {
0x18,
#endif
"xor",OPC_xor,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),},
- {CLASS_BIT+8,CLASS_BIT+9,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,411},
+ {CLASS_BIT+8,CLASS_BIT+9,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,414},
/* 0000 1000 ssN0 dddd *** xorb rbd,@rs */
@@ -4383,7 +4416,7 @@ opcode_entry_type z8k_table[] = {
0x1c,
#endif
"xorb",OPC_xorb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IR+(ARG_RS),},
- {CLASS_BIT+0,CLASS_BIT+8,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,412},
+ {CLASS_BIT+0,CLASS_BIT+8,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,415},
/* 0100 1000 0000 dddd address_src *** xorb rbd,address_src */
@@ -4393,7 +4426,7 @@ opcode_entry_type z8k_table[] = {
0x1c,
#endif
"xorb",OPC_xorb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_DA+(ARG_SRC),},
- {CLASS_BIT+4,CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,413},
+ {CLASS_BIT+4,CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,416},
/* 0100 1000 ssN0 dddd address_src *** xorb rbd,address_src(rs) */
@@ -4403,7 +4436,7 @@ opcode_entry_type z8k_table[] = {
0x1c,
#endif
"xorb",OPC_xorb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_X+(ARG_RS),},
- {CLASS_BIT+4,CLASS_BIT+8,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,414},
+ {CLASS_BIT+4,CLASS_BIT+8,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,417},
/* 0000 1000 0000 dddd imm8 imm8 *** xorb rbd,imm8 */
@@ -4413,7 +4446,7 @@ opcode_entry_type z8k_table[] = {
0x1c,
#endif
"xorb",OPC_xorb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
- {CLASS_BIT+0,CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,0,},2,4,415},
+ {CLASS_BIT+0,CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,0,},2,4,418},
/* 1000 1000 ssss dddd *** xorb rbd,rbs */
@@ -4423,7 +4456,7 @@ opcode_entry_type z8k_table[] = {
0x1c,
#endif
"xorb",OPC_xorb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),},
- {CLASS_BIT+8,CLASS_BIT+8,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,416},
+ {CLASS_BIT+8,CLASS_BIT+8,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,419},
/* 1000 1000 ssss dddd *** xorb rbd,rbs */
@@ -4433,6 +4466,14 @@ opcode_entry_type z8k_table[] = {
0x01,
#endif
"xorb",OPC_xorb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),},
- {CLASS_BIT+8,CLASS_BIT+8,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,417},
-0,0};
+ {CLASS_BIT+8,CLASS_BIT+8,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,420},
+
+/* end marker */
+{
+#ifdef NICENAMES
+NULL,0,0,
+0,
+#endif
+NULL,0,0,{0,0,0,0},{0,0,0,0,0,0,0,0,0,0},0,0,0}
+};
#endif
diff --git a/contrib/binutils/opcodes/z8kgen.c b/contrib/binutils/opcodes/z8kgen.c
index c8f3970..f171724 100644
--- a/contrib/binutils/opcodes/z8kgen.c
+++ b/contrib/binutils/opcodes/z8kgen.c
@@ -19,6 +19,7 @@
/* This program generates z8k-opc.h */
+#include <stdio.h>
#include "sysdep.h"
#define BYTE_INFO_LEN 10
@@ -52,9 +53,9 @@ struct op opt[] =
"------", 10, 8, "1011 1001 imm8", "rsvdb9", 0,
"------", 10, 8, "1011 1111 imm8", "rsvdbf", 0,
- "---V--", 11, 16, "1011 1011 ssN0 1001 0000 rrrr ddN0 1000", "ldd @rs,@rd,rr", 0,
- "---V--", 11, 16, "1011 1011 ssN0 1001 0000 rrrr ddN0 0000", "lddr @rs,@rd,rr", 0,
- "---V--", 11, 8, "1011 1011 ssN0 1001 0000 rrrr ddN0 0000", "lddrb @rs,@rd,rr", 0,
+ "---V--", 11, 16, "1011 1011 ssN0 1001 0000 rrrr ddN0 1000", "ldd @rd,@rs,rr", 0,
+ "---V--", 11, 16, "1011 1011 ssN0 1001 0000 rrrr ddN0 0000", "lddr @rd,@rs,rr", 0,
+ "---V--", 11, 8, "1011 1010 ssN0 1001 0000 rrrr ddN0 0000", "lddrb @rd,@rs,rr", 0,
"---V--", 11, 16, "1011 1011 ssN0 0001 0000 rrrr ddN0 0000", "ldir @rd,@rs,rr", 0,
"CZSV--", 11, 16, "1011 1011 ssN0 0000 0000 rrrr dddd cccc", "cpi rd,@rs,rr,cc", 0,
"CZSV--", 11, 16, "1011 1011 ssN0 0100 0000 rrrr dddd cccc", "cpir rd,@rs,rr,cc", 0,
@@ -62,7 +63,7 @@ struct op opt[] =
"---V--", 11, 16, "1011 1011 ssN0 0001 0000 rrrr ddN0 1000", "ldi @rd,@rs,rr", 0,
"CZSV--", 11, 16, "1011 1011 ssN0 1000 0000 rrrr dddd cccc", "cpd rd,@rs,rr,cc", 0,
"---V--", 11, 8, "1011 1010 ssN0 0001 0000 rrrr ddN0 0000", "ldirb @rd,@rs,rr", 0,
- "---V--", 11, 8, "1011 1010 ssN0 1001 0000 rrrr ddN0 1000", "lddb @rs,@rd,rr", 0,
+ "---V--", 11, 8, "1011 1010 ssN0 1001 0000 rrrr ddN0 1000", "lddb @rd,@rs,rr", 0,
"---V--", 11, 8, "1011 1010 ssN0 0001 0000 rrrr ddN0 1000", "ldib @rd,@rs,rr", 0,
"CZSV--", 11, 8, "1011 1010 ssN0 1000 0000 rrrr dddd cccc", "cpdb rbd,@rs,rr,cc", 0,
"CZSV--", 11, 8, "1011 1010 ssN0 1100 0000 rrrr dddd cccc", "cpdrb rbd,@rs,rr,cc", 0,
@@ -81,12 +82,12 @@ struct op opt[] =
"CZSV--", 5, 16, "1011 0101 ssss dddd", "adc rd,rs", 0,
"CZSVDH", 5, 8, "1011 0100 ssss dddd", "adcb rbd,rbs", 0,
"CZSV--", 7, 16, "0000 0001 ssN0 dddd", "add rd,@rs", 0,
-"CZSV--", 9, 16, "0100 0001 0000 dddd address_src", "add rd,address_src", 0,
+ "CZSV--", 9, 16, "0100 0001 0000 dddd address_src", "add rd,address_src", 0,
"CZSV--", 10, 16, "0100 0001 ssN0 dddd address_src", "add rd,address_src(rs)", 0,
"CZSV--", 7, 16, "0000 0001 0000 dddd imm16", "add rd,imm16", 0,
"CZSV--", 4, 16, "1000 0001 ssss dddd", "add rd,rs", 0,
"CZSVDH", 7, 8, "0000 0000 ssN0 dddd", "addb rbd,@rs", 0,
-"CZSVDH", 9, 8, "0100 0000 0000 dddd address_src", "addb rbd,address_src", 0,
+ "CZSVDH", 9, 8, "0100 0000 0000 dddd address_src", "addb rbd,address_src", 0,
"CZSVDH", 10, 8, "0100 0000 ssN0 dddd address_src", "addb rbd,address_src(rs)", 0,
"CZSVDH", 7, 8, "0000 0000 0000 dddd imm8 imm8", "addb rbd,imm8", 0,
"CZSVDH", 4, 8, "1000 0000 ssss dddd", "addb rbd,rbs", 0,
@@ -97,12 +98,12 @@ struct op opt[] =
"CZSV--", 8, 32, "1001 0110 ssss dddd", "addl rrd,rrs", 0,
"-ZS---", 7, 16, "0000 0111 ssN0 dddd", "and rd,@rs", 0,
-"-ZS---", 9, 16, "0100 0111 0000 dddd address_src", "and rd,address_src", 0,
+ "-ZS---", 9, 16, "0100 0111 0000 dddd address_src", "and rd,address_src", 0,
"-ZS---", 10, 16, "0100 0111 ssN0 dddd address_src", "and rd,address_src(rs)", 0,
"-ZS---", 7, 16, "0000 0111 0000 dddd imm16", "and rd,imm16", 0,
"-ZS---", 4, 16, "1000 0111 ssss dddd", "and rd,rs", 0,
"-ZSP--", 7, 8, "0000 0110 ssN0 dddd", "andb rbd,@rs", 0,
-"-ZSP--", 9, 8, "0100 0110 0000 dddd address_src", "andb rbd,address_src", 0,
+ "-ZSP--", 9, 8, "0100 0110 0000 dddd address_src", "andb rbd,address_src", 0,
"-ZSP--", 10, 8, "0100 0110 ssN0 dddd address_src", "andb rbd,address_src(rs)", 0,
"-ZSP--", 7, 8, "0000 0110 0000 dddd imm8 imm8", "andb rbd,imm8", 0,
"-ZSP--", 4, 8, "1000 0110 ssss dddd", "andb rbd,rbs", 0,
@@ -111,13 +112,13 @@ struct op opt[] =
"-Z----", 11, 16, "0110 0111 ddN0 imm4 address_dst", "bit address_dst(rd),imm4", 0,
"-Z----", 10, 16, "0110 0111 0000 imm4 address_dst", "bit address_dst,imm4", 0,
"-Z----", 4, 16, "1010 0111 dddd imm4", "bit rd,imm4", 0,
-"-Z----", 10, 16, "0010 0111 0000 ssss 0000 dddd 0000 0000", "bit rd,rs", 0,
+ "-Z----", 10, 16, "0010 0111 0000 ssss 0000 dddd 0000 0000", "bit rd,rs", 0,
"-Z----", 8, 8, "0010 0110 ddN0 imm4", "bitb @rd,imm4", 0,
"-Z----", 11, 8, "0110 0110 ddN0 imm4 address_dst", "bitb address_dst(rd),imm4", 0,
"-Z----", 10, 8, "0110 0110 0000 imm4 address_dst", "bitb address_dst,imm4", 0,
"-Z----", 4, 8, "1010 0110 dddd imm4", "bitb rbd,imm4", 0,
-"-Z----", 10, 8, "0010 0110 0000 ssss 0000 dddd 0000 0000", "bitb rbd,rs", 0,
+ "-Z----", 10, 8, "0010 0110 0000 ssss 0000 dddd 0000 0000", "bitb rbd,rs", 0,
"------", 10, 32, "0001 1111 ddN0 0000", "call @rd", 0,
"------", 12, 32, "0101 1111 0000 0000 address_dst", "call address_dst", 0,
@@ -140,7 +141,7 @@ struct op opt[] =
"-ZSP--", 15, 8, "0100 1100 0000 0000 address_dst", "comb address_dst", 0,
"-ZSP--", 16, 8, "0100 1100 ddN0 0000 address_dst", "comb address_dst(rd)", 0,
"-ZSP--", 7, 8, "1000 1100 dddd 0000", "comb rbd", 0,
- "CZSP--", 7, 16, "1000 1101 imm4 0101", "comflg flags", 0,
+ "CZSP--", 7, 16, "1000 1101 flags 0101", "comflg flags", 0,
"CZSV--", 11, 16, "0000 1101 ddN0 0001 imm16", "cp @rd,imm16", 0,
"CZSV--", 15, 16, "0100 1101 ddN0 0001 address_dst imm16", "cp address_dst(rd),imm16", 0,
@@ -156,7 +157,7 @@ struct op opt[] =
"CZSV--", 15, 8, "0100 1100 ddN0 0001 address_dst imm8 imm8", "cpb address_dst(rd),imm8", 0,
"CZSV--", 14, 8, "0100 1100 0000 0001 address_dst imm8 imm8", "cpb address_dst,imm8", 0,
"CZSV--", 7, 8, "0000 1010 ssN0 dddd", "cpb rbd,@rs", 0,
-"CZSV--", 9, 8, "0100 1010 0000 dddd address_src", "cpb rbd,address_src", 0,
+ "CZSV--", 9, 8, "0100 1010 0000 dddd address_src", "cpb rbd,address_src", 0,
"CZSV--", 10, 8, "0100 1010 ssN0 dddd address_src", "cpb rbd,address_src(rs)", 0,
"CZSV--", 7, 8, "0000 1010 0000 dddd imm8 imm8", "cpb rbd,imm8", 0,
"CZSV--", 4, 8, "1000 1010 ssss dddd", "cpb rbd,rbs", 0,
@@ -168,7 +169,7 @@ struct op opt[] =
"CZSV--", 8, 32, "1001 0000 ssss dddd", "cpl rrd,rrs", 0,
"CZS---", 5, 8, "1011 0000 dddd 0000", "dab rbd", 0,
- "------", 11, 16, "1111 dddd 1disp7", "dbjnz rbd,disp7", 0,
+ "------", 11, 16, "1111 dddd 0disp7", "dbjnz rbd,disp7", 0,
"-ZSV--", 11, 16, "0010 1011 ddN0 imm4m1", "dec @rd,imm4m1", 0,
"-ZSV--", 14, 16, "0110 1011 ddN0 imm4m1 address_dst", "dec address_dst(rd),imm4m1", 0,
"-ZSV--", 13, 16, "0110 1011 0000 imm4m1 address_dst", "dec address_dst,imm4m1", 0,
@@ -190,15 +191,15 @@ struct op opt[] =
"CZSV--", 744, 32, "0001 1010 0000 dddd imm32", "divl rqd,imm32", 0,
"CZSV--", 744, 32, "1001 1010 ssss dddd", "divl rqd,rrs", 0,
- "------", 11, 16, "1111 dddd 0disp7", "djnz rd,disp7", 0,
+ "------", 11, 16, "1111 dddd 1disp7", "djnz rd,disp7", 0,
"------", 7, 16, "0111 1100 0000 01ii", "ei i2", 0,
"------", 6, 16, "1010 1101 ssss dddd", "ex rd,rs", 0,
"------", 12, 16, "0010 1101 ssN0 dddd", "ex rd,@rs", 0,
-"------", 15, 16, "0110 1101 0000 dddd address_src", "ex rd,address_src", 0,
+ "------", 15, 16, "0110 1101 0000 dddd address_src", "ex rd,address_src", 0,
"------", 16, 16, "0110 1101 ssN0 dddd address_src", "ex rd,address_src(rs)", 0,
"------", 12, 8, "0010 1100 ssN0 dddd", "exb rbd,@rs", 0,
-"------", 15, 8, "0110 1100 0000 dddd address_src", "exb rbd,address_src", 0,
+ "------", 15, 8, "0110 1100 0000 dddd address_src", "exb rbd,address_src", 0,
"------", 16, 8, "0110 1100 ssN0 dddd address_src", "exb rbd,address_src(rs)", 0,
"------", 6, 8, "1010 1100 ssss dddd", "exb rbd,rbs", 0,
@@ -210,7 +211,7 @@ struct op opt[] =
"------", 10, 16, "0011 1101 ssN0 dddd", "in rd,@rs", 0,
"------", 12, 16, "0011 1101 dddd 0100 imm16", "in rd,imm16", 0,
"------", 12, 8, "0011 1100 ssN0 dddd", "inb rbd,@rs", 0,
- "------", 10, 8, "0011 1100 dddd 0100 imm16", "inb rbd,imm16", 0,
+ "------", 10, 8, "0011 1010 dddd 0100 imm16", "inb rbd,imm16", 0,
"-ZSV--", 11, 16, "0010 1001 ddN0 imm4m1", "inc @rd,imm4m1", 0,
"-ZSV--", 14, 16, "0110 1001 ddN0 imm4m1 address_dst", "inc address_dst(rd),imm4m1", 0,
"-ZSV--", 13, 16, "0110 1001 0000 imm4m1 address_dst", "inc address_dst,imm4m1", 0,
@@ -221,8 +222,8 @@ struct op opt[] =
"-ZSV--", 4, 8, "1010 1000 dddd imm4m1", "incb rbd,imm4m1", 0,
"---V--", 21, 16, "0011 1011 ssN0 1000 0000 aaaa ddN0 1000", "ind @rd,@rs,ra", 0,
"---V--", 21, 8, "0011 1010 ssN0 1000 0000 aaaa ddN0 1000", "indb @rd,@rs,rba", 0,
- "---V--", 21, 8, "0011 1100 ssN0 0000 0000 aaaa ddN0 1000", "inib @rd,@rs,ra", 0,
- "---V--", 21, 16, "0011 1100 ssN0 0000 0000 aaaa ddN0 0000", "inibr @rd,@rs,ra", 0,
+ "---V--", 21, 8, "0011 1010 ssN0 0000 0000 aaaa ddN0 1000", "inib @rd,@rs,ra", 0,
+ "---V--", 21, 16, "0011 1010 ssN0 0000 0000 aaaa ddN0 0000", "inibr @rd,@rs,ra", 0,
"CZSVDH", 13, 16, "0111 1011 0000 0000", "iret", 0,
"------", 10, 16, "0001 1110 ddN0 cccc", "jp cc,@rd", 0,
"------", 7, 16, "0101 1110 0000 cccc address_dst", "jp cc,address_dst", 0,
@@ -234,7 +235,7 @@ struct op opt[] =
"------", 15, 16, "0100 1101 ddN0 0101 address_dst imm16", "ld address_dst(rd),imm16", 0,
"------", 12, 16, "0110 1111 ddN0 ssss address_dst", "ld address_dst(rd),rs", 0,
"------", 14, 16, "0100 1101 0000 0101 address_dst imm16", "ld address_dst,imm16", 0,
-"------", 11, 16, "0110 1111 0000 ssss address_dst", "ld address_dst,rs", 0,
+ "------", 11, 16, "0110 1111 0000 ssss address_dst", "ld address_dst,rs", 0,
"------", 14, 16, "0011 0011 ddN0 ssss imm16", "ld rd(imm16),rs", 0,
"------", 14, 16, "0111 0011 ddN0 ssss 0000 xxxx 0000 0000", "ld rd(rx),rs", 0,
"------", 7, 16, "0010 0001 ssN0 dddd", "ld rd,@rs", 0,
@@ -248,13 +249,13 @@ struct op opt[] =
"------", 7, 8, "0000 1100 ddN0 0101 imm8 imm8", "ldb @rd,imm8", 0,
"------", 8, 8, "0010 1110 ddN0 ssss", "ldb @rd,rbs", 0,
"------", 15, 8, "0100 1100 ddN0 0101 address_dst imm8 imm8", "ldb address_dst(rd),imm8", 0,
- "------", 12, 8, "0100 1110 ddN0 ssN0 address_dst", "ldb address_dst(rd),rbs", 0,
+ "------", 12, 8, "0110 1110 ddN0 ssss address_dst", "ldb address_dst(rd),rbs", 0,
"------", 14, 8, "0100 1100 0000 0101 address_dst imm8 imm8", "ldb address_dst,imm8", 0,
-"------", 11, 8, "0110 1110 0000 ssss address_dst", "ldb address_dst,rbs", 0,
+ "------", 11, 8, "0110 1110 0000 ssss address_dst", "ldb address_dst,rbs", 0,
"------", 14, 8, "0011 0010 ddN0 ssss imm16", "ldb rd(imm16),rbs", 0,
"------", 14, 8, "0111 0010 ddN0 ssss 0000 xxxx 0000 0000", "ldb rd(rx),rbs", 0,
"------", 7, 8, "0010 0000 ssN0 dddd", "ldb rbd,@rs", 0,
-"------", 9, 8, "0110 0000 0000 dddd address_src", "ldb rbd,address_src", 0,
+ "------", 9, 8, "0110 0000 0000 dddd address_src", "ldb rbd,address_src", 0,
"------", 10, 8, "0110 0000 ssN0 dddd address_src", "ldb rbd,address_src(rs)", 0,
"------", 5, 8, "1100 dddd imm8", "ldb rbd,imm8", 0,
"------", 3, 8, "1010 0000 ssss dddd", "ldb rbd,rbs", 0,
@@ -285,7 +286,7 @@ struct op opt[] =
"------", 5, 16, "1011 1101 dddd imm4", "ldk rd,imm4", 0,
"------", 11, 16, "0001 1100 ddN0 1001 0000 ssss 0000 nminus1", "ldm @rd,rs,n", 0,
- "------", 15, 16, "0101 1100 ddN0 1001 0000 ssN0 0000 nminus1 address_dst", "ldm address_dst(rd),rs,n", 0,
+ "------", 15, 16, "0101 1100 ddN0 1001 0000 ssss 0000 nminus1 address_dst", "ldm address_dst(rd),rs,n", 0,
"------", 14, 16, "0101 1100 0000 1001 0000 ssss 0000 nminus1 address_dst", "ldm address_dst,rs,n", 0,
"------", 11, 16, "0001 1100 ssN0 0001 0000 dddd 0000 nminus1", "ldm rd,@rs,n", 0,
"------", 15, 16, "0101 1100 ssN0 0001 0000 dddd 0000 nminus1 address_src", "ldm rd,address_src(rs),n", 0,
@@ -335,7 +336,7 @@ struct op opt[] =
"CZS---", 4, 16, "1000 0101 ssss dddd", "or rd,rs", 0,
"CZSP--", 7, 8, "0000 0100 ssN0 dddd", "orb rbd,@rs", 0,
-"CZSP--", 9, 8, "0100 0100 0000 dddd address_src", "orb rbd,address_src", 0,
+ "CZSP--", 9, 8, "0100 0100 0000 dddd address_src", "orb rbd,address_src", 0,
"CZSP--", 10, 8, "0100 0100 ssN0 dddd address_src", "orb rbd,address_src(rs)", 0,
"CZSP--", 7, 8, "0000 0100 0000 dddd imm8 imm8", "orb rbd,imm8", 0,
"CZSP--", 4, 8, "1000 0100 ssss dddd", "orb rbd,rbs", 0,
@@ -345,9 +346,10 @@ struct op opt[] =
"---V--", 0, 8, "0011 1110 ddN0 ssss", "outb @rd,rbs", 0,
"---V--", 0, 8, "0011 1010 ssss 0110 imm16", "outb imm16,rbs", 0,
"---V--", 0, 16, "0011 1011 ssN0 1010 0000 aaaa ddN0 1000", "outd @rd,@rs,ra", 0,
- "---V--", 0, 8, "0011 1010 ssN0 1010 0000 aaaa ddN0 1000", "outdb @rd,@rs,rba", 0,
- "---V--", 0, 8, "0011 1100 ssN0 0010 0000 aaaa ddN0 1000", "outib @rd,@rs,ra", 0,
- "---V--", 0, 16, "0011 1100 ssN0 0010 0000 aaaa ddN0 0000", "outibr @rd,@rs,ra", 0,
+ "---V--", 0, 16, "0011 1010 ssN0 1010 0000 aaaa ddN0 1000", "outdb @rd,@rs,rba", 0,
+ "---V--", 0, 16, "0011 1011 ssN0 0010 0000 aaaa ddN0 1000", "outi @rd,@rs,ra", 0,
+ "---V--", 0, 16, "0011 1010 ssN0 0010 0000 aaaa ddN0 1000", "outib @rd,@rs,ra", 0,
+ "---V--", 0, 16, "0011 1010 ssN0 0010 0000 aaaa ddN0 0000", "outibr @rd,@rs,ra", 0,
"------", 12, 16, "0001 0111 ssN0 ddN0", "pop @rd,@rs", 0,
"------", 16, 16, "0101 0111 ssN0 ddN0 address_dst", "pop address_dst(rd),@rs", 0,
@@ -374,15 +376,15 @@ struct op opt[] =
"------", 14, 16, "0110 0011 ddN0 imm4 address_dst", "res address_dst(rd),imm4", 0,
"------", 13, 16, "0110 0011 0000 imm4 address_dst", "res address_dst,imm4", 0,
"------", 4, 16, "1010 0011 dddd imm4", "res rd,imm4", 0,
-"------", 10, 16, "0010 0011 0000 ssss 0000 dddd 0000 0000", "res rd,rs", 0,
+ "------", 10, 16, "0010 0011 0000 ssss 0000 dddd 0000 0000", "res rd,rs", 0,
"------", 11, 8, "0010 0010 ddN0 imm4", "resb @rd,imm4", 0,
"------", 14, 8, "0110 0010 ddN0 imm4 address_dst", "resb address_dst(rd),imm4", 0,
"------", 13, 8, "0110 0010 0000 imm4 address_dst", "resb address_dst,imm4", 0,
"------", 4, 8, "1010 0010 dddd imm4", "resb rbd,imm4", 0,
-"------", 10, 8, "0010 0010 0000 ssss 0000 dddd 0000 0000", "resb rbd,rs", 0,
+ "------", 10, 8, "0010 0010 0000 ssss 0000 dddd 0000 0000", "resb rbd,rs", 0,
- "CZSV--", 7, 16, "1000 1101 imm4 0011", "resflg imm4", 0,
+ "CZSV--", 7, 16, "1000 1101 flags 0011", "resflg flags", 0,
"------", 10, 16, "1001 1110 0000 cccc", "ret cc", 0,
"CZSV--", 6, 16, "1011 0011 dddd 00I0", "rl rd,imm1or2", 0,
@@ -403,33 +405,33 @@ struct op opt[] =
"CZSVDH", 33, 8, "0111 1111 imm8", "sc imm8", 0,
-"CZSV--", 15, 16, "1011 0011 dddd 1011 0000 ssss 0000 0000", "sda rd,rs", 0,
-"CZSV--", 15, 8, "1011 0010 dddd 1011 0000 ssss 0000 0000", "sdab rbd,rs", 0,
+ "CZSV--", 15, 16, "1011 0011 dddd 1011 0000 ssss 0000 0000", "sda rd,rs", 0,
+ "CZSV--", 15, 8, "1011 0010 dddd 1011 0000 ssss 0000 0000", "sdab rbd,rs", 0,
"CZSV--", 15, 32, "1011 0011 dddd 1111 0000 ssss 0000 0000", "sdal rrd,rs", 0,
-"CZS---", 15, 16, "1011 0011 dddd 0011 0000 ssss 0000 0000", "sdl rd,rs", 0,
-"CZS---", 15, 8, "1011 0010 dddd 0011 0000 ssss 0000 0000", "sdlb rbd,rs", 0,
+ "CZS---", 15, 16, "1011 0011 dddd 0011 0000 ssss 0000 0000", "sdl rd,rs", 0,
+ "CZS---", 15, 8, "1011 0010 dddd 0011 0000 ssss 0000 0000", "sdlb rbd,rs", 0,
"CZS---", 15, 32, "1011 0011 dddd 0111 0000 ssss 0000 0000", "sdll rrd,rs", 0,
"------", 11, 16, "0010 0101 ddN0 imm4", "set @rd,imm4", 0,
"------", 14, 16, "0110 0101 ddN0 imm4 address_dst", "set address_dst(rd),imm4", 0,
"------", 13, 16, "0110 0101 0000 imm4 address_dst", "set address_dst,imm4", 0,
"------", 4, 16, "1010 0101 dddd imm4", "set rd,imm4", 0,
-"------", 10, 16, "0010 0101 0000 ssss 0000 dddd 0000 0000", "set rd,rs", 0,
+ "------", 10, 16, "0010 0101 0000 ssss 0000 dddd 0000 0000", "set rd,rs", 0,
"------", 11, 8, "0010 0100 ddN0 imm4", "setb @rd,imm4", 0,
"------", 14, 8, "0110 0100 ddN0 imm4 address_dst", "setb address_dst(rd),imm4", 0,
"------", 13, 8, "0110 0100 0000 imm4 address_dst", "setb address_dst,imm4", 0,
"------", 4, 8, "1010 0100 dddd imm4", "setb rbd,imm4", 0,
-"------", 10, 8, "0010 0100 0000 ssss 0000 dddd 0000 0000", "setb rbd,rs", 0,
+ "------", 10, 8, "0010 0100 0000 ssss 0000 dddd 0000 0000", "setb rbd,rs", 0,
- "CZSV--", 7, 16, "1000 1101 imm4 0001", "setflg imm4", 0,
+ "CZSV--", 7, 16, "1000 1101 flags 0001", "setflg flags", 0,
- "------", 0, 8, "0011 1100 dddd 0101 imm16", "sinb rbd,imm16", 0,
- "------", 0, 8, "0011 1101 dddd 0101 imm16", "sinb rd,imm16", 0,
+ "------", 0, 8, "0011 1010 dddd 0101 imm16", "sinb rbd,imm16", 0,
+ "------", 0, 8, "0011 1011 dddd 0101 imm16", "sin rd,imm16", 0,
"------", 0, 16, "0011 1011 ssN0 1000 0001 aaaa ddN0 1000", "sind @rd,@rs,ra", 0,
"------", 0, 8, "0011 1010 ssN0 1000 0001 aaaa ddN0 1000", "sindb @rd,@rs,rba", 0,
- "------", 0, 8, "0011 1100 ssN0 0001 0000 aaaa ddN0 1000", "sinib @rd,@rs,ra", 0,
- "------", 0, 16, "0011 1100 ssN0 0001 0000 aaaa ddN0 0000", "sinibr @rd,@rs,ra", 0,
+ "------", 0, 8, "0011 1010 ssN0 0001 0000 aaaa ddN0 1000", "sinib @rd,@rs,ra", 0,
+ "------", 0, 16, "0011 1010 ssN0 0001 0000 aaaa ddN0 0000", "sinibr @rd,@rs,ra", 0,
"CZSV--", 13, 16, "1011 0011 dddd 1001 0000 0000 imm8", "sla rd,imm8", 0,
"CZSV--", 13, 8, "1011 0010 dddd 1001 0000 0000 imm8", "slab rbd,imm8", 0,
@@ -443,25 +445,25 @@ struct op opt[] =
"------", 0, 8, "0011 1010 ssss 0111 imm16", "soutb imm16,rbs", 0,
"------", 0, 16, "0011 1011 ssN0 1011 0000 aaaa ddN0 1000", "soutd @rd,@rs,ra", 0,
"------", 0, 8, "0011 1010 ssN0 1011 0000 aaaa ddN0 1000", "soutdb @rd,@rs,rba", 0,
- "------", 0, 8, "0011 1100 ssN0 0011 0000 aaaa ddN0 1000", "soutib @rd,@rs,ra", 0,
- "------", 0, 16, "0011 1100 ssN0 0011 0000 aaaa ddN0 0000", "soutibr @rd,@rs,ra", 0,
+ "------", 0, 8, "0011 1010 ssN0 0011 0000 aaaa ddN0 1000", "soutib @rd,@rs,ra", 0,
+ "------", 0, 16, "0011 1010 ssN0 0011 0000 aaaa ddN0 0000", "soutibr @rd,@rs,ra", 0,
"CZSV--", 13, 16, "1011 0011 dddd 1001 1111 1111 nim8", "sra rd,imm8", 0,
- "CZSV--", 13, 8, "1011 0010 dddd 1001 1111 1111 nim8", "srab rbd,imm8", 0,
+ "CZSV--", 13, 8, "1011 0010 dddd 1001 0000 0000 nim8", "srab rbd,imm8", 0,
"CZSV--", 13, 32, "1011 0011 dddd 1101 1111 1111 nim8", "sral rrd,imm8", 0,
"CZSV--", 13, 16, "1011 0011 dddd 0001 1111 1111 nim8", "srl rd,imm8", 0,
- "CZSV--", 13, 8, "1011 0010 dddd 0001 1111 1111 nim8", "srlb rbd,imm8", 0,
+ "CZSV--", 13, 8, "1011 0010 dddd 0001 0000 0000 nim8", "srlb rbd,imm8", 0,
"CZSV--", 13, 32, "1011 0011 dddd 0101 1111 1111 nim8", "srll rrd,imm8", 0,
"CZSV--", 7, 16, "0000 0011 ssN0 dddd", "sub rd,@rs", 0,
-"CZSV--", 9, 16, "0100 0011 0000 dddd address_src", "sub rd,address_src", 0,
+ "CZSV--", 9, 16, "0100 0011 0000 dddd address_src", "sub rd,address_src", 0,
"CZSV--", 10, 16, "0100 0011 ssN0 dddd address_src", "sub rd,address_src(rs)", 0,
- "CZSV--", 7, 16, "0000 0010 0000 dddd imm16", "sub rd,imm16", 0,
+ "CZSV--", 7, 16, "0000 0011 0000 dddd imm16", "sub rd,imm16", 0,
"CZSV--", 4, 16, "1000 0011 ssss dddd", "sub rd,rs", 0,
"CZSVDH", 7, 8, "0000 0010 ssN0 dddd", "subb rbd,@rs", 0,
-"CZSVDH", 9, 8, "0100 0010 0000 dddd address_src", "subb rbd,address_src", 0,
+ "CZSVDH", 9, 8, "0100 0010 0000 dddd address_src", "subb rbd,address_src", 0,
"CZSVDH", 10, 8, "0100 0010 ssN0 dddd address_src", "subb rbd,address_src(rs)", 0,
"CZSVDH", 7, 8, "0000 0010 0000 dddd imm8 imm8", "subb rbd,imm8", 0,
"CZSVDH", 4, 8, "1000 0010 ssss dddd", "subb rbd,rbs", 0,
@@ -486,7 +488,7 @@ struct op opt[] =
"-ZSP--", 7, 8, "1000 1100 dddd 0100", "testb rbd", 0,
"-ZS---", 13, 32, "0001 1100 ddN0 1000", "testl @rd", 0,
-"-ZS---", 16, 32, "0101 1100 0000 1000 address_dst", "testl address_dst", 0,
+ "-ZS---", 16, 32, "0101 1100 0000 1000 address_dst", "testl address_dst", 0,
"-ZS---", 17, 32, "0101 1100 ddN0 1000 address_dst", "testl address_dst(rd)", 0,
"-ZS---", 13, 32, "1001 1100 dddd 1000", "testl rrd", 0,
@@ -494,8 +496,9 @@ struct op opt[] =
"-ZSV--", 25, 8, "1011 1000 ddN0 1100 0000 aaaa ssN0 0000", "trdrb @rd,@rs,rba", 0,
"-ZSV--", 25, 8, "1011 1000 ddN0 0000 0000 rrrr ssN0 0000", "trib @rd,@rs,rbr", 0,
"-ZSV--", 25, 8, "1011 1000 ddN0 0100 0000 rrrr ssN0 0000", "trirb @rd,@rs,rbr", 0,
+ "-ZSV--", 25, 8, "1011 1000 aaN0 1010 0000 rrrr bbN0 0000", "trtdb @ra,@rb,rbr", 0,
"-ZSV--", 25, 8, "1011 1000 aaN0 1110 0000 rrrr bbN0 1110", "trtdrb @ra,@rb,rbr", 0,
- "-ZSV--", 25, 8, "1011 1000 aaN0 0010 0000 rrrr bbN0 0000", "trtib @ra,@rb,rr", 0,
+ "-ZSV--", 25, 8, "1011 1000 aaN0 0010 0000 rrrr bbN0 0000", "trtib @ra,@rb,rbr", 0,
"-ZSV--", 25, 8, "1011 1000 aaN0 0110 0000 rrrr bbN0 1110", "trtirb @ra,@rb,rbr", 0,
"-ZSV--", 25, 8, "1011 1000 aaN0 1010 0000 rrrr bbN0 0000", "trtrb @ra,@rb,rbr", 0,
@@ -510,16 +513,20 @@ struct op opt[] =
"--S---", 7, 8, "1000 1100 dddd 0110", "tsetb rbd", 0,
"-ZS---", 7, 16, "0000 1001 ssN0 dddd", "xor rd,@rs", 0,
-"-ZS---", 9, 16, "0100 1001 0000 dddd address_src", "xor rd,address_src", 0,
+ "-ZS---", 9, 16, "0100 1001 0000 dddd address_src", "xor rd,address_src", 0,
"-ZS---", 10, 16, "0100 1001 ssN0 dddd address_src", "xor rd,address_src(rs)", 0,
"-ZS---", 7, 16, "0000 1001 0000 dddd imm16", "xor rd,imm16", 0,
"-ZS---", 4, 16, "1000 1001 ssss dddd", "xor rd,rs", 0,
"-ZSP--", 7, 8, "0000 1000 ssN0 dddd", "xorb rbd,@rs", 0,
-"-ZSP--", 9, 8, "0100 1000 0000 dddd address_src", "xorb rbd,address_src", 0,
+ "-ZSP--", 9, 8, "0100 1000 0000 dddd address_src", "xorb rbd,address_src", 0,
"-ZSP--", 10, 8, "0100 1000 ssN0 dddd address_src", "xorb rbd,address_src(rs)", 0,
"-ZSP--", 7, 8, "0000 1000 0000 dddd imm8 imm8", "xorb rbd,imm8", 0,
"-ZSP--", 4, 8, "1000 1000 ssss dddd", "xorb rbd,rbs", 0,
+
+ "------", 7, 32, "1000 1100 dddd 0001", "ldctlb rbd,ctrl", 0,
+ "CZSVDH", 7, 32, "1000 1100 ssss 1001", "ldctlb ctrl,rbs", 0,
+
"*", 4, 8, "1000 1000 ssss dddd", "xorb rbd,rbs", 0,
"*", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
@@ -697,7 +704,6 @@ struct tok_struct toks[] =
"01ii", "CLASS_01II", 1,
"00ii", "CLASS_00II", 1,
0, 0
-
};
char *
@@ -893,7 +899,7 @@ void
internal ()
{
int c = count ();
- struct op *new = xmalloc (sizeof (struct op) * c);
+ struct op *new = (struct op *) xmalloc (sizeof (struct op) * c);
struct op *p = opt;
memcpy (new, p, c * sizeof (struct op));
@@ -952,7 +958,7 @@ gas ()
struct op *p = opt;
int idx = 0;
char *oldname = "";
- struct op *new = xmalloc (sizeof (struct op) * c);
+ struct op *new = (struct op *) xmalloc (sizeof (struct op) * c);
memcpy (new, p, c * sizeof (struct op));
@@ -1203,6 +1209,10 @@ gas ()
printf ("#define OPC_rsvd9f 172\n");
printf ("#define OPC_rsvdb9 172\n");
printf ("#define OPC_rsvdbf 172\n");
+ printf ("#define OPC_outi 173\n");
+ printf ("#define OPC_ldctlb 174\n");
+ printf ("#define OPC_sin 175\n");
+ printf ("#define OPC_trtdb 176\n");
#if 0
for (i = 0; toks[i].token; i++)
printf ("#define %s\t0x%x\n", toks[i].token, i * 16);
@@ -1217,7 +1227,7 @@ gas ()
printf ("#endif\n");
printf ("char *name;\n");
printf ("unsigned char opcode;\n");
- printf ("void (*func)();\n");
+ printf ("void (*func) PARAMS ((void));\n");
printf ("unsigned int arg_info[4];\n");
printf ("unsigned int byte_info[%d];\n", BYTE_INFO_LEN);
printf ("int noperands;\n");
@@ -1268,7 +1278,9 @@ gas ()
printf ("},\n");
new++;
}
- printf ("0,0};\n");
+ printf ("\n/* end marker */\n");
+ printf ("{\n#ifdef NICENAMES\nNULL,0,0,\n0,\n#endif\n");
+ printf ("NULL,0,0,{0,0,0,0},{0,0,0,0,0,0,0,0,0,0},0,0,0}\n};\n");
printf ("#endif\n");
}
@@ -1309,5 +1321,5 @@ main (ac, av)
printf ("-d : generate new table for disassemble\n");
printf ("-h : generate new table for humans\n");
}
-return 0;
+ return 0;
}
OpenPOWER on IntegriCloud