aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorprimiano@chromium.org <primiano@chromium.org>2015-03-16 14:12:20 +0000
committerprimiano@chromium.org <primiano@chromium.org>2015-03-16 14:12:20 +0000
commit9b2d7192a4445106beaca76113afa5acd1f937ee (patch)
treee67a3ee542701f42086dee999f731d9b4f2b3009
parentMake breakpad compatible with Android NDK r10d. (diff)
downloadbreakpad-9b2d7192a4445106beaca76113afa5acd1f937ee.tar.xz
Fix compatibility with Android NDK r10d.
This is a reland of the previous CL (r1433). r1433 did not achieve what intended and failed the x86_64 build of Chrome with NDK r10c. The workaround logic in this CL is identical to r1433, but the #define magic is applied in a more appropriate proper place this time. Turns out Breakpad already has an Android compatibility layer, which is common/android/include. Piggybacking the fix there. BUG=breakpad:642 R=fdegans@chromium.org, rmcilroy@chromium.org Review URL: https://breakpad.appspot.com/3794002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1434 4c0a9323-5329-0410-9bdc-e9ce6186880e
-rw-r--r--src/client/linux/dump_writer_common/thread_info.h15
-rw-r--r--src/common/android/include/sys/user.h22
2 files changed, 20 insertions, 17 deletions
diff --git a/src/client/linux/dump_writer_common/thread_info.h b/src/client/linux/dump_writer_common/thread_info.h
index 2a99bb97..5f24fd6b 100644
--- a/src/client/linux/dump_writer_common/thread_info.h
+++ b/src/client/linux/dump_writer_common/thread_info.h
@@ -31,22 +31,7 @@
#define CLIENT_LINUX_DUMP_WRITER_COMMON_THREAD_INFO_H_
#include <sys/ucontext.h>
-
-// TODO(primiano): remove this after Chromium has stably rolled to NDK r10d.
-// Historical context: NDK releases < r10d had a typo in sys/user.h (mxcsr_mask
-// instead of mxcr_mask), which is fixed in r10d. However, just switching to use
-// the correct one (mxcr_mask) would put Breakpad in a state where it can be
-// rolled in chromium only atomically with the r10d NDK. A revert of either
-// project (android_tools, breakpad) would make the other one unrollable.
-// This hack makes breakpad code compatible with both r10c and r10d NDKs,
-// reducing the dependency entangling with android_tools.
-#if defined (__ANDROID__)
-#define mxcsr_mask mxcr_mask
-#include <sys/user.h>
-#undef mxcsr_mask
-#else
#include <sys/user.h>
-#endif
#include "client/linux/dump_writer_common/raw_context_cpu.h"
#include "common/memory.h"
diff --git a/src/common/android/include/sys/user.h b/src/common/android/include/sys/user.h
index d41a82cb..05b22ced 100644
--- a/src/common/android/include/sys/user.h
+++ b/src/common/android/include/sys/user.h
@@ -34,9 +34,11 @@
// glibc) and therefore avoid doing otherwise awkward #ifdefs in the code.
// The following quirks are currently handled by this file:
// - MIPS: Keep using forked definitions of user.h structs. The definition in
-// the NDK is completely different.
-// Internal bug b/18097715
+// the NDK is completely different. Internal bug b/18097715
// - i386: Use the Android NDK but alias user_fxsr_struct > user_fpxregs_struct.
+// - x86_64: Override a typo in user_fpregs_struct (mxcsr_mask -> mxcr_mask).
+// The typo has been fixed in NDK r10d, but a preprocessor workaround is
+// required to make breakpad build with r10c and lower (more details below).
// - Other platforms: Just use the Android NDK unchanged.
#ifdef __mips__
@@ -113,8 +115,24 @@ struct user_fpregs_struct {
#else // __mips__
+// TODO(primiano): remove this after Chromium has stably rolled to NDK r10d.
+// Historical context: NDK releases < r10d had a typo in sys/user.h (mxcsr_mask
+// instead of mxcr_mask), which is fixed in r10d. However, just switching to use
+// the correct one (mxcr_mask) would put Breakpad in a state where it can be
+// rolled in chromium only atomically with the r10d NDK. A revert of either
+// project (android_tools, breakpad) would make the other one unrollable.
+// This hack makes breakpad code compatible with both r10c and r10d NDKs,
+// reducing the dependency entangling with android_tools.
+#if defined(__x86_64__)
+#define mxcsr_mask mxcr_mask
+#endif
+
#include_next <sys/user.h>
+#if defined(__x86_64__)
+#undef mxcsr_mask
+#endif
+
#ifdef __i386__
#ifdef __cplusplus
extern "C" {