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