Commit | Line | Data |
---|---|---|
0afcef53 L |
1 | /* x86 specific support for ELF |
2 | Copyright (C) 2017 Free Software Foundation, Inc. | |
3 | ||
4 | This file is part of BFD, the Binary File Descriptor library. | |
5 | ||
6 | This program is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 3 of the License, or | |
9 | (at your option) any later version. | |
10 | ||
11 | This program is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with this program; if not, write to the Free Software | |
18 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, | |
19 | MA 02110-1301, USA. */ | |
20 | ||
21 | #include "sysdep.h" | |
22 | #include "bfd.h" | |
23 | #include "bfdlink.h" | |
24 | #include "libbfd.h" | |
25 | #include "elf-bfd.h" | |
26 | #include "bfd_stdint.h" | |
0afcef53 L |
27 | #include "hashtab.h" |
28 | ||
aa595247 L |
29 | #define PLT_CIE_LENGTH 20 |
30 | #define PLT_FDE_LENGTH 36 | |
31 | #define PLT_FDE_START_OFFSET 4 + PLT_CIE_LENGTH + 8 | |
32 | #define PLT_FDE_LEN_OFFSET 4 + PLT_CIE_LENGTH + 12 | |
33 | ||
765e526c L |
34 | #define ABI_64_P(abfd) \ |
35 | (get_elf_backend_data (abfd)->s->elfclass == ELFCLASS64) | |
36 | ||
0afcef53 L |
37 | /* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid |
38 | copying dynamic variables from a shared lib into an app's dynbss | |
39 | section, and instead use a dynamic relocation to point into the | |
40 | shared lib. */ | |
41 | #define ELIMINATE_COPY_RELOCS 1 | |
42 | ||
43 | #define elf_x86_hash_table(p, id) \ | |
1cf58434 AM |
44 | (is_elf_hash_table ((p)->hash) \ |
45 | && elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) == (id) \ | |
0afcef53 L |
46 | ? ((struct elf_x86_link_hash_table *) ((p)->hash)) : NULL) |
47 | ||
6999821f L |
48 | /* Will references to this symbol always be local in this object? */ |
49 | #define SYMBOL_REFERENCES_LOCAL_P(INFO, H) \ | |
50 | _bfd_x86_elf_link_symbol_references_local ((INFO), (H)) | |
51 | ||
0afcef53 L |
52 | /* Is a undefined weak symbol which is resolved to 0. Reference to an |
53 | undefined weak symbol is resolved to 0 when building executable if | |
54 | it isn't dynamic and | |
55 | 1. Has non-GOT/non-PLT relocations in text section. Or | |
56 | 2. Has no GOT/PLT relocation. | |
57 | Local undefined weak symbol is always resolved to 0. | |
58 | */ | |
c5bce5c6 | 59 | #define UNDEFINED_WEAK_RESOLVED_TO_ZERO(INFO, EH) \ |
0afcef53 | 60 | ((EH)->elf.root.type == bfd_link_hash_undefweak \ |
6999821f | 61 | && (SYMBOL_REFERENCES_LOCAL_P ((INFO), &(EH)->elf) \ |
0afcef53 | 62 | || (bfd_link_executable (INFO) \ |
c5bce5c6 L |
63 | && (!(EH)->has_got_reloc \ |
64 | || (EH)->has_non_got_reloc)))) | |
0afcef53 L |
65 | |
66 | /* Should copy relocation be generated for a symbol. Don't generate | |
67 | copy relocation against a protected symbol defined in a shared | |
68 | object with GNU_PROPERTY_NO_COPY_ON_PROTECTED. */ | |
69 | #define SYMBOL_NO_COPYRELOC(INFO, EH) \ | |
70 | ((EH)->def_protected \ | |
71 | && ((EH)->elf.root.type == bfd_link_hash_defined \ | |
72 | || (EH)->elf.root.type == bfd_link_hash_defweak) \ | |
73 | && elf_has_no_copy_on_protected ((EH)->elf.root.u.def.section->owner) \ | |
74 | && ((EH)->elf.root.u.def.section->owner->flags & DYNAMIC) != 0 \ | |
75 | && ((EH)->elf.root.u.def.section->flags & SEC_CODE) == 0) | |
76 | ||
daf1c414 L |
77 | /* TRUE if dynamic relocation is needed. If we are creating a shared |
78 | library, and this is a reloc against a global symbol, or a non PC | |
79 | relative reloc against a local symbol, then we need to copy the reloc | |
80 | into the shared library. However, if we are linking with -Bsymbolic, | |
81 | we do not need to copy a reloc against a global symbol which is | |
82 | defined in an object we are including in the link (i.e., DEF_REGULAR | |
83 | is set). At this point we have not seen all the input files, so it | |
84 | is possible that DEF_REGULAR is not set now but will be set later (it | |
85 | is never cleared). In case of a weak definition, DEF_REGULAR may be | |
86 | cleared later by a strong definition in a shared library. We account | |
87 | for that possibility below by storing information in the relocs_copied | |
88 | field of the hash table entry. A similar situation occurs when | |
89 | creating shared libraries and symbol visibility changes render the | |
90 | symbol local. | |
91 | ||
92 | If on the other hand, we are creating an executable, we may need to | |
93 | keep relocations for symbols satisfied by a dynamic library if we | |
94 | manage to avoid copy relocs for the symbol. | |
95 | ||
96 | We also need to generate dynamic pointer relocation against | |
97 | STT_GNU_IFUNC symbol in the non-code section. */ | |
98 | #define NEED_DYNAMIC_RELOCATION_P(INFO, H, SEC, R_TYPE, POINTER_TYPE) \ | |
99 | ((bfd_link_pic (INFO) \ | |
100 | && (! X86_PCREL_TYPE_P (R_TYPE) \ | |
101 | || ((H) != NULL \ | |
102 | && (! (bfd_link_pie (INFO) \ | |
103 | || SYMBOLIC_BIND ((INFO), (H))) \ | |
104 | || (H)->root.type == bfd_link_hash_defweak \ | |
105 | || !(H)->def_regular)))) \ | |
106 | || ((H) != NULL \ | |
107 | && (H)->type == STT_GNU_IFUNC \ | |
108 | && (R_TYPE) == POINTER_TYPE \ | |
109 | && ((SEC)->flags & SEC_CODE) == 0) \ | |
110 | || (ELIMINATE_COPY_RELOCS \ | |
111 | && !bfd_link_pic (INFO) \ | |
112 | && (H) != NULL \ | |
113 | && ((H)->root.type == bfd_link_hash_defweak \ | |
114 | || !(H)->def_regular))) | |
115 | ||
2eba97c2 L |
116 | /* TRUE if this is actually a static link, or it is a -Bsymbolic link |
117 | and the symbol is defined locally, or the symbol was forced to be | |
118 | local because of a version file. */ | |
119 | #define RESOLVED_LOCALLY_P(INFO, H, HTAB) \ | |
120 | (!WILL_CALL_FINISH_DYNAMIC_SYMBOL ((HTAB)->elf.dynamic_sections_created, \ | |
121 | bfd_link_pic (INFO), (H)) \ | |
122 | || (bfd_link_pic (INFO) \ | |
123 | && SYMBOL_REFERENCES_LOCAL_P ((INFO), (H))) \ | |
124 | || (ELF_ST_VISIBILITY ((H)->other) \ | |
125 | && (H)->root.type == bfd_link_hash_undefweak)) | |
126 | ||
51537393 L |
127 | /* TRUE if TLS IE->LE transition is OK. */ |
128 | #define TLS_TRANSITION_IE_TO_LE_P(INFO, H, TLS_TYPE) \ | |
129 | (bfd_link_executable (INFO) \ | |
130 | && (H) != NULL \ | |
131 | && (H)->dynindx == -1 \ | |
132 | && (TLS_TYPE & GOT_TLS_IE)) | |
133 | ||
0afcef53 L |
134 | /* x86 ELF linker hash entry. */ |
135 | ||
136 | struct elf_x86_link_hash_entry | |
137 | { | |
138 | struct elf_link_hash_entry elf; | |
139 | ||
140 | /* Track dynamic relocs copied for this symbol. */ | |
141 | struct elf_dyn_relocs *dyn_relocs; | |
142 | ||
143 | unsigned char tls_type; | |
144 | ||
145 | /* TRUE if symbol has GOT or PLT relocations. */ | |
146 | unsigned int has_got_reloc : 1; | |
147 | ||
148 | /* TRUE if symbol has non-GOT/non-PLT relocations in text sections. */ | |
149 | unsigned int has_non_got_reloc : 1; | |
150 | ||
151 | /* Don't call finish_dynamic_symbol on this symbol. */ | |
152 | unsigned int no_finish_dynamic_symbol : 1; | |
153 | ||
154 | /* TRUE if symbol is __tls_get_addr. */ | |
155 | unsigned int tls_get_addr : 1; | |
156 | ||
157 | /* TRUE if symbol is defined as a protected symbol. */ | |
158 | unsigned int def_protected : 1; | |
159 | ||
6999821f L |
160 | /* 0: Symbol references are unknown. |
161 | 1: Symbol references aren't local. | |
162 | 2: Symbol references are local. | |
163 | */ | |
164 | unsigned int local_ref : 2; | |
165 | ||
0a27fed7 L |
166 | /* TRUE if symbol is defined by linker. */ |
167 | unsigned int linker_def : 1; | |
168 | ||
f47432d4 | 169 | /* TRUE if symbol is referenced by R_386_GOTOFF relocation. This is |
c7df954f | 170 | only used by i386. */ |
0afcef53 L |
171 | unsigned int gotoff_ref : 1; |
172 | ||
173 | /* TRUE if a weak symbol with a real definition needs a copy reloc. | |
174 | When there is a weak symbol with a real definition, the processor | |
175 | independent code will have arranged for us to see the real | |
176 | definition first. We need to copy the needs_copy bit from the | |
177 | real definition and check it when allowing copy reloc in PIE. This | |
178 | is only used by x86-64. */ | |
179 | unsigned int needs_copy : 1; | |
180 | ||
181 | /* Reference count of C/C++ function pointer relocations in read-write | |
182 | section which can be resolved at run-time. */ | |
183 | bfd_signed_vma func_pointer_refcount; | |
184 | ||
185 | /* Information about the GOT PLT entry. Filled when there are both | |
186 | GOT and PLT relocations against the same function. */ | |
187 | union gotplt_union plt_got; | |
188 | ||
189 | /* Information about the second PLT entry. */ | |
190 | union gotplt_union plt_second; | |
191 | ||
192 | /* Offset of the GOTPLT entry reserved for the TLS descriptor, | |
193 | starting at the end of the jump table. */ | |
194 | bfd_vma tlsdesc_got; | |
195 | }; | |
196 | ||
765e526c L |
197 | struct elf_x86_lazy_plt_layout |
198 | { | |
199 | /* The first entry in an absolute lazy procedure linkage table looks | |
200 | like this. */ | |
201 | const bfd_byte *plt0_entry; | |
202 | unsigned int plt0_entry_size; /* Size of PLT0 entry. */ | |
203 | ||
204 | /* Later entries in an absolute lazy procedure linkage table look | |
205 | like this. */ | |
206 | const bfd_byte *plt_entry; | |
207 | unsigned int plt_entry_size; /* Size of each PLT entry. */ | |
208 | ||
209 | /* Offsets into plt0_entry that are to be replaced with GOT[1] and | |
210 | GOT[2]. */ | |
211 | unsigned int plt0_got1_offset; | |
212 | unsigned int plt0_got2_offset; | |
213 | ||
214 | /* Offset of the end of the PC-relative instruction containing | |
215 | plt0_got2_offset. This is for x86-64 only. */ | |
216 | unsigned int plt0_got2_insn_end; | |
217 | ||
218 | /* Offsets into plt_entry that are to be replaced with... */ | |
219 | unsigned int plt_got_offset; /* ... address of this symbol in .got. */ | |
220 | unsigned int plt_reloc_offset; /* ... offset into relocation table. */ | |
221 | unsigned int plt_plt_offset; /* ... offset to start of .plt. */ | |
222 | ||
223 | /* Length of the PC-relative instruction containing plt_got_offset. | |
224 | This is used for x86-64 only. */ | |
225 | unsigned int plt_got_insn_size; | |
226 | ||
227 | /* Offset of the end of the PC-relative jump to plt0_entry. This is | |
228 | used for x86-64 only. */ | |
229 | unsigned int plt_plt_insn_end; | |
230 | ||
231 | /* Offset into plt_entry where the initial value of the GOT entry | |
232 | points. */ | |
233 | unsigned int plt_lazy_offset; | |
234 | ||
235 | /* The first entry in a PIC lazy procedure linkage table looks like | |
a6798bab | 236 | this. */ |
765e526c L |
237 | const bfd_byte *pic_plt0_entry; |
238 | ||
239 | /* Subsequent entries in a PIC lazy procedure linkage table look | |
a6798bab | 240 | like this. */ |
765e526c L |
241 | const bfd_byte *pic_plt_entry; |
242 | ||
243 | /* .eh_frame covering the lazy .plt section. */ | |
244 | const bfd_byte *eh_frame_plt; | |
245 | unsigned int eh_frame_plt_size; | |
246 | }; | |
247 | ||
248 | struct elf_x86_non_lazy_plt_layout | |
249 | { | |
250 | /* Entries in an absolute non-lazy procedure linkage table look like | |
251 | this. */ | |
252 | const bfd_byte *plt_entry; | |
a6798bab | 253 | /* Entries in a PIC non-lazy procedure linkage table look like this. */ |
765e526c L |
254 | const bfd_byte *pic_plt_entry; |
255 | ||
256 | unsigned int plt_entry_size; /* Size of each PLT entry. */ | |
257 | ||
258 | /* Offsets into plt_entry that are to be replaced with... */ | |
259 | unsigned int plt_got_offset; /* ... address of this symbol in .got. */ | |
260 | ||
261 | /* Length of the PC-relative instruction containing plt_got_offset. | |
262 | This is used for x86-64 only. */ | |
263 | unsigned int plt_got_insn_size; | |
264 | ||
265 | /* .eh_frame covering the non-lazy .plt section. */ | |
266 | const bfd_byte *eh_frame_plt; | |
267 | unsigned int eh_frame_plt_size; | |
268 | }; | |
269 | ||
270 | struct elf_x86_plt_layout | |
271 | { | |
272 | /* The first entry in a lazy procedure linkage table looks like this. | |
273 | This is only used for i386 where absolute PLT0 and PIC PLT0 are | |
274 | different. */ | |
275 | const bfd_byte *plt0_entry; | |
276 | /* Entries in a procedure linkage table look like this. */ | |
277 | const bfd_byte *plt_entry; | |
278 | unsigned int plt_entry_size; /* Size of each PLT entry. */ | |
279 | ||
280 | /* 1 has PLT0. */ | |
281 | unsigned int has_plt0; | |
282 | ||
283 | /* Offsets into plt_entry that are to be replaced with... */ | |
284 | unsigned int plt_got_offset; /* ... address of this symbol in .got. */ | |
285 | ||
286 | /* Length of the PC-relative instruction containing plt_got_offset. | |
287 | This is only used for x86-64. */ | |
288 | unsigned int plt_got_insn_size; | |
289 | ||
290 | /* .eh_frame covering the .plt section. */ | |
291 | const bfd_byte *eh_frame_plt; | |
292 | unsigned int eh_frame_plt_size; | |
293 | }; | |
294 | ||
6b9553e2 | 295 | /* Values in tls_type of x86 ELF linker hash entry. */ |
0afcef53 L |
296 | #define GOT_UNKNOWN 0 |
297 | #define GOT_NORMAL 1 | |
298 | #define GOT_TLS_GD 2 | |
6b9553e2 L |
299 | #define GOT_TLS_IE 4 |
300 | #define GOT_TLS_IE_POS 5 | |
301 | #define GOT_TLS_IE_NEG 6 | |
302 | #define GOT_TLS_IE_BOTH 7 | |
303 | #define GOT_TLS_GDESC 8 | |
304 | #define GOT_TLS_GD_BOTH_P(type) \ | |
305 | ((type) == (GOT_TLS_GD | GOT_TLS_GDESC)) | |
306 | #define GOT_TLS_GD_P(type) \ | |
307 | ((type) == GOT_TLS_GD || GOT_TLS_GD_BOTH_P (type)) | |
308 | #define GOT_TLS_GDESC_P(type) \ | |
309 | ((type) == GOT_TLS_GDESC || GOT_TLS_GD_BOTH_P (type)) | |
310 | #define GOT_TLS_GD_ANY_P(type) \ | |
311 | (GOT_TLS_GD_P (type) || GOT_TLS_GDESC_P (type)) | |
0afcef53 L |
312 | |
313 | #define elf_x86_hash_entry(ent) \ | |
314 | ((struct elf_x86_link_hash_entry *)(ent)) | |
315 | ||
316 | /* x86 ELF linker hash table. */ | |
317 | ||
318 | struct elf_x86_link_hash_table | |
319 | { | |
320 | struct elf_link_hash_table elf; | |
321 | ||
322 | /* Short-cuts to get to dynamic linker sections. */ | |
323 | asection *interp; | |
324 | asection *plt_eh_frame; | |
325 | asection *plt_second; | |
326 | asection *plt_second_eh_frame; | |
327 | asection *plt_got; | |
328 | asection *plt_got_eh_frame; | |
329 | ||
765e526c L |
330 | /* Parameters describing PLT generation, lazy or non-lazy. */ |
331 | struct elf_x86_plt_layout plt; | |
332 | ||
333 | /* Parameters describing lazy PLT generation. */ | |
334 | const struct elf_x86_lazy_plt_layout *lazy_plt; | |
335 | ||
336 | /* Parameters describing non-lazy PLT generation. */ | |
337 | const struct elf_x86_non_lazy_plt_layout *non_lazy_plt; | |
338 | ||
0afcef53 L |
339 | union |
340 | { | |
341 | bfd_signed_vma refcount; | |
342 | bfd_vma offset; | |
343 | } tls_ld_or_ldm_got; | |
344 | ||
345 | /* The amount of space used by the jump slots in the GOT. */ | |
346 | bfd_vma sgotplt_jump_table_size; | |
347 | ||
348 | /* Small local sym cache. */ | |
349 | struct sym_cache sym_cache; | |
350 | ||
351 | /* _TLS_MODULE_BASE_ symbol. */ | |
352 | struct bfd_link_hash_entry *tls_module_base; | |
353 | ||
354 | /* Used by local STT_GNU_IFUNC symbols. */ | |
355 | htab_t loc_hash_table; | |
356 | void * loc_hash_memory; | |
357 | ||
0afcef53 L |
358 | /* The offset into sgot of the GOT entry used by the PLT entry |
359 | above. */ | |
360 | bfd_vma tlsdesc_got; | |
361 | ||
362 | /* The index of the next R_X86_64_JUMP_SLOT entry in .rela.plt. */ | |
363 | bfd_vma next_jump_slot_index; | |
364 | /* The index of the next R_X86_64_IRELATIVE entry in .rela.plt. */ | |
365 | bfd_vma next_irelative_index; | |
366 | ||
367 | /* TRUE if there are dynamic relocs against IFUNC symbols that apply | |
368 | to read-only sections. */ | |
369 | bfd_boolean readonly_dynrelocs_against_ifunc; | |
370 | ||
2926eb2c L |
371 | /* TRUE if this is a VxWorks x86 target. This is only used for |
372 | i386. */ | |
eeb2f20a L |
373 | bfd_boolean is_vxworks; |
374 | ||
765e526c L |
375 | /* The (unloaded but important) .rel.plt.unloaded section on VxWorks. |
376 | This is used for i386 only. */ | |
377 | asection *srelplt2; | |
378 | ||
379 | /* The index of the next unused R_386_TLS_DESC slot in .rel.plt. This | |
2926eb2c | 380 | is only used for i386. */ |
765e526c L |
381 | bfd_vma next_tls_desc_index; |
382 | ||
2926eb2c L |
383 | /* The offset into splt of the PLT entry for the TLS descriptor |
384 | resolver. Special values are 0, if not necessary (or not found | |
385 | to be necessary yet), and -1 if needed but not determined | |
386 | yet. This is only used for x86-64. */ | |
387 | bfd_vma tlsdesc_plt; | |
388 | ||
0afcef53 L |
389 | bfd_vma (*r_info) (bfd_vma, bfd_vma); |
390 | bfd_vma (*r_sym) (bfd_vma); | |
5e2ac45d | 391 | bfd_boolean (*is_reloc_section) (const char *); |
fe53b4a4 | 392 | enum elf_target_id target_id; |
503294e7 | 393 | unsigned int sizeof_reloc; |
5e2ac45d L |
394 | unsigned int dt_reloc; |
395 | unsigned int dt_reloc_sz; | |
396 | unsigned int dt_reloc_ent; | |
9ff114ca | 397 | unsigned int got_entry_size; |
0afcef53 L |
398 | unsigned int pointer_r_type; |
399 | int dynamic_interpreter_size; | |
400 | const char *dynamic_interpreter; | |
401 | const char *tls_get_addr; | |
402 | }; | |
403 | ||
1de031c8 | 404 | struct elf_x86_init_table |
a6798bab L |
405 | { |
406 | /* The lazy PLT layout. */ | |
407 | const struct elf_x86_lazy_plt_layout *lazy_plt; | |
408 | ||
409 | /* The non-lazy PLT layout. */ | |
410 | const struct elf_x86_non_lazy_plt_layout *non_lazy_plt; | |
411 | ||
412 | /* The lazy PLT layout for IBT. */ | |
413 | const struct elf_x86_lazy_plt_layout *lazy_ibt_plt; | |
414 | ||
415 | /* The non-lazy PLT layout for IBT. */ | |
416 | const struct elf_x86_non_lazy_plt_layout *non_lazy_ibt_plt; | |
417 | ||
c6295c22 | 418 | /* TRUE if this is a normal x86 target. */ |
a6798bab L |
419 | bfd_boolean normal_target; |
420 | ||
421 | /* TRUE if this is a VxWorks x86 target. */ | |
422 | bfd_boolean is_vxworks; | |
7a382c1c L |
423 | |
424 | bfd_vma (*r_info) (bfd_vma, bfd_vma); | |
425 | bfd_vma (*r_sym) (bfd_vma); | |
a6798bab L |
426 | }; |
427 | ||
0afcef53 L |
428 | struct elf_x86_obj_tdata |
429 | { | |
430 | struct elf_obj_tdata root; | |
431 | ||
432 | /* tls_type for each local got entry. */ | |
433 | char *local_got_tls_type; | |
434 | ||
435 | /* GOTPLT entries for TLS descriptors. */ | |
436 | bfd_vma *local_tlsdesc_gotent; | |
437 | }; | |
438 | ||
f493882d L |
439 | enum elf_x86_plt_type |
440 | { | |
441 | plt_non_lazy = 0, | |
442 | plt_lazy = 1 << 0, | |
443 | plt_pic = 1 << 1, | |
444 | plt_second = 1 << 2, | |
445 | plt_unknown = -1 | |
446 | }; | |
447 | ||
448 | struct elf_x86_plt | |
449 | { | |
450 | const char *name; | |
451 | asection *sec; | |
452 | bfd_byte *contents; | |
453 | enum elf_x86_plt_type type; | |
454 | unsigned int plt_got_offset; | |
455 | unsigned int plt_entry_size; | |
456 | unsigned int plt_got_insn_size; /* Only used for x86-64. */ | |
457 | long count; | |
458 | }; | |
459 | ||
0afcef53 L |
460 | #define elf_x86_tdata(abfd) \ |
461 | ((struct elf_x86_obj_tdata *) (abfd)->tdata.any) | |
462 | ||
463 | #define elf_x86_local_got_tls_type(abfd) \ | |
464 | (elf_x86_tdata (abfd)->local_got_tls_type) | |
465 | ||
466 | #define elf_x86_local_tlsdesc_gotent(abfd) \ | |
467 | (elf_x86_tdata (abfd)->local_tlsdesc_gotent) | |
468 | ||
9ff114ca L |
469 | #define elf_x86_compute_jump_table_size(htab) \ |
470 | ((htab)->elf.srelplt->reloc_count * (htab)->got_entry_size) | |
471 | ||
fe53b4a4 L |
472 | #define is_x86_elf(bfd, htab) \ |
473 | (bfd_get_flavour (bfd) == bfd_target_elf_flavour \ | |
474 | && elf_tdata (bfd) != NULL \ | |
475 | && elf_object_id (bfd) == (htab)->target_id) | |
476 | ||
39946cc2 L |
477 | extern bfd_boolean _bfd_x86_elf_mkobject |
478 | (bfd *); | |
479 | ||
0afcef53 L |
480 | extern void _bfd_x86_elf_set_tls_module_base |
481 | (struct bfd_link_info *); | |
482 | ||
483 | extern bfd_vma _bfd_x86_elf_dtpoff_base | |
484 | (struct bfd_link_info *); | |
485 | ||
486 | extern bfd_boolean _bfd_x86_elf_readonly_dynrelocs | |
487 | (struct elf_link_hash_entry *, void *); | |
488 | ||
489 | extern struct elf_link_hash_entry * _bfd_elf_x86_get_local_sym_hash | |
490 | (struct elf_x86_link_hash_table *, bfd *, const Elf_Internal_Rela *, | |
491 | bfd_boolean); | |
492 | ||
493 | extern hashval_t _bfd_x86_elf_local_htab_hash | |
494 | (const void *); | |
495 | ||
496 | extern int _bfd_x86_elf_local_htab_eq | |
497 | (const void *, const void *); | |
498 | ||
499 | extern struct bfd_hash_entry * _bfd_x86_elf_link_hash_newfunc | |
500 | (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); | |
501 | ||
765e526c | 502 | extern struct bfd_link_hash_table * _bfd_x86_elf_link_hash_table_create |
0afcef53 L |
503 | (bfd *); |
504 | ||
505 | extern int _bfd_x86_elf_compare_relocs | |
506 | (const void *, const void *); | |
507 | ||
508 | extern bfd_boolean _bfd_x86_elf_link_check_relocs | |
509 | (bfd *, struct bfd_link_info *); | |
510 | ||
5e2ac45d L |
511 | extern bfd_boolean _bfd_x86_elf_size_dynamic_sections |
512 | (bfd *, struct bfd_link_info *); | |
513 | ||
0afcef53 L |
514 | extern bfd_boolean _bfd_x86_elf_always_size_sections |
515 | (bfd *, struct bfd_link_info *); | |
516 | ||
517 | extern void _bfd_x86_elf_merge_symbol_attribute | |
518 | (struct elf_link_hash_entry *, const Elf_Internal_Sym *, | |
519 | bfd_boolean, bfd_boolean); | |
520 | ||
521 | extern void _bfd_x86_elf_copy_indirect_symbol | |
522 | (struct bfd_link_info *, struct elf_link_hash_entry *, | |
523 | struct elf_link_hash_entry *); | |
524 | ||
525 | extern bfd_boolean _bfd_x86_elf_fixup_symbol | |
526 | (struct bfd_link_info *, struct elf_link_hash_entry *); | |
527 | ||
528 | extern bfd_boolean _bfd_x86_elf_hash_symbol | |
529 | (struct elf_link_hash_entry *); | |
530 | ||
eeb2f20a L |
531 | extern bfd_boolean _bfd_x86_elf_adjust_dynamic_symbol |
532 | (struct bfd_link_info *, struct elf_link_hash_entry *); | |
533 | ||
6999821f L |
534 | extern bfd_boolean _bfd_x86_elf_link_symbol_references_local |
535 | (struct bfd_link_info *, struct elf_link_hash_entry *); | |
536 | ||
4f501a24 L |
537 | extern asection * _bfd_x86_elf_gc_mark_hook |
538 | (asection *, struct bfd_link_info *, Elf_Internal_Rela *, | |
539 | struct elf_link_hash_entry *, Elf_Internal_Sym *); | |
540 | ||
f493882d L |
541 | extern long _bfd_x86_elf_get_synthetic_symtab |
542 | (bfd *, long, long, bfd_vma, struct elf_x86_plt [], asymbol **, | |
543 | asymbol **); | |
544 | ||
0afcef53 L |
545 | extern enum elf_property_kind _bfd_x86_elf_parse_gnu_properties |
546 | (bfd *, unsigned int, bfd_byte *, unsigned int); | |
547 | ||
548 | extern bfd_boolean _bfd_x86_elf_merge_gnu_properties | |
549 | (struct bfd_link_info *, bfd *, elf_property *, elf_property *); | |
550 | ||
a6798bab | 551 | extern bfd * _bfd_x86_elf_link_setup_gnu_properties |
1de031c8 | 552 | (struct bfd_link_info *, struct elf_x86_init_table *); |
a6798bab | 553 | |
39946cc2 L |
554 | #define bfd_elf64_mkobject \ |
555 | _bfd_x86_elf_mkobject | |
556 | #define bfd_elf32_mkobject \ | |
557 | _bfd_x86_elf_mkobject | |
765e526c L |
558 | #define bfd_elf64_bfd_link_hash_table_create \ |
559 | _bfd_x86_elf_link_hash_table_create | |
560 | #define bfd_elf32_bfd_link_hash_table_create \ | |
561 | _bfd_x86_elf_link_hash_table_create | |
0afcef53 L |
562 | #define bfd_elf64_bfd_link_check_relocs \ |
563 | _bfd_x86_elf_link_check_relocs | |
564 | #define bfd_elf32_bfd_link_check_relocs \ | |
565 | _bfd_x86_elf_link_check_relocs | |
566 | ||
5e2ac45d L |
567 | #define elf_backend_size_dynamic_sections \ |
568 | _bfd_x86_elf_size_dynamic_sections | |
0afcef53 L |
569 | #define elf_backend_always_size_sections \ |
570 | _bfd_x86_elf_always_size_sections | |
571 | #define elf_backend_merge_symbol_attribute \ | |
572 | _bfd_x86_elf_merge_symbol_attribute | |
573 | #define elf_backend_copy_indirect_symbol \ | |
574 | _bfd_x86_elf_copy_indirect_symbol | |
575 | #define elf_backend_fixup_symbol \ | |
576 | _bfd_x86_elf_fixup_symbol | |
577 | #define elf_backend_hash_symbol \ | |
578 | _bfd_x86_elf_hash_symbol | |
eeb2f20a L |
579 | #define elf_backend_adjust_dynamic_symbol \ |
580 | _bfd_x86_elf_adjust_dynamic_symbol | |
4f501a24 L |
581 | #define elf_backend_gc_mark_hook \ |
582 | _bfd_x86_elf_gc_mark_hook | |
0afcef53 L |
583 | #define elf_backend_omit_section_dynsym \ |
584 | ((bfd_boolean (*) (bfd *, struct bfd_link_info *, asection *)) bfd_true) | |
585 | #define elf_backend_parse_gnu_properties \ | |
586 | _bfd_x86_elf_parse_gnu_properties | |
587 | #define elf_backend_merge_gnu_properties \ | |
588 | _bfd_x86_elf_merge_gnu_properties |