From nobody Wed Apr 26 11:38:32 2023 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Q5xhW0YT0z47sZM for ; Wed, 26 Apr 2023 11:38:35 +0000 (UTC) (envelope-from hselasky@freebsd.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Q5xhV49dRz3sNJ; Wed, 26 Apr 2023 11:38:34 +0000 (UTC) (envelope-from hselasky@freebsd.org) Authentication-Results: mx1.freebsd.org; none Received: from [10.36.2.154] (unknown [46.212.121.255]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 5341426167D; Wed, 26 Apr 2023 13:38:33 +0200 (CEST) Message-ID: Date: Wed, 26 Apr 2023 13:38:32 +0200 List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: Link modules to DYN type Content-Language: en-US To: Konstantin Belousov Cc: Zhenlei Huang , FreeBSD CURRENT , Gleb Smirnoff References: <97390FE1-1DF5-43A1-A3F4-2B945D681437@FreeBSD.org> <2bb66cac-c7f1-e45b-693a-8afbda05cfa6@freebsd.org> From: Hans Petter Selasky In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4Q5xhV49dRz3sNJ X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:24940, ipnet:2a01:4f8::/32, country:DE] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N On 4/26/23 13:12, Konstantin Belousov wrote: > No, in-kernel linker does not behave this way. > Modules need to contain explicit reference to all modules they depend upon, > using the MODULE_DEPEND() macro. Only symbols from the dependencies are > resolved. > > All modules get an implicit reference to kernel. Hi Konstantin, Maybe I wasn't so clear. Trying again: > diff --git a/sys/tests/ktest.c b/sys/tests/ktest.c > index 495fedf95dde..eb42cf062487 100644 > --- a/sys/tests/ktest.c > +++ b/sys/tests/ktest.c > @@ -409,6 +409,12 @@ static moduledata_t ktestmod = { > 0 > }; > > +int > +printf(const char *fmt, ...) > +{ > + return (0); > +} > + > DECLARE_MODULE(ktestmod, ktestmod, SI_SUB_PSEUDO, SI_ORDER_ANY); > MODULE_VERSION(ktestmod, 1); > MODULE_DEPEND(ktestmod, netlink, 1, 1, 1); Then kldload ktest.ko . Which printf() function will be used if ktest.c calls printf() ? I would expect a warning from the kernel at least ... --HPS