[lkml]   [2003]   [Jan]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectProblem of undefined reference

Wish you all a happy new year.

I appologize in case you are getting multiple copies of this message.

I am facing the problem of "undefined reference" for my task of using
extended functionality of linux kernel (2.4.18) as detailed below. I shall
appreciate any suggestion to solve the problem.

I would like to incorporate new functions into linux kernel. Therefore I
created a file f.c with function "void foo()". Source f.c uses header file
f.h. The header file "f.h" has declaration "extern void foo(void);". I
included f.o in the obj-y in the Makefile in the corresponding directory. I
could build the new kernel without any error or warning.

Now, I intended to use the extended functionality of the kernel from my
program. I wrote g.c which calls foo(); I have included header f.h in g.c.
However when I build g, I get the error:

"g.o(.text+ox35): undefined reference to `foo`".

I am unable to understand why "foo" is not resolved as the resident kernel
ius built with object f.o. To diagonose the problem further I did the
follwing things which could neither solve my problem.

i) Used "EXPORT_SYMBOL(foo);" in f.c and had f.o included in export-objs in
the Makefile. ==> I still get the problem of undefined reference

ii) Defined library libf.a based on f.o and included the library for
building g. ==> The kernel is agin built ok. I could see (using nm) that the
symbol foo in defined with type T. However, when building g, I am getting
lot of undefined references to kernel variables and routines that are used
in foo.

I shall appreciate any suggestion or alternative for solving the problem.



MSN 8 with e-mail virus protection service: 2 months FREE*

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:32    [W:0.038 / U:6.416 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site