Commit | Line | Data |
---|---|---|
b4911a31 | 1 | /* Common definitions for backends based on IBM RS/6000 "XCOFF64" files. |
116c20d2 | 2 | Copyright 2000, 2001, 2002, 2004, 2005 |
b4911a31 CP |
3 | Free Software Foundation, Inc. |
4 | Contributed by Cygnus Support. | |
5 | ||
116c20d2 | 6 | This file is part of BFD, the Binary File Descriptor library. |
b4911a31 | 7 | |
116c20d2 NC |
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. | |
b4911a31 | 12 | |
116c20d2 NC |
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. | |
b4911a31 | 17 | |
116c20d2 NC |
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 | |
3e110533 | 20 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ |
b4911a31 CP |
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 | \f | |
116c20d2 | 35 | #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER 3 |
b4911a31 CP |
36 | |
37 | #define COFF_LONG_FILENAMES | |
38 | ||
39 | #define NO_COFF_SYMBOLS | |
40 | ||
41 | #define RTYPE2HOWTO(cache_ptr, dst) _bfd_xcoff_rtype2howto (cache_ptr, dst) | |
42 | ||
116c20d2 NC |
43 | #define coff_mkobject _bfd_xcoff_mkobject |
44 | #define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data | |
45 | #define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name | |
3c9458e9 | 46 | #define coff_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) |
116c20d2 NC |
47 | #define coff_bfd_reloc_type_lookup _bfd_xcoff_reloc_type_lookup |
48 | #define coff_relocate_section _bfd_ppc_xcoff_relocate_section | |
49 | #define coff_core_file_failing_command _bfd_nocore_core_file_failing_command | |
50 | #define coff_core_file_failing_signal _bfd_nocore_core_file_failing_signal | |
51 | #define coff_core_file_matches_executable_p _bfd_nocore_core_file_matches_executable_p | |
52 | #define _bfd_xcoff_bfd_get_relocated_section_contents coff_bfd_get_relocated_section_contents | |
53 | #define _bfd_xcoff_bfd_relax_section coff_bfd_relax_section | |
54 | #define _bfd_xcoff_bfd_gc_sections coff_bfd_gc_sections | |
55 | #define _bfd_xcoff_bfd_merge_sections coff_bfd_merge_sections | |
56 | #define _bfd_xcoff_bfd_discard_group bfd_generic_discard_group | |
57 | #define _bfd_xcoff_section_already_linked _bfd_generic_section_already_linked | |
58 | #define _bfd_xcoff_bfd_link_split_section coff_bfd_link_split_section | |
b4911a31 CP |
59 | |
60 | #define CORE_FILE_P _bfd_dummy_target | |
61 | ||
b4911a31 | 62 | #ifdef AIX_CORE |
116c20d2 NC |
63 | |
64 | #undef CORE_FILE_P | |
b4911a31 | 65 | #define CORE_FILE_P rs6000coff_core_p |
cc429f57 JB |
66 | extern const bfd_target * rs6000coff_core_p (bfd *); |
67 | extern bfd_boolean rs6000coff_core_file_matches_executable_p (bfd *, bfd*); | |
b4911a31 CP |
68 | |
69 | #undef coff_core_file_matches_executable_p | |
70 | #define coff_core_file_matches_executable_p \ | |
71 | rs6000coff_core_file_matches_executable_p | |
72 | ||
116c20d2 NC |
73 | extern char *rs6000coff_core_file_failing_command (bfd *); |
74 | #undef coff_core_file_failing_command | |
b4911a31 CP |
75 | #define coff_core_file_failing_command rs6000coff_core_file_failing_command |
76 | ||
116c20d2 NC |
77 | extern int rs6000coff_core_file_failing_signal (bfd *); |
78 | #undef coff_core_file_failing_signal | |
b4911a31 | 79 | #define coff_core_file_failing_signal rs6000coff_core_file_failing_signal |
b4911a31 CP |
80 | #endif /* AIX_CORE */ |
81 | ||
82 | #ifdef LYNX_CORE | |
83 | ||
116c20d2 | 84 | #undef CORE_FILE_P |
b4911a31 | 85 | #define CORE_FILE_P lynx_core_file_p |
116c20d2 | 86 | extern const bfd_target *lynx_core_file_p (bfd *); |
b4911a31 | 87 | |
116c20d2 | 88 | extern bfd_boolean lynx_core_file_matches_executable_p (bfd *, bfd *); |
b4911a31 CP |
89 | #undef coff_core_file_matches_executable_p |
90 | #define coff_core_file_matches_executable_p lynx_core_file_matches_executable_p | |
91 | ||
116c20d2 NC |
92 | extern char *lynx_core_file_failing_command (bfd *); |
93 | #undef coff_core_file_failing_command | |
b4911a31 CP |
94 | #define coff_core_file_failing_command lynx_core_file_failing_command |
95 | ||
116c20d2 NC |
96 | extern int lynx_core_file_failing_signal (bfd *); |
97 | #undef coff_core_file_failing_signal | |
b4911a31 CP |
98 | #define coff_core_file_failing_signal lynx_core_file_failing_signal |
99 | ||
100 | #endif /* LYNX_CORE */ | |
101 | ||
b4911a31 CP |
102 | /* XCOFF archives do not have anything which corresponds to an |
103 | extended name table. */ | |
104 | ||
105 | #define _bfd_xcoff_slurp_extended_name_table bfd_false | |
106 | #define _bfd_xcoff_construct_extended_name_table \ | |
116c20d2 | 107 | ((bfd_boolean (*) (bfd *, char **, bfd_size_type *, const char **)) bfd_false) |
b4911a31 CP |
108 | #define _bfd_xcoff_truncate_arname bfd_dont_truncate_arname |
109 | ||
110 | /* We can use the standard get_elt_at_index routine. */ | |
111 | ||
112 | #define _bfd_xcoff_get_elt_at_index _bfd_generic_get_elt_at_index | |
113 | ||
114 | /* XCOFF archives do not have a timestamp. */ | |
115 | ||
116 | #define _bfd_xcoff_update_armap_timestamp bfd_true | |
117 | ||
116c20d2 NC |
118 | extern bfd_boolean _bfd_xcoff_mkobject (bfd *); |
119 | extern bfd_boolean _bfd_xcoff_copy_private_bfd_data (bfd *, bfd *); | |
120 | extern bfd_boolean _bfd_xcoff_is_local_label_name (bfd *, const char *); | |
121 | extern void _bfd_xcoff_rtype2howto (arelent *, struct internal_reloc *); | |
122 | extern bfd_boolean _bfd_xcoff_slurp_armap (bfd *); | |
123 | extern void * _bfd_xcoff_read_ar_hdr (bfd *); | |
124 | extern bfd * _bfd_xcoff_openr_next_archived_file (bfd *, bfd *); | |
125 | extern int _bfd_xcoff_generic_stat_arch_elt (bfd *, struct stat *); | |
126 | extern bfd_boolean _bfd_xcoff_write_armap (bfd *, unsigned int, struct orl *, unsigned int, int); | |
127 | extern bfd_boolean _bfd_xcoff_write_archive_contents (bfd *); | |
128 | extern int _bfd_xcoff_sizeof_headers (bfd *, bfd_boolean); | |
129 | extern void _bfd_xcoff_swap_sym_in (bfd *, void *, void *); | |
130 | extern unsigned int _bfd_xcoff_swap_sym_out (bfd *, void *, void *); | |
131 | extern void _bfd_xcoff_swap_aux_in (bfd *, void *, int, int, int, int, void *); | |
132 | extern unsigned int _bfd_xcoff_swap_aux_out (bfd *, void *, int, int, int, int, void *); | |
133 | extern reloc_howto_type * _bfd_xcoff_reloc_type_lookup (bfd *, bfd_reloc_code_real_type); | |
134 | extern const bfd_target * _bfd_xcoff_archive_p (bfd *); | |
b4911a31 CP |
135 | |
136 | #ifndef coff_SWAP_sym_in | |
116c20d2 | 137 | #define coff_SWAP_sym_in _bfd_xcoff_swap_sym_in |
b4911a31 | 138 | #define coff_SWAP_sym_out _bfd_xcoff_swap_sym_out |
116c20d2 | 139 | #define coff_SWAP_aux_in _bfd_xcoff_swap_aux_in |
b4911a31 CP |
140 | #define coff_SWAP_aux_out _bfd_xcoff_swap_aux_out |
141 | #endif | |
142 | ||
143 | #include "coffcode.h" | |
144 | ||
3d855632 | 145 | /* The transfer vector that leads the outside world to all of the above. */ |
b4911a31 CP |
146 | |
147 | const bfd_target TARGET_SYM = | |
148 | { | |
149 | TARGET_NAME, | |
9bd09e22 | 150 | bfd_target_xcoff_flavour, |
116c20d2 NC |
151 | BFD_ENDIAN_BIG, /* Data byte order is big. */ |
152 | BFD_ENDIAN_BIG, /* Header byte order is big. */ | |
b4911a31 | 153 | |
116c20d2 | 154 | (HAS_RELOC | EXEC_P | /* Object flags. */ |
b4911a31 CP |
155 | HAS_LINENO | HAS_DEBUG | DYNAMIC | |
156 | HAS_SYMS | HAS_LOCALS | WP_TEXT), | |
157 | ||
116c20d2 NC |
158 | (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* Section flags. */ |
159 | 0, /* Leading char. */ | |
160 | '/', /* AR_pad_char. */ | |
161 | 15, /* AR_max_namelen??? FIXME. */ | |
b4911a31 CP |
162 | |
163 | bfd_getb64, bfd_getb_signed_64, bfd_putb64, | |
164 | bfd_getb32, bfd_getb_signed_32, bfd_putb32, | |
116c20d2 | 165 | bfd_getb16, bfd_getb_signed_16, bfd_putb16,/* Data. */ |
b4911a31 CP |
166 | bfd_getb64, bfd_getb_signed_64, bfd_putb64, |
167 | bfd_getb32, bfd_getb_signed_32, bfd_putb32, | |
116c20d2 | 168 | bfd_getb16, bfd_getb_signed_16, bfd_putb16,/* Headers. */ |
b4911a31 | 169 | |
116c20d2 | 170 | {_bfd_dummy_target, coff_object_p, /* bfd_check_format. */ |
b4911a31 | 171 | _bfd_xcoff_archive_p, CORE_FILE_P}, |
116c20d2 | 172 | {bfd_false, coff_mkobject, /* bfd_set_format. */ |
b4911a31 | 173 | _bfd_generic_mkarchive, bfd_false}, |
116c20d2 | 174 | {bfd_false, coff_write_object_contents, /* bfd_write_contents. */ |
b4911a31 CP |
175 | _bfd_xcoff_write_archive_contents, bfd_false}, |
176 | ||
177 | BFD_JUMP_TABLE_GENERIC (coff), | |
178 | BFD_JUMP_TABLE_COPY (coff), | |
179 | BFD_JUMP_TABLE_CORE (coff), | |
180 | BFD_JUMP_TABLE_ARCHIVE (_bfd_xcoff), | |
181 | BFD_JUMP_TABLE_SYMBOLS (coff), | |
182 | BFD_JUMP_TABLE_RELOCS (coff), | |
183 | BFD_JUMP_TABLE_WRITE (coff), | |
184 | BFD_JUMP_TABLE_LINK (_bfd_xcoff), | |
185 | BFD_JUMP_TABLE_DYNAMIC (_bfd_xcoff), | |
186 | ||
187 | NULL, | |
3d855632 | 188 | |
b4911a31 CP |
189 | COFF_SWAP_TABLE |
190 | }; |