Hideto Ishibashi wrote:
(...)
> Let me ask you a question.
>
> How do I need to specify the options at linking?
> Please tell me the options for `ld', which you use in your
> Makefile/command line.
>
> In fact, I try to do it with my code, but I failed.
> Although the compile and link are success, I got errors
> at loading with insmod. The errors are something like;
> unreferrenced symbol __eh_pc, __rtti_user, __throw.
(...)
Depends on what you are linking, but here's the basics of my
makefile...
#--------------------------------
INC = /usr/src/rtl/include
DINC = /home/src/proj/include
CB = /usr/lib/gcc-lib/i386-redhat-linux/2.7.2.3/crtbegin.o
CE = /usr/lib/gcc-lib/i386-redhat-linux/2.7.2.3/crtend.o
CF = -O2 -Wall
mod_tmp.o: mod.cc mod.h
g++ -I${DINC} -I${INC} ${CF} -D__KERNEL__ -D__RT__ -c mod.cc -o
mod_tmp.o
mod.o: mod_tmp.o
ld -Ur -static -o mod.o $(CB) mod_tmp.o $(CE) -L/usr/lib -lm
-L/usr/lib/gcc-lib/i386-redhat-linux/2.7.2.3/ -lgcc -lg++
#--------------------------------
Note that $(CB) most be linked in before all .o-files with
ctors/dtors, and $(CE) after them. This is how
__do_global_ctors_aux() and __do_global_dtors_aux() gets
to know what to do. Also, note that some functions in libmath,
libgcc and libg++ cannot be used, as they will require linking
in functions not useble from within modules! You may provide
your own "kernel friendly" replacements for those functions,
if necessary.
Hope I didn't miss any important detail here... Anyway, for
init_module() and cleanup_module(), the same rules as for
Linux drivers apply, but for RT tasks, no kernel functions
must be called! So make sure you know what a function does
before using it in an RT task...
Don't know if the search engine works now, but there have
been some posts on these matters before.
//David
--- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
----
For more information on Real-Time Linux see:
http://www.rtlinux.org/~rtlinux/