Linux Audio

Check our new training course

Loading...
v5.4
 1#ifndef __ASM_GENERIC_EXPORT_H
 2#define __ASM_GENERIC_EXPORT_H
 3
 4#ifndef KSYM_FUNC
 5#define KSYM_FUNC(x) x
 6#endif
 7#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
 8#define KSYM_ALIGN 4
 9#elif defined(CONFIG_64BIT)
10#define KSYM_ALIGN 8
 
11#else
 
 
12#define KSYM_ALIGN 4
13#endif
 
14#ifndef KCRC_ALIGN
15#define KCRC_ALIGN 4
16#endif
17
18.macro __put, val, name
19#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
20	.long	\val - ., \name - ., 0
21#elif defined(CONFIG_64BIT)
22	.quad	\val, \name, 0
23#else
24	.long	\val, \name, 0
25#endif
26.endm
27
28/*
29 * note on .section use: @progbits vs %progbits nastiness doesn't matter,
30 * since we immediately emit into those sections anyway.
31 */
32.macro ___EXPORT_SYMBOL name,val,sec
33#ifdef CONFIG_MODULES
34	.globl __ksymtab_\name
35	.section ___ksymtab\sec+\name,"a"
36	.balign KSYM_ALIGN
37__ksymtab_\name:
38	__put \val, __kstrtab_\name
39	.previous
40	.section __ksymtab_strings,"a"
41__kstrtab_\name:
 
 
 
42	.asciz "\name"
 
43	.previous
44#ifdef CONFIG_MODVERSIONS
45	.section ___kcrctab\sec+\name,"a"
46	.balign KCRC_ALIGN
47__kcrctab_\name:
48#if defined(CONFIG_MODULE_REL_CRCS)
49	.long __crc_\name - .
50#else
51	.long __crc_\name
52#endif
53	.weak __crc_\name
54	.previous
55#endif
56#endif
57.endm
 
 
 
 
 
58
59#if defined(CONFIG_TRIM_UNUSED_KSYMS)
60
61#include <linux/kconfig.h>
62#include <generated/autoksyms.h>
63
64.macro __ksym_marker sym
65	.section ".discard.ksym","a"
66__ksym_marker_\sym:
67	 .previous
68.endm
69
70#define __EXPORT_SYMBOL(sym, val, sec)				\
71	__ksym_marker sym;					\
72	__cond_export_sym(sym, val, sec, __is_defined(__KSYM_##sym))
73#define __cond_export_sym(sym, val, sec, conf)			\
74	___cond_export_sym(sym, val, sec, conf)
75#define ___cond_export_sym(sym, val, sec, enabled)		\
76	__cond_export_sym_##enabled(sym, val, sec)
77#define __cond_export_sym_1(sym, val, sec) ___EXPORT_SYMBOL sym, val, sec
78#define __cond_export_sym_0(sym, val, sec) /* nothing */
79
80#else
81#define __EXPORT_SYMBOL(sym, val, sec) ___EXPORT_SYMBOL sym, val, sec
82#endif
83
84#define EXPORT_SYMBOL(name)					\
85	__EXPORT_SYMBOL(name, KSYM_FUNC(name),)
86#define EXPORT_SYMBOL_GPL(name) 				\
87	__EXPORT_SYMBOL(name, KSYM_FUNC(name), _gpl)
88#define EXPORT_DATA_SYMBOL(name)				\
89	__EXPORT_SYMBOL(name, name,)
90#define EXPORT_DATA_SYMBOL_GPL(name)				\
91	__EXPORT_SYMBOL(name, name,_gpl)
92
93#endif
v4.17
 1#ifndef __ASM_GENERIC_EXPORT_H
 2#define __ASM_GENERIC_EXPORT_H
 3
 4#ifndef KSYM_FUNC
 5#define KSYM_FUNC(x) x
 6#endif
 7#ifdef CONFIG_64BIT
 8#define __put .quad
 9#ifndef KSYM_ALIGN
10#define KSYM_ALIGN 8
11#endif
12#else
13#define __put .long
14#ifndef KSYM_ALIGN
15#define KSYM_ALIGN 4
16#endif
17#endif
18#ifndef KCRC_ALIGN
19#define KCRC_ALIGN 4
20#endif
21
22#ifdef CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX
23#define KSYM(name) _##name
 
 
 
24#else
25#define KSYM(name) name
26#endif
 
27
28/*
29 * note on .section use: @progbits vs %progbits nastiness doesn't matter,
30 * since we immediately emit into those sections anyway.
31 */
32.macro ___EXPORT_SYMBOL name,val,sec
33#ifdef CONFIG_MODULES
34	.globl KSYM(__ksymtab_\name)
35	.section ___ksymtab\sec+\name,"a"
36	.balign KSYM_ALIGN
37KSYM(__ksymtab_\name):
38	__put \val, KSYM(__kstrtab_\name)
39	.previous
40	.section __ksymtab_strings,"a"
41KSYM(__kstrtab_\name):
42#ifdef CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX
43	.asciz "_\name"
44#else
45	.asciz "\name"
46#endif
47	.previous
48#ifdef CONFIG_MODVERSIONS
49	.section ___kcrctab\sec+\name,"a"
50	.balign KCRC_ALIGN
51KSYM(__kcrctab_\name):
52#if defined(CONFIG_MODULE_REL_CRCS)
53	.long KSYM(__crc_\name) - .
54#else
55	.long KSYM(__crc_\name)
56#endif
57	.weak KSYM(__crc_\name)
58	.previous
59#endif
60#endif
61.endm
62#undef __put
63
64#if defined(__KSYM_DEPS__)
65
66#define __EXPORT_SYMBOL(sym, val, sec)	=== __KSYM_##sym ===
67
68#elif defined(CONFIG_TRIM_UNUSED_KSYMS)
69
70#include <linux/kconfig.h>
71#include <generated/autoksyms.h>
72
 
 
 
 
 
 
73#define __EXPORT_SYMBOL(sym, val, sec)				\
 
74	__cond_export_sym(sym, val, sec, __is_defined(__KSYM_##sym))
75#define __cond_export_sym(sym, val, sec, conf)			\
76	___cond_export_sym(sym, val, sec, conf)
77#define ___cond_export_sym(sym, val, sec, enabled)		\
78	__cond_export_sym_##enabled(sym, val, sec)
79#define __cond_export_sym_1(sym, val, sec) ___EXPORT_SYMBOL sym, val, sec
80#define __cond_export_sym_0(sym, val, sec) /* nothing */
81
82#else
83#define __EXPORT_SYMBOL(sym, val, sec) ___EXPORT_SYMBOL sym, val, sec
84#endif
85
86#define EXPORT_SYMBOL(name)					\
87	__EXPORT_SYMBOL(name, KSYM_FUNC(KSYM(name)),)
88#define EXPORT_SYMBOL_GPL(name) 				\
89	__EXPORT_SYMBOL(name, KSYM_FUNC(KSYM(name)), _gpl)
90#define EXPORT_DATA_SYMBOL(name)				\
91	__EXPORT_SYMBOL(name, KSYM(name),)
92#define EXPORT_DATA_SYMBOL_GPL(name)				\
93	__EXPORT_SYMBOL(name, KSYM(name),_gpl)
94
95#endif