[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: [rtl] Follow-Up to Constructors/Destructors



Richard Prescott wrote:

> 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?)
>

No. I have several objects, even if none has a destructor.
(By the way, I tried to add an empty destructor and I got "free undefined").

Daniele

--- [rtl] ---
For more information on Real-Time Linux see:
http://rtlinux.cs.nmt.edu/