File indexing completed on 2025-05-11 08:24:25
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 #ifndef _RISCV_ELF_MACHDEP_H_
0035 #define _RISCV_ELF_MACHDEP_H_
0036
0037 #define EM_RISCV 243
0038 #define ELF32_MACHDEP_ID EM_RISCV
0039 #define ELF64_MACHDEP_ID EM_RISCV
0040
0041 #define ELF32_MACHDEP_ENDIANNESS ELFDATA2LSB
0042 #define ELF64_MACHDEP_ENDIANNESS ELFDATA2LSB
0043
0044 #define ELF32_MACHDEP_ID_CASES \
0045 case EM_RISCV: \
0046 break;
0047
0048 #define ELF64_MACHDEP_ID_CASES \
0049 case EM_RISCV: \
0050 break;
0051
0052 #define KERN_ELFSIZE 32
0053 #ifdef _LP64
0054 #define ARCH_ELFSIZE 64
0055 #else
0056 #define ARCH_ELFSIZE 32
0057 #endif
0058
0059
0060
0061
0062
0063 #define R_RISCV_NONE 0
0064 #define R_RISCV_32 1
0065 #define R_RISCV_64 2
0066 #define R_RISCV_RELATIVE 3
0067 #define R_RISCV_COPY 4
0068 #define R_RISCV_JMP_SLOT 5
0069 #define R_RISCV_TLS_DTPMOD32 6
0070 #define R_RISCV_TLS_DTPREL32 7
0071 #define R_RISCV_TLS_DTPMOD64 8
0072 #define R_RISCV_TLS_DTPREL64 9
0073 #define R_RISCV_TLS_TPREL32 10
0074 #define R_RISCV_TLS_TPREL64 11
0075
0076
0077 #define R_RISCV_BRANCH 16
0078 #define R_RISCV_JAL 17
0079 #define R_RISCV_CALL 18
0080 #define R_RISCV_CALL_PLT 19
0081 #define R_RISCV_GOT_HI20 20
0082 #define R_RISCV_TLS_GOT_HI20 21
0083 #define R_RISCV_TLS_GD_HI20 22
0084 #define R_RISCV_PCREL_HI20 23
0085 #define R_RISCV_PCREL_LO12_I 24
0086 #define R_RISCV_PCREL_LO12_S 25
0087 #define R_RISCV_HI20 26
0088 #define R_RISCV_LO12_I 27
0089 #define R_RISCV_LO12_S 28
0090 #define R_RISCV_TPREL_HI20 29
0091 #define R_RISCV_TPREL_LO12_I 30
0092 #define R_RISCV_TPREL_LO12_S 31
0093 #define R_RISCV_TPREL_ADD 32
0094 #define R_RISCV_ADD8 33
0095 #define R_RISCV_ADD16 34
0096 #define R_RISCV_ADD32 35
0097 #define R_RISCV_ADD64 36
0098 #define R_RISCV_SUB8 37
0099 #define R_RISCV_SUB16 38
0100 #define R_RISCV_SUB32 39
0101 #define R_RISCV_SUB64 40
0102 #define R_RISCV_GNU_VTINHERIT 41
0103 #define R_RISCV_GNU_VTENTRY 42
0104 #define R_RISCV_ALIGN 43
0105 #define R_RISCV_RVC_BRANCH 44
0106 #define R_RISCV_RVC_JUMP 45
0107 #define R_RISCV_RVC_LUI 46
0108
0109 #define R_RISCV_RELAX 51
0110 #define R_RISCV_SUB6 52
0111 #define R_RISCV_SET6 53
0112 #define R_RISCV_SET8 54
0113 #define R_RISCV_SET16 55
0114 #define R_RISCV_SET32 56
0115
0116 #define R_RISCV_32_PCREL 57
0117
0118
0119 #define R_RISCV_ADDR32 R_RISCV_32
0120 #define R_RISCV_ADDR64 R_RISCV_64
0121
0122 #define R_TYPE(name) R_RISCV_ ## name
0123 #if ELFSIZE == 32
0124 #define R_TYPESZ(name) R_RISCV_ ## name ## 32
0125 #else
0126 #define R_TYPESZ(name) R_RISCV_ ## name ## 64
0127 #endif
0128
0129 #ifdef _KERNEL
0130 #ifdef ELFSIZE
0131 #define ELF_MD_PROBE_FUNC ELFNAME2(cpu_netbsd,probe)
0132 #endif
0133
0134 struct exec_package;
0135
0136 int cpu_netbsd_elf32_probe(struct lwp *, struct exec_package *, void *, char *,
0137 vaddr_t *);
0138
0139 int cpu_netbsd_elf64_probe(struct lwp *, struct exec_package *, void *, char *,
0140 vaddr_t *);
0141
0142 #endif
0143
0144 #endif