xref: /netbsd-src/sys/arch/i386/include/elf_machdep.h (revision dc2ac295848fdbeb08478f3a5bb113efa716e9ad)
1*dc2ac295Schristos /*	$NetBSD: elf_machdep.h,v 1.13 2017/11/06 03:47:46 christos Exp $	*/
20e097578Scgd 
3522cbf02Skleink #define	ELF32_MACHDEP_ENDIANNESS	ELFDATA2LSB
40e097578Scgd #define	ELF32_MACHDEP_ID_CASES						\
5522cbf02Skleink 		case EM_386:						\
6522cbf02Skleink 		case EM_486:						\
70e097578Scgd 			break;
80e097578Scgd 
9b848861bSchristos #define	ELF64_MACHDEP_ENDIANNESS	XXX	/* break compilation */
100e097578Scgd #define	ELF64_MACHDEP_ID_CASES						\
110e097578Scgd 		/* no 64-bit ELF machine types supported */
125f59f7e1Sthorpej 
1351535d4bSthorpej #define	ELF32_MACHDEP_ID		EM_386
1451535d4bSthorpej 
15*dc2ac295Schristos #define	KERN_ELFSIZE		32
1678b10569Sminoura #define ARCH_ELFSIZE		32	/* MD native binary size */
1778b10569Sminoura 
185f59f7e1Sthorpej /* i386 relocations */
195f59f7e1Sthorpej #define	R_386_NONE	0
205f59f7e1Sthorpej #define	R_386_32	1
215f59f7e1Sthorpej #define	R_386_PC32	2
225f59f7e1Sthorpej #define	R_386_GOT32	3
235f59f7e1Sthorpej #define	R_386_PLT32	4
245f59f7e1Sthorpej #define	R_386_COPY	5
255f59f7e1Sthorpej #define	R_386_GLOB_DAT	6
26636b3ee6Schristos #define	R_386_JMP_SLOT	7
275f59f7e1Sthorpej #define	R_386_RELATIVE	8
285f59f7e1Sthorpej #define	R_386_GOTOFF	9
295f59f7e1Sthorpej #define	R_386_GOTPC	10
30386b5e25Schristos #define	R_386_32PLT	11
31e0397662Sskrll 
32e0397662Sskrll /* TLS relocations */
33e0397662Sskrll #define	R_386_TLS_TPOFF	14
34e0397662Sskrll #define	R_386_TLS_IE	15
35e0397662Sskrll #define	R_386_TLS_GOTIE	16
36e0397662Sskrll #define	R_386_TLS_LE	17
37e0397662Sskrll #define	R_386_TLS_GD	18
38e0397662Sskrll #define	R_386_TLS_LDM	19
39e0397662Sskrll 
405f59f7e1Sthorpej /* The following relocations are GNU extensions. */
415f59f7e1Sthorpej #define	R_386_16	20
425f59f7e1Sthorpej #define	R_386_PC16	21
435f59f7e1Sthorpej #define	R_386_8		22
445f59f7e1Sthorpej #define	R_386_PC8	23
455f59f7e1Sthorpej 
46e0397662Sskrll /* More TLS relocations */
47e0397662Sskrll #define	R_386_TLS_GD_32		24
48e0397662Sskrll #define	R_386_TLS_GD_PUSH	25
49e0397662Sskrll #define	R_386_TLS_GD_CALL	26
50e0397662Sskrll #define	R_386_TLS_GD_POP	27
51e0397662Sskrll #define	R_386_TLS_LDM_32	28
52e0397662Sskrll #define	R_386_TLS_LDM_PUSH	29
53e0397662Sskrll #define	R_386_TLS_LDM_CALL	30
54e0397662Sskrll #define	R_386_TLS_LDM_POP	31
55e0397662Sskrll #define	R_386_TLS_LDO_32	32
56e0397662Sskrll #define	R_386_TLS_IE_32		33
57e0397662Sskrll #define	R_386_TLS_LE_32		34
58e0397662Sskrll #define	R_386_TLS_DTPMOD32	35
59e0397662Sskrll #define	R_386_TLS_DTPOFF32	36
60e0397662Sskrll #define	R_386_TLS_TPOFF32	37
61f09f85eeSchristos 
62f09f85eeSchristos #define R_386_SIZE32		38
63f09f85eeSchristos 
64f09f85eeSchristos /* More TLS relocations */
65e0397662Sskrll #define	R_386_TLS_GOTDESC	39
66e0397662Sskrll #define	R_386_TLS_DESC_CALL	40
67e0397662Sskrll #define	R_386_TLS_DESC		41
68e0397662Sskrll 
69f09f85eeSchristos #define R_386_IRELATIVE		42
70f09f85eeSchristos #define R_386_GOT32X		43
71f09f85eeSchristos 
725f59f7e1Sthorpej #define	R_TYPE(name)	__CONCAT(R_386_,name)
73