http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617
--- Comment #39 from Jack Howarth <howarth at nitro dot med.uc.edu> 2013-02-02 18:16:39 UTC --- While testing whether the single qsort was sufficient, the origin of the problem on darwin was clarified. In machopic_asm_out_constructor, after the vec_safe_push, the constructors are output as... new_elt.position = 0 new_elt.priority = 65535 new_elt.position = 1 new_elt.priority = 99 which my current patch reorders as... elt->position = 1 elt->priority = 99 elt->position = 0 priority = 65535 since darwin sets #undef SUPPORTS_INIT_PRIORITY #define SUPPORTS_INIT_PRIORITY 0 in gcc/config/darwin.h, all constructors are set to #define DEFAULT_INIT_PRIORITY 65535 in gcc/collect2.c. So all of the constructors emitted are actually of a 'higher' priority and that is why I had to reverse the sort on priority from what Jakub suggested in Comment 34. FYI, darwin doesn't compile code with priorities on constructors/destructors so they will always the default init priority... initpri2.C:5:38: error: constructor priorities are not supported