[PATCH] sound/oss/dmasound: fix build when some drivers are =m and others are =y
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!
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") # "forever" Signed-off-by: Randy Dunlap rdunlap@infradead.org Reported-by: kernel test robot lkp@intel.com Cc: Arnd Bergmann arnd@arndb.de Cc: Geert Uytterhoeven geert@linux-m68k.org Cc: Jaroslav Kysela perex@perex.cz Cc: Takashi Iwai tiwai@suse.com Cc: alsa-devel@alsa-project.org --- There may be some Makefile solution to this but I don't know what it is. I didn't want to spend lots of time on these old drivers.
sound/oss/dmasound/Makefile | 6 +++--- sound/oss/dmasound/dmasound_atari.c | 2 +- sound/oss/dmasound/dmasound_core.c | 16 ---------------- sound/oss/dmasound/dmasound_paula.c | 2 +- sound/oss/dmasound/dmasound_q40.c | 2 +- 5 files changed, 6 insertions(+), 22 deletions(-)
--- linux-next-20211117.orig/sound/oss/dmasound/dmasound_atari.c +++ linux-next-20211117/sound/oss/dmasound/dmasound_atari.c @@ -27,7 +27,7 @@ #include <asm/atariints.h> #include <asm/atari_stram.h>
-#include "dmasound.h" +#include "dmasound_core.c"
#define DMASOUND_ATARI_REVISION 0 #define DMASOUND_ATARI_EDITION 3 --- linux-next-20211117.orig/sound/oss/dmasound/dmasound_paula.c +++ linux-next-20211117/sound/oss/dmasound/dmasound_paula.c @@ -30,7 +30,7 @@ #include <asm/amigaints.h> #include <asm/machdep.h>
-#include "dmasound.h" +#include "dmasound_core.c"
#define DMASOUND_PAULA_REVISION 0 #define DMASOUND_PAULA_EDITION 4 --- linux-next-20211117.orig/sound/oss/dmasound/dmasound_q40.c +++ linux-next-20211117/sound/oss/dmasound/dmasound_q40.c @@ -25,7 +25,7 @@ #include <asm/q40ints.h> #include <asm/q40_master.h>
-#include "dmasound.h" +#include "dmasound_core.c"
#define DMASOUND_Q40_REVISION 0 #define DMASOUND_Q40_EDITION 3 --- linux-next-20211117.orig/sound/oss/dmasound/Makefile +++ linux-next-20211117/sound/oss/dmasound/Makefile @@ -3,6 +3,6 @@ # Makefile for the DMA sound driver #
-obj-$(CONFIG_DMASOUND_ATARI) += dmasound_core.o dmasound_atari.o -obj-$(CONFIG_DMASOUND_PAULA) += dmasound_core.o dmasound_paula.o -obj-$(CONFIG_DMASOUND_Q40) += dmasound_core.o dmasound_q40.o +obj-$(CONFIG_DMASOUND_ATARI) += dmasound_atari.o +obj-$(CONFIG_DMASOUND_PAULA) += dmasound_paula.o +obj-$(CONFIG_DMASOUND_Q40) += dmasound_q40.o --- linux-next-20211117.orig/sound/oss/dmasound/dmasound_core.c +++ linux-next-20211117/sound/oss/dmasound/dmasound_core.c @@ -1570,19 +1570,3 @@ char dmasound_alaw2dma8[] = { 3, 3, 3, 3, 3, 3, 3, 3 }; #endif /* HAS_8BIT_TABLES */ - - /* - * Visible symbols for modules - */ - -EXPORT_SYMBOL(dmasound); -EXPORT_SYMBOL(dmasound_init); -#ifdef MODULE -EXPORT_SYMBOL(dmasound_deinit); -#endif -EXPORT_SYMBOL(dmasound_write_sq); -EXPORT_SYMBOL(dmasound_catchRadius); -#ifdef HAS_8BIT_TABLES -EXPORT_SYMBOL(dmasound_ulaw2dma8); -EXPORT_SYMBOL(dmasound_alaw2dma8); -#endif
On Thu, Nov 18, 2021 at 7:21 AM Randy Dunlap rdunlap@infradead.org 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
On 11/17/21 10:50 PM, Arnd Bergmann wrote:
On Thu, Nov 18, 2021 at 7:21 AM Randy Dunlap rdunlap@infradead.org 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.
True dat.
-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.
OK, thanks for the info. I'm not going to spend any more time on it...
participants (2)
-
Arnd Bergmann
-
Randy Dunlap