From 05a965c1a8071bafba3c1740fa697ab7ae04aad5 Mon Sep 17 00:00:00 2001 From: Jim Chen Date: Mon, 29 Jan 2018 17:38:14 -0500 Subject: [PATCH] Bug 1428182 - 6a. Apply Breakpad upstream commit for building with NDK r16; r=ted Apply commit afa9c52715db1e4bfaa4b01c9aec40cc249b689b from the Breakpad upstream to support building with NDK r16. MozReview-Commit-ID: D6xafYkjhjt --HG-- extra : rebase_source : 92f92d04ab13ffab6e8891ca048679b6749ab1c7 --- .../src/common/android/include/link.h | 16 ++++-- .../src/common/android/include/sys/user.h | 50 ++++++------------- 2 files changed, 26 insertions(+), 40 deletions(-) diff --git a/toolkit/crashreporter/google-breakpad/src/common/android/include/link.h b/toolkit/crashreporter/google-breakpad/src/common/android/include/link.h index 0f7d98e7530f..ca059f15878c 100644 --- a/toolkit/crashreporter/google-breakpad/src/common/android/include/link.h +++ b/toolkit/crashreporter/google-breakpad/src/common/android/include/link.h @@ -34,10 +34,16 @@ Provide custom version here. */ #include_next -// TODO(rmcilroy): Remove this file once the ndk is updated for other -// architectures - crbug.com/358831 -#if !defined(__aarch64__) && !defined(__x86_64__) && \ - !(defined(__mips__) && _MIPS_SIM == _ABI64) +#include + +// TODO(rmcilroy): Remove this file once the NDK API level is updated to at +// least 21 for all architectures. https://crbug.com/358831 + +// These structures are only present in traditional headers at API level 21 and +// above. Unified headers define these structures regardless of the chosen API +// level. __ANDROID_API_N__ is a proxy for determining whether unified headers +// are in use. It’s only defined by unified headers. +#if __ANDROID_API__ < 21 && !defined(__ANDROID_API_N__) #ifdef __cplusplus extern "C" { @@ -68,6 +74,6 @@ struct link_map { } // extern "C" #endif // __cplusplus -#endif // !defined(__aarch64__) && !defined(__x86_64__) +#endif // __ANDROID_API__ < 21 && !defined(__ANDROID_API_N__) #endif /* GOOGLE_BREAKPAD_ANDROID_INCLUDE_LINK_H */ diff --git a/toolkit/crashreporter/google-breakpad/src/common/android/include/sys/user.h b/toolkit/crashreporter/google-breakpad/src/common/android/include/sys/user.h index 1eb02a57d2cc..5a9ba0537734 100644 --- a/toolkit/crashreporter/google-breakpad/src/common/android/include/sys/user.h +++ b/toolkit/crashreporter/google-breakpad/src/common/android/include/sys/user.h @@ -34,52 +34,32 @@ // glibc) and therefore avoid doing otherwise awkward #ifdefs in the code. // The following quirks are currently handled by this file: // - i386: Use the Android NDK but alias user_fxsr_struct > user_fpxregs_struct. -// - aarch64: -// - NDK r10: Add missing user_regs_struct and user_fpsimd_struct structs. -// - NDK r11+: Add missing include -// - Other platforms: Just use the Android NDK unchanged. // TODO(primiano): remove these changes after Chromium has stably rolled to -// an NDK with the appropriate fixes. - -#if defined(ANDROID_NDK_MAJOR_VERSION) && ANDROID_NDK_MAJOR_VERSION > 10 -#ifdef __aarch64__ -#include -#endif // __aarch64__ -#endif // defined(ANDROID_NDK_MAJOR_VERSION) && ANDROID_NDK_MAJOR_VERSION > 10 +// an NDK with the appropriate fixes. https://crbug.com/358831 #include_next -#ifdef __i386__ -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus -typedef struct user_fxsr_struct user_fpxregs_struct; -#ifdef __cplusplus -} // extern "C" -#endif // __cplusplus -#endif // __i386__ +#include -#if !defined(ANDROID_NDK_MAJOR_VERSION) || ANDROID_NDK_MAJOR_VERSION == 10 -#ifdef __aarch64__ #ifdef __cplusplus extern "C" { #endif // __cplusplus -struct user_regs_struct { - __u64 regs[31]; - __u64 sp; - __u64 pc; - __u64 pstate; -}; -struct user_fpsimd_struct { - __uint128_t vregs[32]; - __u32 fpsr; - __u32 fpcr; -}; + +#if defined(__i386__) +#if __ANDROID_API__ < 21 && !defined(__ANDROID_API_N__) + +// user_fpxregs_struct was called user_fxsr_struct in traditional headers before +// API level 21. Unified headers call it user_fpxregs_struct regardless of the +// chosen API level. __ANDROID_API_N__ is a proxy for determining whether +// unified headers are in use. It’s only defined by unified headers. +typedef struct user_fxsr_struct user_fpxregs_struct; + +#endif // __ANDROID_API__ < 21 && !defined(__ANDROID_API_N__) +#endif // defined(__i386__) + #ifdef __cplusplus } // extern "C" #endif // __cplusplus -#endif // __aarch64__ -#endif // defined(ANDROID_NDK_VERSION) && ANDROID_NDK_MAJOR_VERSION == 10 #endif // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H