objtool: Add is_cold_func() helper

Add an is_cold_func() helper.  No functional changes intended.

Acked-by: Song Liu <song@kernel.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
This commit is contained in:
Josh Poimboeuf
2026-03-18 15:33:58 -07:00
parent 8eebd57311
commit 6282e9f46b
3 changed files with 10 additions and 4 deletions

View File

@@ -2614,7 +2614,7 @@ static void mark_holes(struct objtool_file *file)
if (insn->jump_dest) {
struct symbol *dest_func = insn_func(insn->jump_dest);
if (dest_func && dest_func->cold)
if (dest_func && is_cold_func(dest_func))
dest_func->ignore = true;
}
}
@@ -4422,8 +4422,8 @@ static int create_prefix_symbol(struct objtool_file *file, struct symbol *func)
char name[SYM_NAME_LEN];
struct cfi_state *cfi;
if (!is_func_sym(func) || is_prefix_func(func) ||
func->cold || func->static_call_tramp)
if (!is_func_sym(func) || is_prefix_func(func) || is_cold_func(func) ||
func->static_call_tramp)
return 0;
if ((strlen(func->name) + sizeof("__pfx_") > SYM_NAME_LEN)) {

View File

@@ -308,6 +308,11 @@ static inline bool is_prefix_func(struct symbol *sym)
return sym->prefix;
}
static inline bool is_cold_func(struct symbol *sym)
{
return sym->cold;
}
static inline bool is_reloc_sec(struct section *sec)
{
return sec->sh.sh_type == SHT_RELA || sec->sh.sh_type == SHT_REL;

View File

@@ -1709,7 +1709,8 @@ static int create_klp_sections(struct elfs *e)
unsigned long sympos;
void *func_data;
if (!is_func_sym(sym) || sym->cold || !sym->clone || !sym->clone->changed)
if (!is_func_sym(sym) || is_cold_func(sym) ||
!sym->clone || !sym->clone->changed)
continue;
/* allocate klp_func_ext */