From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by sourceware.org (Postfix) with ESMTPS id 8AFD83858C98 for ; Thu, 29 Feb 2024 16:25:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8AFD83858C98 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 8AFD83858C98 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=1709223942; cv=none; b=UA2BYQuzgabFcc8wxFGXO1P09TfxVOu8dzXYBF2vTxYypR2ugMSrBSs+IwwFhZ0bfnk8EqLBtQzakLrzxez3MKqRyK5NIiLq44ud52w1IPSoV7mWAGn+fE5d4NoRI8SJ4M4vhtVgPMicr+XolOhYfyMNtfARlD+CzaVRG+lk9BE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709223942; c=relaxed/simple; bh=yGe0VbkL+x7HnUzegAymOzEhMMzT0qZlqGrvNELH5RY=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:Date: From:To:Subject:Message-ID:MIME-Version; b=lcI8wS9vD5ofMk9MekpNFetBFrXuvtb8O2WNbCs/niekbTs743qul52bmJzu/ndYNCSEu5MKR3NFOC8BKMygn7pxpEwU/k8AwvJYabypZ23swfIZ+mAVaXudKsDbgad4/yiznZCMv6EoyrOll8HRWU8nsMKzZ3kugvU1Ie+5Zmw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from knuth.suse.de (unknown [10.168.5.16]) by smtp-out2.suse.de (Postfix) with ESMTP id 658DB1FBF2; Thu, 29 Feb 2024 16:25:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1709223939; 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:references:references; bh=aPkiSME3iLdocI2QiOwQ/v1I90/Zfiirip8AZLu57L4=; b=bYL23oubV/+jtqc+FdBuB105nSW4dbPoHaoqPZz9B7vK21xC2bj+v6ugc+LGTBKWDPY5OI WdxQDJRWKdGNKTdex6l61HnTpvJ/1kFLy9BHDxb/l2J080NJVrMbbcW3KMUf3/fSlVeJEl +lWkVHIOSkczNLE2TBPNGc56GkliV0s= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1709223939; 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:references:references; bh=aPkiSME3iLdocI2QiOwQ/v1I90/Zfiirip8AZLu57L4=; b=K3VMAavo8rGZ4fYa85SPFF8pRzHIhsxRQAbT/+GTlMgoGTYujQ0Nj/+NWG35X7LrXY+uc3 eTaEi9s2n5obvVAA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1709223939; 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:references:references; bh=aPkiSME3iLdocI2QiOwQ/v1I90/Zfiirip8AZLu57L4=; b=bYL23oubV/+jtqc+FdBuB105nSW4dbPoHaoqPZz9B7vK21xC2bj+v6ugc+LGTBKWDPY5OI WdxQDJRWKdGNKTdex6l61HnTpvJ/1kFLy9BHDxb/l2J080NJVrMbbcW3KMUf3/fSlVeJEl +lWkVHIOSkczNLE2TBPNGc56GkliV0s= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1709223939; 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:references:references; bh=aPkiSME3iLdocI2QiOwQ/v1I90/Zfiirip8AZLu57L4=; b=K3VMAavo8rGZ4fYa85SPFF8pRzHIhsxRQAbT/+GTlMgoGTYujQ0Nj/+NWG35X7LrXY+uc3 eTaEi9s2n5obvVAA== Received: by knuth.suse.de (Postfix, from userid 10510) id 57E8D335778; Thu, 29 Feb 2024 17:25:39 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by knuth.suse.de (Postfix) with ESMTP id 56EA6335777; Thu, 29 Feb 2024 17:25:39 +0100 (CET) Date: Thu, 29 Feb 2024 17:25:39 +0100 (CET) From: Michael Matz To: Jakub Jelinek cc: Richard Biener , Uros Bizjak , hjl.tools@gmail.com, gcc-patches@gcc.gnu.org Subject: Re: [PATCH] i386: For noreturn functions save at least the bp register if it is used [PR114116] In-Reply-To: Message-ID: <9c5e0111-441e-04a3-d1b4-467b582a0ffd@suse.de> References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Authentication-Results: smtp-out2.suse.de; none X-Spam-Level: X-Spam-Score: 0.30 X-Spamd-Result: default: False [0.30 / 50.00]; TO_DN_SOME(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_HAM_SHORT(-0.20)[-1.000]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; MID_RHS_MATCH_FROM(0.00)[]; BAYES_HAM(-0.00)[36.54%]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM_LONG(-1.00)[-1.000]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FREEMAIL_CC(0.00)[gmail.com,gcc.gnu.org]; RCVD_COUNT_TWO(0.00)[2]; SUSPICIOUS_RECIPS(1.50)[] X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 List-Id: Hello, On Tue, 27 Feb 2024, Jakub Jelinek wrote: > On Tue, Feb 27, 2024 at 10:13:14AM +0100, Jakub Jelinek wrote: > > For __libc_start_main, glibc surely just could use no_callee_saved_registers > > attribute, because that is typically the outermost frame in backtrace, > > there is no need to save those there. > > And for kernel if it really wants it and nothing will use the backtraces, > > perhaps the patch wouldn't need to be reverted completely but just guarded > > the implicit no_callee_saved_registers treatment of noreturn > > functions on -mcmodel=kernel or -fno-asynchronous-unwind-tables. > > Guarding on -fno-asynchronous-unwind-tables isn't a good idea, > with just -g we emit in that case unwind info in .debug_frame section > and even that shouldn't break, and we shouldn't generate different code for > -g vs. -g0. > The problem with the changes is that it breaks the unwinding and debugging > experience not just in the functions on which the optimization triggers, > but on all functions in the backtrace as well. > > So, IMHO either revert the changes altogether, or guard on -mcmodel=kernel > (but talk to kernel people on linux-toolchains if that is what they actually > want). What is the underlying real purpose of the changes anyway? It's a nano-optimization: for functions to be called multiple times they must either return or be recursive. The latter is not very likely, so a noreturn function is called only once in the vast majority of cases. Any optimizations that diddle with the frame setup code for functions called only once seems to be ... well, not so very useful, especially so when they impact anything that is actually useful, like debugging. I definitely think this shouldn't be done by default. Ciao, Michael.