elf_machdep.h revision 1.11
1/*	$NetBSD: elf_machdep.h,v 1.11 2014/10/23 19:39:42 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	ARCH_ELFSIZE		32	/* MD native binary size */
21
22/*
23 * SuperH ELF header flags.
24 */
25#define	EF_SH_MACH_MASK		0x1f
26
27#define	EF_SH_UNKNOWN		0x00
28#define	EF_SH_SH1		0x01
29#define	EF_SH_SH2		0x02
30#define	EF_SH_SH3		0x03
31#define	EF_SH_DSP		0x04
32#define	EF_SH_SH3_DSP		0x05
33#define	EF_SH_SH3E		0x08
34#define	EF_SH_SH4		0x09
35
36#define	EF_SH_HAS_DSP(x)	((x) & EF_SH_DSP)
37#define	EF_SH_HAS_FP(x)		((x) & EF_SH_SH3E)
38
39
40#define	R_SH_NONE		0
41#define	R_SH_DIR32		1
42#define	R_SH_REL32		2
43#define	R_SH_DIR8WPN		3
44#define	R_SH_IND12W		4
45#define	R_SH_DIR8WPL		5
46#define	R_SH_DIR8WPZ		6
47#define	R_SH_DIR8BP		7
48#define	R_SH_DIR8W		8
49#define	R_SH_DIR8L		9
50#define	R_SH_SWITCH16		25
51#define	R_SH_SWITCH32		26
52#define	R_SH_USES		27
53#define	R_SH_COUNT		28
54#define	R_SH_ALIGN		29
55#define	R_SH_CODE		30
56#define	R_SH_DATA		31
57#define	R_SH_LABEL		32
58#define	R_SH_SWITCH8		33
59#define	R_SH_GNU_VTINHERIT	34
60#define	R_SH_GNU_VTENTRY	35
61#define	R_SH_LOOP_START		36
62#define	R_SH_LOOP_END		37
63
64/* TLS relocations */
65#define	R_SH_TLS_GD_32		144
66#define	R_SH_TLS_LD_32		145
67#define	R_SH_TLS_LDO_32		146
68#define	R_SH_TLS_IE_32		147
69#define	R_SH_TLS_LE_32		148
70#define	R_SH_TLS_DTPMOD32	149
71#define	R_SH_TLS_DTPOFF32	150
72#define	R_SH_TLS_TPOFF32	151
73
74#define	R_SH_GOT32		160
75#define	R_SH_PLT32		161
76#define	R_SH_COPY		162
77#define	R_SH_GLOB_DAT		163
78#define	R_SH_JMP_SLOT		164
79#define	R_SH_RELATIVE		165
80#define	R_SH_GOTOFF		166
81#define	R_SH_GOTPC		167
82
83#define	R_TYPE(name)	__CONCAT(R_SH_,name)
84