I noticed that in the default release configuration, qmake (qmake 3.1, qt 5.9.5 - whatever is installed on my Ubuntu build box) passes -Wl,O1
to g++ when linking. So the linking command line looks like
g++ -Wl,-O1 -flto -O2 -o program program.o lib1.a lib2.a ...
where -flto -O2
are the options that I'm passing via QMAKE_LFLAGS_RELEASE
to enable LTO.
Now the question: why qmake has this -Wl,-O1
option and is it going to interfere with LTO?