e670a8bb2b6b5c4cac48f1daf3b7bf34d18c9f1e
[deliverable/binutils-gdb.git] / bfd / coff-alpha.c
1 /* BFD back-end for ALPHA Extended-Coff files.
2 Copyright 1993, 1994 Free Software Foundation, Inc.
3 Modified from coff-mips.c by Steve Chamberlain <sac@cygnus.com> and
4 Ian Lance Taylor <ian@cygnus.com>.
5
6 This file is part of BFD, the Binary File Descriptor library.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
21
22 #include "bfd.h"
23 #include "sysdep.h"
24 #include "bfdlink.h"
25 #include "libbfd.h"
26 #include "coff/internal.h"
27 #include "coff/sym.h"
28 #include "coff/symconst.h"
29 #include "coff/ecoff.h"
30 #include "coff/alpha.h"
31 #include "libcoff.h"
32 #include "libecoff.h"
33 \f
34 /* Prototypes for static functions. */
35
36 static bfd_target *alpha_ecoff_object_p PARAMS ((bfd *));
37 static boolean alpha_ecoff_bad_format_hook PARAMS ((bfd *abfd, PTR filehdr));
38 static void alpha_ecoff_swap_reloc_in PARAMS ((bfd *, PTR,
39 struct internal_reloc *));
40 static void alpha_ecoff_swap_reloc_out PARAMS ((bfd *,
41 const struct internal_reloc *,
42 PTR));
43 static void alpha_adjust_reloc_in PARAMS ((bfd *,
44 const struct internal_reloc *,
45 arelent *));
46 static void alpha_adjust_reloc_out PARAMS ((bfd *, const arelent *,
47 struct internal_reloc *));
48 static bfd_byte *alpha_ecoff_get_relocated_section_contents
49 PARAMS ((bfd *abfd, struct bfd_link_info *, struct bfd_link_order *,
50 bfd_byte *data, boolean relocateable, asymbol **symbols));
51 static bfd_vma alpha_convert_external_reloc
52 PARAMS ((bfd *, struct bfd_link_info *, bfd *, struct external_reloc *,
53 struct ecoff_link_hash_entry *));
54 static boolean alpha_relocate_section PARAMS ((bfd *, struct bfd_link_info *,
55 bfd *, asection *,
56 bfd_byte *, PTR));
57 \f
58 /* ECOFF has COFF sections, but the debugging information is stored in
59 a completely different format. ECOFF targets use some of the
60 swapping routines from coffswap.h, and some of the generic COFF
61 routines in coffgen.c, but, unlike the real COFF targets, do not
62 use coffcode.h itself.
63
64 Get the generic COFF swapping routines, except for the reloc,
65 symbol, and lineno ones. Give them ecoff names. Define some
66 accessor macros for the large sizes used for Alpha ECOFF. */
67
68 #define GET_FILEHDR_SYMPTR bfd_h_get_64
69 #define PUT_FILEHDR_SYMPTR bfd_h_put_64
70 #define GET_AOUTHDR_TSIZE bfd_h_get_64
71 #define PUT_AOUTHDR_TSIZE bfd_h_put_64
72 #define GET_AOUTHDR_DSIZE bfd_h_get_64
73 #define PUT_AOUTHDR_DSIZE bfd_h_put_64
74 #define GET_AOUTHDR_BSIZE bfd_h_get_64
75 #define PUT_AOUTHDR_BSIZE bfd_h_put_64
76 #define GET_AOUTHDR_ENTRY bfd_h_get_64
77 #define PUT_AOUTHDR_ENTRY bfd_h_put_64
78 #define GET_AOUTHDR_TEXT_START bfd_h_get_64
79 #define PUT_AOUTHDR_TEXT_START bfd_h_put_64
80 #define GET_AOUTHDR_DATA_START bfd_h_get_64
81 #define PUT_AOUTHDR_DATA_START bfd_h_put_64
82 #define GET_SCNHDR_PADDR bfd_h_get_64
83 #define PUT_SCNHDR_PADDR bfd_h_put_64
84 #define GET_SCNHDR_VADDR bfd_h_get_64
85 #define PUT_SCNHDR_VADDR bfd_h_put_64
86 #define GET_SCNHDR_SIZE bfd_h_get_64
87 #define PUT_SCNHDR_SIZE bfd_h_put_64
88 #define GET_SCNHDR_SCNPTR bfd_h_get_64
89 #define PUT_SCNHDR_SCNPTR bfd_h_put_64
90 #define GET_SCNHDR_RELPTR bfd_h_get_64
91 #define PUT_SCNHDR_RELPTR bfd_h_put_64
92 #define GET_SCNHDR_LNNOPTR bfd_h_get_64
93 #define PUT_SCNHDR_LNNOPTR bfd_h_put_64
94
95 #define ALPHAECOFF
96
97 #define NO_COFF_RELOCS
98 #define NO_COFF_SYMBOLS
99 #define NO_COFF_LINENOS
100 #define coff_swap_filehdr_in alpha_ecoff_swap_filehdr_in
101 #define coff_swap_filehdr_out alpha_ecoff_swap_filehdr_out
102 #define coff_swap_aouthdr_in alpha_ecoff_swap_aouthdr_in
103 #define coff_swap_aouthdr_out alpha_ecoff_swap_aouthdr_out
104 #define coff_swap_scnhdr_in alpha_ecoff_swap_scnhdr_in
105 #define coff_swap_scnhdr_out alpha_ecoff_swap_scnhdr_out
106 #include "coffswap.h"
107
108 /* Get the ECOFF swapping routines. */
109 #define ECOFF_64
110 #include "ecoffswap.h"
111 \f
112 /* How to process the various reloc types. */
113
114 static bfd_reloc_status_type
115 reloc_nil (abfd, reloc, sym, data, sec, output_bfd)
116 bfd *abfd;
117 arelent *reloc;
118 asymbol *sym;
119 PTR data;
120 asection *sec;
121 bfd *output_bfd;
122 {
123 return bfd_reloc_ok;
124 }
125
126 /* In case we're on a 32-bit machine, construct a 64-bit "-1" value
127 from smaller values. Start with zero, widen, *then* decrement. */
128 #define MINUS_ONE (((bfd_vma)0) - 1)
129
130 static reloc_howto_type alpha_howto_table[] =
131 {
132 /* Reloc type 0 is ignored by itself. However, it appears after a
133 GPDISP reloc to identify the location where the low order 16 bits
134 of the gp register are loaded. */
135 HOWTO (ALPHA_R_IGNORE, /* type */
136 0, /* rightshift */
137 0, /* size (0 = byte, 1 = short, 2 = long) */
138 8, /* bitsize */
139 true, /* pc_relative */
140 0, /* bitpos */
141 complain_overflow_dont, /* complain_on_overflow */
142 reloc_nil, /* special_function */
143 "IGNORE", /* name */
144 true, /* partial_inplace */
145 0, /* src_mask */
146 0, /* dst_mask */
147 true), /* pcrel_offset */
148
149 /* A 32 bit reference to a symbol. */
150 HOWTO (ALPHA_R_REFLONG, /* type */
151 0, /* rightshift */
152 2, /* size (0 = byte, 1 = short, 2 = long) */
153 32, /* bitsize */
154 false, /* pc_relative */
155 0, /* bitpos */
156 complain_overflow_bitfield, /* complain_on_overflow */
157 0, /* special_function */
158 "REFLONG", /* name */
159 true, /* partial_inplace */
160 0xffffffff, /* src_mask */
161 0xffffffff, /* dst_mask */
162 false), /* pcrel_offset */
163
164 /* A 64 bit reference to a symbol. */
165 HOWTO (ALPHA_R_REFQUAD, /* type */
166 0, /* rightshift */
167 4, /* size (0 = byte, 1 = short, 2 = long) */
168 64, /* bitsize */
169 false, /* pc_relative */
170 0, /* bitpos */
171 complain_overflow_bitfield, /* complain_on_overflow */
172 0, /* special_function */
173 "REFQUAD", /* name */
174 true, /* partial_inplace */
175 MINUS_ONE, /* src_mask */
176 MINUS_ONE, /* dst_mask */
177 false), /* pcrel_offset */
178
179 /* A 32 bit GP relative offset. This is just like REFLONG except
180 that when the value is used the value of the gp register will be
181 added in. */
182 HOWTO (ALPHA_R_GPREL32, /* type */
183 0, /* rightshift */
184 2, /* size (0 = byte, 1 = short, 2 = long) */
185 32, /* bitsize */
186 false, /* pc_relative */
187 0, /* bitpos */
188 complain_overflow_bitfield, /* complain_on_overflow */
189 0, /* special_function */
190 "GPREL32", /* name */
191 true, /* partial_inplace */
192 0xffffffff, /* src_mask */
193 0xffffffff, /* dst_mask */
194 false), /* pcrel_offset */
195
196 /* Used for an instruction that refers to memory off the GP
197 register. The offset is 16 bits of the 32 bit instruction. This
198 reloc always seems to be against the .lita section. */
199 HOWTO (ALPHA_R_LITERAL, /* type */
200 0, /* rightshift */
201 2, /* size (0 = byte, 1 = short, 2 = long) */
202 16, /* bitsize */
203 false, /* pc_relative */
204 0, /* bitpos */
205 complain_overflow_signed, /* complain_on_overflow */
206 0, /* special_function */
207 "LITERAL", /* name */
208 true, /* partial_inplace */
209 0xffff, /* src_mask */
210 0xffff, /* dst_mask */
211 false), /* pcrel_offset */
212
213 /* This reloc only appears immediately following a LITERAL reloc.
214 It identifies a use of the literal. It seems that the linker can
215 use this to eliminate a portion of the .lita section. The symbol
216 index is special: 1 means the literal address is in the base
217 register of a memory format instruction; 2 means the literal
218 address is in the byte offset register of a byte-manipulation
219 instruction; 3 means the literal address is in the target
220 register of a jsr instruction. This does not actually do any
221 relocation. */
222 HOWTO (ALPHA_R_LITUSE, /* type */
223 0, /* rightshift */
224 2, /* size (0 = byte, 1 = short, 2 = long) */
225 32, /* bitsize */
226 false, /* pc_relative */
227 0, /* bitpos */
228 complain_overflow_dont, /* complain_on_overflow */
229 reloc_nil, /* special_function */
230 "LITUSE", /* name */
231 false, /* partial_inplace */
232 0, /* src_mask */
233 0, /* dst_mask */
234 false), /* pcrel_offset */
235
236 /* Load the gp register. This is always used for a ldah instruction
237 which loads the upper 16 bits of the gp register. The next reloc
238 will be an IGNORE reloc which identifies the location of the lda
239 instruction which loads the lower 16 bits. The symbol index of
240 the GPDISP instruction appears to actually be the number of bytes
241 between the ldah and lda instructions. This gives two different
242 ways to determine where the lda instruction is; I don't know why
243 both are used. The value to use for the relocation is the
244 difference between the GP value and the current location; the
245 load will always be done against a register holding the current
246 address. */
247 HOWTO (ALPHA_R_GPDISP, /* type */
248 16, /* rightshift */
249 2, /* size (0 = byte, 1 = short, 2 = long) */
250 16, /* bitsize */
251 true, /* pc_relative */
252 0, /* bitpos */
253 complain_overflow_dont, /* complain_on_overflow */
254 reloc_nil, /* special_function */
255 "GPDISP", /* name */
256 true, /* partial_inplace */
257 0xffff, /* src_mask */
258 0xffff, /* dst_mask */
259 true), /* pcrel_offset */
260
261 /* A 21 bit branch. The native assembler generates these for
262 branches within the text segment, and also fills in the PC
263 relative offset in the instruction. */
264 HOWTO (ALPHA_R_BRADDR, /* type */
265 2, /* rightshift */
266 2, /* size (0 = byte, 1 = short, 2 = long) */
267 21, /* bitsize */
268 true, /* pc_relative */
269 0, /* bitpos */
270 complain_overflow_signed, /* complain_on_overflow */
271 0, /* special_function */
272 "BRADDR", /* name */
273 true, /* partial_inplace */
274 0x1fffff, /* src_mask */
275 0x1fffff, /* dst_mask */
276 false), /* pcrel_offset */
277
278 /* A hint for a jump to a register. */
279 HOWTO (ALPHA_R_HINT, /* type */
280 2, /* rightshift */
281 2, /* size (0 = byte, 1 = short, 2 = long) */
282 14, /* bitsize */
283 true, /* pc_relative */
284 0, /* bitpos */
285 complain_overflow_dont, /* complain_on_overflow */
286 0, /* special_function */
287 "HINT", /* name */
288 true, /* partial_inplace */
289 0x3fff, /* src_mask */
290 0x3fff, /* dst_mask */
291 false), /* pcrel_offset */
292
293 /* 16 bit PC relative offset. */
294 HOWTO (ALPHA_R_SREL16, /* type */
295 0, /* rightshift */
296 1, /* size (0 = byte, 1 = short, 2 = long) */
297 16, /* bitsize */
298 true, /* pc_relative */
299 0, /* bitpos */
300 complain_overflow_signed, /* complain_on_overflow */
301 0, /* special_function */
302 "SREL16", /* name */
303 true, /* partial_inplace */
304 0xffff, /* src_mask */
305 0xffff, /* dst_mask */
306 false), /* pcrel_offset */
307
308 /* 32 bit PC relative offset. */
309 HOWTO (ALPHA_R_SREL32, /* type */
310 0, /* rightshift */
311 2, /* size (0 = byte, 1 = short, 2 = long) */
312 32, /* bitsize */
313 true, /* pc_relative */
314 0, /* bitpos */
315 complain_overflow_signed, /* complain_on_overflow */
316 0, /* special_function */
317 "SREL32", /* name */
318 true, /* partial_inplace */
319 0xffffffff, /* src_mask */
320 0xffffffff, /* dst_mask */
321 false), /* pcrel_offset */
322
323 /* A 64 bit PC relative offset. */
324 HOWTO (ALPHA_R_SREL64, /* type */
325 0, /* rightshift */
326 4, /* size (0 = byte, 1 = short, 2 = long) */
327 64, /* bitsize */
328 true, /* pc_relative */
329 0, /* bitpos */
330 complain_overflow_signed, /* complain_on_overflow */
331 0, /* special_function */
332 "SREL64", /* name */
333 true, /* partial_inplace */
334 MINUS_ONE, /* src_mask */
335 MINUS_ONE, /* dst_mask */
336 false), /* pcrel_offset */
337
338 /* Push a value on the reloc evaluation stack. */
339 HOWTO (ALPHA_R_OP_PUSH, /* type */
340 0, /* rightshift */
341 0, /* size (0 = byte, 1 = short, 2 = long) */
342 0, /* bitsize */
343 false, /* pc_relative */
344 0, /* bitpos */
345 complain_overflow_dont, /* complain_on_overflow */
346 0, /* special_function */
347 "OP_PUSH", /* name */
348 false, /* partial_inplace */
349 0, /* src_mask */
350 0, /* dst_mask */
351 false), /* pcrel_offset */
352
353 /* Store the value from the stack at the given address. Store it in
354 a bitfield of size r_size starting at bit position r_offset. */
355 HOWTO (ALPHA_R_OP_STORE, /* type */
356 0, /* rightshift */
357 4, /* size (0 = byte, 1 = short, 2 = long) */
358 64, /* bitsize */
359 false, /* pc_relative */
360 0, /* bitpos */
361 complain_overflow_dont, /* complain_on_overflow */
362 0, /* special_function */
363 "OP_STORE", /* name */
364 false, /* partial_inplace */
365 0, /* src_mask */
366 MINUS_ONE, /* dst_mask */
367 false), /* pcrel_offset */
368
369 /* Subtract the reloc address from the value on the top of the
370 relocation stack. */
371 HOWTO (ALPHA_R_OP_PSUB, /* type */
372 0, /* rightshift */
373 0, /* size (0 = byte, 1 = short, 2 = long) */
374 0, /* bitsize */
375 false, /* pc_relative */
376 0, /* bitpos */
377 complain_overflow_dont, /* complain_on_overflow */
378 0, /* special_function */
379 "OP_PSUB", /* name */
380 false, /* partial_inplace */
381 0, /* src_mask */
382 0, /* dst_mask */
383 false), /* pcrel_offset */
384
385 /* Shift the value on the top of the relocation stack right by the
386 given value. */
387 HOWTO (ALPHA_R_OP_PRSHIFT, /* type */
388 0, /* rightshift */
389 0, /* size (0 = byte, 1 = short, 2 = long) */
390 0, /* bitsize */
391 false, /* pc_relative */
392 0, /* bitpos */
393 complain_overflow_dont, /* complain_on_overflow */
394 0, /* special_function */
395 "OP_PRSHIFT", /* name */
396 false, /* partial_inplace */
397 0, /* src_mask */
398 0, /* dst_mask */
399 false), /* pcrel_offset */
400
401 /* Adjust the GP value for a new range in the object file. */
402 HOWTO (ALPHA_R_GPVALUE, /* type */
403 0, /* rightshift */
404 0, /* size (0 = byte, 1 = short, 2 = long) */
405 0, /* bitsize */
406 false, /* pc_relative */
407 0, /* bitpos */
408 complain_overflow_dont, /* complain_on_overflow */
409 0, /* special_function */
410 "GPVALUE", /* name */
411 false, /* partial_inplace */
412 0, /* src_mask */
413 0, /* dst_mask */
414 false) /* pcrel_offset */
415 };
416 \f
417 /* Recognize an Alpha ECOFF file. */
418
419 static bfd_target *
420 alpha_ecoff_object_p (abfd)
421 bfd *abfd;
422 {
423 static bfd_target *ret;
424
425 ret = coff_object_p (abfd);
426
427 if (ret != (bfd_target *) NULL)
428 {
429 asection *sec;
430
431 /* Alpha ECOFF has a .pdata section. The lnnoptr field of the
432 .pdata section is the number of entries it contains. Each
433 entry takes up 8 bytes. The number of entries is required
434 since the section is aligned to a 16 byte boundary. When we
435 link .pdata sections together, we do not want to include the
436 alignment bytes. We handle this on input by faking the size
437 of the .pdata section to remove the unwanted alignment bytes.
438 On output we will set the lnnoptr field and force the
439 alignment. */
440 sec = bfd_get_section_by_name (abfd, _PDATA);
441 if (sec != (asection *) NULL)
442 {
443 bfd_size_type size;
444
445 size = sec->line_filepos * 8;
446 BFD_ASSERT (size == bfd_section_size (abfd, sec)
447 || size + 8 == bfd_section_size (abfd, sec));
448 if (! bfd_set_section_size (abfd, sec, size))
449 return NULL;
450 }
451 }
452
453 return ret;
454 }
455
456 /* See whether the magic number matches. */
457
458 static boolean
459 alpha_ecoff_bad_format_hook (abfd, filehdr)
460 bfd *abfd;
461 PTR filehdr;
462 {
463 struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
464
465 if (ALPHA_ECOFF_BADMAG (*internal_f))
466 return false;
467
468 return true;
469 }
470 \f
471 /* Reloc handling. */
472
473 /* Swap a reloc in. */
474
475 static void
476 alpha_ecoff_swap_reloc_in (abfd, ext_ptr, intern)
477 bfd *abfd;
478 PTR ext_ptr;
479 struct internal_reloc *intern;
480 {
481 const RELOC *ext = (RELOC *) ext_ptr;
482
483 intern->r_vaddr = bfd_h_get_64 (abfd, (bfd_byte *) ext->r_vaddr);
484 intern->r_symndx = bfd_h_get_32 (abfd, (bfd_byte *) ext->r_symndx);
485
486 BFD_ASSERT (abfd->xvec->header_byteorder_big_p == false);
487
488 intern->r_type = ((ext->r_bits[0] & RELOC_BITS0_TYPE_LITTLE)
489 >> RELOC_BITS0_TYPE_SH_LITTLE);
490 intern->r_extern = (ext->r_bits[1] & RELOC_BITS1_EXTERN_LITTLE) != 0;
491 intern->r_offset = ((ext->r_bits[1] & RELOC_BITS1_OFFSET_LITTLE)
492 >> RELOC_BITS1_OFFSET_SH_LITTLE);
493 /* Ignored the reserved bits. */
494 intern->r_size = ((ext->r_bits[3] & RELOC_BITS3_SIZE_LITTLE)
495 >> RELOC_BITS3_SIZE_SH_LITTLE);
496
497 if (intern->r_type == ALPHA_R_LITUSE
498 || intern->r_type == ALPHA_R_GPDISP)
499 {
500 /* Handle the LITUSE and GPDISP relocs specially. Its symndx
501 value is not actually a symbol index, but is instead a
502 special code. We put the code in the r_size field, and
503 clobber the symndx. */
504 if (intern->r_size != 0)
505 abort ();
506 intern->r_size = intern->r_symndx;
507 intern->r_symndx = RELOC_SECTION_NONE;
508 }
509 else if (intern->r_type == ALPHA_R_IGNORE)
510 {
511 /* The IGNORE reloc generally follows a GPDISP reloc, and is
512 against the .lita section. The section is irrelevant. */
513 if (! intern->r_extern &&
514 (intern->r_symndx == RELOC_SECTION_NONE
515 || intern->r_symndx == RELOC_SECTION_ABS))
516 abort ();
517 if (! intern->r_extern && intern->r_symndx == RELOC_SECTION_LITA)
518 intern->r_symndx = RELOC_SECTION_NONE;
519 }
520 }
521
522 /* Swap a reloc out. */
523
524 static void
525 alpha_ecoff_swap_reloc_out (abfd, intern, dst)
526 bfd *abfd;
527 const struct internal_reloc *intern;
528 PTR dst;
529 {
530 RELOC *ext = (RELOC *) dst;
531 long symndx;
532 unsigned char size;
533
534 /* Undo the hackery done in swap_reloc_in. */
535 if (intern->r_type == ALPHA_R_LITUSE
536 || intern->r_type == ALPHA_R_GPDISP)
537 {
538 symndx = intern->r_size;
539 size = 0;
540 }
541 else if (intern->r_type == ALPHA_R_IGNORE
542 && ! intern->r_extern
543 && intern->r_symndx == RELOC_SECTION_NONE)
544 {
545 symndx = RELOC_SECTION_LITA;
546 size = intern->r_size;
547 }
548 else
549 {
550 symndx = intern->r_symndx;
551 size = intern->r_size;
552 }
553
554 BFD_ASSERT (intern->r_extern
555 || (intern->r_symndx >= 0 && intern->r_symndx <= 14));
556
557 bfd_h_put_64 (abfd, intern->r_vaddr, (bfd_byte *) ext->r_vaddr);
558 bfd_h_put_32 (abfd, symndx, (bfd_byte *) ext->r_symndx);
559
560 BFD_ASSERT (abfd->xvec->header_byteorder_big_p == false);
561
562 ext->r_bits[0] = ((intern->r_type << RELOC_BITS0_TYPE_SH_LITTLE)
563 & RELOC_BITS0_TYPE_LITTLE);
564 ext->r_bits[1] = ((intern->r_extern ? RELOC_BITS1_EXTERN_LITTLE : 0)
565 | ((intern->r_offset << RELOC_BITS1_OFFSET_SH_LITTLE)
566 & RELOC_BITS1_OFFSET_LITTLE));
567 ext->r_bits[2] = 0;
568 ext->r_bits[3] = ((size << RELOC_BITS3_SIZE_SH_LITTLE)
569 & RELOC_BITS3_SIZE_LITTLE);
570 }
571
572 /* Finish canonicalizing a reloc. Part of this is generic to all
573 ECOFF targets, and that part is in ecoff.c. The rest is done in
574 this backend routine. It must fill in the howto field. */
575
576 static void
577 alpha_adjust_reloc_in (abfd, intern, rptr)
578 bfd *abfd;
579 const struct internal_reloc *intern;
580 arelent *rptr;
581 {
582 if (intern->r_type > ALPHA_R_GPVALUE)
583 abort ();
584
585 switch (intern->r_type)
586 {
587 case ALPHA_R_BRADDR:
588 case ALPHA_R_SREL16:
589 case ALPHA_R_SREL32:
590 case ALPHA_R_SREL64:
591 /* The PC relative relocs do not seem to use the section VMA as
592 a negative addend. */
593 rptr->addend = 0;
594 break;
595
596 case ALPHA_R_GPREL32:
597 case ALPHA_R_LITERAL:
598 /* Copy the gp value for this object file into the addend, to
599 ensure that we are not confused by the linker. */
600 if (! intern->r_extern)
601 rptr->addend += ecoff_data (abfd)->gp;
602 break;
603
604 case ALPHA_R_LITUSE:
605 case ALPHA_R_GPDISP:
606 /* The LITUSE and GPDISP relocs do not use a symbol, or an
607 addend, but they do use a special code. Put this code in the
608 addend field. */
609 rptr->addend = intern->r_size;
610 break;
611
612 case ALPHA_R_OP_STORE:
613 /* The STORE reloc needs the size and offset fields. We store
614 them in the addend. */
615 BFD_ASSERT (intern->r_offset <= 256 && intern->r_size <= 256);
616 rptr->addend = (intern->r_offset << 8) + intern->r_size;
617 break;
618
619 case ALPHA_R_OP_PUSH:
620 case ALPHA_R_OP_PSUB:
621 case ALPHA_R_OP_PRSHIFT:
622 /* The PUSH, PSUB and PRSHIFT relocs do not actually use an
623 address. I believe that the address supplied is really an
624 addend. */
625 rptr->addend = intern->r_vaddr;
626 break;
627
628 case ALPHA_R_GPVALUE:
629 /* Set the addend field to the new GP value. */
630 rptr->addend = intern->r_symndx + ecoff_data (abfd)->gp;
631 break;
632
633 case ALPHA_R_IGNORE:
634 /* If the type is ALPHA_R_IGNORE, make sure this is a reference
635 to the absolute section so that the reloc is ignored. For
636 some reason the address of this reloc type is not adjusted by
637 the section vma. We record the gp value for this object file
638 here, for convenience when doing the GPDISP relocation. */
639 rptr->sym_ptr_ptr = bfd_abs_section.symbol_ptr_ptr;
640 rptr->address = intern->r_vaddr;
641 rptr->addend = ecoff_data (abfd)->gp;
642 break;
643
644 default:
645 break;
646 }
647
648 rptr->howto = &alpha_howto_table[intern->r_type];
649 }
650
651 /* When writing out a reloc we need to pull some values back out of
652 the addend field into the reloc. This is roughly the reverse of
653 alpha_adjust_reloc_in, except that there are several changes we do
654 not need to undo. */
655
656 static void
657 alpha_adjust_reloc_out (abfd, rel, intern)
658 bfd *abfd;
659 const arelent *rel;
660 struct internal_reloc *intern;
661 {
662 switch (intern->r_type)
663 {
664 case ALPHA_R_LITUSE:
665 case ALPHA_R_GPDISP:
666 intern->r_size = rel->addend;
667 break;
668
669 case ALPHA_R_OP_STORE:
670 intern->r_size = rel->addend & 0xff;
671 intern->r_offset = (rel->addend >> 8) & 0xff;
672 break;
673
674 case ALPHA_R_OP_PUSH:
675 case ALPHA_R_OP_PSUB:
676 case ALPHA_R_OP_PRSHIFT:
677 intern->r_vaddr = rel->addend;
678 break;
679
680 case ALPHA_R_IGNORE:
681 intern->r_vaddr = rel->address;
682 if (intern->r_symndx == RELOC_SECTION_ABS)
683 intern->r_symndx = RELOC_SECTION_NONE;
684 break;
685
686 default:
687 break;
688 }
689 }
690
691 /* The size of the stack for the relocation evaluator. */
692 #define RELOC_STACKSIZE (10)
693
694 /* Alpha ECOFF relocs have a built in expression evaluator as well as
695 other interdependencies. Rather than use a bunch of special
696 functions and global variables, we use a single routine to do all
697 the relocation for a section. I haven't yet worked out how the
698 assembler is going to handle this. */
699
700 static bfd_byte *
701 alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
702 data, relocateable, symbols)
703 bfd *abfd;
704 struct bfd_link_info *link_info;
705 struct bfd_link_order *link_order;
706 bfd_byte *data;
707 boolean relocateable;
708 asymbol **symbols;
709 {
710 bfd *input_bfd = link_order->u.indirect.section->owner;
711 asection *input_section = link_order->u.indirect.section;
712 size_t reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
713 arelent **reloc_vector = (arelent **) alloca (reloc_size);
714 bfd *output_bfd = relocateable ? abfd : (bfd *) NULL;
715 bfd_vma gp;
716 boolean gp_undefined;
717 bfd_vma stack[RELOC_STACKSIZE];
718 int tos = 0;
719
720 if (! bfd_get_section_contents (input_bfd, input_section, data,
721 (file_ptr) 0, input_section->_raw_size))
722 return NULL;
723
724 /* The section size is not going to change. */
725 input_section->_cooked_size = input_section->_raw_size;
726 input_section->reloc_done = true;
727
728 if (bfd_canonicalize_reloc (input_bfd, input_section, reloc_vector,
729 symbols)
730 == 0)
731 return data;
732
733 /* Get the GP value for the output BFD. */
734 gp_undefined = false;
735 if (ecoff_data (abfd)->gp == 0)
736 {
737 if (relocateable != false)
738 {
739 asection *sec;
740 bfd_vma lo;
741
742 /* Make up a value. */
743 lo = (bfd_vma) -1;
744 for (sec = abfd->sections; sec != NULL; sec = sec->next)
745 {
746 if (sec->vma < lo
747 && (strcmp (sec->name, ".sbss") == 0
748 || strcmp (sec->name, ".sdata") == 0
749 || strcmp (sec->name, ".lit4") == 0
750 || strcmp (sec->name, ".lit8") == 0
751 || strcmp (sec->name, ".lita") == 0))
752 lo = sec->vma;
753 }
754 ecoff_data (abfd)->gp = lo + 0x8000;
755 }
756 else
757 {
758 struct bfd_link_hash_entry *h;
759
760 h = bfd_link_hash_lookup (link_info->hash, "_gp", false, false,
761 true);
762 if (h == (struct bfd_link_hash_entry *) NULL
763 || h->type != bfd_link_hash_defined)
764 gp_undefined = true;
765 else
766 ecoff_data (abfd)->gp = (h->u.def.value
767 + h->u.def.section->output_section->vma
768 + h->u.def.section->output_offset);
769 }
770 }
771 gp = ecoff_data (abfd)->gp;
772
773 for (; *reloc_vector != (arelent *) NULL; reloc_vector++)
774 {
775 arelent *rel;
776 bfd_reloc_status_type r;
777 char *err;
778
779 rel = *reloc_vector;
780 r = bfd_reloc_ok;
781 switch (rel->howto->type)
782 {
783 case ALPHA_R_IGNORE:
784 rel->address += input_section->output_offset;
785 break;
786
787 case ALPHA_R_REFLONG:
788 case ALPHA_R_REFQUAD:
789 case ALPHA_R_BRADDR:
790 case ALPHA_R_HINT:
791 case ALPHA_R_SREL16:
792 case ALPHA_R_SREL32:
793 case ALPHA_R_SREL64:
794 if (relocateable
795 && ((*rel->sym_ptr_ptr)->flags & BSF_SECTION_SYM) == 0)
796 {
797 rel->address += input_section->output_offset;
798 break;
799 }
800 r = bfd_perform_relocation (input_bfd, rel, data, input_section,
801 output_bfd, &err);
802 break;
803
804 case ALPHA_R_GPREL32:
805 /* This relocation is used in a switch table. It is a 32
806 bit offset from the current GP value. We must adjust it
807 by the different between the original GP value and the
808 current GP value. The original GP value is stored in the
809 addend. We adjust the addend and let
810 bfd_perform_relocation finish the job. */
811 rel->addend -= gp;
812 r = bfd_perform_relocation (input_bfd, rel, data, input_section,
813 output_bfd, &err);
814 if (r == bfd_reloc_ok && gp_undefined)
815 {
816 r = bfd_reloc_dangerous;
817 err = (char *) "GP relative relocation used when GP not defined";
818 }
819 break;
820
821 case ALPHA_R_LITERAL:
822 /* This is a reference to a literal value, generally
823 (always?) in the .lita section. This is a 16 bit GP
824 relative relocation. Sometimes the subsequent reloc is a
825 LITUSE reloc, which indicates how this reloc is used.
826 This sometimes permits rewriting the two instructions
827 referred to by the LITERAL and the LITUSE into different
828 instructions which do not refer to .lita. This can save
829 a memory reference, and permits removing a value from
830 .lita thus saving GP relative space.
831
832 We do not these optimizations. To do them we would need
833 to arrange to link the .lita section first, so that by
834 the time we got here we would know the final values to
835 use. This would not be particularly difficult, but it is
836 not currently implemented. */
837
838 {
839 unsigned long insn;
840
841 /* I believe that the LITERAL reloc will only apply to a
842 ldq or ldl instruction, so check my assumption. */
843 insn = bfd_get_32 (input_bfd, data + rel->address);
844 BFD_ASSERT (((insn >> 26) & 0x3f) == 0x29
845 || ((insn >> 26) & 0x3f) == 0x28);
846
847 rel->addend -= gp;
848 r = bfd_perform_relocation (input_bfd, rel, data, input_section,
849 output_bfd, &err);
850 if (r == bfd_reloc_ok && gp_undefined)
851 {
852 r = bfd_reloc_dangerous;
853 err =
854 (char *) "GP relative relocation used when GP not defined";
855 }
856 }
857 break;
858
859 case ALPHA_R_LITUSE:
860 /* See ALPHA_R_LITERAL above for the uses of this reloc. It
861 does not cause anything to happen, itself. */
862 rel->address += input_section->output_offset;
863 break;
864
865 case ALPHA_R_GPDISP:
866 /* This marks the ldah of an ldah/lda pair which loads the
867 gp register with the difference of the gp value and the
868 current location. The second of the pair is r_size bytes
869 ahead, and is marked with an ALPHA_R_IGNORE reloc. */
870 {
871 unsigned long insn1, insn2;
872 bfd_vma addend;
873
874 BFD_ASSERT (reloc_vector[1] != NULL
875 && reloc_vector[1]->howto->type == ALPHA_R_IGNORE
876 && (rel->address + rel->addend
877 == reloc_vector[1]->address));
878
879 /* Get the two instructions. */
880 insn1 = bfd_get_32 (input_bfd, data + rel->address);
881 insn2 = bfd_get_32 (input_bfd, data + rel->address + rel->addend);
882
883 BFD_ASSERT (((insn1 >> 26) & 0x3f) == 0x09); /* ldah */
884 BFD_ASSERT (((insn2 >> 26) & 0x3f) == 0x08); /* lda */
885
886 /* Get the existing addend. We must account for the sign
887 extension done by lda and ldah. */
888 addend = ((insn1 & 0xffff) << 16) + (insn2 & 0xffff);
889 if (insn1 & 0x8000)
890 {
891 addend -= 0x80000000;
892 addend -= 0x80000000;
893 }
894 if (insn2 & 0x8000)
895 addend -= 0x10000;
896
897 /* The existing addend includes the different between the
898 gp of the input BFD and the address in the input BFD.
899 Subtract this out. */
900 addend -= (reloc_vector[1]->addend
901 - (input_section->vma + rel->address));
902
903 /* Now add in the final gp value, and subtract out the
904 final address. */
905 addend += (gp
906 - (input_section->output_section->vma
907 + input_section->output_offset
908 + rel->address));
909
910 /* Change the instructions, accounting for the sign
911 extension, and write them out. */
912 if (addend & 0x8000)
913 addend += 0x10000;
914 insn1 = (insn1 & 0xffff0000) | ((addend >> 16) & 0xffff);
915 insn2 = (insn2 & 0xffff0000) | (addend & 0xffff);
916
917 bfd_put_32 (input_bfd, (bfd_vma) insn1, data + rel->address);
918 bfd_put_32 (input_bfd, (bfd_vma) insn2,
919 data + rel->address + rel->addend);
920
921 rel->address += input_section->output_offset;
922 }
923 break;
924
925 case ALPHA_R_OP_PUSH:
926 /* Push a value on the reloc evaluation stack. */
927 {
928 asymbol *symbol;
929 bfd_vma relocation;
930
931 if (relocateable)
932 {
933 rel->address += input_section->output_offset;
934 break;
935 }
936
937 /* Figure out the relocation of this symbol. */
938 symbol = *rel->sym_ptr_ptr;
939
940 if (symbol->section == &bfd_und_section)
941 r = bfd_reloc_undefined;
942
943 if (bfd_is_com_section (symbol->section))
944 relocation = 0;
945 else
946 relocation = symbol->value;
947 relocation += symbol->section->output_section->vma;
948 relocation += symbol->section->output_offset;
949 relocation += rel->addend;
950
951 if (tos >= RELOC_STACKSIZE)
952 abort ();
953
954 stack[tos++] = relocation;
955 }
956 break;
957
958 case ALPHA_R_OP_STORE:
959 /* Store a value from the reloc stack into a bitfield. */
960 {
961 bfd_vma val;
962 int offset, size;
963
964 if (relocateable)
965 {
966 rel->address += input_section->output_offset;
967 break;
968 }
969
970 if (tos == 0)
971 abort ();
972
973 /* The offset and size for this reloc are encoded into the
974 addend field by alpha_adjust_reloc_in. */
975 offset = (rel->addend >> 8) & 0xff;
976 size = rel->addend & 0xff;
977
978 val = bfd_get_64 (abfd, data + rel->address);
979 val &=~ (((1 << size) - 1) << offset);
980 val |= (stack[--tos] & ((1 << size) - 1)) << offset;
981 bfd_put_64 (abfd, val, data + rel->address);
982 }
983 break;
984
985 case ALPHA_R_OP_PSUB:
986 /* Subtract a value from the top of the stack. */
987 {
988 asymbol *symbol;
989 bfd_vma relocation;
990
991 if (relocateable)
992 {
993 rel->address += input_section->output_offset;
994 break;
995 }
996
997 /* Figure out the relocation of this symbol. */
998 symbol = *rel->sym_ptr_ptr;
999
1000 if (symbol->section == &bfd_und_section)
1001 r = bfd_reloc_undefined;
1002
1003 if (bfd_is_com_section (symbol->section))
1004 relocation = 0;
1005 else
1006 relocation = symbol->value;
1007 relocation += symbol->section->output_section->vma;
1008 relocation += symbol->section->output_offset;
1009 relocation += rel->addend;
1010
1011 if (tos == 0)
1012 abort ();
1013
1014 stack[tos - 1] -= relocation;
1015 }
1016 break;
1017
1018 case ALPHA_R_OP_PRSHIFT:
1019 /* Shift the value on the top of the stack. */
1020 {
1021 asymbol *symbol;
1022 bfd_vma relocation;
1023
1024 if (relocateable)
1025 {
1026 rel->address += input_section->output_offset;
1027 break;
1028 }
1029
1030 /* Figure out the relocation of this symbol. */
1031 symbol = *rel->sym_ptr_ptr;
1032
1033 if (symbol->section == &bfd_und_section)
1034 r = bfd_reloc_undefined;
1035
1036 if (bfd_is_com_section (symbol->section))
1037 relocation = 0;
1038 else
1039 relocation = symbol->value;
1040 relocation += symbol->section->output_section->vma;
1041 relocation += symbol->section->output_offset;
1042 relocation += rel->addend;
1043
1044 if (tos == 0)
1045 abort ();
1046
1047 stack[tos - 1] >>= relocation;
1048 }
1049 break;
1050
1051 case ALPHA_R_GPVALUE:
1052 /* I really don't know if this does the right thing. */
1053 gp = rel->addend;
1054 gp_undefined = false;
1055 break;
1056
1057 default:
1058 abort ();
1059 }
1060
1061 if (relocateable)
1062 {
1063 asection *os = input_section->output_section;
1064
1065 /* A partial link, so keep the relocs. */
1066 os->orelocation[os->reloc_count] = rel;
1067 os->reloc_count++;
1068 }
1069
1070 if (r != bfd_reloc_ok)
1071 {
1072 switch (r)
1073 {
1074 case bfd_reloc_undefined:
1075 if (! ((*link_info->callbacks->undefined_symbol)
1076 (link_info, bfd_asymbol_name (*rel->sym_ptr_ptr),
1077 input_bfd, input_section, rel->address)))
1078 return NULL;
1079 break;
1080 case bfd_reloc_dangerous:
1081 if (! ((*link_info->callbacks->reloc_dangerous)
1082 (link_info, err, input_bfd, input_section,
1083 rel->address)))
1084 return NULL;
1085 break;
1086 case bfd_reloc_overflow:
1087 if (! ((*link_info->callbacks->reloc_overflow)
1088 (link_info, bfd_asymbol_name (*rel->sym_ptr_ptr),
1089 rel->howto->name, rel->addend, input_bfd,
1090 input_section, rel->address)))
1091 return NULL;
1092 break;
1093 case bfd_reloc_outofrange:
1094 default:
1095 abort ();
1096 break;
1097 }
1098 }
1099 }
1100
1101 if (tos != 0)
1102 abort ();
1103
1104 return data;
1105 }
1106
1107 /* Get the howto structure for a generic reloc type. */
1108
1109 static CONST struct reloc_howto_struct *
1110 alpha_bfd_reloc_type_lookup (abfd, code)
1111 bfd *abfd;
1112 bfd_reloc_code_real_type code;
1113 {
1114 int alpha_type;
1115
1116 switch (code)
1117 {
1118 case BFD_RELOC_32:
1119 alpha_type = ALPHA_R_REFLONG;
1120 break;
1121 case BFD_RELOC_64:
1122 alpha_type = ALPHA_R_REFQUAD;
1123 break;
1124 case BFD_RELOC_GPREL32:
1125 alpha_type = ALPHA_R_GPREL32;
1126 break;
1127 case BFD_RELOC_ALPHA_LITERAL:
1128 alpha_type = ALPHA_R_LITERAL;
1129 break;
1130 case BFD_RELOC_ALPHA_LITUSE:
1131 alpha_type = ALPHA_R_LITUSE;
1132 break;
1133 case BFD_RELOC_ALPHA_GPDISP_HI16:
1134 alpha_type = ALPHA_R_GPDISP;
1135 break;
1136 case BFD_RELOC_ALPHA_GPDISP_LO16:
1137 alpha_type = ALPHA_R_IGNORE;
1138 break;
1139 case BFD_RELOC_23_PCREL_S2:
1140 alpha_type = ALPHA_R_BRADDR;
1141 break;
1142 case BFD_RELOC_ALPHA_HINT:
1143 alpha_type = ALPHA_R_HINT;
1144 break;
1145 case BFD_RELOC_16_PCREL:
1146 alpha_type = ALPHA_R_SREL16;
1147 break;
1148 case BFD_RELOC_32_PCREL:
1149 alpha_type = ALPHA_R_SREL32;
1150 break;
1151 case BFD_RELOC_64_PCREL:
1152 alpha_type = ALPHA_R_SREL64;
1153 break;
1154 #if 0
1155 case ???:
1156 alpha_type = ALPHA_R_OP_PUSH;
1157 break;
1158 case ???:
1159 alpha_type = ALPHA_R_OP_STORE;
1160 break;
1161 case ???:
1162 alpha_type = ALPHA_R_OP_PSUB;
1163 break;
1164 case ???:
1165 alpha_type = ALPHA_R_OP_PRSHIFT;
1166 break;
1167 case ???:
1168 alpha_type = ALPHA_R_GPVALUE;
1169 break;
1170 #endif
1171 default:
1172 return (CONST struct reloc_howto_struct *) NULL;
1173 }
1174
1175 return &alpha_howto_table[alpha_type];
1176 }
1177 \f
1178 /* A helper routine for alpha_relocate_section which converts an
1179 external reloc when generating relocateable output. Returns the
1180 relocation amount. */
1181
1182 static bfd_vma
1183 alpha_convert_external_reloc (output_bfd, info, input_bfd, ext_rel, h)
1184 bfd *output_bfd;
1185 struct bfd_link_info *info;
1186 bfd *input_bfd;
1187 struct external_reloc *ext_rel;
1188 struct ecoff_link_hash_entry *h;
1189 {
1190 unsigned long r_symndx;
1191 bfd_vma relocation;
1192
1193 BFD_ASSERT (info->relocateable);
1194
1195 if (h->root.type == bfd_link_hash_defined)
1196 {
1197 asection *hsec;
1198 const char *name;
1199
1200 /* This symbol is defined in the output. Convert the reloc from
1201 being against the symbol to being against the section. */
1202
1203 /* Clear the r_extern bit. */
1204 ext_rel->r_bits[1] &=~ RELOC_BITS1_EXTERN_LITTLE;
1205
1206 /* Compute a new r_symndx value. */
1207 hsec = h->root.u.def.section;
1208 name = bfd_get_section_name (output_bfd, hsec->output_section);
1209
1210 r_symndx = -1;
1211 switch (name[1])
1212 {
1213 case 'A':
1214 if (strcmp (name, "*ABS*") == 0)
1215 r_symndx = RELOC_SECTION_ABS;
1216 break;
1217 case 'b':
1218 if (strcmp (name, ".bss") == 0)
1219 r_symndx = RELOC_SECTION_BSS;
1220 break;
1221 case 'd':
1222 if (strcmp (name, ".data") == 0)
1223 r_symndx = RELOC_SECTION_DATA;
1224 break;
1225 case 'f':
1226 if (strcmp (name, ".fini") == 0)
1227 r_symndx = RELOC_SECTION_FINI;
1228 break;
1229 case 'i':
1230 if (strcmp (name, ".init") == 0)
1231 r_symndx = RELOC_SECTION_INIT;
1232 break;
1233 case 'l':
1234 if (strcmp (name, ".lita") == 0)
1235 r_symndx = RELOC_SECTION_LITA;
1236 else if (strcmp (name, ".lit8") == 0)
1237 r_symndx = RELOC_SECTION_LIT8;
1238 else if (strcmp (name, ".lit4") == 0)
1239 r_symndx = RELOC_SECTION_LIT4;
1240 break;
1241 case 'p':
1242 if (strcmp (name, ".pdata") == 0)
1243 r_symndx = RELOC_SECTION_PDATA;
1244 break;
1245 case 'r':
1246 if (strcmp (name, ".rdata") == 0)
1247 r_symndx = RELOC_SECTION_RDATA;
1248 break;
1249 case 's':
1250 if (strcmp (name, ".sdata") == 0)
1251 r_symndx = RELOC_SECTION_SDATA;
1252 else if (strcmp (name, ".sbss") == 0)
1253 r_symndx = RELOC_SECTION_SBSS;
1254 break;
1255 case 't':
1256 if (strcmp (name, ".text") == 0)
1257 r_symndx = RELOC_SECTION_TEXT;
1258 break;
1259 case 'x':
1260 if (strcmp (name, ".xdata") == 0)
1261 r_symndx = RELOC_SECTION_XDATA;
1262 break;
1263 }
1264
1265 if (r_symndx == -1)
1266 abort ();
1267
1268 /* Add the section VMA and the symbol value. */
1269 relocation = (h->root.u.def.value
1270 + hsec->output_section->vma
1271 + hsec->output_offset);
1272 }
1273 else
1274 {
1275 /* Change the symndx value to the right one for
1276 the output BFD. */
1277 r_symndx = h->indx;
1278 if (r_symndx == -1)
1279 {
1280 /* Caller must give an error. */
1281 r_symndx = 0;
1282 }
1283 relocation = 0;
1284 }
1285
1286 /* Write out the new r_symndx value. */
1287 bfd_h_put_32 (input_bfd, (bfd_vma) r_symndx,
1288 (bfd_byte *) ext_rel->r_symndx);
1289
1290 return relocation;
1291 }
1292
1293 /* Relocate a section while linking an Alpha ECOFF file. This is
1294 quite similar to get_relocated_section_contents. Perhaps they
1295 could be combined somehow. */
1296
1297 static boolean
1298 alpha_relocate_section (output_bfd, info, input_bfd, input_section,
1299 contents, external_relocs)
1300 bfd *output_bfd;
1301 struct bfd_link_info *info;
1302 bfd *input_bfd;
1303 asection *input_section;
1304 bfd_byte *contents;
1305 PTR external_relocs;
1306 {
1307 asection **symndx_to_section;
1308 struct ecoff_link_hash_entry **sym_hashes;
1309 bfd_vma gp;
1310 boolean gp_undefined;
1311 bfd_vma stack[RELOC_STACKSIZE];
1312 int tos = 0;
1313 struct external_reloc *ext_rel;
1314 struct external_reloc *ext_rel_end;
1315
1316 /* We keep a table mapping the symndx found in an internal reloc to
1317 the appropriate section. This is faster than looking up the
1318 section by name each time. */
1319 symndx_to_section = ecoff_data (input_bfd)->symndx_to_section;
1320 if (symndx_to_section == (asection **) NULL)
1321 {
1322 symndx_to_section = ((asection **)
1323 bfd_alloc (input_bfd,
1324 (NUM_RELOC_SECTIONS
1325 * sizeof (asection *))));
1326
1327 symndx_to_section[RELOC_SECTION_NONE] = NULL;
1328 symndx_to_section[RELOC_SECTION_TEXT] =
1329 bfd_get_section_by_name (input_bfd, ".text");
1330 symndx_to_section[RELOC_SECTION_RDATA] =
1331 bfd_get_section_by_name (input_bfd, ".rdata");
1332 symndx_to_section[RELOC_SECTION_DATA] =
1333 bfd_get_section_by_name (input_bfd, ".data");
1334 symndx_to_section[RELOC_SECTION_SDATA] =
1335 bfd_get_section_by_name (input_bfd, ".sdata");
1336 symndx_to_section[RELOC_SECTION_SBSS] =
1337 bfd_get_section_by_name (input_bfd, ".sbss");
1338 symndx_to_section[RELOC_SECTION_BSS] =
1339 bfd_get_section_by_name (input_bfd, ".bss");
1340 symndx_to_section[RELOC_SECTION_INIT] =
1341 bfd_get_section_by_name (input_bfd, ".init");
1342 symndx_to_section[RELOC_SECTION_LIT8] =
1343 bfd_get_section_by_name (input_bfd, ".lit8");
1344 symndx_to_section[RELOC_SECTION_LIT4] =
1345 bfd_get_section_by_name (input_bfd, ".lit4");
1346 symndx_to_section[RELOC_SECTION_XDATA] =
1347 bfd_get_section_by_name (input_bfd, ".xdata");
1348 symndx_to_section[RELOC_SECTION_PDATA] =
1349 bfd_get_section_by_name (input_bfd, ".pdata");
1350 symndx_to_section[RELOC_SECTION_FINI] =
1351 bfd_get_section_by_name (input_bfd, ".fini");
1352 symndx_to_section[RELOC_SECTION_LITA] =
1353 bfd_get_section_by_name (input_bfd, ".lita");
1354 symndx_to_section[RELOC_SECTION_ABS] = &bfd_abs_section;
1355
1356 ecoff_data (input_bfd)->symndx_to_section = symndx_to_section;
1357 }
1358
1359 sym_hashes = ecoff_data (input_bfd)->sym_hashes;
1360
1361 gp = ecoff_data (output_bfd)->gp;
1362 if (gp == 0)
1363 gp_undefined = true;
1364 else
1365 gp_undefined = false;
1366
1367 BFD_ASSERT (output_bfd->xvec->header_byteorder_big_p == false);
1368 BFD_ASSERT (input_bfd->xvec->header_byteorder_big_p == false);
1369
1370 ext_rel = (struct external_reloc *) external_relocs;
1371 ext_rel_end = ext_rel + input_section->reloc_count;
1372 for (; ext_rel < ext_rel_end; ext_rel++)
1373 {
1374 bfd_vma r_vaddr;
1375 unsigned long r_symndx;
1376 int r_type;
1377 int r_extern;
1378 int r_offset;
1379 int r_size;
1380 boolean relocatep;
1381 boolean adjust_addrp;
1382 boolean gp_usedp;
1383 bfd_vma addend;
1384
1385 r_vaddr = bfd_h_get_64 (input_bfd, (bfd_byte *) ext_rel->r_vaddr);
1386 r_symndx = bfd_h_get_32 (input_bfd, (bfd_byte *) ext_rel->r_symndx);
1387
1388 r_type = ((ext_rel->r_bits[0] & RELOC_BITS0_TYPE_LITTLE)
1389 >> RELOC_BITS0_TYPE_SH_LITTLE);
1390 r_extern = (ext_rel->r_bits[1] & RELOC_BITS1_EXTERN_LITTLE) != 0;
1391 r_offset = ((ext_rel->r_bits[1] & RELOC_BITS1_OFFSET_LITTLE)
1392 >> RELOC_BITS1_OFFSET_SH_LITTLE);
1393 /* Ignored the reserved bits. */
1394 r_size = ((ext_rel->r_bits[3] & RELOC_BITS3_SIZE_LITTLE)
1395 >> RELOC_BITS3_SIZE_SH_LITTLE);
1396
1397 relocatep = false;
1398 adjust_addrp = true;
1399 gp_usedp = false;
1400 addend = 0;
1401
1402 switch (r_type)
1403 {
1404 default:
1405 abort ();
1406
1407 case ALPHA_R_IGNORE:
1408 /* This reloc appears after a GPDISP reloc. It marks the
1409 position of the second instruction to be altered by the
1410 GPDISP reloc, but is not otherwise used for anything.
1411 For some reason, the address of the relocation does not
1412 appear to include the section VMA, unlike the other
1413 relocation types. */
1414 if (info->relocateable)
1415 bfd_h_put_64 (input_bfd,
1416 input_section->output_offset + r_vaddr,
1417 (bfd_byte *) ext_rel->r_vaddr);
1418 adjust_addrp = false;
1419 break;
1420
1421 case ALPHA_R_REFLONG:
1422 case ALPHA_R_REFQUAD:
1423 case ALPHA_R_BRADDR:
1424 case ALPHA_R_HINT:
1425 case ALPHA_R_SREL16:
1426 case ALPHA_R_SREL32:
1427 case ALPHA_R_SREL64:
1428 relocatep = true;
1429 break;
1430
1431 case ALPHA_R_GPREL32:
1432 /* This relocation is used in a switch table. It is a 32
1433 bit offset from the current GP value. We must adjust it
1434 by the different between the original GP value and the
1435 current GP value. */
1436 relocatep = true;
1437 addend = ecoff_data (input_bfd)->gp - gp;
1438 gp_usedp = true;
1439 break;
1440
1441 case ALPHA_R_LITERAL:
1442 /* This is a reference to a literal value, generally
1443 (always?) in the .lita section. This is a 16 bit GP
1444 relative relocation. Sometimes the subsequent reloc is a
1445 LITUSE reloc, which indicates how this reloc is used.
1446 This sometimes permits rewriting the two instructions
1447 referred to by the LITERAL and the LITUSE into different
1448 instructions which do not refer to .lita. This can save
1449 a memory reference, and permits removing a value from
1450 .lita thus saving GP relative space.
1451
1452 We do not these optimizations. To do them we would need
1453 to arrange to link the .lita section first, so that by
1454 the time we got here we would know the final values to
1455 use. This would not be particularly difficult, but it is
1456 not currently implemented. */
1457
1458 /* I believe that the LITERAL reloc will only apply to a ldq
1459 instruction, so check my assumption. */
1460 BFD_ASSERT (((bfd_get_32 (input_bfd,
1461 contents + r_vaddr - input_section->vma)
1462 >> 26)
1463 & 0x3f)
1464 == 0x29);
1465
1466 relocatep = true;
1467 addend = ecoff_data (input_bfd)->gp - gp;
1468 gp_usedp = true;
1469 break;
1470
1471 case ALPHA_R_LITUSE:
1472 /* See ALPHA_R_LITERAL above for the uses of this reloc. It
1473 does not cause anything to happen, itself. */
1474 break;
1475
1476 case ALPHA_R_GPDISP:
1477 /* This marks the ldah of an ldah/lda pair which loads the
1478 gp register with the difference of the gp value and the
1479 current location. The second of the pair is r_symndx
1480 bytes ahead, and is also marked with an ALPHA_R_IGNORE
1481 reloc. */
1482 {
1483 unsigned long insn1, insn2;
1484
1485 BFD_ASSERT (ext_rel + 1 < ext_rel_end
1486 && (((ext_rel + 1)->r_bits[0]
1487 & RELOC_BITS0_TYPE_LITTLE)
1488 >> RELOC_BITS0_TYPE_SH_LITTLE) == ALPHA_R_IGNORE
1489 && (bfd_h_get_64 (input_bfd,
1490 (bfd_byte *) (ext_rel + 1)->r_vaddr)
1491 == r_vaddr - input_section->vma + r_symndx));
1492
1493 /* Get the two instructions. */
1494 insn1 = bfd_get_32 (input_bfd,
1495 contents + r_vaddr - input_section->vma);
1496 insn2 = bfd_get_32 (input_bfd,
1497 (contents
1498 + r_vaddr
1499 - input_section->vma
1500 + r_symndx));
1501
1502 BFD_ASSERT (((insn1 >> 26) & 0x3f) == 0x09); /* ldah */
1503 BFD_ASSERT (((insn2 >> 26) & 0x3f) == 0x08); /* lda */
1504
1505 /* Get the existing addend. We must account for the sign
1506 extension done by lda and ldah. */
1507 addend = ((insn1 & 0xffff) << 16) + (insn2 & 0xffff);
1508 if (insn1 & 0x8000)
1509 {
1510 /* This is addend -= 0x100000000 without causing an
1511 integer overflow on a 32 bit host. */
1512 addend -= 0x80000000;
1513 addend -= 0x80000000;
1514 }
1515 if (insn2 & 0x8000)
1516 addend -= 0x10000;
1517
1518 /* The existing addend includes the difference between the
1519 gp of the input BFD and the address in the input BFD.
1520 We want to change this to the difference between the
1521 final GP and the final address. */
1522 addend += (gp
1523 - ecoff_data (input_bfd)->gp
1524 + input_section->vma
1525 - (input_section->output_section->vma
1526 + input_section->output_offset));
1527
1528 /* Change the instructions, accounting for the sign
1529 extension, and write them out. */
1530 if (addend & 0x8000)
1531 addend += 0x10000;
1532 insn1 = (insn1 & 0xffff0000) | ((addend >> 16) & 0xffff);
1533 insn2 = (insn2 & 0xffff0000) | (addend & 0xffff);
1534
1535 bfd_put_32 (input_bfd, (bfd_vma) insn1,
1536 contents + r_vaddr - input_section->vma);
1537 bfd_put_32 (input_bfd, (bfd_vma) insn2,
1538 contents + r_vaddr - input_section->vma + r_symndx);
1539
1540 gp_usedp = true;
1541 }
1542 break;
1543
1544 case ALPHA_R_OP_PUSH:
1545 case ALPHA_R_OP_PSUB:
1546 case ALPHA_R_OP_PRSHIFT:
1547 /* Manipulate values on the reloc evaluation stack. The
1548 r_vaddr field is not an address in input_section, it is
1549 the current value (including any addend) of the object
1550 being used. */
1551 if (! r_extern)
1552 {
1553 asection *s;
1554
1555 s = symndx_to_section[r_symndx];
1556 if (s == (asection *) NULL)
1557 abort ();
1558 addend = s->output_section->vma + s->output_offset - s->vma;
1559 }
1560 else
1561 {
1562 struct ecoff_link_hash_entry *h;
1563
1564 h = sym_hashes[r_symndx];
1565 if (h == (struct ecoff_link_hash_entry *) NULL)
1566 abort ();
1567
1568 if (! info->relocateable)
1569 {
1570 if (h->root.type == bfd_link_hash_defined)
1571 addend = (h->root.u.def.value
1572 + h->root.u.def.section->output_section->vma
1573 + h->root.u.def.section->output_offset);
1574 else
1575 {
1576 /* Note that we pass the address as 0, since we
1577 do not have a meaningful number for the
1578 location within the section that is being
1579 relocated. */
1580 if (! ((*info->callbacks->undefined_symbol)
1581 (info, h->root.root.string, input_bfd,
1582 input_section, (bfd_vma) 0)))
1583 return false;
1584 addend = 0;
1585 }
1586 }
1587 else
1588 {
1589 if (h->root.type != bfd_link_hash_defined
1590 && h->indx == -1)
1591 {
1592 /* This symbol is not being written out. Pass
1593 the address as 0, as with undefined_symbol,
1594 above. */
1595 if (! ((*info->callbacks->unattached_reloc)
1596 (info, h->root.root.string, input_bfd,
1597 input_section, (bfd_vma) 0)))
1598 return false;
1599 }
1600
1601 addend = alpha_convert_external_reloc (output_bfd, info,
1602 input_bfd,
1603 ext_rel, h);
1604 }
1605 }
1606
1607 addend += r_vaddr;
1608
1609 if (info->relocateable)
1610 {
1611 /* Adjust r_vaddr by the addend. */
1612 bfd_h_put_64 (input_bfd, addend,
1613 (bfd_byte *) ext_rel->r_vaddr);
1614 }
1615 else
1616 {
1617 switch (r_type)
1618 {
1619 case ALPHA_R_OP_PUSH:
1620 if (tos >= RELOC_STACKSIZE)
1621 abort ();
1622 stack[tos++] = addend;
1623 break;
1624
1625 case ALPHA_R_OP_PSUB:
1626 if (tos == 0)
1627 abort ();
1628 stack[tos - 1] -= addend;
1629 break;
1630
1631 case ALPHA_R_OP_PRSHIFT:
1632 if (tos == 0)
1633 abort ();
1634 stack[tos - 1] >>= addend;
1635 break;
1636 }
1637 }
1638
1639 adjust_addrp = false;
1640 break;
1641
1642 case ALPHA_R_OP_STORE:
1643 /* Store a value from the reloc stack into a bitfield. If
1644 we are generating relocateable output, all we do is
1645 adjust the address of the reloc. */
1646 if (! info->relocateable)
1647 {
1648 bfd_vma val;
1649
1650 if (tos == 0)
1651 abort ();
1652
1653 /* FIXME: I don't know what kind of overflow checking,
1654 if any, should be done here. */
1655 val = bfd_get_64 (input_bfd,
1656 contents + r_vaddr - input_section->vma);
1657 val &=~ (((1 << r_size) - 1) << r_offset);
1658 val |= (stack[--tos] & ((1 << r_size) - 1)) << r_offset;
1659 bfd_put_64 (input_bfd, val,
1660 contents + r_vaddr - input_section->vma);
1661 }
1662 break;
1663
1664 case ALPHA_R_GPVALUE:
1665 /* I really don't know if this does the right thing. */
1666 gp = ecoff_data (input_bfd)->gp + r_symndx;
1667 gp_undefined = false;
1668 break;
1669 }
1670
1671 if (relocatep)
1672 {
1673 reloc_howto_type *howto;
1674 struct ecoff_link_hash_entry *h = NULL;
1675 asection *s = NULL;
1676 bfd_vma relocation;
1677 bfd_reloc_status_type r;
1678
1679 /* Perform a relocation. */
1680
1681 howto = &alpha_howto_table[r_type];
1682
1683 if (r_extern)
1684 {
1685 h = sym_hashes[r_symndx];
1686 /* If h is NULL, that means that there is a reloc
1687 against an external symbol which we thought was just
1688 a debugging symbol. This should not happen. */
1689 if (h == (struct ecoff_link_hash_entry *) NULL)
1690 abort ();
1691 }
1692 else
1693 {
1694 if (r_symndx >= NUM_RELOC_SECTIONS)
1695 s = NULL;
1696 else
1697 s = symndx_to_section[r_symndx];
1698
1699 if (s == (asection *) NULL)
1700 abort ();
1701 }
1702
1703 if (info->relocateable)
1704 {
1705 /* We are generating relocateable output, and must
1706 convert the existing reloc. */
1707 if (r_extern)
1708 {
1709 if (h->root.type != bfd_link_hash_defined
1710 && h->indx == -1)
1711 {
1712 /* This symbol is not being written out. */
1713 if (! ((*info->callbacks->unattached_reloc)
1714 (info, h->root.root.string, input_bfd,
1715 input_section, r_vaddr - input_section->vma)))
1716 return false;
1717 }
1718
1719 relocation = alpha_convert_external_reloc (output_bfd,
1720 info,
1721 input_bfd,
1722 ext_rel,
1723 h);
1724 }
1725 else
1726 {
1727 /* This is a relocation against a section. Adjust
1728 the value by the amount the section moved. */
1729 relocation = (s->output_section->vma
1730 + s->output_offset
1731 - s->vma);
1732 }
1733
1734 /* If this is PC relative, the existing object file
1735 appears to already have the reloc worked out. We
1736 must subtract out the old value and add in the new
1737 one. */
1738 if (howto->pc_relative)
1739 relocation -= (input_section->output_section->vma
1740 + input_section->output_offset
1741 - input_section->vma);
1742
1743 /* Put in any addend. */
1744 relocation += addend;
1745
1746 /* Adjust the contents. */
1747 r = _bfd_relocate_contents (howto, input_bfd, relocation,
1748 (contents
1749 + r_vaddr
1750 - input_section->vma));
1751 }
1752 else
1753 {
1754 /* We are producing a final executable. */
1755 if (r_extern)
1756 {
1757 /* This is a reloc against a symbol. */
1758 if (h->root.type == bfd_link_hash_defined)
1759 {
1760 asection *hsec;
1761
1762 hsec = h->root.u.def.section;
1763 relocation = (h->root.u.def.value
1764 + hsec->output_section->vma
1765 + hsec->output_offset);
1766 }
1767 else
1768 {
1769 if (! ((*info->callbacks->undefined_symbol)
1770 (info, h->root.root.string, input_bfd,
1771 input_section,
1772 r_vaddr - input_section->vma)))
1773 return false;
1774 relocation = 0;
1775 }
1776 }
1777 else
1778 {
1779 /* This is a reloc against a section. */
1780 relocation = (s->output_section->vma
1781 + s->output_offset
1782 - s->vma);
1783
1784 /* Adjust a PC relative relocation by removing the
1785 reference to the original source section. */
1786 if (howto->pc_relative)
1787 relocation += input_section->vma;
1788 }
1789
1790 r = _bfd_final_link_relocate (howto,
1791 input_bfd,
1792 input_section,
1793 contents,
1794 r_vaddr - input_section->vma,
1795 relocation,
1796 addend);
1797 }
1798
1799 if (r != bfd_reloc_ok)
1800 {
1801 switch (r)
1802 {
1803 default:
1804 case bfd_reloc_outofrange:
1805 abort ();
1806 case bfd_reloc_overflow:
1807 {
1808 const char *name;
1809
1810 if (r_extern)
1811 name = sym_hashes[r_symndx]->root.root.string;
1812 else
1813 name = bfd_section_name (input_bfd,
1814 symndx_to_section[r_symndx]);
1815 if (! ((*info->callbacks->reloc_overflow)
1816 (info, name, alpha_howto_table[r_type].name,
1817 (bfd_vma) 0, input_bfd, input_section,
1818 r_vaddr - input_section->vma)))
1819 return false;
1820 }
1821 break;
1822 }
1823 }
1824 }
1825
1826 if (info->relocateable && adjust_addrp)
1827 {
1828 /* Change the address of the relocation. */
1829 bfd_h_put_64 (input_bfd,
1830 (input_section->output_section->vma
1831 + input_section->output_offset
1832 - input_section->vma
1833 + r_vaddr),
1834 (bfd_byte *) ext_rel->r_vaddr);
1835 }
1836
1837 if (gp_usedp && gp_undefined)
1838 {
1839 if (! ((*info->callbacks->reloc_dangerous)
1840 (info, "GP relative relocation when GP not defined",
1841 input_bfd, input_section, r_vaddr - input_section->vma)))
1842 return false;
1843 /* Only give the error once per link. */
1844 ecoff_data (output_bfd)->gp = gp = 4;
1845 gp_undefined = false;
1846 }
1847 }
1848
1849 if (tos != 0)
1850 abort ();
1851
1852 return true;
1853 }
1854 \f
1855 #define ecoff_core_file_p _bfd_dummy_target
1856 #define ecoff_core_file_failing_command _bfd_dummy_core_file_failing_command
1857 #define ecoff_core_file_failing_signal _bfd_dummy_core_file_failing_signal
1858 #define ecoff_core_file_matches_executable_p \
1859 _bfd_dummy_core_file_matches_executable_p
1860 \f
1861 /* This is the ECOFF backend structure. The backend field of the
1862 target vector points to this. */
1863
1864 static const struct ecoff_backend_data alpha_ecoff_backend_data =
1865 {
1866 /* COFF backend structure. */
1867 {
1868 (void (*) PARAMS ((bfd *,PTR,int,int,int,int,PTR))) bfd_void, /* aux_in */
1869 (void (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* sym_in */
1870 (void (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* lineno_in */
1871 (unsigned (*) PARAMS ((bfd *,PTR,int,int,int,int,PTR)))bfd_void,/*aux_out*/
1872 (unsigned (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* sym_out */
1873 (unsigned (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* lineno_out */
1874 (unsigned (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* reloc_out */
1875 alpha_ecoff_swap_filehdr_out, alpha_ecoff_swap_aouthdr_out,
1876 alpha_ecoff_swap_scnhdr_out,
1877 FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, true,
1878 alpha_ecoff_swap_filehdr_in, alpha_ecoff_swap_aouthdr_in,
1879 alpha_ecoff_swap_scnhdr_in, alpha_ecoff_bad_format_hook,
1880 ecoff_set_arch_mach_hook, ecoff_mkobject_hook,
1881 ecoff_styp_to_sec_flags, ecoff_make_section_hook, ecoff_set_alignment_hook,
1882 ecoff_slurp_symbol_table, NULL, NULL
1883 },
1884 /* Supported architecture. */
1885 bfd_arch_alpha,
1886 /* Initial portion of armap string. */
1887 "________64",
1888 /* The page boundary used to align sections in a demand-paged
1889 executable file. E.g., 0x1000. */
1890 0x2000,
1891 /* True if the .rdata section is part of the text segment, as on the
1892 Alpha. False if .rdata is part of the data segment, as on the
1893 MIPS. */
1894 true,
1895 /* Bitsize of constructor entries. */
1896 64,
1897 /* Reloc to use for constructor entries. */
1898 &alpha_howto_table[ALPHA_R_REFQUAD],
1899 {
1900 /* Symbol table magic number. */
1901 magicSym2,
1902 /* Alignment of debugging information. E.g., 4. */
1903 8,
1904 /* Sizes of external symbolic information. */
1905 sizeof (struct hdr_ext),
1906 sizeof (struct dnr_ext),
1907 sizeof (struct pdr_ext),
1908 sizeof (struct sym_ext),
1909 sizeof (struct opt_ext),
1910 sizeof (struct fdr_ext),
1911 sizeof (struct rfd_ext),
1912 sizeof (struct ext_ext),
1913 /* Functions to swap in external symbolic data. */
1914 ecoff_swap_hdr_in,
1915 ecoff_swap_dnr_in,
1916 ecoff_swap_pdr_in,
1917 ecoff_swap_sym_in,
1918 ecoff_swap_opt_in,
1919 ecoff_swap_fdr_in,
1920 ecoff_swap_rfd_in,
1921 ecoff_swap_ext_in,
1922 /* Functions to swap out external symbolic data. */
1923 ecoff_swap_hdr_out,
1924 ecoff_swap_dnr_out,
1925 ecoff_swap_pdr_out,
1926 ecoff_swap_sym_out,
1927 ecoff_swap_opt_out,
1928 ecoff_swap_fdr_out,
1929 ecoff_swap_rfd_out,
1930 ecoff_swap_ext_out
1931 },
1932 /* External reloc size. */
1933 RELSZ,
1934 /* Reloc swapping functions. */
1935 alpha_ecoff_swap_reloc_in,
1936 alpha_ecoff_swap_reloc_out,
1937 /* Backend reloc tweaking. */
1938 alpha_adjust_reloc_in,
1939 alpha_adjust_reloc_out,
1940 /* Relocate section contents while linking. */
1941 alpha_relocate_section
1942 };
1943
1944 /* Looking up a reloc type is Alpha specific. */
1945 #define ecoff_bfd_reloc_type_lookup alpha_bfd_reloc_type_lookup
1946
1947 /* So is getting relocated section contents. */
1948 #define ecoff_bfd_get_relocated_section_contents \
1949 alpha_ecoff_get_relocated_section_contents
1950
1951 bfd_target ecoffalpha_little_vec =
1952 {
1953 "ecoff-littlealpha", /* name */
1954 bfd_target_ecoff_flavour,
1955 false, /* data byte order is little */
1956 false, /* header byte order is little */
1957
1958 (HAS_RELOC | EXEC_P | /* object flags */
1959 HAS_LINENO | HAS_DEBUG |
1960 HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
1961
1962 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* sect
1963 flags */
1964 0, /* leading underscore */
1965 ' ', /* ar_pad_char */
1966 15, /* ar_max_namelen */
1967 4, /* minimum alignment power */
1968 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
1969 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
1970 bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
1971 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
1972 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
1973 bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
1974
1975 {_bfd_dummy_target, alpha_ecoff_object_p, /* bfd_check_format */
1976 ecoff_archive_p, _bfd_dummy_target},
1977 {bfd_false, ecoff_mkobject, /* bfd_set_format */
1978 _bfd_generic_mkarchive, bfd_false},
1979 {bfd_false, ecoff_write_object_contents, /* bfd_write_contents */
1980 _bfd_write_archive_contents, bfd_false},
1981 JUMP_TABLE (ecoff),
1982 (PTR) &alpha_ecoff_backend_data
1983 };
This page took 0.069441 seconds and 4 git commands to generate.