Bug 6458 - gentoo-sources-2.6.16-gentoo-r4: compile/link error in fm801.c
Summary: gentoo-sources-2.6.16-gentoo-r4: compile/link error in fm801.c
Status: CLOSED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: Sound(ALSA) (show other bugs)
Hardware: i386 Linux
: P2 low
Assignee: Jaroslav Kysela
URL:
Keywords:
: 6972 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-04-29 05:14 UTC by Toralf Förster
Modified: 2006-08-08 02:26 UTC (History)
3 users (show)

See Also:
Kernel Version: linux-2.6.17-rc4-git2
Subsystem:
Regression: ---
Bisected commit-id:


Attachments
kernel config (39.52 KB, text/plain)
2006-04-29 05:14 UTC, Toralf Förster
Details
make log (93.06 KB, text/plain)
2006-04-29 05:15 UTC, Toralf Förster
Details
kernel config (32.12 KB, text/plain)
2006-05-09 05:28 UTC, Toralf Förster
Details
BAD PATCH do not apply - just to get ball rolling (19.12 KB, patch)
2006-05-17 05:14 UTC, Rob Wilkens
Details | Diff
Patch to fix this issue (1.41 KB, patch)
2006-06-28 10:01 UTC, Adrian Bunk
Details | Diff
The right version of the patch... (1.43 KB, patch)
2006-06-28 10:19 UTC, Adrian Bunk
Details | Diff

Description Toralf Förster 2006-04-29 05:14:38 UTC
Most recent kernel where this bug did not occur:
Distribution:Gentoo
Hardware Environment:
Software Environment:
Problem Description:

Steps to reproduce:

  UPD     include/linux/compile.h
  CC      init/version.o
  LD      init/built-in.o
  LD      vmlinux
sound/built-in.o: In function `snd_fm801_free':
fm801.c:(.text+0x4120b): undefined reference to `snd_tea575x_exit'
sound/built-in.o: In function `snd_fm801_create':
fm801.c:(.text+0x413c2): undefined reference to `snd_tea575x_init'
make: *** [vmlinux] Error 1
Comment 1 Toralf Förster 2006-04-29 05:14:57 UTC
Created attachment 7983 [details]
kernel config
Comment 2 Toralf Förster 2006-04-29 05:15:18 UTC
Created attachment 7984 [details]
make log
Comment 3 Diego Calleja 2006-05-08 13:12:18 UTC
The bug here is that fm801.c is compiled in the kernel and
CONFIG_SND_FM801_TEA575X=m, so that the following define in fm801.c:

#if (defined(CONFIG_SND_FM801_TEA575X) ||
defined(CONFIG_SND_FM801_TEA575X_MODULE)) && (defined(CONFIG_VIDEO_DEV) ||
defined(CONFIG_VIDEO_DEV_MODULE))
#include <sound/tea575x-tuner.h>
#define TEA575X_RADIO 1
#endif

will enable TEA575X_RADIO when it shouldn't. 


I guess the fix would be to add a "depend CONFIG_SND_FM801_TEA575X" in kconfig??
Comment 4 Diego Calleja 2006-05-08 13:15:51 UTC
ehm sorry, I meant "make it not break when SND_FM801_TEA575X is not enabled as
module"
Comment 5 Diego Calleja 2006-05-08 13:31:57 UTC
Sorry, i was completely blind. There's just *no* way of getting a configuration
like the one you have. It's not possible to get CONFIG_SND_FM801=y and
CONFIG_SND_FM801_TEA575X=m, like your .config has because it's a invalid
configuration (I wonder how it was possible to config it in that way). Please
try to config it again.
Comment 6 Diego Calleja 2006-05-08 13:37:29 UTC
(reject the bug as not reproducible)
Comment 7 Toralf Förster 2006-05-09 05:27:49 UTC
Reproduce this bug using linux-2.6.16-gentoo-r6 :

make mrproper && make menuconfig

