From nobody Wed Apr 1 09:43:11 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C4BF33FA5EF; Tue, 31 Mar 2026 14:29:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774967340; cv=none; b=O1Ayd0vegpKoWvN7EQzagDn1Hbpk8vQrdBz0frGNd3T48iicoeu7+TXlLs+xTaBJpQ42LuhAfvufe7mp0hd0d8MUTfLTN471TkZMc03n/mu0OHAQ9pS37Ip/+q2cmTH+rvKv4NxPyx7PGSvtVY7+PNnIsCH1KVEL9jdaagbXVnY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774967340; c=relaxed/simple; bh=2yQOb7vXgd3AaOLg1sYumziLqEVfCbZt3yh4VVFSmHI=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=ZJ+l5Y/vVl2wXYUhUrlPZWSuCcLwAwygs5kDQVgx4x1wZtoZ+3JobXjgzxiEtQoSxJmH2vzU805N2GMwrMRmA1h5u2z02Wm2ng8Q1RecFst2QFaEnRS7LiD29S8y1UZnmjZkKRK9racYTMFXBVLIdjJwoEifB4NZdUx4VUZy17A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GtmjcEh3; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GtmjcEh3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3605C19424; Tue, 31 Mar 2026 14:28:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774967340; bh=2yQOb7vXgd3AaOLg1sYumziLqEVfCbZt3yh4VVFSmHI=; h=From:To:Cc:Subject:Date:From; b=GtmjcEh3ImxrSNW/veNQFQZyunMSJNtwpKa+dp5ZPqZE7/N2ClO+xaj4oj4BPESm8 LY5yLnd3JU/oXzXtydrdje5wyiTckw5leOKMt014ojp6og3sBY8y4Za7UxgTtfdq56 WJfMlKrJFpKtKw9hDeByoX6G9fivuNsxE4AcrsJSBVzuWVSzUKHOoCNhyhj7DXQDcz i5J54WPpfDZ9MTN3kC6H3yUM9q81oqxCOq++5uDuKfJGdef7Ixz3vSQoaSHKtFGq4J qQ+uzEqe27IF2oZAQAt5kTfrLtm/klpAfTJjcOk2/CDeFRaWSTSluwy/ipYAFDqAwI K44IL9NwRSIQQ== From: Arnd Bergmann To: Andrew Morton Cc: Nathan Chancellor , Nicolas Schier , linux-kbuild@vger.kernel.org, Andy Shevchenko , Dmitry Torokhov , Arnd Bergmann , Kees Cook , Marco Elver , Petr Mladek , "Peter Zijlstra (Intel)" , Josh Poimboeuf , linux-kernel@vger.kernel.org Subject: [PATCH] init.h: discard exitcall symbols early Date: Tue, 31 Mar 2026 16:28:38 +0200 Message-Id: <20260331142846.3187706-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.5 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann 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. 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 --- 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") =20 /* * modpost check for section mismatches during the kernel build. --=20 2.39.5