hc
2024-01-31 f9004dbfff8a3fbbd7e2a88c8a4327c7f2f8e5b2
kernel/include/asm-generic/export.h
....@@ -1,17 +1,16 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 #ifndef __ASM_GENERIC_EXPORT_H
23 #define __ASM_GENERIC_EXPORT_H
34
45 #ifndef KSYM_FUNC
56 #define KSYM_FUNC(x) x
67 #endif
7
-#ifdef CONFIG_64BIT
8
-#ifndef KSYM_ALIGN
9
-#define KSYM_ALIGN 8
10
-#endif
11
-#else
12
-#ifndef KSYM_ALIGN
8
+#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
139 #define KSYM_ALIGN 4
14
-#endif
10
+#elif defined(CONFIG_64BIT)
11
+#define KSYM_ALIGN 8
12
+#else
13
+#define KSYM_ALIGN 4
1514 #endif
1615 #ifndef KCRC_ALIGN
1716 #define KCRC_ALIGN 4
....@@ -19,34 +18,34 @@
1918
2019 .macro __put, val, name
2120 #ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
22
- .long \val - ., \name - .
21
+ .long \val - ., \name - ., 0
2322 #elif defined(CONFIG_64BIT)
24
- .quad \val, \name
23
+ .quad \val, \name, 0
2524 #else
26
- .long \val, \name
25
+ .long \val, \name, 0
2726 #endif
2827 .endm
2928
3029 /*
31
- * note on .section use: @progbits vs %progbits nastiness doesn't matter,
32
- * since we immediately emit into those sections anyway.
30
+ * note on .section use: we specify progbits since usage of the "M" (SHF_MERGE)
31
+ * section flag requires it. Use '%progbits' instead of '@progbits' since the
32
+ * former apparently works on all arches according to the binutils source.
3333 */
34
+
3435 .macro ___EXPORT_SYMBOL name,val,sec
35
-#ifdef CONFIG_MODULES
36
- .globl __ksymtab_\name
36
+#if defined(CONFIG_MODULES) && !defined(__DISABLE_EXPORTS)
3737 .section ___ksymtab\sec+\name,"a"
3838 .balign KSYM_ALIGN
3939 __ksymtab_\name:
4040 __put \val, __kstrtab_\name
4141 .previous
42
- .section __ksymtab_strings,"a"
42
+ .section __ksymtab_strings,"aMS",%progbits,1
4343 __kstrtab_\name:
4444 .asciz "\name"
4545 .previous
4646 #ifdef CONFIG_MODVERSIONS
4747 .section ___kcrctab\sec+\name,"a"
4848 .balign KCRC_ALIGN
49
-__kcrctab_\name:
5049 #if defined(CONFIG_MODULE_REL_CRCS)
5150 .long __crc_\name - .
5251 #else
....@@ -57,18 +56,20 @@
5756 #endif
5857 #endif
5958 .endm
60
-#undef __put
6159
62
-#if defined(__KSYM_DEPS__)
63
-
64
-#define __EXPORT_SYMBOL(sym, val, sec) === __KSYM_##sym ===
65
-
66
-#elif defined(CONFIG_TRIM_UNUSED_KSYMS)
60
+#if defined(CONFIG_TRIM_UNUSED_KSYMS)
6761
6862 #include <linux/kconfig.h>
6963 #include <generated/autoksyms.h>
7064
65
+.macro __ksym_marker sym
66
+ .section ".discard.ksym","a"
67
+__ksym_marker_\sym:
68
+ .previous
69
+.endm
70
+
7171 #define __EXPORT_SYMBOL(sym, val, sec) \
72
+ __ksym_marker sym; \
7273 __cond_export_sym(sym, val, sec, __is_defined(__KSYM_##sym))
7374 #define __cond_export_sym(sym, val, sec, conf) \
7475 ___cond_export_sym(sym, val, sec, conf)