diff options
author | Tobias Burnus <tobias@codesourcery.com> | 2023-05-11 12:29:05 +0200 |
---|---|---|
committer | Tobias Burnus <tobias@codesourcery.com> | 2023-05-11 12:29:05 +0200 |
commit | 0171e1652f153f6b2a5506cc3b7073e1f0dacfa0 (patch) | |
tree | fa1a891185fcddb85577b25b8b377b12c944df13 /gcc/tree-ssa-loop-split.cc | |
parent | 07fc54f7f09b79133e296cbdf87a2e6dd02e4eda (diff) | |
download | gcc-0171e1652f153f6b2a5506cc3b7073e1f0dacfa0.zip gcc-0171e1652f153f6b2a5506cc3b7073e1f0dacfa0.tar.gz gcc-0171e1652f153f6b2a5506cc3b7073e1f0dacfa0.tar.bz2 |
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.
(cherry picked from commit c49d51fa8134f6c7e6c7cf6e4e3007c4fea617c5)
Diffstat (limited to 'gcc/tree-ssa-loop-split.cc')
0 files changed, 0 insertions, 0 deletions