https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113617

--- Comment #17 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:1931c40364bb9fb0a7c4b650917e3ac0e88bf6f4

commit r14-9185-g1931c40364bb9fb0a7c4b650917e3ac0e88bf6f4
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Mon Feb 26 17:55:07 2024 +0100

    varasm: Handle private COMDAT function symbol reference in readonly data
section [PR113617]

    If default_elf_select_rtx_section is called to put a reference to some
    local symbol defined in a comdat section into memory, which happens more
often
    since the r14-4944 RA change, linking might fail.
    default_elf_select_rtx_section puts such constants into .data.rel.ro.local
    etc. sections and if linker chooses comdat sections from some other TU
    and discards the one to which a relocation in .data.rel.ro.local remains,
    linker diagnoses error.  References to private comdat symbols can only
appear
    from functions or data objects in the same comdat group, so the following
    patch arranges using .data.rel.ro.local.pool.<comdat_name> and similar
sections.

    2024-02-26  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.

Reply via email to