[PATCH] SH architecture flags overhaul

Andrew Stubbs andrew.stubbs@superh.com
Mon May 24 17:31:00 GMT 2004


Hi

This patch is in response to the discussion starting at message:
http://sources.redhat.com/ml/binutils/2004-03/msg00083.html .

It solves the problem of the broken merge routines by introducing a new
and (hopefully) more maintainable architecture flags system.

The ELF flags are no longer used to determine how to merge
architectures. Instead the opcodes arch flags are used for this purpose.
There are new tables provided to convert between BFD machine and
architecture flags and between BFD machine and ELF flags.

The internal definition of the architecture flags in sh-opc.h has been
altered in order to better describe each architecture and limit the
proliferation of new flags, that has taken place recently, before there
are none left (not that we were likely to run out very soon).  Instead
of having one bit for each architecture variant there is now one bit for
each base architecture and then extra bits describing what extra
features it has. In this way each variant is described by 3 bits (base,
co-processor type and MMU presence). This scales better because adding a
new base architecture automatically allows 8 new variants which would
previously have required 8 new bits defined (should all 8 have been
required).

The value of the ELF flags used to indicate some of the properties of
that architecture. This became impractical (and broken) some time ago.
The value is now merely an index into a table.

These changes have allowed the number of places where architectures are
operated on by name to be reduced. Previously adding a new architecture
variant required editing archures.c (and bfd-in2.h), cpu-sh.c,
elf32-sh.c, tc-sh.c, include/elf/sh.h, sh-opc.h and sh-dis.c. Of those,
elf32-sh.c, tc-sh.c and sh-dis.c should no longer require any
modification.

The assembler now auto-detects what ISAs are available so there is no
longer any need to add the -isa options one at a time. I wanted to add a
similar option to the linker (i.e. stop it linking object files that are
not compatible with a given ISA), but I can find no obvious place to put
the option or even anywhere to put the functionality. Can anybody give
me any pointers? The --help message hints at the -A option, but it isn't
clear to me what that actually does inside the code.

In the process of doing all this it became apparent that an sh3-nommu
target is necessary to make it work properly. Even before these changes
the <arch>_up macros did not work quite right with certain test cases
and would give unexpected results. This is because of the way the
sh4-nommu-nofpu fits into the inheritance graph. Previously I had it
descending from SH3, which implies that it should have an MMU, but of
course it does not.

Having had lots and lots of problems getting all this to work properly -
there are a lot of option/architecture permutations - I have added a
number of new tests to the linker and assembler testsuites. These should
detect if anybody breaks the logic in future. I have also tried to make
it easy to add new architectures to these tests in future.

I also wanted to add tests do the disassembler - to make sure that it
does not disassemble instructions that do not exist on that architecture
- but opcodes has no testsuite and binutils has hardly any testsuite,
none of which is target specific, so I have not done anything.

I have run regression tests (in a unified tree) for both sh-elf sh64-elf
with no new test failures. I have also run regression tests (without the
unified tree) for sh-coff.

Note that the patch requires two Makefile.in files to be regenerated.

-- 
Andrew Stubbs
andrew.stubbs@superh.com
-------------- next part --------------
2004-05-24  Andrew Stubbs <andrew.stubbs@superh.com>

bfd:
	* Makefile.am: Regenerate dependencies.
	* Makefile.in: Regenerate.
	* archures.c: Add bfd_mach_sh3_nommu .
        * bfd-in2.h: Regenerate.
        * cpu-sh.c: Add sh3-nommu architecture.
	  (bfd_to_arch_table[]): Create new table.
	  (sh_get_arch_from_bfd_mach): Create new function.
	  (sh_get_arch_up_from_bfd_mach): Create new function.
	  (sh_merge_bfd_arch): Create new function.
	* elf32-sh.c (sh_ef_bfd_table[]): Add table.
	  (sh_elf_check_relocs): Replace switch statement with
	  use of sh_ef_bfd_table[] .
	  (sh_elf_get_flags_from_mach): Add new function.
	  (sh_find_elf_flags): Likewise.
	  (sh_elf_copy_private_data): Replace most of non-elf contents
	  with a call to sh_merge_bfd_arch() .

gas:
	* Makefile.am: Regenerate dependecies.
	* Makefile.in: Regenerate.
	* config/tc-sh.c (valid_arch): Make unsigned.
          (preset_target_arch): Likewise.
	  (md_begin): Use new architecture flags system.
	  (get_specific): Likewise.
          (assemble_ppi): Likewise.
          (md_assemble): Likewise. Also fix error check for bad opcodes.
	  (md_parse_option): Likewise. Also generate -isa values according
          to the table in bfd/cpu-sh.c instead of just constants. Also
	  allow <arch>-up ISA variants.
          (sh_elf_final_processing): Replace if-else chain with a call to
          sh_find_elf_flags().
	* testsuite/gas/sh/arch: New directory.
        * testsuite/gas/sh/arch/arch.exp: New test script.
        * testsuite/gas/sh/arch/arch_expected.txt: New file.
        * testsuite/gas/sh/arch/sh.s: New file.
        * testsuite/gas/sh/arch/sh2.s: New file.
        * testsuite/gas/sh/arch/sh-dsp.s: New file.
        * testsuite/gas/sh/arch/sh2e.s: New file.
        * testsuite/gas/sh/arch/sh3-nommu.s: New file.
        * testsuite/gas/sh/arch/sh3.s: New file.
        * testsuite/gas/sh/arch/sh3-dsp.s: New file.
        * testsuite/gas/sh/arch/sh3e.s: New file.
        * testsuite/gas/sh/arch/sh4-nommu-nofpu.s: New file.
        * testsuite/gas/sh/arch/sh4-nofpu.s: New file.
        * testsuite/gas/sh/arch/sh4.s: New file.
        * testsuite/gas/sh/arch/sh4a-nofpu.s: New file.
        * testsuite/gas/sh/arch/sh4al-dsp.s: New file.
        * testsuite/gas/sh/arch/sh4a.s: New file.

include/elf:
        * sh.h (EF_SH_HAS_DSP): Remove.
	  (EF_SH_HAS_FP): Remove.
	  (EF_SH_MERGE_MACH): Remove.
	  (EF_SH4_NOFPU): Convert to decimal.
	  (EF_SH4A_NOFPU): Likewise.
	  (EF_SH4_NOMMU_NOFPU): Likewise.
	  (EF_SH3_NOMMU): Add new macro.
	  (EF_SH_BFD_TABLE): Likewise.
          (sh_find_elf_flags): Add prototype.
          (sh_elf_get_flags_from_mach): Likewise.

opcodes:
	* sh-dis.c (target_arch): Make unsigned.
	  (print_insn_sh): Replace (most of) switch with a call to
          sh_get_arch_from_bfd_mach(). Also use new architecture flags system.
	* sh-opc.h: Redefine architecture flags values.
          Add sh3-nommu architecture.
          Reorganise <arch>_up macros so they make more visual sense.
	  (SH_MERGE_ARCH_SET): Define new macro.
          (SH_VALID_BASE_ARCH_SET): Likewise.
          (SH_VALID_MMU_ARCH_SET): Likewise.
          (SH_VALID_CO_ARCH_SET): Likewise.
          (SH_VALID_ARCH_SET): Likewise.
          (SH_MERGE_ARCH_SET_VALID): Likewise.
          (SH_ARCH_SET_HAS_FPU): Likewise.
          (SH_ARCH_SET_HAS_DSP): Likewise.
	  (SH_ARCH_UNKNOWN_ARCH): Likewise.
	  (sh_get_arch_from_bfd_mach): Add prototype.
	  (sh_get_arch_up_from_bfd_mach): Likewise.
	  (sh_get_bfd_mach_from_arch_set): Likewise.
	  (sh_merge_bfd_arc): Likewise.

ld:
        * testsuite/ld-sh/arch/arch.exp: New test script.
        * testsuite/ld-sh/arch/arch_expected.txt: New file.
        * testsuite/ld-sh/arch/sh.s: New file.
        * testsuite/ld-sh/arch/sh2.s: New file.
        * testsuite/ld-sh/arch/sh-dsp.s: New file.
        * testsuite/ld-sh/arch/sh2e.s: New file.
        * testsuite/ld-sh/arch/sh3-nommu.s: New file.
        * testsuite/ld-sh/arch/sh3.s: New file.
        * testsuite/ld-sh/arch/sh3-dsp.s: New file.
        * testsuite/ld-sh/arch/sh3e.s: New file.
        * testsuite/ld-sh/arch/sh4-nommu-nofpu.s: New file.
        * testsuite/ld-sh/arch/sh4-nofpu.s: New file.
        * testsuite/ld-sh/arch/sh4.s: New file.
        * testsuite/ld-sh/arch/sh4a-nofpu.s: New file.
        * testsuite/ld-sh/arch/sh4al-dsp.s: New file.
        * testsuite/ld-sh/arch/sh4a.s: New file.


Index: bfd/Makefile.am
===================================================================
RCS file: /cvs/src/src/bfd/Makefile.am,v
retrieving revision 1.131
diff -c -p -r1.131 Makefile.am
*** bfd/Makefile.am	8 Apr 2004 15:17:35 -0000	1.131
--- bfd/Makefile.am	24 May 2004 11:09:21 -0000
*************** cpu-alpha.lo: cpu-alpha.c $(INCDIR)/file
*** 919,926 ****
  cpu-arc.lo: cpu-arc.c $(INCDIR)/filenames.h
  cpu-arm.lo: cpu-arm.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h
  cpu-avr.lo: cpu-avr.c $(INCDIR)/filenames.h
- cpu-cr16c.lo: cpu-cr16c.c $(INCDIR)/filenames.h
  cpu-cris.lo: cpu-cris.c $(INCDIR)/filenames.h
  cpu-d10v.lo: cpu-d10v.c $(INCDIR)/filenames.h
  cpu-d30v.lo: cpu-d30v.c $(INCDIR)/filenames.h
  cpu-dlx.lo: cpu-dlx.c $(INCDIR)/filenames.h
--- 919,926 ----
  cpu-arc.lo: cpu-arc.c $(INCDIR)/filenames.h
  cpu-arm.lo: cpu-arm.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h
  cpu-avr.lo: cpu-avr.c $(INCDIR)/filenames.h
  cpu-cris.lo: cpu-cris.c $(INCDIR)/filenames.h
+ cpu-cr16c.lo: cpu-cr16c.c $(INCDIR)/filenames.h
  cpu-d10v.lo: cpu-d10v.c $(INCDIR)/filenames.h
  cpu-d30v.lo: cpu-d30v.c $(INCDIR)/filenames.h
  cpu-dlx.lo: cpu-dlx.c $(INCDIR)/filenames.h
*************** cpu-pj.lo: cpu-pj.c $(INCDIR)/filenames.
*** 956,962 ****
  cpu-powerpc.lo: cpu-powerpc.c $(INCDIR)/filenames.h
  cpu-rs6000.lo: cpu-rs6000.c $(INCDIR)/filenames.h
  cpu-s390.lo: cpu-s390.c $(INCDIR)/filenames.h
! cpu-sh.lo: cpu-sh.c $(INCDIR)/filenames.h
  cpu-sparc.lo: cpu-sparc.c $(INCDIR)/filenames.h
  cpu-tic30.lo: cpu-tic30.c $(INCDIR)/filenames.h
  cpu-tic4x.lo: cpu-tic4x.c $(INCDIR)/filenames.h
--- 956,962 ----
  cpu-powerpc.lo: cpu-powerpc.c $(INCDIR)/filenames.h
  cpu-rs6000.lo: cpu-rs6000.c $(INCDIR)/filenames.h
  cpu-s390.lo: cpu-s390.c $(INCDIR)/filenames.h
! cpu-sh.lo: cpu-sh.c $(INCDIR)/filenames.h $(srcdir)/../opcodes/sh-opc.h
  cpu-sparc.lo: cpu-sparc.c $(INCDIR)/filenames.h
  cpu-tic30.lo: cpu-tic30.c $(INCDIR)/filenames.h
  cpu-tic4x.lo: cpu-tic4x.c $(INCDIR)/filenames.h
*************** elf32-avr.lo: elf32-avr.c $(INCDIR)/file
*** 1142,1151 ****
    $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
    $(INCDIR)/bfdlink.h $(INCDIR)/elf/avr.h $(INCDIR)/elf/reloc-macros.h \
    elf32-target.h
! elf32-cr16c.lo: elf32-cr16c.c $(INCDIR)/filenames.h elf-bfd.h \
!   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
    $(INCDIR)/bfdlink.h $(INCDIR)/elf/cr16c.h $(INCDIR)/elf/reloc-macros.h \
!   elf32-target.h
  elf32-cris.lo: elf32-cris.c $(INCDIR)/filenames.h elf-bfd.h \
    $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
    $(INCDIR)/bfdlink.h $(INCDIR)/elf/cris.h $(INCDIR)/elf/reloc-macros.h \
--- 1142,1151 ----
    $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
    $(INCDIR)/bfdlink.h $(INCDIR)/elf/avr.h $(INCDIR)/elf/reloc-macros.h \
    elf32-target.h
! elf32-cr16c.lo: elf32-cr16c.c $(INCDIR)/filenames.h \
    $(INCDIR)/bfdlink.h $(INCDIR)/elf/cr16c.h $(INCDIR)/elf/reloc-macros.h \
!   elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
!   $(INCDIR)/elf/external.h elf32-target.h
  elf32-cris.lo: elf32-cris.c $(INCDIR)/filenames.h elf-bfd.h \
    $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
    $(INCDIR)/bfdlink.h $(INCDIR)/elf/cris.h $(INCDIR)/elf/reloc-macros.h \
