removed unused elf_64_p field
[external/binutils.git] / bfd / elfxx-target.h
1 /* Target definitions for NN-bit ELF
2    Copyright 1993, 1994, 1995 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_elfNN_close_and_cleanup _bfd_generic_close_and_cleanup
29 #define bfd_elfNN_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
30 #ifndef bfd_elfNN_get_section_contents
31 #define bfd_elfNN_get_section_contents _bfd_generic_get_section_contents
32 #endif
33
34 #define bfd_elfNN_bfd_debug_info_start  bfd_void
35 #define bfd_elfNN_bfd_debug_info_end    bfd_void
36 #define bfd_elfNN_bfd_debug_info_accumulate     (PROTO(void,(*),(bfd*, struct sec *))) bfd_void
37
38 #ifndef bfd_elfNN_bfd_get_relocated_section_contents
39 #define bfd_elfNN_bfd_get_relocated_section_contents \
40  bfd_generic_get_relocated_section_contents
41 #endif
42
43 #define bfd_elfNN_bfd_relax_section bfd_generic_relax_section
44 #define bfd_elfNN_bfd_make_debug_symbol \
45   ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
46
47 #ifndef bfd_elfNN_bfd_copy_private_symbol_data
48 #define bfd_elfNN_bfd_copy_private_symbol_data \
49   ((boolean (*) PARAMS ((bfd *, asymbol *, bfd *, asymbol *))) bfd_true)
50 #endif
51 #ifndef bfd_elfNN_bfd_copy_private_section_data
52 #define bfd_elfNN_bfd_copy_private_section_data \
53   ((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_true)
54 #endif
55 #ifndef bfd_elfNN_bfd_copy_private_bfd_data
56 #define bfd_elfNN_bfd_copy_private_bfd_data \
57   ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
58 #endif
59 #ifndef bfd_elfNN_bfd_merge_private_bfd_data
60 #define bfd_elfNN_bfd_merge_private_bfd_data \
61   ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
62 #endif
63 #ifndef bfd_elfNN_bfd_set_private_flags
64 #define bfd_elfNN_bfd_set_private_flags \
65   ((boolean (*) PARAMS ((bfd *, flagword))) bfd_true)
66 #endif
67 #ifndef bfd_elfNN_bfd_is_local_label
68 #define bfd_elfNN_bfd_is_local_label bfd_generic_is_local_label
69 #endif
70
71 #ifndef bfd_elfNN_get_dynamic_reloc_upper_bound
72 #define bfd_elfNN_get_dynamic_reloc_upper_bound \
73   _bfd_nodynamic_get_dynamic_reloc_upper_bound
74 #endif
75 #ifndef bfd_elfNN_canonicalize_dynamic_reloc
76 #define bfd_elfNN_canonicalize_dynamic_reloc \
77   _bfd_nodynamic_canonicalize_dynamic_reloc
78 #endif
79
80 #ifdef elf_backend_relocate_section
81 #ifndef bfd_elfNN_bfd_link_hash_table_create
82 #define bfd_elfNN_bfd_link_hash_table_create _bfd_elf_link_hash_table_create
83 #endif
84 #else /* ! defined (elf_backend_relocate_section) */
85 /* If no backend relocate_section routine, use the generic linker.  */
86 #ifndef bfd_elfNN_bfd_link_hash_table_create
87 #define bfd_elfNN_bfd_link_hash_table_create \
88   _bfd_generic_link_hash_table_create
89 #endif
90 #ifndef bfd_elfNN_bfd_link_add_symbols
91 #define bfd_elfNN_bfd_link_add_symbols  _bfd_generic_link_add_symbols
92 #endif
93 #ifndef bfd_elfNN_bfd_final_link
94 #define bfd_elfNN_bfd_final_link        _bfd_generic_final_link
95 #endif
96 #endif /* ! defined (elf_backend_relocate_section) */
97 #ifndef bfd_elfNN_bfd_link_split_section
98 #define bfd_elfNN_bfd_link_split_section _bfd_generic_link_split_section
99 #endif
100
101 #ifndef elf_info_to_howto_rel
102 #define elf_info_to_howto_rel 0
103 #endif
104
105 #ifndef ELF_MAXPAGESIZE
106 #define ELF_MAXPAGESIZE 1
107 #endif
108
109 #ifndef elf_backend_collect
110 #define elf_backend_collect false
111 #endif
112
113 #ifndef elf_backend_sym_is_global
114 #define elf_backend_sym_is_global       0
115 #endif
116 #ifndef elf_backend_object_p
117 #define elf_backend_object_p            0
118 #endif
119 #ifndef elf_backend_symbol_processing
120 #define elf_backend_symbol_processing   0
121 #endif
122 #ifndef elf_backend_symbol_table_processing
123 #define elf_backend_symbol_table_processing     0
124 #endif
125 #ifndef elf_backend_section_processing
126 #define elf_backend_section_processing  0
127 #endif
128 #ifndef elf_backend_section_from_shdr
129 #define elf_backend_section_from_shdr   0
130 #endif
131 #ifndef elf_backend_fake_sections
132 #define elf_backend_fake_sections       0
133 #endif
134 #ifndef elf_backend_section_from_bfd_section
135 #define elf_backend_section_from_bfd_section    0
136 #endif
137 #ifndef elf_backend_add_symbol_hook
138 #define elf_backend_add_symbol_hook     0
139 #endif
140 #ifndef elf_backend_link_output_symbol_hook
141 #define elf_backend_link_output_symbol_hook 0
142 #endif
143 #ifndef elf_backend_create_dynamic_sections
144 #define elf_backend_create_dynamic_sections 0
145 #endif
146 #ifndef elf_backend_check_relocs
147 #define elf_backend_check_relocs        0
148 #endif
149 #ifndef elf_backend_adjust_dynamic_symbol
150 #define elf_backend_adjust_dynamic_symbol 0
151 #endif
152 #ifndef elf_backend_size_dynamic_sections
153 #define elf_backend_size_dynamic_sections 0
154 #endif
155 #ifndef elf_backend_relocate_section
156 #define elf_backend_relocate_section    0
157 #endif
158 #ifndef elf_backend_finish_dynamic_symbol
159 #define elf_backend_finish_dynamic_symbol       0
160 #endif
161 #ifndef elf_backend_finish_dynamic_sections
162 #define elf_backend_finish_dynamic_sections     0
163 #endif
164 #ifndef elf_backend_begin_write_processing
165 #define elf_backend_begin_write_processing      0
166 #endif
167 #ifndef elf_backend_final_write_processing
168 #define elf_backend_final_write_processing      0
169 #endif
170 #ifndef elf_backend_ecoff_debug_swap
171 #define elf_backend_ecoff_debug_swap    0
172 #endif
173
174 #ifndef ELF_MACHINE_ALT1
175 #define ELF_MACHINE_ALT1 0
176 #endif
177
178 #ifndef ELF_MACHINE_ALT2
179 #define ELF_MACHINE_ALT2 0
180 #endif
181
182 static CONST struct elf_backend_data elfNN_bed =
183 {
184 #ifdef USE_REL
185   0,                            /* use_rela_p */
186 #else
187   1,                            /* use_rela_p */
188 #endif
189   ELF_ARCH,                     /* arch */
190   ELF_MACHINE_CODE,             /* elf_machine_code */
191   ELF_MAXPAGESIZE,              /* maxpagesize */
192   elf_backend_collect,
193   elf_info_to_howto,
194   elf_info_to_howto_rel,
195   elf_backend_sym_is_global,
196   elf_backend_object_p,
197   elf_backend_symbol_processing,
198   elf_backend_symbol_table_processing,
199   elf_backend_section_processing,
200   elf_backend_section_from_shdr,
201   elf_backend_fake_sections,
202   elf_backend_section_from_bfd_section,
203   elf_backend_add_symbol_hook,
204   elf_backend_link_output_symbol_hook,
205   elf_backend_create_dynamic_sections,
206   elf_backend_check_relocs,
207   elf_backend_adjust_dynamic_symbol,
208   elf_backend_size_dynamic_sections,
209   elf_backend_relocate_section,
210   elf_backend_finish_dynamic_symbol,
211   elf_backend_finish_dynamic_sections,
212   elf_backend_begin_write_processing,
213   elf_backend_final_write_processing,
214   elf_backend_ecoff_debug_swap,
215   ELF_MACHINE_ALT1,
216   ELF_MACHINE_ALT2
217 };
218
219 #ifdef TARGET_BIG_SYM
220 const bfd_target TARGET_BIG_SYM =
221 {
222   /* name: identify kind of target */
223   TARGET_BIG_NAME,
224
225   /* flavour: general indication about file */
226   bfd_target_elf_flavour,
227
228   /* byteorder_big_p: data is big endian */
229   true,
230
231   /* header_byteorder_big_p: header is also big endian */
232   true,
233
234   /* object_flags: mask of all file flags */
235   (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
236    DYNAMIC | WP_TEXT | D_PAGED),
237   
238   /* section_flags: mask of all section flags */
239   (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
240    SEC_CODE | SEC_DATA | SEC_DEBUGGING),
241
242    /* leading_symbol_char: is the first char of a user symbol
243       predictable, and if so what is it */
244    0,
245
246   /* ar_pad_char: pad character for filenames within an archive header
247      FIXME:  this really has nothing to do with ELF, this is a characteristic
248      of the archiver and/or os and should be independently tunable */
249   '/',
250
251   /* ar_max_namelen: maximum number of characters in an archive header
252      FIXME:  this really has nothing to do with ELF, this is a characteristic
253      of the archiver and should be independently tunable.  This value is
254      a WAG (wild a** guess) */
255   14,
256
257   /* align_power_min: minimum alignment restriction for any section
258      FIXME:  this value may be target machine dependent */
259   3,
260
261   /* Routines to byte-swap various sized integers from the data sections */
262   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
263     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
264     bfd_getb16, bfd_getb_signed_16, bfd_putb16,
265
266   /* Routines to byte-swap various sized integers from the file headers */
267   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
268     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
269     bfd_getb16, bfd_getb_signed_16, bfd_putb16,
270
271   /* bfd_check_format: check the format of a file being read */
272   { _bfd_dummy_target,          /* unknown format */
273     bfd_elfNN_object_p,         /* assembler/linker output (object file) */
274     bfd_generic_archive_p,      /* an archive */
275     bfd_elfNN_core_file_p       /* a core file */
276   },
277
278   /* bfd_set_format: set the format of a file being written */
279   { bfd_false,
280     bfd_elf_mkobject,
281     _bfd_generic_mkarchive,
282     bfd_false
283   },
284
285   /* bfd_write_contents: write cached information into a file being written */
286   { bfd_false,
287     bfd_elfNN_write_object_contents,
288     _bfd_write_archive_contents,
289     bfd_false
290   },
291
292       BFD_JUMP_TABLE_GENERIC (bfd_elfNN),
293       BFD_JUMP_TABLE_COPY (bfd_elfNN),
294       BFD_JUMP_TABLE_CORE (bfd_elfNN),
295       BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
296       BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN),
297       BFD_JUMP_TABLE_RELOCS (bfd_elfNN),
298       BFD_JUMP_TABLE_WRITE (bfd_elfNN),
299       BFD_JUMP_TABLE_LINK (bfd_elfNN),
300       BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),
301
302   /* backend_data: */
303   (PTR) &elfNN_bed,
304 };
305 #endif
306
307 #ifdef TARGET_LITTLE_SYM
308 const bfd_target TARGET_LITTLE_SYM =
309 {
310   /* name: identify kind of target */
311   TARGET_LITTLE_NAME,
312
313   /* flavour: general indication about file */
314   bfd_target_elf_flavour,
315
316   /* byteorder_big_p: data is big endian */
317   false,                /* Nope -- this one's little endian */
318
319   /* header_byteorder_big_p: header is also big endian */
320   false,                /* Nope -- this one's little endian */
321
322   /* object_flags: mask of all file flags */
323   (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
324    DYNAMIC | WP_TEXT | D_PAGED),
325   
326   /* section_flags: mask of all section flags */
327   (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
328    SEC_CODE | SEC_DATA | SEC_DEBUGGING),
329
330    /* leading_symbol_char: is the first char of a user symbol
331       predictable, and if so what is it */
332    0,
333
334   /* ar_pad_char: pad character for filenames within an archive header
335      FIXME:  this really has nothing to do with ELF, this is a characteristic
336      of the archiver and/or os and should be independently tunable */
337   '/',
338
339   /* ar_max_namelen: maximum number of characters in an archive header
340      FIXME:  this really has nothing to do with ELF, this is a characteristic
341      of the archiver and should be independently tunable.  This value is
342      a WAG (wild a** guess) */
343   14,
344
345   /* align_power_min: minimum alignment restriction for any section
346      FIXME:  this value may be target machine dependent */
347   3,
348
349   /* Routines to byte-swap various sized integers from the data sections */
350   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
351     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
352     bfd_getl16, bfd_getl_signed_16, bfd_putl16,
353
354   /* Routines to byte-swap various sized integers from the file headers */
355   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
356     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
357     bfd_getl16, bfd_getl_signed_16, bfd_putl16,
358
359   /* bfd_check_format: check the format of a file being read */
360   { _bfd_dummy_target,          /* unknown format */
361     bfd_elfNN_object_p,         /* assembler/linker output (object file) */
362     bfd_generic_archive_p,      /* an archive */
363     bfd_elfNN_core_file_p       /* a core file */
364   },
365
366   /* bfd_set_format: set the format of a file being written */
367   { bfd_false,
368     bfd_elf_mkobject,
369     _bfd_generic_mkarchive,
370     bfd_false
371   },
372
373   /* bfd_write_contents: write cached information into a file being written */
374   { bfd_false,
375     bfd_elfNN_write_object_contents,
376     _bfd_write_archive_contents,
377     bfd_false
378   },
379
380       BFD_JUMP_TABLE_GENERIC (bfd_elfNN),
381       BFD_JUMP_TABLE_COPY (bfd_elfNN),
382       BFD_JUMP_TABLE_CORE (bfd_elfNN),
383       BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
384       BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN),
385       BFD_JUMP_TABLE_RELOCS (bfd_elfNN),
386       BFD_JUMP_TABLE_WRITE (bfd_elfNN),
387       BFD_JUMP_TABLE_LINK (bfd_elfNN),
388       BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),
389
390   /* backend_data: */
391   (PTR) &elfNN_bed,
392 };
393 #endif