19990502 sourceware import
[deliverable/binutils-gdb.git] / bfd / elfxx-target.h
CommitLineData
252b5132
RH
1/* Target definitions for NN-bit ELF
2 Copyright 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
3
4This file is part of BFD, the Binary File Descriptor library.
5
6This program is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program; if not, write to the Free Software
18Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
19
20/* This structure contains everything that BFD knows about a target.
21 It includes things like its byte order, name, what routines to call
22 to do various operations, etc. Every BFD points to a target structure
23 with its "xvec" member.
24
25 There are two such structures here: one for big-endian machines and
26 one for little-endian machines. */
27
28#define bfd_elfNN_close_and_cleanup _bfd_elf_close_and_cleanup
29#define bfd_elfNN_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
30#ifndef bfd_elfNN_get_section_contents
31#define bfd_elfNN_get_section_contents _bfd_generic_get_section_contents
32#endif
33
34#define bfd_elfNN_canonicalize_dynamic_symtab _bfd_elf_canonicalize_dynamic_symtab
35#define bfd_elfNN_canonicalize_reloc _bfd_elf_canonicalize_reloc
36#ifndef bfd_elfNN_find_nearest_line
37#define bfd_elfNN_find_nearest_line _bfd_elf_find_nearest_line
38#endif
39#define bfd_elfNN_read_minisymbols _bfd_elf_read_minisymbols
40#define bfd_elfNN_minisymbol_to_symbol _bfd_elf_minisymbol_to_symbol
41#define bfd_elfNN_get_dynamic_symtab_upper_bound _bfd_elf_get_dynamic_symtab_upper_bound
42#define bfd_elfNN_get_lineno _bfd_elf_get_lineno
43#ifndef bfd_elfNN_get_reloc_upper_bound
44#define bfd_elfNN_get_reloc_upper_bound _bfd_elf_get_reloc_upper_bound
45#endif
46#define bfd_elfNN_get_symbol_info _bfd_elf_get_symbol_info
47#define bfd_elfNN_get_symtab _bfd_elf_get_symtab
48#define bfd_elfNN_get_symtab_upper_bound _bfd_elf_get_symtab_upper_bound
49#if 0 /* done in elf-bfd.h */
50#define bfd_elfNN_link_record_dynamic_symbol _bfd_elf_link_record_dynamic_symbol
51#endif
52#define bfd_elfNN_make_empty_symbol _bfd_elf_make_empty_symbol
53#define bfd_elfNN_new_section_hook _bfd_elf_new_section_hook
54#define bfd_elfNN_set_arch_mach _bfd_elf_set_arch_mach
55#ifndef bfd_elfNN_set_section_contents
56#define bfd_elfNN_set_section_contents _bfd_elf_set_section_contents
57#endif
58#define bfd_elfNN_sizeof_headers _bfd_elf_sizeof_headers
59#define bfd_elfNN_write_object_contents _bfd_elf_write_object_contents
60#define bfd_elfNN_write_corefile_contents _bfd_elf_write_corefile_contents
61
62#define bfd_elfNN_get_section_contents_in_window \
63 _bfd_generic_get_section_contents_in_window
64
65#ifndef elf_backend_got_symbol_offset
66#define elf_backend_got_symbol_offset (bfd_vma) 0
67#endif
68#ifndef elf_backend_want_got_plt
69#define elf_backend_want_got_plt 0
70#endif
71#ifndef elf_backend_plt_readonly
72#define elf_backend_plt_readonly 0
73#endif
74#ifndef elf_backend_want_plt_sym
75#define elf_backend_want_plt_sym 0
76#endif
77#ifndef elf_backend_plt_not_loaded
78#define elf_backend_plt_not_loaded 0
79#endif
80#ifndef elf_backend_plt_alignment
81#define elf_backend_plt_alignment 2
82#endif
83
84#define bfd_elfNN_bfd_debug_info_start bfd_void
85#define bfd_elfNN_bfd_debug_info_end bfd_void
86#define bfd_elfNN_bfd_debug_info_accumulate (PROTO(void,(*),(bfd*, struct sec *))) bfd_void
87
88#ifndef bfd_elfNN_bfd_get_relocated_section_contents
89#define bfd_elfNN_bfd_get_relocated_section_contents \
90 bfd_generic_get_relocated_section_contents
91#endif
92
93#ifndef bfd_elfNN_bfd_relax_section
94#define bfd_elfNN_bfd_relax_section bfd_generic_relax_section
95#endif
96
97#ifndef elf_backend_can_gc_sections
98#define elf_backend_can_gc_sections 0
99#endif
100#ifndef elf_backend_gc_mark_hook
101#define elf_backend_gc_mark_hook NULL
102#endif
103#ifndef elf_backend_gc_sweep_hook
104#define elf_backend_gc_sweep_hook NULL
105#endif
106#ifndef bfd_elfNN_bfd_gc_sections
107#define bfd_elfNN_bfd_gc_sections _bfd_elfNN_gc_sections
108#endif
109
110#define bfd_elfNN_bfd_make_debug_symbol \
111 ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
112
113#ifndef bfd_elfNN_bfd_copy_private_symbol_data
114#define bfd_elfNN_bfd_copy_private_symbol_data \
115 _bfd_elf_copy_private_symbol_data
116#endif
117
118#ifndef bfd_elfNN_bfd_copy_private_section_data
119#define bfd_elfNN_bfd_copy_private_section_data \
120 _bfd_elf_copy_private_section_data
121#endif
122#ifndef bfd_elfNN_bfd_copy_private_bfd_data
123#define bfd_elfNN_bfd_copy_private_bfd_data \
124 ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
125#endif
126#ifndef bfd_elfNN_bfd_print_private_bfd_data
127#define bfd_elfNN_bfd_print_private_bfd_data \
128 _bfd_elf_print_private_bfd_data
129#endif
130#ifndef bfd_elfNN_bfd_merge_private_bfd_data
131#define bfd_elfNN_bfd_merge_private_bfd_data \
132 ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
133#endif
134#ifndef bfd_elfNN_bfd_set_private_flags
135#define bfd_elfNN_bfd_set_private_flags \
136 ((boolean (*) PARAMS ((bfd *, flagword))) bfd_true)
137#endif
138#ifndef bfd_elfNN_bfd_is_local_label_name
139#define bfd_elfNN_bfd_is_local_label_name _bfd_elf_is_local_label_name
140#endif
141
142#ifndef bfd_elfNN_get_dynamic_reloc_upper_bound
143#define bfd_elfNN_get_dynamic_reloc_upper_bound \
144 _bfd_elf_get_dynamic_reloc_upper_bound
145#endif
146#ifndef bfd_elfNN_canonicalize_dynamic_reloc
147#define bfd_elfNN_canonicalize_dynamic_reloc \
148 _bfd_elf_canonicalize_dynamic_reloc
149#endif
150
151#ifdef elf_backend_relocate_section
152#ifndef bfd_elfNN_bfd_link_hash_table_create
153#define bfd_elfNN_bfd_link_hash_table_create _bfd_elf_link_hash_table_create
154#endif
155#else /* ! defined (elf_backend_relocate_section) */
156/* If no backend relocate_section routine, use the generic linker. */
157#ifndef bfd_elfNN_bfd_link_hash_table_create
158#define bfd_elfNN_bfd_link_hash_table_create \
159 _bfd_generic_link_hash_table_create
160#endif
161#ifndef bfd_elfNN_bfd_link_add_symbols
162#define bfd_elfNN_bfd_link_add_symbols _bfd_generic_link_add_symbols
163#endif
164#ifndef bfd_elfNN_bfd_final_link
165#define bfd_elfNN_bfd_final_link _bfd_generic_final_link
166#endif
167#endif /* ! defined (elf_backend_relocate_section) */
168#ifndef bfd_elfNN_bfd_link_split_section
169#define bfd_elfNN_bfd_link_split_section _bfd_generic_link_split_section
170#endif
171
172#ifndef bfd_elfNN_archive_p
173#define bfd_elfNN_archive_p bfd_generic_archive_p
174#endif
175
176#ifndef bfd_elfNN_write_archive_contents
177#define bfd_elfNN_write_archive_contents _bfd_write_archive_contents
178#endif
179
180#ifndef bfd_elfNN_mkobject
181#define bfd_elfNN_mkobject bfd_elf_mkobject
182#endif
183
184#ifndef bfd_elfNN_mkcorefile
185#define bfd_elfNN_mkcorefile bfd_elf_mkcorefile
186#endif
187
188#ifndef bfd_elfNN_mkarchive
189#define bfd_elfNN_mkarchive _bfd_generic_mkarchive
190#endif
191
192#ifndef elf_symbol_leading_char
193#define elf_symbol_leading_char 0
194#endif
195
196#ifndef elf_info_to_howto
197#define elf_info_to_howto 0
198#endif
199
200#ifndef elf_info_to_howto_rel
201#define elf_info_to_howto_rel 0
202#endif
203
204#ifndef ELF_MAXPAGESIZE
205#define ELF_MAXPAGESIZE 1
206#endif
207
208#ifndef elf_backend_collect
209#define elf_backend_collect false
210#endif
211#ifndef elf_backend_type_change_ok
212#define elf_backend_type_change_ok false
213#endif
214
215#ifndef elf_backend_sym_is_global
216#define elf_backend_sym_is_global 0
217#endif
218#ifndef elf_backend_object_p
219#define elf_backend_object_p 0
220#endif
221#ifndef elf_backend_symbol_processing
222#define elf_backend_symbol_processing 0
223#endif
224#ifndef elf_backend_symbol_table_processing
225#define elf_backend_symbol_table_processing 0
226#endif
227#ifndef elf_backend_get_symbol_type
228#define elf_backend_get_symbol_type 0
229#endif
230#ifndef elf_backend_section_processing
231#define elf_backend_section_processing 0
232#endif
233#ifndef elf_backend_section_from_shdr
234#define elf_backend_section_from_shdr 0
235#endif
236#ifndef elf_backend_fake_sections
237#define elf_backend_fake_sections 0
238#endif
239#ifndef elf_backend_section_from_bfd_section
240#define elf_backend_section_from_bfd_section 0
241#endif
242#ifndef elf_backend_add_symbol_hook
243#define elf_backend_add_symbol_hook 0
244#endif
245#ifndef elf_backend_link_output_symbol_hook
246#define elf_backend_link_output_symbol_hook 0
247#endif
248#ifndef elf_backend_create_dynamic_sections
249#define elf_backend_create_dynamic_sections 0
250#endif
251#ifndef elf_backend_check_relocs
252#define elf_backend_check_relocs 0
253#endif
254#ifndef elf_backend_adjust_dynamic_symbol
255#define elf_backend_adjust_dynamic_symbol 0
256#endif
257#ifndef elf_backend_always_size_sections
258#define elf_backend_always_size_sections 0
259#endif
260#ifndef elf_backend_size_dynamic_sections
261#define elf_backend_size_dynamic_sections 0
262#endif
263#ifndef elf_backend_relocate_section
264#define elf_backend_relocate_section 0
265#endif
266#ifndef elf_backend_finish_dynamic_symbol
267#define elf_backend_finish_dynamic_symbol 0
268#endif
269#ifndef elf_backend_finish_dynamic_sections
270#define elf_backend_finish_dynamic_sections 0
271#endif
272#ifndef elf_backend_begin_write_processing
273#define elf_backend_begin_write_processing 0
274#endif
275#ifndef elf_backend_final_write_processing
276#define elf_backend_final_write_processing 0
277#endif
278#ifndef elf_backend_additional_program_headers
279#define elf_backend_additional_program_headers 0
280#endif
281#ifndef elf_backend_modify_segment_map
282#define elf_backend_modify_segment_map 0
283#endif
284#ifndef elf_backend_ecoff_debug_swap
285#define elf_backend_ecoff_debug_swap 0
286#endif
287#ifndef elf_backend_got_header_size
288#define elf_backend_got_header_size 0
289#endif
290#ifndef elf_backend_plt_header_size
291#define elf_backend_plt_header_size 0
292#endif
293
294#ifndef ELF_MACHINE_ALT1
295#define ELF_MACHINE_ALT1 0
296#endif
297
298#ifndef ELF_MACHINE_ALT2
299#define ELF_MACHINE_ALT2 0
300#endif
301
302#ifndef elf_backend_size_info
303#define elf_backend_size_info _bfd_elfNN_size_info
304#endif
305
306extern const struct elf_size_info _bfd_elfNN_size_info;
307
308static CONST struct elf_backend_data elfNN_bed =
309{
310#ifdef USE_REL
311 0, /* use_rela_p */
312#else
313 1, /* use_rela_p */
314#endif
315 ELF_ARCH, /* arch */
316 ELF_MACHINE_CODE, /* elf_machine_code */
317 ELF_MAXPAGESIZE, /* maxpagesize */
318 elf_backend_collect,
319 elf_backend_type_change_ok,
320 elf_info_to_howto,
321 elf_info_to_howto_rel,
322 elf_backend_sym_is_global,
323 elf_backend_object_p,
324 elf_backend_symbol_processing,
325 elf_backend_symbol_table_processing,
326 elf_backend_get_symbol_type,
327 elf_backend_section_processing,
328 elf_backend_section_from_shdr,
329 elf_backend_fake_sections,
330 elf_backend_section_from_bfd_section,
331 elf_backend_add_symbol_hook,
332 elf_backend_link_output_symbol_hook,
333 elf_backend_create_dynamic_sections,
334 elf_backend_check_relocs,
335 elf_backend_adjust_dynamic_symbol,
336 elf_backend_always_size_sections,
337 elf_backend_size_dynamic_sections,
338 elf_backend_relocate_section,
339 elf_backend_finish_dynamic_symbol,
340 elf_backend_finish_dynamic_sections,
341 elf_backend_begin_write_processing,
342 elf_backend_final_write_processing,
343 elf_backend_additional_program_headers,
344 elf_backend_modify_segment_map,
345 elf_backend_gc_mark_hook,
346 elf_backend_gc_sweep_hook,
347 elf_backend_ecoff_debug_swap,
348 ELF_MACHINE_ALT1,
349 ELF_MACHINE_ALT2,
350 &elf_backend_size_info,
351 elf_backend_got_symbol_offset,
352 elf_backend_got_header_size,
353 elf_backend_plt_header_size,
354 elf_backend_want_got_plt,
355 elf_backend_plt_readonly,
356 elf_backend_want_plt_sym,
357 elf_backend_plt_not_loaded,
358 elf_backend_plt_alignment,
359 elf_backend_can_gc_sections
360};
361
362#ifdef TARGET_BIG_SYM
363const bfd_target TARGET_BIG_SYM =
364{
365 /* name: identify kind of target */
366 TARGET_BIG_NAME,
367
368 /* flavour: general indication about file */
369 bfd_target_elf_flavour,
370
371 /* byteorder: data is big endian */
372 BFD_ENDIAN_BIG,
373
374 /* header_byteorder: header is also big endian */
375 BFD_ENDIAN_BIG,
376
377 /* object_flags: mask of all file flags */
378 (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
379 DYNAMIC | WP_TEXT | D_PAGED),
380
381 /* section_flags: mask of all section flags */
382 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
383 SEC_CODE | SEC_DATA | SEC_DEBUGGING | SEC_EXCLUDE | SEC_SORT_ENTRIES),
384
385 /* leading_symbol_char: is the first char of a user symbol
386 predictable, and if so what is it */
387 elf_symbol_leading_char,
388
389 /* ar_pad_char: pad character for filenames within an archive header
390 FIXME: this really has nothing to do with ELF, this is a characteristic
391 of the archiver and/or os and should be independently tunable */
392 '/',
393
394 /* ar_max_namelen: maximum number of characters in an archive header
395 FIXME: this really has nothing to do with ELF, this is a characteristic
396 of the archiver and should be independently tunable. This value is
397 a WAG (wild a** guess) */
398 14,
399
400 /* Routines to byte-swap various sized integers from the data sections */
401 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
402 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
403 bfd_getb16, bfd_getb_signed_16, bfd_putb16,
404
405 /* Routines to byte-swap various sized integers from the file headers */
406 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
407 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
408 bfd_getb16, bfd_getb_signed_16, bfd_putb16,
409
410 /* bfd_check_format: check the format of a file being read */
411 { _bfd_dummy_target, /* unknown format */
412 bfd_elfNN_object_p, /* assembler/linker output (object file) */
413 bfd_elfNN_archive_p, /* an archive */
414 bfd_elfNN_core_file_p /* a core file */
415 },
416
417 /* bfd_set_format: set the format of a file being written */
418 { bfd_false,
419 bfd_elfNN_mkobject,
420 bfd_elfNN_mkarchive,
421 bfd_elfNN_mkcorefile
422 },
423
424 /* bfd_write_contents: write cached information into a file being written */
425 { bfd_false,
426 bfd_elfNN_write_object_contents,
427 bfd_elfNN_write_archive_contents,
428 bfd_elfNN_write_corefile_contents,
429 },
430
431 BFD_JUMP_TABLE_GENERIC (bfd_elfNN),
432 BFD_JUMP_TABLE_COPY (bfd_elfNN),
433 BFD_JUMP_TABLE_CORE (bfd_elfNN),
434#ifdef bfd_elfNN_archive_functions
435 BFD_JUMP_TABLE_ARCHIVE (bfd_elfNN_archive),
436#else
437 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
438#endif
439 BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN),
440 BFD_JUMP_TABLE_RELOCS (bfd_elfNN),
441 BFD_JUMP_TABLE_WRITE (bfd_elfNN),
442 BFD_JUMP_TABLE_LINK (bfd_elfNN),
443 BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),
444
445 /* backend_data: */
446 (PTR) &elfNN_bed,
447};
448#endif
449
450#ifdef TARGET_LITTLE_SYM
451const bfd_target TARGET_LITTLE_SYM =
452{
453 /* name: identify kind of target */
454 TARGET_LITTLE_NAME,
455
456 /* flavour: general indication about file */
457 bfd_target_elf_flavour,
458
459 /* byteorder: data is little endian */
460 BFD_ENDIAN_LITTLE,
461
462 /* header_byteorder: header is also little endian */
463 BFD_ENDIAN_LITTLE,
464
465 /* object_flags: mask of all file flags */
466 (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
467 DYNAMIC | WP_TEXT | D_PAGED),
468
469 /* section_flags: mask of all section flags */
470 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
471 SEC_CODE | SEC_DATA | SEC_DEBUGGING | SEC_EXCLUDE | SEC_SORT_ENTRIES),
472
473 /* leading_symbol_char: is the first char of a user symbol
474 predictable, and if so what is it */
475 elf_symbol_leading_char,
476
477 /* ar_pad_char: pad character for filenames within an archive header
478 FIXME: this really has nothing to do with ELF, this is a characteristic
479 of the archiver and/or os and should be independently tunable */
480 '/',
481
482 /* ar_max_namelen: maximum number of characters in an archive header
483 FIXME: this really has nothing to do with ELF, this is a characteristic
484 of the archiver and should be independently tunable. This value is
485 a WAG (wild a** guess) */
486 14,
487
488 /* Routines to byte-swap various sized integers from the data sections */
489 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
490 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
491 bfd_getl16, bfd_getl_signed_16, bfd_putl16,
492
493 /* Routines to byte-swap various sized integers from the file headers */
494 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
495 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
496 bfd_getl16, bfd_getl_signed_16, bfd_putl16,
497
498 /* bfd_check_format: check the format of a file being read */
499 { _bfd_dummy_target, /* unknown format */
500 bfd_elfNN_object_p, /* assembler/linker output (object file) */
501 bfd_elfNN_archive_p, /* an archive */
502 bfd_elfNN_core_file_p /* a core file */
503 },
504
505 /* bfd_set_format: set the format of a file being written */
506 { bfd_false,
507 bfd_elfNN_mkobject,
508 bfd_elfNN_mkarchive,
509 bfd_elfNN_mkcorefile
510 },
511
512 /* bfd_write_contents: write cached information into a file being written */
513 { bfd_false,
514 bfd_elfNN_write_object_contents,
515 bfd_elfNN_write_archive_contents,
516 bfd_elfNN_write_corefile_contents,
517 },
518
519 BFD_JUMP_TABLE_GENERIC (bfd_elfNN),
520 BFD_JUMP_TABLE_COPY (bfd_elfNN),
521 BFD_JUMP_TABLE_CORE (bfd_elfNN),
522#ifdef bfd_elfNN_archive_functions
523 BFD_JUMP_TABLE_ARCHIVE (bfd_elfNN_archive),
524#else
525 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
526#endif
527 BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN),
528 BFD_JUMP_TABLE_RELOCS (bfd_elfNN),
529 BFD_JUMP_TABLE_WRITE (bfd_elfNN),
530 BFD_JUMP_TABLE_LINK (bfd_elfNN),
531 BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),
532
533 /* backend_data: */
534 (PTR) &elfNN_bed,
535};
536#endif
This page took 0.040053 seconds and 4 git commands to generate.