[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: [rtl] Follow-Up to Constructors/Destructors
On Thu, 30 Apr 1998, Daniele Lugli wrote:
> Colin Leister wrote:
>
> > ...Several of them mentioned calling constructors and destructors for
> > global objects explicitly. I wanted to add that this is not necessary
> > if you're
> > using gcc and only slightly modify your code and your makefile.
> >
> > In init_module() add a call to __do_global_ctors_aux(), and in
> > cleanup_module() add a call to
> > __do_global_dtors_aux().
> >
> > In your makefile incorporate these changes:
> >
> > CRT_BEG= /the_correct_gcc-lib_path/crtbegin.o
> > CRT_END= /the_correct_gcc-lib_path/crtend.o
> >
> > On the link line that specifies all your object files, in front of the
> > first .o file, add ${CRT_BEG}.
> > After the last .o file, add ${CRT_END}.
> >
> > e.g. ld -Ur -static -o module.o ${CRT_BEG} file1.o file2.o file3.o
> > ${CRT_END}
>
> I tried your suggestion but at insmod I got
>
> __do_global_ctors_aux undefined
> __do_global_dtors_aux undefined
>
It's maybe du to gcc optimisation ?
(no global objects to construct and destroy?)
Richard
> Loading failed! The module symbols (from linux-2.0.29) don't match your
> linux-2.0.29
>
> I don't know why. I verified that crtbegin.o and crtend.o really do
> contain the correct functions, even if it looks strange to me that
> __do_global_ctors_aux is in crtend.o and __do_global_dtors_aux in
> crtbegin.o. But this should not be the cause of "loading failed", as I
> tried to exchange the two files and nothing changed.
> Any idea?
>
> Best regards, Daniele
>
> --- [rtl] ---
> For more information on Real-Time Linux see:
> http://rtlinux.cs.nmt.edu/
>
<>---------------------------------------------------------------------<>
Richard Prescott <rip@step.polymtl.ca>
SAE Robotique - Ecole Polytechnique de Montreal
Pensee du jour :
echo "\$0&\$0">_;chmod +x _;./_
<>---------------------------------------------------------------------<>
--- [rtl] ---
For more information on Real-Time Linux see:
http://rtlinux.cs.nmt.edu/