diff options
| author | Alexandre Chartre <alexandre.chartre@oracle.com> | 2025-11-21 10:53:27 +0100 |
|---|---|---|
| committer | Peter Zijlstra <peterz@infradead.org> | 2025-11-21 15:30:12 +0100 |
| commit | 5f326c88973691232c0e56ced83c199d53d86766 (patch) | |
| tree | a2d8f50bad1c11aeaa6eb876f664f583889f41d7 /tools/objtool/check.c | |
| parent | c3b7d044fc5ac99a31ce9420431b90e21ed55503 (diff) | |
objtool: Add the --disas=<function-pattern> action
Add the --disas=<function-pattern> actions to disassemble the specified
functions. The function pattern can be a single function name (e.g.
--disas foo to disassemble the function with the name "foo"), or a shell
wildcard pattern (e.g. --disas foo* to disassemble all functions with a
name starting with "foo").
Signed-off-by: Alexandre Chartre <alexandre.chartre@oracle.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
Link: https://patch.msgid.link/20251121095340.464045-18-alexandre.chartre@oracle.com
Diffstat (limited to 'tools/objtool/check.c')
| -rw-r--r-- | tools/objtool/check.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 4ebadf94f8af..9cd9f9d4f656 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -2611,7 +2611,7 @@ static int decode_sections(struct objtool_file *file) * Must be before add_jump_destinations(), which depends on 'func' * being set for alternatives, to enable proper sibling call detection. */ - if (validate_branch_enabled() || opts.noinstr || opts.hack_jump_label) { + if (validate_branch_enabled() || opts.noinstr || opts.hack_jump_label || opts.disas) { if (add_special_section_alts(file)) return -1; } @@ -4915,14 +4915,15 @@ int check(struct objtool_file *file) int ret = 0, warnings = 0; /* - * If the verbose or backtrace option is used then we need a - * disassembly context to disassemble instruction or function - * on warning or backtrace. + * Create a disassembly context if we might disassemble any + * instruction or function. */ - if (opts.verbose || opts.backtrace || opts.trace) { + if (opts.verbose || opts.backtrace || opts.trace || opts.disas) { disas_ctx = disas_context_create(file); - if (!disas_ctx) + if (!disas_ctx) { + opts.disas = false; opts.trace = false; + } objtool_disas_ctx = disas_ctx; } @@ -5054,20 +5055,20 @@ int check(struct objtool_file *file) } out: - if (!ret && !warnings) { - free_insns(file); - return 0; - } - - if (opts.werror && warnings) - ret = 1; - - if (opts.verbose) { + if (ret || warnings) { if (opts.werror && warnings) - WARN("%d warning(s) upgraded to errors", warnings); - disas_warned_funcs(disas_ctx); + ret = 1; + + if (opts.verbose) { + if (opts.werror && warnings) + WARN("%d warning(s) upgraded to errors", warnings); + disas_warned_funcs(disas_ctx); + } } + if (opts.disas) + disas_funcs(disas_ctx); + if (disas_ctx) { disas_context_destroy(disas_ctx); objtool_disas_ctx = NULL; @@ -5075,6 +5076,9 @@ out: free_insns(file); + if (!ret && !warnings) + return 0; + if (opts.backup && make_backup()) return 1; |