This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ordering of constructors


Thanks for all the interesting responses to my question.  Am I correct to
summarize that there is currently no simple way to guarantee ordering of
global constructors?  (A couple of methods were suggested, but if I
understand correctly, none are guaranteed to work?)

If this is true, I'd like to consider a couple of solutions.  I'm thinking
of 3 approaches.

1) Doesn't ld have all the info needed to correctly order constructors
already?

2) A seperate tool can read depenencies and use tsort or similar to produce
an ordering, then annotate the source with __attribute__((init_priority)). 
Or perhaps __attribute__((init_priority)) can be written to a separate
file?  (That would be easier).  In this scenario, the dependencies have to
be specified manually by the user.

3) ld modified to read dependencies and then proceed similar to 2).



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]