bfd: Pass true to ld_plugin_object_p
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 |
success
|
Test passed
|
linaro-tcwg-bot/tcwg_binutils_build--master-arm |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_binutils_check--master-arm |
success
|
Test passed
|
Commit Message
Since linker calls bfd_plugin_object_p, which calls ld_plugin_object_p,
only for command-line input objects, pass true to ld_plugin_object_p so
that the same input IR file won't be included twice if the new LTO hook,
LDPT_REGISTER_CLAIM_FILE_HOOK_V2 isn't used.
PR ld/32153
* plugin.c (bfd_plugin_object_p): Pass true to ld_plugin_object_p.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
bfd/plugin.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
Comments
On Sun, Sep 08, 2024 at 05:27:00PM -0700, H.J. Lu wrote:
> Since linker calls bfd_plugin_object_p, which calls ld_plugin_object_p,
> only for command-line input objects, pass true to ld_plugin_object_p so
> that the same input IR file won't be included twice if the new LTO hook,
> LDPT_REGISTER_CLAIM_FILE_HOOK_V2 isn't used.
>
> PR ld/32153
> * plugin.c (bfd_plugin_object_p): Pass true to ld_plugin_object_p.
Seems reasonable to me.
>
> Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
> ---
> bfd/plugin.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/bfd/plugin.c b/bfd/plugin.c
> index f6c6fdbee69..de2137fddc4 100644
> --- a/bfd/plugin.c
> +++ b/bfd/plugin.c
> @@ -596,8 +596,12 @@ load_plugin (bfd *abfd)
> static bfd_cleanup
> bfd_plugin_object_p (bfd *abfd)
> {
> + /* Since ld_plugin_object_p is called only for linker command-line input
> + objects, pass true to ld_plugin_object_p so that the same input IR
> + file won't be included twice if the LDPT_REGISTER_CLAIM_FILE_HOOK_V2
> + isn't used. */
> if (ld_plugin_object_p)
> - return ld_plugin_object_p (abfd, false);
> + return ld_plugin_object_p (abfd, true);
>
> if (abfd->plugin_format == bfd_plugin_unknown && !load_plugin (abfd))
> return NULL;
> --
> 2.46.0
On Mon, Sep 9, 2024 at 5:19 PM Alan Modra <amodra@gmail.com> wrote:
>
> On Sun, Sep 08, 2024 at 05:27:00PM -0700, H.J. Lu wrote:
> > Since linker calls bfd_plugin_object_p, which calls ld_plugin_object_p,
> > only for command-line input objects, pass true to ld_plugin_object_p so
> > that the same input IR file won't be included twice if the new LTO hook,
> > LDPT_REGISTER_CLAIM_FILE_HOOK_V2 isn't used.
> >
> > PR ld/32153
> > * plugin.c (bfd_plugin_object_p): Pass true to ld_plugin_object_p.
>
> Seems reasonable to me.
OK to backport to 2.43 branch?
> >
> > Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
> > ---
> > bfd/plugin.c | 6 +++++-
> > 1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/bfd/plugin.c b/bfd/plugin.c
> > index f6c6fdbee69..de2137fddc4 100644
> > --- a/bfd/plugin.c
> > +++ b/bfd/plugin.c
> > @@ -596,8 +596,12 @@ load_plugin (bfd *abfd)
> > static bfd_cleanup
> > bfd_plugin_object_p (bfd *abfd)
> > {
> > + /* Since ld_plugin_object_p is called only for linker command-line input
> > + objects, pass true to ld_plugin_object_p so that the same input IR
> > + file won't be included twice if the LDPT_REGISTER_CLAIM_FILE_HOOK_V2
> > + isn't used. */
> > if (ld_plugin_object_p)
> > - return ld_plugin_object_p (abfd, false);
> > + return ld_plugin_object_p (abfd, true);
> >
> > if (abfd->plugin_format == bfd_plugin_unknown && !load_plugin (abfd))
> > return NULL;
> > --
> > 2.46.0
>
> --
> Alan Modra
Hi H.J.
>>> PR ld/32153
>>> * plugin.c (bfd_plugin_object_p): Pass true to ld_plugin_object_p.
>>
>> Seems reasonable to me.
>
> OK to backport to 2.43 branch?
Yes, please do.
Cheers
Nick
@@ -596,8 +596,12 @@ load_plugin (bfd *abfd)
static bfd_cleanup
bfd_plugin_object_p (bfd *abfd)
{
+ /* Since ld_plugin_object_p is called only for linker command-line input
+ objects, pass true to ld_plugin_object_p so that the same input IR
+ file won't be included twice if the LDPT_REGISTER_CLAIM_FILE_HOOK_V2
+ isn't used. */
if (ld_plugin_object_p)
- return ld_plugin_object_p (abfd, false);
+ return ld_plugin_object_p (abfd, true);
if (abfd->plugin_format == bfd_plugin_unknown && !load_plugin (abfd))
return NULL;