[LTO merge][12/15] Add linker plugin

Diego Novillo dnovillo@google.com
Tue Sep 29 01:39:00 GMT 2009


This adds a new toplevel directory named lto-plugin which is a
gold plugin so that lto1 can get information out of the linker
and pull LTO object files out of archives.

We tested this internally heavily until a few months ago, but it
has not been tested since.  It may have bitrotted.  I will test
it before the final merge.

See http://gcc.gnu.org/ml/gcc/2009-09/msg00578.html for a
description of the whole set.


Thanks.  Diego.


2009-05-21  Diego Novillo  <dnovillo@google.com>

	* configure.ac: Remove call to AC_CHECK_GELF.
	Call AC_ARG_VAR for LIBELFLIBS and LIBELFINC.
	* acinclude.m4: Do not include ../config/libelf.m4
	* Makefile.am (LIBELFLIBS): Define.
	(LIBELFINC): Define.
	(AM_CPPFLAGS): Add $(LIBELFINC).
	(ltosymtab_LDADD): Add $(LIBELFLIBS).
	(liblto_plugin_la_LIBADD): Add $(LIBELFLIBS)
	* lto-plugin.c: Always include <gelf.h>
	* lto-symtab.c: Likewise.
	* configure: Regenerate.
	* Makefile.in: Regenerate.

2009-03-23  Rafael Avila de Espindola  <espindola@google.com>

	* lto-plugin.c (libgcc_filename): New.
	(all_symbols_read_handler): Pass libgcc to the linker.
	(all_symbols_read_handler): Parse -libgcc

2009-02-05  Rafael Avila de Espindola  <espindola@google.com>

	* Makefile.am (liblto_plugin_la_LIBADD): Link with libiberty.
	* Makefile.in: Regenerate.
	* lto-plugin.c (add_output_files): Argument is now a FILE.
	(exec_lto_wrapper): Use writeargv and pex.

2009-02-04  Rafael Avila de Espindola  <espindola@google.com>

	Revert:
	2009-02-04  Rafael Avila de Espindola  <espindola@google.com>
	* lto-plugin.c (exec_lto_wrapper): Use writeargv.


2009-02-04  Rafael Avila de Espindola  <espindola@google.com>

	* lto-plugin.c (exec_lto_wrapper): Use writeargv.

2009-01-29  Rafael Avila de Espindola  <espindola@google.com>

	* lto-plugin.c: Include libiberty.h.
	(exec_lto_wrapper, claim_file_handler): Use asprintf instead of
	snprintf.

2009-01-29  Rafael Avila de Espindola  <espindola@google.com>

	* lto-plugin.c (exec_lto_wrapper): Write argv to a file. Pass that
	file to lto-wrapper.

2009-01-28  Rafael Avila de Espindola  <espindola@google.com>

	* lto-plugin.c (plugin_file_info): Remove fd and elf.
	(parse_table_entry): strdup entry->name and entry->comdat_key.
	(free_1): Free name and comdat_key. Don't close the file. Don't call
	elf_end.
	(claim_file_handler): Always call elf_end.

2008-12-23  Rafael Avila de Espindola  <espindola@google.com>

	* Makefile.am (AM_CPPFLAGS): Add -D_LARGEFILE_SOURCE
	-D_FILE_OFFSET_BITS=64
	* Makefile.in: Regenerate

2008-12-22  Rafael Avila de Espindola  <espindola@google.com>

	* Makefile.am (gcc_version, target_noncanonical, libexecsubdir): New.
	(lib_LTLIBRARIES): Rename to libexecsub_LTLIBRARIES.
	* Makefile.in: Regenerate.
	* acinclude.m4: Include ../config/acx.m4 and ../lt~obsolete.m4
	* configure: Regenerate.
	* configure.ac: Add AC_SUBST(target_noncanonical).

2008-12-08  Rafael Avila de Espindola  <espindola@google.com>

	* lto-plugin.c: Include stdbool.h.
	(debug, nop): Declare as bool.

2008-12-08  Rafael Avila de Espindola  <espindola@google.com>

	* lto-plugin.c (nop): New.
	(use_original_files): New.
	(all_symbols_read_handler): Call use_original_files if nop is true.
	(process_option): Parse the -nop option.

2008-12-08  Rafael Avila de Espindola  <espindola@google.com>

	* lto-plugin.c (debug): New.
	(exec_lto_wrapper): Print argv if debug is true.
	(process_option): Process the -debug command line option.

2008-12-03  Rafael Avila de Espindola  <espindola@google.com>

	* lto-plugin.c (process_option): The argument is now a single option,
	not a space separated list.

2008-12-02  Rafael Avila de Espindola  <espindola@google.com>

	* lto-plugin.c: Include sys/types.h and sys/wait.h
	(output_files, num_output_files, lto_wrapper_argv,
	lto_wrapper_num_args): New.
	(free_2): Free output_files.
	(write_resolution): Disable.
	(add_output_files): New.
	(exec_lto_wrapper): New.
	(all_symbols_read_handler): Run lto-wrapper.
	(claim_file_handler): Free lto_file.name and call elf_end.
	(process_option): New.

2008-11-26  Rafael Espindola  <espindola@google.com>

	* lto-plugin.c (add_input_file): New.
	(get_section): Return NULL if get_section fails.
	(write_resolution): New.
	(all_symbols_read_handler): Call add_input_file.
	(claim_file_handler): Unlink the correct file.
	(onload): Record add_input_file.

2008-09-23 Rafael Espindola  <espindola@google.com>

	* Makefile.am (ltosymtab_SOURCES, liblto_plugin_la_SOURCES):
	Update the location of common.c.
	* Makefile.in: Regenerate.
	* common.c: Moved to gcc/lto.
	* common.h: Moved to gcc/lto.
	* lto-plugin.c: Update the location of common.h.
	* lto-symtab.c: Update the location of common.h.

2008-09-23 Rafael Espindola  <espindola@google.com>

	* common.c: Include common.h.
	(lto_kind_str, lto_visibility_str, lto_resolution_str): Use explicit
	sizes.
	* common.h (lto_kind_str, lto_visibility_str, lto_resolution_str): Use
	explicit sizes.

2008-09-23 Rafael Espindola  <espindola@google.com>

	* lto-plugin.c (plugin_file_info): Add temp.
	(cleanup_handler): Only delete temporary files.
	(claim_file_handler): Initialize lto_file.temp.

2008-09-23  Rafael Espindola  <espindola@google.com>

        * plugin-api.h: Moved to include.

2008-09-23 Rafael Espindola  <espindola@google.com>

	* lto-plugin.c (all_symbols_read_handler): Print resolution in a new
	format.

2008-09-22 Rafael Espindola  <espindola@google.com>

	* plugin-api.h: Copy from binutils' cvs.

2008-09-22 Rafael Espindola  <espindola@google.com>

	* lto-symtab.c (get_symbols, add_symbols): Update signature.
	* plugin-api.h: Copy from binutils' cvs.

2008-09-22 Rafael Espindola  <espindola@google.com>

	* common.h (lto_kind_str, lto_visibility_str, lto_resolution_str):
	Make extern

2008-09-10 Rafael Espindola  <espindola@google.com>

	* lto-plugin.c (onload): add missing break statements and asserts.
	* lto-symtab.c (claim_file_handler): Make it static.
	(all_symbols_read_handler): Make it static.
	(all_file_handles): Make it static.
	(num_file_handles): Make it static.
	(register_claim_file): Make it static.
	(register_object): Indent properly.

2008-09-10  Rafael Avila de Espindola  <espindola@google.com>

	* Makefile.am (ltosymtab_LDADD): Add -lelf.
	* Makefiel.in: Regenerate.
	* lto-plugin.c: Include ar.h.
	(claim_file_handler): Handle file->offset != 0.
	* lto-symtab.c: Include gelf.h.
	(all_file_handles): Change type.
	(register_object): New.
	(register_file): Add support for archives.
	(resolve): Update to new type of all_file_handles.
	(print): Update to new type of all_file_handles.
	(free_all): Update to new type of all_file_handles.
	(main): Update to new type of all_file_handles.

2008-09-10  Rafael Avila de Espindola  <espindola@google.com>

	* lto-plugin.c (get_string_table): Remove.
	(get_section): Use elf_strptr instead of get_string_table.

2008-09-08  Doug Kwan  <dougkwan@google.com>

	* lto-plugin.c (all_symbols_read_handler): Widen fprintf arguments
	to 64-bit to fix a 32-bit bootstrap failure due to format warnings.

2008-09-08  Rafael Avila de Espindola  <espindola@google.com>

	* Makefile.am (ltosymtab_SOURCES): add common.c.
	(ltosymtab_CFLAGS): New.
	(liblto_plugin_la_SOURCES): Add common.c.
	* Makefile.in: Regenerate.
	* common.c: New.
	* common.h: New.
	* lto-plugin.c: Include stdio.h, inttypes.h and common.h.
	(plugin_symtab): New.
	(plugin_file_info): New.
	(register_all_symbols_read): New.
	(get_symbols): New.
	(claimed_files): New.
	(num_claimed_files): New.
	(translate): Don't drop the slot number.
	(free_1): New.
	(free_2): New.
	(all_symbols_read_handler): New.
	(claim_file_handler): Record every claimed file.
	(onload): Handle LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK and
	LDPT_GET_SYMBOLS.
	* lto-symtab.c: Include stdlib.h, string.h and common.h.
	(current_file_handle): Remove.
	(ld_plugin_all_symbols_read_handler): New.
	(plugin_handle): New.
	(file_handle): New.
	(all_file_handles): New.
	(num_file_handles): New.
	(get_symbols): New.
	(register_all_symbols_read): New.
	(add_symbols): Don't print the symbols, just record them.
	(ld_plugin_tv): Add LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK and
	LDPT_GET_SYMBOLS.
	(load_plugin): Use plugin_handle.
	(register_file): Add the file handle to all_file_handles.
	(resolve): New.
	(print): New.
	(unload_plugin): New.
	(free_all): New.
	(main): Call all_symbols_read_handler and free resources.

2008-09-03  Rafael Avila de Espindola  <espindola@google.com>

	* Makefile.am (AM_CFLAGS): New.
	(ltosymtab_LDADD): Remove -lelf. Add -ldl.
	(lib_LTLIBRARIES): New.
	(liblto_plugin_la_SOURCES): New.
	(liblto_plugin_la_LIBADD): New.
	* Makefile.in: Regenerate.
	* acinclude.m4: Don't include ../config/acx.m4 and
	../config/no-executables.m4.
	Include ../ltsugar.m4, ../ltoptions.m4, ../ltversion.m4 and
	../libtool.m4.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* configure.ac: Use AM_PROG_LIBTOOL.
	* lto-plugin.c: New.
	* lto-symtab.c: Rewrite to use the plugin.
	* plugin-api.h: New.

2008-08-25  Rafael Avila de Espindola  <espindola@google.com>

	* configure: Regenerate.
	* configure.ac: Use AC_CHECK_GELF.
	* lto-symtab.c: Include gelf.h.
	(get_string_table): Use size independent API.
	(printTable): Use lld to print 64 bit integers.

2008-08-22  Rafael Avila de Espindola  <espindola@google.com>

	* lto-symtab.c (parse_table_entry): Assert entry->kind and
	entry->visibility are valid.

2008-07-22  Rafael Avila de Espindola  <espindola@google.com>
	* lto-symtab.c (table_entry): Add comdat.
	(parse_table_entry): Read comdat.

