From patchwork Tue Jan 9 16:49:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Jires X-Patchwork-Id: 186469 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp238885dyi; Tue, 9 Jan 2024 08:50:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IEZ+l4vpsvVRQ010Kwajyw+hK010I07q6s1OZuXo2lSo1Ot1ER5QL1NUQNgn7oWOKRLB+2h X-Received: by 2002:ad4:568b:0:b0:680:f86b:452f with SMTP id bd11-20020ad4568b000000b00680f86b452fmr4921732qvb.28.1704819031819; Tue, 09 Jan 2024 08:50:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704819031; cv=pass; d=google.com; s=arc-20160816; b=mC737IyGdpp/X7kdgxfc4/ypmHWPGCPJ1/Vyaa1u0ktB+PDbk4/hyfe+wsJW1LSSPv C0Xlqww9Q+gLUqoUR09H4xzPaAtAVOXnkFO1FA666YSEGz052/nlO7s6Ot4EoJ0SWfzq CInt4Hgu8jWHeyvaNHL2fGetT2h3SRLOrECfLIfSkVGiFr+mpXp2ggFtSHCVNRH2VxqO zUyenuGdb613G8FF0Pmx8e7WBcGYKmn8E7kRCQza547CYG6A2BdJdYTQ+KMAa/FnO9em R8BZjqrsyTpxknSsRBwARSmHPQw3ua3E+tH/t6iaR00mPGYlGxpuPrUoRys3xn82yEpF fWrQ== 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:in-reply-to:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature:dkim-signature:dkim-signature:arc-filter :dmarc-filter:delivered-to; bh=Sxh3pMftukja6pK/FSdOUz3C5AaKmWaZXGr5Yo7EwkI=; fh=KcpXRtrFRrFdiwpRGC3mmEPXwDGEHXAc9/iqyfMIYJI=; b=ACiwgLHfS7jyuHkHoDG12fQm0yoG1NUBy04e+W7GlIdpiVsGjopZtEOZ9/tC2GXIdu 2mNfbSmtzwk3UnvrH65VccEJ5Y1v70ErJyBN9rL/I/9lB3dHLM2zGK9ZiwjkkKrGDlsB HMITS7x8z6PoYef83/nwLn+jYzRZJAieG0IU5h1lW/491agA+ck0QWcbzPO+XTEe46Gz M6DDpbKgsSJ5vowPlsYzW/WJwws2CpZHp+DmCW7k9YtEaXOuVmV80yCVdavempX2VRD9 aEYJRzB6sq3yWHTpZnx4A45Pobi01HZc5grXp6TC0mAGqvw7YWwSF3icWDGo4j/D87XD QInQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=r9sHwwDO; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=E8HFQhsn; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=ZwU4Fspe; 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" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id s3-20020a05620a0bc300b00781b51ade67si2557748qki.712.2024.01.09.08.50.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 08:50:31 -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=@suse.cz header.s=susede2_rsa header.b=r9sHwwDO; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=E8HFQhsn; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=ZwU4Fspe; 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" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4D803385C6E5 for ; Tue, 9 Jan 2024 16:50:31 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by sourceware.org (Postfix) with ESMTPS id 3E152385DC28 for ; Tue, 9 Jan 2024 16:49:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3E152385DC28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3E152385DC28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704818980; cv=none; b=o1eU6bZ+wHz53n1YLEk2kwxZSxe0CfEzVUG7bv0e7ZAed7/YTOKlkF40lnSieUHxYRZyd1MuoER9JgFp7V03FDUC91qC+f8QnkXED/rww6jWM042fwxgY+tXoO9t6KZSi++w6I8KrL43YfW2OjXko5ilIHudS/YzXZFMeVZGnZ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704818980; c=relaxed/simple; bh=VpvjNbFuB++jf+wF//Luq/UFmCZp48CvkIx0OjiWZLw=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:Date: From:To:Subject:Message-ID:MIME-Version; b=iSF/uQoOgWiQ0WFmYBSwu+0FpohTyhGELmOrk8IRPVmRMbZp7/pVGkLUfs9arimkWj14sUPLmxavXD3VD8BAEF0eMroc1a89+ffhwn7MXLaUvM967Jk/YlUzN2A6pssnX3yY5D/oVd4hjZAfOtM+1kOng+UOGKcW0axxN/Y6nOY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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 smtp-out2.suse.de (Postfix) with ESMTPS id B9D961F809; Tue, 9 Jan 2024 16:49:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1704818976; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to; bh=Sxh3pMftukja6pK/FSdOUz3C5AaKmWaZXGr5Yo7EwkI=; b=r9sHwwDOUu3hEgkyO4hQgzcs6JS5Zb8Rav6g3tVT8+yVd+pJ/YJcXoPK+N8z0GxbatJQXP nHjz0yeFsWyrYgJzfkzsvoZDB8AsuTp8XbVK6K2wf9tsr6WX+BCKPICxdEhaAS0GiCLlSa 8gFr9coj+wfagSw2PG+H79ydRYGbTRU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1704818976; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to; bh=Sxh3pMftukja6pK/FSdOUz3C5AaKmWaZXGr5Yo7EwkI=; b=zDA6J11sdkr21vs8uMvPV5lztWCgxOy5jukSxvnTsHJzB4Mk2z35ovfxVMWiwVFR3ZgWRV xlFjP2Z0hrP/mnBw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1704818975; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to; bh=Sxh3pMftukja6pK/FSdOUz3C5AaKmWaZXGr5Yo7EwkI=; b=E8HFQhsncnAC+oBxoQEisl0QTjDlOMql9BWeorHvbAlc5letpuQFmNUh/8vbEFQATc9ICt jGP/cKcOOdRHSv1kWIz+VviScNRIuZ2X9Eb4LCmSZ4ceb7Jlx21ROFSdvcdd67LP1UgqHU RcEa4KG8fk9dd7zV6bD8gg7nhm0yDDA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1704818975; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to; bh=Sxh3pMftukja6pK/FSdOUz3C5AaKmWaZXGr5Yo7EwkI=; b=ZwU4Fspeg4ASvNgsTZ4nOtgo7TDLPPTneUKXwfpVTIyl2QX8vaaSUvfkZEPu/1zPSmfQ6K bLIKcgB8kKB+Q6Cg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 7DC53134E8; Tue, 9 Jan 2024 16:49:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap1.dmz-prg2.suse.org with ESMTPSA id g7ROHB95nWVzCwAAD6G6ig (envelope-from ); Tue, 09 Jan 2024 16:49:35 +0000 Date: Tue, 9 Jan 2024 17:49:34 +0100 From: Michal Jires To: Jan Hubicka Cc: gcc-patches@gcc.gnu.org Subject: [PATCH 2/7 v2] lto: Remove random_seed from section name. Message-ID: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Spamd-Bar: +++ Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=E8HFQhsn; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=ZwU4Fspe X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [3.49 / 50.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.cz:+]; RCPT_COUNT_TWO(0.00)[2]; MX_GOOD(-0.01)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; BAYES_HAM(-0.00)[12.17%]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; NEURAL_SPAM_LONG(3.50)[1.000]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.cz:dkim]; FUZZY_BLOCKED(0.00)[rspamd.com]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: 3.49 X-Rspamd-Queue-Id: B9D961F809 X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, 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: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782843693017873047 X-GMAIL-MSGID: 1787632321265765080 This patch removes suffixes from section names during LTO linking. These suffixes were originally added for ld -r to work (PR lto/44992). They were added to all LTO object files, but are only useful before WPA. After that they waste space, and if kept random, make LTO caching impossible. Bootstrapped/regtested on x86_64-pc-linux-gnu gcc/ChangeLog: * lto-streamer.cc (lto_get_section_name): Remove suffixes after WPA. gcc/lto/ChangeLog: * lto-common.cc (lto_section_with_id): Dont load suffix during LTRANS. --- gcc/lto-streamer.cc | 11 +++++++++-- gcc/lto/lto-common.cc | 7 +++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/gcc/lto-streamer.cc b/gcc/lto-streamer.cc index 8032bbf7108..61b5f8ed4dc 100644 --- a/gcc/lto-streamer.cc +++ b/gcc/lto-streamer.cc @@ -132,11 +132,18 @@ lto_get_section_name (int section_type, const char *name, doesn't confuse the reader with merged sections. For options don't add a ID, the option reader cannot deal with them - and merging should be ok here. */ - if (section_type == LTO_section_opts) + and merging should be ok here. + + LTRANS files (output of wpa, input and output of ltrans) are handled + directly inside of linker/lto-wrapper, so name uniqueness for external + tools is not needed. + Randomness would inhibit incremental LTO. */ + if (section_type == LTO_section_opts || flag_ltrans) strcpy (post, ""); else if (f != NULL) sprintf (post, "." HOST_WIDE_INT_PRINT_HEX_PURE, f->id); + else if (flag_wpa) + strcpy (post, ""); else sprintf (post, "." HOST_WIDE_INT_PRINT_HEX_PURE, get_random_seed (false)); char *res = concat (section_name_prefix, sep, add, post, NULL); diff --git a/gcc/lto/lto-common.cc b/gcc/lto/lto-common.cc index 11e7d63f1be..44aeeddf46f 100644 --- a/gcc/lto/lto-common.cc +++ b/gcc/lto/lto-common.cc @@ -2174,6 +2174,13 @@ lto_section_with_id (const char *name, unsigned HOST_WIDE_INT *id) if (strncmp (name, section_name_prefix, strlen (section_name_prefix))) return 0; + + if (flag_ltrans) + { + *id = 0; + return 1; + } + s = strrchr (name, '.'); if (!s) return 0;