-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ndk): Ensure 64-bit devices do not use 32-bit logic (#383)
Small refactor of the API 21+ stack unwinding logic to restrict 32-bit unwinding style from 64-bit devices. While the stack enhancements added in #378 are intended only to be run on 32-bit devices and gated to the arm build, when 64-bit devices are running the 32-bit library, the stacktraces for those devices were unintentionally affected. This is the case when an app is configured to only run 32-bit binaries (Android cannot run both 64-bit and 32-bit binaries at once), and many popular libraries (e.g. React Native) only distribute 32-bit libraries. Added additional improvement to the 32-bit stacktrace resolution by switching to nongnu libunwind only for those devices. This significantly improves the number of frames which can be unwound without risk of a segfault.
- Loading branch information
Showing
10 changed files
with
657 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
ndk/src/main/jni/external/libunwind/include/__libunwind_config.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
//===------------------------- __libunwind_config.h -----------------------===// | ||
// | ||
// The LLVM Compiler Infrastructure | ||
// | ||
// This file is dual licensed under the MIT and the University of Illinois Open | ||
// Source Licenses. See LICENSE.TXT for details. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
#ifndef ____LIBUNWIND_CONFIG_H__ | ||
#define ____LIBUNWIND_CONFIG_H__ | ||
#if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \ | ||
!defined(__ARM_DWARF_EH__) | ||
#define _LIBUNWIND_ARM_EHABI 1 | ||
#else | ||
#define _LIBUNWIND_ARM_EHABI 0 | ||
#endif | ||
#if defined(_LIBUNWIND_IS_NATIVE_ONLY) | ||
# if defined(__i386__) | ||
# define _LIBUNWIND_TARGET_I386 1 | ||
# define _LIBUNWIND_CONTEXT_SIZE 8 | ||
# define _LIBUNWIND_CURSOR_SIZE 19 | ||
# elif defined(__x86_64__) | ||
# define _LIBUNWIND_TARGET_X86_64 1 | ||
# define _LIBUNWIND_CONTEXT_SIZE 21 | ||
# define _LIBUNWIND_CURSOR_SIZE 33 | ||
# elif defined(__ppc__) | ||
# define _LIBUNWIND_TARGET_PPC 1 | ||
# define _LIBUNWIND_CONTEXT_SIZE 117 | ||
# define _LIBUNWIND_CURSOR_SIZE 128 | ||
# elif defined(__aarch64__) | ||
# define _LIBUNWIND_TARGET_AARCH64 1 | ||
# define _LIBUNWIND_CONTEXT_SIZE 66 | ||
# define _LIBUNWIND_CURSOR_SIZE 78 | ||
# elif defined(__arm__) | ||
# define _LIBUNWIND_TARGET_ARM 1 | ||
# define _LIBUNWIND_CONTEXT_SIZE 60 | ||
# define _LIBUNWIND_CURSOR_SIZE 67 | ||
# elif defined(__or1k__) | ||
# define _LIBUNWIND_TARGET_OR1K 1 | ||
# define _LIBUNWIND_CONTEXT_SIZE 16 | ||
# define _LIBUNWIND_CURSOR_SIZE 28 | ||
# else | ||
# error "Unsupported architecture." | ||
# endif | ||
#else // !_LIBUNWIND_IS_NATIVE_ONLY | ||
# define _LIBUNWIND_TARGET_I386 1 | ||
# define _LIBUNWIND_TARGET_X86_64 1 | ||
# define _LIBUNWIND_TARGET_PPC 1 | ||
# define _LIBUNWIND_TARGET_AARCH64 1 | ||
# define _LIBUNWIND_TARGET_ARM 1 | ||
# define _LIBUNWIND_TARGET_OR1K 1 | ||
# define _LIBUNWIND_CONTEXT_SIZE 128 | ||
# define _LIBUNWIND_CURSOR_SIZE 140 | ||
#endif // _LIBUNWIND_IS_NATIVE_ONLY | ||
#endif // ____LIBUNWIND_CONFIG_H__ |
Oops, something went wrong.