1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #ifndef __ASM_GENERIC_EXPORT_H
3 #define __ASM_GENERIC_EXPORT_H
8 #ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
10 #elif defined(CONFIG_64BIT)
19 .macro __put, val, name
20 #ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
21 .long \val - ., \name - ., 0
22 #elif defined(CONFIG_64BIT)
30 * note on .section use: @progbits vs %progbits nastiness doesn't matter,
31 * since we immediately emit into those sections anyway.
33 .macro ___EXPORT_SYMBOL name,val,sec
35 .section ___ksymtab\sec+\name,"a"
38 __put \val, __kstrtab_\name
40 .section __ksymtab_strings,"a"
44 #ifdef CONFIG_MODVERSIONS
45 .section ___kcrctab\sec+\name,"a"
47 #if defined(CONFIG_MODULE_REL_CRCS)
58 #if defined(CONFIG_TRIM_UNUSED_KSYMS)
60 #include <linux/kconfig.h>
61 #include <generated/autoksyms.h>
63 .macro __ksym_marker sym
64 .section ".discard.ksym","a"
69 #define __EXPORT_SYMBOL(sym, val, sec) \
71 __cond_export_sym(sym, val, sec, __is_defined(__KSYM_##sym))
72 #define __cond_export_sym(sym, val, sec, conf) \
73 ___cond_export_sym(sym, val, sec, conf)
74 #define ___cond_export_sym(sym, val, sec, enabled) \
75 __cond_export_sym_##enabled(sym, val, sec)
76 #define __cond_export_sym_1(sym, val, sec) ___EXPORT_SYMBOL sym, val, sec
77 #define __cond_export_sym_0(sym, val, sec) /* nothing */
80 #define __EXPORT_SYMBOL(sym, val, sec) ___EXPORT_SYMBOL sym, val, sec
83 #define EXPORT_SYMBOL(name) \
84 __EXPORT_SYMBOL(name, KSYM_FUNC(name),)
85 #define EXPORT_SYMBOL_GPL(name) \
86 __EXPORT_SYMBOL(name, KSYM_FUNC(name), _gpl)
87 #define EXPORT_DATA_SYMBOL(name) \
88 __EXPORT_SYMBOL(name, name,)
89 #define EXPORT_DATA_SYMBOL_GPL(name) \
90 __EXPORT_SYMBOL(name, name,_gpl)