Skip to content

Commit d76888a

Browse files
committed
[Android] Enable LTO on arm64
On armeabi-v7a it's broken in two ways. Also simplify the LTCG determination code and print the result.
1 parent 93aa8f5 commit d76888a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

firebird.pro

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ QMAKE_CXXFLAGS_RELEASE = -O3 -DNDEBUG
5353
# with Qt's -reduce-relocations option (QTBUG-86173).
5454
# MinGW fails with
5555
# lto1.exe: internal compiler error: in gen_subprogram_die, at dwarf2out.c:22668
56-
!clang | !if(linux|freebsd): !win32: CONFIG += ltcg
56+
# On 32bit ARM, Qt adds -Oz by default but that breaks LTO with NDK r21
57+
# (https://github.com/android/ndk/issues/721). Can be worked around with
58+
# CONFIG -= optimize size, but the resulting binary has random crashes.
59+
if(android:contains(QT_ARCH, "arm64.*")) | if(linux:!clang): CONFIG += ltcg
5760

5861
# noexecstack is not supported by MinGW's as
5962
!win32 {
@@ -137,6 +140,8 @@ else: DEFINES += NO_TRANSLATION
137140
message("FB_ARCH: $$FB_ARCH")
138141
message("TRANSLATION_ENABLED: $$TRANSLATION_ENABLED")
139142
message("SUPPORT_LINUX: $$SUPPORT_LINUX")
143+
ltcg: message("LTCG: true")
144+
else: message("LTCG: false")
140145

141146
equals(SUPPORT_LINUX, true) {
142147
DEFINES += SUPPORT_LINUX

0 commit comments

Comments
 (0)