1 /* ARC-specific header file for PLT support.
2 Copyright (C) 2016-2018 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. */
27 /* Instructions appear in memory as a sequence of half-words (16 bit);
28 individual half-words are represented on the target in target byte order.
29 We use 'unsigned short' on the host to represent the PLT templates,
30 and translate to target byte order as we copy to the target. */
31 typedef uint16_t insn_hword;
40 RELATIVE_INSN_32 = (1 << 9),
41 RELATIVE_INSN_24 = (1 << 10),
43 MIDDLE_ENDIAN = (1 << 11)
46 #define IS_RELATIVE(S) ((S & (RELATIVE | RELATIVE_INSN_24 | RELATIVE_INSN_32)) != 0)
47 #define IS_INSN_32(S) ((S & RELATIVE_INSN_32) != 0)
48 #define IS_INSN_24(S) ((S & RELATIVE_INSN_24) != 0)
49 #define IS_MIDDLE_ENDIAN(S) ((S & MIDDLE_ENDIAN) != 0)
50 #define SYM_ONLY(S) (S & 0xFF)
57 enum plt_reloc_symbol symbol;
62 #define PLT_TYPE_START(NAME) NAME,
63 #define PLT_TYPE_END(NAME)
64 #define PLT_ENTRY(...)
66 #define ENTRY_RELOC(...)
67 #define ELEM_RELOC(...)
72 #include "arc-plt.def"
83 typedef insn_hword insn_hword_array[];
87 const insn_hword_array *entry;
88 const bfd_vma entry_size;
89 const insn_hword_array *elem;
90 const bfd_vma elem_size;
92 const struct plt_reloc *entry_relocs;
93 const struct plt_reloc *elem_relocs;
96 #define PLT_TYPE_START(NAME) \
97 const insn_hword NAME##_plt_entry[] = {
98 #define PLT_TYPE_END(NAME) };
99 #define PLT_ENTRY(...) __VA_ARGS__,
100 #define PLT_ELEM(...)
101 #define ENTRY_RELOC(...)
102 #define ELEM_RELOC(...)
104 #include "arc-plt.def"
106 #undef PLT_TYPE_START
113 #define PLT_TYPE_START(NAME) \
114 const struct plt_reloc NAME##_plt_entry_relocs[] = {
115 #define PLT_TYPE_END(NAME) \
116 {0, 0, 0, LAST_RELOC, 0} \
118 #define PLT_ENTRY(...)
119 #define PLT_ELEM(...)
120 #define ENTRY_RELOC(...) { __VA_ARGS__ },
121 #define ELEM_RELOC(...)
123 #include "arc-plt.def"
125 #undef PLT_TYPE_START
133 #define PLT_TYPE_START(NAME) \
134 const insn_hword NAME##_plt_elem[] = {
135 #define PLT_TYPE_END(NAME) };
136 #define PLT_ENTRY(...)
137 #define PLT_ELEM(...) __VA_ARGS__,
138 #define ENTRY_RELOC(...)
139 #define ELEM_RELOC(...)
141 #include "arc-plt.def"
143 #undef PLT_TYPE_START
150 #define PLT_TYPE_START(NAME) \
151 const struct plt_reloc NAME##_plt_elem_relocs[] = {
152 #define PLT_TYPE_END(NAME) \
153 {0, 0, 0, LAST_RELOC, 0} \
155 #define PLT_ENTRY(...)
156 #define PLT_ELEM(...)
157 #define ENTRY_RELOC(...)
158 #define ELEM_RELOC(...) { __VA_ARGS__ },
160 #include "arc-plt.def"
162 #undef PLT_TYPE_START
170 #define PLT_TYPE_START(NAME) \
172 .entry = &NAME##_plt_entry, \
173 .entry_size = sizeof (NAME##_plt_entry), \
174 .elem = &NAME##_plt_elem, \
175 .elem_size = sizeof (NAME##_plt_elem), \
176 .entry_relocs = NAME##_plt_entry_relocs, \
177 .elem_relocs = NAME##_plt_elem_relocs
178 #define PLT_TYPE_END(NAME) },
179 #define PLT_ENTRY(...)
180 #define PLT_ELEM(...)
181 #define ENTRY_RELOC(...)
182 #define ELEM_RELOC(...)
183 struct plt_version_t plt_versions[PLT_MAX] = {
185 #include "arc-plt.def"
188 #undef PLT_TYPE_START
196 #endif /* ARC_PLT_H */