This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/8] PR ld/17878: Add bfd_maybe_object_p


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.
> 
> 
> H.J.
> ----
> From 35a1e5f3055fc28f129e4d5d0a993218d8af1baf Mon Sep 17 00:00:00 2001
> From: "H.J. Lu" <hjl.tools@gmail.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.


H.J.
---
diff --git a/ld/ChangeLog b/ld/ChangeLog
index d7125ff..00c9466 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,5 +1,10 @@
 2015-02-07  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* plugin.c (plugin_maybe_claim): Replace entry->the_bfd with
+	ibfd.
+
+2015-02-07  H.J. Lu  <hongjiu.lu@intel.com>
+
 	* plugin.c: Include "libbfd.h".
 	(plugin_strdup): New.
 	(plugin_maybe_claim): Remove the argument of pointer to struct
diff --git a/ld/plugin.c b/ld/plugin.c
index de91fa9..51c7a6b 100644
--- a/ld/plugin.c
+++ b/ld/plugin.c
@@ -1067,7 +1067,7 @@ plugin_maybe_claim (lang_input_statement_type *entry)
     einfo (_("%P%F: %s: plugin reported error claiming file\n"),
 	   plugin_error_plugin ());
 
-  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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]