Kernel linker and undefined references in KLD

Andrey V. Elsukov bu7cher at yandex.ru
Thu Jul 15 18:36:24 UTC 2010


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.

-- 
WBR, Andrey V. Elsukov

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20100715/ef87b1d3/signature.pgp


More information about the freebsd-hackers mailing list