https://sourceware.org/bugzilla/show_bug.cgi?id=32083

--- Comment #4 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The binutils-2_43-branch branch has been updated by H.J. Lu
<h...@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=92b6ecd5589fb7db9f28dba41978f87974312aa5

commit 92b6ecd5589fb7db9f28dba41978f87974312aa5
Author: H.J. Lu <hjl.to...@gmail.com>
Date:   Wed Aug 14 20:50:02 2024 -0700

    lto: Don't include unused LTO archive members in output

    When plugin_object_p is called by elf_link_is_defined_archive_symbol to
    check if a symbol in archive is a real definition, set archive member
    plugin_format to bfd_plugin_yes_unused to avoid including the unused LTO
    archive members in linker output.  When plugin_object_p is called as
    known used, call plugin claim_file if plugin_format is bfd_plugin_unknown
    or bfd_plugin_yes_unused.

    To get the proper support for archives with LTO common symbols with GCC,
    the GCC fix for

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

    is needed.

    bfd/

            PR ld/32083
            * archures.c (bfd_arch_get_compatible): Treat bfd_plugin_yes_unused
            the same as bfd_plugin_yes.
            * elflink.c (elf_link_is_defined_archive_symbol): Likewise.
            * bfd.c (bfd_plugin_format): Add bfd_plugin_yes_unused.
            * plugin.c (try_claim): Try claim_file_v2 first.
            * bfd-in2.h: Regenerated.

    ld/

            PR ld/32083
            * plugin.c (plugin_call_claim_file): Add an argument to return
            if LDPT_REGISTER_CLAIM_FILE_HOOK_V2 is used.
            (plugin_object_p): When KNOWN_USED is false, we call plugin
            claim_file if plugin_format is bfd_plugin_unknown and set
            plugin_format to bfd_plugin_yes_unused on LTO object.  When
            KNOWN_USED is true, we call plugin claim_file if plugin_format
            is bfd_plugin_unknown or bfd_plugin_yes_unused.

    Signed-off-by: H.J. Lu <hjl.to...@gmail.com>
    (cherry picked from commit a6f8fe0a9e9cbe871652e46ba7c22d5e9fb86208)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to