Bug 761287 - Fix NDKr8 build by including Android sigcontext instead of using our own; r=ehsan

This commit is contained in:
Jim Chen 2012-11-08 11:45:17 -05:00
Родитель 98fe14949d
Коммит 779c8b61a6
2 изменённых файлов: 13 добавлений и 13 удалений

Просмотреть файл

@ -6,14 +6,16 @@
// Android runs a fairly new Linux kernel, so signal info is there,
// but the C library doesn't have the structs defined.
struct sigcontext {
uint32_t trap_no;
uint32_t error_code;
uint32_t oldmask;
uint32_t gregs[16];
uint32_t arm_cpsr;
uint32_t fault_address;
};
// All NDK platform versions have asm/sigcontext.h for ARM
// Only NDK >= 6, platform >= 9 have asm/sigcontext.h for x86
// Only NDK >= 8, platform >= 9 have asm/sigcontext.h for MIPS
#if defined(__arm__) || defined(__thumb__) || ANDROID_VERSION >= 9
#include <asm/sigcontext.h>
#else
#error use newer NDK or newer platform version (e.g. --with-android-version=9)
#endif
#ifndef __BIONIC_HAVE_UCONTEXT_T
typedef uint32_t __sigset_t;
typedef struct sigcontext mcontext_t;
typedef struct ucontext {
@ -23,7 +25,5 @@ typedef struct ucontext {
mcontext_t uc_mcontext;
__sigset_t uc_sigmask;
} ucontext_t;
enum ArmRegisters {R0 = 0, R1 = 1, R2 = 2, R3 = 3, R4 = 4, R5 = 5,
R6 = 6, R7 = 7, R8 = 8, R9 = 9, R10 = 10,
R11 = 11, R12 = 12, R13 = 13, R14 = 14, R15 = 15};
#endif

Просмотреть файл

@ -54,7 +54,7 @@ pid_t gettid()
static Sampler* sActiveSampler = NULL;
#if !defined(__GLIBC__) && (defined(__arm__) || defined(__thumb__))
#ifdef ANDROID
#include "android-signal-defs.h"
#endif
@ -93,7 +93,7 @@ static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) {
sample->fp = reinterpret_cast<Address>(mcontext.gregs[REG_RBP]);
#elif V8_HOST_ARCH_ARM
// An undefined macro evaluates to 0, so this applies to Android's Bionic also.
#if (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3))
#if !defined(ANDROID) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3))
sample->pc = reinterpret_cast<Address>(mcontext.gregs[R15]);
sample->sp = reinterpret_cast<Address>(mcontext.gregs[R13]);
sample->fp = reinterpret_cast<Address>(mcontext.gregs[R11]);