Tue Oct 31 18:22:24 1995 David Mosberger-Tang <davidm@azstarnet.com>
[deliverable/binutils-gdb.git] / bfd / elfxx-target.h
CommitLineData
b968e4f4
KR
1/* Target definitions for NN-bit ELF
2 Copyright 1993, 1994, 1995 Free Software Foundation, Inc.
3adad029
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
4e98461f 18Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
3adad029
KR
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
b968e4f4
KR
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
3adad029 32#endif
3adad029 33
ede4eed4
KR
34#define bfd_elfNN_canonicalize_dynamic_symtab _bfd_elf_canonicalize_dynamic_symtab
35#define bfd_elfNN_canonicalize_reloc _bfd_elf_canonicalize_reloc
36#ifndef bfd_elfNN_find_nearest_line
37#define bfd_elfNN_find_nearest_line _bfd_elf_find_nearest_line
38#endif
4e98461f
SC
39#define bfd_elfNN_read_minisymbols _bfd_elf_read_minisymbols
40#define bfd_elfNN_minisymbol_to_symbol _bfd_elf_minisymbol_to_symbol
ede4eed4
KR
41#define bfd_elfNN_get_dynamic_symtab_upper_bound _bfd_elf_get_dynamic_symtab_upper_bound
42#define bfd_elfNN_get_lineno _bfd_elf_get_lineno
43#define bfd_elfNN_get_reloc_upper_bound _bfd_elf_get_reloc_upper_bound
44#define bfd_elfNN_get_symbol_info _bfd_elf_get_symbol_info
45#define bfd_elfNN_get_symtab _bfd_elf_get_symtab
46#define bfd_elfNN_get_symtab_upper_bound _bfd_elf_get_symtab_upper_bound
47#if 0 /* done in libelf.h */
48#define bfd_elfNN_link_record_dynamic_symbol _bfd_elf_link_record_dynamic_symbol
49#endif
50#define bfd_elfNN_make_empty_symbol _bfd_elf_make_empty_symbol
51#define bfd_elfNN_new_section_hook _bfd_elf_new_section_hook
52#define bfd_elfNN_set_arch_mach _bfd_elf_set_arch_mach
53#ifndef bfd_elfNN_set_section_contents
54#define bfd_elfNN_set_section_contents _bfd_elf_set_section_contents
55#endif
56#define bfd_elfNN_sizeof_headers _bfd_elf_sizeof_headers
57#define bfd_elfNN_write_object_contents _bfd_elf_write_object_contents
58
59#ifndef elf_backend_want_got_plt
60#define elf_backend_want_got_plt 0
61#endif
62#ifndef elf_backend_plt_readonly
63#define elf_backend_plt_readonly 0
64#endif
65#ifndef elf_backend_want_plt_sym
66#define elf_backend_want_plt_sym 0
67#endif
68
b968e4f4
KR
69#define bfd_elfNN_bfd_debug_info_start bfd_void
70#define bfd_elfNN_bfd_debug_info_end bfd_void
71#define bfd_elfNN_bfd_debug_info_accumulate (PROTO(void,(*),(bfd*, struct sec *))) bfd_void
72
73#ifndef bfd_elfNN_bfd_get_relocated_section_contents
74#define bfd_elfNN_bfd_get_relocated_section_contents \
3adad029 75 bfd_generic_get_relocated_section_contents
b968e4f4
KR
76#endif
77
78#define bfd_elfNN_bfd_relax_section bfd_generic_relax_section
79#define bfd_elfNN_bfd_make_debug_symbol \
3adad029
KR
80 ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
81
b968e4f4
KR
82#ifndef bfd_elfNN_bfd_copy_private_symbol_data
83#define bfd_elfNN_bfd_copy_private_symbol_data \
6167a840
JL
84 ((boolean (*) PARAMS ((bfd *, asymbol *, bfd *, asymbol *))) bfd_true)
85#endif
b968e4f4
KR
86#ifndef bfd_elfNN_bfd_copy_private_section_data
87#define bfd_elfNN_bfd_copy_private_section_data \
5b3577cb
JL
88 ((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_true)
89#endif
b968e4f4
KR
90#ifndef bfd_elfNN_bfd_copy_private_bfd_data
91#define bfd_elfNN_bfd_copy_private_bfd_data \
5b3577cb
JL
92 ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
93#endif
4e98461f
SC
94#ifndef bfd_elfNN_bfd_print_private_bfd_data
95#define bfd_elfNN_bfd_print_private_bfd_data \
96 ((boolean (*) PARAMS ((bfd *, void *))) bfd_true)
97#endif
b968e4f4
KR
98#ifndef bfd_elfNN_bfd_merge_private_bfd_data
99#define bfd_elfNN_bfd_merge_private_bfd_data \
d5fb1e2a
MM
100 ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
101#endif
b968e4f4
KR
102#ifndef bfd_elfNN_bfd_set_private_flags
103#define bfd_elfNN_bfd_set_private_flags \
d5fb1e2a
MM
104 ((boolean (*) PARAMS ((bfd *, flagword))) bfd_true)
105#endif
b968e4f4
KR
106#ifndef bfd_elfNN_bfd_is_local_label
107#define bfd_elfNN_bfd_is_local_label bfd_generic_is_local_label
5b3577cb
JL
108#endif
109
b968e4f4
KR
110#ifndef bfd_elfNN_get_dynamic_reloc_upper_bound
111#define bfd_elfNN_get_dynamic_reloc_upper_bound \
cb71adf1
PS
112 _bfd_nodynamic_get_dynamic_reloc_upper_bound
113#endif
b968e4f4
KR
114#ifndef bfd_elfNN_canonicalize_dynamic_reloc
115#define bfd_elfNN_canonicalize_dynamic_reloc \
cb71adf1
PS
116 _bfd_nodynamic_canonicalize_dynamic_reloc
117#endif
118
6ec3bb6a 119#ifdef elf_backend_relocate_section
b968e4f4
KR
120#ifndef bfd_elfNN_bfd_link_hash_table_create
121#define bfd_elfNN_bfd_link_hash_table_create _bfd_elf_link_hash_table_create
6ec3bb6a
ILT
122#endif
123#else /* ! defined (elf_backend_relocate_section) */
124/* If no backend relocate_section routine, use the generic linker. */
b968e4f4
KR
125#ifndef bfd_elfNN_bfd_link_hash_table_create
126#define bfd_elfNN_bfd_link_hash_table_create \
6ec3bb6a
ILT
127 _bfd_generic_link_hash_table_create
128#endif
b968e4f4
KR
129#ifndef bfd_elfNN_bfd_link_add_symbols
130#define bfd_elfNN_bfd_link_add_symbols _bfd_generic_link_add_symbols
6ec3bb6a 131#endif
b968e4f4
KR
132#ifndef bfd_elfNN_bfd_final_link
133#define bfd_elfNN_bfd_final_link _bfd_generic_final_link
6ec3bb6a
ILT
134#endif
135#endif /* ! defined (elf_backend_relocate_section) */
b968e4f4
KR
136#ifndef bfd_elfNN_bfd_link_split_section
137#define bfd_elfNN_bfd_link_split_section _bfd_generic_link_split_section
6167a840 138#endif
6ec3bb6a 139
b3024965
KR
140#ifndef elf_info_to_howto_rel
141#define elf_info_to_howto_rel 0
142#endif
143
144#ifndef ELF_MAXPAGESIZE
145#define ELF_MAXPAGESIZE 1
146#endif
147
6ec3bb6a
ILT
148#ifndef elf_backend_collect
149#define elf_backend_collect false
150#endif
151
643e9fc7
ILT
152#ifndef elf_backend_sym_is_global
153#define elf_backend_sym_is_global 0
154#endif
a5ccdad1 155#ifndef elf_backend_object_p
643e9fc7 156#define elf_backend_object_p 0
a5ccdad1 157#endif
95469b02 158#ifndef elf_backend_symbol_processing
643e9fc7 159#define elf_backend_symbol_processing 0
95469b02
ILT
160#endif
161#ifndef elf_backend_symbol_table_processing
643e9fc7 162#define elf_backend_symbol_table_processing 0
95469b02
ILT
163#endif
164#ifndef elf_backend_section_processing
643e9fc7 165#define elf_backend_section_processing 0
95469b02
ILT
166#endif
167#ifndef elf_backend_section_from_shdr
643e9fc7 168#define elf_backend_section_from_shdr 0
95469b02
ILT
169#endif
170#ifndef elf_backend_fake_sections
643e9fc7 171#define elf_backend_fake_sections 0
95469b02
ILT
172#endif
173#ifndef elf_backend_section_from_bfd_section
643e9fc7
ILT
174#define elf_backend_section_from_bfd_section 0
175#endif
6ec3bb6a
ILT
176#ifndef elf_backend_add_symbol_hook
177#define elf_backend_add_symbol_hook 0
178#endif
ff5a090f
JL
179#ifndef elf_backend_link_output_symbol_hook
180#define elf_backend_link_output_symbol_hook 0
181#endif
013dec1a
ILT
182#ifndef elf_backend_create_dynamic_sections
183#define elf_backend_create_dynamic_sections 0
184#endif
374d2ef9
ILT
185#ifndef elf_backend_check_relocs
186#define elf_backend_check_relocs 0
187#endif
013dec1a
ILT
188#ifndef elf_backend_adjust_dynamic_symbol
189#define elf_backend_adjust_dynamic_symbol 0
190#endif
191#ifndef elf_backend_size_dynamic_sections
192#define elf_backend_size_dynamic_sections 0
193#endif
6ec3bb6a
ILT
194#ifndef elf_backend_relocate_section
195#define elf_backend_relocate_section 0
196#endif
013dec1a
ILT
197#ifndef elf_backend_finish_dynamic_symbol
198#define elf_backend_finish_dynamic_symbol 0
199#endif
200#ifndef elf_backend_finish_dynamic_sections
201#define elf_backend_finish_dynamic_sections 0
202#endif
99a6c761
JL
203#ifndef elf_backend_begin_write_processing
204#define elf_backend_begin_write_processing 0
205#endif
643e9fc7
ILT
206#ifndef elf_backend_final_write_processing
207#define elf_backend_final_write_processing 0
95469b02
ILT
208#endif
209#ifndef elf_backend_ecoff_debug_swap
643e9fc7 210#define elf_backend_ecoff_debug_swap 0
95469b02
ILT
211#endif
212
8c9bfee3
MM
213#ifndef ELF_MACHINE_ALT1
214#define ELF_MACHINE_ALT1 0
215#endif
216
217#ifndef ELF_MACHINE_ALT2
218#define ELF_MACHINE_ALT2 0
219#endif
220
ede4eed4
KR
221extern const struct elf_size_info _bfd_elfNN_size_info;
222
b968e4f4 223static CONST struct elf_backend_data elfNN_bed =
3adad029
KR
224{
225#ifdef USE_REL
226 0, /* use_rela_p */
227#else
228 1, /* use_rela_p */
b968e4f4 229#endif
3adad029 230 ELF_ARCH, /* arch */
a5ccdad1 231 ELF_MACHINE_CODE, /* elf_machine_code */
95469b02 232 ELF_MAXPAGESIZE, /* maxpagesize */
6ec3bb6a 233 elf_backend_collect,
643e9fc7
ILT
234 elf_info_to_howto,
235 elf_info_to_howto_rel,
236 elf_backend_sym_is_global,
237 elf_backend_object_p,
238 elf_backend_symbol_processing,
239 elf_backend_symbol_table_processing,
240 elf_backend_section_processing,
241 elf_backend_section_from_shdr,
242 elf_backend_fake_sections,
243 elf_backend_section_from_bfd_section,
6ec3bb6a 244 elf_backend_add_symbol_hook,
ff5a090f 245 elf_backend_link_output_symbol_hook,
013dec1a 246 elf_backend_create_dynamic_sections,
374d2ef9 247 elf_backend_check_relocs,
013dec1a
ILT
248 elf_backend_adjust_dynamic_symbol,
249 elf_backend_size_dynamic_sections,
6ec3bb6a 250 elf_backend_relocate_section,
013dec1a
ILT
251 elf_backend_finish_dynamic_symbol,
252 elf_backend_finish_dynamic_sections,
99a6c761
JL
253 elf_backend_begin_write_processing,
254 elf_backend_final_write_processing,
8c9bfee3
MM
255 elf_backend_ecoff_debug_swap,
256 ELF_MACHINE_ALT1,
ede4eed4
KR
257 ELF_MACHINE_ALT2,
258 &_bfd_elfNN_size_info,
259 elf_backend_want_got_plt,
260 elf_backend_plt_readonly,
261 elf_backend_want_plt_sym,
3adad029
KR
262};
263
264#ifdef TARGET_BIG_SYM
2f3508ad 265const bfd_target TARGET_BIG_SYM =
3adad029
KR
266{
267 /* name: identify kind of target */
268 TARGET_BIG_NAME,
269
270 /* flavour: general indication about file */
271 bfd_target_elf_flavour,
272
273 /* byteorder_big_p: data is big endian */
274 true,
275
276 /* header_byteorder_big_p: header is also big endian */
277 true,
278
279 /* object_flags: mask of all file flags */
280 (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
fa15568a 281 DYNAMIC | WP_TEXT | D_PAGED),
3adad029
KR
282
283 /* section_flags: mask of all section flags */
284 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
d6e5f950 285 SEC_CODE | SEC_DATA | SEC_DEBUGGING),
3adad029
KR
286
287 /* leading_symbol_char: is the first char of a user symbol
288 predictable, and if so what is it */
289 0,
290
291 /* ar_pad_char: pad character for filenames within an archive header
292 FIXME: this really has nothing to do with ELF, this is a characteristic
293 of the archiver and/or os and should be independently tunable */
294 '/',
295
296 /* ar_max_namelen: maximum number of characters in an archive header
297 FIXME: this really has nothing to do with ELF, this is a characteristic
298 of the archiver and should be independently tunable. This value is
299 a WAG (wild a** guess) */
7a0c782d 300 14,
3adad029
KR
301
302 /* align_power_min: minimum alignment restriction for any section
303 FIXME: this value may be target machine dependent */
304 3,
305
306 /* Routines to byte-swap various sized integers from the data sections */
23f44e6f
ILT
307 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
308 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
309 bfd_getb16, bfd_getb_signed_16, bfd_putb16,
3adad029
KR
310
311 /* Routines to byte-swap various sized integers from the file headers */
23f44e6f
ILT
312 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
313 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
314 bfd_getb16, bfd_getb_signed_16, bfd_putb16,
3adad029
KR
315
316 /* bfd_check_format: check the format of a file being read */
317 { _bfd_dummy_target, /* unknown format */
b968e4f4 318 bfd_elfNN_object_p, /* assembler/linker output (object file) */
3adad029 319 bfd_generic_archive_p, /* an archive */
b968e4f4 320 bfd_elfNN_core_file_p /* a core file */
3adad029
KR
321 },
322
323 /* bfd_set_format: set the format of a file being written */
324 { bfd_false,
325 bfd_elf_mkobject,
326 _bfd_generic_mkarchive,
327 bfd_false
328 },
329
330 /* bfd_write_contents: write cached information into a file being written */
331 { bfd_false,
b968e4f4 332 bfd_elfNN_write_object_contents,
3adad029
KR
333 _bfd_write_archive_contents,
334 bfd_false
335 },
336
b968e4f4
KR
337 BFD_JUMP_TABLE_GENERIC (bfd_elfNN),
338 BFD_JUMP_TABLE_COPY (bfd_elfNN),
339 BFD_JUMP_TABLE_CORE (bfd_elfNN),
6812b607 340 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
b968e4f4
KR
341 BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN),
342 BFD_JUMP_TABLE_RELOCS (bfd_elfNN),
343 BFD_JUMP_TABLE_WRITE (bfd_elfNN),
344 BFD_JUMP_TABLE_LINK (bfd_elfNN),
345 BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),
3adad029
KR
346
347 /* backend_data: */
b968e4f4 348 (PTR) &elfNN_bed,
3adad029
KR
349};
350#endif
351
352#ifdef TARGET_LITTLE_SYM
2f3508ad 353const bfd_target TARGET_LITTLE_SYM =
3adad029
KR
354{
355 /* name: identify kind of target */
356 TARGET_LITTLE_NAME,
357
358 /* flavour: general indication about file */
359 bfd_target_elf_flavour,
360
361 /* byteorder_big_p: data is big endian */
362 false, /* Nope -- this one's little endian */
363
364 /* header_byteorder_big_p: header is also big endian */
365 false, /* Nope -- this one's little endian */
366
367 /* object_flags: mask of all file flags */
368 (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
fa15568a 369 DYNAMIC | WP_TEXT | D_PAGED),
3adad029
KR
370
371 /* section_flags: mask of all section flags */
372 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
d6e5f950 373 SEC_CODE | SEC_DATA | SEC_DEBUGGING),
3adad029
KR
374
375 /* leading_symbol_char: is the first char of a user symbol
376 predictable, and if so what is it */
377 0,
378
379 /* ar_pad_char: pad character for filenames within an archive header
380 FIXME: this really has nothing to do with ELF, this is a characteristic
381 of the archiver and/or os and should be independently tunable */
382 '/',
383
384 /* ar_max_namelen: maximum number of characters in an archive header
385 FIXME: this really has nothing to do with ELF, this is a characteristic
386 of the archiver and should be independently tunable. This value is
387 a WAG (wild a** guess) */
7a0c782d 388 14,
3adad029
KR
389
390 /* align_power_min: minimum alignment restriction for any section
391 FIXME: this value may be target machine dependent */
392 3,
393
394 /* Routines to byte-swap various sized integers from the data sections */
23f44e6f
ILT
395 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
396 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
397 bfd_getl16, bfd_getl_signed_16, bfd_putl16,
3adad029
KR
398
399 /* Routines to byte-swap various sized integers from the file headers */
23f44e6f
ILT
400 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
401 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
402 bfd_getl16, bfd_getl_signed_16, bfd_putl16,
3adad029
KR
403
404 /* bfd_check_format: check the format of a file being read */
405 { _bfd_dummy_target, /* unknown format */
b968e4f4 406 bfd_elfNN_object_p, /* assembler/linker output (object file) */
3adad029 407 bfd_generic_archive_p, /* an archive */
b968e4f4 408 bfd_elfNN_core_file_p /* a core file */
3adad029
KR
409 },
410
411 /* bfd_set_format: set the format of a file being written */
412 { bfd_false,
413 bfd_elf_mkobject,
414 _bfd_generic_mkarchive,
415 bfd_false
416 },
417
418 /* bfd_write_contents: write cached information into a file being written */
419 { bfd_false,
b968e4f4 420 bfd_elfNN_write_object_contents,
3adad029
KR
421 _bfd_write_archive_contents,
422 bfd_false
423 },
424
b968e4f4
KR
425 BFD_JUMP_TABLE_GENERIC (bfd_elfNN),
426 BFD_JUMP_TABLE_COPY (bfd_elfNN),
427 BFD_JUMP_TABLE_CORE (bfd_elfNN),
6812b607 428 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
b968e4f4
KR
429 BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN),
430 BFD_JUMP_TABLE_RELOCS (bfd_elfNN),
431 BFD_JUMP_TABLE_WRITE (bfd_elfNN),
432 BFD_JUMP_TABLE_LINK (bfd_elfNN),
433 BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),
3adad029
KR
434
435 /* backend_data: */
b968e4f4 436 (PTR) &elfNN_bed,
3adad029
KR
437};
438#endif
This page took 0.213221 seconds and 4 git commands to generate.