summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2020-05-09 12:11:33 +0900
committerSascha Hauer <s.hauer@pengutronix.de>2020-05-12 07:39:40 +0200
commitdf106a84fb035bf8e76497099f1a9629b499e49b (patch)
tree23ef5cd5ddd8d76cd4c07517e4d381cf2d867934 /include/linux
parent54b54c22cf3d8efa67eca6792f9ac344518d3570 (diff)
downloadbarebox-df106a84fb035bf8e76497099f1a9629b499e49b.tar.gz
barebox-df106a84fb035bf8e76497099f1a9629b499e49b.tar.xz
module.h: split out the EXPORT_SYMBOL into export.h
Do as Linux commit f50169324df4ad942e544386d136216c8617636a Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/export.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/include/linux/export.h b/include/linux/export.h
new file mode 100644
index 0000000000..88d318bd8a
--- /dev/null
+++ b/include/linux/export.h
@@ -0,0 +1,39 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef _LINUX_EXPORT_H
+#define _LINUX_EXPORT_H
+
+#define THIS_MODULE 0
+
+#ifdef CONFIG_MODULES
+
+struct kernel_symbol
+{
+ unsigned long value;
+ const char *name;
+};
+
+/* For every exported symbol, place a struct in the __ksymtab section */
+#define __EXPORT_SYMBOL(sym, sec) \
+ extern typeof(sym) sym; \
+ static const char __ustrtab_##sym[] \
+ __attribute__((section("__usymtab_strings"))) \
+ = MODULE_SYMBOL_PREFIX #sym; \
+ static const struct kernel_symbol __usymtab_##sym \
+ __used \
+ __attribute__((section("__usymtab" sec), unused)) \
+ = { (unsigned long)&sym, __ustrtab_##sym }
+
+#define EXPORT_SYMBOL(sym) \
+ __EXPORT_SYMBOL(sym, "")
+
+#define EXPORT_SYMBOL_GPL(sym) \
+ __EXPORT_SYMBOL(sym, "")
+
+#else
+
+#define EXPORT_SYMBOL(sym)
+#define EXPORT_SYMBOL_GPL(sym)
+
+#endif /* CONFIG_MODULES */
+
+#endif /* _LINUX_EXPORT_H */