From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 8CF47386102F for ; Wed, 12 May 2021 07:43:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8CF47386102F Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 14C7XDmE011803 for ; Wed, 12 May 2021 03:43:28 -0400 Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com with ESMTP id 38ga4w18uw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 12 May 2021 03:43:28 -0400 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 14C7h3rw022862 for ; Wed, 12 May 2021 07:43:26 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma06fra.de.ibm.com with ESMTP id 38dhwh146d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 12 May 2021 07:43:25 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 14C7gunB36635046 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 12 May 2021 07:42:57 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 93750A4065 for ; Wed, 12 May 2021 07:43:23 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 702C7A405C for ; Wed, 12 May 2021 07:43:23 +0000 (GMT) Received: from li-ab9d22cc-354d-11b2-a85c-e984af76f811.ibm.com (unknown [9.171.73.145]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Wed, 12 May 2021 07:43:23 +0000 (GMT) Subject: Re: [PATCH 3/3] s390x: Check HWCAP bits against compiler flags To: libc-alpha@sourceware.org References: From: Stefan Liebler Message-ID: <5e7849a4-fd6d-26fd-e89f-fa385e946e46@linux.ibm.com> Date: Wed, 12 May 2021 09:43:23 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: F6XZyNVHUdtWv2bC-nNl_jp0ZMX6W-N- X-Proofpoint-GUID: F6XZyNVHUdtWv2bC-nNl_jp0ZMX6W-N- Content-Transfer-Encoding: 7bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-05-12_03:2021-05-11, 2021-05-12 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 priorityscore=1501 spamscore=0 suspectscore=0 impostorscore=0 adultscore=0 mlxscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 clxscore=1015 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105120053 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 07:43:31 -0000 On 06/05/2021 14:30, Florian Weimer via Libc-alpha wrote: > When compiled with GCC 11.1 and -march=z14 -O3 build flags, running > ld.so (or any dynamically linked program) prints: > > Fatal glibc error: CPU lacks VXE support (z14 or later required) > > Co-Authored-By: Stefan Liebler > --- > sysdeps/s390/s390-64/dl-hwcap-check.h | 40 +++++++++++++++++++++++++++ > 1 file changed, 40 insertions(+) > create mode 100644 sysdeps/s390/s390-64/dl-hwcap-check.h > > diff --git a/sysdeps/s390/s390-64/dl-hwcap-check.h b/sysdeps/s390/s390-64/dl-hwcap-check.h > new file mode 100644 > index 0000000000..87e18be6bd > --- /dev/null > +++ b/sysdeps/s390/s390-64/dl-hwcap-check.h > @@ -0,0 +1,40 @@ > +/* Check for hardware capabilities after HWCAP parsing. S390 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) > +{ > +#if defined __ARCH__ > +# if __ARCH__ >= 13 > + if (!(GLRO(dl_hwcap) & HWCAP_S390_VXRS_EXT2)) > + _dl_fatal_printf ("\ > +Fatal glibc error: CPU lacks VXRS_EXT2 support (z15 or later required)\n"); > +# elif __ARCH__ >= 12 > + if (!(GLRO(dl_hwcap) & HWCAP_S390_VXE)) > + _dl_fatal_printf ("\ > +Fatal glibc error: CPU lacks VXE support (z14 or later required)\n"); > +# endif > +#endif /* __ARCH__ */ > +} > + > +#endif /* _DL_HWCAP_CHECK_H */ > Hi Florian, while running some tests, I got the messages as expected: on z13: - "-march=z13" => no message - "-march=z14" => "z14 or later required" - "-march=z15" => "z15 or later required" on z14: - "-march=z13" => no message - "-march=z14" => no message - "-march=z15" => "z15 or later required" on z15: - "-march=z13" => no message - "-march=z14" => no message - "-march=z15" => no message Reviewed-by: Stefan Liebler Thanks, Stefan