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: Ignore entire functions rather than instructions

STACK_FRAME_NON_STANDARD applies to functions. Use a function-specific
ignore attribute in preparation for getting rid of insn->ignore.

Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/r/4af13376567f83331a9372ae2bb25e11a3d0f055.1742852846.git.jpoimboe@kernel.org

authored by

Josh Poimboeuf and committed by
Ingo Molnar
c84301d7 eeff7ac6

+19 -17
+18 -17
tools/objtool/check.c
··· 981 981 */ 982 982 static void add_ignores(struct objtool_file *file) 983 983 { 984 - struct instruction *insn; 985 984 struct section *rsec; 986 985 struct symbol *func; 987 986 struct reloc *reloc; ··· 1007 1008 continue; 1008 1009 } 1009 1010 1010 - func_for_each_insn(file, func, insn) 1011 - insn->ignore = true; 1011 + func->ignore = true; 1012 1012 } 1013 1013 } 1014 1014 ··· 1610 1612 struct reloc *reloc; 1611 1613 1612 1614 for_each_insn(file, insn) { 1615 + struct symbol *func = insn_func(insn); 1613 1616 if (insn->type != INSN_CALL) 1614 1617 continue; 1615 1618 ··· 1621 1622 1622 1623 add_call_dest(file, insn, dest, false); 1623 1624 1624 - if (insn->ignore) 1625 + if (func && func->ignore) 1625 1626 continue; 1626 1627 1627 1628 if (!insn_call_dest(insn)) { ··· 1629 1630 return -1; 1630 1631 } 1631 1632 1632 - if (insn_func(insn) && insn_call_dest(insn)->type != STT_FUNC) { 1633 + if (func && insn_call_dest(insn)->type != STT_FUNC) { 1633 1634 WARN_INSN(insn, "unsupported call to non-function"); 1634 1635 return -1; 1635 1636 } ··· 3469 3470 u8 visited; 3470 3471 int ret; 3471 3472 3473 + if (func && func->ignore) 3474 + return 0; 3475 + 3472 3476 sec = insn->sec; 3473 3477 3474 3478 while (1) { ··· 3717 3715 struct instruction *insn, 3718 3716 struct insn_state *state) 3719 3717 { 3720 - if (insn->hint && !insn->visited && !insn->ignore) { 3718 + if (insn->hint && !insn->visited) { 3721 3719 int ret = validate_branch(file, insn_func(insn), insn, *state); 3722 3720 if (ret) 3723 3721 BT_INSN(insn, "<=== (hint)"); ··· 3931 3929 3932 3930 static bool ignore_unreachable_insn(struct objtool_file *file, struct instruction *insn) 3933 3931 { 3934 - int i; 3932 + struct symbol *func = insn_func(insn); 3935 3933 struct instruction *prev_insn; 3934 + int i; 3936 3935 3937 - if (insn->ignore || insn->type == INSN_NOP || insn->type == INSN_TRAP) 3936 + if (insn->ignore || insn->type == INSN_NOP || insn->type == INSN_TRAP || (func && func->ignore)) 3938 3937 return true; 3939 3938 3940 3939 /* ··· 3954 3951 * In this case we'll find a piece of code (whole function) that is not 3955 3952 * covered by a !section symbol. Ignore them. 3956 3953 */ 3957 - if (opts.link && !insn_func(insn)) { 3954 + if (opts.link && !func) { 3958 3955 int size = find_symbol_hole_containing(insn->sec, insn->offset); 3959 3956 unsigned long end = insn->offset + size; 3960 3957 ··· 3980 3977 */ 3981 3978 if (insn->jump_dest && insn_func(insn->jump_dest) && 3982 3979 strstr(insn_func(insn->jump_dest)->name, ".cold")) { 3983 - struct instruction *dest = insn->jump_dest; 3984 - func_for_each_insn(file, insn_func(dest), dest) 3985 - dest->ignore = true; 3980 + insn_func(insn->jump_dest)->ignore = true; 3986 3981 } 3987 3982 } 3988 3983 3989 3984 return false; 3990 3985 } 3991 3986 3992 - if (!insn_func(insn)) 3987 + if (!func) 3993 3988 return false; 3994 3989 3995 - if (insn_func(insn)->static_call_tramp) 3990 + if (func->static_call_tramp) 3996 3991 return true; 3997 3992 3998 3993 /* ··· 4021 4020 4022 4021 if (insn->type == INSN_JUMP_UNCONDITIONAL) { 4023 4022 if (insn->jump_dest && 4024 - insn_func(insn->jump_dest) == insn_func(insn)) { 4023 + insn_func(insn->jump_dest) == func) { 4025 4024 insn = insn->jump_dest; 4026 4025 continue; 4027 4026 } ··· 4029 4028 break; 4030 4029 } 4031 4030 4032 - if (insn->offset + insn->len >= insn_func(insn)->offset + insn_func(insn)->len) 4031 + if (insn->offset + insn->len >= func->offset + func->len) 4033 4032 break; 4034 4033 4035 4034 insn = next_insn_same_sec(file, insn); ··· 4121 4120 return 0; 4122 4121 4123 4122 insn = find_insn(file, sec, sym->offset); 4124 - if (!insn || insn->ignore || insn->visited) 4123 + if (!insn || insn->visited) 4125 4124 return 0; 4126 4125 4127 4126 state->uaccess = sym->uaccess_safe;
+1
tools/objtool/include/objtool/elf.h
··· 68 68 u8 embedded_insn : 1; 69 69 u8 local_label : 1; 70 70 u8 frame_pointer : 1; 71 + u8 ignore : 1; 71 72 u8 warnings : 2; 72 73 struct list_head pv_target; 73 74 struct reloc *relocs;