00001 /* 00002 * Copyright (c) 2008 Jiri Svoboda 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions 00007 * are met: 00008 * 00009 * - Redistributions of source code must retain the above copyright 00010 * notice, this list of conditions and the following disclaimer. 00011 * - Redistributions in binary form must reproduce the above copyright 00012 * notice, this list of conditions and the following disclaimer in the 00013 * documentation and/or other materials provided with the distribution. 00014 * - The name of the author may not be used to endorse or promote products 00015 * derived from this software without specific prior written permission. 00016 * 00017 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 00018 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00019 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 00020 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 00021 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 00022 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00023 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00024 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00025 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 00026 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00027 */ 00028 00035 #ifndef LIBC_RTLD_ELF_DYN_H_ 00036 #define LIBC_RTLD_ELF_DYN_H_ 00037 00038 #include <arch/elf.h> 00039 #include <sys/types.h> 00040 00041 #include <elf.h> 00042 #include <libarch/rtld/elf_dyn.h> 00043 00044 #define ELF32_R_SYM(i) ((i)>>8) 00045 #define ELF32_R_TYPE(i) ((unsigned char)(i)) 00046 00047 struct elf32_dyn { 00048 elf_sword d_tag; 00049 union { 00050 elf_word d_val; 00051 elf32_addr d_ptr; 00052 } d_un; 00053 }; 00054 00055 struct elf32_rel { 00056 elf32_addr r_offset; 00057 elf_word r_info; 00058 }; 00059 00060 struct elf32_rela { 00061 elf32_addr r_offset; 00062 elf_word r_info; 00063 elf_sword r_addend; 00064 }; 00065 00066 #ifdef __32_BITS__ 00067 typedef struct elf32_dyn elf_dyn_t; 00068 typedef struct elf32_rel elf_rel_t; 00069 typedef struct elf32_rela elf_rela_t; 00070 #endif 00071 00072 /* 00073 * Dynamic array tags 00074 */ 00075 #define DT_NULL 0 00076 #define DT_NEEDED 1 00077 #define DT_PLTRELSZ 2 00078 #define DT_PLTGOT 3 00079 #define DT_HASH 4 00080 #define DT_STRTAB 5 00081 #define DT_SYMTAB 6 00082 #define DT_RELA 7 00083 #define DT_RELASZ 8 00084 #define DT_RELAENT 9 00085 #define DT_STRSZ 10 00086 #define DT_SYMENT 11 00087 #define DT_INIT 12 00088 #define DT_FINI 13 00089 #define DT_SONAME 14 00090 #define DT_RPATH 15 00091 #define DT_SYMBOLIC 16 00092 #define DT_REL 17 00093 #define DT_RELSZ 18 00094 #define DT_RELENT 19 00095 #define DT_PLTREL 20 00096 #define DT_DEBUG 21 00097 #define DT_TEXTREL 22 00098 #define DT_JMPREL 23 00099 #define DT_BIND_NOW 24 00100 #define DT_LOPROC 0x70000000 00101 #define DT_HIPROC 0x7fffffff 00102 00103 /* 00104 * Special section indexes 00105 */ 00106 #define SHN_UNDEF 0 00107 #define SHN_LORESERVE 0xff00 00108 #define SHN_LOPROC 0xff00 00109 #define SHN_HIPROC 0xff1f 00110 #define SHN_ABS 0xfff1 00111 #define SHN_COMMON 0xfff2 00112 #define SHN_HIRESERVE 0xffff 00113 00114 /* 00115 * Special symbol table index 00116 */ 00117 #define STN_UNDEF 0 00118 00119 #endif 00120