From patchwork Fri Jul 30 11:01:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Buclaw X-Patchwork-Id: 1511612 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=LnwgeXei; dkim-atps=neutral Received: from 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 RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Gbl4Y1kmlz9sXk for ; Fri, 30 Jul 2021 21:08:13 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A3D72393D022 for ; Fri, 30 Jul 2021 11:08:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A3D72393D022 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1627643290; bh=o9Ij/nYZbLZvaq1fZzxv1xfgYKRFbGIda6FcKcOTPMc=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=LnwgeXeikAvKWnHn9BqmVkI0B1pEDoX+GoCHjpzqnzCkUAlnDvdYbxRUIxP/59EAA RozKBal9el73U0XcWyeKsNbyMhscXUDPZZzmNq8bcKoZ0sIuphuVTx5VnxjXg/QdG0 0/B5SEmVijqzK6cVNWWiAxHwRvVz+QFEpF0oQ3lU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) by sourceware.org (Postfix) with ESMTPS id 795CD393FC34 for ; Fri, 30 Jul 2021 11:01:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 795CD393FC34 Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4Gbkwn4PvJzQkBN; Fri, 30 Jul 2021 13:01:29 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id ZMn8ruWT9Wja; Fri, 30 Jul 2021 13:01:26 +0200 (CEST) To: gcc-patches@gcc.gnu.org Subject: [committed 07/12] d: Set COMDAT and visibility of thunks only if they are public. Date: Fri, 30 Jul 2021 13:01:06 +0200 Message-Id: <20210730110111.569140-7-ibuclaw@gdcproject.org> In-Reply-To: <20210730110111.569140-1-ibuclaw@gdcproject.org> References: <20210730110111.569140-1-ibuclaw@gdcproject.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: D80C31846 X-Rspamd-UID: 19fe25 X-Spam-Status: No, score=-15.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Iain Buclaw via Gcc-patches From: Iain Buclaw Reply-To: Iain Buclaw Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" It is not expected to have a member function that can be non-public, but this guards against any internal errors that might occur should that ever change in the front-end. gcc/d/ChangeLog: * decl.cc (make_thunk): Set COMDAT and visibility of thunks only if they are public. --- gcc/d/decl.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gcc/d/decl.cc b/gcc/d/decl.cc index 59991c3c255..cf61cd49159 100644 --- a/gcc/d/decl.cc +++ b/gcc/d/decl.cc @@ -1781,9 +1781,12 @@ make_thunk (FuncDeclaration *decl, int offset) DECL_ARTIFICIAL (thunk) = 1; DECL_DECLARED_INLINE_P (thunk) = 0; - DECL_VISIBILITY (thunk) = DECL_VISIBILITY (function); - DECL_COMDAT (thunk) = DECL_COMDAT (function); - DECL_WEAK (thunk) = DECL_WEAK (function); + if (TREE_PUBLIC (thunk)) + { + DECL_VISIBILITY (thunk) = DECL_VISIBILITY (function); + DECL_COMDAT (thunk) = DECL_COMDAT (function); + DECL_WEAK (thunk) = DECL_WEAK (function); + } /* When the thunk is for an extern C++ function, let C++ do the thunk generation and just reference the symbol as extern, instead of