Re: Undefined symbols in 2.6.11-rc5-mm1

From: Rusty Russell
Date: Fri Mar 04 2005 - 12:06:07 EST


On Wed, 2005-03-02 at 12:23 -0500, Valdis.Kletnieks@xxxxxx wrote:
> static int __init init_hermes(void)
> {
> return 0;
> }
>
> static void __exit exit_hermes(void)
> {
> }
>
> module_init(init_hermes);
> module_exit(exit_hermes);
>
> That's it. As far as I can tell, gcc 4.0 semi-correctly determined they were both
> static functions with no side effect, threw them away, and then the module_init
> and module_exit threw undefined symbols for them.

As a module, we create a non-static alias for "init_hermes", called
"init_module", effectively making it non-static. GCC should not
eliminate it in this case. Similar with module_exit().

For non-modules, we have __attribute_used__.

Rusty.
--
A bad analogy is like a leaky screwdriver -- Richard Braakman

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/