elfent.h (3102B)
1 /* See http://www.sco.com/developers/gabi/latest/contents.html */ 2 3 /* Symbol table index */ 4 #define STN_UNDEF 0 /* undefined */ 5 6 /* Extract symbol info - st_info */ 7 #define ELF_ST_BIND(x) ((x) >> 4) 8 #define ELF_ST_TYPE(x) (((unsigned int) x) & 0xf) 9 #define ELF_ST_INFO(b,t) (((b) << 4) + ((t) & 0xf)) 10 11 #define ELF32_ST_BIND(x) ELF_ST_BIND(x) 12 #define ELF32_ST_TYPE(x) ELF_ST_TYPE(x) 13 #define ELF32_ST_INFO(b,t) ELF_ST_INFO(b, t) 14 15 #define ELF64_ST_BIND(x) ELF_ST_BIND(x) 16 #define ELF64_ST_TYPE(x) ELF_ST_TYPE(x) 17 #define ELF64_ST_INFO(b,t) ELF_ST_INFO(b, t) 18 19 /* Symbol Binding - ELF32_ST_BIND - st_info */ 20 #define STB_LOCAL 0 /* Local symbol */ 21 #define STB_GLOBAL 1 /* Global symbol */ 22 #define STB_WEAK 2 /* like global - lower precedence */ 23 #define STB_NUM 3 /* number of symbol bindings */ 24 #define STB_LOPROC 13 /* reserved range for processor */ 25 #define STB_HIPROC 15 /* specific symbol bindings */ 26 27 /* Symbol type - ELF32_ST_TYPE - st_info */ 28 #define STT_NOTYPE 0 /* not specified */ 29 #define STT_OBJECT 1 /* data object */ 30 #define STT_FUNC 2 /* function */ 31 #define STT_SECTION 3 /* section */ 32 #define STT_FILE 4 /* file */ 33 #define STT_COMMON 5 /* common symbol */ 34 #define STT_TLS 6 /* thread local storage */ 35 #define STT_LOPROC 13 /* reserved range for processor */ 36 #define STT_HIPROC 15 /* specific symbol types */ 37 38 /* Extract symbol visibility - st_other */ 39 #define ELF_ST_VISIBILITY(v) ((v) & 0x3) 40 #define ELF32_ST_VISIBILITY ELF_ST_VISIBILITY 41 #define ELF64_ST_VISIBILITY ELF_ST_VISIBILITY 42 43 #define STV_DEFAULT 0 /* Visibility set by binding type */ 44 #define STV_INTERNAL 1 /* OS specific version of STV_HIDDEN */ 45 #define STV_HIDDEN 2 /* can only be seen inside own .so */ 46 #define STV_PROTECTED 3 /* HIDDEN inside, DEFAULT outside */ 47 48 #define ELFE32SZ 16 49 #define ELFE64SZ 24 50 51 typedef struct elf32_sym Elf32_Sym; 52 typedef struct elf64_sym Elf64_Sym; 53 54 /* Symbol Table Entry */ 55 struct elf32_sym { 56 Elf32_Word st_name; /* name - index into string table */ 57 Elf32_Addr st_value; /* symbol value */ 58 Elf32_Word st_size; /* symbol size */ 59 unsigned char st_info; /* type and binding */ 60 unsigned char st_other; /* visibility */ 61 Elf32_Half st_shndx; /* section header index */ 62 }; 63 64 struct elf64_sym { 65 Elf64_Word st_name; /* Symbol name index in str table */ 66 unsigned char st_info; /* type / binding attrs */ 67 unsigned char st_other; /* visibility */ 68 Elf64_Half st_shndx; /* section index of symbol */ 69 Elf64_Addr st_value; /* value of symbol */ 70 Elf64_Xword st_size; /* size of symbol */ 71 };