122823ab4SAl Viro #ifndef __ASM_GENERIC_EXPORT_H 222823ab4SAl Viro #define __ASM_GENERIC_EXPORT_H 322823ab4SAl Viro 422823ab4SAl Viro #ifndef KSYM_FUNC 522823ab4SAl Viro #define KSYM_FUNC(x) x 622823ab4SAl Viro #endif 722823ab4SAl Viro #ifdef CONFIG_64BIT 822823ab4SAl Viro #define __put .quad 922823ab4SAl Viro #ifndef KSYM_ALIGN 1022823ab4SAl Viro #define KSYM_ALIGN 8 1122823ab4SAl Viro #endif 1222823ab4SAl Viro #else 1322823ab4SAl Viro #define __put .long 1422823ab4SAl Viro #ifndef KSYM_ALIGN 1522823ab4SAl Viro #define KSYM_ALIGN 4 1622823ab4SAl Viro #endif 17*71810db2SArd Biesheuvel #endif 1822823ab4SAl Viro #ifndef KCRC_ALIGN 1922823ab4SAl Viro #define KCRC_ALIGN 4 2022823ab4SAl Viro #endif 2122823ab4SAl Viro 2222823ab4SAl Viro #ifdef CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX 2322823ab4SAl Viro #define KSYM(name) _##name 2422823ab4SAl Viro #else 2522823ab4SAl Viro #define KSYM(name) name 2622823ab4SAl Viro #endif 2722823ab4SAl Viro 2822823ab4SAl Viro /* 2922823ab4SAl Viro * note on .section use: @progbits vs %progbits nastiness doesn't matter, 3022823ab4SAl Viro * since we immediately emit into those sections anyway. 3122823ab4SAl Viro */ 3222823ab4SAl Viro .macro ___EXPORT_SYMBOL name,val,sec 3322823ab4SAl Viro #ifdef CONFIG_MODULES 3422823ab4SAl Viro .globl KSYM(__ksymtab_\name) 3522823ab4SAl Viro .section ___ksymtab\sec+\name,"a" 3622823ab4SAl Viro .balign KSYM_ALIGN 3722823ab4SAl Viro KSYM(__ksymtab_\name): 3822823ab4SAl Viro __put \val, KSYM(__kstrtab_\name) 3922823ab4SAl Viro .previous 4022823ab4SAl Viro .section __ksymtab_strings,"a" 4122823ab4SAl Viro KSYM(__kstrtab_\name): 4222823ab4SAl Viro #ifdef CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX 4322823ab4SAl Viro .asciz "_\name" 4422823ab4SAl Viro #else 4522823ab4SAl Viro .asciz "\name" 4622823ab4SAl Viro #endif 4722823ab4SAl Viro .previous 4822823ab4SAl Viro #ifdef CONFIG_MODVERSIONS 4922823ab4SAl Viro .section ___kcrctab\sec+\name,"a" 5022823ab4SAl Viro .balign KCRC_ALIGN 5122823ab4SAl Viro KSYM(__kcrctab_\name): 52*71810db2SArd Biesheuvel #if defined(CONFIG_MODULE_REL_CRCS) 53*71810db2SArd Biesheuvel .long KSYM(__crc_\name) - . 54*71810db2SArd Biesheuvel #else 55*71810db2SArd Biesheuvel .long KSYM(__crc_\name) 56*71810db2SArd Biesheuvel #endif 5722823ab4SAl Viro .weak KSYM(__crc_\name) 5822823ab4SAl Viro .previous 5922823ab4SAl Viro #endif 6022823ab4SAl Viro #endif 6122823ab4SAl Viro .endm 6222823ab4SAl Viro #undef __put 6322823ab4SAl Viro 6422823ab4SAl Viro #if defined(__KSYM_DEPS__) 6522823ab4SAl Viro 6622823ab4SAl Viro #define __EXPORT_SYMBOL(sym, val, sec) === __KSYM_##sym === 6722823ab4SAl Viro 6822823ab4SAl Viro #elif defined(CONFIG_TRIM_UNUSED_KSYMS) 6922823ab4SAl Viro 7022823ab4SAl Viro #include <linux/kconfig.h> 7122823ab4SAl Viro #include <generated/autoksyms.h> 7222823ab4SAl Viro 7322823ab4SAl Viro #define __EXPORT_SYMBOL(sym, val, sec) \ 74c0a0aba8SMasahiro Yamada __cond_export_sym(sym, val, sec, __is_defined(__KSYM_##sym)) 7522823ab4SAl Viro #define __cond_export_sym(sym, val, sec, conf) \ 7622823ab4SAl Viro ___cond_export_sym(sym, val, sec, conf) 7722823ab4SAl Viro #define ___cond_export_sym(sym, val, sec, enabled) \ 7822823ab4SAl Viro __cond_export_sym_##enabled(sym, val, sec) 7922823ab4SAl Viro #define __cond_export_sym_1(sym, val, sec) ___EXPORT_SYMBOL sym, val, sec 8022823ab4SAl Viro #define __cond_export_sym_0(sym, val, sec) /* nothing */ 8122823ab4SAl Viro 8222823ab4SAl Viro #else 8322823ab4SAl Viro #define __EXPORT_SYMBOL(sym, val, sec) ___EXPORT_SYMBOL sym, val, sec 8422823ab4SAl Viro #endif 8522823ab4SAl Viro 8622823ab4SAl Viro #define EXPORT_SYMBOL(name) \ 8722823ab4SAl Viro __EXPORT_SYMBOL(name, KSYM_FUNC(KSYM(name)),) 8822823ab4SAl Viro #define EXPORT_SYMBOL_GPL(name) \ 8922823ab4SAl Viro __EXPORT_SYMBOL(name, KSYM_FUNC(KSYM(name)), _gpl) 9022823ab4SAl Viro #define EXPORT_DATA_SYMBOL(name) \ 9122823ab4SAl Viro __EXPORT_SYMBOL(name, KSYM(name),) 9222823ab4SAl Viro #define EXPORT_DATA_SYMBOL_GPL(name) \ 9322823ab4SAl Viro __EXPORT_SYMBOL(name, KSYM(name),_gpl) 9422823ab4SAl Viro 9522823ab4SAl Viro #endif 96