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 #ifndef elf_backend_want_got_plt
60 #define elf_backend_want_got_plt 0
62 #ifndef elf_backend_plt_readonly
63 #define elf_backend_plt_readonly 0
65 #ifndef elf_backend_want_plt_sym
66 #define elf_backend_want_plt_sym 0
69 #ifndef elf_backend_want_hdr_in_seg
70 #define elf_backend_want_hdr_in_seg 0
73 #define bfd_elfNN_bfd_debug_info_start bfd_void
74 #define bfd_elfNN_bfd_debug_info_end bfd_void
75 #define bfd_elfNN_bfd_debug_info_accumulate (PROTO(void,(*),(bfd*, struct sec *))) bfd_void
77 #ifndef bfd_elfNN_bfd_get_relocated_section_contents
78 #define bfd_elfNN_bfd_get_relocated_section_contents \
79 bfd_generic_get_relocated_section_contents
82 #define bfd_elfNN_bfd_relax_section bfd_generic_relax_section
83 #define bfd_elfNN_bfd_make_debug_symbol \
84 ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
86 #ifndef bfd_elfNN_bfd_copy_private_symbol_data
87 #define bfd_elfNN_bfd_copy_private_symbol_data \
88 ((boolean (*) PARAMS ((bfd *, asymbol *, bfd *, asymbol *))) bfd_true)
90 #ifndef bfd_elfNN_bfd_copy_private_section_data
91 #define bfd_elfNN_bfd_copy_private_section_data \
92 ((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_true)
94 #ifndef bfd_elfNN_bfd_copy_private_bfd_data
95 #define bfd_elfNN_bfd_copy_private_bfd_data \
96 ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
98 #ifndef bfd_elfNN_bfd_print_private_bfd_data
99 #define bfd_elfNN_bfd_print_private_bfd_data \
100 ((boolean (*) PARAMS ((bfd *, void *))) bfd_true)
102 #ifndef bfd_elfNN_bfd_merge_private_bfd_data
103 #define bfd_elfNN_bfd_merge_private_bfd_data \
104 ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
106 #ifndef bfd_elfNN_bfd_set_private_flags
107 #define bfd_elfNN_bfd_set_private_flags \
108 ((boolean (*) PARAMS ((bfd *, flagword))) bfd_true)
110 #ifndef bfd_elfNN_bfd_is_local_label
111 #define bfd_elfNN_bfd_is_local_label bfd_generic_is_local_label
114 #ifndef bfd_elfNN_get_dynamic_reloc_upper_bound
115 #define bfd_elfNN_get_dynamic_reloc_upper_bound \
116 _bfd_nodynamic_get_dynamic_reloc_upper_bound
118 #ifndef bfd_elfNN_canonicalize_dynamic_reloc
119 #define bfd_elfNN_canonicalize_dynamic_reloc \
120 _bfd_nodynamic_canonicalize_dynamic_reloc
123 #ifdef elf_backend_relocate_section
124 #ifndef bfd_elfNN_bfd_link_hash_table_create
125 #define bfd_elfNN_bfd_link_hash_table_create _bfd_elf_link_hash_table_create
127 #else /* ! defined (elf_backend_relocate_section) */
128 /* If no backend relocate_section routine, use the generic linker. */
129 #ifndef bfd_elfNN_bfd_link_hash_table_create
130 #define bfd_elfNN_bfd_link_hash_table_create \
131 _bfd_generic_link_hash_table_create
133 #ifndef bfd_elfNN_bfd_link_add_symbols
134 #define bfd_elfNN_bfd_link_add_symbols _bfd_generic_link_add_symbols
136 #ifndef bfd_elfNN_bfd_final_link
137 #define bfd_elfNN_bfd_final_link _bfd_generic_final_link
139 #endif /* ! defined (elf_backend_relocate_section) */
140 #ifndef bfd_elfNN_bfd_link_split_section
141 #define bfd_elfNN_bfd_link_split_section _bfd_generic_link_split_section
144 #ifndef elf_info_to_howto_rel
145 #define elf_info_to_howto_rel 0
148 #ifndef ELF_MAXPAGESIZE
149 #define ELF_MAXPAGESIZE 1
152 #ifndef elf_backend_collect
153 #define elf_backend_collect false
156 #ifndef elf_backend_sym_is_global
157 #define elf_backend_sym_is_global 0
159 #ifndef elf_backend_object_p
160 #define elf_backend_object_p 0
162 #ifndef elf_backend_symbol_processing
163 #define elf_backend_symbol_processing 0
165 #ifndef elf_backend_symbol_table_processing
166 #define elf_backend_symbol_table_processing 0
168 #ifndef elf_backend_section_processing
169 #define elf_backend_section_processing 0
171 #ifndef elf_backend_section_from_shdr
172 #define elf_backend_section_from_shdr 0
174 #ifndef elf_backend_fake_sections
175 #define elf_backend_fake_sections 0
177 #ifndef elf_backend_section_from_bfd_section
178 #define elf_backend_section_from_bfd_section 0
180 #ifndef elf_backend_add_symbol_hook
181 #define elf_backend_add_symbol_hook 0
183 #ifndef elf_backend_link_output_symbol_hook
184 #define elf_backend_link_output_symbol_hook 0
186 #ifndef elf_backend_create_dynamic_sections
187 #define elf_backend_create_dynamic_sections 0
189 #ifndef elf_backend_check_relocs
190 #define elf_backend_check_relocs 0
192 #ifndef elf_backend_adjust_dynamic_symbol
193 #define elf_backend_adjust_dynamic_symbol 0
195 #ifndef elf_backend_size_dynamic_sections
196 #define elf_backend_size_dynamic_sections 0
198 #ifndef elf_backend_relocate_section
199 #define elf_backend_relocate_section 0
201 #ifndef elf_backend_finish_dynamic_symbol
202 #define elf_backend_finish_dynamic_symbol 0
204 #ifndef elf_backend_finish_dynamic_sections
205 #define elf_backend_finish_dynamic_sections 0
207 #ifndef elf_backend_begin_write_processing
208 #define elf_backend_begin_write_processing 0
210 #ifndef elf_backend_final_write_processing
211 #define elf_backend_final_write_processing 0
213 #ifndef elf_backend_create_program_headers
214 #define elf_backend_create_program_headers 0
216 #ifndef elf_backend_ecoff_debug_swap
217 #define elf_backend_ecoff_debug_swap 0
220 #ifndef ELF_MACHINE_ALT1
221 #define ELF_MACHINE_ALT1 0
224 #ifndef ELF_MACHINE_ALT2
225 #define ELF_MACHINE_ALT2 0
228 extern const struct elf_size_info _bfd_elfNN_size_info;
230 static CONST struct elf_backend_data elfNN_bed =
238 ELF_MACHINE_CODE, /* elf_machine_code */
239 ELF_MAXPAGESIZE, /* maxpagesize */
242 elf_info_to_howto_rel,
243 elf_backend_sym_is_global,
244 elf_backend_object_p,
245 elf_backend_symbol_processing,
246 elf_backend_symbol_table_processing,
247 elf_backend_section_processing,
248 elf_backend_section_from_shdr,
249 elf_backend_fake_sections,
250 elf_backend_section_from_bfd_section,
251 elf_backend_add_symbol_hook,
252 elf_backend_link_output_symbol_hook,
253 elf_backend_create_dynamic_sections,
254 elf_backend_check_relocs,
255 elf_backend_adjust_dynamic_symbol,
256 elf_backend_size_dynamic_sections,
257 elf_backend_relocate_section,
258 elf_backend_finish_dynamic_symbol,
259 elf_backend_finish_dynamic_sections,
260 elf_backend_begin_write_processing,
261 elf_backend_final_write_processing,
262 elf_backend_create_program_headers,
263 elf_backend_ecoff_debug_swap,
266 &_bfd_elfNN_size_info,
267 elf_backend_want_got_plt,
268 elf_backend_plt_readonly,
269 elf_backend_want_plt_sym,
270 elf_backend_want_hdr_in_seg,
273 #ifdef TARGET_BIG_SYM
274 const bfd_target TARGET_BIG_SYM =
276 /* name: identify kind of target */
279 /* flavour: general indication about file */
280 bfd_target_elf_flavour,
282 /* byteorder_big_p: data is big endian */
285 /* header_byteorder_big_p: header is also big endian */
288 /* object_flags: mask of all file flags */
289 (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
290 DYNAMIC | WP_TEXT | D_PAGED),
292 /* section_flags: mask of all section flags */
293 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
294 SEC_CODE | SEC_DATA | SEC_DEBUGGING),
296 /* leading_symbol_char: is the first char of a user symbol
297 predictable, and if so what is it */
300 /* ar_pad_char: pad character for filenames within an archive header
301 FIXME: this really has nothing to do with ELF, this is a characteristic
302 of the archiver and/or os and should be independently tunable */
305 /* ar_max_namelen: maximum number of characters in an archive header
306 FIXME: this really has nothing to do with ELF, this is a characteristic
307 of the archiver and should be independently tunable. This value is
308 a WAG (wild a** guess) */
311 /* Routines to byte-swap various sized integers from the data sections */
312 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
313 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
314 bfd_getb16, bfd_getb_signed_16, bfd_putb16,
316 /* Routines to byte-swap various sized integers from the file headers */
317 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
318 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
319 bfd_getb16, bfd_getb_signed_16, bfd_putb16,
321 /* bfd_check_format: check the format of a file being read */
322 { _bfd_dummy_target, /* unknown format */
323 bfd_elfNN_object_p, /* assembler/linker output (object file) */
324 bfd_generic_archive_p, /* an archive */
325 bfd_elfNN_core_file_p /* a core file */
328 /* bfd_set_format: set the format of a file being written */
331 _bfd_generic_mkarchive,
335 /* bfd_write_contents: write cached information into a file being written */
337 bfd_elfNN_write_object_contents,
338 _bfd_write_archive_contents,
342 BFD_JUMP_TABLE_GENERIC (bfd_elfNN),
343 BFD_JUMP_TABLE_COPY (bfd_elfNN),
344 BFD_JUMP_TABLE_CORE (bfd_elfNN),
345 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
346 BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN),
347 BFD_JUMP_TABLE_RELOCS (bfd_elfNN),
348 BFD_JUMP_TABLE_WRITE (bfd_elfNN),
349 BFD_JUMP_TABLE_LINK (bfd_elfNN),
350 BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),
357 #ifdef TARGET_LITTLE_SYM
358 const bfd_target TARGET_LITTLE_SYM =
360 /* name: identify kind of target */
363 /* flavour: general indication about file */
364 bfd_target_elf_flavour,
366 /* byteorder_big_p: data is big endian */
367 false, /* Nope -- this one's little endian */
369 /* header_byteorder_big_p: header is also big endian */
370 false, /* Nope -- this one's little endian */
372 /* object_flags: mask of all file flags */
373 (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
374 DYNAMIC | WP_TEXT | D_PAGED),
376 /* section_flags: mask of all section flags */
377 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
378 SEC_CODE | SEC_DATA | SEC_DEBUGGING),
380 /* leading_symbol_char: is the first char of a user symbol
381 predictable, and if so what is it */
384 /* ar_pad_char: pad character for filenames within an archive header
385 FIXME: this really has nothing to do with ELF, this is a characteristic
386 of the archiver and/or os and should be independently tunable */
389 /* ar_max_namelen: maximum number of characters in an archive header
390 FIXME: this really has nothing to do with ELF, this is a characteristic
391 of the archiver and should be independently tunable. This value is
392 a WAG (wild a** guess) */
395 /* Routines to byte-swap various sized integers from the data sections */
396 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
397 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
398 bfd_getl16, bfd_getl_signed_16, bfd_putl16,
400 /* Routines to byte-swap various sized integers from the file headers */
401 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
402 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
403 bfd_getl16, bfd_getl_signed_16, bfd_putl16,
405 /* bfd_check_format: check the format of a file being read */
406 { _bfd_dummy_target, /* unknown format */
407 bfd_elfNN_object_p, /* assembler/linker output (object file) */
408 bfd_generic_archive_p, /* an archive */
409 bfd_elfNN_core_file_p /* a core file */
412 /* bfd_set_format: set the format of a file being written */
415 _bfd_generic_mkarchive,
419 /* bfd_write_contents: write cached information into a file being written */
421 bfd_elfNN_write_object_contents,
422 _bfd_write_archive_contents,
426 BFD_JUMP_TABLE_GENERIC (bfd_elfNN),
427 BFD_JUMP_TABLE_COPY (bfd_elfNN),
428 BFD_JUMP_TABLE_CORE (bfd_elfNN),
429 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
430 BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN),
431 BFD_JUMP_TABLE_RELOCS (bfd_elfNN),
432 BFD_JUMP_TABLE_WRITE (bfd_elfNN),
433 BFD_JUMP_TABLE_LINK (bfd_elfNN),
434 BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),