This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: __CTORS__
>>>>> "Rafael" == Rafael Rodríguez Velilla <rrv@tid.es> writes:
Rafael> Why do you say that they are sorted according to their
Rafael> priority? I have read that you can configure with CDL the
Rafael> priority that determines when the different actions are
Rafael> taken. How do I tell gcc which constructor is more prioritary?
There's a compiler attribute for that:
#if defined(__cplusplus) && defined(__GNUC__)
# define CYGBLD_ATTRIB_INIT_PRI( _pri_ ) __attribute__((init_priority(_pri_)))
#else
// FIXME: should maybe just bomb out if this is attempted anywhere else?
// Not sure
# define CYGBLD_ATTRIB_INIT_PRI( _pri_ )
#endif
This is used a few places in the eCos code to control in which order
various constructors get run. Grep for CYGBLD_ATTRIB_INIT_PRI in the
sources.
Rafael> Let me ask another question... While I was looking for
Rafael> where in hell was defined __CTOR_LIST__ I have searched
Rafael> through lots of source files almost manually (grep
Rafael> __CTOR_LIST__ *). I'm sure that there's a simpler way to find
Rafael> where a symbol comes from, Can anyone of you tell me if
Rafael> there's such a utility?
Are you kidding? Grep is the best thing since sliced bread! :)
This is what I use (it's in a file called grepf):
find . -name "*.[chSs]" -or -name "*.cxx" -or -name "*.java" \
-or -name "*.cpp" -or -name "*.ht" -or -name "*.hxx" \
-or -name "*.in[cl]" -or -name "*.ld" -or -name "*.cdl" \
-or -name "*.ect" -or -name "*.db" | sed 's/.*SCCS.*//;' |\
xargs grep -n "$@"
It's not pretty, but it works very well.
Jesper