[PATCH] Plugin API clarification.

Dave Korn dave.korn.cygwin@gmail.com
Thu Nov 4 03:11:00 GMT 2010
    Hi list,

  Following on from the fix of GCC PR46291, Cary clarified for me that the
plugin interface is meant to retain control of the file descriptor that it
passes to the claim_file handler.  In LD, that means we should close it after
the handler returns, regardless whether it claimed the file or not.

  While I was there, I fixed some formatting problems, and I added a tiny
optimisation that saves us from having to open the fd and create a dummy bfd
only to throw them both away a moment later when there aren't any plugins that
could possibly claim it anyway.

ld/ChangeLog:

	* plugin.h (plugin_active_plugins_p): New prototype.
	(is_ir_dummy_bfd): Delete prototype.
	* plugin.c: Fix formatting issues.
	(is_ir_dummy_bfd): Make static.
	(plugin_active_plugins_p): New function.
	* ldfile.c (ldfile_try_open_bfd): Use it to save work if no plugins
	are loaded.  Always close file descriptor after claim handler returns.
	* ldmain.c (add_archive_element): Likewise.


  Built+tested on i686-pc-cygwin without regressions.  Am bootstrapping
GCC+lto-plugin and will verify it against that after it's finished building.
OK if no problems?

    cheers,
      DaveK

-------------- next part --------------
A non-text attachment was scrubbed...
Name: plugin-api-clarification.diff
Type: text/x-c
Size: 5681 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20101104/e061893d/attachment.bin>


More information about the Binutils mailing list