Fix leaking ISA extensions in LTCG builds

Due to common subexpression elimination instruction set extensions may
leak from the objects where they were enabled when doing link-time
optimizations.

To avoid that this patch disables LTCG/LTO on files built with extra
instruction set extensions.

Change-Id: Ie34ad900be7fb04a0dc4d3562187ee170c183333
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Allan Sandfeld Jensen 2015-02-27 12:44:47 +01:00
parent 8ac63a3323
commit b678445901
3 changed files with 5 additions and 0 deletions

View File

@ -20,10 +20,12 @@ QMAKE_CFLAGS_ISYSTEM = -isystem
QMAKE_CFLAGS_PRECOMPILE = -x c-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT}
QMAKE_CFLAGS_USE_PRECOMPILE = -Xclang -include-pch -Xclang ${QMAKE_PCH_OUTPUT}
QMAKE_CFLAGS_LTCG = -flto
QMAKE_CFLAGS_DISABLE_LTCG = -fno-lto
QMAKE_CXXFLAGS_PRECOMPILE = -x c++-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT}
QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
QMAKE_CXXFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG
QMAKE_CXXFLAGS_DISABLE_LTCG = $$QMAKE_CFLAGS_DISABLE_LTCG
QMAKE_CXXFLAGS_CXX11 = -std=c++11
QMAKE_LFLAGS_CXX11 =

View File

@ -50,6 +50,7 @@ QMAKE_CFLAGS_EXCEPTIONS_OFF += -fno-exceptions
QMAKE_CFLAGS_SPLIT_SECTIONS += -ffunction-sections
QMAKE_CFLAGS_LTCG = -flto -fno-fat-lto-objects
QMAKE_CFLAGS_LTCG_FATOBJECTS = -ffat-lto-objects
QMAKE_CFLAGS_DISABLE_LTCG = -fno-lto
QMAKE_CXXFLAGS += $$QMAKE_CFLAGS
QMAKE_CXXFLAGS_DEPS += $$QMAKE_CFLAGS_DEPS
@ -66,6 +67,7 @@ QMAKE_CXXFLAGS_EXCEPTIONS_OFF += $$QMAKE_CFLAGS_EXCEPTIONS_OFF
QMAKE_CXXFLAGS_SPLIT_SECTIONS += $$QMAKE_CFLAGS_SPLIT_SECTIONS
QMAKE_CXXFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG
QMAKE_CXXFLAGS_LTCG_FATOBJECTS = $$QMAKE_CFLAGS_LTCG_FATOBJECTS
QMAKE_CXXFLAGS_DISABLE_LTCG = $$QMAKE_CFLAGS_DISABLE_LTCG
QMAKE_LFLAGS +=
QMAKE_LFLAGS_DEBUG +=

View File

@ -27,6 +27,7 @@ defineTest(addSimdCompiler) {
CONFIG($$1) {
cflags = $$eval(QMAKE_CFLAGS_$${upname})
ltcg: cflags += $$QMAKE_CFLAGS_DISABLE_LTCG
contains(QT_CPU_FEATURES, $$name) {
# Default compiler settings include this feature, so just add to SOURCES
SOURCES += $$eval($$sources_var)