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