From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2178) id A691F3898532; Wed, 19 May 2021 09:54:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A691F3898532 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Florian Weimer To: glibc-cvs@sourceware.org Subject: [glibc] powerpc64le: Check HWCAP bits against compiler build flags X-Act-Checkin: glibc X-Git-Author: Florian Weimer X-Git-Refname: refs/heads/master X-Git-Oldrev: eb24865637a271ab7dad13190330105eab0d478d X-Git-Newrev: d337345ce145e23c5f3a956f349d924fdf54ce2d Message-Id: <20210519095421.A691F3898532@sourceware.org> Date: Wed, 19 May 2021 09:54:21 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 09:54:21 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=d337345ce145e23c5f3a956f349d924fdf54ce2d commit d337345ce145e23c5f3a956f349d924fdf54ce2d Author: Florian Weimer Date: Wed May 19 11:09:57 2021 +0200 powerpc64le: Check HWCAP bits against compiler build flags When built with GCC 11.1 and -mcpu=power9, ld.so prints this error message when running on POWER8: Fatal glibc error: CPU lacks ISA 3.00 support (POWER9 or later required) Diff: --- sysdeps/powerpc/powerpc64/le/dl-hwcap-check.h | 52 +++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/sysdeps/powerpc/powerpc64/le/dl-hwcap-check.h b/sysdeps/powerpc/powerpc64/le/dl-hwcap-check.h new file mode 100644 index 0000000000..0437ae4d52 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/le/dl-hwcap-check.h @@ -0,0 +1,52 @@ +/* Check for hardware capabilities after HWCAP parsing. powerpc64le version. + Copyright (C) 2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _DL_HWCAP_CHECK_H +#define _DL_HWCAP_CHECK_H + +#include + +static inline void +dl_hwcap_check (void) +{ +#ifdef _ARCH_PWR9 + if ((GLRO (dl_hwcap2) & PPC_FEATURE2_ARCH_3_00) == 0) + _dl_fatal_printf ("\ +Fatal glibc error: CPU lacks ISA 3.00 support (POWER9 or later required)\n"); +#endif +#ifdef __FLOAT128_HARDWARE__ + if ((GLRO (dl_hwcap2) & PPC_FEATURE2_HAS_IEEE128) == 0) + _dl_fatal_printf ("\ +Fatal glibc error: CPU lacks float128 support (POWER 9 or later required)\n"); +#endif + /* This check is not actually reached when building for POWER10 and + running on POWER9 because there are faulting PCREL instructions + before this point. */ +#if defined _ARCH_PWR10 || defined __PCREL__ + if ((GLRO (dl_hwcap2) & PPC_FEATURE2_ARCH_3_1) == 0) + _dl_fatal_printf ("\ +Fatal glibc error: CPU lacks ISA 3.10 support (POWER10 or later required)\n"); +#endif +#ifdef __MMA__ + if ((GLRO (dl_hwcap2) & PPC_FEATURE2_MMA) == 0) + _dl_fatal_printf ("\ +Fatal glibc error: CPU lacks MMA support (POWER10 or later required)\n"); +#endif +} + +#endif /* _DL_HWCAP_CHECK_H */