]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit - include/asm-generic/Kbuild
arch: split MODULE_ARCH_VERMAGIC definitions out to <asm/vermagic.h>
authorMasahiro Yamada <masahiroy@kernel.org>
Tue, 21 Apr 2020 16:13:55 +0000 (01:13 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Thu, 23 Apr 2020 01:50:26 +0000 (10:50 +0900)
commit62d0fd591db1f9dcf68fb963b3a94af085a6b166
tree0e9d37a3d85d5528e9bcd5cfee97fd751994ce60
parent3d4b2238684ac919394eba7fb51bb7eeeec6ab57
arch: split MODULE_ARCH_VERMAGIC definitions out to <asm/vermagic.h>

As the bug report [1] pointed out, <linux/vermagic.h> must be included
after <linux/module.h>.

I believe we should not impose any include order restriction. We often
sort include directives alphabetically, but it is just coding style
convention. Technically, we can include header files in any order by
making every header self-contained.

Currently, arch-specific MODULE_ARCH_VERMAGIC is defined in
<asm/module.h>, which is not included from <linux/vermagic.h>.

Hence, the straight-forward fix-up would be as follows:

|--- a/include/linux/vermagic.h
|+++ b/include/linux/vermagic.h
|@@ -1,5 +1,6 @@
| /* SPDX-License-Identifier: GPL-2.0 */
| #include <generated/utsrelease.h>
|+#include <linux/module.h>
|
| /* Simply sanity version stamp for modules. */
| #ifdef CONFIG_SMP

This works enough, but for further cleanups, I split MODULE_ARCH_VERMAGIC
definitions into <asm/vermagic.h>.

With this, <linux/module.h> and <linux/vermagic.h> will be orthogonal,
and the location of MODULE_ARCH_VERMAGIC definitions will be consistent.

For arc and ia64, MODULE_PROC_FAMILY is only used for defining
MODULE_ARCH_VERMAGIC. I squashed it.

For hexagon, nds32, and xtensa, I removed <asm/modules.h> entirely
because they contained nothing but MODULE_ARCH_VERMAGIC definition.
Kbuild will automatically generate <asm/modules.h> at build-time,
wrapping <asm-generic/module.h>.

[1] https://lore.kernel.org/lkml/20200411155623.GA22175@zn.tnic

Reported-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Jessica Yu <jeyu@kernel.org>
27 files changed:
arch/arc/include/asm/module.h
arch/arc/include/asm/vermagic.h [new file with mode: 0644]
arch/arm/include/asm/module.h
arch/arm/include/asm/vermagic.h [new file with mode: 0644]
arch/arm64/include/asm/module.h
arch/arm64/include/asm/vermagic.h [new file with mode: 0644]
arch/hexagon/include/asm/module.h [deleted file]
arch/hexagon/include/asm/vermagic.h [new file with mode: 0644]
arch/ia64/include/asm/module.h
arch/ia64/include/asm/vermagic.h [new file with mode: 0644]
arch/mips/include/asm/module.h
arch/mips/include/asm/vermagic.h [new file with mode: 0644]
arch/nds32/include/asm/module.h [deleted file]
arch/nds32/include/asm/vermagic.h [new file with mode: 0644]
arch/powerpc/include/asm/module.h
arch/powerpc/include/asm/vermagic.h [new file with mode: 0644]
arch/riscv/include/asm/module.h
arch/riscv/include/asm/vermagic.h [new file with mode: 0644]
arch/sh/include/asm/module.h
arch/sh/include/asm/vermagic.h [new file with mode: 0644]
arch/x86/include/asm/module.h
arch/x86/include/asm/vermagic.h [new file with mode: 0644]
arch/xtensa/include/asm/module.h [deleted file]
arch/xtensa/include/asm/vermagic.h [new file with mode: 0644]
include/asm-generic/Kbuild
include/asm-generic/vermagic.h [new file with mode: 0644]
include/linux/vermagic.h