From patchwork Thu Feb 29 07:13:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Andrew Pinski (QUIC)" X-Patchwork-Id: 208231 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp223239dyb; Wed, 28 Feb 2024 23:14:24 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUySR23CVnaUKdJ2UrXGdLBkzDmhc3KDWXeZC8t91ebXRb7sI7ibL2GPghI/E3QNco3FGLI8Wms5ezlLJPer142WwaD3A== X-Google-Smtp-Source: AGHT+IFTBYryYI0TSfPCDSC1pxVcKYH0YcBrGELsDSoEC785llFalWB4dnDk0WBWiItU7uBaknn5 X-Received: by 2002:a05:622a:388:b0:42e:c1b7:81eb with SMTP id j8-20020a05622a038800b0042ec1b781ebmr16718qtx.14.1709190864315; Wed, 28 Feb 2024 23:14:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709190864; cv=pass; d=google.com; s=arc-20160816; b=mlEUIfAMniGWjZfWX55xiKEZVoskmvs1hJL0y4L/4Wo1jupaucofqz/8307H8Fz2TB 1JW1fop4jHl+i3oK+o/ckStmr51R7WD02exnwfL31RTQzmZJ0BCQQ8UdGKSMZ8HPXYhW 0kS28Hti8DSjasrEoUuSQ7KZA6eRuQO5TWPngcYOhXCLY58Hi9Cg56RKfMnMF04wktUS CPeEW1qMxU8+IB+siBgNf7FY5BOFSBZMPT00yi0O4F3i2Je8dCoo8QSAs0xEr+MTkPvb XqbcpOFnKX94YKS61DBKiXn+6elRRfk1U5Kra0ewywkw3IYZei6ZoL4AzG4nP9X+D7ny CRWw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=Q5AS+8AEddFBw1naHi/80CLDDzMKOo9gQEMcxyuH0Ko=; fh=o3CEdS3yGN/eIa89Zn0Kf01WYLxTE9IjKuSQGVPeOHI=; b=X+RBB8EV5OS0WC+DB8+P39xLZfWL1J1BXPLsqDKrU+iI6K7Y9MxFwVkIl11sMMb+3z avuGsaeD0rlKmHiRrIr0+ceUvNZ/NbnTtEz0OqpNJR3Z8SMhMHJAzKDlQawW87hfmi0f HjAu4mbMZVFsB6Z4Tv+enJBW1rJjqFm3BSF3ge9YyUA5jyKSBXehY7BjDeN8AmLLQnXM Rshek2xMu+zP18uaF4Q+4zN8NUtecXTsQYMEJD0MzMBmDZiVBhwnzbrLno31fYeOyRZV rKoi8kb+LzeJ7xGbzlEA5m324108Bf/crqUt/j4dMOBto0Ly5u60O+NlZKtNzYdb9Y0R lIWw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="dZQUw/Wy"; arc=pass (i=1); 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=quicinc.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id r21-20020a05622a035500b0042e61ea23e7si858802qtw.515.2024.02.28.23.14.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 23:14:24 -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=@quicinc.com header.s=qcppdkim1 header.b="dZQUw/Wy"; arc=pass (i=1); 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=quicinc.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 09FBD385842C for ; Thu, 29 Feb 2024 07:14:24 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by sourceware.org (Postfix) with ESMTPS id 71BA73858D20 for ; Thu, 29 Feb 2024 07:13:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 71BA73858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=quicinc.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 71BA73858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709190812; cv=none; b=pkbZXai4HkvpbOSjkY+p7DO73pbcafX2acN/t7Pe7OXtYRRzVk//EXwq3EQ49oJt8mNuUXO4p6TbY99LZpP1PE4wqKUfSb8CpULeh3sL8POYq8Iu7Zl658auE67EgKGylwJvKr0H9lGMPC86v5gnckev3QXzlM+ogZ1pdRSUk+g= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709190812; c=relaxed/simple; bh=TJNNBFhw3muFZFzOuDh0xaA+l9t8ZVoPCsNLKHk9wJc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Zd8WGdP+XC6QXZpBTbRMkZ78UIU+DYa0yEU6S5knkukfzs2f6iBiaYFTUbFDIqF6cqskktkMDobSAU7Zh7HAkCVKtAFI5nXQtdIx/cLbiSvzIKKTzwktpQSQBnVZsSx7G6hooWyCHzmGReDY960jQDUO94lBUXrwS+WQsMGzTKA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41T61ugJ014132 for ; Thu, 29 Feb 2024 07:13:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding:content-type; s=qcppdkim1; bh=Q5AS+8A EddFBw1naHi/80CLDDzMKOo9gQEMcxyuH0Ko=; b=dZQUw/WyPtf4mnorH9ZV+1z jKOXcdhJuCNH0bHqdvIWo5ZPk5oLVNunz6TYRc/OCWqbChtSPRAO2d4y2KTIzx+R 77ZemEcTyoKICqO3rKmSxTV6MWJFvLzSqu+PhhGoj1V9hU9TV77HEJ9lqE/kKBYv 1JE/6Ti8cw3+1lgvKmEyumwTXoZIDo09y+CxCLYStb6rebscYbLVRmQqDg1Wstww gyMWqhobJHSI7NxE3O/TNra2W+OzZdXnurFVcPlovC4CAVDUPWzMK5zvEsLwZKGb jEBtkmGVGdvd2etWvYAihucI5m9Q5OMCPJ6PymR8IdySkDDDurk9tMBd5NOGOng= = Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wjm9mg4yf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 29 Feb 2024 07:13:29 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 41T7DS61018033 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 29 Feb 2024 07:13:29 GMT Received: from hu-apinski-lv.qualcomm.com (10.49.16.6) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Wed, 28 Feb 2024 23:13:28 -0800 From: Andrew Pinski To: CC: Andrew Pinski Subject: [COMMITTED] aarch64: Fix memtag builtins vs GC [PR108174] Date: Wed, 28 Feb 2024 23:13:16 -0800 Message-ID: <20240229071316.2389716-1-quic_apinski@quicinc.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: qxpY8ZZbKudUjcH-D0xHC-Hv_4Ehur3g X-Proofpoint-ORIG-GUID: qxpY8ZZbKudUjcH-D0xHC-Hv_4Ehur3g X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-28_08,2024-02-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 spamscore=0 lowpriorityscore=0 impostorscore=0 malwarescore=0 clxscore=1015 adultscore=0 bulkscore=0 priorityscore=1501 mlxlogscore=855 suspectscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402290055 X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792216519278297828 X-GMAIL-MSGID: 1792216519278297828 The memtag builtins were being GC'ed away so we end up with a crash sometimes (maybe even wrong code). This fixes that issue by adding GTY on the variable/struct aarch64_memtag_builtin_data. Committed as obvious after a build/test for aarch64-linux-gnu. PR target/108174 gcc/ChangeLog: * config/aarch64/aarch64-builtins.cc (aarch64_memtag_builtin_data): Make static and mark with GTY. gcc/testsuite/ChangeLog: * gcc.target/aarch64/acle/memtag_4.c: New test. Signed-off-by: Andrew Pinski --- gcc/config/aarch64/aarch64-builtins.cc | 2 +- gcc/testsuite/gcc.target/aarch64/acle/memtag_4.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/aarch64/acle/memtag_4.c diff --git a/gcc/config/aarch64/aarch64-builtins.cc b/gcc/config/aarch64/aarch64-builtins.cc index 277904f6d14..75d21de1401 100644 --- a/gcc/config/aarch64/aarch64-builtins.cc +++ b/gcc/config/aarch64/aarch64-builtins.cc @@ -1840,7 +1840,7 @@ aarch64_init_prefetch_builtin (void) } /* Initialize the memory tagging extension (MTE) builtins. */ -struct +static GTY(()) struct GTY(()) { tree ftype; enum insn_code icode; diff --git a/gcc/testsuite/gcc.target/aarch64/acle/memtag_4.c b/gcc/testsuite/gcc.target/aarch64/acle/memtag_4.c new file mode 100644 index 00000000000..1e209ffc25a --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/acle/memtag_4.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-march=armv9-a+memtag --param ggc-min-expand=0 --param ggc-min-heapsize=0" } */ +/* PR target/108174 */ +/* Check to make sure that the builtin functions are not GC'ed away. */ +#include "arm_acle.h" + +void g(void) +{ + const char *c; + __arm_mte_increment_tag(c , 0 ); +} +void h(void) +{ + const char *c; + __arm_mte_increment_tag( c,0); +}