elf_machdep.h revision 1.11
11.11Schristos/*	$NetBSD: elf_machdep.h,v 1.11 2014/10/23 19:39:42 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.8Such#define	ARCH_ELFSIZE		32	/* MD native binary size */
211.7Sthorpej
221.7Sthorpej/*
231.7Sthorpej * SuperH ELF header flags.
241.7Sthorpej */
251.7Sthorpej#define	EF_SH_MACH_MASK		0x1f
261.7Sthorpej
271.7Sthorpej#define	EF_SH_UNKNOWN		0x00
281.7Sthorpej#define	EF_SH_SH1		0x01
291.7Sthorpej#define	EF_SH_SH2		0x02
301.7Sthorpej#define	EF_SH_SH3		0x03
311.7Sthorpej#define	EF_SH_DSP		0x04
321.7Sthorpej#define	EF_SH_SH3_DSP		0x05
331.7Sthorpej#define	EF_SH_SH3E		0x08
341.7Sthorpej#define	EF_SH_SH4		0x09
351.7Sthorpej
361.7Sthorpej#define	EF_SH_HAS_DSP(x)	((x) & EF_SH_DSP)
371.7Sthorpej#define	EF_SH_HAS_FP(x)		((x) & EF_SH_SH3E)
381.7Sthorpej
391.6Sthorpej
401.6Sthorpej#define	R_SH_NONE		0
411.6Sthorpej#define	R_SH_DIR32		1
421.6Sthorpej#define	R_SH_REL32		2
431.6Sthorpej#define	R_SH_DIR8WPN		3
441.6Sthorpej#define	R_SH_IND12W		4
451.6Sthorpej#define	R_SH_DIR8WPL		5
461.6Sthorpej#define	R_SH_DIR8WPZ		6
471.6Sthorpej#define	R_SH_DIR8BP		7
481.6Sthorpej#define	R_SH_DIR8W		8
491.6Sthorpej#define	R_SH_DIR8L		9
501.6Sthorpej#define	R_SH_SWITCH16		25
511.6Sthorpej#define	R_SH_SWITCH32		26
521.6Sthorpej#define	R_SH_USES		27
531.6Sthorpej#define	R_SH_COUNT		28
541.6Sthorpej#define	R_SH_ALIGN		29
551.6Sthorpej#define	R_SH_CODE		30
561.6Sthorpej#define	R_SH_DATA		31
571.6Sthorpej#define	R_SH_LABEL		32
581.6Sthorpej#define	R_SH_SWITCH8		33
591.6Sthorpej#define	R_SH_GNU_VTINHERIT	34
601.6Sthorpej#define	R_SH_GNU_VTENTRY	35
611.6Sthorpej#define	R_SH_LOOP_START		36
621.6Sthorpej#define	R_SH_LOOP_END		37
631.10Sskrll
641.10Sskrll/* TLS relocations */
651.10Sskrll#define	R_SH_TLS_GD_32		144
661.10Sskrll#define	R_SH_TLS_LD_32		145
671.10Sskrll#define	R_SH_TLS_LDO_32		146
681.10Sskrll#define	R_SH_TLS_IE_32		147
691.10Sskrll#define	R_SH_TLS_LE_32		148
701.10Sskrll#define	R_SH_TLS_DTPMOD32	149
711.10Sskrll#define	R_SH_TLS_DTPOFF32	150
721.10Sskrll#define	R_SH_TLS_TPOFF32	151
731.10Sskrll
741.6Sthorpej#define	R_SH_GOT32		160
751.6Sthorpej#define	R_SH_PLT32		161
761.6Sthorpej#define	R_SH_COPY		162
771.6Sthorpej#define	R_SH_GLOB_DAT		163
781.6Sthorpej#define	R_SH_JMP_SLOT		164
791.6Sthorpej#define	R_SH_RELATIVE		165
801.6Sthorpej#define	R_SH_GOTOFF		166
811.6Sthorpej#define	R_SH_GOTPC		167
821.6Sthorpej
831.6Sthorpej#define	R_TYPE(name)	__CONCAT(R_SH_,name)
84