[patch] Add plugin support for bfd

Joseph S. Myers joseph@codesourcery.com
Fri Feb 20 23:07:00 GMT 2009


On Fri, 20 Feb 2009, Rafael Espíndola wrote:

> In contrast with this, gold uses only a command line option. This is
> very nice, but gold has the advantage that it is always called from
> GCC. GCC (in the LTO branch) knows where to find its plugin and passes
> the correct option to gold. That is not true for other utilities (nm
> and ar). Also, in most build systems there is no NMFLAGS or ARFLAGS,
> so they have to search for the plugin. One option that is more
> complicated than the environment variable but maybe better is to do
> what gcc does: Take -B options and search for plugins there. Also have
> reasonable compile time defaults so that normal users don't have to
> add -B to the command line.

All tools in the toolchain are relocatable using make_relative_prefix.  So 
you can define a location relative to where ar and nm are installed and 
search in that location for plugins.

> +  if (plugin_handle)
> +    return 1;
> +
> +  const char *pname = getenv ("BFD_PLUGIN");

I believe binutils is limited to C90, so no declarations after code.

> +  onload = dlsym(plugin_handle, "onload");

Missing space between function name and open parenthesis.

(I have not checked for these problems elsewhere in the patch.)

-- 
Joseph S. Myers
joseph@codesourcery.com


More information about the Binutils mailing list