* coff-rs6000.c (xcoff_howto_table): Fix src_mask entries. Make all
[deliverable/binutils-gdb.git] / bfd / coff64-rs6000.c
CommitLineData
7f6d05e8 1/* BFD back-end for IBM RS/6000 "XCOFF64" files.
38487e5e 2 Copyright 2000, 2001, 2002
7f6d05e8
CP
3 Free Software Foundation, Inc.
4 Written Clinton Popetz.
5 Contributed by Cygnus Support.
6
eb1e0e80 7 This file is part of BFD, the Binary File Descriptor library.
7f6d05e8 8
eb1e0e80
NC
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
7f6d05e8 13
eb1e0e80
NC
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
7f6d05e8 18
eb1e0e80
NC
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
7f6d05e8 22
7f6d05e8
CP
23#include "bfd.h"
24#include "sysdep.h"
beb1bf64 25#include "bfdlink.h"
7f6d05e8
CP
26#include "libbfd.h"
27#include "coff/internal.h"
beb1bf64 28#include "coff/xcoff.h"
7f6d05e8 29#include "coff/rs6k64.h"
dc810e39 30#include "libcoff.h"
beb1bf64 31#include "libxcoff.h"
7f6d05e8 32
dc810e39
AM
33#define GET_FILEHDR_SYMPTR H_GET_64
34#define PUT_FILEHDR_SYMPTR H_PUT_64
35#define GET_AOUTHDR_DATA_START H_GET_64
36#define PUT_AOUTHDR_DATA_START H_PUT_64
37#define GET_AOUTHDR_TEXT_START H_GET_64
38#define PUT_AOUTHDR_TEXT_START H_PUT_64
39#define GET_AOUTHDR_TSIZE H_GET_64
40#define PUT_AOUTHDR_TSIZE H_PUT_64
41#define GET_AOUTHDR_DSIZE H_GET_64
42#define PUT_AOUTHDR_DSIZE H_PUT_64
43#define GET_AOUTHDR_BSIZE H_GET_64
44#define PUT_AOUTHDR_BSIZE H_PUT_64
45#define GET_AOUTHDR_ENTRY H_GET_64
46#define PUT_AOUTHDR_ENTRY H_PUT_64
47#define GET_SCNHDR_PADDR H_GET_64
48#define PUT_SCNHDR_PADDR H_PUT_64
49#define GET_SCNHDR_VADDR H_GET_64
50#define PUT_SCNHDR_VADDR H_PUT_64
51#define GET_SCNHDR_SIZE H_GET_64
52#define PUT_SCNHDR_SIZE H_PUT_64
53#define GET_SCNHDR_SCNPTR H_GET_64
54#define PUT_SCNHDR_SCNPTR H_PUT_64
55#define GET_SCNHDR_RELPTR H_GET_64
56#define PUT_SCNHDR_RELPTR H_PUT_64
57#define GET_SCNHDR_LNNOPTR H_GET_64
58#define PUT_SCNHDR_LNNOPTR H_PUT_64
59#define GET_SCNHDR_NRELOC H_GET_32
7f6d05e8 60#define MAX_SCNHDR_NRELOC 0xffffffff
dc810e39
AM
61#define PUT_SCNHDR_NRELOC H_PUT_32
62#define GET_SCNHDR_NLNNO H_GET_32
7f6d05e8 63#define MAX_SCNHDR_NLNNO 0xffffffff
dc810e39
AM
64#define PUT_SCNHDR_NLNNO H_PUT_32
65#define GET_RELOC_VADDR H_GET_64
66#define PUT_RELOC_VADDR H_PUT_64
7f6d05e8
CP
67
68#define COFF_FORCE_SYMBOLS_IN_STRINGS
69#define COFF_DEBUG_STRING_WIDE_PREFIX
70
beb1bf64 71
dc810e39
AM
72#define COFF_ADJUST_SCNHDR_OUT_POST(ABFD, INT, EXT) \
73 do \
74 { \
75 memset (((SCNHDR *) EXT)->s_pad, 0, \
76 sizeof (((SCNHDR *) EXT)->s_pad)); \
77 } \
78 while (0)
7f6d05e8
CP
79
80#define NO_COFF_LINENOS
81
beb1bf64
TR
82#define coff_SWAP_lineno_in _bfd_xcoff64_swap_lineno_in
83#define coff_SWAP_lineno_out _bfd_xcoff64_swap_lineno_out
7f6d05e8 84
814fa6ab
AM
85static void _bfd_xcoff64_swap_lineno_in PARAMS ((bfd *, PTR, PTR));
86static unsigned int _bfd_xcoff64_swap_lineno_out PARAMS ((bfd *, PTR, PTR));
54327882
AM
87static boolean _bfd_xcoff64_put_symbol_name
88 PARAMS ((bfd *, struct bfd_strtab_hash *, struct internal_syment *,
89 const char *));
814fa6ab
AM
90static boolean _bfd_xcoff64_put_ldsymbol_name
91 PARAMS ((bfd *, struct xcoff_loader_info *, struct internal_ldsym *,
92 const char *));
dc810e39
AM
93static void _bfd_xcoff64_swap_sym_in PARAMS ((bfd *, PTR, PTR));
94static unsigned int _bfd_xcoff64_swap_sym_out PARAMS ((bfd *, PTR, PTR));
95static void _bfd_xcoff64_swap_aux_in
96 PARAMS ((bfd *, PTR, int, int, int, int, PTR));
97static unsigned int _bfd_xcoff64_swap_aux_out
98 PARAMS ((bfd *, PTR, int, int, int, int, PTR));
59862849
TR
99static void xcoff64_swap_reloc_in PARAMS ((bfd *, PTR, PTR));
100static unsigned int xcoff64_swap_reloc_out PARAMS ((bfd *, PTR, PTR));
dc810e39
AM
101extern boolean _bfd_xcoff_mkobject PARAMS ((bfd *));
102extern boolean _bfd_xcoff_copy_private_bfd_data PARAMS ((bfd *, bfd *));
103extern boolean _bfd_xcoff_is_local_label_name PARAMS ((bfd *, const char *));
104extern void xcoff64_rtype2howto
105 PARAMS ((arelent *, struct internal_reloc *));
106extern reloc_howto_type * xcoff64_reloc_type_lookup
107 PARAMS ((bfd *, bfd_reloc_code_real_type));
108extern boolean _bfd_xcoff_slurp_armap PARAMS ((bfd *));
109extern PTR _bfd_xcoff_read_ar_hdr PARAMS ((bfd *));
110extern bfd *_bfd_xcoff_openr_next_archived_file PARAMS ((bfd *, bfd *));
51b9608c 111extern int _bfd_xcoff_stat_arch_elt PARAMS ((bfd *, struct stat *));
dc810e39
AM
112extern boolean _bfd_xcoff_write_armap
113 PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
114extern boolean _bfd_xcoff_write_archive_contents PARAMS ((bfd *));
115extern int _bfd_xcoff_sizeof_headers PARAMS ((bfd *, boolean));
116extern void _bfd_xcoff_swap_sym_in PARAMS ((bfd *, PTR, PTR));
117extern unsigned int _bfd_xcoff_swap_sym_out PARAMS ((bfd *, PTR, PTR));
118extern void _bfd_xcoff_swap_aux_in
119 PARAMS ((bfd *, PTR, int, int, int, int, PTR));
120extern unsigned int _bfd_xcoff_swap_aux_out
121 PARAMS ((bfd *, PTR, int, int, int, int, PTR));
122static void xcoff64_swap_ldhdr_in
123 PARAMS ((bfd *, const PTR, struct internal_ldhdr *));
124static void xcoff64_swap_ldhdr_out
125 PARAMS ((bfd *, const struct internal_ldhdr *, PTR d));
126static void xcoff64_swap_ldsym_in
127 PARAMS ((bfd *, const PTR, struct internal_ldsym *));
128static void xcoff64_swap_ldsym_out
129 PARAMS ((bfd *, const struct internal_ldsym *, PTR d));
130static void xcoff64_swap_ldrel_in
131 PARAMS ((bfd *, const PTR, struct internal_ldrel *));
132static void xcoff64_swap_ldrel_out
133 PARAMS ((bfd *, const struct internal_ldrel *, PTR d));
134static boolean xcoff64_write_object_contents PARAMS ((bfd *));
135static boolean xcoff64_ppc_relocate_section
136 PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
54327882
AM
137 struct internal_reloc *, struct internal_syment *,
138 asection **));
dc810e39
AM
139static boolean xcoff64_slurp_armap PARAMS ((bfd *));
140static const bfd_target *xcoff64_archive_p PARAMS ((bfd *));
141static bfd *xcoff64_openr_next_archived_file PARAMS ((bfd *, bfd *));
142static int xcoff64_sizeof_headers PARAMS ((bfd *, boolean));
143static asection *xcoff64_create_csect_from_smclas
144 PARAMS ((bfd *, union internal_auxent *, const char *));
145static boolean xcoff64_is_lineno_count_overflow PARAMS ((bfd *, bfd_vma));
146static boolean xcoff64_is_reloc_count_overflow PARAMS ((bfd *, bfd_vma));
147static bfd_vma xcoff64_loader_symbol_offset
148 PARAMS ((bfd *, struct internal_ldhdr *));
149static bfd_vma xcoff64_loader_reloc_offset
150 PARAMS ((bfd *, struct internal_ldhdr *));
54327882 151static boolean xcoff64_generate_rtinit
eb1e0e80
NC
152 PARAMS ((bfd *, const char *, const char *, boolean));
153static boolean xcoff64_bad_format_hook PARAMS ((bfd *, PTR ));
dc810e39 154
f1f0d9ab
TR
155/* Relocation functions */
156static boolean xcoff64_reloc_type_br PARAMS ((XCOFF_RELOC_FUNCTION_ARGS));
157
158boolean (*xcoff64_calculate_relocation[XCOFF_MAX_CALCULATE_RELOCATION])
159 (XCOFF_RELOC_FUNCTION_ARGS) =
160{
161 xcoff_reloc_type_pos, /* R_POS (0x00) */
162 xcoff_reloc_type_neg, /* R_NEG (0x01) */
163 xcoff_reloc_type_rel, /* R_REL (0x02) */
164 xcoff_reloc_type_toc, /* R_TOC (0x03) */
165 xcoff_reloc_type_fail, /* R_RTB (0x04) */
166 xcoff_reloc_type_toc, /* R_GL (0x05) */
167 xcoff_reloc_type_toc, /* R_TCL (0x06) */
168 xcoff_reloc_type_fail, /* (0x07) */
169 xcoff_reloc_type_ba, /* R_BA (0x08) */
170 xcoff_reloc_type_fail, /* (0x09) */
171 xcoff64_reloc_type_br, /* R_BR (0x0a) */
172 xcoff_reloc_type_fail, /* (0x0b) */
173 xcoff_reloc_type_pos, /* R_RL (0x0c) */
174 xcoff_reloc_type_pos, /* R_RLA (0x0d) */
175 xcoff_reloc_type_fail, /* (0x0e) */
176 xcoff_reloc_type_noop, /* R_REF (0x0f) */
177 xcoff_reloc_type_fail, /* (0x10) */
178 xcoff_reloc_type_fail, /* (0x11) */
179 xcoff_reloc_type_toc, /* R_TRL (0x12) */
180 xcoff_reloc_type_toc, /* R_TRLA (0x13) */
181 xcoff_reloc_type_fail, /* R_RRTBI (0x14) */
182 xcoff_reloc_type_fail, /* R_RRTBA (0x15) */
183 xcoff_reloc_type_ba, /* R_CAI (0x16) */
184 xcoff_reloc_type_crel, /* R_CREL (0x17) */
185 xcoff_reloc_type_ba, /* R_RBA (0x18) */
186 xcoff_reloc_type_ba, /* R_RBAC (0x19) */
187 xcoff64_reloc_type_br, /* R_RBR (0x1a) */
188 xcoff_reloc_type_ba, /* R_RBRC (0x1b) */
189};
190
eb1e0e80 191/* coffcode.h needs these to be defined. */
dc810e39
AM
192/* Internalcoff.h and coffcode.h modify themselves based on these flags. */
193#define XCOFF64
194#define RS6000COFF_C 1
195
196#define SELECT_RELOC(internal, howto) \
197 { \
198 internal.r_type = howto->type; \
199 internal.r_size = \
200 ((howto->complain_on_overflow == complain_overflow_signed \
201 ? 0x80 \
202 : 0) \
203 | (howto->bitsize - 1)); \
204 }
814fa6ab 205
dc810e39
AM
206#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3)
207#define COFF_LONG_FILENAMES
208#define NO_COFF_SYMBOLS
209#define RTYPE2HOWTO(cache_ptr, dst) xcoff64_rtype2howto (cache_ptr, dst)
210#define coff_mkobject _bfd_xcoff_mkobject
211#define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data
212#define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name
213#define coff_bfd_reloc_type_lookup xcoff64_reloc_type_lookup
214#ifdef AIX_CORE
69f284c7 215extern const bfd_target * rs6000coff_core_p PARAMS ((bfd *abfd));
54327882 216extern boolean rs6000coff_core_file_matches_executable_p
69f284c7 217 PARAMS((bfd *cbfd, bfd *ebfd));
dc810e39
AM
218extern char *rs6000coff_core_file_failing_command PARAMS ((bfd *abfd));
219extern int rs6000coff_core_file_failing_signal PARAMS ((bfd *abfd));
220#define CORE_FILE_P rs6000coff_core_p
221#define coff_core_file_failing_command \
222 rs6000coff_core_file_failing_command
223#define coff_core_file_failing_signal \
224 rs6000coff_core_file_failing_signal
225#define coff_core_file_matches_executable_p \
226 rs6000coff_core_file_matches_executable_p
227#else
228#define CORE_FILE_P _bfd_dummy_target
229#define coff_core_file_failing_command \
230 _bfd_nocore_core_file_failing_command
231#define coff_core_file_failing_signal \
232 _bfd_nocore_core_file_failing_signal
233#define coff_core_file_matches_executable_p \
234 _bfd_nocore_core_file_matches_executable_p
235#endif
236#define coff_SWAP_sym_in _bfd_xcoff64_swap_sym_in
237#define coff_SWAP_sym_out _bfd_xcoff64_swap_sym_out
238#define coff_SWAP_aux_in _bfd_xcoff64_swap_aux_in
239#define coff_SWAP_aux_out _bfd_xcoff64_swap_aux_out
59862849
TR
240#define coff_swap_reloc_in xcoff64_swap_reloc_in
241#define coff_swap_reloc_out xcoff64_swap_reloc_out
242#define NO_COFF_RELOCS
dc810e39
AM
243
244#include "coffcode.h"
245
246/* For XCOFF64, the effective width of symndx changes depending on
7f6d05e8
CP
247 whether we are the first entry. Sigh. */
248static void
beb1bf64 249_bfd_xcoff64_swap_lineno_in (abfd, ext1, in1)
dc810e39 250 bfd *abfd;
7f6d05e8
CP
251 PTR ext1;
252 PTR in1;
253{
dc810e39
AM
254 LINENO *ext = (LINENO *) ext1;
255 struct internal_lineno *in = (struct internal_lineno *) in1;
7f6d05e8 256
dc810e39 257 in->l_lnno = H_GET_32 (abfd, (ext->l_lnno));
7f6d05e8 258 if (in->l_lnno == 0)
dc810e39 259 in->l_addr.l_symndx = H_GET_32 (abfd, ext->l_addr.l_symndx);
7f6d05e8 260 else
dc810e39 261 in->l_addr.l_paddr = H_GET_64 (abfd, ext->l_addr.l_paddr);
7f6d05e8
CP
262}
263
264static unsigned int
beb1bf64 265_bfd_xcoff64_swap_lineno_out (abfd, inp, outp)
dc810e39
AM
266 bfd *abfd;
267 PTR inp;
268 PTR outp;
7f6d05e8 269{
dc810e39
AM
270 struct internal_lineno *in = (struct internal_lineno *) inp;
271 struct external_lineno *ext = (struct external_lineno *) outp;
272
273 H_PUT_32 (abfd, in->l_addr.l_symndx, ext->l_addr.l_symndx);
274 H_PUT_32 (abfd, in->l_lnno, (ext->l_lnno));
7f6d05e8 275
7f6d05e8 276 if (in->l_lnno == 0)
dc810e39 277 H_PUT_32 (abfd, in->l_addr.l_symndx, ext->l_addr.l_symndx);
7f6d05e8 278 else
dc810e39 279 H_PUT_64 (abfd, in->l_addr.l_paddr, ext->l_addr.l_paddr);
7f6d05e8
CP
280
281 return bfd_coff_linesz (abfd);
282}
283
7f6d05e8 284static void
beb1bf64 285_bfd_xcoff64_swap_sym_in (abfd, ext1, in1)
dc810e39 286 bfd *abfd;
7f6d05e8
CP
287 PTR ext1;
288 PTR in1;
289{
dc810e39
AM
290 struct external_syment *ext = (struct external_syment *) ext1;
291 struct internal_syment *in = (struct internal_syment *) in1;
7f6d05e8 292
7f6d05e8 293 in->_n._n_n._n_zeroes = 0;
dc810e39
AM
294 in->_n._n_n._n_offset = H_GET_32 (abfd, ext->e_offset);
295 in->n_value = H_GET_64 (abfd, ext->e_value);
296 in->n_scnum = H_GET_16 (abfd, ext->e_scnum);
297 in->n_type = H_GET_16 (abfd, ext->e_type);
298 in->n_sclass = H_GET_8 (abfd, ext->e_sclass);
299 in->n_numaux = H_GET_8 (abfd, ext->e_numaux);
7f6d05e8
CP
300}
301
302static unsigned int
beb1bf64 303_bfd_xcoff64_swap_sym_out (abfd, inp, extp)
dc810e39
AM
304 bfd *abfd;
305 PTR inp;
306 PTR extp;
7f6d05e8 307{
dc810e39
AM
308 struct internal_syment *in = (struct internal_syment *) inp;
309 struct external_syment *ext = (struct external_syment *) extp;
310
311 H_PUT_32 (abfd, in->_n._n_n._n_offset, ext->e_offset);
312 H_PUT_64 (abfd, in->n_value, ext->e_value);
313 H_PUT_16 (abfd, in->n_scnum, ext->e_scnum);
314 H_PUT_16 (abfd, in->n_type, ext->e_type);
315 H_PUT_8 (abfd, in->n_sclass, ext->e_sclass);
316 H_PUT_8 (abfd, in->n_numaux, ext->e_numaux);
7f6d05e8
CP
317 return bfd_coff_symesz (abfd);
318}
319
320static void
beb1bf64 321_bfd_xcoff64_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
dc810e39
AM
322 bfd *abfd;
323 PTR ext1;
324 int type;
325 int class;
326 int indx;
327 int numaux;
328 PTR in1;
7f6d05e8 329{
dc810e39
AM
330 union external_auxent *ext = (union external_auxent *) ext1;
331 union internal_auxent *in = (union internal_auxent *) in1;
7f6d05e8 332
dc810e39
AM
333 switch (class)
334 {
7f6d05e8 335 case C_FILE:
deeb2cd7 336 if (ext->x_file.x_n.x_zeroes[0] == 0)
dc810e39 337 {
7f6d05e8 338 in->x_file.x_n.x_zeroes = 0;
dc810e39
AM
339 in->x_file.x_n.x_offset = H_GET_32 (abfd, ext->x_file.x_n.x_offset);
340 }
341 else
342 {
beb1bf64
TR
343 memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN);
344 }
7f6d05e8
CP
345 goto end;
346
347 /* RS/6000 "csect" auxents */
348 case C_EXT:
349 case C_HIDEXT:
350 if (indx + 1 == numaux)
351 {
beb1bf64
TR
352 bfd_signed_vma h = 0;
353 bfd_vma l = 0;
354
dc810e39
AM
355 h = H_GET_S32 (abfd, ext->x_csect.x_scnlen_hi);
356 l = H_GET_32 (abfd, ext->x_csect.x_scnlen_lo);
beb1bf64
TR
357
358 in->x_csect.x_scnlen.l = h << 32 | (l & 0xffffffff);
359
dc810e39
AM
360 in->x_csect.x_parmhash = H_GET_32 (abfd, ext->x_csect.x_parmhash);
361 in->x_csect.x_snhash = H_GET_16 (abfd, ext->x_csect.x_snhash);
7f6d05e8
CP
362 /* We don't have to hack bitfields in x_smtyp because it's
363 defined by shifts-and-ands, which are equivalent on all
364 byte orders. */
dc810e39
AM
365 in->x_csect.x_smtyp = H_GET_8 (abfd, ext->x_csect.x_smtyp);
366 in->x_csect.x_smclas = H_GET_8 (abfd, ext->x_csect.x_smclas);
7f6d05e8
CP
367 goto end;
368 }
369 break;
370
371 case C_STAT:
372 case C_LEAFSTAT:
373 case C_HIDDEN:
dc810e39
AM
374 if (type == T_NULL)
375 {
7f6d05e8 376 /* PE defines some extra fields; we zero them out for
dc810e39 377 safety. */
7f6d05e8
CP
378 in->x_scn.x_checksum = 0;
379 in->x_scn.x_associated = 0;
380 in->x_scn.x_comdat = 0;
381
382 goto end;
383 }
384 break;
385 }
386
387 if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class))
388 {
dc810e39
AM
389 in->x_sym.x_fcnary.x_fcn.x_lnnoptr
390 = H_GET_64 (abfd, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr);
391 in->x_sym.x_fcnary.x_fcn.x_endndx.l
392 = H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_endndx);
393 }
394 if (ISFCN (type))
395 {
396 in->x_sym.x_misc.x_fsize
397 = H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_fsize);
398 }
399 else
400 {
401 in->x_sym.x_misc.x_lnsz.x_lnno
402 = H_GET_32 (abfd, ext->x_sym.x_fcnary.x_lnsz.x_lnno);
403 in->x_sym.x_misc.x_lnsz.x_size
404 = H_GET_16 (abfd, ext->x_sym.x_fcnary.x_lnsz.x_size);
7f6d05e8 405 }
7f6d05e8 406
dc810e39 407 end: ;
7f6d05e8
CP
408}
409
7f6d05e8 410static unsigned int
beb1bf64 411_bfd_xcoff64_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
dc810e39
AM
412 bfd *abfd;
413 PTR inp;
414 int type;
415 int class;
416 int indx ATTRIBUTE_UNUSED;
417 int numaux ATTRIBUTE_UNUSED;
418 PTR extp;
7f6d05e8 419{
dc810e39
AM
420 union internal_auxent *in = (union internal_auxent *) inp;
421 union external_auxent *ext = (union external_auxent *) extp;
7f6d05e8 422
dc810e39 423 memset ((PTR) ext, 0, bfd_coff_auxesz (abfd));
7f6d05e8
CP
424 switch (class)
425 {
dc810e39 426 case C_FILE:
a58d9c34 427 if (in->x_file.x_n.x_zeroes == 0)
dc810e39
AM
428 {
429 H_PUT_32 (abfd, 0, ext->x_file.x_n.x_zeroes);
430 H_PUT_32 (abfd, in->x_file.x_n.x_offset, ext->x_file.x_n.x_offset);
431 }
432 else
433 {
434 memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN);
435 }
436 H_PUT_8 (abfd, _AUX_FILE, ext->x_auxtype.x_auxtype);
7f6d05e8 437 goto end;
dc810e39
AM
438
439 /* RS/6000 "csect" auxents */
440 case C_EXT:
441 case C_HIDEXT:
442 if (indx + 1 == numaux)
443 {
444 bfd_vma temp;
445
446 temp = in->x_csect.x_scnlen.l & 0xffffffff;
447 H_PUT_32 (abfd, temp, ext->x_csect.x_scnlen_lo);
448 temp = in->x_csect.x_scnlen.l >> 32;
449 H_PUT_32 (abfd, temp, ext->x_csect.x_scnlen_hi);
450 H_PUT_32 (abfd, in->x_csect.x_parmhash, ext->x_csect.x_parmhash);
451 H_PUT_16 (abfd, in->x_csect.x_snhash, ext->x_csect.x_snhash);
452 /* We don't have to hack bitfields in x_smtyp because it's
453 defined by shifts-and-ands, which are equivalent on all
454 byte orders. */
455 H_PUT_8 (abfd, in->x_csect.x_smtyp, ext->x_csect.x_smtyp);
456 H_PUT_8 (abfd, in->x_csect.x_smclas, ext->x_csect.x_smclas);
457 H_PUT_8 (abfd, _AUX_CSECT, ext->x_auxtype.x_auxtype);
458 goto end;
459 }
460 break;
461
462 case C_STAT:
463 case C_LEAFSTAT:
464 case C_HIDDEN:
465 if (type == T_NULL)
466 {
467 goto end;
468 }
469 break;
7f6d05e8 470 }
7f6d05e8
CP
471
472 if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class))
473 {
dc810e39
AM
474 H_PUT_64 (abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr,
475 ext->x_sym.x_fcnary.x_fcn.x_lnnoptr);
476 H_PUT_8 (abfd, _AUX_FCN,
477 ext->x_auxtype.x_auxtype);
478 H_PUT_32 (abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l,
479 ext->x_sym.x_fcnary.x_fcn.x_endndx);
7f6d05e8
CP
480 }
481 if (ISFCN (type))
dc810e39
AM
482 {
483 H_PUT_32 (abfd, in->x_sym.x_misc.x_fsize,
484 ext->x_sym.x_fcnary.x_fcn.x_fsize);
485 }
7f6d05e8
CP
486 else
487 {
dc810e39
AM
488 H_PUT_32 (abfd, in->x_sym.x_misc.x_lnsz.x_lnno,
489 ext->x_sym.x_fcnary.x_lnsz.x_lnno);
490 H_PUT_16 (abfd, in->x_sym.x_misc.x_lnsz.x_size,
491 ext->x_sym.x_fcnary.x_lnsz.x_size);
7f6d05e8
CP
492 }
493
dc810e39 494 end:
beb1bf64 495
7f6d05e8
CP
496 return bfd_coff_auxesz (abfd);
497}
498
beb1bf64 499static boolean
eb1e0e80
NC
500_bfd_xcoff64_put_symbol_name (abfd, strtab, sym, name)
501 bfd *abfd;
502 struct bfd_strtab_hash *strtab;
503 struct internal_syment *sym;
504 const char *name;
505{
beb1bf64
TR
506 boolean hash;
507 bfd_size_type indx;
dc810e39 508
beb1bf64 509 hash = true;
dc810e39 510
beb1bf64
TR
511 if ((abfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
512 hash = false;
dc810e39 513
beb1bf64 514 indx = _bfd_stringtab_add (strtab, name, hash, false);
dc810e39 515
beb1bf64
TR
516 if (indx == (bfd_size_type) -1)
517 return false;
dc810e39 518
beb1bf64
TR
519 sym->_n._n_n._n_zeroes = 0;
520 sym->_n._n_n._n_offset = STRING_SIZE_SIZE + indx;
dc810e39 521
beb1bf64
TR
522 return true;
523}
524
525static boolean
526_bfd_xcoff64_put_ldsymbol_name (abfd, ldinfo, ldsym, name)
527 bfd *abfd ATTRIBUTE_UNUSED;
dc810e39
AM
528 struct xcoff_loader_info *ldinfo;
529 struct internal_ldsym *ldsym;
530 const char *name;
beb1bf64 531{
beb1bf64
TR
532 size_t len;
533 len = strlen (name);
534
dc810e39
AM
535 if (ldinfo->string_size + len + 3 > ldinfo->string_alc)
536 {
537 bfd_size_type newalc;
538 bfd_byte *newstrings;
539
540 newalc = ldinfo->string_alc * 2;
541 if (newalc == 0)
542 newalc = 32;
543 while (ldinfo->string_size + len + 3 > newalc)
544 newalc *= 2;
545
546 newstrings = ((bfd_byte *)
547 bfd_realloc ((PTR) ldinfo->strings, newalc));
548 if (newstrings == NULL)
549 {
550 ldinfo->failed = true;
551 return false;
552 }
553 ldinfo->string_alc = newalc;
554 ldinfo->strings = newstrings;
beb1bf64 555 }
dc810e39
AM
556
557 bfd_put_16 (ldinfo->output_bfd, (bfd_vma) (len + 1),
beb1bf64
TR
558 ldinfo->strings + ldinfo->string_size);
559 strcpy (ldinfo->strings + ldinfo->string_size + 2, name);
560 ldsym->_l._l_l._l_zeroes = 0;
561 ldsym->_l._l_l._l_offset = ldinfo->string_size + 2;
562 ldinfo->string_size += len + 3;
dc810e39 563
beb1bf64
TR
564 return true;
565}
566
beb1bf64
TR
567/* Routines to swap information in the XCOFF .loader section. If we
568 ever need to write an XCOFF loader, this stuff will need to be
569 moved to another file shared by the linker (which XCOFF calls the
570 ``binder'') and the loader. */
571
572/* Swap in the ldhdr structure. */
573
574static void
814fa6ab
AM
575xcoff64_swap_ldhdr_in (abfd, s, dst)
576 bfd *abfd;
577 const PTR s;
578 struct internal_ldhdr *dst;
579{
580 const struct external_ldhdr *src = (const struct external_ldhdr *) s;
581
beb1bf64
TR
582 dst->l_version = bfd_get_32 (abfd, src->l_version);
583 dst->l_nsyms = bfd_get_32 (abfd, src->l_nsyms);
584 dst->l_nreloc = bfd_get_32 (abfd, src->l_nreloc);
585 dst->l_istlen = bfd_get_32 (abfd, src->l_istlen);
586 dst->l_nimpid = bfd_get_32 (abfd, src->l_nimpid);
587 dst->l_stlen = bfd_get_32 (abfd, src->l_stlen);
588 dst->l_impoff = bfd_get_64 (abfd, src->l_impoff);
589 dst->l_stoff = bfd_get_64 (abfd, src->l_stoff);
590 dst->l_symoff = bfd_get_64 (abfd, src->l_symoff);
591 dst->l_rldoff = bfd_get_64 (abfd, src->l_rldoff);
592}
593
594/* Swap out the ldhdr structure. */
595
596static void
814fa6ab 597xcoff64_swap_ldhdr_out (abfd, src, d)
beb1bf64
TR
598 bfd *abfd;
599 const struct internal_ldhdr *src;
814fa6ab 600 PTR d;
beb1bf64 601{
814fa6ab
AM
602 struct external_ldhdr *dst = (struct external_ldhdr *) d;
603
dc810e39 604 bfd_put_32 (abfd, (bfd_vma) src->l_version, dst->l_version);
beb1bf64
TR
605 bfd_put_32 (abfd, src->l_nsyms, dst->l_nsyms);
606 bfd_put_32 (abfd, src->l_nreloc, dst->l_nreloc);
607 bfd_put_32 (abfd, src->l_istlen, dst->l_istlen);
608 bfd_put_32 (abfd, src->l_nimpid, dst->l_nimpid);
609 bfd_put_32 (abfd, src->l_stlen, dst->l_stlen);
610 bfd_put_64 (abfd, src->l_impoff, dst->l_impoff);
611 bfd_put_64 (abfd, src->l_stoff, dst->l_stoff);
612 bfd_put_64 (abfd, src->l_symoff, dst->l_symoff);
613 bfd_put_64 (abfd, src->l_rldoff, dst->l_rldoff);
614}
615
616/* Swap in the ldsym structure. */
617
618static void
814fa6ab 619xcoff64_swap_ldsym_in (abfd, s, dst)
beb1bf64 620 bfd *abfd;
814fa6ab 621 const PTR s;
beb1bf64
TR
622 struct internal_ldsym *dst;
623{
814fa6ab 624 const struct external_ldsym *src = (const struct external_ldsym *) s;
dc810e39
AM
625 /* XCOFF64 does not use l_zeroes like XCOFF32
626 Set the internal l_zeroes to 0 so the common 32/64 code uses l_value
627 as an offset into the loader symbol table. */
beb1bf64
TR
628 dst->_l._l_l._l_zeroes = 0;
629 dst->_l._l_l._l_offset = bfd_get_32 (abfd, src->l_offset);
630 dst->l_value = bfd_get_64 (abfd, src->l_value);
631 dst->l_scnum = bfd_get_16 (abfd, src->l_scnum);
632 dst->l_smtype = bfd_get_8 (abfd, src->l_smtype);
633 dst->l_smclas = bfd_get_8 (abfd, src->l_smclas);
634 dst->l_ifile = bfd_get_32 (abfd, src->l_ifile);
635 dst->l_parm = bfd_get_32 (abfd, src->l_parm);
636}
637
638/* Swap out the ldsym structure. */
639
640static void
814fa6ab 641xcoff64_swap_ldsym_out (abfd, src, d)
beb1bf64
TR
642 bfd *abfd;
643 const struct internal_ldsym *src;
814fa6ab 644 PTR d;
beb1bf64 645{
814fa6ab
AM
646 struct external_ldsym *dst = (struct external_ldsym *) d;
647
beb1bf64 648 bfd_put_64 (abfd, src->l_value, dst->l_value);
dc810e39
AM
649 bfd_put_32 (abfd, (bfd_vma) src->_l._l_l._l_offset, dst->l_offset);
650 bfd_put_16 (abfd, (bfd_vma) src->l_scnum, dst->l_scnum);
beb1bf64
TR
651 bfd_put_8 (abfd, src->l_smtype, dst->l_smtype);
652 bfd_put_8 (abfd, src->l_smclas, dst->l_smclas);
653 bfd_put_32 (abfd, src->l_ifile, dst->l_ifile);
654 bfd_put_32 (abfd, src->l_parm, dst->l_parm);
655}
656
59862849
TR
657static void
658xcoff64_swap_reloc_in (abfd, s, d)
659 bfd *abfd;
660 PTR s;
661 PTR d;
662{
663 struct external_reloc *src = (struct external_reloc *) s;
664 struct internal_reloc *dst = (struct internal_reloc *) d;
665
666 memset (dst, 0, sizeof (struct internal_reloc));
667
668 dst->r_vaddr = bfd_get_64 (abfd, src->r_vaddr);
669 dst->r_symndx = bfd_get_32 (abfd, src->r_symndx);
670 dst->r_size = bfd_get_8 (abfd, src->r_size);
671 dst->r_type = bfd_get_8 (abfd, src->r_type);
672}
673
674static unsigned int
675xcoff64_swap_reloc_out (abfd, s, d)
676 bfd *abfd;
677 PTR s;
678 PTR d;
679{
680 struct internal_reloc *src = (struct internal_reloc *) s;
681 struct external_reloc *dst = (struct external_reloc *) d;
682
683 bfd_put_64 (abfd, src->r_vaddr, dst->r_vaddr);
684 bfd_put_32 (abfd, src->r_symndx, dst->r_symndx);
685 bfd_put_8 (abfd, src->r_type, dst->r_type);
686 bfd_put_8 (abfd, src->r_size, dst->r_size);
687
688 return bfd_coff_relsz (abfd);
689}
690
beb1bf64
TR
691/* Swap in the ldrel structure. */
692
693static void
814fa6ab 694xcoff64_swap_ldrel_in (abfd, s, dst)
beb1bf64 695 bfd *abfd;
814fa6ab 696 const PTR s;
beb1bf64
TR
697 struct internal_ldrel *dst;
698{
814fa6ab
AM
699 const struct external_ldrel *src = (const struct external_ldrel *) s;
700
beb1bf64
TR
701 dst->l_vaddr = bfd_get_64 (abfd, src->l_vaddr);
702 dst->l_symndx = bfd_get_32 (abfd, src->l_symndx);
703 dst->l_rtype = bfd_get_16 (abfd, src->l_rtype);
704 dst->l_rsecnm = bfd_get_16 (abfd, src->l_rsecnm);
705}
706
707/* Swap out the ldrel structure. */
708
709static void
814fa6ab 710xcoff64_swap_ldrel_out (abfd, src, d)
beb1bf64
TR
711 bfd *abfd;
712 const struct internal_ldrel *src;
814fa6ab 713 PTR d;
beb1bf64 714{
814fa6ab
AM
715 struct external_ldrel *dst = (struct external_ldrel *) d;
716
beb1bf64 717 bfd_put_64 (abfd, src->l_vaddr, dst->l_vaddr);
dc810e39
AM
718 bfd_put_16 (abfd, (bfd_vma) src->l_rtype, dst->l_rtype);
719 bfd_put_16 (abfd, (bfd_vma) src->l_rsecnm, dst->l_rsecnm);
beb1bf64
TR
720 bfd_put_32 (abfd, src->l_symndx, dst->l_symndx);
721}
722
723static boolean
724xcoff64_write_object_contents (abfd)
725 bfd * abfd;
726{
727 asection *current;
728 boolean hasrelocs = false;
729 boolean haslinno = false;
730 file_ptr scn_base;
731 file_ptr reloc_base;
732 file_ptr lineno_base;
733 file_ptr sym_base;
734 unsigned long reloc_size = 0;
735 unsigned long lnno_size = 0;
736 boolean long_section_names;
dc810e39
AM
737 asection *text_sec = ((void *) 0);
738 asection *data_sec = ((void *) 0);
739 asection *bss_sec = ((void *) 0);
beb1bf64
TR
740 struct internal_filehdr internal_f;
741 struct internal_aouthdr internal_a;
742
743 bfd_set_error (bfd_error_system_call);
744
82e51918 745 if (! abfd->output_has_begun)
dc810e39
AM
746 {
747 if (! bfd_coff_compute_section_file_positions (abfd))
748 return false;
749 }
beb1bf64 750
eb1e0e80 751 /* Work out the size of the reloc and linno areas. */
beb1bf64
TR
752 reloc_base = obj_relocbase (abfd);
753
dc810e39 754 for (current = abfd->sections; current != NULL; current = current->next)
beb1bf64 755 reloc_size += current->reloc_count * bfd_coff_relsz (abfd);
beb1bf64
TR
756
757 lineno_base = reloc_base + reloc_size;
758
759 /* Make a pass through the symbol table to count line number entries and
eb1e0e80 760 put them into the correct asections. */
beb1bf64
TR
761 lnno_size = coff_count_linenumbers (abfd) * bfd_coff_linesz (abfd);
762
763 sym_base = lineno_base + lnno_size;
764
eb1e0e80 765 /* Indicate in each section->line_filepos its actual file address. */
dc810e39
AM
766 for (current = abfd->sections; current != NULL; current = current->next)
767 {
768 if (current->lineno_count)
769 {
770 current->line_filepos = lineno_base;
771 current->moving_line_filepos = lineno_base;
772 lineno_base += current->lineno_count * bfd_coff_linesz (abfd);
773 }
774 else
775 {
776 current->line_filepos = 0;
777 }
778
779 if (current->reloc_count)
780 {
781 current->rel_filepos = reloc_base;
782 reloc_base += current->reloc_count * bfd_coff_relsz (abfd);
783 }
784 else
785 {
786 current->rel_filepos = 0;
787 }
788 }
789
790 if ((abfd->flags & EXEC_P) != 0)
791 {
792 scn_base = bfd_coff_filhsz (abfd) + bfd_coff_aoutsz (abfd);
793 internal_f.f_opthdr = bfd_coff_aoutsz (abfd);
beb1bf64 794 }
dc810e39
AM
795 else
796 {
797 scn_base = bfd_coff_filhsz (abfd);
798 internal_f.f_opthdr = 0;
beb1bf64 799 }
beb1bf64
TR
800
801 internal_f.f_nscns = 0;
802
803 if (bfd_seek (abfd, scn_base, SEEK_SET) != 0)
804 return false;
805
806 long_section_names = false;
dc810e39
AM
807 for (current = abfd->sections; current != NULL; current = current->next)
808 {
809 struct internal_scnhdr section;
810 struct external_scnhdr buff;
811 bfd_size_type amount;
beb1bf64 812
dc810e39 813 internal_f.f_nscns++;
beb1bf64 814
dc810e39 815 strncpy (section.s_name, current->name, SCNNMLEN);
beb1bf64 816
dc810e39
AM
817 section.s_vaddr = current->vma;
818 section.s_paddr = current->lma;
819 section.s_size = current->_raw_size;
beb1bf64 820
dc810e39
AM
821 /* If this section has no size or is unloadable then the scnptr
822 will be 0 too. */
823 if (current->_raw_size == 0
824 || (current->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0)
825 {
826 section.s_scnptr = 0;
827 }
828 else
829 {
830 section.s_scnptr = current->filepos;
831 }
832
833 section.s_relptr = current->rel_filepos;
834 section.s_lnnoptr = current->line_filepos;
835 section.s_nreloc = current->reloc_count;
836
837 section.s_nlnno = current->lineno_count;
838 if (current->reloc_count != 0)
839 hasrelocs = true;
840 if (current->lineno_count != 0)
841 haslinno = true;
beb1bf64 842
dc810e39
AM
843 section.s_flags = sec_to_styp_flags (current->name, current->flags);
844
845 if (!strcmp (current->name, _TEXT))
846 {
847 text_sec = current;
848 }
849 else if (!strcmp (current->name, _DATA))
850 {
851 data_sec = current;
852 }
853 else if (!strcmp (current->name, _BSS))
854 {
855 bss_sec = current;
856 }
857
858 amount = bfd_coff_scnhsz (abfd);
859 if (bfd_coff_swap_scnhdr_out (abfd, &section, &buff) == 0
860 || bfd_bwrite ((PTR) (&buff), amount, abfd) != amount)
beb1bf64 861 return false;
dc810e39 862 }
beb1bf64
TR
863
864 internal_f.f_timdat = 0;
865
866 internal_f.f_flags = 0;
867
868 if (!hasrelocs)
869 internal_f.f_flags |= F_RELFLG;
870 if (!haslinno)
871 internal_f.f_flags |= F_LNNO;
872 if (abfd->flags & EXEC_P)
873 internal_f.f_flags |= F_EXEC;
874
eb1e0e80 875 /* FIXME: this is wrong for PPC_PE! */
beb1bf64
TR
876 if (bfd_little_endian (abfd))
877 internal_f.f_flags |= F_AR32WR;
878 else
879 internal_f.f_flags |= F_AR32W;
880
881 if ((abfd->flags & DYNAMIC) != 0)
882 internal_f.f_flags |= F_SHROBJ;
883 if (bfd_get_section_by_name (abfd, _LOADER) != NULL)
884 internal_f.f_flags |= F_DYNLOAD;
885
886 memset (&internal_a, 0, sizeof internal_a);
887
eb1e0e80 888 internal_f.f_magic = bfd_xcoff_magic_number (abfd);
beb1bf64
TR
889 internal_a.magic = (abfd->flags & D_PAGED) ? RS6K_AOUTHDR_ZMAGIC :
890 (abfd->flags & WP_TEXT) ? RS6K_AOUTHDR_NMAGIC :
891 RS6K_AOUTHDR_OMAGIC;
892
893 /* FIXME: Does anybody ever set this to another value? */
894 internal_a.vstamp = 0;
895
eb1e0e80 896 /* Now should write relocs, strings, syms. */
beb1bf64
TR
897 obj_sym_filepos (abfd) = sym_base;
898
899 internal_f.f_symptr = 0;
900 internal_f.f_nsyms = 0;
901
dc810e39
AM
902 /* If bfd_get_symcount (abfd) != 0, then we are not using the COFF
903 backend linker, and obj_raw_syment_count is not valid until after
904 coff_write_symbols is called. */
905 if (bfd_get_symcount (abfd) != 0)
906 {
907 int firstundef;
beb1bf64 908
dc810e39
AM
909 if (!coff_renumber_symbols (abfd, &firstundef))
910 return false;
911 coff_mangle_symbols (abfd);
912 if (! coff_write_symbols (abfd))
913 return false;
914 if (! coff_write_linenumbers (abfd))
915 return false;
916 if (! coff_write_relocs (abfd, firstundef))
917 return false;
beb1bf64 918
dc810e39
AM
919 internal_f.f_symptr = sym_base;
920 internal_f.f_nsyms = bfd_get_symcount (abfd);
921 }
922 else if (obj_raw_syment_count (abfd) != 0)
923 {
924 internal_f.f_symptr = sym_base;
925
926 /* AIX appears to require that F_RELFLG not be set if there are
927 local symbols but no relocations. */
928 internal_f.f_flags &=~ F_RELFLG;
929 }
930 else
931 {
932 internal_f.f_flags |= F_LSYMS;
933 }
beb1bf64 934
dc810e39
AM
935 if (text_sec)
936 {
937 internal_a.tsize = bfd_get_section_size_before_reloc (text_sec);
beb1bf64 938 internal_a.text_start = internal_a.tsize ? text_sec->vma : 0;
dc810e39 939 }
beb1bf64 940
dc810e39
AM
941 if (data_sec)
942 {
943 internal_a.dsize = bfd_get_section_size_before_reloc (data_sec);
944 internal_a.data_start = internal_a.dsize ? data_sec->vma : 0;
945 }
beb1bf64 946
dc810e39
AM
947 if (bss_sec)
948 {
949 internal_a.bsize = bfd_get_section_size_before_reloc (bss_sec);
950 if (internal_a.bsize && bss_sec->vma < internal_a.data_start)
951 internal_a.data_start = bss_sec->vma;
952 }
beb1bf64
TR
953
954 internal_a.entry = bfd_get_start_address (abfd);
955 internal_f.f_nsyms = obj_raw_syment_count (abfd);
956
dc810e39
AM
957 if (xcoff_data (abfd)->full_aouthdr)
958 {
beb1bf64
TR
959 bfd_vma toc;
960 asection *loader_sec;
961
962 internal_a.vstamp = 1;
963
964 internal_a.o_snentry = xcoff_data (abfd)->snentry;
965 if (internal_a.o_snentry == 0)
966 internal_a.entry = (bfd_vma) -1;
967
dc810e39
AM
968 if (text_sec != NULL)
969 {
beb1bf64
TR
970 internal_a.o_sntext = text_sec->target_index;
971 internal_a.o_algntext = bfd_get_section_alignment (abfd, text_sec);
dc810e39
AM
972 }
973 else
974 {
975 internal_a.o_sntext = 0;
976 internal_a.o_algntext = 0;
977 }
978
979 if (data_sec != NULL)
980 {
981 internal_a.o_sndata = data_sec->target_index;
982 internal_a.o_algndata = bfd_get_section_alignment (abfd, data_sec);
983 }
984 else
985 {
986 internal_a.o_sndata = 0;
987 internal_a.o_algndata = 0;
988 }
beb1bf64
TR
989
990 loader_sec = bfd_get_section_by_name (abfd, ".loader");
991 if (loader_sec != NULL)
992 internal_a.o_snloader = loader_sec->target_index;
993 else
994 internal_a.o_snloader = 0;
995 if (bss_sec != NULL)
996 internal_a.o_snbss = bss_sec->target_index;
997 else
998 internal_a.o_snbss = 0;
999
1000 toc = xcoff_data (abfd)->toc;
1001 internal_a.o_toc = toc;
1002 internal_a.o_sntoc = xcoff_data (abfd)->sntoc;
1003
1004 internal_a.o_modtype = xcoff_data (abfd)->modtype;
1005 if (xcoff_data (abfd)->cputype != -1)
1006 internal_a.o_cputype = xcoff_data (abfd)->cputype;
1007 else
1008 {
1009 switch (bfd_get_arch (abfd))
1010 {
1011 case bfd_arch_rs6000:
1012 internal_a.o_cputype = 4;
1013 break;
1014 case bfd_arch_powerpc:
1015 if (bfd_get_mach (abfd) == 0)
1016 internal_a.o_cputype = 3;
1017 else
1018 internal_a.o_cputype = 1;
1019 break;
1020 default:
1021 abort ();
1022 }
1023 }
1024 internal_a.o_maxstack = xcoff_data (abfd)->maxstack;
1025 internal_a.o_maxdata = xcoff_data (abfd)->maxdata;
dc810e39
AM
1026 }
1027
1028 if (bfd_seek (abfd, (file_ptr) 0, 0) != 0)
beb1bf64 1029 return false;
dc810e39 1030
beb1bf64
TR
1031 {
1032 char * buff;
dc810e39
AM
1033 bfd_size_type amount = bfd_coff_filhsz (abfd);
1034
1035 buff = bfd_malloc (amount);
1036 if (buff == NULL)
beb1bf64 1037 return false;
dc810e39
AM
1038
1039 bfd_coff_swap_filehdr_out (abfd, (PTR) &internal_f, (PTR) buff);
1040 amount = bfd_bwrite ((PTR) buff, amount, abfd);
1041
beb1bf64 1042 free (buff);
dc810e39 1043
beb1bf64
TR
1044 if (amount != bfd_coff_filhsz (abfd))
1045 return false;
1046 }
beb1bf64 1047
dc810e39
AM
1048 if (abfd->flags & EXEC_P)
1049 {
1050 char * buff;
1051 bfd_size_type amount = bfd_coff_aoutsz (abfd);
beb1bf64 1052
dc810e39
AM
1053 buff = bfd_malloc (amount);
1054 if (buff == NULL)
1055 return false;
beb1bf64 1056
dc810e39
AM
1057 bfd_coff_swap_aouthdr_out (abfd, (PTR) & internal_a, (PTR) buff);
1058 amount = bfd_bwrite ((PTR) buff, amount, abfd);
1059
1060 free (buff);
beb1bf64 1061
dc810e39
AM
1062 if (amount != bfd_coff_aoutsz (abfd))
1063 return false;
1064 }
beb1bf64
TR
1065
1066 return true;
1067}
1068
f1f0d9ab
TR
1069static boolean
1070xcoff64_reloc_type_br (input_bfd, input_section, output_bfd, rel, sym, howto,
1071 val, addend, relocation, contents)
1072 bfd *input_bfd;
1073 asection *input_section;
1074 bfd *output_bfd ATTRIBUTE_UNUSED;
1075 struct internal_reloc *rel;
1076 struct internal_syment *sym ATTRIBUTE_UNUSED;
1077 struct reloc_howto_struct *howto;
1078 bfd_vma val;
1079 bfd_vma addend;
1080 bfd_vma *relocation;
1081 bfd_byte *contents;
1082{
1083 struct xcoff_link_hash_entry *h;
1084
1085 if (0 > rel->r_symndx)
1086 return false;
1087
1088 h = obj_xcoff_sym_hashes (input_bfd)[rel->r_symndx];
1089
1090 /* If we see an R_BR or R_RBR reloc which is jumping to global
1091 linkage code, and it is followed by an appropriate cror nop
1092 instruction, we replace the cror with ld r2,40(r1). This
1093 restores the TOC after the glink code. Contrariwise, if the
1094 call is followed by a ld r2,40(r1), but the call is not
1095 going to global linkage code, we can replace the load with a
1096 cror. */
1097 if (NULL != h
1098 && bfd_link_hash_defined == h->root.type
1099 && (rel->r_vaddr - input_section->vma + 8 <=
1100 input_section->_cooked_size))
1101 {
1102 bfd_byte *pnext;
1103 unsigned long next;
1104
1105 pnext = contents + (rel->r_vaddr - input_section->vma) + 4;
1106 next = bfd_get_32 (input_bfd, pnext);
1107
1108 /* The _ptrgl function is magic. It is used by the AIX compiler to call
1109 a function through a pointer. */
1110 if (h->smclas == XMC_GL || strcmp (h->root.root.string, "._ptrgl") == 0)
1111 {
1112 if (next == 0x4def7b82 /* cror 15,15,15 */
1113 || next == 0x4ffffb82 /* cror 31,31,31 */
1114 || next == 0x60000000) /* ori r0,r0,0 */
1115 bfd_put_32 (input_bfd, 0xe8410028, pnext); /* ld r2,40(r1) */
1116 }
1117 else
1118 {
1119 if (next == 0xe8410028) /* ld r2,40(r1) */
1120 bfd_put_32 (input_bfd, 0x60000000, pnext); /* ori r0,r0,0 */
1121 }
1122 }
1123 else if (NULL != h && bfd_link_hash_undefined == h->root.type)
1124 {
1125 /* Normally, this relocation is against a defined symbol. In the
1126 case where this is a partial link and the output section offset
1127 is greater than 2^25, the linker will return an invalid error
1128 message that the relocation has been truncated. Yes it has been
1129 truncated but no it not important. For this case, disable the
1130 overflow checking. */
1131 howto->complain_on_overflow = complain_overflow_dont;
1132 }
1133
1134 howto->pc_relative = true;
48bfecdd
AM
1135 howto->src_mask |= 3;
1136 howto->dst_mask &= ~3;
f1f0d9ab
TR
1137
1138 /* A PC relative reloc includes the section address. */
1139 addend += input_section->vma;
1140
1141 *relocation = val + addend;
1142 *relocation -= (input_section->output_section->vma +
1143 input_section->output_offset);
1144 return true;
1145}
1146
dbe341c6
TR
1147/* This is the relocation function for the PowerPC64.
1148 See xcoff_ppc_relocation_section for more information. */
beb1bf64 1149
dbe341c6 1150boolean
beb1bf64
TR
1151xcoff64_ppc_relocate_section (output_bfd, info, input_bfd,
1152 input_section, contents, relocs, syms,
1153 sections)
1154 bfd *output_bfd;
1155 struct bfd_link_info *info;
1156 bfd *input_bfd;
1157 asection *input_section;
1158 bfd_byte *contents;
1159 struct internal_reloc *relocs;
1160 struct internal_syment *syms;
1161 asection **sections;
1162{
1163 struct internal_reloc *rel;
1164 struct internal_reloc *relend;
1165
1166 rel = relocs;
1167 relend = rel + input_section->reloc_count;
1168 for (; rel < relend; rel++)
1169 {
1170 long symndx;
1171 struct xcoff_link_hash_entry *h;
1172 struct internal_syment *sym;
1173 bfd_vma addend;
1174 bfd_vma val;
1175 struct reloc_howto_struct howto;
dbe341c6
TR
1176 bfd_vma relocation;
1177 bfd_vma value_to_relocate;
1178 bfd_vma address;
1179 bfd_byte *location;
beb1bf64
TR
1180
1181 /* Relocation type R_REF is a special relocation type which is
dbe341c6
TR
1182 merely used to prevent garbage collection from occurring for
1183 the csect including the symbol which it references. */
beb1bf64
TR
1184 if (rel->r_type == R_REF)
1185 continue;
1186
dbe341c6 1187 /* howto */
beb1bf64
TR
1188 howto.type = rel->r_type;
1189 howto.rightshift = 0;
beb1bf64 1190 howto.bitsize = (rel->r_size & 0x3f) + 1;
dbe341c6 1191 howto.size = howto.bitsize > 16 ? (howto.bitsize > 32 ? 4 : 2) : 1;
beb1bf64
TR
1192 howto.pc_relative = false;
1193 howto.bitpos = 0;
dbe341c6
TR
1194 howto.complain_on_overflow = rel->r_size & 0x80 ?
1195 complain_overflow_signed : complain_overflow_bitfield;
beb1bf64
TR
1196 howto.special_function = NULL;
1197 howto.name = "internal";
1198 howto.partial_inplace = true;
48bfecdd
AM
1199 howto.dst_mask = N_ONES (howto.bitsize);
1200 howto.src_mask = ~howto.dst_mask & N_ONES (8 << howto.size);
beb1bf64
TR
1201 howto.pcrel_offset = false;
1202
dbe341c6 1203 /* symbol */
beb1bf64 1204 val = 0;
dbe341c6
TR
1205 addend = 0;
1206 h = NULL;
1207 sym = NULL;
1208 symndx = rel->r_symndx;
beb1bf64 1209
dbe341c6 1210 if (-1 != symndx)
dc810e39
AM
1211 {
1212 asection *sec;
dbe341c6
TR
1213
1214 h = obj_xcoff_sym_hashes (input_bfd)[symndx];
1215 sym = syms + symndx;
1216 addend = - sym->n_value;
1217
1218 if (NULL == h)
dc810e39
AM
1219 {
1220 sec = sections[symndx];
1221 /* Hack to make sure we use the right TOC anchor value
1222 if this reloc is against the TOC anchor. */
1223 if (sec->name[3] == '0'
1224 && strcmp (sec->name, ".tc0") == 0)
1225 val = xcoff_data (output_bfd)->toc;
1226 else
1227 val = (sec->output_section->vma
1228 + sec->output_offset
1229 + sym->n_value
1230 - sec->vma);
dbe341c6
TR
1231 }
1232 else
dc810e39 1233 {
dbe341c6
TR
1234 if (h->root.type == bfd_link_hash_defined
1235 || h->root.type == bfd_link_hash_defweak)
dc810e39 1236 {
dbe341c6
TR
1237 sec = h->root.u.def.section;
1238 val = (h->root.u.def.value
1239 + sec->output_section->vma
1240 + sec->output_offset);
1241 }
1242 else if (h->root.type == bfd_link_hash_common)
1243 {
1244 sec = h->root.u.c.p->section;
1245 val = (sec->output_section->vma
1246 + sec->output_offset);
1247 }
1248 else if ((0 == (h->flags & (XCOFF_DEF_DYNAMIC | XCOFF_IMPORT)))
1249 && ! info->relocateable)
1250 {
1251 if (! ((*info->callbacks->undefined_symbol)
1252 (info, h->root.root.string, input_bfd, input_section,
1253 rel->r_vaddr - input_section->vma, true)))
1254 return false;
1255
1256 /* Don't try to process the reloc. It can't help, and
1257 it may generate another error. */
1258 continue;
dc810e39 1259 }
dc810e39 1260 }
dc810e39 1261 }
dbe341c6
TR
1262
1263 if (rel->r_type >= XCOFF_MAX_CALCULATE_RELOCATION
f1f0d9ab 1264 || (false == xcoff64_calculate_relocation[rel->r_type]
dbe341c6
TR
1265 (input_bfd, input_section, output_bfd, rel, sym, &howto, val,
1266 addend, &relocation, contents)))
1267 return false;
1268
1269 /* address */
1270 address = rel->r_vaddr - input_section->vma;
1271 location = contents + address;
1272
1273 if (address > input_section->_raw_size)
1274 abort();
1275
1276 /* Get the value we are going to relocate. */
1277 if (1 == howto.size)
1278 value_to_relocate = bfd_get_16 (input_bfd, location);
1279 else if (2 == howto.size)
1280 value_to_relocate = bfd_get_32 (input_bfd, location);
1281 else
1282 value_to_relocate = bfd_get_64 (input_bfd, location);
1283
1284 /* overflow.
1285
1286 FIXME: We may drop bits during the addition
1287 which we don't check for. We must either check at every single
1288 operation, which would be tedious, or we must do the computations
1289 in a type larger than bfd_vma, which would be inefficient. */
1290
1291 if ((unsigned int) howto.complain_on_overflow >=
1292 XCOFF_MAX_COMPLAIN_OVERFLOW)
1293 abort();
1294
1295 if ((true == xcoff_complain_overflow[howto.complain_on_overflow]
1296 (input_bfd, value_to_relocate, relocation, &howto)))
dc810e39 1297 {
dbe341c6
TR
1298 const char *name;
1299 char buf[SYMNMLEN + 1];
1300 char reloc_type_name[10];
1301
1302 if (symndx == -1)
beb1bf64 1303 {
dbe341c6
TR
1304 name = "*ABS*";
1305 }
1306 else if (h != NULL)
1307 {
1308 name = h->root.root.string;
1309 }
1310 else
beb1bf64 1311 {
dbe341c6
TR
1312 name = _bfd_coff_internal_syment_name (input_bfd, sym, buf);
1313 if (name == NULL)
1314 name = "UNKNOWN";
beb1bf64 1315 }
dbe341c6
TR
1316 sprintf (reloc_type_name, "0x%02x", rel->r_type);
1317
1318 if (! ((*info->callbacks->reloc_overflow)
1319 (info, name, reloc_type_name, (bfd_vma) 0, input_bfd,
1320 input_section, rel->r_vaddr - input_section->vma)))
1321 return false;
beb1bf64
TR
1322 }
1323
dbe341c6
TR
1324 /* Add RELOCATION to the right bits of VALUE_TO_RELOCATE. */
1325 value_to_relocate = ((value_to_relocate & ~howto.dst_mask) |
1326 (((value_to_relocate & howto.src_mask) +
1327 relocation) & howto.dst_mask));
1328
1329 /* Put the value back in the object file. */
1330 if (1 == howto.size)
1331 bfd_put_16 (input_bfd, value_to_relocate, location);
1332 else if (2 == howto.size)
1333 bfd_put_32 (input_bfd, value_to_relocate, location);
1334 else
1335 bfd_put_64 (input_bfd, value_to_relocate, location);
1336
beb1bf64 1337 }
beb1bf64
TR
1338 return true;
1339}
1340
beb1bf64
TR
1341\f
1342/* The XCOFF reloc table. Actually, XCOFF relocations specify the
1343 bitsize and whether they are signed or not, along with a
1344 conventional type. This table is for the types, which are used for
1345 different algorithms for putting in the reloc. Many of these
1346 relocs need special_function entries, which I have not written. */
1347
beb1bf64
TR
1348reloc_howto_type xcoff64_howto_table[] =
1349{
1350 /* Standard 64 bit relocation. */
38487e5e 1351 HOWTO (R_POS, /* type */
dc810e39
AM
1352 0, /* rightshift */
1353 4, /* size (0 = byte, 1 = short, 2 = long) */
1354 64, /* bitsize */
1355 false, /* pc_relative */
1356 0, /* bitpos */
beb1bf64 1357 complain_overflow_bitfield, /* complain_on_overflow */
dc810e39 1358 0, /* special_function */
59862849 1359 "R_POS_64", /* name */
dc810e39 1360 true, /* partial_inplace */
48bfecdd 1361 0, /* src_mask */
dc810e39
AM
1362 MINUS_ONE, /* dst_mask */
1363 false), /* pcrel_offset */
beb1bf64
TR
1364
1365 /* 64 bit relocation, but store negative value. */
38487e5e 1366 HOWTO (R_NEG, /* type */
dc810e39
AM
1367 0, /* rightshift */
1368 -4, /* size (0 = byte, 1 = short, 2 = long) */
1369 64, /* bitsize */
1370 false, /* pc_relative */
1371 0, /* bitpos */
beb1bf64 1372 complain_overflow_bitfield, /* complain_on_overflow */
dc810e39
AM
1373 0, /* special_function */
1374 "R_NEG", /* name */
1375 true, /* partial_inplace */
48bfecdd 1376 0, /* src_mask */
dc810e39
AM
1377 MINUS_ONE, /* dst_mask */
1378 false), /* pcrel_offset */
beb1bf64
TR
1379
1380 /* 32 bit PC relative relocation. */
38487e5e 1381 HOWTO (R_REL, /* type */
dc810e39
AM
1382 0, /* rightshift */
1383 2, /* size (0 = byte, 1 = short, 2 = long) */
1384 32, /* bitsize */
1385 true, /* pc_relative */
1386 0, /* bitpos */
beb1bf64 1387 complain_overflow_signed, /* complain_on_overflow */
dc810e39
AM
1388 0, /* special_function */
1389 "R_REL", /* name */
1390 true, /* partial_inplace */
48bfecdd 1391 0, /* src_mask */
dc810e39
AM
1392 0xffffffff, /* dst_mask */
1393 false), /* pcrel_offset */
beb1bf64
TR
1394
1395 /* 16 bit TOC relative relocation. */
38487e5e 1396 HOWTO (R_TOC, /* type */
dc810e39
AM
1397 0, /* rightshift */
1398 1, /* size (0 = byte, 1 = short, 2 = long) */
1399 16, /* bitsize */
1400 false, /* pc_relative */
1401 0, /* bitpos */
beb1bf64 1402 complain_overflow_bitfield, /* complain_on_overflow */
dc810e39
AM
1403 0, /* special_function */
1404 "R_TOC", /* name */
1405 true, /* partial_inplace */
48bfecdd 1406 0, /* src_mask */
dc810e39
AM
1407 0xffff, /* dst_mask */
1408 false), /* pcrel_offset */
1409
54327882 1410 /* I don't really know what this is. */
38487e5e 1411 HOWTO (R_RTB, /* type */
dc810e39
AM
1412 1, /* rightshift */
1413 2, /* size (0 = byte, 1 = short, 2 = long) */
1414 32, /* bitsize */
1415 false, /* pc_relative */
1416 0, /* bitpos */
beb1bf64 1417 complain_overflow_bitfield, /* complain_on_overflow */
dc810e39
AM
1418 0, /* special_function */
1419 "R_RTB", /* name */
1420 true, /* partial_inplace */
48bfecdd 1421 0, /* src_mask */
dc810e39
AM
1422 0xffffffff, /* dst_mask */
1423 false), /* pcrel_offset */
beb1bf64
TR
1424
1425 /* External TOC relative symbol. */
38487e5e 1426 HOWTO (R_GL, /* type */
dc810e39 1427 0, /* rightshift */
48bfecdd 1428 1, /* size (0 = byte, 1 = short, 2 = long) */
dc810e39
AM
1429 16, /* bitsize */
1430 false, /* pc_relative */
1431 0, /* bitpos */
beb1bf64 1432 complain_overflow_bitfield, /* complain_on_overflow */
dc810e39
AM
1433 0, /* special_function */
1434 "R_GL", /* name */
1435 true, /* partial_inplace */
48bfecdd 1436 0, /* src_mask */
dc810e39
AM
1437 0xffff, /* dst_mask */
1438 false), /* pcrel_offset */
1439
1440 /* Local TOC relative symbol. */
38487e5e 1441 HOWTO (R_TCL, /* type */
dc810e39 1442 0, /* rightshift */
48bfecdd 1443 1, /* size (0 = byte, 1 = short, 2 = long) */
dc810e39
AM
1444 16, /* bitsize */
1445 false, /* pc_relative */
1446 0, /* bitpos */
beb1bf64 1447 complain_overflow_bitfield, /* complain_on_overflow */
dc810e39
AM
1448 0, /* special_function */
1449 "R_TCL", /* name */
1450 true, /* partial_inplace */
48bfecdd 1451 0, /* src_mask */
dc810e39
AM
1452 0xffff, /* dst_mask */
1453 false), /* pcrel_offset */
beb1bf64
TR
1454
1455 EMPTY_HOWTO (7),
1456
1457 /* Non modifiable absolute branch. */
38487e5e 1458 HOWTO (R_BA, /* type */
dc810e39
AM
1459 0, /* rightshift */
1460 2, /* size (0 = byte, 1 = short, 2 = long) */
1461 26, /* bitsize */
1462 false, /* pc_relative */
1463 0, /* bitpos */
beb1bf64 1464 complain_overflow_bitfield, /* complain_on_overflow */
dc810e39 1465 0, /* special_function */
59862849 1466 "R_BA_26", /* name */
dc810e39 1467 true, /* partial_inplace */
48bfecdd
AM
1468 0xfc000003, /* src_mask */
1469 0x03fffffc, /* dst_mask */
dc810e39 1470 false), /* pcrel_offset */
beb1bf64
TR
1471
1472 EMPTY_HOWTO (9),
1473
1474 /* Non modifiable relative branch. */
38487e5e 1475 HOWTO (R_BR, /* type */
dc810e39
AM
1476 0, /* rightshift */
1477 2, /* size (0 = byte, 1 = short, 2 = long) */
1478 26, /* bitsize */
1479 true, /* pc_relative */
1480 0, /* bitpos */
beb1bf64 1481 complain_overflow_signed, /* complain_on_overflow */
dc810e39
AM
1482 0, /* special_function */
1483 "R_BR", /* name */
1484 true, /* partial_inplace */
48bfecdd
AM
1485 0xfc000003, /* src_mask */
1486 0x03fffffc, /* dst_mask */
dc810e39 1487 false), /* pcrel_offset */
beb1bf64
TR
1488
1489 EMPTY_HOWTO (0xb),
1490
1491 /* Indirect load. */
38487e5e 1492 HOWTO (R_RL, /* type */
dc810e39 1493 0, /* rightshift */
48bfecdd 1494 1, /* size (0 = byte, 1 = short, 2 = long) */
dc810e39
AM
1495 16, /* bitsize */
1496 false, /* pc_relative */
1497 0, /* bitpos */
beb1bf64 1498 complain_overflow_bitfield, /* complain_on_overflow */
dc810e39
AM
1499 0, /* special_function */
1500 "R_RL", /* name */
1501 true, /* partial_inplace */
48bfecdd 1502 0, /* src_mask */
dc810e39
AM
1503 0xffff, /* dst_mask */
1504 false), /* pcrel_offset */
beb1bf64
TR
1505
1506 /* Load address. */
38487e5e 1507 HOWTO (R_RLA, /* type */
dc810e39 1508 0, /* rightshift */
48bfecdd 1509 1, /* size (0 = byte, 1 = short, 2 = long) */
dc810e39
AM
1510 16, /* bitsize */
1511 false, /* pc_relative */
1512 0, /* bitpos */
beb1bf64 1513 complain_overflow_bitfield, /* complain_on_overflow */
dc810e39
AM
1514 0, /* special_function */
1515 "R_RLA", /* name */
1516 true, /* partial_inplace */
48bfecdd 1517 0, /* src_mask */
dc810e39
AM
1518 0xffff, /* dst_mask */
1519 false), /* pcrel_offset */
beb1bf64
TR
1520
1521 EMPTY_HOWTO (0xe),
1522
54327882 1523 /* Non-relocating reference. */
38487e5e 1524 HOWTO (R_REF, /* type */
dc810e39
AM
1525 0, /* rightshift */
1526 2, /* size (0 = byte, 1 = short, 2 = long) */
1527 32, /* bitsize */
1528 false, /* pc_relative */
1529 0, /* bitpos */
beb1bf64 1530 complain_overflow_bitfield, /* complain_on_overflow */
dc810e39
AM
1531 0, /* special_function */
1532 "R_REF", /* name */
1533 false, /* partial_inplace */
1534 0, /* src_mask */
1535 0, /* dst_mask */
1536 false), /* pcrel_offset */
beb1bf64
TR
1537
1538 EMPTY_HOWTO (0x10),
1539 EMPTY_HOWTO (0x11),
1540
1541 /* TOC relative indirect load. */
38487e5e 1542 HOWTO (R_TRL, /* type */
dc810e39 1543 0, /* rightshift */
48bfecdd 1544 1, /* size (0 = byte, 1 = short, 2 = long) */
dc810e39
AM
1545 16, /* bitsize */
1546 false, /* pc_relative */
1547 0, /* bitpos */
beb1bf64 1548 complain_overflow_bitfield, /* complain_on_overflow */
dc810e39
AM
1549 0, /* special_function */
1550 "R_TRL", /* name */
1551 true, /* partial_inplace */
48bfecdd 1552 0, /* src_mask */
dc810e39
AM
1553 0xffff, /* dst_mask */
1554 false), /* pcrel_offset */
1555
1556 /* TOC relative load address. */
38487e5e 1557 HOWTO (R_TRLA, /* type */
dc810e39 1558 0, /* rightshift */
48bfecdd 1559 1, /* size (0 = byte, 1 = short, 2 = long) */
dc810e39
AM
1560 16, /* bitsize */
1561 false, /* pc_relative */
1562 0, /* bitpos */
beb1bf64 1563 complain_overflow_bitfield, /* complain_on_overflow */
dc810e39
AM
1564 0, /* special_function */
1565 "R_TRLA", /* name */
1566 true, /* partial_inplace */
48bfecdd 1567 0, /* src_mask */
dc810e39
AM
1568 0xffff, /* dst_mask */
1569 false), /* pcrel_offset */
beb1bf64
TR
1570
1571 /* Modifiable relative branch. */
38487e5e 1572 HOWTO (R_RRTBI, /* type */
dc810e39
AM
1573 1, /* rightshift */
1574 2, /* size (0 = byte, 1 = short, 2 = long) */
1575 32, /* bitsize */
1576 false, /* pc_relative */
1577 0, /* bitpos */
beb1bf64 1578 complain_overflow_bitfield, /* complain_on_overflow */
dc810e39
AM
1579 0, /* special_function */
1580 "R_RRTBI", /* name */
1581 true, /* partial_inplace */
48bfecdd 1582 0, /* src_mask */
dc810e39
AM
1583 0xffffffff, /* dst_mask */
1584 false), /* pcrel_offset */
beb1bf64
TR
1585
1586 /* Modifiable absolute branch. */
38487e5e 1587 HOWTO (R_RRTBA, /* type */
dc810e39
AM
1588 1, /* rightshift */
1589 2, /* size (0 = byte, 1 = short, 2 = long) */
1590 32, /* bitsize */
1591 false, /* pc_relative */
1592 0, /* bitpos */
beb1bf64 1593 complain_overflow_bitfield, /* complain_on_overflow */
dc810e39
AM
1594 0, /* special_function */
1595 "R_RRTBA", /* name */
1596 true, /* partial_inplace */
48bfecdd 1597 0, /* src_mask */
dc810e39
AM
1598 0xffffffff, /* dst_mask */
1599 false), /* pcrel_offset */
1600
1601 /* Modifiable call absolute indirect. */
38487e5e 1602 HOWTO (R_CAI, /* type */
dc810e39 1603 0, /* rightshift */
48bfecdd 1604 1, /* size (0 = byte, 1 = short, 2 = long) */
dc810e39
AM
1605 16, /* bitsize */
1606 false, /* pc_relative */
1607 0, /* bitpos */
beb1bf64 1608 complain_overflow_bitfield, /* complain_on_overflow */
dc810e39
AM
1609 0, /* special_function */
1610 "R_CAI", /* name */
1611 true, /* partial_inplace */
48bfecdd 1612 0, /* src_mask */
dc810e39
AM
1613 0xffff, /* dst_mask */
1614 false), /* pcrel_offset */
1615
54327882 1616 /* Modifiable call relative. */
38487e5e 1617 HOWTO (R_CREL, /* type */
dc810e39 1618 0, /* rightshift */
48bfecdd 1619 1, /* size (0 = byte, 1 = short, 2 = long) */
dc810e39
AM
1620 16, /* bitsize */
1621 false, /* pc_relative */
1622 0, /* bitpos */
beb1bf64 1623 complain_overflow_bitfield, /* complain_on_overflow */
dc810e39
AM
1624 0, /* special_function */
1625 "R_CREL", /* name */
1626 true, /* partial_inplace */
48bfecdd 1627 0, /* src_mask */
dc810e39
AM
1628 0xffff, /* dst_mask */
1629 false), /* pcrel_offset */
beb1bf64
TR
1630
1631 /* Modifiable branch absolute. */
38487e5e 1632 HOWTO (R_RBA, /* type */
dc810e39
AM
1633 0, /* rightshift */
1634 2, /* size (0 = byte, 1 = short, 2 = long) */
1635 26, /* bitsize */
1636 false, /* pc_relative */
1637 0, /* bitpos */
beb1bf64 1638 complain_overflow_bitfield, /* complain_on_overflow */
dc810e39
AM
1639 0, /* special_function */
1640 "R_RBA", /* name */
1641 true, /* partial_inplace */
48bfecdd
AM
1642 0xfc000003, /* src_mask */
1643 0x03fffffc, /* dst_mask */
dc810e39 1644 false), /* pcrel_offset */
beb1bf64
TR
1645
1646 /* Modifiable branch absolute. */
38487e5e 1647 HOWTO (R_RBAC, /* type */
dc810e39
AM
1648 0, /* rightshift */
1649 2, /* size (0 = byte, 1 = short, 2 = long) */
1650 32, /* bitsize */
1651 false, /* pc_relative */
1652 0, /* bitpos */
beb1bf64 1653 complain_overflow_bitfield, /* complain_on_overflow */
dc810e39
AM
1654 0, /* special_function */
1655 "R_RBAC", /* name */
1656 true, /* partial_inplace */
48bfecdd
AM
1657 0, /* src_mask */
1658 0xffffffff, /* dst_mask */
dc810e39 1659 false), /* pcrel_offset */
beb1bf64
TR
1660
1661 /* Modifiable branch relative. */
38487e5e 1662 HOWTO (R_RBR, /* type */
dc810e39
AM
1663 0, /* rightshift */
1664 2, /* size (0 = byte, 1 = short, 2 = long) */
1665 26, /* bitsize */
1666 false, /* pc_relative */
1667 0, /* bitpos */
beb1bf64 1668 complain_overflow_signed, /* complain_on_overflow */
dc810e39 1669 0, /* special_function */
59862849 1670 "R_RBR_26", /* name */
dc810e39 1671 true, /* partial_inplace */
48bfecdd
AM
1672 0xfc000003, /* src_mask */
1673 0x03fffffc, /* dst_mask */
dc810e39 1674 false), /* pcrel_offset */
beb1bf64
TR
1675
1676 /* Modifiable branch absolute. */
38487e5e 1677 HOWTO (R_RBRC, /* type */
dc810e39 1678 0, /* rightshift */
48bfecdd 1679 1, /* size (0 = byte, 1 = short, 2 = long) */
dc810e39
AM
1680 16, /* bitsize */
1681 false, /* pc_relative */
1682 0, /* bitpos */
beb1bf64 1683 complain_overflow_bitfield, /* complain_on_overflow */
dc810e39
AM
1684 0, /* special_function */
1685 "R_RBRC", /* name */
1686 true, /* partial_inplace */
48bfecdd 1687 0, /* src_mask */
dc810e39
AM
1688 0xffff, /* dst_mask */
1689 false), /* pcrel_offset */
1690
38487e5e 1691 HOWTO (R_POS, /* type */
dc810e39 1692 0, /* rightshift */
59862849
TR
1693 2, /* size (0 = byte, 1 = short, 2 = long) */
1694 32, /* bitsize */
dc810e39
AM
1695 false, /* pc_relative */
1696 0, /* bitpos */
1697 complain_overflow_bitfield, /* complain_on_overflow */
1698 0, /* special_function */
59862849 1699 "R_POS_32", /* name */
dc810e39 1700 true, /* partial_inplace */
48bfecdd 1701 0, /* src_mask */
59862849 1702 0xffffffff, /* dst_mask */
ff3a6ee3
TR
1703 false), /* pcrel_offset */
1704
1705 /* 16 bit Non modifiable absolute branch. */
54327882
AM
1706 HOWTO (R_BA, /* type */
1707 0, /* rightshift */
59862849 1708 1, /* size (0 = byte, 1 = short, 2 = long) */
54327882
AM
1709 16, /* bitsize */
1710 false, /* pc_relative */
1711 0, /* bitpos */
ff3a6ee3 1712 complain_overflow_bitfield, /* complain_on_overflow */
54327882 1713 0, /* special_function */
59862849 1714 "R_BA_16", /* name */
54327882 1715 true, /* partial_inplace */
48bfecdd 1716 0x0003, /* src_mask */
54327882
AM
1717 0xfffc, /* dst_mask */
1718 false), /* pcrel_offset */
59862849
TR
1719
1720 /* Modifiable branch relative. */
1721 HOWTO (R_RBR, /* type */
1722 0, /* rightshift */
1723 1, /* size (0 = byte, 1 = short, 2 = long) */
1724 16, /* bitsize */
1725 false, /* pc_relative */
1726 0, /* bitpos */
1727 complain_overflow_signed, /* complain_on_overflow */
1728 0, /* special_function */
1729 "R_RBR_16", /* name */
1730 true, /* partial_inplace */
48bfecdd 1731 0, /* src_mask */
59862849
TR
1732 0xffff, /* dst_mask */
1733 false), /* pcrel_offset */
1b164155
TR
1734
1735 /* Modifiable branch absolute. */
1736 HOWTO (R_RBA, /* type */
1737 0, /* rightshift */
1738 1, /* size (0 = byte, 1 = short, 2 = long) */
1739 16, /* bitsize */
1740 false, /* pc_relative */
1741 0, /* bitpos */
1742 complain_overflow_bitfield, /* complain_on_overflow */
1743 0, /* special_function */
1744 "R_RBA_16", /* name */
1745 true, /* partial_inplace */
48bfecdd 1746 0, /* src_mask */
1b164155
TR
1747 0xffff, /* dst_mask */
1748 false), /* pcrel_offset */
1749
beb1bf64
TR
1750};
1751
1752void
1753xcoff64_rtype2howto (relent, internal)
1754 arelent *relent;
1755 struct internal_reloc *internal;
1756{
59862849 1757 if (internal->r_type > R_RBRC)
beb1bf64
TR
1758 abort ();
1759
59862849
TR
1760 /* Default howto layout works most of the time */
1761 relent->howto = &xcoff64_howto_table[internal->r_type];
1762
1763 /* Special case some 16 bit reoloc */
1764 if (15 == (internal->r_size & 0x3f))
1765 {
1766 if (R_BA == internal->r_type)
1767 relent->howto = &xcoff64_howto_table[0x1d];
1768 else if (R_RBR == internal->r_type)
1769 relent->howto = &xcoff64_howto_table[0x1e];
1b164155
TR
1770 else if (R_RBA == internal->r_type)
1771 relent->howto = &xcoff64_howto_table[0x1f];
59862849
TR
1772 }
1773 /* Special case 32 bit */
1774 else if (31 == (internal->r_size & 0x3f))
1775 {
1776 if (R_POS == internal->r_type)
1777 relent->howto = &xcoff64_howto_table[0x1c];
1778 }
1779
beb1bf64
TR
1780 /* The r_size field of an XCOFF reloc encodes the bitsize of the
1781 relocation, as well as indicating whether it is signed or not.
1782 Doublecheck that the relocation information gathered from the
1783 type matches this information. The bitsize is not significant
1784 for R_REF relocs. */
1785 if (relent->howto->dst_mask != 0
dc810e39 1786 && (relent->howto->bitsize
beb1bf64
TR
1787 != ((unsigned int) internal->r_size & 0x3f) + 1))
1788 abort ();
59862849
TR
1789
1790 /* Put a meaningful value in addend */
1791 relent->addend = (internal->r_size & 0x80) ? - internal->r_vaddr
1792 : internal->r_vaddr;
beb1bf64
TR
1793}
1794
1795reloc_howto_type *
1796xcoff64_reloc_type_lookup (abfd, code)
1797 bfd *abfd ATTRIBUTE_UNUSED;
1798 bfd_reloc_code_real_type code;
1799{
1800 switch (code)
1801 {
1802 case BFD_RELOC_PPC_B26:
1803 return &xcoff64_howto_table[0xa];
ff3a6ee3
TR
1804 case BFD_RELOC_PPC_BA16:
1805 return &xcoff64_howto_table[0x1d];
beb1bf64
TR
1806 case BFD_RELOC_PPC_BA26:
1807 return &xcoff64_howto_table[8];
1808 case BFD_RELOC_PPC_TOC16:
1809 return &xcoff64_howto_table[3];
1810 case BFD_RELOC_32:
1811 case BFD_RELOC_CTOR:
beb1bf64 1812 return &xcoff64_howto_table[0x1c];
59862849
TR
1813 case BFD_RELOC_64:
1814 return &xcoff64_howto_table[0];
beb1bf64
TR
1815 default:
1816 return NULL;
1817 }
1818}
1819
beb1bf64
TR
1820/* Read in the armap of an XCOFF archive. */
1821
814fa6ab 1822static boolean
beb1bf64
TR
1823xcoff64_slurp_armap (abfd)
1824 bfd *abfd;
1825{
1826 file_ptr off;
1827 size_t namlen;
dc810e39 1828 bfd_size_type sz, amt;
beb1bf64
TR
1829 bfd_byte *contents, *cend;
1830 bfd_vma c, i;
1831 carsym *arsym;
1832 bfd_byte *p;
dc810e39 1833 file_ptr pos;
beb1bf64
TR
1834
1835 /* This is for the new format. */
1836 struct xcoff_ar_hdr_big hdr;
1837
dc810e39
AM
1838 if (xcoff_ardata (abfd) == NULL)
1839 {
1840 bfd_has_map (abfd) = false;
1841 return true;
1842 }
beb1bf64 1843
487e54f2
AM
1844 off = bfd_scan_vma (xcoff_ardata_big (abfd)->symoff64,
1845 (const char **) NULL, 10);
dc810e39
AM
1846 if (off == 0)
1847 {
1848 bfd_has_map (abfd) = false;
1849 return true;
1850 }
beb1bf64
TR
1851
1852 if (bfd_seek (abfd, off, SEEK_SET) != 0)
1853 return false;
1854
1855 /* The symbol table starts with a normal archive header. */
dc810e39
AM
1856 if (bfd_bread ((PTR) &hdr, (bfd_size_type) SIZEOF_AR_HDR_BIG, abfd)
1857 != SIZEOF_AR_HDR_BIG)
beb1bf64
TR
1858 return false;
1859
1860 /* Skip the name (normally empty). */
1861 namlen = strtol (hdr.namlen, (char **) NULL, 10);
dc810e39
AM
1862 pos = ((namlen + 1) & ~(size_t) 1) + SXCOFFARFMAG;
1863 if (bfd_seek (abfd, pos, SEEK_CUR) != 0)
beb1bf64
TR
1864 return false;
1865
487e54f2 1866 sz = bfd_scan_vma (hdr.size, (const char **) NULL, 10);
beb1bf64
TR
1867
1868 /* Read in the entire symbol table. */
1869 contents = (bfd_byte *) bfd_alloc (abfd, sz);
1870 if (contents == NULL)
1871 return false;
dc810e39 1872 if (bfd_bread ((PTR) contents, sz, abfd) != sz)
beb1bf64
TR
1873 return false;
1874
1875 /* The symbol table starts with an eight byte count. */
dc810e39 1876 c = H_GET_64 (abfd, contents);
beb1bf64 1877
dc810e39
AM
1878 if (c * 8 >= sz)
1879 {
1880 bfd_set_error (bfd_error_bad_value);
1881 return false;
1882 }
1883 amt = c;
1884 amt *= sizeof (carsym);
1885 bfd_ardata (abfd)->symdefs = (carsym *) bfd_alloc (abfd, amt);
beb1bf64
TR
1886 if (bfd_ardata (abfd)->symdefs == NULL)
1887 return false;
dc810e39 1888
beb1bf64
TR
1889 /* After the count comes a list of eight byte file offsets. */
1890 for (i = 0, arsym = bfd_ardata (abfd)->symdefs, p = contents + 8;
1891 i < c;
1892 ++i, ++arsym, p += 8)
dc810e39 1893 arsym->file_offset = H_GET_64 (abfd, p);
beb1bf64
TR
1894
1895 /* After the file offsets come null terminated symbol names. */
1896 cend = contents + sz;
1897 for (i = 0, arsym = bfd_ardata (abfd)->symdefs;
1898 i < c;
1899 ++i, ++arsym, p += strlen ((char *) p) + 1)
1900 {
1901 if (p >= cend)
1902 {
1903 bfd_set_error (bfd_error_bad_value);
1904 return false;
1905 }
1906 arsym->name = (char *) p;
1907 }
1908
1909 bfd_ardata (abfd)->symdef_count = c;
1910 bfd_has_map (abfd) = true;
1911
1912 return true;
1913}
1914
1915
beb1bf64
TR
1916/* See if this is an NEW XCOFF archive. */
1917
814fa6ab 1918static const bfd_target *
beb1bf64
TR
1919xcoff64_archive_p (abfd)
1920 bfd *abfd;
1921{
487e54f2 1922 struct artdata *tdata_hold;
beb1bf64
TR
1923 char magic[SXCOFFARMAG];
1924 /* This is the new format. */
1925 struct xcoff_ar_file_hdr_big hdr;
dc810e39 1926 bfd_size_type amt = SXCOFFARMAG;
beb1bf64 1927
dc810e39
AM
1928 if (bfd_bread ((PTR) magic, amt, abfd) != amt)
1929 {
1930 if (bfd_get_error () != bfd_error_system_call)
1931 bfd_set_error (bfd_error_wrong_format);
1932 return NULL;
1933 }
1934
1935 if (strncmp (magic, XCOFFARMAGBIG, SXCOFFARMAG) != 0)
1936 {
1937 bfd_set_error (bfd_error_wrong_format);
1938 return NULL;
1939 }
beb1bf64 1940
beb1bf64
TR
1941 /* Copy over the magic string. */
1942 memcpy (hdr.magic, magic, SXCOFFARMAG);
1943
1944 /* Now read the rest of the file header. */
487e54f2
AM
1945 amt = SIZEOF_AR_FILE_HDR_BIG - SXCOFFARMAG;
1946 if (bfd_bread ((PTR) &hdr.memoff, amt, abfd) != amt)
dc810e39
AM
1947 {
1948 if (bfd_get_error () != bfd_error_system_call)
1949 bfd_set_error (bfd_error_wrong_format);
1950 return NULL;
1951 }
beb1bf64 1952
487e54f2
AM
1953 tdata_hold = bfd_ardata (abfd);
1954
1955 amt = sizeof (struct artdata);
1956 bfd_ardata (abfd) = (struct artdata *) bfd_zalloc (abfd, amt);
1957 if (bfd_ardata (abfd) == (struct artdata *) NULL)
1958 goto error_ret_restore;
1959
1960 bfd_ardata (abfd)->cache = NULL;
1961 bfd_ardata (abfd)->archive_head = NULL;
1962 bfd_ardata (abfd)->symdefs = NULL;
1963 bfd_ardata (abfd)->extended_names = NULL;
1964 bfd_ardata (abfd)->first_file_filepos = bfd_scan_vma (hdr.firstmemoff,
1965 (const char **) NULL,
1966 10);
beb1bf64 1967
dc810e39
AM
1968 amt = SIZEOF_AR_FILE_HDR_BIG;
1969 bfd_ardata (abfd)->tdata = bfd_zalloc (abfd, amt);
beb1bf64 1970 if (bfd_ardata (abfd)->tdata == NULL)
487e54f2 1971 goto error_ret;
dc810e39 1972
beb1bf64
TR
1973 memcpy (bfd_ardata (abfd)->tdata, &hdr, SIZEOF_AR_FILE_HDR_BIG);
1974
dc810e39
AM
1975 if (! xcoff64_slurp_armap (abfd))
1976 {
487e54f2 1977 error_ret:
dc810e39 1978 bfd_release (abfd, bfd_ardata (abfd));
487e54f2
AM
1979 error_ret_restore:
1980 bfd_ardata (abfd) = tdata_hold;
dc810e39
AM
1981 return NULL;
1982 }
beb1bf64
TR
1983
1984 return abfd->xvec;
1985}
1986
1987
1988/* Open the next element in an XCOFF archive. */
1989
814fa6ab 1990static bfd *
beb1bf64
TR
1991xcoff64_openr_next_archived_file (archive, last_file)
1992 bfd *archive;
1993 bfd *last_file;
1994{
1995 file_ptr filestart;
1996
dc810e39
AM
1997 if ((xcoff_ardata (archive) == NULL)
1998 || ! xcoff_big_format_p (archive))
1999 {
2000 bfd_set_error (bfd_error_invalid_operation);
2001 return NULL;
2002 }
beb1bf64 2003
dc810e39
AM
2004 if (last_file == NULL)
2005 {
beb1bf64 2006 filestart = bfd_ardata (archive)->first_file_filepos;
dc810e39
AM
2007 }
2008 else
2009 {
487e54f2
AM
2010 filestart = bfd_scan_vma (arch_xhdr_big (last_file)->nextoff,
2011 (const char **) NULL, 10);
dc810e39 2012 }
487e54f2 2013
beb1bf64 2014 if (filestart == 0
487e54f2
AM
2015 || filestart == bfd_scan_vma (xcoff_ardata_big (archive)->memoff,
2016 (const char **) NULL, 10)
2017 || filestart == bfd_scan_vma (xcoff_ardata_big (archive)->symoff,
2018 (const char **) NULL, 10))
dc810e39
AM
2019 {
2020 bfd_set_error (bfd_error_no_more_archived_files);
2021 return NULL;
2022 }
beb1bf64
TR
2023
2024 return _bfd_get_elt_at_filepos (archive, filestart);
2025}
2026
2027/* We can't use the usual coff_sizeof_headers routine, because AIX
2028 always uses an a.out header. */
2029
2030/*ARGSUSED*/
814fa6ab 2031static int
beb1bf64
TR
2032xcoff64_sizeof_headers (abfd, reloc)
2033 bfd *abfd;
2034 boolean reloc ATTRIBUTE_UNUSED;
2035{
2036 int size;
2037
dc810e39 2038 size = bfd_coff_filhsz (abfd);
beb1bf64 2039
08da05b0 2040 /* Don't think the small aout header can be used since some of the
dc810e39
AM
2041 old elements have been reordered past the end of the old coff
2042 small aout size. */
beb1bf64
TR
2043
2044 if (xcoff_data (abfd)->full_aouthdr)
dc810e39 2045 size += bfd_coff_aoutsz (abfd);
beb1bf64 2046
dc810e39 2047 size += abfd->section_count * bfd_coff_scnhsz (abfd);
beb1bf64
TR
2048 return size;
2049}
2050
2051
2052
2053static asection *
dc810e39 2054xcoff64_create_csect_from_smclas (abfd, aux, symbol_name)
beb1bf64
TR
2055 bfd *abfd;
2056 union internal_auxent *aux;
2057 const char *symbol_name;
2058{
2059 asection *return_value = NULL;
2060
dc810e39
AM
2061 /* Changes from 32 :
2062 .sv == 8, is only for 32 bit programs
2063 .ti == 12 and .tb == 13 are now reserved. */
2064 static const char *names[19] =
2065 {
beb1bf64
TR
2066 ".pr", ".ro", ".db", ".tc", ".ua", ".rw", ".gl", ".xo",
2067 NULL, ".bs", ".ds", ".uc", NULL, NULL, NULL, ".tc0",
dc810e39 2068 ".td", ".sv64", ".sv3264"
beb1bf64
TR
2069 };
2070
dc810e39
AM
2071 if ((19 >= aux->x_csect.x_smclas)
2072 && (NULL != names[aux->x_csect.x_smclas]))
2073 {
beb1bf64 2074
dc810e39
AM
2075 return_value = bfd_make_section_anyway
2076 (abfd, names[aux->x_csect.x_smclas]);
beb1bf64 2077
dc810e39
AM
2078 }
2079 else
2080 {
2081 (*_bfd_error_handler)
2082 (_("%s: symbol `%s' has unrecognized smclas %d"),
8f615d07 2083 bfd_archive_filename (abfd), symbol_name, aux->x_csect.x_smclas);
dc810e39
AM
2084 bfd_set_error (bfd_error_bad_value);
2085 }
beb1bf64
TR
2086
2087 return return_value;
2088}
2089
dc810e39 2090static boolean
beb1bf64 2091xcoff64_is_lineno_count_overflow (abfd, value)
dc810e39
AM
2092 bfd *abfd ATTRIBUTE_UNUSED;
2093 bfd_vma value ATTRIBUTE_UNUSED;
beb1bf64
TR
2094{
2095 return false;
2096}
2097
dc810e39 2098static boolean
beb1bf64 2099xcoff64_is_reloc_count_overflow (abfd, value)
dc810e39
AM
2100 bfd *abfd ATTRIBUTE_UNUSED;
2101 bfd_vma value ATTRIBUTE_UNUSED;
beb1bf64
TR
2102{
2103 return false;
2104}
2105
814fa6ab 2106static bfd_vma
beb1bf64 2107xcoff64_loader_symbol_offset (abfd, ldhdr)
dc810e39
AM
2108 bfd *abfd ATTRIBUTE_UNUSED;
2109 struct internal_ldhdr *ldhdr;
beb1bf64
TR
2110{
2111 return (ldhdr->l_symoff);
2112}
2113
814fa6ab 2114static bfd_vma
beb1bf64 2115xcoff64_loader_reloc_offset (abfd, ldhdr)
dc810e39
AM
2116 bfd *abfd ATTRIBUTE_UNUSED;
2117 struct internal_ldhdr *ldhdr;
beb1bf64
TR
2118{
2119 return (ldhdr->l_rldoff);
2120}
2121
eb1e0e80
NC
2122static boolean
2123xcoff64_bad_format_hook (abfd, filehdr)
2124 bfd * abfd;
2125 PTR filehdr;
2126{
2127 struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
2128
2129 /* Check flavor first. */
2130 if (bfd_get_flavour (abfd) != bfd_target_xcoff_flavour)
2131 return false;
2132
2133 if (bfd_xcoff_magic_number (abfd) != internal_f->f_magic)
2134 return false;
2135
2136 return true;
2137}
2138
54327882 2139static boolean
69f284c7 2140xcoff64_generate_rtinit (abfd, init, fini, rtld)
9a4c7f16
TR
2141 bfd *abfd;
2142 const char *init;
2143 const char *fini;
69f284c7 2144 boolean rtld;
9a4c7f16
TR
2145{
2146 bfd_byte filehdr_ext[FILHSZ];
69f284c7
TR
2147 bfd_byte scnhdr_ext[SCNHSZ * 3];
2148 bfd_byte syment_ext[SYMESZ * 10];
2149 bfd_byte reloc_ext[RELSZ * 3];
9a4c7f16
TR
2150 bfd_byte *data_buffer;
2151 bfd_size_type data_buffer_size;
2152 bfd_byte *string_table, *st_tmp;
2153 bfd_size_type string_table_size;
2154 bfd_vma val;
2155 size_t initsz, finisz;
2156 struct internal_filehdr filehdr;
69f284c7
TR
2157 struct internal_scnhdr text_scnhdr;
2158 struct internal_scnhdr data_scnhdr;
2159 struct internal_scnhdr bss_scnhdr;
9a4c7f16
TR
2160 struct internal_syment syment;
2161 union internal_auxent auxent;
2162 struct internal_reloc reloc;
54327882 2163
69f284c7 2164 char *text_name = ".text";
9a4c7f16 2165 char *data_name = ".data";
69f284c7 2166 char *bss_name = ".bss";
9a4c7f16 2167 char *rtinit_name = "__rtinit";
69f284c7 2168 char *rtld_name = "__rtld";
54327882 2169
69f284c7 2170 if (! bfd_xcoff_rtinit_size (abfd))
9a4c7f16
TR
2171 return false;
2172
2173 initsz = (init == NULL ? 0 : 1 + strlen (init));
2174 finisz = (fini == NULL ? 0 : 1 + strlen (fini));
2175
eb1e0e80 2176 /* File header. */
9a4c7f16
TR
2177 memset (filehdr_ext, 0, FILHSZ);
2178 memset (&filehdr, 0, sizeof (struct internal_filehdr));
2179 filehdr.f_magic = bfd_xcoff_magic_number (abfd);
54327882 2180 filehdr.f_nscns = 3;
9a4c7f16
TR
2181 filehdr.f_timdat = 0;
2182 filehdr.f_nsyms = 0; /* at least 6, no more than 8 */
2183 filehdr.f_symptr = 0; /* set below */
2184 filehdr.f_opthdr = 0;
2185 filehdr.f_flags = 0;
2186
eb1e0e80 2187 /* Section headers. */
69f284c7
TR
2188 memset (scnhdr_ext, 0, 3 * SCNHSZ);
2189
eb1e0e80 2190 /* Text. */
69f284c7
TR
2191 memset (&text_scnhdr, 0, sizeof (struct internal_scnhdr));
2192 memcpy (text_scnhdr.s_name, text_name, strlen (text_name));
2193 text_scnhdr.s_paddr = 0;
2194 text_scnhdr.s_vaddr = 0;
2195 text_scnhdr.s_size = 0;
2196 text_scnhdr.s_scnptr = 0;
2197 text_scnhdr.s_relptr = 0;
2198 text_scnhdr.s_lnnoptr = 0;
2199 text_scnhdr.s_nreloc = 0;
2200 text_scnhdr.s_nlnno = 0;
2201 text_scnhdr.s_flags = STYP_TEXT;
2202
eb1e0e80 2203 /* Data. */
69f284c7
TR
2204 memset (&data_scnhdr, 0, sizeof (struct internal_scnhdr));
2205 memcpy (data_scnhdr.s_name, data_name, strlen (data_name));
2206 data_scnhdr.s_paddr = 0;
2207 data_scnhdr.s_vaddr = 0;
2208 data_scnhdr.s_size = 0; /* set below */
2209 data_scnhdr.s_scnptr = FILHSZ + 3 * SCNHSZ;
2210 data_scnhdr.s_relptr = 0; /* set below */
2211 data_scnhdr.s_lnnoptr = 0;
2212 data_scnhdr.s_nreloc = 0; /* either 1 or 2 */
2213 data_scnhdr.s_nlnno = 0;
2214 data_scnhdr.s_flags = STYP_DATA;
2215
eb1e0e80 2216 /* Bss. */
69f284c7
TR
2217 memset (&bss_scnhdr, 0, sizeof (struct internal_scnhdr));
2218 memcpy (bss_scnhdr.s_name, bss_name, strlen (bss_name));
2219 bss_scnhdr.s_paddr = 0; /* set below */
2220 bss_scnhdr.s_vaddr = 0; /* set below */
2221 bss_scnhdr.s_size = 0; /* set below */
2222 bss_scnhdr.s_scnptr = 0;
54327882 2223 bss_scnhdr.s_relptr = 0;
69f284c7
TR
2224 bss_scnhdr.s_lnnoptr = 0;
2225 bss_scnhdr.s_nreloc = 0;
2226 bss_scnhdr.s_nlnno = 0;
2227 bss_scnhdr.s_flags = STYP_BSS;
9a4c7f16 2228
54327882 2229 /* .data
9a4c7f16
TR
2230 0x0000 0x00000000 : rtl
2231 0x0004 0x00000000 :
2232 0x0008 0x00000018 : offset to init, or 0
2233 0x000C 0x00000038 : offset to fini, or 0
54327882 2234 0x0010 0x00000010 : size of descriptor
9a4c7f16
TR
2235 0x0014 0x00000000 : pad
2236 0x0018 0x00000000 : init, needs a reloc
2237 0x001C 0x00000000 :
2238 0x0020 0x00000058 : offset to init name
2239 0x0024 0x00000000 : flags, padded to a word
2240 0x0028 0x00000000 : empty init
2241 0x002C 0x00000000 :
54327882
AM
2242 0x0030 0x00000000 :
2243 0x0034 0x00000000 :
9a4c7f16
TR
2244 0x0038 0x00000000 : fini, needs a reloc
2245 0x003C 0x00000000 :
2246 0x0040 0x00000??? : offset to fini name
2247 0x0044 0x00000000 : flags, padded to a word
2248 0x0048 0x00000000 : empty fini
2249 0x004C 0x00000000 :
54327882
AM
2250 0x0050 0x00000000 :
2251 0x0054 0x00000000 :
9a4c7f16
TR
2252 0x0058 init name
2253 0x0058 + initsz fini name */
2254
2255 data_buffer_size = 0x0058 + initsz + finisz;
2256 data_buffer_size += (data_buffer_size & 7) ? 8 - (data_buffer_size & 7) : 0;
330693f5 2257 data_buffer = NULL;
9bab7074 2258 data_buffer = (bfd_byte *) bfd_zmalloc (data_buffer_size);
330693f5
TR
2259 if (data_buffer == NULL)
2260 return false;
54327882 2261
54327882 2262 if (initsz)
9a4c7f16
TR
2263 {
2264 val = 0x18;
2265 bfd_put_32 (abfd, val, &data_buffer[0x08]);
2266 val = 0x58;
2267 bfd_put_32 (abfd, val, &data_buffer[0x20]);
2268 memcpy (&data_buffer[val], init, initsz);
2269 }
2270
54327882 2271 if (finisz)
9a4c7f16
TR
2272 {
2273 val = 0x38;
2274 bfd_put_32 (abfd, val, &data_buffer[0x0C]);
2275 val = 0x58 + initsz;
2276 bfd_put_32 (abfd, val, &data_buffer[0x40]);
2277 memcpy (&data_buffer[val], fini, finisz);
2278 }
2279
2280 val = 0x10;
2281 bfd_put_32 (abfd, val, &data_buffer[0x10]);
69f284c7
TR
2282 data_scnhdr.s_size = data_buffer_size;
2283 bss_scnhdr.s_paddr = bss_scnhdr.s_vaddr = data_scnhdr.s_size;
9a4c7f16 2284
eb1e0e80 2285 /* String table. */
9a4c7f16
TR
2286 string_table_size = 4;
2287 string_table_size += strlen (data_name) + 1;
2288 string_table_size += strlen (rtinit_name) + 1;
2289 string_table_size += initsz;
2290 string_table_size += finisz;
69f284c7
TR
2291 if (true == rtld)
2292 string_table_size += strlen (rtld_name) + 1;
9a4c7f16 2293
9bab7074
AM
2294 string_table = (bfd_byte *) bfd_zmalloc (string_table_size);
2295 if (string_table == NULL)
2296 return false;
2297
9a4c7f16
TR
2298 val = string_table_size;
2299 bfd_put_32 (abfd, val, &string_table[0]);
2300 st_tmp = string_table + 4;
54327882
AM
2301
2302 /* symbols
9a4c7f16
TR
2303 0. .data csect
2304 2. __rtinit
54327882
AM
2305 4. init function
2306 6. fini function
69f284c7
TR
2307 8. __rtld */
2308 memset (syment_ext, 0, 10 * SYMESZ);
2309 memset (reloc_ext, 0, 3 * RELSZ);
9a4c7f16
TR
2310
2311 /* .data csect */
2312 memset (&syment, 0, sizeof (struct internal_syment));
2313 memset (&auxent, 0, sizeof (union internal_auxent));
2314
2315 syment._n._n_n._n_offset = st_tmp - string_table;
2316 memcpy (st_tmp, data_name, strlen (data_name));
2317 st_tmp += strlen (data_name) + 1;
2318
69f284c7 2319 syment.n_scnum = 2;
9a4c7f16
TR
2320 syment.n_sclass = C_HIDEXT;
2321 syment.n_numaux = 1;
2322 auxent.x_csect.x_scnlen.l = data_buffer_size;
2323 auxent.x_csect.x_smtyp = 3 << 3 | XTY_SD;
2324 auxent.x_csect.x_smclas = XMC_RW;
54327882 2325 bfd_coff_swap_sym_out (abfd, &syment,
9a4c7f16 2326 &syment_ext[filehdr.f_nsyms * SYMESZ]);
54327882
AM
2327 bfd_coff_swap_aux_out (abfd, &auxent, syment.n_type, syment.n_sclass, 0,
2328 syment.n_numaux,
9a4c7f16
TR
2329 &syment_ext[(filehdr.f_nsyms + 1) * SYMESZ]);
2330 filehdr.f_nsyms += 2;
2331
2332 /* __rtinit */
2333 memset (&syment, 0, sizeof (struct internal_syment));
2334 memset (&auxent, 0, sizeof (union internal_auxent));
2335 syment._n._n_n._n_offset = st_tmp - string_table;
2336 memcpy (st_tmp, rtinit_name, strlen (rtinit_name));
2337 st_tmp += strlen (rtinit_name) + 1;
54327882 2338
69f284c7 2339 syment.n_scnum = 2;
9a4c7f16
TR
2340 syment.n_sclass = C_EXT;
2341 syment.n_numaux = 1;
2342 auxent.x_csect.x_smtyp = XTY_LD;
2343 auxent.x_csect.x_smclas = XMC_RW;
54327882 2344 bfd_coff_swap_sym_out (abfd, &syment,
9a4c7f16 2345 &syment_ext[filehdr.f_nsyms * SYMESZ]);
54327882
AM
2346 bfd_coff_swap_aux_out (abfd, &auxent, syment.n_type, syment.n_sclass, 0,
2347 syment.n_numaux,
9a4c7f16
TR
2348 &syment_ext[(filehdr.f_nsyms + 1) * SYMESZ]);
2349 filehdr.f_nsyms += 2;
2350
eb1e0e80 2351 /* Init. */
54327882 2352 if (initsz)
9a4c7f16
TR
2353 {
2354 memset (&syment, 0, sizeof (struct internal_syment));
2355 memset (&auxent, 0, sizeof (union internal_auxent));
2356
2357 syment._n._n_n._n_offset = st_tmp - string_table;
2358 memcpy (st_tmp, init, initsz);
2359 st_tmp += initsz;
2360
2361 syment.n_sclass = C_EXT;
2362 syment.n_numaux = 1;
54327882 2363 bfd_coff_swap_sym_out (abfd, &syment,
9a4c7f16 2364 &syment_ext[filehdr.f_nsyms * SYMESZ]);
54327882
AM
2365 bfd_coff_swap_aux_out (abfd, &auxent, syment.n_type, syment.n_sclass, 0,
2366 syment.n_numaux,
9a4c7f16 2367 &syment_ext[(filehdr.f_nsyms + 1) * SYMESZ]);
eb1e0e80 2368 /* Reloc. */
9a4c7f16
TR
2369 memset (&reloc, 0, sizeof (struct internal_reloc));
2370 reloc.r_vaddr = 0x0018;
2371 reloc.r_symndx = filehdr.f_nsyms;
2372 reloc.r_type = R_POS;
2373 reloc.r_size = 63;
2374 bfd_coff_swap_reloc_out (abfd, &reloc, &reloc_ext[0]);
2375
2376 filehdr.f_nsyms += 2;
69f284c7 2377 data_scnhdr.s_nreloc += 1;
9a4c7f16
TR
2378 }
2379
eb1e0e80 2380 /* Finit. */
54327882 2381 if (finisz)
9a4c7f16
TR
2382 {
2383 memset (&syment, 0, sizeof (struct internal_syment));
2384 memset (&auxent, 0, sizeof (union internal_auxent));
2385
2386 syment._n._n_n._n_offset = st_tmp - string_table;
2387 memcpy (st_tmp, fini, finisz);
2388 st_tmp += finisz;
2389
2390 syment.n_sclass = C_EXT;
2391 syment.n_numaux = 1;
54327882 2392 bfd_coff_swap_sym_out (abfd, &syment,
9a4c7f16 2393 &syment_ext[filehdr.f_nsyms * SYMESZ]);
54327882
AM
2394 bfd_coff_swap_aux_out (abfd, &auxent, syment.n_type, syment.n_sclass, 0,
2395 syment.n_numaux,
9a4c7f16
TR
2396 &syment_ext[(filehdr.f_nsyms + 1) * SYMESZ]);
2397
eb1e0e80 2398 /* Reloc. */
9a4c7f16
TR
2399 memset (&reloc, 0, sizeof (struct internal_reloc));
2400 reloc.r_vaddr = 0x0038;
2401 reloc.r_symndx = filehdr.f_nsyms;
2402 reloc.r_type = R_POS;
2403 reloc.r_size = 63;
54327882 2404 bfd_coff_swap_reloc_out (abfd, &reloc,
69f284c7 2405 &reloc_ext[data_scnhdr.s_nreloc * RELSZ]);
9a4c7f16
TR
2406
2407 filehdr.f_nsyms += 2;
69f284c7 2408 data_scnhdr.s_nreloc += 1;
9a4c7f16
TR
2409 }
2410
69f284c7
TR
2411 if (rtld)
2412 {
2413 memset (&syment, 0, sizeof (struct internal_syment));
2414 memset (&auxent, 0, sizeof (union internal_auxent));
2415
2416 syment._n._n_n._n_offset = st_tmp - string_table;
2417 memcpy (st_tmp, rtld_name, strlen (rtld_name));
2418 st_tmp += strlen (rtld_name) + 1;
2419
2420 syment.n_sclass = C_EXT;
2421 syment.n_numaux = 1;
54327882 2422 bfd_coff_swap_sym_out (abfd, &syment,
69f284c7 2423 &syment_ext[filehdr.f_nsyms * SYMESZ]);
54327882
AM
2424 bfd_coff_swap_aux_out (abfd, &auxent, syment.n_type, syment.n_sclass, 0,
2425 syment.n_numaux,
69f284c7
TR
2426 &syment_ext[(filehdr.f_nsyms + 1) * SYMESZ]);
2427
eb1e0e80 2428 /* Reloc. */
69f284c7
TR
2429 memset (&reloc, 0, sizeof (struct internal_reloc));
2430 reloc.r_vaddr = 0x0000;
2431 reloc.r_symndx = filehdr.f_nsyms;
2432 reloc.r_type = R_POS;
2433 reloc.r_size = 63;
54327882 2434 bfd_coff_swap_reloc_out (abfd, &reloc,
69f284c7
TR
2435 &reloc_ext[data_scnhdr.s_nreloc * RELSZ]);
2436
2437 filehdr.f_nsyms += 2;
2438 data_scnhdr.s_nreloc += 1;
2439
2440 bss_scnhdr.s_size = 0;
2441 }
2442
2443 data_scnhdr.s_relptr = data_scnhdr.s_scnptr + data_buffer_size;
2444 filehdr.f_symptr = data_scnhdr.s_relptr + data_scnhdr.s_nreloc * RELSZ;
9a4c7f16
TR
2445
2446 bfd_coff_swap_filehdr_out (abfd, &filehdr, filehdr_ext);
2447 bfd_bwrite (filehdr_ext, FILHSZ, abfd);
69f284c7
TR
2448 bfd_coff_swap_scnhdr_out (abfd, &text_scnhdr, &scnhdr_ext[SCNHSZ * 0]);
2449 bfd_coff_swap_scnhdr_out (abfd, &data_scnhdr, &scnhdr_ext[SCNHSZ * 1]);
2450 bfd_coff_swap_scnhdr_out (abfd, &bss_scnhdr, &scnhdr_ext[SCNHSZ * 2]);
2451 bfd_bwrite (scnhdr_ext, 3 * SCNHSZ, abfd);
9a4c7f16 2452 bfd_bwrite (data_buffer, data_buffer_size, abfd);
69f284c7 2453 bfd_bwrite (reloc_ext, data_scnhdr.s_nreloc * RELSZ, abfd);
9a4c7f16
TR
2454 bfd_bwrite (syment_ext, filehdr.f_nsyms * SYMESZ, abfd);
2455 bfd_bwrite (string_table, string_table_size, abfd);
2456
330693f5
TR
2457 free (data_buffer);
2458 data_buffer = NULL;
2459
9a4c7f16
TR
2460 return true;
2461}
2462
beb1bf64
TR
2463/* The typical dynamic reloc. */
2464
2465static reloc_howto_type xcoff64_dynamic_reloc =
dc810e39
AM
2466HOWTO (0, /* type */
2467 0, /* rightshift */
2468 4, /* size (0 = byte, 1 = short, 2 = long) */
2469 64, /* bitsize */
2470 false, /* pc_relative */
2471 0, /* bitpos */
2472 complain_overflow_bitfield, /* complain_on_overflow */
2473 0, /* special_function */
2474 "R_POS", /* name */
2475 true, /* partial_inplace */
2476 MINUS_ONE, /* src_mask */
2477 MINUS_ONE, /* dst_mask */
2478 false); /* pcrel_offset */
beb1bf64
TR
2479
2480static unsigned long xcoff64_glink_code[10] =
2481{
54327882
AM
2482 0xe9820000, /* ld r12,0(r2) */
2483 0xf8410028, /* std r2,40(r1) */
2484 0xe80c0000, /* ld r0,0(r12) */
2485 0xe84c0008, /* ld r0,8(r12) */
2486 0x7c0903a6, /* mtctr r0 */
2487 0x4e800420, /* bctr */
2488 0x00000000, /* start of traceback table */
2489 0x000ca000, /* traceback table */
2490 0x00000000, /* traceback table */
2491 0x00000018, /* ??? */
beb1bf64
TR
2492};
2493
dc810e39 2494static const struct xcoff_backend_data_rec bfd_xcoff_backend_data =
beb1bf64 2495{
eb1e0e80 2496 { /* COFF backend, defined in libcoff.h. */
54327882
AM
2497 _bfd_xcoff64_swap_aux_in, /* _bfd_coff_swap_aux_in */
2498 _bfd_xcoff64_swap_sym_in, /* _bfd_coff_swap_sym_in */
2499 _bfd_xcoff64_swap_lineno_in, /* _bfd_coff_swap_lineno_in */
2500 _bfd_xcoff64_swap_aux_out, /* _bfd_swap_aux_out */
2501 _bfd_xcoff64_swap_sym_out, /* _bfd_swap_sym_out */
2502 _bfd_xcoff64_swap_lineno_out, /* _bfd_swap_lineno_out */
59862849 2503 xcoff64_swap_reloc_out, /* _bfd_swap_reloc_out */
54327882
AM
2504 coff_swap_filehdr_out, /* _bfd_swap_filehdr_out */
2505 coff_swap_aouthdr_out, /* _bfd_swap_aouthdr_out */
2506 coff_swap_scnhdr_out, /* _bfd_swap_scnhdr_out */
2507 FILHSZ, /* _bfd_filhsz */
2508 AOUTSZ, /* _bfd_aoutsz */
2509 SCNHSZ, /* _bfd_scnhsz */
2510 SYMESZ, /* _bfd_symesz */
2511 AUXESZ, /* _bfd_auxesz */
2512 RELSZ, /* _bfd_relsz */
2513 LINESZ, /* _bfd_linesz */
2514 FILNMLEN, /* _bfd_filnmlen */
2515 true, /* _bfd_coff_long_filenames */
2516 false, /* _bfd_coff_long_section_names */
2517 (3), /* _bfd_coff_default_section_alignment_power */
2518 true, /* _bfd_coff_force_symnames_in_strings */
2519 4, /* _bfd_coff_debug_string_prefix_length */
2520 coff_swap_filehdr_in, /* _bfd_coff_swap_filehdr_in */
2521 coff_swap_aouthdr_in, /* _bfd_swap_aouthdr_in */
2522 coff_swap_scnhdr_in, /* _bfd_swap_scnhdr_in */
59862849 2523 xcoff64_swap_reloc_in, /* _bfd_reloc_in */
54327882
AM
2524 xcoff64_bad_format_hook, /* _bfd_bad_format_hook */
2525 coff_set_arch_mach_hook, /* _bfd_set_arch_mach_hook */
2526 coff_mkobject_hook, /* _bfd_mkobject_hook */
2527 styp_to_sec_flags, /* _bfd_syp_to_sec_flags */
2528 coff_set_alignment_hook, /* _bfd_set_alignment_hook */
2529 coff_slurp_symbol_table, /* _bfd_coff_slurp_symbol_table */
2530 symname_in_debug_hook, /* _coff_symname_in_debug_hook */
2531 coff_pointerize_aux_hook, /* _bfd_coff_pointerize_aux_hook */
2532 coff_print_aux, /* bfd_coff_print_aux */
2533 dummy_reloc16_extra_cases, /* _bfd_coff_reloc16_extra_cases */
2534 dummy_reloc16_estimate, /* _bfd_coff_reloc16_estimate */
2535 NULL, /* bfd_coff_sym_is_global */
dc810e39 2536 /* _bfd_coff_compute_section_file_positions */
beb1bf64 2537 coff_compute_section_file_positions,
54327882
AM
2538 NULL , /* _bfd_coff_start_final_link */
2539 xcoff64_ppc_relocate_section, /* _bfd_coff_relocate_section */
2540 coff_rtype_to_howto, /* _bfd_coff_rtype_to_howto */
2541 NULL , /* _bfd_coff_addust_symndx */
2542 _bfd_generic_link_add_one_symbol, /* _bfd_coff_add_one_symbol */
2543 coff_link_output_has_begun, /* _bfd_coff_link_output_has_begun */
2544 coff_final_link_postscript /* _bfd_coff_final_link_postscript */
beb1bf64
TR
2545 },
2546
54327882
AM
2547 0x01EF, /* magic number */
2548 bfd_arch_powerpc, /* architecture */
2549 bfd_mach_ppc_620, /* machine */
beb1bf64 2550
eb1e0e80 2551 /* Function pointers to xcoff specific swap routines. */
54327882
AM
2552 xcoff64_swap_ldhdr_in, /* _xcoff_swap_ldhdr_in */
2553 xcoff64_swap_ldhdr_out, /* _xcoff_swap_ldhdr_out */
2554 xcoff64_swap_ldsym_in, /* _xcoff_swap_ldsym_in */
2555 xcoff64_swap_ldsym_out, /* _xcoff_swap_ldsym_out */
2556 xcoff64_swap_ldrel_in, /* _xcoff_swap_ldrel_in */
2557 xcoff64_swap_ldrel_out, /* _xcoff_swap_ldrel_out */
beb1bf64 2558
eb1e0e80 2559 /* Sizes. */
54327882
AM
2560 LDHDRSZ, /* _xcoff_ldhdrsz */
2561 LDSYMSZ, /* _xcoff_ldsymsz */
2562 LDRELSZ, /* _xcoff_ldrelsz */
2563 24, /* _xcoff_function_descriptor_size */
2564 0, /* _xcoff_small_aout_header_size */
eb1e0e80
NC
2565
2566 /* Versions. */
54327882 2567 2, /* _xcoff_ldhdr_version */
beb1bf64 2568
eb1e0e80 2569 /* xcoff vs xcoff64 putting symbol names. */
54327882
AM
2570 _bfd_xcoff64_put_symbol_name, /* _xcoff_put_symbol_name */
2571 _bfd_xcoff64_put_ldsymbol_name, /* _xcoff_put_ldsymbol_name */
beb1bf64 2572
eb1e0e80 2573 /* Dynamic reloc howto. */
beb1bf64
TR
2574 &xcoff64_dynamic_reloc,
2575
dc810e39 2576 xcoff64_create_csect_from_smclas,
beb1bf64 2577
eb1e0e80 2578 /* Lineno and reloc count overflow. */
beb1bf64
TR
2579 xcoff64_is_lineno_count_overflow,
2580 xcoff64_is_reloc_count_overflow,
dc810e39 2581
beb1bf64
TR
2582 xcoff64_loader_symbol_offset,
2583 xcoff64_loader_reloc_offset,
2584
eb1e0e80 2585 /* glink. */
beb1bf64 2586 &xcoff64_glink_code[0],
54327882 2587 40, /* _xcoff_glink_size */
beb1bf64 2588
eb1e0e80 2589 /* rtinit. */
54327882
AM
2590 88, /* _xcoff_rtinit_size */
2591 xcoff64_generate_rtinit, /* _xcoff_generate_rtinit */
beb1bf64
TR
2592};
2593
eb1e0e80 2594/* The transfer vector that leads the outside world to all of the above. */
beb1bf64
TR
2595const bfd_target rs6000coff64_vec =
2596{
2597 "aixcoff64-rs6000",
2598 bfd_target_xcoff_flavour,
2599 BFD_ENDIAN_BIG, /* data byte order is big */
2600 BFD_ENDIAN_BIG, /* header byte order is big */
2601
2602 (HAS_RELOC | EXEC_P | /* object flags */
2603 HAS_LINENO | HAS_DEBUG | DYNAMIC |
2604 HAS_SYMS | HAS_LOCALS | WP_TEXT),
2605
2606 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
2607 0, /* leading char */
2608 '/', /* ar_pad_char */
2609 15, /* ar_max_namelen??? FIXMEmgo */
2610
dc810e39 2611 /* data */
54327882
AM
2612 bfd_getb64, /* bfd_getx64 */
2613 bfd_getb_signed_64, /* bfd_getx_signed_64 */
2614 bfd_putb64, /* bfd_putx64 */
2615 bfd_getb32, /* bfd_getx32 */
2616 bfd_getb_signed_32, /* bfd_getx_signed_32 */
2617 bfd_putb32, /* bfd_putx32 */
2618 bfd_getb16, /* bfd_getx16 */
2619 bfd_getb_signed_16, /* bfd_getx_signed_16 */
2620 bfd_putb16, /* bfd_putx16 */
beb1bf64 2621
dc810e39 2622 /* hdrs */
54327882
AM
2623 bfd_getb64, /* bfd_h_getx64 */
2624 bfd_getb_signed_64, /* bfd_h_getx_signed_64 */
2625 bfd_putb64, /* bfd_h_putx64 */
2626 bfd_getb32, /* bfd_h_getx32 */
2627 bfd_getb_signed_32, /* bfd_h_getx_signed_32 */
2628 bfd_putb32, /* bfd_h_putx32 */
2629 bfd_getb16, /* bfd_h_getx16 */
2630 bfd_getb_signed_16, /* bfd_h_getx_signed_16 */
2631 bfd_putb16, /* bfd_h_putx16 */
dc810e39 2632
beb1bf64 2633 { /* bfd_check_format */
dc810e39
AM
2634 _bfd_dummy_target,
2635 coff_object_p,
2636 xcoff64_archive_p,
2637 CORE_FILE_P
beb1bf64 2638 },
dc810e39 2639
beb1bf64 2640 { /* bfd_set_format */
dc810e39 2641 bfd_false,
beb1bf64 2642 coff_mkobject,
dc810e39 2643 _bfd_generic_mkarchive,
beb1bf64
TR
2644 bfd_false
2645 },
dc810e39 2646
beb1bf64 2647 {/* bfd_write_contents */
dc810e39 2648 bfd_false,
beb1bf64 2649 xcoff64_write_object_contents,
dc810e39 2650 _bfd_xcoff_write_archive_contents,
beb1bf64
TR
2651 bfd_false
2652 },
dc810e39 2653
beb1bf64 2654 /* Generic */
54327882
AM
2655 bfd_true, /* _close_and_cleanup */
2656 bfd_true, /* _bfd_free_cached_info */
2657 coff_new_section_hook, /* _new_section_hook */
2658 _bfd_generic_get_section_contents, /* _bfd_get_section_contents */
dc810e39
AM
2659 /* _bfd_get_section_contents_in_window */
2660 _bfd_generic_get_section_contents_in_window,
beb1bf64
TR
2661
2662 /* Copy */
54327882 2663 _bfd_xcoff_copy_private_bfd_data, /* _bfd_copy_private_bfd */
dc810e39 2664 /* _bfd_merge_private_bfd_data */
beb1bf64 2665 ((boolean (*) (bfd *, bfd *)) bfd_true),
dc810e39 2666 /* _bfd_copy_pivate_section_data */
beb1bf64 2667 ((boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true),
dc810e39 2668 /* _bfd_copy_private_symbol_data */
beb1bf64
TR
2669 ((boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true),
2670 ((boolean (*) (bfd *, flagword)) bfd_true), /* _bfd_set_private_flags */
2671 ((boolean (*) (bfd *, void * )) bfd_true), /* _bfd_print_private_bfd_data */
2672
2673 /* Core */
54327882
AM
2674 coff_core_file_failing_command, /* _core_file_failing_command */
2675 coff_core_file_failing_signal, /* _core_file_failing_signal */
2676 coff_core_file_matches_executable_p, /* _core_file_matches_executable_p */
beb1bf64
TR
2677
2678 /* Archive */
54327882
AM
2679 xcoff64_slurp_armap, /* _slurp_armap */
2680 /* XCOFF archives do not have anything which corresponds to an
2681 extended name table. */
2682 bfd_false, /* _slurp_extended_name_table */
dc810e39 2683 /* _construct_extended_name_table */
beb1bf64 2684 ((boolean (*) (bfd *, char **, bfd_size_type *, const char **)) bfd_false),
54327882
AM
2685 bfd_dont_truncate_arname, /* _truncate_arname */
2686 _bfd_xcoff_write_armap, /* _write_armap */
2687 _bfd_xcoff_read_ar_hdr, /* _read_ar_hdr */
2688 xcoff64_openr_next_archived_file, /* _openr_next_archived_file */
2689 _bfd_generic_get_elt_at_index, /* _get_elt_at_index */
2690 _bfd_xcoff_stat_arch_elt, /* _generic_stat_arch_elt */
2691 /* XCOFF archives do not have a timestamp. */
2692 bfd_true, /* _update_armap_timestamp */
beb1bf64
TR
2693
2694 /* Symbols */
54327882
AM
2695 coff_get_symtab_upper_bound, /* _get_symtab_upper_bound */
2696 coff_get_symtab, /* _get_symtab */
2697 coff_make_empty_symbol, /* _make_empty_symbol */
2698 coff_print_symbol, /* _print_symbol */
2699 coff_get_symbol_info, /* _get_symbol_info */
2700 _bfd_xcoff_is_local_label_name, /* _bfd_is_local_label_name */
2701 coff_get_lineno, /* _get_lineno */
2702 coff_find_nearest_line, /* _find_nearest_line */
2703 coff_bfd_make_debug_symbol, /* _bfd_make_debug_symbol */
2704 _bfd_generic_read_minisymbols, /* _read_minisymbols */
2705 _bfd_generic_minisymbol_to_symbol, /* _minsymbol_to_symbol */
beb1bf64
TR
2706
2707 /* Reloc */
54327882
AM
2708 coff_get_reloc_upper_bound, /* _get_reloc_upper_bound */
2709 coff_canonicalize_reloc, /* _cononicalize_reloc */
2710 xcoff64_reloc_type_lookup, /* _bfd_reloc_type_lookup */
beb1bf64
TR
2711
2712 /* Write */
54327882
AM
2713 coff_set_arch_mach, /* _set_arch_mach */
2714 coff_set_section_contents, /* _set_section_contents */
beb1bf64
TR
2715
2716 /* Link */
54327882 2717 xcoff64_sizeof_headers, /* _sizeof_headers */
dc810e39 2718 /* _bfd_get_relocated_section_contents */
beb1bf64 2719 bfd_generic_get_relocated_section_contents,
54327882
AM
2720 bfd_generic_relax_section, /* _bfd_relax_section */
2721 _bfd_xcoff_bfd_link_hash_table_create,/* _bfd_link_hash_table_create */
e2d34d7d 2722 _bfd_generic_link_hash_table_free, /* _bfd_link_hash_table_free */
54327882 2723 _bfd_xcoff_bfd_link_add_symbols, /* _bfd_link_add_symbols */
2d653fc7
AM
2724 _bfd_generic_link_just_syms, /* _bfd_link_just_syms */
2725 _bfd_xcoff_bfd_final_link, /* _bfd_final_link */
54327882
AM
2726 _bfd_generic_link_split_section, /* _bfd_link_split_section */
2727 bfd_generic_gc_sections, /* _bfd_gc_sections */
2728 bfd_generic_merge_sections, /* _bfd_merge_sections */
e61463e1 2729 bfd_generic_discard_group, /* _bfd_discard_group */
beb1bf64
TR
2730
2731 /* Dynamic */
dc810e39
AM
2732 /* _get_dynamic_symtab_upper_bound */
2733 _bfd_xcoff_get_dynamic_symtab_upper_bound,
beb1bf64
TR
2734 _bfd_xcoff_canonicalize_dynamic_symtab, /* _cononicalize_dynamic_symtab */
2735 _bfd_xcoff_get_dynamic_reloc_upper_bound,/* _get_dynamic_reloc_upper_bound */
2736 _bfd_xcoff_canonicalize_dynamic_reloc, /* _cononicalize_dynamic_reloc */
2737
2738 /* Opposite endian version, none exists */
2739 NULL,
dc810e39 2740
beb1bf64
TR
2741 /* back end data */
2742 (void *) &bfd_xcoff_backend_data,
2743};
eb1e0e80 2744
54327882
AM
2745extern const bfd_target *xcoff64_core_p PARAMS ((bfd *));
2746extern boolean xcoff64_core_file_matches_executable_p PARAMS((bfd *, bfd *));
2747extern char *xcoff64_core_file_failing_command PARAMS ((bfd *));
2748extern int xcoff64_core_file_failing_signal PARAMS ((bfd *));
eb1e0e80
NC
2749
2750/* AIX 5 */
54327882 2751static const struct xcoff_backend_data_rec bfd_xcoff_aix5_backend_data =
eb1e0e80
NC
2752{
2753 { /* COFF backend, defined in libcoff.h. */
54327882
AM
2754 _bfd_xcoff64_swap_aux_in, /* _bfd_coff_swap_aux_in */
2755 _bfd_xcoff64_swap_sym_in, /* _bfd_coff_swap_sym_in */
2756 _bfd_xcoff64_swap_lineno_in, /* _bfd_coff_swap_lineno_in */
2757 _bfd_xcoff64_swap_aux_out, /* _bfd_swap_aux_out */
2758 _bfd_xcoff64_swap_sym_out, /* _bfd_swap_sym_out */
2759 _bfd_xcoff64_swap_lineno_out, /* _bfd_swap_lineno_out */
59862849 2760 xcoff64_swap_reloc_out, /* _bfd_swap_reloc_out */
54327882
AM
2761 coff_swap_filehdr_out, /* _bfd_swap_filehdr_out */
2762 coff_swap_aouthdr_out, /* _bfd_swap_aouthdr_out */
2763 coff_swap_scnhdr_out, /* _bfd_swap_scnhdr_out */
2764 FILHSZ, /* _bfd_filhsz */
2765 AOUTSZ, /* _bfd_aoutsz */
2766 SCNHSZ, /* _bfd_scnhsz */
2767 SYMESZ, /* _bfd_symesz */
2768 AUXESZ, /* _bfd_auxesz */
2769 RELSZ, /* _bfd_relsz */
2770 LINESZ, /* _bfd_linesz */
2771 FILNMLEN, /* _bfd_filnmlen */
2772 true, /* _bfd_coff_long_filenames */
2773 false, /* _bfd_coff_long_section_names */
2774 (3), /* _bfd_coff_default_section_alignment_power */
2775 true, /* _bfd_coff_force_symnames_in_strings */
2776 4, /* _bfd_coff_debug_string_prefix_length */
2777 coff_swap_filehdr_in, /* _bfd_coff_swap_filehdr_in */
2778 coff_swap_aouthdr_in, /* _bfd_swap_aouthdr_in */
2779 coff_swap_scnhdr_in, /* _bfd_swap_scnhdr_in */
59862849 2780 xcoff64_swap_reloc_in, /* _bfd_reloc_in */
54327882
AM
2781 xcoff64_bad_format_hook, /* _bfd_bad_format_hook */
2782 coff_set_arch_mach_hook, /* _bfd_set_arch_mach_hook */
2783 coff_mkobject_hook, /* _bfd_mkobject_hook */
2784 styp_to_sec_flags, /* _bfd_syp_to_sec_flags */
2785 coff_set_alignment_hook, /* _bfd_set_alignment_hook */
2786 coff_slurp_symbol_table, /* _bfd_coff_slurp_symbol_table */
2787 symname_in_debug_hook, /* _coff_symname_in_debug_hook */
2788 coff_pointerize_aux_hook, /* _bfd_coff_pointerize_aux_hook */
2789 coff_print_aux, /* bfd_coff_print_aux */
2790 dummy_reloc16_extra_cases, /* _bfd_coff_reloc16_extra_cases */
2791 dummy_reloc16_estimate, /* _bfd_coff_reloc16_estimate */
2792 NULL, /* bfd_coff_sym_is_global */
2793 /* _bfd_coff_compute_section_file_positions */
eb1e0e80 2794 coff_compute_section_file_positions,
54327882
AM
2795 NULL , /* _bfd_coff_start_final_link */
2796 xcoff64_ppc_relocate_section, /* _bfd_coff_relocate_section */
2797 coff_rtype_to_howto, /* _bfd_coff_rtype_to_howto */
2798 NULL , /* _bfd_coff_addust_symndx */
2799 _bfd_generic_link_add_one_symbol, /* _bfd_coff_add_one_symbol */
2800 coff_link_output_has_begun, /* _bfd_coff_link_output_has_begun */
2801 coff_final_link_postscript /* _bfd_coff_final_link_postscript */
eb1e0e80
NC
2802 },
2803
54327882
AM
2804 U64_TOCMAGIC, /* magic number */
2805 bfd_arch_powerpc, /* architecture */
2806 bfd_mach_ppc_620, /* machine */
eb1e0e80 2807
54327882
AM
2808 /* Function pointers to xcoff specific swap routines. */
2809 xcoff64_swap_ldhdr_in, /* _xcoff_swap_ldhdr_in */
2810 xcoff64_swap_ldhdr_out, /* _xcoff_swap_ldhdr_out */
2811 xcoff64_swap_ldsym_in, /* _xcoff_swap_ldsym_in */
2812 xcoff64_swap_ldsym_out, /* _xcoff_swap_ldsym_out */
2813 xcoff64_swap_ldrel_in, /* _xcoff_swap_ldrel_in */
2814 xcoff64_swap_ldrel_out, /* _xcoff_swap_ldrel_out */
eb1e0e80
NC
2815
2816 /* Sizes. */
54327882
AM
2817 LDHDRSZ, /* _xcoff_ldhdrsz */
2818 LDSYMSZ, /* _xcoff_ldsymsz */
2819 LDRELSZ, /* _xcoff_ldrelsz */
2820 24, /* _xcoff_function_descriptor_size */
2821 0, /* _xcoff_small_aout_header_size */
eb1e0e80 2822 /* Versions. */
54327882 2823 2, /* _xcoff_ldhdr_version */
eb1e0e80 2824
54327882
AM
2825 _bfd_xcoff64_put_symbol_name, /* _xcoff_put_symbol_name */
2826 _bfd_xcoff64_put_ldsymbol_name, /* _xcoff_put_ldsymbol_name */
eb1e0e80
NC
2827
2828 /* Dynamic reloc howto. */
2829 &xcoff64_dynamic_reloc,
54327882 2830 xcoff64_create_csect_from_smclas,
eb1e0e80
NC
2831
2832 /* Lineno and reloc count overflow. */
2833 xcoff64_is_lineno_count_overflow,
2834 xcoff64_is_reloc_count_overflow,
54327882 2835
eb1e0e80
NC
2836 xcoff64_loader_symbol_offset,
2837 xcoff64_loader_reloc_offset,
2838
2839 /* glink. */
2840 &xcoff64_glink_code[0],
54327882 2841 40, /* _xcoff_glink_size */
eb1e0e80
NC
2842
2843 /* rtinit. */
54327882
AM
2844 88, /* _xcoff_rtinit_size */
2845 xcoff64_generate_rtinit, /* _xcoff_generate_rtinit */
eb1e0e80
NC
2846};
2847
2848/* The transfer vector that leads the outside world to all of the above. */
2849const bfd_target aix5coff64_vec =
2850{
2851 "aix5coff64-rs6000",
2852 bfd_target_xcoff_flavour,
2853 BFD_ENDIAN_BIG, /* data byte order is big */
2854 BFD_ENDIAN_BIG, /* header byte order is big */
2855
2856 (HAS_RELOC | EXEC_P | /* object flags */
2857 HAS_LINENO | HAS_DEBUG | DYNAMIC |
2858 HAS_SYMS | HAS_LOCALS | WP_TEXT),
2859
2860 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
2861 0, /* leading char */
2862 '/', /* ar_pad_char */
2863 15, /* ar_max_namelen??? FIXMEmgo */
2864
54327882
AM
2865 /* data */
2866 bfd_getb64, /* bfd_getx64 */
2867 bfd_getb_signed_64, /* bfd_getx_signed_64 */
2868 bfd_putb64, /* bfd_putx64 */
2869 bfd_getb32, /* bfd_getx32 */
2870 bfd_getb_signed_32, /* bfd_getx_signed_32 */
2871 bfd_putb32, /* bfd_putx32 */
2872 bfd_getb16, /* bfd_getx16 */
2873 bfd_getb_signed_16, /* bfd_getx_signed_16 */
2874 bfd_putb16, /* bfd_putx16 */
2875
2876 /* hdrs */
2877 bfd_getb64, /* bfd_h_getx64 */
2878 bfd_getb_signed_64, /* bfd_h_getx_signed_64 */
2879 bfd_putb64, /* bfd_h_putx64 */
2880 bfd_getb32, /* bfd_h_getx32 */
2881 bfd_getb_signed_32, /* bfd_h_getx_signed_32 */
2882 bfd_putb32, /* bfd_h_putx32 */
2883 bfd_getb16, /* bfd_h_getx16 */
2884 bfd_getb_signed_16, /* bfd_h_getx_signed_16 */
2885 bfd_putb16, /* bfd_h_putx16 */
2886
eb1e0e80 2887 { /* bfd_check_format */
54327882
AM
2888 _bfd_dummy_target,
2889 coff_object_p,
2890 xcoff64_archive_p,
eb1e0e80
NC
2891 xcoff64_core_p
2892 },
54327882 2893
eb1e0e80 2894 { /* bfd_set_format */
54327882 2895 bfd_false,
eb1e0e80 2896 coff_mkobject,
54327882 2897 _bfd_generic_mkarchive,
eb1e0e80
NC
2898 bfd_false
2899 },
54327882 2900
eb1e0e80 2901 {/* bfd_write_contents */
54327882 2902 bfd_false,
eb1e0e80 2903 xcoff64_write_object_contents,
54327882 2904 _bfd_xcoff_write_archive_contents,
eb1e0e80
NC
2905 bfd_false
2906 },
54327882 2907
eb1e0e80 2908 /* Generic */
54327882
AM
2909 bfd_true, /* _close_and_cleanup */
2910 bfd_true, /* _bfd_free_cached_info */
2911 coff_new_section_hook, /* _new_section_hook */
2912 _bfd_generic_get_section_contents, /* _bfd_get_section_contents */
2913 /* _bfd_get_section_contents_in_window */
2914 _bfd_generic_get_section_contents_in_window,
eb1e0e80
NC
2915
2916 /* Copy */
54327882
AM
2917 _bfd_xcoff_copy_private_bfd_data, /* _bfd_copy_private_bfd */
2918 /* _bfd_merge_private_bfd_data */
eb1e0e80 2919 ((boolean (*) (bfd *, bfd *)) bfd_true),
54327882 2920 /* _bfd_copy_pivate_section_data */
eb1e0e80 2921 ((boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true),
54327882 2922 /* _bfd_copy_private_symbol_data */
eb1e0e80
NC
2923 ((boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true),
2924 ((boolean (*) (bfd *, flagword)) bfd_true), /* _bfd_set_private_flags */
2925 ((boolean (*) (bfd *, void * )) bfd_true), /* _bfd_print_private_bfd_data */
2926
2927 /* Core */
54327882
AM
2928 xcoff64_core_file_failing_command, /* _core_file_failing_command */
2929 xcoff64_core_file_failing_signal, /* _core_file_failing_signal */
eb1e0e80
NC
2930 xcoff64_core_file_matches_executable_p, /* _core_file_matches_executable_p */
2931
2932 /* Archive */
54327882
AM
2933 xcoff64_slurp_armap, /* _slurp_armap */
2934 /* XCOFF archives do not have anything which corresponds to an
2935 extended name table. */
2936 bfd_false, /* _slurp_extended_name_table */
2937 /* _construct_extended_name_table */
eb1e0e80 2938 ((boolean (*) (bfd *, char **, bfd_size_type *, const char **)) bfd_false),
54327882
AM
2939 bfd_dont_truncate_arname, /* _truncate_arname */
2940 _bfd_xcoff_write_armap, /* _write_armap */
2941 _bfd_xcoff_read_ar_hdr, /* _read_ar_hdr */
2942 xcoff64_openr_next_archived_file, /* _openr_next_archived_file */
2943 _bfd_generic_get_elt_at_index, /* _get_elt_at_index */
2944 _bfd_xcoff_stat_arch_elt, /* _generic_stat_arch_elt */
2945 /* XCOFF archives do not have a timestamp. */
2946 bfd_true, /* _update_armap_timestamp */
eb1e0e80
NC
2947
2948 /* Symbols */
54327882
AM
2949 coff_get_symtab_upper_bound, /* _get_symtab_upper_bound */
2950 coff_get_symtab, /* _get_symtab */
2951 coff_make_empty_symbol, /* _make_empty_symbol */
2952 coff_print_symbol, /* _print_symbol */
2953 coff_get_symbol_info, /* _get_symbol_info */
2954 _bfd_xcoff_is_local_label_name, /* _bfd_is_local_label_name */
2955 coff_get_lineno, /* _get_lineno */
2956 coff_find_nearest_line, /* _find_nearest_line */
2957 coff_bfd_make_debug_symbol, /* _bfd_make_debug_symbol */
2958 _bfd_generic_read_minisymbols, /* _read_minisymbols */
2959 _bfd_generic_minisymbol_to_symbol, /* _minsymbol_to_symbol */
eb1e0e80
NC
2960
2961 /* Reloc */
54327882
AM
2962 coff_get_reloc_upper_bound, /* _get_reloc_upper_bound */
2963 coff_canonicalize_reloc, /* _cononicalize_reloc */
2964 xcoff64_reloc_type_lookup, /* _bfd_reloc_type_lookup */
eb1e0e80
NC
2965
2966 /* Write */
54327882
AM
2967 coff_set_arch_mach, /* _set_arch_mach */
2968 coff_set_section_contents, /* _set_section_contents */
eb1e0e80
NC
2969
2970 /* Link */
54327882
AM
2971 xcoff64_sizeof_headers, /* _sizeof_headers */
2972 /* _bfd_get_relocated_section_contents */
eb1e0e80 2973 bfd_generic_get_relocated_section_contents,
54327882
AM
2974 bfd_generic_relax_section, /* _bfd_relax_section */
2975 _bfd_xcoff_bfd_link_hash_table_create,/* _bfd_link_hash_table_create */
e2d34d7d 2976 _bfd_generic_link_hash_table_free, /* _bfd_link_hash_table_free */
54327882 2977 _bfd_xcoff_bfd_link_add_symbols, /* _bfd_link_add_symbols */
2d653fc7
AM
2978 _bfd_generic_link_just_syms, /* _bfd_link_just_syms */
2979 _bfd_xcoff_bfd_final_link, /* _bfd_final_link */
54327882
AM
2980 _bfd_generic_link_split_section, /* _bfd_link_split_section */
2981 bfd_generic_gc_sections, /* _bfd_gc_sections */
2982 bfd_generic_merge_sections, /* _bfd_merge_sections */
e61463e1 2983 bfd_generic_discard_group, /* _bfd_discard_group */
eb1e0e80
NC
2984
2985 /* Dynamic */
54327882
AM
2986 /* _get_dynamic_symtab_upper_bound */
2987 _bfd_xcoff_get_dynamic_symtab_upper_bound,
eb1e0e80
NC
2988 _bfd_xcoff_canonicalize_dynamic_symtab, /* _cononicalize_dynamic_symtab */
2989 _bfd_xcoff_get_dynamic_reloc_upper_bound,/* _get_dynamic_reloc_upper_bound */
2990 _bfd_xcoff_canonicalize_dynamic_reloc, /* _cononicalize_dynamic_reloc */
2991
2992 /* Opposite endian version, none exists. */
2993 NULL,
54327882 2994
eb1e0e80
NC
2995 /* back end data */
2996 (void *) & bfd_xcoff_aix5_backend_data,
2997};
This page took 0.264911 seconds and 4 git commands to generate.