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