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]

[m68k] arch flag cleanup v2


This patch reworks some of the changes I made in my last patch to cleanup the coldfire architecture switches. In re-reviewing the coldfire architectures, and the bfd_mach enumeration, I realized we'd been too flexible, and this was confusing. AFAICT all isa-a machines implement hw div (an isa-a insn), except for 5200, 5202, 5204 & 5206. Rather than have a separate ELF flag for hwdiv, this patch creates a variant isa 'a-minus', which is all of isa-a except for the hwdiv insns. similarly all isa-a+ & isa-b chips implement USP support except for 5407. Thus I enumerated an isa-b-minus variant in the ELF flags for that.
These new isa names are user visible, in that objdump and readelf will show them. The user cannot select them directly (use isaa,nohwdiv and isab,nousp respectively). I could rework the display so that what I've termed isa-a-minus is shown as '[isa-a] [nohwdiv]' for instance. I have no strong feeling about that, except a negative capability flag might be a bit odd.


This elf flag relabling is binary incompatible with the previous version, but as that's only been committed for a couple of weeks, I think that is ok.

The patch also fixes an error in merging the elf flags, in that isa-a+ and isa-b are not compatible.

Also, this patch allows -mfloat to be used to enable either cf-float or m68k-float (68881) support, depending on the architecture being targetted. This capability will be used in upcoming gcc patches.

built & tested on m68k-elf with a cf simulator, ok?

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

2006-02-20  Nathan Sidwell  <nathan@codesourcery.com>

	* bfd/archures.c (bfd_mach_mcf_isa_aminus, bfd_mach_mcf_isa_bminus):
	New.  Adjust other variants.
	(bfd_default_scan): Update.
	* bfd/bfd-in2.h: Rebuilt.
	* bfd/cpu-m68k.c: Adjust.
	* bfd/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.
	* bfd/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.

	* 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_MINUS, EF_M68K_ISA_B_MINUS): New.
	(EF_M68K_HW_DIV, EF_M68K_USP): Remove.
	(EF_M68K_MAC, EF_M68K_EMAC, EF_M68K_FLOAT): Adjust.
	(EF_M68K_EMAC_B): New.

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	20 Feb 2006 15:51:25 -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_aminus 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_bminus 16
! .#define bfd_mach_mcf_isa_bminus_mac 17
! .#define bfd_mach_mcf_isa_bminus_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_aminus;
        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_bminus_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.380
diff -c -3 -p -r1.380 bfd-in2.h
*** bfd/bfd-in2.h	17 Feb 2006 14:36:21 -0000	1.380
--- bfd/bfd-in2.h	20 Feb 2006 15:51:28 -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_aminus 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_bminus 16
! #define bfd_mach_mcf_isa_bminus_mac 17
! #define bfd_mach_mcf_isa_bminus_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	20 Feb 2006 15:51:28 -0000
*************** static const bfd_arch_info_type arch_inf
*** 39,92 ****
      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]),
      N(bfd_mach_mcf_isa_b_mac, "m68k:isa-b:mac",
        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 =
--- 39,90 ----
      N(bfd_mach_cpu32,   "m68k:cpu32", FALSE, &arch_info_struct[8]),
  
      /* Various combinations of CF architecture features */
!     N(bfd_mach_mcf_isa_aminus, "m68k:isa-aminus",
        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_bminus, "m68k:isa-bminus",
        FALSE, &arch_info_struct[16]),
!     N(bfd_mach_mcf_isa_bminus_mac, "m68k:isa-bminus:mac",
        FALSE, &arch_info_struct[17]),
!     N(bfd_mach_mcf_isa_bminus_emac, "m68k:isa-bminus:emac",
        FALSE, &arch_info_struct[18]),
!     N(bfd_mach_mcf_isa_b_mac, "m68k:isa-b",
        FALSE, &arch_info_struct[19]),
      N(bfd_mach_mcf_isa_b_mac, "m68k:isa-b:mac",
        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_aminus, "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_bminus_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,
--- 107,121 ----
    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,
Index: bfd/elf32-m68k.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m68k.c,v
retrieving revision 1.85
diff -c -3 -p -r1.85 elf32-m68k.c
*** bfd/elf32-m68k.c	7 Feb 2006 19:01:09 -0000	1.85
--- bfd/elf32-m68k.c	20 Feb 2006 15:51:30 -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_MINUS:
  	  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_MINUS:
+ 	  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,
*** 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))
--- 485,521 ----
      }
    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_MINUS
! 		      || 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_MINUS
! 		      || 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,
*** 562,580 ****
        
        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:
--- 574,598 ----
        
        switch (eflags & EF_M68K_ISA_MASK)
  	{
+ 	case EF_M68K_ISA_A_MINUS:
+ 	  isa = "A-";
+ 	  break;
  	case EF_M68K_ISA_A:
  	  isa = "A";
  	  break;
  	case EF_M68K_ISA_A_PLUS:
  	  isa = "A+";
  	  break;
+ 	case EF_M68K_ISA_B_MINUS:
+ 	  isa = "B-";
+ 	  break;
  	case EF_M68K_ISA_B:
  	  isa = "B";
  	  break;
  	}
        fprintf (file, " [isa %s]", isa);
!       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);
--- 607,612 ----
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	20 Feb 2006 15:51:32 -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_aminus: id = "isa-aminus"; 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_bminus: id = "isa-bminus"; break;
! 	  case bfd_mach_mcf_isa_bminus_mac: id = "isa-bminus:mac"; break;
! 	  case bfd_mach_mcf_isa_bminus_emac: id = "isa-bminus: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	20 Feb 2006 15:51:38 -0000
*************** get_machine_flags (unsigned e_flags, uns
*** 1952,1971 ****
        
  	      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:
--- 1952,1977 ----
        
  	      switch (e_flags & EF_M68K_ISA_MASK)
  		{
+ 		case EF_M68K_ISA_A_MINUS:
+ 		  isa = "A-";
+ 		  break;
  		case EF_M68K_ISA_A:
  		  isa = "A";
  		  break;
  		case EF_M68K_ISA_A_PLUS:
  		  isa = "A+";
  		  break;
+ 		case EF_M68K_ISA_B_MINUS:
+ 		  isa = "B-";
+ 		  break;
  		case EF_M68K_ISA_B:
  		  isa = "B";
  		  break;
  		}
  	      strcat (buf, ", cf, isa ");
  	      strcat (buf, isa);
! 	      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;
  
--- 1989,1994 ----
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	20 Feb 2006 15:51:42 -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[
*** 398,413 ****
    {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},
     
--- 402,419 ----
    {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},
     
*************** 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 int isa_features[][2] =
!       {
! 	{EF_M68K_ISA_A_MINUS, mcfisa_a},
! 	{EF_M68K_ISA_A,	mcfisa_a|mcfhwdiv},
! 	{EF_M68K_ISA_A_PLUS,mcfisa_a|mcfisa_aa|mcfhwdiv|mcfusp},
! 	{EF_M68K_ISA_B_MINUS,mcfisa_a|mcfisa_b|mcfhwdiv},
! 	{EF_M68K_ISA_B,	mcfisa_a|mcfisa_b|mcfhwdiv|mcfusp},
! 	{0,0},
!       };
!       static const int 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: 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	20 Feb 2006 15:51:45 -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_MINUS	0x01  /* ISA A except for div */
! #define EF_M68K_ISA_A		0x02
! #define EF_M68K_ISA_A_PLUS	0x03
! #define EF_M68K_ISA_B_MINUS	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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]