Re: [RFC PATCH v2 11/17] objtool: Add option to trace function validation

From: Josh Poimboeuf

Date: Tue Sep 23 2025 - 18:25:31 EST


On Thu, Jun 19, 2025 at 04:56:53PM +0200, Alexandre Chartre wrote:
> @@ -3796,6 +3843,8 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,
> if (file->ignore_unreachables)
> return 0;
>
> + TRACE_INSN(insn, "falls through to next function");
> +
> WARN("%s() falls through to next function %s()",
> func->name, insn_func(insn)->name);

Why duplicate the warning?

> func->warned = 1;
> @@ -3805,10 +3854,15 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,
>
> ret = validate_insn(file, func, insn, &state, prev_insn, next_insn,
> &dead_end);
> - if (dead_end)
> - break;
>
> - if (!next_insn) {
> + if (!insn->trace) {
> + if (ret)
> + TRACE_INSN(insn, "warning (%d)", ret);
> + else
> + TRACE_INSN(insn, NULL);
> + }

What does "TRACE_INSN(insn, NULL)" do?

> @@ -4237,9 +4304,19 @@ static int validate_symbol(struct objtool_file *file, struct section *sec,
> if (opts.uaccess)
> state->uaccess = sym->uaccess_safe;
>
> + if (opts.trace && !fnmatch(opts.trace, sym->name, 0)) {
> + trace_enable();
> + TRACE("%s: validation begin\n", sym->name);
> + }
> +
> ret = validate_branch(file, insn_func(insn), insn, *state);
> if (ret)
> BT_INSN(insn, "<=== (sym)");
> +
> + TRACE("%s: validation %s\n\n", sym->name, ret ? "failed" : "end");
> + trace_disable();
> +
> +
> return ret;

extra newline

--
Josh