* hosts/mpw.h (SEEK_SET, SEEK_CUR, BYTES_IN_PRINTF_INT):
[deliverable/binutils-gdb.git] / bfd / elf32-target.h
CommitLineData
81187b54 1/* Target definitions for 32-bit ELF
dfc1c006 2 Copyright 1993, 1994 Free Software Foundation, Inc.
81187b54
KR
3
4This file is part of BFD, the Binary File Descriptor library.
5
6This program is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program; if not, write to the Free Software
18Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
19
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.
24
25 There are two such structures here: one for big-endian machines and
26 one for little-endian machines. */
27
6812b607
ILT
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
ae06054e 32#endif
9942e684 33
9942e684 34#define bfd_elf32_bfd_get_relocated_section_contents \
81187b54 35 bfd_generic_get_relocated_section_contents
9942e684 36#define bfd_elf32_bfd_relax_section bfd_generic_relax_section
9942e684 37#define bfd_elf32_bfd_make_debug_symbol \
81187b54
KR
38 ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
39
5b3577cb
JL
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)
43#endif
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)
47#endif
48#ifndef bfd_elf32_bfd_is_local_label
49#define bfd_elf32_bfd_is_local_label bfd_generic_is_local_label
50#endif
51
cb71adf1
PS
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
55#endif
56#ifndef bfd_elf32_canonicalize_dynamic_reloc
57#define bfd_elf32_canonicalize_dynamic_reloc \
58 _bfd_nodynamic_canonicalize_dynamic_reloc
59#endif
60
6ec3bb6a
ILT
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
64#endif
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
70#endif
71#ifndef bfd_elf32_bfd_link_add_symbols
72#define bfd_elf32_bfd_link_add_symbols _bfd_generic_link_add_symbols
73#endif
74#ifndef bfd_elf32_bfd_final_link
75#define bfd_elf32_bfd_final_link _bfd_generic_final_link
76#endif
77#endif /* ! defined (elf_backend_relocate_section) */
78
b3024965
KR
79#ifndef elf_info_to_howto_rel
80#define elf_info_to_howto_rel 0
81#endif
82
83#ifndef ELF_MAXPAGESIZE
84#define ELF_MAXPAGESIZE 1
85#endif
86
6ec3bb6a
ILT
87#ifndef elf_backend_collect
88#define elf_backend_collect false
89#endif
90
643e9fc7
ILT
91#ifndef elf_backend_sym_is_global
92#define elf_backend_sym_is_global 0
93#endif
a5ccdad1 94#ifndef elf_backend_object_p
643e9fc7 95#define elf_backend_object_p 0
a5ccdad1 96#endif
e2a422b8 97#ifndef elf_backend_symbol_processing
643e9fc7 98#define elf_backend_symbol_processing 0
e2a422b8
KR
99#endif
100#ifndef elf_backend_symbol_table_processing
643e9fc7 101#define elf_backend_symbol_table_processing 0
e2a422b8
KR
102#endif
103#ifndef elf_backend_section_processing
643e9fc7 104#define elf_backend_section_processing 0
e2a422b8
KR
105#endif
106#ifndef elf_backend_section_from_shdr
643e9fc7 107#define elf_backend_section_from_shdr 0
e2a422b8
KR
108#endif
109#ifndef elf_backend_fake_sections
643e9fc7 110#define elf_backend_fake_sections 0
e2a422b8
KR
111#endif
112#ifndef elf_backend_section_from_bfd_section
643e9fc7
ILT
113#define elf_backend_section_from_bfd_section 0
114#endif
6ec3bb6a
ILT
115#ifndef elf_backend_add_symbol_hook
116#define elf_backend_add_symbol_hook 0
117#endif
ff5a090f
JL
118#ifndef elf_backend_link_output_symbol_hook
119#define elf_backend_link_output_symbol_hook 0
120#endif
013dec1a
ILT
121#ifndef elf_backend_create_dynamic_sections
122#define elf_backend_create_dynamic_sections 0
123#endif
374d2ef9
ILT
124#ifndef elf_backend_check_relocs
125#define elf_backend_check_relocs 0
126#endif
013dec1a
ILT
127#ifndef elf_backend_adjust_dynamic_symbol
128#define elf_backend_adjust_dynamic_symbol 0
129#endif
130#ifndef elf_backend_size_dynamic_sections
131#define elf_backend_size_dynamic_sections 0
132#endif
6ec3bb6a
ILT
133#ifndef elf_backend_relocate_section
134#define elf_backend_relocate_section 0
135#endif
013dec1a
ILT
136#ifndef elf_backend_finish_dynamic_symbol
137#define elf_backend_finish_dynamic_symbol 0
138#endif
139#ifndef elf_backend_finish_dynamic_sections
140#define elf_backend_finish_dynamic_sections 0
141#endif
99a6c761
JL
142#ifndef elf_backend_begin_write_processing
143#define elf_backend_begin_write_processing 0
144#endif
643e9fc7
ILT
145#ifndef elf_backend_final_write_processing
146#define elf_backend_final_write_processing 0
e2a422b8 147#endif
95469b02 148#ifndef elf_backend_ecoff_debug_swap
643e9fc7 149#define elf_backend_ecoff_debug_swap 0
95469b02 150#endif
e2a422b8 151
8c9bfee3
MM
152#ifndef ELF_MACHINE_ALT1
153#define ELF_MACHINE_ALT1 0
154#endif
155
156#ifndef ELF_MACHINE_ALT2
157#define ELF_MACHINE_ALT2 0
158#endif
159
268f94ac 160static CONST struct elf_backend_data elf32_bed =
81187b54 161{
7050286d
KR
162#ifdef USE_REL
163 0, /* use_rela_p */
164#else
165 1, /* use_rela_p */
166#endif
167 0, /* elf_64_p */
168 ELF_ARCH, /* arch */
a5ccdad1 169 ELF_MACHINE_CODE, /* elf_machine_code */
95469b02 170 ELF_MAXPAGESIZE, /* maxpagesize */
6ec3bb6a 171 elf_backend_collect,
643e9fc7
ILT
172 elf_info_to_howto,
173 elf_info_to_howto_rel,
174 elf_backend_sym_is_global,
175 elf_backend_object_p,
176 elf_backend_symbol_processing,
177 elf_backend_symbol_table_processing,
178 elf_backend_section_processing,
179 elf_backend_section_from_shdr,
180 elf_backend_fake_sections,
181 elf_backend_section_from_bfd_section,
6ec3bb6a 182 elf_backend_add_symbol_hook,
ff5a090f 183 elf_backend_link_output_symbol_hook,
013dec1a 184 elf_backend_create_dynamic_sections,
374d2ef9 185 elf_backend_check_relocs,
013dec1a
ILT
186 elf_backend_adjust_dynamic_symbol,
187 elf_backend_size_dynamic_sections,
6ec3bb6a 188 elf_backend_relocate_section,
013dec1a
ILT
189 elf_backend_finish_dynamic_symbol,
190 elf_backend_finish_dynamic_sections,
99a6c761 191 elf_backend_begin_write_processing,
643e9fc7 192 elf_backend_final_write_processing,
8c9bfee3
MM
193 elf_backend_ecoff_debug_swap,
194 ELF_MACHINE_ALT1,
195 ELF_MACHINE_ALT2
81187b54
KR
196};
197
198#ifdef TARGET_BIG_SYM
2f3508ad 199const bfd_target TARGET_BIG_SYM =
81187b54
KR
200{
201 /* name: identify kind of target */
202 TARGET_BIG_NAME,
203
204 /* flavour: general indication about file */
205 bfd_target_elf_flavour,
206
207 /* byteorder_big_p: data is big endian */
208 true,
209
210 /* header_byteorder_big_p: header is also big endian */
211 true,
212
213 /* object_flags: mask of all file flags */
214 (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
fa15568a 215 DYNAMIC | WP_TEXT | D_PAGED),
81187b54
KR
216
217 /* section_flags: mask of all section flags */
218 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
d6e5f950 219 SEC_CODE | SEC_DATA | SEC_DEBUGGING),
81187b54
KR
220
221 /* leading_symbol_char: is the first char of a user symbol
222 predictable, and if so what is it */
223 0,
224
225 /* ar_pad_char: pad character for filenames within an archive header
226 FIXME: this really has nothing to do with ELF, this is a characteristic
227 of the archiver and/or os and should be independently tunable */
228 '/',
229
230 /* ar_max_namelen: maximum number of characters in an archive header
231 FIXME: this really has nothing to do with ELF, this is a characteristic
232 of the archiver and should be independently tunable. This value is
233 a WAG (wild a** guess) */
7a0c782d 234 14,
81187b54
KR
235
236 /* align_power_min: minimum alignment restriction for any section
237 FIXME: this value may be target machine dependent */
238 3,
239
240 /* Routines to byte-swap various sized integers from the data sections */
23f44e6f
ILT
241 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
242 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
243 bfd_getb16, bfd_getb_signed_16, bfd_putb16,
81187b54
KR
244
245 /* Routines to byte-swap various sized integers from the file headers */
23f44e6f
ILT
246 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
247 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
248 bfd_getb16, bfd_getb_signed_16, bfd_putb16,
81187b54
KR
249
250 /* bfd_check_format: check the format of a file being read */
251 { _bfd_dummy_target, /* unknown format */
9942e684 252 bfd_elf32_object_p, /* assembler/linker output (object file) */
81187b54 253 bfd_generic_archive_p, /* an archive */
9942e684 254 bfd_elf32_core_file_p /* a core file */
81187b54
KR
255 },
256
257 /* bfd_set_format: set the format of a file being written */
258 { bfd_false,
998ce1e0 259 bfd_elf_mkobject,
81187b54
KR
260 _bfd_generic_mkarchive,
261 bfd_false
262 },
263
264 /* bfd_write_contents: write cached information into a file being written */
265 { bfd_false,
9942e684 266 bfd_elf32_write_object_contents,
81187b54
KR
267 _bfd_write_archive_contents,
268 bfd_false
269 },
270
6812b607
ILT
271 BFD_JUMP_TABLE_GENERIC (bfd_elf32),
272 BFD_JUMP_TABLE_COPY (bfd_elf32),
273 BFD_JUMP_TABLE_CORE (bfd_elf32),
274 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
275 BFD_JUMP_TABLE_SYMBOLS (bfd_elf32),
276 BFD_JUMP_TABLE_RELOCS (bfd_elf32),
277 BFD_JUMP_TABLE_WRITE (bfd_elf32),
278 BFD_JUMP_TABLE_LINK (bfd_elf32),
cb71adf1 279 BFD_JUMP_TABLE_DYNAMIC (bfd_elf32),
81187b54
KR
280
281 /* backend_data: */
9942e684 282 (PTR) &elf32_bed,
81187b54
KR
283};
284#endif
285
286#ifdef TARGET_LITTLE_SYM
2f3508ad 287const bfd_target TARGET_LITTLE_SYM =
81187b54
KR
288{
289 /* name: identify kind of target */
290 TARGET_LITTLE_NAME,
291
292 /* flavour: general indication about file */
293 bfd_target_elf_flavour,
294
295 /* byteorder_big_p: data is big endian */
296 false, /* Nope -- this one's little endian */
297
298 /* header_byteorder_big_p: header is also big endian */
299 false, /* Nope -- this one's little endian */
300
301 /* object_flags: mask of all file flags */
302 (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
fa15568a 303 DYNAMIC | WP_TEXT | D_PAGED),
81187b54
KR
304
305 /* section_flags: mask of all section flags */
306 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
d6e5f950 307 SEC_CODE | SEC_DATA | SEC_DEBUGGING),
81187b54
KR
308
309 /* leading_symbol_char: is the first char of a user symbol
310 predictable, and if so what is it */
311 0,
312
313 /* ar_pad_char: pad character for filenames within an archive header
314 FIXME: this really has nothing to do with ELF, this is a characteristic
315 of the archiver and/or os and should be independently tunable */
316 '/',
317
318 /* ar_max_namelen: maximum number of characters in an archive header
319 FIXME: this really has nothing to do with ELF, this is a characteristic
320 of the archiver and should be independently tunable. This value is
321 a WAG (wild a** guess) */
7a0c782d 322 14,
81187b54
KR
323
324 /* align_power_min: minimum alignment restriction for any section
325 FIXME: this value may be target machine dependent */
326 3,
327
328 /* Routines to byte-swap various sized integers from the data sections */
23f44e6f
ILT
329 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
330 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
331 bfd_getl16, bfd_getl_signed_16, bfd_putl16,
81187b54
KR
332
333 /* Routines to byte-swap various sized integers from the file headers */
23f44e6f
ILT
334 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
335 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
336 bfd_getl16, bfd_getl_signed_16, bfd_putl16,
81187b54
KR
337
338 /* bfd_check_format: check the format of a file being read */
339 { _bfd_dummy_target, /* unknown format */
9942e684 340 bfd_elf32_object_p, /* assembler/linker output (object file) */
81187b54 341 bfd_generic_archive_p, /* an archive */
9942e684 342 bfd_elf32_core_file_p /* a core file */
81187b54
KR
343 },
344
345 /* bfd_set_format: set the format of a file being written */
346 { bfd_false,
998ce1e0 347 bfd_elf_mkobject,
81187b54
KR
348 _bfd_generic_mkarchive,
349 bfd_false
350 },
351
352 /* bfd_write_contents: write cached information into a file being written */
353 { bfd_false,
9942e684 354 bfd_elf32_write_object_contents,
81187b54
KR
355 _bfd_write_archive_contents,
356 bfd_false
357 },
358
6812b607
ILT
359 BFD_JUMP_TABLE_GENERIC (bfd_elf32),
360 BFD_JUMP_TABLE_COPY (bfd_elf32),
361 BFD_JUMP_TABLE_CORE (bfd_elf32),
362 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
363 BFD_JUMP_TABLE_SYMBOLS (bfd_elf32),
364 BFD_JUMP_TABLE_RELOCS (bfd_elf32),
365 BFD_JUMP_TABLE_WRITE (bfd_elf32),
366 BFD_JUMP_TABLE_LINK (bfd_elf32),
cb71adf1 367 BFD_JUMP_TABLE_DYNAMIC (bfd_elf32),
81187b54
KR
368
369 /* backend_data: */
9942e684 370 (PTR) &elf32_bed,
81187b54
KR
371};
372#endif
This page took 0.106734 seconds and 4 git commands to generate.