The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 1 | /* $OpenBSD: exec_elf.h,v 1.41 2006/01/06 18:53:05 millert Exp $ */ |
| 2 | /* |
| 3 | * Copyright (c) 1995, 1996 Erik Theisen. All rights reserved. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions |
| 7 | * are met: |
| 8 | * 1. Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * 2. Redistributions in binary form must reproduce the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer in the |
| 12 | * documentation and/or other materials provided with the distribution. |
| 13 | * 3. The name of the author may not be used to endorse or promote products |
| 14 | * derived from this software without specific prior written permission |
| 15 | * |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 | */ |
| 27 | |
| 28 | /* |
| 29 | * This is the ELF ABI header file |
| 30 | * formerly known as "elf_abi.h". |
| 31 | */ |
| 32 | |
| 33 | #ifndef _SYS_EXEC_ELF_H_ |
| 34 | #define _SYS_EXEC_ELF_H_ |
| 35 | |
| 36 | #include <machine/_types.h> |
| 37 | #include <machine/exec.h> |
Nick Kralevich | 67e7a93 | 2012-02-28 11:49:41 -0800 | [diff] [blame] | 38 | #include <linux/elf.h> |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 39 | |
| 40 | /* e_ident[] Operating System/ABI */ |
| 41 | #define ELFOSABI_SYSV 0 /* UNIX System V ABI */ |
| 42 | #define ELFOSABI_HPUX 1 /* HP-UX operating system */ |
| 43 | #define ELFOSABI_NETBSD 2 /* NetBSD */ |
| 44 | #define ELFOSABI_LINUX 3 /* GNU/Linux */ |
| 45 | #define ELFOSABI_HURD 4 /* GNU/Hurd */ |
| 46 | #define ELFOSABI_86OPEN 5 /* 86Open common IA32 ABI */ |
| 47 | #define ELFOSABI_SOLARIS 6 /* Solaris */ |
| 48 | #define ELFOSABI_MONTEREY 7 /* Monterey */ |
| 49 | #define ELFOSABI_IRIX 8 /* IRIX */ |
| 50 | #define ELFOSABI_FREEBSD 9 /* FreeBSD */ |
| 51 | #define ELFOSABI_TRU64 10 /* TRU64 UNIX */ |
| 52 | #define ELFOSABI_MODESTO 11 /* Novell Modesto */ |
| 53 | #define ELFOSABI_OPENBSD 12 /* OpenBSD */ |
| 54 | #define ELFOSABI_ARM 97 /* ARM */ |
| 55 | #define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */ |
| 56 | |
| 57 | /* e_ident */ |
| 58 | #define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \ |
| 59 | (ehdr).e_ident[EI_MAG1] == ELFMAG1 && \ |
| 60 | (ehdr).e_ident[EI_MAG2] == ELFMAG2 && \ |
| 61 | (ehdr).e_ident[EI_MAG3] == ELFMAG3) |
| 62 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 63 | /* e_machine */ |
| 64 | #define EM_NONE 0 /* No Machine */ |
| 65 | #define EM_M32 1 /* AT&T WE 32100 */ |
| 66 | #define EM_SPARC 2 /* SPARC */ |
| 67 | #define EM_386 3 /* Intel 80386 */ |
| 68 | #define EM_68K 4 /* Motorola 68000 */ |
| 69 | #define EM_88K 5 /* Motorola 88000 */ |
| 70 | #define EM_486 6 /* Intel 80486 - unused? */ |
| 71 | #define EM_860 7 /* Intel 80860 */ |
| 72 | #define EM_MIPS 8 /* MIPS R3000 Big-Endian only */ |
| 73 | /* |
| 74 | * Don't know if EM_MIPS_RS4_BE, |
| 75 | * EM_SPARC64, EM_PARISC, |
| 76 | * or EM_PPC are ABI compliant |
| 77 | */ |
| 78 | #define EM_MIPS_RS4_BE 10 /* MIPS R4000 Big-Endian */ |
| 79 | #define EM_SPARC64 11 /* SPARC v9 64-bit unoffical */ |
| 80 | #define EM_PARISC 15 /* HPPA */ |
| 81 | #define EM_SPARC32PLUS 18 /* Enhanced instruction set SPARC */ |
| 82 | #define EM_PPC 20 /* PowerPC */ |
| 83 | #define EM_ARM 40 /* Advanced RISC Machines ARM */ |
| 84 | #define EM_ALPHA 41 /* DEC ALPHA */ |
| 85 | #define EM_SPARCV9 43 /* SPARC version 9 */ |
| 86 | #define EM_ALPHA_EXP 0x9026 /* DEC ALPHA */ |
| 87 | #define EM_AMD64 62 /* AMD64 architecture */ |
| 88 | #define EM_VAX 75 /* DEC VAX */ |
| 89 | #define EM_NUM 15 /* number of machine types */ |
| 90 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 91 | |
| 92 | /* Section names */ |
| 93 | #define ELF_BSS ".bss" /* uninitialized data */ |
| 94 | #define ELF_DATA ".data" /* initialized data */ |
| 95 | #define ELF_DEBUG ".debug" /* debug */ |
| 96 | #define ELF_DYNAMIC ".dynamic" /* dynamic linking information */ |
| 97 | #define ELF_DYNSTR ".dynstr" /* dynamic string table */ |
| 98 | #define ELF_DYNSYM ".dynsym" /* dynamic symbol table */ |
| 99 | #define ELF_FINI ".fini" /* termination code */ |
| 100 | #define ELF_GOT ".got" /* global offset table */ |
| 101 | #define ELF_HASH ".hash" /* symbol hash table */ |
| 102 | #define ELF_INIT ".init" /* initialization code */ |
| 103 | #define ELF_REL_DATA ".rel.data" /* relocation data */ |
| 104 | #define ELF_REL_FINI ".rel.fini" /* relocation termination code */ |
| 105 | #define ELF_REL_INIT ".rel.init" /* relocation initialization code */ |
| 106 | #define ELF_REL_DYN ".rel.dyn" /* relocaltion dynamic link info */ |
| 107 | #define ELF_REL_RODATA ".rel.rodata" /* relocation read-only data */ |
| 108 | #define ELF_REL_TEXT ".rel.text" /* relocation code */ |
| 109 | #define ELF_RODATA ".rodata" /* read-only data */ |
| 110 | #define ELF_SHSTRTAB ".shstrtab" /* section header string table */ |
| 111 | #define ELF_STRTAB ".strtab" /* string table */ |
| 112 | #define ELF_SYMTAB ".symtab" /* symbol table */ |
| 113 | #define ELF_TEXT ".text" /* code */ |
| 114 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 115 | /* Symbol Binding - ELF32_ST_BIND - st_info */ |
| 116 | #define STB_LOCAL 0 /* Local symbol */ |
| 117 | #define STB_GLOBAL 1 /* Global symbol */ |
| 118 | #define STB_WEAK 2 /* like global - lower precedence */ |
| 119 | #define STB_NUM 3 /* number of symbol bindings */ |
| 120 | #define STB_LOPROC 13 /* reserved range for processor */ |
| 121 | #define STB_HIPROC 15 /* specific symbol bindings */ |
| 122 | |
| 123 | /* Symbol type - ELF32_ST_TYPE - st_info */ |
| 124 | #define STT_NOTYPE 0 /* not specified */ |
| 125 | #define STT_OBJECT 1 /* data object */ |
| 126 | #define STT_FUNC 2 /* function */ |
| 127 | #define STT_SECTION 3 /* section */ |
| 128 | #define STT_FILE 4 /* file */ |
| 129 | #define STT_NUM 5 /* number of symbol types */ |
| 130 | #define STT_LOPROC 13 /* reserved range for processor */ |
| 131 | #define STT_HIPROC 15 /* specific symbol types */ |
| 132 | |
Nick Kralevich | 9ec0f03 | 2012-02-28 10:40:00 -0800 | [diff] [blame] | 133 | #define PT_GNU_RELRO 0x6474e552 /* Read-only post relocation */ |
| 134 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 135 | #endif /* _SYS_EXEC_ELF_H_ */ |