This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [m68k] arch flag cleanup v2


Ben Elliston wrote:

Thanks for the review. I've made the changes you suggested.

OK with the changes above.  I wouldn't mind some test cases, either!
(In particlar for the merging logic).

This is what I've committed, after testing. I added a set of linker merge tests. I also discovered I needed a m68k version of bfd_default_compatible to deal with the coldfire/m68k differences.



nathan


--
Nathan Sidwell    ::   http://www.codesourcery.com   ::         CodeSourcery
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

2006-03-06  Nathan Sidwell  <nathan@codesourcery.com>

	bfd:
	* archures.c (bfd_mach_mcf_isa_a_nodiv, bfd_mach_mcf_isa_b_nousp):
	New.  Adjust other variants.
	(bfd_default_scan): Update.
	* bfd-in2.h: Rebuilt.
	* cpu-m68k.c: Adjust.
	(bfd_m68k_compatible): New. Use it for architectures.
	* elf32-m68k.c (elf32_m68k_object_p): Adjust.
	(elf32_m68k_merge_private_bfd_data): Adjust.  Correct isa-a/b
	mismatch.
	(elf32_m68k_print_private_bfd_data): Adjust.
	* ieee.c (ieee_write_processor): Adjust.
	
	binutils:
	* readelf.c (get_machine_flags): Adjust.

	gas:
	* config/tc-m68k.c (m68k_extensions): Allow 'float' on both m68k
	and cf.
	(m68k_ip): <case 'J'> Check we have some control regs.
	(md_parse_option): Allow raw arch switch.
	(m68k_init_arch): Better detection of arch/cpu mismatch.  Detect
	whether 68881 or cfloat was meant by -mfloat.
	(md_show_usage): Adjust extension display.
	(m68k_elf_final_processing): Adjust.

	gas/testsuite:
	* gas/m68k/arch-cpu-1.s: Tweak.
	* gas/m68k/arch-cpu-1.d: Tweak.

	include/elf:
	* m68k.h (EF_M68K_ISA_MASK, EF_M68K_ISA_A,
	EF_M68K_ISA_A_PLUS, EF_M68K_ISA_B, EF_M68K_ISA_C): Adjust.
	(EF_M68K_ISA_A_NODIV, EF_M68K_ISA_B_NOUSP): New.
	(EF_M68K_HW_DIV, EF_M68K_USP): Remove.
	(EF_M68K_MAC, EF_M68K_EMAC, EF_M68K_FLOAT): Adjust.
	(EF_M68K_EMAC_B): New.

	ld/testsuite:
	* ld-m68k: New tests.

Index: bfd/archures.c
===================================================================
RCS file: /cvs/src/src/bfd/archures.c,v
retrieving revision 1.115
diff -c -3 -p -r1.115 archures.c
*** bfd/archures.c	17 Feb 2006 14:36:21 -0000	1.115
--- bfd/archures.c	6 Mar 2006 13:30:45 -0000
*************** DESCRIPTION
*** 80,101 ****
  .#define bfd_mach_m68040 6
  .#define bfd_mach_m68060 7
  .#define bfd_mach_cpu32  8
! .#define bfd_mach_mcf_isa_a 9
! .#define bfd_mach_mcf_isa_a_div 10
! .#define bfd_mach_mcf_isa_a_div_mac 11
! .#define bfd_mach_mcf_isa_a_div_emac 12
  .#define bfd_mach_mcf_isa_aplus 13
  .#define bfd_mach_mcf_isa_aplus_mac 14
  .#define bfd_mach_mcf_isa_aplus_emac 15
! .#define bfd_mach_mcf_isa_aplus_usp 16
! .#define bfd_mach_mcf_isa_aplus_usp_mac 17
! .#define bfd_mach_mcf_isa_aplus_usp_emac 18
  .#define bfd_mach_mcf_isa_b 19
  .#define bfd_mach_mcf_isa_b_mac 20
  .#define bfd_mach_mcf_isa_b_emac 21
