1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/crashreporter/google-breakpad/src/common/android/include/elf.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,159 @@ 1.4 +// Copyright (c) 2012, Google Inc. 1.5 +// All rights reserved. 1.6 +// 1.7 +// Redistribution and use in source and binary forms, with or without 1.8 +// modification, are permitted provided that the following conditions are 1.9 +// met: 1.10 +// 1.11 +// * Redistributions of source code must retain the above copyright 1.12 +// notice, this list of conditions and the following disclaimer. 1.13 +// * Redistributions in binary form must reproduce the above 1.14 +// copyright notice, this list of conditions and the following disclaimer 1.15 +// in the documentation and/or other materials provided with the 1.16 +// distribution. 1.17 +// * Neither the name of Google Inc. nor the names of its 1.18 +// contributors may be used to endorse or promote products derived from 1.19 +// this software without specific prior written permission. 1.20 +// 1.21 +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1.22 +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1.23 +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1.24 +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 1.25 +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 1.26 +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 1.27 +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 1.28 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 1.29 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 1.30 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 1.31 +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 1.32 + 1.33 +#ifndef GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_ELF_H 1.34 +#define GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_ELF_H 1.35 + 1.36 +#include <stdint.h> 1.37 +#include <libgen.h> 1.38 + 1.39 +#ifdef __cplusplus 1.40 +extern "C" { 1.41 +#endif // __cplusplus 1.42 + 1.43 +// The Android <elf.h> provides BSD-based definitions for the ElfXX_Nhdr 1.44 +// types 1.45 +// always source-compatible with the GLibc/kernel ones. To overcome this 1.46 +// issue without modifying a lot of code in Breakpad, use an ugly macro 1.47 +// renaming trick with #include_next 1.48 + 1.49 +// Avoid conflict with BSD-based definition of ElfXX_Nhdr. 1.50 +// Unfortunately, their field member names do not use a 'n_' prefix. 1.51 +#define Elf32_Nhdr __bsd_Elf32_Nhdr 1.52 +#define Elf64_Nhdr __bsd_Elf64_Nhdr 1.53 + 1.54 +// In case they are defined by the NDK version 1.55 +#define Elf32_auxv_t __bionic_Elf32_auxv_t 1.56 +#define Elf64_auxv_t __bionic_Elf64_auxv_t 1.57 + 1.58 +#define Elf32_Dyn __bionic_Elf32_Dyn 1.59 +#define Elf64_Dyn __bionic_Elf64_Dyn 1.60 + 1.61 +#include_next <elf.h> 1.62 + 1.63 +#undef Elf32_Nhdr 1.64 +#undef Elf64_Nhdr 1.65 + 1.66 +typedef struct { 1.67 + Elf32_Word n_namesz; 1.68 + Elf32_Word n_descsz; 1.69 + Elf32_Word n_type; 1.70 +} Elf32_Nhdr; 1.71 + 1.72 +typedef struct { 1.73 + Elf64_Word n_namesz; 1.74 + Elf64_Word n_descsz; 1.75 + Elf64_Word n_type; 1.76 +} Elf64_Nhdr; 1.77 + 1.78 +#undef Elf32_auxv_t 1.79 +#undef Elf64_auxv_t 1.80 + 1.81 +typedef struct { 1.82 + uint32_t a_type; 1.83 + union { 1.84 + uint32_t a_val; 1.85 + } a_un; 1.86 +} Elf32_auxv_t; 1.87 + 1.88 +typedef struct { 1.89 + uint64_t a_type; 1.90 + union { 1.91 + uint64_t a_val; 1.92 + } a_un; 1.93 +} Elf64_auxv_t; 1.94 + 1.95 +#undef Elf32_Dyn 1.96 +#undef Elf64_Dyn 1.97 + 1.98 +typedef struct { 1.99 + Elf32_Sword d_tag; 1.100 + union { 1.101 + Elf32_Word d_val; 1.102 + Elf32_Addr d_ptr; 1.103 + } d_un; 1.104 +} Elf32_Dyn; 1.105 + 1.106 +typedef struct { 1.107 + Elf64_Sxword d_tag; 1.108 + union { 1.109 + Elf64_Xword d_val; 1.110 + Elf64_Addr d_ptr; 1.111 + } d_un; 1.112 +} Elf64_Dyn; 1.113 + 1.114 + 1.115 +// __WORDSIZE is GLibc-specific and used by Google Breakpad on Linux. 1.116 +// All Android platforms are 32-bit for now. 1.117 +#ifndef __WORDSIZE 1.118 +#define __WORDSIZE 32 1.119 +#endif 1.120 + 1.121 +// The Android headers don't always define this constant. 1.122 +#ifndef EM_X86_64 1.123 +#define EM_X86_64 62 1.124 +#endif 1.125 + 1.126 +#ifndef EM_PPC64 1.127 +#define EM_PPC64 21 1.128 +#endif 1.129 + 1.130 +#ifndef EM_S390 1.131 +#define EM_S390 22 1.132 +#endif 1.133 + 1.134 +#if !defined(AT_SYSINFO_EHDR) 1.135 +#define AT_SYSINFO_EHDR 33 1.136 +#endif 1.137 + 1.138 +#if !defined(NT_PRSTATUS) 1.139 +#define NT_PRSTATUS 1 1.140 +#endif 1.141 + 1.142 +#if !defined(NT_PRPSINFO) 1.143 +#define NT_PRPSINFO 3 1.144 +#endif 1.145 + 1.146 +#if !defined(NT_AUXV) 1.147 +#define NT_AUXV 6 1.148 +#endif 1.149 + 1.150 +#if !defined(NT_PRXFPREG) 1.151 +#define NT_PRXFPREG 0x46e62b7f 1.152 +#endif 1.153 + 1.154 +#if !defined(NT_FPREGSET) 1.155 +#define NT_FPREGSET 2 1.156 +#endif 1.157 + 1.158 +#ifdef __cplusplus 1.159 +} // extern "C" 1.160 +#endif // __cplusplus 1.161 + 1.162 +#endif // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_ELF_H