https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99759
Alan Modra <amodra at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |amodra at gmail dot com Status|WAITING |NEW --- Comment #2 from Alan Modra <amodra at gmail dot com> --- > this means the ctors.65535 will come last. Nope, it will come first. And since DT_INIT_ARRAY pointers are executed in the order they appear in the array, it will be one of the first to run. .init_array and .ctors sorting is complicated. ld.bfd will sort .init_array.0 (highest priority .init_array section) and .ctors.65535 (highest priority .ctors section) together. I assume this comment: > The input section description is quite close but does not sort .init_array.* > and .ctors.* with the same priority together. is referring to lld. > I don't see any issue here really in the end because GCC will produce > init_array most of the time. So the issue really is that lld doesn't support mixing of .ctors.* and .init_array.*. It might be nice for libgcc to use .init_array.0 here instead of .ctors.65536 whenever gcc will use .init_array in compiled code.