dfa500
commit b5232c9f9e6048b8f780d3cbfadbc8e59bb90ce4
dfa500
Author: Paul A. Clarke <pc@us.ibm.com>
dfa500
Date:   Mon Jul 8 17:06:19 2019 -0500
dfa500
dfa500
    [powerpc] fenv_libc.h: protect use of __builtin_cpu_supports
dfa500
    
dfa500
    Using __builtin_cpu_supports() requires support in GCC and Glibc.
dfa500
    My recent patch to fenv_libc.h added an unprotected use of
dfa500
    __builtin_cpu_supports().  Compilation of Glibc itself will fail
dfa500
    with a sufficiently new GCC and sufficiently old Glibc:
dfa500
    
dfa500
    ../sysdeps/powerpc/fpu/fegetexcept.c: In function ‘__fegetexcept’:
dfa500
    ../sysdeps/powerpc/fpu/fenv_libc.h:52:20: error: builtin ‘__builtin_cpu_supports’ needs GLIBC (2.23 and newer) that exports hardware capability bits [-Werror]
dfa500
    
dfa500
    Reviewed-by: Florian Weimer <fweimer@redhat.com>
dfa500
    Fixes 3db85a9814784a74536a1f0e7b7ddbfef7dc84bb.
dfa500
dfa500
diff --git a/sysdeps/powerpc/fpu/fenv_libc.h b/sysdeps/powerpc/fpu/fenv_libc.h
dfa500
index cc00df033da47c1a..9dca6e760cc51946 100644
dfa500
--- a/sysdeps/powerpc/fpu/fenv_libc.h
dfa500
+++ b/sysdeps/powerpc/fpu/fenv_libc.h
dfa500
@@ -48,12 +48,14 @@ extern const fenv_t *__fe_mask_env (void) attribute_hidden;
dfa500
 
dfa500
 #ifdef _ARCH_PWR9
dfa500
 # define fegetenv_status() fegetenv_status_ISA300()
dfa500
-#else
dfa500
+#elif defined __BUILTIN_CPU_SUPPORTS__
dfa500
 # define fegetenv_status()						\
dfa500
   (__glibc_likely (__builtin_cpu_supports ("arch_3_00"))		\
dfa500
    ? fegetenv_status_ISA300()						\
dfa500
    : fegetenv_register()						\
dfa500
   )
dfa500
+#else
dfa500
+# define fegetenv_status() fegetenv_register ()
dfa500
 #endif
dfa500
 
dfa500
 /* Equivalent to fesetenv, but takes a fenv_t instead of a pointer.  */