• R/O
  • HTTP
  • SSH
  • HTTPS

thirdparty-breakpad: Commit

Breakpad, a crash reporter, from Google.

Original home: https://chromium.googlesource.com/breakpad/breakpad/


Commit MetaInfo

Révisionafa9c52715db1e4bfaa4b01c9aec40cc249b689b (tree)
l'heure2017-09-18 23:00:44
AuteurMark Mentovai <mark@chro...>
CommiterMark Mentovai

Message de Log

android: Don’t compete with NDK API >= 21 over NDK structures

Chrome uses API 16 for 32-bit builds and API 21 for 64-bit builds. The
NDK’s <link.h> provides r_debug and link_map structure definitions only
at API 21 and above. Breakpad used a custom <link.h> to define these
structures only during 64-bit builds, which worked for Chrome’s
purposes. However, other consumers may wish to build Breakpad at
arbitrary API levels without regard to bitness. This alters Breakpad’s
custom <link.h> to correctly check the NDK API level rather than target
CPU bitness.

Likewise for <sys/user.h> on 32-bit x86, which provided a typedef for
user_fpxregs_struct to user_fxsr_struct. API 21 and above, as well as
the unified headers at any API level, always name the structure
user_fpxregs_struct.

Definitions for 64-bit ARM’s user_regs_struct and user_fpsimd_struct
have been removed from Breakpad’s copy of <sys/user.h>. The header
claims that these fallback definitions are only necessary with NDK r10,
which should no longer be in use even by Chromium, which now uses NDK
r12b. This removes the Chromium-specific ANDROID_NDK_MAJOR_VERSION macro
from use entirely.

Fixes https://stackoverflow.com/questions/44141159/ and b/65630828.

Bug: google-breakpad:733
Change-Id: I5841906297cd15b15ce48b73fd8332fd40afc9a0
Reviewed-on: https://chromium-review.googlesource.com/665740
Reviewed-by: Primiano Tucci <primiano@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>

Change Summary

Modification

--- a/src/common/android/include/link.h
+++ b/src/common/android/include/link.h
@@ -34,10 +34,16 @@
3434 Provide custom version here. */
3535 #include_next <link.h>
3636
37-// TODO(rmcilroy): Remove this file once the ndk is updated for other
38-// architectures - crbug.com/358831
39-#if !defined(__aarch64__) && !defined(__x86_64__) && \
40- !(defined(__mips__) && _MIPS_SIM == _ABI64)
37+#include <android/api-level.h>
38+
39+// TODO(rmcilroy): Remove this file once the NDK API level is updated to at
40+// least 21 for all architectures. https://crbug.com/358831
41+
42+// These structures are only present in traditional headers at API level 21 and
43+// above. Unified headers define these structures regardless of the chosen API
44+// level. __ANDROID_API_N__ is a proxy for determining whether unified headers
45+// are in use. It’s only defined by unified headers.
46+#if __ANDROID_API__ < 21 && !defined(__ANDROID_API_N__)
4147
4248 #ifdef __cplusplus
4349 extern "C" {
@@ -66,6 +72,6 @@ struct link_map {
6672 } // extern "C"
6773 #endif // __cplusplus
6874
69-#endif // !defined(__aarch64__) && !defined(__x86_64__)
75+#endif // __ANDROID_API__ < 21 && !defined(__ANDROID_API_N__)
7076
7177 #endif /* GOOGLE_BREAKPAD_ANDROID_INCLUDE_LINK_H */
--- a/src/common/android/include/sys/user.h
+++ b/src/common/android/include/sys/user.h
@@ -34,52 +34,32 @@
3434 // glibc) and therefore avoid doing otherwise awkward #ifdefs in the code.
3535 // The following quirks are currently handled by this file:
3636 // - i386: Use the Android NDK but alias user_fxsr_struct > user_fpxregs_struct.
37-// - aarch64:
38-// - NDK r10: Add missing user_regs_struct and user_fpsimd_struct structs.
39-// - NDK r11+: Add missing <stdint.h> include
40-// - Other platforms: Just use the Android NDK unchanged.
4137
4238 // TODO(primiano): remove these changes after Chromium has stably rolled to
43-// an NDK with the appropriate fixes.
44-
45-#if defined(ANDROID_NDK_MAJOR_VERSION) && ANDROID_NDK_MAJOR_VERSION > 10
46-#ifdef __aarch64__
47-#include <stdint.h>
48-#endif // __aarch64__
49-#endif // defined(ANDROID_NDK_MAJOR_VERSION) && ANDROID_NDK_MAJOR_VERSION > 10
39+// an NDK with the appropriate fixes. https://crbug.com/358831
5040
5141 #include_next <sys/user.h>
5242
53-#ifdef __i386__
43+#include <android/api-level.h>
44+
5445 #ifdef __cplusplus
5546 extern "C" {
5647 #endif // __cplusplus
48+
49+#if defined(__i386__)
50+#if __ANDROID_API__ < 21 && !defined(__ANDROID_API_N__)
51+
52+// user_fpxregs_struct was called user_fxsr_struct in traditional headers before
53+// API level 21. Unified headers call it user_fpxregs_struct regardless of the
54+// chosen API level. __ANDROID_API_N__ is a proxy for determining whether
55+// unified headers are in use. It’s only defined by unified headers.
5756 typedef struct user_fxsr_struct user_fpxregs_struct;
58-#ifdef __cplusplus
59-} // extern "C"
60-#endif // __cplusplus
61-#endif // __i386__
6257
63-#if !defined(ANDROID_NDK_MAJOR_VERSION) || ANDROID_NDK_MAJOR_VERSION == 10
64-#ifdef __aarch64__
65-#ifdef __cplusplus
66-extern "C" {
67-#endif // __cplusplus
68-struct user_regs_struct {
69- __u64 regs[31];
70- __u64 sp;
71- __u64 pc;
72- __u64 pstate;
73-};
74-struct user_fpsimd_struct {
75- __uint128_t vregs[32];
76- __u32 fpsr;
77- __u32 fpcr;
78-};
58+#endif // __ANDROID_API__ < 21 && !defined(__ANDROID_API_N__)
59+#endif // defined(__i386__)
60+
7961 #ifdef __cplusplus
8062 } // extern "C"
8163 #endif // __cplusplus
82-#endif // __aarch64__
83-#endif // defined(ANDROID_NDK_VERSION) && ANDROID_NDK_MAJOR_VERSION == 10
8464
8565 #endif // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H
Afficher sur ancien navigateur de dépôt.