]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
AArch64: Add GCC_CPUINFO override
authorTamar Christina <tamar.christina@arm.com>
Fri, 17 Jul 2020 12:10:53 +0000 (13:10 +0100)
committerTamar Christina <tamar.christina@arm.com>
Fri, 21 Aug 2020 15:25:57 +0000 (16:25 +0100)
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.

gcc/ChangeLog:

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

(cherry picked from commit 55f6addc0c102eab2bf19d94de3ce52f9de0ab91)

gcc/config/aarch64/driver-aarch64.c

index 2a5536d45ae3579f95df1d728393a39e81b24722..1d1d99f72082d8bec8584081899ff6507fcb670b 100644 (file)
@@ -259,6 +259,7 @@ host_detect_local_cpu (int argc, const char **argv)
   unsigned long default_flags = 0;
   std::string buf;
   size_t sep_pos = -1;
+  char *fcpu_info;
 
   gcc_assert (argc);
 
@@ -276,7 +277,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;