1 /* BFD support for the AMDGCN GPU architecture.
2 
3    Copyright (C) 2019-2022 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 #include "sysdep.h"
21 #include "bfd.h"
22 #include "libbfd.h"
23 
24 #define N(MACHINE, PRINTABLE_NAME, DEFAULT, NEXT)       \
25   {                                                     \
26     32, /* 32 bits in a word */                         \
27     64, /* 64 bits in an address */                     \
28     8,  /* 8 bits in a byte */                          \
29     bfd_arch_amdgcn,                                    \
30     MACHINE,                                            \
31     "amdgcn",                                           \
32     PRINTABLE_NAME,                                     \
33     3, /* section align power */                        \
34     DEFAULT,                                            \
35     bfd_default_compatible,                             \
36     bfd_default_scan,                                   \
37     bfd_arch_default_fill,                              \
38     NEXT,                                               \
39     0                                                   \
40   }
41 
42 #define NN(index) (&arch_info_struct[index])
43 
44 static const bfd_arch_info_type arch_info_struct[] =
45 {
46   N (bfd_mach_amdgcn_gfx904, "amdgcn:gfx904", false, NN (1)),
47   N (bfd_mach_amdgcn_gfx906, "amdgcn:gfx906", false, NN (2)),
48   N (bfd_mach_amdgcn_gfx908, "amdgcn:gfx908", false, NN (3)),
49   N (bfd_mach_amdgcn_gfx90a, "amdgcn:gfx90a", false, NN (4)),
50   N (bfd_mach_amdgcn_gfx1010, "amdgcn:gfx1010", false, NN (5)),
51   N (bfd_mach_amdgcn_gfx1011, "amdgcn:gfx1011", false, NN (6)),
52   N (bfd_mach_amdgcn_gfx1012, "amdgcn:gfx1012", false, NN (7)),
53   N (bfd_mach_amdgcn_gfx1030, "amdgcn:gfx1030", false, NN (8)),
54   N (bfd_mach_amdgcn_gfx1031, "amdgcn:gfx1031", false, NN (9)),
55   N (bfd_mach_amdgcn_gfx1032, "amdgcn:gfx1032", false, NULL)
56 };
57 
58 const bfd_arch_info_type bfd_amdgcn_arch =
59   N (bfd_mach_amdgcn_gfx900, "amdgcn:gfx900", true, NN (0));
60