I don't think -O2 will solve the problem in this case but it does, if a function is declared as "extern inline". Basically this qualifier tells gcc to inline the function (strictly). If gcc is not able to inline, then gcc will produce a non-linkable format of the function and linker will report undefined reference for the function. When the function (declared as extern inline) is compiled with -O2, gcc can inline it and produces linkable format and linker will not complain. You can try compiling this small program with and without -O2 to see the result. extern inline int function(int a) { return a*a; } int main(void) { printf("%d\n", function(6)); return 0; } Regards Mohanlal ----- Original Message ----- From: "Christophe Lucas" <c.lucas@ifrance.com> To: <kernelnewbies@nl.linux.org> Sent: Thursday, May 06, 2004 3:08 PM Subject: Re: Unresolved symbol during insmod > Saifuddin (saif@odysseytec.com) wrote: > > > > > > The command that i used to compile the module was: > > > > > > ---snip--- > > > gcc -Wall -DMODULE -D__KERNEL__ -DLINUX -c mod.c > > > -I/lib/modules/`uname -r`/build/include/ > > > ---snap--- > > > > Try using -O2 while compiling. It should solve your problem..... > > I must be wrong, but why -O2 will solve his unresolved symbol problem ? > > I can read this in gcc manual : > -O2 Optimize even more. GCC performs nearly all supported optimizations > that do not involve a space-speed tradeoff. The compiler does not > perform loop unrolling or function inlining when you specify -O2. As > compared to -O, this option increases both compilation time and the > performance of the generated code. > > I would be happy to know the reason if this flag solve his problem. > > -- > Regards > > Christophe > > * GNU/Linux & UNIX developer and network administrator > * Membre RotomaLUG (http://www.rotomalug.org) > * Registered User #271267 > * Email: c.lucas@ifrance.com > * Web Site: http://odie.mcom.fr/~clucas/ > > -- > Kernelnewbies: Help each other learn about the Linux kernel. > Archive: http://mail.nl.linux.org/kernelnewbies/ > FAQ: http://kernelnewbies.org/faq/ > > -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/