summaryrefslogtreecommitdiffstats
path: root/include/module.h
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2007-10-01 10:20:57 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2007-10-01 10:20:57 +0200
commit6b58e74d04e651cb3adf6986a009e68abcb07901 (patch)
tree55c8ad848d6a28dbd715fe83bcdb203d317d0665 /include/module.h
parent8b8c95b9fccb86eca260684c597b85ab1882a9ce (diff)
downloadbarebox-6b58e74d04e651cb3adf6986a009e68abcb07901.tar.gz
barebox-6b58e74d04e651cb3adf6986a009e68abcb07901.tar.xz
Resolve the symbols using an extra section and only resolve explicitly
exported symbols. Using kallsyms for this purpose doesn't do it because kallsyms do not resolve variables. Also the symbol table gets quite big using kallsyms.
Diffstat (limited to 'include/module.h')
-rw-r--r--include/module.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/include/module.h b/include/module.h
index faea2ae7e4..421b9374fb 100644
--- a/include/module.h
+++ b/include/module.h
@@ -4,6 +4,34 @@
#include <elf.h>
#include <asm/module.h>
+#ifndef MODULE_SYMBOL_PREFIX
+#define MODULE_SYMBOL_PREFIX
+#endif
+
+#ifdef CONFIG_MODULE
+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 __u_boot_strtab_##sym[] \
+ __attribute__((section("__u_boot_symtab_strings"))) \
+ = MODULE_SYMBOL_PREFIX #sym; \
+ static const struct kernel_symbol __u_boot_symtab_##sym \
+ __used \
+ __attribute__((section("__u_boot_symtab" sec), unused)) \
+ = { (unsigned long)&sym, __u_boot_strtab_##sym }
+
+#define EXPORT_SYMBOL(sym) \
+ __EXPORT_SYMBOL(sym, "")
+#else
+#define EXPORT_SYMBOL(sym)
+#endif
+
struct module {
char *name;