Subject: Re: [PATCH 1/2] [RFC] debugobjects: avoid gcc-16.0.1 section mismatch

From: Thomas Gleixner <[email-masked]>
Date: Sun, 10 May 2026 21:31:59 +0200

On Tue, Feb 03 2026 at 17:23, Arnd Bergmann wrote:
> From: Arnd Bergmann <[email-masked]>
>
> gcc-16 has gained some more advanced inlining techniques that enable
> it to inline the is_static_object() function pointer into a specialized
> version of lookup_object_or_alloc:
>
> WARNING: modpost: vmlinux: section mismatch in reference: lookup_object_or_alloc.part.0+0x1ac (section: .text) -> is_static_object (section: .init.text)
>
> From what I can tell, the transformation is correct, as this
> is only called when lookup_object_or_alloc() is called from
> debug_objects_selftest(), which is also __init.

So clearly the compiler is buggy. It creates an __init specific copy of
lookup_object_or_alloc() and then fails to attribute it correctly.

> I have not come up with a good workaround, so this simply marks
> is_static_object() as not __init. Since there are currently only two
> files where this happens, that may be an easy way out.

That's a horrible hack and while it's only two files today, this sounds
like the start of a whack a mole game.

Aside of that five weeks down the road some clever AI bot creates a
patch which marks the function __init again (rightfully so).

> If anyone has a better idea for how to deal with that, let me know!

Mark the compiler broken and wait until GCC people get their act
together.

Thanks,

        tglx