133965Sjdp/* Define a target vector and some small routines for a variant of a.out. 278828Sobrien Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 3218822Sdim 2000, 2001, 2002, 2003, 2004, 2005, 2007 433965Sjdp Free Software Foundation, Inc. 533965Sjdp 6218822Sdim This file is part of BFD, the Binary File Descriptor library. 733965Sjdp 8218822Sdim This program is free software; you can redistribute it and/or modify 9218822Sdim it under the terms of the GNU General Public License as published by 10218822Sdim the Free Software Foundation; either version 2 of the License, or 11218822Sdim (at your option) any later version. 1233965Sjdp 13218822Sdim This program is distributed in the hope that it will be useful, 14218822Sdim but WITHOUT ANY WARRANTY; without even the implied warranty of 15218822Sdim MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16218822Sdim GNU General Public License for more details. 1733965Sjdp 18218822Sdim You should have received a copy of the GNU General Public License 19218822Sdim along with this program; if not, write to the Free Software 20218822Sdim Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 2133965Sjdp 2233965Sjdp#include "aout/aout64.h" 2333965Sjdp#include "aout/stab_gnu.h" 2433965Sjdp#include "aout/ar.h" 2533965Sjdp/*#include "libaout.h"*/ 2633965Sjdp 2733965Sjdp#ifndef SEGMENT_SIZE 2833965Sjdp#define SEGMENT_SIZE TARGET_PAGE_SIZE 2933965Sjdp#endif 3033965Sjdp 31218822Sdimextern reloc_howto_type * NAME (aout, reloc_type_lookup) (bfd *, bfd_reloc_code_real_type); 32218822Sdimextern reloc_howto_type * NAME (aout, reloc_name_lookup) (bfd *, const char *); 3333965Sjdp 3433965Sjdp/* Set parameters about this a.out file that are machine-dependent. 3533965Sjdp This routine is called from some_aout_object_p just before it returns. */ 3633965Sjdp#ifndef MY_callback 3733965Sjdp 3833965Sjdpstatic const bfd_target * 39218822SdimMY (callback) (bfd *abfd) 4033965Sjdp{ 4133965Sjdp struct internal_exec *execp = exec_hdr (abfd); 4233965Sjdp unsigned int arch_align_power; 4333965Sjdp unsigned long arch_align; 4433965Sjdp 45218822Sdim /* Calculate the file positions of the parts of a newly read aout header. */ 46218822Sdim obj_textsec (abfd)->size = N_TXTSIZE (*execp); 4733965Sjdp 48218822Sdim /* The virtual memory addresses of the sections. */ 49218822Sdim obj_textsec (abfd)->vma = N_TXTADDR (*execp); 50218822Sdim obj_datasec (abfd)->vma = N_DATADDR (*execp); 51218822Sdim obj_bsssec (abfd)->vma = N_BSSADDR (*execp); 5233965Sjdp 5333965Sjdp /* For some targets, if the entry point is not in the same page 5433965Sjdp as the start of the text, then adjust the VMA so that it is. 5533965Sjdp FIXME: Do this with a macro like SET_ARCH_MACH instead? */ 5633965Sjdp if (aout_backend_info (abfd)->entry_is_text_address 5733965Sjdp && execp->a_entry > obj_textsec (abfd)->vma) 5833965Sjdp { 5933965Sjdp bfd_vma adjust; 6033965Sjdp 6133965Sjdp adjust = execp->a_entry - obj_textsec (abfd)->vma; 6277298Sobrien /* Adjust only by whole pages. */ 6333965Sjdp adjust &= ~(TARGET_PAGE_SIZE - 1); 6433965Sjdp obj_textsec (abfd)->vma += adjust; 6533965Sjdp obj_datasec (abfd)->vma += adjust; 6633965Sjdp obj_bsssec (abfd)->vma += adjust; 6733965Sjdp } 6833965Sjdp 6933965Sjdp /* Set the load addresses to be the same as the virtual addresses. */ 7033965Sjdp obj_textsec (abfd)->lma = obj_textsec (abfd)->vma; 7133965Sjdp obj_datasec (abfd)->lma = obj_datasec (abfd)->vma; 7233965Sjdp obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma; 7333965Sjdp 74218822Sdim /* The file offsets of the sections. */ 7533965Sjdp obj_textsec (abfd)->filepos = N_TXTOFF (*execp); 7633965Sjdp obj_datasec (abfd)->filepos = N_DATOFF (*execp); 7733965Sjdp 78218822Sdim /* The file offsets of the relocation info. */ 79218822Sdim obj_textsec (abfd)->rel_filepos = N_TRELOFF (*execp); 80218822Sdim obj_datasec (abfd)->rel_filepos = N_DRELOFF (*execp); 8133965Sjdp 8233965Sjdp /* The file offsets of the string table and symbol table. */ 8333965Sjdp obj_sym_filepos (abfd) = N_SYMOFF (*execp); 8433965Sjdp obj_str_filepos (abfd) = N_STROFF (*execp); 8577298Sobrien 8633965Sjdp /* Determine the architecture and machine type of the object file. */ 8733965Sjdp#ifdef SET_ARCH_MACH 8889857Sobrien SET_ARCH_MACH (abfd, *execp); 8933965Sjdp#else 9089857Sobrien bfd_default_set_arch_mach (abfd, DEFAULT_ARCH, 0); 9133965Sjdp#endif 9233965Sjdp 9333965Sjdp /* The number of relocation records. This must be called after 9433965Sjdp SET_ARCH_MACH. It assumes that SET_ARCH_MACH will set 9533965Sjdp obj_reloc_entry_size correctly, if the reloc size is not 9633965Sjdp RELOC_STD_SIZE. */ 9733965Sjdp obj_textsec (abfd)->reloc_count = 9833965Sjdp execp->a_trsize / obj_reloc_entry_size (abfd); 9933965Sjdp obj_datasec (abfd)->reloc_count = 10033965Sjdp execp->a_drsize / obj_reloc_entry_size (abfd); 10133965Sjdp 10233965Sjdp /* Now that we know the architecture, set the alignments of the 103218822Sdim sections. This is normally done by NAME (aout,new_section_hook), 10433965Sjdp but when the initial sections were created the architecture had 10533965Sjdp not yet been set. However, for backward compatibility, we don't 10633965Sjdp set the alignment power any higher than as required by the size 10733965Sjdp of the section. */ 10833965Sjdp arch_align_power = bfd_get_arch_info (abfd)->section_align_power; 10933965Sjdp arch_align = 1 << arch_align_power; 110218822Sdim if ((BFD_ALIGN (obj_textsec (abfd)->size, arch_align) 111218822Sdim == obj_textsec (abfd)->size) 112218822Sdim && (BFD_ALIGN (obj_datasec (abfd)->size, arch_align) 113218822Sdim == obj_datasec (abfd)->size) 114218822Sdim && (BFD_ALIGN (obj_bsssec (abfd)->size, arch_align) 115218822Sdim == obj_bsssec (abfd)->size)) 11633965Sjdp { 11733965Sjdp obj_textsec (abfd)->alignment_power = arch_align_power; 11833965Sjdp obj_datasec (abfd)->alignment_power = arch_align_power; 11933965Sjdp obj_bsssec (abfd)->alignment_power = arch_align_power; 12033965Sjdp } 12133965Sjdp 12233965Sjdp /* Don't set sizes now -- can't be sure until we know arch & mach. 12333965Sjdp Sizes get set in set_sizes callback, later. */ 12433965Sjdp 12533965Sjdp return abfd->xvec; 12633965Sjdp} 12733965Sjdp#endif 12833965Sjdp 12933965Sjdp#ifndef MY_object_p 130218822Sdim/* Finish up the reading of an a.out file header. */ 13133965Sjdp 13233965Sjdpstatic const bfd_target * 133218822SdimMY (object_p) (bfd *abfd) 13433965Sjdp{ 135218822Sdim struct external_exec exec_bytes; /* Raw exec header from file. */ 136218822Sdim struct internal_exec exec; /* Cleaned-up exec header. */ 13733965Sjdp const bfd_target *target; 13889857Sobrien bfd_size_type amt = EXEC_BYTES_SIZE; 13933965Sjdp 140218822Sdim if (bfd_bread ((void *) &exec_bytes, amt, abfd) != amt) 14189857Sobrien { 14289857Sobrien if (bfd_get_error () != bfd_error_system_call) 14389857Sobrien bfd_set_error (bfd_error_wrong_format); 14489857Sobrien return 0; 14589857Sobrien } 14633965Sjdp 14733965Sjdp#ifdef SWAP_MAGIC 14833965Sjdp exec.a_info = SWAP_MAGIC (exec_bytes.e_info); 14933965Sjdp#else 15089857Sobrien exec.a_info = GET_MAGIC (abfd, exec_bytes.e_info); 151218822Sdim#endif 15233965Sjdp 153218822Sdim if (N_BADMAG (exec)) 154218822Sdim return 0; 155218822Sdim 15633965Sjdp#ifdef MACHTYPE_OK 157218822Sdim if (!(MACHTYPE_OK (N_MACHTYPE (exec)))) 158218822Sdim return 0; 15933965Sjdp#endif 16033965Sjdp 161218822Sdim NAME (aout, swap_exec_header_in) (abfd, &exec_bytes, &exec); 16233965Sjdp 16333965Sjdp#ifdef SWAP_MAGIC 164218822Sdim /* Swap_exec_header_in read in a_info with the wrong byte order. */ 16533965Sjdp exec.a_info = SWAP_MAGIC (exec_bytes.e_info); 166218822Sdim#endif 16733965Sjdp 168218822Sdim target = NAME (aout, some_aout_object_p) (abfd, &exec, MY (callback)); 16933965Sjdp 17033965Sjdp#ifdef ENTRY_CAN_BE_ZERO 17133965Sjdp /* The NEWSOS3 entry-point is/was 0, which (amongst other lossage) 172218822Sdim means that it isn't obvious if EXEC_P should be set. 173218822Sdim All of the following must be true for an executable: 174218822Sdim There must be no relocations, the bfd can be neither an 175218822Sdim archive nor an archive element, and the file must be executable. */ 17633965Sjdp 17733965Sjdp if (exec.a_trsize + exec.a_drsize == 0 17833965Sjdp && bfd_get_format(abfd) == bfd_object && abfd->my_archive == NULL) 17933965Sjdp { 18033965Sjdp struct stat buf; 18133965Sjdp#ifndef S_IXUSR 18233965Sjdp#define S_IXUSR 0100 /* Execute by owner. */ 18333965Sjdp#endif 18433965Sjdp if (stat(abfd->filename, &buf) == 0 && (buf.st_mode & S_IXUSR)) 18533965Sjdp abfd->flags |= EXEC_P; 18633965Sjdp } 18733965Sjdp#endif /* ENTRY_CAN_BE_ZERO */ 18833965Sjdp 18933965Sjdp return target; 19033965Sjdp} 191218822Sdim#define MY_object_p MY (object_p) 19233965Sjdp#endif 19333965Sjdp 19433965Sjdp#ifndef MY_mkobject 19533965Sjdp 196130561Sobrienstatic bfd_boolean 197218822SdimMY (mkobject) (bfd *abfd) 19833965Sjdp{ 199218822Sdim return NAME (aout, mkobject (abfd)); 20033965Sjdp} 201218822Sdim 202218822Sdim#define MY_mkobject MY (mkobject) 20333965Sjdp#endif 20433965Sjdp 20533965Sjdp#ifndef MY_bfd_copy_private_section_data 20633965Sjdp 20733965Sjdp/* Copy private section data. This actually does nothing with the 20833965Sjdp sections. It copies the subformat field. We copy it here, because 20933965Sjdp we need to know whether this is a QMAGIC file before we set the 21033965Sjdp section contents, and copy_private_bfd_data is not called until 21133965Sjdp after the section contents have been set. */ 21233965Sjdp 213130561Sobrienstatic bfd_boolean 214218822SdimMY_bfd_copy_private_section_data (bfd *ibfd, 215218822Sdim asection *isec ATTRIBUTE_UNUSED, 216218822Sdim bfd *obfd, 217218822Sdim asection *osec ATTRIBUTE_UNUSED) 21833965Sjdp{ 21933965Sjdp if (bfd_get_flavour (ibfd) == bfd_target_aout_flavour 22033965Sjdp && bfd_get_flavour (obfd) == bfd_target_aout_flavour) 22133965Sjdp obj_aout_subformat (obfd) = obj_aout_subformat (ibfd); 222130561Sobrien return TRUE; 22333965Sjdp} 22433965Sjdp 22533965Sjdp#endif 22633965Sjdp 22733965Sjdp/* Write an object file. 22833965Sjdp Section contents have already been written. We write the 22933965Sjdp file header, symbols, and relocation. */ 23033965Sjdp 23133965Sjdp#ifndef MY_write_object_contents 23289857Sobrien 233130561Sobrienstatic bfd_boolean 234218822SdimMY (write_object_contents) (bfd *abfd) 23533965Sjdp{ 23633965Sjdp struct external_exec exec_bytes; 23733965Sjdp struct internal_exec *execp = exec_hdr (abfd); 23833965Sjdp 23933965Sjdp obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; 24033965Sjdp 241218822Sdim WRITE_HEADERS (abfd, execp); 24233965Sjdp 243130561Sobrien return TRUE; 24433965Sjdp} 245218822Sdim#define MY_write_object_contents MY (write_object_contents) 24633965Sjdp#endif 24733965Sjdp 24833965Sjdp#ifndef MY_set_sizes 24933965Sjdp 250130561Sobrienstatic bfd_boolean 251218822SdimMY (set_sizes) (bfd *abfd) 25233965Sjdp{ 25333965Sjdp adata(abfd).page_size = TARGET_PAGE_SIZE; 25433965Sjdp adata(abfd).segment_size = SEGMENT_SIZE; 25533965Sjdp 25633965Sjdp#ifdef ZMAGIC_DISK_BLOCK_SIZE 25733965Sjdp adata(abfd).zmagic_disk_block_size = ZMAGIC_DISK_BLOCK_SIZE; 25833965Sjdp#else 25933965Sjdp adata(abfd).zmagic_disk_block_size = TARGET_PAGE_SIZE; 26033965Sjdp#endif 26133965Sjdp 26233965Sjdp adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE; 263130561Sobrien return TRUE; 26433965Sjdp} 265218822Sdim#define MY_set_sizes MY (set_sizes) 26633965Sjdp#endif 26733965Sjdp 26833965Sjdp#ifndef MY_exec_hdr_flags 26933965Sjdp#define MY_exec_hdr_flags 0 27033965Sjdp#endif 27133965Sjdp 27233965Sjdp#ifndef MY_backend_data 27333965Sjdp 27433965Sjdp#ifndef MY_zmagic_contiguous 27533965Sjdp#define MY_zmagic_contiguous 0 27633965Sjdp#endif 27733965Sjdp#ifndef MY_text_includes_header 27833965Sjdp#define MY_text_includes_header 0 27933965Sjdp#endif 28033965Sjdp#ifndef MY_entry_is_text_address 28133965Sjdp#define MY_entry_is_text_address 0 28233965Sjdp#endif 28333965Sjdp#ifndef MY_exec_header_not_counted 28433965Sjdp#define MY_exec_header_not_counted 0 28533965Sjdp#endif 28633965Sjdp#ifndef MY_add_dynamic_symbols 28733965Sjdp#define MY_add_dynamic_symbols 0 28833965Sjdp#endif 28933965Sjdp#ifndef MY_add_one_symbol 29033965Sjdp#define MY_add_one_symbol 0 29133965Sjdp#endif 29233965Sjdp#ifndef MY_link_dynamic_object 29333965Sjdp#define MY_link_dynamic_object 0 29433965Sjdp#endif 29533965Sjdp#ifndef MY_write_dynamic_symbol 29633965Sjdp#define MY_write_dynamic_symbol 0 29733965Sjdp#endif 29833965Sjdp#ifndef MY_check_dynamic_reloc 29933965Sjdp#define MY_check_dynamic_reloc 0 30033965Sjdp#endif 30133965Sjdp#ifndef MY_finish_dynamic_link 30233965Sjdp#define MY_finish_dynamic_link 0 30333965Sjdp#endif 30433965Sjdp 305218822Sdimstatic const struct aout_backend_data MY (backend_data) = 306218822Sdim{ 30733965Sjdp MY_zmagic_contiguous, 30833965Sjdp MY_text_includes_header, 30933965Sjdp MY_entry_is_text_address, 31033965Sjdp MY_exec_hdr_flags, 311218822Sdim 0, /* Text vma? */ 31233965Sjdp MY_set_sizes, 31333965Sjdp MY_exec_header_not_counted, 31433965Sjdp MY_add_dynamic_symbols, 31533965Sjdp MY_add_one_symbol, 31633965Sjdp MY_link_dynamic_object, 31733965Sjdp MY_write_dynamic_symbol, 31833965Sjdp MY_check_dynamic_reloc, 31933965Sjdp MY_finish_dynamic_link 32033965Sjdp}; 321218822Sdim#define MY_backend_data &MY (backend_data) 32233965Sjdp#endif 32333965Sjdp 32433965Sjdp#ifndef MY_final_link_callback 32533965Sjdp 32633965Sjdp/* Callback for the final_link routine to set the section offsets. */ 32733965Sjdp 32833965Sjdpstatic void 329218822SdimMY_final_link_callback (bfd *abfd, 330218822Sdim file_ptr *ptreloff, 331218822Sdim file_ptr *pdreloff, 332218822Sdim file_ptr *psymoff) 33333965Sjdp{ 33433965Sjdp struct internal_exec *execp = exec_hdr (abfd); 33533965Sjdp 33633965Sjdp *ptreloff = N_TRELOFF (*execp); 33733965Sjdp *pdreloff = N_DRELOFF (*execp); 33833965Sjdp *psymoff = N_SYMOFF (*execp); 33933965Sjdp} 34033965Sjdp 34133965Sjdp#endif 34233965Sjdp 34333965Sjdp#ifndef MY_bfd_final_link 34433965Sjdp 34533965Sjdp/* Final link routine. We need to use a call back to get the correct 34633965Sjdp offsets in the output file. */ 34733965Sjdp 348130561Sobrienstatic bfd_boolean 349218822SdimMY_bfd_final_link (bfd *abfd, struct bfd_link_info *info) 35033965Sjdp{ 351218822Sdim return NAME (aout, final_link) (abfd, info, MY_final_link_callback); 35233965Sjdp} 35333965Sjdp 35433965Sjdp#endif 35533965Sjdp 35633965Sjdp/* We assume BFD generic archive files. */ 35733965Sjdp#ifndef MY_openr_next_archived_file 35833965Sjdp#define MY_openr_next_archived_file bfd_generic_openr_next_archived_file 35933965Sjdp#endif 36033965Sjdp#ifndef MY_get_elt_at_index 36133965Sjdp#define MY_get_elt_at_index _bfd_generic_get_elt_at_index 36233965Sjdp#endif 36333965Sjdp#ifndef MY_generic_stat_arch_elt 36433965Sjdp#define MY_generic_stat_arch_elt bfd_generic_stat_arch_elt 36533965Sjdp#endif 36633965Sjdp#ifndef MY_slurp_armap 36733965Sjdp#define MY_slurp_armap bfd_slurp_bsd_armap 36833965Sjdp#endif 36933965Sjdp#ifndef MY_slurp_extended_name_table 37033965Sjdp#define MY_slurp_extended_name_table _bfd_slurp_extended_name_table 37133965Sjdp#endif 37233965Sjdp#ifndef MY_construct_extended_name_table 37333965Sjdp#define MY_construct_extended_name_table \ 37433965Sjdp _bfd_archive_bsd_construct_extended_name_table 37533965Sjdp#endif 37633965Sjdp#ifndef MY_write_armap 37733965Sjdp#define MY_write_armap bsd_write_armap 37833965Sjdp#endif 37933965Sjdp#ifndef MY_read_ar_hdr 38033965Sjdp#define MY_read_ar_hdr _bfd_generic_read_ar_hdr 38133965Sjdp#endif 38233965Sjdp#ifndef MY_truncate_arname 38333965Sjdp#define MY_truncate_arname bfd_bsd_truncate_arname 38433965Sjdp#endif 38533965Sjdp#ifndef MY_update_armap_timestamp 38633965Sjdp#define MY_update_armap_timestamp _bfd_archive_bsd_update_armap_timestamp 38733965Sjdp#endif 38833965Sjdp 38933965Sjdp/* No core file defined here -- configure in trad-core.c separately. */ 39033965Sjdp#ifndef MY_core_file_failing_command 39133965Sjdp#define MY_core_file_failing_command _bfd_nocore_core_file_failing_command 39233965Sjdp#endif 39333965Sjdp#ifndef MY_core_file_failing_signal 39433965Sjdp#define MY_core_file_failing_signal _bfd_nocore_core_file_failing_signal 39533965Sjdp#endif 39633965Sjdp#ifndef MY_core_file_matches_executable_p 39733965Sjdp#define MY_core_file_matches_executable_p \ 39833965Sjdp _bfd_nocore_core_file_matches_executable_p 39933965Sjdp#endif 40033965Sjdp#ifndef MY_core_file_p 40133965Sjdp#define MY_core_file_p _bfd_dummy_target 40233965Sjdp#endif 40333965Sjdp 40433965Sjdp#ifndef MY_bfd_debug_info_start 40533965Sjdp#define MY_bfd_debug_info_start bfd_void 40633965Sjdp#endif 40733965Sjdp#ifndef MY_bfd_debug_info_end 40833965Sjdp#define MY_bfd_debug_info_end bfd_void 40933965Sjdp#endif 41033965Sjdp#ifndef MY_bfd_debug_info_accumulate 41133965Sjdp#define MY_bfd_debug_info_accumulate \ 412218822Sdim (void (*) (bfd *, struct bfd_section *)) bfd_void 41333965Sjdp#endif 41433965Sjdp 41533965Sjdp#ifndef MY_core_file_failing_command 416218822Sdim#define MY_core_file_failing_command NAME (aout, core_file_failing_command) 41733965Sjdp#endif 41833965Sjdp#ifndef MY_core_file_failing_signal 419218822Sdim#define MY_core_file_failing_signal NAME (aout, core_file_failing_signal) 42033965Sjdp#endif 42133965Sjdp#ifndef MY_core_file_matches_executable_p 422218822Sdim#define MY_core_file_matches_executable_p NAME (aout, core_file_matches_executable_p) 42333965Sjdp#endif 42433965Sjdp#ifndef MY_set_section_contents 425218822Sdim#define MY_set_section_contents NAME (aout, set_section_contents) 42633965Sjdp#endif 42733965Sjdp#ifndef MY_get_section_contents 428218822Sdim#define MY_get_section_contents NAME (aout, get_section_contents) 42933965Sjdp#endif 43033965Sjdp#ifndef MY_get_section_contents_in_window 43133965Sjdp#define MY_get_section_contents_in_window _bfd_generic_get_section_contents_in_window 43233965Sjdp#endif 43333965Sjdp#ifndef MY_new_section_hook 434218822Sdim#define MY_new_section_hook NAME (aout, new_section_hook) 43533965Sjdp#endif 43633965Sjdp#ifndef MY_get_symtab_upper_bound 437218822Sdim#define MY_get_symtab_upper_bound NAME (aout, get_symtab_upper_bound) 43833965Sjdp#endif 439130561Sobrien#ifndef MY_canonicalize_symtab 440218822Sdim#define MY_canonicalize_symtab NAME (aout, canonicalize_symtab) 44133965Sjdp#endif 44233965Sjdp#ifndef MY_get_reloc_upper_bound 443218822Sdim#define MY_get_reloc_upper_bound NAME (aout,get_reloc_upper_bound) 44433965Sjdp#endif 44533965Sjdp#ifndef MY_canonicalize_reloc 446218822Sdim#define MY_canonicalize_reloc NAME (aout, canonicalize_reloc) 44733965Sjdp#endif 44833965Sjdp#ifndef MY_make_empty_symbol 449218822Sdim#define MY_make_empty_symbol NAME (aout, make_empty_symbol) 45033965Sjdp#endif 45133965Sjdp#ifndef MY_print_symbol 452218822Sdim#define MY_print_symbol NAME (aout, print_symbol) 45333965Sjdp#endif 45433965Sjdp#ifndef MY_get_symbol_info 455218822Sdim#define MY_get_symbol_info NAME (aout, get_symbol_info) 45633965Sjdp#endif 45733965Sjdp#ifndef MY_get_lineno 458218822Sdim#define MY_get_lineno NAME (aout, get_lineno) 45933965Sjdp#endif 46033965Sjdp#ifndef MY_set_arch_mach 461218822Sdim#define MY_set_arch_mach NAME (aout, set_arch_mach) 46233965Sjdp#endif 46333965Sjdp#ifndef MY_find_nearest_line 464218822Sdim#define MY_find_nearest_line NAME (aout, find_nearest_line) 46533965Sjdp#endif 466218822Sdim#ifndef MY_find_inliner_info 467218822Sdim#define MY_find_inliner_info _bfd_nosymbols_find_inliner_info 468218822Sdim#endif 46933965Sjdp#ifndef MY_sizeof_headers 470218822Sdim#define MY_sizeof_headers NAME (aout, sizeof_headers) 47133965Sjdp#endif 47233965Sjdp#ifndef MY_bfd_get_relocated_section_contents 47333965Sjdp#define MY_bfd_get_relocated_section_contents \ 47433965Sjdp bfd_generic_get_relocated_section_contents 47533965Sjdp#endif 47633965Sjdp#ifndef MY_bfd_relax_section 47733965Sjdp#define MY_bfd_relax_section bfd_generic_relax_section 47833965Sjdp#endif 47960484Sobrien#ifndef MY_bfd_gc_sections 48060484Sobrien#define MY_bfd_gc_sections bfd_generic_gc_sections 48160484Sobrien#endif 48289857Sobrien#ifndef MY_bfd_merge_sections 48389857Sobrien#define MY_bfd_merge_sections bfd_generic_merge_sections 48489857Sobrien#endif 485218822Sdim#ifndef MY_bfd_is_group_section 486218822Sdim#define MY_bfd_is_group_section bfd_generic_is_group_section 487218822Sdim#endif 488104834Sobrien#ifndef MY_bfd_discard_group 489104834Sobrien#define MY_bfd_discard_group bfd_generic_discard_group 490104834Sobrien#endif 491218822Sdim#ifndef MY_section_already_linked 492218822Sdim#define MY_section_already_linked \ 493218822Sdim _bfd_generic_section_already_linked 494218822Sdim#endif 49533965Sjdp#ifndef MY_bfd_reloc_type_lookup 496218822Sdim#define MY_bfd_reloc_type_lookup NAME (aout, reloc_type_lookup) 49733965Sjdp#endif 498218822Sdim#ifndef MY_bfd_reloc_name_lookup 499218822Sdim#define MY_bfd_reloc_name_lookup NAME (aout, reloc_name_lookup) 500218822Sdim#endif 50133965Sjdp#ifndef MY_bfd_make_debug_symbol 50233965Sjdp#define MY_bfd_make_debug_symbol 0 50333965Sjdp#endif 50433965Sjdp#ifndef MY_read_minisymbols 505218822Sdim#define MY_read_minisymbols NAME (aout, read_minisymbols) 50633965Sjdp#endif 50733965Sjdp#ifndef MY_minisymbol_to_symbol 508218822Sdim#define MY_minisymbol_to_symbol NAME (aout, minisymbol_to_symbol) 50933965Sjdp#endif 51033965Sjdp#ifndef MY_bfd_link_hash_table_create 511218822Sdim#define MY_bfd_link_hash_table_create NAME (aout, link_hash_table_create) 51233965Sjdp#endif 513104834Sobrien#ifndef MY_bfd_link_hash_table_free 514104834Sobrien#define MY_bfd_link_hash_table_free _bfd_generic_link_hash_table_free 515104834Sobrien#endif 51633965Sjdp#ifndef MY_bfd_link_add_symbols 517218822Sdim#define MY_bfd_link_add_symbols NAME (aout, link_add_symbols) 51833965Sjdp#endif 519104834Sobrien#ifndef MY_bfd_link_just_syms 520104834Sobrien#define MY_bfd_link_just_syms _bfd_generic_link_just_syms 521104834Sobrien#endif 52233965Sjdp#ifndef MY_bfd_link_split_section 52333965Sjdp#define MY_bfd_link_split_section _bfd_generic_link_split_section 52433965Sjdp#endif 52533965Sjdp 52633965Sjdp#ifndef MY_bfd_copy_private_bfd_data 52733965Sjdp#define MY_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data 52833965Sjdp#endif 52933965Sjdp 53033965Sjdp#ifndef MY_bfd_merge_private_bfd_data 53133965Sjdp#define MY_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data 53233965Sjdp#endif 53333965Sjdp 53433965Sjdp#ifndef MY_bfd_copy_private_symbol_data 53533965Sjdp#define MY_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data 53633965Sjdp#endif 53733965Sjdp 538218822Sdim#ifndef MY_bfd_copy_private_header_data 539218822Sdim#define MY_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data 540218822Sdim#endif 541218822Sdim 54233965Sjdp#ifndef MY_bfd_print_private_bfd_data 54333965Sjdp#define MY_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data 54433965Sjdp#endif 54533965Sjdp 54633965Sjdp#ifndef MY_bfd_set_private_flags 54733965Sjdp#define MY_bfd_set_private_flags _bfd_generic_bfd_set_private_flags 54833965Sjdp#endif 54933965Sjdp 55033965Sjdp#ifndef MY_bfd_is_local_label_name 55133965Sjdp#define MY_bfd_is_local_label_name bfd_generic_is_local_label_name 55233965Sjdp#endif 55333965Sjdp 554218822Sdim#ifndef MY_bfd_is_target_special_symbol 555218822Sdim#define MY_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) 556218822Sdim#endif 557218822Sdim 55833965Sjdp#ifndef MY_bfd_free_cached_info 559218822Sdim#define MY_bfd_free_cached_info NAME (aout, bfd_free_cached_info) 56033965Sjdp#endif 56133965Sjdp 56233965Sjdp#ifndef MY_close_and_cleanup 56333965Sjdp#define MY_close_and_cleanup MY_bfd_free_cached_info 56433965Sjdp#endif 56533965Sjdp 56633965Sjdp#ifndef MY_get_dynamic_symtab_upper_bound 56733965Sjdp#define MY_get_dynamic_symtab_upper_bound \ 56833965Sjdp _bfd_nodynamic_get_dynamic_symtab_upper_bound 56933965Sjdp#endif 57033965Sjdp#ifndef MY_canonicalize_dynamic_symtab 57133965Sjdp#define MY_canonicalize_dynamic_symtab \ 57233965Sjdp _bfd_nodynamic_canonicalize_dynamic_symtab 57333965Sjdp#endif 574218822Sdim#ifndef MY_get_synthetic_symtab 575218822Sdim#define MY_get_synthetic_symtab \ 576218822Sdim _bfd_nodynamic_get_synthetic_symtab 577218822Sdim#endif 57833965Sjdp#ifndef MY_get_dynamic_reloc_upper_bound 57933965Sjdp#define MY_get_dynamic_reloc_upper_bound \ 58033965Sjdp _bfd_nodynamic_get_dynamic_reloc_upper_bound 58133965Sjdp#endif 58233965Sjdp#ifndef MY_canonicalize_dynamic_reloc 58333965Sjdp#define MY_canonicalize_dynamic_reloc \ 58433965Sjdp _bfd_nodynamic_canonicalize_dynamic_reloc 58533965Sjdp#endif 58633965Sjdp 587218822Sdim/* Aout symbols normally have leading underscores. */ 58877298Sobrien#ifndef MY_symbol_leading_char 58933965Sjdp#define MY_symbol_leading_char '_' 59033965Sjdp#endif 59133965Sjdp 592218822Sdim/* Aout archives normally use spaces for padding. */ 59333965Sjdp#ifndef AR_PAD_CHAR 59433965Sjdp#define AR_PAD_CHAR ' ' 59533965Sjdp#endif 59633965Sjdp 59733965Sjdp#ifndef MY_BFD_TARGET 598218822Sdimconst bfd_target MY (vec) = 59933965Sjdp{ 600218822Sdim TARGETNAME, /* Name. */ 60133965Sjdp bfd_target_aout_flavour, 60233965Sjdp#ifdef TARGET_IS_BIG_ENDIAN_P 603218822Sdim BFD_ENDIAN_BIG, /* Target byte order (big). */ 604218822Sdim BFD_ENDIAN_BIG, /* Target headers byte order (big). */ 60533965Sjdp#else 606218822Sdim BFD_ENDIAN_LITTLE, /* Target byte order (little). */ 607218822Sdim BFD_ENDIAN_LITTLE, /* Target headers byte order (little). */ 60833965Sjdp#endif 609218822Sdim (HAS_RELOC | EXEC_P | /* Object flags. */ 61033965Sjdp HAS_LINENO | HAS_DEBUG | 61133965Sjdp HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED), 61238889Sjdp (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA), 61333965Sjdp MY_symbol_leading_char, 614218822Sdim AR_PAD_CHAR, /* AR_pad_char. */ 615218822Sdim 15, /* AR_max_namelen. */ 61633965Sjdp#ifdef TARGET_IS_BIG_ENDIAN_P 61733965Sjdp bfd_getb64, bfd_getb_signed_64, bfd_putb64, 61833965Sjdp bfd_getb32, bfd_getb_signed_32, bfd_putb32, 619218822Sdim bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data. */ 62033965Sjdp bfd_getb64, bfd_getb_signed_64, bfd_putb64, 62133965Sjdp bfd_getb32, bfd_getb_signed_32, bfd_putb32, 622218822Sdim bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Headers. */ 62333965Sjdp#else 62433965Sjdp bfd_getl64, bfd_getl_signed_64, bfd_putl64, 62533965Sjdp bfd_getl32, bfd_getl_signed_32, bfd_putl32, 626218822Sdim bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Data. */ 62733965Sjdp bfd_getl64, bfd_getl_signed_64, bfd_putl64, 62833965Sjdp bfd_getl32, bfd_getl_signed_32, bfd_putl32, 629218822Sdim bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Headers. */ 63033965Sjdp#endif 631218822Sdim {_bfd_dummy_target, MY_object_p, /* bfd_check_format. */ 63233965Sjdp bfd_generic_archive_p, MY_core_file_p}, 633218822Sdim {bfd_false, MY_mkobject, /* bfd_set_format. */ 63433965Sjdp _bfd_generic_mkarchive, bfd_false}, 635218822Sdim {bfd_false, MY_write_object_contents, /* bfd_write_contents. */ 63633965Sjdp _bfd_write_archive_contents, bfd_false}, 63733965Sjdp 63833965Sjdp BFD_JUMP_TABLE_GENERIC (MY), 63933965Sjdp BFD_JUMP_TABLE_COPY (MY), 64033965Sjdp BFD_JUMP_TABLE_CORE (MY), 64133965Sjdp BFD_JUMP_TABLE_ARCHIVE (MY), 64233965Sjdp BFD_JUMP_TABLE_SYMBOLS (MY), 64333965Sjdp BFD_JUMP_TABLE_RELOCS (MY), 64433965Sjdp BFD_JUMP_TABLE_WRITE (MY), 64533965Sjdp BFD_JUMP_TABLE_LINK (MY), 64633965Sjdp BFD_JUMP_TABLE_DYNAMIC (MY), 64733965Sjdp 648218822Sdim /* Alternative_target. */ 64960484Sobrien NULL, 65077298Sobrien 651218822Sdim MY_backend_data 65233965Sjdp}; 65333965Sjdp#endif /* MY_BFD_TARGET */ 654