C++ problems with sh4
Alexandra Kossovsky
sasha at oktet.ru
Mon Nov 5 15:06:42 UTC 2001
On Mon, Nov 05, 2001 at 07:06:42AM -0600, Joel Sherrill wrote:
>
> Alexandra Kossovsky wrote:
> >
> > Hi!
> >
> > I have gensh4 bsp, and I need C++ to work.
> > It worked perfectly with ss-20010816
> >
> > Now, in ss-20011017 (or ss-20011025) it does not work.
> > The problem is with global constructors -- they are not called.
> >
> > gcc does not define __USE_INIT_FINI__ for sh4.
> > In 'gcc-2.95.3/gcc/config/sh/elf.h' there is:
> > ---------
> > /* Arrange to call __main, rather than using crtbegin.o and crtend.o
> > and relying on .init and .fini being executed at appropriate times. */
> > ---------
> >
> > In ss-20010816 gcc calls '__do_global_ctors' on the begining of 'main()',
> > and all is OK. In ss-20011025 where are no 'main()'.
> >
> > What can I do?
> > Should I patch gcc to do all this things through init & fini ?
> > Or something else?
>
> We did this because making main() available in user space is generally
> a good thing.
>
> Hmm... I see two possibilities. As an experiment, change the name of
> the first task to main() and verify things work.
OK, it works.
> If that does in fact work, then we might want make the toolset
> define __USE__MAIN__ and have an alternative next to the
> __USE_INIT_FINI__.
> That presupposes that this won't result in the global ctors being
> called twice if someone uses main().
It would be fine. Can I help with this work?
--
Alexandra Kossovsky
OKTET Ltd.
1 Ulianovskaya st., Petergof, St.Petersburg, 198904 Russia
Phones: +7(812)428-43-84(work) +7(812)184-52-58(home) +7(812)956-42-86(mobile)
e-mail: sasha at oktet.ru (or sasha at gate.ort.spb.ru)
More information about the users
mailing list