On Mon, Jan 29, 2024 at 02:01:56PM -0800, H.J. Lu wrote: > > A function accesses a function symbol defined in a comdat group. > > If the function symbol is public, any comdat definition of the same group > > signature should provide the function definition. If the function symbol > > is private to the comdat group, only functions in the same comdat > > group can access the private function symbol. If a function in a different > > comdat group accesses a private symbol, it is a compiler bug and > > link may catch it like in this case. > > > > My patch simply puts the constant pool of the function symbol reference > in the same comdat group as the function definition. I believe it is the > right thing to do.
I disagree, I think we should use something like if (current_function_decl) return targetm.asm_out.function_rodata_section (current_function_decl, true); Obviously, for non-reloc or non-pic, we don't want an unconditional if (current_function_decl) return targetm.asm_out.function_rodata_section (current_function_decl, false); that would kill mergeable sections, so perhaps if (current_function_decl && reloc && DECL_COMDAT_GROUP (current_function_decl)) return targetm.asm_out.function_rodata_section (current_function_decl, false); Jakub