Re: objtool failure caused some kernel functionality not working
From: Josh Poimboeuf
Date: Thu Jan 30 2025 - 03:25:42 EST
On Wed, Jan 29, 2025 at 11:10:14PM -0800, Yonghong Song wrote:
> The llvm18 does not have issues. I tried to bisect what changed in llvm19 and
> found the following llvm patch is responsible:
>
> https://github.com/llvm/llvm-project/pull/96089
>
> Basically, the compiler might be able to create a jump target which actually
> not possible at runtime. For example, in one of examples in the above llvm patch, something
> like
> if i >= 3 goto out; /* i unsigned */
> switch i, label default_unreachable:
> case 0: goto label1;
> case 1: goto label2;
> case 2: goto label3;
> label1: ...; return;
> label2: ...; return;
> label3: ...; return;
> default_unreachable:
>
> I think that this should be a valid code from compiler perspective.
>
> Can we fix objtool to handle jump target which is immediately after the func body?Thanks, Yonghong
I actually have a fix for that, can you try this?
https://git.kernel.org/pub/scm/linux/kernel/git/jpoimboe/linux.git/commit/?h=objtool/core&id=fbb454b7bb39955c324693e73a5cf7e448632553
--
Josh