Skip to content

Commit

Permalink
Use -Oz instead of -Os for Clang.
Browse files Browse the repository at this point in the history
-Os doesn't really optimize for size.

Test: ./checkbuild.py && ./run_tests.py
Bug: android/ndk#133
Change-Id: I8d4eb6f57ca88ea1034c9a3fa02419c0134d5aff
  • Loading branch information
DanAlbert committed Sep 26, 2017
1 parent 6cc5725 commit 7457fda
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
19 changes: 9 additions & 10 deletions build/cmake/android.toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion build/core/toolchains/arm-linux-androideabi-clang/setup.mk
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ TARGET_arm_release_CFLAGS := \

TARGET_thumb_release_CFLAGS := \
-mthumb \
-Os \
-Oz \
-DNDEBUG \

TARGET_arm_debug_CFLAGS := \
Expand Down
3 changes: 0 additions & 3 deletions tests/device/gtest/test_config.py
Original file line number Diff line number Diff line change
@@ -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'

Expand Down

0 comments on commit 7457fda

Please sign in to comment.