https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97803
--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> --- (In reply to Richard Biener from comment #1) > Does it work if you add -fno-toplevel-reorder? SHF_GNU_RETAIN should > preserve the order of vars even if 'used' then. Linker will reorder section layout when SHF_GNU_RETAIN is used.