| 1 | /* Common definitions for backends based on IBM RS/6000 "XCOFF64" files.
|
|---|
| 2 | Copyright 2000, 2001, 2002
|
|---|
| 3 | Free Software Foundation, Inc.
|
|---|
| 4 | Contributed by Cygnus Support.
|
|---|
| 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 | /* Internalcoff.h and coffcode.h modify themselves based on this flag. */
|
|---|
| 23 | #define RS6000COFF_C 1
|
|---|
| 24 |
|
|---|
| 25 | #define SELECT_RELOC(internal, howto) \
|
|---|
| 26 | { \
|
|---|
| 27 | internal.r_type = howto->type; \
|
|---|
| 28 | internal.r_size = \
|
|---|
| 29 | ((howto->complain_on_overflow == complain_overflow_signed \
|
|---|
| 30 | ? 0x80 \
|
|---|
| 31 | : 0) \
|
|---|
| 32 | | (howto->bitsize - 1)); \
|
|---|
| 33 | }
|
|---|
| 34 | |
|---|
| 35 |
|
|---|
| 36 | #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3)
|
|---|
| 37 |
|
|---|
| 38 | #define COFF_LONG_FILENAMES
|
|---|
| 39 |
|
|---|
| 40 | #define NO_COFF_SYMBOLS
|
|---|
| 41 |
|
|---|
| 42 | #define RTYPE2HOWTO(cache_ptr, dst) _bfd_xcoff_rtype2howto (cache_ptr, dst)
|
|---|
| 43 |
|
|---|
| 44 | #define coff_mkobject _bfd_xcoff_mkobject
|
|---|
| 45 | #define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data
|
|---|
| 46 | #define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name
|
|---|
| 47 | #define coff_bfd_reloc_type_lookup _bfd_xcoff_reloc_type_lookup
|
|---|
| 48 | #define coff_relocate_section _bfd_ppc_xcoff_relocate_section
|
|---|
| 49 |
|
|---|
| 50 | #define CORE_FILE_P _bfd_dummy_target
|
|---|
| 51 |
|
|---|
| 52 | #define coff_core_file_failing_command _bfd_nocore_core_file_failing_command
|
|---|
| 53 | #define coff_core_file_failing_signal _bfd_nocore_core_file_failing_signal
|
|---|
| 54 | #define coff_core_file_matches_executable_p \
|
|---|
| 55 | _bfd_nocore_core_file_matches_executable_p
|
|---|
| 56 |
|
|---|
| 57 | #ifdef AIX_CORE
|
|---|
| 58 | #undef CORE_FILE_P
|
|---|
| 59 | #define CORE_FILE_P rs6000coff_core_p
|
|---|
| 60 | extern const bfd_target * rs6000coff_core_p ();
|
|---|
| 61 | extern bfd_boolean rs6000coff_core_file_matches_executable_p ();
|
|---|
| 62 |
|
|---|
| 63 | #undef coff_core_file_matches_executable_p
|
|---|
| 64 | #define coff_core_file_matches_executable_p \
|
|---|
| 65 | rs6000coff_core_file_matches_executable_p
|
|---|
| 66 |
|
|---|
| 67 | extern char *rs6000coff_core_file_failing_command PARAMS ((bfd *abfd));
|
|---|
| 68 | #undef coff_core_file_failing_command
|
|---|
| 69 | #define coff_core_file_failing_command rs6000coff_core_file_failing_command
|
|---|
| 70 |
|
|---|
| 71 | extern int rs6000coff_core_file_failing_signal PARAMS ((bfd *abfd));
|
|---|
| 72 | #undef coff_core_file_failing_signal
|
|---|
| 73 | #define coff_core_file_failing_signal rs6000coff_core_file_failing_signal
|
|---|
| 74 | #endif /* AIX_CORE */
|
|---|
| 75 |
|
|---|
| 76 | #ifdef LYNX_CORE
|
|---|
| 77 |
|
|---|
| 78 | #undef CORE_FILE_P
|
|---|
| 79 | #define CORE_FILE_P lynx_core_file_p
|
|---|
| 80 | extern const bfd_target *lynx_core_file_p PARAMS ((bfd *abfd));
|
|---|
| 81 |
|
|---|
| 82 | extern bfd_boolean lynx_core_file_matches_executable_p
|
|---|
| 83 | PARAMS ((bfd *core_bfd, bfd *exec_bfd));
|
|---|
| 84 | #undef coff_core_file_matches_executable_p
|
|---|
| 85 | #define coff_core_file_matches_executable_p lynx_core_file_matches_executable_p
|
|---|
| 86 |
|
|---|
| 87 | extern char *lynx_core_file_failing_command PARAMS ((bfd *abfd));
|
|---|
| 88 | #undef coff_core_file_failing_command
|
|---|
| 89 | #define coff_core_file_failing_command lynx_core_file_failing_command
|
|---|
| 90 |
|
|---|
| 91 | extern int lynx_core_file_failing_signal PARAMS ((bfd *abfd));
|
|---|
| 92 | #undef coff_core_file_failing_signal
|
|---|
| 93 | #define coff_core_file_failing_signal lynx_core_file_failing_signal
|
|---|
| 94 |
|
|---|
| 95 | #endif /* LYNX_CORE */
|
|---|
| 96 |
|
|---|
| 97 | #define _bfd_xcoff_bfd_get_relocated_section_contents \
|
|---|
| 98 | coff_bfd_get_relocated_section_contents
|
|---|
| 99 | #define _bfd_xcoff_bfd_relax_section coff_bfd_relax_section
|
|---|
| 100 | #define _bfd_xcoff_bfd_gc_sections coff_bfd_gc_sections
|
|---|
| 101 | #define _bfd_xcoff_bfd_merge_sections coff_bfd_merge_sections
|
|---|
| 102 | #define _bfd_xcoff_bfd_discard_group bfd_generic_discard_group
|
|---|
| 103 | #define _bfd_xcoff_bfd_link_split_section coff_bfd_link_split_section
|
|---|
| 104 |
|
|---|
| 105 | /* XCOFF archives do not have anything which corresponds to an
|
|---|
| 106 | extended name table. */
|
|---|
| 107 |
|
|---|
| 108 | #define _bfd_xcoff_slurp_extended_name_table bfd_false
|
|---|
| 109 | #define _bfd_xcoff_construct_extended_name_table \
|
|---|
| 110 | ((bfd_boolean (*) PARAMS ((bfd *, char **, bfd_size_type *, const char **))) \
|
|---|
| 111 | bfd_false)
|
|---|
| 112 | #define _bfd_xcoff_truncate_arname bfd_dont_truncate_arname
|
|---|
| 113 |
|
|---|
| 114 | /* We can use the standard get_elt_at_index routine. */
|
|---|
| 115 |
|
|---|
| 116 | #define _bfd_xcoff_get_elt_at_index _bfd_generic_get_elt_at_index
|
|---|
| 117 |
|
|---|
| 118 | /* XCOFF archives do not have a timestamp. */
|
|---|
| 119 |
|
|---|
| 120 | #define _bfd_xcoff_update_armap_timestamp bfd_true
|
|---|
| 121 |
|
|---|
| 122 | extern bfd_boolean _bfd_xcoff_mkobject PARAMS ((bfd *));
|
|---|
| 123 | extern bfd_boolean _bfd_xcoff_copy_private_bfd_data PARAMS ((bfd *, bfd *));
|
|---|
| 124 | extern bfd_boolean _bfd_xcoff_is_local_label_name PARAMS ((bfd *, const char *));
|
|---|
| 125 | extern void _bfd_xcoff_rtype2howto
|
|---|
| 126 | PARAMS ((arelent *, struct internal_reloc *));
|
|---|
| 127 | extern reloc_howto_type *_bfd_xcoff_reloc_type_lookup
|
|---|
| 128 | PARAMS ((bfd *, bfd_reloc_code_real_type));
|
|---|
| 129 | extern bfd_boolean _bfd_xcoff_slurp_armap PARAMS ((bfd *));
|
|---|
| 130 | extern const bfd_target *_bfd_xcoff_archive_p PARAMS ((bfd *));
|
|---|
| 131 | extern PTR _bfd_xcoff_read_ar_hdr PARAMS ((bfd *));
|
|---|
| 132 | extern bfd *_bfd_xcoff_openr_next_archived_file PARAMS ((bfd *, bfd *));
|
|---|
| 133 | extern int _bfd_xcoff_generic_stat_arch_elt PARAMS ((bfd *, struct stat *));
|
|---|
| 134 | extern bfd_boolean _bfd_xcoff_write_armap
|
|---|
| 135 | PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
|
|---|
| 136 | extern bfd_boolean _bfd_xcoff_write_archive_contents PARAMS ((bfd *));
|
|---|
| 137 | extern int _bfd_xcoff_sizeof_headers PARAMS ((bfd *, bfd_boolean));
|
|---|
| 138 | extern void _bfd_xcoff_swap_sym_in PARAMS ((bfd *, PTR, PTR));
|
|---|
| 139 | extern unsigned int _bfd_xcoff_swap_sym_out PARAMS ((bfd *, PTR, PTR));
|
|---|
| 140 | extern void _bfd_xcoff_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR));
|
|---|
| 141 | extern unsigned int _bfd_xcoff_swap_aux_out PARAMS ((bfd *, PTR, int, int, int, int, PTR));
|
|---|
| 142 |
|
|---|
| 143 | #ifndef coff_SWAP_sym_in
|
|---|
| 144 | #define coff_SWAP_sym_in _bfd_xcoff_swap_sym_in
|
|---|
| 145 | #define coff_SWAP_sym_out _bfd_xcoff_swap_sym_out
|
|---|
| 146 | #define coff_SWAP_aux_in _bfd_xcoff_swap_aux_in
|
|---|
| 147 | #define coff_SWAP_aux_out _bfd_xcoff_swap_aux_out
|
|---|
| 148 | #endif
|
|---|
| 149 |
|
|---|
| 150 | #include "coffcode.h"
|
|---|
| 151 |
|
|---|
| 152 | /* The transfer vector that leads the outside world to all of the above. */
|
|---|
| 153 |
|
|---|
| 154 | const bfd_target TARGET_SYM =
|
|---|
| 155 | {
|
|---|
| 156 | TARGET_NAME,
|
|---|
| 157 | bfd_target_xcoff_flavour,
|
|---|
| 158 | BFD_ENDIAN_BIG, /* data byte order is big */
|
|---|
| 159 | BFD_ENDIAN_BIG, /* header byte order is big */
|
|---|
| 160 |
|
|---|
| 161 | (HAS_RELOC | EXEC_P | /* object flags */
|
|---|
| 162 | HAS_LINENO | HAS_DEBUG | DYNAMIC |
|
|---|
| 163 | HAS_SYMS | HAS_LOCALS | WP_TEXT),
|
|---|
| 164 |
|
|---|
| 165 | (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
|---|
| 166 | 0, /* leading char */
|
|---|
| 167 | '/', /* ar_pad_char */
|
|---|
| 168 | 15, /* ar_max_namelen??? FIXMEmgo */
|
|---|
| 169 |
|
|---|
| 170 | bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
|---|
| 171 | bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
|---|
| 172 | bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
|
|---|
| 173 | bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
|---|
| 174 | bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
|---|
| 175 | bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
|
|---|
| 176 |
|
|---|
| 177 | {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
|
|---|
| 178 | _bfd_xcoff_archive_p, CORE_FILE_P},
|
|---|
| 179 | {bfd_false, coff_mkobject, /* bfd_set_format */
|
|---|
| 180 | _bfd_generic_mkarchive, bfd_false},
|
|---|
| 181 | {bfd_false, coff_write_object_contents, /* bfd_write_contents */
|
|---|
| 182 | _bfd_xcoff_write_archive_contents, bfd_false},
|
|---|
| 183 |
|
|---|
| 184 | BFD_JUMP_TABLE_GENERIC (coff),
|
|---|
| 185 | BFD_JUMP_TABLE_COPY (coff),
|
|---|
| 186 | BFD_JUMP_TABLE_CORE (coff),
|
|---|
| 187 | BFD_JUMP_TABLE_ARCHIVE (_bfd_xcoff),
|
|---|
| 188 | BFD_JUMP_TABLE_SYMBOLS (coff),
|
|---|
| 189 | BFD_JUMP_TABLE_RELOCS (coff),
|
|---|
| 190 | BFD_JUMP_TABLE_WRITE (coff),
|
|---|
| 191 | BFD_JUMP_TABLE_LINK (_bfd_xcoff),
|
|---|
| 192 | BFD_JUMP_TABLE_DYNAMIC (_bfd_xcoff),
|
|---|
| 193 |
|
|---|
| 194 | NULL,
|
|---|
| 195 |
|
|---|
| 196 | COFF_SWAP_TABLE
|
|---|
| 197 | };
|
|---|