From patchwork Wed Sep 25 00:54:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathaniel Shead X-Patchwork-Id: 1989106 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=ZkX2zy7v; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XCyvM067pz1xsM for ; Wed, 25 Sep 2024 10:55:26 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 640CB3858D26 for ; Wed, 25 Sep 2024 00:55:24 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by sourceware.org (Postfix) with ESMTPS id D22883858D26 for ; Wed, 25 Sep 2024 00:55:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D22883858D26 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D22883858D26 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::52b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727225704; cv=none; b=fNTtAc3Q0M40gCQXrnxKMbsTXbcGRt2W+Cn43aMxRJw3IZUcGw6rfxARG/PIJGEAjjG1JwQk7ZtFvnPnC0I1di+bIbbVX3E311V/NHmvKIvRyIT0hr/1Z+uo/5+eCrU1AN6Tq4NWHssJ5RH3FSMtEyG5BHBpqI8UKVElF8oIjR0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727225704; c=relaxed/simple; bh=xhK2/g/jgKHPfikSsFo0qYuUOpkPyjZ98VcHkwwlkL0=; h=DKIM-Signature:Message-ID:Date:From:To:Subject:MIME-Version; b=ebTGTcPWw2prsQ3evWliyluw8iKHOo8d42zvmjg6o3CXoK9YDGatQOOlhfTCqlcUh07BV5M78oVbgcb/M6nY29NlEeMRfnU2ZwrVlSls9aO9wp0kfKZ44st44roQ9RhbodO0USWwPp9G339p8R3O5tiJL8tUhUE9CnZfVprleLI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-7e6bac92bf6so138150a12.3 for ; Tue, 24 Sep 2024 17:55:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727225701; x=1727830501; darn=gcc.gnu.org; h=in-reply-to:content-disposition:mime-version:references:subject:cc :to:from:date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=KVsuJ67CcOWRrtYC0g5KKkcC6Zs2Vq3JzfTTlseRARM=; b=ZkX2zy7vXKuLD58R17p5P7LDTNBr17ImtUJuoZKPB0BW5Ypn39h/aWiO5AHAoGeDvX Bs3wsVP+aHnU7dTL7QBrZFbCsIF4+ZLsFSAl7jGCkYJtDcAg76R25+zRT2TQjzTSL2JS HK7NR9GcxpkA553qYX/Lnv5psnftvfs3W8bjkFBo6BzC29wZhAfr97YH9voyqF2prShI fNFymvbT8wG1K36fp2QG/bLumY7gtDDmC61eM4XPrbOOpV/ViEan+tXM/tBQ4H+BrXnc F+w9U0csGc9uNpbUB8bJVN8KsjVsLT7AVNhIgeYFMYIMLd/G7rI+ptSFv1Y76AC8F+Zf cong== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727225701; x=1727830501; h=in-reply-to:content-disposition:mime-version:references:subject:cc :to:from:date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=KVsuJ67CcOWRrtYC0g5KKkcC6Zs2Vq3JzfTTlseRARM=; b=uSr+yiLz06qWFIsD7Slo9jYTUHi5peQwiyEikE5aR7qDwtgYQt9WDTNv4aC0HJNLMr carzDoky2lEjRlKOcxMpoFSHceCsSRNpz59PT5AglFXVsGBIlEqno1eQCu4WgG8cjDQK gRmNR4KW4lgO4vYA7lSH9GTBze+g/el8h3nD5bRygI1SRzeen1lx7LmLVyk9DsIEjCRK NL+8w0EQs3FjKanPhkHkcU/LG3rbBA13lgqJ0wrniuXlAZHqf3wn3jra6+9bQRwr6BUZ Dqjvo8hYal6Xa2ubOhWBVl4lLjUgMAFldbGyn0Mc1l+Pqa9zIZUUKMYFJ0E2T7MAi8WO 372A== X-Gm-Message-State: AOJu0YwT8nHgGfsS0/ldBhQx+vjnS4UqOLBoMN0PH1F2okLjbwwMSTSu 3A9qzVIBSg9+8QlsulQGgSPeiLLLllckPfF/DgFKpvZoJQm8VvnzJVIp8Q== X-Google-Smtp-Source: AGHT+IEXN3SAgDqrITQ707+I1Awzf4ScUe82lpVsKvZpAzTSKkFakgkvRzXQoqNRTDRRlkmQQDr/kA== X-Received: by 2002:a05:6a00:1254:b0:704:173c:5111 with SMTP id d2e1a72fcca58-71b0ac41274mr662625b3a.3.1727225700548; Tue, 24 Sep 2024 17:55:00 -0700 (PDT) Received: from Thaum. (163-47-68-2.ipv4.originbroadband.com.au. [163.47.68.2]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71afc85bbbasm1768688b3a.95.2024.09.24.17.54.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Sep 2024 17:55:00 -0700 (PDT) Message-ID: <66f35f64.050a0220.1a363a.7c51@mx.google.com> X-Google-Original-Message-ID: Date: Wed, 25 Sep 2024 10:54:56 +1000 From: Nathaniel Shead To: gcc-patches@gcc.gnu.org Cc: Jason Merrill , Nathan Sidwell Subject: [PATCH 11/10] c++/modules: Treat weakrefs as not TU-local [PR115126] References: <66f1fce5.170a0220.150b6f.03f5@mx.google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <66f1fce5.170a0220.150b6f.03f5@mx.google.com> X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org This follows up on some more test failures reported by Linaro on aarch64. The testcase also depends on the libgcc/libstdc++ patch here: https://gcc.gnu.org/pipermail/gcc-patches/2024-September/663749.html To avoid an intermediary state where aarch64 regtests fail I could include the module.cc changes in patch 6 of this series. Let me know if you'd like me to send through a full updated v2 patch series instead of having all these 'extra' patches fixing issues on other platforms... Bootstrapped and regtested on x86_64-pc-linux and aarch64-unknown-linux-gnu, OK for trunk? -- >8 -- On some targets the gthreads support code uses weakref aliases on entities marked 'static'. By the C++ standard these have internal linkage, but we really shouldn't consider these as TU-local. This provides enough of the puzzle to pass the testcase in the PR on at least x86_64-linux and aarch64-linux; we'll see what happens on other targets. PR c++/115126 gcc/cp/ChangeLog: * module.cc (depset::hash::is_tu_local_entity): Don't treat weak entities as TU-local. gcc/testsuite/ChangeLog: * g++.dg/modules/xtreme-header-8.C: New test. Signed-off-by: Nathaniel Shead --- gcc/cp/module.cc | 5 +++++ gcc/testsuite/g++.dg/modules/xtreme-header-8.C | 8 ++++++++ 2 files changed, 13 insertions(+) create mode 100644 gcc/testsuite/g++.dg/modules/xtreme-header-8.C diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index d54f1c88366..3e9b63c1e56 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -13135,6 +13135,11 @@ depset::hash::is_tu_local_entity (tree decl, bool explain/*=false*/) linkage_kind kind = decl_linkage (decl); if (kind == lk_internal) { + /* But don't consider weak entities as TU-local. */ + tree inner = STRIP_TEMPLATE (decl); + if (VAR_OR_FUNCTION_DECL_P (inner) && DECL_WEAK (inner)) + return false; + if (explain) inform (loc, "%qD declared with internal linkage", decl); return true; diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header-8.C b/gcc/testsuite/g++.dg/modules/xtreme-header-8.C new file mode 100644 index 00000000000..9da4e01cc68 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/xtreme-header-8.C @@ -0,0 +1,8 @@ +// PR c++/115126 +// { dg-additional-options "-fmodules-ts -Wignored-exposures" } +// { dg-module-cmi xstd } + +export module xstd; +extern "C++" { + #include "xtreme-header.h" +}