]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
objtool: Fix "unexpected end of section" warning for alternatives
authorJosh Poimboeuf <jpoimboe@kernel.org>
Wed, 17 Sep 2025 16:03:30 +0000 (09:03 -0700)
committerJosh Poimboeuf <jpoimboe@kernel.org>
Tue, 14 Oct 2025 21:45:24 +0000 (14:45 -0700)
commit4cdee7888f42f5573b380ddfa9da43208e759bdc
tree27ab0f46e3f55c486a454912b04872ab27bd976b
parent68245893cf447cca478e6bd71c02741656053ef4
objtool: Fix "unexpected end of section" warning for alternatives

Due to the short circuiting logic in next_insn_to_validate(), control
flow may silently transition from .altinstr_replacement to .text without
a corresponding nested call to validate_branch().

As a result the validate_branch() 'sec' variable doesn't get
reinitialized, which can trigger a confusing "unexpected end of section"
warning which blames .altinstr_replacement rather than the offending
fallthrough function.

Fix that by not caching the section.  There's no point in doing that
anyway.

Acked-by: Petr Mladek <pmladek@suse.com>
Tested-by: Joe Lawrence <joe.lawrence@redhat.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
tools/objtool/check.c