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 #define bfd_elf32_bfd_get_relocated_section_contents \
35 bfd_generic_get_relocated_section_contents
36 #define bfd_elf32_bfd_relax_section bfd_generic_relax_section
37 #define bfd_elf32_bfd_make_debug_symbol \
38 ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
40 #ifndef bfd_elf32_bfd_copy_private_section_data
41 #define bfd_elf32_bfd_copy_private_section_data \
42 ((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_true)
44 #ifndef bfd_elf32_bfd_copy_private_bfd_data
45 #define bfd_elf32_bfd_copy_private_bfd_data \
46 ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
48 #ifndef bfd_elf32_bfd_is_local_label
49 #define bfd_elf32_bfd_is_local_label bfd_generic_is_local_label
52 #ifndef bfd_elf32_get_dynamic_reloc_upper_bound
53 #define bfd_elf32_get_dynamic_reloc_upper_bound \
54 _bfd_nodynamic_get_dynamic_reloc_upper_bound
56 #ifndef bfd_elf32_canonicalize_dynamic_reloc
57 #define bfd_elf32_canonicalize_dynamic_reloc \
58 _bfd_nodynamic_canonicalize_dynamic_reloc
61 #ifdef elf_backend_relocate_section
62 #ifndef bfd_elf32_bfd_link_hash_table_create
63 #define bfd_elf32_bfd_link_hash_table_create _bfd_elf_link_hash_table_create
65 #else /* ! defined (elf_backend_relocate_section) */
66 /* If no backend relocate_section routine, use the generic linker. */
67 #ifndef bfd_elf32_bfd_link_hash_table_create
68 #define bfd_elf32_bfd_link_hash_table_create \
69 _bfd_generic_link_hash_table_create
71 #ifndef bfd_elf32_bfd_link_add_symbols
72 #define bfd_elf32_bfd_link_add_symbols _bfd_generic_link_add_symbols
74 #ifndef bfd_elf32_bfd_final_link
75 #define bfd_elf32_bfd_final_link _bfd_generic_final_link
77 #endif /* ! defined (elf_backend_relocate_section) */
79 #ifndef elf_info_to_howto_rel
80 #define elf_info_to_howto_rel 0
83 #ifndef ELF_MAXPAGESIZE
84 #define ELF_MAXPAGESIZE 1
87 #ifndef elf_backend_collect
88 #define elf_backend_collect false
91 #ifndef elf_backend_sym_is_global
92 #define elf_backend_sym_is_global 0
94 #ifndef elf_backend_object_p
95 #define elf_backend_object_p 0
97 #ifndef elf_backend_symbol_processing
98 #define elf_backend_symbol_processing 0
100 #ifndef elf_backend_symbol_table_processing
101 #define elf_backend_symbol_table_processing 0
103 #ifndef elf_backend_section_processing
104 #define elf_backend_section_processing 0
106 #ifndef elf_backend_section_from_shdr
107 #define elf_backend_section_from_shdr 0
109 #ifndef elf_backend_fake_sections
110 #define elf_backend_fake_sections 0
112 #ifndef elf_backend_section_from_bfd_section
113 #define elf_backend_section_from_bfd_section 0
115 #ifndef elf_backend_add_symbol_hook
116 #define elf_backend_add_symbol_hook 0
118 #ifndef elf_backend_link_output_symbol_hook
119 #define elf_backend_link_output_symbol_hook 0
121 #ifndef elf_backend_create_dynamic_sections
122 #define elf_backend_create_dynamic_sections 0
124 #ifndef elf_backend_check_relocs
125 #define elf_backend_check_relocs 0
127 #ifndef elf_backend_adjust_dynamic_symbol
128 #define elf_backend_adjust_dynamic_symbol 0
130 #ifndef elf_backend_size_dynamic_sections
131 #define elf_backend_size_dynamic_sections 0
133 #ifndef elf_backend_relocate_section
134 #define elf_backend_relocate_section 0
136 #ifndef elf_backend_finish_dynamic_symbol
137 #define elf_backend_finish_dynamic_symbol 0
139 #ifndef elf_backend_finish_dynamic_sections
140 #define elf_backend_finish_dynamic_sections 0
142 #ifndef elf_backend_begin_write_processing
143 #define elf_backend_begin_write_processing 0
145 #ifndef elf_backend_final_write_processing
146 #define elf_backend_final_write_processing 0
148 #ifndef elf_backend_ecoff_debug_swap
149 #define elf_backend_ecoff_debug_swap 0
152 static CONST
struct elf_backend_data elf32_bed
=
161 ELF_MACHINE_CODE
, /* elf_machine_code */
162 ELF_MAXPAGESIZE
, /* maxpagesize */
165 elf_info_to_howto_rel
,
166 elf_backend_sym_is_global
,
167 elf_backend_object_p
,
168 elf_backend_symbol_processing
,
169 elf_backend_symbol_table_processing
,
170 elf_backend_section_processing
,
171 elf_backend_section_from_shdr
,
172 elf_backend_fake_sections
,
173 elf_backend_section_from_bfd_section
,
174 elf_backend_add_symbol_hook
,
175 elf_backend_link_output_symbol_hook
,
176 elf_backend_create_dynamic_sections
,
177 elf_backend_check_relocs
,
178 elf_backend_adjust_dynamic_symbol
,
179 elf_backend_size_dynamic_sections
,
180 elf_backend_relocate_section
,
181 elf_backend_finish_dynamic_symbol
,
182 elf_backend_finish_dynamic_sections
,
183 elf_backend_begin_write_processing
,
184 elf_backend_final_write_processing
,
185 elf_backend_ecoff_debug_swap
188 #ifdef TARGET_BIG_SYM
189 const bfd_target TARGET_BIG_SYM
=
191 /* name: identify kind of target */
194 /* flavour: general indication about file */
195 bfd_target_elf_flavour
,
197 /* byteorder_big_p: data is big endian */
200 /* header_byteorder_big_p: header is also big endian */
203 /* object_flags: mask of all file flags */
204 (HAS_RELOC
| EXEC_P
| HAS_LINENO
| HAS_DEBUG
| HAS_SYMS
| HAS_LOCALS
|
205 DYNAMIC
| WP_TEXT
| D_PAGED
),
207 /* section_flags: mask of all section flags */
208 (SEC_HAS_CONTENTS
| SEC_ALLOC
| SEC_LOAD
| SEC_RELOC
| SEC_READONLY
|
209 SEC_CODE
| SEC_DATA
| SEC_DEBUGGING
),
211 /* leading_symbol_char: is the first char of a user symbol
212 predictable, and if so what is it */
215 /* ar_pad_char: pad character for filenames within an archive header
216 FIXME: this really has nothing to do with ELF, this is a characteristic
217 of the archiver and/or os and should be independently tunable */
220 /* ar_max_namelen: maximum number of characters in an archive header
221 FIXME: this really has nothing to do with ELF, this is a characteristic
222 of the archiver and should be independently tunable. This value is
223 a WAG (wild a** guess) */
226 /* align_power_min: minimum alignment restriction for any section
227 FIXME: this value may be target machine dependent */
230 /* Routines to byte-swap various sized integers from the data sections */
231 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
232 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
233 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
,
235 /* Routines to byte-swap various sized integers from the file headers */
236 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
237 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
238 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
,
240 /* bfd_check_format: check the format of a file being read */
241 { _bfd_dummy_target
, /* unknown format */
242 bfd_elf32_object_p
, /* assembler/linker output (object file) */
243 bfd_generic_archive_p
, /* an archive */
244 bfd_elf32_core_file_p
/* a core file */
247 /* bfd_set_format: set the format of a file being written */
250 _bfd_generic_mkarchive
,
254 /* bfd_write_contents: write cached information into a file being written */
256 bfd_elf32_write_object_contents
,
257 _bfd_write_archive_contents
,
261 BFD_JUMP_TABLE_GENERIC (bfd_elf32
),
262 BFD_JUMP_TABLE_COPY (bfd_elf32
),
263 BFD_JUMP_TABLE_CORE (bfd_elf32
),
264 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff
),
265 BFD_JUMP_TABLE_SYMBOLS (bfd_elf32
),
266 BFD_JUMP_TABLE_RELOCS (bfd_elf32
),
267 BFD_JUMP_TABLE_WRITE (bfd_elf32
),
268 BFD_JUMP_TABLE_LINK (bfd_elf32
),
269 BFD_JUMP_TABLE_DYNAMIC (bfd_elf32
),
276 #ifdef TARGET_LITTLE_SYM
277 const bfd_target TARGET_LITTLE_SYM
=
279 /* name: identify kind of target */
282 /* flavour: general indication about file */
283 bfd_target_elf_flavour
,
285 /* byteorder_big_p: data is big endian */
286 false, /* Nope -- this one's little endian */
288 /* header_byteorder_big_p: header is also big endian */
289 false, /* Nope -- this one's little endian */
291 /* object_flags: mask of all file flags */
292 (HAS_RELOC
| EXEC_P
| HAS_LINENO
| HAS_DEBUG
| HAS_SYMS
| HAS_LOCALS
|
293 DYNAMIC
| WP_TEXT
| D_PAGED
),
295 /* section_flags: mask of all section flags */
296 (SEC_HAS_CONTENTS
| SEC_ALLOC
| SEC_LOAD
| SEC_RELOC
| SEC_READONLY
|
297 SEC_CODE
| SEC_DATA
| SEC_DEBUGGING
),
299 /* leading_symbol_char: is the first char of a user symbol
300 predictable, and if so what is it */
303 /* ar_pad_char: pad character for filenames within an archive header
304 FIXME: this really has nothing to do with ELF, this is a characteristic
305 of the archiver and/or os and should be independently tunable */
308 /* ar_max_namelen: maximum number of characters in an archive header
309 FIXME: this really has nothing to do with ELF, this is a characteristic
310 of the archiver and should be independently tunable. This value is
311 a WAG (wild a** guess) */
314 /* align_power_min: minimum alignment restriction for any section
315 FIXME: this value may be target machine dependent */
318 /* Routines to byte-swap various sized integers from the data sections */
319 bfd_getl64
, bfd_getl_signed_64
, bfd_putl64
,
320 bfd_getl32
, bfd_getl_signed_32
, bfd_putl32
,
321 bfd_getl16
, bfd_getl_signed_16
, bfd_putl16
,
323 /* Routines to byte-swap various sized integers from the file headers */
324 bfd_getl64
, bfd_getl_signed_64
, bfd_putl64
,
325 bfd_getl32
, bfd_getl_signed_32
, bfd_putl32
,
326 bfd_getl16
, bfd_getl_signed_16
, bfd_putl16
,
328 /* bfd_check_format: check the format of a file being read */
329 { _bfd_dummy_target
, /* unknown format */
330 bfd_elf32_object_p
, /* assembler/linker output (object file) */
331 bfd_generic_archive_p
, /* an archive */
332 bfd_elf32_core_file_p
/* a core file */
335 /* bfd_set_format: set the format of a file being written */
338 _bfd_generic_mkarchive
,
342 /* bfd_write_contents: write cached information into a file being written */
344 bfd_elf32_write_object_contents
,
345 _bfd_write_archive_contents
,
349 BFD_JUMP_TABLE_GENERIC (bfd_elf32
),
350 BFD_JUMP_TABLE_COPY (bfd_elf32
),
351 BFD_JUMP_TABLE_CORE (bfd_elf32
),
352 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff
),
353 BFD_JUMP_TABLE_SYMBOLS (bfd_elf32
),
354 BFD_JUMP_TABLE_RELOCS (bfd_elf32
),
355 BFD_JUMP_TABLE_WRITE (bfd_elf32
),
356 BFD_JUMP_TABLE_LINK (bfd_elf32
),
357 BFD_JUMP_TABLE_DYNAMIC (bfd_elf32
),