Re: clang/objtool failures on linux-next
From: Nathan Chancellor
Date: Mon Mar 09 2026 - 17:19:30 EST
On Fri, Mar 06, 2026 at 05:35:20PM -0800, Josh Poimboeuf wrote:
> On Fri, Mar 06, 2026 at 11:04:50PM +0100, Arnd Bergmann wrote:
> > ==> build/x86/0x8FD83285_defconfig/log <==
> > drivers/gpu/drm/amd/amdgpu/amdgpu_cs.o: warning: objtool: amdgpu_cs_parser_bos+0x723: unreachable instruction
> > drivers/gpu/drm/xe/xe_bo.o: warning: objtool: xe_bo_create_pin_map_at_novm+0x11d: unreachable instruction
> > drivers/gpu/drm/panthor/panthor_drv.o: warning: objtool: panthor_ioctl_vm_bind+0x2df: unreachable instruction
>
> These three warnings are accurate, for each of these, Clang is leaving
> an unreachable JMP at the end of the function:
>
> 166e: 4c 89 ea mov %r13,%rdx
> 1671: e8 00 00 00 00 call 1676 <amdgpu_cs_parser_bos+0x716> 1672: R_X86_64_PLT32 __ubsan_handle_shift_out_of_bounds-0x4
> 1676: 49 8b 94 24 08 1d 01 00 mov 0x11d08(%r12),%rdx
> 167e: e9 c6 fd ff ff jmp 1449 <amdgpu_cs_parser_bos+0x4e9>
> 1683: e9 8c f9 ff ff jmp 1014 <amdgpu_cs_parser_bos+0xb4>
> 1688: 0f 1f 84 00 00 00 00 00 nopl 0x0(%rax,%rax,1)
>
> Nathan, any idea? I haven't seen this pattern before.
This seems pretty similar to
https://github.com/ClangBuiltLinux/linux/issues/2130
https://github.com/llvm/llvm-project/issues/167774
as they all use drm_exec_until_all_locked(). Justin fixed this in main
(23.0.0) and it was backported to 22.1.0:
https://github.com/llvm/llvm-project/commit/404920838836a022b0ae4b9a462befba89ee0cdc
https://github.com/llvm/llvm-project/commit/2fb8921a7c70b264f670569ac319d1c96e9f5acc
I don't think Arnd has that fix based on the .comment section:
Debian clang version 22.0.0 (++20251025104945+e219cf60598c-1~exp1~20251025225011.1789)
I don't see a configuration file for these so I cannot verify that they
are actually fixed with a newer version of clang.
Unfortunately, the problematic change landed in the 21.1.0 release so
that version will still see these warnings. I am guessing it is probably
not too easy to workaround this in objtool though, so maybe we will just
have to live with them?
Cheers,
Nathan