This is the mail archive of the binutils@sources.redhat.com 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]

Re: Patch: mips gas reorg


Eric Christopher wrote:
> 
> > I'm not satisfied with the logic implemented here:
> 
> Grrr... a lot of these options should have been errors to have
> concurrently.

Well, since the last change -mcpu is mutually exclusive with
both -march and -mtune, but this doesn't prevent correct use
of gas.

For my target, the latest working gcc snapshot is of 2001-05-01,
which does not know about -march/-mtune, so I need the backward
compatibility for -mcpu in gas (at least for the moment).

> > It results in silently ignoring the -mcpu switch if an isa is
> > specified. E.g. '-mips4 -mcpu=r10000' produces code for r8000
> > without a warning, which breaks backward compatibility.
> > 
> > A simple fix would be doing the check for -mcpu first, I did
> > so in the appended patch.
> 
> Go ahead. 

The new version below regards both -mcpu/-march and -mcpu/-mtune
pairs as_fatal().


Thiemo


2001-07-04  Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>

	/gas/ChangeLog
	* config/tc-mips.c (md_begin): Take -mcpu value into account even when
	-mipsX is specified. Make both -mcpu/-march and -mcpu/-mtune pairs
	mutually exclusive.
	(md_parse_option): Remove superfluous setting of mips_tune, this is
	done in md_begin anyway.


diff -BurPX /bigdisk/dl/src/binutils-exclude src-orig/gas/config/tc-mips.c src/gas/config/tc-mips.c
--- src-orig/gas/config/tc-mips.c	Mon Jul  2 14:34:19 2001
+++ src/gas/config/tc-mips.c	Wed Jul  4 12:52:46 2001
@@ -939,6 +967,28 @@
   if (mips_opts.mips16 < 0)
     mips_opts.mips16 = target_cpu_had_mips16;
 
+  /* Backward compatibility for historic -mcpu= option.  Warn.  */
+  if (mips_cpu != CPU_UNKNOWN && mips_arch != CPU_UNKNOWN)
+    {
+      as_fatal (_("The -mcpu option can't be used together with -march. "
+		  "Use -mtune instead of -mcpu."));
+    }
+
+  if (mips_cpu != CPU_UNKNOWN && mips_tune != CPU_UNKNOWN)
+    {
+      as_fatal (_("The -mcpu option can't be used together with -mtune. "
+		  "Use -march instead of -mcpu."));
+    }
+
+  if (mips_arch == CPU_UNKNOWN && mips_cpu != CPU_UNKNOWN)
+    {
+      ci = mips_cpu_info_from_cpu (mips_cpu);
+      assert (ci != NULL);
+      mips_arch = ci->cpu;
+      as_warn (_("The -mcpu option is deprecated.  Please use -march and "
+		 "-mtune instead."));
+    }
+
   /* At this point, mips_arch will either be CPU_UNKNOWN if no ARCH was
      specified on the command line, or some other value if one was.
      Similarly, mips_opts.isa will be ISA_UNKNOWN if not specified on
@@ -961,19 +1011,6 @@
       assert (ci != NULL);
       mips_arch = ci->cpu;
     }
-  else if (mips_arch == CPU_UNKNOWN
-	   && mips_opts.isa == ISA_UNKNOWN
-	   && mips_cpu != CPU_UNKNOWN)
-    {
-      /* Historic -mcpu= option.  Warn.  */
-      ci = mips_cpu_info_from_cpu (mips_cpu);
-      assert (ci != NULL);
-      mips_arch = ci->cpu;
-      mips_tune = ci->cpu;
-      mips_opts.isa = ci->isa;
-      as_warn (_("The -mcpu option is deprecated.  Please use -march and -mtune instead."));
-
-    }
   else
     {
       /* We need to set both ISA and ARCH from target cpu.  */
@@ -9093,7 +9229,6 @@
 
     case OPTION_M4650:
       mips_arch = CPU_R4650;
-      mips_tune = CPU_R4650;
       break;
 
     case OPTION_NO_M4650:
@@ -9101,7 +9236,6 @@
 
     case OPTION_M4010:
       mips_arch = CPU_R4010;
-      mips_tune = CPU_R4010;
       break;
 
     case OPTION_NO_M4010:
@@ -9109,7 +9243,6 @@
 
     case OPTION_M4100:
       mips_arch = CPU_VR4100;
-      mips_tune = CPU_VR4100;
       break;
 
     case OPTION_NO_M4100:
@@ -9117,7 +9250,6 @@
 
     case OPTION_M3900:
       mips_arch = CPU_R3900;
-      mips_tune = CPU_R3900;
       break;
 
     case OPTION_NO_M3900:


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