diff options
author | Thomas Weißschuh <linux@weissschuh.net> | 2024-09-01 19:55:21 +0200 |
---|---|---|
committer | Masahiro Yamada <masahiroy@kernel.org> | 2024-09-07 17:24:08 +0900 |
commit | fdf94e4403ece60b29ef9e2da95e2fcefe50817f (patch) | |
tree | e3f2d66b1af83d665ee838b3fc045cd7d01eb6cd /scripts/module-common.c | |
parent | cd615d7fcc7958107d1506c6eb5be50f4e920312 (diff) |
kbuild: compile constant module information only once
Various information about modules is compiled into the info sections.
For that a dedicated .mod.c file is generated by modpost for each module
and then linked into the module.
However most of the information in the .mod.c is the same for all
modules, internal and external.
Split the shared information into a dedicated source file that is
compiled once and then linked into all modules.
This avoids frequent rebuilds for all .mod.c files when using
CONFIG_LOCALVERSION_AUTO because the local version ends up in .mod.c
through UTS_RELEASE and VERMAGIC_STRING.
The modules are still relinked in this case.
The code is also easier to maintain as it's now in a proper source file
instead of an inline string literal.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Diffstat (limited to 'scripts/module-common.c')
-rw-r--r-- | scripts/module-common.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/module-common.c b/scripts/module-common.c new file mode 100644 index 000000000000..12fbc6d3aae8 --- /dev/null +++ b/scripts/module-common.c @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include <linux/module.h> +/* + * Include build-salt.h after module.h in order to + * inherit the definitions. + */ +#define INCLUDE_VERMAGIC +#include <linux/build-salt.h> +#include <linux/elfnote-lto.h> +#include <linux/vermagic.h> + +#ifdef CONFIG_UNWINDER_ORC +#include <asm/orc_header.h> +ORC_HEADER; +#endif + +BUILD_SALT; +BUILD_LTO_INFO; + +MODULE_INFO(vermagic, VERMAGIC_STRING); + +#ifdef CONFIG_MITIGATION_RETPOLINE +MODULE_INFO(retpoline, "Y"); +#endif |