! .#define bfd_mach_mcf_isa_b_usp_float 22
! .#define bfd_mach_mcf_isa_b_usp_float_mac 23
! .#define bfd_mach_mcf_isa_b_usp_float_emac 24
  .  bfd_arch_vax,       {* DEC Vax *}
  .  bfd_arch_i960,      {* Intel 960 *}
  .    {* The order of the following is important.
--- 80,101 ----
  .#define bfd_mach_m68040 6
  .#define bfd_mach_m68060 7
  .#define bfd_mach_cpu32  8
! .#define bfd_mach_mcf_isa_a_nodiv 9
! .#define bfd_mach_mcf_isa_a 10
! .#define bfd_mach_mcf_isa_a_mac 11
! .#define bfd_mach_mcf_isa_a_emac 12
  .#define bfd_mach_mcf_isa_aplus 13
  .#define bfd_mach_mcf_isa_aplus_mac 14
  .#define bfd_mach_mcf_isa_aplus_emac 15
! .#define bfd_mach_mcf_isa_b_nousp 16
! .#define bfd_mach_mcf_isa_b_nousp_mac 17
! .#define bfd_mach_mcf_isa_b_nousp_emac 18
  .#define bfd_mach_mcf_isa_b 19
  .#define bfd_mach_mcf_isa_b_mac 20
  .#define bfd_mach_mcf_isa_b_emac 21
! .#define bfd_mach_mcf_isa_b_float 22
! .#define bfd_mach_mcf_isa_b_float_mac 23
! .#define bfd_mach_mcf_isa_b_float_emac 24
  .  bfd_arch_vax,       {* DEC Vax *}
  .  bfd_arch_i960,      {* Intel 960 *}
  .    {* The order of the following is important.
*************** bfd_default_scan (const bfd_arch_info_ty
*** 1016,1038 ****
        break;
      case 5200:
        arch = bfd_arch_m68k;
!       number = bfd_mach_mcf_isa_a;
        break;
      case 5206:
        arch = bfd_arch_m68k;
!       number = bfd_mach_mcf_isa_a_div_mac;
        break;
      case 5307:
        arch = bfd_arch_m68k;
!       number = bfd_mach_mcf_isa_a_div_mac;
        break;
      case 5407:
        arch = bfd_arch_m68k;
!       number = bfd_mach_mcf_isa_b_mac;
        break;
      case 5282:
        arch = bfd_arch_m68k;
!       number = bfd_mach_mcf_isa_b_usp_float_emac;
        break;
  
      case 32000:
--- 1016,1038 ----
        break;
      case 5200:
        arch = bfd_arch_m68k;
!       number = bfd_mach_mcf_isa_a_nodiv;
        break;
      case 5206:
        arch = bfd_arch_m68k;
!       number = bfd_mach_mcf_isa_a_mac;
        break;
      case 5307:
        arch = bfd_arch_m68k;
!       number = bfd_mach_mcf_isa_a_mac;
        break;
      case 5407:
        arch = bfd_arch_m68k;
!       number = bfd_mach_mcf_isa_b_nousp_mac;
        break;
      case 5282:
        arch = bfd_arch_m68k;
!       number = bfd_mach_mcf_isa_aplus_emac;
        break;
  
      case 32000:
Index: bfd/bfd-in2.h
===================================================================
RCS file: /cvs/src/src/bfd/bfd-in2.h,v
retrieving revision 1.382
diff -c -3 -p -r1.382 bfd-in2.h
*** bfd/bfd-in2.h	3 Mar 2006 15:25:29 -0000	1.382
--- bfd/bfd-in2.h	6 Mar 2006 13:30:49 -0000
*************** enum bfd_architecture
*** 1674,1695 ****
  #define bfd_mach_m68040 6
  #define bfd_mach_m68060 7
  #define bfd_mach_cpu32  8
! #define bfd_mach_mcf_isa_a 9
! #define bfd_mach_mcf_isa_a_div 10
! #define bfd_mach_mcf_isa_a_div_mac 11
! #define bfd_mach_mcf_isa_a_div_emac 12
  #define bfd_mach_mcf_isa_aplus 13
  #define bfd_mach_mcf_isa_aplus_mac 14
  #define bfd_mach_mcf_isa_aplus_emac 15
! #define bfd_mach_mcf_isa_aplus_usp 16
! #define bfd_mach_mcf_isa_aplus_usp_mac 17
! #define bfd_mach_mcf_isa_aplus_usp_emac 18
  #define bfd_mach_mcf_isa_b 19
  #define bfd_mach_mcf_isa_b_mac 20
  #define bfd_mach_mcf_isa_b_emac 21
! #define bfd_mach_mcf_isa_b_usp_float 22
! #define bfd_mach_mcf_isa_b_usp_float_mac 23
! #define bfd_mach_mcf_isa_b_usp_float_emac 24
    bfd_arch_vax,       /* DEC Vax */
    bfd_arch_i960,      /* Intel 960 */
      /* The order of the following is important.
--- 1674,1695 ----
  #define bfd_mach_m68040 6
  #define bfd_mach_m68060 7
  #define bfd_mach_cpu32  8
! #define bfd_mach_mcf_isa_a_nodiv 9
! #define bfd_mach_mcf_isa_a 10
! #define bfd_mach_mcf_isa_a_mac 11
! #define bfd_mach_mcf_isa_a_emac 12
  #define bfd_mach_mcf_isa_aplus 13
  #define bfd_mach_mcf_isa_aplus_mac 14
  #define bfd_mach_mcf_isa_aplus_emac 15
! #define bfd_mach_mcf_isa_b_nousp 16
! #define bfd_mach_mcf_isa_b_nousp_mac 17
! #define bfd_mach_mcf_isa_b_nousp_emac 18
  #define bfd_mach_mcf_isa_b 19
  #define bfd_mach_mcf_isa_b_mac 20
  #define bfd_mach_mcf_isa_b_emac 21
! #define bfd_mach_mcf_isa_b_float 22
! #define bfd_mach_mcf_isa_b_float_mac 23
! #define bfd_mach_mcf_isa_b_float_emac 24
    bfd_arch_vax,       /* DEC Vax */
    bfd_arch_i960,      /* Intel 960 */
      /* The order of the following is important.
Index: bfd/cpu-m68k.c
===================================================================
RCS file: /cvs/src/src/bfd/cpu-m68k.c,v
retrieving revision 1.11
diff -c -3 -p -r1.11 cpu-m68k.c
*** bfd/cpu-m68k.c	7 Feb 2006 19:01:09 -0000	1.11
--- bfd/cpu-m68k.c	6 Mar 2006 13:30:50 -0000
***************
*** 24,31 ****
  #include "libbfd.h"
  #include "opcode/m68k.h"
  
  #define N(name, print,d,next)  \
! {  32, 32, 8, bfd_arch_m68k, name, "m68k",print,2,d,bfd_default_compatible,bfd_default_scan, next, }
  
  static const bfd_arch_info_type arch_info_struct[] =
    {
--- 24,35 ----
  #include "libbfd.h"
  #include "opcode/m68k.h"
  
+ static const bfd_arch_info_type *
+ bfd_m68k_compatible (const bfd_arch_info_type *a,
+ 		     const bfd_arch_info_type *b);
+ 
  #define N(name, print,d,next)  \
! {  32, 32, 8, bfd_arch_m68k, name, "m68k",print,2,d,bfd_m68k_compatible,bfd_default_scan, next, }
  
  static const bfd_arch_info_type arch_info_struct[] =
    {
*************** static const bfd_arch_info_type arch_inf
*** 39,63 ****
      N(bfd_mach_cpu32,   "m68k:cpu32", FALSE, &arch_info_struct[8]),
  
      /* Various combinations of CF architecture features */
!     N(bfd_mach_mcf_isa_a, "m68k:isa-a",
        FALSE, &arch_info_struct[9]),
!     N(bfd_mach_mcf_isa_a_div, "m68k:isa-a:div",
        FALSE, &arch_info_struct[10]),
!     N(bfd_mach_mcf_isa_a_div_mac, "m68k:isa-a:div:mac",
        FALSE, &arch_info_struct[11]),
!     N(bfd_mach_mcf_isa_a_div_emac, "m68k:isa-a:div:emac",
        FALSE, &arch_info_struct[12]),
!     N(bfd_mach_mcf_isa_aplus, "m68k:isa-a+",
        FALSE, &arch_info_struct[13]),
!     N(bfd_mach_mcf_isa_aplus_mac, "m68k:isa-a+:mac",
        FALSE, &arch_info_struct[14]),
!     N(bfd_mach_mcf_isa_aplus_emac, "m68k:isa-a+:emac",
        FALSE, &arch_info_struct[15]),
!     N(bfd_mach_mcf_isa_aplus_usp, "m68k:isa-a+:usp",
        FALSE, &arch_info_struct[16]),
!     N(bfd_mach_mcf_isa_aplus_usp_mac, "m68k:isa-a+:usp:mac",
        FALSE, &arch_info_struct[17]),
!     N(bfd_mach_mcf_isa_aplus_usp_emac, "m68k:isa-a+:usp:emac",
        FALSE, &arch_info_struct[18]),
      N(bfd_mach_mcf_isa_b, "m68k:isa-b",
        FALSE, &arch_info_struct[19]),
--- 43,67 ----
      N(bfd_mach_cpu32,   "m68k:cpu32", FALSE, &arch_info_struct[8]),
  
      /* Various combinations of CF architecture features */
!     N(bfd_mach_mcf_isa_a_nodiv, "m68k:isa-a:nodiv",
        FALSE, &arch_info_struct[9]),
!     N(bfd_mach_mcf_isa_a, "m68k:isa-a",
        FALSE, &arch_info_struct[10]),
!     N(bfd_mach_mcf_isa_a_mac, "m68k:isa-a:mac",
        FALSE, &arch_info_struct[11]),
!     N(bfd_mach_mcf_isa_a_emac, "m68k:isa-a:emac",
        FALSE, &arch_info_struct[12]),
!     N(bfd_mach_mcf_isa_aplus, "m68k:isa-aplus",
        FALSE, &arch_info_struct[13]),
!     N(bfd_mach_mcf_isa_aplus_mac, "m68k:isa-aplus:mac",
        FALSE, &arch_info_struct[14]),
!     N(bfd_mach_mcf_isa_aplus_emac, "m68k:isa-aplus:emac",
        FALSE, &arch_info_struct[15]),
!     N(bfd_mach_mcf_isa_b_nousp, "m68k:isa-b:nousp",
        FALSE, &arch_info_struct[16]),
!     N(bfd_mach_mcf_isa_b_nousp_mac, "m68k:isa-b:nousp:mac",
        FALSE, &arch_info_struct[17]),
!     N(bfd_mach_mcf_isa_b_nousp_emac, "m68k:isa-b:nousp:emac",
        FALSE, &arch_info_struct[18]),
      N(bfd_mach_mcf_isa_b, "m68k:isa-b",
        FALSE, &arch_info_struct[19]),
*************** static const bfd_arch_info_type arch_inf
*** 65,92 ****
        FALSE, &arch_info_struct[20]),
      N(bfd_mach_mcf_isa_b_emac, "m68k:isa-b:emac",
        FALSE, &arch_info_struct[21]),
!     N(bfd_mach_mcf_isa_b_usp_float, "m68k:isa-b:usp:float",
        FALSE, &arch_info_struct[22]),
!     N(bfd_mach_mcf_isa_b_usp_float_mac, "m68k:isa-b:usp:float:mac",
        FALSE, &arch_info_struct[23]),
!     N(bfd_mach_mcf_isa_b_usp_float_emac, "m68k:isa-b:usp:float:emac",
        FALSE, &arch_info_struct[24]),
  
      /* Legacy names for CF architectures */
!     N(bfd_mach_mcf_isa_a, "m68k:5200",  FALSE, &arch_info_struct[25]),
!     N(bfd_mach_mcf_isa_a_div_mac,"m68k:5206e", FALSE, &arch_info_struct[26]),
!     N(bfd_mach_mcf_isa_a_div_mac, "m68k:5307",  FALSE, &arch_info_struct[27]),
!     N(bfd_mach_mcf_isa_b_mac, "m68k:5407",  FALSE, &arch_info_struct[28]),
!     N(bfd_mach_mcf_isa_aplus_usp_emac, "m68k:528x",
!       FALSE, &arch_info_struct[29]),
!     N(bfd_mach_mcf_isa_aplus_usp_emac, "m68k:521x",
!       FALSE, &arch_info_struct[30]),
!     N(bfd_mach_mcf_isa_a_div_emac, "m68k:5249",  FALSE, &arch_info_struct[31]),
!     N(bfd_mach_mcf_isa_b_usp_float_emac, "m68k:547x",
        FALSE, &arch_info_struct[32]),
!     N(bfd_mach_mcf_isa_b_usp_float_emac, "m68k:548x",
        FALSE, &arch_info_struct[33]),
!     N(bfd_mach_mcf_isa_b_usp_float_emac,  "m68k:cfv4e", FALSE, 0),
    };
  
  const bfd_arch_info_type bfd_m68k_arch =
--- 69,94 ----
        FALSE, &arch_info_struct[20]),
      N(bfd_mach_mcf_isa_b_emac, "m68k:isa-b:emac",
        FALSE, &arch_info_struct[21]),
