[powerpc] fenv_libc.h: protect use of __builtin_cpu_supports
authorPaul A. Clarke <pc@us.ibm.com>
Mon, 8 Jul 2019 22:06:19 +0000 (17:06 -0500)
committerPaul A. Clarke <pc@us.ibm.com>
Tue, 9 Jul 2019 18:09:35 +0000 (13:09 -0500)
Using __builtin_cpu_supports() requires support in GCC and Glibc.
My recent patch to fenv_libc.h added an unprotected use of
__builtin_cpu_supports().  Compilation of Glibc itself will fail
with a sufficiently new GCC and sufficiently old Glibc:

../sysdeps/powerpc/fpu/fegetexcept.c: In function ‘__fegetexcept’:
../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]

Reviewed-by: Florian Weimer <fweimer@redhat.com>
Fixes 3db85a9814784a74536a1f0e7b7ddbfef7dc84bb.

ChangeLog
sysdeps/powerpc/fpu/fenv_libc.h

index ed7283f..158337a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2019-07-09  Paul A. Clarke  <pc@us.ibm.com>
+    
+       * sysdeps/powerpc/fpu/fenv_libc.h (_FPU_GET_RC): Protect use of
+       __builtin_cpu_supports with __BUILTIN_CPU_SUPPORTS__.
+
 2019-07-08  DJ Delorie  <dj@redhat.com>
 
        [BZ #23501]
index 55b1697..9861f18 100644 (file)
@@ -47,12 +47,14 @@ extern const fenv_t *__fe_mask_env (void) attribute_hidden;
 
 #ifdef _ARCH_PWR9
 # define fegetenv_status() fegetenv_status_ISA300()
-#else
+#elif defined __BUILTIN_CPU_SUPPORTS__
 # define fegetenv_status()                                             \
   (__glibc_likely (__builtin_cpu_supports ("arch_3_00"))               \
    ? fegetenv_status_ISA300()                                          \
    : fegetenv_register()                                               \
   )
+#else
+# define fegetenv_status() fegetenv_register ()
 #endif
 
 /* Equivalent to fesetenv, but takes a fenv_t instead of a pointer.  */