From: Zheng Zengkai zhengzengkai@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I8LQBH
-----------------------
Add CONFIG_KABI_RESERVE to control KABI padding reserve or not, for some embedded system, KABI padding reserve may be not necessary.
By the way, adjust unsigned long to u64 to unify basic reserve length for both 32bit and 64bit architectures.
Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com Reviewed-by: Xie XiuQi xiexiuqi@huawei.com Signed-off-by: Jialin Zhang zhangjialin11@huawei.com --- include/linux/kabi.h | 10 +++++++++- init/Kconfig | 8 ++++++++ 2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/include/linux/kabi.h b/include/linux/kabi.h index 0f25a84809c3..c3f1cf96b07a 100644 --- a/include/linux/kabi.h +++ b/include/linux/kabi.h @@ -396,6 +396,7 @@ # define _KABI_DEPRECATE(_type, _orig) _type kabi_reserved_##_orig # define _KABI_DEPRECATE_FN(_type, _orig, _args...) \ _type (* kabi_reserved_##_orig)(_args) +#ifdef CONFIG_KABI_RESERVE # define _KABI_REPLACE(_orig, _new) \ union { \ _new; \ @@ -404,6 +405,9 @@ } __UNIQUE_ID(kabi_hide); \ __KABI_CHECK_SIZE_ALIGN(_orig, _new); \ } +#else +# define _KABI_REPLACE(_orig, _new) KABI_BROKEN_REPLACE(_orig, _new) +#endif
# define _KABI_EXCLUDE(_elem) _elem
@@ -425,7 +429,11 @@ * leverage those common names making it easier to read and find in the * code. */ -# define _KABI_RESERVE(n) unsigned long kabi_reserved##n +#ifdef CONFIG_KABI_RESERVE +# define _KABI_RESERVE(n) u64 kabi_reserved##n +#else +# define _KABI_RESERVE(n) +#endif # define KABI_RESERVE(n) _KABI_RESERVE(n); /* * Simple wrappers to replace standard openEuler reserved elements. diff --git a/init/Kconfig b/init/Kconfig index 81ff8d28ec28..c94c82cc539f 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1920,6 +1920,14 @@ config BINDGEN_VERSION_TEXT config TRACEPOINTS bool
+config KABI_RESERVE + bool "Enable KABI PADDING RESERVE" + default y + help + This option enables KABI padding reserve. + For some embedded system, KABI padding reserve may be not necessary. + Disable it on demand. + config KABI_SIZE_ALIGN_CHECKS bool "Enables more stringent kabi checks in the macros" default y