objtool: Re-arrange validate_functions()

In preparation to adding a vmlinux.o specific pass, rearrange some
code. No functional changes intended.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Miroslav Benes <mbenes@suse.cz>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lkml.kernel.org/r/20200324160924.924304616@infradead.org
This commit is contained in:
Peter Zijlstra 2020-03-23 20:57:13 +01:00
parent 74b873e49d
commit 350994bf95
1 changed files with 33 additions and 25 deletions

View File

@ -2395,9 +2395,8 @@ static bool ignore_unreachable_insn(struct instruction *insn)
return false;
}
static int validate_functions(struct objtool_file *file)
static int validate_section(struct objtool_file *file, struct section *sec)
{
struct section *sec;
struct symbol *func;
struct instruction *insn;
struct insn_state state;
@ -2410,7 +2409,6 @@ static int validate_functions(struct objtool_file *file)
CFI_NUM_REGS * sizeof(struct cfi_reg));
state.stack_size = initial_func_cfi.cfa.offset;
for_each_sec(file, sec) {
list_for_each_entry(func, &sec->symbol_list, list) {
if (func->type != STT_FUNC)
continue;
@ -2435,7 +2433,17 @@ static int validate_functions(struct objtool_file *file)
BT_FUNC("<=== (func)", insn);
warnings += ret;
}
}
return warnings;
}
static int validate_functions(struct objtool_file *file)
{
struct section *sec;
int warnings = 0;
for_each_sec(file, sec)
warnings += validate_section(file, sec);
return warnings;
}