Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

objtool: Mark prefix functions

In preparation for the objtool klp diff subcommand, introduce a flag to
identify __pfx_*() and __cfi_*() functions in advance so they don't need
to be manually identified every time a check is needed.

Acked-by: Petr Mladek <pmladek@suse.com>
Tested-by: Joe Lawrence <joe.lawrence@redhat.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>

+14 -4
+1 -4
tools/objtool/check.c
··· 3568 3568 3569 3569 if (func && insn_func(insn) && func != insn_func(insn)->pfunc) { 3570 3570 /* Ignore KCFI type preambles, which always fall through */ 3571 - if (!strncmp(func->name, "__cfi_", 6) || 3572 - !strncmp(func->name, "__pfx_", 6) || 3573 - !strncmp(func->name, "__pi___cfi_", 11) || 3574 - !strncmp(func->name, "__pi___pfx_", 11)) 3571 + if (is_prefix_func(func)) 3575 3572 return 0; 3576 3573 3577 3574 if (file->ignore_unreachables)
+7
tools/objtool/elf.c
··· 442 442 elf_hash_add(symbol, &sym->hash, sym->idx); 443 443 elf_hash_add(symbol_name, &sym->name_hash, str_hash(sym->name)); 444 444 445 + if (is_func_sym(sym) && 446 + (strstarts(sym->name, "__pfx_") || 447 + strstarts(sym->name, "__cfi_") || 448 + strstarts(sym->name, "__pi___pfx_") || 449 + strstarts(sym->name, "__pi___cfi_"))) 450 + sym->prefix = 1; 451 + 445 452 if (is_func_sym(sym) && strstr(sym->name, ".cold")) 446 453 sym->cold = 1; 447 454 sym->pfunc = sym->cfunc = sym;
+6
tools/objtool/include/objtool/elf.h
··· 73 73 u8 ignore : 1; 74 74 u8 nocfi : 1; 75 75 u8 cold : 1; 76 + u8 prefix : 1; 76 77 struct list_head pv_target; 77 78 struct reloc *relocs; 78 79 struct section *group_sec; ··· 229 228 static inline bool is_local_sym(struct symbol *sym) 230 229 { 231 230 return sym->bind == STB_LOCAL; 231 + } 232 + 233 + static inline bool is_prefix_func(struct symbol *sym) 234 + { 235 + return sym->prefix; 232 236 } 233 237 234 238 static inline bool is_reloc_sec(struct section *sec)