From patchwork Tue Jan 9 13:09:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 186361 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp94713dyi; Tue, 9 Jan 2024 05:10:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IHbJs5fjGi4Ie4rnVPlYtnWvsNxRpS443BP73J8oOpjPB0TR68kBpz/Wq2foCHo1M0U0Yt0 X-Received: by 2002:a05:6214:57c1:b0:680:f9a2:4eca with SMTP id lw1-20020a05621457c100b00680f9a24ecamr3042994qvb.7.1704805811532; Tue, 09 Jan 2024 05:10:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704805811; cv=pass; d=google.com; s=arc-20160816; b=riEXZ+OIDATqx+qBOUTdlKNi/wwYylY5Cc6OOvIxT9cRVl+3LSrJlbFYm38vBabNKh 66IyvHzmjth3tZ5pKCjtS7gdeIueC9DXHgtiOcWzl2m9E6SBwtE9J+b/e7CrM5cVS0Bc RQeuD228Jx6cuGl3HaY7uSSco3exdXgoJx0e52r6z0NqfVyLxkffP/IviEodISeh1Rgx mPqom/mPDcLVvMpFp1ahqViNXuNPpmCXYS96yZSCCm5ZkJ3ONqjtt+/jvSmaSnsHreTR ToNdLIFlkoEiwoTNdfngcfFHlsq10ovd360xIHi7i9/fAD4Vh4R3GJcc58F766WgYfpZ IO5Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:reply-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=WR92Zrto+VPJr03r7s9fv0RmAPnXe5vyaoBpaZKR7fA=; fh=dNpYIFOttpYEfvbtfBjnwSgshS52NdaiB8asplFYYoc=; b=gPZ7b1gzcc08dxGlvbLK9tpyNchPYaYTst551hagUyt/HOku9l8SvqcgAQZpyM7IQH FwnXt3l9QwNkQZ3AQL7oEgdYRvAndSyTILL2aV2UitQ5nVwm6+UQPXEib6p1sH9SGNrE Ki35lV/8pm8X12scfFel269mOF3ayihmzICPVN0r8NVsn0BLzAKVZf/9LE6UWm1HXVBS J+l+ctrscyv4CXivcyiwdQ1IzhNExr7PSc+Lbcvm22gx/3WAcR2bhySv4uwDKD5EzNPd P0e1tDCsVSDsh99mKzRVJMqKnWSgO/DRtkD4Ho7IuQPKadN499DOgHR+L1xivkPHAakm 3Edg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=N42oLQLC; arc=pass (i=1); 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=redhat.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id e28-20020a0caa5c000000b0067f9f2f4bc9si2309256qvb.173.2024.01.09.05.10.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 05:10:11 -0800 (PST) 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=@redhat.com header.s=mimecast20190719 header.b=N42oLQLC; arc=pass (i=1); 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=redhat.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 13322386103C for ; Tue, 9 Jan 2024 13:10:11 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id B00B43858298 for ; Tue, 9 Jan 2024 13:09:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B00B43858298 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 B00B43858298 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704805768; cv=none; b=vAPhnh1Ct29jU6KXgKApvoazR9esAiDzdu9JDti1fQ0eXv3hnKOjKwWSst87Gp/u1Oo/o7RC9HXRYvfpIAO4ZAuX4UZQ5wws7g1gHY0n9sX6+ZPD0AEtxzEClmEOaj8Qn7fws68n78xz4xvIkhmGeuyMci8QWmwtU3rh9ZcxzHw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704805768; c=relaxed/simple; bh=IlqG5tmvmMF8tPltCemkljHcjrCk8AEPh4aS11mHqmE=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=DqKCVx6xngazwVN2OFK4mQ8FAVcyVu8e9W+k2H48IC1vJrl4f+HZ28Up9f/DAleD5p5RDUd0IhuWdGAH3RCDTPCviuqsEs8OKsbeS0tbVLIJzBFEwfoYN2hGmGSMTSg1xYokOYVSJJRqEW6orSXoK8ZrraxxC4yJmkwYDe8ZihU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704805766; 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=WR92Zrto+VPJr03r7s9fv0RmAPnXe5vyaoBpaZKR7fA=; b=N42oLQLCH3AoKx8kyYNNpQzJMiNspttloZ/xbvQ9B/oWgNFGDDSjny3jIaRL8Ax8eiWYRZ nRtWPTE1wzP/W9ybTAZir+TtF+YoIo3IcVsNvTm7qmxYkn4lxhFGLtNMC+PDg44B8xC5Co jZAN5eYlMsW4eXfrInqAnJsaSTUzDTs= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-433-cCMx2r-FNwy_ON_rP4rj_w-1; Tue, 09 Jan 2024 08:09:25 -0500 X-MC-Unique: cCMx2r-FNwy_ON_rP4rj_w-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (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 C0759185A783; Tue, 9 Jan 2024 13:09:24 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.92]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 840212026D66; Tue, 9 Jan 2024 13:09:24 +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 409D9LMB1773433 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 9 Jan 2024 14:09:22 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 409D9Lju1773432; Tue, 9 Jan 2024 14:09:21 +0100 Date: Tue, 9 Jan 2024 14:09:20 +0100 From: Jakub Jelinek To: Richard Sandiford Cc: gcc-patches@gcc.gnu.org Subject: [committed] aarch64: Fix up GC of aarch64_simd_types [PR113270] Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-4.6 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, 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: , Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787618458669217502 X-GMAIL-MSGID: 1787618458669217502 Hi! The r14-6524 changes created aarch64-builtins.h header and moved struct aarch64_simd_type_info definition in there. Unfortunately, the new header wasn't added to target_gtfiles, so the trees and const char * pointer elements in the aarch64_simd_types array aren't marked as GC roots anymore. That breaks e.g. PCH, when the array elements then can refer to ggc_freed memory instead of the expected types, but also any other GC collection could free them and further uses would not work correctly. Unfortunately, just adding the new header to target_gtfiles doesn't fix this, because non-static variable definitions marked with GTY(()) aren't considered by gengtype, it looks in those cases for an extern GTY(()) declaration, and there was none - the aarch64-builtins.h header contains an extern declaration without GTY(()). Adding GTY(()) to that extern declaration doesn't work, because then gengtype attempts to emit the aarch64_simd_types GC roots in gtype-desc.cc but the corresponding header isn't included there. So, the patch instead adds another extern declaration in aarch64-builtins.cc right before the actual definition, which makes sure the GC roots are registered correctly in gt-aarch64-builtins.h (where we want them). Bootstrapped/regtested on aarch64-linux, preapproved in the PR by Richard, committed to trunk. 2024-01-09 Jakub Jelinek PR target/113270 * config.gcc (aarch64*-*-*): Add aarch64-builtins.h to target_gtfiles. * config/aarch64/aarch64-builtins.cc (aarch64_simd_types): Add extern GTY(()) declaration before the definition, drop GTY(()) drom the definition. Jakub --- gcc/config.gcc.jj 2024-01-08 16:13:18.561941400 +0100 +++ gcc/config.gcc 2024-01-08 17:05:56.108386947 +0100 @@ -350,7 +350,7 @@ aarch64*-*-*) cxx_target_objs="aarch64-c.o" d_target_objs="aarch64-d.o" extra_objs="aarch64-builtins.o aarch-common.o aarch64-sve-builtins.o aarch64-sve-builtins-shapes.o aarch64-sve-builtins-base.o aarch64-sve-builtins-sve2.o aarch64-sve-builtins-sme.o cortex-a57-fma-steering.o aarch64-speculation.o falkor-tag-collision-avoidance.o aarch-bti-insert.o aarch64-cc-fusion.o aarch64-early-ra.o aarch64-ldp-fusion.o" - target_gtfiles="\$(srcdir)/config/aarch64/aarch64-builtins.cc \$(srcdir)/config/aarch64/aarch64-sve-builtins.h \$(srcdir)/config/aarch64/aarch64-sve-builtins.cc" + target_gtfiles="\$(srcdir)/config/aarch64/aarch64-builtins.h \$(srcdir)/config/aarch64/aarch64-builtins.cc \$(srcdir)/config/aarch64/aarch64-sve-builtins.h \$(srcdir)/config/aarch64/aarch64-sve-builtins.cc" target_has_targetm_common=yes ;; alpha*-*-*) --- gcc/config/aarch64/aarch64-builtins.cc.jj 2024-01-08 16:13:13.756008421 +0100 +++ gcc/config/aarch64/aarch64-builtins.cc 2024-01-08 17:03:33.557395210 +0100 @@ -863,9 +863,11 @@ const char *aarch64_scalar_builtin_types NULL }; +extern GTY(()) aarch64_simd_type_info aarch64_simd_types[]; + #define ENTRY(E, M, Q, G) \ {E, "__" #E, #G "__" #E, NULL_TREE, NULL_TREE, E_##M##mode, qualifier_##Q}, -GTY(()) struct aarch64_simd_type_info aarch64_simd_types [] = { +struct aarch64_simd_type_info aarch64_simd_types [] = { #include "aarch64-simd-builtin-types.def" }; #undef ENTRY