*************** elf32-sh64.lo: elf32-sh64.c $(INCDIR)/fi
*** 1280,1286 ****
    $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
    $(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \
    elf32-sh64.h elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
!   elf32-target.h
  elf32-sh64-com.lo: elf32-sh64-com.c $(INCDIR)/filenames.h \
    elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
    $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/sh.h \
--- 1280,1286 ----
    $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
    $(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \
    elf32-sh64.h elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
!   $(INCDIR)/libiberty.h elf32-target.h
  elf32-sh64-com.lo: elf32-sh64-com.c $(INCDIR)/filenames.h \
    elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
    $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/sh.h \
*************** elf32-s390.lo: elf32-s390.c $(INCDIR)/fi
*** 1292,1298 ****
  elf32-sh.lo: elf32-sh.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 \
!   elf32-target.h
  elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \
    $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
    $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \
--- 1292,1298 ----
  elf32-sh.lo: elf32-sh.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 \
!   $(INCDIR)/libiberty.h elf32-target.h
  elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \
    $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
    $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \
*************** elf32-xtensa.lo: elf32-xtensa.c $(INCDIR
*** 1318,1328 ****
    $(INCDIR)/xtensa-config.h elf32-target.h
  elf32.lo: elf32.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
    $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
!   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h \
!   $(INCDIR)/safe-ctype.h
  elflink.lo: elflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
    elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
!   $(INCDIR)/elf/external.h $(INCDIR)/libiberty.h
  elf-strtab.lo: elf-strtab.c $(INCDIR)/filenames.h elf-bfd.h \
    $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
    $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h
--- 1318,1327 ----
    $(INCDIR)/xtensa-config.h elf32-target.h
  elf32.lo: elf32.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
    $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
!   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h
  elflink.lo: elflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
    elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
!   $(INCDIR)/elf/external.h $(INCDIR)/safe-ctype.h $(INCDIR)/libiberty.h
  elf-strtab.lo: elf-strtab.c $(INCDIR)/filenames.h elf-bfd.h \
    $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
    $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h
*************** xcofflink.lo: xcofflink.c $(INCDIR)/file
*** 1522,1529 ****
  xsym.lo: xsym.c xsym.h $(INCDIR)/filenames.h
  xtensa-isa.lo: xtensa-isa.c $(INCDIR)/xtensa-isa.h \
    $(INCDIR)/xtensa-isa-internal.h
! xtensa-modules.lo: xtensa-modules.c $(INCDIR)/xtensa-isa.h \
!   $(INCDIR)/xtensa-isa-internal.h
  aix5ppc-core.lo: aix5ppc-core.c
  aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
    $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \
--- 1521,1527 ----
  xsym.lo: xsym.c xsym.h $(INCDIR)/filenames.h
  xtensa-isa.lo: xtensa-isa.c $(INCDIR)/xtensa-isa.h \
    $(INCDIR)/xtensa-isa-internal.h
! xtensa-modules.lo: xtensa-modules.c $(INCDIR)/xtensa-isa-internal.h
  aix5ppc-core.lo: aix5ppc-core.c
  aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
    $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \
*************** elf64-sparc.lo: elf64-sparc.c $(INCDIR)/
*** 1600,1607 ****
    elf64-target.h
  elf64.lo: elf64.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
    $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
!   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h \
!   $(INCDIR)/safe-ctype.h
  mmo.lo: mmo.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
    $(INCDIR)/elf/mmix.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/mmix.h
  nlm32-alpha.lo: nlm32-alpha.c $(INCDIR)/filenames.h \
--- 1598,1604 ----
    elf64-target.h
  elf64.lo: elf64.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
    $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
!   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h
  mmo.lo: mmo.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
    $(INCDIR)/elf/mmix.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/mmix.h
  nlm32-alpha.lo: nlm32-alpha.c $(INCDIR)/filenames.h \
Index: bfd/archures.c
===================================================================
RCS file: /cvs/src/src/bfd/archures.c,v
retrieving revision 1.93
diff -c -p -r1.93 archures.c
*** bfd/archures.c	5 May 2004 14:33:13 -0000	1.93
--- bfd/archures.c	24 May 2004 11:09:21 -0000
*************** DESCRIPTION
*** 231,236 ****
--- 231,237 ----
  .#define bfd_mach_sh_dsp     0x2d
  .#define bfd_mach_sh2e       0x2e
  .#define bfd_mach_sh3        0x30
+ .#define bfd_mach_sh3_nommu  0x31
  .#define bfd_mach_sh3_dsp    0x3d
  .#define bfd_mach_sh3e       0x3e
  .#define bfd_mach_sh4        0x40
Index: bfd/bfd-in2.h
===================================================================
RCS file: /cvs/src/src/bfd/bfd-in2.h,v
retrieving revision 1.276
diff -c -p -r1.276 bfd-in2.h
*** bfd/bfd-in2.h	5 May 2004 14:33:13 -0000	1.276
--- bfd/bfd-in2.h	24 May 2004 11:09:21 -0000
*************** enum bfd_architecture
*** 1650,1655 ****
--- 1650,1656 ----
  #define bfd_mach_sh_dsp     0x2d
  #define bfd_mach_sh2e       0x2e
  #define bfd_mach_sh3        0x30
+ #define bfd_mach_sh3_nommu  0x31
  #define bfd_mach_sh3_dsp    0x3d
  #define bfd_mach_sh3e       0x3e
  #define bfd_mach_sh4        0x40
Index: bfd/cpu-sh.c
===================================================================
RCS file: /cvs/src/src/bfd/cpu-sh.c,v
retrieving revision 1.14
diff -c -p -r1.14 cpu-sh.c
*** bfd/cpu-sh.c	3 Mar 2004 18:01:49 -0000	1.14
--- bfd/cpu-sh.c	24 May 2004 11:09:21 -0000
***************
*** 22,41 ****
  #include "bfd.h"
  #include "sysdep.h"
  #include "libbfd.h"
  
  #define SH_NEXT      &arch_info_struct[0]
  #define SH2_NEXT     &arch_info_struct[1]
  #define SH2E_NEXT    &arch_info_struct[2]
  #define SH_DSP_NEXT  &arch_info_struct[3]
  #define SH3_NEXT     &arch_info_struct[4]
! #define SH3_DSP_NEXT &arch_info_struct[5]
! #define SH3E_NEXT    &arch_info_struct[6]
! #define SH4_NEXT     &arch_info_struct[7]
! #define SH4A_NEXT    &arch_info_struct[8]
! #define SH4AL_DSP_NEXT &arch_info_struct[9]
! #define SH4_NOFPU_NEXT &arch_info_struct[10]
! #define SH4_NOMMU_NOFPU_NEXT &arch_info_struct[11]
! #define SH4A_NOFPU_NEXT &arch_info_struct[12]
  #define SH64_NEXT    NULL
  
  static const bfd_arch_info_type arch_info_struct[] =
--- 22,43 ----
  #include "bfd.h"
  #include "sysdep.h"
  #include "libbfd.h"
+ #include "../opcodes/sh-opc.h"
  
  #define SH_NEXT      &arch_info_struct[0]
  #define SH2_NEXT     &arch_info_struct[1]
  #define SH2E_NEXT    &arch_info_struct[2]
  #define SH_DSP_NEXT  &arch_info_struct[3]
  #define SH3_NEXT     &arch_info_struct[4]
! #define SH3_NOMMU_NEXT &arch_info_struct[5]
! #define SH3_DSP_NEXT &arch_info_struct[6]
! #define SH3E_NEXT    &arch_info_struct[7]
! #define SH4_NEXT     &arch_info_struct[8]
! #define SH4A_NEXT    &arch_info_struct[9]
! #define SH4AL_DSP_NEXT &arch_info_struct[10]
! #define SH4_NOFPU_NEXT &arch_info_struct[11]
! #define SH4_NOMMU_NOFPU_NEXT &arch_info_struct[12]
! #define SH4A_NOFPU_NEXT &arch_info_struct[13]
  #define SH64_NEXT    NULL
  
  static const bfd_arch_info_type arch_info_struct[] =
*************** static const bfd_arch_info_type arch_inf
*** 101,106 ****
--- 103,122 ----
      32,				/* 32 bits in an address */
      8,				/* 8 bits in a byte */
      bfd_arch_sh,
+     bfd_mach_sh3_nommu,
+     "sh",			/* arch_name  */
+     "sh3-nommu",		/* printable name */
+     1,
+     FALSE,			/* not the default */
+     bfd_default_compatible,
+     bfd_default_scan,
+     SH3_NOMMU_NEXT
+   },
+   {
+     32,				/* 32 bits in a word */
+     32,				/* 32 bits in an address */
+     8,				/* 8 bits in a byte */
+     bfd_arch_sh,
      bfd_mach_sh3_dsp,
      "sh",			/* arch_name  */
      "sh3-dsp",			/* printable name */
*************** const bfd_arch_info_type bfd_sh_arch =
*** 239,241 ****
--- 255,426 ----
    bfd_default_scan,
    SH_NEXT
  };
+ 
+ 
+ /* This table defines the mappings from the BFD internal numbering
+    system to the opcodes internal flags system.
+    It is used by the functions defined below.
+    The prototypes for these SH specific functions are found in
+    sh-opc.h .  */
+ 
+ static struct { unsigned long bfd_mach, arch, arch_up; } bfd_to_arch_table[] =
+ {
+   { bfd_mach_sh,              arch_sh1,             arch_sh1_up },
+   { bfd_mach_sh2,             arch_sh2,             arch_sh2_up },
+   { bfd_mach_sh2e,            arch_sh2e,            arch_sh2e_up },
+   { bfd_mach_sh_dsp,          arch_sh_dsp,          arch_sh_dsp_up },
+   { bfd_mach_sh3,             arch_sh3,             arch_sh3_up },
+   { bfd_mach_sh3_nommu,       arch_sh3_nommu,       arch_sh3_nommu_up },
+   { bfd_mach_sh3_dsp,         arch_sh3_dsp,         arch_sh3_dsp_up },
+   { bfd_mach_sh3e,            arch_sh3e,            arch_sh3e_up },
+   { bfd_mach_sh4,             arch_sh4,             arch_sh4_up },
+   { bfd_mach_sh4a,            arch_sh4a,            arch_sh4a_up },
+   { bfd_mach_sh4al_dsp,       arch_sh4al_dsp,       arch_sh4al_dsp_up },
+   { bfd_mach_sh4_nofpu,       arch_sh4_nofpu,       arch_sh4_nofp_up },
+   { bfd_mach_sh4_nommu_nofpu, arch_sh4_nommu_nofpu, arch_sh4_nommu_nofpu_up },
+   { bfd_mach_sh4a_nofpu,      arch_sh4a_nofpu,      arch_sh4a_nofp_up },
+   { 0, 0, 0 }   /* Terminator.  */
+ };
+ 
+ 
+ /* Convert a BFD mach number into the right opcodes arch flags
+    using the table above.  */
+ 
+ unsigned int
+ sh_get_arch_from_bfd_mach (unsigned long mach)
+ {
+   int i = 0;
+   
+   while (bfd_to_arch_table[i].bfd_mach != 0)
+     if (bfd_to_arch_table[i].bfd_mach == mach)
+       return bfd_to_arch_table[i].arch;
+     else
+       i++;
+ 
+   /* mach not found.  */
+   BFD_FAIL();
+ 
+   return SH_ARCH_UNKNOWN_ARCH;
+ }
+ 
+ 
+ /* Convert a BFD mach number into a set of opcodes arch flags
+    describing all the compatible architectures (i.e. arch_up)
+    using the table above.  */
+ 
+ unsigned int
+ sh_get_arch_up_from_bfd_mach (unsigned long mach)
+ {
+   int i = 0;
+   
+   while (bfd_to_arch_table[i].bfd_mach != 0)
+     if (bfd_to_arch_table[i].bfd_mach == mach)
+       return bfd_to_arch_table[i].arch_up;
+     else
+       i++;
+ 
+   /* mach not found.  */
+   BFD_FAIL();
+ 
+   return SH_ARCH_UNKNOWN_ARCH;
+ }
+ 
+ 
+ /* Convert an arbitary arch_set - not necessarily corresponding
+    directly to anything in the table above - to the most generic
+    architecture which supports all the required features, and
+    return the corresponding BFD mach.  */
+ 
+ unsigned long
+ sh_get_bfd_mach_from_arch_set (unsigned int arch_set)
+ {
+   unsigned long result = 0;
+   unsigned int best = ~arch_set;
+   unsigned int co_mask = ~0;
+   int i = 0;
+ 
+   /* If arch_set permits variants with no coprocessor then do not allow
+      the other irrelevant co-processor bits to influence the choice:
+        e.g. if dsp is disallowed by arch_set, then the algorithm would
+        prefer fpu variants over nofpu variants because they also disallow
+        dsp - even though the nofpu would be the most correct choice.
+      This assumes that EVERY fpu/dsp variant has a no-coprocessor
+      counter-part, or their non-fpu/dsp instructions do not have the
+      no co-processor bit set.  */
+   if (arch_set & arch_sh_no_co)
+     co_mask = ~(arch_sh_sp_fpu | arch_sh_dp_fpu | arch_sh_has_dsp);
+ 
+   while (bfd_to_arch_table[i].bfd_mach != 0)
+     {
+       unsigned int try = bfd_to_arch_table[i].arch_up & co_mask;
+ 
+       /* Conceptually: Find the architecture with the least number
+ 	 of extra features or, if they have the same number, then
+ 	 the greatest number of required features.  Disregard
+          architectures where the required features alone do
+ 	 not describe a valid architecture.  */
+       if (((try & ~arch_set) < (best & ~arch_set)
+ 	   || ((try & ~arch_set) == (best & ~arch_set)
+ 	       && (~try & arch_set) < (~best & arch_set)))
+ 	  && SH_MERGE_ARCH_SET_VALID (try, arch_set))
+ 	{
+ 	  result = bfd_to_arch_table[i].bfd_mach;
+ 	  best = try;
+ 	}
+ 
+       i++;
+     }
+ 
+   /* This might happen if a new variant is added to sh-opc.h
+      but no corresponding entry is added to the table above.  */
+   BFD_ASSERT (result != 0);
+ 
+   return result;
+ }
+ 
+ 
+ /* Merge the architecture type of two BFD files, such that the
+    resultant architecture supports all the features required
+    by the two input BFDs.
+    If the input BFDs are multually incompatible - i.e. one uses
+    DSP while the other uses FPU - or there is no known architecture
+    that fits the requirements then an error is emitted.  */
+ 
+ bfd_boolean
+ sh_merge_bfd_arch (bfd *ibfd, bfd *obfd)
+ {
+   unsigned int old_arch, new_arch, merged_arch;
+ 
+   if (! _bfd_generic_verify_endian_match (ibfd, obfd))
+     return FALSE;
+ 
+   old_arch = sh_get_arch_up_from_bfd_mach (bfd_get_mach (obfd));
+   new_arch = sh_get_arch_up_from_bfd_mach (bfd_get_mach (ibfd));
+ 
+   merged_arch = SH_MERGE_ARCH_SET (old_arch, new_arch);
+ 
+   if (!SH_VALID_CO_ARCH_SET (merged_arch))
+     {
+       (*_bfd_error_handler)
+ 	("%s: uses %s instructions while previous modules use %s instructions",
+ 	 bfd_archive_filename (ibfd),
+ 	 SH_ARCH_SET_HAS_DSP (new_arch) ? "dsp" : "floating point",
+ 	 SH_ARCH_SET_HAS_DSP (new_arch) ? "floating point" : "dsp");
+       bfd_set_error (bfd_error_bad_value);
+       return FALSE;
+     }
+   else if (!SH_VALID_ARCH_SET (merged_arch))
+     {
+       (*_bfd_error_handler)
+ 	("internal error: merge of architecture '%s' with architecture '%s' produced unknown architecture\n",
+ 	 bfd_printable_name (obfd),
+ 	 bfd_printable_name (ibfd));
+       bfd_set_error (bfd_error_bad_value);
+       return FALSE;
+     }
+ 
+   bfd_default_set_arch_mach (obfd, bfd_arch_sh,
+ 			     sh_get_bfd_mach_from_arch_set (merged_arch));
+   
+   return TRUE;
+ }
Index: bfd/elf32-sh.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-sh.c,v
retrieving revision 1.105
diff -c -p -r1.105 elf32-sh.c
*** bfd/elf32-sh.c	23 Apr 2004 02:47:38 -0000	1.105
--- bfd/elf32-sh.c	24 May 2004 11:09:21 -0000
***************
*** 25,30 ****
--- 25,31 ----
  #include "libbfd.h"
  #include "elf-bfd.h"
  #include "elf/sh.h"
+ #include "libiberty.h"
  
  static bfd_reloc_status_type sh_elf_reloc
    (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
*************** sh_elf_check_relocs (bfd *abfd, struct b
*** 6819,6876 ****
  }
  
  #ifndef sh_elf_set_mach_from_flags
  static bfd_boolean
  sh_elf_set_mach_from_flags (bfd *abfd)
  {
!   flagword flags = elf_elfheader (abfd)->e_flags;
  
-   switch (flags & EF_SH_MACH_MASK)
-     {
-     case EF_SH1:
-       bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh);
-       break;
-     case EF_SH2:
-       bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh2);
-       break;
-     case EF_SH2E:
-       bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh2e);
-       break;
-     case EF_SH_DSP:
-       bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh_dsp);
-       break;
-     case EF_SH3:
-       bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh3);
-       break;
-     case EF_SH3_DSP:
-       bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh3_dsp);
-       break;
-     case EF_SH3E:
-       bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh3e);
-       break;
-     case EF_SH_UNKNOWN:
-     case EF_SH4:
-       bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh4);
-       break;
-     case EF_SH4_NOFPU:
-       bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh4_nofpu);
-       break;
-     case EF_SH4A:
-       bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh4a);
-       break;
-     case EF_SH4A_NOFPU:
-       bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh4a_nofpu);
-       break;
-     case EF_SH4AL_DSP:
-       bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh4al_dsp);
-       break;
-     case EF_SH4_NOMMU_NOFPU:
-       bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh4_nommu_nofpu);
-       break;
-     default:
-       return FALSE;
-     }
    return TRUE;
  }
  #endif /* not sh_elf_set_mach_from_flags */
  
  #ifndef sh_elf_set_private_flags
--- 6820,6863 ----
  }
  
  #ifndef sh_elf_set_mach_from_flags
+ static unsigned int sh_ef_bfd_table[] = { EF_SH_BFD_TABLE };
+ 
  static bfd_boolean
  sh_elf_set_mach_from_flags (bfd *abfd)
  {
!   flagword flags = elf_elfheader (abfd)->e_flags & EF_SH_MACH_MASK;
! 
!   if (flags >= sizeof(sh_ef_bfd_table))
!     return FALSE;
! 
!   if (sh_ef_bfd_table[flags] == 0)
!     return FALSE;
!   
!   bfd_default_set_arch_mach (abfd, bfd_arch_sh, sh_ef_bfd_table[flags]);
  
    return TRUE;
  }
+ 
+ 
+ /* Reverse table lookup for sh_ef_bfd_table[].
+    Given a bfd MACH value from archures.c
+    return the equivalent ELF flags from the table.
+    Return -1 if no match is found.  */
+ 
+ int
+ sh_elf_get_flags_from_mach (unsigned long mach)
+ {
+   int i = ARRAY_SIZE (sh_ef_bfd_table);
+   
+   for (; i>0; i--)
+     if (sh_ef_bfd_table[i] == mach)
+       return i;
+   
+   /* shouldn't get here */
+   BFD_FAIL();
+ 
+   return -1;
+ }
  #endif /* not sh_elf_set_mach_from_flags */
  
  #ifndef sh_elf_set_private_flags
