public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/109128] [Offload][OpenMP][OpenACC] Static linking with unused offload function will lead to mismatch number of offload fn/symbols
Date: Thu, 11 May 2023 08:09:08 +0000	[thread overview]
Message-ID: <bug-109128-4-W4Pt3k82oi@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109128-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tobias Burnus <burnus@gcc.gnu.org>:

https://gcc.gnu.org/g:c49d51fa8134f6c7e6c7cf6e4e3007c4fea617c5

commit r14-677-gc49d51fa8134f6c7e6c7cf6e4e3007c4fea617c5
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Thu May 11 10:07:00 2023 +0200

    Implement LDPT_REGISTER_CLAIM_FILE_HOOK_V2 linker plugin hook [PR109128]

    This is one part of the fix for PR109128, along with a corresponding
    binutils's linker change.  Without this patch, what happens in the
    linker, when an unused object in a .a file has offload data, is that
    elf_link_is_defined_archive_symbol calls bfd_link_plugin_object_p,
    which ends up calling the plugin's claim_file_handler, which then
    records the object as one with offload data. That is, the linker never
    decides to use the object in the first place, but use of this _p
    interface (called as part of trying to decide whether to use the
    object) results in the plugin deciding to use its offload data (and a
    consequent mismatch in the offload data present at runtime).

    The new hook allows the linker plugin to distinguish calls to
    claim_file_handler that know the object is being used by the linker
    (from ldmain.c:add_archive_element), from calls that don't know it's
    being used by the linker (from elf_link_is_defined_archive_symbol); in
    the latter case, the plugin should avoid recording the object as one
    with offload data.

            PR middle-end/109128

            include/
            * plugin-api.h (ld_plugin_claim_file_handler_v2)
            (ld_plugin_register_claim_file_v2)
            (LDPT_REGISTER_CLAIM_FILE_HOOK_V2): New.
            (struct ld_plugin_tv): Add tv_register_claim_file_v2.

            lto-plugin/
            * lto-plugin.c (register_claim_file_v2): New.
            (claim_file_handler_v2): New.
            (claim_file_handler): Wrap claim_file_handler_v2.
            (onload): Handle LDPT_REGISTER_CLAIM_FILE_HOOK_V2.

  parent reply	other threads:[~2023-05-11  8:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-14 12:15 [Bug middle-end/109128] New: " burnus at gcc dot gnu.org
2023-03-14 12:36 ` [Bug middle-end/109128] " tschwinge at gcc dot gnu.org
2023-03-14 13:07 ` burnus at gcc dot gnu.org
2023-03-30 14:42 ` burnus at gcc dot gnu.org
2023-03-30 19:12 ` burnus at gcc dot gnu.org
2023-03-30 20:00 ` burnus at gcc dot gnu.org
2023-03-31  8:39 ` tschwinge at gcc dot gnu.org
2023-05-02 17:20 ` burnus at gcc dot gnu.org
2023-05-11  8:09 ` cvs-commit at gcc dot gnu.org [this message]
2023-05-11 14:56 ` burnus at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-109128-4-W4Pt3k82oi@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).