1 /* Target definitions for NN-bit ELF
2 Copyright 1993, 1994, 1995 Free Software Foundation, Inc.
4 This file is part of BFD, the Binary File Descriptor library.
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 2 of the License, or
9 (at your option) any later version.
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.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
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.
25 There are two such structures here: one for big-endian machines and
26 one for little-endian machines. */
28 #define bfd_elfNN_close_and_cleanup _bfd_generic_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
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
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 #define bfd_elfNN_get_reloc_upper_bound _bfd_elf_get_reloc_upper_bound
44 #define bfd_elfNN_get_symbol_info _bfd_elf_get_symbol_info
45 #define bfd_elfNN_get_symtab _bfd_elf_get_symtab
46 #define bfd_elfNN_get_symtab_upper_bound _bfd_elf_get_symtab_upper_bound
47 #if 0 /* done in elf-bfd.h */
48 #define bfd_elfNN_link_record_dynamic_symbol _bfd_elf_link_record_dynamic_symbol
50 #define bfd_elfNN_make_empty_symbol _bfd_elf_make_empty_symbol
51 #define bfd_elfNN_new_section_hook _bfd_elf_new_section_hook
52 #define bfd_elfNN_set_arch_mach _bfd_elf_set_arch_mach
53 #ifndef bfd_elfNN_set_section_contents
54 #define bfd_elfNN_set_section_contents _bfd_elf_set_section_contents
56 #define bfd_elfNN_sizeof_headers _bfd_elf_sizeof_headers
57 #define bfd_elfNN_write_object_contents _bfd_elf_write_object_contents
59 #define bfd_elfNN_get_section_contents_in_window \
60 _bfd_generic_get_section_contents_in_window
62 #ifndef elf_backend_want_got_plt
63 #define elf_backend_want_got_plt 0
65 #ifndef elf_backend_plt_readonly
66 #define elf_backend_plt_readonly 0
68 #ifndef elf_backend_want_plt_sym
69 #define elf_backend_want_plt_sym 0
72 #ifndef elf_backend_want_hdr_in_seg
73 #define elf_backend_want_hdr_in_seg 0
76 #define bfd_elfNN_bfd_debug_info_start bfd_void
77 #define bfd_elfNN_bfd_debug_info_end bfd_void
78 #define bfd_elfNN_bfd_debug_info_accumulate (PROTO(void,(*),(bfd*, struct sec *))) bfd_void
80 #ifndef bfd_elfNN_bfd_get_relocated_section_contents
81 #define bfd_elfNN_bfd_get_relocated_section_contents \
82 bfd_generic_get_relocated_section_contents
85 #define bfd_elfNN_bfd_relax_section bfd_generic_relax_section
86 #define bfd_elfNN_bfd_make_debug_symbol \
87 ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
89 #ifndef bfd_elfNN_bfd_copy_private_symbol_data
90 #define bfd_elfNN_bfd_copy_private_symbol_data \
91 _bfd_elf_copy_private_symbol_data
94 #ifndef bfd_elfNN_bfd_copy_private_section_data
95 #define bfd_elfNN_bfd_copy_private_section_data \
96 _bfd_elf_copy_private_section_data
98 #ifndef bfd_elfNN_bfd_copy_private_bfd_data
99 #define bfd_elfNN_bfd_copy_private_bfd_data \
100 ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
102 #ifndef bfd_elfNN_bfd_print_private_bfd_data
103 #define bfd_elfNN_bfd_print_private_bfd_data \
104 ((boolean (*) PARAMS ((bfd *, void *))) bfd_true)
106 #ifndef bfd_elfNN_bfd_merge_private_bfd_data
107 #define bfd_elfNN_bfd_merge_private_bfd_data \
108 ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
110 #ifndef bfd_elfNN_bfd_set_private_flags
111 #define bfd_elfNN_bfd_set_private_flags \
112 ((boolean (*) PARAMS ((bfd *, flagword))) bfd_true)
114 #ifndef bfd_elfNN_bfd_is_local_label
115 #define bfd_elfNN_bfd_is_local_label bfd_generic_is_local_label
118 #ifndef bfd_elfNN_get_dynamic_reloc_upper_bound
119 #define bfd_elfNN_get_dynamic_reloc_upper_bound \
120 _bfd_nodynamic_get_dynamic_reloc_upper_bound
122 #ifndef bfd_elfNN_canonicalize_dynamic_reloc
123 #define bfd_elfNN_canonicalize_dynamic_reloc \
124 _bfd_nodynamic_canonicalize_dynamic_reloc
127 #ifdef elf_backend_relocate_section
128 #ifndef bfd_elfNN_bfd_link_hash_table_create
129 #define bfd_elfNN_bfd_link_hash_table_create _bfd_elf_link_hash_table_create
131 #else /* ! defined (elf_backend_relocate_section) */
132 /* If no backend relocate_section routine, use the generic linker. */
133 #ifndef bfd_elfNN_bfd_link_hash_table_create
134 #define bfd_elfNN_bfd_link_hash_table_create \
135 _bfd_generic_link_hash_table_create
137 #ifndef bfd_elfNN_bfd_link_add_symbols
138 #define bfd_elfNN_bfd_link_add_symbols _bfd_generic_link_add_symbols
140 #ifndef bfd_elfNN_bfd_final_link
141 #define bfd_elfNN_bfd_final_link _bfd_generic_final_link
143 #endif /* ! defined (elf_backend_relocate_section) */
144 #ifndef bfd_elfNN_bfd_link_split_section
145 #define bfd_elfNN_bfd_link_split_section _bfd_generic_link_split_section
148 #ifndef elf_info_to_howto_rel
149 #define elf_info_to_howto_rel 0
152 #ifndef ELF_MAXPAGESIZE
153 #define ELF_MAXPAGESIZE 1
156 #ifndef elf_backend_collect
157 #define elf_backend_collect false
160 #ifndef elf_backend_sym_is_global
161 #define elf_backend_sym_is_global 0
163 #ifndef elf_backend_object_p
164 #define elf_backend_object_p 0
166 #ifndef elf_backend_symbol_processing
167 #define elf_backend_symbol_processing 0
169 #ifndef elf_backend_symbol_table_processing
170 #define elf_backend_symbol_table_processing 0
172 #ifndef elf_backend_section_processing
173 #define elf_backend_section_processing 0
175 #ifndef elf_backend_section_from_shdr
176 #define elf_backend_section_from_shdr 0
178 #ifndef elf_backend_fake_sections
179 #define elf_backend_fake_sections 0
181 #ifndef elf_backend_section_from_bfd_section
182 #define elf_backend_section_from_bfd_section 0
184 #ifndef elf_backend_add_symbol_hook
185 #define elf_backend_add_symbol_hook 0
187 #ifndef elf_backend_link_output_symbol_hook
188 #define elf_backend_link_output_symbol_hook 0
190 #ifndef elf_backend_create_dynamic_sections
191 #define elf_backend_create_dynamic_sections 0
193 #ifndef elf_backend_check_relocs
194 #define elf_backend_check_relocs 0
196 #ifndef elf_backend_adjust_dynamic_symbol
197 #define elf_backend_adjust_dynamic_symbol 0
199 #ifndef elf_backend_size_dynamic_sections
200 #define elf_backend_size_dynamic_sections 0
202 #ifndef elf_backend_relocate_section
203 #define elf_backend_relocate_section 0
205 #ifndef elf_backend_finish_dynamic_symbol
206 #define elf_backend_finish_dynamic_symbol 0
208 #ifndef elf_backend_finish_dynamic_sections
209 #define elf_backend_finish_dynamic_sections 0
211 #ifndef elf_backend_begin_write_processing
212 #define elf_backend_begin_write_processing 0
214 #ifndef elf_backend_final_write_processing
215 #define elf_backend_final_write_processing 0
217 #ifndef elf_backend_create_program_headers
218 #define elf_backend_create_program_headers 0
220 #ifndef elf_backend_ecoff_debug_swap
221 #define elf_backend_ecoff_debug_swap 0
224 #ifndef ELF_MACHINE_ALT1
225 #define ELF_MACHINE_ALT1 0
228 #ifndef ELF_MACHINE_ALT2
229 #define ELF_MACHINE_ALT2 0
232 extern const struct elf_size_info _bfd_elfNN_size_info;
234 static CONST struct elf_backend_data elfNN_bed =
242 ELF_MACHINE_CODE, /* elf_machine_code */
243 ELF_MAXPAGESIZE, /* maxpagesize */
246 elf_info_to_howto_rel,
247 elf_backend_sym_is_global,
248 elf_backend_object_p,
249 elf_backend_symbol_processing,
250 elf_backend_symbol_table_processing,
251 elf_backend_section_processing,
252 elf_backend_section_from_shdr,
253 elf_backend_fake_sections,
254 elf_backend_section_from_bfd_section,
255 elf_backend_add_symbol_hook,
256 elf_backend_link_output_symbol_hook,
257 elf_backend_create_dynamic_sections,
258 elf_backend_check_relocs,
259 elf_backend_adjust_dynamic_symbol,
260 elf_backend_size_dynamic_sections,
261 elf_backend_relocate_section,
262 elf_backend_finish_dynamic_symbol,
263 elf_backend_finish_dynamic_sections,
264 elf_backend_begin_write_processing,
265 elf_backend_final_write_processing,
266 elf_backend_create_program_headers,
267 elf_backend_ecoff_debug_swap,
270 &_bfd_elfNN_size_info,
271 elf_backend_want_got_plt,
272 elf_backend_plt_readonly,
273 elf_backend_want_plt_sym,
274 elf_backend_want_hdr_in_seg,
277 #ifdef TARGET_BIG_SYM
278 const bfd_target TARGET_BIG_SYM =
280 /* name: identify kind of target */
283 /* flavour: general indication about file */
284 bfd_target_elf_flavour,
286 /* byteorder_big_p: data is big endian */
289 /* header_byteorder_big_p: header is also big endian */
292 /* object_flags: mask of all file flags */
293 (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
294 DYNAMIC | WP_TEXT | D_PAGED),
296 /* section_flags: mask of all section flags */
297 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
298 SEC_CODE | SEC_DATA | SEC_DEBUGGING),
300 /* leading_symbol_char: is the first char of a user symbol
301 predictable, and if so what is it */
304 /* ar_pad_char: pad character for filenames within an archive header
305 FIXME: this really has nothing to do with ELF, this is a characteristic
306 of the archiver and/or os and should be independently tunable */
309 /* ar_max_namelen: maximum number of characters in an archive header
310 FIXME: this really has nothing to do with ELF, this is a characteristic
311 of the archiver and should be independently tunable. This value is
312 a WAG (wild a** guess) */
315 /* Routines to byte-swap various sized integers from the data sections */
316 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
317 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
318 bfd_getb16, bfd_getb_signed_16, bfd_putb16,
320 /* Routines to byte-swap various sized integers from the file headers */
321 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
322 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
323 bfd_getb16, bfd_getb_signed_16, bfd_putb16,
325 /* bfd_check_format: check the format of a file being read */
326 { _bfd_dummy_target, /* unknown format */
327 bfd_elfNN_object_p, /* assembler/linker output (object file) */
328 bfd_generic_archive_p, /* an archive */
329 bfd_elfNN_core_file_p /* a core file */
332 /* bfd_set_format: set the format of a file being written */
335 _bfd_generic_mkarchive,
339 /* bfd_write_contents: write cached information into a file being written */
341 bfd_elfNN_write_object_contents,
342 _bfd_write_archive_contents,
346 BFD_JUMP_TABLE_GENERIC (bfd_elfNN),
347 BFD_JUMP_TABLE_COPY (bfd_elfNN),
348 BFD_JUMP_TABLE_CORE (bfd_elfNN),
349 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
350 BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN),
351 BFD_JUMP_TABLE_RELOCS (bfd_elfNN),
352 BFD_JUMP_TABLE_WRITE (bfd_elfNN),
353 BFD_JUMP_TABLE_LINK (bfd_elfNN),
354 BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),
361 #ifdef TARGET_LITTLE_SYM
362 const bfd_target TARGET_LITTLE_SYM =
364 /* name: identify kind of target */
367 /* flavour: general indication about file */
368 bfd_target_elf_flavour,
370 /* byteorder_big_p: data is big endian */
371 false, /* Nope -- this one's little endian */
373 /* header_byteorder_big_p: header is also big endian */
374 false, /* Nope -- this one's little endian */
376 /* object_flags: mask of all file flags */
377 (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
378 DYNAMIC | WP_TEXT | D_PAGED),
380 /* section_flags: mask of all section flags */
381 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
382 SEC_CODE | SEC_DATA | SEC_DEBUGGING),
384 /* leading_symbol_char: is the first char of a user symbol
385 predictable, and if so what is it */
388 /* ar_pad_char: pad character for filenames within an archive header
389 FIXME: this really has nothing to do with ELF, this is a characteristic
390 of the archiver and/or os and should be independently tunable */
393 /* ar_max_namelen: maximum number of characters in an archive header
394 FIXME: this really has nothing to do with ELF, this is a characteristic
395 of the archiver and should be independently tunable. This value is
396 a WAG (wild a** guess) */
399 /* Routines to byte-swap various sized integers from the data sections */
400 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
401 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
402 bfd_getl16, bfd_getl_signed_16, bfd_putl16,
404 /* Routines to byte-swap various sized integers from the file headers */
405 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
406 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
407 bfd_getl16, bfd_getl_signed_16, bfd_putl16,
409 /* bfd_check_format: check the format of a file being read */
410 { _bfd_dummy_target, /* unknown format */
411 bfd_elfNN_object_p, /* assembler/linker output (object file) */
412 bfd_generic_archive_p, /* an archive */
413 bfd_elfNN_core_file_p /* a core file */
416 /* bfd_set_format: set the format of a file being written */
419 _bfd_generic_mkarchive,
423 /* bfd_write_contents: write cached information into a file being written */
425 bfd_elfNN_write_object_contents,
426 _bfd_write_archive_contents,
430 BFD_JUMP_TABLE_GENERIC (bfd_elfNN),
431 BFD_JUMP_TABLE_COPY (bfd_elfNN),
432 BFD_JUMP_TABLE_CORE (bfd_elfNN),
433 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
434 BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN),
435 BFD_JUMP_TABLE_RELOCS (bfd_elfNN),
436 BFD_JUMP_TABLE_WRITE (bfd_elfNN),
437 BFD_JUMP_TABLE_LINK (bfd_elfNN),
438 BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),