public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Paul Clarke <pc@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] [powerpc] fenv_libc.h: protect use of __builtin_cpu_supports
Date: Tue, 09 Jul 2019 18:12:00 -0000	[thread overview]
Message-ID: <20190709181254.16511.qmail@sourceware.org> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="us-ascii", Size: 2110 bytes --]

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b5232c9f9e6048b8f780d3cbfadbc8e59bb90ce4

commit b5232c9f9e6048b8f780d3cbfadbc8e59bb90ce4
Author: Paul A. Clarke <pc@us.ibm.com>
Date:   Mon Jul 8 17:06:19 2019 -0500

    [powerpc] fenv_libc.h: protect use of __builtin_cpu_supports
    
    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.

Diff:
---
 ChangeLog                       | 5 +++++
 sysdeps/powerpc/fpu/fenv_libc.h | 4 +++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index ed7283f..158337a 100644
--- 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]
diff --git a/sysdeps/powerpc/fpu/fenv_libc.h b/sysdeps/powerpc/fpu/fenv_libc.h
index 55b1697..9861f18 100644
--- a/sysdeps/powerpc/fpu/fenv_libc.h
+++ b/sysdeps/powerpc/fpu/fenv_libc.h
@@ -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.  */


                 reply	other threads:[~2019-07-09 18:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190709181254.16511.qmail@sourceware.org \
    --to=pc@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).