Arm: Add GCC_CPUINFO override

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

Tests using these are added later on.

gcc/ChangeLog:

	* config/arm/driver-arm.c (host_detect_local_cpu): Add GCC_CPUINFO.
This commit is contained in:
Tamar Christina 2020-07-17 13:12:00 +01:00
parent 55f6addc0c
commit 34a6c43487
1 changed files with 7 additions and 1 deletions

View File

@ -61,6 +61,7 @@ host_detect_local_cpu (int argc, const char **argv)
FILE *f = NULL;
bool arch;
const struct vendor_cpu *cpu_table = NULL;
char *fcpu_info = NULL;
if (argc < 1)
goto not_found;
@ -69,7 +70,12 @@ host_detect_local_cpu (int argc, const char **argv)
if (!arch && strcmp (argv[0], "cpu") != 0 && strcmp (argv[0], "tune"))
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;