]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR target/68491 (libgcc calls __get_cpuid with 0 level breaks on early...
authorUros Bizjak <ubizjak@gmail.com>
Wed, 3 May 2017 20:00:50 +0000 (22:00 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Wed, 3 May 2017 20:00:50 +0000 (22:00 +0200)
Backport from mainline
2017-05-01  Uros Bizjak  <ubizjak@gmail.com>

PR target/68491
* config/i386/cpuid.h (__get_cpuid): Always return 0 when
__get_cpuid_max returns 0.

From-SVN: r247566

gcc/ChangeLog
gcc/config/i386/cpuid.h

index b592996003ce4b331930e879d6f87de1b4736cb5..fa4ed943ddc9fc3bf1283ced9ed6aea157e11e72 100644 (file)
@@ -1,3 +1,12 @@
+2017-05-03  Uros Bizjak  <ubizjak@gmail.com>
+
+       Backport from mainline
+       2017-05-01  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/68491
+       * config/i386/cpuid.h (__get_cpuid): Always return 0 when
+       __get_cpuid_max returns 0.
+
 2017-04-21  Christophe Lyon  <christophe.lyon@linaro.org>
 
        Backport from mainline
index 1ddc6e2e6a87e339d2153a2062d13b3bcbd8eef6..c7778d989f5674397457d9b5b990acb60f37f2ea 100644 (file)
@@ -234,8 +234,9 @@ __get_cpuid (unsigned int __level,
             unsigned int *__ecx, unsigned int *__edx)
 {
   unsigned int __ext = __level & 0x80000000;
+  unsigned int __maxlevel = __get_cpuid_max (__ext, 0);
 
-  if (__get_cpuid_max (__ext, 0) < __level)
+  if (__maxlevel == 0 || __maxlevel < __level)
     return 0;
 
   __cpuid (__level, *__eax, *__ebx, *__ecx, *__edx);