2 * Copyright (c) 2006 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
26 * $FreeBSD: src/lib/libelf/elf_types.m4,v 1.2 2006/12/18 05:40:01 jkoshy Exp $
30 * ELF types, defined in the "enum Elf_Type" API.
32 * The members of the list form a 3-tuple: (name, C-type-suffix, OSversion).
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 * + `version' is the OS version the symbol first appeared in.
39 define(`ELF_TYPE_LIST',
40 ``ADDR, Addr, 600102',
46 `LWORD, Lword, 700025',
48 `MOVEP, MoveP, 700025',
55 `SWORD, Sword, 600102',
56 `SXWORD, Sxword, 700009',
57 `SYMINFO, Syminfo, 700025',
59 `VDEF, Verdef, 700009',
60 `VNEED, Verneed, 700009',
62 `XWORD, Xword, 700009',
66 * DEFINE_STRUCT(NAME,MEMBERLIST...)
68 * Map a type name to its members.
70 * Each member-list element comprises of pairs of (field name, type),
71 * in the sequence used in the file representation of `NAME'.
73 * Each member list element comprises a pair containing a field name
74 * and a basic type. Basic types include IDENT, HALF, WORD, LWORD,
75 * ADDR{32,64}, OFF{32,64}, SWORD, XWORD, SXWORD.
77 * The last element of a member list is the null element: `_,_'.
80 define(`DEFINE_STRUCT',`define(`$1_DEF',shift($@))dnl')
82 DEFINE_STRUCT(`Elf32_Cap',
87 DEFINE_STRUCT(`Elf64_Cap',
92 DEFINE_STRUCT(`Elf32_Dyn',
97 DEFINE_STRUCT(`Elf64_Dyn',
102 DEFINE_STRUCT(`Elf32_Ehdr',
119 DEFINE_STRUCT(`Elf64_Ehdr',
136 DEFINE_STRUCT(`Elf32_Move',
144 DEFINE_STRUCT(`Elf64_Move',
152 DEFINE_STRUCT(`Elf32_Phdr',
163 DEFINE_STRUCT(`Elf64_Phdr',
174 DEFINE_STRUCT(`Elf32_Rel',
179 DEFINE_STRUCT(`Elf64_Rel',
184 DEFINE_STRUCT(`Elf32_Rela',
190 DEFINE_STRUCT(`Elf64_Rela',
196 DEFINE_STRUCT(`Elf32_Shdr',
205 `sh_addralign, WORD',
209 DEFINE_STRUCT(`Elf64_Shdr',
218 `sh_addralign, XWORD',
222 DEFINE_STRUCT(`Elf32_Sym',
231 DEFINE_STRUCT(`Elf64_Sym',
240 DEFINE_STRUCT(`Elf32_Syminfo',
245 DEFINE_STRUCT(`Elf64_Syminfo',
250 DEFINE_STRUCT(`Elf32_Verdaux',
255 DEFINE_STRUCT(`Elf64_Verdaux',
260 DEFINE_STRUCT(`Elf32_Verdef',
270 DEFINE_STRUCT(`Elf64_Verdef',
280 DEFINE_STRUCT(`Elf32_Verneed',
288 DEFINE_STRUCT(`Elf64_Verneed',
296 DEFINE_STRUCT(`Elf32_Vernaux',
304 DEFINE_STRUCT(`Elf64_Vernaux',