2 * Copyright (c) 2006,2008 Joseph Koshy
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
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.
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
30 * ELF types, defined in the "enum Elf_Type" API.
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.
37 define(`ELF_TYPE_LIST',
65 * DEFINE_STRUCT(NAME,MEMBERLIST...)
67 * Map a type name to its members.
69 * Each member-list element comprises of pairs of (field name, type),
70 * in the sequence used in the file representation of `NAME'.
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.
76 * The last element of a member list is the null element: `_,_'.
79 define(`DEFINE_STRUCT',`define(`$1_DEF',shift($@))dnl')
81 DEFINE_STRUCT(`Elf32_Cap',
86 DEFINE_STRUCT(`Elf64_Cap',
91 DEFINE_STRUCT(`Elf32_Dyn',
96 DEFINE_STRUCT(`Elf64_Dyn',
101 DEFINE_STRUCT(`Elf32_Ehdr',
118 DEFINE_STRUCT(`Elf64_Ehdr',
135 DEFINE_STRUCT(`Elf32_Move',
143 DEFINE_STRUCT(`Elf64_Move',
151 DEFINE_STRUCT(`Elf32_Phdr',
162 DEFINE_STRUCT(`Elf64_Phdr',
173 DEFINE_STRUCT(`Elf32_Rel',
178 DEFINE_STRUCT(`Elf64_Rel',
183 DEFINE_STRUCT(`Elf32_Rela',
189 DEFINE_STRUCT(`Elf64_Rela',
195 DEFINE_STRUCT(`Elf32_Shdr',
204 `sh_addralign, WORD',
208 DEFINE_STRUCT(`Elf64_Shdr',
217 `sh_addralign, XWORD',
221 DEFINE_STRUCT(`Elf32_Sym',
230 DEFINE_STRUCT(`Elf64_Sym',
239 DEFINE_STRUCT(`Elf32_Syminfo',
244 DEFINE_STRUCT(`Elf64_Syminfo',
249 DEFINE_STRUCT(`Elf32_Verdaux',
254 DEFINE_STRUCT(`Elf64_Verdaux',
259 DEFINE_STRUCT(`Elf32_Verdef',
269 DEFINE_STRUCT(`Elf64_Verdef',
279 DEFINE_STRUCT(`Elf32_Verneed',
287 DEFINE_STRUCT(`Elf64_Verneed',
295 DEFINE_STRUCT(`Elf32_Vernaux',
303 DEFINE_STRUCT(`Elf64_Vernaux',