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: 83616 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BD4463858024 for ; Tue, 9 Jan 2024 13:09:53 +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+patchwork=sourceware.org@gcc.gnu.org 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