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