[PATCH 47/57][Arm][OBJDUMP] Add support for MVE instructions: vaddv, vmlaldav, vmlada...
[binutils-gdb.git] / bfd / arc-plt.h
bloba940df29a2aceccbf5cea29409aac5e3bbc75b1b
1 /* ARC-specific header file for PLT support.
2 Copyright (C) 2016-2019 Free Software Foundation, Inc.
3 Contributed by Cupertino Miranda (cmiranda@synopsys.com).
5 This file is part of BFD, the Binary File Descriptor library.
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.
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.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20 MA 02110-1301, USA. */
22 #ifndef ARC_PLT_H
23 #define ARC_PLT_H
25 /* Instructions appear in memory as a sequence of half-words (16 bit);
26 individual half-words are represented on the target in target byte order.
27 We use 'unsigned short' on the host to represent the PLT templates,
28 and translate to target byte order as we copy to the target. */
29 typedef uint16_t insn_hword;
31 enum plt_reloc_symbol
33 LAST_RELOC = 0,
35 SGOT = 1,
37 RELATIVE = (1 << 8),
38 RELATIVE_INSN_32 = (1 << 9),
39 RELATIVE_INSN_24 = (1 << 10),
41 MIDDLE_ENDIAN = (1 << 11)
44 #define IS_RELATIVE(S) ((S & (RELATIVE | RELATIVE_INSN_24 | RELATIVE_INSN_32)) != 0)
45 #define IS_INSN_32(S) ((S & RELATIVE_INSN_32) != 0)
46 #define IS_INSN_24(S) ((S & RELATIVE_INSN_24) != 0)
47 #define IS_MIDDLE_ENDIAN(S) ((S & MIDDLE_ENDIAN) != 0)
48 #define SYM_ONLY(S) (S & 0xFF)
50 struct plt_reloc
52 bfd_vma offset;
53 bfd_vma size;
54 bfd_vma mask;
55 enum plt_reloc_symbol symbol;
56 bfd_vma addend;
60 #define PLT_TYPE_START(NAME) NAME,
61 #define PLT_TYPE_END(NAME)
62 #define PLT_ENTRY(...)
63 #define PLT_ELEM(...)
64 #define ENTRY_RELOC(...)
65 #define ELEM_RELOC(...)
67 enum plt_types_enum
69 PLT_START = -1,
70 #include "arc-plt.def"
71 PLT_MAX
74 #undef PLT_TYPE_START
75 #undef PLT_TYPE_END
76 #undef PLT_ENTRY
77 #undef PLT_ELEM
78 #undef ENTRY_RELOC
79 #undef ELEM_RELOC
81 typedef insn_hword insn_hword_array[];
83 struct plt_version_t
85 const insn_hword_array *entry;
86 const bfd_vma entry_size;
87 const insn_hword_array *elem;
88 const bfd_vma elem_size;
90 const struct plt_reloc *entry_relocs;
91 const struct plt_reloc *elem_relocs;
94 #define PLT_TYPE_START(NAME) \
95 const insn_hword NAME##_plt_entry[] = {
96 #define PLT_TYPE_END(NAME) };
97 #define PLT_ENTRY(...) __VA_ARGS__,
98 #define PLT_ELEM(...)
99 #define ENTRY_RELOC(...)
100 #define ELEM_RELOC(...)
102 #include "arc-plt.def"
104 #undef PLT_TYPE_START
105 #undef PLT_TYPE_END
106 #undef PLT_ENTRY
107 #undef PLT_ELEM
108 #undef ENTRY_RELOC
109 #undef ELEM_RELOC
111 #define PLT_TYPE_START(NAME) \
112 const struct plt_reloc NAME##_plt_entry_relocs[] = {
113 #define PLT_TYPE_END(NAME) \
114 {0, 0, 0, LAST_RELOC, 0} \
116 #define PLT_ENTRY(...)
117 #define PLT_ELEM(...)
118 #define ENTRY_RELOC(...) { __VA_ARGS__ },
119 #define ELEM_RELOC(...)
121 #include "arc-plt.def"
123 #undef PLT_TYPE_START
124 #undef PLT_TYPE_END
125 #undef PLT_ENTRY
126 #undef PLT_ELEM
127 #undef ENTRY_RELOC
128 #undef ELEM_RELOC
131 #define PLT_TYPE_START(NAME) \
132 const insn_hword NAME##_plt_elem[] = {
133 #define PLT_TYPE_END(NAME) };
134 #define PLT_ENTRY(...)
135 #define PLT_ELEM(...) __VA_ARGS__,
136 #define ENTRY_RELOC(...)
137 #define ELEM_RELOC(...)
139 #include "arc-plt.def"
141 #undef PLT_TYPE_START
142 #undef PLT_TYPE_END
143 #undef PLT_ENTRY
144 #undef PLT_ELEM
145 #undef ENTRY_RELOC
146 #undef ELEM_RELOC
148 #define PLT_TYPE_START(NAME) \
149 const struct plt_reloc NAME##_plt_elem_relocs[] = {
150 #define PLT_TYPE_END(NAME) \
151 {0, 0, 0, LAST_RELOC, 0} \
153 #define PLT_ENTRY(...)
154 #define PLT_ELEM(...)
155 #define ENTRY_RELOC(...)
156 #define ELEM_RELOC(...) { __VA_ARGS__ },
158 #include "arc-plt.def"
160 #undef PLT_TYPE_START
161 #undef PLT_TYPE_END
162 #undef PLT_ENTRY
163 #undef PLT_ELEM
164 #undef ENTRY_RELOC
165 #undef ELEM_RELOC
168 #define PLT_TYPE_START(NAME) \
170 .entry = &NAME##_plt_entry, \
171 .entry_size = sizeof (NAME##_plt_entry), \
172 .elem = &NAME##_plt_elem, \
173 .elem_size = sizeof (NAME##_plt_elem), \
174 .entry_relocs = NAME##_plt_entry_relocs, \
175 .elem_relocs = NAME##_plt_elem_relocs
176 #define PLT_TYPE_END(NAME) },
177 #define PLT_ENTRY(...)
178 #define PLT_ELEM(...)
179 #define ENTRY_RELOC(...)
180 #define ELEM_RELOC(...)
181 struct plt_version_t plt_versions[PLT_MAX] = {
183 #include "arc-plt.def"
186 #undef PLT_TYPE_START
187 #undef PLT_TYPE_END
188 #undef PLT_ENTRY
189 #undef PLT_ELEM
190 #undef ENTRY_RELOC
191 #undef ELEM_RELOC
194 #endif /* ARC_PLT_H */