aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUros Bizjak <uros@gcc.gnu.org>2017-05-01 17:38:14 +0200
committerUros Bizjak <uros@gcc.gnu.org>2017-05-01 17:38:14 +0200
commita6c78ea30381cc28ea0b2cf8f0bd584a91dda948 (patch)
tree49a39e8cce8ab3c31b76d4abbc5c9224cfec8930
parent723f4140da3d33c70b25941382bf345dd60ed18f (diff)
downloadgcc-a6c78ea30381cc28ea0b2cf8f0bd584a91dda948.zip
gcc-a6c78ea30381cc28ea0b2cf8f0bd584a91dda948.tar.gz
gcc-a6c78ea30381cc28ea0b2cf8f0bd584a91dda948.tar.bz2
re PR target/68491 (libgcc calls __get_cpuid with 0 level breaks on early 486)
PR target/68491 * config/i386/cpuid.h (__get_cpuid): Always return 0 when __get_cpuid_max returns 0. (__get_cpuid_count): Ditto. From-SVN: r247439
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/config/i386/cpuid.h6
2 files changed, 13 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 07b205c..c58e417 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+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.
+ (__get_cpuid_count): Ditto.
+
2017-05-01 Eric Botcazou <ebotcazou@adacore.com>
* tree.c (substitute_in_expr) <tcc_vl_exp>: Also inline a call if the
@@ -79,7 +86,7 @@
(init_target_to_host_charmap, target_to_host, target_strtol10): New
functions.
(maybe_warn, format_directive, parse_directive): Use new functions.
- (pass_sprintf_length::execute): Call init_target_to_host_charmap.
+ (pass_sprintf_length::execute): Call init_target_to_host_charmap.
2017-04-28 Marc Glisse <marc.glisse@inria.fr>
@@ -106,7 +113,7 @@
* ipa-inline-analysis.c (estimate_node_size_and_time,
estimate_ipcp_clone_size_and_time, do_estimate_edge_time): Likewise.
(estimate_time_after_inlining): Remove.
-
+
2017-04-28 Martin Liska <mliska@suse.cz>
* doc/gcov.texi: Enhance documentation of gcov.
diff --git a/gcc/config/i386/cpuid.h b/gcc/config/i386/cpuid.h
index d451e977..f915d2d 100644
--- a/gcc/config/i386/cpuid.h
+++ b/gcc/config/i386/cpuid.h
@@ -246,8 +246,9 @@ __get_cpuid (unsigned int __leaf,
unsigned int *__ecx, unsigned int *__edx)
{
unsigned int __ext = __leaf & 0x80000000;
+ unsigned int __maxlevel = __get_cpuid_max (__ext, 0);
- if (__get_cpuid_max (__ext, 0) < __leaf)
+ if (__maxlevel == 0 || __maxlevel < __leaf)
return 0;
__cpuid (__leaf, *__eax, *__ebx, *__ecx, *__edx);
@@ -262,8 +263,9 @@ __get_cpuid_count (unsigned int __leaf, unsigned int __subleaf,
unsigned int *__ecx, unsigned int *__edx)
{
unsigned int __ext = __leaf & 0x80000000;
+ unsigned int __maxlevel = __get_cpuid_max (__ext, 0);
- if (__get_cpuid_max (__ext, 0) < __leaf)
+ if (__maxlevel == 0 || __maxlevel < __leaf)
return 0;
__cpuid_count (__leaf, __subleaf, *__eax, *__ebx, *__ecx, *__edx);