CARDS 2.4.87
Package manager for the NuTyX GNU/Linux distribution
elf_common.h
1 /* Based on the code of
2  Fred Fish @ Cygnus Support, from information published
3  in "UNIX System V Release 4, Programmers Guide: ANSI C and
4  Programming Support Tools".
5 
6  */
7 
8 #ifndef _COMMON_H
9 #define _COMMON_H
10 
11 /* Magic number signature */
12 #define EI_MAG0 0 /* File identification byte 0 index */
13 #define ELFMAG0 0x7F /* Magic number byte 0 */
14 #define EI_MAG1 1 /* File identification byte 1 index */
15 #define ELFMAG1 'E' /* Magic number byte 1 */
16 #define EI_MAG2 2 /* File identification byte 2 index */
17 #define ELFMAG2 'L' /* Magic number byte 2 */
18 #define EI_MAG3 3 /* File identification byte 3 index */
19 #define ELFMAG3 'F' /* Magic number byte 3 */
20 
21 #define EI_CLASS 4 /* File class */
22 #define ELFCLASSNONE 0 /* Invalid class */
23 #define ELFCLASS32 1 /* 32-bit objects */
24 #define ELFCLASS64 2 /* 64-bit objects */
25 
26 /* Operating System/ABI indication */
27 #define ELFOSABI_NONE 0 /* UNIX System V ABI */
28 #define ELFOSABI_GNU 3 /* GNU */
29 
30 /* Values for e_type, which identifies the object file type. */
31 
32 #define ET_NONE 0 /* No file type */
33 #define ET_REL 1 /* Relocatable file */
34 #define ET_EXEC 2 /* Executable file */
35 #define ET_DYN 3 /* Shared object file */
36 #define ET_CORE 4 /* Core file */
37 #define ET_LOOS 0xFE00 /* Operating system-specific */
38 #define ET_HIOS 0xFEFF /* Operating system-specific */
39 #define ET_LOPROC 0xFF00 /* Processor-specific */
40 #define ET_HIPROC 0xFFFF /* Processor-specific */
41 
42 /* Values for e_version. */
43 
44 #define EV_NONE 0 /* Invalid ELF version */
45 #define EV_CURRENT 1 /* Current version */
46 
47 /* Values for program header, p_type field. */
48 
49 #define PT_NULL 0 /* Program header table entry unused */
50 #define PT_LOAD 1 /* Loadable program segment */
51 #define PT_DYNAMIC 2 /* Dynamic linking information */
52 #define PT_INTERP 3 /* Program interpreter */
53 #define PT_NOTE 4 /* Auxiliary information */
54 #define PT_SHLIB 5 /* Reserved, unspecified semantics */
55 #define PT_PHDR 6 /* Entry for header table itself */
56 #define PT_TLS 7 /* Thread local storage segment */
57 #define PT_LOOS 0x60000000 /* OS-specific */
58 #define PT_HIOS 0x6fffffff /* OS-specific */
59 #define PT_LOPROC 0x70000000 /* Processor-specific */
60 #define PT_HIPROC 0x7FFFFFFF /* Processor-specific */
61 
62 #define PT_GNU_EH_FRAME (PT_LOOS + 0x474e550) /* Frame unwind information */
63 #define PT_SUNW_EH_FRAME PT_GNU_EH_FRAME /* Solaris uses the same value */
64 #define PT_GNU_STACK (PT_LOOS + 0x474e551) /* Stack flags */
65 #define PT_GNU_RELRO (PT_LOOS + 0x474e552) /* Read-only after relocation */
66 
67 /* Values for section header, sh_type field. */
68 
69 #define SHT_NULL 0 /* Section header table entry unused */
70 #define SHT_PROGBITS 1 /* Program specific (private) data */
71 #define SHT_SYMTAB 2 /* Link editing symbol table */
72 #define SHT_STRTAB 3 /* A string table */
73 #define SHT_RELA 4 /* Relocation entries with addends */
74 #define SHT_HASH 5 /* A symbol hash table */
75 #define SHT_DYNAMIC 6 /* Information for dynamic linking */
76 #define SHT_NOTE 7 /* Information that marks file */
77 #define SHT_NOBITS 8 /* Section occupies no space in file */
78 #define SHT_REL 9 /* Relocation entries, no addends */
79 #define SHT_SHLIB 10 /* Reserved, unspecified semantics */
80 #define SHT_DYNSYM 11 /* Dynamic linking symbol table */
81 
82 #define SHT_INIT_ARRAY 14 /* Array of ptrs to init functions */
83 #define SHT_FINI_ARRAY 15 /* Array of ptrs to finish functions */
84 #define SHT_PREINIT_ARRAY 16 /* Array of ptrs to pre-init funcs */
85 #define SHT_GROUP 17 /* Section contains a section group */
86 #define SHT_SYMTAB_SHNDX 18 /* Indicies for SHN_XINDEX entries */
87 
88 #define SHT_LOOS 0x60000000 /* First of OS specific semantics */
89 #define SHT_HIOS 0x6fffffff /* Last of OS specific semantics */
90 
91 #define SHT_GNU_INCREMENTAL_INPUTS 0x6fff4700 /* incremental build data */
92 #define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* Object attributes */
93 #define SHT_GNU_HASH 0x6ffffff6 /* GNU style symbol hash table */
94 #define SHT_GNU_LIBLIST 0x6ffffff7 /* List of prelink dependencies */
95 
96 
97 
98 /* Dynamic section tags. */
99 
100 #define DT_NULL 0
101 #define DT_NEEDED 1
102 #define DT_PLTRELSZ 2
103 #define DT_PLTGOT 3
104 #define DT_HASH 4
105 #define DT_STRTAB 5
106 #define DT_SYMTAB 6
107 #define DT_RELA 7
108 #define DT_RELASZ 8
109 #define DT_RELAENT 9
110 #define DT_STRSZ 10
111 #define DT_SYMENT 11
112 #define DT_INIT 12
113 #define DT_FINI 13
114 #define DT_SONAME 14
115 #define DT_RPATH 15
116 #define DT_SYMBOLIC 16
117 #define DT_REL 17
118 #define DT_RELSZ 18
119 #define DT_RELENT 19
120 #define DT_PLTREL 20
121 #define DT_DEBUG 21
122 #define DT_TEXTREL 22
123 #define DT_JMPREL 23
124 #define DT_BIND_NOW 24
125 #define DT_INIT_ARRAY 25
126 #define DT_FINI_ARRAY 26
127 #define DT_INIT_ARRAYSZ 27
128 #define DT_FINI_ARRAYSZ 28
129 #define DT_RUNPATH 29
130 #define DT_FLAGS 30
131 #define DT_ENCODING 32
132 #define DT_PREINIT_ARRAY 32
133 #define DT_PREINIT_ARRAYSZ 33
134 
135 #endif /* _COMMON_H */