Menu ▾ ▴

#1918 Provide libraries compiled with -flto

OTHER
assigned
Feature
none
Unknown
False
2014-01-23
2012-06-14
Jan Ringoš
No

If possible, could MinGW provide libraries compiled with -flto option?
That would be mingwrt libraries (libmingw32.a, libmingwex.a, ...), and libstdc++, libgcc and others that actually contain code (libiconv, libz, ...). This would lead to smaller and/or faster code when one chooses to link the whole program with -flto. Thanks for consideration.

Discussion

  • Earnie Boyd

    Earnie Boyd - 2012-07-24
    • milestone: 307068 -->
    • status: open --> pending
     
  • Earnie Boyd

    Earnie Boyd - 2012-07-24

    Would this require needing lto enabled libraries and non-lto enabled libraries depending on usage? If so then we need a consensus from the MinGW community which way we should go with it because encumbering us with multiple library distributions is not going to happen.

     
  • Jan Ringoš

    Jan Ringoš - 2012-07-24

    No, no multiple library distributions are needed. Since the LTO informations are added as a completely new sections in the .o/.a files, such files can be linked interchangeably with files without LTO informations. AFAIK the linker, when invoked with -flto, will employ LTO information from files that contain it, while linking files without LTO the classic way.

     
  • Jan Ringoš

    Jan Ringoš - 2012-07-24
    • status: pending --> open
     
  • Earnie Boyd

    Earnie Boyd - 2013-02-15

    Ticket moved from /p/mingw/feature-requests/113/

     
  • Earnie Boyd

    Earnie Boyd - 2013-02-15

    Keith, I've assigned to you for your input.

     
  • Earnie Boyd

    Earnie Boyd - 2013-02-15
    • labels: Suggested Feature --> -flto, relevance?
    • status: open --> assigned
    • assigned_to: Keith Marshall
    • milestone: --> OTHER
    • type: --> Feature
    • resolution: --> none
    • category: --> Unknown
    • patch_attached: --> False
     
  • Jan Ringoš

    Jan Ringoš - 2014-01-20

    Hi, I just wanted to report that I have tried building libcrt, libmingw32 and libmingwex with -flto (just added the flag to makefile) and it works well for me. Although I have tested it on just a few projects of mine, the resulting executables are up to ~15kB smaller for projects compiled and linked with -flto. There is no difference (for me) when not linking with -flto.
    I would love to try both libsupc++ and libstdc++ compiled with -flto. I have tried to build MinGW myself, but I am apparently missing serious amount of knowledge to manage to do that.

     
  • Thorsten Otto

    Thorsten Otto - 2014-01-23

    According to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59893, it is (currently) not a good idea to enable -flto by default.