From patchwork Tue Mar 14 00:23:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam James X-Patchwork-Id: 1756628 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=sg4DhKDx; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PbDmg3mHVz1yWp for ; Tue, 14 Mar 2023 11:24:33 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4A9AC3858C66 for ; Tue, 14 Mar 2023 00:24:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4A9AC3858C66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678753468; bh=QHNSB2dgmJWPwejcxBbs/CMcwu734f3j1i3IMQDaeS4=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=sg4DhKDxae+7gtmRlgKM7/6ExWs3cTAwhYtjbQsQ90a+POqwzgdgnI7jPFPqbKs1o IDXhH/qgdGKF+0TyGHGiZL0Dw50FQ/6GjTfoOXKmB2jj8/uGJm3SmduM2pMOaVvY5c m59NiPEyAUd7jFdRtHZLdcU8rVLTzDb01TQJCy14= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id 941673858D32 for ; Tue, 14 Mar 2023 00:24:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 941673858D32 To: gcc-patches@gcc.gnu.org Cc: Kito Cheng , Palmer Dabbelt , Andrew Waterman , Jim Wilson , Ju-Zhe Zhong , Sam James Subject: [PATCH v4 1/2] RISC-V: Avoid calloc() poisoning on musl Date: Tue, 14 Mar 2023 00:23:53 +0000 Message-Id: <20230314002354.367655-1-sam@gentoo.org> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Sam James via Gcc-patches From: Sam James Reply-To: Sam James Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" This fixes errors like: ``` In file included from /usr/include/pthread.h:30, from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/riscv64-gentoo-linux-musl/bits/gthr-default.h:35, from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/riscv64-gentoo-linux-musl/bits/gthr.h:148, from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/ext/atomicity.h:35, from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/bits/ios_base.h:39, from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/ios:42, from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/istream:38, from /usr/lib/gcc/riscv64-gentoo-linux-musl/12/include/g++-v12/sstream:38, from /var/tmp/portage/sys-devel/gcc-13.0.1_pre20230305/work/gcc-13-20230305/gcc/config/riscv/genrvv-type-indexer.cc:22: /usr/include/sched.h:84:7: error: attempt to use poisoned "calloc" 84 | void *calloc(size_t, size_t); | ^ /usr/include/sched.h:124:36: error: attempt to use poisoned "calloc" 124 | #define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n))) | ^ make[3]: *** [Makefile:2855: build/genrvv-type-indexer.o] Error 1 ``` See also 3b21c21f3f5726823e19728fdd1571a14aae0fb3 and 49d508065bdd36fb1a9b6aad9666b1edb5e06474, which was fixed in PR106102. gcc/ChangeLog: * config/riscv/genrvv-type-indexer.cc: Avoid calloc() poisoning on musl by including earlier. * system.h: Add INCLUDE_SSTREAM. Signed-off-by: Sam James --- gcc/config/riscv/genrvv-type-indexer.cc | 2 +- gcc/system.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/config/riscv/genrvv-type-indexer.cc b/gcc/config/riscv/genrvv-type-indexer.cc index 0ef1d766002..e677b55290c 100644 --- a/gcc/config/riscv/genrvv-type-indexer.cc +++ b/gcc/config/riscv/genrvv-type-indexer.cc @@ -14,12 +14,12 @@ along with GCC; see the file COPYING3. If not see . */ #include "bconfig.h" +#define INCLUDE_SSTREAM #include "system.h" #include "errors.h" #include "coretypes.h" -#include #include #include diff --git a/gcc/system.h b/gcc/system.h index 64cd5a49258..cf45db3f97e 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -751,6 +751,10 @@ extern int vsnprintf (char *, size_t, const char *, va_list); # include #endif +#ifdef INCLUDE_SSTREAM +# include +#endif + #ifdef INCLUDE_MALLOC_H #if defined(HAVE_MALLINFO) || defined(HAVE_MALLINFO2) #include From patchwork Tue Mar 14 00:23:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam James X-Patchwork-Id: 1756629 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=tcwiGbn1; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PbDqL40W0z247D for ; Tue, 14 Mar 2023 11:26:54 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6CD823858C2F for ; Tue, 14 Mar 2023 00:26:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6CD823858C2F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678753612; bh=Y/p53GAisScfbSNPapJZZob07hVtI07XJg9wUQ071pw=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=tcwiGbn1raN840baluBOdGg2VoLLyn5zb1sgDLRyrkqMg6w5rpucbN24bsZJlG9A2 rGIm8/QJMSUJvhOj0jH3vY+P5eh4GVxo+mJ3M5ic9hTd9z1mcrctQGooAJw1yNeFTr U38ZA2WNzo6aP+hgweK+QrVeo6R5ibBaIhtNcNiI= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id 3478C3858C5F for ; Tue, 14 Mar 2023 00:26:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3478C3858C5F To: gcc-patches@gcc.gnu.org Cc: Kito Cheng , Palmer Dabbelt , Andrew Waterman , Jim Wilson , Ju-Zhe Zhong , Sam James Subject: [PATCH v4 2/2] gcc: Drop obsolete INCLUDE_PTHREAD_H Date: Tue, 14 Mar 2023 00:23:54 +0000 Message-Id: <20230314002354.367655-2-sam@gentoo.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230314002354.367655-1-sam@gentoo.org> References: <20230314002354.367655-1-sam@gentoo.org> MIME-Version: 1.0 X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Sam James via Gcc-patches From: Sam James Reply-To: Sam James Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" This is no longer used since 0a62889c7a155f8ed971860d68870dc9c46bb004, so let's clean it up. gcc/ChangeLog: * system.h: Drop unused INCLUDE_PTHREAD_H. Signed-off-by: Sam James Signed-off-by: Sam James --- gcc/system.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/gcc/system.h b/gcc/system.h index cf45db3f97e..3fdad7abf1e 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -761,10 +761,6 @@ extern int vsnprintf (char *, size_t, const char *, va_list); #endif #endif -#ifdef INCLUDE_PTHREAD_H -#include -#endif - #ifdef INCLUDE_ISL #ifdef HAVE_isl #include