xref: /netbsd-src/sys/arch/sh3/include/elf_machdep.h (revision dc2ac295848fdbeb08478f3a5bb113efa716e9ad)
1 /*	$NetBSD: elf_machdep.h,v 1.13 2017/11/06 03:47:48 christos Exp $	*/
2 
3 #include <machine/endian_machdep.h>
4 
5 #if _BYTE_ORDER == _LITTLE_ENDIAN
6 #define	ELF32_MACHDEP_ENDIANNESS	ELFDATA2LSB
7 #else
8 #define	ELF32_MACHDEP_ENDIANNESS	ELFDATA2MSB
9 #endif
10 #define	ELF32_MACHDEP_ID_CASES						\
11 		case EM_SH:						\
12 			break;
13 
14 #define	ELF64_MACHDEP_ENDIANNESS	XXX	/* break compilation */
15 #define	ELF64_MACHDEP_ID_CASES						\
16 		/* no 64-bit ELF machine types supported */
17 
18 #define	ELF32_MACHDEP_ID	EM_SH
19 
20 #define	KERN_ELFSIZE		32
21 #define	ARCH_ELFSIZE		32	/* MD native binary size */
22 
23 /*
24  * SuperH ELF header flags.
25  */
26 #define	EF_SH_MACH_MASK		0x1f
27 
28 #define	EF_SH_UNKNOWN		0x00
29 #define	EF_SH_SH1		0x01
30 #define	EF_SH_SH2		0x02
31 #define	EF_SH_SH3		0x03
32 #define	EF_SH_DSP		0x04
33 #define	EF_SH_SH3_DSP		0x05
34 #define	EF_SH_SH3E		0x08
35 #define	EF_SH_SH4		0x09
36 
37 #define	EF_SH_HAS_DSP(x)	((x) & EF_SH_DSP)
38 #define	EF_SH_HAS_FP(x)		((x) & EF_SH_SH3E)
39 
40 
41 #define	R_SH_NONE		0
42 #define	R_SH_DIR32		1
43 #define	R_SH_REL32		2
44 #define	R_SH_DIR8WPN		3
45 #define	R_SH_IND12W		4
46 #define	R_SH_DIR8WPL		5
47 #define	R_SH_DIR8WPZ		6
48 #define	R_SH_DIR8BP		7
49 #define	R_SH_DIR8W		8
50 #define	R_SH_DIR8L		9
51 #define	R_SH_LOOP_START		10
52 #define	R_SH_LOOP_END		11
53 #define	R_SH_GNU_VTINHERIT	22
54 #define	R_SH_GNU_VTENTRY	23
55 #define	R_SH_SWITCH8		24
56 #define	R_SH_SWITCH16		25
57 #define	R_SH_SWITCH32		26
58 #define	R_SH_USES		27
59 #define	R_SH_COUNT		28
60 #define	R_SH_ALIGN		29
61 #define	R_SH_CODE		30
62 #define	R_SH_DATA		31
63 #define	R_SH_LABEL		32
64 
65 /* TLS relocations */
66 #define	R_SH_TLS_GD_32		144
67 #define	R_SH_TLS_LD_32		145
68 #define	R_SH_TLS_LDO_32		146
69 #define	R_SH_TLS_IE_32		147
70 #define	R_SH_TLS_LE_32		148
71 #define	R_SH_TLS_DTPMOD32	149
72 #define	R_SH_TLS_DTPOFF32	150
73 #define	R_SH_TLS_TPOFF32	151
74 
75 #define	R_SH_GOT32		160
76 #define	R_SH_PLT32		161
77 #define	R_SH_COPY		162
78 #define	R_SH_GLOB_DAT		163
79 #define	R_SH_JMP_SLOT		164
80 #define	R_SH_RELATIVE		165
81 #define	R_SH_GOTOFF		166
82 #define	R_SH_GOTPC		167
83 
84 #define	R_TYPE(name)	__CONCAT(R_SH_,name)
85