History

objtool: Add is_cold_func() helper

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

Josh Poimboeuf committed 8 months ago

Commit 6282e9f1 parent 8eebd573 files · +10 −4Browse files

Unified · Split

3 files
  1. tools/objtool/check.c +3 −3
  2. tools/objtool/include/objtool/elf.h +5 −0
  3. tools/objtool/klp-diff.c +2 −1
tools/objtool/check.c+3−3
@@ -2614,7 +2614,7 @@ static void mark_holes(struct objtool_file *file) · 2613 unmodified lines
26142614 if (insn->jump_dest) {
26152615 struct symbol *dest_func = insn_func(insn->jump_dest);
26162616
2617− if (dest_func && dest_func->cold)
2617+ if (dest_func && is_cold_func(dest_func))
26182618 dest_func->ignore = true;
26192619 }
26202620 }
@@ -4422,8 +4422,8 @@ static int create_prefix_symbol(struct objtool_file *file, struct symbol *func) · 1801 unmodified lines
44224422 char name[SYM_NAME_LEN];
44234423 struct cfi_state *cfi;
44244424
4425− if (!is_func_sym(func) || is_prefix_func(func) ||
4426− func->cold || func->static_call_tramp)
4425+ if (!is_func_sym(func) || is_prefix_func(func) || is_cold_func(func) ||
4426+ func->static_call_tramp)
44274427 return 0;
44284428
44294429 if ((strlen(func->name) + sizeof("__pfx_") > SYM_NAME_LEN)) {
tools/objtool/include/objtool/elf.h+5−0
@@ -308,6 +308,11 @@ static inline bool is_prefix_func(struct symbol *sym) · 307 unmodified lines
308308 return sym->prefix;
309309 }
310310
311+static inline bool is_cold_func(struct symbol *sym)
312+{
313+ return sym->cold;
314+}
315+
311316 static inline bool is_reloc_sec(struct section *sec)
312317 {
313318 return sec->sh.sh_type == SHT_RELA || sec->sh.sh_type == SHT_REL;
tools/objtool/klp-diff.c+2−1
@@ -1709,7 +1709,8 @@ static int create_klp_sections(struct elfs *e) · 1708 unmodified lines
17091709 unsigned long sympos;
17101710 void *func_data;
17111711
1712− if (!is_func_sym(sym) || sym->cold || !sym->clone || !sym->clone->changed)
1712+ if (!is_func_sym(sym) || is_cold_func(sym) ||
1713+ !sym->clone || !sym->clone->changed)
17131714 continue;
17141715
17151716 /* allocate klp_func_ext */