On Fri, Oct 29, 2010 at 3:31 AM, Ian Lance Taylor <i...@google.com> wrote: > Dave Korn <dave.korn.cyg...@gmail.com> 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? > > 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. > > 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? > > Does the general interface look OK? > > This patch requires approval from the LTO maintainers. I don't need > approval for the libiberty changes (if the code stays in libiberty) but > of course I would appreciate it if somebody could look it over. I think > the configure and Makefile changes are sufficiently obvious given the > other changes as to not require approval. > > If this patch is accepted, then gccgo will not require elfcpp.
Nice! The LTO changes are ok (I suppose you'll be around in helping people debug eventual problems). Richard. > Ian > > > include/ChangeLog: > > 2010-10-28 Ian Lance Taylor <i...@google.com> > > * objfile.h: New file. > > libiberty/ChangeLog: > > 2010-10-28 Ian Lance Taylor <i...@google.com> > > * objfile.c: New file. > * objfile-common.h: New file. > * objfile-elf.c: New file. > * objfile-mach-o.c: New file. > * objfile-coff.c: New file. > * configure.ac: Add AC_TYPE_SSIZE_T. > * Makefile.in: Rebuild dependencies. > (CFILES): Add objfile.c, objfile-coff, objfile-elf.c, > objfile-mach-o.c. > (REQUIRED_OFILES): Add corresponding object files. > * configure: Rebuild. > * config.in: Rebuild. > > gcc/ChangeLog: > > 2010-10-28 Ian Lance Taylor <i...@google.com> > > * configure.ac: Remove elf_getshdrstrndx test. Don't substitute > LTO_BINARY_READER or LTO_USE_LIBELF. Remove LIBELFLIBS and > LIBELFINC. Remove HAVE_libelf. > * gcc/config.gcc: Don't set lto_binary_reader. > * gcc/Makefile.in (LIBELFLIBS, LIBELFINC): Remove variables. > (LTO_BINARY_READER, LTO_USE_LIBELF): Remove variables. > (LIBS): Remove $(LIBELFLIBS). > (INCLUDES): Remove $(LIBELFINC). > * doc/install.texi (Prerequisites): Remove libelf paragraphs. > (Configuration): Mention --disable-lto. Remove --with-libelf > paragraph. > * configure: Rebuild. > * config.in: Rebuild. > > gcc/lto/ChangeLog: > > 2010-10-28 Ian Lance Taylor <i...@google.com> > > * lto-objfile.c: New file. > * lto-elf.c: Remove file. > * lto-macho.c: Remove file. > * lto-macho.h: Remove file. > * lto-coff.c: Remove file. > * lto-coff.h: Remove file. > * Make-lang.in (LTO_OBJS): Change lto/$(LTO_BINARY_READER).o to > lto/lto-objfile.o. > ($(LTO_EXE)): Remove $(LTO_USE_LIBELF) > (lto/lto-objfile.o): New target. > (lto/lto-elf.o, lto/lto-coff.o, lto/lto-macho.o): Remove targets. > > ./ChangeLog: > > 2010-10-28 Ian Lance Taylor <i...@google.com> > > * configure.ac: Don't set default_enable_lto. Remove libelf tests. > * configure: Rebuild. > > >