summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2002-12-01 02:12:42 -0800
committerJames Bottomley <jejb@raven.il.steeleye.com>2002-12-01 02:12:42 -0800
commita110ac32ded0c9b2505e41259342f79c85a74b49 (patch)
tree969dc030569ce4158d84e05baccf0b3e665600e5 /include/linux
parent1929e8b2a804ea760ef1dba27f26d62d6236dd65 (diff)
[PATCH] Table fix for module-init-tools
This patch allows the new depmod to generate the USB & PCI hotplug tables. Greg Banks and I are (slowly) working on a better solution, but allows the old-style "modules.pcimap" etc. to be generated in the short term. This patch adds a "__mod_XXX_table" symbol which is an alias to the module table, rather than a pointer. This makes it relatively trivial to extract the table. Previously, it required a pointer dereference, which means the relocations must be applied, which is why the old depmod needs so much of modutils (ie. it basically links the whole module in order to find the table). The old depmod can still be invoked using "-F System.map" to generate the tables (there'll be lots of other warnings, and it will generate a completely bogus modules.dep, but the tables should be OK.)
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/module.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/include/linux/module.h b/include/linux/module.h
index 927341a26c0e..24389ac2db19 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -15,6 +15,7 @@
#include <linux/cache.h>
#include <linux/kmod.h>
#include <linux/elf.h>
+#include <linux/stringify.h>
#include <asm/module.h>
#include <asm/uaccess.h> /* For struct exception_table_entry */
@@ -40,11 +41,14 @@ struct kernel_symbol
#ifdef MODULE
-#define MODULE_GENERIC_TABLE(gtype,name) \
-static const unsigned long __module_##gtype##_size \
- __attribute__ ((unused)) = sizeof(struct gtype##_id); \
-static const struct gtype##_id * __module_##gtype##_table \
- __attribute__ ((unused)) = name
+/* For replacement modutils, use an alias not a pointer. */
+#define MODULE_GENERIC_TABLE(gtype,name) \
+static const unsigned long __module_##gtype##_size \
+ __attribute__ ((unused)) = sizeof(struct gtype##_id); \
+static const struct gtype##_id * __module_##gtype##_table \
+ __attribute__ ((unused)) = name; \
+extern const struct gtype##_id __mod_##gtype##_table \
+ __attribute__ ((unused, alias(__stringify(name))))
/* This is magically filled in by the linker, but THIS_MODULE must be
a constant so it works in initializers. */