[PATCH] bfd: Add support for more than one plugin in lib/bfd-plugins
Alan Modra
amodra@gmail.com
Tue Sep 23 12:08:00 GMT 2014
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
More information about the Binutils
mailing list