Re: 2.1.22 unneeded global symbols

Thomas Koenig (ig25@fg70.rz.uni-karlsruhe.de)
28 Jan 1997 10:15:08 +0100


In linux.dev.kernel, alan@lxorguk.ukuu.org.uk (Alan Cox) wrote:

>Ah but the following isnt going to work

>foo.c
>
>static void flobble(int x)
>{
> printf("Kersplat\n");
>}
>
>
>
>bar.c
>
>extern void flobble(int);
>
>int main()
>{
> register_kersplat_handler(flobble);
>}

Correct.

However, if you changed flobble to extern, my script would no longer
complain about flobble, since it would find a reference to flobble in
both bar.c and foo.c (undefined in bar.c):

[changed 'static' to 'extern' in foo.c, compiled with cc -c]

$ nm *.o

bar.o:
U flobble
00000000 t gcc2_compiled.
00000000 T main
U register_kersplat_handler

foo.o:
00000000 T flobble
00000000 t gcc2_compiled.
U printf