Re: Fwd: binutils in debian unstable is broken.

Eric Lammerts (eric@lammerts.org)
Wed, 5 Dec 2001 14:34:42 +0100 (CET)


On Wed, 5 Dec 2001, Alan Cox wrote:

> > The problem appears to be that the linker is now actually doing what
> > we asked it to do, so the `remove_foo' entry in that table now points
> > at a function which isn't going to be linked into the kernel. Oh dear.
>
> The ideal it seems would be for binutils to support passing a stub function
> to use in such cases. That would keep the kernel stuff working nicely and
> allow us to do panic("__exit code called"); if anyone actually did manage
> to call one.

We can get a panic() call (and remove the ugly #ifdef's) with
something like this:

in some .h file:

#ifdef DEVEXIT_LINKED
#define DEVEXIT_FUNC(a) (a)
#else
void panic_exit_code();
#define DEVEXIT_FUNC(a) ((typeof((a)) *)panic_exit_code)
#endif

in some .c file:

#ifndef DEVEXIT_LINKED
void panic_exit_code()
{
panic("__exit code called");
}
#endif

change the drivers like this:

#ifdef DEVEXIT_LINKED
remove: firestream_remove_one,
#endif

to this:

remove: DEVEXIT_FUNC(firestream_remove_one),

Eric

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