From: Tamar Christina Date: Fri, 17 Jul 2020 12:12:00 +0000 (+0100) Subject: Arm: Add GCC_CPUINFO override X-Git-Tag: releases/gcc-9.4.0~743 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a1360f71887b6f3832f7ec045da245b2e3fa48a0;p=thirdparty%2Fgcc.git 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. (cherry picked from commit 34a6c43487caf3a2a0ec9c7c79c526d116abc8b9) --- diff --git a/gcc/config/arm/driver-arm.c b/gcc/config/arm/driver-arm.c index a13f905e9f86..7d5d82ec7e6e 100644 --- a/gcc/config/arm/driver-arm.c +++ b/gcc/config/arm/driver-arm.c @@ -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;