On 29/10/2010 02:31, Ian Lance Taylor wrote: > Dave Korn <dave.korn.cygwin@ writes: > >> What would be even nicer would be if we could share the same code-reader >> interface between lto and go (and the lto-plugin), thereby getting object >> format independence equally everywhere for no extra cost. > > How about this?
That looks excellent, thank you! > This implements an object file reader/writer which does everything > required by LTO and gccgo. The ELF code works. I have not tested the > Mach-O and COFF code at all beyond compiling it; I hope that somebody > else can test those targets and fix them. I'm right here :) Can't help with Darwin but hopefully Jack/Iain will be available. > With this patch, libelf is no longer needed. > > I've bootstrapped this on x86_64-unknown-linux-gnu, and I've run the LTO > testsuite. > > This patch puts the code in libiberty, but it could equally well go in > gcc. Anybody want to make an argument one way or another? Libiberty is better for sharing with lto-plugin, I think. I sent a patch that commoned out some of the COFF-reader code into gcc/, but I only put it there because it was a single header file with no associated object file. Now there's actual code to be linked in, I think libiberty is a better choice than lto-plugin trying to share .o files from the ../gcc/ objdir. > Does the general interface look OK? > > This patch requires approval from the LTO maintainers. Also, I have a patch outstanding to COFF-ize the lto-plugin(*), so if we can get an early "OK in principle" I'll get cracking on respinning it to use this new interface. cheers, DaveK -- (*) - http://gcc.gnu.org/ml/gcc-patches/2010-10/msg02176.html