blob: 1eaaa93c37bff4cf5d17888732c74983b58a0dc6 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Masahiro Yamada62d0fd52020-04-22 01:13:55 +09002#ifndef _LINUX_VERMAGIC_H
3#define _LINUX_VERMAGIC_H
Leon Romanovsky51161bf2020-04-19 18:55:06 +03004
5#ifndef INCLUDE_VERMAGIC
6#error "This header can be included from kernel/module.c or *.mod.c only"
7#endif
8
Sam Ravnborg273b2812009-10-18 00:52:28 +02009#include <generated/utsrelease.h>
Masahiro Yamada62d0fd52020-04-22 01:13:55 +090010#include <asm/vermagic.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070011
12/* Simply sanity version stamp for modules. */
13#ifdef CONFIG_SMP
14#define MODULE_VERMAGIC_SMP "SMP "
15#else
16#define MODULE_VERMAGIC_SMP ""
17#endif
18#ifdef CONFIG_PREEMPT
19#define MODULE_VERMAGIC_PREEMPT "preempt "
Thomas Gleixner4b950bb2019-07-28 20:27:41 +020020#elif defined(CONFIG_PREEMPT_RT)
21#define MODULE_VERMAGIC_PREEMPT "preempt_rt "
Linus Torvalds1da177e2005-04-16 15:20:36 -070022#else
23#define MODULE_VERMAGIC_PREEMPT ""
24#endif
Paolo 'Blaisorblade' Giarrusso5ac90c92006-04-10 22:54:28 -070025#ifdef CONFIG_MODULE_UNLOAD
26#define MODULE_VERMAGIC_MODULE_UNLOAD "mod_unload "
27#else
28#define MODULE_VERMAGIC_MODULE_UNLOAD ""
29#endif
Rusty Russell6c2545e2008-05-09 16:23:17 +100030#ifdef CONFIG_MODVERSIONS
31#define MODULE_VERMAGIC_MODVERSIONS "modversions "
32#else
33#define MODULE_VERMAGIC_MODVERSIONS ""
34#endif
Kees Cook313dd1b62017-05-05 23:37:45 -070035#ifdef RANDSTRUCT_PLUGIN
36#include <generated/randomize_layout_hash.h>
37#define MODULE_RANDSTRUCT_PLUGIN "RANDSTRUCT_PLUGIN_" RANDSTRUCT_HASHED_SEED
38#else
39#define MODULE_RANDSTRUCT_PLUGIN
40#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070041
42#define VERMAGIC_STRING \
43 UTS_RELEASE " " \
44 MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT \
Rusty Russell6c2545e2008-05-09 16:23:17 +100045 MODULE_VERMAGIC_MODULE_UNLOAD MODULE_VERMAGIC_MODVERSIONS \
Kees Cook313dd1b62017-05-05 23:37:45 -070046 MODULE_ARCH_VERMAGIC \
Greg Kroah-Hartman5132ede2018-01-24 15:28:17 +010047 MODULE_RANDSTRUCT_PLUGIN
Andi Kleen1bb49962006-09-26 10:52:37 +020048
Masahiro Yamada62d0fd52020-04-22 01:13:55 +090049#endif /* _LINUX_VERMAGIC_H */