summaryrefslogtreecommitdiff
path: root/kernel/module.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2002-12-01 02:12:47 -0800
committerJames Bottomley <jejb@raven.il.steeleye.com>2002-12-01 02:12:47 -0800
commit1504317a0d85ff9cbf729d9d4ff3886aacc7a695 (patch)
tree5d5d7a3d18ee441a69461b14f7817d2addbf9268 /kernel/module.c
parenta110ac32ded0c9b2505e41259342f79c85a74b49 (diff)
[PATCH] v850 support
On the v850, the elf toolchain uses a `_' prefix for all user symbols (I'm not sure why, since most toolchains seem to have dropped this sort of thing). The attached patch adds the ability to deal with this, if the macro MODULE_SYMBOL_PREFIX is defined by <asm/module.h>. This only affects places where symbol names come from the user, e.g., EXPORT_SYMBOL, or the explicit symbol-names used in kernel/module.c itself. [Tweaked a little by Rusty, original by Miles Bader]
Diffstat (limited to 'kernel/module.c')
-rw-r--r--kernel/module.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/kernel/module.c b/kernel/module.c
index 9ee9bf6411ad..712f780d6be1 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -37,6 +37,9 @@
#define DEBUGP(fmt , a...)
#endif
+#define symbol_is(literal, string) \
+ (strcmp(MODULE_SYMBOL_PREFIX literal, (string)) == 0)
+
/* List of modules, protected by module_mutex */
static DECLARE_MUTEX(module_mutex);
LIST_HEAD(modules); /* FIXME: Accessed w/o lock on oops by some archs */
@@ -630,10 +633,10 @@ static int grab_private_symbols(Elf_Shdr *sechdrs,
unsigned int i;
for (i = 1; i < sechdrs[symbolsec].sh_size/sizeof(*sym); i++) {
- if (strcmp("__initfn", strtab + sym[i].st_name) == 0)
+ if (symbol_is("__initfn", strtab + sym[i].st_name))
mod->init = (void *)sym[i].st_value;
#ifdef CONFIG_MODULE_UNLOAD
- if (strcmp("__exitfn", strtab + sym[i].st_name) == 0)
+ if (symbol_is("__exitfn", strtab + sym[i].st_name))
mod->exit = (void *)sym[i].st_value;
#endif
}
@@ -770,7 +773,7 @@ static void simplify_symbols(Elf_Shdr *sechdrs,
mod,
&ksg);
/* We fake up "__this_module" */
- if (strcmp(strtab+sym[i].st_name, "__this_module")==0)
+ if (symbol_is("__this_module", strtab+sym[i].st_name))
sym[i].st_value = (unsigned long)mod;
}
}