https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92183
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #3) > It should be easy to fix this in default_elf_select_rtx_section. > > before calling mergeable_constant_section check reloc and return rodata if > reloc is true. > > Let me see if that fixes this. yes that fixed it: ``` .section .rodata .align 8 .LC2: .quad .LC0 .align 8 .LC3: .quad .LC1 ``` The patch itself: ``` diff --git a/gcc/varasm.cc b/gcc/varasm.cc index 0d78f5b384f..891b4437f1c 100644 --- a/gcc/varasm.cc +++ b/gcc/varasm.cc @@ -7757,6 +7757,10 @@ default_elf_select_rtx_section (machine_mode mode, rtx x, return get_section (name, flags | SECTION_LINKONCE, decl); } + /* Don't output relocations into mergeable sections. */ + if (reloc) + return readonly_data_section; + return mergeable_constant_section (mode, align, 0); } ```