michael@0: // Copyright (c) 2012, Google Inc. michael@0: // All rights reserved. michael@0: // michael@0: // Redistribution and use in source and binary forms, with or without michael@0: // modification, are permitted provided that the following conditions are michael@0: // met: michael@0: // michael@0: // * Redistributions of source code must retain the above copyright michael@0: // notice, this list of conditions and the following disclaimer. michael@0: // * Redistributions in binary form must reproduce the above michael@0: // copyright notice, this list of conditions and the following disclaimer michael@0: // in the documentation and/or other materials provided with the michael@0: // distribution. michael@0: // * Neither the name of Google Inc. nor the names of its michael@0: // contributors may be used to endorse or promote products derived from michael@0: // this software without specific prior written permission. michael@0: // michael@0: // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS michael@0: // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT michael@0: // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR michael@0: // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT michael@0: // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, michael@0: // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT michael@0: // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, michael@0: // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY michael@0: // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT michael@0: // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE michael@0: // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. michael@0: michael@0: #ifndef GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_ELF_H michael@0: #define GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_ELF_H michael@0: michael@0: #include michael@0: #include michael@0: michael@0: #ifdef __cplusplus michael@0: extern "C" { michael@0: #endif // __cplusplus michael@0: michael@0: // The Android provides BSD-based definitions for the ElfXX_Nhdr michael@0: // types michael@0: // always source-compatible with the GLibc/kernel ones. To overcome this michael@0: // issue without modifying a lot of code in Breakpad, use an ugly macro michael@0: // renaming trick with #include_next michael@0: michael@0: // Avoid conflict with BSD-based definition of ElfXX_Nhdr. michael@0: // Unfortunately, their field member names do not use a 'n_' prefix. michael@0: #define Elf32_Nhdr __bsd_Elf32_Nhdr michael@0: #define Elf64_Nhdr __bsd_Elf64_Nhdr michael@0: michael@0: // In case they are defined by the NDK version michael@0: #define Elf32_auxv_t __bionic_Elf32_auxv_t michael@0: #define Elf64_auxv_t __bionic_Elf64_auxv_t michael@0: michael@0: #define Elf32_Dyn __bionic_Elf32_Dyn michael@0: #define Elf64_Dyn __bionic_Elf64_Dyn michael@0: michael@0: #include_next michael@0: michael@0: #undef Elf32_Nhdr michael@0: #undef Elf64_Nhdr michael@0: michael@0: typedef struct { michael@0: Elf32_Word n_namesz; michael@0: Elf32_Word n_descsz; michael@0: Elf32_Word n_type; michael@0: } Elf32_Nhdr; michael@0: michael@0: typedef struct { michael@0: Elf64_Word n_namesz; michael@0: Elf64_Word n_descsz; michael@0: Elf64_Word n_type; michael@0: } Elf64_Nhdr; michael@0: michael@0: #undef Elf32_auxv_t michael@0: #undef Elf64_auxv_t michael@0: michael@0: typedef struct { michael@0: uint32_t a_type; michael@0: union { michael@0: uint32_t a_val; michael@0: } a_un; michael@0: } Elf32_auxv_t; michael@0: michael@0: typedef struct { michael@0: uint64_t a_type; michael@0: union { michael@0: uint64_t a_val; michael@0: } a_un; michael@0: } Elf64_auxv_t; michael@0: michael@0: #undef Elf32_Dyn michael@0: #undef Elf64_Dyn michael@0: michael@0: typedef struct { michael@0: Elf32_Sword d_tag; michael@0: union { michael@0: Elf32_Word d_val; michael@0: Elf32_Addr d_ptr; michael@0: } d_un; michael@0: } Elf32_Dyn; michael@0: michael@0: typedef struct { michael@0: Elf64_Sxword d_tag; michael@0: union { michael@0: Elf64_Xword d_val; michael@0: Elf64_Addr d_ptr; michael@0: } d_un; michael@0: } Elf64_Dyn; michael@0: michael@0: michael@0: // __WORDSIZE is GLibc-specific and used by Google Breakpad on Linux. michael@0: // All Android platforms are 32-bit for now. michael@0: #ifndef __WORDSIZE michael@0: #define __WORDSIZE 32 michael@0: #endif michael@0: michael@0: // The Android headers don't always define this constant. michael@0: #ifndef EM_X86_64 michael@0: #define EM_X86_64 62 michael@0: #endif michael@0: michael@0: #ifndef EM_PPC64 michael@0: #define EM_PPC64 21 michael@0: #endif michael@0: michael@0: #ifndef EM_S390 michael@0: #define EM_S390 22 michael@0: #endif michael@0: michael@0: #if !defined(AT_SYSINFO_EHDR) michael@0: #define AT_SYSINFO_EHDR 33 michael@0: #endif michael@0: michael@0: #if !defined(NT_PRSTATUS) michael@0: #define NT_PRSTATUS 1 michael@0: #endif michael@0: michael@0: #if !defined(NT_PRPSINFO) michael@0: #define NT_PRPSINFO 3 michael@0: #endif michael@0: michael@0: #if !defined(NT_AUXV) michael@0: #define NT_AUXV 6 michael@0: #endif michael@0: michael@0: #if !defined(NT_PRXFPREG) michael@0: #define NT_PRXFPREG 0x46e62b7f michael@0: #endif michael@0: michael@0: #if !defined(NT_FPREGSET) michael@0: #define NT_FPREGSET 2 michael@0: #endif michael@0: michael@0: #ifdef __cplusplus michael@0: } // extern "C" michael@0: #endif // __cplusplus michael@0: michael@0: #endif // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_ELF_H