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 1A959C6FA83 for ; Mon, 12 Sep 2022 11:42:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229790AbiILLmQ (ORCPT ); Mon, 12 Sep 2022 07:42:16 -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-toolchains@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