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., 675 Mass Ave, Cambridge, MA 02139, 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_get_dynamic_symtab_upper_bound _bfd_elf_get_dynamic_symtab_upper_bound
40 #define bfd_elfNN_get_lineno _bfd_elf_get_lineno
41 #define bfd_elfNN_get_reloc_upper_bound _bfd_elf_get_reloc_upper_bound
42 #define bfd_elfNN_get_symbol_info _bfd_elf_get_symbol_info
43 #define bfd_elfNN_get_symtab _bfd_elf_get_symtab
44 #define bfd_elfNN_get_symtab_upper_bound _bfd_elf_get_symtab_upper_bound
45 #if 0 /* done in libelf.h */
46 #define bfd_elfNN_link_record_dynamic_symbol _bfd_elf_link_record_dynamic_symbol
48 #define bfd_elfNN_make_empty_symbol _bfd_elf_make_empty_symbol
49 #define bfd_elfNN_new_section_hook _bfd_elf_new_section_hook
50 #define bfd_elfNN_set_arch_mach _bfd_elf_set_arch_mach
51 #ifndef bfd_elfNN_set_section_contents
52 #define bfd_elfNN_set_section_contents _bfd_elf_set_section_contents
54 #define bfd_elfNN_sizeof_headers _bfd_elf_sizeof_headers
55 #define bfd_elfNN_write_object_contents _bfd_elf_write_object_contents
57 #ifndef elf_backend_want_got_plt
58 #define elf_backend_want_got_plt 0
60 #ifndef elf_backend_plt_readonly
61 #define elf_backend_plt_readonly 0
63 #ifndef elf_backend_want_plt_sym
64 #define elf_backend_want_plt_sym 0
67 #define bfd_elfNN_bfd_debug_info_start bfd_void
68 #define bfd_elfNN_bfd_debug_info_end bfd_void
69 #define bfd_elfNN_bfd_debug_info_accumulate (PROTO(void,(*),(bfd*, struct sec *))) bfd_void
71 #ifndef bfd_elfNN_bfd_get_relocated_section_contents
72 #define bfd_elfNN_bfd_get_relocated_section_contents \
73 bfd_generic_get_relocated_section_contents
76 #define bfd_elfNN_bfd_relax_section bfd_generic_relax_section
77 #define bfd_elfNN_bfd_make_debug_symbol \
78 ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
80 #ifndef bfd_elfNN_bfd_copy_private_symbol_data
81 #define bfd_elfNN_bfd_copy_private_symbol_data \
82 ((boolean (*) PARAMS ((bfd *, asymbol *, bfd *, asymbol *))) bfd_true)
84 #ifndef bfd_elfNN_bfd_copy_private_section_data
85 #define bfd_elfNN_bfd_copy_private_section_data \
86 ((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_true)
88 #ifndef bfd_elfNN_bfd_copy_private_bfd_data
89 #define bfd_elfNN_bfd_copy_private_bfd_data \
90 ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
92 #ifndef bfd_elfNN_bfd_merge_private_bfd_data
93 #define bfd_elfNN_bfd_merge_private_bfd_data \
94 ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
96 #ifndef bfd_elfNN_bfd_set_private_flags
97 #define bfd_elfNN_bfd_set_private_flags \
98 ((boolean (*) PARAMS ((bfd *, flagword))) bfd_true)
100 #ifndef bfd_elfNN_bfd_is_local_label
101 #define bfd_elfNN_bfd_is_local_label bfd_generic_is_local_label
104 #ifndef bfd_elfNN_get_dynamic_reloc_upper_bound
105 #define bfd_elfNN_get_dynamic_reloc_upper_bound \
106 _bfd_nodynamic_get_dynamic_reloc_upper_bound
108 #ifndef bfd_elfNN_canonicalize_dynamic_reloc
109 #define bfd_elfNN_canonicalize_dynamic_reloc \
110 _bfd_nodynamic_canonicalize_dynamic_reloc
113 #ifdef elf_backend_relocate_section
114 #ifndef bfd_elfNN_bfd_link_hash_table_create
115 #define bfd_elfNN_bfd_link_hash_table_create _bfd_elf_link_hash_table_create
117 #else /* ! defined (elf_backend_relocate_section) */
118 /* If no backend relocate_section routine, use the generic linker. */
119 #ifndef bfd_elfNN_bfd_link_hash_table_create
120 #define bfd_elfNN_bfd_link_hash_table_create \
121 _bfd_generic_link_hash_table_create
123 #ifndef bfd_elfNN_bfd_link_add_symbols
124 #define bfd_elfNN_bfd_link_add_symbols _bfd_generic_link_add_symbols
126 #ifndef bfd_elfNN_bfd_final_link
127 #define bfd_elfNN_bfd_final_link _bfd_generic_final_link
129 #endif /* ! defined (elf_backend_relocate_section) */
130 #ifndef bfd_elfNN_bfd_link_split_section
131 #define bfd_elfNN_bfd_link_split_section _bfd_generic_link_split_section
134 #ifndef elf_info_to_howto_rel
135 #define elf_info_to_howto_rel 0
138 #ifndef ELF_MAXPAGESIZE
139 #define ELF_MAXPAGESIZE 1
142 #ifndef elf_backend_collect
143 #define elf_backend_collect false
146 #ifndef elf_backend_sym_is_global
147 #define elf_backend_sym_is_global 0
149 #ifndef elf_backend_object_p
150 #define elf_backend_object_p 0
152 #ifndef elf_backend_symbol_processing
153 #define elf_backend_symbol_processing 0
155 #ifndef elf_backend_symbol_table_processing
156 #define elf_backend_symbol_table_processing 0
158 #ifndef elf_backend_section_processing
159 #define elf_backend_section_processing 0
161 #ifndef elf_backend_section_from_shdr
162 #define elf_backend_section_from_shdr 0
164 #ifndef elf_backend_fake_sections
165 #define elf_backend_fake_sections 0
167 #ifndef elf_backend_section_from_bfd_section
168 #define elf_backend_section_from_bfd_section 0
170 #ifndef elf_backend_add_symbol_hook
171 #define elf_backend_add_symbol_hook 0
173 #ifndef elf_backend_link_output_symbol_hook
174 #define elf_backend_link_output_symbol_hook 0
176 #ifndef elf_backend_create_dynamic_sections
177 #define elf_backend_create_dynamic_sections 0
179 #ifndef elf_backend_check_relocs
180 #define elf_backend_check_relocs 0
182 #ifndef elf_backend_adjust_dynamic_symbol
183 #define elf_backend_adjust_dynamic_symbol 0
185 #ifndef elf_backend_size_dynamic_sections
186 #define elf_backend_size_dynamic_sections 0
188 #ifndef elf_backend_relocate_section
189 #define elf_backend_relocate_section 0
191 #ifndef elf_backend_finish_dynamic_symbol
192 #define elf_backend_finish_dynamic_symbol 0
194 #ifndef elf_backend_finish_dynamic_sections
195 #define elf_backend_finish_dynamic_sections 0
197 #ifndef elf_backend_begin_write_processing
198 #define elf_backend_begin_write_processing 0
200 #ifndef elf_backend_final_write_processing
201 #define elf_backend_final_write_processing 0
203 #ifndef elf_backend_ecoff_debug_swap
204 #define elf_backend_ecoff_debug_swap 0
207 #ifndef ELF_MACHINE_ALT1
208 #define ELF_MACHINE_ALT1 0
211 #ifndef ELF_MACHINE_ALT2
212 #define ELF_MACHINE_ALT2 0
215 extern const struct elf_size_info _bfd_elfNN_size_info;
217 static CONST struct elf_backend_data elfNN_bed =
225 ELF_MACHINE_CODE, /* elf_machine_code */
226 ELF_MAXPAGESIZE, /* maxpagesize */
229 elf_info_to_howto_rel,
230 elf_backend_sym_is_global,
231 elf_backend_object_p,
232 elf_backend_symbol_processing,
233 elf_backend_symbol_table_processing,
234 elf_backend_section_processing,
235 elf_backend_section_from_shdr,
236 elf_backend_fake_sections,
237 elf_backend_section_from_bfd_section,
238 elf_backend_add_symbol_hook,
239 elf_backend_link_output_symbol_hook,
240 elf_backend_create_dynamic_sections,
241 elf_backend_check_relocs,
242 elf_backend_adjust_dynamic_symbol,
243 elf_backend_size_dynamic_sections,
244 elf_backend_relocate_section,
245 elf_backend_finish_dynamic_symbol,
246 elf_backend_finish_dynamic_sections,
247 elf_backend_begin_write_processing,
248 elf_backend_final_write_processing,
249 elf_backend_ecoff_debug_swap,
252 &_bfd_elfNN_size_info,
253 elf_backend_want_got_plt,
254 elf_backend_plt_readonly,
255 elf_backend_want_plt_sym,
258 #ifdef TARGET_BIG_SYM
259 const bfd_target TARGET_BIG_SYM =
261 /* name: identify kind of target */
264 /* flavour: general indication about file */
265 bfd_target_elf_flavour,
267 /* byteorder_big_p: data is big endian */
270 /* header_byteorder_big_p: header is also big endian */
273 /* object_flags: mask of all file flags */
274 (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
275 DYNAMIC | WP_TEXT | D_PAGED),
277 /* section_flags: mask of all section flags */
278 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
279 SEC_CODE | SEC_DATA | SEC_DEBUGGING),
281 /* leading_symbol_char: is the first char of a user symbol
282 predictable, and if so what is it */
285 /* ar_pad_char: pad character for filenames within an archive header
286 FIXME: this really has nothing to do with ELF, this is a characteristic
287 of the archiver and/or os and should be independently tunable */
290 /* ar_max_namelen: maximum number of characters in an archive header
291 FIXME: this really has nothing to do with ELF, this is a characteristic
292 of the archiver and should be independently tunable. This value is
293 a WAG (wild a** guess) */
296 /* align_power_min: minimum alignment restriction for any section
297 FIXME: this value may be target machine dependent */
300 /* Routines to byte-swap various sized integers from the data sections */
301 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
302 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
303 bfd_getb16, bfd_getb_signed_16, bfd_putb16,
305 /* Routines to byte-swap various sized integers from the file headers */
306 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
307 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
308 bfd_getb16, bfd_getb_signed_16, bfd_putb16,
310 /* bfd_check_format: check the format of a file being read */
311 { _bfd_dummy_target, /* unknown format */
312 bfd_elfNN_object_p, /* assembler/linker output (object file) */
313 bfd_generic_archive_p, /* an archive */
314 bfd_elfNN_core_file_p /* a core file */
317 /* bfd_set_format: set the format of a file being written */
320 _bfd_generic_mkarchive,
324 /* bfd_write_contents: write cached information into a file being written */
326 bfd_elfNN_write_object_contents,
327 _bfd_write_archive_contents,
331 BFD_JUMP_TABLE_GENERIC (bfd_elfNN),
332 BFD_JUMP_TABLE_COPY (bfd_elfNN),
333 BFD_JUMP_TABLE_CORE (bfd_elfNN),
334 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
335 BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN),
336 BFD_JUMP_TABLE_RELOCS (bfd_elfNN),
337 BFD_JUMP_TABLE_WRITE (bfd_elfNN),
338 BFD_JUMP_TABLE_LINK (bfd_elfNN),
339 BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),
346 #ifdef TARGET_LITTLE_SYM
347 const bfd_target TARGET_LITTLE_SYM =
349 /* name: identify kind of target */
352 /* flavour: general indication about file */
353 bfd_target_elf_flavour,
355 /* byteorder_big_p: data is big endian */
356 false, /* Nope -- this one's little endian */
358 /* header_byteorder_big_p: header is also big endian */
359 false, /* Nope -- this one's little endian */
361 /* object_flags: mask of all file flags */
362 (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
363 DYNAMIC | WP_TEXT | D_PAGED),
365 /* section_flags: mask of all section flags */
366 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
367 SEC_CODE | SEC_DATA | SEC_DEBUGGING),
369 /* leading_symbol_char: is the first char of a user symbol
370 predictable, and if so what is it */
373 /* ar_pad_char: pad character for filenames within an archive header
374 FIXME: this really has nothing to do with ELF, this is a characteristic
375 of the archiver and/or os and should be independently tunable */
378 /* ar_max_namelen: maximum number of characters in an archive header
379 FIXME: this really has nothing to do with ELF, this is a characteristic
380 of the archiver and should be independently tunable. This value is
381 a WAG (wild a** guess) */
384 /* align_power_min: minimum alignment restriction for any section
385 FIXME: this value may be target machine dependent */
388 /* Routines to byte-swap various sized integers from the data sections */
389 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
390 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
391 bfd_getl16, bfd_getl_signed_16, bfd_putl16,
393 /* Routines to byte-swap various sized integers from the file headers */
394 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
395 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
396 bfd_getl16, bfd_getl_signed_16, bfd_putl16,
398 /* bfd_check_format: check the format of a file being read */
399 { _bfd_dummy_target, /* unknown format */
400 bfd_elfNN_object_p, /* assembler/linker output (object file) */
401 bfd_generic_archive_p, /* an archive */
402 bfd_elfNN_core_file_p /* a core file */
405 /* bfd_set_format: set the format of a file being written */
408 _bfd_generic_mkarchive,
412 /* bfd_write_contents: write cached information into a file being written */
414 bfd_elfNN_write_object_contents,
415 _bfd_write_archive_contents,
419 BFD_JUMP_TABLE_GENERIC (bfd_elfNN),
420 BFD_JUMP_TABLE_COPY (bfd_elfNN),
421 BFD_JUMP_TABLE_CORE (bfd_elfNN),
422 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
423 BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN),
424 BFD_JUMP_TABLE_RELOCS (bfd_elfNN),
425 BFD_JUMP_TABLE_WRITE (bfd_elfNN),
426 BFD_JUMP_TABLE_LINK (bfd_elfNN),
427 BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),