From patchwork Wed Oct 25 08:38:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 157929 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp2451904vqx; Wed, 25 Oct 2023 01:39:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH8HjH7YZwYxXkqWmCP2br1EBBL/uQaisRn3Y0ZOjdkUOq7Sjb8SQFTwGDY38O8qQ6Aa8SZ X-Received: by 2002:a05:6214:27cb:b0:658:3a12:9949 with SMTP id ge11-20020a05621427cb00b006583a129949mr18201141qvb.53.1698223141478; Wed, 25 Oct 2023 01:39:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698223141; cv=pass; d=google.com; s=arc-20160816; b=p1fokdIGV5fdQ78Q29F+82NahE1sEOYX615wnZSgmM9xwUi8idSY2QPv3Hw3+dM8PN lmf3CQ1oXLoUTkKuhfEd56ukx6/Ht0BHztcl4WXrCSqgmJTeKuckSOgtNa5sgjBM0NRN W/7twAeMlxfvTt7kqeB0iCFkgMVbLbNI524PmCyOZdXr23vBGzBjQA31ljk8rWiKy4aO ULvWJBYD/+wEyPof5s3nV2KacgVXa7RipAg7VQq+3DLBSWIh7sL+f1431OLXDsZ1FwPj qktAbQO9LMDpXhk4KmY8oj8mL4eTBnnZeH1hf3/zrm21KvbPrP6j6VwKHwdJBUtgQUuK iOrQ== 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:mime-version:message-id:date :user-agent:references:in-reply-to:subject:to:from:ironport-sdr :arc-filter:dmarc-filter:delivered-to; bh=luoQCgo4E9mVXNthfH7+CwFK+ws29ez5aRSOJ1ASRiw=; fh=eFkiSZLWwt6NUk89P52s4KbBpZ86lKHrs6ztijECvfM=; b=LBUiKGfwqGhDBOzrvgbzyXWwllaKdoPDIz9Y1HwwGZxM6KR7y43eDSqL2EQN0vAnk7 6H98Ez0AeChvzkJOElwN6Ho1/ZSMu9Jk77OibDvdNvnLzPbD1TUDXtA0SM4apQLQuhLi Z0l9ICokKWct1NhEkmf0iR2mman4hhhsW+xCqK9FJ+z+r9r3/qPYUdZ5faNG09iT9i4z BO6lUB5jrE2564YK3IuymXtyL7BOIFz+9PrQwpqnayGG/6RyD7xPy5txseO5Xqnz2P+w wWmXWAd5R+NlpqHYoT72DcVZhnrQ3n3ZczyAQ/00272VtPVf9s8KmXAl/G72RB/nJbjS +u4A== ARC-Authentication-Results: i=2; mx.google.com; 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" Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id bp16-20020a05621407f000b0066b13c94254si8150660qvb.247.2023.10.25.01.39.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 01:39:01 -0700 (PDT) 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; 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" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4310F3857019 for ; Wed, 25 Oct 2023 08:39:01 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id BF7DE3858C27 for ; Wed, 25 Oct 2023 08:38:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BF7DE3858C27 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BF7DE3858C27 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=68.232.141.98 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698223109; cv=none; b=KVc8U7qfvu8e/rNF0TiegseQqJ/qlygqr6M10UXQyk6PUz8jlW/2XOleYeyzbUL4UhaJwX02MfbZrBbplmOr0r/ix6KXmtQn/pw7LvAIeUtNo96rv+XAEKJ8o007OzNsacWkKQMxXVBCL6LjfsE3zKiBc9gRnYr/7aVTRloAy0Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698223109; c=relaxed/simple; bh=ROD43vAGFmbIz+cfgsyKGkOdeuJ6uMGAqih6QYes0Pw=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=HAdAx/4kR8ZM+fiJDwe1DB1o1lzDVe/xG14ltK1OArRPEQXt456vR0gznr3Ov45k1/H8hE5Oam4BjCkSgT4JnktjaTxepXmw0lWAOpkXKPKi0f+DRMwjPGIjC2lrxe8LbrpUN6T+lCeE5zDjgBH01psvXPS+Sq26YqDUuzPPYXc= ARC-Authentication-Results: i=1; server2.sourceware.org X-CSE-ConnectionGUID: yzY6P1okRyiqSgUD3Xiuxg== X-CSE-MsgGUID: Ade5nsfzRomZeepoE6f8Rg== X-IronPort-AV: E=Sophos;i="6.03,250,1694764800"; d="scan'208,223";a="23193418" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa2.mentor.iphmx.com with ESMTP; 25 Oct 2023 00:38:25 -0800 IronPort-SDR: H514qqiWFYz9p3kI5d3cvo/FJ9QaOf8DNBnjeWgwSojL9FzWV3kSv60nOY5/5aWQpCUWjMDzt5 Iw1jSgkgPq/N25tuoo45/qpXOM2PNpipa9MncfujVr0KtLKxkgriJ5lo8YBE+zddZ6Ci4ihUDV 8xD6hRotiobHvg/7Dxw5ajxbt52UCnhYjaajEYSMFcAN1VayfHv41HnKbJJmojGoKATHE3DQMy /2lBxpzbMXbpO/cLlTaf5awJv+0HREhmL0ALInr1jItfG5RCVJhrpk9yYTvheN368vbbuVCcHs O3Y= From: Thomas Schwinge To: Jan Hubicka , Subject: [PING^2] More '#ifdef ASM_OUTPUT_DEF' -> 'if (TARGET_SUPPORTS_ALIASES)' etc. (was: [PATCH][v2] Introduce TARGET_SUPPORTS_ALIASES) In-Reply-To: <875y46y2f7.fsf@euler.schwinge.homeip.net> References: <20170717092719.GB33905@kam.mff.cuni.cz> <20170724140622.GB90943@kam.mff.cuni.cz> <927a43eb-4cfb-8e1c-7d31-b54410ddd30a@suse.cz> <92d3a985-f28d-e2dd-3df3-a50130131787@suse.cz> <20170810134213.GB65902@kam.mff.cuni.cz> <87ledgzxcl.fsf@euler.schwinge.homeip.net> <875y46y2f7.fsf@euler.schwinge.homeip.net> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/28.2 (x86_64-pc-linux-gnu) Date: Wed, 25 Oct 2023 10:38:21 +0200 Message-ID: <87sf5zw0zm.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-14.mgc.mentorg.com (139.181.222.14) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, 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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776470841932025370 X-GMAIL-MSGID: 1780716028905343177 Hi! Ping. Grüße Thomas On 2023-09-19T10:47:56+0200, I wrote: > Hi! > > Ping. > > > Grüße > Thomas > > > On 2023-09-08T14:02:50+0200, I wrote: >> Hi! >> >> On 2017-08-10T15:42:13+0200, Jan Hubicka wrote: >>>> On 07/31/2017 11:57 AM, Yuri Gribov wrote: >>>> > On Mon, Jul 31, 2017 at 9:04 AM, Martin Liška wrote: >>>> >> Doing the transformation suggested by Honza. >> >> ... which was: >> >> | On 2017-07-24T16:06:22+0200, Jan Hubicka wrote: >> | > we probably should turn ASM_OUTPUT_DEF ifdefs into a conditional compilation >> | > incrementally. >> >>>> >From 78ee08b25d22125cb1fa248bac98ef1e84504761 Mon Sep 17 00:00:00 2001 >>>> From: marxin >>>> Date: Tue, 25 Jul 2017 13:11:28 +0200 >>>> Subject: [PATCH] Introduce TARGET_SUPPORTS_ALIASES >> >> ..., and got pushed as commit a8b522b483ebb8c972ecfde8779a7a6ec16aecd6 >> (Subversion r251048) "Introduce TARGET_SUPPORTS_ALIASES". >> >> I don't know if that was actually intentional here, or just an >> "accident", but such changes actually allow that a back end may or may >> not provide symbol aliasing support ('TARGET_SUPPORTS_ALIASES') >> independent of '#ifdef ASM_OUTPUT_DEF', and in particular, depending not >> just on static but instead on dynamic (run-time) configuration. This is >> relevant for the nvptx back end's '-malias' flag. >> >> There did remain a few instances where we currently still assume that >> from '#ifdef ASM_OUTPUT_DEF' follows 'TARGET_SUPPORTS_ALIASES', which I'm >> adjusting in the attached (with '--ignore-space-change', for easy review) >> "More '#ifdef ASM_OUTPUT_DEF' -> 'if (TARGET_SUPPORTS_ALIASES)' etc.". >> OK to push? >> >> These changes are necessary to cure nvptx regressions raised in >> >> "[nvptx] Use .alias directive for mptx >= 6.3", addressing the comment: >> "[...] remains to be analyzed". >> >> >> Grüße >> Thomas ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955 From 4c725226c3657adb775af274876de5077b8fbf45 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Thu, 7 Sep 2023 22:15:08 +0200 Subject: [PATCH] More '#ifdef ASM_OUTPUT_DEF' -> 'if (TARGET_SUPPORTS_ALIASES)' etc. Per commit a8b522b483ebb8c972ecfde8779a7a6ec16aecd6 (Subversion r251048) "Introduce TARGET_SUPPORTS_ALIASES", there is the idea that a back end may or may not provide symbol aliasing support ('TARGET_SUPPORTS_ALIASES') independent of '#ifdef ASM_OUTPUT_DEF', and in particular, depending not just on static but instead on dynamic (run-time) configuration. There did remain a few instances where we currently still assume that from '#ifdef ASM_OUTPUT_DEF' follows 'TARGET_SUPPORTS_ALIASES'. Change these to 'if (TARGET_SUPPORTS_ALIASES)', similarly, or 'gcc_checking_assert (TARGET_SUPPORTS_ALIASES);'. gcc/ * ipa-icf.cc (sem_item::target_supports_symbol_aliases_p): 'gcc_checking_assert (TARGET_SUPPORTS_ALIASES);' before 'return true;'. * ipa-visibility.cc (function_and_variable_visibility): Change '#ifdef ASM_OUTPUT_DEF' to 'if (TARGET_SUPPORTS_ALIASES)'. * varasm.cc (output_constant_pool_contents) [#ifdef ASM_OUTPUT_DEF]: 'gcc_checking_assert (TARGET_SUPPORTS_ALIASES);'. (do_assemble_alias) [#ifdef ASM_OUTPUT_DEF]: 'if (!TARGET_SUPPORTS_ALIASES)', 'gcc_checking_assert (seen_error ());'. (assemble_alias): Change '#if !defined (ASM_OUTPUT_DEF)' to 'if (!TARGET_SUPPORTS_ALIASES)'. (default_asm_output_anchor): 'gcc_checking_assert (TARGET_SUPPORTS_ALIASES);'. --- gcc/ipa-icf.cc | 1 + gcc/ipa-visibility.cc | 8 +++++--- gcc/varasm.cc | 13 ++++++++++--- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/gcc/ipa-icf.cc b/gcc/ipa-icf.cc index 836d0914ded..bbdfd445397 100644 --- a/gcc/ipa-icf.cc +++ b/gcc/ipa-icf.cc @@ -218,6 +218,7 @@ sem_item::target_supports_symbol_aliases_p (void) #if !defined (ASM_OUTPUT_DEF) || (!defined(ASM_OUTPUT_WEAK_ALIAS) && !defined (ASM_WEAKEN_DECL)) return false; #else + gcc_checking_assert (TARGET_SUPPORTS_ALIASES); return true; #endif } diff --git a/gcc/ipa-visibility.cc b/gcc/ipa-visibility.cc index 8ec82bb333e..8ce56114ee3 100644 --- a/gcc/ipa-visibility.cc +++ b/gcc/ipa-visibility.cc @@ -622,7 +622,8 @@ function_and_variable_visibility (bool whole_program) /* All aliases should be processed at this point. */ gcc_checking_assert (!alias_pairs || !alias_pairs->length ()); -#ifdef ASM_OUTPUT_DEF + if (TARGET_SUPPORTS_ALIASES) + { FOR_EACH_DEFINED_FUNCTION (node) { if (node->get_availability () != AVAIL_INTERPOSABLE @@ -643,7 +644,8 @@ function_and_variable_visibility (bool whole_program) if (!alias) { - alias = dyn_cast (node->noninterposable_alias ()); + alias + = dyn_cast (node->noninterposable_alias ()); gcc_assert (alias && alias != node); } @@ -656,7 +658,7 @@ function_and_variable_visibility (bool whole_program) } } } -#endif + } FOR_EACH_FUNCTION (node) { diff --git a/gcc/varasm.cc b/gcc/varasm.cc index 53f0cc61922..40d6081a3fa 100644 --- a/gcc/varasm.cc +++ b/gcc/varasm.cc @@ -4300,6 +4300,8 @@ output_constant_pool_contents (struct rtx_constant_pool *pool) if (desc->mark < 0) { #ifdef ASM_OUTPUT_DEF + gcc_checking_assert (TARGET_SUPPORTS_ALIASES); + const char *name = XSTR (desc->sym, 0); char label[256]; char buffer[256 + 32]; @@ -6225,6 +6227,10 @@ do_assemble_alias (tree decl, tree target) IDENTIFIER_POINTER (id), IDENTIFIER_POINTER (target)); # endif + /* If symbol aliases aren't actually supported... */ + if (!TARGET_SUPPORTS_ALIASES) + /* ..., 'ASM_OUTPUT_DEF{,_FROM_DECLS}' better have raised an error. */ + gcc_checking_assert (seen_error ()); #elif defined (ASM_OUTPUT_WEAK_ALIAS) || defined (ASM_WEAKEN_DECL) { const char *name; @@ -6294,9 +6300,8 @@ assemble_alias (tree decl, tree target) if (TREE_PUBLIC (decl)) error ("%qs symbol %q+D must have static linkage", "weakref", decl); } - else + else if (!TARGET_SUPPORTS_ALIASES) { -#if !defined (ASM_OUTPUT_DEF) # if !defined(ASM_OUTPUT_WEAK_ALIAS) && !defined (ASM_WEAKEN_DECL) error_at (DECL_SOURCE_LOCATION (decl), "alias definitions not supported in this configuration"); @@ -6317,7 +6322,7 @@ assemble_alias (tree decl, tree target) return; } # endif -#endif + gcc_unreachable (); } TREE_USED (decl) = 1; @@ -7406,6 +7411,8 @@ default_strip_name_encoding (const char *str) void default_asm_output_anchor (rtx symbol) { + gcc_checking_assert (TARGET_SUPPORTS_ALIASES); + char buffer[100]; sprintf (buffer, "*. + " HOST_WIDE_INT_PRINT_DEC, -- 2.34.1