[4.5.1,PR42776] Backport LTO-COFF implementation.

Dave Korn dave.korn.cygwin@gmail.com
Sat Jun 12 06:00:00 GMT 2010


    Hi list,

  The attached patch backports the LTO-COFF implementation from mainline to
4.5 branch, as we discussed at the time it was committed to trunk.

ChangeLog:

  Backport from mainline:
  2010-04-27  Dave Korn  <dave.korn.cygwin@gmail.com>

	PR lto/42776
	* configure.ac (--enable-lto): Refactor handling so libelf tests
	are only performed inside then-clause of ACX_ELF_TARGET_IFELSE,
	and allow LTO to be explicitly enabled on non-ELF platforms that
	are known to support it inside else-clause.
	* configure: Regenerate.

gcc/ChangeLog:

  Backport from mainline:
  2010-04-27  Dave Korn  <dave.korn.cygwin@gmail.com>

	PR lto/42776
	* configure.ac (gcc_cv_as_section_has_align): Set if installed
	binutils supports extended .section directive needed by LTO, or
	warn if older binutils found.
	(LTO_BINARY_READER): New AC_SUBST'd variable.
	(LTO_USE_LIBELF): Likewise.
	* config.gcc (lto_binary_reader): New target-specific configure
	variable.
	* Makefile.in (LTO_BINARY_READER): Import AC_SUBST'd autoconf var.
	(LTO_USE_LIBELF): Likewise.
	* configure: Regenerate.
	* collect2.c (is_elf): Rename from this ...
	(is_elf_or_coff): ... to this, and recognize and allow i386 COFF
	 object files in addition to ELF-formatted ones.
	(scan_prog_file): Caller updated.  Also allow for LTO info marker
	symbol to be prefixed or not by an extra underscore.
	* config/i386/t-cygming (winnt.o): Also depend on LTO_STREAMER_H.
	* config/i386/winnt.c: Also #include lto-streamer.h
	(i386_pe_asm_named_section): Specify 1-byte section alignment for
	LTO named sections.
	(i386_pe_asm_output_aligned_decl_common): Add comment.
	(i386_pe_maybe_record_exported_symbol): Allow decl arg to be NULL.

gcc/lto/ChangeLog:

  Backport from mainline:
  2010-04-27  Dave Korn  <dave.korn.cygwin@gmail.com>

	PR lto/42776
	* Make-lang.in (LTO_OBJS): Use LTO_BINARY_READER instead of
	hardcoding 'lto-elf.o'.
	($(LTO_EXE)): Use LTO_USE_LIBELF instead of hardcoding '-lelf'.
	* lto-coff.h: New file.
	* lto-coff.c: Likewise.

  2010-04-26  Dave Korn  <dave.korn.cygwin@gmail.com>

	* lto.h (lto_elf_file_open): Rename prototype from this ...
	(lto_obj_file_open): ... to this.
	(lto_elf_file_close): Likewise ...
	(lto_obj_file_close): ... and likewise.
	(lto_elf_build_section_table): Likewise ...
	(lto_obj_build_section_table): ... and likewise.
	(lto_elf_begin_section): Likewise ...
	(lto_obj_begin_section): ... and likewise.
	(lto_elf_append_data): Likewise ...
	(lto_obj_append_data): ... and likewise.
	(lto_elf_end_section): Likewise ...
	(lto_obj_end_section): ... and likewise.
	* lto.c (lto_file_read): Update references to the above.
	(lto_wpa_write_files): Likewise.
	(lto_read_all_file_options): Likewise.
	(read_cgraph_and_symbols): Likewise.
	* lto-lang.c (LANG_HOOKS_BEGIN_SECTION): Likewise.
	(LANG_HOOKS_APPEND_DATA): Likewise.
	(LANG_HOOKS_END_SECTION): Likewise.
	* lto-elf.c (lto_elf_file_open): Rename from this ...
	(lto_obj_file_open): ... to this, updating any references.
	(lto_elf_file_close): Likewise ...
	(lto_obj_file_close): ... and likewise.
	(lto_elf_build_section_table): Likewise ...
	(lto_obj_build_section_table): ... and likewise.
	(lto_elf_begin_section): Likewise ...
	(lto_obj_begin_section): ... and likewise.
	(lto_elf_append_data): Likewise ...
	(lto_obj_append_data): ... and likewise.
	(lto_elf_end_section): Likewise ...
	(lto_obj_end_section): ... and likewise.


  Bootstrapped and tests running on i686-pc-cygwin; ok for branch if (when) no
regressions?

    cheers,
      DaveK


-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr42776-backport.diff
Type: text/x-c
Size: 55276 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100612/5953361e/attachment.bin>


More information about the Gcc-patches mailing list