Hi All,

This adds an in intentionally undocumented environment variable
GCC_CPUINFO which can be used to test -mcpu=native.

Tests using this are added later on.

Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.

Ok for master, GCC 10, 9 and 8?

Thanks,
Tamar

gcc/ChangeLog:

        * config/aarch64/driver-aarch64.c (host_detect_local_cpu):
        Add GCC_CPUINFO.

-- 
diff --git a/gcc/config/aarch64/driver-aarch64.c b/gcc/config/aarch64/driver-aarch64.c
index 78616379189e80e75a28973f6b90ca4ca287e4bc..498350f5588e1109472ed95a61f1021d697eb057 100644
--- a/gcc/config/aarch64/driver-aarch64.c
+++ b/gcc/config/aarch64/driver-aarch64.c
@@ -230,6 +230,7 @@ host_detect_local_cpu (int argc, const char **argv)
   uint64_t extension_flags = 0;
   uint64_t default_flags = 0;
   std::string buf;
+  char *fcpu_info;
 
   gcc_assert (argc);
 
@@ -247,7 +248,11 @@ host_detect_local_cpu (int argc, const char **argv)
   if (!arch && !tune && !cpu)
     goto not_found;
 
-  f = fopen ("/proc/cpuinfo", "r");
+  fcpu_info = getenv ("GCC_CPUINFO");
+  if (fcpu_info)
+    f = fopen (fcpu_info, "r");
+  else
+    f = fopen ("/proc/cpuinfo", "r");
 
   if (f == NULL)
     goto not_found;

Reply via email to