!     N(bfd_mach_mcf_isa_b_float, "m68k:isa-b:float",
        FALSE, &arch_info_struct[22]),
!     N(bfd_mach_mcf_isa_b_float_mac, "m68k:isa-b:float:mac",
        FALSE, &arch_info_struct[23]),
!     N(bfd_mach_mcf_isa_b_float_emac, "m68k:isa-b:float:emac",
        FALSE, &arch_info_struct[24]),
  
      /* Legacy names for CF architectures */
!     N(bfd_mach_mcf_isa_a_nodiv, "m68k:5200", FALSE, &arch_info_struct[25]),
!     N(bfd_mach_mcf_isa_a_mac,"m68k:5206e", FALSE, &arch_info_struct[26]),
!     N(bfd_mach_mcf_isa_a_mac, "m68k:5307", FALSE, &arch_info_struct[27]),
!     N(bfd_mach_mcf_isa_b_nousp_mac, "m68k:5407", FALSE, &arch_info_struct[28]),
!     N(bfd_mach_mcf_isa_aplus_emac, "m68k:528x", FALSE, &arch_info_struct[29]),
!     N(bfd_mach_mcf_isa_aplus_emac, "m68k:521x", FALSE, &arch_info_struct[30]),
!     N(bfd_mach_mcf_isa_a_emac, "m68k:5249", FALSE, &arch_info_struct[31]),
!     N(bfd_mach_mcf_isa_b_float_emac, "m68k:547x",
        FALSE, &arch_info_struct[32]),
!     N(bfd_mach_mcf_isa_b_float_emac, "m68k:548x",
        FALSE, &arch_info_struct[33]),
!     N(bfd_mach_mcf_isa_b_float_emac, "m68k:cfv4e", FALSE, 0),
    };
  
  const bfd_arch_info_type bfd_m68k_arch =
*************** static const unsigned m68k_arch_features
*** 109,123 ****
    mcfisa_a|mcfhwdiv,
    mcfisa_a|mcfhwdiv|mcfmac,
    mcfisa_a|mcfhwdiv|mcfemac,
-   mcfisa_a|mcfisa_aa|mcfhwdiv,
-   mcfisa_a|mcfisa_aa|mcfhwdiv|mcfmac,
-   mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac,
    mcfisa_a|mcfisa_aa|mcfhwdiv|mcfusp,
    mcfisa_a|mcfisa_aa|mcfhwdiv|mcfusp|mcfmac,
    mcfisa_a|mcfisa_aa|mcfhwdiv|mcfusp|mcfemac,
    mcfisa_a|mcfhwdiv|mcfisa_b,
    mcfisa_a|mcfhwdiv|mcfisa_b|mcfmac,
    mcfisa_a|mcfhwdiv|mcfisa_b|mcfemac,
    mcfisa_a|mcfhwdiv|mcfisa_b|mcfusp|cfloat,
    mcfisa_a|mcfhwdiv|mcfisa_b|mcfusp|cfloat|mcfmac,
    mcfisa_a|mcfhwdiv|mcfisa_b|mcfusp|cfloat|mcfemac,
--- 111,125 ----
    mcfisa_a|mcfhwdiv,
    mcfisa_a|mcfhwdiv|mcfmac,
    mcfisa_a|mcfhwdiv|mcfemac,
    mcfisa_a|mcfisa_aa|mcfhwdiv|mcfusp,
    mcfisa_a|mcfisa_aa|mcfhwdiv|mcfusp|mcfmac,
    mcfisa_a|mcfisa_aa|mcfhwdiv|mcfusp|mcfemac,
    mcfisa_a|mcfhwdiv|mcfisa_b,
    mcfisa_a|mcfhwdiv|mcfisa_b|mcfmac,
    mcfisa_a|mcfhwdiv|mcfisa_b|mcfemac,
+   mcfisa_a|mcfhwdiv|mcfisa_b|mcfusp,
+   mcfisa_a|mcfhwdiv|mcfisa_b|mcfusp|mcfmac,
+   mcfisa_a|mcfhwdiv|mcfisa_b|mcfusp|mcfemac,
    mcfisa_a|mcfhwdiv|mcfisa_b|mcfusp|cfloat,
    mcfisa_a|mcfhwdiv|mcfisa_b|mcfusp|cfloat|mcfmac,
    mcfisa_a|mcfhwdiv|mcfisa_b|mcfusp|cfloat|mcfemac,
*************** int bfd_m68k_features_to_mach (unsigned 
*** 181,183 ****
--- 183,218 ----
      }
    return superset ? superset : subset;
  }
