[PATCH] Fix sparc64-*-linux* bi-arch compiler

Jakub Jelinek jakub@redhat.com
Fri May 21 15:10:00 GMT 2004


Hi!

--with-cpu= changes from last year broke sparc64 bi-arch compiler.
A -m32/-m64 compiler defaulting to -m32 is built with:
../configure sparc64-redhat-linux --with-cpu=v7 ...
But with addition to OPTION_DEFAULT_SPECS, -mcpu=v7 is passed
when the user did not specify any -mcpu= even in -m64, which is deadly
(-m64 code requires v9 at least).

I have applied the following fix to the trunk and gcc-3_4-branch.

2004-05-21  Jakub Jelinek  <jakub@redhat.com>

	* config/sparc/linux64.h (OPTION_DEFAULT_SPECS): If SPARC_BI_ARCH,
	override sparc.h definition.

--- gcc/config/sparc/linux64.h.jj	2004-04-01 18:10:09.000000000 +0200
+++ gcc/config/sparc/linux64.h	2004-05-21 12:12:58.545786085 +0200
@@ -224,6 +224,27 @@ Boston, MA 02111-1307, USA.  */
 "
 #endif
 
+/* Support for a compile-time default CPU, et cetera.  The rules are:
+   --with-cpu is ignored if -mcpu is specified.
+   --with-tune is ignored if -mtune is specified.
+   --with-float is ignored if -mhard-float, -msoft-float, -mfpu, or -mno-fpu
+     are specified.
+   In the SPARC_BI_ARCH compiler we cannot pass %{!mcpu=*:-mcpu=%(VALUE)}
+   here, otherwise say -mcpu=v7 would be passed even when -m64.
+   CC1_SPEC above takes care of this instead.  */
+#undef OPTION_DEFAULT_SPECS
+#if DEFAULT_ARCH32_P
+#define OPTION_DEFAULT_SPECS \
+  {"cpu", "%{!m64:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
+  {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \
+  {"float", "%{!msoft-float:%{!mhard-float:%{!fpu:%{!no-fpu:-m%(VALUE)-float}}}}" }
+#else
+#define OPTION_DEFAULT_SPECS \
+  {"cpu", "%{!m32:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
+  {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \
+  {"float", "%{!msoft-float:%{!mhard-float:%{!fpu:%{!no-fpu:-m%(VALUE)-float}}}}" }
+#endif
+
 #if DEFAULT_ARCH32_P
 #define MULTILIB_DEFAULTS { "m32" }
 #else


	Jakub



More information about the Gcc-patches mailing list