public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* ERROR: already selected `xxxx' processor
@ 2006-07-05 16:00 Thomas Fleischmann
  2006-07-05 16:36 ` Dave Korn
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Fleischmann @ 2006-07-05 16:00 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 1126 bytes --]

Hi all,

one month ago we built a m68k-elf - toolchain ourselfes (binutils 2.16.1 / gcc 4.1.1).

Whilst the gcc doesn't support our used cpu MCF5213 100%, we use the compilerswitch -m5200 to generate generic code for a MCF52xx.
We also need to use inline assembly for the MCF5213 stuff (movec ..., %rambar). So we have to apply a second compiler switch to be passed to gas -Wa,-m5213 (-Wa,-mcpu=5213 for binutils 2.17).

This is ok for binutils 2.16.1 but not for 2.17.

As the compiler passes two "cpu" selections to gas, one indirectly generated by gcc's -m5200 and one direktly passed by -Wa,-mcpu=5213, gas is "confused".
File gas/config/tc-m68k.c checks this and produces an error, because of two different selected cpu's.

My suggestion is:
If gas is invoked with -mcpu=xxx, this should override the former settings. Additional a warning will be produced.

My included patch would produce this behavior.
Please could you check if I done everything right and if it is worth to be applied to gas.

Thomas Fleischmann
-- 


Echte DSL-Flatrate dauerhaft für 0,- Euro*!
"Feel free" mit GMX DSL! http://www.gmx.net/de/go/dsl

[-- Attachment #2: binutils-2.17-forcecpu.patch --]
[-- Type: application/octet-stream, Size: 2769 bytes --]

diff -urN binutils-2.17.orig/gas/ChangeLog binutils-2.17/gas/ChangeLog
--- binutils-2.17.orig/gas/ChangeLog	2006-06-12 15:05:03.000000000 +0200
+++ binutils-2.17/gas/ChangeLog	2006-07-05 09:57:10.000000000 +0200
@@ -1,3 +1,7 @@
+2006-07-04  Thomas Fleischmann <tfleischmann@gmx.de>
+
+	* config/tc-m68k.c: overwrite cpu selection
+
 2006-06-07  Joseph S. Myers  <joseph@codesourcery.com>
 
 	* po/Make-in (pdf, ps): New dummy targets.
diff -urN binutils-2.17.orig/gas/config/tc-m68k.c binutils-2.17/gas/config/tc-m68k.c
--- binutils-2.17.orig/gas/config/tc-m68k.c	2006-06-02 04:16:34.000000000 +0200
+++ binutils-2.17/gas/config/tc-m68k.c	2006-07-05 09:54:00.000000000 +0200
@@ -558,7 +558,7 @@
 static const struct m68k_cpu *m68k_lookup_cpu
 (const char *, const struct m68k_cpu *, int, int *);
 static int m68k_set_arch (const char *, int, int);
-static int m68k_set_cpu (const char *, int, int);
+static int m68k_set_cpu (const char *, int, int, int);
 static int m68k_set_extension (const char *, int, int);
 static void m68k_init_arch (void);
 
@@ -3915,7 +3915,7 @@
       /* We've not selected an architecture yet.  Set the default
 	 now.  We do this lazily so that an initial .cpu or .arch directive
 	 can specify.  */
-      if (!m68k_set_cpu (TARGET_CPU, 1, 1))
+      if (!m68k_set_cpu (TARGET_CPU, 1, 1, 0))
 	as_bad (_("unrecognized default cpu `%s'"), TARGET_CPU);
     }
   if (!initialized)
@@ -6901,7 +6901,7 @@
   saved_char = *input_line_pointer;
   *input_line_pointer = 0;
 
-  m68k_set_cpu (name, 1, 0);
+  m68k_set_cpu (name, 1, 0, 0);
   
   *input_line_pointer = saved_char;
   demand_empty_rest_of_line ();
@@ -7005,7 +7005,7 @@
 /* Set the cpu, issuing errors if it is unrecognized, or invalid */
 
 static int
-m68k_set_cpu (char const *name, int allow_m, int silent)
+m68k_set_cpu (char const *name, int allow_m, int silent, int force)
 {
   const struct m68k_cpu *cpu;
 
@@ -7020,9 +7020,15 @@
       
   if (selected_cpu && selected_cpu != cpu)
     {
-      as_bad (_("already selected `%s' processor"),
-	      selected_cpu->name);
-      return 0;
+      if(!force)
+	{
+	  as_bad (_("already selected `%s' processor"),
+		 selected_cpu->name);
+	  return 0;
+	}
+      else
+	as_warn (_("override selected `%s' processor with `%s'"),
+		selected_cpu->name, cpu->name);
     }
   selected_cpu = cpu;
   return 1;
@@ -7195,12 +7201,12 @@
       if (!strncmp (arg, "arch=", 5))
 	m68k_set_arch (arg + 5, 1, 0);
       else if (!strncmp (arg, "cpu=", 4))
-	m68k_set_cpu (arg + 4, 1, 0);
+	m68k_set_cpu (arg + 4, 1, 0, 1);
       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 if (m68k_set_cpu (arg, 0, 1, 0))
 	;
       else
 	return 0;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: ERROR: already selected `xxxx' processor
  2006-07-05 16:00 ERROR: already selected `xxxx' processor Thomas Fleischmann
@ 2006-07-05 16:36 ` Dave Korn
  2006-07-05 17:10   ` Thomas Fleischmann
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Korn @ 2006-07-05 16:36 UTC (permalink / raw)
  To: 'Thomas Fleischmann', binutils

On 05 July 2006 17:00, Thomas Fleischmann wrote:

> Whilst the gcc doesn't support our used cpu MCF5213 100%, we use the
> compilerswitch -m5200 to generate generic code for a MCF52xx. 
> We also need to use inline assembly for the MCF5213 stuff (movec ...,
> %rambar). So we have to apply a second compiler switch to be passed to gas
> -Wa,-m5213 (-Wa,-mcpu=5213 for binutils 2.17).  
> 
> This is ok for binutils 2.16.1 but not for 2.17.
> 
> As the compiler passes two "cpu" selections to gas, one indirectly
> generated by gcc's -m5200 and one direktly passed by -Wa,-mcpu=5213, gas is
> "confused".  
> File gas/config/tc-m68k.c checks this and produces an error, because of two
> different selected cpu's. 
> 
> My suggestion is:
> If gas is invoked with -mcpu=xxx, this should override the former settings.
> Additional a warning will be produced. 
> 
> My included patch would produce this behavior.
> Please could you check if I done everything right and if it is worth to be
> applied to gas. 


  You mean, let's patch gas to accept invalid command lines rather than you
fix your invalid kludgey hacked-up build environment?  I suggest let's not!  I
appreciate that you have a valid motive here owing to the disjunction between
what cpus gcc understands and what cpus gas understands, but this surely isn't
the way to resolve it.  The fact that it used to be accepted in 2.16.1 and now
there's a check for it and it is specifically disallowed suggests that there
may be some kind of problem.  Did you check the archives to see why this test
was added?

  The correct fix for this situation would be to add a -m5213 option to gcc,
not to try and persuade gas to accept two or more --cpu options at the same
time.  It could be as simple as using the driver specs so that -m5213 gets
turned into -m5200 when it's passed to cc1 in the CC1_SPEC and gets turned
into -mcpu=5213 when it's passed to gas in the ASM_SPEC.  Wouldn't that do
everything you need, and be a somewhat cleaner solution as well?

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: ERROR: already selected `xxxx' processor
  2006-07-05 16:36 ` Dave Korn
@ 2006-07-05 17:10   ` Thomas Fleischmann
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Fleischmann @ 2006-07-05 17:10 UTC (permalink / raw)
  To: Dave Korn, binutils

> On 05 July 2006 17:00, Thomas Fleischmann wrote:
> 
> > Whilst the gcc doesn't support our used cpu MCF5213 100%, we use the
> > compilerswitch -m5200 to generate generic code for a MCF52xx. 
> > We also need to use inline assembly for the MCF5213 stuff (movec ...,
> > %rambar). So we have to apply a second compiler switch to be passed to
> gas
> > -Wa,-m5213 (-Wa,-mcpu=5213 for binutils 2.17).  
> > 
> > This is ok for binutils 2.16.1 but not for 2.17.
> > 
> > As the compiler passes two "cpu" selections to gas, one indirectly
> > generated by gcc's -m5200 and one direktly passed by -Wa,-mcpu=5213, gas
> is
> > "confused".  
> > File gas/config/tc-m68k.c checks this and produces an error, because of
> two
> > different selected cpu's. 
> > 
> > My suggestion is:
> > If gas is invoked with -mcpu=xxx, this should override the former
> settings.
> > Additional a warning will be produced. 
> > 
> > My included patch would produce this behavior.
> > Please could you check if I done everything right and if it is worth to
> be
> > applied to gas. 
> 
> 
>   You mean, let's patch gas to accept invalid command lines rather than
> you
> fix your invalid kludgey hacked-up build environment?  I suggest let's
> not!  I
> appreciate that you have a valid motive here owing to the disjunction
> between
> what cpus gcc understands and what cpus gas understands, but this surely
> isn't
> the way to resolve it.  The fact that it used to be accepted in 2.16.1 and
> now
> there's a check for it and it is specifically disallowed suggests that
> there
> may be some kind of problem.  Did you check the archives to see why this
> test
> was added?
> 
>   The correct fix for this situation would be to add a -m5213 option to
> gcc,
> not to try and persuade gas to accept two or more --cpu options at the
> same
> time.  It could be as simple as using the driver specs so that -m5213 gets
> turned into -m5200 when it's passed to cc1 in the CC1_SPEC and gets turned
> into -mcpu=5213 when it's passed to gas in the ASM_SPEC.  Wouldn't that do
> everything you need, and be a somewhat cleaner solution as well?

Ok, you're right :-)

As I had to find a quick solution, I forgot the gcc spec file ;-(
Your suggestion is what I was searching for.

thanks

Thomas Fleischmann
-- 


Echte DSL-Flatrate dauerhaft für 0,- Euro*!
"Feel free" mit GMX DSL! http://www.gmx.net/de/go/dsl

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-07-05 17:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-05 16:00 ERROR: already selected `xxxx' processor Thomas Fleischmann
2006-07-05 16:36 ` Dave Korn
2006-07-05 17:10   ` Thomas Fleischmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).