[PATCH] Add plugin interface to LD [0/4]

Dave Korn dave.korn.cygwin@gmail.com
Thu Sep 23 05:07:00 GMT 2010


    Hi list,

  The following set of patches implements the plugin API as seen in GOLD into
GNU LD.  I've done it in a set of steps that first add the infrastructure,
then fill out the functionality in logical progression, and I'll comment on
noticeable points of each patch as I post them, but first a few overall comments.

  It follows the design outlined at http://gcc.gnu.org/wiki/whopr/driver, with
one significant exception so far: the GET_INPUT_FILE and RELEASE_INPUT_FILE
methods aren't implemented yet (they return errors if called).

  I think it's OK to leave these unimplemented for now, because the GCC LTO
plugin doesn't use them, and that's the main target of this work.  I will add
them later, or sooner in the case that anything actually starts trying to use
them!

  There are two other unsupported features as well: it doesn't handle
libraries yet (in terms of offering the individual members to the claim files
hook), and it doesn't support ELF visibility settings.  These two things I
would like fix with follow-on patches over the coming days, but I think that
the feature as it stands is sufficiently complete to commit now anyway, for
the following reasons:

- ELF visibility handling doesn't need to be a first priority because ELF
targets should be using GOLD for best results anyway; this patch is sufficient
for non-ELF targets that don't have the option of using GOLD and don't need
visibility support anyway.

- Linking against library files still works, but the library contents won't be
available for LTO.  The rest of the program still will be, and since
LTO-compiled objects (and hence archives) contain native assembly sections as
well as LTO sections, the compiled code will still work.

- Since we only release once a year, I'd really like to have this in 2.21, for
the sake of supporting LTO on non-ELF targets when GCC 4.6.0 comes out,
otherwise it'll be another year until the whole toolchain fully supports LTO
on COFF (et al.), even if there are bugs that mean it's not fully working
until 2.21.1 (although I fully hope to have it working for 2.20.0).

- Even though it's not fully complete, it's good enough to start porting work
on the GCC LTO plugin, which will hopefully shake out any remaining bugs
fairly quickly; like before the end of GCC stage 1 next month.

- It's only conditionally compiled in by a configure-time option, so adding it
now can't break anything; but it at least gives us the chance of having LTO
support in the 2.21/4.6 combination.

  I've been testing it on both i686-pc-cygwin and i686-pc-linux-gnu (with
--enable-64-bit-bfd) and it works on both, and has the testcases to show it.
I hope it's not too controversial to commit right now because it really is at
the 95% point and pretty safe.

  Notes on the implementation will follow in the mails carrying the individual
patches.

  What does everyone think?  Ok?

    cheers,
      DaveK



More information about the Binutils mailing list