This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/26877] New: configure switches --with-arch and --with-tune are broken on x86
- From: "lasse dot collin at tukaani dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Mar 2006 16:51:51 -0000
- Subject: [Bug target/26877] New: configure switches --with-arch and --with-tune are broken on x86
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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