Re: [PATCH] sound/oss/dmasound: fix build when some drivers are =m and others are =y

From: Arnd Bergmann
Date: Thu Nov 18 2021 - 01:51:28 EST


On Thu, Nov 18, 2021 at 7:21 AM Randy Dunlap <rdunlap@xxxxxxxxxxxxx> wrote:
>
> When CONFIG_DMASOUND_ATARI=y and CONFIG_DMASOUND_Q40=m,
> dmasound_atari.o is built first (listed first in the Makefile),
> so dmasound_core.o is built as builtin, not for use by loadable
> modules. Then dmasound_q40.o is built and linked with the
> already-built dmasound_core.o, but the latter does not support
> use by loadable modules. This causes the missing symbol to be
> undefined.
>
> Fixes this build error:
> ERROR: modpost: "dmasound_deinit" [sound/oss/dmasound/dmasound_q40.ko] undefined!

I suspect your patch now breaks the case where multiple drivers are
built-in, because that puts the same global symbols into vmlinux more
than once.

> -EXPORT_SYMBOL(dmasound);
> -EXPORT_SYMBOL(dmasound_init);
> -#ifdef MODULE
> -EXPORT_SYMBOL(dmasound_deinit);
> -#endif

>From a very brief look, I would think that removing this #ifdef and
unconditionally defining dmasound_deinit is the correct solution
here, to solve the case of the core driver being built-in but called
from a loadable module, the Makefile logic is otherwise correct.

Arnd