From nobody Mon Feb 9 00:55:55 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 52EF5EB64DC for ; Tue, 11 Jul 2023 16:11:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233385AbjGKQLG (ORCPT ); Tue, 11 Jul 2023 12:11:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232057AbjGKQLB (ORCPT ); Tue, 11 Jul 2023 12:11:01 -0400 Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D23EB12F for ; Tue, 11 Jul 2023 09:10:32 -0700 (PDT) Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233]) by localhost (Postfix) with ESMTP id 4R0m5S03gdz9sFB; Tue, 11 Jul 2023 18:09:00 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Dq2wk4YP3-Sx; Tue, 11 Jul 2023 18:08:59 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4R0m5C5dM5z9sFP; Tue, 11 Jul 2023 18:08:47 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id BBF348B779; Tue, 11 Jul 2023 18:08:47 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id mZOkKT6vsgFz; Tue, 11 Jul 2023 18:08:47 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (unknown [192.168.233.184]) by messagerie.si.c-s.fr (Postfix) with ESMTP id DD3D68B77E; Tue, 11 Jul 2023 18:08:46 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (localhost [127.0.0.1]) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.16.1) with ESMTPS id 36BG8j593696828 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 11 Jul 2023 18:08:45 +0200 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.17.1/Submit) id 36BG8j7f3696827; Tue, 11 Jul 2023 18:08:45 +0200 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy To: Michael Ellerman , Nicholas Piggin , Josh Poimboeuf , Peter Zijlstra , Sathvika Vasireddy , Naveen N Rao Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH v4 07/15] objtool: Merge mark_func_jump_tables() and add_func_jump_tables() Date: Tue, 11 Jul 2023 18:08:33 +0200 Message-ID: <0803f9de476eb9485fc22e2ac080e6ae734f5d6b.1689091394.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1689091705; l=1922; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=SlmT1C5ivl5NXIHNullp0y7NLXMRpXMW0bpClqDQ3p0=; b=sanrNniV6SKkllj2MruVQBdISFqCNjpG00G9TvrcwGoJ5Wd8zVl1zTXpzjJjSY0OWU3EO02MG bcomKi4le9pBWZTWw6PCXu891aLL3ZdwcLxGUEOYTdv4aXCQj9ncldR X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Those two functions loop over the instructions of a function. Merge the two loops in order to ease enhancement of table end in a following patch. Signed-off-by: Christophe Leroy --- tools/objtool/check.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 5a6a87ddbf27..d51f47c4a3bd 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -2097,11 +2097,12 @@ static struct reloc *find_jump_table(struct objtool= _file *file, * First pass: Mark the head of each jump table so that in the next pass, * we know when a given jump table ends and the next one starts. */ -static void mark_func_jump_tables(struct objtool_file *file, - struct symbol *func) +static int mark_add_func_jump_tables(struct objtool_file *file, + struct symbol *func) { - struct instruction *insn, *last =3D NULL; + struct instruction *insn, *last =3D NULL, *insn_t1 =3D NULL, *insn_t2; struct reloc *reloc; + int ret =3D 0; =20 func_for_each_insn(file, func, insn) { if (!last) @@ -2127,17 +2128,7 @@ static void mark_func_jump_tables(struct objtool_fil= e *file, reloc =3D find_jump_table(file, func, insn); if (reloc) insn->_jump_table =3D reloc; - } -} - -static int add_func_jump_tables(struct objtool_file *file, - struct symbol *func) -{ - struct instruction *insn, *insn_t1 =3D NULL, *insn_t2; - int ret =3D 0; - - func_for_each_insn(file, func, insn) { - if (!insn_jump_table(insn)) + else continue; =20 if (!insn_t1) { @@ -2177,8 +2168,7 @@ static int add_jump_table_alts(struct objtool_file *f= ile) if (func->type !=3D STT_FUNC) continue; =20 - mark_func_jump_tables(file, func); - ret =3D add_func_jump_tables(file, func); + ret =3D mark_add_func_jump_tables(file, func); if (ret) return ret; } --=20 2.41.0