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_bfd_debug_info_start bfd_void
35 #define bfd_elfNN_bfd_debug_info_end bfd_void
36 #define bfd_elfNN_bfd_debug_info_accumulate (PROTO(void,(*),(bfd*, struct sec *))) bfd_void
38 #ifndef bfd_elfNN_bfd_get_relocated_section_contents
39 #define bfd_elfNN_bfd_get_relocated_section_contents \
40 bfd_generic_get_relocated_section_contents
43 #define bfd_elfNN_bfd_relax_section bfd_generic_relax_section
44 #define bfd_elfNN_bfd_make_debug_symbol \
45 ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
47 #ifndef bfd_elfNN_bfd_copy_private_symbol_data
48 #define bfd_elfNN_bfd_copy_private_symbol_data \
49 ((boolean (*) PARAMS ((bfd *, asymbol *, bfd *, asymbol *))) bfd_true)
51 #ifndef bfd_elfNN_bfd_copy_private_section_data
52 #define bfd_elfNN_bfd_copy_private_section_data \
53 ((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_true)
55 #ifndef bfd_elfNN_bfd_copy_private_bfd_data
56 #define bfd_elfNN_bfd_copy_private_bfd_data \
57 ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
59 #ifndef bfd_elfNN_bfd_merge_private_bfd_data
60 #define bfd_elfNN_bfd_merge_private_bfd_data \
61 ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
63 #ifndef bfd_elfNN_bfd_set_private_flags
64 #define bfd_elfNN_bfd_set_private_flags \
65 ((boolean (*) PARAMS ((bfd *, flagword))) bfd_true)
67 #ifndef bfd_elfNN_bfd_is_local_label
68 #define bfd_elfNN_bfd_is_local_label bfd_generic_is_local_label
71 #ifndef bfd_elfNN_get_dynamic_reloc_upper_bound
72 #define bfd_elfNN_get_dynamic_reloc_upper_bound \
73 _bfd_nodynamic_get_dynamic_reloc_upper_bound
75 #ifndef bfd_elfNN_canonicalize_dynamic_reloc
76 #define bfd_elfNN_canonicalize_dynamic_reloc \
77 _bfd_nodynamic_canonicalize_dynamic_reloc
80 #ifdef elf_backend_relocate_section
81 #ifndef bfd_elfNN_bfd_link_hash_table_create
82 #define bfd_elfNN_bfd_link_hash_table_create _bfd_elf_link_hash_table_create
84 #else /* ! defined (elf_backend_relocate_section) */
85 /* If no backend relocate_section routine, use the generic linker. */
86 #ifndef bfd_elfNN_bfd_link_hash_table_create
87 #define bfd_elfNN_bfd_link_hash_table_create \
88 _bfd_generic_link_hash_table_create
90 #ifndef bfd_elfNN_bfd_link_add_symbols
91 #define bfd_elfNN_bfd_link_add_symbols _bfd_generic_link_add_symbols
93 #ifndef bfd_elfNN_bfd_final_link
94 #define bfd_elfNN_bfd_final_link _bfd_generic_final_link
96 #endif /* ! defined (elf_backend_relocate_section) */
97 #ifndef bfd_elfNN_bfd_link_split_section
98 #define bfd_elfNN_bfd_link_split_section _bfd_generic_link_split_section
101 #ifndef elf_info_to_howto_rel
102 #define elf_info_to_howto_rel 0
105 #ifndef ELF_MAXPAGESIZE
106 #define ELF_MAXPAGESIZE 1
109 #ifndef elf_backend_collect
110 #define elf_backend_collect false
113 #ifndef elf_backend_sym_is_global
114 #define elf_backend_sym_is_global 0
116 #ifndef elf_backend_object_p
117 #define elf_backend_object_p 0
119 #ifndef elf_backend_symbol_processing
120 #define elf_backend_symbol_processing 0
122 #ifndef elf_backend_symbol_table_processing
123 #define elf_backend_symbol_table_processing 0
125 #ifndef elf_backend_section_processing
126 #define elf_backend_section_processing 0
128 #ifndef elf_backend_section_from_shdr
129 #define elf_backend_section_from_shdr 0
131 #ifndef elf_backend_fake_sections
132 #define elf_backend_fake_sections 0
134 #ifndef elf_backend_section_from_bfd_section
135 #define elf_backend_section_from_bfd_section 0
137 #ifndef elf_backend_add_symbol_hook
138 #define elf_backend_add_symbol_hook 0
140 #ifndef elf_backend_link_output_symbol_hook
141 #define elf_backend_link_output_symbol_hook 0
143 #ifndef elf_backend_create_dynamic_sections
144 #define elf_backend_create_dynamic_sections 0
146 #ifndef elf_backend_check_relocs
147 #define elf_backend_check_relocs 0
149 #ifndef elf_backend_adjust_dynamic_symbol
150 #define elf_backend_adjust_dynamic_symbol 0
152 #ifndef elf_backend_size_dynamic_sections
153 #define elf_backend_size_dynamic_sections 0
155 #ifndef elf_backend_relocate_section
156 #define elf_backend_relocate_section 0
158 #ifndef elf_backend_finish_dynamic_symbol
159 #define elf_backend_finish_dynamic_symbol 0
161 #ifndef elf_backend_finish_dynamic_sections
162 #define elf_backend_finish_dynamic_sections 0
164 #ifndef elf_backend_begin_write_processing
165 #define elf_backend_begin_write_processing 0
167 #ifndef elf_backend_final_write_processing
168 #define elf_backend_final_write_processing 0
170 #ifndef elf_backend_ecoff_debug_swap
171 #define elf_backend_ecoff_debug_swap 0
174 #ifndef ELF_MACHINE_ALT1
175 #define ELF_MACHINE_ALT1 0
178 #ifndef ELF_MACHINE_ALT2
179 #define ELF_MACHINE_ALT2 0
182 static CONST struct elf_backend_data elfNN_bed =
195 ELF_MACHINE_CODE, /* elf_machine_code */
196 ELF_MAXPAGESIZE, /* maxpagesize */
199 elf_info_to_howto_rel,
200 elf_backend_sym_is_global,
201 elf_backend_object_p,
202 elf_backend_symbol_processing,
203 elf_backend_symbol_table_processing,
204 elf_backend_section_processing,
205 elf_backend_section_from_shdr,
206 elf_backend_fake_sections,
207 elf_backend_section_from_bfd_section,
208 elf_backend_add_symbol_hook,
209 elf_backend_link_output_symbol_hook,
210 elf_backend_create_dynamic_sections,
211 elf_backend_check_relocs,
212 elf_backend_adjust_dynamic_symbol,
213 elf_backend_size_dynamic_sections,
214 elf_backend_relocate_section,
215 elf_backend_finish_dynamic_symbol,
216 elf_backend_finish_dynamic_sections,
217 elf_backend_begin_write_processing,
218 elf_backend_final_write_processing,
219 elf_backend_ecoff_debug_swap,
224 #ifdef TARGET_BIG_SYM
225 const bfd_target TARGET_BIG_SYM =
227 /* name: identify kind of target */
230 /* flavour: general indication about file */
231 bfd_target_elf_flavour,
233 /* byteorder_big_p: data is big endian */
236 /* header_byteorder_big_p: header is also big endian */
239 /* object_flags: mask of all file flags */
240 (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
241 DYNAMIC | WP_TEXT | D_PAGED),
243 /* section_flags: mask of all section flags */
244 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
245 SEC_CODE | SEC_DATA | SEC_DEBUGGING),
247 /* leading_symbol_char: is the first char of a user symbol
248 predictable, and if so what is it */
251 /* ar_pad_char: pad character for filenames within an archive header
252 FIXME: this really has nothing to do with ELF, this is a characteristic
253 of the archiver and/or os and should be independently tunable */
256 /* ar_max_namelen: maximum number of characters in an archive header
257 FIXME: this really has nothing to do with ELF, this is a characteristic
258 of the archiver and should be independently tunable. This value is
259 a WAG (wild a** guess) */
262 /* align_power_min: minimum alignment restriction for any section
263 FIXME: this value may be target machine dependent */
266 /* Routines to byte-swap various sized integers from the data sections */
267 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
268 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
269 bfd_getb16, bfd_getb_signed_16, bfd_putb16,
271 /* Routines to byte-swap various sized integers from the file headers */
272 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
273 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
274 bfd_getb16, bfd_getb_signed_16, bfd_putb16,
276 /* bfd_check_format: check the format of a file being read */
277 { _bfd_dummy_target, /* unknown format */
278 bfd_elfNN_object_p, /* assembler/linker output (object file) */
279 bfd_generic_archive_p, /* an archive */
280 bfd_elfNN_core_file_p /* a core file */
283 /* bfd_set_format: set the format of a file being written */
286 _bfd_generic_mkarchive,
290 /* bfd_write_contents: write cached information into a file being written */
292 bfd_elfNN_write_object_contents,
293 _bfd_write_archive_contents,
297 BFD_JUMP_TABLE_GENERIC (bfd_elfNN),
298 BFD_JUMP_TABLE_COPY (bfd_elfNN),
299 BFD_JUMP_TABLE_CORE (bfd_elfNN),
300 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
301 BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN),
302 BFD_JUMP_TABLE_RELOCS (bfd_elfNN),
303 BFD_JUMP_TABLE_WRITE (bfd_elfNN),
304 BFD_JUMP_TABLE_LINK (bfd_elfNN),
305 BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),
312 #ifdef TARGET_LITTLE_SYM
313 const bfd_target TARGET_LITTLE_SYM =
315 /* name: identify kind of target */
318 /* flavour: general indication about file */
319 bfd_target_elf_flavour,
321 /* byteorder_big_p: data is big endian */
322 false, /* Nope -- this one's little endian */
324 /* header_byteorder_big_p: header is also big endian */
325 false, /* Nope -- this one's little endian */
327 /* object_flags: mask of all file flags */
328 (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
329 DYNAMIC | WP_TEXT | D_PAGED),
331 /* section_flags: mask of all section flags */
332 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
333 SEC_CODE | SEC_DATA | SEC_DEBUGGING),
335 /* leading_symbol_char: is the first char of a user symbol
336 predictable, and if so what is it */
339 /* ar_pad_char: pad character for filenames within an archive header
340 FIXME: this really has nothing to do with ELF, this is a characteristic
341 of the archiver and/or os and should be independently tunable */
344 /* ar_max_namelen: maximum number of characters in an archive header
345 FIXME: this really has nothing to do with ELF, this is a characteristic
346 of the archiver and should be independently tunable. This value is
347 a WAG (wild a** guess) */
350 /* align_power_min: minimum alignment restriction for any section
351 FIXME: this value may be target machine dependent */
354 /* Routines to byte-swap various sized integers from the data sections */
355 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
356 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
357 bfd_getl16, bfd_getl_signed_16, bfd_putl16,
359 /* Routines to byte-swap various sized integers from the file headers */
360 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
361 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
362 bfd_getl16, bfd_getl_signed_16, bfd_putl16,
364 /* bfd_check_format: check the format of a file being read */
365 { _bfd_dummy_target, /* unknown format */
366 bfd_elfNN_object_p, /* assembler/linker output (object file) */
367 bfd_generic_archive_p, /* an archive */
368 bfd_elfNN_core_file_p /* a core file */
371 /* bfd_set_format: set the format of a file being written */
374 _bfd_generic_mkarchive,
378 /* bfd_write_contents: write cached information into a file being written */
380 bfd_elfNN_write_object_contents,
381 _bfd_write_archive_contents,
385 BFD_JUMP_TABLE_GENERIC (bfd_elfNN),
386 BFD_JUMP_TABLE_COPY (bfd_elfNN),
387 BFD_JUMP_TABLE_CORE (bfd_elfNN),
388 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
389 BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN),
390 BFD_JUMP_TABLE_RELOCS (bfd_elfNN),
391 BFD_JUMP_TABLE_WRITE (bfd_elfNN),
392 BFD_JUMP_TABLE_LINK (bfd_elfNN),
393 BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),