xref: /linux/arch/openrisc/include/uapi/asm/elf.h (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2 /*
3  * OpenRISC Linux
4  *
5  * Linux architectural port borrowing liberally from similar works of
6  * others.  All original copyrights apply as per the original source
7  * declaration.
8  *
9  * OpenRISC implementation:
10  * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
11  * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
12  * et al.
13  *
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation; either version 2 of the License, or
17  * (at your option) any later version.
18  */
19 
20 #ifndef _UAPI__ASM_OPENRISC_ELF_H
21 #define _UAPI__ASM_OPENRISC_ELF_H
22 
23 /*
24  * This files is partially exported to userspace.  This allows us to keep
25  * the ELF bits in one place which should assist in keeping the kernel and
26  * userspace in sync.
27  */
28 
29 /*
30  * ELF register definitions..
31  */
32 
33 /* for struct user_regs_struct definition */
34 #include <asm/ptrace.h>
35 
36 /* The OR1K relocation types... not all relevant for module loader */
37 #define R_OR1K_NONE		0
38 #define R_OR1K_32		1
39 #define R_OR1K_16		2
40 #define R_OR1K_8		3
41 #define R_OR1K_LO_16_IN_INSN	4
42 #define R_OR1K_HI_16_IN_INSN	5
43 #define R_OR1K_INSN_REL_26	6
44 #define R_OR1K_GNU_VTENTRY	7
45 #define R_OR1K_GNU_VTINHERIT	8
46 #define R_OR1K_32_PCREL		9
47 #define R_OR1K_16_PCREL		10
48 #define R_OR1K_8_PCREL		11
49 #define R_OR1K_GOTPC_HI16	12
50 #define R_OR1K_GOTPC_LO16	13
51 #define R_OR1K_GOT16		14
52 #define R_OR1K_PLT26		15
53 #define R_OR1K_GOTOFF_HI16	16
54 #define R_OR1K_GOTOFF_LO16	17
55 #define R_OR1K_COPY		18
56 #define R_OR1K_GLOB_DAT		19
57 #define R_OR1K_JMP_SLOT		20
58 #define R_OR1K_RELATIVE		21
59 #define R_OR1K_TLS_GD_HI16	22
60 #define R_OR1K_TLS_GD_LO16	23
61 #define R_OR1K_TLS_LDM_HI16	24
62 #define R_OR1K_TLS_LDM_LO16	25
63 #define R_OR1K_TLS_LDO_HI16	26
64 #define R_OR1K_TLS_LDO_LO16	27
65 #define R_OR1K_TLS_IE_HI16	28
66 #define R_OR1K_TLS_IE_LO16	29
67 #define R_OR1K_TLS_LE_HI16	30
68 #define R_OR1K_TLS_LE_LO16	31
69 #define R_OR1K_TLS_TPOFF	32
70 #define R_OR1K_TLS_DTPOFF	33
71 #define R_OR1K_TLS_DTPMOD	34
72 #define R_OR1K_AHI16		35
73 #define R_OR1K_GOTOFF_AHI16	36
74 #define R_OR1K_TLS_IE_AHI16	37
75 #define R_OR1K_TLS_LE_AHI16	38
76 #define R_OR1K_SLO16		39
77 #define R_OR1K_GOTOFF_SLO16	40
78 #define R_OR1K_TLS_LE_SLO16	41
79 #define R_OR1K_PCREL_PG21	42
80 #define R_OR1K_GOT_PG21		43
81 #define R_OR1K_TLS_GD_PG21	44
82 #define R_OR1K_TLS_LDM_PG21	45
83 #define R_OR1K_TLS_IE_PG21	46
84 #define R_OR1K_LO13		47
85 #define R_OR1K_GOT_LO13		48
86 #define R_OR1K_TLS_GD_LO13	49
87 #define R_OR1K_TLS_LDM_LO13	50
88 #define R_OR1K_TLS_IE_LO13	51
89 #define R_OR1K_SLO13		52
90 #define R_OR1K_PLTA26		53
91 #define R_OR1K_GOT_AHI16	54
92 
93 /* Old relocation names */
94 #define R_OR32_NONE	R_OR1K_NONE
95 #define R_OR32_32	R_OR1K_32
96 #define R_OR32_16	R_OR1K_16
97 #define R_OR32_8	R_OR1K_8
98 #define R_OR32_CONST	R_OR1K_LO_16_IN_INSN
99 #define R_OR32_CONSTH	R_OR1K_HI_16_IN_INSN
100 #define R_OR32_JUMPTARG	R_OR1K_INSN_REL_26
101 #define R_OR32_VTENTRY	R_OR1K_GNU_VTENTRY
102 #define R_OR32_VTINHERIT R_OR1K_GNU_VTINHERIT
103 
104 typedef unsigned long elf_greg_t;
105 
106 /*
107  * Note that NGREG is defined to ELF_NGREG in include/linux/elfcore.h, and is
108  * thus exposed to user-space.
109  */
110 #define ELF_NGREG (sizeof(struct user_regs_struct) / sizeof(elf_greg_t))
111 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
112 
113 typedef struct __or1k_fpu_state elf_fpregset_t;
114 
115 /* EM_OPENRISC is defined in linux/elf-em.h */
116 #define EM_OR32         0x8472
117 
118 /*
119  * These are used to set parameters in the core dumps.
120  */
121 #define ELF_ARCH	EM_OR32
122 #define ELF_CLASS	ELFCLASS32
123 #define ELF_DATA	ELFDATA2MSB
124 
125 #endif /* _UAPI__ASM_OPENRISC_ELF_H */
126