[patch] Add plugin support for bfd
Rafael Espíndola
rafael.espindola@gmail.com
Fri Feb 20 23:00:00 GMT 2009
The attached patch adds support for plugins in bfd. It does so by
creating a plugin target. It is not a full target, but is enough to
add plugin support for nm and ar. The plugin interface is the same
interface used by gold. It just passes fewer callbacks to onload.
This is needed for getting build systems that use archives to works
with LLVM's LTO. The problem that exists currently is that when given
LLVM IL files, ar will not create a symbol table for the archive and
gold will refuse to use it.
This should also be useful for GCC's LTO branch. That branch uses fat
elf files with both IL and regular code. With this patch it should be
possible to do
nm foo.o (prints the ELF symbol table)
nm --plugin plugin.so foo.o (prints the IL symbol table)
some bugs we (LTO developers) had in the past were caused by
inconsistencies between the tables, so this would be a nice debugging
tool. We just have to make sure that the plugin target is tried first
(not included in this patch).
To enable plugin support, just build with --enable-plugins (the same
option used for gold).
I would like any comments you might have, but there are some items I
don't like too much about the patch and I would really appreciate if
you have suggestions on how to improve it:
1) I use a environment variable in bfd to find the plugin.
2) The --plugin option is implemented using the environment variable.
3) The check for --enable-plugin is duplicated in many configure.in
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.
Cheers,
Rafael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bfd-plugin.patch
Type: text/x-patch
Size: 26314 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20090220/a43646b9/attachment.bin>
More information about the Binutils
mailing list