summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mkspecs/android-g++/qmake.conf35
1 files changed, 17 insertions, 18 deletions
diff --git a/mkspecs/android-g++/qmake.conf b/mkspecs/android-g++/qmake.conf
index ef78c42de9..1ea6a1fa55 100644
--- a/mkspecs/android-g++/qmake.conf
+++ b/mkspecs/android-g++/qmake.conf
@@ -89,20 +89,16 @@ equals(ANDROID_TARGET_ARCH, x86_64)|equals(ANDROID_TARGET_ARCH, mips64): \
# modifications to g++.conf
QMAKE_CC = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-gcc
+# -fstack-protector-strong offers good protection against stack smashing attacks.
+# It is (currently) enabled only on Android because we know for sure that Andoroid compilers supports it
+QMAKE_CFLAGS = -fstack-protector-strong -DANDROID
+
equals(ANDROID_TARGET_ARCH, armeabi-v7a): \
- QMAKE_CFLAGS = -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack -fno-builtin-memmove
+ QMAKE_CFLAGS += -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fno-builtin-memmove
else: equals(ANDROID_TARGET_ARCH, armeabi): \
- QMAKE_CFLAGS = -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack -fno-builtin-memmove
-else: equals(ANDROID_TARGET_ARCH, arm64-v8a): \
- QMAKE_CFLAGS = -ffunction-sections -funwind-tables -fstack-protector -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300 -DANDROID -Wa,--noexecstack
-else: equals(ANDROID_TARGET_ARCH, x86): \
- QMAKE_CFLAGS = -ffunction-sections -funwind-tables -O2 -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300 -DANDROID -Wa,--noexecstack
-else: equals(ANDROID_TARGET_ARCH, x86_64): \
- QMAKE_CFLAGS = -ffunction-sections -funwind-tables -fstack-protector -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300 -DANDROID -Wa,--noexecstack
-else: equals(ANDROID_TARGET_ARCH, mips): \
- QMAKE_CFLAGS = -fno-strict-aliasing -finline-functions -ffunction-sections -funwind-tables -fmessage-length=0 -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers -O2 -fomit-frame-pointer -funswitch-loops -finline-limit=300 -DANDROID -Wa,--noexecstack
-else: equals(ANDROID_TARGET_ARCH, mips64): \
- QMAKE_CFLAGS = -fno-strict-aliasing -finline-functions -ffunction-sections -funwind-tables -fmessage-length=0 -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers -fomit-frame-pointer -funswitch-loops -finline-limit=300 -DANDROID -Werror -Wa,--noexecstack
+ QMAKE_CFLAGS += -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -fno-builtin-memmove
+
+# -fno-builtin-memmove is used to workaround https://code.google.com/p/android/issues/detail?id=81692
QMAKE_CFLAGS_WARN_ON = -Wall -Wno-psabi -W
QMAKE_CFLAGS_WARN_OFF = -Wno-psabi
@@ -117,19 +113,19 @@ equals(ANDROID_TARGET_ARCH, x86) {
} else: equals(ANDROID_TARGET_ARCH, mips) {
QMAKE_CFLAGS_RELEASE = -O2
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -O2
- QMAKE_CFLAGS_DEBUG = -g -fno-omit-frame-pointer
+ QMAKE_CFLAGS_DEBUG = -g
} else: equals(ANDROID_TARGET_ARCH, mips64) {
QMAKE_CFLAGS_RELEASE = -O2
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -O2
- QMAKE_CFLAGS_DEBUG = -g -fno-omit-frame-pointer
+ QMAKE_CFLAGS_DEBUG = -g
} else: equals(ANDROID_TARGET_ARCH, arm64-v8a) {
QMAKE_CFLAGS_RELEASE = -O2
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -O2
- QMAKE_CFLAGS_DEBUG = -g -fno-omit-frame-pointer
+ QMAKE_CFLAGS_DEBUG = -g
} else { # arm
- QMAKE_CFLAGS_RELEASE = -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64
- QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64
- QMAKE_CFLAGS_DEBUG = -g -marm -O0 -fno-omit-frame-pointer
+ QMAKE_CFLAGS_RELEASE = -Os
+ QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -Os
+ QMAKE_CFLAGS_DEBUG = -g -marm -O0
equals(ANDROID_TARGET_ARCH, armeabi):if(equals(NDK_TOOLCHAIN_VERSION, 4.8)|equals(NDK_TOOLCHAIN_VERSION, 4.9)) {
DEFINES += QT_OS_ANDROID_GCC_48_WORKAROUND
} else {
@@ -138,6 +134,9 @@ equals(ANDROID_TARGET_ARCH, x86) {
}
}
+# Don't override our options with -O3
+QMAKE_CFLAGS_OPTIMIZE_FULL =
+
QMAKE_CFLAGS_SHLIB = -fPIC
QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses
QMAKE_CFLAGS_THREAD = -D_REENTRANT