From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AFE54ECAAD5 for ; Mon, 12 Sep 2022 11:40:34 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4MR4R50mtlz3c8X for ; Mon, 12 Sep 2022 21:40:33 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.crashing.org (client-ip=63.228.1.57; helo=gate.crashing.org; envelope-from=segher@kernel.crashing.org; receiver=) Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by lists.ozlabs.org (Postfix) with ESMTP id 4MR4QZ3vWwz2xGS for ; Mon, 12 Sep 2022 21:40:05 +1000 (AEST) Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 28CBVGtH009422; Mon, 12 Sep 2022 06:31:16 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 28CBVEwA009421; Mon, 12 Sep 2022 06:31:14 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Mon, 12 Sep 2022 06:31:14 -0500 From: Segher Boessenkool To: Josh Poimboeuf Subject: Re: [RFC] Objtool toolchain proposal: -fannotate-{jump-table,noreturn} Message-ID: <20220912113114.GV25951@gate.crashing.org> References: <20220909180704.jwwed4zhwvin7uyi@treble> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220909180704.jwwed4zhwvin7uyi@treble> User-Agent: Mutt/1.4.2.3i X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Peter Zijlstra , linuxppc-dev@lists.ozlabs.org, Chen Zhongjin , x86@kernel.org, Nick Desaulniers , linux-kernel@vger.kernel.org, Mark Brown , Sathvika Vasireddy , linux-toolchains@vger.kernel.org, Indu Bhagat , live-patching@vger.kernel.org, Miroslav Benes , Will Deacon , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org, "Jose E. Marchesi" Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Hi! On Fri, Sep 09, 2022 at 11:07:04AM -0700, Josh Poimboeuf wrote: > 2) Noreturn functions: > > There's no reliable way to determine which functions are designated > by the compiler to be noreturn (either explictly via function > attribute, or implicitly via a static function which is a wrapper > around a noreturn function.) Or just a function that does not return for any other reason. The compiler makes no difference between functions that have the attribute and functions that do not. There are good reasons to not have the attribute on functions that do in fact not return. The not-returningness of the function may be just an implementation accident, something you do not want part of the API, so it *should* not have that attribute; or you may want the callers to a function to not be optimised according to this knowledge (you cannot *prevent* that, the compiler can figure it out it other ways, but still) for any other reason. > This information is needed because the > code after the call to such a function is optimized out as > unreachable and objtool has no way of knowing that. Since June we (GCC) have -funreachable-traps. This creates a trap insn wherever control flow would otherwise go into limbo. Segher From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 614E4ECAAA1 for ; Mon, 12 Sep 2022 11:40:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Mime-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=60zkk1Ui1loMuMgUgumIigTcdrDPd26RdSd5MfrL3FI=; b=EY7YNcnTghO6Vu dzOQpudAwHvPFYACdvWFdWOp7KmKYsXSfaqFylFXMxWUJ6AAGVZjTs5n6kgBeiIZvw5ZQxpL5IJZ+ zqfi2ocnyRwZab4FxS5efor0ZXQPz85bl4V2aBHhBHlU4xCIisqAg7Ae3maOPF5zBQhQnjw7Cm333 mp1Dk6rRSZmE8K9Vhw8rrHlnKn5ysRfpzpSTk5AhuWEHtrdlRiE88z7iO/vBHfpm1adRG7TgdQ6GX 3Tz/PaC6TLE9Q/JXAyeUse84+ZI8z9Wq5YgPqTaivEzfOWReaDeLz3ZyWypofLO9kl5dBTSgDgZ/X J7LXidomF6CFsoPoEYnA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oXhmK-009OHw-90; Mon, 12 Sep 2022 11:39:04 +0000 Received: from gate.crashing.org ([63.228.1.57]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oXhmG-009OGP-HM for linux-arm-kernel@lists.infradead.org; Mon, 12 Sep 2022 11:39:01 +0000 Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 28CBVGtH009422; Mon, 12 Sep 2022 06:31:16 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 28CBVEwA009421; Mon, 12 Sep 2022 06:31:14 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Mon, 12 Sep 2022 06:31:14 -0500 From: Segher Boessenkool To: Josh Poimboeuf Cc: linux-toolchains@vger.kernel.org, Peter Zijlstra , Indu Bhagat , Nick Desaulniers , linux-kernel@vger.kernel.org, "Jose E. Marchesi" , Miroslav Benes , Mark Rutland , Will Deacon , x86@kernel.org, linux-arm-kernel@lists.infradead.org, live-patching@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Ard Biesheuvel , Chen Zhongjin , Sathvika Vasireddy , Christophe Leroy , Mark Brown Subject: Re: [RFC] Objtool toolchain proposal: -fannotate-{jump-table,noreturn} Message-ID: <20220912113114.GV25951@gate.crashing.org> References: <20220909180704.jwwed4zhwvin7uyi@treble> Mime-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220909180704.jwwed4zhwvin7uyi@treble> User-Agent: Mutt/1.4.2.3i X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220912_043900_827457_6BFACA72 X-CRM114-Status: GOOD ( 16.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi! On Fri, Sep 09, 2022 at 11:07:04AM -0700, Josh Poimboeuf wrote: > 2) Noreturn functions: > > There's no reliable way to determine which functions are designated > by the compiler to be noreturn (either explictly via function > attribute, or implicitly via a static function which is a wrapper > around a noreturn function.) Or just a function that does not return for any other reason. The compiler makes no difference between functions that have the attribute and functions that do not. There are good reasons to not have the attribute on functions that do in fact not return. The not-returningness of the function may be just an implementation accident, something you do not want part of the API, so it *should* not have that attribute; or you may want the callers to a function to not be optimised according to this knowledge (you cannot *prevent* that, the compiler can figure it out it other ways, but still) for any other reason. > This information is needed because the > code after the call to such a function is optimized out as > unreachable and objtool has no way of knowing that. Since June we (GCC) have -funreachable-traps. This creates a trap insn wherever control flow would otherwise go into limbo. Segher _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D368AECAAA1 for ; Mon, 12 Sep 2022 11:42:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229899AbiILLmS (ORCPT ); Mon, 12 Sep 2022 07:42:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229512AbiILLmP (ORCPT ); Mon, 12 Sep 2022 07:42:15 -0400 Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 16FFF3C160; Mon, 12 Sep 2022 04:42:13 -0700 (PDT) Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 28CBVGtH009422; Mon, 12 Sep 2022 06:31:16 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 28CBVEwA009421; Mon, 12 Sep 2022 06:31:14 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Mon, 12 Sep 2022 06:31:14 -0500 From: Segher Boessenkool To: Josh Poimboeuf Cc: linux-toolchains@vger.kernel.org, Peter Zijlstra , Indu Bhagat , Nick Desaulniers , linux-kernel@vger.kernel.org, "Jose E. Marchesi" , Miroslav Benes , Mark Rutland , Will Deacon , x86@kernel.org, linux-arm-kernel@lists.infradead.org, live-patching@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Ard Biesheuvel , Chen Zhongjin , Sathvika Vasireddy , Christophe Leroy , Mark Brown Subject: Re: [RFC] Objtool toolchain proposal: -fannotate-{jump-table,noreturn} Message-ID: <20220912113114.GV25951@gate.crashing.org> References: <20220909180704.jwwed4zhwvin7uyi@treble> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220909180704.jwwed4zhwvin7uyi@treble> User-Agent: Mutt/1.4.2.3i Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi! On Fri, Sep 09, 2022 at 11:07:04AM -0700, Josh Poimboeuf wrote: > 2) Noreturn functions: > > There's no reliable way to determine which functions are designated > by the compiler to be noreturn (either explictly via function > attribute, or implicitly via a static function which is a wrapper > around a noreturn function.) Or just a function that does not return for any other reason. The compiler makes no difference between functions that have the attribute and functions that do not. There are good reasons to not have the attribute on functions that do in fact not return. The not-returningness of the function may be just an implementation accident, something you do not want part of the API, so it *should* not have that attribute; or you may want the callers to a function to not be optimised according to this knowledge (you cannot *prevent* that, the compiler can figure it out it other ways, but still) for any other reason. > This information is needed because the > code after the call to such a function is optimized out as > unreachable and objtool has no way of knowing that. Since June we (GCC) have -funreachable-traps. This creates a trap insn wherever control flow would otherwise go into limbo. Segher