11.13Schristos/*	$NetBSD: elf_machdep.h,v 1.13 2017/11/06 03:47:48 christos Exp $	*/
21.1Sitojun
31.11Schristos#include <machine/endian_machdep.h>
41.4Smarcus
51.4Smarcus#if _BYTE_ORDER == _LITTLE_ENDIAN
61.4Smarcus#define	ELF32_MACHDEP_ENDIANNESS	ELFDATA2LSB
71.4Smarcus#else
81.2Skleink#define	ELF32_MACHDEP_ENDIANNESS	ELFDATA2MSB
91.4Smarcus#endif
101.1Sitojun#define	ELF32_MACHDEP_ID_CASES						\
111.2Skleink		case EM_SH:						\
121.1Sitojun			break;
131.1Sitojun
141.1Sitojun#define	ELF64_MACHDEP_ENDIANNESS	XXX	/* break compilation */
151.1Sitojun#define	ELF64_MACHDEP_ID_CASES						\
161.1Sitojun		/* no 64-bit ELF machine types supported */
171.5Sthorpej
181.5Sthorpej#define	ELF32_MACHDEP_ID	EM_SH
191.3Sminoura
201.13Schristos#define	KERN_ELFSIZE		32
211.8Such#define	ARCH_ELFSIZE		32	/* MD native binary size */
221.7Sthorpej
231.7Sthorpej/*
241.7Sthorpej * SuperH ELF header flags.
251.7Sthorpej */
261.7Sthorpej#define	EF_SH_MACH_MASK		0x1f
271.7Sthorpej
281.7Sthorpej#define	EF_SH_UNKNOWN		0x00
291.7Sthorpej#define	EF_SH_SH1		0x01
301.7Sthorpej#define	EF_SH_SH2		0x02
311.7Sthorpej#define	EF_SH_SH3		0x03
321.7Sthorpej#define	EF_SH_DSP		0x04
331.7Sthorpej#define	EF_SH_SH3_DSP		0x05
341.7Sthorpej#define	EF_SH_SH3E		0x08
351.7Sthorpej#define	EF_SH_SH4		0x09
361.7Sthorpej
371.7Sthorpej#define	EF_SH_HAS_DSP(x)	((x) & EF_SH_DSP)
381.7Sthorpej#define	EF_SH_HAS_FP(x)		((x) & EF_SH_SH3E)
391.7Sthorpej
401.6Sthorpej
411.6Sthorpej#define	R_SH_NONE		0
421.6Sthorpej#define	R_SH_DIR32		1
431.6Sthorpej#define	R_SH_REL32		2
441.6Sthorpej#define	R_SH_DIR8WPN		3
451.6Sthorpej#define	R_SH_IND12W		4
461.6Sthorpej#define	R_SH_DIR8WPL		5
471.6Sthorpej#define	R_SH_DIR8WPZ		6
481.6Sthorpej#define	R_SH_DIR8BP		7
491.6Sthorpej#define	R_SH_DIR8W		8
501.6Sthorpej#define	R_SH_DIR8L		9
511.12Sjoerg#define	R_SH_LOOP_START		10
521.12Sjoerg#define	R_SH_LOOP_END		11
531.12Sjoerg#define	R_SH_GNU_VTINHERIT	22
541.12Sjoerg#define	R_SH_GNU_VTENTRY	23
551.12Sjoerg#define	R_SH_SWITCH8		24
561.6Sthorpej#define	R_SH_SWITCH16		25
571.6Sthorpej#define	R_SH_SWITCH32		26
581.6Sthorpej#define	R_SH_USES		27
591.6Sthorpej#define	R_SH_COUNT		28
601.6Sthorpej#define	R_SH_ALIGN		29
611.6Sthorpej#define	R_SH_CODE		30
621.6Sthorpej#define	R_SH_DATA		31
631.6Sthorpej#define	R_SH_LABEL		32
641.10Sskrll
651.10Sskrll/* TLS relocations */
661.10Sskrll#define	R_SH_TLS_GD_32		144
671.10Sskrll#define	R_SH_TLS_LD_32		145
681.10Sskrll#define	R_SH_TLS_LDO_32		146
691.10Sskrll#define	R_SH_TLS_IE_32		147
701.10Sskrll#define	R_SH_TLS_LE_32		148
711.10Sskrll#define	R_SH_TLS_DTPMOD32	149
721.10Sskrll#define	R_SH_TLS_DTPOFF32	150
731.10Sskrll#define	R_SH_TLS_TPOFF32	151
741.10Sskrll
751.6Sthorpej#define	R_SH_GOT32		160
761.6Sthorpej#define	R_SH_PLT32		161
771.6Sthorpej#define	R_SH_COPY		162
781.6Sthorpej#define	R_SH_GLOB_DAT		163
791.6Sthorpej#define	R_SH_JMP_SLOT		164
801.6Sthorpej#define	R_SH_RELATIVE		165
811.6Sthorpej#define	R_SH_GOTOFF		166
821.6Sthorpej#define	R_SH_GOTPC		167
831.6Sthorpej
841.6Sthorpej#define	R_TYPE(name)	__CONCAT(R_SH_,name)
85