then select SND_MPU401_UART=y, now select SND_FM801=y and select
SDND_FM801_TEA575X=m results in :
n22 /mnt/ramdisk/src # make mrproper
awk: cmd. line:1: fatal: cannot open file
`/mnt/ramdisk/src/include/linux/version.h' for reading (No such file or directory)
  CLEAN   scripts/basic
  CLEAN   scripts/kconfig/lxdialog
  CLEAN   scripts/kconfig
  CLEAN   .config include/linux/autoconf.h .kernelrelease
n22 /mnt/ramdisk/src # make menuconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/basic/split-include
  HOSTCC  scripts/basic/docproc
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/kxgettext.o
  HOSTCC  scripts/kconfig/mconf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/lex.zconf.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/mconf
  HOSTCC  scripts/kconfig/lxdialog/checklist.o
  HOSTCC  scripts/kconfig/lxdialog/inputbox.o
  HOSTCC  scripts/kconfig/lxdialog/lxdialog.o
  HOSTCC  scripts/kconfig/lxdialog/menubox.o
  HOSTCC  scripts/kconfig/lxdialog/msgbox.o
  HOSTCC  scripts/kconfig/lxdialog/textbox.o
  HOSTCC  scripts/kconfig/lxdialog/util.o
  HOSTCC  scripts/kconfig/lxdialog/yesno.o
  HOSTLD  scripts/kconfig/lxdialog/lxdialog
scripts/kconfig/mconf arch/i386/Kconfig
#
# using defaults found in arch/i386/defconfig
#
arch/i386/defconfig:13:warning: trying to assign nonexistent symbol CLEAN_COMPILE
arch/i386/defconfig:121:warning: trying to assign nonexistent symbol HAVE_DEC_LOCK
arch/i386/defconfig:171:warning: trying to assign nonexistent symbol PCI_USE_VECTOR
arch/i386/defconfig:173:warning: trying to assign nonexistent symbol PCI_NAMES
arch/i386/defconfig:216:warning: trying to assign nonexistent symbol PARPORT_PC_CML1
arch/i386/defconfig:220:warning: trying to assign nonexistent symbol PARPORT_OTHER
arch/i386/defconfig:247:warning: trying to assign nonexistent symbol BLK_DEV_CARMEL
arch/i386/defconfig:268:warning: trying to assign nonexistent symbol IDE_TASKFILE_IO
arch/i386/defconfig:287:warning: trying to assign nonexistent symbol BLK_DEV_ADMA
arch/i386/defconfig:360:warning: trying to assign nonexistent symbol SCSI_MEGARAID
arch/i386/defconfig:371:warning: trying to assign nonexistent symbol SCSI_CPQFCTS
arch/i386/defconfig:392:warning: trying to assign nonexistent symbol SCSI_QLOGIC_ISP
arch/i386/defconfig:395:warning: trying to assign nonexistent symbol SCSI_QLA2XXX
arch/i386/defconfig:401:warning: trying to assign nonexistent symbol SCSI_QLA6322
arch/i386/defconfig:455:warning: trying to assign nonexistent symbol IEEE1394_CMP
arch/i386/defconfig:472:warning: trying to assign nonexistent symbol NETLINK_DEV
arch/i386/defconfig:506:warning: trying to assign nonexistent symbol
IP_NF_MATCH_LIMIT
arch/i386/defconfig:508:warning: trying to assign nonexistent symbol IP_NF_MATCH_MAC
arch/i386/defconfig:509:warning: trying to assign nonexistent symbol
IP_NF_MATCH_PKTTYPE
arch/i386/defconfig:510:warning: trying to assign nonexistent symbol
IP_NF_MATCH_MARK
arch/i386/defconfig:517:warning: trying to assign nonexistent symbol
IP_NF_MATCH_LENGTH
arch/i386/defconfig:519:warning: trying to assign nonexistent symbol
IP_NF_MATCH_TCPMSS
arch/i386/defconfig:520:warning: trying to assign nonexistent symbol
IP_NF_MATCH_HELPER
arch/i386/defconfig:521:warning: trying to assign nonexistent symbol
IP_NF_MATCH_STATE
arch/i386/defconfig:522:warning: trying to assign nonexistent symbol
IP_NF_MATCH_CONNTRACK
arch/i386/defconfig:537:warning: trying to assign nonexistent symbol
IP_NF_TARGET_MARK
arch/i386/defconfig:538:warning: trying to assign nonexistent symbol
IP_NF_TARGET_CLASSIFY
arch/i386/defconfig:545:warning: trying to assign nonexistent symbol
IP_NF_TARGET_NOTRACK
arch/i386/defconfig:564:warning: trying to assign nonexistent symbol NET_FASTROUTE
arch/i386/defconfig:565:warning: trying to assign nonexistent symbol
NET_HW_FLOWCONTROL
arch/i386/defconfig:717:warning: trying to assign nonexistent symbol SOUND_GAMEPORT
arch/i386/defconfig:773:warning: trying to assign nonexistent symbol QIC02_TAPE
arch/i386/defconfig:809:warning: trying to assign nonexistent symbol DRM_GAMMA
arch/i386/defconfig:985:warning: trying to assign nonexistent symbol
USB_BLUETOOTH_TTY
arch/i386/defconfig:995:warning: trying to assign nonexistent symbol
USB_STORAGE_HP8200e
arch/i386/defconfig:1021:warning: trying to assign nonexistent symbol USB_HPUSBSCSI
arch/i386/defconfig:1056:warning: trying to assign nonexistent symbol USB_TIGL
arch/i386/defconfig:1114:warning: trying to assign nonexistent symbol DEVFS_FS
arch/i386/defconfig:1115:warning: trying to assign nonexistent symbol
DEVPTS_FS_XATTR
arch/i386/defconfig:1243:warning: trying to assign nonexistent symbol
X86_STD_RESOURCES
arch/i386/defconfig:1244:warning: trying to assign nonexistent symbol PC


*** End of Linux kernel configuration.
*** Execute 'make' to build the kernel or try 'make help'.

I'll attach the resulting kernelconfig with next comment.
Comment 8 Toralf Förster 2006-05-09 05:28:44 UTC
Created attachment 8074 [details]
kernel config

got from the steps described above
Comment 9 Diego Calleja 2006-05-09 06:04:34 UTC
I don't understand how you're reproducing this. The SND_FM801_TEA575X option
can't be enabled as module when SND_FM801 is set to y - there's a "depend" line
in the Kconfig, and that makes sure. Try changing it with "make menuconfig":
it's completely impossible to set it by hand. Maybe this is a gentoo bug, or
maybe this is a bug in the config system? Can you set it by hand in the
menuconfig menu?
Comment 10 Daniel Gryniewicz 2006-05-09 09:21:11 UTC
I was able to reproduce this on stock 2.6.16, following the instructions above:

[12:09:56 nox] linux-2.6.16# grep FM801 .config
CONFIG_SND_FM801=y
CONFIG_SND_FM801_TEA575X=m

  LD      .tmp_vmlinux1
sound/built-in.o: In function `snd_fm801_free':
fm801.c:(.text+0x3b1f7): undefined reference to `snd_tea575x_exit'
sound/built-in.o: In function `snd_fm801_create':
fm801.c:(.text+0x3b407): undefined reference to `snd_tea575x_init'
make: *** [.tmp_vmlinux1] Error 1

It does not appear to be a gentoo bug.
Comment 11 Diego Calleja 2006-05-09 11:18:00 UTC
Oh wait, I got it _completely_ wrong (Kconfig manages to breaks my mind)

The problem is that the combination of SND_FM801=y and SND_FM801_TEA575X=m is
just not possible: sound/pci/fm801.c has coder under a ifdef which needs
sound/i2c/other/tea575x-tuner.c when it's compiled inside the kernel.

IOW: It's neccesary that when SND_FM801=y, SND_FM801_TEA575 can only be disabled
or set to "y", but at the same time it must be compilable as module when
SND_FM801=m. Currently the Kconfig sets a "depends on SND_FM801" in the
SND_FM801_TEA757X entry, but that allows to set SND_FM801_TEA575X as module when
SND_FM801=y 


I've no idea of what Kconfig trickery must be neccesary here to make it fly.
Adrian, do you know what it's neccesary here?
Comment 12 Rob Wilkens 2006-05-16 12:26:20 UTC
I don't have the hardware to test it, so I'm hesitant to do my own debugging (I
might anyway), but a brief I looked at Diego's comments then I looked inside the
source a little.

There's a strange dependency, where it appears that if you EVER want to build
the TEA driver as a module, you have to do it at the same time you build the
FM801 module.  That is, the module(s) are not independent, so why bother
building them as modules??

Ideally, the FM801 driver should be modified to stand on its own YET at the same
time allow the TEA module to be loaded later.  I'm by no means an expert, but I
would say most of the #ifdefs related to the TEA module that are in the FM801
module should be removed and the modules should be made to stand on their own
AND work together (*Realizing there should be a dependency that if the TEA
module loads then the FM801 modules needs to be loaded beforehand).

Rob
Comment 13 Diego Calleja 2006-05-16 16:43:42 UTC
It's not easy. The problem is that there's a source-level dependendy from FM801
on TEA, not tracked by Kconfig.

I don't know if the modules could be made "less dependent" though.
Comment 14 Rob Wilkens 2006-05-17 05:14:55 UTC
Created attachment 8123 [details]
BAD PATCH do not apply - just to get ball rolling

This is NOT a patch-patch.  It's only something to get the wheels spinning,
something to consider.	Last I checked, this compiles.. But when it does the
module portion of the build, there is a WARNING that a global variable I
created is not accessible.  I know, globals are bad, but this at least gets the
problem solving process started.

What I'm TRYING to do here:
I created a global called fm801_tea575_loaded, and put it in the fm801 module,
initialized to zero.  Inside of the TEA575 module, I use "extern int" to pull
in that variable and set it to 1 when the module loads.  Back in fm801 module,
all the functions that are dependent on tea575 before executing will now CHECK
to see if that variable is zero or one, and either execute or not execute,
depending on whether or not it is loaded.

Yes, by the way, I realize:
(1) If the tea module is unloaded, the variable should be set BACK to zero.
(2) I'm probably using global variables wrong.	Perhaps the tea575 driver could
make a function call instead of directly setting the variable, and that
function call could set the global variable.  

Sorry, I haven't done kernel programming (or much else) in nearly 10 years now.


-Rob
Comment 15 Adrian Bunk 2006-06-28 10:01:13 UTC
Created attachment 8439 [details]
Patch to fix this issue
Comment 16 Adrian Bunk 2006-06-28 10:19:52 UTC
Created attachment 8440 [details]
The right version of the patch...
Comment 17 Adrian Bunk 2006-07-16 05:03:36 UTC
This patch is now inluded in Linus' tree.
Comment 18 Andy Shevchenko 2006-08-08 02:26:30 UTC
*** Bug 6972 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.