From 7457fda2a7e4a004adedd2d5c2b820e13041b857 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Tue, 26 Sep 2017 14:07:24 -0700 Subject: [PATCH] Use -Oz instead of -Os for Clang. -Os doesn't really optimize for size. Test: ./checkbuild.py && ./run_tests.py Bug: https://github.com/android-ndk/ndk/issues/133 Change-Id: I8d4eb6f57ca88ea1034c9a3fa02419c0134d5aff --- build/cmake/android.toolchain.cmake | 19 +++++++++---------- .../arm-linux-androideabi-clang/setup.mk | 2 +- tests/device/gtest/test_config.py | 3 --- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/build/cmake/android.toolchain.cmake b/build/cmake/android.toolchain.cmake index 891774db..db3949e8 100644 --- a/build/cmake/android.toolchain.cmake +++ b/build/cmake/android.toolchain.cmake @@ -458,20 +458,19 @@ list(APPEND ANDROID_LINKER_FLAGS_EXE -Wl,-z,nocopyreloc) # Debug and release flags. -list(APPEND ANDROID_COMPILER_FLAGS_DEBUG - -O0) +list(APPEND ANDROID_COMPILER_FLAGS_DEBUG -O0) if(ANDROID_ABI MATCHES "^armeabi") - list(APPEND ANDROID_COMPILER_FLAGS_RELEASE - -Os) + if(ANDROID_TOOLCHAIN STREQUAL clang) + list(APPEND ANDROID_COMPILER_FLAGS_RELEASE -Oz) + else() + list(APPEND ANDROID_COMPILER_FLAGS_RELEASE -Os) + endif() else() - list(APPEND ANDROID_COMPILER_FLAGS_RELEASE - -O2) + list(APPEND ANDROID_COMPILER_FLAGS_RELEASE -O2) endif() -list(APPEND ANDROID_COMPILER_FLAGS_RELEASE - -DNDEBUG) +list(APPEND ANDROID_COMPILER_FLAGS_RELEASE -DNDEBUG) if(ANDROID_TOOLCHAIN STREQUAL clang) - list(APPEND ANDROID_COMPILER_FLAGS_DEBUG - -fno-limit-debug-info) + list(APPEND ANDROID_COMPILER_FLAGS_DEBUG -fno-limit-debug-info) endif() # Toolchain and ABI specific flags. diff --git a/build/core/toolchains/arm-linux-androideabi-clang/setup.mk b/build/core/toolchains/arm-linux-androideabi-clang/setup.mk index 0b93b355..3f65b025 100644 --- a/build/core/toolchains/arm-linux-androideabi-clang/setup.mk +++ b/build/core/toolchains/arm-linux-androideabi-clang/setup.mk @@ -97,7 +97,7 @@ TARGET_arm_release_CFLAGS := \ TARGET_thumb_release_CFLAGS := \ -mthumb \ - -Os \ + -Oz \ -DNDEBUG \ TARGET_arm_debug_CFLAGS := \ diff --git a/tests/device/gtest/test_config.py b/tests/device/gtest/test_config.py index 22c1f9f6..60b76094 100644 --- a/tests/device/gtest/test_config.py +++ b/tests/device/gtest/test_config.py @@ -1,7 +1,4 @@ def run_broken(abi, _device_api, toolchain, name): - if abi == 'armeabi' and toolchain == 'clang' and name == 'gtest_all_test': - return abi, 'https://github.com/android-ndk/ndk/issues/374' - if abi in ('x86', 'x86_64'): return abi, 'http://b/24380035'