[PATCH] MIPS gas: Allow simultan use of -mpu amd -mipsX again

Thiemo Seufer ica2_ts@csv.ica.uni-stuttgart.de
Sat Jul 21 15:38:00 GMT 2001


Hi All,

this patch re-allows using the -mcpu backward-compatibility switch
in combination with -mipsX, where it was silently ignored as a
side-effect of the recent introduction of -march and -tune.

It also adds warnings if one of -march/-mtune/-mcpu is specified
more than once, what can happen under the hood even for e.g.
"-m4650 -march=r4000".


Thiemo


2001-07-22  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 (if they are different).
	(md_parse_option): Warn if an -march/-mtune/-mcpu option is set more
	than once.


diff -BurPX /bigdisk/src/binutils-exclude src-orig/gas/config/tc-mips.c src/gas/config/tc-mips.c
--- src-orig/gas/config/tc-mips.c	Wed Jul  4 14:44:12 2001
+++ src/gas/config/tc-mips.c	Sun Jul 22 00:02:59 2001
@@ -939,6 +967,33 @@
   if (mips_opts.mips16 < 0)
     mips_opts.mips16 = target_cpu_had_mips16;
 
+  /* Backward compatibility for historic -mcpu= option.  Check for
+     incompatible options, warn if -mcpu is used.  */
+  if (mips_cpu != CPU_UNKNOWN
+      && mips_arch != CPU_UNKNOWN
+      && mips_cpu != mips_arch)
+    {
+      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
+      && mips_cpu != mips_tune)
+    {
+      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 +1016,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.  */
@@ -9080,12 +9219,21 @@
 	switch (c)
 	  {
 	  case OPTION_MTUNE:
+	    if (mips_tune != CPU_UNKNOWN && mips_tune != cpu)
+	      as_warn(_("A different -mtune= was already specified, is now "
+			"-mtune=%s"), arg);
 	    mips_tune = cpu;
 	    break;
 	  case OPTION_MARCH:
+	    if (mips_arch != CPU_UNKNOWN && mips_arch != cpu)
+	      as_warn(_("A different -march= was already specified, is now "
+			"-march=%s"), arg);
 	    mips_arch = cpu;
 	    break;
 	  case OPTION_MCPU:
+	    if (mips_cpu != CPU_UNKNOWN && mips_cpu != cpu)
+	      as_warn(_("A different -mcpu= was already specified, is now "
+			"-mcpu=%s"), arg);
 	    mips_cpu = cpu;
 	  }
       }



More information about the Binutils mailing list