[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a1iqXjsYERVh+nQs9Xz4x7FreW3aS7OQPSB8CWcntnL4A@mail.gmail.com>
Date: Sat, 16 Jan 2021 18:04:12 +0100
From: Arnd Bergmann <arnd@...nel.org>
To: Marek Vasut <marex@...x.de>
Cc: Networking <netdev@...r.kernel.org>, Andrew Lunn <andrew@...n.ch>,
Arnd Bergmann <arnd@...db.de>,
Heiner Kallweit <hkallweit1@...il.com>,
Jakub Kicinski <kuba@...nel.org>,
Lukas Wunner <lukas@...ner.de>
Subject: Re: [PATCH net-next V2] net: ks8851: Fix mixed module/builtin build
On Sat, Jan 16, 2021 at 5:48 PM Marek Vasut <marex@...x.de> wrote:
>
> When either the SPI or PAR variant is compiled as module AND the other
> variant is compiled as built-in, the following build error occurs:
>
> arm-linux-gnueabi-ld: drivers/net/ethernet/micrel/ks8851_common.o: in function `ks8851_probe_common':
> ks8851_common.c:(.text+0x1564): undefined reference to `__this_module'
>
> Fix this by passing THIS_MODULE as argument to ks8851_probe_common(),
> ks8851_register_mdiobus(), and ultimately __mdiobus_register() in the
> ks8851_common.c.
>
> Fixes: ef3631220d2b ("net: ks8851: Register MDIO bus and the internal PHY")
> Signed-off-by: Marek Vasut <marex@...x.de>
> Cc: Andrew Lunn <andrew@...n.ch>
> Cc: Arnd Bergmann <arnd@...db.de>
> Cc: Heiner Kallweit <hkallweit1@...il.com>
> Cc: Jakub Kicinski <kuba@...nel.org>
> Cc: Lukas Wunner <lukas@...ner.de>
I don't really like this version, as it does not actually solve the problem of
linking the same object file into both vmlinux and a loadable module, which
can have all kinds of side-effects besides that link failure you saw.
If you want to avoid exporting all those symbols, a simpler hack would
be to '#include "ks8851_common.c" from each of the two files, which
then always duplicates the contents (even when both are built-in), but
at least builds the file the correct way.
Arnd
Powered by blists - more mailing lists