[PATCH] Richard Henderson for President!

Rusty Russell (rusty@rustcorp.com.au)
Fri, 17 Jan 2003 15:49:15 +1100


Linus, please apply. Makes symbol_get work if !CONFIG_MODULE.

Name: symbol_get fix
Author: Rusty Russell
Status: Trivial

D: Make symbol_get() use undefined weak symbols if !CONFIG_MODULE.
D: Many thanks to RTH for introducing undef weak symbols to me.

diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .932-linux-2.5-bk/include/linux/module.h .932-linux-2.5-bk.updated/include/linux/module.h
--- .932-linux-2.5-bk/include/linux/module.h 2003-01-17 12:59:22.000000000 +1100
+++ .932-linux-2.5-bk.updated/include/linux/module.h 2003-01-17 15:44:57.000000000 +1100
@@ -344,7 +344,7 @@ static inline int module_text_address(un
}

/* Get/put a kernel symbol (calls should be symmetric) */
-#define symbol_get(x) (&(x))
+#define symbol_get(x) ({ extern typeof(x) x __attribute__((weak)); &(x); })
#define symbol_put(x) do { } while(0)
#define symbol_put_addr(x) do { } while(0)

--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/