Adding upstream version 6.02~pre8+dfsg.
[syslinux-debian/hramrach.git] / com32 / include / sys / elf32.h
blobc98c274b3c045eed80372d3bf54bb84c520265bc
1 /*
2 * sys/elf32.h
3 */
5 #ifndef _SYS_ELF32_H
6 #define _SYS_ELF32_H
8 #include <sys/elfcommon.h>
10 /* ELF standard typedefs (yet more proof that <stdint.h> was way overdue) */
11 typedef uint16_t Elf32_Half;
12 typedef int16_t Elf32_SHalf;
13 typedef uint32_t Elf32_Word;
14 typedef int32_t Elf32_Sword;
15 typedef uint64_t Elf32_Xword;
16 typedef int64_t Elf32_Sxword;
18 typedef uint32_t Elf32_Off;
19 typedef uint32_t Elf32_Addr;
20 typedef uint16_t Elf32_Section;
22 /* Dynamic header */
24 typedef struct elf32_dyn {
25 Elf32_Sword d_tag;
26 union {
27 Elf32_Sword d_val;
28 Elf32_Addr d_ptr;
29 } d_un;
30 } Elf32_Dyn;
32 /* Relocations */
34 #define ELF32_R_SYM(x) ((x) >> 8)
35 #define ELF32_R_TYPE(x) ((x) & 0xff)
37 typedef struct elf32_rel {
38 Elf32_Addr r_offset;
39 Elf32_Word r_info;
40 } Elf32_Rel;
42 typedef struct elf32_rela {
43 Elf32_Addr r_offset;
44 Elf32_Word r_info;
45 Elf32_Sword r_addend;
46 } Elf32_Rela;
48 /* Symbol */
50 typedef struct elf32_sym {
51 Elf32_Word st_name;
52 Elf32_Addr st_value;
53 Elf32_Word st_size;
54 unsigned char st_info;
55 unsigned char st_other;
56 Elf32_Half st_shndx;
57 } Elf32_Sym;
59 /* Main file header */
61 typedef struct elf32_hdr {
62 unsigned char e_ident[EI_NIDENT];
63 Elf32_Half e_type;
64 Elf32_Half e_machine;
65 Elf32_Word e_version;
66 Elf32_Addr e_entry;
67 Elf32_Off e_phoff;
68 Elf32_Off e_shoff;
69 Elf32_Word e_flags;
70 Elf32_Half e_ehsize;
71 Elf32_Half e_phentsize;
72 Elf32_Half e_phnum;
73 Elf32_Half e_shentsize;
74 Elf32_Half e_shnum;
75 Elf32_Half e_shstrndx;
76 } Elf32_Ehdr;
78 /* Program header */
80 typedef struct elf32_phdr {
81 Elf32_Word p_type;
82 Elf32_Off p_offset;
83 Elf32_Addr p_vaddr;
84 Elf32_Addr p_paddr;
85 Elf32_Word p_filesz;
86 Elf32_Word p_memsz;
87 Elf32_Word p_flags;
88 Elf32_Word p_align;
89 } Elf32_Phdr;
91 /* Section header */
93 typedef struct elf32_shdr {
94 Elf32_Word sh_name;
95 Elf32_Word sh_type;
96 Elf32_Word sh_flags;
97 Elf32_Addr sh_addr;
98 Elf32_Off sh_offset;
99 Elf32_Word sh_size;
100 Elf32_Word sh_link;
101 Elf32_Word sh_info;
102 Elf32_Word sh_addralign;
103 Elf32_Word sh_entsize;
104 } Elf32_Shdr;
106 /* Note header */
107 typedef struct elf32_note {
108 Elf32_Word n_namesz; /* Name size */
109 Elf32_Word n_descsz; /* Content size */
110 Elf32_Word n_type; /* Content type */
111 } Elf32_Nhdr;
113 #endif /* _SYS_ELF32_H */