*************** sh_elf_copy_private_data (bfd * ibfd, bf
*** 6903,6919 ****
  #endif /* not sh_elf_copy_private_data */
  
  #ifndef sh_elf_merge_private_data
- /* This routine checks for linking big and little endian objects
-    together, and for linking sh-dsp with sh3e / sh4 objects.  */
  
! static bfd_boolean
! sh_elf_merge_private_data (bfd *ibfd, bfd *obfd)
  {
!   flagword old_flags, new_flags;
  
-   if (! _bfd_generic_verify_endian_match (ibfd, obfd))
-     return FALSE;
  
    if (   bfd_get_flavour (ibfd) != bfd_target_elf_flavour
        || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
      return TRUE;
--- 6890,6913 ----
  #endif /* not sh_elf_copy_private_data */
  
  #ifndef sh_elf_merge_private_data
  
! /* This function returns the ELF architecture number that
!    corresponds to the given arch_sh* flags.  */
! int
! sh_find_elf_flags (unsigned int arch_set)
  {
!   unsigned long bfd_mach = sh_get_bfd_mach_from_arch_set (arch_set);
! 
!   return sh_elf_get_flags_from_mach (bfd_mach);
! }
  
  
+ /* This routine initialises the elf flags when required and
+    calls sh_merge_bfd_arch() to check dsp/fpu compatibility.  */
+ 
+ static bfd_boolean
+ sh_elf_merge_private_data (bfd *ibfd, bfd *obfd)
+ {
    if (   bfd_get_flavour (ibfd) != bfd_target_elf_flavour
        || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
      return TRUE;
*************** sh_elf_merge_private_data (bfd *ibfd, bf
*** 6923,6945 ****
        /* This happens when ld starts out with a 'blank' output file.  */
        elf_flags_init (obfd) = TRUE;
        elf_elfheader (obfd)->e_flags = EF_SH1;
      }
-   old_flags = elf_elfheader (obfd)->e_flags;
-   new_flags = elf_elfheader (ibfd)->e_flags;
-   if ((EF_SH_HAS_DSP (old_flags) && EF_SH_HAS_FP (new_flags))
-       || (EF_SH_HAS_DSP (new_flags) && EF_SH_HAS_FP (old_flags)))
-     {
-       (*_bfd_error_handler)
- 	("%s: uses %s instructions while previous modules use %s instructions",
- 	 bfd_archive_filename (ibfd),
- 	 EF_SH_HAS_DSP (new_flags) ? "dsp" : "floating point",
- 	 EF_SH_HAS_DSP (new_flags) ? "floating point" : "dsp");
-       bfd_set_error (bfd_error_bad_value);
-       return FALSE;
-     }
-   elf_elfheader (obfd)->e_flags = EF_SH_MERGE_MACH (old_flags, new_flags);
  
!   return sh_elf_set_mach_from_flags (obfd);
  }
  #endif /* not sh_elf_merge_private_data */
  
--- 6917,6932 ----
        /* This happens when ld starts out with a 'blank' output file.  */
        elf_flags_init (obfd) = TRUE;
        elf_elfheader (obfd)->e_flags = EF_SH1;
+       sh_elf_set_mach_from_flags (obfd);
      }
  
!   if ( ! sh_merge_bfd_arch (ibfd, obfd) )
!     return FALSE;
! 
!   elf_elfheader (obfd)->e_flags =
!     sh_elf_get_flags_from_mach (bfd_get_mach (obfd));
!   
!   return TRUE;
  }
  #endif /* not sh_elf_merge_private_data */
  
Index: gas/Makefile.am
===================================================================
RCS file: /cvs/src/src/gas/Makefile.am,v
retrieving revision 1.88
diff -c -p -r1.88 Makefile.am
*** gas/Makefile.am	7 May 2004 06:23:53 -0000	1.88
--- gas/Makefile.am	24 May 2004 11:09:21 -0000
*************** bignum-copy.o: bignum-copy.c $(INCDIR)/s
*** 2428,2435 ****
  cond.o: cond.c $(INCDIR)/symcat.h macro.h sb.h $(INCDIR)/obstack.h
  depend.o: depend.c $(INCDIR)/symcat.h
  dwarf2dbg.o: dwarf2dbg.c $(INCDIR)/symcat.h dwarf2dbg.h \
!   $(INCDIR)/filenames.h subsegs.h $(INCDIR)/obstack.h \
!   $(INCDIR)/elf/dwarf2.h
  dw2gencfi.o: dw2gencfi.c $(INCDIR)/symcat.h dw2gencfi.h \
    $(INCDIR)/elf/dwarf2.h
  ecoff.o: ecoff.c $(INCDIR)/symcat.h ecoff.h
--- 2428,2434 ----
  cond.o: cond.c $(INCDIR)/symcat.h macro.h sb.h $(INCDIR)/obstack.h
  depend.o: depend.c $(INCDIR)/symcat.h
  dwarf2dbg.o: dwarf2dbg.c $(INCDIR)/symcat.h dwarf2dbg.h \
!   subsegs.h $(INCDIR)/obstack.h $(INCDIR)/elf/dwarf2.h
  dw2gencfi.o: dw2gencfi.c $(INCDIR)/symcat.h dw2gencfi.h \
    $(INCDIR)/elf/dwarf2.h
  ecoff.o: ecoff.c $(INCDIR)/symcat.h ecoff.h
Index: gas/config/tc-sh.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-sh.c,v
retrieving revision 1.98
diff -c -p -r1.98 tc-sh.c
*** gas/config/tc-sh.c	2 Apr 2004 01:39:30 -0000	1.98
--- gas/config/tc-sh.c	24 May 2004 11:09:22 -0000
*************** static int dont_adjust_reloc_32;
*** 138,148 ****
  
  /* preset architecture set, if given; zero otherwise.  */
  
! static int preset_target_arch;
  
  /* The bit mask of architectures that could
     accommodate the insns seen so far.  */
! static int valid_arch;
  
  const char EXP_CHARS[] = "eE";
  
--- 138,148 ----
  
  /* preset architecture set, if given; zero otherwise.  */
  
! static unsigned int preset_target_arch;
  
  /* The bit mask of architectures that could
     accommodate the insns seen so far.  */
! static unsigned int valid_arch;
  
  const char EXP_CHARS[] = "eE";
  
*************** md_begin (void)
*** 836,845 ****
  {
    const sh_opcode_info *opcode;
    char *prev_name = "";
!   int target_arch;
  
    target_arch
!     = preset_target_arch ? preset_target_arch : arch_sh1_up & ~arch_sh_dsp_up;
    valid_arch = target_arch;
  
  #ifdef HAVE_SH64
--- 836,845 ----
  {
    const sh_opcode_info *opcode;
    char *prev_name = "";
!   unsigned int target_arch;
  
    target_arch
!     = preset_target_arch ? preset_target_arch : arch_sh1_up & ~arch_sh_has_dsp;
    valid_arch = target_arch;
  
  #ifdef HAVE_SH64
*************** md_begin (void)
*** 853,859 ****
      {
        if (strcmp (prev_name, opcode->name) != 0)
  	{
! 	  if (! (opcode->arch & target_arch))
  	    continue;
  	  prev_name = opcode->name;
  	  hash_insert (opcode_hash_control, opcode->name, (char *) opcode);
--- 853,859 ----
      {
        if (strcmp (prev_name, opcode->name) != 0)
  	{
! 	  if (!SH_MERGE_ARCH_SET_VALID (opcode->arch, target_arch))
  	    continue;
  	  prev_name = opcode->name;
  	  hash_insert (opcode_hash_control, opcode->name, (char *) opcode);
*************** get_specific (sh_opcode_info *opcode, sh
*** 2018,2026 ****
  	      goto fail;
  	    }
  	}
!       if ( !(valid_arch & this_try->arch))
  	goto fail;
!       valid_arch &= this_try->arch;
        return this_try;
      fail:
        ;
--- 2018,2026 ----
  	      goto fail;
  	    }
  	}
!       if ( !SH_MERGE_ARCH_SET_VALID (valid_arch, this_try->arch))
  	goto fail;
!       valid_arch = SH_MERGE_ARCH_SET (valid_arch, this_try->arch);
        return this_try;
      fail:
        ;
*************** assemble_ppi (char *op_end, sh_opcode_in
*** 2486,2494 ****
  		field_b -= 0x8100;
  	      /* pclr Dz pmuls Se,Sf,Dg */
  	      else if ((field_b & 0xff00) == 0x8d00
! 		       && (valid_arch & arch_sh4al_dsp_up))
  		{
! 		  valid_arch &= arch_sh4al_dsp_up;
  		  field_b -= 0x8cf0;
  		}
  	      else
--- 2486,2494 ----
  		field_b -= 0x8100;
  	      /* pclr Dz pmuls Se,Sf,Dg */
  	      else if ((field_b & 0xff00) == 0x8d00
! 		       && (SH_MERGE_ARCH_SET_VALID (valid_arch, arch_sh4al_dsp_up)))
  		{
! 		  valid_arch = SH_MERGE_ARCH_SET (valid_arch, arch_sh4al_dsp_up);
  		  field_b -= 0x8cf0;
  		}
  	      else
*************** md_assemble (char *str)
*** 2643,2649 ****
        /* search for opcode in full list */
        for (op = sh_table; op->name; op++)
  	{
! 	  if (strncasecmp (op->name, name, name_length) == 0)
  	    {
  	      found = 1;
  	      break;
--- 2643,2650 ----
        /* search for opcode in full list */
        for (op = sh_table; op->name; op++)
  	{
! 	  if (strncasecmp (op->name, name, name_length) == 0
! 	      && op->name[name_length] == '\0')
  	    {
  	      found = 1;
  	      break;
*************** md_assemble (char *str)
*** 2682,2689 ****
  	{
  	  /* Since we skip get_specific here, we have to check & update
  	     valid_arch now.  */
! 	  if (valid_arch & opcode->arch)
! 	    valid_arch &= opcode->arch;
  	  else
  	    as_bad (_("Delayed branches not available on SH1"));
  	  parse_exp (op_end + 1, &operand[0]);
--- 2683,2690 ----
  	{
  	  /* Since we skip get_specific here, we have to check & update
  	     valid_arch now.  */
! 	  if (SH_MERGE_ARCH_SET_VALID (valid_arch, opcode->arch))
! 	    valid_arch = SH_MERGE_ARCH_SET (valid_arch, opcode->arch);
  	  else
  	    as_bad (_("Delayed branches not available on SH1"));
  	  parse_exp (op_end + 1, &operand[0]);
*************** md_parse_option (int c, char *arg ATTRIB
*** 2936,2942 ****
        break;
  
      case OPTION_DSP:
!       preset_target_arch = arch_sh1_up & ~arch_sh2e_up;
        break;
  
      case OPTION_RENESAS:
--- 2937,2943 ----
        break;
  
      case OPTION_DSP:
!       preset_target_arch = arch_sh1_up & ~(arch_sh_sp_fpu|arch_sh_dp_fpu);
        break;
  
      case OPTION_RENESAS:
*************** md_parse_option (int c, char *arg ATTRIB
*** 2953,2961 ****
        else if (strcasecmp (arg, "sh4a") == 0)
  	preset_target_arch = arch_sh4a;
        else if (strcasecmp (arg, "dsp") == 0)
! 	preset_target_arch = arch_sh1_up & ~arch_sh2e_up;
        else if (strcasecmp (arg, "fp") == 0)
! 	preset_target_arch = arch_sh2e_up;
        else if (strcasecmp (arg, "any") == 0)
  	preset_target_arch = arch_sh1_up;
  #ifdef HAVE_SH64
--- 2954,2962 ----
        else if (strcasecmp (arg, "sh4a") == 0)
  	preset_target_arch = arch_sh4a;
        else if (strcasecmp (arg, "dsp") == 0)
! 	preset_target_arch = arch_sh1_up & ~(arch_sh_sp_fpu|arch_sh_dp_fpu);
        else if (strcasecmp (arg, "fp") == 0)
! 	preset_target_arch = arch_sh1_up & ~arch_sh_has_dsp;
        else if (strcasecmp (arg, "any") == 0)
  	preset_target_arch = arch_sh1_up;
  #ifdef HAVE_SH64
*************** md_parse_option (int c, char *arg ATTRIB
*** 2975,2981 ****
  	}
  #endif /* HAVE_SH64 */
        else
! 	as_bad ("Invalid argument to --isa option: %s", arg);
        break;
  
  #ifdef HAVE_SH64
--- 2976,3010 ----
  	}
  #endif /* HAVE_SH64 */
        else
! 	{
! 	  extern const bfd_arch_info_type bfd_sh_arch;
! 	  extern unsigned int sh_ef_archset_table[];
! 	  bfd_arch_info_type *bfd_arch = &bfd_sh_arch;
! 	  preset_target_arch = 0;
! 	  for (; bfd_arch; bfd_arch=bfd_arch->next)
! 	    {
! 	      int len = strlen(bfd_arch->printable_name);
! 	      
! 	      if (bfd_arch->mach == bfd_mach_sh5)
! 		continue;
! 	      
! 	      if (strncasecmp (bfd_arch->printable_name, arg, len) != 0)
! 		continue;
! 
! 	      if (arg[len] == '\0')
! 		preset_target_arch =
! 		  sh_get_arch_from_bfd_mach (bfd_arch->mach);
! 	      else if (strcasecmp(&arg[len], "-up") == 0)
! 		preset_target_arch =
! 		  sh_get_arch_up_from_bfd_mach (bfd_arch->mach);
! 	      else
! 		continue;
! 	      break;
! 	    }
! 	  
! 	  if (!preset_target_arch)
! 	    as_bad ("Invalid argument to --isa option: %s", arg);
! 	}
        break;
  
  #ifdef HAVE_SH64
*************** SH options:\n\
*** 3034,3046 ****
  			compatibility with Renesas assembler.\n\
  -small			align sections to 4 byte boundaries, not 16\n\
  -dsp			enable sh-dsp insns, and disable floating-point ISAs.\n\
! -isa=[sh4\n\
!     | sh4-nofpu		sh4 with fpu disabled\n\
!     | sh4-nommu-nofpu   sh4 with no MMU or FPU\n\
!     | sh4a\n\
      | dsp               same as '-dsp'\n\
!     | fp\n\
!     | any]		use most appropriate isa\n"));
  #ifdef HAVE_SH64
    fprintf (stream, _("\
  -isa=[shmedia		set as the default instruction set for SH64\n\
--- 3063,3082 ----
  			compatibility with Renesas assembler.\n\
  -small			align sections to 4 byte boundaries, not 16\n\
  -dsp			enable sh-dsp insns, and disable floating-point ISAs.\n\
! -isa=[any		use most appropriate isa\n\
      | dsp               same as '-dsp'\n\
!     | fp"));
!   {
!     extern const bfd_arch_info_type bfd_sh_arch;
!     bfd_arch_info_type *bfd_arch = &bfd_sh_arch;
!     for (; bfd_arch; bfd_arch=bfd_arch->next)
!       if (bfd_arch->mach != bfd_mach_sh5)
! 	{
! 	  fprintf (stream, "\n    | %s", bfd_arch->printable_name);
! 	  fprintf (stream, "\n    | %s-up", bfd_arch->printable_name);
! 	}
!   }
!   fprintf (stream, "]\n");
  #ifdef HAVE_SH64
    fprintf (stream, _("\
  -isa=[shmedia		set as the default instruction set for SH64\n\
*************** sh_elf_final_processing (void)
*** 3603,3636 ****
      val = EF_SH5;
    else
  #endif /* HAVE_SH64 */
!   if (valid_arch & arch_sh1)
!     val = EF_SH1;
!   else if (valid_arch & arch_sh2)
!     val = EF_SH2;
!   else if (valid_arch & arch_sh2e)
!     val = EF_SH2E;
!   else if (valid_arch & arch_sh_dsp)
!     val = EF_SH_DSP;
!   else if (valid_arch & arch_sh3)
!     val = EF_SH3;
!   else if (valid_arch & arch_sh3_dsp)
!     val = EF_SH3_DSP;
!   else if (valid_arch & arch_sh3e)
!     val = EF_SH3E;
!   else if (valid_arch & arch_sh4_nommu_nofpu)
!     val = EF_SH4_NOMMU_NOFPU;
!   else if (valid_arch & arch_sh4_nofpu)
!     val = EF_SH4_NOFPU;
!   else if (valid_arch & arch_sh4)
!     val = EF_SH4;
!   else if (valid_arch & arch_sh4a_nofpu)
!     val = EF_SH4A_NOFPU;
!   else if (valid_arch & arch_sh4a)
!     val = EF_SH4A;
!   else if (valid_arch & arch_sh4al_dsp)
!     val = EF_SH4AL_DSP;
!   else
!     abort ();
  
    elf_elfheader (stdoutput)->e_flags &= ~EF_SH_MACH_MASK;
    elf_elfheader (stdoutput)->e_flags |= val;
--- 3639,3645 ----
      val = EF_SH5;
    else
  #endif /* HAVE_SH64 */
!     val = sh_find_elf_flags (valid_arch);
  
    elf_elfheader (stdoutput)->e_flags &= ~EF_SH_MACH_MASK;
    elf_elfheader (stdoutput)->e_flags |= val;
Index: include/elf/sh.h
===================================================================
RCS file: /cvs/src/src/include/elf/sh.h,v
retrieving revision 1.17
diff -c -p -r1.17 sh.h
*** include/elf/sh.h	3 Mar 2004 18:01:49 -0000	1.17
--- include/elf/sh.h	24 May 2004 11:09:23 -0000
***************
*** 27,83 ****
  #define EF_SH1		   1
  #define EF_SH2		   2
  #define EF_SH3		   3
- #define EF_SH_HAS_DSP(flags) (((flags) & EF_SH_MACH_MASK & ~3) == 4)
  #define EF_SH_DSP	   4
  #define EF_SH3_DSP	   5
  #define EF_SH4AL_DSP	   6
- #define EF_SH_HAS_FP(flags) ((flags) & 8)
  #define EF_SH3E		   8
  #define EF_SH4		   9
  #define EF_SH2E            11
  #define EF_SH4A		   12
  
! #define EF_SH4_NOFPU	   0x10
! #define EF_SH4A_NOFPU	   0x11
! #define EF_SH4_NOMMU_NOFPU 0x12
  
  /* This one can only mix in objects from other EF_SH5 objects.  */
  #define EF_SH5		  10
  
! #define EF_SH_MERGE_MACH(mach1, mach2) \
!   (((((mach1) == EF_SH3 || (mach1) == EF_SH_UNKNOWN) && (mach2) == EF_SH_DSP) \
!     || ((mach1) == EF_SH_DSP \
! 	&& ((mach2) == EF_SH3 || (mach2) == EF_SH_UNKNOWN))) \
!    ? EF_SH3_DSP \
!    : (((mach1) < EF_SH3 && (mach2) == EF_SH_UNKNOWN) \
!       || ((mach2) < EF_SH3 && (mach1) == EF_SH_UNKNOWN)) \
!    ? EF_SH3 \
!    : ((mach1) == EF_SH2E && EF_SH_HAS_FP (mach2)) \
!    ? (mach2) \
!    : ((mach2) == EF_SH2E && EF_SH_HAS_FP (mach1)) \
!    ? (mach1) \
!    : (((mach1) == EF_SH2E && (mach2) == EF_SH_UNKNOWN) \
!       || ((mach2) == EF_SH2E && (mach1) == EF_SH_UNKNOWN)) \
!    ? EF_SH2E \
!    : (((mach1) == EF_SH3E && (mach2) == EF_SH_UNKNOWN) \
!       || ((mach2) == EF_SH3E && (mach1) == EF_SH_UNKNOWN)) \
!    ? EF_SH4 \
!    /* ??? SH4?  Why not SH3E?  */ \
!    : ((((mach1) == EF_SH4_NOFPU || (mach1) == EF_SH4A_NOFPU) \
!        && EF_SH_HAS_DSP (mach2)) \
!       || (((mach2) == EF_SH4_NOFPU || (mach2) == EF_SH4A_NOFPU) \
! 	  && EF_SH_HAS_DSP (mach1))) \
!    ? EF_SH4AL_DSP \
!    : ((mach1) == EF_SH4_NOFPU && EF_SH_HAS_FP (mach2)) \
!    ? ((mach2) < EF_SH4A) ? EF_SH4 : (mach2) \
!    : ((mach2) == EF_SH4_NOFPU && EF_SH_HAS_FP (mach1)) \
!    ? ((mach1) < EF_SH4A) ? EF_SH4 : (mach1) \
!    : ((mach1) == EF_SH4A_NOFPU && EF_SH_HAS_FP (mach2)) \
!    ? ((mach2) <= EF_SH4A) ? EF_SH4A : (mach2) \
!    : ((mach2) == EF_SH4A_NOFPU && EF_SH_HAS_FP (mach1)) \
!    ? ((mach1) <= EF_SH4A) ? EF_SH4A : (mach1) \
!    : (((mach1) == EF_SH2E ? 7 : (mach1)) > ((mach2) == EF_SH2E ? 7 : (mach2)) \
!       ? (mach1) : (mach2)))
  
  /* Flags for the st_other symbol field.
     Keep away from the STV_ visibility flags (bit 0..1).  */
--- 27,77 ----
  #define EF_SH1		   1
  #define EF_SH2		   2
  #define EF_SH3		   3
  #define EF_SH_DSP	   4
  #define EF_SH3_DSP	   5
  #define EF_SH4AL_DSP	   6
  #define EF_SH3E		   8
  #define EF_SH4		   9
  #define EF_SH2E            11
  #define EF_SH4A		   12
  
! #define EF_SH4_NOFPU	   16
! #define EF_SH4A_NOFPU	   17
! #define EF_SH4_NOMMU_NOFPU 18
! #define EF_SH3_NOMMU       20
  
  /* This one can only mix in objects from other EF_SH5 objects.  */
  #define EF_SH5		  10
  
! /* Define the mapping from ELF to bfd mach numbers.
!    bfd_mach_* are defined in bfd_in2.h (generated from
!    archures.c).  */
! #define EF_SH_BFD_TABLE \
! /* EF_SH_UNKNOWN	*/ bfd_mach_sh3		, \
! /* EF_SH1		*/ bfd_mach_sh		, \
! /* EF_SH2		*/ bfd_mach_sh2		, \
! /* EF_SH3		*/ bfd_mach_sh3		, \
! /* EF_SH_DSP		*/ bfd_mach_sh_dsp	, \
! /* EF_SH3_DSP		*/ bfd_mach_sh3_dsp	, \
! /* EF_SHAL_DSP		*/ bfd_mach_sh4al_dsp	, \
! /* 7			*/ 0, \
! /* EF_SH3E		*/ bfd_mach_sh3e	, \
! /* EF_SH4		*/ bfd_mach_sh4		, \
! /* EF_SH5		*/ 0, \
! /* EF_SH2E		*/ bfd_mach_sh2e	, \
! /* EF_SH4A		*/ bfd_mach_sh4a	, \
! /* 13, 14, 15		*/ 0, 0, 0, \
! /* EF_SH4_NOFPU		*/ bfd_mach_sh4_nofpu	, \
! /* EF_SH4A_NOFPU	*/ bfd_mach_sh4a_nofpu	, \
! /* EF_SH4_NOMMU_NOFPU	*/ bfd_mach_sh4_nommu_nofpu, \
! /* 19			*/ 0, \
! /* EF_SH3_NOMMU		*/ bfd_mach_sh3_nommu
! 
! /* Convert arch_sh* into EF_SH*.  */
! int sh_find_elf_flags (unsigned int arch_set);
! 
! /* Convert bfd_mach_* into EF_SH*.  */
! int sh_elf_get_flags_from_mach (unsigned long mach);
  
  /* Flags for the st_other symbol field.
     Keep away from the STV_ visibility flags (bit 0..1).  */
Index: opcodes/sh-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/sh-dis.c,v
retrieving revision 1.21
diff -c -p -r1.21 sh-dis.c
*** opcodes/sh-dis.c	23 Apr 2004 02:47:39 -0000	1.21
--- opcodes/sh-dis.c	24 May 2004 11:09:23 -0000
*************** print_insn_sh (memaddr, info)
*** 402,408 ****
    int status;
    bfd_vma relmask = ~(bfd_vma) 0;
    const sh_opcode_info *op;
!   int target_arch;
  
    switch (info->mach)
      {
--- 402,408 ----
    int status;
    bfd_vma relmask = ~(bfd_vma) 0;
    const sh_opcode_info *op;
!   unsigned int target_arch;
  
    switch (info->mach)
      {
*************** print_insn_sh (memaddr, info)
*** 415,454 ****
  	  && bfd_asymbol_flavour(*info->symbols) == bfd_target_coff_flavour)
  	target_arch = arch_sh4;
        break;
-     case bfd_mach_sh2:
-       target_arch = arch_sh2;
-       break;
-     case bfd_mach_sh2e:
-       target_arch = arch_sh2e;
-       break;
-     case bfd_mach_sh_dsp:
-       target_arch = arch_sh_dsp;
-       break;
-     case bfd_mach_sh3:
-       target_arch = arch_sh3;
-       break;
-     case bfd_mach_sh3_dsp:
-       target_arch = arch_sh3_dsp;
-       break;
-     case bfd_mach_sh3e:
-       target_arch = arch_sh3e;
-       break;
-     case bfd_mach_sh4_nofpu:
-       target_arch = arch_sh4_nofpu;
-       break;
-     case bfd_mach_sh4:
-       target_arch = arch_sh4;
-       break;
-     case bfd_mach_sh4a:
-     case bfd_mach_sh4a_nofpu:
-       target_arch = arch_sh4a;
-       break;
-     case bfd_mach_sh4al_dsp:
-       target_arch = arch_sh4al_dsp;
-       break;
-     case bfd_mach_sh4_nommu_nofpu:
-       target_arch = arch_sh4_nommu_nofpu;
-       break;
      case bfd_mach_sh5:
  #ifdef INCLUDE_SHMEDIA
        status = print_insn_sh64 (memaddr, info);
--- 415,420 ----
*************** print_insn_sh (memaddr, info)
*** 460,466 ****
        target_arch = arch_sh4;
        break;
      default:
!       abort ();
      }
  
    status = info->read_memory_func (memaddr, insn, 2, info);
--- 426,432 ----
        target_arch = arch_sh4;
        break;
      default:
!       target_arch = sh_get_arch_from_bfd_mach (info->mach);
      }
  
    status = info->read_memory_func (memaddr, insn, 2, info);
*************** print_insn_sh (memaddr, info)
*** 488,494 ****
        nibs[3] = insn[1] & 0xf;
      }
  
!   if (nibs[0] == 0xf && (nibs[1] & 4) == 0 && target_arch & arch_sh_dsp_up)
      {
        if (nibs[1] & 8)
  	{
--- 454,461 ----
        nibs[3] = insn[1] & 0xf;
      }
  
!   if (nibs[0] == 0xf && (nibs[1] & 4) == 0
!       && SH_MERGE_ARCH_SET_VALID (target_arch, arch_sh_dsp_up))
      {
        if (nibs[1] & 8)
  	{
*************** print_insn_sh (memaddr, info)
*** 524,530 ****
        int disp_pc;
        bfd_vma disp_pc_addr = 0;
  
!       if ((op->arch & target_arch) == 0)
  	goto fail;
        for (n = 0; n < 4; n++)
  	{
--- 491,497 ----
        int disp_pc;
        bfd_vma disp_pc_addr = 0;
  
!       if (!SH_MERGE_ARCH_SET_VALID (op->arch, target_arch))
  	goto fail;
        for (n = 0; n < 4; n++)
  	{
Index: opcodes/sh-opc.h
===================================================================
RCS file: /cvs/src/src/opcodes/sh-opc.h,v
retrieving revision 1.20
diff -c -p -r1.20 sh-opc.h
*** opcodes/sh-opc.h	3 Mar 2004 18:01:47 -0000	1.20
--- opcodes/sh-opc.h	24 May 2004 11:09:23 -0000
***************
*** 16,21 ****
--- 16,23 ----
     along with this program; if not, write to the Free Software
     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
  
+ #include "bfd.h"
+ 
  typedef enum
    {
      HEX_0,
*************** typedef enum
*** 176,222 ****
    }
  sh_dsp_reg_nums;
  
! #define arch_sh1     0x0001
! #define arch_sh2     0x0002
! #define arch_sh3     0x0004
! #define arch_sh3e    0x0008
! #define arch_sh4     0x0010
! #define arch_sh2e    0x0020
! #define arch_sh4a    0x0040
! #define arch_sh_dsp  0x0100
! #define arch_sh3_dsp 0x0200
! #define arch_sh4al_dsp 0x0400
! #define arch_sh4_nofpu 0x1000
! #define arch_sh4a_nofpu 0x2000
! #define arch_sh4_nommu_nofpu 0x4000  /* no mmu nor fpu */
  
! #define arch_sh1_up  (arch_sh1 | arch_sh2_up)
! #define arch_sh2_up  (arch_sh2 | arch_sh2e_up | arch_sh3_up | arch_sh_dsp)
  #define arch_sh2e_up (arch_sh2e | arch_sh3e_up)
- #define arch_sh3_up  (arch_sh3 | arch_sh3e_up | arch_sh3_dsp_up \
- 		      | arch_sh4_nommu_nofpu_up)
  #define arch_sh3e_up (arch_sh3e | arch_sh4_up)
  #define arch_sh4_up  (arch_sh4 | arch_sh4a_up)
  #define arch_sh4a_up (arch_sh4a)
  
! #define arch_sh_dsp_up (arch_sh_dsp | arch_sh3_dsp_up)
! #define arch_sh3_dsp_up (arch_sh3_dsp | arch_sh4al_dsp_up)
  #define arch_sh4al_dsp_up (arch_sh4al_dsp)
  
- #define arch_sh4_nommu_nofpu_up (arch_sh4_nommu_nofpu | arch_sh4_nofp_up)
- 
- #define arch_sh4_nofp_up (arch_sh4_nofpu | arch_sh4_up | arch_sh4a_nofp_up)
- #define arch_sh4a_nofp_up (arch_sh4a_nofpu | arch_sh4a_up | arch_sh4al_dsp_up)
  
- #define arch_sh_any_with_mmu (arch_sh3 | arch_sh3e_up | arch_sh3_dsp_up \
- 	| arch_sh4_nofp_up)  /* arch _sh3_up omitting arch_sh4_nommu_nofpu */
  
  typedef struct
  {
    char *name;
    sh_arg_type arg[4];
    sh_nibble_type nibbles[5];
!   int arch;
  } sh_opcode_info;
  
  #ifdef DEFINE_TABLE
--- 178,297 ----
    }
  sh_dsp_reg_nums;
  
! #define arch_sh1_base	0x0001
! #define arch_sh2_base	0x0002
! #define arch_sh3_base	0x0004
! #define arch_sh4_base	0x0008
! #define arch_sh4a_base	0x0010
! #define arch_sh_no_mmu	0x04000000
! #define arch_sh_has_mmu 0x08000000
! #define arch_sh_no_co	0x10000000 /* neither FPU nor DSP co-processor */
! #define arch_sh_sp_fpu	0x20000000 /* single precision FPU */
! #define arch_sh_dp_fpu	0x40000000 /* double precision FPU */
! #define arch_sh_has_dsp	0x80000000
! 
! #define arch_sh_base_mask 0x0000001f
! #define arch_sh_mmu_mask  0x0c000000
! #define arch_sh_co_mask   0xf0000000
! 
! #define arch_sh1	(arch_sh1_base|arch_sh_no_mmu|arch_sh_no_co)
! #define arch_sh2	(arch_sh2_base|arch_sh_no_mmu|arch_sh_no_co)
! #define arch_sh2e	(arch_sh2_base|arch_sh_no_mmu|arch_sh_sp_fpu)
! #define arch_sh_dsp	(arch_sh2_base|arch_sh_no_mmu|arch_sh_has_dsp)
! #define arch_sh3_nommu	(arch_sh3_base|arch_sh_no_mmu|arch_sh_no_co)
! #define arch_sh3	(arch_sh3_base|arch_sh_has_mmu|arch_sh_no_co)
! #define arch_sh3e	(arch_sh3_base|arch_sh_has_mmu|arch_sh_sp_fpu)
! #define arch_sh3_dsp	(arch_sh3_base|arch_sh_has_mmu|arch_sh_has_dsp)
! #define arch_sh4	(arch_sh4_base|arch_sh_has_mmu|arch_sh_dp_fpu)
! #define arch_sh4a	(arch_sh4a_base|arch_sh_has_mmu|arch_sh_dp_fpu)
! #define arch_sh4al_dsp	(arch_sh4a_base|arch_sh_has_mmu|arch_sh_has_dsp)
! #define arch_sh4_nofpu	(arch_sh4_base|arch_sh_has_mmu|arch_sh_no_co)
! #define arch_sh4a_nofpu	(arch_sh4a_base|arch_sh_has_mmu|arch_sh_no_co)
! #define arch_sh4_nommu_nofpu (arch_sh4_base|arch_sh_no_mmu|arch_sh_no_co)
! 
! #define SH_MERGE_ARCH_SET(SET1, SET2) ((SET1) & (SET2))
! #define SH_VALID_BASE_ARCH_SET(SET) (((SET) & arch_sh_base_mask) != 0)
! #define SH_VALID_MMU_ARCH_SET(SET)  (((SET) & arch_sh_mmu_mask) != 0)
! #define SH_VALID_CO_ARCH_SET(SET)   (((SET) & arch_sh_co_mask) != 0)
! #define SH_VALID_ARCH_SET(SET) \
!   (SH_VALID_BASE_ARCH_SET (SET) \
!    && SH_VALID_MMU_ARCH_SET (SET) \
!    && SH_VALID_CO_ARCH_SET (SET))
! #define SH_MERGE_ARCH_SET_VALID(SET1, SET2) \
!   SH_VALID_ARCH_SET (SH_MERGE_ARCH_SET (SET1, SET2))
! 
! #define SH_ARCH_SET_HAS_FPU(SET) \
!   (((SET) & (arch_sh_sp_fpu | arch_sh_dp_fpu)) != 0)
! #define SH_ARCH_SET_HAS_DSP(SET) \
!   (((SET) & arch_sh_has_dsp) != 0)
! 
! /* This is returned from the functions below when an error occurs
!    (in addition to a call to BFD_FAIL). The value should allow
!    the tools to continue to function in most cases - there may
!    be some confusion between DSP and FPU etc.  */
! #define SH_ARCH_UNKNOWN_ARCH 0xffffffff
! 
! /* These are defined in bfd/cpu-sh.c .  */
! unsigned int sh_get_arch_from_bfd_mach (unsigned long mach);
! unsigned int sh_get_arch_up_from_bfd_mach (unsigned long mach);
! unsigned long sh_get_bfd_mach_from_arch_set (unsigned int arch_set);
! bfd_boolean sh_merge_bfd_arch (bfd *ibfd, bfd *obfd);
! 
! /* Below are the 'architecture sets'.
!    They describe the following inheritance graph:
! 
!                 SH1
!                  |
!                 SH2
!    .------------'|`--------------------.
!   /              |                      \
! SH-DSP          SH3-nommu               SH2E
!  |               |`--------.             |
!  |               |          \            |
!  |              SH3     SH4-nommu-nofpu  |
!  |               |           |           |
!  | .------------'|`----------+---------. |
!  |/                         /           \|
!  |               | .-------'             |
!  |               |/                      |
! SH3-dsp         SH4-nofpu               SH3E
!  |               |`--------------------. |
!  |               |                      \|
!  |              SH4A-nofpu              SH4
!  | .------------' `--------------------. |
!  |/                                     \|
! SH4AL-dsp                               SH4A
! 
! */
! 
! /* Central branches */
! #define arch_sh1_up       (arch_sh1 | arch_sh2_up)
! #define arch_sh2_up       (arch_sh2 | arch_sh2e_up | arch_sh3_nommu_up | arch_sh_dsp_up)
! #define arch_sh3_nommu_up (arch_sh3_nommu | arch_sh3_up | arch_sh4_nommu_nofpu_up)
! #define arch_sh3_up       (arch_sh3 | arch_sh3e_up | arch_sh3_dsp_up | arch_sh4_nofp_up)
! #define arch_sh4_nommu_nofpu_up (arch_sh4_nommu_nofpu | arch_sh4_nofp_up)
! #define arch_sh4_nofp_up  (arch_sh4_nofpu | arch_sh4_up | arch_sh4a_nofp_up)
! #define arch_sh4a_nofp_up (arch_sh4a_nofpu | arch_sh4a_up | arch_sh4al_dsp_up)
  
! /* Right branch */
  #define arch_sh2e_up (arch_sh2e | arch_sh3e_up)
  #define arch_sh3e_up (arch_sh3e | arch_sh4_up)
  #define arch_sh4_up  (arch_sh4 | arch_sh4a_up)
  #define arch_sh4a_up (arch_sh4a)
  
! /* Left branch */
! #define arch_sh_dsp_up    (arch_sh_dsp | arch_sh3_dsp_up)
! #define arch_sh3_dsp_up   (arch_sh3_dsp | arch_sh4al_dsp_up)
  #define arch_sh4al_dsp_up (arch_sh4al_dsp)
  
  
  
  typedef struct
  {
    char *name;
    sh_arg_type arg[4];
    sh_nibble_type nibbles[5];
!   unsigned int arch;
  } sh_opcode_info;
  
  #ifdef DEFINE_TABLE
*************** const sh_opcode_info sh_table[] =
*** 313,325 ****
  
  /* 0100nnnn01101110 ldc <REG_N>,RS     */{"ldc",{A_REG_N,A_RS},{HEX_4,REG_N,HEX_6,HEX_E}, arch_sh_dsp_up},
  
! /* 0100nnnn00111110 ldc <REG_N>,SSR     */{"ldc",{A_REG_N,A_SSR},{HEX_4,REG_N,HEX_3,HEX_E}, arch_sh3_up},
  
! /* 0100nnnn01001110 ldc <REG_N>,SPC     */{"ldc",{A_REG_N,A_SPC},{HEX_4,REG_N,HEX_4,HEX_E}, arch_sh3_up},
  
  /* 0100nnnn11111010 ldc <REG_N>,DBR     */{"ldc",{A_REG_N,A_DBR},{HEX_4,REG_N,HEX_F,HEX_A}, arch_sh4_nommu_nofpu_up},
  
! /* 0100nnnn1xxx1110 ldc <REG_N>,Rn_BANK */{"ldc",{A_REG_N,A_REG_B},{HEX_4,REG_N,REG_B,HEX_E}, arch_sh3_up},
  
  /* 0100nnnn00000111 ldc.l @<REG_N>+,SR  */{"ldc.l",{A_INC_N,A_SR},{HEX_4,REG_N,HEX_0,HEX_7}, arch_sh1_up},
  
--- 388,400 ----
  
  /* 0100nnnn01101110 ldc <REG_N>,RS     */{"ldc",{A_REG_N,A_RS},{HEX_4,REG_N,HEX_6,HEX_E}, arch_sh_dsp_up},
  
! /* 0100nnnn00111110 ldc <REG_N>,SSR     */{"ldc",{A_REG_N,A_SSR},{HEX_4,REG_N,HEX_3,HEX_E}, arch_sh3_nommu_up},
  
! /* 0100nnnn01001110 ldc <REG_N>,SPC     */{"ldc",{A_REG_N,A_SPC},{HEX_4,REG_N,HEX_4,HEX_E}, arch_sh3_nommu_up},
  
  /* 0100nnnn11111010 ldc <REG_N>,DBR     */{"ldc",{A_REG_N,A_DBR},{HEX_4,REG_N,HEX_F,HEX_A}, arch_sh4_nommu_nofpu_up},
  
! /* 0100nnnn1xxx1110 ldc <REG_N>,Rn_BANK */{"ldc",{A_REG_N,A_REG_B},{HEX_4,REG_N,REG_B,HEX_E}, arch_sh3_nommu_up},
  
  /* 0100nnnn00000111 ldc.l @<REG_N>+,SR  */{"ldc.l",{A_INC_N,A_SR},{HEX_4,REG_N,HEX_0,HEX_7}, arch_sh1_up},
  
*************** const sh_opcode_info sh_table[] =
*** 335,347 ****
  
  /* 0100nnnn01100111 ldc.l @<REG_N>+,RS */{"ldc.l",{A_INC_N,A_RS},{HEX_4,REG_N,HEX_6,HEX_7}, arch_sh_dsp_up},
  
! /* 0100nnnn00110111 ldc.l @<REG_N>+,SSR */{"ldc.l",{A_INC_N,A_SSR},{HEX_4,REG_N,HEX_3,HEX_7}, arch_sh3_up},
  
! /* 0100nnnn01000111 ldc.l @<REG_N>+,SPC */{"ldc.l",{A_INC_N,A_SPC},{HEX_4,REG_N,HEX_4,HEX_7}, arch_sh3_up},
  
  /* 0100nnnn11110110 ldc.l @<REG_N>+,DBR */{"ldc.l",{A_INC_N,A_DBR},{HEX_4,REG_N,HEX_F,HEX_6}, arch_sh4_nommu_nofpu_up},
  
! /* 0100nnnn1xxx0111 ldc.l <REG_N>,Rn_BANK */{"ldc.l",{A_INC_N,A_REG_B},{HEX_4,REG_N,REG_B,HEX_7}, arch_sh3_up},
  
  /* 0100mmmm00110100 ldrc <REG_M>        */{"ldrc",{A_REG_M},{HEX_4,REG_M,HEX_3,HEX_4}, arch_sh4al_dsp_up},
  /* 10001010i8*1.... ldrc #<imm>         */{"ldrc",{A_IMM},{HEX_8,HEX_A,IMM0_8}, arch_sh4al_dsp_up},
--- 410,422 ----
  
  /* 0100nnnn01100111 ldc.l @<REG_N>+,RS */{"ldc.l",{A_INC_N,A_RS},{HEX_4,REG_N,HEX_6,HEX_7}, arch_sh_dsp_up},
  
! /* 0100nnnn00110111 ldc.l @<REG_N>+,SSR */{"ldc.l",{A_INC_N,A_SSR},{HEX_4,REG_N,HEX_3,HEX_7}, arch_sh3_nommu_up},
  
! /* 0100nnnn01000111 ldc.l @<REG_N>+,SPC */{"ldc.l",{A_INC_N,A_SPC},{HEX_4,REG_N,HEX_4,HEX_7}, arch_sh3_nommu_up},
  
  /* 0100nnnn11110110 ldc.l @<REG_N>+,DBR */{"ldc.l",{A_INC_N,A_DBR},{HEX_4,REG_N,HEX_F,HEX_6}, arch_sh4_nommu_nofpu_up},
  
! /* 0100nnnn1xxx0111 ldc.l <REG_N>,Rn_BANK */{"ldc.l",{A_INC_N,A_REG_B},{HEX_4,REG_N,REG_B,HEX_7}, arch_sh3_nommu_up},
  
  /* 0100mmmm00110100 ldrc <REG_M>        */{"ldrc",{A_REG_M},{HEX_4,REG_M,HEX_3,HEX_4}, arch_sh4al_dsp_up},
  /* 10001010i8*1.... ldrc #<imm>         */{"ldrc",{A_IMM},{HEX_8,HEX_A,IMM0_8}, arch_sh4al_dsp_up},
*************** const sh_opcode_info sh_table[] =
*** 394,400 ****
    
  /* 0100nnnn01100110 lds.l @<REG_M>+,FPSCR*/{"lds.l",{A_INC_M,FPSCR_N},{HEX_4,REG_M,HEX_6,HEX_6}, arch_sh2e_up},
  
! /* 0000000000111000 ldtlb               */{"ldtlb",{0},{HEX_0,HEX_0,HEX_3,HEX_8}, arch_sh_any_with_mmu},
  
  /* 0100nnnnmmmm1111 mac.w @<REG_M>+,@<REG_N>+*/{"mac.w",{A_INC_M,A_INC_N},{HEX_4,REG_N,REG_M,HEX_F}, arch_sh1_up},
  
--- 469,475 ----
    
  /* 0100nnnn01100110 lds.l @<REG_M>+,FPSCR*/{"lds.l",{A_INC_M,FPSCR_N},{HEX_4,REG_M,HEX_6,HEX_6}, arch_sh2e_up},
  
! /* 0000000000111000 ldtlb               */{"ldtlb",{0},{HEX_0,HEX_0,HEX_3,HEX_8}, arch_sh3_up},
  
  /* 0100nnnnmmmm1111 mac.w @<REG_M>+,@<REG_N>+*/{"mac.w",{A_INC_M,A_INC_N},{HEX_4,REG_N,REG_M,HEX_F}, arch_sh1_up},
  
*************** const sh_opcode_info sh_table[] =
*** 535,543 ****
  
  /* repeat start end #<imm>        	*/{"repeat",{A_DISP_PC,A_DISP_PC,A_IMM},{REPEAT,HEX_2,IMM0_8,HEX_8}, arch_sh_dsp_up},
  
! /* 0100nnnnmmmm1100 shad <REG_M>,<REG_N>*/{"shad",{ A_REG_M,A_REG_N},{HEX_4,REG_N,REG_M,HEX_C}, arch_sh3_up},
  
! /* 0100nnnnmmmm1101 shld <REG_M>,<REG_N>*/{"shld",{ A_REG_M,A_REG_N},{HEX_4,REG_N,REG_M,HEX_D}, arch_sh3_up},
  
  /* 0100nnnn00100000 shal <REG_N>        */{"shal",{A_REG_N},{HEX_4,REG_N,HEX_2,HEX_0}, arch_sh1_up},
  
--- 610,618 ----
  
  /* repeat start end #<imm>        	*/{"repeat",{A_DISP_PC,A_DISP_PC,A_IMM},{REPEAT,HEX_2,IMM0_8,HEX_8}, arch_sh_dsp_up},
  
! /* 0100nnnnmmmm1100 shad <REG_M>,<REG_N>*/{"shad",{ A_REG_M,A_REG_N},{HEX_4,REG_N,REG_M,HEX_C}, arch_sh3_nommu_up},
  
! /* 0100nnnnmmmm1101 shld <REG_M>,<REG_N>*/{"shld",{ A_REG_M,A_REG_N},{HEX_4,REG_N,REG_M,HEX_D}, arch_sh3_nommu_up},
  
  /* 0100nnnn00100000 shal <REG_N>        */{"shal",{A_REG_N},{HEX_4,REG_N,HEX_2,HEX_0}, arch_sh1_up},
  
*************** const sh_opcode_info sh_table[] =
*** 573,587 ****
  
  /* 0000nnnn01100010 stc RS,<REG_N>     */{"stc",{A_RS,A_REG_N},{HEX_0,REG_N,HEX_6,HEX_2}, arch_sh_dsp_up},
  
! /* 0000nnnn00110010 stc SSR,<REG_N>     */{"stc",{A_SSR,A_REG_N},{HEX_0,REG_N,HEX_3,HEX_2}, arch_sh3_up},
  
! /* 0000nnnn01000010 stc SPC,<REG_N>     */{"stc",{A_SPC,A_REG_N},{HEX_0,REG_N,HEX_4,HEX_2}, arch_sh3_up},
  
  /* 0000nnnn00111010 stc SGR,<REG_N>     */{"stc",{A_SGR,A_REG_N},{HEX_0,REG_N,HEX_3,HEX_A}, arch_sh4_nommu_nofpu_up},
  
  /* 0000nnnn11111010 stc DBR,<REG_N>     */{"stc",{A_DBR,A_REG_N},{HEX_0,REG_N,HEX_F,HEX_A}, arch_sh4_nommu_nofpu_up},
  
! /* 0000nnnn1xxx0010 stc Rn_BANK,<REG_N> */{"stc",{A_REG_B,A_REG_N},{HEX_0,REG_N,REG_B,HEX_2}, arch_sh3_up},
  
  /* 0100nnnn00000011 stc.l SR,@-<REG_N>  */{"stc.l",{A_SR,A_DEC_N},{HEX_4,REG_N,HEX_0,HEX_3}, arch_sh1_up},
  
--- 648,662 ----
  
  /* 0000nnnn01100010 stc RS,<REG_N>     */{"stc",{A_RS,A_REG_N},{HEX_0,REG_N,HEX_6,HEX_2}, arch_sh_dsp_up},
  
! /* 0000nnnn00110010 stc SSR,<REG_N>     */{"stc",{A_SSR,A_REG_N},{HEX_0,REG_N,HEX_3,HEX_2}, arch_sh3_nommu_up},
  
! /* 0000nnnn01000010 stc SPC,<REG_N>     */{"stc",{A_SPC,A_REG_N},{HEX_0,REG_N,HEX_4,HEX_2}, arch_sh3_nommu_up},
  
  /* 0000nnnn00111010 stc SGR,<REG_N>     */{"stc",{A_SGR,A_REG_N},{HEX_0,REG_N,HEX_3,HEX_A}, arch_sh4_nommu_nofpu_up},
  
  /* 0000nnnn11111010 stc DBR,<REG_N>     */{"stc",{A_DBR,A_REG_N},{HEX_0,REG_N,HEX_F,HEX_A}, arch_sh4_nommu_nofpu_up},
  
! /* 0000nnnn1xxx0010 stc Rn_BANK,<REG_N> */{"stc",{A_REG_B,A_REG_N},{HEX_0,REG_N,REG_B,HEX_2}, arch_sh3_nommu_up},
  
  /* 0100nnnn00000011 stc.l SR,@-<REG_N>  */{"stc.l",{A_SR,A_DEC_N},{HEX_4,REG_N,HEX_0,HEX_3}, arch_sh1_up},
  
*************** const sh_opcode_info sh_table[] =
*** 593,601 ****
  
  /* 0100nnnn01100011 stc.l RS,@-<REG_N>  */{"stc.l",{A_RS,A_DEC_N},{HEX_4,REG_N,HEX_6,HEX_3}, arch_sh_dsp_up},
  
! /* 0100nnnn00110011 stc.l SSR,@-<REG_N> */{"stc.l",{A_SSR,A_DEC_N},{HEX_4,REG_N,HEX_3,HEX_3}, arch_sh3_up},
  
! /* 0100nnnn01000011 stc.l SPC,@-<REG_N> */{"stc.l",{A_SPC,A_DEC_N},{HEX_4,REG_N,HEX_4,HEX_3}, arch_sh3_up},
  
  /* 0100nnnn00010011 stc.l GBR,@-<REG_N> */{"stc.l",{A_GBR,A_DEC_N},{HEX_4,REG_N,HEX_1,HEX_3}, arch_sh1_up},
  
--- 668,676 ----
  
  /* 0100nnnn01100011 stc.l RS,@-<REG_N>  */{"stc.l",{A_RS,A_DEC_N},{HEX_4,REG_N,HEX_6,HEX_3}, arch_sh_dsp_up},
  
! /* 0100nnnn00110011 stc.l SSR,@-<REG_N> */{"stc.l",{A_SSR,A_DEC_N},{HEX_4,REG_N,HEX_3,HEX_3}, arch_sh3_nommu_up},
  
! /* 0100nnnn01000011 stc.l SPC,@-<REG_N> */{"stc.l",{A_SPC,A_DEC_N},{HEX_4,REG_N,HEX_4,HEX_3}, arch_sh3_nommu_up},
  
  /* 0100nnnn00010011 stc.l GBR,@-<REG_N> */{"stc.l",{A_GBR,A_DEC_N},{HEX_4,REG_N,HEX_1,HEX_3}, arch_sh1_up},
  
*************** const sh_opcode_info sh_table[] =
*** 603,609 ****
  
  /* 0100nnnn11110010 stc.l DBR,@-<REG_N> */{"stc.l",{A_DBR,A_DEC_N},{HEX_4,REG_N,HEX_F,HEX_2}, arch_sh4_nommu_nofpu_up},
  
! /* 0100nnnn1xxx0011 stc.l Rn_BANK,@-<REG_N> */{"stc.l",{A_REG_B,A_DEC_N},{HEX_4,REG_N,REG_B,HEX_3}, arch_sh3_up},
  
  /* 0000nnnn00001010 sts MACH,<REG_N>    */{"sts",{A_MACH,A_REG_N},{HEX_0,REG_N,HEX_0,HEX_A}, arch_sh1_up},
  
--- 678,684 ----
  
  /* 0100nnnn11110010 stc.l DBR,@-<REG_N> */{"stc.l",{A_DBR,A_DEC_N},{HEX_4,REG_N,HEX_F,HEX_2}, arch_sh4_nommu_nofpu_up},
  
! /* 0100nnnn1xxx0011 stc.l Rn_BANK,@-<REG_N> */{"stc.l",{A_REG_B,A_DEC_N},{HEX_4,REG_N,REG_B,HEX_3}, arch_sh3_nommu_up},
  
  /* 0000nnnn00001010 sts MACH,<REG_N>    */{"sts",{A_MACH,A_REG_N},{HEX_0,REG_N,HEX_0,HEX_A}, arch_sh1_up},
  
*** /dev/null	Thu Aug 30 21:30:55 2001
--- gas/testsuite/gas/sh/arch/arch.exp	Fri Mar 26 12:58:51 2004
***************
*** 0 ****
--- 1,197 ----
+ # Copyright (C) 2004
+ # Free Software Foundation, Inc.
+ 
+ # This program is free software; you can redistribute it and/or modify
+ # it under the terms of the GNU General Public License as published by
+ # the Free Software Foundation; either version 2 of the License, or
+ # (at your option) any later version.
+ # 
+ # This program is distributed in the hope that it will be useful,
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ # GNU General Public License for more details.
+ # 
+ # You should have received a copy of the GNU General Public License
+ # along with this program; if not, write to the Free Software
+ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
+ 
+ # Please email any bugs, comments, and/or additions to this file to:
+ # dejagnu@gnu.org
+ 
+ # This scripts tests all available SH architectures with all the assembler
+ # options related to the architecture. It ensures that those combinations
+ # which should not work do not work, and that those that should work
+ # produce the correct output architecture.
+ #
+ # It looks for files in the same directory as this file named sh*.s .
+ # Each file must contain one or more instructions which uniquely identifies
+ # that architecture. The architecture name is inferred from the file name.
+ #
+ # The script generates the architecture/option permutations automatically,
+ # but it reads the expected results from the file arch_expected.txt (also
+ # found in the same directory as this script).
+ #
+ # The arch_expected.txt file should NOT be hand edited. Whenever the script
+ # is run (e.g. with 'make check') it creates a new (usually identical) file
+ # named arch_results.txt in the <objdir>/gas/testsuite directory. When the
+ # expected results change (or new architectures are added) this new file
+ # can be used to replace arch_expected.txt with no modification required.
+ 
+ 
+ # The procedure extracts the architecture name from the objdump output.
+ # If there is no architecture name (or objdump output changes significantly)
+ # then the behaviour is undefined, but it will most likely return junk.
+ 
+ proc get_sh_arch { ofile } {
+     global comp_output
+ 
+     objdump "-f $ofile"
+     send_log $comp_output
+ 
+     set comp_output [string replace $comp_output 0 \
+ 	    [expr [string first "architecture:" $comp_output] + 13] ""]
+ 
+     return [string range $comp_output 0 [expr [string first "," $comp_output] - 1]]
+ }
+ 
+ 
+ # This procedure runs two tests:
+ #   Test 1: Check the assembler can assemble the given file with
+ #           given options.
+ #   Test 2: Check that the resultant architecture is as expected.
+ # It also writes an entry to the arch_results.txt file.
+ 
+ proc test_arch { file opt arch resultfile } {
+     global comp_output
+ 
+     set name [file tail $file]
+     set rootname [file rootname $name]
+ 
+     if [string equal $opt "default-options"] then {
+ 	gas_run $name "-o ${rootname}-#${opt}#.o" ""
+     } else {
+ 	gas_run $name "$opt -o ${rootname}-#${opt}#.o" ""
+     }
+ 
+     if [want_no_output "$rootname file should assemble with $opt"] then {
+ 	set result [get_sh_arch "${rootname}-#${opt}#.o"]
+ 	puts $resultfile [format "%-20s %-25s %s" $file $opt $result]
+ 
+ 	if {$result == $arch} then {
+ 	    pass "$rootname file with $opt should assemble to arch $arch"
+ 	    file delete "${rootname}-#${opt}#.o"
+ 	} else {
+ 	    send_log $comp_output
+ 	    fail "$rootname file with $opt should assemble to arch $arch"
+ 	}
+     } else {
+ 	puts $resultfile [format "%-20s %-25s ERROR" $file $opt]
+ 	untested "$rootname file with $opt should assemble to arch $arch"
+     }
+ 
+ }
+ 
+ 
+ # This procedure tests that a file that is not suposed to assemble
+ # with a given option does, in fact, not assemble.
+ # It also writes an entry to the arch_results.txt file.
+ 
+ proc test_arch_error { file opt resultfile} {
+     global comp_output
+ 
+     set name [file tail $file]
+     set rootname [file rootname $name]
+ 
+     if [string equal $opt "default-options"] then {
+ 	gas_run $name "-o ${rootname}-#${opt}#.o" ""
+     } else {
+ 	gas_run $name "$opt -o ${rootname}-#${opt}#.o" ""
+     }
+ 
+     if [string match "" $comp_output] then {
+ 	fail "$rootname file with $opt should not assemble"
+ 	puts $resultfile [format "%-20s %-25s [get_sh_arch ${rootname}-#${opt}#.o]" $file $opt]
+     } else {
+ 	pass "$rootname file with $opt should not assemble"
+ 	puts $resultfile [format "%-20s %-25s ERROR" $file $opt]
+     }
+ }   
+ 
+ # These tests are not suitable for sh-coff because
+ # coff does not store the architecture information.
+ 
+ if [istarget sh*-*-elf] then {
+     global subdir srcdir
+ 
+     # Find all the architectures and generate the
+     # list of options we will test.
+ 
+     set filelist [lsort -ascii [glob "$srcdir/$subdir/sh*.s"]]
+     set optlist {"default-options" "-dsp" "-isa=any" "-isa=dsp" "-isa=fp"}
+     foreach file $filelist {
+ 	set arch [file rootname [file tail $file]]
+ 	lappend optlist "-isa=$arch" "-isa=${arch}-up"
+     }
+ 
+     # Initialise the results file
+ 
+     set outfile [open "arch_results.txt" w 0666]
+     puts $outfile "# Generated file. DO NOT EDIT"
+     puts $outfile "#"
+     puts $outfile "# This file is generated by gas/testsuite/gas/sh/arch/arch.exp ."
+     puts $outfile "# It contains the expected results of the tests."
+     puts $outfile "# If the tests are failing because the expected results"
+     puts $outfile "# have changed then run 'make check' and copy the new file"
+     puts $outfile "# from <objdir>/gas/testsuite/arch_results.txt"
+     puts $outfile "# to   <srcdir>/gas/testsuite/gas/sh/arch/arch_expected.txt ."
+     puts $outfile "# Make sure the new expected results are ALL correct."
+     puts $outfile "#"
+     puts $outfile [format "# %-18s %-25s %s" "FILE" "OPTION" "OUTPUT"]
+     puts $outfile [format "# %-18s %-25s %s" "----" "------" "------"]
+ 
+     # Open the expected results file and skip the header
+ 
+     set infile [open "$srcdir/$subdir/arch_expected.txt" r]
+     while {[gets $infile line] >= 0 && [string match {\#*} $line]} {send_log "reading '$line'\n"}
+ 
+     foreach file $filelist {
+ 	foreach opt $optlist {
+ 	    set name [file tail $file]
+ 	    set rootname [file rootname $name]
+ 
+ 	    # Decode the expected result from the file
+ 
+ 	    scan $line "%s %s %s" exfile exopt exarch
+ 	    send_log "exfile = '$exfile', exopt = '$exopt', exarch = '$exarch'\n"
+ 	    send_log "  name = '$name',   opt = '$opt'\n"
+ 
+ 	    if {[string equal $exfile $name] && [string equal $exopt $opt]} then {
+ 		# The expected result file makes sense and
+ 		# appears up-to-date (the file and options match)
+ 
+ 		if {[string equal $exarch "ERROR"]} then {
+ 		    test_arch_error $name $opt $outfile
+ 		} else {
+ 		    test_arch $name $opt $exarch $outfile
+ 		}
+ 	    } else {
+ 		# The expected result file isn't right somehow
+ 		# so just try any old test. This will cause
+ 		# many failures, but will genrate the results file.
+ 
+ 		test_arch $name $opt $rootname $outfile
+ 	    }
+ 
+ 	    # Read the next line from the expected result file.
+ 	    # This is at the end because the process of skipping
+ 	    # the header reads the first real line
+ 
+ 	    if [gets $infile line] then {
+ 		send_log "reading '$line'\n"
+ 	    }
+ 	}
+     }
+ 
+     close $infile
+     close $outfile
+ }
*** /dev/null	Thu Aug 30 21:30:55 2001
--- gas/testsuite/gas/sh/arch/arch_expected.txt	Fri Mar 26 12:29:17 2004
***************
*** 0 ****
--- 1,474 ----
+ # Generated file. DO NOT EDIT
+ #
+ # This file is generated by gas/testsuite/gas/sh/arch/arch.exp .
+ # It contains the expected results of the tests.
+ # If the tests are failing because the expected results
+ # have changed then run 'make check' and copy the new file
+ # from <objdir>/gas/testsuite/arch_results.txt
+ # to   <srcdir>/gas/testsuite/gas/sh/arch/arch_expected.txt .
+ # Make sure the new expected results are ALL correct.
+ #
+ # FILE               OPTION                    OUTPUT
+ # ----               ------                    ------
+ sh-dsp.s             default-options           ERROR
+ sh-dsp.s             -dsp                      sh-dsp
+ sh-dsp.s             -isa=any                  sh-dsp
+ sh-dsp.s             -isa=dsp                  sh-dsp
+ sh-dsp.s             -isa=fp                   ERROR
+ sh-dsp.s             -isa=sh-dsp               sh-dsp
+ sh-dsp.s             -isa=sh-dsp-up            sh-dsp
+ sh-dsp.s             -isa=sh                   ERROR
+ sh-dsp.s             -isa=sh-up                sh-dsp
+ sh-dsp.s             -isa=sh2                  ERROR
+ sh-dsp.s             -isa=sh2-up               sh-dsp
+ sh-dsp.s             -isa=sh2e                 ERROR
+ sh-dsp.s             -isa=sh2e-up              ERROR
+ sh-dsp.s             -isa=sh3-dsp              sh3-dsp
+ sh-dsp.s             -isa=sh3-dsp-up           sh3-dsp
+ sh-dsp.s             -isa=sh3-nommu            ERROR
+ sh-dsp.s             -isa=sh3-nommu-up         sh3-dsp
+ sh-dsp.s             -isa=sh3                  ERROR
+ sh-dsp.s             -isa=sh3-up               sh3-dsp
+ sh-dsp.s             -isa=sh3e                 ERROR
+ sh-dsp.s             -isa=sh3e-up              ERROR
+ sh-dsp.s             -isa=sh4-nofpu            ERROR
+ sh-dsp.s             -isa=sh4-nofpu-up         sh4al-dsp
+ sh-dsp.s             -isa=sh4-nommu-nofpu      ERROR
+ sh-dsp.s             -isa=sh4-nommu-nofpu-up   sh4al-dsp
+ sh-dsp.s             -isa=sh4                  ERROR
+ sh-dsp.s             -isa=sh4-up               ERROR
+ sh-dsp.s             -isa=sh4a-nofpu           ERROR
+ sh-dsp.s             -isa=sh4a-nofpu-up        sh4al-dsp
+ sh-dsp.s             -isa=sh4a                 ERROR
+ sh-dsp.s             -isa=sh4a-up              ERROR
+ sh-dsp.s             -isa=sh4al-dsp            sh4al-dsp
+ sh-dsp.s             -isa=sh4al-dsp-up         sh4al-dsp
+ sh.s                 default-options           sh
+ sh.s                 -dsp                      sh
+ sh.s                 -isa=any                  sh
+ sh.s                 -isa=dsp                  sh
+ sh.s                 -isa=fp                   sh
+ sh.s                 -isa=sh-dsp               sh-dsp
+ sh.s                 -isa=sh-dsp-up            sh-dsp
+ sh.s                 -isa=sh                   sh
+ sh.s                 -isa=sh-up                sh
+ sh.s                 -isa=sh2                  sh2
+ sh.s                 -isa=sh2-up               sh2
+ sh.s                 -isa=sh2e                 sh2e
+ sh.s                 -isa=sh2e-up              sh2e
+ sh.s                 -isa=sh3-dsp              sh3-dsp
+ sh.s                 -isa=sh3-dsp-up           sh3-dsp
+ sh.s                 -isa=sh3-nommu            sh3-nommu
+ sh.s                 -isa=sh3-nommu-up         sh3-nommu
+ sh.s                 -isa=sh3                  sh3
+ sh.s                 -isa=sh3-up               sh3
+ sh.s                 -isa=sh3e                 sh3e
+ sh.s                 -isa=sh3e-up              sh3e
+ sh.s                 -isa=sh4-nofpu            sh4-nofpu
+ sh.s                 -isa=sh4-nofpu-up         sh4-nofpu
+ sh.s                 -isa=sh4-nommu-nofpu      sh4-nommu-nofpu
+ sh.s                 -isa=sh4-nommu-nofpu-up   sh4-nommu-nofpu
+ sh.s                 -isa=sh4                  sh4
+ sh.s                 -isa=sh4-up               sh4
+ sh.s                 -isa=sh4a-nofpu           sh4a-nofpu
+ sh.s                 -isa=sh4a-nofpu-up        sh4a-nofpu
+ sh.s                 -isa=sh4a                 sh4a
+ sh.s                 -isa=sh4a-up              sh4a
+ sh.s                 -isa=sh4al-dsp            sh4al-dsp
+ sh.s                 -isa=sh4al-dsp-up         sh4al-dsp
+ sh2.s                default-options           sh2
+ sh2.s                -dsp                      sh2
+ sh2.s                -isa=any                  sh2
+ sh2.s                -isa=dsp                  sh2
+ sh2.s                -isa=fp                   sh2
+ sh2.s                -isa=sh-dsp               sh-dsp
+ sh2.s                -isa=sh-dsp-up            sh-dsp
+ sh2.s                -isa=sh                   ERROR
+ sh2.s                -isa=sh-up                sh2
+ sh2.s                -isa=sh2                  sh2
+ sh2.s                -isa=sh2-up               sh2
+ sh2.s                -isa=sh2e                 sh2e
+ sh2.s                -isa=sh2e-up              sh2e
+ sh2.s                -isa=sh3-dsp              sh3-dsp
+ sh2.s                -isa=sh3-dsp-up           sh3-dsp
+ sh2.s                -isa=sh3-nommu            sh3-nommu
+ sh2.s                -isa=sh3-nommu-up         sh3-nommu
+ sh2.s                -isa=sh3                  sh3
+ sh2.s                -isa=sh3-up               sh3
+ sh2.s                -isa=sh3e                 sh3e
+ sh2.s                -isa=sh3e-up              sh3e
+ sh2.s                -isa=sh4-nofpu            sh4-nofpu
+ sh2.s                -isa=sh4-nofpu-up         sh4-nofpu
+ sh2.s                -isa=sh4-nommu-nofpu      sh4-nommu-nofpu
+ sh2.s                -isa=sh4-nommu-nofpu-up   sh4-nommu-nofpu
+ sh2.s                -isa=sh4                  sh4
+ sh2.s                -isa=sh4-up               sh4
+ sh2.s                -isa=sh4a-nofpu           sh4a-nofpu
+ sh2.s                -isa=sh4a-nofpu-up        sh4a-nofpu
+ sh2.s                -isa=sh4a                 sh4a
+ sh2.s                -isa=sh4a-up              sh4a
+ sh2.s                -isa=sh4al-dsp            sh4al-dsp
+ sh2.s                -isa=sh4al-dsp-up         sh4al-dsp
+ sh2e.s               default-options           sh2e
+ sh2e.s               -dsp                      ERROR
+ sh2e.s               -isa=any                  sh2e
+ sh2e.s               -isa=dsp                  ERROR
+ sh2e.s               -isa=fp                   sh2e
+ sh2e.s               -isa=sh-dsp               ERROR
+ sh2e.s               -isa=sh-dsp-up            ERROR
+ sh2e.s               -isa=sh                   ERROR
+ sh2e.s               -isa=sh-up                sh2e
+ sh2e.s               -isa=sh2                  ERROR
+ sh2e.s               -isa=sh2-up               sh2e
+ sh2e.s               -isa=sh2e                 sh2e
+ sh2e.s               -isa=sh2e-up              sh2e
+ sh2e.s               -isa=sh3-dsp              ERROR
+ sh2e.s               -isa=sh3-dsp-up           ERROR
+ sh2e.s               -isa=sh3-nommu            ERROR
+ sh2e.s               -isa=sh3-nommu-up         sh3e
+ sh2e.s               -isa=sh3                  ERROR
+ sh2e.s               -isa=sh3-up               sh3e
+ sh2e.s               -isa=sh3e                 sh3e
+ sh2e.s               -isa=sh3e-up              sh3e
+ sh2e.s               -isa=sh4-nofpu            ERROR
+ sh2e.s               -isa=sh4-nofpu-up         sh4
+ sh2e.s               -isa=sh4-nommu-nofpu      ERROR
+ sh2e.s               -isa=sh4-nommu-nofpu-up   sh4
+ sh2e.s               -isa=sh4                  sh4
+ sh2e.s               -isa=sh4-up               sh4
+ sh2e.s               -isa=sh4a-nofpu           ERROR
+ sh2e.s               -isa=sh4a-nofpu-up        sh4a
+ sh2e.s               -isa=sh4a                 sh4a
+ sh2e.s               -isa=sh4a-up              sh4a
+ sh2e.s               -isa=sh4al-dsp            ERROR
+ sh2e.s               -isa=sh4al-dsp-up         ERROR
+ sh3-dsp.s            default-options           ERROR
+ sh3-dsp.s            -dsp                      sh3-dsp
+ sh3-dsp.s            -isa=any                  sh3-dsp
+ sh3-dsp.s            -isa=dsp                  sh3-dsp
+ sh3-dsp.s            -isa=fp                   ERROR
+ sh3-dsp.s            -isa=sh-dsp               ERROR
+ sh3-dsp.s            -isa=sh-dsp-up            sh3-dsp
+ sh3-dsp.s            -isa=sh                   ERROR
+ sh3-dsp.s            -isa=sh-up                sh3-dsp
+ sh3-dsp.s            -isa=sh2                  ERROR
+ sh3-dsp.s            -isa=sh2-up               sh3-dsp
+ sh3-dsp.s            -isa=sh2e                 ERROR
+ sh3-dsp.s            -isa=sh2e-up              ERROR
+ sh3-dsp.s            -isa=sh3-dsp              sh3-dsp
+ sh3-dsp.s            -isa=sh3-dsp-up           sh3-dsp
+ sh3-dsp.s            -isa=sh3-nommu            ERROR
+ sh3-dsp.s            -isa=sh3-nommu-up         sh3-dsp
+ sh3-dsp.s            -isa=sh3                  ERROR
+ sh3-dsp.s            -isa=sh3-up               sh3-dsp
+ sh3-dsp.s            -isa=sh3e                 ERROR
+ sh3-dsp.s            -isa=sh3e-up              ERROR
+ sh3-dsp.s            -isa=sh4-nofpu            ERROR
+ sh3-dsp.s            -isa=sh4-nofpu-up         sh4al-dsp
+ sh3-dsp.s            -isa=sh4-nommu-nofpu      ERROR
+ sh3-dsp.s            -isa=sh4-nommu-nofpu-up   sh4al-dsp
+ sh3-dsp.s            -isa=sh4                  ERROR
+ sh3-dsp.s            -isa=sh4-up               ERROR
+ sh3-dsp.s            -isa=sh4a-nofpu           ERROR
+ sh3-dsp.s            -isa=sh4a-nofpu-up        sh4al-dsp
+ sh3-dsp.s            -isa=sh4a                 ERROR
+ sh3-dsp.s            -isa=sh4a-up              ERROR
+ sh3-dsp.s            -isa=sh4al-dsp            sh4al-dsp
+ sh3-dsp.s            -isa=sh4al-dsp-up         sh4al-dsp
+ sh3-nommu.s          default-options           sh3-nommu
+ sh3-nommu.s          -dsp                      sh3-nommu
+ sh3-nommu.s          -isa=any                  sh3-nommu
+ sh3-nommu.s          -isa=dsp                  sh3-nommu
+ sh3-nommu.s          -isa=fp                   sh3-nommu
+ sh3-nommu.s          -isa=sh-dsp               ERROR
+ sh3-nommu.s          -isa=sh-dsp-up            sh3-dsp
+ sh3-nommu.s          -isa=sh                   ERROR
+ sh3-nommu.s          -isa=sh-up                sh3-nommu
+ sh3-nommu.s          -isa=sh2                  ERROR
+ sh3-nommu.s          -isa=sh2-up               sh3-nommu
+ sh3-nommu.s          -isa=sh2e                 ERROR
+ sh3-nommu.s          -isa=sh2e-up              sh3e
+ sh3-nommu.s          -isa=sh3-dsp              sh3-dsp
+ sh3-nommu.s          -isa=sh3-dsp-up           sh3-dsp
+ sh3-nommu.s          -isa=sh3-nommu            sh3-nommu
+ sh3-nommu.s          -isa=sh3-nommu-up         sh3-nommu
+ sh3-nommu.s          -isa=sh3                  sh3
+ sh3-nommu.s          -isa=sh3-up               sh3
+ sh3-nommu.s          -isa=sh3e                 sh3e
+ sh3-nommu.s          -isa=sh3e-up              sh3e
+ sh3-nommu.s          -isa=sh4-nofpu            sh4-nofpu
+ sh3-nommu.s          -isa=sh4-nofpu-up         sh4-nofpu
+ sh3-nommu.s          -isa=sh4-nommu-nofpu      sh4-nommu-nofpu
+ sh3-nommu.s          -isa=sh4-nommu-nofpu-up   sh4-nommu-nofpu
+ sh3-nommu.s          -isa=sh4                  sh4
+ sh3-nommu.s          -isa=sh4-up               sh4
+ sh3-nommu.s          -isa=sh4a-nofpu           sh4a-nofpu
+ sh3-nommu.s          -isa=sh4a-nofpu-up        sh4a-nofpu
+ sh3-nommu.s          -isa=sh4a                 sh4a
+ sh3-nommu.s          -isa=sh4a-up              sh4a
+ sh3-nommu.s          -isa=sh4al-dsp            sh4al-dsp
+ sh3-nommu.s          -isa=sh4al-dsp-up         sh4al-dsp
+ sh3.s                default-options           sh3
+ sh3.s                -dsp                      sh3
+ sh3.s                -isa=any                  sh3
+ sh3.s                -isa=dsp                  sh3
+ sh3.s                -isa=fp                   sh3
+ sh3.s                -isa=sh-dsp               ERROR
+ sh3.s                -isa=sh-dsp-up            sh3-dsp
+ sh3.s                -isa=sh                   ERROR
+ sh3.s                -isa=sh-up                sh3
+ sh3.s                -isa=sh2                  ERROR
+ sh3.s                -isa=sh2-up               sh3
+ sh3.s                -isa=sh2e                 ERROR
+ sh3.s                -isa=sh2e-up              sh3e
+ sh3.s                -isa=sh3-dsp              sh3-dsp
+ sh3.s                -isa=sh3-dsp-up           sh3-dsp
+ sh3.s                -isa=sh3-nommu            ERROR
+ sh3.s                -isa=sh3-nommu-up         sh3
+ sh3.s                -isa=sh3                  sh3
+ sh3.s                -isa=sh3-up               sh3
+ sh3.s                -isa=sh3e                 sh3e
+ sh3.s                -isa=sh3e-up              sh3e
+ sh3.s                -isa=sh4-nofpu            sh4-nofpu
+ sh3.s                -isa=sh4-nofpu-up         sh4-nofpu
+ sh3.s                -isa=sh4-nommu-nofpu      ERROR
+ sh3.s                -isa=sh4-nommu-nofpu-up   sh4-nofpu
+ sh3.s                -isa=sh4                  sh4
+ sh3.s                -isa=sh4-up               sh4
+ sh3.s                -isa=sh4a-nofpu           sh4a-nofpu
+ sh3.s                -isa=sh4a-nofpu-up        sh4a-nofpu
+ sh3.s                -isa=sh4a                 sh4a
+ sh3.s                -isa=sh4a-up              sh4a
+ sh3.s                -isa=sh4al-dsp            sh4al-dsp
+ sh3.s                -isa=sh4al-dsp-up         sh4al-dsp
+ sh3e.s               default-options           sh3e
+ sh3e.s               -dsp                      ERROR
+ sh3e.s               -isa=any                  sh3e
+ sh3e.s               -isa=dsp                  ERROR
+ sh3e.s               -isa=fp                   sh3e
+ sh3e.s               -isa=sh-dsp               ERROR
+ sh3e.s               -isa=sh-dsp-up            ERROR
+ sh3e.s               -isa=sh                   ERROR
+ sh3e.s               -isa=sh-up                sh3e
+ sh3e.s               -isa=sh2                  ERROR
+ sh3e.s               -isa=sh2-up               sh3e
+ sh3e.s               -isa=sh2e                 ERROR
+ sh3e.s               -isa=sh2e-up              sh3e
+ sh3e.s               -isa=sh3-dsp              ERROR
+ sh3e.s               -isa=sh3-dsp-up           ERROR
+ sh3e.s               -isa=sh3-nommu            ERROR
+ sh3e.s               -isa=sh3-nommu-up         sh3e
+ sh3e.s               -isa=sh3                  ERROR
+ sh3e.s               -isa=sh3-up               sh3e
+ sh3e.s               -isa=sh3e                 sh3e
+ sh3e.s               -isa=sh3e-up              sh3e
+ sh3e.s               -isa=sh4-nofpu            ERROR
+ sh3e.s               -isa=sh4-nofpu-up         sh4
+ sh3e.s               -isa=sh4-nommu-nofpu      ERROR
+ sh3e.s               -isa=sh4-nommu-nofpu-up   sh4
+ sh3e.s               -isa=sh4                  sh4
+ sh3e.s               -isa=sh4-up               sh4
+ sh3e.s               -isa=sh4a-nofpu           ERROR
+ sh3e.s               -isa=sh4a-nofpu-up        sh4a
+ sh3e.s               -isa=sh4a                 sh4a
+ sh3e.s               -isa=sh4a-up              sh4a
+ sh3e.s               -isa=sh4al-dsp            ERROR
+ sh3e.s               -isa=sh4al-dsp-up         ERROR
+ sh4-nofpu.s          default-options           sh4-nofpu
+ sh4-nofpu.s          -dsp                      sh4-nofpu
+ sh4-nofpu.s          -isa=any                  sh4-nofpu
+ sh4-nofpu.s          -isa=dsp                  sh4-nofpu
+ sh4-nofpu.s          -isa=fp                   sh4-nofpu
+ sh4-nofpu.s          -isa=sh-dsp               ERROR
+ sh4-nofpu.s          -isa=sh-dsp-up            sh4al-dsp
+ sh4-nofpu.s          -isa=sh                   ERROR
+ sh4-nofpu.s          -isa=sh-up                sh4-nofpu
+ sh4-nofpu.s          -isa=sh2                  ERROR
+ sh4-nofpu.s          -isa=sh2-up               sh4-nofpu
+ sh4-nofpu.s          -isa=sh2e                 ERROR
+ sh4-nofpu.s          -isa=sh2e-up              sh4
+ sh4-nofpu.s          -isa=sh3-dsp              ERROR
+ sh4-nofpu.s          -isa=sh3-dsp-up           sh4al-dsp
+ sh4-nofpu.s          -isa=sh3-nommu            ERROR
+ sh4-nofpu.s          -isa=sh3-nommu-up         sh4-nofpu
+ sh4-nofpu.s          -isa=sh3                  ERROR
+ sh4-nofpu.s          -isa=sh3-up               sh4-nofpu
+ sh4-nofpu.s          -isa=sh3e                 ERROR
+ sh4-nofpu.s          -isa=sh3e-up              sh4
+ sh4-nofpu.s          -isa=sh4-nofpu            sh4-nofpu
+ sh4-nofpu.s          -isa=sh4-nofpu-up         sh4-nofpu
+ sh4-nofpu.s          -isa=sh4-nommu-nofpu      ERROR
+ sh4-nofpu.s          -isa=sh4-nommu-nofpu-up   sh4-nofpu
+ sh4-nofpu.s          -isa=sh4                  sh4
+ sh4-nofpu.s          -isa=sh4-up               sh4
+ sh4-nofpu.s          -isa=sh4a-nofpu           sh4a-nofpu
+ sh4-nofpu.s          -isa=sh4a-nofpu-up        sh4a-nofpu
+ sh4-nofpu.s          -isa=sh4a                 sh4a
+ sh4-nofpu.s          -isa=sh4a-up              sh4a
+ sh4-nofpu.s          -isa=sh4al-dsp            sh4al-dsp
+ sh4-nofpu.s          -isa=sh4al-dsp-up         sh4al-dsp
+ sh4-nommu-nofpu.s    default-options           sh4-nommu-nofpu
+ sh4-nommu-nofpu.s    -dsp                      sh4-nommu-nofpu
+ sh4-nommu-nofpu.s    -isa=any                  sh4-nommu-nofpu
+ sh4-nommu-nofpu.s    -isa=dsp                  sh4-nommu-nofpu
+ sh4-nommu-nofpu.s    -isa=fp                   sh4-nommu-nofpu
+ sh4-nommu-nofpu.s    -isa=sh-dsp               ERROR
+ sh4-nommu-nofpu.s    -isa=sh-dsp-up            sh4al-dsp
+ sh4-nommu-nofpu.s    -isa=sh                   ERROR
+ sh4-nommu-nofpu.s    -isa=sh-up                sh4-nommu-nofpu
+ sh4-nommu-nofpu.s    -isa=sh2                  ERROR
+ sh4-nommu-nofpu.s    -isa=sh2-up               sh4-nommu-nofpu
+ sh4-nommu-nofpu.s    -isa=sh2e                 ERROR
+ sh4-nommu-nofpu.s    -isa=sh2e-up              sh4
+ sh4-nommu-nofpu.s    -isa=sh3-dsp              ERROR
+ sh4-nommu-nofpu.s    -isa=sh3-dsp-up           sh4al-dsp
+ sh4-nommu-nofpu.s    -isa=sh3-nommu            ERROR
+ sh4-nommu-nofpu.s    -isa=sh3-nommu-up         sh4-nommu-nofpu
+ sh4-nommu-nofpu.s    -isa=sh3                  ERROR
+ sh4-nommu-nofpu.s    -isa=sh3-up               sh4-nofpu
+ sh4-nommu-nofpu.s    -isa=sh3e                 ERROR
+ sh4-nommu-nofpu.s    -isa=sh3e-up              sh4
+ sh4-nommu-nofpu.s    -isa=sh4-nofpu            sh4-nofpu
+ sh4-nommu-nofpu.s    -isa=sh4-nofpu-up         sh4-nofpu
+ sh4-nommu-nofpu.s    -isa=sh4-nommu-nofpu      sh4-nommu-nofpu
+ sh4-nommu-nofpu.s    -isa=sh4-nommu-nofpu-up   sh4-nommu-nofpu
+ sh4-nommu-nofpu.s    -isa=sh4                  sh4
+ sh4-nommu-nofpu.s    -isa=sh4-up               sh4
+ sh4-nommu-nofpu.s    -isa=sh4a-nofpu           sh4a-nofpu
+ sh4-nommu-nofpu.s    -isa=sh4a-nofpu-up        sh4a-nofpu
+ sh4-nommu-nofpu.s    -isa=sh4a                 sh4a
+ sh4-nommu-nofpu.s    -isa=sh4a-up              sh4a
+ sh4-nommu-nofpu.s    -isa=sh4al-dsp            sh4al-dsp
+ sh4-nommu-nofpu.s    -isa=sh4al-dsp-up         sh4al-dsp
+ sh4.s                default-options           sh4
+ sh4.s                -dsp                      ERROR
+ sh4.s                -isa=any                  sh4
+ sh4.s                -isa=dsp                  ERROR
+ sh4.s                -isa=fp                   sh4
+ sh4.s                -isa=sh-dsp               ERROR
+ sh4.s                -isa=sh-dsp-up            ERROR
+ sh4.s                -isa=sh                   ERROR
+ sh4.s                -isa=sh-up                sh4
+ sh4.s                -isa=sh2                  ERROR
+ sh4.s                -isa=sh2-up               sh4
+ sh4.s                -isa=sh2e                 ERROR
+ sh4.s                -isa=sh2e-up              sh4
+ sh4.s                -isa=sh3-dsp              ERROR
+ sh4.s                -isa=sh3-dsp-up           ERROR
+ sh4.s                -isa=sh3-nommu            ERROR
+ sh4.s                -isa=sh3-nommu-up         sh4
+ sh4.s                -isa=sh3                  ERROR
+ sh4.s                -isa=sh3-up               sh4
+ sh4.s                -isa=sh3e                 ERROR
+ sh4.s                -isa=sh3e-up              sh4
+ sh4.s                -isa=sh4-nofpu            ERROR
+ sh4.s                -isa=sh4-nofpu-up         sh4
+ sh4.s                -isa=sh4-nommu-nofpu      ERROR
+ sh4.s                -isa=sh4-nommu-nofpu-up   sh4
+ sh4.s                -isa=sh4                  sh4
+ sh4.s                -isa=sh4-up               sh4
+ sh4.s                -isa=sh4a-nofpu           ERROR
+ sh4.s                -isa=sh4a-nofpu-up        sh4a
+ sh4.s                -isa=sh4a                 sh4a
+ sh4.s                -isa=sh4a-up              sh4a
+ sh4.s                -isa=sh4al-dsp            ERROR
+ sh4.s                -isa=sh4al-dsp-up         ERROR
+ sh4a-nofpu.s         default-options           sh4a-nofpu
+ sh4a-nofpu.s         -dsp                      sh4a-nofpu
+ sh4a-nofpu.s         -isa=any                  sh4a-nofpu
+ sh4a-nofpu.s         -isa=dsp                  sh4a-nofpu
+ sh4a-nofpu.s         -isa=fp                   sh4a-nofpu
+ sh4a-nofpu.s         -isa=sh-dsp               ERROR
+ sh4a-nofpu.s         -isa=sh-dsp-up            sh4al-dsp
+ sh4a-nofpu.s         -isa=sh                   ERROR
+ sh4a-nofpu.s         -isa=sh-up                sh4a-nofpu
+ sh4a-nofpu.s         -isa=sh2                  ERROR
+ sh4a-nofpu.s         -isa=sh2-up               sh4a-nofpu
+ sh4a-nofpu.s         -isa=sh2e                 ERROR
+ sh4a-nofpu.s         -isa=sh2e-up              sh4a
+ sh4a-nofpu.s         -isa=sh3-dsp              ERROR
+ sh4a-nofpu.s         -isa=sh3-dsp-up           sh4al-dsp
+ sh4a-nofpu.s         -isa=sh3-nommu            ERROR
+ sh4a-nofpu.s         -isa=sh3-nommu-up         sh4a-nofpu
+ sh4a-nofpu.s         -isa=sh3                  ERROR
+ sh4a-nofpu.s         -isa=sh3-up               sh4a-nofpu
+ sh4a-nofpu.s         -isa=sh3e                 ERROR
+ sh4a-nofpu.s         -isa=sh3e-up              sh4a
+ sh4a-nofpu.s         -isa=sh4-nofpu            ERROR
+ sh4a-nofpu.s         -isa=sh4-nofpu-up         sh4a-nofpu
+ sh4a-nofpu.s         -isa=sh4-nommu-nofpu      ERROR
+ sh4a-nofpu.s         -isa=sh4-nommu-nofpu-up   sh4a-nofpu
+ sh4a-nofpu.s         -isa=sh4                  ERROR
+ sh4a-nofpu.s         -isa=sh4-up               sh4a
+ sh4a-nofpu.s         -isa=sh4a-nofpu           sh4a-nofpu
+ sh4a-nofpu.s         -isa=sh4a-nofpu-up        sh4a-nofpu
+ sh4a-nofpu.s         -isa=sh4a                 sh4a
+ sh4a-nofpu.s         -isa=sh4a-up              sh4a
+ sh4a-nofpu.s         -isa=sh4al-dsp            sh4al-dsp
+ sh4a-nofpu.s         -isa=sh4al-dsp-up         sh4al-dsp
+ sh4a.s               default-options           sh4a
+ sh4a.s               -dsp                      ERROR
+ sh4a.s               -isa=any                  sh4a
+ sh4a.s               -isa=dsp                  ERROR
+ sh4a.s               -isa=fp                   sh4a
+ sh4a.s               -isa=sh-dsp               ERROR
+ sh4a.s               -isa=sh-dsp-up            ERROR
+ sh4a.s               -isa=sh                   ERROR
+ sh4a.s               -isa=sh-up                sh4a
+ sh4a.s               -isa=sh2                  ERROR
+ sh4a.s               -isa=sh2-up               sh4a
+ sh4a.s               -isa=sh2e                 ERROR
+ sh4a.s               -isa=sh2e-up              sh4a
+ sh4a.s               -isa=sh3-dsp              ERROR
+ sh4a.s               -isa=sh3-dsp-up           ERROR
+ sh4a.s               -isa=sh3-nommu            ERROR
+ sh4a.s               -isa=sh3-nommu-up         sh4a
+ sh4a.s               -isa=sh3                  ERROR
+ sh4a.s               -isa=sh3-up               sh4a
+ sh4a.s               -isa=sh3e                 ERROR
+ sh4a.s               -isa=sh3e-up              sh4a
+ sh4a.s               -isa=sh4-nofpu            ERROR
+ sh4a.s               -isa=sh4-nofpu-up         sh4a
+ sh4a.s               -isa=sh4-nommu-nofpu      ERROR
+ sh4a.s               -isa=sh4-nommu-nofpu-up   sh4a
+ sh4a.s               -isa=sh4                  ERROR
+ sh4a.s               -isa=sh4-up               sh4a
+ sh4a.s               -isa=sh4a-nofpu           ERROR
+ sh4a.s               -isa=sh4a-nofpu-up        sh4a
+ sh4a.s               -isa=sh4a                 sh4a
+ sh4a.s               -isa=sh4a-up              sh4a
+ sh4a.s               -isa=sh4al-dsp            ERROR
+ sh4a.s               -isa=sh4al-dsp-up         ERROR
+ sh4al-dsp.s          default-options           ERROR
+ sh4al-dsp.s          -dsp                      sh4al-dsp
+ sh4al-dsp.s          -isa=any                  sh4al-dsp
+ sh4al-dsp.s          -isa=dsp                  sh4al-dsp
+ sh4al-dsp.s          -isa=fp                   ERROR
+ sh4al-dsp.s          -isa=sh-dsp               ERROR
+ sh4al-dsp.s          -isa=sh-dsp-up            sh4al-dsp
+ sh4al-dsp.s          -isa=sh                   ERROR
+ sh4al-dsp.s          -isa=sh-up                sh4al-dsp
+ sh4al-dsp.s          -isa=sh2                  ERROR
+ sh4al-dsp.s          -isa=sh2-up               sh4al-dsp
+ sh4al-dsp.s          -isa=sh2e                 ERROR
+ sh4al-dsp.s          -isa=sh2e-up              ERROR
+ sh4al-dsp.s          -isa=sh3-dsp              ERROR
+ sh4al-dsp.s          -isa=sh3-dsp-up           sh4al-dsp
+ sh4al-dsp.s          -isa=sh3-nommu            ERROR
+ sh4al-dsp.s          -isa=sh3-nommu-up         sh4al-dsp
+ sh4al-dsp.s          -isa=sh3                  ERROR
+ sh4al-dsp.s          -isa=sh3-up               sh4al-dsp
+ sh4al-dsp.s          -isa=sh3e                 ERROR
+ sh4al-dsp.s          -isa=sh3e-up              ERROR
+ sh4al-dsp.s          -isa=sh4-nofpu            ERROR
+ sh4al-dsp.s          -isa=sh4-nofpu-up         sh4al-dsp
+ sh4al-dsp.s          -isa=sh4-nommu-nofpu      ERROR
+ sh4al-dsp.s          -isa=sh4-nommu-nofpu-up   sh4al-dsp
+ sh4al-dsp.s          -isa=sh4                  ERROR
+ sh4al-dsp.s          -isa=sh4-up               ERROR
+ sh4al-dsp.s          -isa=sh4a-nofpu           ERROR
+ sh4al-dsp.s          -isa=sh4a-nofpu-up        sh4al-dsp
+ sh4al-dsp.s          -isa=sh4a                 ERROR
+ sh4al-dsp.s          -isa=sh4a-up              ERROR
+ sh4al-dsp.s          -isa=sh4al-dsp            sh4al-dsp
+ sh4al-dsp.s          -isa=sh4al-dsp-up         sh4al-dsp
*** /dev/null	Thu Aug 30 21:30:55 2001
--- gas/testsuite/gas/sh/arch/sh2e.s	Fri Mar 26 12:59:36 2004
***************
*** 0 ****
--- 1,3 ----
+ 	.section .text
+ sh2e:
+ 	lds r1,fpul
*** /dev/null	Thu Aug 30 21:30:55 2001
--- gas/testsuite/gas/sh/arch/sh2.s	Fri Mar 26 12:59:41 2004
***************
*** 0 ****
--- 1,3 ----
+ 	.section .text
+ sh2:
+ 	bt.s sh2
*** /dev/null	Thu Aug 30 21:30:55 2001
--- gas/testsuite/gas/sh/arch/sh3-dsp.s	Fri Mar 26 12:59:47 2004
***************
*** 0 ****
--- 1,4 ----
+ 	.section .text
+ sh3_dsp:
+ 	ldc r1,ssr
+ 	ldc r1,mod
*** /dev/null	Thu Aug 30 21:30:55 2001
--- gas/testsuite/gas/sh/arch/sh3e.s	Fri Mar 26 12:59:49 2004
***************
*** 0 ****
--- 1,3 ----
+ 	.section .text
+ sh3e:
+ 	fsqrt fr1
*** /dev/null	Thu Aug 30 21:30:55 2001
--- gas/testsuite/gas/sh/arch/sh3-nommu.s	Fri Mar 26 12:59:53 2004
***************
*** 0 ****
--- 1,3 ----
+ 	.section .text
+ sh3_nommu:
+ 	ldc r1,ssr
*** /dev/null	Thu Aug 30 21:30:55 2001
--- gas/testsuite/gas/sh/arch/sh3.s	Fri Mar 26 12:59:56 2004
***************
*** 0 ****
--- 1,4 ----
+ 	.section .text
+ sh3:
+ 	ldc r1,ssr
+ 	ldtlb
*** /dev/null	Thu Aug 30 21:30:55 2001
--- gas/testsuite/gas/sh/arch/sh4al-dsp.s	Fri Mar 26 12:59:59 2004
***************
*** 0 ****
--- 1,3 ----
+ 	.section .text
+ sh4al_dsp:
+ 	clrdmxy
*** /dev/null	Thu Aug 30 21:30:55 2001
--- gas/testsuite/gas/sh/arch/sh4a-nofpu.s	Fri Mar 26 13:00:03 2004
***************
*** 0 ****
--- 1,3 ----
+ 	.section .text
+ sh4a_nofpu:
+ 	icbi @r1
*** /dev/null	Thu Aug 30 21:30:55 2001
--- gas/testsuite/gas/sh/arch/sh4a.s	Fri Mar 26 13:00:06 2004
***************
*** 0 ****
--- 1,3 ----
+ 	.section .text
+ sh4a:
+ 	fpchg
*** /dev/null	Thu Aug 30 21:30:55 2001
--- gas/testsuite/gas/sh/arch/sh4-nofpu.s	Fri Mar 26 13:00:08 2004
***************
*** 0 ****
--- 1,4 ----
+ 	.section .text
+ sh4_nofpu:
+ 	ldc r1,sgr
+ 	ldtlb
*** /dev/null	Thu Aug 30 21:30:55 2001
--- gas/testsuite/gas/sh/arch/sh4-nommu-nofpu.s	Fri Mar 26 13:00:11 2004
***************
*** 0 ****
--- 1,3 ----
+ 	.section .text
+ sh4_nommu_nofpu:
+ 	ldc r1,sgr
*** /dev/null	Thu Aug 30 21:30:55 2001
--- gas/testsuite/gas/sh/arch/sh4.s	Fri Mar 26 13:00:14 2004
***************
*** 0 ****
--- 1,3 ----
+ 	.section .text
+ sh4:
+ 	fabs dr0
*** /dev/null	Thu Aug 30 21:30:55 2001
--- gas/testsuite/gas/sh/arch/sh-dsp.s	Fri Mar 26 13:00:18 2004
***************
*** 0 ****
--- 1,3 ----
+ 	.section .text
+ sh2_dsp:
+ 	ldc r1,mod
*** /dev/null	Thu Aug 30 21:30:55 2001
--- gas/testsuite/gas/sh/arch/sh.s	Fri Mar 26 13:00:21 2004
***************
*** 0 ****
--- 1,3 ----
+ 	.section .text
+ sh1:
+ 	mov r1,r2
*** /dev/null	Thu Aug 30 21:30:55 2001
--- ld/testsuite/ld-sh/arch/arch.exp	Fri Apr  2 16:02:46 2004
***************
*** 0 ****
--- 1,244 ----
+ # Copyright (C) 2004
+ # Free Software Foundation, Inc.
+ 
+ # This program is free software; you can redistribute it and/or modify
+ # it under the terms of the GNU General Public License as published by
+ # the Free Software Foundation; either version 2 of the License, or
+ # (at your option) any later version.
+ # 
+ # This program is distributed in the hope that it will be useful,
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ # GNU General Public License for more details.
+ # 
+ # You should have received a copy of the GNU General Public License
+ # along with this program; if not, write to the Free Software
+ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
+ 
+ # Please email any bugs, comments, and/or additions to this file to:
+ # dejagnu@gnu.org
+ 
+ # This scripts tests of all available SH architectures with all other SH
+ # architectures. It ensures that those combinations which should not work
+ # do not work, and that those that should work produce the correct output
+ # architecture.
+ #
+ # It looks for files in the same directory as this file named sh*.s .
+ # Each file must contain one or more instructions which uniquely identifies
+ # that architecture. The architecture name is inferred from the file name.
+ #
+ # It also creates another architecture named 'sh-unknown' by modifying
+ # another arch type (there is no way to assemble such an arch) in order
+ # to test what the linker would do with an older object file.
+ #
+ # The script generates the architecture  permutations automatically,
+ # but it reads the expected results from the file arch_expected.txt (also
+ # found in the same directory as this script).
+ #
+ # The arch_expected.txt file should NOT be hand edited. Whenever the script
+ # is run (e.g. with 'make check') it creates a new (usually identical) file
+ # named arch_results.txt in the <objdir>/ld/testsuite directory. When the
+ # expected results change (or new architectures are added) this new file
+ # can be used to replace arch_expected.txt with no modification required.
+ 
+ 
+ # The procedure extracts the architecture name from the objdump output.
+ # If there is no architecture name (or objdump output changes significantly)
+ # then the behaviour is undefined, but it will most likely return junk.
+ 
+ proc get_sh_arch { ofile } {
+     global OBJDUMP
+ 
+     set cmd "$OBJDUMP -f $ofile"
+     verbose -log $cmd
+     catch "exec $cmd" objdump_output
+     verbose -log $objdump_output
+ 
+     set objdump_output [string replace $objdump_output 0 \
+ 	    [expr [string first "architecture:" $objdump_output] + 13] ""]
+ 
+     return [string range $objdump_output 0 [expr [string first "," $objdump_output] - 1]]
+ }
+ 
+ 
+ # This procedure runs two tests:
+ #   Test 1: Check the linker can link the given files.
+ #   Test 2: Check that the resultant architecture is as expected.
+ # It also writes an entry to the arch_results.txt file.
+ 
+ proc test_arch { file1 file2 arch resultfile } {
+     global LD
+ 
+     set name1 [file tail $file1]
+     set rootname1 [file rootname $name1]
+ 
+     set name2 [file tail $file2]
+     set rootname2 [file rootname $name2]
+ 
+     set result [default_ld_simple_link $LD "${rootname1}_${rootname2}.o" "$file1 $file2"]
+ 
+     if {$result == 1} then {
+ 	pass "$rootname1 file should link with $rootname2 file"
+ 
+ 	set result [get_sh_arch "${rootname1}_${rootname2}.o"]
+ 	puts $resultfile [format "%-20s %-20s %s" $file1 $file2 $result]
+ 
+ 	if {$result == $arch} then {
+ 	    pass "$rootname1 file with $rootname2 file should link to arch $arch"
+ 	    file delete "${rootname1}_${rootname2}.o"
+ 	} else {
+ 	    fail "$rootname1 file with $rootname2 file should link to arch $arch"
+ 	}
+     } else {
+ 	fail "$rootname1 file should link with $rootname2 file"
+ 
+ 	puts $resultfile [format "%-20s %-20s ERROR" $file1 $file2]
+ 	untested "$rootname2 file with $rootname2 file should link to arch $arch"
+     }
+ 
+ }
+ 
+ 
+ 
+ # This procedure tests that a pair of files that are not
+ # suposed to link does, in fact, not link.
+ # It also writes an entry to the arch_results.txt file.
+ 
+ proc test_arch_error { file1 file2 resultfile} {
+     global link_output LD
+ 
+     set name1 [file tail $file1]
+     set rootname1 [file rootname $name1]
+ 
+     set name2 [file tail $file2]
+     set rootname2 [file rootname $name2]
+ 
+     set result [default_ld_simple_link $LD "${rootname1}_${rootname2}.o" "$file1 $file2"]
+ 
+     if {$result == 1} then {
+ 	fail "$rootname1 file should NOT link with $rootname2 file"
+ 	puts $resultfile [format "%-20s %-20s [get_sh_arch ${rootname1}_${rootname2}.o]" $file1 $file2]
+     } else {
+ 	pass "$rootname1 file should NOT link with $rootname2 file"
+ 	puts $resultfile [format "%-20s %-20s ERROR" $file1 $file2]
+     }
+ }   
+ 
+ # These tests are not suitable for sh-coff because
+ # coff does not store the architecture information.
+ 
+ if [istarget sh*-*-elf] then {
+     global subdir srcdir
+     global AS
+ 
+     # Find all the architectures and assemble all the files
+     # we will use for the linker tests.
+ 
+     set sfilelist [lsort -ascii [glob "$srcdir/$subdir/sh*.s"]]
+     set ofilelist {}
+     foreach sfile $sfilelist {
+ 	set ofile "[file rootname [file tail $sfile]].o"
+ 	lappend ofilelist $ofile
+ 
+ 	set endian "-big"
+ 	if [string equal [big_or_little_endian] " -EL"] then {
+ 	    set endian "-little"
+ 	}
+ 
+ 	set cmd "$AS $endian -isa=any $sfile -o $ofile"
+ 	verbose -log $cmd
+ 	catch "exec $cmd" as_output
+ 	if ![file exists $ofile] then {
+ 	    verbose -log $as_output
+ 	    perror "$sfile: assembly failed"
+ 	}
+     }
+ 
+     # Create the default arch ofile
+     # This cannot be created with the assembler
+     # sh4al-dsp is number 6, sh-unknown is 0
+ 
+     lappend ofilelist "sh-unknown.o"
+ 
+     if [string equal [big_or_little_endian] " -EL"] then {
+ 	set cmd {xxd sh4al-dsp.o | sed {s/\(^0000020: .... .... \)06/\100/} | xxd -r - sh-unknown.o}
+     } else {
+ 	set cmd {xxd sh4al-dsp.o | sed {s/\(^0000020: .... .... .... ..\)06/\100/} | xxd -r - sh-unknown.o}
+     }
+     verbose -log $cmd
+     catch "exec $cmd" xxd_output
+     verbose -log $xxd_output
+     if [string equal [get_sh_arch "sh-unknown.o"] "sh4al-dsp"] then {
+ 	perror "sh-unknown.o not generated correctly"
+     }
+ 
+ 
+     # Initialise the results file
+ 
+     set outfile [open "arch_results.txt" w 0666]
+     puts $outfile "# Generated file. DO NOT EDIT"
+     puts $outfile "#"
+     puts $outfile "# This file is generated by ld/testsuite/ld-sh/arch/arch.exp ."
+     puts $outfile "# It contains the expected results of the tests."
+     puts $outfile "# If the tests are failing because the expected results"
+     puts $outfile "# have changed then run 'make check' and copy the new file"
+     puts $outfile "# from <objdir>/ld/arch_results.txt"
+     puts $outfile "# to   <srcdir>/ld/testsuite/ld-sh/arch/arch_expected.txt ."
+     puts $outfile "# Make sure the new expected results are ALL correct."
+     puts $outfile "#"
+     puts $outfile [format "# %-18s %-20s %s" "FILE1" "FILE2" "OUTPUT"]
+     puts $outfile [format "# %-18s %-20s %s" "-----" "-----" "------"]
+ 
+     # Open the expected results file and skip the header
+ 
+     set infile [open "$srcdir/$subdir/arch_expected.txt" r]
+     while {[gets $infile line] >= 0 && [string match {\#*} $line]} {verbose -log "reading '$line'"}
+ 
+     foreach file1 $ofilelist {
+ 	foreach file2 $ofilelist {
+ 	    set name1 [file tail $file1]
+ 	    set rootname1 [file rootname $name1]
+ 
+ 	    set name2 [file tail $file2]
+ 	    set rootname2 [file rootname $name2]
+ 
+ 	    # Decode the expected result from the file
+ 
+ 	    scan $line "%s %s %s" exfile1 exfile2 exarch
+ 	    verbose -log "exfile1 = '$exfile1', exfile2 = '$exfile2', exarch = '$exarch'"
+ 	    verbose -log "  name1 = '$name1',   name2 = '$name2'"
+ 
+ 	    if {[string equal $exfile1 $name1] && [string equal $exfile2 $file2]} then {
+ 		# The expected result file makes sense and
+ 		# appears up-to-date (the file and options match)
+ 
+ 		if {[string equal $exarch "ERROR"]} then {
+ 		    test_arch_error $file1 $file2 $outfile
+ 		} else {
+ 		    test_arch $file1 $file2 $exarch $outfile
+ 		}
+ 	    } else {
+ 		# The expected result file isn't right somehow
+ 		# so just try any old test. This will cause
+ 		# many failures, but will genrate the results file.
+ 
+ 		test_arch $file1 $file2 $rootname1 $outfile
+ 	    }
+ 
+ 	    # Read the next line from the expected result file.
+ 	    # This is at the end because the process of skipping
+ 	    # the header reads the first real line
+ 
+ 	    if [gets $infile line] then {
+ 		verbose -log "reading '$line'"
+ 	    }
+ 	}
+     }
+ 
+     close $infile
+     close $outfile
+ 
+     foreach file $ofilelist {
+ 	file delete $file
+     }
+ }
*** /dev/null	Thu Aug 30 21:30:55 2001
--- ld/testsuite/ld-sh/arch/arch_expected.txt	Fri Apr  2 15:52:18 2004
***************
*** 0 ****
--- 1,237 ----
+ # Generated file. DO NOT EDIT
+ #
+ # This file is generated by ld/testsuite/ld-sh/arch/arch.exp .
+ # It contains the expected results of the tests.
+ # If the tests are failing because the expected results
+ # have changed then run 'make check' and copy the new file
+ # from <objdir>/ld/testsuite/arch_results.txt
+ # to   <srcdir>/ld/testsuite/ld-sh/arch/arch_expected.txt .
+ # Make sure the new expected results are ALL correct.
+ #
+ # FILE1              FILE2                OUTPUT
+ # -----              -----                ------
+ sh-dsp.o             sh-dsp.o             sh-dsp
+ sh-dsp.o             sh.o                 sh-dsp
+ sh-dsp.o             sh2.o                sh-dsp
+ sh-dsp.o             sh2e.o               ERROR
+ sh-dsp.o             sh3-dsp.o            sh3-dsp
+ sh-dsp.o             sh3-nommu.o          sh3-dsp
+ sh-dsp.o             sh3.o                sh3-dsp
+ sh-dsp.o             sh3e.o               ERROR
+ sh-dsp.o             sh4-nofpu.o          sh4al-dsp
+ sh-dsp.o             sh4-nommu-nofpu.o    sh4al-dsp
+ sh-dsp.o             sh4.o                ERROR
+ sh-dsp.o             sh4a-nofpu.o         sh4al-dsp
+ sh-dsp.o             sh4a.o               ERROR
+ sh-dsp.o             sh4al-dsp.o          sh4al-dsp
+ sh-dsp.o             sh-unknown.o         sh3-dsp
+ sh.o                 sh-dsp.o             sh-dsp
+ sh.o                 sh.o                 sh
+ sh.o                 sh2.o                sh2
+ sh.o                 sh2e.o               sh2e
+ sh.o                 sh3-dsp.o            sh3-dsp
+ sh.o                 sh3-nommu.o          sh3-nommu
+ sh.o                 sh3.o                sh3
+ sh.o                 sh3e.o               sh3e
+ sh.o                 sh4-nofpu.o          sh4-nofpu
+ sh.o                 sh4-nommu-nofpu.o    sh4-nommu-nofpu
+ sh.o                 sh4.o                sh4
+ sh.o                 sh4a-nofpu.o         sh4a-nofpu
+ sh.o                 sh4a.o               sh4a
+ sh.o                 sh4al-dsp.o          sh4al-dsp
+ sh.o                 sh-unknown.o         sh3
+ sh2.o                sh-dsp.o             sh-dsp
+ sh2.o                sh.o                 sh2
+ sh2.o                sh2.o                sh2
+ sh2.o                sh2e.o               sh2e
+ sh2.o                sh3-dsp.o            sh3-dsp
+ sh2.o                sh3-nommu.o          sh3-nommu
+ sh2.o                sh3.o                sh3
+ sh2.o                sh3e.o               sh3e
+ sh2.o                sh4-nofpu.o          sh4-nofpu
+ sh2.o                sh4-nommu-nofpu.o    sh4-nommu-nofpu
+ sh2.o                sh4.o                sh4
+ sh2.o                sh4a-nofpu.o         sh4a-nofpu
+ sh2.o                sh4a.o               sh4a
+ sh2.o                sh4al-dsp.o          sh4al-dsp
+ sh2.o                sh-unknown.o         sh3
+ sh2e.o               sh-dsp.o             ERROR
+ sh2e.o               sh.o                 sh2e
+ sh2e.o               sh2.o                sh2e
+ sh2e.o               sh2e.o               sh2e
+ sh2e.o               sh3-dsp.o            ERROR
+ sh2e.o               sh3-nommu.o          sh3e
+ sh2e.o               sh3.o                sh3e
+ sh2e.o               sh3e.o               sh3e
+ sh2e.o               sh4-nofpu.o          sh4
+ sh2e.o               sh4-nommu-nofpu.o    sh4
+ sh2e.o               sh4.o                sh4
+ sh2e.o               sh4a-nofpu.o         sh4a
+ sh2e.o               sh4a.o               sh4a
+ sh2e.o               sh4al-dsp.o          ERROR
+ sh2e.o               sh-unknown.o         sh3e
+ sh3-dsp.o            sh-dsp.o             sh3-dsp
+ sh3-dsp.o            sh.o                 sh3-dsp
+ sh3-dsp.o            sh2.o                sh3-dsp
+ sh3-dsp.o            sh2e.o               ERROR
+ sh3-dsp.o            sh3-dsp.o            sh3-dsp
+ sh3-dsp.o            sh3-nommu.o          sh3-dsp
+ sh3-dsp.o            sh3.o                sh3-dsp
+ sh3-dsp.o            sh3e.o               ERROR
+ sh3-dsp.o            sh4-nofpu.o          sh4al-dsp
+ sh3-dsp.o            sh4-nommu-nofpu.o    sh4al-dsp
+ sh3-dsp.o            sh4.o                ERROR
+ sh3-dsp.o            sh4a-nofpu.o         sh4al-dsp
+ sh3-dsp.o            sh4a.o               ERROR
+ sh3-dsp.o            sh4al-dsp.o          sh4al-dsp
+ sh3-dsp.o            sh-unknown.o         sh3-dsp
+ sh3-nommu.o          sh-dsp.o             sh3-dsp
+ sh3-nommu.o          sh.o                 sh3-nommu
+ sh3-nommu.o          sh2.o                sh3-nommu
+ sh3-nommu.o          sh2e.o               sh3e
+ sh3-nommu.o          sh3-dsp.o            sh3-dsp
+ sh3-nommu.o          sh3-nommu.o          sh3-nommu
+ sh3-nommu.o          sh3.o                sh3
+ sh3-nommu.o          sh3e.o               sh3e
+ sh3-nommu.o          sh4-nofpu.o          sh4-nofpu
+ sh3-nommu.o          sh4-nommu-nofpu.o    sh4-nommu-nofpu
+ sh3-nommu.o          sh4.o                sh4
+ sh3-nommu.o          sh4a-nofpu.o         sh4a-nofpu
+ sh3-nommu.o          sh4a.o               sh4a
+ sh3-nommu.o          sh4al-dsp.o          sh4al-dsp
+ sh3-nommu.o          sh-unknown.o         sh3
+ sh3.o                sh-dsp.o             sh3-dsp
+ sh3.o                sh.o                 sh3
+ sh3.o                sh2.o                sh3
+ sh3.o                sh2e.o               sh3e
+ sh3.o                sh3-dsp.o            sh3-dsp
+ sh3.o                sh3-nommu.o          sh3
+ sh3.o                sh3.o                sh3
+ sh3.o                sh3e.o               sh3e
+ sh3.o                sh4-nofpu.o          sh4-nofpu
+ sh3.o                sh4-nommu-nofpu.o    sh4-nofpu
+ sh3.o                sh4.o                sh4
+ sh3.o                sh4a-nofpu.o         sh4a-nofpu
+ sh3.o                sh4a.o               sh4a
+ sh3.o                sh4al-dsp.o          sh4al-dsp
+ sh3.o                sh-unknown.o         sh3
+ sh3e.o               sh-dsp.o             ERROR
+ sh3e.o               sh.o                 sh3e
+ sh3e.o               sh2.o                sh3e
+ sh3e.o               sh2e.o               sh3e
+ sh3e.o               sh3-dsp.o            ERROR
+ sh3e.o               sh3-nommu.o          sh3e
+ sh3e.o               sh3.o                sh3e
+ sh3e.o               sh3e.o               sh3e
+ sh3e.o               sh4-nofpu.o          sh4
+ sh3e.o               sh4-nommu-nofpu.o    sh4
+ sh3e.o               sh4.o                sh4
+ sh3e.o               sh4a-nofpu.o         sh4a
+ sh3e.o               sh4a.o               sh4a
+ sh3e.o               sh4al-dsp.o          ERROR
+ sh3e.o               sh-unknown.o         sh3e
+ sh4-nofpu.o          sh-dsp.o             sh4al-dsp
+ sh4-nofpu.o          sh.o                 sh4-nofpu
+ sh4-nofpu.o          sh2.o                sh4-nofpu
+ sh4-nofpu.o          sh2e.o               sh4
+ sh4-nofpu.o          sh3-dsp.o            sh4al-dsp
+ sh4-nofpu.o          sh3-nommu.o          sh4-nofpu
+ sh4-nofpu.o          sh3.o                sh4-nofpu
+ sh4-nofpu.o          sh3e.o               sh4
+ sh4-nofpu.o          sh4-nofpu.o          sh4-nofpu
+ sh4-nofpu.o          sh4-nommu-nofpu.o    sh4-nofpu
+ sh4-nofpu.o          sh4.o                sh4
+ sh4-nofpu.o          sh4a-nofpu.o         sh4a-nofpu
+ sh4-nofpu.o          sh4a.o               sh4a
+ sh4-nofpu.o          sh4al-dsp.o          sh4al-dsp
+ sh4-nofpu.o          sh-unknown.o         sh4-nofpu
+ sh4-nommu-nofpu.o    sh-dsp.o             sh4al-dsp
+ sh4-nommu-nofpu.o    sh.o                 sh4-nommu-nofpu
+ sh4-nommu-nofpu.o    sh2.o                sh4-nommu-nofpu
+ sh4-nommu-nofpu.o    sh2e.o               sh4
+ sh4-nommu-nofpu.o    sh3-dsp.o            sh4al-dsp
+ sh4-nommu-nofpu.o    sh3-nommu.o          sh4-nommu-nofpu
+ sh4-nommu-nofpu.o    sh3.o                sh4-nofpu
+ sh4-nommu-nofpu.o    sh3e.o               sh4
+ sh4-nommu-nofpu.o    sh4-nofpu.o          sh4-nofpu
+ sh4-nommu-nofpu.o    sh4-nommu-nofpu.o    sh4-nommu-nofpu
+ sh4-nommu-nofpu.o    sh4.o                sh4
+ sh4-nommu-nofpu.o    sh4a-nofpu.o         sh4a-nofpu
+ sh4-nommu-nofpu.o    sh4a.o               sh4a
+ sh4-nommu-nofpu.o    sh4al-dsp.o          sh4al-dsp
+ sh4-nommu-nofpu.o    sh-unknown.o         sh4-nofpu
+ sh4.o                sh-dsp.o             ERROR
+ sh4.o                sh.o                 sh4
+ sh4.o                sh2.o                sh4
+ sh4.o                sh2e.o               sh4
+ sh4.o                sh3-dsp.o            ERROR
+ sh4.o                sh3-nommu.o          sh4
+ sh4.o                sh3.o                sh4
+ sh4.o                sh3e.o               sh4
+ sh4.o                sh4-nofpu.o          sh4
+ sh4.o                sh4-nommu-nofpu.o    sh4
+ sh4.o                sh4.o                sh4
+ sh4.o                sh4a-nofpu.o         sh4a
+ sh4.o                sh4a.o               sh4a
+ sh4.o                sh4al-dsp.o          ERROR
+ sh4.o                sh-unknown.o         sh4
+ sh4a-nofpu.o         sh-dsp.o             sh4al-dsp
+ sh4a-nofpu.o         sh.o                 sh4a-nofpu
+ sh4a-nofpu.o         sh2.o                sh4a-nofpu
+ sh4a-nofpu.o         sh2e.o               sh4a
+ sh4a-nofpu.o         sh3-dsp.o            sh4al-dsp
+ sh4a-nofpu.o         sh3-nommu.o          sh4a-nofpu
+ sh4a-nofpu.o         sh3.o                sh4a-nofpu
+ sh4a-nofpu.o         sh3e.o               sh4a
+ sh4a-nofpu.o         sh4-nofpu.o          sh4a-nofpu
+ sh4a-nofpu.o         sh4-nommu-nofpu.o    sh4a-nofpu
+ sh4a-nofpu.o         sh4.o                sh4a
+ sh4a-nofpu.o         sh4a-nofpu.o         sh4a-nofpu
+ sh4a-nofpu.o         sh4a.o               sh4a
+ sh4a-nofpu.o         sh4al-dsp.o          sh4al-dsp
+ sh4a-nofpu.o         sh-unknown.o         sh4a-nofpu
+ sh4a.o               sh-dsp.o             ERROR
+ sh4a.o               sh.o                 sh4a
+ sh4a.o               sh2.o                sh4a
+ sh4a.o               sh2e.o               sh4a
+ sh4a.o               sh3-dsp.o            ERROR
+ sh4a.o               sh3-nommu.o          sh4a
+ sh4a.o               sh3.o                sh4a
+ sh4a.o               sh3e.o               sh4a
+ sh4a.o               sh4-nofpu.o          sh4a
+ sh4a.o               sh4-nommu-nofpu.o    sh4a
+ sh4a.o               sh4.o                sh4a
+ sh4a.o               sh4a-nofpu.o         sh4a
+ sh4a.o               sh4a.o               sh4a
+ sh4a.o               sh4al-dsp.o          ERROR
+ sh4a.o               sh-unknown.o         sh4a
+ sh4al-dsp.o          sh-dsp.o             sh4al-dsp
+ sh4al-dsp.o          sh.o                 sh4al-dsp
+ sh4al-dsp.o          sh2.o                sh4al-dsp
+ sh4al-dsp.o          sh2e.o               ERROR
+ sh4al-dsp.o          sh3-dsp.o            sh4al-dsp
+ sh4al-dsp.o          sh3-nommu.o          sh4al-dsp
+ sh4al-dsp.o          sh3.o                sh4al-dsp
+ sh4al-dsp.o          sh3e.o               ERROR
+ sh4al-dsp.o          sh4-nofpu.o          sh4al-dsp
+ sh4al-dsp.o          sh4-nommu-nofpu.o    sh4al-dsp
+ sh4al-dsp.o          sh4.o                ERROR
+ sh4al-dsp.o          sh4a-nofpu.o         sh4al-dsp
+ sh4al-dsp.o          sh4a.o               ERROR
+ sh4al-dsp.o          sh4al-dsp.o          sh4al-dsp
+ sh4al-dsp.o          sh-unknown.o         sh4al-dsp
+ sh-unknown.o         sh-dsp.o             sh3-dsp
+ sh-unknown.o         sh.o                 sh3
+ sh-unknown.o         sh2.o                sh3
+ sh-unknown.o         sh2e.o               sh3e
+ sh-unknown.o         sh3-dsp.o            sh3-dsp
+ sh-unknown.o         sh3-nommu.o          sh3
+ sh-unknown.o         sh3.o                sh3
+ sh-unknown.o         sh3e.o               sh3e
+ sh-unknown.o         sh4-nofpu.o          sh4-nofpu
+ sh-unknown.o         sh4-nommu-nofpu.o    sh4-nofpu
+ sh-unknown.o         sh4.o                sh4
+ sh-unknown.o         sh4a-nofpu.o         sh4a-nofpu
+ sh-unknown.o         sh4a.o               sh4a
+ sh-unknown.o         sh4al-dsp.o          sh4al-dsp
+ sh-unknown.o         sh-unknown.o         sh3
*** /dev/null	Thu Aug 30 21:30:55 2001
--- ld/testsuite/ld-sh/arch/sh2e.s	Fri Mar 26 12:59:36 2004
***************
*** 0 ****
--- 1,3 ----
+ 	.section .text
+ sh2e:
+ 	lds r1,fpul
*** /dev/null	Thu Aug 30 21:30:55 2001
--- ld/testsuite/ld-sh/arch/sh2.s	Fri Mar 26 12:59:41 2004
***************
*** 0 ****
--- 1,3 ----
+ 	.section .text
+ sh2:
+ 	bt.s sh2
*** /dev/null	Thu Aug 30 21:30:55 2001
--- ld/testsuite/ld-sh/arch/sh3-dsp.s	Fri Mar 26 12:59:47 2004
***************
*** 0 ****
--- 1,4 ----
+ 	.section .text
+ sh3_dsp:
+ 	ldc r1,ssr
+ 	ldc r1,mod
*** /dev/null	Thu Aug 30 21:30:55 2001
--- ld/testsuite/ld-sh/arch/sh3e.s	Fri Mar 26 12:59:49 2004
***************
*** 0 ****
--- 1,3 ----
+ 	.section .text
+ sh3e:
+ 	fsqrt fr1
*** /dev/null	Thu Aug 30 21:30:55 2001
--- ld/testsuite/ld-sh/arch/sh3-nommu.s	Fri Mar 26 12:59:53 2004
***************
*** 0 ****
--- 1,3 ----
+ 	.section .text
+ sh3_nommu:
+ 	ldc r1,ssr
*** /dev/null	Thu Aug 30 21:30:55 2001
--- ld/testsuite/ld-sh/arch/sh3.s	Fri Mar 26 12:59:56 2004
***************
*** 0 ****
--- 1,4 ----
+ 	.section .text
+ sh3:
+ 	ldc r1,ssr
+ 	ldtlb
*** /dev/null	Thu Aug 30 21:30:55 2001
--- ld/testsuite/ld-sh/arch/sh4al-dsp.s	Fri Mar 26 12:59:59 2004
***************
*** 0 ****
--- 1,3 ----
+ 	.section .text
+ sh4al_dsp:
+ 	clrdmxy
*** /dev/null	Thu Aug 30 21:30:55 2001
--- ld/testsuite/ld-sh/arch/sh4a-nofpu.s	Fri Mar 26 13:00:03 2004
***************
*** 0 ****
--- 1,3 ----
+ 	.section .text
+ sh4a_nofpu:
+ 	icbi @r1
*** /dev/null	Thu Aug 30 21:30:55 2001
--- ld/testsuite/ld-sh/arch/sh4a.s	Fri Mar 26 13:00:06 2004
***************
*** 0 ****
--- 1,3 ----
+ 	.section .text
+ sh4a:
+ 	fpchg
*** /dev/null	Thu Aug 30 21:30:55 2001
--- ld/testsuite/ld-sh/arch/sh4-nofpu.s	Fri Mar 26 13:00:08 2004
***************
*** 0 ****
--- 1,4 ----
+ 	.section .text
+ sh4_nofpu:
+ 	ldc r1,sgr
+ 	ldtlb
*** /dev/null	Thu Aug 30 21:30:55 2001
--- ld/testsuite/ld-sh/arch/sh4-nommu-nofpu.s	Fri Mar 26 13:00:11 2004
***************
*** 0 ****
--- 1,3 ----
+ 	.section .text
+ sh4_nommu_nofpu:
+ 	ldc r1,sgr
*** /dev/null	Thu Aug 30 21:30:55 2001
--- ld/testsuite/ld-sh/arch/sh4.s	Fri Mar 26 13:00:14 2004
***************
*** 0 ****
--- 1,3 ----
+ 	.section .text
+ sh4:
+ 	fabs dr0
*** /dev/null	Thu Aug 30 21:30:55 2001
--- ld/testsuite/ld-sh/arch/sh-dsp.s	Fri Mar 26 13:00:18 2004
***************
*** 0 ****
--- 1,3 ----
+ 	.section .text
+ sh2_dsp:
+ 	ldc r1,mod
*** /dev/null	Thu Aug 30 21:30:55 2001
--- ld/testsuite/ld-sh/arch/sh.s	Fri Mar 26 13:00:21 2004
***************
*** 0 ****
--- 1,3 ----
+ 	.section .text
+ sh1:
+ 	mov r1,r2



More information about the Binutils mailing list