This is the mail archive of the
mailing list for the binutils project.
Re: [PATCH 1/8] PR ld/17878: Add bfd_maybe_object_p
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Binutils <binutils at sourceware dot org>
- Date: Sat, 7 Feb 2015 12:51:20 -0800
- Subject: Re: [PATCH 1/8] PR ld/17878: Add bfd_maybe_object_p
- Authentication-results: sourceware.org; auth=none
- References: <20150205135440 dot GA27203 at gmail dot com> <20150207094240 dot GD14796 at bubble dot grove dot modra dot org> <CAMe9rOoC1KKOHtPT81fFAnU8sjHWO0BLjG2=XoGU=b1oiuR10g at mail dot gmail dot com> <20150207191022 dot GA10023 at gmail dot com>
On Sat, Feb 07, 2015 at 11:10:22AM -0800, H.J. Lu wrote:
> On Sat, Feb 07, 2015 at 04:50:27AM -0800, H.J. Lu wrote:
> > > I think you need to find a way of answering the question "is this a
> > > file accepted by a plugin?" in a more robust way. One possibility is
> > > merging the linker handling of plugins into the bfd plugin support.
> > >
> > I have considered it before. This approach has many implications.
> > If we do this, we need to add bfd_plugin_object and bfd_all_object.
> > bfd_all_object includes bfd_object and bfd_plugin_object. We need
> > bfd_plugin_object so that we won't update dummy BFD info from the
> > LTO IR input. Let me take another look.
> We can extract a plugin_object_p out of plugin_maybe_claim for BFD.
> Here is the first patch. I am checking it in.
> From 35a1e5f3055fc28f129e4d5d0a993218d8af1baf Mon Sep 17 00:00:00 2001
> From: "H.J. Lu" <email@example.com>
> Date: Sat, 7 Feb 2015 11:01:22 -0800
> Subject: [PATCH] Update plugin_maybe_claim
> This patch removes the argument of pointer to struct ld_plugin_input_file.
> This is the first step to extract a plugin_object_p out of
> plugin_maybe_claim for BFD.
> * plugin.c: Include "libbfd.h".
> (plugin_strdup): New.
> (plugin_maybe_claim): Remove the argument of pointer to struct
> ld_plugin_input_file. Open and handle input entry.
> * plugin.h (plugin_maybe_claim): Updated.
> * ldfile.c (ldfile_try_open_bfd): Call plugin_maybe_claim directly
> without passing a pointer to struct ld_plugin_input_file.
> * ldmain.c: Don't include "libbfd.h".
> (add_archive_element): Call plugin_maybe_claim directly without
> passing a pointer to struct ld_plugin_input_file.
I checked in this small update.
diff --git a/ld/ChangeLog b/ld/ChangeLog
index d7125ff..00c9466 100644
@@ -1,5 +1,10 @@
2015-02-07 H.J. Lu <firstname.lastname@example.org>
+ * plugin.c (plugin_maybe_claim): Replace entry->the_bfd with
+2015-02-07 H.J. Lu <email@example.com>
* plugin.c: Include "libbfd.h".
(plugin_maybe_claim): Remove the argument of pointer to struct
diff --git a/ld/plugin.c b/ld/plugin.c
index de91fa9..51c7a6b 100644
@@ -1067,7 +1067,7 @@ plugin_maybe_claim (lang_input_statement_type *entry)
einfo (_("%P%F: %s: plugin reported error claiming file\n"),
- if (input->fd != -1 && bfd_check_format (entry->the_bfd, bfd_object))
+ if (input->fd != -1 && bfd_check_format (ibfd, bfd_object))
/* FIXME: fd belongs to us, not the plugin. IR for GCC plugin,
which doesn't need fd after plugin_call_claim_file, is