2008-08-21  Rafael Espindola  <espindola@google.com>

	* Makefile.am: New.
	* Makefile.in: New.
	* acinclude.m4: New.
	* aclocal.m4: New.
	* configure: New.
	* configure.ac: New.
	* lto-symtab.c: New.
diff -rdupN --exclude=.svn --exclude=.git --exclude='*.diff*' --exclude='autom4te*' --exclude=tags --exclude=ChangeLog.lto --exclude=configure /usr/local/google/homedirs/dnovillo/gcc/trunk/include/lto-symtab.h /usr/local/google/homedirs/dnovillo/gcc/trunk.lto/include/lto-symtab.h
--- /usr/local/google/homedirs/dnovillo/gcc/trunk/include/lto-symtab.h	1969-12-31 19:00:00.000000000 -0500
+++ /usr/local/google/homedirs/dnovillo/gcc/trunk.lto/include/lto-symtab.h	2009-09-23 11:34:40.000000000 -0400
@@ -0,0 +1,41 @@
+/* Data types used in the IL symbol table.
+   Copyright (C) 1999, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Contributed by Rafael Espindola <espindola@google.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
+
+#ifndef GCC_LTO_SYMTAB_H
+#define GCC_LTO_SYMTAB_H
+
+enum gcc_plugin_symbol_kind
+  {
+    GCCPK_DEF,
+    GCCPK_WEAKDEF,
+    GCCPK_UNDEF,
+    GCCPK_WEAKUNDEF,
+    GCCPK_COMMON
+  };
+
+enum gcc_plugin_symbol_visibility
+  {
+    GCCPV_DEFAULT,
+    GCCPV_PROTECTED,
+    GCCPV_INTERNAL,
+    GCCPV_HIDDEN
+  };
+
+#endif /* GCC_LTO_SYMTAB_H  */
diff -rdupN --exclude=.svn --exclude=.git --exclude='*.diff*' --exclude='autom4te*' --exclude=tags --exclude=ChangeLog.lto --exclude=configure /usr/local/google/homedirs/dnovillo/gcc/trunk/include/plugin-api.h /usr/local/google/homedirs/dnovillo/gcc/trunk.lto/include/plugin-api.h
--- /usr/local/google/homedirs/dnovillo/gcc/trunk/include/plugin-api.h	1969-12-31 19:00:00.000000000 -0500
+++ /usr/local/google/homedirs/dnovillo/gcc/trunk.lto/include/plugin-api.h	2009-09-23 11:34:41.000000000 -0400
@@ -0,0 +1,263 @@
+/* plugin-api.h -- External linker plugin API.  */
+
+/* Copyright 2008 Free Software Foundation, Inc.
+   Written by Cary Coutant <ccoutant@google.com>.
+
+   This file is part of binutils.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
+
+/* This file defines the interface for writing a linker plugin, which is
+   described at < http://gcc.gnu.org/wiki/whopr/driver >.  */
+
+#ifndef PLUGIN_API_H
+#define PLUGIN_API_H
+
+#include <stdint.h>
+#include <sys/types.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/* Status code returned by most API routines.  */
+
+enum ld_plugin_status
+{
+  LDPS_OK = 0,
+  LDPS_NO_SYMS,         /* Attempt to get symbols that haven't been added. */
+  LDPS_ERR
+  /* Additional Error codes TBD.  */
+};
+
+/* The version of the API specification.  */
+
+enum ld_plugin_api_version
+{
+  LD_PLUGIN_API_VERSION = 1
+};
+
+/* The type of output file being generated by the linker.  */
+
+enum ld_plugin_output_file_type
+{
+  LDPO_REL,
+  LDPO_EXEC,
+  LDPO_DYN
+};
+
+/* An input file managed by the plugin library.  */
+
+struct ld_plugin_input_file
+{
+  const char *name;
+  int fd;
+  off_t offset;
+  off_t filesize;
+  void *handle;
+};
+
+/* A symbol belonging to an input file managed by the plugin library.  */
+
+struct ld_plugin_symbol
+{
+  char *name;
+  char *version;
+  int def;
+  int visibility;
+  uint64_t size;
+  char *comdat_key;
+  int resolution;
+};
+
+/* Whether the symbol is a definition, reference, or common, weak or not.  */
+
+enum ld_plugin_symbol_kind
+{
+  LDPK_DEF,
+  LDPK_WEAKDEF,
+  LDPK_UNDEF,
+  LDPK_WEAKUNDEF,
+  LDPK_COMMON
+};
+
+/* The visibility of the symbol.  */
+
+enum ld_plugin_symbol_visibility
+{
+  LDPV_DEFAULT,
+  LDPV_PROTECTED,
+  LDPV_INTERNAL,
+  LDPV_HIDDEN
+};
+
+/* How a symbol is resolved.  */
+
+enum ld_plugin_symbol_resolution
+{
+  LDPR_UNKNOWN = 0,
+
+  /* Symbol is still undefined at this point.  */
+  LDPR_UNDEF,
+
+  /* This is the prevailing definition of the symbol, with references from
+     regular object code.  */
+  LDPR_PREVAILING_DEF,
+
+  /* This is the prevailing definition of the symbol, with no
+     references from regular objects.  It is only referenced from IR
+     code.  */
+  LDPR_PREVAILING_DEF_IRONLY,
+
+  /* This definition was pre-empted by a definition in a regular
+     object file.  */
+  LDPR_PREEMPTED_REG,
+
+  /* This definition was pre-empted by a definition in another IR file.  */
+  LDPR_PREEMPTED_IR,
+
+  /* This symbol was resolved by a definition in another IR file.  */
+  LDPR_RESOLVED_IR,
+
+  /* This symbol was resolved by a definition in a regular object
+     linked into the main executable.  */
+  LDPR_RESOLVED_EXEC,
+
+  /* This symbol was resolved by a definition in a shared object.  */
+  LDPR_RESOLVED_DYN
+};
+
+/* The plugin library's "claim file" handler.  */
+
+typedef
+enum ld_plugin_status
+(*ld_plugin_claim_file_handler) (
+  const struct ld_plugin_input_file *file, int *claimed);
+
+/* The plugin library's "all symbols read" handler.  */
+
+typedef
+enum ld_plugin_status
+(*ld_plugin_all_symbols_read_handler) (void);
+
+/* The plugin library's cleanup handler.  */
+
+typedef
+enum ld_plugin_status
+(*ld_plugin_cleanup_handler) (void);
+
+/* The linker's interface for registering the "claim file" handler.  */
+
+typedef
+enum ld_plugin_status
+(*ld_plugin_register_claim_file) (ld_plugin_claim_file_handler handler);
+
+/* The linker's interface for registering the "all symbols read" handler.  */
+
+typedef
+enum ld_plugin_status
+(*ld_plugin_register_all_symbols_read) (
+  ld_plugin_all_symbols_read_handler handler);
+
+/* The linker's interface for registering the cleanup handler.  */
+
+typedef
+enum ld_plugin_status
+(*ld_plugin_register_cleanup) (ld_plugin_cleanup_handler handler);
+
+/* The linker's interface for adding symbols from a claimed input file.  */
+
+typedef
+enum ld_plugin_status
+(*ld_plugin_add_symbols) (void *handle, int nsyms,
+                          const struct ld_plugin_symbol *syms);
+
+/* The linker's interface for retrieving symbol resolution information.  */
+
+typedef
+enum ld_plugin_status
+(*ld_plugin_get_symbols) (const void *handle, int nsyms,
+                          struct ld_plugin_symbol *syms);
+
+/* The linker's interface for adding a compiled input file.  */
+
+typedef
+enum ld_plugin_status
+(*ld_plugin_add_input_file) (char *pathname);
+
+/* The linker's interface for issuing a warning or error message.  */
+
+typedef
+enum ld_plugin_status
+(*ld_plugin_message) (int level, char *format, ...);
+
+enum ld_plugin_level
+{
+  LDPL_INFO,
+  LDPL_WARNING,
+  LDPL_ERROR,
+  LDPL_FATAL
+};
+
+/* Values for the tv_tag field of the transfer vector.  */
+
+enum ld_plugin_tag
+{
+  LDPT_NULL = 0,
+  LDPT_API_VERSION,
+  LDPT_GOLD_VERSION,
+  LDPT_LINKER_OUTPUT,
+  LDPT_OPTION,
+  LDPT_REGISTER_CLAIM_FILE_HOOK,
+  LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK,
+  LDPT_REGISTER_CLEANUP_HOOK,
+  LDPT_ADD_SYMBOLS,
+  LDPT_GET_SYMBOLS,
+  LDPT_ADD_INPUT_FILE,
+  LDPT_MESSAGE
+};
+
+/* The plugin transfer vector.  */
+
+struct ld_plugin_tv
+{
+  enum ld_plugin_tag tv_tag;
+  union
+  {
+    int tv_val;
+    const char *tv_string;
+    ld_plugin_register_claim_file tv_register_claim_file;
+    ld_plugin_register_all_symbols_read tv_register_all_symbols_read;
+    ld_plugin_register_cleanup tv_register_cleanup;
+    ld_plugin_add_symbols tv_add_symbols;
+    ld_plugin_get_symbols tv_get_symbols;
+    ld_plugin_add_input_file tv_add_input_file;
+    ld_plugin_message tv_message;
+  } tv_u;
+};
+
+/* The plugin library's "onload" entry point.  */
+
+typedef
+enum ld_plugin_status
+(*ld_plugin_onload) (struct ld_plugin_tv *tv);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif /* !defined(PLUGIN_API_H) */
diff -rdupN --exclude=.svn --exclude=.git --exclude='*.diff*' --exclude='autom4te*' --exclude=tags --exclude=ChangeLog.lto --exclude=configure /usr/local/google/homedirs/dnovillo/gcc/trunk/lto-plugin/ChangeLog /usr/local/google/homedirs/dnovillo/gcc/trunk.lto/lto-plugin/ChangeLog
--- /usr/local/google/homedirs/dnovillo/gcc/trunk/lto-plugin/ChangeLog	1969-12-31 19:00:00.000000000 -0500
+++ /usr/local/google/homedirs/dnovillo/gcc/trunk.lto/lto-plugin/ChangeLog	2009-09-23 11:34:52.000000000 -0400
@@ -0,0 +1,287 @@
+2009-05-21  Diego Novillo  <dnovillo@google.com>
+
+	* configure.ac: Remove call to AC_CHECK_GELF.
+	Call AC_ARG_VAR for LIBELFLIBS and LIBELFINC.
+	* acinclude.m4: Do not include ../config/libelf.m4
+	* Makefile.am (LIBELFLIBS): Define.
+	(LIBELFINC): Define.
+	(AM_CPPFLAGS): Add $(LIBELFINC).
+	(ltosymtab_LDADD): Add $(LIBELFLIBS).
+	(liblto_plugin_la_LIBADD): Add $(LIBELFLIBS)
+	* lto-plugin.c: Always include <gelf.h>
+	* lto-symtab.c: Likewise.
+	* configure: Regenerate.
+	* Makefile.in: Regenerate.
+
+2009-03-23  Rafael Avila de Espindola  <espindola@google.com>
+
+	* lto-plugin.c (libgcc_filename): New.
+	(all_symbols_read_handler): Pass libgcc to the linker.
+	(all_symbols_read_handler): Parse -libgcc
+
+2009-02-05  Rafael Avila de Espindola  <espindola@google.com>
+
+	* Makefile.am (liblto_plugin_la_LIBADD): Link with libiberty.
+	* Makefile.in: Regenerate.
+	* lto-plugin.c (add_output_files): Argument is now a FILE.
+	(exec_lto_wrapper): Use writeargv and pex.
+
+2009-02-04  Rafael Avila de Espindola  <espindola@google.com>
+
+	Revert:
+	2009-02-04  Rafael Avila de Espindola  <espindola@google.com>
+	* lto-plugin.c (exec_lto_wrapper): Use writeargv.
+
+
+2009-02-04  Rafael Avila de Espindola  <espindola@google.com>
+
+	* lto-plugin.c (exec_lto_wrapper): Use writeargv.
+
+2009-01-29  Rafael Avila de Espindola  <espindola@google.com>
+
+	* lto-plugin.c: Include libiberty.h.
+	(exec_lto_wrapper, claim_file_handler): Use asprintf instead of
+	snprintf.
+
+2009-01-29  Rafael Avila de Espindola  <espindola@google.com>
+
+	* lto-plugin.c (exec_lto_wrapper): Write argv to a file. Pass that
+	file to lto-wrapper.
+
+2009-01-28  Rafael Avila de Espindola  <espindola@google.com>
+
+	* lto-plugin.c (plugin_file_info): Remove fd and elf.
+	(parse_table_entry): strdup entry->name and entry->comdat_key.
+	(free_1): Free name and comdat_key. Don't close the file. Don't call
+	elf_end.
+	(claim_file_handler): Always call elf_end.
+
+2008-12-23  Rafael Avila de Espindola  <espindola@google.com>
+
+	* Makefile.am (AM_CPPFLAGS): Add -D_LARGEFILE_SOURCE
+	-D_FILE_OFFSET_BITS=64
+	* Makefile.in: Regenerate
+
+2008-12-22  Rafael Avila de Espindola  <espindola@google.com>
+
+	* Makefile.am (gcc_version, target_noncanonical, libexecsubdir): New.
+	(lib_LTLIBRARIES): Rename to libexecsub_LTLIBRARIES.
+	* Makefile.in: Regenerate.
+	* acinclude.m4: Include ../config/acx.m4 and ../lt~obsolete.m4
+	* configure: Regenerate.
+	* configure.ac: Add AC_SUBST(target_noncanonical).
+
+2008-12-08  Rafael Avila de Espindola  <espindola@google.com>
+
+	* lto-plugin.c: Include stdbool.h.
+	(debug, nop): Declare as bool.
+
+2008-12-08  Rafael Avila de Espindola  <espindola@google.com>
+
+	* lto-plugin.c (nop): New.
+	(use_original_files): New.
+	(all_symbols_read_handler): Call use_original_files if nop is true.
+	(process_option): Parse the -nop option.
+
+2008-12-08  Rafael Avila de Espindola  <espindola@google.com>
+
+	* lto-plugin.c (debug): New.
+	(exec_lto_wrapper): Print argv if debug is true.
+	(process_option): Process the -debug command line option.
+
+2008-12-03  Rafael Avila de Espindola  <espindola@google.com>
+
+	* lto-plugin.c (process_option): The argument is now a single option,
+	not a space separated list.
+
+2008-12-02  Rafael Avila de Espindola  <espindola@google.com>
+
+	* lto-plugin.c: Include sys/types.h and sys/wait.h
+	(output_files, num_output_files, lto_wrapper_argv,
+	lto_wrapper_num_args): New.
+	(free_2): Free output_files.
+	(write_resolution): Disable.
+	(add_output_files): New.
+	(exec_lto_wrapper): New.
+	(all_symbols_read_handler): Run lto-wrapper.
+	(claim_file_handler): Free lto_file.name and call elf_end.
+	(process_option): New.
+
+2008-11-26  Rafael Espindola  <espindola@google.com>
+
+	* lto-plugin.c (add_input_file): New.
+	(get_section): Return NULL if get_section fails.
+	(write_resolution): New.
+	(all_symbols_read_handler): Call add_input_file.
+	(claim_file_handler): Unlink the correct file.
+	(onload): Record add_input_file.
+
+2008-09-23 Rafael Espindola  <espindola@google.com>
+
+	* Makefile.am (ltosymtab_SOURCES, liblto_plugin_la_SOURCES):
+	Update the location of common.c.
+	* Makefile.in: Regenerate.
+	* common.c: Moved to gcc/lto.
+	* common.h: Moved to gcc/lto.
+	* lto-plugin.c: Update the location of common.h.
+	* lto-symtab.c: Update the location of common.h.
+
+2008-09-23 Rafael Espindola  <espindola@google.com>
+
+	* common.c: Include common.h.
+	(lto_kind_str, lto_visibility_str, lto_resolution_str): Use explicit
+	sizes.
+	* common.h (lto_kind_str, lto_visibility_str, lto_resolution_str): Use
+	explicit sizes.
+
+2008-09-23 Rafael Espindola  <espindola@google.com>
+
+	* lto-plugin.c (plugin_file_info): Add temp.
+	(cleanup_handler): Only delete temporary files.
+	(claim_file_handler): Initialize lto_file.temp.
+
+2008-09-23  Rafael Espindola  <espindola@google.com>
+
+        * plugin-api.h: Moved to include.
+
+2008-09-23 Rafael Espindola  <espindola@google.com>
+
+	* lto-plugin.c (all_symbols_read_handler): Print resolution in a new
+	format.
+
+2008-09-22 Rafael Espindola  <espindola@google.com>
+
+	* plugin-api.h: Copy from binutils' cvs.
+
+2008-09-22 Rafael Espindola  <espindola@google.com>
+
+	* lto-symtab.c (get_symbols, add_symbols): Update signature.
+	* plugin-api.h: Copy from binutils' cvs.
+
+2008-09-22 Rafael Espindola  <espindola@google.com>
+
+	* common.h (lto_kind_str, lto_visibility_str, lto_resolution_str):
+	Make extern
+
+2008-09-10 Rafael Espindola  <espindola@google.com>
+
+	* lto-plugin.c (onload): add missing break statements and asserts.
+	* lto-symtab.c (claim_file_handler): Make it static.
+	(all_symbols_read_handler): Make it static.
+	(all_file_handles): Make it static.
+	(num_file_handles): Make it static.
+	(register_claim_file): Make it static.
+	(register_object): Indent properly.
+
+2008-09-10  Rafael Avila de Espindola  <espindola@google.com>
+
+	* Makefile.am (ltosymtab_LDADD): Add -lelf.
+	* Makefiel.in: Regenerate.
+	* lto-plugin.c: Include ar.h.
+	(claim_file_handler): Handle file->offset != 0.
+	* lto-symtab.c: Include gelf.h.
+	(all_file_handles): Change type.
+	(register_object): New.
+	(register_file): Add support for archives.
+	(resolve): Update to new type of all_file_handles.
+	(print): Update to new type of all_file_handles.
+	(free_all): Update to new type of all_file_handles.
+	(main): Update to new type of all_file_handles.
+
+2008-09-10  Rafael Avila de Espindola  <espindola@google.com>
+
+	* lto-plugin.c (get_string_table): Remove.
+	(get_section): Use elf_strptr instead of get_string_table.
+
+2008-09-08  Doug Kwan  <dougkwan@google.com>
+
+	* lto-plugin.c (all_symbols_read_handler): Widen fprintf arguments
+	to 64-bit to fix a 32-bit bootstrap failure due to format warnings.
+
+2008-09-08  Rafael Avila de Espindola  <espindola@google.com>
+
+	* Makefile.am (ltosymtab_SOURCES): add common.c.
+	(ltosymtab_CFLAGS): New.
+	(liblto_plugin_la_SOURCES): Add common.c.
+	* Makefile.in: Regenerate.
+	* common.c: New.
+	* common.h: New.
+	* lto-plugin.c: Include stdio.h, inttypes.h and common.h.
+	(plugin_symtab): New.
+	(plugin_file_info): New.
+	(register_all_symbols_read): New.
+	(get_symbols): New.
+	(claimed_files): New.
+	(num_claimed_files): New.
+	(translate): Don't drop the slot number.
+	(free_1): New.
+	(free_2): New.
+	(all_symbols_read_handler): New.
+	(claim_file_handler): Record every claimed file.
+	(onload): Handle LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK and
+	LDPT_GET_SYMBOLS.
+	* lto-symtab.c: Include stdlib.h, string.h and common.h.
+	(current_file_handle): Remove.
+	(ld_plugin_all_symbols_read_handler): New.
+	(plugin_handle): New.
+	(file_handle): New.
+	(all_file_handles): New.
+	(num_file_handles): New.
+	(get_symbols): New.
+	(register_all_symbols_read): New.
+	(add_symbols): Don't print the symbols, just record them.
+	(ld_plugin_tv): Add LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK and
+	LDPT_GET_SYMBOLS.
+	(load_plugin): Use plugin_handle.
+	(register_file): Add the file handle to all_file_handles.
+	(resolve): New.
+	(print): New.
+	(unload_plugin): New.
+	(free_all): New.
+	(main): Call all_symbols_read_handler and free resources.
+
+2008-09-03  Rafael Avila de Espindola  <espindola@google.com>
+
+	* Makefile.am (AM_CFLAGS): New.
+	(ltosymtab_LDADD): Remove -lelf. Add -ldl.
+	(lib_LTLIBRARIES): New.
+	(liblto_plugin_la_SOURCES): New.
+	(liblto_plugin_la_LIBADD): New.
+	* Makefile.in: Regenerate.
+	* acinclude.m4: Don't include ../config/acx.m4 and
+	../config/no-executables.m4.
+	Include ../ltsugar.m4, ../ltoptions.m4, ../ltversion.m4 and
+	../libtool.m4.
+	* aclocal.m4: Regenerate.
+	* configure: Regenerate.
+	* configure.ac: Use AM_PROG_LIBTOOL.
+	* lto-plugin.c: New.
+	* lto-symtab.c: Rewrite to use the plugin.
+	* plugin-api.h: New.
+
+2008-08-25  Rafael Avila de Espindola  <espindola@google.com>
+
+	* configure: Regenerate.
+	* configure.ac: Use AC_CHECK_GELF.
+	* lto-symtab.c: Include gelf.h.
+	(get_string_table): Use size independent API.
+	(printTable): Use lld to print 64 bit integers.
+
+2008-08-22  Rafael Avila de Espindola  <espindola@google.com>
+
+	* lto-symtab.c (parse_table_entry): Assert entry->kind and
+	entry->visibility are valid.
+
+2008-07-22  Rafael Avila de Espindola  <espindola@google.com>
+	* lto-symtab.c (table_entry): Add comdat.
+	(parse_table_entry): Read comdat.
+
+2008-08-21  Rafael Espindola  <espindola@google.com>
+
+	* Makefile.am: New.
+	* Makefile.in: New.
+	* acinclude.m4: New.
+	* aclocal.m4: New.
+	* configure: New.
+	* configure.ac: New.
+	* lto-symtab.c: New.
diff -rdupN --exclude=.svn --exclude=.git --exclude='*.diff*' --exclude='autom4te*' --exclude=tags --exclude=ChangeLog.lto --exclude=configure /usr/local/google/homedirs/dnovillo/gcc/trunk/lto-plugin/Makefile.am /usr/local/google/homedirs/dnovillo/gcc/trunk.lto/lto-plugin/Makefile.am
--- /usr/local/google/homedirs/dnovillo/gcc/trunk/lto-plugin/Makefile.am	1969-12-31 19:00:00.000000000 -0500
+++ /usr/local/google/homedirs/dnovillo/gcc/trunk.lto/lto-plugin/Makefile.am	2009-09-23 11:34:52.000000000 -0400
@@ -0,0 +1,26 @@
+# Makefile.am is used by automake 1.9.6 to generate Makefile.in.
+
+gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+target_noncanonical := @target_noncanonical@
+libexecsubdir := $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version)
+
+# How to find libelf
+LIBELFLIBS = @LIBELFLIBS@
+LIBELFINC = @LIBELFINC@
+
+AM_CPPFLAGS = -I$(top_srcdir)/../include -D_LARGEFILE_SOURCE \
+	-D_FILE_OFFSET_BITS=64 $(LIBELFINC)
+
+AM_CFLAGS = -Wall -Werror
+
+bin_PROGRAMS = ltosymtab
+
+ltosymtab_SOURCES = lto-symtab.c $(top_srcdir)/../gcc/lto/common.c
+ltosymtab_LDADD = $(LIBELFLIBS) -ldl
+#hack to use common.c in both targets
+ltosymtab_CFLAGS = $(AM_CFLAGS)
+
+libexecsub_LTLIBRARIES = liblto_plugin.la
+
+liblto_plugin_la_SOURCES = lto-plugin.c $(top_srcdir)/../gcc/lto/common.c
+liblto_plugin_la_LIBADD = $(LIBELFLIBS) -L../libiberty/pic -liberty
diff -rdupN --exclude=.svn --exclude=.git --exclude='*.diff*' --exclude='autom4te*' --exclude=tags --exclude=ChangeLog.lto --exclude=configure /usr/local/google/homedirs/dnovillo/gcc/trunk/lto-plugin/Makefile.in /usr/local/google/homedirs/dnovillo/gcc/trunk.lto/lto-plugin/Makefile.in
--- /usr/local/google/homedirs/dnovillo/gcc/trunk/lto-plugin/Makefile.in	1969-12-31 19:00:00.000000000 -0500
+++ /usr/local/google/homedirs/dnovillo/gcc/trunk.lto/lto-plugin/Makefile.in	2009-09-23 11:34:52.000000000 -0400
@@ -0,0 +1,686 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Makefile.am is used by automake 1.9.6 to generate Makefile.in.
+
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = .
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = ltosymtab$(EXEEXT)
+DIST_COMMON = $(am__configure_deps) $(srcdir)/../compile \
+	$(srcdir)/../config.guess $(srcdir)/../config.sub \
+	$(srcdir)/../depcomp $(srcdir)/../install-sh \
+	$(srcdir)/../ltmain.sh $(srcdir)/../missing \
+	$(srcdir)/../mkinstalldirs $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in $(top_srcdir)/configure ChangeLog
+subdir = .
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/../config/acx.m4 $(top_srcdir)/../lt~obsolete.m4 \
+	$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltoptions.m4 \
+	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../libtool.m4 \
+	$(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno configure.status.lineno
+mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libexecsubdir)" "$(DESTDIR)$(bindir)"
+libexecsubLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(libexecsub_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+liblto_plugin_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
+am_liblto_plugin_la_OBJECTS = lto-plugin.lo common.lo
+liblto_plugin_la_OBJECTS = $(am_liblto_plugin_la_OBJECTS)
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_ltosymtab_OBJECTS = ltosymtab-lto-symtab.$(OBJEXT) \
+	ltosymtab-common.$(OBJEXT)
+ltosymtab_OBJECTS = $(am_ltosymtab_OBJECTS)
+ltosymtab_DEPENDENCIES = $(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+depcomp = $(SHELL) $(top_srcdir)/../depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(liblto_plugin_la_SOURCES) $(ltosymtab_SOURCES)
+DIST_SOURCES = $(liblto_plugin_la_SOURCES) $(ltosymtab_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+  { test ! -d $(distdir) \
+    || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
+         && rm -fr $(distdir); }; }
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBELFINC = @LIBELFINC@
+
+# How to find libelf
+LIBELFLIBS = @LIBELFLIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_libsubdir = @build_libsubdir@
+build_os = @build_os@
+build_subdir = @build_subdir@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_subdir = @host_subdir@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+target_noncanonical := @target_noncanonical@
+target_subdir = @target_subdir@
+gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+libexecsubdir := $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version)
+AM_CPPFLAGS = -I$(top_srcdir)/../include -D_LARGEFILE_SOURCE \
+	-D_FILE_OFFSET_BITS=64 $(LIBELFINC)
+
+AM_CFLAGS = -Wall -Werror
+ltosymtab_SOURCES = lto-symtab.c $(top_srcdir)/../gcc/lto/common.c
+ltosymtab_LDADD = $(LIBELFLIBS) -ldl
+#hack to use common.c in both targets
+ltosymtab_CFLAGS = $(AM_CFLAGS)
+libexecsub_LTLIBRARIES = liblto_plugin.la
+liblto_plugin_la_SOURCES = lto-plugin.c $(top_srcdir)/../gcc/lto/common.c
+liblto_plugin_la_LIBADD = $(LIBELFLIBS) -L../libiberty/pic -liberty
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+am--refresh:
+	@:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
+	      cd $(srcdir) && $(AUTOMAKE) --foreign  \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    echo ' $(SHELL) ./config.status'; \
+	    $(SHELL) ./config.status;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	$(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+install-libexecsubLTLIBRARIES: $(libexecsub_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(libexecsubdir)" || $(mkdir_p) "$(DESTDIR)$(libexecsubdir)"
+	@list='$(libexecsub_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) --mode=install $(libexecsubLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libexecsubdir)/$$f'"; \
+	    $(LIBTOOL) --mode=install $(libexecsubLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libexecsubdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-libexecsubLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@set -x; list='$(libexecsub_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libexecsubdir)/$$p'"; \
+	  $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libexecsubdir)/$$p"; \
+	done
+
+clean-libexecsubLTLIBRARIES:
+	-test -z "$(libexecsub_LTLIBRARIES)" || rm -f $(libexecsub_LTLIBRARIES)
+	@list='$(libexecsub_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+liblto_plugin.la: $(liblto_plugin_la_OBJECTS) $(liblto_plugin_la_DEPENDENCIES) 
+	$(LINK) -rpath $(libexecsubdir) $(liblto_plugin_la_LDFLAGS) $(liblto_plugin_la_OBJECTS) $(liblto_plugin_la_LIBADD) $(LIBS)
+install-binPROGRAMS: $(bin_PROGRAMS)
+	@$(NORMAL_INSTALL)
+	test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  if test -f $$p \
+	     || test -f $$p1 \
+	  ; then \
+	    f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+	   echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+	   $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+	  else :; fi; \
+	done
+
+uninstall-binPROGRAMS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+	  echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(bindir)/$$f"; \
+	done
+
+clean-binPROGRAMS:
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  echo " rm -f $$p $$f"; \
+	  rm -f $$p $$f ; \
+	done
+ltosymtab$(EXEEXT): $(ltosymtab_OBJECTS) $(ltosymtab_DEPENDENCIES) 
+	@rm -f ltosymtab$(EXEEXT)
+	$(LINK) $(ltosymtab_LDFLAGS) $(ltosymtab_OBJECTS) $(ltosymtab_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lto-plugin.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ltosymtab-common.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ltosymtab-lto-symtab.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+common.lo: $(top_srcdir)/../gcc/lto/common.c
+@am__fastdepCC_TRUE@	if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT common.lo -MD -MP -MF "$(DEPDIR)/common.Tpo" -c -o common.lo `test -f '$(top_srcdir)/../gcc/lto/common.c' || echo '$(srcdir)/'`$(top_srcdir)/../gcc/lto/common.c; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/common.Tpo" "$(DEPDIR)/common.Plo"; else rm -f "$(DEPDIR)/common.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$(top_srcdir)/../gcc/lto/common.c' object='common.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o common.lo `test -f '$(top_srcdir)/../gcc/lto/common.c' || echo '$(srcdir)/'`$(top_srcdir)/../gcc/lto/common.c
+
+ltosymtab-lto-symtab.o: lto-symtab.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ltosymtab_CFLAGS) $(CFLAGS) -MT ltosymtab-lto-symtab.o -MD -MP -MF "$(DEPDIR)/ltosymtab-lto-symtab.Tpo" -c -o ltosymtab-lto-symtab.o `test -f 'lto-symtab.c' || echo '$(srcdir)/'`lto-symtab.c; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/ltosymtab-lto-symtab.Tpo" "$(DEPDIR)/ltosymtab-lto-symtab.Po"; else rm -f "$(DEPDIR)/ltosymtab-lto-symtab.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='lto-symtab.c' object='ltosymtab-lto-symtab.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ltosymtab_CFLAGS) $(CFLAGS) -c -o ltosymtab-lto-symtab.o `test -f 'lto-symtab.c' || echo '$(srcdir)/'`lto-symtab.c
+
+ltosymtab-lto-symtab.obj: lto-symtab.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ltosymtab_CFLAGS) $(CFLAGS) -MT ltosymtab-lto-symtab.obj -MD -MP -MF "$(DEPDIR)/ltosymtab-lto-symtab.Tpo" -c -o ltosymtab-lto-symtab.obj `if test -f 'lto-symtab.c'; then $(CYGPATH_W) 'lto-symtab.c'; else $(CYGPATH_W) '$(srcdir)/lto-symtab.c'; fi`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/ltosymtab-lto-symtab.Tpo" "$(DEPDIR)/ltosymtab-lto-symtab.Po"; else rm -f "$(DEPDIR)/ltosymtab-lto-symtab.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='lto-symtab.c' object='ltosymtab-lto-symtab.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ltosymtab_CFLAGS) $(CFLAGS) -c -o ltosymtab-lto-symtab.obj `if test -f 'lto-symtab.c'; then $(CYGPATH_W) 'lto-symtab.c'; else $(CYGPATH_W) '$(srcdir)/lto-symtab.c'; fi`
+
+ltosymtab-common.o: $(top_srcdir)/../gcc/lto/common.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ltosymtab_CFLAGS) $(CFLAGS) -MT ltosymtab-common.o -MD -MP -MF "$(DEPDIR)/ltosymtab-common.Tpo" -c -o ltosymtab-common.o `test -f '$(top_srcdir)/../gcc/lto/common.c' || echo '$(srcdir)/'`$(top_srcdir)/../gcc/lto/common.c; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/ltosymtab-common.Tpo" "$(DEPDIR)/ltosymtab-common.Po"; else rm -f "$(DEPDIR)/ltosymtab-common.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$(top_srcdir)/../gcc/lto/common.c' object='ltosymtab-common.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ltosymtab_CFLAGS) $(CFLAGS) -c -o ltosymtab-common.o `test -f '$(top_srcdir)/../gcc/lto/common.c' || echo '$(srcdir)/'`$(top_srcdir)/../gcc/lto/common.c
+
+ltosymtab-common.obj: $(top_srcdir)/../gcc/lto/common.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ltosymtab_CFLAGS) $(CFLAGS) -MT ltosymtab-common.obj -MD -MP -MF "$(DEPDIR)/ltosymtab-common.Tpo" -c -o ltosymtab-common.obj `if test -f '$(top_srcdir)/../gcc/lto/common.c'; then $(CYGPATH_W) '$(top_srcdir)/../gcc/lto/common.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/../gcc/lto/common.c'; fi`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/ltosymtab-common.Tpo" "$(DEPDIR)/ltosymtab-common.Po"; else rm -f "$(DEPDIR)/ltosymtab-common.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$(top_srcdir)/../gcc/lto/common.c' object='ltosymtab-common.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ltosymtab_CFLAGS) $(CFLAGS) -c -o ltosymtab-common.obj `if test -f '$(top_srcdir)/../gcc/lto/common.c'; then $(CYGPATH_W) '$(top_srcdir)/../gcc/lto/common.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/../gcc/lto/common.c'; fi`
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	$(am__remove_distdir)
+	mkdir $(distdir)
+	$(mkdir_p) $(distdir)/.. $(distdir)/../config
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+	-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+	  ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
+	|| chmod -R a+r $(distdir)
+dist-gzip: distdir
+	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+	$(am__remove_distdir)
+
+dist-bzip2: distdir
+	tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+	$(am__remove_distdir)
+
+dist-tarZ: distdir
+	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+	$(am__remove_distdir)
+
+dist-shar: distdir
+	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+	$(am__remove_distdir)
+
+dist-zip: distdir
+	-rm -f $(distdir).zip
+	zip -rq $(distdir).zip $(distdir)
+	$(am__remove_distdir)
+
+dist dist-all: distdir
+	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+	$(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration.  Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+	case '$(DIST_ARCHIVES)' in \
+	*.tar.gz*) \
+	  GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+	*.tar.bz2*) \
+	  bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+	*.tar.Z*) \
+	  uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+	*.shar.gz*) \
+	  GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+	*.zip*) \
+	  unzip $(distdir).zip ;;\
+	esac
+	chmod -R a-w $(distdir); chmod a+w $(distdir)
+	mkdir $(distdir)/_build
+	mkdir $(distdir)/_inst
+	chmod a-w $(distdir)
+	dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+	  && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+	  && cd $(distdir)/_build \
+	  && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+	    $(DISTCHECK_CONFIGURE_FLAGS) \
+	  && $(MAKE) $(AM_MAKEFLAGS) \
+	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
+	  && $(MAKE) $(AM_MAKEFLAGS) check \
+	  && $(MAKE) $(AM_MAKEFLAGS) install \
+	  && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+	  && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+	  && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+	        distuninstallcheck \
+	  && chmod -R a-w "$$dc_install_base" \
+	  && ({ \
+	       (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+	            distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+	      } || { rm -rf "$$dc_destdir"; exit 1; }) \
+	  && rm -rf "$$dc_destdir" \
+	  && $(MAKE) $(AM_MAKEFLAGS) dist \
+	  && rm -rf $(DIST_ARCHIVES) \
+	  && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+	$(am__remove_distdir)
+	@(echo "$(distdir) archives ready for distribution: "; \
+	  list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+	  sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
+distuninstallcheck:
+	@cd $(distuninstallcheck_dir) \
+	&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+	   || { echo "ERROR: files left after uninstall:" ; \
+	        if test -n "$(DESTDIR)"; then \
+	          echo "  (check DESTDIR support)"; \
+	        fi ; \
+	        $(distuninstallcheck_listfiles) ; \
+	        exit 1; } >&2
+distcleancheck: distclean
+	@if test '$(srcdir)' = . ; then \
+	  echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+	  exit 1 ; \
+	fi
+	@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+	  || { echo "ERROR: files left in build directory after distclean:" ; \
+	       $(distcleancheck_listfiles) ; \
+	       exit 1; } >&2
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS)
+installdirs:
+	for dir in "$(DESTDIR)$(libexecsubdir)" "$(DESTDIR)$(bindir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libexecsubLTLIBRARIES \
+	clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-binPROGRAMS install-libexecsubLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
+	-rm -rf $(top_srcdir)/autom4te.cache
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-info-am \
+	uninstall-libexecsubLTLIBRARIES
+
+.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \
+	clean-binPROGRAMS clean-generic clean-libexecsubLTLIBRARIES \
+	clean-libtool ctags dist dist-all dist-bzip2 dist-gzip \
+	dist-shar dist-tarZ dist-zip distcheck distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distcleancheck distdir distuninstallcheck dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-binPROGRAMS install-data install-data-am install-exec \
+	install-exec-am install-info install-info-am \
+	install-libexecsubLTLIBRARIES install-man install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-binPROGRAMS \
+	uninstall-info-am uninstall-libexecsubLTLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff -rdupN --exclude=.svn --exclude=.git --exclude='*.diff*' --exclude='autom4te*' --exclude=tags --exclude=ChangeLog.lto --exclude=configure /usr/local/google/homedirs/dnovillo/gcc/trunk/lto-plugin/acinclude.m4 /usr/local/google/homedirs/dnovillo/gcc/trunk.lto/lto-plugin/acinclude.m4
--- /usr/local/google/homedirs/dnovillo/gcc/trunk/lto-plugin/acinclude.m4	1969-12-31 19:00:00.000000000 -0500
+++ /usr/local/google/homedirs/dnovillo/gcc/trunk.lto/lto-plugin/acinclude.m4	2009-09-23 11:34:52.000000000 -0400
@@ -0,0 +1,7 @@
+m4_include([../config/acx.m4])
+m4_include([../lt~obsolete.m4])
+m4_include([../ltsugar.m4])
+m4_include([../ltoptions.m4])
+m4_include([../ltversion.m4])
+
+sinclude(../libtool.m4)
diff -rdupN --exclude=.svn --exclude=.git --exclude='*.diff*' --exclude='autom4te*' --exclude=tags --exclude=ChangeLog.lto --exclude=configure /usr/local/google/homedirs/dnovillo/gcc/trunk/lto-plugin/aclocal.m4 /usr/local/google/homedirs/dnovillo/gcc/trunk.lto/lto-plugin/aclocal.m4
--- /usr/local/google/homedirs/dnovillo/gcc/trunk/lto-plugin/aclocal.m4	1969-12-31 19:00:00.000000000 -0500
+++ /usr/local/google/homedirs/dnovillo/gcc/trunk.lto/lto-plugin/aclocal.m4	2009-09-23 11:34:52.000000000 -0400
@@ -0,0 +1,851 @@
+# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005  Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+# Copyright (C) 2002, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION so it can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+	 [AM_AUTOMAKE_VERSION([1.9.6])])
+
+# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory.  The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run.  This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+#    fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+#    fails if $ac_aux_dir is absolute,
+#    fails when called from a subdirectory in a VPATH build with
+#          a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir.  In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
+#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+#   MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH.  The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL                                            -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 7
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
+	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])
+AC_SUBST([$1_FALSE])
+if $2; then
+  $1_TRUE=
+  $1_FALSE='#'
+else
+  $1_TRUE='#'
+  $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+  AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 8
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery.  Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
+       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
+       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
+                   [depcc="$$1"   am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+               [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_$1_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_$1_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])
+])
+
+# Generate code to set up dependency tracking.              -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+#serial 3
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[for mf in $CONFIG_FILES; do
+  # Strip MF so we end up with the name of the file.
+  mf=`echo "$mf" | sed -e 's/:.*$//'`
+  # Check whether this is an Automake generated Makefile or not.
+  # We used to match only the files named `Makefile.in', but
+  # some people rename them; so instead we look at the file content.
+  # Grep'ing the first line is not enough: some people post-process
+  # each Makefile.in and add a new line on top of each file to say so.
+  # So let's grep whole file.
+  if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+    dirpart=`AS_DIRNAME("$mf")`
+  else
+    continue
+  fi
+  # Extract the definition of DEPDIR, am__include, and am__quote
+  # from the Makefile without running `make'.
+  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+  test -z "$DEPDIR" && continue
+  am__include=`sed -n 's/^am__include = //p' < "$mf"`
+  test -z "am__include" && continue
+  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+  # When using ansi2knr, U may be empty or an underscore; expand it
+  U=`sed -n 's/^U = //p' < "$mf"`
+  # Find all dependency output files, they are included files with
+  # $(DEPDIR) in their names.  We invoke sed twice because it is the
+  # simplest approach to changing $(DEPDIR) to its actual value in the
+  # expansion.
+  for file in `sed -n "
+    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+    # Make sure the directory exists.
+    test -f "$dirpart/$file" && continue
+    fdir=`AS_DIRNAME(["$file"])`
+    AS_MKDIR_P([$dirpart/$fdir])
+    # echo "creating $dirpart/$file"
+    echo '# dummy' > "$dirpart/$file"
+  done
+done
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled.  FIXME.  This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Do all the work for Automake.                             -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 12
+
+# This macro actually does too much.  Some checks are only needed if
+# your package does certain things.  But this isn't really a big deal.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out.  PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition.  After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.58])dnl
+dnl Autoconf wants to disallow AM_ names.  We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+   test -f $srcdir/config.status; then
+  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_PROG_INSTALL_SH
+AM_PROG_INSTALL_STRIP
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+              [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+	      		     [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+                  [_AM_DEPENDENCIES(CC)],
+                  [define([AC_PROG_CC],
+                          defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+                  [_AM_DEPENDENCIES(CXX)],
+                  [define([AC_PROG_CXX],
+                          defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+])
+])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated.  The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $1 | $1:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+AC_SUBST(install_sh)])
+
+# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot.  For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Check to see how 'make' treats includes.	            -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+	@echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+   am__include=include
+   am__quote=
+   _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+      am__include=.include
+      am__quote="\""
+      _am_result=BSD
+   fi
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# Copyright (C) 2003, 2004, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
+#
+# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
+# created by `make install' are always world readable, even if the
+# installer happens to have an overly restrictive umask (e.g. 077).
+# This was a mistake.  There are at least two reasons why we must not
+# use `-m 0755':
+#   - it causes special bits like SGID to be ignored,
+#   - it may be too restrictive (some setups expect 775 directories).
+#
+# Do not use -m 0755 and let people choose whatever they expect by
+# setting umask.
+#
+# We cannot accept any implementation of `mkdir' that recognizes `-p'.
+# Some implementations (such as Solaris 8's) are not thread-safe: if a
+# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
+# concurrently, both version can detect that a/ is missing, but only
+# one can create it and the other will error out.  Consequently we
+# restrict ourselves to GNU make (using the --version option ensures
+# this.)
+AC_DEFUN([AM_PROG_MKDIR_P],
+[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+  # We used to keeping the `.' as first argument, in order to
+  # allow $(mkdir_p) to be used without argument.  As in
+  #   $(mkdir_p) $(somedir)
+  # where $(somedir) is conditionally defined.  However this is wrong
+  # for two reasons:
+  #  1. if the package is installed by a user who cannot write `.'
+  #     make install will fail,
+  #  2. the above comment should most certainly read
+  #     $(mkdir_p) $(DESTDIR)$(somedir)
+  #     so it does not work when $(somedir) is undefined and
+  #     $(DESTDIR) is not.
+  #  To support the latter case, we have to write
+  #     test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+  #  so the `.' trick is pointless.
+  mkdir_p='mkdir -p --'
+else
+  # On NextStep and OpenStep, the `mkdir' command does not
+  # recognize any option.  It will interpret all options as
+  # directories to create, and then abort because `.' already
+  # exists.
+  for d in ./-p ./--version;
+  do
+    test -d $d && rmdir $d
+  done
+  # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+  if test -f "$ac_aux_dir/mkinstalldirs"; then
+    mkdir_p='$(mkinstalldirs)'
+  else
+    mkdir_p='$(install_sh) -d'
+  fi
+fi
+AC_SUBST([mkdir_p])])
+
+# Helper functions for option handling.                     -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME.  Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Check to make sure that the build environment is sane.    -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   if test "$[*]" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$[*]" != "X $srcdir/configure conftest.file" \
+      && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
+alias in your environment])
+   fi
+
+   test "$[2]" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries.  This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+  AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Check how to create a tarball.                            -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+#     tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+#     $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.
+AM_MISSING_PROG([AMTAR], [tar])
+m4_if([$1], [v7],
+     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+     [m4_case([$1], [ustar],, [pax],,
+              [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+  case $_am_tool in
+  gnutar)
+    for _am_tar in tar gnutar gtar;
+    do
+      AM_RUN_LOG([$_am_tar --version]) && break
+    done
+    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+    am__untar="$_am_tar -xf -"
+    ;;
+  plaintar)
+    # Must skip GNU tar: if it does not support --format= it doesn't create
+    # ustar tarball either.
+    (tar --version) >/dev/null 2>&1 && continue
+    am__tar='tar chf - "$$tardir"'
+    am__tar_='tar chf - "$tardir"'
+    am__untar='tar xf -'
+    ;;
+  pax)
+    am__tar='pax -L -x $1 -w "$$tardir"'
+    am__tar_='pax -L -x $1 -w "$tardir"'
+    am__untar='pax -r'
+    ;;
+  cpio)
+    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+    am__untar='cpio -i -H $1 -d'
+    ;;
+  none)
+    am__tar=false
+    am__tar_=false
+    am__untar=false
+    ;;
+  esac
+
+  # If the value was cached, stop now.  We just wanted to have am__tar
+  # and am__untar set.
+  test -n "${am_cv_prog_tar_$1}" && break
+
+  # tar/untar a dummy directory, and stop if the command works
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  echo GrepMe > conftest.dir/file
+  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+  rm -rf conftest.dir
+  if test -s conftest.tar; then
+    AM_RUN_LOG([$am__untar <conftest.tar])
+    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+  fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
+m4_include([acinclude.m4])
diff -rdupN --exclude=.svn --exclude=.git --exclude='*.diff*' --exclude='autom4te*' --exclude=tags --exclude=ChangeLog.lto --exclude=configure /usr/local/google/homedirs/dnovillo/gcc/trunk/lto-plugin/configure.ac /usr/local/google/homedirs/dnovillo/gcc/trunk.lto/lto-plugin/configure.ac
--- /usr/local/google/homedirs/dnovillo/gcc/trunk/lto-plugin/configure.ac	1969-12-31 19:00:00.000000000 -0500
+++ /usr/local/google/homedirs/dnovillo/gcc/trunk.lto/lto-plugin/configure.ac	2009-09-23 11:34:52.000000000 -0400
@@ -0,0 +1,11 @@
+AC_PREREQ(2.59)
+AC_INIT([LTO plugin for ld], 0.1,,[lto-plugin])
+GCC_TOPLEV_SUBDIRS
+AM_INIT_AUTOMAKE([foreign])
+AC_PROG_CC
+AC_ARG_VAR(LIBELFLIBS,[How to link libelf])
+AC_ARG_VAR(LIBELFINC,[How to find libelf include files])
+AM_PROG_LIBTOOL
+AC_SUBST(target_noncanonical)
+AC_CONFIG_FILES(Makefile)
+AC_OUTPUT
diff -rdupN --exclude=.svn --exclude=.git --exclude='*.diff*' --exclude='autom4te*' --exclude=tags --exclude=ChangeLog.lto --exclude=configure /usr/local/google/homedirs/dnovillo/gcc/trunk/lto-plugin/lto-plugin.c /usr/local/google/homedirs/dnovillo/gcc/trunk.lto/lto-plugin/lto-plugin.c
--- /usr/local/google/homedirs/dnovillo/gcc/trunk/lto-plugin/lto-plugin.c	1969-12-31 19:00:00.000000000 -0500
+++ /usr/local/google/homedirs/dnovillo/gcc/trunk.lto/lto-plugin/lto-plugin.c	2009-09-23 11:34:52.000000000 -0400
@@ -0,0 +1,674 @@
+/* LTO plugin for gold.
+   Copyright (C) 2008 Free Software Foundation, Inc.
+   Contributed by Rafael Avila de Espindola (espindola@google.com).
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+/* The plugin has only one external function: onload. Gold passes it an array of
+   function that the plugin uses to communicate back to gold.
+
+   With the functions provided by gold, the plugin can be notified when
+   gold first analyzes a file and pass a symbol table back to gold. The plugin
+   is also notified when all symbols have been read and it is time to generate
+   machine code for the necessary symbols.
+
+   More information at http://gcc.gnu.org/wiki/whopr/driver.
+
+   This plugin should be passed the lto-wrapper options and will forward them.
+   It also has 2 options of its own:
+   -debug: Print the command line used to run lto-wrapper.
+   -nop: Instead of running lto-wrapper, pass the original to the plugin. This
+   only works if the input files are hybrid.  */
+
+#include <assert.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <inttypes.h>
+#include <ar.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <stdbool.h>
+#include <libiberty.h>
+
+/* The presence of gelf.h is checked by the toplevel configure script.  */
+#include <gelf.h>
+
+#include "plugin-api.h"
+#include "../gcc/lto/common.h"
+
+/* The part of the symbol table the plugin has to keep track of. Note that we
+   must keep SYMS until all_symbols_read is called to give the linker time to
+   copy the symbol information. */
+
+struct plugin_symtab
+{
+  int nsyms;
+  uint32_t *slots;
+  struct ld_plugin_symbol *syms;
+};
+
+/* All that we have to remember about a file. */
+
+struct plugin_file_info
+{
+  char *name;
+  void *handle;
+  struct plugin_symtab symtab;
+  unsigned char temp;
+};
+
+
+static char *temp_obj_dir_name;
+static ld_plugin_register_claim_file register_claim_file;
+static ld_plugin_add_symbols add_symbols;
+static ld_plugin_register_all_symbols_read register_all_symbols_read;
+static ld_plugin_get_symbols get_symbols;
+static ld_plugin_register_cleanup register_cleanup;
+static ld_plugin_add_input_file add_input_file;
+
+static struct plugin_file_info *claimed_files = NULL;
+static unsigned int num_claimed_files = 0;
+
+static char **output_files = NULL;
+static unsigned int num_output_files = 0;
+
+static char **lto_wrapper_argv;
+static int lto_wrapper_num_args;
+
+static char *libgcc_filename = NULL;
+
+static bool debug;
+static bool nop;
+
+/* Parse an entry of the IL symbol table. The data to be parsed is pointed
+   by P and the result is written in ENTRY. The slot number is stored in SLOT.
+   Returns the address of the next entry. */
+
+static char *
+parse_table_entry (char *p, struct ld_plugin_symbol *entry, uint32_t *slot)
+{
+  unsigned char t;
+  enum ld_plugin_symbol_kind translate_kind[] =
+    {
+      LDPK_DEF,
+      LDPK_WEAKDEF,
+      LDPK_UNDEF,
+      LDPK_WEAKUNDEF,
+      LDPK_COMMON
+    };
+
+  enum ld_plugin_symbol_visibility translate_visibility[] =
+    {
+      LDPV_DEFAULT,
+      LDPV_PROTECTED,
+      LDPV_INTERNAL,
+      LDPV_HIDDEN
+    };
+
+  entry->name = strdup (p);
+  while (*p)
+    p++;
+  p++;
+
+  entry->version = NULL;
+
+  entry->comdat_key = p;
+  while (*p)
+    p++;
+  p++;
+
+  if (strlen (entry->comdat_key) == 0)
+    entry->comdat_key = NULL;
+  else
+    entry->comdat_key = strdup (entry->comdat_key);
+
+  t = *p;
+  assert (t <= 4);
+  entry->def = translate_kind[t];
+  p++;
+
+  t = *p;
+  assert (t <= 3);
+  entry->visibility = translate_visibility[t];
+  p++;
+
+  entry->size = *(uint64_t *) p;
+  p += 8;
+
+  *slot = *(uint32_t *) p;
+  p += 4;
+
+  entry->resolution = LDPR_UNKNOWN;
+
+  return p;
+}
+
+/* Return the section in ELF that is named NAME. */
+
+static Elf_Scn *
+get_section (Elf *elf, const char *name)
+{
+  Elf_Scn *section = 0;
+  GElf_Ehdr header;
+  GElf_Ehdr *t = gelf_getehdr (elf, &header);
+  if (t == NULL)
+    return NULL;
+  assert (t == &header);
+
+  while ((section = elf_nextscn(elf, section)) != 0)
+    {
+      GElf_Shdr shdr;
+      GElf_Shdr *tshdr = gelf_getshdr (section, &shdr);
+      const char *t;
+      assert (tshdr == &shdr);
+      t = elf_strptr (elf, header.e_shstrndx, shdr.sh_name);
+      assert (t != NULL);
+      if (strcmp (t, name) == 0)
+	return section;
+    }
+  return NULL;
+}
+
+/* Returns the IL symbol table of file ELF. */
+
+static Elf_Data *
+get_symtab (Elf *elf)
+{
+  Elf_Data *data = 0;
+  Elf_Scn *section = get_section (elf, ".gnu.lto_.symtab");
+  if (!section)
+    return NULL;
+
+  data = elf_getdata (section, data);
+  assert (data);
+  return data;
+}
+
+/* Translate the IL symbol table SYMTAB. Write the slots and symbols in OUT. */
+
+static void
+translate (Elf_Data *symtab, struct plugin_symtab *out)
+{
+  uint32_t *slots = NULL;
+  char *data = symtab->d_buf;
+  char *end = data + symtab->d_size;
+  struct ld_plugin_symbol *syms = NULL;
+  int n = 0;
+
+  while (data < end)
+    {
+      n++;
+      syms = realloc (syms, n * sizeof (struct ld_plugin_symbol));
+      assert (syms);
+      slots = realloc (slots, n * sizeof (uint32_t));
+      assert (slots);
+      data = parse_table_entry (data, &syms[n - 1], &slots[n - 1]);
+    }
+
+  out->nsyms = n;
+  out->syms = syms;
+  out->slots = slots;
+}
+
+/* Free all memory that is no longer needed at the beginning of all_symbols_read. */
+
+static void
+free_1 (void)
+{
+  unsigned int i;
+  for (i = 0; i < num_claimed_files; i++)
+    {
+      struct plugin_file_info *info = &claimed_files[i];
+      struct plugin_symtab *symtab = &info->symtab;
+      unsigned int j;
+      for (j = 0; j < symtab->nsyms; j++)
+	{
+	  struct ld_plugin_symbol *s = &symtab->syms[j];
+	  free (s->name);
+	  if (s->comdat_key)
+	    free (s->comdat_key);
+	}
+      free (symtab->syms);
+      symtab->syms = NULL;
+    }
+}
+
+/* Free all remaining memory. */
+
+static void
+free_2 (void)
+{
+  unsigned int i;
+  for (i = 0; i < num_claimed_files; i++)
+    {
+      struct plugin_file_info *info = &claimed_files[i];
+      struct plugin_symtab *symtab = &info->symtab;
+      free (symtab->slots);
+      free (info->name);
+    }
+
+  for (i = 0; i < num_output_files; i++)
+    free (output_files[i]);
+  free (output_files);
+
+  free (claimed_files);
+  claimed_files = NULL;
+  num_claimed_files = 0;
+
+  free (temp_obj_dir_name);
+  temp_obj_dir_name = NULL;
+}
+
+/*  Writes the relocations to disk. */
+
+static void
+write_resolution (void)
+{
+  unsigned int i;
+  FILE *f;
+  /* FIXME: Disabled for now since we are not using the resolution file. */
+  return;
+
+
+  /* FIXME: This should be a temporary file. */
+  f = fopen ("resolution", "w");
+
+  fprintf (f, "%d\n", num_claimed_files);
+
+  for (i = 0; i < num_claimed_files; i++)
+    {
+      struct plugin_file_info *info = &claimed_files[i];
+      struct plugin_symtab *symtab = &info->symtab;
+      struct ld_plugin_symbol *syms = calloc (symtab->nsyms,
+					      sizeof (struct ld_plugin_symbol));
+      unsigned j;
+
+      assert (syms);
+      get_symbols (info->handle, symtab->nsyms, syms);
+
+      fprintf (f, "%s %d\n", info->name, info->symtab.nsyms);
+
+      for (j = 0; j < info->symtab.nsyms; j++)
+	{
+	  uint32_t slot = symtab->slots[j];
+	  unsigned int resolution = syms[j].resolution;
+	  fprintf (f, "%d %s\n", slot, lto_resolution_str[resolution]);
+	}
+      free (syms);
+    }
+  fclose (f);
+}
+
+/* Pass files generated by the lto-wrapper to the linker. FD is lto-wrapper's
+   stdout. */
+
+static void
+add_output_files (FILE *f)
+{
+  char fname[1000]; /* FIXME: Is this big enough? */
+
+  for (;;)
+    {
+      size_t len;
+      char *s = fgets (fname, sizeof (fname), f);
+      if (!s)
+	break;
+
+      len = strlen (s);
+      assert (s[len - 1] == '\n');
+      s[len - 1] = '\0';
+
+      num_output_files++;
+      output_files = realloc (output_files, num_output_files * sizeof (char *));
+      output_files[num_output_files - 1] = strdup (s);
+      add_input_file (output_files[num_output_files - 1]);
+    }
+}
+
+/* Execute the lto-wrapper. ARGV[0] is the binary. The rest of ARGV is the
+   argument list. */
+
+static void
+exec_lto_wrapper (char *argv[])
+{
+  int t;
+  int status;
+  char *at_args;
+  char *args_name;
+  FILE *args;
+  FILE *wrapper_output;
+  char *new_argv[3];
+  struct pex_obj *pex;
+  const char *errmsg;
+
+  /* Write argv to a file to avoid a command line that is too long. */
+  t = asprintf (&at_args, "@%s/arguments", temp_obj_dir_name);
+  assert (t >= 0);
+
+  args_name = at_args + 1;
+  args = fopen (args_name, "w");
+  assert (args);
+
+  t = writeargv (&argv[1], args);
+  assert (t == 0);
+  t = fclose (args);
+  assert (t == 0);
+
+  new_argv[0] = argv[0];
+  new_argv[1] = at_args;
+  new_argv[2] = NULL;
+
+  if (debug)
+    {
+      int i;
+      for (i = 0; new_argv[i]; i++)
+	fprintf (stderr, "%s ", new_argv[i]);
+      fprintf (stderr, "\n");
+    }
+
+
+  pex = pex_init (PEX_USE_PIPES, "lto-wrapper", NULL);
+  assert (pex != NULL);
+
+  errmsg = pex_run (pex, 0, new_argv[0], new_argv, NULL, NULL, &t);
+  assert (errmsg == NULL);
+  assert (t == 0);
+
+  wrapper_output = pex_read_output (pex, 0);
+  assert (wrapper_output);
+
+  add_output_files (wrapper_output);
+
+  t = pex_get_status (pex, 1, &status);
+  assert (t == 1);
+  assert (WIFEXITED (status) && WEXITSTATUS (status) == 0);
+
+  pex_free (pex);
+
+  t = unlink (args_name);
+  assert (t == 0);
+  free (at_args);
+}
+
+/* Pass the original files back to the linker. */
+
+static void
+use_original_files (void)
+{
+  unsigned i;
+  for (i = 0; i < num_claimed_files; i++)
+    {
+      struct plugin_file_info *info = &claimed_files[i];
+      add_input_file (info->name);
+    }
+}
+
+
+/* Called by the linker once all symbols have been read. */
+
+static enum ld_plugin_status
+all_symbols_read_handler (void)
+{
+  unsigned i;
+  unsigned num_lto_args = num_claimed_files + lto_wrapper_num_args + 1;
+  char **lto_argv;
+  const char **lto_arg_ptr;
+  if (num_claimed_files == 0)
+    return LDPS_OK;
+
+  free_1 ();
+
+  if (nop)
+    {
+      use_original_files ();
+      return LDPS_OK;
+    }
+
+  lto_argv = (char **) calloc (sizeof (char *), num_lto_args);
+  lto_arg_ptr = (const char **) lto_argv;
+  assert (lto_wrapper_argv);
+
+  write_resolution ();
+
+  for (i = 0; i < lto_wrapper_num_args; i++)
+    *lto_arg_ptr++ = lto_wrapper_argv[i];
+
+  for (i = 0; i < num_claimed_files; i++)
+    {
+      struct plugin_file_info *info = &claimed_files[i];
+
+      *lto_arg_ptr++ = info->name;
+    }
+
+  *lto_arg_ptr++ = NULL;
+  exec_lto_wrapper (lto_argv);
+
+  free (lto_argv);
+
+  if (libgcc_filename)
+    add_input_file (libgcc_filename);
+
+  free (libgcc_filename);
+  libgcc_filename = NULL;
+
+  return LDPS_OK;
+}
+
+/* Remove temporary files at the end of the link. */
+
+static enum ld_plugin_status
+cleanup_handler (void)
+{
+  int t;
+  unsigned i;
+
+  for (i = 0; i < num_claimed_files; i++)
+    {
+      struct plugin_file_info *info = &claimed_files[i];
+      if (info->temp)
+	{
+	  t = unlink (info->name);
+	  assert (t == 0);
+	}
+    }
+  t = rmdir (temp_obj_dir_name);
+  assert (t == 0);
+
+  free_2 ();
+  return LDPS_OK;
+}
+
+/* Callback used by gold to check if the plugin will claim FILE. Writes
+   the result in CLAIMED. */
+
+static enum ld_plugin_status
+claim_file_handler (const struct ld_plugin_input_file *file, int *claimed)
+{
+  enum ld_plugin_status status;
+  Elf *elf;
+  struct plugin_file_info lto_file;
+  Elf_Data *symtab;
+  int lto_file_fd;
+
+  if (file->offset != 0)
+    {
+      /* FIXME lto: lto1 should know how to handle archives. */
+      int fd;
+      off_t size = file->filesize;
+      off_t offset;
+
+      static int objnum = 0;
+      char *objname;
+      int t = asprintf (&objname, "%s/obj%d.o",
+			temp_obj_dir_name, objnum);
+      assert (t >= 0);
+      objnum++;
+
+      fd = open (objname, O_RDWR | O_CREAT, 0666);
+      assert (fd > 0);
+      offset = lseek (file->fd, file->offset, SEEK_SET);
+      assert (offset == file->offset);
+      while (size > 0)
+	{
+	  ssize_t r, written;
+	  char buf[1000];
+	  off_t s = sizeof (buf) < size ? sizeof (buf) : size;
+	  r = read (file->fd, buf, s);
+	  written = write (fd, buf, r);
+	  assert (written = r);
+	  size -= r;
+	}
+      lto_file.name = objname;
+      lto_file_fd = fd;
+      lto_file.handle = file->handle;
+      lto_file.temp = 1;
+    }
+  else
+    {
+      lto_file.name = strdup (file->name);
+      lto_file_fd = file->fd;
+      lto_file.handle = file->handle;
+      lto_file.temp = 0;
+    }
+  elf = elf_begin (lto_file_fd, ELF_C_READ, NULL);
+
+  *claimed = 0;
+
+  if (!elf)
+    goto err;
+
+  symtab = get_symtab (elf);
+  if (!symtab)
+    goto err;
+
+  translate (symtab, &lto_file.symtab);
+
+  status = add_symbols (file->handle, lto_file.symtab.nsyms,
+			lto_file.symtab.syms);
+  assert (status == LDPS_OK);
+
+  *claimed = 1;
+  num_claimed_files++;
+  claimed_files =
+    realloc (claimed_files,
+	     num_claimed_files * sizeof (struct plugin_file_info));
+  claimed_files[num_claimed_files - 1] = lto_file;
+
+  goto cleanup;
+
+ err:
+  if (file->offset != 0)
+    {
+      int t = unlink (lto_file.name);
+      assert (t == 0);
+    }
+  free (lto_file.name);
+
+ cleanup:
+  if (elf)
+    elf_end (elf);
+
+  return LDPS_OK;
+}
+
+/* Parse the plugin options. */
+
+static void
+process_option (const char *option)
+{
+  if (strcmp (option, "-debug") == 0)
+    debug = 1;
+  else if (strcmp (option, "-nop") == 0)
+    nop = 1;
+  else if (!strncmp (option, "-libgcc", strlen("-libgcc")))
+    libgcc_filename = strdup (option + strlen ("-libgcc="));
+  else
+    {
+      int size;
+      lto_wrapper_num_args += 1;
+      size = lto_wrapper_num_args * sizeof (char *);
+      lto_wrapper_argv = (char **) realloc (lto_wrapper_argv, size);
+      lto_wrapper_argv[lto_wrapper_num_args - 1] = strdup(option);
+    }
+}
+
+/* Called by gold after loading the plugin. TV is the transfer vector. */
+
+void
+onload (struct ld_plugin_tv *tv)
+{
+  struct ld_plugin_tv *p;
+  enum ld_plugin_status status;
+  char *t;
+
+  unsigned version = elf_version (EV_CURRENT);
+  assert (version != EV_NONE);
+
+  p = tv;
+  while (p->tv_tag)
+    {
+      switch (p->tv_tag)
+	{
+	case LDPT_REGISTER_CLAIM_FILE_HOOK:
+	  register_claim_file = p->tv_u.tv_register_claim_file;
+	  break;
+	case LDPT_ADD_SYMBOLS:
+	  add_symbols = p->tv_u.tv_add_symbols;
+	  break;
+	case LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK:
+	  register_all_symbols_read = p->tv_u.tv_register_all_symbols_read;
+	  break;
+	case LDPT_GET_SYMBOLS:
+	  get_symbols = p->tv_u.tv_get_symbols;
+	  break;
+	case LDPT_REGISTER_CLEANUP_HOOK:
+	  register_cleanup = p->tv_u.tv_register_cleanup;
+	  break;
+	case LDPT_ADD_INPUT_FILE:
+	  add_input_file = p->tv_u.tv_add_input_file;
+	  break;
+	case LDPT_OPTION:
+	  process_option (p->tv_u.tv_string);
+	  break;
+	default:
+	  break;
+	}
+      p++;
+    }
+
+  assert (register_cleanup);
+  assert (register_claim_file);
+  assert (add_symbols);
+  status = register_claim_file (claim_file_handler);
+  assert (status == LDPS_OK);
+
+  status = register_cleanup (cleanup_handler);
+  assert (status == LDPS_OK);
+
+  if (register_all_symbols_read)
+    {
+      assert (get_symbols);
+      status = register_all_symbols_read (all_symbols_read_handler);
+      assert (status == LDPS_OK);
+    }
+
+  temp_obj_dir_name = strdup ("tmp_objectsXXXXXX");
+  t = mkdtemp (temp_obj_dir_name);
+  assert (t == temp_obj_dir_name);
+}
diff -rdupN --exclude=.svn --exclude=.git --exclude='*.diff*' --exclude='autom4te*' --exclude=tags --exclude=ChangeLog.lto --exclude=configure /usr/local/google/homedirs/dnovillo/gcc/trunk/lto-plugin/lto-symtab.c /usr/local/google/homedirs/dnovillo/gcc/trunk.lto/lto-plugin/lto-symtab.c
--- /usr/local/google/homedirs/dnovillo/gcc/trunk/lto-plugin/lto-symtab.c	1969-12-31 19:00:00.000000000 -0500
+++ /usr/local/google/homedirs/dnovillo/gcc/trunk.lto/lto-plugin/lto-symtab.c	2009-09-23 11:34:52.000000000 -0400
@@ -0,0 +1,359 @@
+/* Program to read the IL symbol table.
+   Copyright (C) 2008 Free Software Foundation, Inc.
+   Contributed by Rafael Avila de Espindola (espindola@google.com).
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+#include <fcntl.h>
+#include <assert.h>
+#include <dlfcn.h>
+#include <stdio.h>
+#include <inttypes.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "plugin-api.h"
+#include "../gcc/lto/common.h"
+
+/* The presence of gelf.h is checked by the toplevel configure script.  */
+# include <gelf.h>
+
+static ld_plugin_claim_file_handler claim_file_handler;
+static ld_plugin_all_symbols_read_handler all_symbols_read_handler;
+static ld_plugin_cleanup_handler cleanup_handler;
+static void *plugin_handle;
+
+struct file_handle {
+  unsigned nsyms;
+  struct ld_plugin_symbol *syms;
+};
+
+static struct file_handle **all_file_handles = NULL;
+static unsigned int num_file_handles;
+
+/* Write NSYMS symbols from file HANDLE in SYMS. */
+
+static enum ld_plugin_status
+get_symbols (const void *handle, int nsyms, struct ld_plugin_symbol *syms)
+{
+  unsigned i;
+  struct file_handle *h = (struct file_handle *) handle;
+  assert (h->nsyms == nsyms);
+
+  for (i = 0; i < nsyms; i++)
+    syms[i] = h->syms[i];
+
+  return LDPS_OK;
+}
+
+/* Register HANDLER as the callback for notifying the plugin that all symbols
+   have been read. */
+
+static enum ld_plugin_status
+register_all_symbols_read (ld_plugin_all_symbols_read_handler handler)
+{
+  all_symbols_read_handler = handler;
+  return LDPS_OK;
+}
+
+/* Register HANDLER as the callback for claiming a file. */
+
+static enum ld_plugin_status
+register_claim_file(ld_plugin_claim_file_handler handler)
+{
+  claim_file_handler = handler;
+  return LDPS_OK;
+}
+
+/* Register HANDLER as the callback to removing temporary files. */
+
+static enum ld_plugin_status
+register_cleanup (ld_plugin_cleanup_handler handler)
+{
+  cleanup_handler = handler;
+  return LDPS_OK;
+}
+
+/* For a file identified by HANDLE, add NSYMS symbols from SYMS. */
+
+static enum ld_plugin_status
+add_symbols (void *handle, int nsyms,
+	     const struct ld_plugin_symbol *syms)
+{
+  int i;
+  struct file_handle *h = (struct file_handle *) handle;
+  h->nsyms = nsyms;
+  h->syms = calloc (nsyms, sizeof (struct ld_plugin_symbol));
+  assert (h->syms);
+
+  for (i = 0; i < nsyms; i++)
+    {
+      h->syms[i] = syms[i];
+      h->syms[i].name = strdup (h->syms[i].name);
+      if (h->syms[i].version)
+	h->syms[i].version = strdup (h->syms[i].version);
+      if (h->syms[i].comdat_key)
+	h->syms[i].comdat_key = strdup (h->syms[i].comdat_key);
+    }
+
+  return LDPS_OK;
+}
+
+struct ld_plugin_tv tv[] = {
+  {LDPT_REGISTER_CLAIM_FILE_HOOK,
+   {.tv_register_claim_file = register_claim_file}
+  },
+  {LDPT_ADD_SYMBOLS,
+   {.tv_add_symbols = add_symbols}
+  },
+
+  {LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK,
+   {.tv_register_all_symbols_read = register_all_symbols_read}
+  },
+  {LDPT_GET_SYMBOLS,
+   {.tv_get_symbols = get_symbols}
+  },
+  {LDPT_REGISTER_CLEANUP_HOOK,
+   {.tv_register_cleanup = register_cleanup}
+  },
+  {0, {0}}
+};
+
+/* Load a plugin from a file named NAME. */
+
+static void
+load_plugin (const char *name)
+{
+  ld_plugin_onload onload;
+  plugin_handle = dlopen (name, RTLD_LAZY);
+
+  assert (plugin_handle != NULL);
+  onload = dlsym (plugin_handle, "onload");
+  assert (onload);
+  onload (tv);
+  assert (claim_file_handler);
+}
+
+/* Send object to the plugin. The file (archive or object) name is NAME.
+   FD is an open file descriptor. The object data starts at OFFSET and is
+   FILESIZE bytes long. */
+
+static void
+register_object (const char *name, int fd, off_t offset, off_t filesize)
+{
+  int claimed;
+  struct ld_plugin_input_file file;
+  void *handle;
+
+  num_file_handles++;
+  all_file_handles = realloc (all_file_handles, num_file_handles
+			      * sizeof (struct file_handle *));
+  assert (all_file_handles);
+
+  all_file_handles[num_file_handles - 1] = calloc (1,
+						   sizeof (struct file_handle));
+  handle = all_file_handles[num_file_handles - 1];
+  assert (handle);
+
+  file.name = (char *) name;
+  file.fd = fd;
+  file.offset = offset;
+  file.filesize = filesize;
+
+  file.handle = handle;
+
+  claim_file_handler (&file, &claimed);
+}
+
+/* Send file named NAME to the plugin. */
+
+static void
+register_file (const char *name)
+{
+ int fd = open (name, O_RDONLY);
+ Elf *elf;
+
+ assert (fd >= 0);
+
+ elf = elf_begin (fd, ELF_C_READ, NULL);
+ assert (elf);
+
+ Elf_Kind kind = elf_kind (elf);
+
+ assert (kind == ELF_K_ELF || kind == ELF_K_AR);
+
+ if (kind == ELF_K_AR)
+   {
+     Elf *member = elf_begin (fd, ELF_C_READ, elf);
+     while (member)
+       {
+	 Elf_Arhdr *h = elf_getarhdr (member);
+	 assert (h);
+
+	 if (h->ar_name[0] != '/')
+	   {
+	     off_t offset = elf_getbase (member);
+	     register_object (name, fd, offset, h->ar_size);
+	   }
+
+	 Elf_Cmd cmd = elf_next (member);
+	 elf_end (member);
+	 member = elf_begin (fd, cmd, elf);
+       }
+   }
+ else /* Single File */
+   register_object (name, fd, 0, 0);
+
+ elf_end (elf);
+}
+
+/* Fake symbol resolution for testing. */
+
+static void
+resolve (void)
+{
+  unsigned j;
+  for (j = 0; j < num_file_handles; j++)
+    {
+      struct file_handle *handle = all_file_handles[j];
+      unsigned int nsyms = handle->nsyms;
+      struct ld_plugin_symbol *syms = handle->syms;
+      unsigned i;
+      for (i = 0; i < nsyms; i++)
+	{
+	  switch (syms[i].def)
+	    {
+	    case LDPK_DEF:
+	    case LDPK_WEAKDEF:
+	    case LDPK_COMMON:
+	      syms[i].resolution =  LDPR_PREVAILING_DEF;
+	      break;
+	    case LDPK_UNDEF:
+	    case LDPK_WEAKUNDEF:
+	      syms[i].resolution =  LDPR_RESOLVED_IR;
+	      break;
+	    }
+	}
+    }
+}
+
+/* Print all symbol information. */
+
+static void
+print (void)
+{
+  unsigned j;
+  for (j = 0; j < num_file_handles; j++)
+    {
+      struct file_handle *handle = all_file_handles[j];
+      unsigned int nsyms = handle->nsyms;
+      struct ld_plugin_symbol *syms = handle->syms;
+      unsigned i;
+      for (i = 0; i < nsyms; i++)
+	{
+	  printf("name: %s; ", syms[i].name);
+	  if (syms[i].version)
+	     printf("version: %s;", syms[i].version);
+	  else
+	    printf("not versioned; ");
+	  printf("kind: %s; ", lto_kind_str[syms[i].def]);
+	  printf("visibility: %s; ", lto_visibility_str[syms[i].visibility]);
+	  printf("size: %" PRId64 "; ", syms[i].size);
+	  if (syms[i].comdat_key)
+	    printf("comdat_key: %s; ", syms[i].comdat_key);
+	  else
+	    printf("no comdat_key; ");
+	  printf ("resolution: %s\n", lto_resolution_str[syms[i].resolution]);
+	}
+    }
+}
+
+/* Unload the plugin. */
+
+static void
+unload_plugin (void)
+{
+  unsigned err = dlclose (plugin_handle);
+  assert (err == 0);
+  claim_file_handler = 0;
+  all_symbols_read_handler = 0;
+}
+
+/* Free all memory allocated by us that hasn't been freed yet. */
+
+static void
+free_all (void)
+{
+  unsigned j;
+  for (j = 0; j < num_file_handles; j++)
+    {
+      struct file_handle *handle = all_file_handles[j];
+      unsigned int nsyms = handle->nsyms;
+      struct ld_plugin_symbol *syms = handle->syms;
+      unsigned i;
+      for (i = 0; i < nsyms; i++)
+	{
+	  free (syms[i].name);
+	  syms[i].name = 0;
+	  if (syms[i].version)
+	    {
+	      free (syms[i].version);
+	      syms[i].version = 0;
+	    }
+	  if (syms[i].comdat_key)
+	    {
+	      free (syms[i].comdat_key);
+	      syms[i].comdat_key = 0;
+	    }
+	}
+      free (syms);
+      handle->syms = NULL;
+      handle->nsyms = 0;
+      free (all_file_handles[j]);
+      all_file_handles[j] = NULL;
+    }
+
+  free (all_file_handles);
+  all_file_handles = NULL;
+  num_file_handles = 0;
+}
+
+int
+main(int argc, char *argv[])
+{
+  const char *plugin;
+  unsigned int i;
+  assert (argc >= 3);
+  plugin = argv[1];
+
+  load_plugin (plugin);
+
+  for (i = 2; i < argc; i++)
+    register_file (argv[i]);
+
+  resolve ();
+
+  print ();
+
+  all_symbols_read_handler ();
+
+  free_all ();
+
+  cleanup_handler ();
+
+  unload_plugin ();
+
+  return 0;
+}



More information about the Gcc-patches mailing list