Kernel linker and undefined references in KLD
Kostik Belousov
kostikbel at gmail.com
Thu Jul 15 19:16:28 UTC 2010
On Thu, Jul 15, 2010 at 10:36:04PM +0400, Andrey V. Elsukov wrote:
> On 15.07.2010 18:32, Kostik Belousov wrote:
> > The kernel linker ignores weak attribute of the symbol, as you see.
> > There is more bugs in this department, in regard of the list of
> > exported symbols from the modules.
> >
> > I have a patch that fixes the issues, but I am leery to commit it, since
> > the fix effectively breaks significant set of the modules.
>
> Hi, Kostik
>
> i want to remind that some time ago there was a report about another
> bug.
>
> #include <sys/param.h>
> #include <sys/kernel.h>
> #include <sys/module.h>
> #include <sys/systm.h>
>
> static int
> tst_modevent(module_t mod, int type, void *unused)
> {
> switch (type) {
> case MOD_LOAD:
> return (EINVAL);
> case MOD_UNLOAD:
> break;
> };
> return (0);
> }
> static moduledata_t tstmod = {
> "tst",
> tst_modevent,
> 0
> };
>
> DECLARE_MODULE(tst, tstmod, SI_SUB_ROOT_CONF, SI_ORDER_ANY);
>
> # kldload -v ./tst.ko
> Loaded ./tst.ko, id=16
>
> I think loading of this module should be rejected on MOD_LOAD,
> but it doesn't.
Did you tried this ? It works for me.
There was a thread about the issue where apparently submitter used
binutils 2.20.1. The solution of reverting r103230 was
mentioned by peter.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20100715/9ee1a793/attachment.pgp
More information about the freebsd-hackers
mailing list