On Wed, Feb 6, 2013 at 7:44 AM, Jack Howarth <howa...@bromo.med.uc.edu> wrote: > On Wed, Feb 06, 2013 at 07:36:06AM -0800, Ian Lance Taylor wrote: >> On Wed, Feb 6, 2013 at 7:14 AM, Alexander Potapenko <gli...@google.com> >> wrote: >> > >> > I understand and fully support your desire for intra-module ctor/dtor >> > priority. >> > My comment was meant to reply to Mike (sorry for top-posting it, >> > again), who, as far as I understood him, wanted to see full >> > init_priority support on Darwin, which IIUC can't be implemented >> > without the proper linker support. LTO may help as a bandaid, but I >> > don't think this solution scales well enough yet. >> >> It could be done using collect2. Though it would be a bit tedious to write. > > Ian, > Don't you need assembler support for the constructor init priorities to be > called in the correct order when they reside in static or shared libraries? > I couldn't puzzle out how collect2 can help with that issue.
collect2 sees the whole link. It can gather all the constructors together and sort them. Ian