Skip to content

Commit

Permalink
Fix incorrect min API level for rosegment.
Browse files Browse the repository at this point in the history
Broken crash stack traces with SDK 29, and need to raise the min SDK version to 30 to solve the problem.

Test: added test
fix bug 1589 android/ndk#1589
Change-Id: Ie39ed3e48048a90caa69a462ff44e48a02c361d8
  • Loading branch information
ZijunZhaoCCK committed Oct 12, 2021
1 parent 858eee3 commit e3436c7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion build/cmake/android-legacy.toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,9 @@ list(APPEND ANDROID_COMPILER_FLAGS
# the old version of LLDB in Android Studio, which doesn't understand LLD's
# default hash ("fast").
list(APPEND ANDROID_LINKER_FLAGS -Wl,--build-id=sha1)
if(ANDROID_PLATFORM_LEVEL LESS 29)
if(ANDROID_PLATFORM_LEVEL LESS 30)
# https://github.com/android/ndk/issues/1196
# https://github.com/android/ndk/issues/1589
list(APPEND ANDROID_LINKER_FLAGS -Wl,--no-rosegment)
endif()

Expand Down
3 changes: 2 additions & 1 deletion build/cmake/flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ string(APPEND _ANDROID_NDK_INIT_CFLAGS_DEBUG " -fno-limit-debug-info")
# https://github.com/android/ndk/issues/885
string(APPEND _ANDROID_NDK_INIT_LDFLAGS " -Wl,--build-id=sha1")

if(CMAKE_SYSTEM_VERSION LESS 29)
if(CMAKE_SYSTEM_VERSION LESS 30)
# https://github.com/android/ndk/issues/1196
# https://github.com/android/ndk/issues/1589
string(APPEND _ANDROID_NDK_INIT_LDFLAGS " -Wl,--no-rosegment")
endif()

Expand Down
3 changes: 2 additions & 1 deletion build/core/build-binary.mk
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,9 @@ CLEAN_OBJS_DIRS += $(LOCAL_OBJS_DIR)
# default hash ("fast").
linker_ldflags := -Wl,--build-id=sha1

ifneq (,$(call lt,$(APP_PLATFORM_LEVEL),29))
ifneq (,$(call lt,$(APP_PLATFORM_LEVEL),30))
# https://github.com/android/ndk/issues/1196
# https://github.com/android/ndk/issues/1589
linker_ldflags += -Wl,--no-rosegment
endif

Expand Down
4 changes: 2 additions & 2 deletions tests/build/lld_rosegment/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ def run_test(ndk_path: str,
config: BuildConfiguration) -> tuple[bool, Optional[str]]:
"""Checks correct --no-rosegment use."""
verifier = FlagVerifier(Path('project'), Path(ndk_path),
config).with_api(28)
config).with_api(29)
verifier.expect_flag('-Wl,--no-rosegment')
verifier.expect_not_flag('-Wl,--rosegment')
result = verifier.verify()
if result.failed():
return result.make_test_result_tuple()

verifier = FlagVerifier(Path('project'), Path(ndk_path),
config).with_api(29)
config).with_api(30)
verifier.expect_not_flag('-Wl,--no-rosegment')
return verifier.verify().make_test_result_tuple()

0 comments on commit e3436c7

Please sign in to comment.