resolve symbols exported by drivers
---
dev/arch/arm/gba/dev.ld | 8 ++++++++
dev/arch/i386/nommu/dev.ld | 8 ++++++++
dev/arch/i386/pc/dev.ld | 8 ++++++++
dev/include/driver.h | 18 ++++++++++++++++++
4 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/dev/arch/arm/gba/dev.ld b/dev/arch/arm/gba/dev.ld
index 6cab458..b8fa431 100755
--- a/dev/arch/arm/gba/dev.ld
+++ b/dev/arch/arm/gba/dev.ld
@@ -24,6 +24,14 @@ SECTIONS
*(.rodata.*)
} : text
+ .kstrtab : {
+ *(.kstrtab)
+ } : text
+
+ .ksymtab ALIGN(4) : {
+ *(.ksymtab)
+ } : text
+
. = ALIGN(4);
.driver_table : {
diff --git a/dev/arch/i386/nommu/dev.ld b/dev/arch/i386/nommu/dev.ld
index f7a286c..a586078 100755
--- a/dev/arch/i386/nommu/dev.ld
+++ b/dev/arch/i386/nommu/dev.ld
@@ -22,6 +22,14 @@ SECTIONS
*(.rodata.*)
} : text
+ .kstrtab : {
+ *(.kstrtab)
+ } : text
+
+ .ksymtab ALIGN(4) : {
+ *(.ksymtab)
+ } : text
+
. = ALIGN(32);
.driver_table : {
diff --git a/dev/arch/i386/pc/dev.ld b/dev/arch/i386/pc/dev.ld
index f7a286c..a586078 100755
--- a/dev/arch/i386/pc/dev.ld
+++ b/dev/arch/i386/pc/dev.ld
@@ -22,6 +22,14 @@ SECTIONS
*(.rodata.*)
} : text
+ .kstrtab : {
+ *(.kstrtab)
+ } : text
+
+ .ksymtab ALIGN(4) : {
+ *(.ksymtab)
+ } : text
+
. = ALIGN(32);
.driver_table : {
diff --git a/dev/include/driver.h b/dev/include/driver.h
index 9eb4973..682fc80 100755
--- a/dev/include/driver.h
+++ b/dev/include/driver.h
@@ -321,4 +321,22 @@ extern void system_reset(void);
extern void debug_attach(void (*func)(char *));
extern void system_bootinfo(struct boot_info **);
+/* Export symbols for drivers. Place the symbol name in .kstrtab and a
+ * struct kernel_symbol in the .ksymtab. The elf loader will use this
+ * information to resolve these symbols in driver modules */
+struct kernel_symbol
+{
+ u_long value;
+ const char *name;
+};
+
+#define EXPORT_SYMBOL(sym) \
+ static const char __kstrtab_##sym[] \
+ __attribute__((section(".kstrtab"))) \
+ = #sym; \
+ static const struct kernel_symbol __ksymtab_##sym \
+ __attribute__((__used__)) \
+ __attribute__((section(".ksymtab"), unused)) \
+ = { .value = (u_long)&sym, .name = __kstrtab_##sym }
+
#endif /* !_DRIVER_H */
--
1.5.0.3.GIT
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Prex-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/prex-devel