1 /*	$OpenBSD: exec.h,v 1.9 2002/08/11 23:06:03 art Exp $	*/
2 /*	$NetBSD: exec.h,v 1.7 1994/11/20 20:53:02 deraadt Exp $ */
3 
4 /*
5  * Copyright (c) 1993 Christopher G. Demetriou
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  * 3. The name of the author may not be used to endorse or promote products
17  *    derived from this software without specific prior written permission
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 #ifndef _SPARC_EXEC_H_
32 #define _SPARC_EXEC_H_
33 
34 #define __LDPGSZ	8192	/* linker page size */
35 
36 #ifndef __ELF__
37 enum reloc_type {
38 	RELOC_8,	RELOC_16, 	RELOC_32,
39 	RELOC_DISP8,	RELOC_DISP16,	RELOC_DISP32,
40 	RELOC_WDISP30,	RELOC_WDISP22,
41 	RELOC_HI22,	RELOC_22,
42 	RELOC_13,	RELOC_LO10,
43 	RELOC_UNUSED1,	RELOC_UNUSED2,
44 	RELOC_BASE10,	RELOC_BASE13,	RELOC_BASE22,
45 	RELOC_PC10,	RELOC_PC22,
46 	RELOC_JMP_TBL,
47 	RELOC_UNUSED3,
48 	RELOC_GLOB_DAT,	RELOC_JMP_SLOT,	RELOC_RELATIVE,
49 };
50 
51 /* Relocation format. */
52 struct relocation_info_sparc {
53 	int r_address;			/* offset in text or data segment */
54 	unsigned int r_symbolnum : 24,	/* ordinal number of add symbol */
55 			r_extern :  1,	/* 1 if need to add symbol to value */
56 				 :  2;	/* unused bits */
57 	enum reloc_type r_type   :  5;	/* relocation type time copy */
58 	long r_addend;			/* relocation addend */
59 };
60 #define relocation_info	relocation_info_sparc
61 #else
62 #define R_SPARC_NONE		0
63 #define R_SPARC_8		1
64 #define R_SPARC_16		2
65 #define R_SPARC_32		3
66 #define R_SPARC_DISP8		4
67 #define R_SPARC_DISP16		5
68 #define R_SPARC_DISP32		6
69 #define R_SPARC_WDISP30		7
70 #define R_SPARC_WDISP22		8
71 #define R_SPARC_HI22		9
72 #define R_SPARC_22		10
73 #define R_SPARC_13		11
74 #define R_SPARC_LO10		12
75 #define R_SPARC_GOT10		13
76 #define R_SPARC_GOT13		14
77 #define R_SPARC_GOT22		15
78 #define R_SPARC_PC10		16
79 #define R_SPARC_PC22		17
80 #define R_SPARC_WPLT30		18
81 #define R_SPARC_COPY		19
82 #define R_SPARC_GLOB_DAT	20
83 #define R_SPARC_JMP_SLOT	21
84 #define R_SPARC_RELATIVE	22
85 #define R_SPARC_UA32		23
86 #define R_SPARC_PLT32		24
87 #define R_SPARC_HIPLT22		25
88 #define R_SPARC_LOPLT10		26
89 #define R_SPARC_PCPLT32		27
90 #define R_SPARC_PCPLT22		28
91 #define R_SPARC_PCPLT10		29
92 #define R_SPARC_10		30
93 #define R_SPARC_11		31
94 #define R_SPARC_64		32
95 #define R_SPARC_OLO10		33
96 #define R_SPARC_HH22		34
97 #define R_SPARC_HM10		35
98 #define R_SPARC_LM22		36
99 #define R_SPARC_PC_HH22		37
100 #define R_SPARC_PC_HM10		38
101 #define R_SPARC_PC_LM22		39
102 #define R_SPARC_WDISP16		40
103 #define R_SPARC_WDISP19		41
104 #define R_SPARC_GLOB_JMP	42
105 #define R_SPARC_7		43
106 #define R_SPARC_5		44
107 #define R_SPARC_6		45
108 
109 #define R_TYPE(name)		__CONCAT(R_SPARC_,name)
110 #endif
111 
112 #define NATIVE_EXEC_ELF
113 
114 #define ARCH_ELFSIZE		32
115 
116 #define	ELF_TARG_CLASS	ELFCLASS32
117 #define	ELF_TARG_DATA	ELFDATA2MSB
118 #define	ELF_TARG_MACH	EM_SPARC
119 
120 #define	_NLIST_DO_AOUT
121 #define	_NLIST_DO_ELF
122 
123 #define _KERN_DO_AOUT
124 #define _KERN_DO_ELF
125 
126 #endif  /* _SPARC_EXEC_H_ */
127