On Thu, Dec 04, 2025 at 11:49:05AM +0100, Michal Jires wrote:
> I now did build+link the kernel with allyesconfig and
> -flto=partition=balanced (which is better for finding bugs).
> 
> There are two issues interesting for GCC:
> 
> 1) Do we give any guarantee in which section is toplevel assembly
> emitted? "__static_call_return" causes modpost error when it is not
> emitted into ".text*" but in ".rodata*". Even without LTO this happens
> when the preceding (noreorder) symbol is a string constant.

If the toplevel inline asm cares about the exact section, it should
.pushsection to it and .popsection afterwards.

> 2) Do we want to allow defining symbols inside functions?
> It seems to be a weird single use case, where it would be better to just
> recommend to make it global if they really want to keep this.

I think so.  We've been allowing that since forever before and before
toplevel asm was allowed to be extended asm in GCC 15, it was the only
way to get something with say immediate constants from the compiler.
So, the only thing that changed in GCC 15 for those is that now one can use
the new constraint letters to tell the compiler about the symbols it defines
or symbols it uses.

> extern void int3_selftest_ip(void);
> /* Must be noinline to ensure uniqueness of int3_selftest_ip. */
> static noinline void __init int3_selftest(void)
> {
>       /* ... */
>       asm volatile ("int3_selftest_ip:\n\t" /*..*/);
>       /* ... */
> }

        Jakub

Reply via email to