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]

[patch] Add fido support (Part 3/n)


Hi,

Attached is the third in a series of patches to add fido support to
binutils.

This patch adds the infrastructure support for fido.  Specifically, it

- creates a new bfd_mach number for fido,

- creates architecture flag EF_M68K_CPU32_FIDO_A to make fido object
  files unique from other m68k object files,

- adds -mfido_a, but

- does not add any support for new instructions (or new movec
  registers) yet.

Tested by building binutils.  OK to apply?

Kazu Hirata

bfd/
2006-12-23  Kazu Hirata  <kazu@codesourcery.com>

	* archures.c (bfd_mach_cpu32_fido): New.
	(bfd_mach_mcf_isa_a_nodiv, bfd_mach_mcf_isa_a,
	bfd_mach_mcf_isa_a_mac, bfd_mach_mcf_isa_a_emac,
	bfd_mach_mcf_isa_aplus, bfd_mach_mcf_isa_aplus_mac,
	bfd_mach_mcf_isa_aplus_emac, bfd_mach_mcf_isa_b_nousp,
	bfd_mach_mcf_isa_b_nousp_mac, bfd_mach_mcf_isa_b_nousp_emac,
	bfd_mach_mcf_isa_b, bfd_mach_mcf_isa_b_mac,
	bfd_mach_mcf_isa_b_emac, bfd_mach_mcf_isa_b_float,
	bfd_mach_mcf_isa_b_float_mac, bfd_mach_mcf_isa_b_float_emac):
	Increment the defined values.
	* bfd-in2.h: Regenerate.
	* cpu-m68k.c (arch_info_struct): Add en entry for
	bfd_mach_cpu32_fido.
	* elf32-m68k.c (elf32_m68k_object_p): Handle
	EF_M68K_CPU32_FIDO_A.
	(elf32_m68k_merge_private_bfd_data): Use EF_M68K_CPU32_MASK.
	(elf32_m68k_print_private_bfd_data): Handle
	EF_M68K_CPU32_FIDO_A.

binutils/
2006-12-23  Kazu Hirata  <kazu@codesourcery.com>

	* readelf.c (get_machine_flags): Handle EF_M68K_CPU32_FIDO_A.

gas/
2006-12-23  Kazu Hirata  <kazu@codesourcery.com>

	* config/tc-m68k.c (cpu_of_arch): Add fido.
	(m68k_archs, m68k_cpu): Add entries for fido.
	(m68k_elf_final_processing): Handle EF_M68K_CPU32_FIDO_A.

include/elf/
2006-12-23  Kazu Hirata  <kazu@codesourcery.com>

	* m68k.h (EF_M68K_CPU32_FIDO_A, EF_M68K_CPU32_MASK): New.

include/opcode/
2006-12-23  Kazu Hirata  <kazu@codesourcery.com>

	* m68k.h (fido_a): New.

Index: bfd/archures.c
===================================================================
RCS file: /cvs/src/src/bfd/archures.c,v
retrieving revision 1.120
diff -u -d -p -r1.120 archures.c
--- bfd/archures.c	25 Oct 2006 06:49:20 -0000	1.120
+++ bfd/archures.c	24 Dec 2006 03:05:19 -0000
@@ -80,22 +80,23 @@ DESCRIPTION
 .#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
