Re: [MODULES] fix weak symbol handling

Rusty Russell (rusty@rustcorp.com.au)
Wed, 15 Jan 2003 15:39:43 +1100


In message <20030114171250.C5751@twiddle.net> you write:
> On Tue, Jan 14, 2003 at 07:39:44PM +1100, Rusty Russell wrote:
> > After that's reverted, here's my implementation. Richard?
>
> Nope. Doesn't handle undef weak. Handling of defined weak
> I'm not sure is necessary at all; I can't think of any good
> use for it in the kernel.

I didn't know about undefined weak symbols. I was thinking:

int nosupport_function(void)
{
return -ENOSYS;
}

extern int support_function(void)
__attribute__((alias("nosupport_function"), weak));

....

int init(void)
{
/* Or you could simply call it... */
if (support_function == nosupport_function)
...

Of course, you can use symbol_get and symbol_put, too, but they don't
work if !CONFIG_MODULES: I chose to implement that case as simply a
reference, so you'll get a link failure: see linux/module.h.

Rusty.

--
  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/