]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
objtool: Add is_cold_func() helper
authorJosh Poimboeuf <jpoimboe@kernel.org>
Wed, 18 Mar 2026 22:33:58 +0000 (15:33 -0700)
committerJosh Poimboeuf <jpoimboe@kernel.org>
Tue, 5 May 2026 04:16:05 +0000 (21:16 -0700)
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>
tools/objtool/check.c
tools/objtool/include/objtool/elf.h
tools/objtool/klp-diff.c

index 6c94eb32c0901230707bb1da138b4db5e66691ce..93a054adf2091fdc197c0e2492bec04c93b546b4 100644 (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)) {
index ccc72a692d9a685e533e0da6b1ebd6434e878230..e452784df7028eaf325b26384576908bc9ad768a 100644 (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;
index 7e58ef36f805b1d12e67d8e4bb7eb85d851ba3ce..8728dda1e08c3f83ddd51d8ee5a67aaab7606628 100644 (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 */