History

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.

Thomas Weißschuh committed 2 years ago

Commit fdf94e41 parent cd615d73 files · +30 −25Browse files

Showing the changes to scripts/module-common.c (1 of 3 files). Show all

Unified · Split

scripts/module-common.c+25−0
@@ -0,0 +1,25 @@
1+// SPDX-License-Identifier: GPL-2.0
2+
3+#include <linux/module.h>
4+/*
5+ * Include build-salt.h after module.h in order to
6+ * inherit the definitions.
7+ */
8+#define INCLUDE_VERMAGIC
9+#include <linux/build-salt.h>
10+#include <linux/elfnote-lto.h>
11+#include <linux/vermagic.h>
12+
13+#ifdef CONFIG_UNWINDER_ORC
14+#include <asm/orc_header.h>
15+ORC_HEADER;
16+#endif
17+
18+BUILD_SALT;
19+BUILD_LTO_INFO;
20+
21+MODULE_INFO(vermagic, VERMAGIC_STRING);
22+
23+#ifdef CONFIG_MITIGATION_RETPOLINE
24+MODULE_INFO(retpoline, "Y");
25+#endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t