ldivmod, uldivmod: fix qdivrem calls
[minix.git] / lib / libelf / elf_types.m4
blobe23cfd97b476238b8c43da161d7d0f6c82b8e701
1 /*-
2  * Copyright (c) 2006,2008 Joseph Koshy
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24  * SUCH DAMAGE.
25  *
26  * $Id$
27  */
30  * ELF types, defined in the "enum Elf_Type" API.
31  *
32  * The members of the list form a 2-tuple: (name, C-type-suffix).
33  * + `name' is an Elf_Type symbol without the `ELF_T_' prefix.
34  * + `C-type-suffix' is the suffix for Elf32_ and Elf64_ type names.
35  */
37 define(`ELF_TYPE_LIST',
38         ``ADDR,         Addr',
39         `BYTE,          Byte',
40         `CAP,           Cap',
41         `DYN,           Dyn',
42         `EHDR,          Ehdr',
43         `GNUHASH,       -',
44         `HALF,          Half',
45         `LWORD,         Lword',
46         `MOVE,          Move',
47         `MOVEP,         MoveP',
48         `NOTE,          Note',
49         `OFF,           Off',
50         `PHDR,          Phdr',
51         `REL,           Rel',
52         `RELA,          Rela',
53         `SHDR,          Shdr',
54         `SWORD,         Sword',
55         `SXWORD,        Sxword',
56         `SYMINFO,       Syminfo',
57         `SYM,           Sym',
58         `VDEF,          Verdef',
59         `VNEED,         Verneed',
60         `WORD,          Word',
61         `XWORD,         Xword',
62         `NUM,           _'')
65  * DEFINE_STRUCT(NAME,MEMBERLIST...)
66  *
67  * Map a type name to its members.
68  *
69  * Each member-list element comprises of pairs of (field name, type),
70  * in the sequence used in the file representation of `NAME'.
71  *
72  * Each member list element comprises a pair containing a field name
73  * and a basic type.  Basic types include IDENT, HALF, WORD, LWORD,
74  * ADDR{32,64}, OFF{32,64}, SWORD, XWORD, SXWORD.
75  *
76  * The last element of a member list is the null element: `_,_'.
77  */
79 define(`DEFINE_STRUCT',`define(`$1_DEF',shift($@))dnl')
81 DEFINE_STRUCT(`Elf32_Cap',
82         ``c_tag,        WORD',
83         `c_un.c_val,    WORD',
84         `_,_'')
86 DEFINE_STRUCT(`Elf64_Cap',
87         ``c_tag,        XWORD',
88         `c_un.c_val,    XWORD',
89         `_,_'')
91 DEFINE_STRUCT(`Elf32_Dyn',
92         ``d_tag,        SWORD',
93         `d_un.d_ptr,    WORD',
94         `_,_'')
96 DEFINE_STRUCT(`Elf64_Dyn',
97         ``d_tag,        SXWORD',
98         `d_un.d_ptr,    XWORD',
99         `_,_'')
101 DEFINE_STRUCT(`Elf32_Ehdr',
102         ``e_ident,      IDENT',
103         `e_type,        HALF',
104         `e_machine,     HALF',
105         `e_version,     WORD',
106         `e_entry,       ADDR',
107         `e_phoff,       OFF',
108         `e_shoff,       OFF',
109         `e_flags,       WORD',
110         `e_ehsize,      HALF',
111         `e_phentsize,   HALF',
112         `e_phnum,       HALF',
113         `e_shentsize,   HALF',
114         `e_shnum,       HALF',
115         `e_shstrndx,    HALF',
116         `_,_'')
118 DEFINE_STRUCT(`Elf64_Ehdr',
119         ``e_ident,      IDENT',
120         `e_type,        HALF',
121         `e_machine,     HALF',
122         `e_version,     WORD',
123         `e_entry,       ADDR',
124         `e_phoff,       OFF',
125         `e_shoff,       OFF',
126         `e_flags,       WORD',
127         `e_ehsize,      HALF',
128         `e_phentsize,   HALF',
129         `e_phnum,       HALF',
130         `e_shentsize,   HALF',
131         `e_shnum,       HALF',
132         `e_shstrndx,    HALF',
133         `_,_'')
135 DEFINE_STRUCT(`Elf32_Move',
136         ``m_value,      LWORD',
137         `m_info,        WORD',
138         `m_poffset,     WORD',
139         `m_repeat,      HALF',
140         `m_stride,      HALF',
141         `_,_'')
143 DEFINE_STRUCT(`Elf64_Move',
144         ``m_value,      LWORD',
145         `m_info,        XWORD',
146         `m_poffset,     XWORD',
147         `m_repeat,      HALF',
148         `m_stride,      HALF',
149         `_,_'')
151 DEFINE_STRUCT(`Elf32_Phdr',
152         ``p_type,       WORD',
153         `p_offset,      OFF',
154         `p_vaddr,       ADDR',
155         `p_paddr,       ADDR',
156         `p_filesz,      WORD',
157         `p_memsz,       WORD',
158         `p_flags,       WORD',
159         `p_align,       WORD',
160         `_,_'')
162 DEFINE_STRUCT(`Elf64_Phdr',
163         ``p_type,       WORD',
164         `p_flags,       WORD',
165         `p_offset,      OFF',
166         `p_vaddr,       ADDR',
167         `p_paddr,       ADDR',
168         `p_filesz,      XWORD',
169         `p_memsz,       XWORD',
170         `p_align,       XWORD',
171         `_,_'')
173 DEFINE_STRUCT(`Elf32_Rel',
174         ``r_offset,     ADDR',
175         `r_info,        WORD',
176         `_,_'')
178 DEFINE_STRUCT(`Elf64_Rel',
179         ``r_offset,     ADDR',
180         `r_info,        XWORD',
181         `_,_'')
183 DEFINE_STRUCT(`Elf32_Rela',
184         ``r_offset,     ADDR',
185         `r_info,        WORD',
186         `r_addend,      SWORD',
187         `_,_'')
189 DEFINE_STRUCT(`Elf64_Rela',
190         ``r_offset,     ADDR',
191         `r_info,        XWORD',
192         `r_addend,      SXWORD',
193         `_,_'')
195 DEFINE_STRUCT(`Elf32_Shdr',
196         ``sh_name,      WORD',
197         `sh_type,       WORD',
198         `sh_flags,      WORD',
199         `sh_addr,       ADDR',
200         `sh_offset,     OFF',
201         `sh_size,       WORD',
202         `sh_link,       WORD',
203         `sh_info,       WORD',
204         `sh_addralign,  WORD',
205         `sh_entsize,    WORD',
206         `_,_'')
208 DEFINE_STRUCT(`Elf64_Shdr',
209         ``sh_name,      WORD',
210         `sh_type,       WORD',
211         `sh_flags,      XWORD',
212         `sh_addr,       ADDR',
213         `sh_offset,     OFF',
214         `sh_size,       XWORD',
215         `sh_link,       WORD',
216         `sh_info,       WORD',
217         `sh_addralign,  XWORD',
218         `sh_entsize,    XWORD',
219         `_,_'')
221 DEFINE_STRUCT(`Elf32_Sym',
222         ``st_name,      WORD',
223         `st_value,      ADDR',
224         `st_size,       WORD',
225         `st_info,       BYTE',
226         `st_other,      BYTE',
227         `st_shndx,      HALF',
228         `_,_'')
230 DEFINE_STRUCT(`Elf64_Sym',
231         ``st_name,      WORD',
232         `st_info,       BYTE',
233         `st_other,      BYTE',
234         `st_shndx,      HALF',
235         `st_value,      ADDR',
236         `st_size,       XWORD',
237         `_,_'')
239 DEFINE_STRUCT(`Elf32_Syminfo',
240         ``si_boundto,   HALF',
241         `si_flags,      HALF',
242         `_,_'')
244 DEFINE_STRUCT(`Elf64_Syminfo',
245         ``si_boundto,   HALF',
246         `si_flags,      HALF',
247         `_,_'')
249 DEFINE_STRUCT(`Elf32_Verdaux',
250         ``vda_name,     WORD',
251         `vda_next,      WORD',
252         `_,_'')
254 DEFINE_STRUCT(`Elf64_Verdaux',
255         ``vda_name,     WORD',
256         `vda_next,      WORD',
257         `_,_'')
259 DEFINE_STRUCT(`Elf32_Verdef',
260         ``vd_version,   HALF',
261         `vd_flags,      HALF',
262         `vd_ndx,        HALF',
263         `vd_cnt,        HALF',
264         `vd_hash,       WORD',
265         `vd_aux,        WORD',
266         `vd_next,       WORD',
267         `_,_'')
269 DEFINE_STRUCT(`Elf64_Verdef',
270         ``vd_version,   HALF',
271         `vd_flags,      HALF',
272         `vd_ndx,        HALF',
273         `vd_cnt,        HALF',
274         `vd_hash,       WORD',
275         `vd_aux,        WORD',
276         `vd_next,       WORD',
277         `_,_'')
279 DEFINE_STRUCT(`Elf32_Verneed',
280         ``vn_version,   HALF',
281         `vn_cnt,        HALF',
282         `vn_file,       WORD',
283         `vn_aux,        WORD',
284         `vn_next,       WORD',
285         `_,_'')
287 DEFINE_STRUCT(`Elf64_Verneed',
288         ``vn_version,   HALF',
289         `vn_cnt,        HALF',
290         `vn_file,       WORD',
291         `vn_aux,        WORD',
292         `vn_next,       WORD',
293         `_,_'')
295 DEFINE_STRUCT(`Elf32_Vernaux',
296         ``vna_hash,     WORD',
297         `vna_flags,     HALF',
298         `vna_other,     HALF',
299         `vna_name,      WORD',
300         `vna_next,      WORD',
301         `_,_'')
303 DEFINE_STRUCT(`Elf64_Vernaux',
304         ``vna_hash,     WORD',
305         `vna_flags,     HALF',
306         `vna_other,     HALF',
307         `vna_name,      WORD',
308         `vna_next,      WORD',
309         `_,_'')