Re: [PATCH 32/48] objtool: Add is_cold_func() helper

Peter Zijlstra
2026-04-23T08:38:52Z

On Wed, Apr 22, 2026 at 09:04:00PM -0700, Josh Poimboeuf wrote:

> diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
> index 00c2389f345f..8a6e1338af97 100644
> --- a/tools/objtool/elf.c
> +++ b/tools/objtool/elf.c
> @@ -586,8 +586,11 @@ static int elf_add_symbol(struct elf *elf, struct symbol *sym)
> if (strstarts(sym->name, ".klp.sym"))
> sym->klp = 1;
>
> + sym->pfunc = sym->cfunc = sym;
> +
> if (!sym->klp && !is_sec_sym(sym) && strstr(sym->name, ".cold")) {
> - sym->cold = 1;
> + /* Tell read_symbols() this is a cold subfunction */
> + sym->pfunc = NULL;
>
> /*
> * Clang doesn't mark cold subfunctions as STT_FUNC, which
> @@ -596,8 +599,6 @@ static int elf_add_symbol(struct elf *elf, struct symbol *sym)
> sym->type = STT_FUNC;
> }
>
> - sym->pfunc = sym->cfunc = sym;
> -
> return 0;
> }

So now the cold subfunction has a NULL parent-function and a
child-function that points to the parent?

I'm confused.