This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] bfd: Add support for more than one plugin in lib/bfd-plugins
- From: Alan Modra <amodra at gmail dot com>
- To: Markus Trippelsdorf <markus at trippelsdorf dot de>
- Cc: binutils at sourceware dot org, Nick Clifton <nickc at redhat dot com>, Rafael Avila de Espindola <rafael dot espindola at gmail dot com>
- Date: Tue, 23 Sep 2014 21:38:06 +0930
- Subject: Re: [PATCH] bfd: Add support for more than one plugin in lib/bfd-plugins
- Authentication-results: sourceware.org; auth=none
- References: <20140923062536 dot GA28768 at x4>
On Tue, Sep 23, 2014 at 08:25:36AM +0200, Markus Trippelsdorf wrote:
> PR 17422
> * plugin.c (try_claim): New function. Moved from
> bfd_plugin_object_p.
> (try_load_plugin): Pass though filename. Add test.
> (load_plugin): Pass though filename.
> (bfd_plugin_object_p): Move logic to try_claim.
I like what you're doing, but there are a few problems.
> +try_load_plugin (const char *pname, bfd *abfd)
> {
> static void *plugin_handle;
Nit, preexisting. Seems to me that this should no longer be a static
var.
> int tv_size = 4;
> @@ -164,7 +209,6 @@ try_load_plugin (const char *pname)
> int i;
> ld_plugin_onload onload;
> enum ld_plugin_status status;
> -
> plugin_handle = dlopen (pname, RTLD_NOW);
> if (!plugin_handle)
> {
> @@ -200,6 +244,9 @@ try_load_plugin (const char *pname)
> if (!claim_file)
> goto err;
>
> + if (!try_claim (abfd))
> + goto err;
Since you're calling try_claim here..
> - lseek(file.fd, cur_offset, SEEK_SET);
> - if (!claimed)
> + if (!try_claim (abfd))
> return NULL;
..you shouldn't do so here in bfd_plugin_object_p.
A perhaps more serious issue is that after your patch we'll call
dlopen() and onload() on each lto input object file. Before, we
dlopen a plugin and call onload just once.
--
Alan Modra
Australia Development Lab, IBM