-
Notifications
You must be signed in to change notification settings - Fork 0
/
elf_symbol.h
87 lines (81 loc) · 2.99 KB
/
elf_symbol.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#ifndef ELF_SYMBOL_H_
#define ELF_SYMBOL_H_
#include "elf_types.h"
/* Useful for manipulating a symbol's type and binding attributes. */
#define ELF64_ST_BIND(i) ((i)>>4)
#define ELF64_ST_TYPE(i) ((i)&0xf)
#define ELF64_ST_INFO(b,t) (((b)<<4)+((t)&0xf))
/* Local symbols are not visible outside the object file containing
* their definition. Local symbols of the same name may exist in
* multiple files without interfering with each other.
*/
#define STB_LOCAL 0
/* Global symbols are visible to all object files being combined.
* One file's definition of a global symbol will satisfy another
* file's undefined reference to the same global symbol.
*/
#define STB_GLOBAL 1
/* Weak symbols resemble global symbols, but their definitions have
* lower precedence.
*/
#define STB_WEAK 2
/* Values in this inclusive range are reserved for processor-specific
* semantics.
*/
#define STB_LOPROC 13
#define STD_HIPROC 15
/* Symbol Types */
/* The symbol's type is not specified. */
#define STT_NOTYPE 0
/* The symbol is associated with a data object, such as a variable,
* an array, etc.
*/
#define STT_OBJECT 1
/* The symbol is associated with a function or other executable code. */
#define STT_FUNC 2
/* The symbol is associated with a section. Symbol table entries of
* this type exist primarily for relocation and normally have
* `STB_LOCAL` binding.
*/
#define STT_SECTION 3
/* Conventionally, the symbol's name gives the name of the source file
* associated with the object file. A file symbol has `STB_LOCAL`
* binding, its section index is `SHN_ABS`, and it precedes the
* other `STB_LOCAL` symbols for the file, if it is present.
*/
#define STT_FILE 4
/* Values in this inclusive range are reserved for processor-specific
* semantics.
*/
#define STT_LOPROC 13
#define STT_HIPROC 15
/* An entry in the symbol table. */
typedef struct {
/* This member holds an index into the object file's symbol
* string table, which holds the character representations
* of the symbol names. If the value is non-zero, it represents
* a string table index that gives the symbol name. Otherwise,
* the symbol table entry has no name.
*/
Elf64_Word st_name;
/* This member gives the value of the associated symbol.
* Depending on the context, this may be an absolute value,
* and address, etc.
*/
Elf64_Addr st_value;
/* Many symbols have associated sizes. For example, a data object's
* size is the number of bytes contained in the object. This member
* holds 0 if the symbol has no size or an unknown size.
*/
Elf64_Word st_size;
/* This member specifies the symbol's type and binding attributes. */
unsigned char st_info;
/* This member currently holds 0 and has no defined meaning. */
unsigned char st_other;
/* Every symbol table entry is "defined" in relation to some
* section; this member holds the relevant section header table
* index.
*/
Elf64_Short st_shndx;
} Elf64_Sym;
#endif