From nobody Sun Feb 8 20:34:13 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 2AABBC77B7D for ; Thu, 18 May 2023 11:09:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231159AbjERLJL (ORCPT ); Thu, 18 May 2023 07:09:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230515AbjERLJI (ORCPT ); Thu, 18 May 2023 07:09:08 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B1BF1738; Thu, 18 May 2023 04:08:30 -0700 (PDT) Date: Thu, 18 May 2023 11:08:03 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1684408083; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4ATqR6+23eUp9OSsJpJ6LDVDI6BWgqiqufebazH3Qso=; b=Z4k5wrCpButQ5ztn8gNmpE86UfOfX4NGi5ZC4IQrgITNMYssFktm0GAn5GCm4ZQXF+Nm74 Zr6427PdGY6kIQv8oYROUEZeBb6BMxiZp8vs79do2vgk4b7k5Nb9DF8FExnThO5OCq+2+B eWa60oRfeHtneDrcFJotyQEYHn85vzTfutifvW7uIpqUb4eIyiB/vtAJOaNFHu56NGpktU E1BAwP+jnQ/ogxli4txfZL3NZqfyWsZILHbRFF/Z//1K/Jzf71Z4d4ej0u+3rvqAEaAtWj ByvKrApri9lxRMgHsXLlMdllecWkqasCYMvvbWTvhGULUYcsWeMd2x/ZEWNI8w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1684408083; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4ATqR6+23eUp9OSsJpJ6LDVDI6BWgqiqufebazH3Qso=; b=IeH4ed2b6ngQPj7TAI/c3beRbDIHDEl3f2syZ7bc4mZ2qVroxvf02OXPEb6/bplYWX1t4F TnsCptdoN/EVyCCg== From: "tip-bot2 for Josh Poimboeuf" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: objtool/core] objtool: Limit unreachable warnings to once per function Cc: Miroslav Benes , Josh Poimboeuf , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <9d38f881bfc34e031c74e4e90064ccb3e49f599a.1681853186.git.jpoimboe@kernel.org> References: <9d38f881bfc34e031c74e4e90064ccb3e49f599a.1681853186.git.jpoimboe@kernel.org> MIME-Version: 1.0 Message-ID: <168440808302.404.11280971463305376650.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the objtool/core branch of tip: Commit-ID: 5e3992fe72748ed3892be876f09d4d990548b7af Gitweb: https://git.kernel.org/tip/5e3992fe72748ed3892be876f09d4d990= 548b7af Author: Josh Poimboeuf AuthorDate: Tue, 18 Apr 2023 14:27:47 -07:00 Committer: Josh Poimboeuf CommitterDate: Tue, 16 May 2023 06:31:51 -07:00 objtool: Limit unreachable warnings to once per function Unreachable instruction warnings are limited to once per object file. That no longer makes sense for vmlinux validation, which might have more unreachable instructions lurking in other places. Change it to once per function. Note this affects some other (much rarer) non-fatal warnings as well. In general I think one-warning-per-function makes sense, as related warnings can accumulate quickly and we want to eventually get back to failing the build with -Werror anyway. Reviewed-by: Miroslav Benes Link: https://lore.kernel.org/r/9d38f881bfc34e031c74e4e90064ccb3e49f599a.16= 81853186.git.jpoimboe@kernel.org Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 5 +++-- tools/objtool/include/objtool/elf.h | 1 + tools/objtool/include/objtool/warn.h | 7 ++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 0fcf99c..98e6c3b 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -4514,6 +4514,7 @@ static int validate_sls(struct objtool_file *file) static int validate_reachable_instructions(struct objtool_file *file) { struct instruction *insn; + int warnings =3D 0; =20 if (file->ignore_unreachables) return 0; @@ -4523,10 +4524,10 @@ static int validate_reachable_instructions(struct o= bjtool_file *file) continue; =20 WARN_INSN(insn, "unreachable instruction"); - return 1; + warnings++; } =20 - return 0; + return warnings; } =20 int check(struct objtool_file *file) diff --git a/tools/objtool/include/objtool/elf.h b/tools/objtool/include/ob= jtool/elf.h index e1ca588..78e2d0f 100644 --- a/tools/objtool/include/objtool/elf.h +++ b/tools/objtool/include/objtool/elf.h @@ -61,6 +61,7 @@ struct symbol { u8 return_thunk : 1; u8 fentry : 1; u8 profiling_func : 1; + u8 warned : 1; struct list_head pv_target; struct list_head reloc_list; }; diff --git a/tools/objtool/include/objtool/warn.h b/tools/objtool/include/o= bjtool/warn.h index b1c920d..f195dea 100644 --- a/tools/objtool/include/objtool/warn.h +++ b/tools/objtool/include/objtool/warn.h @@ -55,7 +55,12 @@ static inline char *offstr(struct section *sec, unsigned= long offset) =20 #define WARN_INSN(insn, format, ...) \ ({ \ - WARN_FUNC(format, insn->sec, insn->offset, ##__VA_ARGS__); \ + struct instruction *_insn =3D (insn); \ + if (!_insn->sym || !_insn->sym->warned) \ + WARN_FUNC(format, _insn->sec, _insn->offset, \ + ##__VA_ARGS__); \ + if (_insn->sym) \ + _insn->sym->warned =3D 1; \ }) =20 #define BT_FUNC(format, insn, ...) \