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