1 /* Target definitions for 32-bit ELF
2 Copyright 1993, 1994 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_elf32_close_and_cleanup _bfd_generic_close_and_cleanup
29 #define bfd_elf32_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
30 #ifndef bfd_elf32_get_section_contents
31 #define bfd_elf32_get_section_contents _bfd_generic_get_section_contents
34 #ifndef bfd_elf32_bfd_get_relocated_section_contents
35 #define bfd_elf32_bfd_get_relocated_section_contents \
36 bfd_generic_get_relocated_section_contents
38 #define bfd_elf32_bfd_relax_section bfd_generic_relax_section
39 #define bfd_elf32_bfd_make_debug_symbol \
40 ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
42 #ifndef bfd_elf32_bfd_copy_private_section_data
43 #define bfd_elf32_bfd_copy_private_section_data \
44 ((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_true)
46 #ifndef bfd_elf32_bfd_copy_private_bfd_data
47 #define bfd_elf32_bfd_copy_private_bfd_data \
48 ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
50 #ifndef bfd_elf32_bfd_merge_private_bfd_data
51 #define bfd_elf32_bfd_merge_private_bfd_data \
52 ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
54 #ifndef bfd_elf32_bfd_set_private_flags
55 #define bfd_elf32_bfd_set_private_flags \
56 ((boolean (*) PARAMS ((bfd *, flagword))) bfd_true)
58 #ifndef bfd_elf32_bfd_is_local_label
59 #define bfd_elf32_bfd_is_local_label bfd_generic_is_local_label
62 #ifndef bfd_elf32_get_dynamic_reloc_upper_bound
63 #define bfd_elf32_get_dynamic_reloc_upper_bound \
64 _bfd_nodynamic_get_dynamic_reloc_upper_bound
66 #ifndef bfd_elf32_canonicalize_dynamic_reloc
67 #define bfd_elf32_canonicalize_dynamic_reloc \
68 _bfd_nodynamic_canonicalize_dynamic_reloc
71 #ifdef elf_backend_relocate_section
72 #ifndef bfd_elf32_bfd_link_hash_table_create
73 #define bfd_elf32_bfd_link_hash_table_create _bfd_elf_link_hash_table_create
75 #else /* ! defined (elf_backend_relocate_section) */
76 /* If no backend relocate_section routine, use the generic linker. */
77 #ifndef bfd_elf32_bfd_link_hash_table_create
78 #define bfd_elf32_bfd_link_hash_table_create \
79 _bfd_generic_link_hash_table_create
81 #ifndef bfd_elf32_bfd_link_add_symbols
82 #define bfd_elf32_bfd_link_add_symbols _bfd_generic_link_add_symbols
84 #ifndef bfd_elf32_bfd_final_link
85 #define bfd_elf32_bfd_final_link _bfd_generic_final_link
87 #endif /* ! defined (elf_backend_relocate_section) */
89 #ifndef elf_info_to_howto_rel
90 #define elf_info_to_howto_rel 0
93 #ifndef ELF_MAXPAGESIZE
94 #define ELF_MAXPAGESIZE 1
97 #ifndef elf_backend_collect
98 #define elf_backend_collect false
101 #ifndef elf_backend_sym_is_global
102 #define elf_backend_sym_is_global 0
104 #ifndef elf_backend_object_p
105 #define elf_backend_object_p 0
107 #ifndef elf_backend_symbol_processing
108 #define elf_backend_symbol_processing 0
110 #ifndef elf_backend_symbol_table_processing
111 #define elf_backend_symbol_table_processing 0
113 #ifndef elf_backend_section_processing
114 #define elf_backend_section_processing 0
116 #ifndef elf_backend_section_from_shdr
117 #define elf_backend_section_from_shdr 0
119 #ifndef elf_backend_fake_sections
120 #define elf_backend_fake_sections 0
122 #ifndef elf_backend_section_from_bfd_section
123 #define elf_backend_section_from_bfd_section 0
125 #ifndef elf_backend_add_symbol_hook
126 #define elf_backend_add_symbol_hook 0
128 #ifndef elf_backend_link_output_symbol_hook
129 #define elf_backend_link_output_symbol_hook 0
131 #ifndef elf_backend_create_dynamic_sections
132 #define elf_backend_create_dynamic_sections 0
134 #ifndef elf_backend_check_relocs
135 #define elf_backend_check_relocs 0
137 #ifndef elf_backend_adjust_dynamic_symbol
138 #define elf_backend_adjust_dynamic_symbol 0
140 #ifndef elf_backend_size_dynamic_sections
141 #define elf_backend_size_dynamic_sections 0
143 #ifndef elf_backend_relocate_section
144 #define elf_backend_relocate_section 0
146 #ifndef elf_backend_finish_dynamic_symbol
147 #define elf_backend_finish_dynamic_symbol 0
149 #ifndef elf_backend_finish_dynamic_sections
150 #define elf_backend_finish_dynamic_sections 0
152 #ifndef elf_backend_begin_write_processing
153 #define elf_backend_begin_write_processing 0
155 #ifndef elf_backend_final_write_processing
156 #define elf_backend_final_write_processing 0
158 #ifndef elf_backend_ecoff_debug_swap
159 #define elf_backend_ecoff_debug_swap 0
162 #ifndef ELF_MACHINE_ALT1
163 #define ELF_MACHINE_ALT1 0
166 #ifndef ELF_MACHINE_ALT2
167 #define ELF_MACHINE_ALT2 0
170 static CONST struct elf_backend_data elf32_bed =
179 ELF_MACHINE_CODE, /* elf_machine_code */
180 ELF_MAXPAGESIZE, /* maxpagesize */
183 elf_info_to_howto_rel,
184 elf_backend_sym_is_global,
185 elf_backend_object_p,
186 elf_backend_symbol_processing,
187 elf_backend_symbol_table_processing,
188 elf_backend_section_processing,
189 elf_backend_section_from_shdr,
190 elf_backend_fake_sections,
191 elf_backend_section_from_bfd_section,
192 elf_backend_add_symbol_hook,
193 elf_backend_link_output_symbol_hook,
194 elf_backend_create_dynamic_sections,
195 elf_backend_check_relocs,
196 elf_backend_adjust_dynamic_symbol,
197 elf_backend_size_dynamic_sections,
198 elf_backend_relocate_section,
199 elf_backend_finish_dynamic_symbol,
200 elf_backend_finish_dynamic_sections,
201 elf_backend_begin_write_processing,
202 elf_backend_final_write_processing,
203 elf_backend_ecoff_debug_swap,
208 #ifdef TARGET_BIG_SYM
209 const bfd_target TARGET_BIG_SYM =
211 /* name: identify kind of target */
214 /* flavour: general indication about file */
215 bfd_target_elf_flavour,
217 /* byteorder_big_p: data is big endian */
220 /* header_byteorder_big_p: header is also big endian */
223 /* object_flags: mask of all file flags */
224 (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
225 DYNAMIC | WP_TEXT | D_PAGED),
227 /* section_flags: mask of all section flags */
228 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
229 SEC_CODE | SEC_DATA | SEC_DEBUGGING),
231 /* leading_symbol_char: is the first char of a user symbol
232 predictable, and if so what is it */
235 /* ar_pad_char: pad character for filenames within an archive header
236 FIXME: this really has nothing to do with ELF, this is a characteristic
237 of the archiver and/or os and should be independently tunable */
240 /* ar_max_namelen: maximum number of characters in an archive header
241 FIXME: this really has nothing to do with ELF, this is a characteristic
242 of the archiver and should be independently tunable. This value is
243 a WAG (wild a** guess) */
246 /* align_power_min: minimum alignment restriction for any section
247 FIXME: this value may be target machine dependent */
250 /* Routines to byte-swap various sized integers from the data sections */
251 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
252 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
253 bfd_getb16, bfd_getb_signed_16, bfd_putb16,
255 /* Routines to byte-swap various sized integers from the file headers */
256 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
257 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
258 bfd_getb16, bfd_getb_signed_16, bfd_putb16,
260 /* bfd_check_format: check the format of a file being read */
261 { _bfd_dummy_target, /* unknown format */
262 bfd_elf32_object_p, /* assembler/linker output (object file) */
263 bfd_generic_archive_p, /* an archive */
264 bfd_elf32_core_file_p /* a core file */
267 /* bfd_set_format: set the format of a file being written */
270 _bfd_generic_mkarchive,
274 /* bfd_write_contents: write cached information into a file being written */
276 bfd_elf32_write_object_contents,
277 _bfd_write_archive_contents,
281 BFD_JUMP_TABLE_GENERIC (bfd_elf32),
282 BFD_JUMP_TABLE_COPY (bfd_elf32),
283 BFD_JUMP_TABLE_CORE (bfd_elf32),
284 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
285 BFD_JUMP_TABLE_SYMBOLS (bfd_elf32),
286 BFD_JUMP_TABLE_RELOCS (bfd_elf32),
287 BFD_JUMP_TABLE_WRITE (bfd_elf32),
288 BFD_JUMP_TABLE_LINK (bfd_elf32),
289 BFD_JUMP_TABLE_DYNAMIC (bfd_elf32),
296 #ifdef TARGET_LITTLE_SYM
297 const bfd_target TARGET_LITTLE_SYM =
299 /* name: identify kind of target */
302 /* flavour: general indication about file */
303 bfd_target_elf_flavour,
305 /* byteorder_big_p: data is big endian */
306 false, /* Nope -- this one's little endian */
308 /* header_byteorder_big_p: header is also big endian */
309 false, /* Nope -- this one's little endian */
311 /* object_flags: mask of all file flags */
312 (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
313 DYNAMIC | WP_TEXT | D_PAGED),
315 /* section_flags: mask of all section flags */
316 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
317 SEC_CODE | SEC_DATA | SEC_DEBUGGING),
319 /* leading_symbol_char: is the first char of a user symbol
320 predictable, and if so what is it */
323 /* ar_pad_char: pad character for filenames within an archive header
324 FIXME: this really has nothing to do with ELF, this is a characteristic
325 of the archiver and/or os and should be independently tunable */
328 /* ar_max_namelen: maximum number of characters in an archive header
329 FIXME: this really has nothing to do with ELF, this is a characteristic
330 of the archiver and should be independently tunable. This value is
331 a WAG (wild a** guess) */
334 /* align_power_min: minimum alignment restriction for any section
335 FIXME: this value may be target machine dependent */
338 /* Routines to byte-swap various sized integers from the data sections */
339 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
340 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
341 bfd_getl16, bfd_getl_signed_16, bfd_putl16,
343 /* Routines to byte-swap various sized integers from the file headers */
344 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
345 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
346 bfd_getl16, bfd_getl_signed_16, bfd_putl16,
348 /* bfd_check_format: check the format of a file being read */
349 { _bfd_dummy_target, /* unknown format */
350 bfd_elf32_object_p, /* assembler/linker output (object file) */
351 bfd_generic_archive_p, /* an archive */
352 bfd_elf32_core_file_p /* a core file */
355 /* bfd_set_format: set the format of a file being written */
358 _bfd_generic_mkarchive,
362 /* bfd_write_contents: write cached information into a file being written */
364 bfd_elf32_write_object_contents,
365 _bfd_write_archive_contents,
369 BFD_JUMP_TABLE_GENERIC (bfd_elf32),
370 BFD_JUMP_TABLE_COPY (bfd_elf32),
371 BFD_JUMP_TABLE_CORE (bfd_elf32),
372 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
373 BFD_JUMP_TABLE_SYMBOLS (bfd_elf32),
374 BFD_JUMP_TABLE_RELOCS (bfd_elf32),
375 BFD_JUMP_TABLE_WRITE (bfd_elf32),
376 BFD_JUMP_TABLE_LINK (bfd_elf32),
377 BFD_JUMP_TABLE_DYNAMIC (bfd_elf32),