* Re: [PATCH] serial: 8250: Fix section mismatch with CONFIG_MODULES=n
[not found] <20260926163506.487201-1-danishkhateeb03@gmail.com>
@ 2026-09-26 17:40 ` Uwe Kleine-König
2026-09-27 14:00 ` Danish Khateeb
0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König @ 2026-09-26 17:40 UTC (permalink / raw)
To: Danish Khateeb
Cc: gregkh, jirislaby, andriy.shevchenko, linux-serial, linux-kernel,
linux-kbuild
[-- Attachment #1: Type: text/plain, Size: 884 bytes --]
Hello Danish,
On Sat, Sep 26, 2026 at 11:35:06AM -0500, Danish Khateeb wrote:
> Without CONFIG_MODULES, __init_or_module means __init, so
> serial8250_pnp_exit() and serial8250_hub6_exit() end up in .init.text.
> They are also called from serial8250_exit(), which is __exit, and
> modpost warns:
>
> WARNING: modpost: vmlinux: section mismatch in reference: serial8250_exit+0x2a (section: .exit.text) -> serial8250_pnp_exit (section: .init.text)
Isn't that a false positive because with CONFIG_MODULES=n .exit is
discarded and so the section mismatch doesn't matter?
> The exit code never runs in such a kernel, so nothing breaks at runtime.
Ah, you found that, too.
> But a function that is called from both __init and __exit code can't
> carry either annotation, so drop it.
I thought __init_or_module was the right annotation ...
Best regards
Uwe
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] serial: 8250: Fix section mismatch with CONFIG_MODULES=n
2026-09-26 17:40 ` [PATCH] serial: 8250: Fix section mismatch with CONFIG_MODULES=n Uwe Kleine-König
@ 2026-09-27 14:00 ` Danish Khateeb
0 siblings, 0 replies; 2+ messages in thread
From: Danish Khateeb @ 2026-09-27 14:00 UTC (permalink / raw)
To: u.kleine-koenig
Cc: Danish Khateeb, gregkh, jirislaby, andriy.shevchenko,
linux-serial, linux-kernel, linux-kbuild
Hello Uwe,
On Sat, Sep 26, 2026 at 07:40:03PM +0200, Uwe Kleine-König wrote:
> Isn't that a false positive because with CONFIG_MODULES=n .exit is
> discarded and so the section mismatch doesn't matter?
Yes, it's harmless at runtime, but modpost still warns on every
CONFIG_MODULES=n build with SERIAL_8250_PNP (e.g. kunit.py --alltests),
and the build fails with CONFIG_SECTION_MISMATCH_WARN_ONLY=n.
> I thought __init_or_module was the right annotation ...
It is, modpost just doesn't know that. Without it the two helpers stay in
memory after boot, 16 bytes each on x86_64. The alternative is teaching
modpost to skip exit -> init references in vmlinux when CONFIG_MODULES=n.
Thanks
Danish
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-27 14:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260926163506.487201-1-danishkhateeb03@gmail.com>
2026-09-26 17:40 ` [PATCH] serial: 8250: Fix section mismatch with CONFIG_MODULES=n Uwe Kleine-König
2026-09-27 14:00 ` Danish Khateeb
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox