Re: sound blaster driver as a module

Urban Widmark (urban@svenskatest.se)
Tue, 29 Dec 1998 22:26:22 +0100 (MET)


On Tue, 29 Dec 1998, Alan Cox wrote:

> > If I compile the sound blaster driver as a module (just that, not the
> > general sound support or OSS) then I get an undefined symbol
> > mod_firmware_load trying to load sb.o. I can fix it by manually linking
> > the sb module with sound_firmware.o which is made for me. This is a
> > little unconvenient though as I have to make this a module since I use
> > isapnp. I'm assuming this would work correctly if I made all of the sound
> > support a module?
>
> It does then. It should in all cases. I've been over this one a couple of times
> and not yet figured out quite what is going on. Its probably something very
> simple and silly.
>
> Alan
>

mod_firmware_load is the only exported name from sound_firmware.o

When compiling sb.o as a module there is nothing in the kernel that
references anything in sound_firmware.o, and therefore ld does not include
it in the kernel. (assuming no other soundcards are involved) A small
example:

a.c:
int func_a() { return 1; }

b.c:
int func_b() { return 1; }
int func_b2() { return 2; }

After compiling, create an archive:
% ar rcs misc.a a.o b.o

main.c:
int main() { return func_b2(); }

% gcc -o main main.c misc.a
% nm main | grep func
08048554 T func_b
08048564 T func_b2

The simple fix would be to move sound_firmware.c to sound_core.c, and
perhaps waste some space. In this case sound_firmware.c should perhaps be
included in the module, but at least msnd_pinnacle.c uses it as a non
module, so it can't be module only.

I have tried doing the same as the above example with an actual kernel.
When adding a fake call to mod_firmware_load the symbol can be seen using
nm on vmlinuz (which I assume is the same as what the modules see).

/Urban, not managing to be as brief as Alan usually is, in spite of the
"compressed" indentation used :)

---
Urban Widmark                           urban@svenskatest.se
Svenska Test AB                         +46 90 71 71 23

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/