From patchwork Tue Jul 9 14:41:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Paul A. Clarke" X-Patchwork-Id: 33629 Received: (qmail 63054 invoked by alias); 9 Jul 2019 14:41:49 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 63045 invoked by uid 89); 9 Jul 2019 14:41:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 spammy= X-HELO: mx0a-001b2d01.pphosted.com From: "Paul A. Clarke" To: libc-alpha@sourceware.org Cc: tuliom@ascii.art.br, fweimer@redhat.com, schwab@suse.de, law@redhat.com, carlos@redhat.com Subject: [PATCH v2] [powerpc] fenv_libc.h: protect use of __builtin_cpu_supports() Date: Tue, 9 Jul 2019 09:41:40 -0500 MIME-Version: 1.0 x-cbid: 19070914-2213-0000-0000-000003AB72EF X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00011400; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000286; SDB=6.01229723; UDB=6.00647660; IPR=6.01010983; MB=3.00027652; MTD=3.00000008; XFM=3.00000015; UTC=2019-07-09 14:41:44 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19070914-2214-0000-0000-00005F29C851 Message-Id: <1562683300-7622-1-git-send-email-pc@us.ibm.com> From: "Paul A. Clarke" 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] Fixes 3db85a9814784a74536a1f0e7b7ddbfef7dc84bb. 2019-07-09 Paul A. Clarke * sysdeps/powerpc/fpu/fenv_libc.h (_FPU_GET_RC): Protect use of __builtin_cpu_supports with __BUILTIN_CPU_SUPPORTS__. v2: No source changes. Corrected subject and commit message to reflect correct name of file changed. --- sysdeps/powerpc/fpu/fenv_libc.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sysdeps/powerpc/fpu/fenv_libc.h b/sysdeps/powerpc/fpu/fenv_libc.h index 55b1697..59a8c44 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. */