Commit | Line | Data |
---|---|---|
252b5132 | 1 | /* Define a target vector and some small routines for a variant of a.out. |
250d07de | 2 | Copyright (C) 1990-2021 Free Software Foundation, Inc. |
252b5132 | 3 | |
116c20d2 | 4 | This file is part of BFD, the Binary File Descriptor library. |
252b5132 | 5 | |
116c20d2 NC |
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 | |
cd123cb7 | 8 | the Free Software Foundation; either version 3 of the License, or |
116c20d2 | 9 | (at your option) any later version. |
252b5132 | 10 | |
116c20d2 NC |
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. | |
252b5132 | 15 | |
116c20d2 NC |
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 | |
cd123cb7 NC |
18 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
19 | MA 02110-1301, USA. */ | |
252b5132 RH |
20 | |
21 | #include "aout/aout64.h" | |
22 | #include "aout/stab_gnu.h" | |
23 | #include "aout/ar.h" | |
24 | /*#include "libaout.h"*/ | |
25 | ||
26 | #ifndef SEGMENT_SIZE | |
27 | #define SEGMENT_SIZE TARGET_PAGE_SIZE | |
28 | #endif | |
29 | ||
116c20d2 | 30 | extern reloc_howto_type * NAME (aout, reloc_type_lookup) (bfd *, bfd_reloc_code_real_type); |
157090f7 | 31 | extern reloc_howto_type * NAME (aout, reloc_name_lookup) (bfd *, const char *); |
252b5132 RH |
32 | |
33 | /* Set parameters about this a.out file that are machine-dependent. | |
34 | This routine is called from some_aout_object_p just before it returns. */ | |
35 | #ifndef MY_callback | |
36 | ||
cb001c0d | 37 | static bfd_cleanup |
116c20d2 | 38 | MY (callback) (bfd *abfd) |
252b5132 RH |
39 | { |
40 | struct internal_exec *execp = exec_hdr (abfd); | |
41 | unsigned int arch_align_power; | |
42 | unsigned long arch_align; | |
43 | ||
116c20d2 | 44 | /* Calculate the file positions of the parts of a newly read aout header. */ |
bbb1afc8 | 45 | obj_textsec (abfd)->size = N_TXTSIZE (execp); |
252b5132 | 46 | |
116c20d2 | 47 | /* The virtual memory addresses of the sections. */ |
bbb1afc8 AM |
48 | obj_textsec (abfd)->vma = N_TXTADDR (execp); |
49 | obj_datasec (abfd)->vma = N_DATADDR (execp); | |
50 | obj_bsssec (abfd)->vma = N_BSSADDR (execp); | |
252b5132 RH |
51 | |
52 | /* For some targets, if the entry point is not in the same page | |
53 | as the start of the text, then adjust the VMA so that it is. | |
54 | FIXME: Do this with a macro like SET_ARCH_MACH instead? */ | |
55 | if (aout_backend_info (abfd)->entry_is_text_address | |
56 | && execp->a_entry > obj_textsec (abfd)->vma) | |
57 | { | |
58 | bfd_vma adjust; | |
59 | ||
60 | adjust = execp->a_entry - obj_textsec (abfd)->vma; | |
c4dfa77f | 61 | /* Adjust only by whole pages. */ |
252b5132 RH |
62 | adjust &= ~(TARGET_PAGE_SIZE - 1); |
63 | obj_textsec (abfd)->vma += adjust; | |
64 | obj_datasec (abfd)->vma += adjust; | |
65 | obj_bsssec (abfd)->vma += adjust; | |
66 | } | |
67 | ||
68 | /* Set the load addresses to be the same as the virtual addresses. */ | |
69 | obj_textsec (abfd)->lma = obj_textsec (abfd)->vma; | |
70 | obj_datasec (abfd)->lma = obj_datasec (abfd)->vma; | |
71 | obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma; | |
72 | ||
116c20d2 | 73 | /* The file offsets of the sections. */ |
bbb1afc8 AM |
74 | obj_textsec (abfd)->filepos = N_TXTOFF (execp); |
75 | obj_datasec (abfd)->filepos = N_DATOFF (execp); | |
252b5132 | 76 | |
116c20d2 | 77 | /* The file offsets of the relocation info. */ |
bbb1afc8 AM |
78 | obj_textsec (abfd)->rel_filepos = N_TRELOFF (execp); |
79 | obj_datasec (abfd)->rel_filepos = N_DRELOFF (execp); | |
252b5132 RH |
80 | |
81 | /* The file offsets of the string table and symbol table. */ | |
bbb1afc8 AM |
82 | obj_sym_filepos (abfd) = N_SYMOFF (execp); |
83 | obj_str_filepos (abfd) = N_STROFF (execp); | |
c4dfa77f | 84 | |
252b5132 RH |
85 | /* Determine the architecture and machine type of the object file. */ |
86 | #ifdef SET_ARCH_MACH | |
bbb1afc8 | 87 | SET_ARCH_MACH (abfd, execp); |
252b5132 | 88 | #else |
dc810e39 | 89 | bfd_default_set_arch_mach (abfd, DEFAULT_ARCH, 0); |
252b5132 RH |
90 | #endif |
91 | ||
92 | /* The number of relocation records. This must be called after | |
93 | SET_ARCH_MACH. It assumes that SET_ARCH_MACH will set | |
94 | obj_reloc_entry_size correctly, if the reloc size is not | |
95 | RELOC_STD_SIZE. */ | |
96 | obj_textsec (abfd)->reloc_count = | |
97 | execp->a_trsize / obj_reloc_entry_size (abfd); | |
98 | obj_datasec (abfd)->reloc_count = | |
99 | execp->a_drsize / obj_reloc_entry_size (abfd); | |
100 | ||
101 | /* Now that we know the architecture, set the alignments of the | |
116c20d2 | 102 | sections. This is normally done by NAME (aout,new_section_hook), |
252b5132 RH |
103 | but when the initial sections were created the architecture had |
104 | not yet been set. However, for backward compatibility, we don't | |
105 | set the alignment power any higher than as required by the size | |
106 | of the section. */ | |
107 | arch_align_power = bfd_get_arch_info (abfd)->section_align_power; | |
108 | arch_align = 1 << arch_align_power; | |
eea6121a AM |
109 | if ((BFD_ALIGN (obj_textsec (abfd)->size, arch_align) |
110 | == obj_textsec (abfd)->size) | |
111 | && (BFD_ALIGN (obj_datasec (abfd)->size, arch_align) | |
112 | == obj_datasec (abfd)->size) | |
113 | && (BFD_ALIGN (obj_bsssec (abfd)->size, arch_align) | |
114 | == obj_bsssec (abfd)->size)) | |
252b5132 RH |
115 | { |
116 | obj_textsec (abfd)->alignment_power = arch_align_power; | |
117 | obj_datasec (abfd)->alignment_power = arch_align_power; | |
118 | obj_bsssec (abfd)->alignment_power = arch_align_power; | |
119 | } | |
120 | ||
121 | /* Don't set sizes now -- can't be sure until we know arch & mach. | |
122 | Sizes get set in set_sizes callback, later. */ | |
252b5132 | 123 | |
cb001c0d | 124 | return _bfd_no_cleanup; |
252b5132 RH |
125 | } |
126 | #endif | |
127 | ||
128 | #ifndef MY_object_p | |
116c20d2 | 129 | /* Finish up the reading of an a.out file header. */ |
252b5132 | 130 | |
cb001c0d | 131 | static bfd_cleanup |
116c20d2 | 132 | MY (object_p) (bfd *abfd) |
252b5132 | 133 | { |
116c20d2 NC |
134 | struct external_exec exec_bytes; /* Raw exec header from file. */ |
135 | struct internal_exec exec; /* Cleaned-up exec header. */ | |
cb001c0d | 136 | bfd_cleanup cleanup; |
986f0783 | 137 | size_t amt = EXEC_BYTES_SIZE; |
252b5132 | 138 | |
116c20d2 | 139 | if (bfd_bread ((void *) &exec_bytes, amt, abfd) != amt) |
dc810e39 AM |
140 | { |
141 | if (bfd_get_error () != bfd_error_system_call) | |
142 | bfd_set_error (bfd_error_wrong_format); | |
143 | return 0; | |
144 | } | |
252b5132 RH |
145 | |
146 | #ifdef SWAP_MAGIC | |
147 | exec.a_info = SWAP_MAGIC (exec_bytes.e_info); | |
148 | #else | |
e135f41b | 149 | exec.a_info = GET_MAGIC (abfd, exec_bytes.e_info); |
116c20d2 NC |
150 | #endif |
151 | ||
bbb1afc8 | 152 | if (N_BADMAG (&exec)) |
116c20d2 | 153 | return 0; |
252b5132 | 154 | |
252b5132 | 155 | #ifdef MACHTYPE_OK |
bbb1afc8 | 156 | if (!(MACHTYPE_OK (N_MACHTYPE (&exec)))) |
116c20d2 | 157 | return 0; |
252b5132 RH |
158 | #endif |
159 | ||
116c20d2 | 160 | NAME (aout, swap_exec_header_in) (abfd, &exec_bytes, &exec); |
252b5132 RH |
161 | |
162 | #ifdef SWAP_MAGIC | |
116c20d2 | 163 | /* Swap_exec_header_in read in a_info with the wrong byte order. */ |
252b5132 | 164 | exec.a_info = SWAP_MAGIC (exec_bytes.e_info); |
116c20d2 | 165 | #endif |
252b5132 | 166 | |
cb001c0d | 167 | cleanup = NAME (aout, some_aout_object_p) (abfd, &exec, MY (callback)); |
252b5132 RH |
168 | |
169 | #ifdef ENTRY_CAN_BE_ZERO | |
170 | /* The NEWSOS3 entry-point is/was 0, which (amongst other lossage) | |
116c20d2 NC |
171 | means that it isn't obvious if EXEC_P should be set. |
172 | All of the following must be true for an executable: | |
173 | There must be no relocations, the bfd can be neither an | |
174 | archive nor an archive element, and the file must be executable. */ | |
252b5132 RH |
175 | |
176 | if (exec.a_trsize + exec.a_drsize == 0 | |
177 | && bfd_get_format(abfd) == bfd_object && abfd->my_archive == NULL) | |
178 | { | |
179 | struct stat buf; | |
180 | #ifndef S_IXUSR | |
181 | #define S_IXUSR 0100 /* Execute by owner. */ | |
182 | #endif | |
765cf5f6 AM |
183 | if (stat (bfd_get_filename (abfd), &buf) == 0 |
184 | && (buf.st_mode & S_IXUSR) != 0) | |
252b5132 RH |
185 | abfd->flags |= EXEC_P; |
186 | } | |
187 | #endif /* ENTRY_CAN_BE_ZERO */ | |
188 | ||
cb001c0d | 189 | return cleanup; |
252b5132 | 190 | } |
116c20d2 | 191 | #define MY_object_p MY (object_p) |
252b5132 RH |
192 | #endif |
193 | ||
252b5132 RH |
194 | #ifndef MY_mkobject |
195 | ||
0a1b45a2 | 196 | static bool |
116c20d2 | 197 | MY (mkobject) (bfd *abfd) |
252b5132 | 198 | { |
0e71e495 | 199 | return NAME (aout, mkobject (abfd)); |
252b5132 | 200 | } |
0e71e495 | 201 | |
116c20d2 | 202 | #define MY_mkobject MY (mkobject) |
252b5132 RH |
203 | #endif |
204 | ||
205 | #ifndef MY_bfd_copy_private_section_data | |
206 | ||
207 | /* Copy private section data. This actually does nothing with the | |
208 | sections. It copies the subformat field. We copy it here, because | |
209 | we need to know whether this is a QMAGIC file before we set the | |
210 | section contents, and copy_private_bfd_data is not called until | |
211 | after the section contents have been set. */ | |
212 | ||
0a1b45a2 | 213 | static bool |
116c20d2 NC |
214 | MY_bfd_copy_private_section_data (bfd *ibfd, |
215 | asection *isec ATTRIBUTE_UNUSED, | |
216 | bfd *obfd, | |
217 | asection *osec ATTRIBUTE_UNUSED) | |
252b5132 RH |
218 | { |
219 | if (bfd_get_flavour (ibfd) == bfd_target_aout_flavour | |
220 | && bfd_get_flavour (obfd) == bfd_target_aout_flavour) | |
221 | obj_aout_subformat (obfd) = obj_aout_subformat (ibfd); | |
0a1b45a2 | 222 | return true; |
252b5132 RH |
223 | } |
224 | ||
225 | #endif | |
226 | ||
227 | /* Write an object file. | |
228 | Section contents have already been written. We write the | |
229 | file header, symbols, and relocation. */ | |
230 | ||
231 | #ifndef MY_write_object_contents | |
5a65713f | 232 | |
0a1b45a2 | 233 | static bool |
116c20d2 | 234 | MY (write_object_contents) (bfd *abfd) |
252b5132 RH |
235 | { |
236 | struct external_exec exec_bytes; | |
237 | struct internal_exec *execp = exec_hdr (abfd); | |
238 | ||
252b5132 | 239 | obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; |
252b5132 | 240 | |
116c20d2 | 241 | WRITE_HEADERS (abfd, execp); |
252b5132 | 242 | |
0a1b45a2 | 243 | return true; |
252b5132 | 244 | } |
116c20d2 | 245 | #define MY_write_object_contents MY (write_object_contents) |
252b5132 RH |
246 | #endif |
247 | ||
248 | #ifndef MY_set_sizes | |
249 | ||
0a1b45a2 | 250 | static bool |
116c20d2 | 251 | MY (set_sizes) (bfd *abfd) |
252b5132 RH |
252 | { |
253 | adata(abfd).page_size = TARGET_PAGE_SIZE; | |
254 | adata(abfd).segment_size = SEGMENT_SIZE; | |
255 | ||
256 | #ifdef ZMAGIC_DISK_BLOCK_SIZE | |
257 | adata(abfd).zmagic_disk_block_size = ZMAGIC_DISK_BLOCK_SIZE; | |
258 | #else | |
259 | adata(abfd).zmagic_disk_block_size = TARGET_PAGE_SIZE; | |
260 | #endif | |
261 | ||
262 | adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE; | |
0a1b45a2 | 263 | return true; |
252b5132 | 264 | } |
116c20d2 | 265 | #define MY_set_sizes MY (set_sizes) |
252b5132 RH |
266 | #endif |
267 | ||
268 | #ifndef MY_exec_hdr_flags | |
269 | #define MY_exec_hdr_flags 0 | |
270 | #endif | |
271 | ||
272 | #ifndef MY_backend_data | |
273 | ||
274 | #ifndef MY_zmagic_contiguous | |
275 | #define MY_zmagic_contiguous 0 | |
276 | #endif | |
277 | #ifndef MY_text_includes_header | |
278 | #define MY_text_includes_header 0 | |
279 | #endif | |
280 | #ifndef MY_entry_is_text_address | |
281 | #define MY_entry_is_text_address 0 | |
282 | #endif | |
283 | #ifndef MY_exec_header_not_counted | |
284 | #define MY_exec_header_not_counted 0 | |
285 | #endif | |
286 | #ifndef MY_add_dynamic_symbols | |
287 | #define MY_add_dynamic_symbols 0 | |
288 | #endif | |
289 | #ifndef MY_add_one_symbol | |
290 | #define MY_add_one_symbol 0 | |
291 | #endif | |
292 | #ifndef MY_link_dynamic_object | |
293 | #define MY_link_dynamic_object 0 | |
294 | #endif | |
295 | #ifndef MY_write_dynamic_symbol | |
296 | #define MY_write_dynamic_symbol 0 | |
297 | #endif | |
298 | #ifndef MY_check_dynamic_reloc | |
299 | #define MY_check_dynamic_reloc 0 | |
300 | #endif | |
301 | #ifndef MY_finish_dynamic_link | |
302 | #define MY_finish_dynamic_link 0 | |
303 | #endif | |
304 | ||
116c20d2 NC |
305 | static const struct aout_backend_data MY (backend_data) = |
306 | { | |
252b5132 RH |
307 | MY_zmagic_contiguous, |
308 | MY_text_includes_header, | |
309 | MY_entry_is_text_address, | |
310 | MY_exec_hdr_flags, | |
116c20d2 | 311 | 0, /* Text vma? */ |
252b5132 RH |
312 | MY_set_sizes, |
313 | MY_exec_header_not_counted, | |
314 | MY_add_dynamic_symbols, | |
315 | MY_add_one_symbol, | |
316 | MY_link_dynamic_object, | |
317 | MY_write_dynamic_symbol, | |
318 | MY_check_dynamic_reloc, | |
319 | MY_finish_dynamic_link | |
320 | }; | |
116c20d2 | 321 | #define MY_backend_data &MY (backend_data) |
252b5132 RH |
322 | #endif |
323 | ||
324 | #ifndef MY_final_link_callback | |
325 | ||
326 | /* Callback for the final_link routine to set the section offsets. */ | |
327 | ||
252b5132 | 328 | static void |
116c20d2 NC |
329 | MY_final_link_callback (bfd *abfd, |
330 | file_ptr *ptreloff, | |
331 | file_ptr *pdreloff, | |
332 | file_ptr *psymoff) | |
252b5132 RH |
333 | { |
334 | struct internal_exec *execp = exec_hdr (abfd); | |
335 | ||
bbb1afc8 AM |
336 | *ptreloff = N_TRELOFF (execp); |
337 | *pdreloff = N_DRELOFF (execp); | |
338 | *psymoff = N_SYMOFF (execp); | |
252b5132 RH |
339 | } |
340 | ||
341 | #endif | |
342 | ||
343 | #ifndef MY_bfd_final_link | |
344 | ||
345 | /* Final link routine. We need to use a call back to get the correct | |
346 | offsets in the output file. */ | |
347 | ||
0a1b45a2 | 348 | static bool |
116c20d2 | 349 | MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info) |
252b5132 | 350 | { |
116c20d2 | 351 | return NAME (aout, final_link) (abfd, info, MY_final_link_callback); |
252b5132 RH |
352 | } |
353 | ||
354 | #endif | |
355 | ||
356 | /* We assume BFD generic archive files. */ | |
357 | #ifndef MY_openr_next_archived_file | |
358 | #define MY_openr_next_archived_file bfd_generic_openr_next_archived_file | |
359 | #endif | |
360 | #ifndef MY_get_elt_at_index | |
361 | #define MY_get_elt_at_index _bfd_generic_get_elt_at_index | |
362 | #endif | |
363 | #ifndef MY_generic_stat_arch_elt | |
364 | #define MY_generic_stat_arch_elt bfd_generic_stat_arch_elt | |
365 | #endif | |
366 | #ifndef MY_slurp_armap | |
367 | #define MY_slurp_armap bfd_slurp_bsd_armap | |
368 | #endif | |
369 | #ifndef MY_slurp_extended_name_table | |
370 | #define MY_slurp_extended_name_table _bfd_slurp_extended_name_table | |
371 | #endif | |
372 | #ifndef MY_construct_extended_name_table | |
373 | #define MY_construct_extended_name_table \ | |
374 | _bfd_archive_bsd_construct_extended_name_table | |
375 | #endif | |
376 | #ifndef MY_write_armap | |
7ec22e0f | 377 | #define MY_write_armap _bfd_bsd_write_armap |
252b5132 RH |
378 | #endif |
379 | #ifndef MY_read_ar_hdr | |
380 | #define MY_read_ar_hdr _bfd_generic_read_ar_hdr | |
381 | #endif | |
8f95b6e4 TG |
382 | #ifndef MY_write_ar_hdr |
383 | #define MY_write_ar_hdr _bfd_generic_write_ar_hdr | |
384 | #endif | |
252b5132 RH |
385 | #ifndef MY_truncate_arname |
386 | #define MY_truncate_arname bfd_bsd_truncate_arname | |
387 | #endif | |
388 | #ifndef MY_update_armap_timestamp | |
389 | #define MY_update_armap_timestamp _bfd_archive_bsd_update_armap_timestamp | |
390 | #endif | |
391 | ||
392 | /* No core file defined here -- configure in trad-core.c separately. */ | |
393 | #ifndef MY_core_file_failing_command | |
394 | #define MY_core_file_failing_command _bfd_nocore_core_file_failing_command | |
395 | #endif | |
396 | #ifndef MY_core_file_failing_signal | |
397 | #define MY_core_file_failing_signal _bfd_nocore_core_file_failing_signal | |
398 | #endif | |
399 | #ifndef MY_core_file_matches_executable_p | |
400 | #define MY_core_file_matches_executable_p \ | |
401 | _bfd_nocore_core_file_matches_executable_p | |
402 | #endif | |
261b8d08 PA |
403 | #ifndef MY_core_file_pid |
404 | #define MY_core_file_pid _bfd_nocore_core_file_pid | |
405 | #endif | |
252b5132 RH |
406 | #ifndef MY_core_file_p |
407 | #define MY_core_file_p _bfd_dummy_target | |
408 | #endif | |
409 | ||
410 | #ifndef MY_bfd_debug_info_start | |
d00dd7dc | 411 | #define MY_bfd_debug_info_start _bfd_void_bfd |
252b5132 RH |
412 | #endif |
413 | #ifndef MY_bfd_debug_info_end | |
d00dd7dc | 414 | #define MY_bfd_debug_info_end _bfd_void_bfd |
252b5132 RH |
415 | #endif |
416 | #ifndef MY_bfd_debug_info_accumulate | |
d00dd7dc | 417 | #define MY_bfd_debug_info_accumulate _bfd_void_bfd_asection |
252b5132 RH |
418 | #endif |
419 | ||
420 | #ifndef MY_core_file_failing_command | |
116c20d2 | 421 | #define MY_core_file_failing_command NAME (aout, core_file_failing_command) |
252b5132 RH |
422 | #endif |
423 | #ifndef MY_core_file_failing_signal | |
116c20d2 | 424 | #define MY_core_file_failing_signal NAME (aout, core_file_failing_signal) |
252b5132 RH |
425 | #endif |
426 | #ifndef MY_core_file_matches_executable_p | |
116c20d2 | 427 | #define MY_core_file_matches_executable_p NAME (aout, core_file_matches_executable_p) |
252b5132 RH |
428 | #endif |
429 | #ifndef MY_set_section_contents | |
116c20d2 | 430 | #define MY_set_section_contents NAME (aout, set_section_contents) |
252b5132 RH |
431 | #endif |
432 | #ifndef MY_get_section_contents | |
116c20d2 | 433 | #define MY_get_section_contents NAME (aout, get_section_contents) |
252b5132 RH |
434 | #endif |
435 | #ifndef MY_get_section_contents_in_window | |
436 | #define MY_get_section_contents_in_window _bfd_generic_get_section_contents_in_window | |
437 | #endif | |
438 | #ifndef MY_new_section_hook | |
116c20d2 | 439 | #define MY_new_section_hook NAME (aout, new_section_hook) |
252b5132 RH |
440 | #endif |
441 | #ifndef MY_get_symtab_upper_bound | |
116c20d2 | 442 | #define MY_get_symtab_upper_bound NAME (aout, get_symtab_upper_bound) |
252b5132 | 443 | #endif |
6cee3f79 | 444 | #ifndef MY_canonicalize_symtab |
116c20d2 | 445 | #define MY_canonicalize_symtab NAME (aout, canonicalize_symtab) |
252b5132 RH |
446 | #endif |
447 | #ifndef MY_get_reloc_upper_bound | |
116c20d2 | 448 | #define MY_get_reloc_upper_bound NAME (aout,get_reloc_upper_bound) |
252b5132 RH |
449 | #endif |
450 | #ifndef MY_canonicalize_reloc | |
116c20d2 | 451 | #define MY_canonicalize_reloc NAME (aout, canonicalize_reloc) |
252b5132 | 452 | #endif |
23186865 JM |
453 | #ifndef MY_set_reloc |
454 | #define MY_set_reloc _bfd_generic_set_reloc | |
455 | #endif | |
252b5132 | 456 | #ifndef MY_make_empty_symbol |
116c20d2 | 457 | #define MY_make_empty_symbol NAME (aout, make_empty_symbol) |
252b5132 RH |
458 | #endif |
459 | #ifndef MY_print_symbol | |
116c20d2 | 460 | #define MY_print_symbol NAME (aout, print_symbol) |
252b5132 RH |
461 | #endif |
462 | #ifndef MY_get_symbol_info | |
116c20d2 | 463 | #define MY_get_symbol_info NAME (aout, get_symbol_info) |
252b5132 | 464 | #endif |
60bb06bc L |
465 | #ifndef MY_get_symbol_version_string |
466 | #define MY_get_symbol_version_string \ | |
467 | _bfd_nosymbols_get_symbol_version_string | |
468 | #endif | |
252b5132 | 469 | #ifndef MY_get_lineno |
116c20d2 | 470 | #define MY_get_lineno NAME (aout, get_lineno) |
252b5132 RH |
471 | #endif |
472 | #ifndef MY_set_arch_mach | |
116c20d2 | 473 | #define MY_set_arch_mach NAME (aout, set_arch_mach) |
252b5132 RH |
474 | #endif |
475 | #ifndef MY_find_nearest_line | |
116c20d2 | 476 | #define MY_find_nearest_line NAME (aout, find_nearest_line) |
252b5132 | 477 | #endif |
9c461f7d AM |
478 | #ifndef MY_find_line |
479 | #define MY_find_line _bfd_nosymbols_find_line | |
480 | #endif | |
4ab527b0 FF |
481 | #ifndef MY_find_inliner_info |
482 | #define MY_find_inliner_info _bfd_nosymbols_find_inliner_info | |
483 | #endif | |
252b5132 | 484 | #ifndef MY_sizeof_headers |
116c20d2 | 485 | #define MY_sizeof_headers NAME (aout, sizeof_headers) |
252b5132 RH |
486 | #endif |
487 | #ifndef MY_bfd_get_relocated_section_contents | |
488 | #define MY_bfd_get_relocated_section_contents \ | |
489 | bfd_generic_get_relocated_section_contents | |
490 | #endif | |
491 | #ifndef MY_bfd_relax_section | |
492 | #define MY_bfd_relax_section bfd_generic_relax_section | |
493 | #endif | |
494 | #ifndef MY_bfd_gc_sections | |
495 | #define MY_bfd_gc_sections bfd_generic_gc_sections | |
496 | #endif | |
ae17ab41 CM |
497 | #ifndef MY_bfd_lookup_section_flags |
498 | #define MY_bfd_lookup_section_flags bfd_generic_lookup_section_flags | |
499 | #endif | |
8550eb6e JJ |
500 | #ifndef MY_bfd_merge_sections |
501 | #define MY_bfd_merge_sections bfd_generic_merge_sections | |
502 | #endif | |
72adc230 AM |
503 | #ifndef MY_bfd_is_group_section |
504 | #define MY_bfd_is_group_section bfd_generic_is_group_section | |
505 | #endif | |
cb7f4b29 AM |
506 | #ifndef MY_bfd_group_name |
507 | #define MY_bfd_group_name bfd_generic_group_name | |
508 | #endif | |
e61463e1 AM |
509 | #ifndef MY_bfd_discard_group |
510 | #define MY_bfd_discard_group bfd_generic_discard_group | |
511 | #endif | |
082b7297 L |
512 | #ifndef MY_section_already_linked |
513 | #define MY_section_already_linked \ | |
514 | _bfd_generic_section_already_linked | |
515 | #endif | |
3023e3f6 RS |
516 | #ifndef MY_bfd_define_common_symbol |
517 | #define MY_bfd_define_common_symbol bfd_generic_define_common_symbol | |
518 | #endif | |
34a87bb0 L |
519 | #ifndef MY_bfd_link_hide_symbol |
520 | #define MY_bfd_link_hide_symbol _bfd_generic_link_hide_symbol | |
521 | #endif | |
7dba9362 AM |
522 | #ifndef MY_bfd_define_start_stop |
523 | #define MY_bfd_define_start_stop bfd_generic_define_start_stop | |
524 | #endif | |
252b5132 | 525 | #ifndef MY_bfd_reloc_type_lookup |
116c20d2 | 526 | #define MY_bfd_reloc_type_lookup NAME (aout, reloc_type_lookup) |
252b5132 | 527 | #endif |
157090f7 AM |
528 | #ifndef MY_bfd_reloc_name_lookup |
529 | #define MY_bfd_reloc_name_lookup NAME (aout, reloc_name_lookup) | |
530 | #endif | |
252b5132 RH |
531 | #ifndef MY_bfd_make_debug_symbol |
532 | #define MY_bfd_make_debug_symbol 0 | |
533 | #endif | |
534 | #ifndef MY_read_minisymbols | |
116c20d2 | 535 | #define MY_read_minisymbols NAME (aout, read_minisymbols) |
252b5132 RH |
536 | #endif |
537 | #ifndef MY_minisymbol_to_symbol | |
116c20d2 | 538 | #define MY_minisymbol_to_symbol NAME (aout, minisymbol_to_symbol) |
252b5132 RH |
539 | #endif |
540 | #ifndef MY_bfd_link_hash_table_create | |
116c20d2 | 541 | #define MY_bfd_link_hash_table_create NAME (aout, link_hash_table_create) |
252b5132 RH |
542 | #endif |
543 | #ifndef MY_bfd_link_add_symbols | |
116c20d2 | 544 | #define MY_bfd_link_add_symbols NAME (aout, link_add_symbols) |
252b5132 | 545 | #endif |
2d653fc7 AM |
546 | #ifndef MY_bfd_link_just_syms |
547 | #define MY_bfd_link_just_syms _bfd_generic_link_just_syms | |
548 | #endif | |
1338dd10 PB |
549 | #ifndef MY_bfd_copy_link_hash_symbol_type |
550 | #define MY_bfd_copy_link_hash_symbol_type \ | |
551 | _bfd_generic_copy_link_hash_symbol_type | |
552 | #endif | |
252b5132 RH |
553 | #ifndef MY_bfd_link_split_section |
554 | #define MY_bfd_link_split_section _bfd_generic_link_split_section | |
555 | #endif | |
556 | ||
4f3b23b3 NC |
557 | #ifndef MY_bfd_link_check_relocs |
558 | #define MY_bfd_link_check_relocs _bfd_generic_link_check_relocs | |
559 | #endif | |
560 | ||
252b5132 RH |
561 | #ifndef MY_bfd_copy_private_bfd_data |
562 | #define MY_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data | |
563 | #endif | |
564 | ||
565 | #ifndef MY_bfd_merge_private_bfd_data | |
566 | #define MY_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data | |
567 | #endif | |
568 | ||
569 | #ifndef MY_bfd_copy_private_symbol_data | |
570 | #define MY_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data | |
571 | #endif | |
572 | ||
80fccad2 BW |
573 | #ifndef MY_bfd_copy_private_header_data |
574 | #define MY_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data | |
575 | #endif | |
576 | ||
252b5132 RH |
577 | #ifndef MY_bfd_print_private_bfd_data |
578 | #define MY_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data | |
579 | #endif | |
580 | ||
581 | #ifndef MY_bfd_set_private_flags | |
582 | #define MY_bfd_set_private_flags _bfd_generic_bfd_set_private_flags | |
583 | #endif | |
584 | ||
585 | #ifndef MY_bfd_is_local_label_name | |
586 | #define MY_bfd_is_local_label_name bfd_generic_is_local_label_name | |
587 | #endif | |
588 | ||
3c9458e9 | 589 | #ifndef MY_bfd_is_target_special_symbol |
d00dd7dc | 590 | #define MY_bfd_is_target_special_symbol _bfd_bool_bfd_asymbol_false |
3c9458e9 NC |
591 | #endif |
592 | ||
252b5132 | 593 | #ifndef MY_bfd_free_cached_info |
116c20d2 | 594 | #define MY_bfd_free_cached_info NAME (aout, bfd_free_cached_info) |
252b5132 RH |
595 | #endif |
596 | ||
597 | #ifndef MY_close_and_cleanup | |
75344f2a HPN |
598 | |
599 | /* Handle closing of a BFD including the resource-releasing parts. */ | |
600 | ||
0a1b45a2 | 601 | static bool |
75344f2a HPN |
602 | MY_close_and_cleanup (bfd *abfd) |
603 | { | |
604 | if (!MY_bfd_free_cached_info (abfd)) | |
0a1b45a2 | 605 | return false; |
75344f2a HPN |
606 | |
607 | return _bfd_generic_close_and_cleanup (abfd); | |
608 | } | |
609 | ||
252b5132 RH |
610 | #endif |
611 | ||
612 | #ifndef MY_get_dynamic_symtab_upper_bound | |
613 | #define MY_get_dynamic_symtab_upper_bound \ | |
614 | _bfd_nodynamic_get_dynamic_symtab_upper_bound | |
615 | #endif | |
616 | #ifndef MY_canonicalize_dynamic_symtab | |
617 | #define MY_canonicalize_dynamic_symtab \ | |
618 | _bfd_nodynamic_canonicalize_dynamic_symtab | |
619 | #endif | |
4c45e5c9 JJ |
620 | #ifndef MY_get_synthetic_symtab |
621 | #define MY_get_synthetic_symtab \ | |
622 | _bfd_nodynamic_get_synthetic_symtab | |
623 | #endif | |
252b5132 RH |
624 | #ifndef MY_get_dynamic_reloc_upper_bound |
625 | #define MY_get_dynamic_reloc_upper_bound \ | |
626 | _bfd_nodynamic_get_dynamic_reloc_upper_bound | |
627 | #endif | |
628 | #ifndef MY_canonicalize_dynamic_reloc | |
629 | #define MY_canonicalize_dynamic_reloc \ | |
630 | _bfd_nodynamic_canonicalize_dynamic_reloc | |
631 | #endif | |
632 | ||
116c20d2 | 633 | /* Aout symbols normally have leading underscores. */ |
c4dfa77f | 634 | #ifndef MY_symbol_leading_char |
252b5132 RH |
635 | #define MY_symbol_leading_char '_' |
636 | #endif | |
637 | ||
116c20d2 | 638 | /* Aout archives normally use spaces for padding. */ |
252b5132 RH |
639 | #ifndef AR_PAD_CHAR |
640 | #define AR_PAD_CHAR ' ' | |
641 | #endif | |
642 | ||
643 | #ifndef MY_BFD_TARGET | |
116c20d2 | 644 | const bfd_target MY (vec) = |
252b5132 | 645 | { |
116c20d2 | 646 | TARGETNAME, /* Name. */ |
252b5132 RH |
647 | bfd_target_aout_flavour, |
648 | #ifdef TARGET_IS_BIG_ENDIAN_P | |
116c20d2 NC |
649 | BFD_ENDIAN_BIG, /* Target byte order (big). */ |
650 | BFD_ENDIAN_BIG, /* Target headers byte order (big). */ | |
252b5132 | 651 | #else |
116c20d2 NC |
652 | BFD_ENDIAN_LITTLE, /* Target byte order (little). */ |
653 | BFD_ENDIAN_LITTLE, /* Target headers byte order (little). */ | |
252b5132 | 654 | #endif |
116c20d2 | 655 | (HAS_RELOC | EXEC_P | /* Object flags. */ |
252b5132 RH |
656 | HAS_LINENO | HAS_DEBUG | |
657 | HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED), | |
658 | (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA), | |
659 | MY_symbol_leading_char, | |
116c20d2 NC |
660 | AR_PAD_CHAR, /* AR_pad_char. */ |
661 | 15, /* AR_max_namelen. */ | |
0aabe54e | 662 | 0, /* match priority. */ |
d1bcae83 | 663 | TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols. */ |
252b5132 RH |
664 | #ifdef TARGET_IS_BIG_ENDIAN_P |
665 | bfd_getb64, bfd_getb_signed_64, bfd_putb64, | |
666 | bfd_getb32, bfd_getb_signed_32, bfd_putb32, | |
116c20d2 | 667 | bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data. */ |
252b5132 RH |
668 | bfd_getb64, bfd_getb_signed_64, bfd_putb64, |
669 | bfd_getb32, bfd_getb_signed_32, bfd_putb32, | |
116c20d2 | 670 | bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Headers. */ |
252b5132 RH |
671 | #else |
672 | bfd_getl64, bfd_getl_signed_64, bfd_putl64, | |
673 | bfd_getl32, bfd_getl_signed_32, bfd_putl32, | |
116c20d2 | 674 | bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Data. */ |
252b5132 RH |
675 | bfd_getl64, bfd_getl_signed_64, bfd_putl64, |
676 | bfd_getl32, bfd_getl_signed_32, bfd_putl32, | |
116c20d2 | 677 | bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Headers. */ |
252b5132 | 678 | #endif |
d00dd7dc AM |
679 | { /* bfd_check_format. */ |
680 | _bfd_dummy_target, | |
681 | MY_object_p, | |
682 | bfd_generic_archive_p, | |
683 | MY_core_file_p | |
684 | }, | |
685 | { /* bfd_set_format. */ | |
686 | _bfd_bool_bfd_false_error, | |
687 | MY_mkobject, | |
688 | _bfd_generic_mkarchive, | |
689 | _bfd_bool_bfd_false_error | |
690 | }, | |
691 | { /* bfd_write_contents. */ | |
692 | _bfd_bool_bfd_false_error, | |
693 | MY_write_object_contents, | |
694 | _bfd_write_archive_contents, | |
695 | _bfd_bool_bfd_false_error | |
696 | }, | |
252b5132 RH |
697 | |
698 | BFD_JUMP_TABLE_GENERIC (MY), | |
699 | BFD_JUMP_TABLE_COPY (MY), | |
700 | BFD_JUMP_TABLE_CORE (MY), | |
701 | BFD_JUMP_TABLE_ARCHIVE (MY), | |
702 | BFD_JUMP_TABLE_SYMBOLS (MY), | |
703 | BFD_JUMP_TABLE_RELOCS (MY), | |
704 | BFD_JUMP_TABLE_WRITE (MY), | |
705 | BFD_JUMP_TABLE_LINK (MY), | |
706 | BFD_JUMP_TABLE_DYNAMIC (MY), | |
707 | ||
116c20d2 | 708 | /* Alternative_target. */ |
c3c89269 | 709 | NULL, |
c4dfa77f | 710 | |
116c20d2 | 711 | MY_backend_data |
252b5132 RH |
712 | }; |
713 | #endif /* MY_BFD_TARGET */ |