xref: /freebsd/sys/cddl/compat/opensolaris/sys/elf.h (revision 95ee2897)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  *
21  * ELF compatibility definitions for OpenSolaris source.
22  *
23  */
24 
25 #ifndef	_SYS__ELF_SOLARIS_H_
26 #define	_SYS__ELF_SOLARIS_H_
27 
28 #include_next <sys/elf.h>
29 
30 #define __sElfN(x)       typedef __CONCAT(__CONCAT(__CONCAT(Elf,__ELF_WORD_SIZE),_),x) x
31 
32 __sElfN(Addr);
33 __sElfN(Cap);
34 __sElfN(Dyn);
35 __sElfN(Ehdr);
36 __sElfN(Move);
37 __sElfN(Off);
38 __sElfN(Phdr);
39 __sElfN(Rel);
40 __sElfN(Rela);
41 __sElfN(Shdr);
42 __sElfN(Sym);
43 __sElfN(Syminfo);
44 __sElfN(Verdaux);
45 __sElfN(Verdef);
46 __sElfN(Vernaux);
47 __sElfN(Verneed);
48 __sElfN(Versym);
49 
50 __sElfN(Half);
51 __sElfN(Sword);
52 __sElfN(Word);
53 
54 #if __ELF_WORD_SIZE == 32
55 typedef	Elf32_Word	Xword;	/* Xword/Sxword are 32-bits in Elf32 */
56 typedef	Elf32_Sword	Sxword;
57 #else
58 typedef	Elf64_Xword	Xword;
59 typedef	Elf64_Sxword	Sxword;
60 #endif
61 
62 #define ELF_M_INFO	__ELFN(M_INFO)
63 #define ELF_M_SIZE	__ELFN(M_SIZE)
64 #define ELF_M_SYM	__ELFN(M_SYM)
65 
66 /*
67  * Elf `printf' type-cast macros.  These force arguments to be a fixed size
68  * so that Elf32 and Elf64 can share common format strings.
69  */
70 #define	EC_ADDR(a)	((Elf64_Addr)(a))		/* "ull" */
71 #define	EC_OFF(a)	((Elf64_Off)(a))		/* "ull"  */
72 #define	EC_HALF(a)	((Elf64_Half)(a))		/* "d"   */
73 #define	EC_WORD(a)	((Elf64_Word)(a))		/* "u"   */
74 #define	EC_SWORD(a)	((Elf64_Sword)(a))		/* "d"   */
75 #define	EC_XWORD(a)	((Elf64_Xword)(a))		/* "ull" */
76 #define	EC_SXWORD(a)	((Elf64_Sxword)(a))		/* "ll"  */
77 #define	EC_LWORD(a)	((Elf64_Lword)(a))		/* "ull" */
78 
79 #define	elf_checksum		__elfN(checksum)
80 #define	elf_fsize		__elfN(fsize)
81 #define	elf_getehdr		__elfN(getehdr)
82 #define	elf_getphdr		__elfN(getphdr)
83 #define	elf_newehdr		__elfN(newehdr)
84 #define	elf_newphdr		__elfN(newphdr)
85 #define	elf_getshdr		__elfN(getshdr)
86 #define	elf_xlatetof		__elfN(xlatetof)
87 #define	elf_xlatetom		__elfN(xlatetom)
88 
89 #define	Elf_cap_entry		__ElfN(cap_entry)
90 #define	Elf_cap_title		__ElfN(cap_title)
91 #define	Elf_demangle_name	__ElfN(demangle_name)
92 #define	Elf_dyn_entry		__ElfN(dyn_entry)
93 #define	Elf_dyn_title		__ElfN(dyn_title)
94 #define	Elf_ehdr		__ElfN(ehdr)
95 #define	Elf_got_entry		__ElfN(got_entry)
96 #define	Elf_got_title		__ElfN(got_title)
97 #define	Elf_reloc_apply_reg	__ElfN(reloc_apply_reg)
98 #define	Elf_reloc_apply_val	__ElfN(reloc_apply_val)
99 #define	Elf_reloc_entry_1	__ElfN(reloc_entry_1)
100 #define	Elf_reloc_entry_2	__ElfN(reloc_entry_2)
101 #define	Elf_reloc_title		__ElfN(reloc_title)
102 #define	Elf_phdr		__ElfN(phdr)
103 #define	Elf_shdr		__ElfN(shdr)
104 #define	Elf_syms_table_entry	__ElfN(syms_table_entry)
105 #define	Elf_syms_table_title	__ElfN(syms_table_title)
106 #define	Elf_ver_def_title	__ElfN(ver_def_title)
107 #define	Elf_ver_line_1		__ElfN(ver_line_1)
108 #define	Elf_ver_line_2		__ElfN(ver_line_2)
109 #define	Elf_ver_line_3		__ElfN(ver_line_3)
110 #define	Elf_ver_line_4		__ElfN(ver_line_4)
111 #define	Elf_ver_line_5		__ElfN(ver_line_5)
112 #define	Elf_ver_need_title	__ElfN(ver_need_title)
113 
114 #endif /* !_SYS__ELF_SOLARIS_H_ */
115