lkml.org 
[lkml]   [2023]   [Mar]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4/5] objtool: Add per-function rate limiting for unreachable warnings
On Mon, 27 Mar 2023, Josh Poimboeuf wrote:

> Unreachable instruction warnings are rate limited to once per object
> file. That no longer makes sense for vmlinux validation, which might
> have other unreachable instructions lurking in other places. Change it
> to once per function.
>
> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
> ---
> tools/objtool/check.c | 4 ++++
> tools/objtool/include/objtool/elf.h | 1 +
> 2 files changed, 5 insertions(+)
>
> diff --git a/tools/objtool/check.c b/tools/objtool/check.c
> index 73dd091c0075..67a684225702 100644
> --- a/tools/objtool/check.c
> +++ b/tools/objtool/check.c
> @@ -4557,6 +4557,10 @@ static int validate_reachable_instructions(struct objtool_file *file)
> if (insn->visited || ignore_unreachable_insn(file, insn))
> continue;
>
> + if (insn->sym->warned)
> + continue;
> + insn->sym->warned = 1;
> +

Ok

> WARN_FUNC("unreachable instruction", insn->sec, insn->offset);
> return 1;

But we still return here when an unreachable instruction is encountered
and warned about. Or maybe I am just misunderstanding the purpose.

If not, would it be better to just collect the number of warnings per
object as we do elsewhere?

warnings++;

and then at the end

return warnings;

Miroslav

\
 
 \ /
  Last update: 2023-03-28 11:09    [W:2.134 / U:0.640 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site