Using Link-Time-Optimization in mingw/gcc: Any experience?
Posted: Thu Aug 01, 2019 10:16 am
Hi.
I started to reorganize some of my code seperating one big module into several smaller modules (cpp files) which resulted in a slowdown (msys2/mingw64/gcc/g++ build), probably because the optimization used so far only works inside one module.
Then I discovered the -flto switch and gave it a try. Sadly the resulting exe just crashed at start with a segmentation violation error.
But... if I remove the -static switch and compile again, the resulting exe (needing some of the mingw64 dlls now) seems to work fine and gave a great speed improvement.
I don't like builds that rely on some dlls so I tried everything to make it work with -static but failed so far. I read several things about -flto in Internet from "Broken in windows, don't use it!" to some advises how to make it work using different linker/bin utils/parameters but nothing worked for me so far.
Has anybody of you experience in this field? Any hint is welcome.
.Andreas
I started to reorganize some of my code seperating one big module into several smaller modules (cpp files) which resulted in a slowdown (msys2/mingw64/gcc/g++ build), probably because the optimization used so far only works inside one module.
Then I discovered the -flto switch and gave it a try. Sadly the resulting exe just crashed at start with a segmentation violation error.
But... if I remove the -static switch and compile again, the resulting exe (needing some of the mingw64 dlls now) seems to work fine and gave a great speed improvement.
I don't like builds that rely on some dlls so I tried everything to make it work with -static but failed so far. I read several things about -flto in Internet from "Broken in windows, don't use it!" to some advises how to make it work using different linker/bin utils/parameters but nothing worked for me so far.
Has anybody of you experience in this field? Any hint is welcome.
.Andreas