]> Git Repo - binutils.git/blob - bfd/elf32-target.h
Sun Jul 10 09:12:02 1994 D. V. Henkel-Wallace ([email protected])
[binutils.git] / bfd / elf32-target.h
1 /* Target definitions for 32-bit ELF
2    Copyright 1993, 1994 Free Software Foundation, Inc.
3
4 This file is part of BFD, the Binary File Descriptor library.
5
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.
10
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.
15
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.  */
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
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
32 #endif
33
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)
39
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
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
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
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
87 #ifndef elf_backend_collect
88 #define elf_backend_collect false
89 #endif
90
91 #ifndef elf_backend_sym_is_global
92 #define elf_backend_sym_is_global       0
93 #endif
94 #ifndef elf_backend_object_p
95 #define elf_backend_object_p            0
96 #endif
97 #ifndef elf_backend_symbol_processing
98 #define elf_backend_symbol_processing   0
99 #endif
100 #ifndef elf_backend_symbol_table_processing
101 #define elf_backend_symbol_table_processing     0
102 #endif
103 #ifndef elf_backend_section_processing
104 #define elf_backend_section_processing  0
105 #endif
106 #ifndef elf_backend_section_from_shdr
107 #define elf_backend_section_from_shdr   0
108 #endif
109 #ifndef elf_backend_fake_sections
110 #define elf_backend_fake_sections       0
111 #endif
112 #ifndef elf_backend_section_from_bfd_section
113 #define elf_backend_section_from_bfd_section    0
114 #endif
115 #ifndef elf_backend_add_symbol_hook
116 #define elf_backend_add_symbol_hook     0
117 #endif
118 #ifndef elf_backend_link_output_symbol_hook
119 #define elf_backend_link_output_symbol_hook 0
120 #endif
121 #ifndef elf_backend_create_dynamic_sections
122 #define elf_backend_create_dynamic_sections 0
123 #endif
124 #ifndef elf_backend_adjust_dynamic_symbol
125 #define elf_backend_adjust_dynamic_symbol 0
126 #endif
127 #ifndef elf_backend_size_dynamic_sections
128 #define elf_backend_size_dynamic_sections 0
129 #endif
130 #ifndef elf_backend_relocate_section
131 #define elf_backend_relocate_section    0
132 #endif
133 #ifndef elf_backend_finish_dynamic_symbol
134 #define elf_backend_finish_dynamic_symbol       0
135 #endif
136 #ifndef elf_backend_finish_dynamic_sections
137 #define elf_backend_finish_dynamic_sections     0
138 #endif
139 #ifndef elf_backend_begin_write_processing
140 #define elf_backend_begin_write_processing      0
141 #endif
142 #ifndef elf_backend_final_write_processing
143 #define elf_backend_final_write_processing      0
144 #endif
145 #ifndef elf_backend_ecoff_debug_swap
146 #define elf_backend_ecoff_debug_swap    0
147 #endif
148
149 static CONST struct elf_backend_data elf32_bed =
150 {
151 #ifdef USE_REL
152   0,                            /* use_rela_p */
153 #else
154   1,                            /* use_rela_p */
155 #endif
156   0,                            /* elf_64_p */
157   ELF_ARCH,                     /* arch */
158   ELF_MACHINE_CODE,             /* elf_machine_code */
159   ELF_MAXPAGESIZE,              /* maxpagesize */
160   elf_backend_collect,
161   elf_info_to_howto,
162   elf_info_to_howto_rel,
163   elf_backend_sym_is_global,
164   elf_backend_object_p,
165   elf_backend_symbol_processing,
166   elf_backend_symbol_table_processing,
167   elf_backend_section_processing,
168   elf_backend_section_from_shdr,
169   elf_backend_fake_sections,
170   elf_backend_section_from_bfd_section,
171   elf_backend_add_symbol_hook,
172   elf_backend_link_output_symbol_hook,
173   elf_backend_create_dynamic_sections,
174   elf_backend_adjust_dynamic_symbol,
175   elf_backend_size_dynamic_sections,
176   elf_backend_relocate_section,
177   elf_backend_finish_dynamic_symbol,
178   elf_backend_finish_dynamic_sections,
179   elf_backend_begin_write_processing,
180   elf_backend_final_write_processing,
181   elf_backend_ecoff_debug_swap
182 };
183
184 #ifdef TARGET_BIG_SYM
185 const bfd_target TARGET_BIG_SYM =
186 {
187   /* name: identify kind of target */
188   TARGET_BIG_NAME,
189
190   /* flavour: general indication about file */
191   bfd_target_elf_flavour,
192
193   /* byteorder_big_p: data is big endian */
194   true,
195
196   /* header_byteorder_big_p: header is also big endian */
197   true,
198
199   /* object_flags: mask of all file flags */
200   (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
201    DYNAMIC | WP_TEXT | D_PAGED),
202   
203   /* section_flags: mask of all section flags */
204   (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
205    SEC_CODE | SEC_DATA | SEC_DEBUGGING),
206
207    /* leading_symbol_char: is the first char of a user symbol
208       predictable, and if so what is it */
209    0,
210
211   /* ar_pad_char: pad character for filenames within an archive header
212      FIXME:  this really has nothing to do with ELF, this is a characteristic
213      of the archiver and/or os and should be independently tunable */
214   '/',
215
216   /* ar_max_namelen: maximum number of characters in an archive header
217      FIXME:  this really has nothing to do with ELF, this is a characteristic
218      of the archiver and should be independently tunable.  This value is
219      a WAG (wild a** guess) */
220   14,
221
222   /* align_power_min: minimum alignment restriction for any section
223      FIXME:  this value may be target machine dependent */
224   3,
225
226   /* Routines to byte-swap various sized integers from the data sections */
227   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
228     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
229     bfd_getb16, bfd_getb_signed_16, bfd_putb16,
230
231   /* Routines to byte-swap various sized integers from the file headers */
232   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
233     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
234     bfd_getb16, bfd_getb_signed_16, bfd_putb16,
235
236   /* bfd_check_format: check the format of a file being read */
237   { _bfd_dummy_target,          /* unknown format */
238     bfd_elf32_object_p,         /* assembler/linker output (object file) */
239     bfd_generic_archive_p,      /* an archive */
240     bfd_elf32_core_file_p       /* a core file */
241   },
242
243   /* bfd_set_format: set the format of a file being written */
244   { bfd_false,
245     bfd_elf_mkobject,
246     _bfd_generic_mkarchive,
247     bfd_false
248   },
249
250   /* bfd_write_contents: write cached information into a file being written */
251   { bfd_false,
252     bfd_elf32_write_object_contents,
253     _bfd_write_archive_contents,
254     bfd_false
255   },
256
257       BFD_JUMP_TABLE_GENERIC (bfd_elf32),
258       BFD_JUMP_TABLE_COPY (bfd_elf32),
259       BFD_JUMP_TABLE_CORE (bfd_elf32),
260       BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
261       BFD_JUMP_TABLE_SYMBOLS (bfd_elf32),
262       BFD_JUMP_TABLE_RELOCS (bfd_elf32),
263       BFD_JUMP_TABLE_WRITE (bfd_elf32),
264       BFD_JUMP_TABLE_LINK (bfd_elf32),
265       BFD_JUMP_TABLE_DYNAMIC (bfd_elf32),
266
267   /* backend_data: */
268   (PTR) &elf32_bed,
269 };
270 #endif
271
272 #ifdef TARGET_LITTLE_SYM
273 const bfd_target TARGET_LITTLE_SYM =
274 {
275   /* name: identify kind of target */
276   TARGET_LITTLE_NAME,
277
278   /* flavour: general indication about file */
279   bfd_target_elf_flavour,
280
281   /* byteorder_big_p: data is big endian */
282   false,                /* Nope -- this one's little endian */
283
284   /* header_byteorder_big_p: header is also big endian */
285   false,                /* Nope -- this one's little endian */
286
287   /* object_flags: mask of all file flags */
288   (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
289    DYNAMIC | WP_TEXT | D_PAGED),
290   
291   /* section_flags: mask of all section flags */
292   (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
293    SEC_CODE | SEC_DATA | SEC_DEBUGGING),
294
295    /* leading_symbol_char: is the first char of a user symbol
296       predictable, and if so what is it */
297    0,
298
299   /* ar_pad_char: pad character for filenames within an archive header
300      FIXME:  this really has nothing to do with ELF, this is a characteristic
301      of the archiver and/or os and should be independently tunable */
302   '/',
303
304   /* ar_max_namelen: maximum number of characters in an archive header
305      FIXME:  this really has nothing to do with ELF, this is a characteristic
306      of the archiver and should be independently tunable.  This value is
307      a WAG (wild a** guess) */
308   14,
309
310   /* align_power_min: minimum alignment restriction for any section
311      FIXME:  this value may be target machine dependent */
312   3,
313
314   /* Routines to byte-swap various sized integers from the data sections */
315   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
316     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
317     bfd_getl16, bfd_getl_signed_16, bfd_putl16,
318
319   /* Routines to byte-swap various sized integers from the file headers */
320   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
321     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
322     bfd_getl16, bfd_getl_signed_16, bfd_putl16,
323
324   /* bfd_check_format: check the format of a file being read */
325   { _bfd_dummy_target,          /* unknown format */
326     bfd_elf32_object_p,         /* assembler/linker output (object file) */
327     bfd_generic_archive_p,      /* an archive */
328     bfd_elf32_core_file_p       /* a core file */
329   },
330
331   /* bfd_set_format: set the format of a file being written */
332   { bfd_false,
333     bfd_elf_mkobject,
334     _bfd_generic_mkarchive,
335     bfd_false
336   },
337
338   /* bfd_write_contents: write cached information into a file being written */
339   { bfd_false,
340     bfd_elf32_write_object_contents,
341     _bfd_write_archive_contents,
342     bfd_false
343   },
344
345       BFD_JUMP_TABLE_GENERIC (bfd_elf32),
346       BFD_JUMP_TABLE_COPY (bfd_elf32),
347       BFD_JUMP_TABLE_CORE (bfd_elf32),
348       BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
349       BFD_JUMP_TABLE_SYMBOLS (bfd_elf32),
350       BFD_JUMP_TABLE_RELOCS (bfd_elf32),
351       BFD_JUMP_TABLE_WRITE (bfd_elf32),
352       BFD_JUMP_TABLE_LINK (bfd_elf32),
353       BFD_JUMP_TABLE_DYNAMIC (bfd_elf32),
354
355   /* backend_data: */
356   (PTR) &elf32_bed,
357 };
358 #endif
This page took 0.044123 seconds and 4 git commands to generate.