+.#define bfd_mach_cpu32_fido  9
+.#define bfd_mach_mcf_isa_a_nodiv 10
+.#define bfd_mach_mcf_isa_a 11
+.#define bfd_mach_mcf_isa_a_mac 12
+.#define bfd_mach_mcf_isa_a_emac 13
+.#define bfd_mach_mcf_isa_aplus 14
+.#define bfd_mach_mcf_isa_aplus_mac 15
+.#define bfd_mach_mcf_isa_aplus_emac 16
+.#define bfd_mach_mcf_isa_b_nousp 17
+.#define bfd_mach_mcf_isa_b_nousp_mac 18
+.#define bfd_mach_mcf_isa_b_nousp_emac 19
+.#define bfd_mach_mcf_isa_b 20
+.#define bfd_mach_mcf_isa_b_mac 21
+.#define bfd_mach_mcf_isa_b_emac 22
+.#define bfd_mach_mcf_isa_b_float 23
+.#define bfd_mach_mcf_isa_b_float_mac 24
+.#define bfd_mach_mcf_isa_b_float_emac 25
 .  bfd_arch_vax,       {* DEC Vax *}
 .  bfd_arch_i960,      {* Intel 960 *}
 .    {* The order of the following is important.
Index: bfd/bfd-in2.h
===================================================================
RCS file: /cvs/src/src/bfd/bfd-in2.h,v
retrieving revision 1.410
diff -u -d -p -r1.410 bfd-in2.h
--- bfd/bfd-in2.h	15 Dec 2006 04:13:34 -0000	1.410
+++ bfd/bfd-in2.h	24 Dec 2006 03:05:19 -0000
@@ -1715,22 +1715,23 @@ enum bfd_architecture
 #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
+#define bfd_mach_cpu32_fido  9
+#define bfd_mach_mcf_isa_a_nodiv 10
+#define bfd_mach_mcf_isa_a 11
+#define bfd_mach_mcf_isa_a_mac 12
+#define bfd_mach_mcf_isa_a_emac 13
+#define bfd_mach_mcf_isa_aplus 14
+#define bfd_mach_mcf_isa_aplus_mac 15
+#define bfd_mach_mcf_isa_aplus_emac 16
+#define bfd_mach_mcf_isa_b_nousp 17
+#define bfd_mach_mcf_isa_b_nousp_mac 18
+#define bfd_mach_mcf_isa_b_nousp_emac 19
+#define bfd_mach_mcf_isa_b 20
+#define bfd_mach_mcf_isa_b_mac 21
+#define bfd_mach_mcf_isa_b_emac 22
+#define bfd_mach_mcf_isa_b_float 23
+#define bfd_mach_mcf_isa_b_float_mac 24
+#define bfd_mach_mcf_isa_b_float_emac 25
   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.14
diff -u -d -p -r1.14 cpu-m68k.c
--- bfd/cpu-m68k.c	12 Jul 2006 12:46:59 -0000	1.14
+++ bfd/cpu-m68k.c	24 Dec 2006 03:05:19 -0000
@@ -41,53 +41,54 @@ static const bfd_arch_info_type arch_inf
     N(bfd_mach_m68040,  "m68k:68040", FALSE, &arch_info_struct[6]),
     N(bfd_mach_m68060,  "m68k:68060", FALSE, &arch_info_struct[7]),
     N(bfd_mach_cpu32,   "m68k:cpu32", FALSE, &arch_info_struct[8]),
+    N(bfd_mach_cpu32_fido, "m68k:fido", FALSE, &arch_info_struct[9]),
 
     /* 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",
+    N(bfd_mach_mcf_isa_a, "m68k:isa-a",
       FALSE, &arch_info_struct[11]),
-    N(bfd_mach_mcf_isa_a_emac, "m68k:isa-a:emac",
+    N(bfd_mach_mcf_isa_a_mac, "m68k:isa-a:mac",
       FALSE, &arch_info_struct[12]),
-    N(bfd_mach_mcf_isa_aplus, "m68k:isa-aplus",
+    N(bfd_mach_mcf_isa_a_emac, "m68k:isa-a:emac",
       FALSE, &arch_info_struct[13]),
-    N(bfd_mach_mcf_isa_aplus_mac, "m68k:isa-aplus:mac",
+    N(bfd_mach_mcf_isa_aplus, "m68k:isa-aplus",
       FALSE, &arch_info_struct[14]),
-    N(bfd_mach_mcf_isa_aplus_emac, "m68k:isa-aplus:emac",
+    N(bfd_mach_mcf_isa_aplus_mac, "m68k:isa-aplus:mac",
       FALSE, &arch_info_struct[15]),
-    N(bfd_mach_mcf_isa_b_nousp, "m68k:isa-b:nousp",
+    N(bfd_mach_mcf_isa_aplus_emac, "m68k:isa-aplus:emac",
       FALSE, &arch_info_struct[16]),
-    N(bfd_mach_mcf_isa_b_nousp_mac, "m68k:isa-b:nousp:mac",
+    N(bfd_mach_mcf_isa_b_nousp, "m68k:isa-b:nousp",
       FALSE, &arch_info_struct[17]),
-    N(bfd_mach_mcf_isa_b_nousp_emac, "m68k:isa-b:nousp:emac",
+    N(bfd_mach_mcf_isa_b_nousp_mac, "m68k:isa-b:nousp:mac",
       FALSE, &arch_info_struct[18]),
-    N(bfd_mach_mcf_isa_b, "m68k:isa-b",
+    N(bfd_mach_mcf_isa_b_nousp_emac, "m68k:isa-b:nousp:emac",
       FALSE, &arch_info_struct[19]),
-    N(bfd_mach_mcf_isa_b_mac, "m68k:isa-b:mac",
+    N(bfd_mach_mcf_isa_b, "m68k:isa-b",
       FALSE, &arch_info_struct[20]),
-    N(bfd_mach_mcf_isa_b_emac, "m68k:isa-b:emac",
+    N(bfd_mach_mcf_isa_b_mac, "m68k:isa-b:mac",
       FALSE, &arch_info_struct[21]),
-    N(bfd_mach_mcf_isa_b_float, "m68k:isa-b:float",
+    N(bfd_mach_mcf_isa_b_emac, "m68k:isa-b:emac",
       FALSE, &arch_info_struct[22]),
-    N(bfd_mach_mcf_isa_b_float_mac, "m68k:isa-b:float:mac",
+    N(bfd_mach_mcf_isa_b_float, "m68k:isa-b:float",
       FALSE, &arch_info_struct[23]),
-    N(bfd_mach_mcf_isa_b_float_emac, "m68k:isa-b:float:emac",
+    N(bfd_mach_mcf_isa_b_float_mac, "m68k:isa-b:float:mac",
       FALSE, &arch_info_struct[24]),
+    N(bfd_mach_mcf_isa_b_float_emac, "m68k:isa-b:float:emac",
+      FALSE, &arch_info_struct[25]),
 
     /* 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_a_nodiv, "m68k:5200", FALSE, &arch_info_struct[26]),
+    N(bfd_mach_mcf_isa_a_mac,"m68k:5206e", FALSE, &arch_info_struct[27]),
+    N(bfd_mach_mcf_isa_a_mac, "m68k:5307", FALSE, &arch_info_struct[28]),
+    N(bfd_mach_mcf_isa_b_nousp_mac, "m68k:5407", FALSE, &arch_info_struct[29]),
+    N(bfd_mach_mcf_isa_aplus_emac, "m68k:528x", FALSE, &arch_info_struct[30]),
+    N(bfd_mach_mcf_isa_aplus_emac, "m68k:521x", FALSE, &arch_info_struct[31]),
+    N(bfd_mach_mcf_isa_a_emac, "m68k:5249", FALSE, &arch_info_struct[32]),
     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:548x",
+      FALSE, &arch_info_struct[34]),
     N(bfd_mach_mcf_isa_b_float_emac, "m68k:cfv4e", FALSE, 0),
   };
 
@@ -107,6 +108,7 @@ static const unsigned m68k_arch_features
   m68040|m68881|m68851,
   m68060|m68881|m68851,
   cpu32|m68881,
+  cpu32|m68881|fido_a,
   mcfisa_a,
   mcfisa_a|mcfhwdiv,
   mcfisa_a|mcfhwdiv|mcfmac,
@@ -202,16 +204,16 @@ bfd_m68k_compatible (const bfd_arch_info
   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_cpu32 && b->mach == bfd_mach_cpu32)
-    /* CPU32 is compatible with itself. */
-    return a;
-  else if (a->mach >= bfd_mach_mcf_isa_a_nodiv
-	   && b->mach >= bfd_mach_mcf_isa_a_nodiv)
+  else if (a->mach >= bfd_mach_cpu32 && b->mach >= bfd_mach_cpu32)
     {
-      /* Merge cf machine.  */
+      /* Merge the machine features.  */
       unsigned features = (bfd_m68k_mach_to_features (a->mach)
 			   | bfd_m68k_mach_to_features (b->mach));
 
+      /* CPU32 and Coldfire are incompatible.  */
+      if ((~features & (cpu32 | mcfisa_a)) == 0)
+	return NULL;
+
       /* ISA A+ and ISA B are incompatible.  */
       if ((~features & (mcfisa_aa | mcfisa_b)) == 0)
 	return NULL;
Index: bfd/elf32-m68k.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m68k.c,v
retrieving revision 1.95
diff -u -d -p -r1.95 elf32-m68k.c
--- bfd/elf32-m68k.c	19 Dec 2006 13:24:56 -0000	1.95
+++ bfd/elf32-m68k.c	24 Dec 2006 03:05:19 -0000
@@ -432,7 +432,14 @@ elf32_m68k_object_p (bfd *abfd)
   if ((eflags & EF_M68K_ARCH_MASK) == EF_M68K_M68000)
     features |= m68000;
   else if ((eflags & EF_M68K_ARCH_MASK) == EF_M68K_CPU32)
-    features |= cpu32;
+    {
+      features |= cpu32;
+      switch (eflags & EF_M68K_CPU32_MASK)
+	{
+        case EF_M68K_CPU32_FIDO_A:
+	  features |= fido_a; break;
+	}
+    }
   else
     {
       switch (eflags & EF_M68K_CF_ISA_MASK)
@@ -523,7 +530,7 @@ elf32_m68k_merge_private_bfd_data (ibfd,
       if ((in_flags & EF_M68K_ARCH_MASK) == EF_M68K_M68000)
 	variant_mask = 0;
       else if ((in_flags & EF_M68K_ARCH_MASK) == EF_M68K_CPU32)
-	variant_mask = 0;
+	variant_mask = EF_M68K_CPU32_MASK;
       else
 	variant_mask = EF_M68K_CF_ISA_MASK;
 
@@ -560,7 +567,11 @@ elf32_m68k_print_private_bfd_data (abfd,
   if ((eflags & EF_M68K_ARCH_MASK) == EF_M68K_M68000)
     fprintf (file, " [m68000]");
   else if ((eflags & EF_M68K_ARCH_MASK) == EF_M68K_CPU32)
-    fprintf (file, " [cpu32]");
+    {
+      fprintf (file, " [cpu32]");
+      if (eflags & EF_M68K_CPU32_FIDO_A)
+	fprintf (file, " [fido]");
+    }
   else
     {
       if ((eflags & EF_M68K_ARCH_MASK) == EF_M68K_CFV4E)
Index: binutils/readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.353
diff -u -d -p -r1.353 readelf.c
--- binutils/readelf.c	19 Dec 2006 13:24:56 -0000	1.353
+++ binutils/readelf.c	24 Dec 2006 03:05:19 -0000
@@ -2015,7 +2015,11 @@ get_machine_flags (unsigned e_flags, uns
 	  if ((e_flags & EF_M68K_ARCH_MASK) == EF_M68K_M68000)
 	    strcat (buf, ", m68000");
 	  else if ((e_flags & EF_M68K_ARCH_MASK) == EF_M68K_CPU32)
-	    strcat (buf, ", cpu32");
+	    {
+	      strcat (buf, ", cpu32");
+	      if (e_flags & EF_M68K_CPU32_FIDO_A)
+		strcat (buf, ", fido_a");
+	    }
 	  else
 	    {
 	      char const *isa = _("unknown");
Index: gas/config/tc-m68k.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-m68k.c,v
retrieving revision 1.79
diff -u -d -p -r1.79 tc-m68k.c
--- gas/config/tc-m68k.c	7 Dec 2006 15:39:01 -0000	1.79
+++ gas/config/tc-m68k.c	24 Dec 2006 03:05:19 -0000
@@ -284,7 +284,7 @@ struct m68k_it
   reloc[5];			/* Five is enough???  */
 };
 
-#define cpu_of_arch(x)		((x) & (m68000up | mcfisa_a))
+#define cpu_of_arch(x)		((x) & (m68000up | mcfisa_a | fido_a))
 #define float_of_arch(x)	((x) & mfloat)
 #define mmu_of_arch(x)		((x) & mmmu)
 #define arch_coldfire_p(x)	((x) & mcfisa_a)
@@ -421,6 +421,7 @@ static const struct m68k_cpu m68k_archs[
   {m68040,					m68040_ctrl, "68040", 0},
   {m68060,					m68060_ctrl, "68060", 0},
   {cpu32|m68881,				cpu32_ctrl, "cpu32", 0},
+  {cpu32|fido_a,				cpu32_ctrl, "fidoa", 0},
   {mcfisa_a|mcfhwdiv,				NULL, "isaa", 0},
   {mcfisa_a|mcfhwdiv|mcfisa_aa|mcfusp,		NULL, "isaaplus", 0},
   {mcfisa_a|mcfhwdiv|mcfisa_b|mcfusp,		NULL, "isab", 0},
@@ -552,6 +553,8 @@ static const struct m68k_cpu m68k_cpus[]
   {mcfisa_a|mcfisa_b|mcfhwdiv|mcfemac|mcfusp|cfloat, mcfv4e_ctrl, "5485", -1},
   {mcfisa_a|mcfisa_b|mcfhwdiv|mcfemac|mcfusp|cfloat, mcfv4e_ctrl, "548x", 0},
   
+  {cpu32|fido_a,				cpu32_ctrl, "fido", 1},
+
   {0,NULL,NULL, 0}
   };
 
@@ -7498,7 +7501,11 @@ m68k_elf_final_processing (void)
     flags |= EF_M68K_CFV4E;
   /* Set file-specific flags if this is a cpu32 processor.  */
   if (cpu_of_arch (current_architecture) & cpu32)
-    flags |= EF_M68K_CPU32;
+    {
+      flags |= EF_M68K_CPU32;
+      if (cpu_of_arch (current_architecture) & fido_a)
+	flags |= EF_M68K_CPU32_FIDO_A;
+    }
   else if ((cpu_of_arch (current_architecture) & m68000up)
 	   && !(cpu_of_arch (current_architecture) & m68020up))
     flags |= EF_M68K_M68000;
Index: include/elf/m68k.h
===================================================================
RCS file: /cvs/src/src/include/elf/m68k.h,v
retrieving revision 1.14
diff -u -d -p -r1.14 m68k.h
--- include/elf/m68k.h	19 Dec 2006 13:24:56 -0000	1.14
+++ include/elf/m68k.h	24 Dec 2006 03:05:19 -0000
@@ -76,4 +76,10 @@ END_RELOC_NUMBERS (R_68K_max)
 #define EF_M68K_CF_FLOAT	0x40  /* Has float insns */
 #define EF_M68K_CF_MASK		0xFF
      
+/* We use the bottom 8 bits to encode information about the
+   CPU32 variant.  If we use any of these bits, the top 24 bits must
+   be EF_M68K_CPU32.  */
+#define EF_M68K_CPU32_FIDO_A	0x01
+#define EF_M68K_CPU32_MASK	0xFF
+
 #endif
Index: include/opcode/m68k.h
===================================================================
RCS file: /cvs/src/src/include/opcode/m68k.h,v
retrieving revision 1.14
diff -u -d -p -r1.14 m68k.h
--- include/opcode/m68k.h	24 Dec 2006 02:58:37 -0000	1.14
+++ include/opcode/m68k.h	24 Dec 2006 03:05:19 -0000
@@ -31,6 +31,7 @@
 #define	m68881   0x040
 #define	m68851   0x080
 #define cpu32	 0x100		/* e.g., 68332 */
+#define fido_a   0x200
 #define m68k_mask  0x3ff
 
 #define mcfmac   0x400		/* ColdFire MAC. */


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