+ 
+ static const bfd_arch_info_type *
+ bfd_m68k_compatible (const bfd_arch_info_type *a,
+ 		     const bfd_arch_info_type *b)
+ {
+   if (a->arch != b->arch)
+     return NULL;
+ 
+   if (a->bits_per_word != b->bits_per_word)
+     return NULL;
+ 
+   if (!a->mach)
+     return b;
+   if (!b->mach)
+     return a;
+   
+   if (a->mach <= bfd_mach_m68060 && b->mach <= bfd_mach_m68060)
+     /* Merge m68k machine. */
+     return a->mach > b->mach ? a : b;
+   else if (a->mach >= bfd_mach_mcf_isa_a_nodiv
+ 	   && b->mach >= bfd_mach_mcf_isa_a_nodiv)
+     {
+       /* Merge cf machine.  */
+       unsigned features = (bfd_m68k_mach_to_features (a->mach)
+ 			   | bfd_m68k_mach_to_features (b->mach));
+       unsigned machine = bfd_m68k_features_to_mach (features);
+ 
+       return bfd_lookup_arch (a->arch, machine);
+     }
+   else
+     /* They are incompatible.  */
+     return NULL;
+ }
Index: bfd/elf32-m68k.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m68k.c,v
retrieving revision 1.86
diff -c -3 -p -r1.86 elf32-m68k.c
*** bfd/elf32-m68k.c	27 Feb 2006 08:48:28 -0000	1.86
--- bfd/elf32-m68k.c	6 Mar 2006 13:30:52 -0000
*************** elf32_m68k_object_p (bfd *abfd)
*** 390,407 ****
      {
        switch (eflags & EF_M68K_ISA_MASK)
  	{
! 	case EF_M68K_ISA_B:
! 	  features |= mcfisa_b;
! 	  /* FALLTHROUGH */
! 	case EF_M68K_ISA_A_PLUS:
! 	  features |= mcfisa_aa;
! 	  /* FALLTHROUGH */
! 	case EF_M68K_ISA_A:
  	  features |= mcfisa_a;
  	  break;
  	}
-       if (eflags & EF_M68K_HW_DIV)
- 	features |= mcfhwdiv;
        switch (eflags & EF_M68K_MAC_MASK)
  	{
  	case EF_M68K_MAC:
--- 390,411 ----
      {
        switch (eflags & EF_M68K_ISA_MASK)
  	{
! 	case EF_M68K_ISA_A_NODIV:
  	  features |= mcfisa_a;
  	  break;
+ 	case EF_M68K_ISA_A:
+ 	  features |= mcfisa_a|mcfhwdiv;
+ 	  break;
+ 	case EF_M68K_ISA_A_PLUS:
+ 	  features |= mcfisa_a|mcfisa_aa|mcfhwdiv|mcfusp;
+ 	  break;
+ 	case EF_M68K_ISA_B_NOUSP:
+ 	  features |= mcfisa_a|mcfisa_b|mcfhwdiv;
+ 	  break;
+ 	case EF_M68K_ISA_B:
+ 	  features |= mcfisa_a|mcfisa_b|mcfhwdiv|mcfusp;
+ 	  break;
  	}
        switch (eflags & EF_M68K_MAC_MASK)
  	{
  	case EF_M68K_MAC:
*************** elf32_m68k_object_p (bfd *abfd)
*** 411,418 ****
  	  features |= mcfemac;
  	  break;
  	}
-       if (eflags & EF_M68K_USP)
- 	features |= mcfusp;
        if (eflags & EF_M68K_FLOAT)
  	features |= cfloat;
      }
--- 415,420 ----
*************** elf32_m68k_merge_private_bfd_data (ibfd,
*** 462,468 ****
  	  if (in_mach > out_mach)
  	    out_mach = in_mach;
  	}
!       else if (in_mach >= bfd_mach_mcf_isa_a && out_mach >= bfd_mach_mcf_isa_a)
  	/* Merge cf machine.  */
  	out_mach = bfd_m68k_features_to_mach
  	  (bfd_m68k_mach_to_features (in_mach)
--- 464,471 ----
  	  if (in_mach > out_mach)
  	    out_mach = in_mach;
  	}
!       else if (in_mach >= bfd_mach_mcf_isa_a_nodiv
! 	       && out_mach >= bfd_mach_mcf_isa_a_nodiv)
  	/* Merge cf machine.  */
  	out_mach = bfd_m68k_features_to_mach
  	  (bfd_m68k_mach_to_features (in_mach)
*************** elf32_m68k_merge_private_bfd_data (ibfd,
*** 483,509 ****
      }
    else
      {
        /* Copy legacy flags.  */
        out_flags |= in_flags & (EF_M68K_CPU32 | EF_M68K_M68000 | EF_M68K_CFV4E);
  
!       if (((in_flags | out_flags) & EF_M68K_ISA_MASK)
  	  && ((in_flags | out_flags) & (EF_M68K_CPU32 | EF_M68K_M68000)))
  	/* Mixing m68k and cf is not allowed */
  	return FALSE;
        
!       if (in_flags & EF_M68K_ISA_MASK)
  	{
! 	  if (out_flags & EF_M68K_ISA_MASK)
  	    {
! 	      /* Merge cf specific flags */
! 	      if ((in_flags & EF_M68K_ISA_MASK)
! 		  > (out_flags & EF_M68K_ISA_MASK))
! 		{
! 		  out_flags ^= out_flags & EF_M68K_ISA_MASK;
! 		  out_flags |= in_flags & EF_M68K_ISA_MASK;
! 		}
! 	      out_flags |= in_flags
! 		& (EF_M68K_HW_DIV | EF_M68K_USP | EF_M68K_FLOAT);
  	      if (in_flags & EF_M68K_MAC_MASK)
  		{
  		  if (!(out_flags & EF_M68K_MAC_MASK))
--- 486,522 ----
      }
    else
      {
+       flagword isa_in = in_flags & EF_M68K_ISA_MASK;
+       flagword isa_out = out_flags & EF_M68K_ISA_MASK;
+       
+       
        /* Copy legacy flags.  */
        out_flags |= in_flags & (EF_M68K_CPU32 | EF_M68K_M68000 | EF_M68K_CFV4E);
  
!       if ((isa_in | isa_out)
  	  && ((in_flags | out_flags) & (EF_M68K_CPU32 | EF_M68K_M68000)))
  	/* Mixing m68k and cf is not allowed */
  	return FALSE;
        
!       if (isa_in)
  	{
! 	  if (isa_out)
  	    {
! 	      if (isa_out == EF_M68K_ISA_A_PLUS
! 		  && (isa_in == EF_M68K_ISA_B_NOUSP
! 		      || isa_in == EF_M68K_ISA_B))
! 		/* Cannot mix A+ and B */
! 		return FALSE;
! 	      if (isa_in == EF_M68K_ISA_A_PLUS
! 		  && (isa_out == EF_M68K_ISA_B_NOUSP
! 		      || isa_out == EF_M68K_ISA_B))
! 		/* Cannot mix B and A+ */
! 		return FALSE;
! 	      
! 	      if (isa_in > isa_out)
! 		out_flags ^= isa_in ^ isa_out;
! 
! 	      out_flags |= in_flags & EF_M68K_FLOAT;
  	      if (in_flags & EF_M68K_MAC_MASK)
  		{
  		  if (!(out_flags & EF_M68K_MAC_MASK))
*************** elf32_m68k_print_private_bfd_data (abfd,
*** 559,580 ****
      {
        char const *isa = _("unknown");
        char const *mac = _("unknown");
        
        switch (eflags & EF_M68K_ISA_MASK)
  	{
  	case EF_M68K_ISA_A:
  	  isa = "A";
  	  break;
  	case EF_M68K_ISA_A_PLUS:
  	  isa = "A+";
  	  break;
  	case EF_M68K_ISA_B:
  	  isa = "B";
  	  break;
  	}
!       fprintf (file, " [isa %s]", isa);
!       if (eflags & EF_M68K_HW_DIV)
! 	fprintf (file, " [hwdiv]");
        switch (eflags & EF_M68K_MAC_MASK)
  	{
  	case 0:
--- 572,602 ----
      {
        char const *isa = _("unknown");
        char const *mac = _("unknown");
+       char const *additional = "";
        
        switch (eflags & EF_M68K_ISA_MASK)
  	{
+ 	case EF_M68K_ISA_A_NODIV:
+ 	  isa = "A";
+ 	  additional = " [nodiv]";
+ 	  break;
  	case EF_M68K_ISA_A:
  	  isa = "A";
  	  break;
  	case EF_M68K_ISA_A_PLUS:
  	  isa = "A+";
  	  break;
+ 	case EF_M68K_ISA_B_NOUSP:
+ 	  isa = "B";
+ 	  additional = " [nousp]";
+ 	  break;
  	case EF_M68K_ISA_B:
  	  isa = "B";
  	  break;
  	}
!       fprintf (file, " [isa %s]%s", isa, additional);
!       if (eflags & EF_M68K_FLOAT)
! 	fprintf (file, " [float]");
        switch (eflags & EF_M68K_MAC_MASK)
  	{
  	case 0:
*************** elf32_m68k_print_private_bfd_data (abfd,
*** 589,598 ****
  	}
        if (mac)
  	fprintf (file, " [%s]", mac);
-       if (eflags & EF_M68K_USP)
- 	fprintf (file, " [usp");
-       if (eflags & EF_M68K_FLOAT)
- 	fprintf (file, " [float]");
      }
    
    fputc ('\n', file);
--- 611,616 ----
Index: bfd/ieee.c
===================================================================
RCS file: /cvs/src/src/bfd/ieee.c,v
retrieving revision 1.52
diff -c -3 -p -r1.52 ieee.c
*** bfd/ieee.c	7 Feb 2006 19:01:09 -0000	1.52
--- bfd/ieee.c	6 Mar 2006 13:30:54 -0000
*************** ieee_write_processor (bfd *abfd)
*** 3466,3487 ****
  	  case bfd_mach_m68040: id = "68040"; break;
  	  case bfd_mach_m68060: id = "68060"; break;
  	  case bfd_mach_cpu32:  id = "cpu32"; break;
  	  case bfd_mach_mcf_isa_a: id = "isa-a"; break;
! 	  case bfd_mach_mcf_isa_a_div: id = "isa-a:div"; break;
! 	  case bfd_mach_mcf_isa_a_div_mac: id = "isa-a:div:mac"; break;
! 	  case bfd_mach_mcf_isa_a_div_emac: id = "isa-a:div:emac"; break;
! 	  case bfd_mach_mcf_isa_aplus: id = "isa-a+"; break;
! 	  case bfd_mach_mcf_isa_aplus_mac: id = "isa-a+:mac"; break;
! 	  case bfd_mach_mcf_isa_aplus_emac: id = "isa-a+:mac"; break;
! 	  case bfd_mach_mcf_isa_aplus_usp: id = "isa-a+:usp"; break;
! 	  case bfd_mach_mcf_isa_aplus_usp_mac: id = "isa-a+:usp:mac"; break;
! 	  case bfd_mach_mcf_isa_aplus_usp_emac: id = "isa-a+:usp:emac"; break;
  	  case bfd_mach_mcf_isa_b: id = "isa-b"; break;
  	  case bfd_mach_mcf_isa_b_mac: id = "isa-b:mac"; break;
  	  case bfd_mach_mcf_isa_b_emac: id = "isa-b:emac"; break;
! 	  case bfd_mach_mcf_isa_b_usp_float: id = "isa-b:usp:float"; break;
! 	  case bfd_mach_mcf_isa_b_usp_float_mac: id = "isa-b:usp:float:mac"; break;
! 	  case bfd_mach_mcf_isa_b_usp_float_emac: id = "isa-b:usp:float:emac"; break;
  	  }
  
  	if (! ieee_write_id (abfd, id))
--- 3466,3487 ----
  	  case bfd_mach_m68040: id = "68040"; break;
  	  case bfd_mach_m68060: id = "68060"; break;
  	  case bfd_mach_cpu32:  id = "cpu32"; break;
+ 	  case bfd_mach_mcf_isa_a_nodiv: id = "isa-a:nodiv"; break;
  	  case bfd_mach_mcf_isa_a: id = "isa-a"; break;
! 	  case bfd_mach_mcf_isa_a_mac: id = "isa-a:mac"; break;
! 	  case bfd_mach_mcf_isa_a_emac: id = "isa-a:emac"; break;
! 	  case bfd_mach_mcf_isa_aplus: id = "isa-aplus"; break;
! 	  case bfd_mach_mcf_isa_aplus_mac: id = "isa-aplus:mac"; break;
! 	  case bfd_mach_mcf_isa_aplus_emac: id = "isa-aplus:mac"; break;
! 	  case bfd_mach_mcf_isa_b_nousp: id = "isa-b:nousp"; break;
! 	  case bfd_mach_mcf_isa_b_nousp_mac: id = "isa-b:nousp:mac"; break;
! 	  case bfd_mach_mcf_isa_b_nousp_emac: id = "isa-b:nousp:emac"; break;
  	  case bfd_mach_mcf_isa_b: id = "isa-b"; break;
  	  case bfd_mach_mcf_isa_b_mac: id = "isa-b:mac"; break;
  	  case bfd_mach_mcf_isa_b_emac: id = "isa-b:emac"; break;
! 	  case bfd_mach_mcf_isa_b_float: id = "isa-b:float"; break;
! 	  case bfd_mach_mcf_isa_b_float_mac: id = "isa-b:float:mac"; break;
! 	  case bfd_mach_mcf_isa_b_float_emac: id = "isa-b:float:emac"; break;
  	  }
  
  	if (! ieee_write_id (abfd, id))
Index: binutils/readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.338
diff -c -3 -p -r1.338 readelf.c
*** binutils/readelf.c	17 Feb 2006 14:36:21 -0000	1.338
--- binutils/readelf.c	6 Mar 2006 13:30:59 -0000
*************** get_machine_flags (unsigned e_flags, uns
*** 1949,1971 ****
  	    {
  	      char const *isa = _("unknown");
  	      char const *mac = _("unknown mac");
        
  	      switch (e_flags & EF_M68K_ISA_MASK)
  		{
  		case EF_M68K_ISA_A:
  		  isa = "A";
  		  break;
  		case EF_M68K_ISA_A_PLUS:
  		  isa = "A+";
  		  break;
  		case EF_M68K_ISA_B:
  		  isa = "B";
  		  break;
  		}
  	      strcat (buf, ", cf, isa ");
  	      strcat (buf, isa);
! 	      if (e_flags & EF_M68K_HW_DIV)
! 		strcat (buf, ", hwdiv");
  	      switch (e_flags & EF_M68K_MAC_MASK)
  		{
  		case 0:
--- 1949,1982 ----
  	    {
  	      char const *isa = _("unknown");
  	      char const *mac = _("unknown mac");
+ 	      char const *additional = NULL;
        
  	      switch (e_flags & EF_M68K_ISA_MASK)
  		{
+ 		case EF_M68K_ISA_A_NODIV:
+ 		  isa = "A";
+ 		  additional = ", nodiv";
+ 		  break;
  		case EF_M68K_ISA_A:
  		  isa = "A";
  		  break;
  		case EF_M68K_ISA_A_PLUS:
  		  isa = "A+";
  		  break;
+ 		case EF_M68K_ISA_B_NOUSP:
+ 		  isa = "B";
+ 		  additional = ", nousp";
+ 		  break;
  		case EF_M68K_ISA_B:
  		  isa = "B";
  		  break;
  		}
  	      strcat (buf, ", cf, isa ");
  	      strcat (buf, isa);
! 	      if (additional)
! 		strcat (buf, additional);
! 	      if (e_flags & EF_M68K_FLOAT)
! 		strcat (buf, ", float");
  	      switch (e_flags & EF_M68K_MAC_MASK)
  		{
  		case 0:
*************** get_machine_flags (unsigned e_flags, uns
*** 1983,1992 ****
  		  strcat (buf, ", ");
  		  strcat (buf, mac);
  		}
- 	      if (e_flags & EF_M68K_USP)
- 		strcat (buf, ", usp");
- 	      if (e_flags & EF_M68K_FLOAT)
- 		strcat (buf, ", float");
  	    }
  	  break;
  
--- 1994,1999 ----
Index: gas/config/tc-m68k.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-m68k.c,v
retrieving revision 1.71
diff -c -3 -p -r1.71 tc-m68k.c
*** gas/config/tc-m68k.c	7 Feb 2006 19:01:09 -0000	1.71
--- gas/config/tc-m68k.c	6 Mar 2006 13:31:04 -0000
*************** struct m68k_cpu
*** 368,374 ****
    unsigned long arch;	/* Architecture features.  */
    unsigned long chip;	/* Specific chip */
    const char *name;	/* Name */
!   unsigned alias;
  };
  
  /* We hold flags for features explicitly enabled and explicitly
--- 368,378 ----
    unsigned long arch;	/* Architecture features.  */
    unsigned long chip;	/* Specific chip */
    const char *name;	/* Name */
!   int alias;       	/* Alias for a cannonical name.  If 1, then
! 			   succeeds canonical name, if -1 then
! 			   succeeds canonical name, if <-1 ||>1 this is a
! 			   deprecated name, and the next/previous name
! 			   should be used. */
  };
  
  /* We hold flags for features explicitly enabled and explicitly
*************** static const struct m68k_cpu m68k_archs[
*** 391,413 ****
    {m68060,					cpu_m68060, "68060", 0},
    {cpu32|m68881,				cpu_cpu32, "cpu32", 0},
    {mcfisa_a|mcfhwdiv,				0, "isaa", 0},
!   {mcfisa_a|mcfhwdiv|mcfisa_aa,			0, "isaaplus", 0},
!   {mcfisa_a|mcfhwdiv|mcfisa_b,			0, "isab", 0},
    {mcfisa_a|mcfhwdiv|mcfisa_b|mcfemac|mcfusp|cfloat,
     cpu_cf547x, "cfv4e", 0},
    {0,0,NULL, 0}
  };
  
! /* Architecture extensions.  */
  static const struct m68k_cpu m68k_extensions[] =
  {
!   {m68851,					0, "68851", 0},
!   {m68881,					0, "68881", 0},
!   {m68881,					0, "68882", 0},
    
    {mcfhwdiv,					0, "div", 1},
    {mcfusp,					0, "usp", 1},
-   {cfloat,					0, "float", 1},
    {mcfmac,					0, "mac", 1},
    {mcfemac,					0, "emac", 1},
     
--- 395,419 ----
    {m68060,					cpu_m68060, "68060", 0},
    {cpu32|m68881,				cpu_cpu32, "cpu32", 0},
    {mcfisa_a|mcfhwdiv,				0, "isaa", 0},
!   {mcfisa_a|mcfhwdiv|mcfisa_aa|mcfusp,		0, "isaaplus", 0},
!   {mcfisa_a|mcfhwdiv|mcfisa_b|mcfusp,		0, "isab", 0},
    {mcfisa_a|mcfhwdiv|mcfisa_b|mcfemac|mcfusp|cfloat,
     cpu_cf547x, "cfv4e", 0},
    {0,0,NULL, 0}
  };
  
! /* Architecture extensions, here 'alias' -1 for m68k, +1 for cf and 0
!    for either.  */
  static const struct m68k_cpu m68k_extensions[] =
  {
!   {m68851,					0, "68851", -1},
!   {m68881,					0, "68881", -1},
!   {m68881,					0, "68882", -1},
!   
!   {cfloat|m68881,				0, "float", 0},
    
    {mcfhwdiv,					0, "div", 1},
    {mcfusp,					0, "usp", 1},
    {mcfmac,					0, "mac", 1},
    {mcfemac,					0, "emac", 1},
     
*************** static const struct m68k_cpu m68k_cpus[]
*** 426,438 ****
    { cpu32|m68881,				cpu_cpu32, "cpu32",  0},
    { mcfisa_a,					cpu_cf5200, "5200", 0},
    { mcfisa_a|mcfhwdiv|mcfmac,			cpu_cf5206e, "5206e", 0},
!   { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfmac,	cpu_cf5208, "5208", 0},
!   { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfmac,	cpu_cf5213, "5213", 0},
    { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac|mcfusp,cpu_cf521x, "521x", 0},
    { mcfisa_a|mcfhwdiv|mcfemac,		cpu_cf5249, "5249", 0},
    { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac|mcfusp,cpu_cf528x, "528x", 0},
    { mcfisa_a|mcfhwdiv|mcfmac,			cpu_cf5307, "5307", 0},
!   { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac,	cpu_cf5329, "5329", 0},
    { mcfisa_a|mcfhwdiv|mcfisa_b|mcfmac,	cpu_cf5407, "5407",0},
    { mcfisa_a|mcfhwdiv|mcfisa_b|mcfemac|mcfusp|cfloat,
      cpu_cf547x, "547x", 0},
--- 432,444 ----
    { cpu32|m68881,				cpu_cpu32, "cpu32",  0},
    { mcfisa_a,					cpu_cf5200, "5200", 0},
    { mcfisa_a|mcfhwdiv|mcfmac,			cpu_cf5206e, "5206e", 0},
!   { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfmac|mcfusp,	cpu_cf5208, "5208", 0},
!   { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfmac|mcfusp,	cpu_cf5213, "5213", 0},
    { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac|mcfusp,cpu_cf521x, "521x", 0},
    { mcfisa_a|mcfhwdiv|mcfemac,		cpu_cf5249, "5249", 0},
    { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac|mcfusp,cpu_cf528x, "528x", 0},
    { mcfisa_a|mcfhwdiv|mcfmac,			cpu_cf5307, "5307", 0},
!   { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac|mcfusp,	cpu_cf5329, "5329", 0},
    { mcfisa_a|mcfhwdiv|mcfisa_b|mcfmac,	cpu_cf5407, "5407",0},
    { mcfisa_a|mcfhwdiv|mcfisa_b|mcfemac|mcfusp|cfloat,
      cpu_cf547x, "547x", 0},
*************** static const struct m68k_cpu m68k_cpus[]
*** 467,482 ****
    { mcfisa_a,					cpu_cf5200, "5202", 1},
    { mcfisa_a,					cpu_cf5200, "5204", 1},
    { mcfisa_a,					cpu_cf5200, "5206", 1},
!   { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfmac,		cpu_cf5208, "5207", 1},
!   { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfmac,		cpu_cf5213, "5211", 1},
!   { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfmac,		cpu_cf5213, "5212", 1},
!   { mcfisa_a|mcfhwdiv|mcfisa_aa|mcfemac,	cpu_cf521x, "5214", 1},
!   { mcfisa_a|mcfhwdiv|mcfisa_aa|mcfemac,	cpu_cf521x, "5216", 1},
!   { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac,	cpu_cf5329, "5327", 1},
!   { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac,	cpu_cf5329, "5328", 1},
!   { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac,	cpu_cf528x, "5280", 1},
!   { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac,	cpu_cf528x, "5281", 1},
!   { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac,	cpu_cf528x, "5282", 1},
    { mcfisa_a|mcfhwdiv|mcfisa_b|mcfmac,	cpu_cf5407,	"cfv4", 1 },
    { mcfisa_a|mcfhwdiv|mcfisa_b|mcfemac|mcfusp|cfloat,
      cpu_cf547x, "cfv4e", 1 },
--- 473,488 ----
    { mcfisa_a,					cpu_cf5200, "5202", 1},
    { mcfisa_a,					cpu_cf5200, "5204", 1},
    { mcfisa_a,					cpu_cf5200, "5206", 1},
!   { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfmac|mcfusp,	cpu_cf5208, "5207", 1},
!   { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfmac|mcfusp,	cpu_cf5213, "5211", 1},
!   { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfmac|mcfusp,	cpu_cf5213, "5212", 1},
!   { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac|mcfusp,	cpu_cf521x, "5214", 1},
!   { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac|mcfusp,	cpu_cf521x, "5216", 1},
!   { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac|mcfusp,	cpu_cf5329, "5327", 1},
!   { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac|mcfusp,	cpu_cf5329, "5328", 1},
!   { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac|mcfusp,	cpu_cf528x, "5280", 1},
!   { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac|mcfusp,	cpu_cf528x, "5281", 1},
!   { mcfisa_a|mcfisa_aa|mcfhwdiv|mcfemac|mcfusp,	cpu_cf528x, "5282", 1},
    { mcfisa_a|mcfhwdiv|mcfisa_b|mcfmac,	cpu_cf5407,	"cfv4", 1 },
    { mcfisa_a|mcfhwdiv|mcfisa_b|mcfemac|mcfusp|cfloat,
      cpu_cf547x, "cfv4e", 1 },
*************** m68k_ip (char *instring)
*** 1700,1710 ****
  		case 'J':
  		  if (opP->mode != CONTROL
  		      || opP->reg < USP
! 		      || opP->reg > last_movec_reg)
  		    losing++;
  		  else
  		    {
  		      const enum m68k_register *rp;
  		      for (rp = control_regs; *rp; rp++)
  			if (*rp == opP->reg)
  			  break;
--- 1706,1718 ----
  		case 'J':
  		  if (opP->mode != CONTROL
  		      || opP->reg < USP
! 		      || opP->reg > last_movec_reg
! 		      || !control_regs)
  		    losing++;
  		  else
  		    {
  		      const enum m68k_register *rp;
+ 		      
  		      for (rp = control_regs; *rp; rp++)
  			if (*rp == opP->reg)
  			  break;
*************** md_parse_option (int c, char *arg)
*** 7271,7276 ****
--- 7279,7286 ----
  	m68k_set_cpu (arg + 4, 1, 0);
        else if (m68k_set_extension (arg, 0, 1))
  	;
+       else if (m68k_set_arch (arg, 0, 1))
+ 	;
        else if (m68k_set_cpu (arg, 0, 1))
  	;
        else
*************** md_parse_option (int c, char *arg)
*** 7289,7323 ****
  static void
  m68k_init_arch (void)
  {
-   unsigned arch_of_chip = 0;
-   
    if (not_current_architecture & current_architecture)
      {
        as_bad (_("architecture features both enabled and disabled"));
        not_current_architecture &= ~current_architecture;
      }
    if (selected_arch)
      {
!       arch_of_chip = selected_arch->arch;
!       current_chip = selected_arch->chip;
!       if (selected_cpu && (arch_of_chip & ~selected_cpu->arch))
  	{
! 	  as_bad (_("selected processor is not from selected architecture"));
! 	  arch_of_chip = selected_cpu->arch;
  	}
      }
-   else
-     arch_of_chip = selected_cpu->arch;
-   if (selected_cpu)
-     current_chip = selected_cpu->chip;
  
!   current_architecture |= arch_of_chip;
!   current_architecture &= ~not_current_architecture;
    if ((current_architecture & m68k_mask)
        && (current_architecture & ~m68k_mask))
      {
        as_bad (_ ("m68k and cf features both selected"));
!       if (arch_of_chip & m68k_mask)
  	current_architecture &= m68k_mask;
        else
  	current_architecture &= ~m68k_mask;
--- 7299,7340 ----
  static void
  m68k_init_arch (void)
  {
    if (not_current_architecture & current_architecture)
      {
        as_bad (_("architecture features both enabled and disabled"));
        not_current_architecture &= ~current_architecture;
      }
    if (selected_arch)
+     current_architecture |= selected_arch->arch;
+   else
+     current_architecture |= selected_cpu->arch;
+ 
+   current_architecture &= ~not_current_architecture;
+   
+   if (selected_cpu)
      {
!       if (current_architecture & ~selected_cpu->arch)
  	{
! 	  as_bad (_("selected processor does not have all features of selected architecture"));
! 	  current_architecture
! 	    = selected_cpu->arch & ~not_current_architecture;
  	}
      }
  
!   if ((current_architecture & (cfloat | m68881)) == (cfloat | m68881))
!     {
!       /* Determine which float is really meant.  */
!       if (current_architecture & (m68k_mask & ~m68881))
! 	current_architecture ^= cfloat;
!       else
! 	current_architecture ^= m68881;
!     }
! 
    if ((current_architecture & m68k_mask)
        && (current_architecture & ~m68k_mask))
      {
        as_bad (_ ("m68k and cf features both selected"));
!       if (current_architecture & m68k_mask)
  	current_architecture &= m68k_mask;
        else
  	current_architecture &= ~m68k_mask;
*************** md_show_usage (FILE *stream)
*** 7375,7382 ****
  "), default_cpu);
    for (i = 0; m68k_extensions[i].name; i++)
      fprintf (stream, _("\
! -m[no-]%-16s enable/disable %s architecture extension\n\
! "), m68k_extensions[i].name, m68k_extensions[i].alias ? "ColdFire" : "m68k");
    
    fprintf (stream, _("\
  -l			use 1 word for refs to undefined symbols [default 2]\n\
--- 7392,7401 ----
  "), default_cpu);
    for (i = 0; m68k_extensions[i].name; i++)
      fprintf (stream, _("\
! -m[no-]%-16s enable/disable%s architecture extension\n\
! "), m68k_extensions[i].name,
! 	     m68k_extensions[i].alias > 0 ? " ColdFire"
! 	     : m68k_extensions[i].alias < 0 ? " m68k" : "");
    
    fprintf (stream, _("\
  -l			use 1 word for refs to undefined symbols [default 2]\n\
*************** m68k_elf_final_processing (void)
*** 7568,7594 ****
    
    if (current_architecture & mcfisa_a)
      {
!       /* Set coldfire specific elf flags */
!       if (current_architecture & mcfisa_b)
! 	flags |= EF_M68K_ISA_B;
!       else if (current_architecture & mcfisa_aa)
! 	flags |= EF_M68K_ISA_A_PLUS;
!       else
! 	flags |= EF_M68K_ISA_A;
! 
!       if (current_architecture & mcfhwdiv)
! 	flags |= EF_M68K_HW_DIV;
! 
!       if (current_architecture & mcfusp)
! 	flags |= EF_M68K_USP;
        
!       if (current_architecture & cfloat)
! 	flags |= EF_M68K_FLOAT;
  
!       if (current_architecture & mcfmac)
! 	flags |= EF_M68K_MAC;
!       else if (current_architecture & mcfemac)
! 	flags |= EF_M68K_EMAC;
      }
    elf_elfheader (stdoutput)->e_flags |= flags;
  }
--- 7587,7645 ----
    
    if (current_architecture & mcfisa_a)
      {
!       static const unsigned isa_features[][2] =
!       {
! 	{EF_M68K_ISA_A_NODIV, mcfisa_a},
! 	{EF_M68K_ISA_A,	mcfisa_a|mcfhwdiv},
! 	{EF_M68K_ISA_A_PLUS,mcfisa_a|mcfisa_aa|mcfhwdiv|mcfusp},
! 	{EF_M68K_ISA_B_NOUSP,mcfisa_a|mcfisa_b|mcfhwdiv},
! 	{EF_M68K_ISA_B,	mcfisa_a|mcfisa_b|mcfhwdiv|mcfusp},
! 	{0,0},
!       };
!       static const unsigned mac_features[][2] =
!       {
! 	{EF_M68K_MAC, mcfmac},
! 	{EF_M68K_EMAC, mcfemac},
! 	{0,0},
!       };
!       unsigned ix;
!       unsigned pattern;
        
!       pattern = (current_architecture
! 		 & (mcfisa_a|mcfisa_aa|mcfisa_b|mcfhwdiv|mcfusp));
!       for (ix = 0; isa_features[ix][1]; ix++)
! 	{
! 	  if (pattern == isa_features[ix][1])
! 	    {
! 	      flags |= isa_features[ix][0];
! 	      break;
! 	    }
! 	}
!       if (!isa_features[ix][1])
! 	{
! 	cf_bad:
! 	  as_warn (_("Not a defined coldfire architecture"));
! 	}
!       else
! 	{
! 	  if (current_architecture & cfloat)
! 	    flags |= EF_M68K_FLOAT | EF_M68K_CFV4E;
  
! 	  pattern = current_architecture & (mcfmac|mcfemac);
! 	  if (pattern)
! 	    {
! 	      for (ix = 0; mac_features[ix][1]; ix++)
! 		{
! 		  if (pattern == mac_features[ix][1])
! 		    {
! 		      flags |= mac_features[ix][0];
! 		      break;
! 		    }
! 		}
! 	      if (!mac_features[ix][1])
! 		goto cf_bad;
! 	    }
! 	}
      }
    elf_elfheader (stdoutput)->e_flags |= flags;
  }
Index: gas/testsuite/gas/m68k/arch-cpu-1.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/m68k/arch-cpu-1.d,v
retrieving revision 1.1
diff -c -3 -p -r1.1 arch-cpu-1.d
*** gas/testsuite/gas/m68k/arch-cpu-1.d	26 Feb 2006 10:00:30 -0000	1.1
--- gas/testsuite/gas/m68k/arch-cpu-1.d	6 Mar 2006 13:31:07 -0000
***************
*** 3,9 ****
  
  
  .*:     file format elf32-m68k
! private flags = 22: \[isa A\+\] \[emac\]
  
  Disassembly of section .text:
  
--- 3,9 ----
  
  
  .*:     file format elf32-m68k
! private flags = 21: \[isa A\] \[nodiv\] \[emac\]
  
  Disassembly of section .text:
  
Index: gas/testsuite/gas/m68k/arch-cpu-1.s
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/m68k/arch-cpu-1.s,v
retrieving revision 1.1
diff -c -3 -p -r1.1 arch-cpu-1.s
*** gas/testsuite/gas/m68k/arch-cpu-1.s	26 Feb 2006 10:00:30 -0000	1.1
--- gas/testsuite/gas/m68k/arch-cpu-1.s	6 Mar 2006 13:31:07 -0000
***************
*** 1,4 ****
! 	.arch  isaaplus,no-div,emac
  	.cpu 5329
  
  	mac.w   %d1l,%a1u,<<,%acc0
--- 1,4 ----
! 	.arch  isaa,no-div,emac
  	.cpu 5329
  
  	mac.w   %d1l,%a1u,<<,%acc0
Index: include/elf/m68k.h
===================================================================
RCS file: /cvs/src/src/include/elf/m68k.h,v
retrieving revision 1.11
diff -c -3 -p -r1.11 m68k.h
*** include/elf/m68k.h	7 Feb 2006 19:01:10 -0000	1.11
--- include/elf/m68k.h	6 Mar 2006 13:31:09 -0000
*************** END_RELOC_NUMBERS (R_68K_max)
*** 58,73 ****
  
  /* We use the bottom 8 bits to encode information about the
     coldfire variant.  */
! #define EF_M68K_ISA_MASK	0x07  /* Which ISA */
! #define EF_M68K_ISA_A		0x01
! #define EF_M68K_ISA_A_PLUS	0x02
! #define EF_M68K_ISA_B		0x03
! #define EF_M68K_HW_DIV		0x08  /* Has HW divide */
  #define EF_M68K_MAC_MASK	0x30 
! #define EF_M68K_MAC		0x10  /* Has MAC */
! #define EF_M68K_EMAC		0x20  /* Has EMAC */
! #define EF_M68K_USP		0x40  /* Has USP insns */
! #define EF_M68K_FLOAT		0x80  /* Has float insns */
  #define EF_M68K_CF_MASK		0xFF
       
  #endif
--- 58,75 ----
  
  /* We use the bottom 8 bits to encode information about the
     coldfire variant.  */
! #define EF_M68K_ISA_MASK	0x0F  /* Which ISA */
! #define EF_M68K_ISA_A_NODIV	0x01  /* ISA A except for div */
! #define EF_M68K_ISA_A		0x02
! #define EF_M68K_ISA_A_PLUS	0x03
! #define EF_M68K_ISA_B_NOUSP	0x04  /* ISA_B except for USP */
! #define EF_M68K_ISA_B		0x05
! #define EF_M68K_ISA_C		0x06
  #define EF_M68K_MAC_MASK	0x30 
! #define EF_M68K_MAC		0x10  /* MAC */
! #define EF_M68K_EMAC		0x20  /* EMAC */
! #define EF_M68K_EMAC_B		0x30  /* EMAC_B */
! #define EF_M68K_FLOAT		0x40  /* Has float insns */
  #define EF_M68K_CF_MASK		0xFF
       
  #endif
Index: ld/testsuite/ld-m68k/isaa-mac.d
===================================================================
RCS file: ld/testsuite/ld-m68k/isaa-mac.d
diff -N ld/testsuite/ld-m68k/isaa-mac.d
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- ld/testsuite/ld-m68k/isaa-mac.d	6 Mar 2006 13:31:11 -0000
***************
*** 0 ****
--- 1,7 ----
+ 
+ .*:     file format elf32-m68k
+ 
+ Program Header:
+ #...
+ private flags = 12: \[isa A\] \[mac\]
+ 
Index: ld/testsuite/ld-m68k/isaa-mac.s
===================================================================
RCS file: ld/testsuite/ld-m68k/isaa-mac.s
diff -N ld/testsuite/ld-m68k/isaa-mac.s
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- ld/testsuite/ld-m68k/isaa-mac.s	6 Mar 2006 13:31:11 -0000
***************
*** 0 ****
--- 1,3 ----
+ 	.arch isaa,mac
+ 
+ 	nop
Index: ld/testsuite/ld-m68k/isaa-nodiv.s
===================================================================
RCS file: ld/testsuite/ld-m68k/isaa-nodiv.s
diff -N ld/testsuite/ld-m68k/isaa-nodiv.s
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- ld/testsuite/ld-m68k/isaa-nodiv.s	6 Mar 2006 13:31:11 -0000
***************
*** 0 ****
--- 1,3 ----
+ 	.arch isaa,no-div
+ 
+ 	nop
Index: ld/testsuite/ld-m68k/isaa.d
===================================================================
RCS file: ld/testsuite/ld-m68k/isaa.d
diff -N ld/testsuite/ld-m68k/isaa.d
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- ld/testsuite/ld-m68k/isaa.d	6 Mar 2006 13:31:11 -0000
***************
*** 0 ****
--- 1,7 ----
+ 
+ .*:     file format elf32-m68k
+ 
+ Program Header:
+ #...
+ private flags = 2: \[isa A\]
+ 
Index: ld/testsuite/ld-m68k/isaa.s
===================================================================
RCS file: ld/testsuite/ld-m68k/isaa.s
diff -N ld/testsuite/ld-m68k/isaa.s
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- ld/testsuite/ld-m68k/isaa.s	6 Mar 2006 13:31:11 -0000
***************
*** 0 ****
--- 1,3 ----
+ 	.arch isaa
+ 
+ 	nop
Index: ld/testsuite/ld-m68k/isaaplus.d
===================================================================
RCS file: ld/testsuite/ld-m68k/isaaplus.d
diff -N ld/testsuite/ld-m68k/isaaplus.d
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- ld/testsuite/ld-m68k/isaaplus.d	6 Mar 2006 13:31:11 -0000
***************
*** 0 ****
--- 1,7 ----
+ 
+ .*:     file format elf32-m68k
+ 
+ Program Header:
+ #...
+ private flags = 3: \[isa A\+\]
+ 
Index: ld/testsuite/ld-m68k/isaaplus.s
===================================================================
RCS file: ld/testsuite/ld-m68k/isaaplus.s
diff -N ld/testsuite/ld-m68k/isaaplus.s
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- ld/testsuite/ld-m68k/isaaplus.s	6 Mar 2006 13:31:11 -0000
***************
*** 0 ****
--- 1,3 ----
+ 	.arch isaaplus
+ 
+ 	nop
Index: ld/testsuite/ld-m68k/isab-float.d
===================================================================
RCS file: ld/testsuite/ld-m68k/isab-float.d
diff -N ld/testsuite/ld-m68k/isab-float.d
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- ld/testsuite/ld-m68k/isab-float.d	6 Mar 2006 13:31:11 -0000
***************
*** 0 ****
--- 1,7 ----
+ 
+ .*:     file format elf32-m68k
+ 
+ Program Header:
+ #...
+ private flags = 8045: \[cfv4e\] \[isa B\] \[float\]
+ 
Index: ld/testsuite/ld-m68k/isab-float.s
===================================================================
RCS file: ld/testsuite/ld-m68k/isab-float.s
diff -N ld/testsuite/ld-m68k/isab-float.s
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- ld/testsuite/ld-m68k/isab-float.s	6 Mar 2006 13:31:11 -0000
***************
*** 0 ****
--- 1,3 ----
+ 	.arch isab,float
+ 
+ 	nop
Index: ld/testsuite/ld-m68k/isab-nousp.s
===================================================================
RCS file: ld/testsuite/ld-m68k/isab-nousp.s
diff -N ld/testsuite/ld-m68k/isab-nousp.s
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- ld/testsuite/ld-m68k/isab-nousp.s	6 Mar 2006 13:31:11 -0000
***************
*** 0 ****
--- 1,3 ----
+ 	.arch isab,no-usp
+ 
+ 	nop
Index: ld/testsuite/ld-m68k/isab.d
===================================================================
RCS file: ld/testsuite/ld-m68k/isab.d
diff -N ld/testsuite/ld-m68k/isab.d
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- ld/testsuite/ld-m68k/isab.d	6 Mar 2006 13:31:11 -0000
***************
*** 0 ****
--- 1,7 ----
+ 
+ .*:     file format elf32-m68k
+ 
+ Program Header:
+ #...
+ private flags = 5: \[isa B\]
+ 
Index: ld/testsuite/ld-m68k/isab.s
===================================================================
RCS file: ld/testsuite/ld-m68k/isab.s
diff -N ld/testsuite/ld-m68k/isab.s
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- ld/testsuite/ld-m68k/isab.s	6 Mar 2006 13:31:11 -0000
***************
*** 0 ****
--- 1,3 ----
+ 	.arch isab
+ 
+ 	nop
Index: ld/testsuite/ld-m68k/m68k.exp
===================================================================
RCS file: ld/testsuite/ld-m68k/m68k.exp
diff -N ld/testsuite/ld-m68k/m68k.exp
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- ld/testsuite/ld-m68k/m68k.exp	6 Mar 2006 13:31:11 -0000
***************
*** 0 ****
--- 1,47 ----
+ # Expect script for run_dump_test based ld-m68k tests.
+ #   Copyright 2006 Free Software Foundation, Inc.
+ #
+ # This file is free software; you can redistribute it and/or modify
+ # it under the terms of the GNU General Public License as published by
+ # 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ #
+ # Test m68k object merging
+ 
+ if { ![is_elf_format] || ![istarget m68k-*-*] } {
+     return
+ }
+ 
+ # List contains test-items with 3 items followed by 2 lists:
+ # 0:name 1:ld options 2:assembler options
+ # 3:filenames of assembler files 4: action and options. 5: name of output file
+ 
+ # Actions:
+ # objdump: Apply objdump options on result.  Compare with regex (last arg).
+ # nm: Apply nm options on result.  Compare with regex (last arg).
+ # readelf: Apply readelf options on result.  Compare with regex (last arg).
+ 
+ set m68k_mergeok_tests {
+     {"merge isa-a isa-a:nodiv" "-T merge.ld" ""
+ 	{isaa.s isaa-nodiv.s} {{objdump -p isaa.d}} "isaa"}
+     {"merge isa-a isa-b" "-T merge.ld" ""
+ 	{isaa.s isab.s} {{objdump -p isab.d}} "isab"}
+     {"merge isa-a isa-aplus" "-T merge.ld" ""
+ 	{isaa.s isaaplus.s} {{objdump -p isaaplus.d}} "isaplus"}
+     {"merge isa-b isa-b:nousp" "-T merge.ld" ""
+ 	{isab.s isab-nousp.s} {{objdump -p isab.d}} "isab"}
+     {"merge isa-a isa-a:mac" "-T merge.ld" ""
+ 	{isaa.s isaa-mac.s} {{objdump -p isaa-mac.d}} "isaa-mac"}
+     {"merge isa-b isa-b:float" "-T merge.ld" ""
+ 	{isab.s isab-float.s} {{objdump -p isab-float.d}} "isab-float"}}
+ 
+ run_ld_link_tests $m68k_mergeok_tests
Index: ld/testsuite/ld-m68k/merge.ld
===================================================================
RCS file: ld/testsuite/ld-m68k/merge.ld
diff -N ld/testsuite/ld-m68k/merge.ld
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- ld/testsuite/ld-m68k/merge.ld	6 Mar 2006 13:31:11 -0000
***************
*** 0 ****
--- 1,9 ----
+ OUTPUT_FORMAT("elf32-m68k", "elf32-m68k",
+               "elf32-m68k")
+ OUTPUT_ARCH(m68k)
+ ENTRY(_start)
+ 
+ SECTIONS {
+  
+   .text : {_start = .; *(.text)}
+ }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]