Re: [PATCH RESEND] objtool: speedup subsequent calls to dead_end_function()

From: Josh Poimboeuf

Date: Fri Sep 19 2025 - 13:47:21 EST


On Fri, Sep 19, 2025 at 04:55:57PM +0300, Dmitry Antipov wrote:
> Running over KASAN-enabled vmlinux.o, some functions comes from the
> sanitizer runtime may be processed by 'dead_end_function()' a lot of
> times, so it's reasonable to record the result in 'struct symbol' of
> the relevant function. Briefly testing over huge 'make allyesconfig'
> vmlinux.o, this may speedup objtool by nearly 10%.
>
> Signed-off-by: Dmitry Antipov <dmantipov@xxxxxxxxx>
> ---
> tools/objtool/check.c | 5 ++++-
> tools/objtool/include/objtool/elf.h | 1 +
> 2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/tools/objtool/check.c b/tools/objtool/check.c
> index d14f20ef1db1..d4c0ef419b95 100644
> --- a/tools/objtool/check.c
> +++ b/tools/objtool/check.c
> @@ -322,7 +322,10 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func,
>
> static bool dead_end_function(struct objtool_file *file, struct symbol *func)
> {
> - return __dead_end_function(file, func, 0);
> + if (func->functype == UNKNOWN)
> + func->functype = (__dead_end_function(file, func, 0)
> + ? NORETURN : REGULAR);
> + return func->functype == NORETURN;
> }

Thanks for the patch.

Since this basically gets called at least once for every function
anyway, how about we just identify them during init, all at once, in
decode_sections()? Then we only need a single "noreturn" bit.

--
Josh