[PATCH] bfd: Add support for more than one plugin in lib/bfd-plugins

Alan Modra amodra@gmail.com
Tue Sep 23 14:01:00 GMT 2014


On Tue, Sep 23, 2014 at 03:07:29PM +0200, Markus Trippelsdorf wrote:
> On 2014.09.23 at 21:38 +0930, Alan Modra wrote:
> > 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.
> 
> That is the price to pay for handling mixed (LLVM/GCC/native) archives.

No, you can still get by with one dlopen per plugin without
complicating matters too much.  The idea is to load all the plugins
the first time you need any, storing their claim_file function
addresses in a dynamically allocated array or linked list.  Then for
each object file, iterate over these claim_file functions until you
find one that claims the object.

Bonus points awarded if you arrange the iteration such that a
previously successful claim_file is the first one tried on a new
object.

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list