From: Petr Mladek <pmladek@suse.com>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Nathan Chancellor <nathan@kernel.org>,
Nicolas Schier <nsc@kernel.org>,
linux-kbuild@vger.kernel.org,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Arnd Bergmann <arnd@arndb.de>, Kees Cook <kees@kernel.org>,
Marco Elver <elver@google.com>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
Josh Poimboeuf <jpoimboe@kernel.org>,
Luis Chamberlain <mcgrof@kernel.org>,
Petr Pavlu <petr.pavlu@suse.com>,
Daniel Gomez <da.gomez@kernel.org>,
Sami Tolvanen <samitolvanen@google.com>,
Aaron Tomlin <atomlin@atomlin.com>,
linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] init.h: discard exitcall symbols early
Date: Tue, 31 Mar 2026 16:56:04 +0200 [thread overview]
Message-ID: <acvghO4glmZamFSZ@pathway.suse.cz> (raw)
In-Reply-To: <20260331142846.3187706-1-arnd@kernel.org>
Adding module loader maintainers into Cc to make them aware of this
change.
On Tue 2026-03-31 16:28:38, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> Any __exitcall() and built-in module_exit() handler is marked as __used,
> which leads to the code being included in the object file and later
> discarded at link time.
Is this safe for dynamically loaded modules?
Honestly, I am not sure what is the exact efect of this change.
The dynamically loadded modules just came to my mind...
Best Regards,
Petr
> As far as I can tell, this was originally added at the same time
> as initcalls were marked the same way, to prevent them from getting
> dropped with gcc-3.4, but it was never actaully necessary to keep exit
> functions around.
>
> Mark them as __maybe_unused instead, which lets the compiler treat
> the exitcalls as entirely unused, and make better decisions about
> dropping specializing static functions called from these.
>
> Link: https://lore.kernel.org/all/acruxMNdnUlyRHiy@google.com/
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> include/linux/init.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/init.h b/include/linux/init.h
> index 5db55c660124..ad5c19763034 100644
> --- a/include/linux/init.h
> +++ b/include/linux/init.h
> @@ -47,7 +47,7 @@
> #define __initdata __section(".init.data")
> #define __initconst __section(".init.rodata")
> #define __exitdata __section(".exit.data")
> -#define __exit_call __used __section(".exitcall.exit")
> +#define __exit_call __maybe_unused __section(".exitcall.exit")
>
> /*
> * modpost check for section mismatches during the kernel build.
> --
> 2.39.5
next prev parent reply other threads:[~2026-03-31 14:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-31 14:28 [PATCH] init.h: discard exitcall symbols early Arnd Bergmann
2026-03-31 14:56 ` Petr Mladek [this message]
2026-03-31 15:01 ` Arnd Bergmann
2026-03-31 15:35 ` Petr Mladek
2026-04-07 19:47 ` Nicolas Schier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=acvghO4glmZamFSZ@pathway.suse.cz \
--to=pmladek@suse.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=atomlin@atomlin.com \
--cc=da.gomez@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=elver@google.com \
--cc=jpoimboe@kernel.org \
--cc=kees@kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=nathan@kernel.org \
--cc=nsc@kernel.org \
--cc=peterz@infradead.org \
--cc=petr.pavlu@suse.com \
--cc=samitolvanen@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.