public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/26877]  New: configure switches --with-arch and --with-tune are broken on x86
@ 2006-03-26 16:51 lasse dot collin at tukaani dot org
  2006-03-30 20:25 ` [Bug target/26877] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: lasse dot collin at tukaani dot org @ 2006-03-26 16:51 UTC (permalink / raw)
  To: gcc-bugs

I was trying to build GCC on x86 so that it would default to -march=i586
-mtune=i686. I specified --with-arch=i586 --with-tune=i686 to configure, but
the resulting gcc still used -mtune=i586 instead of -mtune=i686.

The configure switches --with-arch, --with-cpu and --with-tune write
appropriate values to gcc/configargs.h correctly. However, if --with-arch=foo
has been specified, the cpu and tune values have no effect, because in
gcc/config/i386/i386.h the order of arch/tune/cpu is wrong:

#define OPTION_DEFAULT_SPECS \
  {"arch", "%{!march=*:-march=%(VALUE)}"}, \
  {"tune", "%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}" }, \
  {"cpu", "%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}" }

Example command line: gcc -o foo foo.c
  "arch": -march= hasn't been given on the command line, append
          -march=%(VALUE). This is correct.
  "tune": -mtune= hasn't been given on the command line, neither
          is -mcpu=. But -march is (we just appended it) so
          -mtune=%(VALUE) does NOT get appended. This is wrong.
  "cpu":  Same as with "tune".

The solution is changing the order from arch/tune/cpu to tune/cpu/arch. This
problem applies to at least GCC 3.4.6 and 4.1.0; probably all versions since
3.4.0.


--- gcc-4.1.0/gcc/config/i386/i386.h.orig       2006-03-24 23:22:04.000000000
+0200
+++ gcc-4.1.0/gcc/config/i386/i386.h    2006-03-24 23:39:30.000000000 +0200
@@ -269,9 +269,9 @@

 /* Support for configure-time defaults of some command line options.  */
 #define OPTION_DEFAULT_SPECS \
-  {"arch", "%{!march=*:-march=%(VALUE)}"}, \
   {"tune", "%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}" }, \
-  {"cpu", "%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}" }
+  {"cpu", "%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}" }, \
+  {"arch", "%{!march=*:-march=%(VALUE)}"}

 /* Specs for the compiler proper */


-- 
           Summary: configure switches --with-arch and --with-tune are
                    broken on x86
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: trivial
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: lasse dot collin at tukaani dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26877


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

end of thread, other threads:[~2006-07-20  7:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-26 16:51 [Bug target/26877] New: configure switches --with-arch and --with-tune are broken on x86 lasse dot collin at tukaani dot org
2006-03-30 20:25 ` [Bug target/26877] " pinskia at gcc dot gnu dot org
2006-07-19 21:59 ` echristo at apple dot com
2006-07-20  7:40 ` echristo at apple dot com
2006-07-20  7:40 ` echristo at gcc dot gnu dot org

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).