mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: Patch?: module-init-tools/modprobe.c - use modules.dep
       [not found] <200211252254.OAA04288@freya.yggdrasil.com>
@ 2002-11-26  0:45 ` Rusty Russell
  2002-11-26  7:40   ` [PATCH] Symbol name prefixes (e.g., `_') with the new module loader Miles Bader
  0 siblings, 1 reply; 2+ messages in thread
From: Rusty Russell @ 2002-11-26  0:45 UTC (permalink / raw)
  To: Adam J. Richter; +Cc: dwmw2, linux-kernel

In message <200211252254.OAA04288@freya.yggdrasil.com> you write:
> Rusty Russell wrote:
> >(you took out module alias support in your patch, though) 8(.
> 
> 	Did not.  See the routine get_alias() in my version.

No, you took out the part that reads the aliases from the module
itself (.modalias section).

> 	However, my version does not support:
> 
> 		 wildcard aliases,
> 		 an alias that expands to multiple targets, or
> 		 an alias that expands to an alias.
> 
> 	It should only take a few lines to fix the first two.

See my wishlist for the second one (or/and support): this is a request
I got from someone.

> As for last, I'm not sure how useful aliasing to an alias really is.

Don't know.  Combinations of and/or aliases would be easiest with
this, though.

> It wouldn't be the Manhattan Project to add it, but I'd rather not
> add a feature if it has no real use.

Good man!

Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH]  Symbol name prefixes (e.g., `_') with the new module loader
  2002-11-26  0:45 ` Patch?: module-init-tools/modprobe.c - use modules.dep Rusty Russell
@ 2002-11-26  7:40   ` Miles Bader
  0 siblings, 0 replies; 2+ messages in thread
From: Miles Bader @ 2002-11-26  7:40 UTC (permalink / raw)
  To: Rusty Russell; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 436 bytes --]

Hi,

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.


Patch:



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: module-sympfx-20021126.patch --]
[-- Type: text/x-patch, Size: 3161 bytes --]

diff -ruN -X../cludes ../orig/linux-2.5.49-uc0/include/linux/module.h include/linux/module.h
--- ../orig/linux-2.5.49-uc0/include/linux/module.h	2002-11-25 10:30:09.000000000 +0900
+++ include/linux/module.h	2002-11-25 18:55:11.000000000 +0900
@@ -88,11 +88,18 @@
 void *__symbol_get_gpl(const char *symbol);
 #define symbol_get(x) ((typeof(&x))(__symbol_get(#x)))
 
+#ifdef MODULE_SYMBOL_PREFIX
 /* For every exported symbol, place a struct in the __ksymtab section */
 #define EXPORT_SYMBOL(sym)				\
 	const struct kernel_symbol __ksymtab_##sym	\
 	__attribute__((section("__ksymtab")))		\
+	= { (unsigned long)&sym, MODULE_SYMBOL_PREFIX #sym }
+#else
+#define EXPORT_SYMBOL(sym)				\
+	const struct kernel_symbol __ksymtab_##sym	\
+	__attribute__((section("__ksymtab")))		\
 	= { (unsigned long)&sym, #sym }
+#endif
 
 #define EXPORT_SYMBOL_NOVERS(sym) EXPORT_SYMBOL(sym)
 #define EXPORT_SYMBOL_GPL(sym) EXPORT_SYMBOL(sym)
diff -ruN -X../cludes ../orig/linux-2.5.49-uc0/kernel/module.c kernel/module.c
--- ../orig/linux-2.5.49-uc0/kernel/module.c	2002-11-25 10:30:10.000000000 +0900
+++ kernel/module.c	2002-11-25 18:38:58.000000000 +0900
@@ -37,6 +37,17 @@
 #define DEBUGP(fmt , a...)
 #endif
 
+/* Define a handy short alias for MODULE_SYMBOL_PREFIX, defaulting
+   to "" if it isn't defined (it's also useful to avoid just
+   defining MODULE_SYMBOL_PREFIX here so that #ifdefs can still be
+   done against it).  */
+#ifdef MODULE_SYMBOL_PREFIX
+#define SYMPFX MODULE_SYMBOL_PREFIX
+#else
+#define SYMPFX ""
+#endif
+
+
 /* 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 +641,10 @@
 	unsigned int i;
 
 	for (i = 1; i < sechdrs[symbolsec].sh_size/sizeof(*sym); i++) {
-		if (strcmp("__initfn", strtab + sym[i].st_name) == 0)
+		if (strcmp(SYMPFX "__initfn", strtab + sym[i].st_name) == 0)
 			mod->init = (void *)sym[i].st_value;
 #ifdef CONFIG_MODULE_UNLOAD
-		if (strcmp("__exitfn", strtab + sym[i].st_name) == 0)
+		if (strcmp(SYMPFX "__exitfn", strtab + sym[i].st_name) == 0)
 			mod->exit = (void *)sym[i].st_value;
 #endif
 	}
@@ -770,7 +781,8 @@
 						       mod,
 						       &ksg);
 			/* We fake up "__this_module" */
-			if (strcmp(strtab+sym[i].st_name, "__this_module")==0)
+			if (strcmp(strtab+sym[i].st_name,
+				   SYMPFX "__this_module")==0)
 				sym[i].st_value = (unsigned long)mod;
 		}
 	}
@@ -869,7 +881,8 @@
 			/* This module's name */
 			DEBUGP("Module name in section %u\n", i);
 			modnameindex = i;
-		} else if (strcmp(secstrings+sechdrs[i].sh_name, "__ksymtab")
+		} else if (strcmp(secstrings+sechdrs[i].sh_name,
+				  SYMPFX "__ksymtab")
 			   == 0) {
 			/* Exported symbols. */
 			DEBUGP("EXPORT table in section %u\n", i);
@@ -884,7 +897,8 @@
 			/* Setup parameter info */
 			DEBUGP("Setup table found in section %u\n", i);
 			setupindex = i;
-		} else if (strcmp(secstrings+sechdrs[i].sh_name, "__ex_table")
+		} else if (strcmp(secstrings+sechdrs[i].sh_name,
+				  SYMPFX "__ex_table")
 			   == 0) {
 			/* Exception table */
 			DEBUGP("Exception table found in section %u\n", i);

[-- Attachment #3: Type: text/plain, Size: 63 bytes --]



Thanks,

-Miles
-- 
"1971 pickup truck; will trade for guns"

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-11-26  7:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <200211252254.OAA04288@freya.yggdrasil.com>
2002-11-26  0:45 ` Patch?: module-init-tools/modprobe.c - use modules.dep Rusty Russell
2002-11-26  7:40   ` [PATCH] Symbol name prefixes (e.g., `_') with the new module loader Miles Bader

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®