https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113183
--- Comment #12 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Sebastian Unger from comment #11) > I see. It was the SORT_BY_INIT_PRIORITY with the section name used not > actually having a priority that triggered it, was it?! If I change the > section name to .init_array.1 then it works. > > But, yes, you suggestion using the constructor attribute is even better. > > Thank you very much. > > I suspect it would still be better to not crash though. ;-) Changing the linker script to: ``` .preinit_array : { KEEP(*(SORT_BY_INIT_PRIORITY(".preinit_array.*"))) KEEP (*(.preinit_array)) } >"LOADER_REGION" __preinit_array_start = ADDR(.preinit_array); __preinit_array_end = ADDR(.preinit_array) + SIZEOF(.preinit_array); .init_array : { KEEP(*(SORT_BY_INIT_PRIORITY(".init_array.*"))) KEEP (*(.init_array)) } >"LOADER_REGION" ``` Also fixes the ICE if you don't want to change to use the constructor attribute.