Thu Apr 20 09:07:39 1995 Steve Chamberlain <sac@slash.cygnus.com>
[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
d5fb1e2a
MM
48#ifndef bfd_elf32_bfd_merge_private_bfd_data
49#define bfd_elf32_bfd_merge_private_bfd_data \
50 ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
51#endif
52#ifndef bfd_elf32_bfd_set_private_flags
53#define bfd_elf32_bfd_set_private_flags \
54 ((boolean (*) PARAMS ((bfd *, flagword))) bfd_true)
55#endif
5b3577cb
JL
56#ifndef bfd_elf32_bfd_is_local_label
57#define bfd_elf32_bfd_is_local_label bfd_generic_is_local_label
58#endif
59
cb71adf1
PS
60#ifndef bfd_elf32_get_dynamic_reloc_upper_bound
61#define bfd_elf32_get_dynamic_reloc_upper_bound \
62 _bfd_nodynamic_get_dynamic_reloc_upper_bound
63#endif
64#ifndef bfd_elf32_canonicalize_dynamic_reloc
65#define bfd_elf32_canonicalize_dynamic_reloc \
66 _bfd_nodynamic_canonicalize_dynamic_reloc
67#endif
68
6ec3bb6a
ILT
69#ifdef elf_backend_relocate_section
70#ifndef bfd_elf32_bfd_link_hash_table_create
71#define bfd_elf32_bfd_link_hash_table_create _bfd_elf_link_hash_table_create
72#endif
73#else /* ! defined (elf_backend_relocate_section) */
74/* If no backend relocate_section routine, use the generic linker. */
75#ifndef bfd_elf32_bfd_link_hash_table_create
76#define bfd_elf32_bfd_link_hash_table_create \
77 _bfd_generic_link_hash_table_create
78#endif
79#ifndef bfd_elf32_bfd_link_add_symbols
80#define bfd_elf32_bfd_link_add_symbols _bfd_generic_link_add_symbols
81#endif
82#ifndef bfd_elf32_bfd_final_link
83#define bfd_elf32_bfd_final_link _bfd_generic_final_link
84#endif
85#endif /* ! defined (elf_backend_relocate_section) */
86
b3024965
KR
87#ifndef elf_info_to_howto_rel
88#define elf_info_to_howto_rel 0
89#endif
90
91#ifndef ELF_MAXPAGESIZE
92#define ELF_MAXPAGESIZE 1
93#endif
94
6ec3bb6a
ILT
95#ifndef elf_backend_collect
96#define elf_backend_collect false
97#endif
98
643e9fc7
ILT
99#ifndef elf_backend_sym_is_global
100#define elf_backend_sym_is_global 0
101#endif
a5ccdad1 102#ifndef elf_backend_object_p
643e9fc7 103#define elf_backend_object_p 0
a5ccdad1 104#endif
e2a422b8 105#ifndef elf_backend_symbol_processing
643e9fc7 106#define elf_backend_symbol_processing 0
e2a422b8
KR
107#endif
108#ifndef elf_backend_symbol_table_processing
643e9fc7 109#define elf_backend_symbol_table_processing 0
e2a422b8
KR
110#endif
111#ifndef elf_backend_section_processing
643e9fc7 112#define elf_backend_section_processing 0
e2a422b8
KR
113#endif
114#ifndef elf_backend_section_from_shdr
643e9fc7 115#define elf_backend_section_from_shdr 0
e2a422b8
KR
116#endif
117#ifndef elf_backend_fake_sections
643e9fc7 118#define elf_backend_fake_sections 0
e2a422b8
KR
119#endif
120#ifndef elf_backend_section_from_bfd_section
643e9fc7
ILT
121#define elf_backend_section_from_bfd_section 0
122#endif
6ec3bb6a
ILT
123#ifndef elf_backend_add_symbol_hook
124#define elf_backend_add_symbol_hook 0
125#endif
ff5a090f
JL
126#ifndef elf_backend_link_output_symbol_hook
127#define elf_backend_link_output_symbol_hook 0
128#endif
013dec1a
ILT
129#ifndef elf_backend_create_dynamic_sections
130#define elf_backend_create_dynamic_sections 0
131#endif
374d2ef9
ILT
132#ifndef elf_backend_check_relocs
133#define elf_backend_check_relocs 0
134#endif
013dec1a
ILT
135#ifndef elf_backend_adjust_dynamic_symbol
136#define elf_backend_adjust_dynamic_symbol 0
137#endif
138#ifndef elf_backend_size_dynamic_sections
139#define elf_backend_size_dynamic_sections 0
140#endif
6ec3bb6a
ILT
141#ifndef elf_backend_relocate_section
142#define elf_backend_relocate_section 0
143#endif
013dec1a
ILT
144#ifndef elf_backend_finish_dynamic_symbol
145#define elf_backend_finish_dynamic_symbol 0
146#endif
147#ifndef elf_backend_finish_dynamic_sections
148#define elf_backend_finish_dynamic_sections 0
149#endif
99a6c761
JL
150#ifndef elf_backend_begin_write_processing
151#define elf_backend_begin_write_processing 0
152#endif
643e9fc7
ILT
153#ifndef elf_backend_final_write_processing
154#define elf_backend_final_write_processing 0
e2a422b8 155#endif
95469b02 156#ifndef elf_backend_ecoff_debug_swap
643e9fc7 157#define elf_backend_ecoff_debug_swap 0
95469b02 158#endif
e2a422b8 159
8c9bfee3
MM
160#ifndef ELF_MACHINE_ALT1
161#define ELF_MACHINE_ALT1 0
162#endif
163
164#ifndef ELF_MACHINE_ALT2
165#define ELF_MACHINE_ALT2 0
166#endif
167
268f94ac 168static CONST struct elf_backend_data elf32_bed =
81187b54 169{
7050286d
KR
170#ifdef USE_REL
171 0, /* use_rela_p */
172#else
173 1, /* use_rela_p */
174#endif
175 0, /* elf_64_p */
176 ELF_ARCH, /* arch */
a5ccdad1 177 ELF_MACHINE_CODE, /* elf_machine_code */
95469b02 178 ELF_MAXPAGESIZE, /* maxpagesize */
6ec3bb6a 179 elf_backend_collect,
643e9fc7
ILT
180 elf_info_to_howto,
181 elf_info_to_howto_rel,
182 elf_backend_sym_is_global,
183 elf_backend_object_p,
184 elf_backend_symbol_processing,
185 elf_backend_symbol_table_processing,
186 elf_backend_section_processing,
187 elf_backend_section_from_shdr,
188 elf_backend_fake_sections,
189 elf_backend_section_from_bfd_section,
6ec3bb6a 190 elf_backend_add_symbol_hook,
ff5a090f 191 elf_backend_link_output_symbol_hook,
013dec1a 192 elf_backend_create_dynamic_sections,
374d2ef9 193 elf_backend_check_relocs,
013dec1a
ILT
194 elf_backend_adjust_dynamic_symbol,
195 elf_backend_size_dynamic_sections,
6ec3bb6a 196 elf_backend_relocate_section,
013dec1a
ILT
197 elf_backend_finish_dynamic_symbol,
198 elf_backend_finish_dynamic_sections,
99a6c761 199 elf_backend_begin_write_processing,
643e9fc7 200 elf_backend_final_write_processing,
8c9bfee3
MM
201 elf_backend_ecoff_debug_swap,
202 ELF_MACHINE_ALT1,
203 ELF_MACHINE_ALT2
81187b54
KR
204};
205
206#ifdef TARGET_BIG_SYM
2f3508ad 207const bfd_target TARGET_BIG_SYM =
81187b54
KR
208{
209 /* name: identify kind of target */
210 TARGET_BIG_NAME,
211
212 /* flavour: general indication about file */
213 bfd_target_elf_flavour,
214
215 /* byteorder_big_p: data is big endian */
216 true,
217
218 /* header_byteorder_big_p: header is also big endian */
219 true,
220
221 /* object_flags: mask of all file flags */
222 (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
fa15568a 223 DYNAMIC | WP_TEXT | D_PAGED),
81187b54
KR
224
225 /* section_flags: mask of all section flags */
226 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
d6e5f950 227 SEC_CODE | SEC_DATA | SEC_DEBUGGING),
81187b54
KR
228
229 /* leading_symbol_char: is the first char of a user symbol
230 predictable, and if so what is it */
231 0,
232
233 /* ar_pad_char: pad character for filenames within an archive header
234 FIXME: this really has nothing to do with ELF, this is a characteristic
235 of the archiver and/or os and should be independently tunable */
236 '/',
237
238 /* ar_max_namelen: maximum number of characters in an archive header
239 FIXME: this really has nothing to do with ELF, this is a characteristic
240 of the archiver and should be independently tunable. This value is
241 a WAG (wild a** guess) */
7a0c782d 242 14,
81187b54
KR
243
244 /* align_power_min: minimum alignment restriction for any section
245 FIXME: this value may be target machine dependent */
246 3,
247
248 /* Routines to byte-swap various sized integers from the data sections */
23f44e6f
ILT
249 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
250 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
251 bfd_getb16, bfd_getb_signed_16, bfd_putb16,
81187b54
KR
252
253 /* Routines to byte-swap various sized integers from the file headers */
23f44e6f
ILT
254 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
255 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
256 bfd_getb16, bfd_getb_signed_16, bfd_putb16,
81187b54
KR
257
258 /* bfd_check_format: check the format of a file being read */
259 { _bfd_dummy_target, /* unknown format */
9942e684 260 bfd_elf32_object_p, /* assembler/linker output (object file) */
81187b54 261 bfd_generic_archive_p, /* an archive */
9942e684 262 bfd_elf32_core_file_p /* a core file */
81187b54
KR
263 },
264
265 /* bfd_set_format: set the format of a file being written */
266 { bfd_false,
998ce1e0 267 bfd_elf_mkobject,
81187b54
KR
268 _bfd_generic_mkarchive,
269 bfd_false
270 },
271
272 /* bfd_write_contents: write cached information into a file being written */
273 { bfd_false,
9942e684 274 bfd_elf32_write_object_contents,
81187b54
KR
275 _bfd_write_archive_contents,
276 bfd_false
277 },
278
6812b607
ILT
279 BFD_JUMP_TABLE_GENERIC (bfd_elf32),
280 BFD_JUMP_TABLE_COPY (bfd_elf32),
281 BFD_JUMP_TABLE_CORE (bfd_elf32),
282 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
283 BFD_JUMP_TABLE_SYMBOLS (bfd_elf32),
284 BFD_JUMP_TABLE_RELOCS (bfd_elf32),
285 BFD_JUMP_TABLE_WRITE (bfd_elf32),
286 BFD_JUMP_TABLE_LINK (bfd_elf32),
cb71adf1 287 BFD_JUMP_TABLE_DYNAMIC (bfd_elf32),
81187b54
KR
288
289 /* backend_data: */
9942e684 290 (PTR) &elf32_bed,
81187b54
KR
291};
292#endif
293
294#ifdef TARGET_LITTLE_SYM
2f3508ad 295const bfd_target TARGET_LITTLE_SYM =
81187b54
KR
296{
297 /* name: identify kind of target */
298 TARGET_LITTLE_NAME,
299
300 /* flavour: general indication about file */
301 bfd_target_elf_flavour,
302
303 /* byteorder_big_p: data is big endian */
304 false, /* Nope -- this one's little endian */
305
306 /* header_byteorder_big_p: header is also big endian */
307 false, /* Nope -- this one's little endian */
308
309 /* object_flags: mask of all file flags */
310 (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
fa15568a 311 DYNAMIC | WP_TEXT | D_PAGED),
81187b54
KR
312
313 /* section_flags: mask of all section flags */
314 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
d6e5f950 315 SEC_CODE | SEC_DATA | SEC_DEBUGGING),
81187b54
KR
316
317 /* leading_symbol_char: is the first char of a user symbol
318 predictable, and if so what is it */
319 0,
320
321 /* ar_pad_char: pad character for filenames within an archive header
322 FIXME: this really has nothing to do with ELF, this is a characteristic
323 of the archiver and/or os and should be independently tunable */
324 '/',
325
326 /* ar_max_namelen: maximum number of characters in an archive header
327 FIXME: this really has nothing to do with ELF, this is a characteristic
328 of the archiver and should be independently tunable. This value is
329 a WAG (wild a** guess) */
7a0c782d 330 14,
81187b54
KR
331
332 /* align_power_min: minimum alignment restriction for any section
333 FIXME: this value may be target machine dependent */
334 3,
335
336 /* Routines to byte-swap various sized integers from the data sections */
23f44e6f
ILT
337 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
338 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
339 bfd_getl16, bfd_getl_signed_16, bfd_putl16,
81187b54
KR
340
341 /* Routines to byte-swap various sized integers from the file headers */
23f44e6f
ILT
342 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
343 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
344 bfd_getl16, bfd_getl_signed_16, bfd_putl16,
81187b54
KR
345
346 /* bfd_check_format: check the format of a file being read */
347 { _bfd_dummy_target, /* unknown format */
9942e684 348 bfd_elf32_object_p, /* assembler/linker output (object file) */
81187b54 349 bfd_generic_archive_p, /* an archive */
9942e684 350 bfd_elf32_core_file_p /* a core file */
81187b54
KR
351 },
352
353 /* bfd_set_format: set the format of a file being written */
354 { bfd_false,
998ce1e0 355 bfd_elf_mkobject,
81187b54
KR
356 _bfd_generic_mkarchive,
357 bfd_false
358 },
359
360 /* bfd_write_contents: write cached information into a file being written */
361 { bfd_false,
9942e684 362 bfd_elf32_write_object_contents,
81187b54
KR
363 _bfd_write_archive_contents,
364 bfd_false
365 },
366
6812b607
ILT
367 BFD_JUMP_TABLE_GENERIC (bfd_elf32),
368 BFD_JUMP_TABLE_COPY (bfd_elf32),
369 BFD_JUMP_TABLE_CORE (bfd_elf32),
370 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
371 BFD_JUMP_TABLE_SYMBOLS (bfd_elf32),
372 BFD_JUMP_TABLE_RELOCS (bfd_elf32),
373 BFD_JUMP_TABLE_WRITE (bfd_elf32),
374 BFD_JUMP_TABLE_LINK (bfd_elf32),
cb71adf1 375 BFD_JUMP_TABLE_DYNAMIC (bfd_elf32),
81187b54
KR
376
377 /* backend_data: */
9942e684 378 (PTR) &elf32_bed,
81187b54
KR
379};
380#endif
This page took 0.109631 seconds and 4 git commands to generate.