Re: [tip: objtool/core] objtool: Add CONFIG_OBJTOOL_WERROR
From: Josh Poimboeuf
Date: Mon Mar 17 2025 - 20:05:55 EST
On Mon, Mar 17, 2025 at 10:27:12PM +0100, Ingo Molnar wrote:
> > +config OBJTOOL_WERROR
> > + bool "Upgrade objtool warnings to errors"
> > + depends on OBJTOOL && !COMPILE_TEST
> > + help
> > + Fail the build on objtool warnings.
> > +
> > + Objtool warnings can indicate kernel instability, including boot
> > + failures. This option is highly recommended.
> > +
> > + If unsure, say Y.
>
> My randconfig build tests found this failure of 36 warnings upgraded to
> a build failure:
>
> vmlinux.o: error: objtool: 36 warning(s) upgraded to errors
Hm, I'm actually surprised randconfig doesn't set COMPILE_TEST.
Anyway, the warnings are valid:
vmlinux.o: error: objtool: do_syscall_64+0x40: call to ftrace_likely_update() leaves .noinstr.text section
vmlinux.o: error: objtool: do_int80_emulation+0x30: call to ftrace_likely_update() leaves .noinstr.text section
vmlinux.o: error: objtool: do_fast_syscall_32+0x7b: call to ftrace_likely_update() leaves .noinstr.text section
...
Those are triggered by CONFIG_TRACE_BRANCH_PROFILING which adds a
function call to ftrace_likely_update() for every likely() / unlikely().
Which obliterates the noinstr rules.
Steven, do you still want to keep that config option?
If so, I suppose we could make OBJTOOL_WERROR depend on
!TRACE_BRANCH_PROFILING.
--
Josh