From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id D3CBC3858289 for ; Mon, 22 Apr 2024 15:37:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D3CBC3858289 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D3CBC3858289 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713800254; cv=none; b=gDDEpnHXCs+nhn1iKJXOcpmyBKcKKs+iD/FuviPHgJNz97a5cUYa1PKbqbmGELCSBH8ldbeTQjqR0+T1ONu4N560vWi5+7XxsK94ginR2LLi2hVi4g8b207wAp002eaL3Cu8Ao6LVfkVpjKgcnro85oq1bl3o73GQhBJXD9hNvg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713800254; c=relaxed/simple; bh=WqKOVPkBlqkqk6OXfvUrkHX6/V0nx5eNeEFB4Zl+5lU=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=DqMi7gXdfN+XdZnYsGZCpxCDJIOX9zLZc7yP0gPONI7dPFtpE2VVhfC/+p96MLvV3yUiy642iJX14lC3xeFEayooI2YM+Jx70kVSB48EXIssh7zoqUDYHLRN6PrMuWrSxFPmjURjJKmR58h9YHzw4aZjlvkYoq5ULN2tANsv4X4= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713800251; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=OWmYQ4o/BeeYB6xswLCx51w19rGDwV6v1piaDAyRgtk=; b=d7+AxchC9qog8hz36KdiCoSP0mSvO0diTjWzAJMqeDwtDmpW9w8l/DsvuAkx28duWdxcL0 C7FR5vNaLqTfcwMOB8AoGRufMGsXoyicDJ0pfG+CwZLs2DqCG4t03RNnq9dYLBvpMhGXQF MdFQPTWnQYSn9AADrqojqxthmPfaezY= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-694-i09Um84NOa2jZnVAXYpbhw-1; Mon, 22 Apr 2024 11:37:29 -0400 X-MC-Unique: i09Um84NOa2jZnVAXYpbhw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 836763C108C3; Mon, 22 Apr 2024 15:37:29 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.45.224.5]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4520A1121306; Mon, 22 Apr 2024 15:37:29 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 43MFbRfn3662951 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 22 Apr 2024 17:37:27 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 43MFbRjc3662950; Mon, 22 Apr 2024 17:37:27 +0200 Date: Mon, 22 Apr 2024 17:37:27 +0200 From: Jakub Jelinek To: libstdc++@gcc.gnu.org Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] libstdc++: Workaround kernel-headers on s390x-linux Message-ID: Reply-To: Jakub Jelinek MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi! We see FAIL: 17_intro/headers/c++1998/all_attributes.cc (test for excess errors) FAIL: 17_intro/headers/c++2011/all_attributes.cc (test for excess errors) FAIL: 17_intro/headers/c++2014/all_attributes.cc (test for excess errors) FAIL: 17_intro/headers/c++2017/all_attributes.cc (test for excess errors) FAIL: 17_intro/headers/c++2020/all_attributes.cc (test for excess errors) FAIL: 17_intro/names.cc -std=gnu++17 (test for excess errors) on s390x-linux. The first 5 are due to kernel-headers not using uglified attribute names, where contains __attribute__((packed, aligned(4))) I've filed a downstream bugreport for this in https://bugzilla.redhat.com/show_bug.cgi?id=2276084 (not really sure where to report kernel-headers issues upstream), while the last one is due to from glibc containing: #ifdef __USE_MISC # define __ctx(fld) fld #else # define __ctx(fld) __ ## fld #endif ... typedef union { double __ctx(d); float __ctx(f); } fpreg_t; and g++ predefining -D_GNU_SOURCE which implies define __USE_MISC. The following patch adds a workaround for this on the libstdc++ testsuite side, ok for trunk? 2024-04-22 Jakub Jelinek * testsuite/17_intro/names.cc (d, f): Undefine on s390*-linux*. * testsuite/17_intro/headers/c++1998/all_attributes.cc (packed): Don't define on s390. * testsuite/17_intro/headers/c++2011/all_attributes.cc (packed): Likewise. * testsuite/17_intro/headers/c++2014/all_attributes.cc (packed): Likewise. * testsuite/17_intro/headers/c++2017/all_attributes.cc (packed): Likewise. * testsuite/17_intro/headers/c++2020/all_attributes.cc (packed): Likewise. --- libstdc++-v3/testsuite/17_intro/names.cc.jj 2024-02-02 22:13:29.575359165 +0100 +++ libstdc++-v3/testsuite/17_intro/names.cc 2024-04-22 16:54:35.696710752 +0200 @@ -270,6 +270,12 @@ #undef u #endif +#if defined (__linux__) && defined (__s390__) +// defines fpreg_t::d and fpreg_t::f +#undef d +#undef f +#endif + #if defined (__linux__) && defined (__sparc__) #undef y #endif --- libstdc++-v3/testsuite/17_intro/headers/c++1998/all_attributes.cc.jj 2024-01-03 12:08:09.603789437 +0100 +++ libstdc++-v3/testsuite/17_intro/headers/c++1998/all_attributes.cc 2024-04-22 17:11:04.734990469 +0200 @@ -29,7 +29,11 @@ # define noreturn 1 # define visibility 1 #endif +#ifndef __s390__ +// kernel-headers uses __attribute__((packed,aligned(4))) on +// S390. #define packed 1 +#endif #define pure 1 // glibc's sysdeps/unix/sysv/linux/arm/sys/ucontext.h uses this on ARM. #ifndef __arm__ --- libstdc++-v3/testsuite/17_intro/headers/c++2011/all_attributes.cc.jj 2024-04-22 17:11:20.028805205 +0200 +++ libstdc++-v3/testsuite/17_intro/headers/c++2011/all_attributes.cc 2024-04-22 17:12:01.531302456 +0200 @@ -29,7 +29,11 @@ # define visibility 1 #endif #define no_unique_address 1 +#ifndef __s390__ +// kernel-headers uses __attribute__((packed,aligned(4))) on +// S390. #define packed 1 +#endif #define pure 1 // glibc's sysdeps/unix/sysv/linux/arm/sys/ucontext.h uses this on ARM. #ifndef __arm__ --- libstdc++-v3/testsuite/17_intro/headers/c++2014/all_attributes.cc.jj 2024-01-03 12:08:09.556790095 +0100 +++ libstdc++-v3/testsuite/17_intro/headers/c++2014/all_attributes.cc 2024-04-22 17:12:20.630071099 +0200 @@ -29,7 +29,11 @@ # define visibility 1 #endif #define no_unique_address 1 +#ifndef __s390__ +// kernel-headers uses __attribute__((packed,aligned(4))) on +// S390. #define packed 1 +#endif #define pure 1 // glibc's sysdeps/unix/sysv/linux/arm/sys/ucontext.h uses this on ARM. #ifndef __arm__ --- libstdc++-v3/testsuite/17_intro/headers/c++2017/all_attributes.cc.jj 2024-01-03 12:08:09.506790795 +0100 +++ libstdc++-v3/testsuite/17_intro/headers/c++2017/all_attributes.cc 2024-04-22 17:12:38.751851577 +0200 @@ -28,7 +28,11 @@ # define visibility 1 #endif #define no_unique_address 1 +#ifndef __s390__ +// kernel-headers uses __attribute__((packed,aligned(4))) on +// S390. #define packed 1 +#endif #define pure 1 // glibc's sysdeps/unix/sysv/linux/arm/sys/ucontext.h uses this on ARM. #ifndef __arm__ --- libstdc++-v3/testsuite/17_intro/headers/c++2020/all_attributes.cc.jj 2024-01-03 12:08:09.502790851 +0100 +++ libstdc++-v3/testsuite/17_intro/headers/c++2020/all_attributes.cc 2024-04-22 17:12:56.043642110 +0200 @@ -27,7 +27,11 @@ # define cold 1 # define visibility 1 #endif +#ifndef __s390__ +// kernel-headers uses __attribute__((packed,aligned(4))) on +// S390. #define packed 1 +#endif #define pure 1 // glibc's sysdeps/unix/sysv/linux/arm/sys/ucontext.h uses this on ARM. #ifndef __arm__ Jakub