https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63576
--- Comment #9 from Markus Trippelsdorf <trippels at gcc dot gnu.org> --- I will give your patch a try. In case it might help here's the script I use for LTO/PGO (as you can see it starts the instrumented browser. I then just visit a couple of webpages to train it): markus@x4 mozilla-central % cat profile_build #!/bin/zsh mv .mozconfig .mozconfig_tmp && cp .mozconfig_profile_gen .mozconfig && nice -n 19 make -f client.mk && killall firefox /var/tmp/moz-build-dir/dist/bin/firefox && rm /var/tmp/moz-build-dir/**/Makefile && rm /var/tmp/moz-build-dir/**/*.o && rm /var/tmp/moz-build-dir/**/config.status && rm /var/tmp/moz-build-dir/**/configure.pkl && cp .mozconfig_profile_use .mozconfig && nice -n 19 make -f client.mk && make DESTDIR=/var/tmp/firefox-destdir -C /var/tmp/moz-build-dir install && rm -fr /var/tmp/moz-build-dir mv .mozconfig_tmp .mozconfig Where .mozconfig_profile_gen contains: export CFLAGS="-march=native -fno-semantic-interposition -ffunction-sections -fdata-sections" export CXXFLAGS="-march=native -fno-semantic-interposition -fprofile-generate -ffunction-sections -fdata-sections" and .mozconfig_profile_use contains: export CFLAGS="-march=native -fno-semantic-interposition -ffunction-sections -fdata-sections" export CXXFLAGS="-march=native -fno-semantic-interposition -flto=4 -fdevirtualize-at-ltrans -fprofile-use -fprofile-correction -ffunction-sections -fdata-sections"