From patchwork Sat Mar 11 20:27:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam James X-Patchwork-Id: 68189 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp440643wrd; Sat, 11 Mar 2023 12:27:56 -0800 (PST) X-Google-Smtp-Source: AK7set+FklkEMm/yCxjPuNzIMuj8ZJqChiHWqGey9Ec3YsRqlOKlPqOQcDKBVivXkXWRZTT2KIsF X-Received: by 2002:a17:906:fe42:b0:8b1:820a:7b60 with SMTP id wz2-20020a170906fe4200b008b1820a7b60mr35103179ejb.6.1678566476124; Sat, 11 Mar 2023 12:27:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678566476; cv=none; d=google.com; s=arc-20160816; b=JzBwchB97Zfrad33kbUt8ree1wI/RnXRldjy9udWwguvqPIxVcYRVkSP5un5cRCAbD odmuJtsjpgMbPaGvCfVBN34A8QnRMqAQU4clKDFMhYoHbPjOPBVDiDE9jUTwHkAsgH5K lGV/RwQKPUCPl179BMYcIQd33QGlrrBWQ4e0UR+rcgfgyLNjPn7tx+Pr+yc7nO7TAkrW mAiIuEqXJ9O+oRLn5OM6h/Kuq4Wj4snb3s7A7Woy/4zlXdNxsvBgPbPZ3P2TuQi/LU4k 2x7ydAc2sjCRsaL0ZvxHAmWutiT7qedDMPTXbUUokqEw6kF4yVY1+L0BPXujWnKda7Ao 5V/g== 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=W5V36rT029onwa9VZ4gghMB6BFYfSvEgTH9OI/Oxqo4=; b=cl0Qj0bEUlJb5XHR8Vcc0DpkQztcZFBsodmNckvDpimQCBWiXH2f5JsH8R3UinCCMj 3qYYu9IFqj1VYw1uYGYJCFl9oOMoHgBpWLN5ct9mMqDUptxkeA/JO0UE8Tanb2xK510B /0kYUUatgRckD7SLvwQq8b8PbStKywuga/Sf8GE58UZ1XT5ufPQXRymTgrJE+KTNNv4e CmEyc87q295V+pu7Au6GST6k9HBEhSdiXI1WsQ/sIMV0nFeHlMfBalGdocOGxe5dWG9V Q5LlqeAr9j61tKUXkTWtVd6QUhv/+Pr/sivqwS4aLWFDgOpkPNptTjSN6CoeYUNtkPzj JTZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=HUm90pFM; 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 ot1-20020a170906ccc100b008f4625e4c16si3261373ejb.577.2023.03.11.12.27.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Mar 2023 12:27:56 -0800 (PST) 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=HUm90pFM; 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 1F939385842C for ; Sat, 11 Mar 2023 20:27:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1F939385842C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678566475; bh=W5V36rT029onwa9VZ4gghMB6BFYfSvEgTH9OI/Oxqo4=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=HUm90pFMj7QWh+Wt/AwZh8K0AG4PKd86fVt8PnM9qPTWK8KKN9XWFun8i9TBevBPT IiZEoofnK1H/ClQZsu1UIlaN2Sjy8R7B2Fwyxku23XhHWzoeNKGh22GX13XqHufUlo wPGtNEWCjrzrdETPe8lKHbXin0Xz6N7RskE1MhrM= 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 4D0DC3858D1E for ; Sat, 11 Mar 2023 20:27:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4D0DC3858D1E To: gcc-patches@gcc.gnu.org Cc: Kito Cheng , Palmer Dabbelt , Andrew Waterman , Jim Wilson , Ju-Zhe Zhong , Sam James Subject: [PATCH v2] RISC-V: Avoid calloc() poisoning on musl Date: Sat, 11 Mar 2023 20:27:05 +0000 Message-Id: <20230311202705.3135051-1-sam@gentoo.org> X-Mailer: git-send-email 2.39.2 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?1760104406200314379?= X-GMAIL-MSGID: =?utf-8?q?1760104521052337178?= 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 adding include. v2: fix changelog. Signed-off-by: Sam James --- gcc/ChangeLog | 5 +++++ gcc/config/riscv/genrvv-type-indexer.cc | 1 + 2 files changed, 6 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c9e557ce833..f8a1c37f76e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2023-03-11 Sam James + + * config/riscv/genrvv-type-indexer.cc: Avoid calloc() poisoning on musl by + adding include. + 2023-03-10 Jakub Jelinek PR target/107703 diff --git a/gcc/config/riscv/genrvv-type-indexer.cc b/gcc/config/riscv/genrvv-type-indexer.cc index 0ef1d766002..b286ec84132 100644 --- a/gcc/config/riscv/genrvv-type-indexer.cc +++ b/gcc/config/riscv/genrvv-type-indexer.cc @@ -14,6 +14,7 @@ along with GCC; see the file COPYING3. If not see . */ #include "bconfig.h" +#define INCLUDE_PTHREAD_H #include "system.h" #include "errors.h"