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