]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/blame - include/asm-generic/export.h
Merge tag 'v5.0-rc1' into next-general
[mirror_ubuntu-focal-kernel.git] / include / asm-generic / export.h
CommitLineData
22823ab4
AV
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
22823ab4
AV
8#ifndef KSYM_ALIGN
9#define KSYM_ALIGN 8
10#endif
22823ab4 11#else
22823ab4
AV
12#ifndef KSYM_ALIGN
13#define KSYM_ALIGN 4
14#endif
71810db2 15#endif
22823ab4
AV
16#ifndef KCRC_ALIGN
17#define KCRC_ALIGN 4
18#endif
22823ab4 19
7290d580
AB
20.macro __put, val, name
21#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
22 .long \val - ., \name - .
23#elif defined(CONFIG_64BIT)
24 .quad \val, \name
25#else
26 .long \val, \name
27#endif
28.endm
29
22823ab4
AV
30/*
31 * note on .section use: @progbits vs %progbits nastiness doesn't matter,
32 * since we immediately emit into those sections anyway.
33 */
34.macro ___EXPORT_SYMBOL name,val,sec
35#ifdef CONFIG_MODULES
94e58e0a 36 .globl __ksymtab_\name
22823ab4
AV
37 .section ___ksymtab\sec+\name,"a"
38 .balign KSYM_ALIGN
94e58e0a
MY
39__ksymtab_\name:
40 __put \val, __kstrtab_\name
22823ab4
AV
41 .previous
42 .section __ksymtab_strings,"a"
94e58e0a 43__kstrtab_\name:
22823ab4 44 .asciz "\name"
22823ab4
AV
45 .previous
46#ifdef CONFIG_MODVERSIONS
47 .section ___kcrctab\sec+\name,"a"
48 .balign KCRC_ALIGN
94e58e0a 49__kcrctab_\name:
71810db2 50#if defined(CONFIG_MODULE_REL_CRCS)
94e58e0a 51 .long __crc_\name - .
71810db2 52#else
94e58e0a 53 .long __crc_\name
71810db2 54#endif
94e58e0a 55 .weak __crc_\name
22823ab4
AV
56 .previous
57#endif
58#endif
59.endm
60#undef __put
61
bbda5ec6 62#if defined(CONFIG_TRIM_UNUSED_KSYMS)
22823ab4
AV
63
64#include <linux/kconfig.h>
65#include <generated/autoksyms.h>
66
bbda5ec6
MY
67.macro __ksym_marker sym
68 .section ".discard.ksym","a"
69__ksym_marker_\sym:
70 .previous
71.endm
72
22823ab4 73#define __EXPORT_SYMBOL(sym, val, sec) \
bbda5ec6 74 __ksym_marker sym; \
c0a0aba8 75 __cond_export_sym(sym, val, sec, __is_defined(__KSYM_##sym))
22823ab4
AV
76#define __cond_export_sym(sym, val, sec, conf) \
77 ___cond_export_sym(sym, val, sec, conf)
78#define ___cond_export_sym(sym, val, sec, enabled) \
79 __cond_export_sym_##enabled(sym, val, sec)
80#define __cond_export_sym_1(sym, val, sec) ___EXPORT_SYMBOL sym, val, sec
81#define __cond_export_sym_0(sym, val, sec) /* nothing */
82
83#else
84#define __EXPORT_SYMBOL(sym, val, sec) ___EXPORT_SYMBOL sym, val, sec
85#endif
86
87#define EXPORT_SYMBOL(name) \
94e58e0a 88 __EXPORT_SYMBOL(name, KSYM_FUNC(name),)
22823ab4 89#define EXPORT_SYMBOL_GPL(name) \
94e58e0a 90 __EXPORT_SYMBOL(name, KSYM_FUNC(name), _gpl)
22823ab4 91#define EXPORT_DATA_SYMBOL(name) \
94e58e0a 92 __EXPORT_SYMBOL(name, name,)
22823ab4 93#define EXPORT_DATA_SYMBOL_GPL(name) \
94e58e0a 94 __EXPORT_SYMBOL(name, name,_gpl)
22823ab4
AV
95
96#endif