lkml.org 
[lkml]   [2023]   [Mar]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 4/5] objtool: Add per-function rate limiting for unreachable warnings
Date
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;
+
WARN_FUNC("unreachable instruction", insn->sec, insn->offset);
return 1;
}
diff --git a/tools/objtool/include/objtool/elf.h b/tools/objtool/include/objtool/elf.h
index ad0024da262b..a668173a5869 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;
};
--
2.39.2
\
 
 \ /
  Last update: 2023-03-27 18:01    [W:0.126 / U:0.672 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site