https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103080
--- Comment #3 from Iain Sandoe <iains at gcc dot gnu.org> --- (In reply to hubicka from comment #1) > The cdtor merging code is predating LTO - it is also used for collect2 > path on targets w/o cdtor sections. Even so, I do not see how it can work there either*** - within a single built __GLOBAL_I_xxxxxx we would have the CTOR order reversed from the source. There is nothing collect2 can do to fix that ;) > I guess the DECL_UID compare is not very safe things to do since it > depends on the tree merging decisions. I agree it looks very fragile to depend on DECL_UID ordering (unless there is a strong guarantee that the UID value indicates definition order (what about declarations that become definitions later in the TU - but with different ordering?). > We do not record declaration > order to LTO time, however we have order of definitions which would be > cgraph_node::get (f1)->order Presumably, something new would need to be streamed - or would the relative ordering of the functions be preserved ? === *** I was also looking a while ago at making collect2 do init_prio on Darwin - but making it work with LTO seems quite a bit of lifting still to do....