On Wed, Jan 31, 2024 at 08:48:33AM -0800, H.J. Lu wrote: > Which function (target hook) can I use to generate > > .section .data.rel.ro.local,"awG",@progbits,_ZN1AIxE3fooExx,comdat
Just if (decl) return get_section (reloc == 1 ? ".data.rel.ro.local" : ".data.rel.ro", SECTION_WRITE | SECTION_RELRO | SECTION_LINKONCE, decl); for the first hunk and else if (decl) return get_section (".rodata", SECTION_LINKONCE, decl); in the second case? Haven't tried it though, maybe the get_section section conflict stuff isn't able to handle it (and perhaps that is the reason why we simply don't emit functions into .section .text,"axG",@progbits,whatever,comdat sections instead of .section .text.function_name,"axG",@progbits,whatever,comdat In such case, we could append something to those section names, like const.pool (or whatever else that couldn't clash with function names, so needs probably a dot somewhere). Could be .data.rel.ro.local.const.pool .data.rel.ro.const.pool or .data.rel.ro.local..shared .data.rel.ro..shared or something similar, but .data.rel.ro.local.shared would not be ok, because it could clash with .data.rel.ro.local section for shared function. > > Another question is if we need to do anything about the > > DECL_COMDAT_GROUP (decl) && DECL_SECTION_NAME (decl) > > && startswith (DECL_SECTION_NAME (decl), ".gnu.linkonce.t.") > > case (older linkers) (i.e. when using years old GNU linkers). > > > > Should we support such targets? It is not easy for me to test it. Perhaps let's wait if somebody files an issue with such configuration. Jakub