On Wed, Jan 31, 2024 at 07:58:50PM +0100, Jakub Jelinek wrote:
> On Wed, Jan 31, 2024 at 07:11:20PM +0100, Jakub Jelinek wrote:
> > On Wed, Jan 31, 2024 at 09:39:12AM -0800, H.J. Lu wrote:
> > > GNU binutils has no issues with it:
> > 
> > I know, I meant gcc.
> > So, it seems get_section handles section purely by name lookup
> > and isn't prepared to deal with multiple different sections
> > of the same name, but different comdat group.
> > 
> > Thus, maybe at least temporarily we need to use unique
> > section names here, say
> > .data.rel.ro.local.pool.<comdat_name>
> > .data.rel.ro.pool.<comdat_name>
> > .rodata.pool.<comdat_name>
> > where <comdat_name> would be the name of the comdat group, i.e.
> > IDENTIFIER_POINTER (DECL_COMDAT_GROUP (decl))
> 
> Here is an untested patch which implements that:
> 
> 2024-01-31  Jakub Jelinek  <ja...@redhat.com>
>           H.J. Lu  <hjl.to...@gmail.com>
> 
>       PR rtl-optimization/113617
>       * varasm.cc (default_elf_select_rtx_section): For
>       references to private symbols in comdat sections
>       use .data.relro.local.pool.<comdat>, .data.relro.pool.<comdat>
>       or .rodata.<comdat> comdat sections.
> 
>       * g++.dg/other/pr113617.C: New test.
>       * g++.dg/other/pr113617.h: New test.
>       * g++.dg/other/pr113617-aux.cc: New test.

Bootstrapped/regtested on x86_64-linux and i686-linux successfully,
ok for trunk?

        Jakub

Reply via email to