This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH,4.6/4.5.1,PR42776] Implement LTO for Windows (PE-COFF) targets.


On Tue, Apr 13, 2010 at 8:16 AM, Dave Korn
<dave.korn.cygwin@googlemail.com> wrote:
>
> ? ?Hi list,
>
> ?The attached patch generalizes the interface between lto1 and its object
> file reader, and provides an object file format-specific reader for COFF
> (currently only validated against and enabled for Windows platforms) as an
> alternative to the current ELF object file reader.
>
> ?The configury provided to make the object format reader selectable will
> facilitate an eventual solution to PR43729 (no LTO on Mach-O) and the COFF
> reader will be easily extensible (if not already sufficient) for any other
> COFF targets that want to enable LTO.
>
> ChangeLog:
>
> ? ? ? ?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
>
> ? ? ? ?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.
> ? ? ? ?* gcc/config.gcc (lto_binary_reader): New target-specific configure
> ? ? ? ?variable.
> ? ? ? ?* gcc/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.
>
> lto/ChangeLog
>
> ? ? ? ?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.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.
> ? ? ? ?* gcc/lto/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.
> ? ? ? ?* lto-coff.h: New file.
> ? ? ? ?* lto-coff.c: Likewise.
>
> gcc/testsuite/ChangeLog
>
> ? ? ? ?PR lto/42776
> ? ? ? ?* lib/lto.exp (lto_prune_vis_warns): New function.
> ? ? ? ?(lto-link-and-maybe-run): Call it.
>
> ?Bootstrapped on i686-pc-cygwin against r.158195, tests in progress; repeated
> previous runs have shown that all lto tests (except for a couple which rely on
> ELF symbol aliasing) now pass without regressions. ?It's also been tested,
> according to contributors on the PR, against MinGW, where it works, and on
> Linux, where it doesn't break existing ELF LTO any. ?I've also quickly tested
> (in a non-bootstrap configuration) that the configury correctly warns when I
> roll back my binutils to a version that lacks the necessary support for LTO on
> COFF (an extended form of the .section directive that allows specifying
> alignments below the default section alignment).
>
> ?Assuming no regressions when the tests complete, OK for HEAD, and for 4.5
> branch when it reopens after the .0 release?

The middle-end and LTO changes are fine.  Please get an ack
from a build-system maintainer.

As for backporting the changes to the 4.5 branch after the .0 release,
please give the patch some time to settle on the trunk.

Thanks,
Richard.

> ? ?cheers,
> ? ? ?DaveK
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]