This is the mail archive of the
ecos-discuss@sourceware.cygnus.com
mailing list for the eCos project.
Re: initialization priority workaround
- To: James Robertson <James dot Robertson at eng dot sun dot com>
- Subject: Re: [ECOS] initialization priority workaround
- From: Jonathan Larmour <jlarmour at redhat dot co dot uk>
- Date: Thu, 17 Feb 2000 20:26:12 +0000
- CC: ecos-discuss at sourceware dot cygnus dot com
- Organization: Red Hat UK Ltd.
- References: <libSDtMail.200002171142.20879.jamesr@mamacita>
James Robertson wrote:
>
> Hi,
> I'm building eCos using gcc 2.8.1. Yes, this gcc doesn't support the
> initialization priority feature that eCos uses for constructor ordering.
> Unfortunately, this is a custom modified gcc, and I'm not able to upgrade to
> 2.95 at this time. I've written a perl script to reorder the __CTOR_LIST__ by
> hand, but I was wondering if there were any better workarounds. Did you have any
> workaround before you put the constructor ordering in gcc?
We hacked the linker script to manually order the constructors in the
__CTOR_LIST__ by matching the various object files the constructor symbols
came from. Like so (from the old code):
#ifdef CYG_KERNEL_USE_INIT_PRIORITY
__CTOR_LIST__ = .;
KEEP(*(SORT(.ctors*)))
__CTOR_END__ = .;
__DTOR_LIST__ = .;
KEEP(*(SORT(.dtors*)))
__DTOR_END__ = .;
#else
__CTOR_LIST__ = .;
*sched.o(.ctors*)
*clock.o(.ctors*)
*thread.o(.ctors*)
*(.ctors*)
__CTOR_END__ = .;
__DTOR_LIST__ = .;
*(.dtors)
__DTOR_END__ = .;
#endif
To be honest, your perl script is probably the best thing in the absence of
the compiler feature.
Jifl
--
Red Hat, 35 Cambridge Place, Cambridge, UK. CB2 1NS Tel: +44 (1223) 728762
"Plan to be spontaneous tomorrow." || These opinions are all my own fault