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: 69202 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1480825wrd; Mon, 13 Mar 2023 17:24:53 -0700 (PDT) X-Google-Smtp-Source: AK7set+tY/zyc43nEnZu9VGaEDU8uSXNOKQ6pUX+NLnmEDGeOdVJoVuUbwjGULsXBUVIvRtKwbW3 X-Received: by 2002:a17:906:d210:b0:922:6bde:2530 with SMTP id w16-20020a170906d21000b009226bde2530mr385791ejz.32.1678753493566; Mon, 13 Mar 2023 17:24:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678753493; cv=none; d=google.com; s=arc-20160816; b=XKOTl/lY0CqA6lMjBj79hSTS+1jc9PZUwj0UqzbB0kvzmkIZYGN5xK1+VRX8YeW55v SQnaIOuqjov7Qbagmfmi235Gb4wsUm1U7VCky3IJo/ILCJ0HGn/+WV1L69EYuW5ot8Pa Pp6Pv5k1st+t38NnC9jzbHIhMVEwFoWDAIZUFfPQK1cRNu+uazOpUQSh8wgpmsXRD9Cy ANRSchXAyhXo8td4THF9Wdry7AUq9vMot28A7oVIDj7sLiPDlsA5kqgUVDajjvIdWzD7 tXlY7hszxfjGSVDri/qby9fCFoS8qtWWzuxQGPd8Ll98hLuQ/XSN6hxhZceHIjw691Xx ogRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=QHNSB2dgmJWPwejcxBbs/CMcwu734f3j1i3IMQDaeS4=; b=jeR6jTJsyexUt45DwvaaIGZThHabGozCxXajiqWddHuvC83A0jlgi1+Ca084NJVE3F lyw0Ia4nb3y1UH2ygPhYpncVgnSB15Q92rHKFYtDjSJtojcjt/WAWijxjPIghMc4PvaQ feraEMR5zx2+iuhum+blV4IcglSgRbdzvWrMGkK31csJ+kvENT2jYkIQ5lclbiPtFAHx 9cKlNYv/e02MorVKrozehdTFIE4JvRTMEEgEh4AFjLVCS/Io+N/YaDkvD3ODsvCJ9Hbo dWg+f8LXe8ISA9HcjyBNfGAt24GQyMgigEL9G48Q0S75y/aYgKhWdoBSZraCiNyXpopB Vt1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="N/OHI/UB"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id sd30-20020a1709076e1e00b0092befda3959si1044436ejc.731.2023.03.13.17.24.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Mar 2023 17:24:53 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="N/OHI/UB"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5D7CF3858431 for ; Tue, 14 Mar 2023 00:24:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5D7CF3858431 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678753492; 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=N/OHI/UBg6TXr5BfS/rXi/Jz4gQnrZFoDVFIVDbO34IxUeQvoNmJ66bs0BDDcJLyR DQdImPsyfqo49RC6SZ0rsO0NuVGsC/+wt7Mfr6P91r/fnTk4A26i9nCJ0Va1+Bh7l3 hZKIcI4oENX35At653zrsLJuAHZ0zPV2lGeQMrzQ= 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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760300623687318643?= X-GMAIL-MSGID: =?utf-8?q?1760300623687318643?= 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: 69203 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1481633wrd; Mon, 13 Mar 2023 17:27:17 -0700 (PDT) X-Google-Smtp-Source: AK7set8VdP8XTSuLP0qjpHpetKhCkH1ltES8j3Vwjt55UyKTqDbwTugXkLYDxH2rNrnSfxLBpytF X-Received: by 2002:a17:907:75f5:b0:7c0:efb9:bc0e with SMTP id jz21-20020a17090775f500b007c0efb9bc0emr369046ejc.62.1678753637382; Mon, 13 Mar 2023 17:27:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678753637; cv=none; d=google.com; s=arc-20160816; b=iS0veTHjUM0R6QDqIjxZCIl3ScALNNMyqN+XlyTemrnnn4wqhONHauTDuwUD7XRoyk Pzi8AmSZKnDQq1w9W9Zo1UaRjbvcq8FtDzoViToQHEcFsHxcAnvqtTavasiPDOCvoB4D cEf1xGWr0NH4TBixJvvZ47AsTMFsnl0dbn2kADakGiLSrFPkVq0gz1XI+Degdm7Hd3KZ oe0jhteURbjFPrJPwuzhEd41bTGDeDFI9Dr36qkCk0ekUqS3ouqc6yv4gwjZL81v2xl2 oRcwO3A1pFO2DilT42jIZzWxxASjrjPMePh53p+tGHo1s2wkBtXi2P9F8jMRvPDuiQX3 RmeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=Y/p53GAisScfbSNPapJZZob07hVtI07XJg9wUQ071pw=; b=t9JWJQzSxP8DIRRhLqX0vQIsDv3h4nHZJZ2iBRs046AoDDFYyAvQmgvP+bxPP0cj9W 2Y8ehZ4LPb7D8PecQTGenFvNcILLAOYdnAeO0cxCtpdipKaGORChI7Em2sind8gzVRhf nydcjwRVz+CZZMSMcZC4bJcppQ6n6cxlkzLtQKOtXG6aAU3yE3BSOwE61GmSd8lEL/y9 GMBxRfRg25F6tKgKpDagEf+ME89no6wt9vLhVKzjM2FeWqYrm8iWNOv1BcDapZaj1Sob qMmyYhVDjuz0AvSCymPuvyv7pDVavPAUOcHea9c9AblO9BP9+v2stDnZlbEuy0h+JNYd UIiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=RuEffS2X; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id oy1-20020a170907104100b008be6648db8asi869181ejb.408.2023.03.13.17.27.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Mar 2023 17:27:17 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=RuEffS2X; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 654003858C2F for ; Tue, 14 Mar 2023 00:27:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 654003858C2F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678753636; 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=RuEffS2XdpMKC7BdtzmUvvg6RQ86sjFpKNBOQ+8IucR+N1C18pY8wm6e6S1bPVOLA Zs1cpzopOY4V73VMWNrpKmtZd65mQcf37PHNOHoEZYOI9qtT0fWTcB+LCQHHWtTpDW /gxY0yz9y2N1DWQv6fvOCkDlDj1TKq9L63FRYCck= 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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760300773933044095?= X-GMAIL-MSGID: =?utf-8?q?1760300773933044095?= 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