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