1174042Sjb/*
2174042Sjb * CDDL HEADER START
3174042Sjb *
4174042Sjb * The contents of this file are subject to the terms of the
5174042Sjb * Common Development and Distribution License (the "License").
6174042Sjb * You may not use this file except in compliance with the License.
7174042Sjb *
8174042Sjb * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9174042Sjb * or http://www.opensolaris.org/os/licensing.
10174042Sjb * See the License for the specific language governing permissions
11174042Sjb * and limitations under the License.
12174042Sjb *
13174042Sjb * When distributing Covered Code, include this CDDL HEADER in each
14174042Sjb * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15174042Sjb * If applicable, add the following below this CDDL HEADER, with the
16174042Sjb * fields enclosed by brackets "[]" replaced with your own identifying
17174042Sjb * information: Portions Copyright [yyyy] [name of copyright owner]
18174042Sjb *
19174042Sjb * CDDL HEADER END
20174042Sjb *
21174042Sjb * $FreeBSD$
22174042Sjb *
23174042Sjb * ELF compatibility definitions for OpenSolaris source.
24174042Sjb *
25174042Sjb */
26174042Sjb
27174042Sjb#ifndef	_SYS__ELF_SOLARIS_H_
28174042Sjb#define	_SYS__ELF_SOLARIS_H_
29174042Sjb
30174042Sjb#include_next <sys/elf.h>
31174042Sjb
32174042Sjb#define __sElfN(x)       typedef __CONCAT(__CONCAT(__CONCAT(Elf,__ELF_WORD_SIZE),_),x) x
33174042Sjb
34174042Sjb__sElfN(Addr);
35174042Sjb__sElfN(Cap);
36174042Sjb__sElfN(Dyn);
37174042Sjb__sElfN(Ehdr);
38174042Sjb__sElfN(Move);
39174042Sjb__sElfN(Off);
40174042Sjb__sElfN(Phdr);
41174042Sjb__sElfN(Rel);
42174042Sjb__sElfN(Rela);
43174042Sjb__sElfN(Shdr);
44174042Sjb__sElfN(Sym);
45174042Sjb__sElfN(Syminfo);
46174042Sjb__sElfN(Verdaux);
47174042Sjb__sElfN(Verdef);
48174042Sjb__sElfN(Vernaux);
49174042Sjb__sElfN(Verneed);
50174042Sjb__sElfN(Versym);
51174042Sjb
52174042Sjb__sElfN(Half);
53174042Sjb__sElfN(Sword);
54174042Sjb__sElfN(Word);
55174042Sjb
56174042Sjb#if __ELF_WORD_SIZE == 32
57174042Sjbtypedef	Elf32_Word	Xword;	/* Xword/Sxword are 32-bits in Elf32 */
58174042Sjbtypedef	Elf32_Sword	Sxword;
59174042Sjb#else
60174042Sjbtypedef	Elf64_Xword	Xword;
61174042Sjbtypedef	Elf64_Sxword	Sxword;
62174042Sjb#endif
63174042Sjb
64174042Sjb#define ELF_M_INFO	__ELFN(M_INFO)
65174042Sjb#define ELF_M_SIZE	__ELFN(M_SIZE)
66174042Sjb#define ELF_M_SYM	__ELFN(M_SYM)
67174042Sjb
68174042Sjb/*
69174042Sjb * Elf `printf' type-cast macros.  These force arguments to be a fixed size
70174042Sjb * so that Elf32 and Elf64 can share common format strings.
71174042Sjb */
72174042Sjb#define	EC_ADDR(a)	((Elf64_Addr)(a))		/* "ull" */
73174042Sjb#define	EC_OFF(a)	((Elf64_Off)(a))		/* "ull"  */
74174042Sjb#define	EC_HALF(a)	((Elf64_Half)(a))		/* "d"   */
75174042Sjb#define	EC_WORD(a)	((Elf64_Word)(a))		/* "u"   */
76174042Sjb#define	EC_SWORD(a)	((Elf64_Sword)(a))		/* "d"   */
77174042Sjb#define	EC_XWORD(a)	((Elf64_Xword)(a))		/* "ull" */
78174042Sjb#define	EC_SXWORD(a)	((Elf64_Sxword)(a))		/* "ll"  */
79174042Sjb#define	EC_LWORD(a)	((Elf64_Lword)(a))		/* "ull" */
80174042Sjb
81174042Sjb#define	elf_checksum		__elfN(checksum)
82174042Sjb#define	elf_fsize		__elfN(fsize)
83174042Sjb#define	elf_getehdr		__elfN(getehdr)
84174042Sjb#define	elf_getphdr		__elfN(getphdr)
85174042Sjb#define	elf_newehdr		__elfN(newehdr)
86174042Sjb#define	elf_newphdr		__elfN(newphdr)
87174042Sjb#define	elf_getshdr		__elfN(getshdr)
88174042Sjb#define	elf_xlatetof		__elfN(xlatetof)
89174042Sjb#define	elf_xlatetom		__elfN(xlatetom)
90174042Sjb
91174042Sjb#define	Elf_cap_entry		__ElfN(cap_entry)
92174042Sjb#define	Elf_cap_title		__ElfN(cap_title)
93174042Sjb#define	Elf_demangle_name	__ElfN(demangle_name)
94174042Sjb#define	Elf_dyn_entry		__ElfN(dyn_entry)
95174042Sjb#define	Elf_dyn_title		__ElfN(dyn_title)
96174042Sjb#define	Elf_ehdr		__ElfN(ehdr)
97174042Sjb#define	Elf_got_entry		__ElfN(got_entry)
98174042Sjb#define	Elf_got_title		__ElfN(got_title)
99174042Sjb#define	Elf_reloc_apply_reg	__ElfN(reloc_apply_reg)
100174042Sjb#define	Elf_reloc_apply_val	__ElfN(reloc_apply_val)
101174042Sjb#define	Elf_reloc_entry_1	__ElfN(reloc_entry_1)
102174042Sjb#define	Elf_reloc_entry_2	__ElfN(reloc_entry_2)
103174042Sjb#define	Elf_reloc_title		__ElfN(reloc_title)
104174042Sjb#define	Elf_phdr		__ElfN(phdr)
105174042Sjb#define	Elf_shdr		__ElfN(shdr)
106174042Sjb#define	Elf_syms_table_entry	__ElfN(syms_table_entry)
107174042Sjb#define	Elf_syms_table_title	__ElfN(syms_table_title)
108174042Sjb#define	Elf_ver_def_title	__ElfN(ver_def_title)
109174042Sjb#define	Elf_ver_line_1		__ElfN(ver_line_1)
110174042Sjb#define	Elf_ver_line_2		__ElfN(ver_line_2)
111174042Sjb#define	Elf_ver_line_3		__ElfN(ver_line_3)
112174042Sjb#define	Elf_ver_line_4		__ElfN(ver_line_4)
113174042Sjb#define	Elf_ver_line_5		__ElfN(ver_line_5)
114174042Sjb#define	Elf_ver_need_title	__ElfN(ver_need_title)
115174042Sjb
116174042Sjb#endif /* !_SYS__ELF_SOLARIS_H_ */
117