2007-03-13 H.J. Lu <hongjiu.lu@intel.com>
[external/binutils.git] / bfd / elfxx-target.h
1 /* Target definitions for NN-bit ELF
2    Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
3    2003, 2004, 2005, 2006 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 2 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, write to the Free Software
19    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
20
21 /* This structure contains everything that BFD knows about a target.
22    It includes things like its byte order, name, what routines to call
23    to do various operations, etc.  Every BFD points to a target structure
24    with its "xvec" member.
25
26    There are two such structures here:  one for big-endian machines and
27    one for little-endian machines.   */
28
29 #ifndef bfd_elfNN_close_and_cleanup
30 #define bfd_elfNN_close_and_cleanup _bfd_elf_close_and_cleanup
31 #endif
32 #ifndef bfd_elfNN_bfd_free_cached_info
33 #define bfd_elfNN_bfd_free_cached_info _bfd_free_cached_info
34 #endif
35 #ifndef bfd_elfNN_get_section_contents
36 #define bfd_elfNN_get_section_contents _bfd_generic_get_section_contents
37 #endif
38
39 #define bfd_elfNN_canonicalize_dynamic_symtab \
40   _bfd_elf_canonicalize_dynamic_symtab
41 #ifndef bfd_elfNN_get_synthetic_symtab
42 #define bfd_elfNN_get_synthetic_symtab \
43   _bfd_elf_get_synthetic_symtab
44 #endif
45 #ifndef bfd_elfNN_canonicalize_reloc
46 #define bfd_elfNN_canonicalize_reloc    _bfd_elf_canonicalize_reloc
47 #endif
48 #ifndef bfd_elfNN_find_nearest_line
49 #define bfd_elfNN_find_nearest_line     _bfd_elf_find_nearest_line
50 #endif
51 #ifndef bfd_elfNN_find_inliner_info
52 #define bfd_elfNN_find_inliner_info     _bfd_elf_find_inliner_info
53 #endif
54 #define bfd_elfNN_read_minisymbols      _bfd_elf_read_minisymbols
55 #define bfd_elfNN_minisymbol_to_symbol  _bfd_elf_minisymbol_to_symbol
56 #define bfd_elfNN_get_dynamic_symtab_upper_bound \
57   _bfd_elf_get_dynamic_symtab_upper_bound
58 #define bfd_elfNN_get_lineno            _bfd_elf_get_lineno
59 #ifndef bfd_elfNN_get_reloc_upper_bound
60 #define bfd_elfNN_get_reloc_upper_bound _bfd_elf_get_reloc_upper_bound
61 #endif
62 #ifndef bfd_elfNN_get_symbol_info
63 #define bfd_elfNN_get_symbol_info       _bfd_elf_get_symbol_info
64 #endif
65 #define bfd_elfNN_canonicalize_symtab   _bfd_elf_canonicalize_symtab
66 #define bfd_elfNN_get_symtab_upper_bound _bfd_elf_get_symtab_upper_bound
67 #define bfd_elfNN_make_empty_symbol     _bfd_elf_make_empty_symbol
68 #ifndef bfd_elfNN_new_section_hook
69 #define bfd_elfNN_new_section_hook      _bfd_elf_new_section_hook
70 #endif
71 #define bfd_elfNN_set_arch_mach         _bfd_elf_set_arch_mach
72 #ifndef bfd_elfNN_set_section_contents
73 #define bfd_elfNN_set_section_contents  _bfd_elf_set_section_contents
74 #endif
75 #define bfd_elfNN_sizeof_headers        _bfd_elf_sizeof_headers
76 #define bfd_elfNN_write_object_contents _bfd_elf_write_object_contents
77 #define bfd_elfNN_write_corefile_contents _bfd_elf_write_corefile_contents
78
79 #define bfd_elfNN_get_section_contents_in_window \
80   _bfd_generic_get_section_contents_in_window
81
82 #ifndef elf_backend_can_refcount
83 #define elf_backend_can_refcount 0
84 #endif
85 #ifndef elf_backend_want_got_plt
86 #define elf_backend_want_got_plt 0
87 #endif
88 #ifndef elf_backend_plt_readonly
89 #define elf_backend_plt_readonly 0
90 #endif
91 #ifndef elf_backend_want_plt_sym
92 #define elf_backend_want_plt_sym 0
93 #endif
94 #ifndef elf_backend_plt_not_loaded
95 #define elf_backend_plt_not_loaded 0
96 #endif
97 #ifndef elf_backend_plt_alignment
98 #define elf_backend_plt_alignment 2
99 #endif
100 #ifndef elf_backend_want_dynbss
101 #define elf_backend_want_dynbss 1
102 #endif
103 #ifndef elf_backend_want_p_paddr_set_to_zero
104 #define elf_backend_want_p_paddr_set_to_zero 0
105 #endif
106 #ifndef elf_backend_default_execstack
107 #define elf_backend_default_execstack 1
108 #endif
109
110 #define bfd_elfNN_bfd_debug_info_start  bfd_void
111 #define bfd_elfNN_bfd_debug_info_end    bfd_void
112 #define bfd_elfNN_bfd_debug_info_accumulate \
113   ((void (*) (bfd*, struct bfd_section *)) bfd_void)
114
115 #ifndef bfd_elfNN_bfd_get_relocated_section_contents
116 #define bfd_elfNN_bfd_get_relocated_section_contents \
117   bfd_generic_get_relocated_section_contents
118 #endif
119
120 #ifndef bfd_elfNN_bfd_relax_section
121 #define bfd_elfNN_bfd_relax_section bfd_generic_relax_section
122 #endif
123
124 #ifndef elf_backend_can_gc_sections
125 #define elf_backend_can_gc_sections 0
126 #endif
127 #ifndef elf_backend_can_refcount
128 #define elf_backend_can_refcount 0
129 #endif
130 #ifndef elf_backend_want_got_sym
131 #define elf_backend_want_got_sym 1
132 #endif
133 #ifndef elf_backend_gc_mark_dynamic_ref
134 #define elf_backend_gc_mark_dynamic_ref bfd_elf_gc_mark_dynamic_ref_symbol
135 #endif
136 #ifndef elf_backend_gc_mark_hook
137 #define elf_backend_gc_mark_hook        _bfd_elf_gc_mark_hook
138 #endif
139 #ifndef elf_backend_gc_mark_extra_sections
140 #define elf_backend_gc_mark_extra_sections      NULL
141 #endif
142 #ifndef elf_backend_gc_sweep_hook
143 #define elf_backend_gc_sweep_hook       NULL
144 #endif
145 #ifndef bfd_elfNN_bfd_gc_sections
146 #define bfd_elfNN_bfd_gc_sections bfd_elf_gc_sections
147 #endif
148
149 #ifndef bfd_elfNN_bfd_merge_sections
150 #define bfd_elfNN_bfd_merge_sections \
151   _bfd_elf_merge_sections
152 #endif
153
154 #ifndef bfd_elfNN_bfd_is_group_section
155 #define bfd_elfNN_bfd_is_group_section bfd_elf_is_group_section
156 #endif
157
158 #ifndef bfd_elfNN_bfd_discard_group
159 #define bfd_elfNN_bfd_discard_group bfd_generic_discard_group
160 #endif
161
162 #ifndef bfd_elfNN_section_already_linked
163 #define bfd_elfNN_section_already_linked \
164   _bfd_elf_section_already_linked
165 #endif
166
167 #ifndef bfd_elfNN_bfd_make_debug_symbol
168 #define bfd_elfNN_bfd_make_debug_symbol \
169   ((asymbol * (*) (bfd *, void *, unsigned long)) bfd_nullvoidptr)
170 #endif
171
172 #ifndef bfd_elfNN_bfd_copy_private_symbol_data
173 #define bfd_elfNN_bfd_copy_private_symbol_data \
174   _bfd_elf_copy_private_symbol_data
175 #endif
176
177 #ifndef bfd_elfNN_bfd_copy_private_section_data
178 #define bfd_elfNN_bfd_copy_private_section_data \
179   _bfd_elf_copy_private_section_data
180 #endif
181 #ifndef bfd_elfNN_bfd_copy_private_header_data
182 #define bfd_elfNN_bfd_copy_private_header_data \
183   _bfd_elf_copy_private_header_data
184 #endif
185 #ifndef bfd_elfNN_bfd_copy_private_bfd_data
186 #define bfd_elfNN_bfd_copy_private_bfd_data \
187   _bfd_elf_copy_private_bfd_data
188 #endif
189 #ifndef bfd_elfNN_bfd_print_private_bfd_data
190 #define bfd_elfNN_bfd_print_private_bfd_data \
191   _bfd_elf_print_private_bfd_data
192 #endif
193 #ifndef bfd_elfNN_bfd_merge_private_bfd_data
194 #define bfd_elfNN_bfd_merge_private_bfd_data \
195   ((bfd_boolean (*) (bfd *, bfd *)) bfd_true)
196 #endif
197 #ifndef bfd_elfNN_bfd_set_private_flags
198 #define bfd_elfNN_bfd_set_private_flags \
199   ((bfd_boolean (*) (bfd *, flagword)) bfd_true)
200 #endif
201 #ifndef bfd_elfNN_bfd_is_local_label_name
202 #define bfd_elfNN_bfd_is_local_label_name _bfd_elf_is_local_label_name
203 #endif
204 #ifndef bfd_elfNN_bfd_is_target_special_symbol
205 #define bfd_elfNN_bfd_is_target_special_symbol \
206   ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
207 #endif
208
209 #ifndef bfd_elfNN_get_dynamic_reloc_upper_bound
210 #define bfd_elfNN_get_dynamic_reloc_upper_bound \
211   _bfd_elf_get_dynamic_reloc_upper_bound
212 #endif
213 #ifndef bfd_elfNN_canonicalize_dynamic_reloc
214 #define bfd_elfNN_canonicalize_dynamic_reloc \
215   _bfd_elf_canonicalize_dynamic_reloc
216 #endif
217
218 #ifndef bfd_elfNN_bfd_link_hash_table_free
219 #define bfd_elfNN_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
220 #endif
221
222 #ifdef elf_backend_relocate_section
223 #ifndef bfd_elfNN_bfd_link_hash_table_create
224 #define bfd_elfNN_bfd_link_hash_table_create _bfd_elf_link_hash_table_create
225 #endif
226 #ifndef bfd_elfNN_bfd_link_add_symbols
227 #define bfd_elfNN_bfd_link_add_symbols  bfd_elf_link_add_symbols
228 #endif
229 #ifndef bfd_elfNN_bfd_final_link
230 #define bfd_elfNN_bfd_final_link        bfd_elf_final_link
231 #endif
232 #else /* ! defined (elf_backend_relocate_section) */
233 /* If no backend relocate_section routine, use the generic linker.
234    Note - this will prevent the port from being able to use some of
235    the other features of the ELF linker, because the generic hash structure
236    does not have the fields needed by the ELF linker.  In particular it
237    means that linking directly to S-records will not work.  */
238 #ifndef bfd_elfNN_bfd_link_hash_table_create
239 #define bfd_elfNN_bfd_link_hash_table_create \
240   _bfd_generic_link_hash_table_create
241 #endif
242 #ifndef bfd_elfNN_bfd_link_add_symbols
243 #define bfd_elfNN_bfd_link_add_symbols  _bfd_generic_link_add_symbols
244 #endif
245 #ifndef bfd_elfNN_bfd_final_link
246 #define bfd_elfNN_bfd_final_link        _bfd_generic_final_link
247 #endif
248 #endif /* ! defined (elf_backend_relocate_section) */
249
250 #ifndef bfd_elfNN_bfd_link_just_syms
251 #define bfd_elfNN_bfd_link_just_syms    _bfd_elf_link_just_syms
252 #endif
253
254 #ifndef bfd_elfNN_bfd_link_split_section
255 #define bfd_elfNN_bfd_link_split_section _bfd_generic_link_split_section
256 #endif
257
258 #ifndef bfd_elfNN_archive_p
259 #define bfd_elfNN_archive_p bfd_generic_archive_p
260 #endif
261
262 #ifndef bfd_elfNN_write_archive_contents
263 #define bfd_elfNN_write_archive_contents _bfd_write_archive_contents
264 #endif
265
266 #ifndef bfd_elfNN_mkobject
267 #define bfd_elfNN_mkobject bfd_elf_mkobject
268 #endif
269
270 #ifndef bfd_elfNN_mkcorefile
271 #define bfd_elfNN_mkcorefile bfd_elf_mkcorefile
272 #endif
273
274 #ifndef bfd_elfNN_mkarchive
275 #define bfd_elfNN_mkarchive _bfd_generic_mkarchive
276 #endif
277
278 #ifndef bfd_elfNN_print_symbol
279 #define bfd_elfNN_print_symbol bfd_elf_print_symbol
280 #endif
281
282 #ifndef elf_symbol_leading_char
283 #define elf_symbol_leading_char 0
284 #endif
285
286 #ifndef elf_info_to_howto
287 #define elf_info_to_howto 0
288 #endif
289
290 #ifndef elf_info_to_howto_rel
291 #define elf_info_to_howto_rel 0
292 #endif
293
294 #ifndef ELF_OSABI
295 #define ELF_OSABI ELFOSABI_NONE
296 #endif
297
298 #ifndef ELF_MAXPAGESIZE
299   #error ELF_MAXPAGESIZE is not defined
300 #define ELF_MAXPAGESIZE 1
301 #endif
302
303 #ifndef ELF_MINPAGESIZE
304 #define ELF_MINPAGESIZE ELF_MAXPAGESIZE
305 #endif
306
307 #ifndef ELF_COMMONPAGESIZE
308 #define ELF_COMMONPAGESIZE ELF_MAXPAGESIZE
309 #endif
310
311 #ifndef ELF_DYNAMIC_SEC_FLAGS
312 /* Note that we set the SEC_IN_MEMORY flag for these sections.  */
313 #define ELF_DYNAMIC_SEC_FLAGS                   \
314   (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS      \
315    | SEC_IN_MEMORY | SEC_LINKER_CREATED)
316 #endif
317
318 #ifndef elf_backend_collect
319 #define elf_backend_collect FALSE
320 #endif
321 #ifndef elf_backend_type_change_ok
322 #define elf_backend_type_change_ok FALSE
323 #endif
324
325 #ifndef elf_backend_sym_is_global
326 #define elf_backend_sym_is_global       0
327 #endif
328 #ifndef elf_backend_object_p
329 #define elf_backend_object_p            0
330 #endif
331 #ifndef elf_backend_symbol_processing
332 #define elf_backend_symbol_processing   0
333 #endif
334 #ifndef elf_backend_symbol_table_processing
335 #define elf_backend_symbol_table_processing     0
336 #endif
337 #ifndef elf_backend_get_symbol_type
338 #define elf_backend_get_symbol_type 0
339 #endif
340 #ifndef elf_backend_archive_symbol_lookup
341 #define elf_backend_archive_symbol_lookup _bfd_elf_archive_symbol_lookup
342 #endif
343 #ifndef elf_backend_name_local_section_symbols
344 #define elf_backend_name_local_section_symbols  0
345 #endif
346 #ifndef elf_backend_section_processing
347 #define elf_backend_section_processing  0
348 #endif
349 #ifndef elf_backend_section_from_shdr
350 #define elf_backend_section_from_shdr   _bfd_elf_make_section_from_shdr
351 #endif
352 #ifndef elf_backend_section_flags
353 #define elf_backend_section_flags       0
354 #endif
355 #ifndef elf_backend_get_sec_type_attr
356 #define elf_backend_get_sec_type_attr   _bfd_elf_get_sec_type_attr
357 #endif
358 #ifndef elf_backend_section_from_phdr
359 #define elf_backend_section_from_phdr   _bfd_elf_make_section_from_phdr
360 #endif
361 #ifndef elf_backend_fake_sections
362 #define elf_backend_fake_sections       0
363 #endif
364 #ifndef elf_backend_section_from_bfd_section
365 #define elf_backend_section_from_bfd_section    0
366 #endif
367 #ifndef elf_backend_add_symbol_hook
368 #define elf_backend_add_symbol_hook     0
369 #endif
370 #ifndef elf_backend_link_output_symbol_hook
371 #define elf_backend_link_output_symbol_hook 0
372 #endif
373 #ifndef elf_backend_create_dynamic_sections
374 #define elf_backend_create_dynamic_sections 0
375 #endif
376 #ifndef elf_backend_omit_section_dynsym
377 #define elf_backend_omit_section_dynsym _bfd_elf_link_omit_section_dynsym
378 #endif
379 #ifndef elf_backend_check_relocs
380 #define elf_backend_check_relocs        0
381 #endif
382 #ifndef elf_backend_check_directives
383 #define elf_backend_check_directives    0
384 #endif
385 #ifndef elf_backend_as_needed_cleanup
386 #define elf_backend_as_needed_cleanup   0
387 #endif
388 #ifndef elf_backend_adjust_dynamic_symbol
389 #define elf_backend_adjust_dynamic_symbol 0
390 #endif
391 #ifndef elf_backend_always_size_sections
392 #define elf_backend_always_size_sections 0
393 #endif
394 #ifndef elf_backend_size_dynamic_sections
395 #define elf_backend_size_dynamic_sections 0
396 #endif
397 #ifndef elf_backend_init_index_section
398 #define elf_backend_init_index_section \
399  ((void (*) (bfd *, struct bfd_link_info *)) bfd_void)
400 #endif
401 #ifndef elf_backend_relocate_section
402 #define elf_backend_relocate_section    0
403 #endif
404 #ifndef elf_backend_finish_dynamic_symbol
405 #define elf_backend_finish_dynamic_symbol       0
406 #endif
407 #ifndef elf_backend_finish_dynamic_sections
408 #define elf_backend_finish_dynamic_sections     0
409 #endif
410 #ifndef elf_backend_begin_write_processing
411 #define elf_backend_begin_write_processing      0
412 #endif
413 #ifndef elf_backend_final_write_processing
414 #define elf_backend_final_write_processing      0
415 #endif
416 #ifndef elf_backend_additional_program_headers
417 #define elf_backend_additional_program_headers  0
418 #endif
419 #ifndef elf_backend_modify_segment_map
420 #define elf_backend_modify_segment_map  0
421 #endif
422 #ifndef elf_backend_modify_program_headers
423 #define elf_backend_modify_program_headers      0
424 #endif
425 #ifndef elf_backend_ecoff_debug_swap
426 #define elf_backend_ecoff_debug_swap    0
427 #endif
428 #ifndef elf_backend_bfd_from_remote_memory
429 #define elf_backend_bfd_from_remote_memory _bfd_elfNN_bfd_from_remote_memory
430 #endif
431 #ifndef elf_backend_got_header_size
432 #define elf_backend_got_header_size     0
433 #endif
434 #ifndef elf_backend_post_process_headers
435 #define elf_backend_post_process_headers        NULL
436 #endif
437 #ifndef elf_backend_print_symbol_all
438 #define elf_backend_print_symbol_all            NULL
439 #endif
440 #ifndef elf_backend_output_arch_local_syms
441 #define elf_backend_output_arch_local_syms      NULL
442 #endif
443 #ifndef elf_backend_output_arch_syms
444 #define elf_backend_output_arch_syms            NULL
445 #endif
446 #ifndef elf_backend_copy_indirect_symbol
447 #define elf_backend_copy_indirect_symbol  _bfd_elf_link_hash_copy_indirect
448 #endif
449 #ifndef elf_backend_hide_symbol
450 #define elf_backend_hide_symbol         _bfd_elf_link_hash_hide_symbol
451 #endif
452 #ifndef elf_backend_fixup_symbol
453 #define elf_backend_fixup_symbol                NULL    
454 #endif
455 #ifndef elf_backend_merge_symbol_attribute
456 #define elf_backend_merge_symbol_attribute      NULL
457 #endif
458 #ifndef elf_backend_ignore_undef_symbol
459 #define elf_backend_ignore_undef_symbol         NULL
460 #endif
461 #ifndef elf_backend_emit_relocs
462 #define elf_backend_emit_relocs                 _bfd_elf_link_output_relocs
463 #endif
464 #ifndef elf_backend_count_relocs
465 #define elf_backend_count_relocs                NULL
466 #endif
467 #ifndef elf_backend_grok_prstatus
468 #define elf_backend_grok_prstatus               NULL
469 #endif
470 #ifndef elf_backend_grok_psinfo
471 #define elf_backend_grok_psinfo                 NULL
472 #endif
473 #ifndef elf_backend_write_core_note
474 #define elf_backend_write_core_note             NULL
475 #endif
476 #ifndef elf_backend_sprintf_vma
477 #define elf_backend_sprintf_vma                 _bfd_elf_sprintf_vma
478 #endif
479 #ifndef elf_backend_fprintf_vma
480 #define elf_backend_fprintf_vma                 _bfd_elf_fprintf_vma
481 #endif
482 #ifndef elf_backend_reloc_type_class
483 #define elf_backend_reloc_type_class            _bfd_elf_reloc_type_class
484 #endif
485 #ifndef elf_backend_discard_info
486 #define elf_backend_discard_info                NULL
487 #endif
488 #ifndef elf_backend_ignore_discarded_relocs
489 #define elf_backend_ignore_discarded_relocs     NULL
490 #endif
491 #ifndef elf_backend_action_discarded
492 #define elf_backend_action_discarded _bfd_elf_default_action_discarded
493 #endif
494 #ifndef elf_backend_eh_frame_address_size
495 #define elf_backend_eh_frame_address_size _bfd_elf_eh_frame_address_size
496 #endif
497 #ifndef elf_backend_can_make_relative_eh_frame
498 #define elf_backend_can_make_relative_eh_frame  _bfd_elf_can_make_relative
499 #endif
500 #ifndef elf_backend_can_make_lsda_relative_eh_frame
501 #define elf_backend_can_make_lsda_relative_eh_frame     _bfd_elf_can_make_relative
502 #endif
503 #ifndef elf_backend_encode_eh_address
504 #define elf_backend_encode_eh_address           _bfd_elf_encode_eh_address
505 #endif
506 #ifndef elf_backend_write_section
507 #define elf_backend_write_section               NULL
508 #endif
509 #ifndef elf_backend_mips_irix_compat
510 #define elf_backend_mips_irix_compat            NULL
511 #endif
512 #ifndef elf_backend_mips_rtype_to_howto
513 #define elf_backend_mips_rtype_to_howto         NULL
514 #endif
515
516 /* Previously, backends could only use SHT_REL or SHT_RELA relocation
517    sections, but not both.  They defined USE_REL to indicate SHT_REL
518    sections, and left it undefined to indicated SHT_RELA sections.
519    For backwards compatibility, we still support this usage.  */
520 #ifndef USE_REL
521 #define USE_REL 0
522 #endif
523
524 /* Use these in new code.  */
525 #ifndef elf_backend_may_use_rel_p
526 #define elf_backend_may_use_rel_p USE_REL
527 #endif
528 #ifndef elf_backend_may_use_rela_p
529 #define elf_backend_may_use_rela_p !USE_REL
530 #endif
531 #ifndef elf_backend_default_use_rela_p
532 #define elf_backend_default_use_rela_p !USE_REL
533 #endif
534
535 #ifndef elf_backend_rela_normal
536 #define elf_backend_rela_normal 0
537 #endif
538
539 #ifndef elf_backend_plt_sym_val
540 #define elf_backend_plt_sym_val NULL
541 #endif
542 #ifndef elf_backend_relplt_name
543 #define elf_backend_relplt_name NULL
544 #endif
545
546 #ifndef ELF_MACHINE_ALT1
547 #define ELF_MACHINE_ALT1 0
548 #endif
549
550 #ifndef ELF_MACHINE_ALT2
551 #define ELF_MACHINE_ALT2 0
552 #endif
553
554 #ifndef elf_backend_size_info
555 #define elf_backend_size_info _bfd_elfNN_size_info
556 #endif
557
558 #ifndef elf_backend_special_sections
559 #define elf_backend_special_sections NULL
560 #endif
561
562 #ifndef elf_backend_sign_extend_vma
563 #define elf_backend_sign_extend_vma 0
564 #endif
565
566 #ifndef elf_backend_link_order_error_handler
567 #define elf_backend_link_order_error_handler _bfd_default_error_handler
568 #endif
569
570 #ifndef elf_backend_common_definition
571 #define elf_backend_common_definition _bfd_elf_common_definition
572 #endif
573
574 #ifndef elf_backend_common_section_index
575 #define elf_backend_common_section_index _bfd_elf_common_section_index
576 #endif
577
578 #ifndef elf_backend_common_section
579 #define elf_backend_common_section _bfd_elf_common_section
580 #endif
581
582 #ifndef elf_backend_merge_symbol
583 #define elf_backend_merge_symbol NULL
584 #endif
585
586 #ifndef elf_backend_hash_symbol
587 #define elf_backend_hash_symbol _bfd_elf_hash_symbol
588 #endif
589
590 extern const struct elf_size_info _bfd_elfNN_size_info;
591
592 static struct elf_backend_data elfNN_bed =
593 {
594   ELF_ARCH,                     /* arch */
595   ELF_MACHINE_CODE,             /* elf_machine_code */
596   ELF_OSABI,                    /* elf_osabi  */
597   ELF_MAXPAGESIZE,              /* maxpagesize */
598   ELF_MINPAGESIZE,              /* minpagesize */
599   ELF_COMMONPAGESIZE,           /* commonpagesize */
600   ELF_DYNAMIC_SEC_FLAGS,        /* dynamic_sec_flags */
601   elf_info_to_howto,
602   elf_info_to_howto_rel,
603   elf_backend_sym_is_global,
604   elf_backend_object_p,
605   elf_backend_symbol_processing,
606   elf_backend_symbol_table_processing,
607   elf_backend_get_symbol_type,
608   elf_backend_archive_symbol_lookup,
609   elf_backend_name_local_section_symbols,
610   elf_backend_section_processing,
611   elf_backend_section_from_shdr,
612   elf_backend_section_flags,
613   elf_backend_get_sec_type_attr,
614   elf_backend_section_from_phdr,
615   elf_backend_fake_sections,
616   elf_backend_section_from_bfd_section,
617   elf_backend_add_symbol_hook,
618   elf_backend_link_output_symbol_hook,
619   elf_backend_create_dynamic_sections,
620   elf_backend_omit_section_dynsym,
621   elf_backend_check_relocs,
622   elf_backend_check_directives,
623   elf_backend_as_needed_cleanup,
624   elf_backend_adjust_dynamic_symbol,
625   elf_backend_always_size_sections,
626   elf_backend_size_dynamic_sections,
627   elf_backend_init_index_section,
628   elf_backend_relocate_section,
629   elf_backend_finish_dynamic_symbol,
630   elf_backend_finish_dynamic_sections,
631   elf_backend_begin_write_processing,
632   elf_backend_final_write_processing,
633   elf_backend_additional_program_headers,
634   elf_backend_modify_segment_map,
635   elf_backend_modify_program_headers,
636   elf_backend_gc_mark_dynamic_ref,
637   elf_backend_gc_mark_hook,
638   elf_backend_gc_mark_extra_sections,
639   elf_backend_gc_sweep_hook,
640   elf_backend_post_process_headers,
641   elf_backend_print_symbol_all,
642   elf_backend_output_arch_local_syms,
643   elf_backend_output_arch_syms,
644   elf_backend_copy_indirect_symbol,
645   elf_backend_hide_symbol,
646   elf_backend_fixup_symbol,
647   elf_backend_merge_symbol_attribute,
648   elf_backend_ignore_undef_symbol,
649   elf_backend_emit_relocs,
650   elf_backend_count_relocs,
651   elf_backend_grok_prstatus,
652   elf_backend_grok_psinfo,
653   elf_backend_write_core_note,
654   elf_backend_sprintf_vma,
655   elf_backend_fprintf_vma,
656   elf_backend_reloc_type_class,
657   elf_backend_discard_info,
658   elf_backend_ignore_discarded_relocs,
659   elf_backend_action_discarded,
660   elf_backend_eh_frame_address_size,
661   elf_backend_can_make_relative_eh_frame,
662   elf_backend_can_make_lsda_relative_eh_frame,
663   elf_backend_encode_eh_address,
664   elf_backend_write_section,
665   elf_backend_mips_irix_compat,
666   elf_backend_mips_rtype_to_howto,
667   elf_backend_ecoff_debug_swap,
668   elf_backend_bfd_from_remote_memory,
669   elf_backend_plt_sym_val,
670   elf_backend_common_definition,
671   elf_backend_common_section_index,
672   elf_backend_common_section,
673   elf_backend_merge_symbol,
674   elf_backend_hash_symbol,
675   elf_backend_link_order_error_handler,
676   elf_backend_relplt_name,
677   ELF_MACHINE_ALT1,
678   ELF_MACHINE_ALT2,
679   &elf_backend_size_info,
680   elf_backend_special_sections,
681   elf_backend_got_header_size,
682   elf_backend_collect,
683   elf_backend_type_change_ok,
684   elf_backend_may_use_rel_p,
685   elf_backend_may_use_rela_p,
686   elf_backend_default_use_rela_p,
687   elf_backend_rela_normal,
688   elf_backend_sign_extend_vma,
689   elf_backend_want_got_plt,
690   elf_backend_plt_readonly,
691   elf_backend_want_plt_sym,
692   elf_backend_plt_not_loaded,
693   elf_backend_plt_alignment,
694   elf_backend_can_gc_sections,
695   elf_backend_can_refcount,
696   elf_backend_want_got_sym,
697   elf_backend_want_dynbss,
698   elf_backend_want_p_paddr_set_to_zero,
699   elf_backend_default_execstack
700 };
701
702 /* Forward declaration for use when initialising alternative_target field.  */
703 #ifdef TARGET_LITTLE_SYM
704 extern const bfd_target TARGET_LITTLE_SYM;
705 #endif
706
707 #ifdef TARGET_BIG_SYM
708 const bfd_target TARGET_BIG_SYM =
709 {
710   /* name: identify kind of target */
711   TARGET_BIG_NAME,
712
713   /* flavour: general indication about file */
714   bfd_target_elf_flavour,
715
716   /* byteorder: data is big endian */
717   BFD_ENDIAN_BIG,
718
719   /* header_byteorder: header is also big endian */
720   BFD_ENDIAN_BIG,
721
722   /* object_flags: mask of all file flags */
723   (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS
724    | DYNAMIC | WP_TEXT | D_PAGED),
725
726   /* section_flags: mask of all section flags */
727   (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY
728    | SEC_CODE | SEC_DATA | SEC_DEBUGGING | SEC_EXCLUDE | SEC_SORT_ENTRIES
729    | SEC_SMALL_DATA | SEC_MERGE | SEC_STRINGS | SEC_GROUP),
730
731    /* leading_symbol_char: is the first char of a user symbol
732       predictable, and if so what is it */
733   elf_symbol_leading_char,
734
735   /* ar_pad_char: pad character for filenames within an archive header
736      FIXME:  this really has nothing to do with ELF, this is a characteristic
737      of the archiver and/or os and should be independently tunable */
738   '/',
739
740   /* ar_max_namelen: maximum number of characters in an archive header
741      FIXME:  this really has nothing to do with ELF, this is a characteristic
742      of the archiver and should be independently tunable.  The System V ABI,
743      Chapter 7 (Formats & Protocols), Archive section sets this as 15.  */
744   15,
745
746   /* Routines to byte-swap various sized integers from the data sections */
747   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
748     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
749     bfd_getb16, bfd_getb_signed_16, bfd_putb16,
750
751   /* Routines to byte-swap various sized integers from the file headers */
752   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
753     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
754     bfd_getb16, bfd_getb_signed_16, bfd_putb16,
755
756   /* bfd_check_format: check the format of a file being read */
757   { _bfd_dummy_target,          /* unknown format */
758     bfd_elfNN_object_p,         /* assembler/linker output (object file) */
759     bfd_elfNN_archive_p,        /* an archive */
760     bfd_elfNN_core_file_p       /* a core file */
761   },
762
763   /* bfd_set_format: set the format of a file being written */
764   { bfd_false,
765     bfd_elfNN_mkobject,
766     bfd_elfNN_mkarchive,
767     bfd_elfNN_mkcorefile
768   },
769
770   /* bfd_write_contents: write cached information into a file being written */
771   { bfd_false,
772     bfd_elfNN_write_object_contents,
773     bfd_elfNN_write_archive_contents,
774     bfd_elfNN_write_corefile_contents,
775   },
776
777   BFD_JUMP_TABLE_GENERIC (bfd_elfNN),
778   BFD_JUMP_TABLE_COPY (bfd_elfNN),
779   BFD_JUMP_TABLE_CORE (bfd_elfNN),
780 #ifdef bfd_elfNN_archive_functions
781   BFD_JUMP_TABLE_ARCHIVE (bfd_elfNN_archive),
782 #else
783   BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
784 #endif
785   BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN),
786   BFD_JUMP_TABLE_RELOCS (bfd_elfNN),
787   BFD_JUMP_TABLE_WRITE (bfd_elfNN),
788   BFD_JUMP_TABLE_LINK (bfd_elfNN),
789   BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),
790
791   /* Alternative endian target.  */
792 #ifdef TARGET_LITTLE_SYM
793   & TARGET_LITTLE_SYM,
794 #else
795   NULL,
796 #endif
797
798   /* backend_data: */
799   &elfNN_bed
800 };
801 #endif
802
803 #ifdef TARGET_LITTLE_SYM
804 const bfd_target TARGET_LITTLE_SYM =
805 {
806   /* name: identify kind of target */
807   TARGET_LITTLE_NAME,
808
809   /* flavour: general indication about file */
810   bfd_target_elf_flavour,
811
812   /* byteorder: data is little endian */
813   BFD_ENDIAN_LITTLE,
814
815   /* header_byteorder: header is also little endian */
816   BFD_ENDIAN_LITTLE,
817
818   /* object_flags: mask of all file flags */
819   (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS
820    | DYNAMIC | WP_TEXT | D_PAGED),
821
822   /* section_flags: mask of all section flags */
823   (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY
824    | SEC_CODE | SEC_DATA | SEC_DEBUGGING | SEC_EXCLUDE | SEC_SORT_ENTRIES
825    | SEC_SMALL_DATA | SEC_MERGE | SEC_STRINGS | SEC_GROUP),
826
827    /* leading_symbol_char: is the first char of a user symbol
828       predictable, and if so what is it */
829   elf_symbol_leading_char,
830
831   /* ar_pad_char: pad character for filenames within an archive header
832      FIXME:  this really has nothing to do with ELF, this is a characteristic
833      of the archiver and/or os and should be independently tunable */
834   '/',
835
836   /* ar_max_namelen: maximum number of characters in an archive header
837      FIXME:  this really has nothing to do with ELF, this is a characteristic
838      of the archiver and should be independently tunable.  The System V ABI,
839      Chapter 7 (Formats & Protocols), Archive section sets this as 15.  */
840   15,
841
842   /* Routines to byte-swap various sized integers from the data sections */
843   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
844     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
845     bfd_getl16, bfd_getl_signed_16, bfd_putl16,
846
847   /* Routines to byte-swap various sized integers from the file headers */
848   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
849     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
850     bfd_getl16, bfd_getl_signed_16, bfd_putl16,
851
852   /* bfd_check_format: check the format of a file being read */
853   { _bfd_dummy_target,          /* unknown format */
854     bfd_elfNN_object_p,         /* assembler/linker output (object file) */
855     bfd_elfNN_archive_p,        /* an archive */
856     bfd_elfNN_core_file_p       /* a core file */
857   },
858
859   /* bfd_set_format: set the format of a file being written */
860   { bfd_false,
861     bfd_elfNN_mkobject,
862     bfd_elfNN_mkarchive,
863     bfd_elfNN_mkcorefile
864   },
865
866   /* bfd_write_contents: write cached information into a file being written */
867   { bfd_false,
868     bfd_elfNN_write_object_contents,
869     bfd_elfNN_write_archive_contents,
870     bfd_elfNN_write_corefile_contents,
871   },
872
873   BFD_JUMP_TABLE_GENERIC (bfd_elfNN),
874   BFD_JUMP_TABLE_COPY (bfd_elfNN),
875   BFD_JUMP_TABLE_CORE (bfd_elfNN),
876 #ifdef bfd_elfNN_archive_functions
877   BFD_JUMP_TABLE_ARCHIVE (bfd_elfNN_archive),
878 #else
879   BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
880 #endif
881   BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN),
882   BFD_JUMP_TABLE_RELOCS (bfd_elfNN),
883   BFD_JUMP_TABLE_WRITE (bfd_elfNN),
884   BFD_JUMP_TABLE_LINK (bfd_elfNN),
885   BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),
886
887   /* Alternative endian target.  */
888 #ifdef TARGET_BIG_SYM
889   & TARGET_BIG_SYM,
890 #else
891   NULL,
892 #endif
893
894   /* backend_data: */
895   &elfNN_bed
896 };
897 #endif