Here we are placing constant values that have relocations into mergeable sections, many linkers don't support handling of that merging that section so they ignore the mergeability bit at that point. So instead just place them into the normal readonly section.
Note categorize_decl_for_section will do this already for generic decls, this just fixes the rtx constant pool selection. Bootstrapped and tested on x86_64-linux-gnu. PR middle-end/92183 gcc/ChangeLog: * varasm.cc (default_elf_select_rtx_section): If there are relocs, select readonly data section instead of mergeable sections. Signed-off-by: Andrew Pinski <andrew.pin...@oss.qualcomm.com> --- gcc/varasm.cc | 4 ++++ 1 file changed, 4 insertions(+) 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); } -- 2.43.0