1*3d8817e4Smiod /* Common definitions for backends based on IBM RS/6000 "XCOFF64" files. 2*3d8817e4Smiod Copyright 2000, 2001, 2002, 2004, 2005 3*3d8817e4Smiod Free Software Foundation, Inc. 4*3d8817e4Smiod Contributed by Cygnus Support. 5*3d8817e4Smiod 6*3d8817e4Smiod This file is part of BFD, the Binary File Descriptor library. 7*3d8817e4Smiod 8*3d8817e4Smiod This program is free software; you can redistribute it and/or modify 9*3d8817e4Smiod it under the terms of the GNU General Public License as published by 10*3d8817e4Smiod the Free Software Foundation; either version 2 of the License, or 11*3d8817e4Smiod (at your option) any later version. 12*3d8817e4Smiod 13*3d8817e4Smiod This program is distributed in the hope that it will be useful, 14*3d8817e4Smiod but WITHOUT ANY WARRANTY; without even the implied warranty of 15*3d8817e4Smiod MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16*3d8817e4Smiod GNU General Public License for more details. 17*3d8817e4Smiod 18*3d8817e4Smiod You should have received a copy of the GNU General Public License 19*3d8817e4Smiod along with this program; if not, write to the Free Software 20*3d8817e4Smiod Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 21*3d8817e4Smiod 22*3d8817e4Smiod /* Internalcoff.h and coffcode.h modify themselves based on this flag. */ 23*3d8817e4Smiod #define RS6000COFF_C 1 24*3d8817e4Smiod 25*3d8817e4Smiod #define SELECT_RELOC(internal, howto) \ 26*3d8817e4Smiod { \ 27*3d8817e4Smiod internal.r_type = howto->type; \ 28*3d8817e4Smiod internal.r_size = \ 29*3d8817e4Smiod ((howto->complain_on_overflow == complain_overflow_signed \ 30*3d8817e4Smiod ? 0x80 \ 31*3d8817e4Smiod : 0) \ 32*3d8817e4Smiod | (howto->bitsize - 1)); \ 33*3d8817e4Smiod } 34*3d8817e4Smiod 35*3d8817e4Smiod #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER 3 36*3d8817e4Smiod 37*3d8817e4Smiod #define COFF_LONG_FILENAMES 38*3d8817e4Smiod 39*3d8817e4Smiod #define NO_COFF_SYMBOLS 40*3d8817e4Smiod 41*3d8817e4Smiod #define RTYPE2HOWTO(cache_ptr, dst) _bfd_xcoff_rtype2howto (cache_ptr, dst) 42*3d8817e4Smiod 43*3d8817e4Smiod #define coff_mkobject _bfd_xcoff_mkobject 44*3d8817e4Smiod #define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data 45*3d8817e4Smiod #define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name 46*3d8817e4Smiod #define coff_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) 47*3d8817e4Smiod #define coff_bfd_reloc_type_lookup _bfd_xcoff_reloc_type_lookup 48*3d8817e4Smiod #define coff_relocate_section _bfd_ppc_xcoff_relocate_section 49*3d8817e4Smiod #define coff_core_file_failing_command _bfd_nocore_core_file_failing_command 50*3d8817e4Smiod #define coff_core_file_failing_signal _bfd_nocore_core_file_failing_signal 51*3d8817e4Smiod #define coff_core_file_matches_executable_p _bfd_nocore_core_file_matches_executable_p 52*3d8817e4Smiod #define _bfd_xcoff_bfd_get_relocated_section_contents coff_bfd_get_relocated_section_contents 53*3d8817e4Smiod #define _bfd_xcoff_bfd_relax_section coff_bfd_relax_section 54*3d8817e4Smiod #define _bfd_xcoff_bfd_gc_sections coff_bfd_gc_sections 55*3d8817e4Smiod #define _bfd_xcoff_bfd_merge_sections coff_bfd_merge_sections 56*3d8817e4Smiod #define _bfd_xcoff_bfd_discard_group bfd_generic_discard_group 57*3d8817e4Smiod #define _bfd_xcoff_section_already_linked _bfd_generic_section_already_linked 58*3d8817e4Smiod #define _bfd_xcoff_bfd_link_split_section coff_bfd_link_split_section 59*3d8817e4Smiod 60*3d8817e4Smiod #define CORE_FILE_P _bfd_dummy_target 61*3d8817e4Smiod 62*3d8817e4Smiod #ifdef AIX_CORE 63*3d8817e4Smiod 64*3d8817e4Smiod #undef CORE_FILE_P 65*3d8817e4Smiod #define CORE_FILE_P rs6000coff_core_p 66*3d8817e4Smiod extern const bfd_target * rs6000coff_core_p (bfd *); 67*3d8817e4Smiod extern bfd_boolean rs6000coff_core_file_matches_executable_p (bfd *, bfd*); 68*3d8817e4Smiod 69*3d8817e4Smiod #undef coff_core_file_matches_executable_p 70*3d8817e4Smiod #define coff_core_file_matches_executable_p \ 71*3d8817e4Smiod rs6000coff_core_file_matches_executable_p 72*3d8817e4Smiod 73*3d8817e4Smiod extern char *rs6000coff_core_file_failing_command (bfd *); 74*3d8817e4Smiod #undef coff_core_file_failing_command 75*3d8817e4Smiod #define coff_core_file_failing_command rs6000coff_core_file_failing_command 76*3d8817e4Smiod 77*3d8817e4Smiod extern int rs6000coff_core_file_failing_signal (bfd *); 78*3d8817e4Smiod #undef coff_core_file_failing_signal 79*3d8817e4Smiod #define coff_core_file_failing_signal rs6000coff_core_file_failing_signal 80*3d8817e4Smiod #endif /* AIX_CORE */ 81*3d8817e4Smiod 82*3d8817e4Smiod #ifdef LYNX_CORE 83*3d8817e4Smiod 84*3d8817e4Smiod #undef CORE_FILE_P 85*3d8817e4Smiod #define CORE_FILE_P lynx_core_file_p 86*3d8817e4Smiod extern const bfd_target *lynx_core_file_p (bfd *); 87*3d8817e4Smiod 88*3d8817e4Smiod extern bfd_boolean lynx_core_file_matches_executable_p (bfd *, bfd *); 89*3d8817e4Smiod #undef coff_core_file_matches_executable_p 90*3d8817e4Smiod #define coff_core_file_matches_executable_p lynx_core_file_matches_executable_p 91*3d8817e4Smiod 92*3d8817e4Smiod extern char *lynx_core_file_failing_command (bfd *); 93*3d8817e4Smiod #undef coff_core_file_failing_command 94*3d8817e4Smiod #define coff_core_file_failing_command lynx_core_file_failing_command 95*3d8817e4Smiod 96*3d8817e4Smiod extern int lynx_core_file_failing_signal (bfd *); 97*3d8817e4Smiod #undef coff_core_file_failing_signal 98*3d8817e4Smiod #define coff_core_file_failing_signal lynx_core_file_failing_signal 99*3d8817e4Smiod 100*3d8817e4Smiod #endif /* LYNX_CORE */ 101*3d8817e4Smiod 102*3d8817e4Smiod /* XCOFF archives do not have anything which corresponds to an 103*3d8817e4Smiod extended name table. */ 104*3d8817e4Smiod 105*3d8817e4Smiod #define _bfd_xcoff_slurp_extended_name_table bfd_false 106*3d8817e4Smiod #define _bfd_xcoff_construct_extended_name_table \ 107*3d8817e4Smiod ((bfd_boolean (*) (bfd *, char **, bfd_size_type *, const char **)) bfd_false) 108*3d8817e4Smiod #define _bfd_xcoff_truncate_arname bfd_dont_truncate_arname 109*3d8817e4Smiod 110*3d8817e4Smiod /* We can use the standard get_elt_at_index routine. */ 111*3d8817e4Smiod 112*3d8817e4Smiod #define _bfd_xcoff_get_elt_at_index _bfd_generic_get_elt_at_index 113*3d8817e4Smiod 114*3d8817e4Smiod /* XCOFF archives do not have a timestamp. */ 115*3d8817e4Smiod 116*3d8817e4Smiod #define _bfd_xcoff_update_armap_timestamp bfd_true 117*3d8817e4Smiod 118*3d8817e4Smiod extern bfd_boolean _bfd_xcoff_mkobject (bfd *); 119*3d8817e4Smiod extern bfd_boolean _bfd_xcoff_copy_private_bfd_data (bfd *, bfd *); 120*3d8817e4Smiod extern bfd_boolean _bfd_xcoff_is_local_label_name (bfd *, const char *); 121*3d8817e4Smiod extern void _bfd_xcoff_rtype2howto (arelent *, struct internal_reloc *); 122*3d8817e4Smiod extern bfd_boolean _bfd_xcoff_slurp_armap (bfd *); 123*3d8817e4Smiod extern void * _bfd_xcoff_read_ar_hdr (bfd *); 124*3d8817e4Smiod extern bfd * _bfd_xcoff_openr_next_archived_file (bfd *, bfd *); 125*3d8817e4Smiod extern int _bfd_xcoff_generic_stat_arch_elt (bfd *, struct stat *); 126*3d8817e4Smiod extern bfd_boolean _bfd_xcoff_write_armap (bfd *, unsigned int, struct orl *, unsigned int, int); 127*3d8817e4Smiod extern bfd_boolean _bfd_xcoff_write_archive_contents (bfd *); 128*3d8817e4Smiod extern int _bfd_xcoff_sizeof_headers (bfd *, bfd_boolean); 129*3d8817e4Smiod extern void _bfd_xcoff_swap_sym_in (bfd *, void *, void *); 130*3d8817e4Smiod extern unsigned int _bfd_xcoff_swap_sym_out (bfd *, void *, void *); 131*3d8817e4Smiod extern void _bfd_xcoff_swap_aux_in (bfd *, void *, int, int, int, int, void *); 132*3d8817e4Smiod extern unsigned int _bfd_xcoff_swap_aux_out (bfd *, void *, int, int, int, int, void *); 133*3d8817e4Smiod extern reloc_howto_type * _bfd_xcoff_reloc_type_lookup (bfd *, bfd_reloc_code_real_type); 134*3d8817e4Smiod extern const bfd_target * _bfd_xcoff_archive_p (bfd *); 135*3d8817e4Smiod 136*3d8817e4Smiod #ifndef coff_SWAP_sym_in 137*3d8817e4Smiod #define coff_SWAP_sym_in _bfd_xcoff_swap_sym_in 138*3d8817e4Smiod #define coff_SWAP_sym_out _bfd_xcoff_swap_sym_out 139*3d8817e4Smiod #define coff_SWAP_aux_in _bfd_xcoff_swap_aux_in 140*3d8817e4Smiod #define coff_SWAP_aux_out _bfd_xcoff_swap_aux_out 141*3d8817e4Smiod #endif 142*3d8817e4Smiod 143*3d8817e4Smiod #include "coffcode.h" 144*3d8817e4Smiod 145*3d8817e4Smiod /* The transfer vector that leads the outside world to all of the above. */ 146*3d8817e4Smiod 147*3d8817e4Smiod const bfd_target TARGET_SYM = 148*3d8817e4Smiod { 149*3d8817e4Smiod TARGET_NAME, 150*3d8817e4Smiod bfd_target_xcoff_flavour, 151*3d8817e4Smiod BFD_ENDIAN_BIG, /* Data byte order is big. */ 152*3d8817e4Smiod BFD_ENDIAN_BIG, /* Header byte order is big. */ 153*3d8817e4Smiod 154*3d8817e4Smiod (HAS_RELOC | EXEC_P | /* Object flags. */ 155*3d8817e4Smiod HAS_LINENO | HAS_DEBUG | DYNAMIC | 156*3d8817e4Smiod HAS_SYMS | HAS_LOCALS | WP_TEXT), 157*3d8817e4Smiod 158*3d8817e4Smiod (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* Section flags. */ 159*3d8817e4Smiod 0, /* Leading char. */ 160*3d8817e4Smiod '/', /* AR_pad_char. */ 161*3d8817e4Smiod 15, /* AR_max_namelen??? FIXME. */ 162*3d8817e4Smiod 163*3d8817e4Smiod bfd_getb64, bfd_getb_signed_64, bfd_putb64, 164*3d8817e4Smiod bfd_getb32, bfd_getb_signed_32, bfd_putb32, 165*3d8817e4Smiod bfd_getb16, bfd_getb_signed_16, bfd_putb16,/* Data. */ 166*3d8817e4Smiod bfd_getb64, bfd_getb_signed_64, bfd_putb64, 167*3d8817e4Smiod bfd_getb32, bfd_getb_signed_32, bfd_putb32, 168*3d8817e4Smiod bfd_getb16, bfd_getb_signed_16, bfd_putb16,/* Headers. */ 169*3d8817e4Smiod 170*3d8817e4Smiod {_bfd_dummy_target, coff_object_p, /* bfd_check_format. */ 171*3d8817e4Smiod _bfd_xcoff_archive_p, CORE_FILE_P}, 172*3d8817e4Smiod {bfd_false, coff_mkobject, /* bfd_set_format. */ 173*3d8817e4Smiod _bfd_generic_mkarchive, bfd_false}, 174*3d8817e4Smiod {bfd_false, coff_write_object_contents, /* bfd_write_contents. */ 175*3d8817e4Smiod _bfd_xcoff_write_archive_contents, bfd_false}, 176*3d8817e4Smiod 177*3d8817e4Smiod BFD_JUMP_TABLE_GENERIC (coff), 178*3d8817e4Smiod BFD_JUMP_TABLE_COPY (coff), 179*3d8817e4Smiod BFD_JUMP_TABLE_CORE (coff), 180*3d8817e4Smiod BFD_JUMP_TABLE_ARCHIVE (_bfd_xcoff), 181*3d8817e4Smiod BFD_JUMP_TABLE_SYMBOLS (coff), 182*3d8817e4Smiod BFD_JUMP_TABLE_RELOCS (coff), 183*3d8817e4Smiod BFD_JUMP_TABLE_WRITE (coff), 184*3d8817e4Smiod BFD_JUMP_TABLE_LINK (_bfd_xcoff), 185*3d8817e4Smiod BFD_JUMP_TABLE_DYNAMIC (_bfd_xcoff), 186*3d8817e4Smiod 187*3d8817e4Smiod NULL, 188*3d8817e4Smiod 189*3d8817e4Smiod COFF_SWAP_TABLE 190*3d8817e4Smiod }; 191