From patchwork Fri Jan 12 10:03:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 187660 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2614:b0:101:6a76:bbe3 with SMTP id mm20csp71430dyc; Fri, 12 Jan 2024 02:04:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IHJtyxWi7JMYqOQKK/quFyo69ZjA0wwSj3zznfPYYDyxkLSXDpDnZeqksXVMcpstb+xv1Kb X-Received: by 2002:a05:6808:6485:b0:3bd:647f:fa92 with SMTP id fh5-20020a056808648500b003bd647ffa92mr160151oib.97.1705053889435; Fri, 12 Jan 2024 02:04:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705053889; cv=pass; d=google.com; s=arc-20160816; b=y8NVhMObC/JUgwptDzztgzYdslyI8tjOT9jx9cZE8qBQOaC2GDSoICW7zshfJiaNFw trPtbUnojy6gT9B4lHpOV4HtrVIdP2Oej9pxjgxYSlY+WdUr99Pv5BGPxl5cerZZg4r+ Dvm/w3+mr/dAs6yjJGOxS3CS8F4o3bJoy3wvCTHcTdamtqyBNvBJZzSOeZXjjOOt/fKF gxtuQnT3T6SedQMqvf5sI2u0EIhYd2ebgeATo4Xe3RVp24oydxWVfcwtw/xrzf6Ecmkj TUQWprSbtEPd9B0VtAcH11TD65esMlaA1cwkHcr+rv0ZTUhD00HBIE2TxbQwkqwk8XHB fkwg== 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=hyuejXyb9nJ2jVmnh2LOUqV/YpB8X9E9tb4CBpEBX7g=; fh=hBzwOorC2xtjKlAFciCDlCFgPZRnpEPWnN8eWd5jCUw=; b=XAlnq6i2P7pjmPwtTW4zpMr6AQ0fxzEZwayBotmXjZY7DSG/MaV33sUFshmGC5V8O6 CwObARt4E3B4zOwawTbjKOE1Tf6Wq8S/iJhyr1J/CtQ2feoiXHB/DR8vWhsXC8LSWDEn pCf/4c+0FlHbwG2kFt1Rn1QcBX0AwIVwPWgTnoQ3jbwxuHjjIbERkbmOLIHdTdZjHJDR LqeC87ea0s4oBxAorrIroN0ypmpv7/R4myDCn9RzwfK9mh4cliDuLw1JhMs4CYouQ5fL rfuyiBzxsshg1EskTkt+O0DJZ/sTOdWY5ml9ig7qkfPmMq1KFICw6zuwaCyg0aB1C5Hr b0Aw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iczgacns; 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 oq23-20020a05620a611700b0078337726ff9si2480085qkn.130.2024.01.12.02.04.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jan 2024 02:04:49 -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=iczgacns; 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 1F190385840E for ; Fri, 12 Jan 2024 10:04:49 +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.133.124]) by sourceware.org (Postfix) with ESMTPS id 5D5E23858D3C for ; Fri, 12 Jan 2024 10:03:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5D5E23858D3C 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 5D5E23858D3C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705053833; cv=none; b=Dm5k7sNtjELhDegFp5OVgjsHAwVb0kSR5QVDG/Yo/IJhJIK2cZqvQ2bq4kw2ie7AQAk8ok2MrGJk09wQ9tzhNQsnnsTLNThfrHaGLcuIv9f+qounpn7Ax/gXpEhqU6sjfm5ljTeA2pmPvEpZyApl/+of1eQOqpIsn99ICz8VTyU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705053833; c=relaxed/simple; bh=xdis318HZT6JOlOe6ZUDkozLQxXFQ9zzuchQmArHWeA=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=j4ct2bCUJ0Bai7jGup7TDCFe3vUlXRzmglgtmEUUp7M0SZJW/RAaEB9tScetau5cbykK/DmlOsauLWu+OEvpJgdepsLJ2lDlHRIBRy0kstG1MuB9Z5Dp1lOXm+IrqDsFZTDtljPzKtwkAv6xzTqvt+RsTNMPL1VOiMbEyZ6ogP4= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705053831; 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=hyuejXyb9nJ2jVmnh2LOUqV/YpB8X9E9tb4CBpEBX7g=; b=iczgacns0GzzRKSnx7Syb4Bd89V10Xt4g/ByWvXNVO4ND30u0GBuFhA7puO8t08OinnYOx /qjsuRBitZfFlvF0SZnR13pFhqqW7/63L/0BEISuZSVwxRJnCOAjloO1sVZTeqh+0HK4y1 WjunN+4bpUm9519HrHv+gEkulYXjIuo= 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-596-qixQ6_caO8Sn2BsGBmzKAg-1; Fri, 12 Jan 2024 05:03:49 -0500 X-MC-Unique: qixQ6_caO8Sn2BsGBmzKAg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (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 733618A4403; Fri, 12 Jan 2024 10:03:49 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.92]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 33F37C08EE4; Fri, 12 Jan 2024 10:03:49 +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 40CA3kRK3307396 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 12 Jan 2024 11:03:46 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 40CA3jw33307395; Fri, 12 Jan 2024 11:03:45 +0100 Date: Fri, 12 Jan 2024 11:03:44 +0100 From: Jakub Jelinek To: Jeff Law , Richard Biener Cc: gcc-patches@gcc.gnu.org, "Jose E. Marchesi" Subject: [PATCH] varasm: Fix up process_pending_assemble_externals [PR113182] Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, 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: 1787878586764816513 X-GMAIL-MSGID: 1787878586764816513 Hi! John reported that on HP-UX we no longer emit needed external libcalls. The problem is that we didn't strip name encoding when looking up the identifiers in assemble_external_libcall and process_pending_assemble_externals, while assemble_name_resolve does that: const char *real_name = targetm.strip_name_encoding (name); tree id = maybe_get_identifier (real_name); if (id) { ... mark_referenced (id); The intention is that assemble_external_libcall ensures the IDENTIFIER exists for the external libcall, then for actually emitted calls assemble_name_resolve sees those IDENTIFIERS and sets TREE_SYMBOL_REFERENCED on them and finally process_pending_assemble_externals looks the IDENTIFIER up again and checks its TREE_SYMBOL_REFERENCED. But without the strip_name_encoding call, they can look up different identifiers and those are likely never used. In the PR, John was discussing whether get_identifier or maybe_get_identifier should be used, I believe in assemble_external_libcall we definitely want to use get_identifier, we need an IDENTIFIER allocated so that it can be actually tracked, in process_pending_assemble_externals it doesn't matter, the IDENTIFIER should be already created. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2024-01-12 John David Anglin Jakub Jelinek PR middle-end/113182 * varasm.cc (process_pending_assemble_externals, assemble_external_libcall): Use targetm.strip_name_encoding before calling get_identifier. Jakub --- gcc/varasm.cc.jj 2024-01-08 21:56:04.968516120 +0100 +++ gcc/varasm.cc 2024-01-11 18:44:19.171399167 +0100 @@ -2543,7 +2543,8 @@ process_pending_assemble_externals (void for (rtx list = pending_libcall_symbols; list; list = XEXP (list, 1)) { rtx symbol = XEXP (list, 0); - tree id = get_identifier (XSTR (symbol, 0)); + const char *name = targetm.strip_name_encoding (XSTR (symbol, 0)); + tree id = get_identifier (name); if (TREE_SYMBOL_REFERENCED (id)) targetm.asm_out.external_libcall (symbol); } @@ -2631,7 +2632,8 @@ assemble_external_libcall (rtx fun) reference to it will mark its tree node as referenced, via assemble_name_resolve. These are eventually emitted, if used, in process_pending_assemble_externals. */ - get_identifier (XSTR (fun, 0)); + const char *name = targetm.strip_name_encoding (XSTR (fun, 0)); + get_identifier (name); pending_libcall_symbols = gen_rtx_EXPR_LIST (VOIDmode, fun, pending_libcall_symbols); }