From 6d33cce6a0616be17ac9cd76159a9358d047c177 Mon Sep 17 00:00:00 2001 From: Fabian Vogt Date: Mon, 5 Dec 2022 08:23:26 +0100 Subject: [PATCH] [Android] Enable LTO on arm64 On armeabi-v7a it's broken in two ways. Also simplify the LTCG determination code and print the result. --- firebird.pro | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/firebird.pro b/firebird.pro index f4e8c0d5..e23ec608 100644 --- a/firebird.pro +++ b/firebird.pro @@ -53,7 +53,10 @@ QMAKE_CXXFLAGS_RELEASE = -O3 -DNDEBUG # with Qt's -reduce-relocations option (QTBUG-86173). # MinGW fails with # lto1.exe: internal compiler error: in gen_subprogram_die, at dwarf2out.c:22668 -!clang | !if(linux|freebsd): !win32: CONFIG += ltcg +# On 32bit ARM, Qt adds -Oz by default but that breaks LTO with NDK r21 +# (https://github.com/android/ndk/issues/721). Can be worked around with +# CONFIG -= optimize size, but the resulting binary has random crashes. +if(android:contains(QT_ARCH, "arm64.*")) | if(linux:!clang): CONFIG += ltcg # noexecstack is not supported by MinGW's as !win32 { @@ -137,6 +140,8 @@ else: DEFINES += NO_TRANSLATION message("FB_ARCH: $$FB_ARCH") message("TRANSLATION_ENABLED: $$TRANSLATION_ENABLED") message("SUPPORT_LINUX: $$SUPPORT_LINUX") +ltcg: message("LTCG: true") +else: message("LTCG: false") equals(SUPPORT_LINUX, true) { DEFINES += SUPPORT_LINUX