From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) by sourceware.org (Postfix) with ESMTPS id A85743858C39 for ; Tue, 9 Apr 2024 12:49:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A85743858C39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A85743858C39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712666952; cv=none; b=H6i4vXRgx44P3apzqzuteBdZpuxEd4Bhg8ao3nKWAVzWiIGYXG3FZ914kxuMvf5aIXzFQq42Lp1oUiyjRplCNjl25bmkgjTQFVE2GrvJgeRsI+HhbrWfGxw1kfeX9zqHxRi4bQQhezNqwCZv1mtTFfuh2gRQqr6IK0y/CbclH/o= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712666952; c=relaxed/simple; bh=9L/gN+gFLkGbZGGGUCI706dtg0cp/V5upobYpd4SjTc=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:Date: From:To:Subject:MIME-Version; b=TohDP1XluCqakyJt8E1/7lyLZMqMtX8DSHUwPx7u4QJcK6l5tk7Mekw/il6SQDSeVUKbfNi58U9kx5QNanIgn/vBhH/bs+AiUhCnrULTVsBKLm7rG+r/cPZrUjBofI0VRGcUbgn3XmeaGwlit0wlP+nxEGAcRWPHmIdjSdoKbqY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from [10.168.5.241] (unknown [10.168.5.241]) (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-out1.suse.de (Postfix) with ESMTPS id 96930339CC; Tue, 9 Apr 2024 12:49:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1712666949; h=from:from:reply-to:date:date:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=jq2zzzpn4MBaR0FlEh0RVSg7SyHOG+3yBNjUQ77kcNE=; b=If2Vf+dSTPtkGy+2vIUw0lxdTsf7MDn0jnR/QYX7YgJraiusIK+mPCytV4jYeXWC+vKCKg kpFruRWMFldkxe1wT/PI/Wd5fr99EmMVolmFug1pGNgnVHqQynyBQQ61JN5JCMajsIsOZx G9VF2Dh9hgn0eyK1Y0Y2XRlkviESImU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1712666949; h=from:from:reply-to:date:date:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=jq2zzzpn4MBaR0FlEh0RVSg7SyHOG+3yBNjUQ77kcNE=; b=tq8zvK42l5NYGGuYMXWE6Mcu/OMZcB/CcsOyHmDLew7KXE5EF8Dazbjqnm3gQw3WZBimOc qmh2+1mB3Qt7R1DQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1712666949; h=from:from:reply-to:date:date:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=jq2zzzpn4MBaR0FlEh0RVSg7SyHOG+3yBNjUQ77kcNE=; b=If2Vf+dSTPtkGy+2vIUw0lxdTsf7MDn0jnR/QYX7YgJraiusIK+mPCytV4jYeXWC+vKCKg kpFruRWMFldkxe1wT/PI/Wd5fr99EmMVolmFug1pGNgnVHqQynyBQQ61JN5JCMajsIsOZx G9VF2Dh9hgn0eyK1Y0Y2XRlkviESImU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1712666949; h=from:from:reply-to:date:date:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=jq2zzzpn4MBaR0FlEh0RVSg7SyHOG+3yBNjUQ77kcNE=; b=tq8zvK42l5NYGGuYMXWE6Mcu/OMZcB/CcsOyHmDLew7KXE5EF8Dazbjqnm3gQw3WZBimOc qmh2+1mB3Qt7R1DQ== Date: Tue, 9 Apr 2024 14:49:09 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org cc: Jakub Jelinek Subject: [PATCH] lto/114655 - -flto=4 at link time doesn't override -flto=auto at compile time MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Score: -0.44 X-Spam-Level: X-Spamd-Result: default: False [-0.44 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MISSING_MID(2.50)[]; NEURAL_SPAM_LONG(0.36)[0.102]; NEURAL_HAM_SHORT(-0.20)[-0.978]; MIME_GOOD(-0.10)[text/plain]; MISSING_XM_UA(0.00)[]; RCVD_COUNT_ZERO(0.00)[0]; ARC_NA(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; TO_DN_SOME(0.00)[] X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,MISSING_MID,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 List-Id: Message-ID: <20240409124909.7MTolL2TaaTe_oGP5iswycbIJULtBg_PoRsxVdtF05A@z> The following adjusts -flto option processing in lto-wrapper to have link-time -flto override any compile time setting. LTO-boostrapped on x86_64-unknown-linux-gnu, testing in progress. OK for trunk and branches? GCC 11 seems to be unaffected by this. Thanks, Richard. PR lto/114655 * lto-wrapper.cc (merge_flto_options): Add force argument. (merge_and_complain): Do not force here. (run_gcc): But here to make the link-time -flto option override any compile-time one. --- gcc/lto-wrapper.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/gcc/lto-wrapper.cc b/gcc/lto-wrapper.cc index 610594cdc2b..02579951569 100644 --- a/gcc/lto-wrapper.cc +++ b/gcc/lto-wrapper.cc @@ -218,15 +218,18 @@ find_option (vec &options, cl_decoded_option *option) return find_option (options, option->opt_index); } -/* Merge -flto FOPTION into vector of DECODED_OPTIONS. */ +/* Merge -flto FOPTION into vector of DECODED_OPTIONS. If FORCE is true + then FOPTION overrides previous settings. */ static void merge_flto_options (vec &decoded_options, - cl_decoded_option *foption) + cl_decoded_option *foption, bool force) { int existing_opt = find_option (decoded_options, foption); if (existing_opt == -1) decoded_options.safe_push (*foption); + else if (force) + decoded_options[existing_opt].arg = foption->arg; else { if (strcmp (foption->arg, decoded_options[existing_opt].arg) != 0) @@ -493,7 +496,7 @@ merge_and_complain (vec &decoded_options, break; case OPT_flto_: - merge_flto_options (decoded_options, foption); + merge_flto_options (decoded_options, foption, false); break; } } @@ -1550,8 +1553,8 @@ run_gcc (unsigned argc, char *argv[]) break; case OPT_flto_: - /* Merge linker -flto= option with what we have in IL files. */ - merge_flto_options (fdecoded_options, option); + /* Override IL file settings with a linker -flto= option. */ + merge_flto_options (fdecoded_options, option, true); if (strcmp (option->arg, "jobserver") == 0) jobserver_requested = true; break; -- 2.35.3