https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70422
--- Comment #7 from Jim Wilson <wilson at gcc dot gnu.org> --- The function alloc_entries calls fancy_abort with __func__, causing the string to get into the output. This function is inlined into the hash_table expand function, which is then in turn inlined into other functions. Without debug info, there is a single reference to this string, in the hash_table expand function, so it gets emitted into the comdat rodata section for that function. With debug info, we have multiple references to this string. One is in the code for the expand function. The others are symbol table entries for the inlined instances of the alloc_entries and/of hash_table expand functions. dwarf2out calls output_constant_def to get the rtl for a string. output_constant_def calls build_constant_desc which generates the rtl for a string. Without flag_section_anchors, build_constant_desc generates a SYMBOL_REF, and the placement to a section happens later. With flag_section_anchors, build_constant_desc generates a label in a specific section. It calls get_constant_section to get the section, which calls select_section, which is default_elf_select_section, which calls mergeable_constant_section, which calls function_mergeable_rodata_prefix, which uses current_function_decl. So the section placement depends on which function we happen to be in when we see the first reference to the string, which in this case is curr_statistics_hash. So the string gets emitted into different sections with and without debug info when flag_sections_anchors is true. It seems like there are some conflicting goals here. We want to share the string across functions, but we also want to put it in function specific comdat sections. We want the same code with and without debug info, but we have more references to the string with debug info than without. It isn't clear what the solution is. It does appear that the fundamental problem is that the section anchors support in build_constant_desc should not be choosing a section when it is called from dwarf2out.c. The section should be chosen later somehow. Or perhaps just not for debug info references. Not clear how to handle this as the moment.