PR ld/11843
[binutils.git] / bfd / xcoff-target.h
blob4837fdff7a788ffc1eabda2367851c9ca7ade11f
1 /* Common definitions for backends based on IBM RS/6000 "XCOFF64" files.
2 Copyright 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2009
3 Free Software Foundation, Inc.
4 Contributed by Cygnus Support.
6 This file is part of BFD, the Binary File Descriptor library.
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 3 of the License, or
11 (at your option) any later version.
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.
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., 51 Franklin Street - Fifth Floor, Boston,
21 MA 02110-1301, USA. */
24 /* Internalcoff.h and coffcode.h modify themselves based on this flag. */
25 #define RS6000COFF_C 1
27 #define SELECT_RELOC(internal, howto) \
28 { \
29 internal.r_type = howto->type; \
30 internal.r_size = \
31 ((howto->complain_on_overflow == complain_overflow_signed \
32 ? 0x80 \
33 : 0) \
34 | (howto->bitsize - 1)); \
37 #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER 3
39 #define COFF_LONG_FILENAMES
41 #define NO_COFF_SYMBOLS
43 #define RTYPE2HOWTO(cache_ptr, dst) _bfd_xcoff_rtype2howto (cache_ptr, dst)
45 #define coff_mkobject _bfd_xcoff_mkobject
46 #define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data
47 #define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name
48 #define coff_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
49 #define coff_bfd_reloc_type_lookup _bfd_xcoff_reloc_type_lookup
50 #define coff_relocate_section _bfd_ppc_xcoff_relocate_section
51 #define coff_core_file_failing_command _bfd_nocore_core_file_failing_command
52 #define coff_core_file_failing_signal _bfd_nocore_core_file_failing_signal
53 #define coff_core_file_matches_executable_p _bfd_nocore_core_file_matches_executable_p
54 #define _bfd_xcoff_bfd_get_relocated_section_contents coff_bfd_get_relocated_section_contents
55 #define _bfd_xcoff_bfd_relax_section coff_bfd_relax_section
56 #define _bfd_xcoff_bfd_gc_sections coff_bfd_gc_sections
57 #define _bfd_xcoff_bfd_merge_sections coff_bfd_merge_sections
58 #define _bfd_xcoff_bfd_discard_group bfd_generic_discard_group
59 #define _bfd_xcoff_section_already_linked _bfd_generic_section_already_linked
60 #define _bfd_xcoff_bfd_define_common_symbol _bfd_xcoff_define_common_symbol
61 #define _bfd_xcoff_bfd_link_split_section coff_bfd_link_split_section
63 #define CORE_FILE_P _bfd_dummy_target
65 #ifdef AIX_CORE
67 #undef CORE_FILE_P
68 #define CORE_FILE_P rs6000coff_core_p
69 extern const bfd_target * rs6000coff_core_p (bfd *);
70 extern bfd_boolean rs6000coff_core_file_matches_executable_p (bfd *, bfd*);
72 #undef coff_core_file_matches_executable_p
73 #define coff_core_file_matches_executable_p \
74 rs6000coff_core_file_matches_executable_p
76 extern char *rs6000coff_core_file_failing_command (bfd *);
77 #undef coff_core_file_failing_command
78 #define coff_core_file_failing_command rs6000coff_core_file_failing_command
80 extern int rs6000coff_core_file_failing_signal (bfd *);
81 #undef coff_core_file_failing_signal
82 #define coff_core_file_failing_signal rs6000coff_core_file_failing_signal
83 #endif /* AIX_CORE */
85 #ifdef LYNX_CORE
87 #undef CORE_FILE_P
88 #define CORE_FILE_P lynx_core_file_p
89 extern const bfd_target *lynx_core_file_p (bfd *);
91 extern bfd_boolean lynx_core_file_matches_executable_p (bfd *, bfd *);
92 #undef coff_core_file_matches_executable_p
93 #define coff_core_file_matches_executable_p lynx_core_file_matches_executable_p
95 extern char *lynx_core_file_failing_command (bfd *);
96 #undef coff_core_file_failing_command
97 #define coff_core_file_failing_command lynx_core_file_failing_command
99 extern int lynx_core_file_failing_signal (bfd *);
100 #undef coff_core_file_failing_signal
101 #define coff_core_file_failing_signal lynx_core_file_failing_signal
103 #endif /* LYNX_CORE */
105 /* XCOFF archives do not have anything which corresponds to an
106 extended name table. */
108 #define _bfd_xcoff_slurp_extended_name_table bfd_false
109 #define _bfd_xcoff_construct_extended_name_table \
110 ((bfd_boolean (*) (bfd *, char **, bfd_size_type *, const char **)) bfd_false)
111 #define _bfd_xcoff_truncate_arname bfd_dont_truncate_arname
113 /* We can use the standard get_elt_at_index routine. */
115 #define _bfd_xcoff_get_elt_at_index _bfd_generic_get_elt_at_index
117 /* XCOFF archives do not have a timestamp. */
119 #define _bfd_xcoff_update_armap_timestamp bfd_true
121 extern bfd_boolean _bfd_xcoff_mkobject (bfd *);
122 extern bfd_boolean _bfd_xcoff_copy_private_bfd_data (bfd *, bfd *);
123 extern bfd_boolean _bfd_xcoff_is_local_label_name (bfd *, const char *);
124 extern void _bfd_xcoff_rtype2howto (arelent *, struct internal_reloc *);
125 extern bfd_boolean _bfd_xcoff_slurp_armap (bfd *);
126 extern void * _bfd_xcoff_read_ar_hdr (bfd *);
127 extern bfd * _bfd_xcoff_openr_next_archived_file (bfd *, bfd *);
128 extern int _bfd_xcoff_generic_stat_arch_elt (bfd *, struct stat *);
129 extern bfd_boolean _bfd_xcoff_write_armap (bfd *, unsigned int, struct orl *, unsigned int, int);
130 extern bfd_boolean _bfd_xcoff_write_archive_contents (bfd *);
131 extern int _bfd_xcoff_sizeof_headers (bfd *, struct bfd_link_info *);
132 extern void _bfd_xcoff_swap_sym_in (bfd *, void *, void *);
133 extern unsigned int _bfd_xcoff_swap_sym_out (bfd *, void *, void *);
134 extern void _bfd_xcoff_swap_aux_in (bfd *, void *, int, int, int, int, void *);
135 extern unsigned int _bfd_xcoff_swap_aux_out (bfd *, void *, int, int, int, int, void *);
136 extern reloc_howto_type * _bfd_xcoff_reloc_type_lookup (bfd *, bfd_reloc_code_real_type);
137 extern const bfd_target * _bfd_xcoff_archive_p (bfd *);
139 #ifndef coff_SWAP_sym_in
140 #define coff_SWAP_sym_in _bfd_xcoff_swap_sym_in
141 #define coff_SWAP_sym_out _bfd_xcoff_swap_sym_out
142 #define coff_SWAP_aux_in _bfd_xcoff_swap_aux_in
143 #define coff_SWAP_aux_out _bfd_xcoff_swap_aux_out
144 #endif
146 #include "coffcode.h"
148 /* The transfer vector that leads the outside world to all of the above. */
150 const bfd_target TARGET_SYM =
152 TARGET_NAME,
153 bfd_target_xcoff_flavour,
154 BFD_ENDIAN_BIG, /* Data byte order is big. */
155 BFD_ENDIAN_BIG, /* Header byte order is big. */
157 (HAS_RELOC | EXEC_P | /* Object flags. */
158 HAS_LINENO | HAS_DEBUG | DYNAMIC |
159 HAS_SYMS | HAS_LOCALS | WP_TEXT),
161 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* Section flags. */
162 0, /* Leading char. */
163 '/', /* AR_pad_char. */
164 15, /* AR_max_namelen??? FIXME. */
166 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
167 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
168 bfd_getb16, bfd_getb_signed_16, bfd_putb16,/* Data. */
169 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
170 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
171 bfd_getb16, bfd_getb_signed_16, bfd_putb16,/* Headers. */
173 {_bfd_dummy_target, coff_object_p, /* bfd_check_format. */
174 _bfd_xcoff_archive_p, CORE_FILE_P},
175 {bfd_false, coff_mkobject, /* bfd_set_format. */
176 _bfd_generic_mkarchive, bfd_false},
177 {bfd_false, coff_write_object_contents, /* bfd_write_contents. */
178 _bfd_xcoff_write_archive_contents, bfd_false},
180 BFD_JUMP_TABLE_GENERIC (coff),
181 BFD_JUMP_TABLE_COPY (coff),
182 BFD_JUMP_TABLE_CORE (coff),
183 BFD_JUMP_TABLE_ARCHIVE (_bfd_xcoff),
184 BFD_JUMP_TABLE_SYMBOLS (coff),
185 BFD_JUMP_TABLE_RELOCS (coff),
186 BFD_JUMP_TABLE_WRITE (coff),
187 BFD_JUMP_TABLE_LINK (_bfd_xcoff),
188 BFD_JUMP_TABLE_DYNAMIC (_bfd_xcoff),
190 NULL,
192 COFF_SWAP_TABLE