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
2614 if (insn->jump_dest) {2614 if (insn->jump_dest) {
2615 struct symbol *dest_func = insn_func(insn->jump_dest);2615 struct symbol *dest_func = insn_func(insn->jump_dest);
2616 2616
2617 if (dest_func && dest_func->cold)2617 if (dest_func && is_cold_func(dest_func))
2618 dest_func->ignore = true;2618 dest_func->ignore = true;
2619 }2619 }
2620 }2620 }
@@ -4422,8 +4422,8 @@ static int create_prefix_symbol(struct objtool_file *file, struct symbol *func) · 1801 unmodified lines
4422 char name[SYM_NAME_LEN];4422 char name[SYM_NAME_LEN];
4423 struct cfi_state *cfi;4423 struct cfi_state *cfi;
4424 4424
4425 if (!is_func_sym(func) || is_prefix_func(func) ||4425 if (!is_func_sym(func) || is_prefix_func(func) || is_cold_func(func) ||
4426 func->cold || func->static_call_tramp)4426 func->static_call_tramp)
4427 return 0;4427 return 0;
4428 4428
4429 if ((strlen(func->name) + sizeof("__pfx_") > SYM_NAME_LEN)) {4429 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
308 return sym->prefix;308 return sym->prefix;
309}309}
310 310
311static inline bool is_cold_func(struct symbol *sym)
312{
313 return sym->cold;
314}
315
311static inline bool is_reloc_sec(struct section *sec)316static inline bool is_reloc_sec(struct section *sec)
312{317{
313 return sec->sh.sh_type == SHT_RELA || sec->sh.sh_type == SHT_REL;318 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
1709 unsigned long sympos;1709 unsigned long sympos;
1710 void *func_data;1710 void *func_data;
1711 1711
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)
1713 continue;1714 continue;
1714 1715
1715 /* allocate klp_func_ext */1716 /* allocate klp_func_ext */