From 852c5acb3054ca2f68a0fe929e51b1b916276546 Mon Sep 17 00:00:00 2001
From: geoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Fri, 22 Sep 2006 23:50:51 +0000
Subject: [PATCH] 	* config/i386/driver-i386.c: Always define
 host_detect_local_cpu. 	* config/i386/i386.h: Define
 EXTRA_SPEC_FUNCTIONS on any i386 	or x86_64 host.  Define
 HAVE_LOCAL_CPU_DETECT. 	(CC1_CPU_SPEC): Make conditional on
 HAVE_LOCAL_CPU_DETECT rather 	than replicating condition above. 	*
 config.host (i[34567]86-*-*): Always use driver-i386.o.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@117159 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog                 | 7 +++++++
 gcc/config.host               | 7 ++-----
 gcc/config/i386/driver-i386.c | 8 +-------
 gcc/config/i386/i386.h        | 9 ++++++---
 4 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d8683fbd26ee..0b0ef57d94e4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,12 @@
 2006-09-22  Geoffrey Keating  <geoffk@apple.com>
 
+	* config/i386/driver-i386.c: Always define host_detect_local_cpu.
+	* config/i386/i386.h: Define EXTRA_SPEC_FUNCTIONS on any i386
+	or x86_64 host.  Define HAVE_LOCAL_CPU_DETECT.
+	(CC1_CPU_SPEC): Make conditional on HAVE_LOCAL_CPU_DETECT rather
+	than replicating condition above.
+	* config.host (i[34567]86-*-*): Always use driver-i386.o.
+
 	* config/darwin.h (LINK_SYSROOT_SPEC): New.
 	(LINK_SPEC): If TARGET_SYSTEM_ROOT is defined, pass it to
 	the linker by default.
diff --git a/gcc/config.host b/gcc/config.host
index b36066f44e5b..4547864d9c11 100644
--- a/gcc/config.host
+++ b/gcc/config.host
@@ -97,11 +97,8 @@ esac
 case ${host} in
   i[34567]86-*-* \
   | x86_64-*-* )
-    # include the support for -march=native only when not cross compiling
-    if test x${host} = x${target} ; then
-      host_extra_gcc_objs="driver-i386.o"
-      host_xmake_file="${host_xmake_file} i386/x-i386"
-    fi
+    host_extra_gcc_objs="driver-i386.o"
+    host_xmake_file="${host_xmake_file} i386/x-i386"
     ;;
 esac
 
diff --git a/gcc/config/i386/driver-i386.c b/gcc/config/i386/driver-i386.c
index f13abd11dc5e..979a6a5025dc 100644
--- a/gcc/config/i386/driver-i386.c
+++ b/gcc/config/i386/driver-i386.c
@@ -22,11 +22,6 @@ Boston, MA 02110-1301, USA.  */
 #include "system.h"
 #include <stdlib.h>
 
-#ifndef CROSS_COMPILE
-/* This file shouldn't even be included in a cross compiler, but
-   let's be sure.  */
-extern const char *host_detect_local_cpu (int argc, const char **argv);
-
 #ifdef GCC_VERSION
 #define cpuid(num,a,b,c,d) \
   asm volatile ("xchgl %%ebx, %1; cpuid; xchgl %%ebx, %1" \
@@ -170,5 +165,4 @@ const char *host_detect_local_cpu (int argc, const char **argv)
 {
   return concat ("-m", argv[0], "=i386", NULL);
 }
-#endif
-#endif
+#endif /* GCC_VERSION */
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index f2e6ce06a960..4993a94f5ce5 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -274,12 +274,15 @@ extern int x86_prefetch_sse;
 #define OPTIMIZATION_OPTIONS(LEVEL, SIZE) \
   optimization_options ((LEVEL), (SIZE))
 
-/* -march=native handling only makes sense with a native compiler.  */
-#ifndef CROSS_COMPILE
+/* -march=native handling only makes sense with compiler running on
+   an x86 or x86_64 chip.  If changing this condition, also change
+   the condition in driver-i386.c.  */
+#if defined(__i386__) || defined(__x86_64__)
 /* In driver-i386.c.  */
 extern const char *host_detect_local_cpu (int argc, const char **argv);
 #define EXTRA_SPEC_FUNCTIONS \
   { "local_cpu_detect", host_detect_local_cpu },
+#define HAVE_LOCAL_CPU_DETECT
 #endif
 
 /* Support for configure-time defaults of some command line options.
@@ -311,7 +314,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
 %{mno-intel-syntax:-masm=att \
 %n`-mno-intel-syntax' is deprecated. Use `-masm=att' instead.\n}"
 
-#ifdef CROSS_COMPILE
+#ifndef HAVE_LOCAL_CPU_DETECT
 #define CC1_CPU_SPEC CC1_CPU_SPEC_1
 #else
 #define CC1_CPU_SPEC CC1_CPU_SPEC_1 \
-- 
GitLab