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