1 /* ARC-specific header file for PLT support.
2 Copyright (C) 2016-2021 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. */
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
;
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)
55 enum plt_reloc_symbol symbol
;
60 #define PLT_TYPE_START(NAME) NAME,
61 #define PLT_TYPE_END(NAME)
62 #define PLT_ENTRY(...)
64 #define ENTRY_RELOC(...)
65 #define ELEM_RELOC(...)
70 #include "arc-plt.def"
81 typedef insn_hword insn_hword_array
[];
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__,
99 #define ENTRY_RELOC(...)
100 #define ELEM_RELOC(...)
102 #include "arc-plt.def"
104 #undef PLT_TYPE_START
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
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
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
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 const struct plt_version_t plt_versions
[PLT_MAX
] = {
183 #include "arc-plt.def"
186 #undef PLT_TYPE_START
194 #endif /* ARC_PLT_H */