From nobody Mon Apr 6 21:31:14 2026 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 12933C38145 for ; Fri, 2 Sep 2022 14:33:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236374AbiIBOdL (ORCPT ); Fri, 2 Sep 2022 10:33:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236920AbiIBO3J (ORCPT ); Fri, 2 Sep 2022 10:29:09 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48EFF2648 for ; Fri, 2 Sep 2022 06:54:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To; bh=zQlKGQHBFgjVvjoX8AWmJKxWpsURbcGwMojDrLJkF48=; b=ALJrRxb1oOAv3oR6l6jjujyd61 RAneOzfB60U91aF/P5PkjNPeCQCUT62upDitSH8L65BG9joWG0VhBm9GC812c05U9QUB6Hm56IOsA abeowS4cmR8B1nb7ZHIwwZdebJoGMhCU9TkBwspMjrv70IDKVqXJQMIYJo1a9KYJlDxKoOWlDsFGB LqjGkN9FrH/K4TTEJjcP+8wbtd1MtGqYKfpkAqGYeETk/CNvcizLoCp1Uq4OjLKANE2Wr2uJs5Mu1 xF0w1x1Y/1RBi2P4x9SbrBcGimAfwqgXWb6xElAQuE/A/7JbDtPJbb9GT3EM8KQdh+bDep7ple0oC c5a2yGCA==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1oU77N-0074TN-MK; Fri, 02 Sep 2022 13:53:58 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 2BC90302188; Fri, 2 Sep 2022 15:53:54 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id ED9EA2B8EF7F6; Fri, 2 Sep 2022 15:53:52 +0200 (CEST) Message-ID: <20220902130949.683665538@infradead.org> User-Agent: quilt/0.66 Date: Fri, 02 Sep 2022 15:06:57 +0200 From: Peter Zijlstra To: Thomas Gleixner Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, x86@kernel.org, Linus Torvalds , Tim Chen , Josh Poimboeuf , Andrew Cooper , Pawan Gupta , Johannes Wikner , Alyssa Milburn , Jann Horn , "H.J. Lu" , Joao Moreira , Joseph Nuzman , Steven Rostedt , Juergen Gross , Masami Hiramatsu , Alexei Starovoitov , Daniel Borkmann , K Prateek Nayak , Eric Dumazet Subject: [PATCH v2 32/59] objtool: Allow STT_NOTYPE -> STT_FUNC+0 tail-calls References: <20220902130625.217071627@infradead.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Peter Zijlstra Allow STT_NOTYPE to tail-call into STT_FUNC, per definition STT_NOTYPE is not a sub-function of the STT_FUNC. Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Thomas Gleixner Signed-off-by: Peter Zijlstra (Intel) --- tools/objtool/check.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1370,6 +1370,16 @@ static void add_return_call(struct objto =20 static bool same_function(struct instruction *insn1, struct instruction *i= nsn2) { + if (!insn1->func && !insn2->func) + return true; + + /* Allow STT_NOTYPE -> STT_FUNC+0 tail-calls */ + if (!insn1->func && insn1->func !=3D insn2->func) + return false; + + if (!insn2->func) + return true; + return insn1->func->pfunc =3D=3D insn2->func->pfunc; } =20 @@ -1487,18 +1497,19 @@ static int add_jump_destinations(struct strstr(jump_dest->func->name, ".cold")) { insn->func->cfunc =3D jump_dest->func; jump_dest->func->pfunc =3D insn->func; - - } else if (!same_function(insn, jump_dest) && - is_first_func_insn(file, jump_dest)) { - /* - * Internal sibling call without reloc or with - * STT_SECTION reloc. - */ - add_call_dest(file, insn, jump_dest->func, true); - continue; } } =20 + if (!same_function(insn, jump_dest) && + is_first_func_insn(file, jump_dest)) { + /* + * Internal sibling call without reloc or with + * STT_SECTION reloc. + */ + add_call_dest(file, insn, jump_dest->func, true); + continue; + } + insn->jump_dest =3D jump_dest; }