]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - include/elf/amdgpu.h
d44244194e9d280ce661b65eba7a02b56d363f1c
[thirdparty/binutils-gdb.git] / include / elf / amdgpu.h
1 /* AMDGPU ELF support for BFD.
2
3 Copyright (C) 2019-2023 Free Software Foundation, Inc.
4
5 This file is part of BFD, the Binary File Descriptor library.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20 #ifndef _ELF_AMDGPU_H
21 #define _ELF_AMDGPU_H
22
23 #include "elf/reloc-macros.h"
24
25 /* e_ident[EI_ABIVERSION] values, when e_ident[EI_OSABI] is
26 ELFOSABI_AMDGPU_HSA. */
27
28 #define ELFABIVERSION_AMDGPU_HSA_V2 0
29 #define ELFABIVERSION_AMDGPU_HSA_V3 1
30 #define ELFABIVERSION_AMDGPU_HSA_V4 2
31 #define ELFABIVERSION_AMDGPU_HSA_V5 3
32
33 /* Processor selection mask for EF_AMDGPU_MACH_* values. */
34
35 #define EF_AMDGPU_MACH 0x0ff
36 #define EF_AMDGPU_MACH_AMDGCN_MIN 0x020
37
38 #define EF_AMDGPU_MACH_AMDGCN_GFX600 0x020
39 #define EF_AMDGPU_MACH_AMDGCN_GFX601 0x021
40 #define EF_AMDGPU_MACH_AMDGCN_GFX700 0x022
41 #define EF_AMDGPU_MACH_AMDGCN_GFX701 0x023
42 #define EF_AMDGPU_MACH_AMDGCN_GFX702 0x024
43 #define EF_AMDGPU_MACH_AMDGCN_GFX703 0x025
44 #define EF_AMDGPU_MACH_AMDGCN_GFX704 0x026
45 #define EF_AMDGPU_MACH_AMDGCN_GFX801 0x028
46 #define EF_AMDGPU_MACH_AMDGCN_GFX802 0x029
47 #define EF_AMDGPU_MACH_AMDGCN_GFX803 0x02a
48 #define EF_AMDGPU_MACH_AMDGCN_GFX810 0x02b
49 #define EF_AMDGPU_MACH_AMDGCN_GFX900 0x02c
50 #define EF_AMDGPU_MACH_AMDGCN_GFX902 0x02d
51 #define EF_AMDGPU_MACH_AMDGCN_GFX904 0x02e
52 #define EF_AMDGPU_MACH_AMDGCN_GFX906 0x02f
53 #define EF_AMDGPU_MACH_AMDGCN_GFX908 0x030
54 #define EF_AMDGPU_MACH_AMDGCN_GFX909 0x031
55 #define EF_AMDGPU_MACH_AMDGCN_GFX90C 0x032
56 #define EF_AMDGPU_MACH_AMDGCN_GFX1010 0x033
57 #define EF_AMDGPU_MACH_AMDGCN_GFX1011 0x034
58 #define EF_AMDGPU_MACH_AMDGCN_GFX1012 0x035
59 #define EF_AMDGPU_MACH_AMDGCN_GFX1030 0x036
60 #define EF_AMDGPU_MACH_AMDGCN_GFX1031 0x037
61 #define EF_AMDGPU_MACH_AMDGCN_GFX1032 0x038
62 #define EF_AMDGPU_MACH_AMDGCN_GFX1033 0x039
63 #define EF_AMDGPU_MACH_AMDGCN_GFX602 0x03a
64 #define EF_AMDGPU_MACH_AMDGCN_GFX705 0x03b
65 #define EF_AMDGPU_MACH_AMDGCN_GFX805 0x03c
66 #define EF_AMDGPU_MACH_AMDGCN_GFX1035 0x03d
67 #define EF_AMDGPU_MACH_AMDGCN_GFX1034 0x03e
68 #define EF_AMDGPU_MACH_AMDGCN_GFX90A 0x03f
69 #define EF_AMDGPU_MACH_AMDGCN_GFX940 0x040
70 #define EF_AMDGPU_MACH_AMDGCN_GFX1013 0x042
71 #define EF_AMDGPU_MACH_AMDGCN_GFX1036 0x045
72
73 /* Code object v3 machine flags. */
74
75 #define EF_AMDGPU_FEATURE_XNACK_V3 0x100
76 #define EF_AMDGPU_FEATURE_SRAMECC_V3 0x200
77
78 /* Code object v4 (and later) machine flags. */
79
80 #define EF_AMDGPU_FEATURE_XNACK_V4 0x300
81 #define EF_AMDGPU_FEATURE_XNACK_UNSUPPORTED_V4 0x000
82 #define EF_AMDGPU_FEATURE_XNACK_ANY_V4 0x100
83 #define EF_AMDGPU_FEATURE_XNACK_OFF_V4 0x200
84 #define EF_AMDGPU_FEATURE_XNACK_ON_V4 0x300
85
86 #define EF_AMDGPU_FEATURE_SRAMECC_V4 0xc00
87 #define EF_AMDGPU_FEATURE_SRAMECC_UNSUPPORTED_V4 0x000
88 #define EF_AMDGPU_FEATURE_SRAMECC_ANY_V4 0x400
89 #define EF_AMDGPU_FEATURE_SRAMECC_OFF_V4 0x800
90 #define EF_AMDGPU_FEATURE_SRAMECC_ON_V4 0xc00
91
92 /* Notes. */
93
94 #define NT_AMDGPU_METADATA 32
95
96 /* Relocations. */
97
98 START_RELOC_NUMBERS (elf_amdgpu_reloc_type)
99 RELOC_NUMBER (R_AMDGPU_NONE, 0)
100 RELOC_NUMBER (R_AMDGPU_ABS32_LO, 1)
101 RELOC_NUMBER (R_AMDGPU_ABS32_HI, 2)
102 RELOC_NUMBER (R_AMDGPU_ABS64, 3)
103 RELOC_NUMBER (R_AMDGPU_REL32, 4)
104 RELOC_NUMBER (R_AMDGPU_REL64, 5)
105 RELOC_NUMBER (R_AMDGPU_ABS32, 6)
106 RELOC_NUMBER (R_AMDGPU_GOTPCREL, 7)
107 RELOC_NUMBER (R_AMDGPU_GOTPCREL32_LO, 8)
108 RELOC_NUMBER (R_AMDGPU_GOTPCREL32_HI, 9)
109 RELOC_NUMBER (R_AMDGPU_REL32_LO, 10)
110 RELOC_NUMBER (R_AMDGPU_REL32_HI, 11)
111 RELOC_NUMBER (R_AMDGPU_RELATIVE64, 13)
112 RELOC_NUMBER (R_AMDGPU_REL16, 16)
113 END_RELOC_NUMBERS (R_AMDGPU_max)
114
115 #endif /* _ELF_AMDGPU_H */