Add linux.mh and xm-linux.h.
[deliverable/binutils-gdb.git] / bfd / elfxx-target.h
CommitLineData
b968e4f4 1/* Target definitions for NN-bit ELF
d1bf45aa 2 Copyright 1993, 1994, 1995, 1996 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
631b10f4
ILT
59#define bfd_elfNN_get_section_contents_in_window \
60 _bfd_generic_get_section_contents_in_window
61
ede4eed4
KR
62#ifndef elf_backend_want_got_plt
63#define elf_backend_want_got_plt 0
64#endif
65#ifndef elf_backend_plt_readonly
66#define elf_backend_plt_readonly 0
67#endif
68#ifndef elf_backend_want_plt_sym
69#define elf_backend_want_plt_sym 0
70#endif
71
b968e4f4
KR
72#define bfd_elfNN_bfd_debug_info_start bfd_void
73#define bfd_elfNN_bfd_debug_info_end bfd_void
74#define bfd_elfNN_bfd_debug_info_accumulate (PROTO(void,(*),(bfd*, struct sec *))) bfd_void
75
76#ifndef bfd_elfNN_bfd_get_relocated_section_contents
77#define bfd_elfNN_bfd_get_relocated_section_contents \
3adad029 78 bfd_generic_get_relocated_section_contents
b968e4f4
KR
79#endif
80
81#define bfd_elfNN_bfd_relax_section bfd_generic_relax_section
82#define bfd_elfNN_bfd_make_debug_symbol \
3adad029
KR
83 ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
84
b968e4f4
KR
85#ifndef bfd_elfNN_bfd_copy_private_symbol_data
86#define bfd_elfNN_bfd_copy_private_symbol_data \
631b10f4 87 _bfd_elf_copy_private_symbol_data
6167a840 88#endif
631b10f4 89
b968e4f4
KR
90#ifndef bfd_elfNN_bfd_copy_private_section_data
91#define bfd_elfNN_bfd_copy_private_section_data \
631b10f4 92 _bfd_elf_copy_private_section_data
5b3577cb 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 \
27fb8f29 100 _bfd_elf_print_private_bfd_data
4e98461f 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
d1bf45aa
ILT
144#ifndef elf_symbol_leading_char
145#define elf_symbol_leading_char 0
146#endif
147
148#ifndef elf_info_to_howto
149#define elf_info_to_howto 0
150#endif
151
b3024965
KR
152#ifndef elf_info_to_howto_rel
153#define elf_info_to_howto_rel 0
154#endif
155
156#ifndef ELF_MAXPAGESIZE
157#define ELF_MAXPAGESIZE 1
158#endif
159
6ec3bb6a
ILT
160#ifndef elf_backend_collect
161#define elf_backend_collect false
162#endif
5b3b9ff6
ILT
163#ifndef elf_backend_type_change_ok
164#define elf_backend_type_change_ok false
165#endif
6ec3bb6a 166
643e9fc7
ILT
167#ifndef elf_backend_sym_is_global
168#define elf_backend_sym_is_global 0
169#endif
a5ccdad1 170#ifndef elf_backend_object_p
643e9fc7 171#define elf_backend_object_p 0
a5ccdad1 172#endif
95469b02 173#ifndef elf_backend_symbol_processing
643e9fc7 174#define elf_backend_symbol_processing 0
95469b02
ILT
175#endif
176#ifndef elf_backend_symbol_table_processing
643e9fc7 177#define elf_backend_symbol_table_processing 0
95469b02
ILT
178#endif
179#ifndef elf_backend_section_processing
643e9fc7 180#define elf_backend_section_processing 0
95469b02
ILT
181#endif
182#ifndef elf_backend_section_from_shdr
643e9fc7 183#define elf_backend_section_from_shdr 0
95469b02
ILT
184#endif
185#ifndef elf_backend_fake_sections
643e9fc7 186#define elf_backend_fake_sections 0
95469b02
ILT
187#endif
188#ifndef elf_backend_section_from_bfd_section
643e9fc7
ILT
189#define elf_backend_section_from_bfd_section 0
190#endif
6ec3bb6a
ILT
191#ifndef elf_backend_add_symbol_hook
192#define elf_backend_add_symbol_hook 0
193#endif
ff5a090f
JL
194#ifndef elf_backend_link_output_symbol_hook
195#define elf_backend_link_output_symbol_hook 0
196#endif
013dec1a
ILT
197#ifndef elf_backend_create_dynamic_sections
198#define elf_backend_create_dynamic_sections 0
199#endif
374d2ef9
ILT
200#ifndef elf_backend_check_relocs
201#define elf_backend_check_relocs 0
202#endif
013dec1a
ILT
203#ifndef elf_backend_adjust_dynamic_symbol
204#define elf_backend_adjust_dynamic_symbol 0
205#endif
206#ifndef elf_backend_size_dynamic_sections
207#define elf_backend_size_dynamic_sections 0
208#endif
6ec3bb6a
ILT
209#ifndef elf_backend_relocate_section
210#define elf_backend_relocate_section 0
211#endif
013dec1a
ILT
212#ifndef elf_backend_finish_dynamic_symbol
213#define elf_backend_finish_dynamic_symbol 0
214#endif
215#ifndef elf_backend_finish_dynamic_sections
216#define elf_backend_finish_dynamic_sections 0
217#endif
99a6c761
JL
218#ifndef elf_backend_begin_write_processing
219#define elf_backend_begin_write_processing 0
220#endif
643e9fc7
ILT
221#ifndef elf_backend_final_write_processing
222#define elf_backend_final_write_processing 0
95469b02 223#endif
5b3b9ff6
ILT
224#ifndef elf_backend_additional_program_headers
225#define elf_backend_additional_program_headers 0
226#endif
227#ifndef elf_backend_modify_segment_map
228#define elf_backend_modify_segment_map 0
6ab826bd 229#endif
95469b02 230#ifndef elf_backend_ecoff_debug_swap
643e9fc7 231#define elf_backend_ecoff_debug_swap 0
95469b02
ILT
232#endif
233
8c9bfee3
MM
234#ifndef ELF_MACHINE_ALT1
235#define ELF_MACHINE_ALT1 0
236#endif
237
238#ifndef ELF_MACHINE_ALT2
239#define ELF_MACHINE_ALT2 0
240#endif
241
d1bf45aa
ILT
242#ifndef elf_backend_size_info
243#define elf_backend_size_info _bfd_elfNN_size_info
244#endif
245
ede4eed4
KR
246extern const struct elf_size_info _bfd_elfNN_size_info;
247
b968e4f4 248static CONST struct elf_backend_data elfNN_bed =
3adad029
KR
249{
250#ifdef USE_REL
251 0, /* use_rela_p */
252#else
253 1, /* use_rela_p */
b968e4f4 254#endif
3adad029 255 ELF_ARCH, /* arch */
a5ccdad1 256 ELF_MACHINE_CODE, /* elf_machine_code */
95469b02 257 ELF_MAXPAGESIZE, /* maxpagesize */
6ec3bb6a 258 elf_backend_collect,
5b3b9ff6 259 elf_backend_type_change_ok,
643e9fc7
ILT
260 elf_info_to_howto,
261 elf_info_to_howto_rel,
262 elf_backend_sym_is_global,
263 elf_backend_object_p,
264 elf_backend_symbol_processing,
265 elf_backend_symbol_table_processing,
266 elf_backend_section_processing,
267 elf_backend_section_from_shdr,
268 elf_backend_fake_sections,
269 elf_backend_section_from_bfd_section,
6ec3bb6a 270 elf_backend_add_symbol_hook,
ff5a090f 271 elf_backend_link_output_symbol_hook,
013dec1a 272 elf_backend_create_dynamic_sections,
374d2ef9 273 elf_backend_check_relocs,
013dec1a
ILT
274 elf_backend_adjust_dynamic_symbol,
275 elf_backend_size_dynamic_sections,
6ec3bb6a 276 elf_backend_relocate_section,
013dec1a
ILT
277 elf_backend_finish_dynamic_symbol,
278 elf_backend_finish_dynamic_sections,
99a6c761
JL
279 elf_backend_begin_write_processing,
280 elf_backend_final_write_processing,
5b3b9ff6
ILT
281 elf_backend_additional_program_headers,
282 elf_backend_modify_segment_map,
8c9bfee3
MM
283 elf_backend_ecoff_debug_swap,
284 ELF_MACHINE_ALT1,
ede4eed4 285 ELF_MACHINE_ALT2,
d1bf45aa 286 &elf_backend_size_info,
ede4eed4
KR
287 elf_backend_want_got_plt,
288 elf_backend_plt_readonly,
d1bf45aa 289 elf_backend_want_plt_sym
3adad029
KR
290};
291
292#ifdef TARGET_BIG_SYM
2f3508ad 293const bfd_target TARGET_BIG_SYM =
3adad029
KR
294{
295 /* name: identify kind of target */
296 TARGET_BIG_NAME,
297
298 /* flavour: general indication about file */
299 bfd_target_elf_flavour,
300
5b3b9ff6
ILT
301 /* byteorder: data is big endian */
302 BFD_ENDIAN_BIG,
3adad029 303
5b3b9ff6
ILT
304 /* header_byteorder: header is also big endian */
305 BFD_ENDIAN_BIG,
3adad029
KR
306
307 /* object_flags: mask of all file flags */
308 (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
fa15568a 309 DYNAMIC | WP_TEXT | D_PAGED),
3adad029
KR
310
311 /* section_flags: mask of all section flags */
312 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
83f4323e 313 SEC_CODE | SEC_DATA | SEC_DEBUGGING | SEC_EXCLUDE | SEC_SORT_ENTRIES),
3adad029
KR
314
315 /* leading_symbol_char: is the first char of a user symbol
316 predictable, and if so what is it */
d1bf45aa 317 elf_symbol_leading_char,
3adad029
KR
318
319 /* ar_pad_char: pad character for filenames within an archive header
320 FIXME: this really has nothing to do with ELF, this is a characteristic
321 of the archiver and/or os and should be independently tunable */
322 '/',
323
324 /* ar_max_namelen: maximum number of characters in an archive header
325 FIXME: this really has nothing to do with ELF, this is a characteristic
326 of the archiver and should be independently tunable. This value is
327 a WAG (wild a** guess) */
7a0c782d 328 14,
3adad029 329
3adad029 330 /* Routines to byte-swap various sized integers from the data sections */
23f44e6f
ILT
331 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
332 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
333 bfd_getb16, bfd_getb_signed_16, bfd_putb16,
3adad029
KR
334
335 /* Routines to byte-swap various sized integers from the file headers */
23f44e6f
ILT
336 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
337 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
338 bfd_getb16, bfd_getb_signed_16, bfd_putb16,
3adad029
KR
339
340 /* bfd_check_format: check the format of a file being read */
341 { _bfd_dummy_target, /* unknown format */
b968e4f4 342 bfd_elfNN_object_p, /* assembler/linker output (object file) */
3adad029 343 bfd_generic_archive_p, /* an archive */
b968e4f4 344 bfd_elfNN_core_file_p /* a core file */
3adad029
KR
345 },
346
347 /* bfd_set_format: set the format of a file being written */
348 { bfd_false,
349 bfd_elf_mkobject,
350 _bfd_generic_mkarchive,
351 bfd_false
352 },
353
354 /* bfd_write_contents: write cached information into a file being written */
355 { bfd_false,
b968e4f4 356 bfd_elfNN_write_object_contents,
3adad029
KR
357 _bfd_write_archive_contents,
358 bfd_false
359 },
360
b968e4f4
KR
361 BFD_JUMP_TABLE_GENERIC (bfd_elfNN),
362 BFD_JUMP_TABLE_COPY (bfd_elfNN),
363 BFD_JUMP_TABLE_CORE (bfd_elfNN),
6812b607 364 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
b968e4f4
KR
365 BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN),
366 BFD_JUMP_TABLE_RELOCS (bfd_elfNN),
367 BFD_JUMP_TABLE_WRITE (bfd_elfNN),
368 BFD_JUMP_TABLE_LINK (bfd_elfNN),
369 BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),
3adad029
KR
370
371 /* backend_data: */
b968e4f4 372 (PTR) &elfNN_bed,
3adad029
KR
373};
374#endif
375
376#ifdef TARGET_LITTLE_SYM
2f3508ad 377const bfd_target TARGET_LITTLE_SYM =
3adad029
KR
378{
379 /* name: identify kind of target */
380 TARGET_LITTLE_NAME,
381
382 /* flavour: general indication about file */
383 bfd_target_elf_flavour,
384
5b3b9ff6
ILT
385 /* byteorder: data is little endian */
386 BFD_ENDIAN_LITTLE,
3adad029 387
5b3b9ff6
ILT
388 /* header_byteorder: header is also little endian */
389 BFD_ENDIAN_LITTLE,
3adad029
KR
390
391 /* object_flags: mask of all file flags */
392 (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
fa15568a 393 DYNAMIC | WP_TEXT | D_PAGED),
3adad029
KR
394
395 /* section_flags: mask of all section flags */
396 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
83f4323e 397 SEC_CODE | SEC_DATA | SEC_DEBUGGING | SEC_EXCLUDE | SEC_SORT_ENTRIES),
3adad029
KR
398
399 /* leading_symbol_char: is the first char of a user symbol
400 predictable, and if so what is it */
d1bf45aa 401 elf_symbol_leading_char,
3adad029
KR
402
403 /* ar_pad_char: pad character for filenames within an archive header
404 FIXME: this really has nothing to do with ELF, this is a characteristic
405 of the archiver and/or os and should be independently tunable */
406 '/',
407
408 /* ar_max_namelen: maximum number of characters in an archive header
409 FIXME: this really has nothing to do with ELF, this is a characteristic
410 of the archiver and should be independently tunable. This value is
411 a WAG (wild a** guess) */
7a0c782d 412 14,
3adad029 413
3adad029 414 /* Routines to byte-swap various sized integers from the data sections */
23f44e6f
ILT
415 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
416 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
417 bfd_getl16, bfd_getl_signed_16, bfd_putl16,
3adad029
KR
418
419 /* Routines to byte-swap various sized integers from the file headers */
23f44e6f
ILT
420 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
421 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
422 bfd_getl16, bfd_getl_signed_16, bfd_putl16,
3adad029
KR
423
424 /* bfd_check_format: check the format of a file being read */
425 { _bfd_dummy_target, /* unknown format */
b968e4f4 426 bfd_elfNN_object_p, /* assembler/linker output (object file) */
3adad029 427 bfd_generic_archive_p, /* an archive */
b968e4f4 428 bfd_elfNN_core_file_p /* a core file */
3adad029
KR
429 },
430
431 /* bfd_set_format: set the format of a file being written */
432 { bfd_false,
433 bfd_elf_mkobject,
434 _bfd_generic_mkarchive,
435 bfd_false
436 },
437
438 /* bfd_write_contents: write cached information into a file being written */
439 { bfd_false,
b968e4f4 440 bfd_elfNN_write_object_contents,
3adad029
KR
441 _bfd_write_archive_contents,
442 bfd_false
443 },
444
b968e4f4
KR
445 BFD_JUMP_TABLE_GENERIC (bfd_elfNN),
446 BFD_JUMP_TABLE_COPY (bfd_elfNN),
447 BFD_JUMP_TABLE_CORE (bfd_elfNN),
6812b607 448 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
b968e4f4
KR
449 BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN),
450 BFD_JUMP_TABLE_RELOCS (bfd_elfNN),
451 BFD_JUMP_TABLE_WRITE (bfd_elfNN),
452 BFD_JUMP_TABLE_LINK (bfd_elfNN),
453 BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),
3adad029
KR
454
455 /* backend_data: */
b968e4f4 456 (PTR) &elfNN_bed,
3adad029
KR
457};
458#endif
This page took 0.140056 seconds and 4 git commands to generate.