1 /* BFD back-end for PowerPC Microsoft Portable Executable files.
2 Copyright 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
4 Original version pieced together by Kim Knuttila (krk@cygnus.com)
6 There is nothing new under the sun. This file draws a lot on other
7 coff files, in particular, those for the rs/6000, alpha, mips, and
8 intel backends, and the PE work for the arm.
10 This file is part of BFD, the Binary File Descriptor library.
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
28 - relocs generated by gas
29 - ld will link files, but they do not run.
30 - dlltool will not produce correct output in some .reloc cases, and will
31 not produce the right glue code for dll function calls.
40 #include "coff/powerpc.h"
41 #include "coff/internal.h"
49 #define BADMAG(x) PPCBADMAG(x)
53 /* The toc is a set of bfd_vma fields. We use the fact that valid */
54 /* addresses are even (i.e. the bit representing "1" is off) to allow */
55 /* us to encode a little extra information in the field */
56 /* - Unallocated addresses are intialized to 1. */
57 /* - Allocated addresses are even numbers. */
58 /* The first time we actually write a reference to the toc in the bfd, */
59 /* we want to record that fact in a fixup file (if it is asked for), so */
60 /* we keep track of whether or not an address has been written by marking */
61 /* the low order bit with a "1" upon writing */
63 #define SET_UNALLOCATED(x) ((x) = 1)
64 #define IS_UNALLOCATED(x) ((x) == 1)
66 #define IS_WRITTEN(x) ((x) & 1)
67 #define MARK_AS_WRITTEN(x) ((x) |= 1)
68 #define MAKE_ADDR_AGAIN(x) ((x) &= ~1)
70 /* In order not to add an int to every hash table item for every coff
71 linker, we define our own hash table, derived from the coff one */
73 /* PE linker hash table entries. */
75 struct ppc_coff_link_hash_entry
77 struct coff_link_hash_entry root
; /* First entry, as required */
79 /* As we wonder around the relocs, we'll keep the assigned toc_offset
81 bfd_vma toc_offset
; /* Our addition, as required */
83 unsigned long int glue_insn
;
87 /* Need a 7 char string for an eye catcher */
90 #define CHECK_EYE(addr) \
91 if (strcmp(addr, EYE) != 0) \
94 "File %s, line %d, Hash check failure, bad eye %8s\n", \
95 __FILE__, __LINE__, addr); \
99 /* PE linker hash table. */
101 struct ppc_coff_link_hash_table
103 struct coff_link_hash_table root
; /* First entry, as required */
106 static struct bfd_hash_entry
*ppc_coff_link_hash_newfunc
107 PARAMS ((struct bfd_hash_entry
*, struct bfd_hash_table
*,
110 /* Routine to create an entry in the link hash table. */
112 static struct bfd_hash_entry
*
113 ppc_coff_link_hash_newfunc (entry
, table
, string
)
114 struct bfd_hash_entry
*entry
;
115 struct bfd_hash_table
*table
;
118 struct ppc_coff_link_hash_entry
*ret
=
119 (struct ppc_coff_link_hash_entry
*) entry
;
121 /* Allocate the structure if it has not already been allocated by a
123 if (ret
== (struct ppc_coff_link_hash_entry
*) NULL
)
124 ret
= (struct ppc_coff_link_hash_entry
*)
125 bfd_hash_allocate (table
,
126 sizeof (struct ppc_coff_link_hash_entry
));
128 if (ret
== (struct ppc_coff_link_hash_entry
*) NULL
)
131 /* Call the allocation method of the superclass. */
132 ret
= ((struct ppc_coff_link_hash_entry
*)
133 _bfd_coff_link_hash_newfunc ((struct bfd_hash_entry
*) ret
,
138 /* Initialize the local fields. */
139 SET_UNALLOCATED(ret
->toc_offset
);
140 ret
->symbol_is_glue
= 0;
142 strcpy(ret
->eye_catcher
, EYE
);
145 return (struct bfd_hash_entry
*) ret
;
148 /* Initialize a PE linker hash table. */
151 ppc_coff_link_hash_table_init (table
, abfd
, newfunc
)
152 struct ppc_coff_link_hash_table
*table
;
154 struct bfd_hash_entry
*(*newfunc
) PARAMS ((struct bfd_hash_entry
*,
155 struct bfd_hash_table
*,
158 return _bfd_coff_link_hash_table_init (&table
->root
, abfd
, newfunc
);
161 /* Create a PE linker hash table. */
163 static struct bfd_link_hash_table
*
164 ppc_coff_link_hash_table_create (abfd
)
167 struct ppc_coff_link_hash_table
*ret
;
169 ret
= ((struct ppc_coff_link_hash_table
*)
170 bfd_alloc (abfd
, sizeof (struct ppc_coff_link_hash_table
)));
173 if (! ppc_coff_link_hash_table_init (ret
, abfd
,
174 ppc_coff_link_hash_newfunc
))
176 bfd_release (abfd
, ret
);
177 return (struct bfd_link_hash_table
*) NULL
;
179 return &ret
->root
.root
;
182 /* Now, tailor coffcode.h to use our hash stuff */
184 #define coff_bfd_link_hash_table_create ppc_coff_link_hash_table_create
187 /* The nt loader points the toc register to &toc + 32768, in order to */
188 /* use the complete range of a 16-bit displacement (I guess). We have */
189 /* to adjust for this when we fix up loads displaced off the toc reg. */
190 #define TOC_LOAD_ADJUSTMENT (-32768)
191 #define TOC_SECTION_NAME ".private.toc"
193 /* The main body of code is in coffcode.h. */
195 #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3)
197 /* In case we're on a 32-bit machine, construct a 64-bit "-1" value
198 from smaller values. Start with zero, widen, *then* decrement. */
199 #define MINUS_ONE (((bfd_vma)0) - 1)
201 /* these should definitely go in a header file somewhere... */
204 #define IMAGE_REL_PPC_ABSOLUTE 0x0000
207 #define IMAGE_REL_PPC_ADDR64 0x0001
210 #define IMAGE_REL_PPC_ADDR32 0x0002
212 /* 26-bit address, shifted left 2 (branch absolute) */
213 #define IMAGE_REL_PPC_ADDR24 0x0003
216 #define IMAGE_REL_PPC_ADDR16 0x0004
218 /* 16-bit address, shifted left 2 (load doubleword) */
219 #define IMAGE_REL_PPC_ADDR14 0x0005
221 /* 26-bit PC-relative offset, shifted left 2 (branch relative) */
222 #define IMAGE_REL_PPC_REL24 0x0006
224 /* 16-bit PC-relative offset, shifted left 2 (br cond relative) */
225 #define IMAGE_REL_PPC_REL14 0x0007
227 /* 16-bit offset from TOC base */
228 #define IMAGE_REL_PPC_TOCREL16 0x0008
230 /* 16-bit offset from TOC base, shifted left 2 (load doubleword) */
231 #define IMAGE_REL_PPC_TOCREL14 0x0009
233 /* 32-bit addr w/o image base */
234 #define IMAGE_REL_PPC_ADDR32NB 0x000A
236 /* va of containing section (as in an image sectionhdr) */
237 #define IMAGE_REL_PPC_SECREL 0x000B
239 /* sectionheader number */
240 #define IMAGE_REL_PPC_SECTION 0x000C
242 /* substitute TOC restore instruction iff symbol is glue code */
243 #define IMAGE_REL_PPC_IFGLUE 0x000D
245 /* symbol is glue code; virtual address is TOC restore instruction */
246 #define IMAGE_REL_PPC_IMGLUE 0x000E
248 /* va of containing section (limited to 16 bits) */
249 #define IMAGE_REL_PPC_SECREL16 0x000F
251 /* stuff to handle immediate data when the number of bits in the */
252 /* data is greater than the number of bits in the immediate field */
253 /* We need to do (usually) 32 bit arithmetic on 16 bit chunks */
254 #define IMAGE_REL_PPC_REFHI 0x0010
255 #define IMAGE_REL_PPC_REFLO 0x0011
256 #define IMAGE_REL_PPC_PAIR 0x0012
258 /* This is essentially the same as tocrel16, with TOCDEFN assumed */
259 #define IMAGE_REL_PPC_TOCREL16_DEFN 0x0013
261 /* Flag bits in IMAGE_RELOCATION.TYPE */
263 /* subtract reloc value rather than adding it */
264 #define IMAGE_REL_PPC_NEG 0x0100
266 /* fix branch prediction bit to predict branch taken */
267 #define IMAGE_REL_PPC_BRTAKEN 0x0200
269 /* fix branch prediction bit to predict branch not taken */
270 #define IMAGE_REL_PPC_BRNTAKEN 0x0400
272 /* toc slot defined in file (or, data in toc) */
273 #define IMAGE_REL_PPC_TOCDEFN 0x0800
275 /* masks to isolate above values in IMAGE_RELOCATION.Type */
276 #define IMAGE_REL_PPC_TYPEMASK 0x00FF
277 #define IMAGE_REL_PPC_FLAGMASK 0x0F00
279 #define EXTRACT_TYPE(x) ((x) & IMAGE_REL_PPC_TYPEMASK)
280 #define EXTRACT_FLAGS(x) ((x) & IMAGE_REL_PPC_FLAGMASK)
281 #define EXTRACT_JUNK(x) \
282 ((x) & ~(IMAGE_REL_PPC_TYPEMASK | IMAGE_REL_PPC_FLAGMASK))
285 /* static helper functions to make relocation work */
286 /* (Work In Progress) */
288 static bfd_reloc_status_type ppc_refhi_reloc
PARAMS ((bfd
*abfd
,
295 static bfd_reloc_status_type ppc_reflo_reloc
PARAMS ((bfd
*abfd
,
302 static bfd_reloc_status_type ppc_pair_reloc
PARAMS ((bfd
*abfd
,
311 static bfd_reloc_status_type ppc_toc16_reloc
PARAMS ((bfd
*abfd
,
319 static bfd_reloc_status_type ppc_addr32nb_reloc
PARAMS ((bfd
*abfd
,
327 static bfd_reloc_status_type ppc_section_reloc
PARAMS ((bfd
*abfd
,
335 static bfd_reloc_status_type ppc_secrel_reloc
PARAMS ((bfd
*abfd
,
343 static bfd_reloc_status_type ppc_imglue_reloc
PARAMS ((bfd
*abfd
,
353 static boolean in_reloc_p
PARAMS((bfd
*abfd
, reloc_howto_type
*howto
));
356 /* FIXME: It'll take a while to get through all of these. I only need a few to
357 get us started, so those I'll make sure work. Those marked FIXME are either
358 completely unverified or have a specific unknown marked in the comment */
360 /*---------------------------------------------------------------------------*/
362 /* Relocation entries for Windows/NT on PowerPC. */
364 /* From the document "" we find the following listed as used relocs: */
366 /* ABSOLUTE : The noop */
367 /* ADDR[64|32|16] : fields that hold addresses in data fields or the */
368 /* 16 bit displacement field on a load/store. */
369 /* ADDR[24|14] : fields that hold addresses in branch and cond */
370 /* branches. These represent [26|16] bit addresses. */
371 /* The low order 2 bits are preserved. */
372 /* REL[24|14] : branches relative to the Instruction Address */
373 /* register. These represent [26|16] bit addresses, */
374 /* as before. The instruction field will be zero, and */
375 /* the address of the SYM will be inserted at link time. */
376 /* TOCREL16 : 16 bit displacement field referring to a slot in */
378 /* TOCREL14 : 16 bit displacement field, similar to REL14 or ADDR14. */
379 /* ADDR32NB : 32 bit address relative to the virtual origin. */
380 /* (On the alpha, this is always a linker generated thunk)*/
381 /* (i.e. 32bit addr relative to the image base) */
382 /* SECREL : The value is relative to the start of the section */
383 /* containing the symbol. */
384 /* SECTION : access to the header containing the item. Supports the */
385 /* codeview debugger. */
387 /* In particular, note that the document does not indicate that the */
388 /* relocations listed in the header file are used. */
392 /*---------------------------------------------------------------------------*/
394 static reloc_howto_type ppc_coff_howto_table
[] =
396 /* IMAGE_REL_PPC_ABSOLUTE 0x0000 NOP */
398 HOWTO (IMAGE_REL_PPC_ABSOLUTE
, /* type */
400 0, /* size (0 = byte, 1 = short, 2 = long) */
402 false, /* pc_relative */
404 complain_overflow_dont
, /* dont complain_on_overflow */
405 0, /* special_function */
406 "ABSOLUTE", /* name */
407 false, /* partial_inplace */
410 false), /* pcrel_offset */
412 /* IMAGE_REL_PPC_ADDR64 0x0001 64-bit address */
414 HOWTO(IMAGE_REL_PPC_ADDR64
, /* type */
416 3, /* size (0 = byte, 1 = short, 2 = long) */
418 false, /* pc_relative */
420 complain_overflow_bitfield
, /* complain_on_overflow */
421 0, /* special_function */
423 true, /* partial_inplace */
424 MINUS_ONE
, /* src_mask */
425 MINUS_ONE
, /* dst_mask */
426 false), /* pcrel_offset */
428 /* IMAGE_REL_PPC_ADDR32 0x0002 32-bit address */
430 HOWTO (IMAGE_REL_PPC_ADDR32
, /* type */
432 2, /* size (0 = byte, 1 = short, 2 = long) */
434 false, /* pc_relative */
436 complain_overflow_bitfield
, /* complain_on_overflow */
437 0, /* special_function */
439 true, /* partial_inplace */
440 0xffffffff, /* src_mask */
441 0xffffffff, /* dst_mask */
442 false), /* pcrel_offset */
444 /* IMAGE_REL_PPC_ADDR24 0x0003 26-bit address, shifted left 2 (branch absolute) */
445 /* the LI field is in bit 6 through bit 29 is 24 bits, + 2 for the shift */
446 /* Of course, That's the IBM approved bit numbering, which is not what */
447 /* anyone else uses.... The li field is in bit 2 thru 25 */
449 HOWTO (IMAGE_REL_PPC_ADDR24
, /* type */
451 2, /* size (0 = byte, 1 = short, 2 = long) */
453 false, /* pc_relative */
455 complain_overflow_bitfield
, /* complain_on_overflow */
456 0, /* special_function */
458 true, /* partial_inplace */
459 0x07fffffc, /* src_mask */
460 0x07fffffc, /* dst_mask */
461 false), /* pcrel_offset */
463 /* IMAGE_REL_PPC_ADDR16 0x0004 16-bit address */
465 HOWTO (IMAGE_REL_PPC_ADDR16
, /* type */
467 1, /* size (0 = byte, 1 = short, 2 = long) */
469 false, /* pc_relative */
471 complain_overflow_signed
, /* complain_on_overflow */
472 0, /* special_function */
474 true, /* partial_inplace */
475 0xffff, /* src_mask */
476 0xffff, /* dst_mask */
477 false), /* pcrel_offset */
479 /* IMAGE_REL_PPC_ADDR14 0x0005 */
480 /* 16-bit address, shifted left 2 (load doubleword) */
481 /* FIXME: the mask is likely wrong, and the bit position may be as well */
483 HOWTO (IMAGE_REL_PPC_ADDR14
, /* type */
485 1, /* size (0 = byte, 1 = short, 2 = long) */
487 false, /* pc_relative */
489 complain_overflow_signed
, /* complain_on_overflow */
490 0, /* special_function */
492 true, /* partial_inplace */
493 0xffff, /* src_mask */
494 0xffff, /* dst_mask */
495 false), /* pcrel_offset */
497 /* IMAGE_REL_PPC_REL24 0x0006 */
498 /* 26-bit PC-relative offset, shifted left 2 (branch relative) */
500 HOWTO (IMAGE_REL_PPC_REL24
, /* type */
502 2, /* size (0 = byte, 1 = short, 2 = long) */
504 true, /* pc_relative */
506 complain_overflow_signed
, /* complain_on_overflow */
507 0, /* special_function */
509 true, /* partial_inplace */
510 0x3fffffc, /* src_mask */
511 0x3fffffc, /* dst_mask */
512 false), /* pcrel_offset */
514 /* IMAGE_REL_PPC_REL14 0x0007 */
515 /* 16-bit PC-relative offset, shifted left 2 (br cond relative) */
516 /* FIXME: the mask is likely wrong, and the bit position may be as well */
517 /* FIXME: how does it know how far to shift? */
519 HOWTO (IMAGE_REL_PPC_ADDR14
, /* type */
521 1, /* size (0 = byte, 1 = short, 2 = long) */
523 false, /* pc_relative */
525 complain_overflow_signed
, /* complain_on_overflow */
526 0, /* special_function */
528 true, /* partial_inplace */
529 0xffff, /* src_mask */
530 0xffff, /* dst_mask */
531 true), /* pcrel_offset */
533 /* IMAGE_REL_PPC_TOCREL16 0x0008 */
534 /* 16-bit offset from TOC base */
536 HOWTO (IMAGE_REL_PPC_TOCREL16
,/* type */
538 1, /* size (0 = byte, 1 = short, 2 = long) */
540 false, /* pc_relative */
542 complain_overflow_dont
, /* complain_on_overflow */
543 ppc_toc16_reloc
, /* special_function */
544 "TOCREL16", /* name */
545 false, /* partial_inplace */
546 0xffff, /* src_mask */
547 0xffff, /* dst_mask */
548 false), /* pcrel_offset */
550 /* IMAGE_REL_PPC_TOCREL14 0x0009 */
551 /* 16-bit offset from TOC base, shifted left 2 (load doubleword) */
553 HOWTO (IMAGE_REL_PPC_TOCREL14
,/* type */
555 1, /* size (0 = byte, 1 = short, 2 = long) */
557 false, /* pc_relative */
559 complain_overflow_signed
, /* complain_on_overflow */
560 0, /* special_function */
561 "TOCREL14", /* name */
562 false, /* partial_inplace */
563 0xffff, /* src_mask */
564 0xffff, /* dst_mask */
565 false), /* pcrel_offset */
567 /* IMAGE_REL_PPC_ADDR32NB 0x000A */
568 /* 32-bit addr w/ image base */
570 HOWTO (IMAGE_REL_PPC_ADDR32NB
,/* type */
572 2, /* size (0 = byte, 1 = short, 2 = long) */
574 false, /* pc_relative */
576 complain_overflow_signed
, /* complain_on_overflow */
577 0, /* special_function */
578 "ADDR32NB", /* name */
579 true, /* partial_inplace */
580 0xffffffff, /* src_mask */
581 0xffffffff, /* dst_mask */
582 false), /* pcrel_offset */
584 /* IMAGE_REL_PPC_SECREL 0x000B */
585 /* va of containing section (as in an image sectionhdr) */
587 HOWTO (IMAGE_REL_PPC_SECREL
,/* type */
589 2, /* size (0 = byte, 1 = short, 2 = long) */
591 false, /* pc_relative */
593 complain_overflow_signed
, /* complain_on_overflow */
594 ppc_secrel_reloc
, /* special_function */
596 true, /* partial_inplace */
597 0xffffffff, /* src_mask */
598 0xffffffff, /* dst_mask */
599 true), /* pcrel_offset */
601 /* IMAGE_REL_PPC_SECTION 0x000C */
602 /* sectionheader number */
604 HOWTO (IMAGE_REL_PPC_SECTION
,/* type */
606 2, /* size (0 = byte, 1 = short, 2 = long) */
608 false, /* pc_relative */
610 complain_overflow_signed
, /* complain_on_overflow */
611 ppc_section_reloc
, /* special_function */
612 "SECTION", /* name */
613 true, /* partial_inplace */
614 0xffffffff, /* src_mask */
615 0xffffffff, /* dst_mask */
616 true), /* pcrel_offset */
618 /* IMAGE_REL_PPC_IFGLUE 0x000D */
619 /* substitute TOC restore instruction iff symbol is glue code */
621 HOWTO (IMAGE_REL_PPC_IFGLUE
,/* type */
623 2, /* size (0 = byte, 1 = short, 2 = long) */
625 false, /* pc_relative */
627 complain_overflow_signed
, /* complain_on_overflow */
628 0, /* special_function */
630 true, /* partial_inplace */
631 0xffffffff, /* src_mask */
632 0xffffffff, /* dst_mask */
633 false), /* pcrel_offset */
635 /* IMAGE_REL_PPC_IMGLUE 0x000E */
636 /* symbol is glue code; virtual address is TOC restore instruction */
638 HOWTO (IMAGE_REL_PPC_IMGLUE
,/* type */
640 2, /* size (0 = byte, 1 = short, 2 = long) */
642 false, /* pc_relative */
644 complain_overflow_dont
, /* complain_on_overflow */
645 ppc_imglue_reloc
, /* special_function */
647 false, /* partial_inplace */
648 0xffffffff, /* src_mask */
649 0xffffffff, /* dst_mask */
650 false), /* pcrel_offset */
652 /* IMAGE_REL_PPC_SECREL16 0x000F */
653 /* va of containing section (limited to 16 bits) */
655 HOWTO (IMAGE_REL_PPC_SECREL16
,/* type */
657 1, /* size (0 = byte, 1 = short, 2 = long) */
659 false, /* pc_relative */
661 complain_overflow_signed
, /* complain_on_overflow */
662 0, /* special_function */
663 "SECREL16", /* name */
664 true, /* partial_inplace */
665 0xffff, /* src_mask */
666 0xffff, /* dst_mask */
667 true), /* pcrel_offset */
669 /* IMAGE_REL_PPC_REFHI 0x0010 */
671 HOWTO (IMAGE_REL_PPC_REFHI
, /* type */
673 1, /* size (0 = byte, 1 = short, 2 = long) */
675 false, /* pc_relative */
677 complain_overflow_signed
, /* complain_on_overflow */
678 ppc_refhi_reloc
, /* special_function */
680 true, /* partial_inplace */
681 0xffffffff, /* src_mask */
682 0xffffffff, /* dst_mask */
683 false), /* pcrel_offset */
685 /* IMAGE_REL_PPC_REFLO 0x0011 */
687 HOWTO (IMAGE_REL_PPC_REFLO
, /* type */
689 1, /* size (0 = byte, 1 = short, 2 = long) */
691 false, /* pc_relative */
693 complain_overflow_signed
, /* complain_on_overflow */
694 ppc_refhi_reloc
, /* special_function */
696 true, /* partial_inplace */
697 0xffffffff, /* src_mask */
698 0xffffffff, /* dst_mask */
699 false), /* pcrel_offset */
701 /* IMAGE_REL_PPC_PAIR 0x0012 */
703 HOWTO (IMAGE_REL_PPC_PAIR
, /* type */
705 1, /* size (0 = byte, 1 = short, 2 = long) */
707 false, /* pc_relative */
709 complain_overflow_signed
, /* complain_on_overflow */
710 ppc_pair_reloc
, /* special_function */
712 true, /* partial_inplace */
713 0xffffffff, /* src_mask */
714 0xffffffff, /* dst_mask */
715 false), /* pcrel_offset */
717 /* IMAGE_REL_PPC_TOCREL16_DEFN 0x0013 */
718 /* 16-bit offset from TOC base, without causing a definition */
720 HOWTO ( (IMAGE_REL_PPC_TOCREL16
| IMAGE_REL_PPC_TOCDEFN
), /* type */
722 1, /* size (0 = byte, 1 = short, 2 = long) */
724 false, /* pc_relative */
726 complain_overflow_dont
, /* complain_on_overflow */
727 0, /* special_function */
728 "TOCREL16, TOCDEFN", /* name */
729 false, /* partial_inplace */
730 0xffff, /* src_mask */
731 0xffff, /* dst_mask */
732 false), /* pcrel_offset */
739 /* Some really cheezy macros that can be turned on to test stderr :-) */
748 fprintf(stderr,"Unimplemented Relocation -- %s\n",x); \
752 #define DUMP_RELOC(n,r) \
754 fprintf(stderr,"%s sym %d, addr %d, addend %d\n", \
755 n, (*(r->sym_ptr_ptr))->name, \
756 r->address, r->addend); \
759 /* Given a reloc name, n, and a pointer to an internal_reloc,
760 dump out interesting information on the contents
762 #define n_name _n._n_name
763 #define n_zeroes _n._n_n._n_zeroes
764 #define n_offset _n._n_n._n_offset
768 #define DUMP_RELOC2(n,r) \
770 fprintf(stderr,"%s sym %d, r_vaddr %d %s\n", \
771 n, r->r_symndx, r->r_vaddr,\
772 (((r->r_type) & IMAGE_REL_PPC_TOCDEFN) == 0) \
778 #define DUMP_RELOC(n,r)
779 #define DUMP_RELOC2(n,r)
784 /* toc construction and management routines */
785 extern bfd
* bfd_of_toc_owner
;
786 extern long int global_toc_size
;
788 extern long int import_table_size
;
789 extern long int first_thunk_address
;
790 extern long int thunk_size
;
808 struct list_ele
*next
;
810 enum ref_category cat
;
815 extern struct list_ele
*head
;
816 extern struct list_ele
*tail
;
819 record_toc(toc_section
, our_toc_offset
, cat
, name
)
820 asection
*toc_section
;
822 enum ref_category cat
;
825 /* add this entry to our toc addr-offset-name list */
827 t
= malloc(sizeof(struct list_ele
));
829 t
->offset
= our_toc_offset
;
832 t
->addr
= toc_section
->output_offset
+ our_toc_offset
;
846 /* record a toc offset against a symbol */
848 ppc_record_toc_entry(abfd
, info
, sec
, sym
, toc_kind
)
850 struct bfd_link_info
*info
;
853 enum toc_type toc_kind
;
856 bfd_byte
*old_contents
;
861 struct ppc_coff_link_hash_entry
*h
;
862 struct coff_symbol_struct
*target
;
870 h
= (struct ppc_coff_link_hash_entry
*) (obj_coff_sym_hashes (abfd
)[sym
]);
873 CHECK_EYE(h
->eye_catcher
);
878 local_syms
= obj_coff_local_toc_table(abfd
);
882 /* allocate a table */
884 (int *) bfd_zalloc (abfd
,
885 obj_raw_syment_count(abfd
) * sizeof(int));
888 obj_coff_local_toc_table(abfd
) = local_syms
;
889 for (i
= 0; i
< obj_raw_syment_count(abfd
); ++i
)
891 SET_UNALLOCATED(local_syms
[i
]);
895 if (IS_UNALLOCATED(local_syms
[sym
]))
897 local_syms
[sym
] = global_toc_size
;
898 ret_val
= global_toc_size
;
899 global_toc_size
+= 4;
901 /* The size must fit in a 16bit displacment */
902 if (global_toc_size
>= 65535)
905 "Exceeded toc size of 65535\n");
911 "Setting toc_offset for local sym %d to %d\n",
917 ret_val
= local_syms
[sym
];
920 "toc_offset already set for local sym %d to %d\n",
927 name
= h
->root
.root
.root
.string
;
929 /* check to see if there's a toc slot allocated. If not, do it
930 here. It will be used in relocate_section */
931 if (IS_UNALLOCATED(h
->toc_offset
))
933 h
->toc_offset
= global_toc_size
;
934 ret_val
= global_toc_size
;
935 global_toc_size
+= 4;
937 /* The size must fit in a 16bit displacment */
938 if (global_toc_size
>= 65535)
941 "Exceeded toc size of 65535\n");
947 "Setting toc_offset for sym %d (%s) [h=%p] to %d\n",
948 sym
, name
, h
, ret_val
);
953 ret_val
= h
->toc_offset
;
956 "toc_offset already set for sym %d (%s) [h=%p] to %d\n",
957 sym
, name
, h
, ret_val
);
964 /* FIXME: record a toc offset against a data-in-toc symbol */
965 /* Now, there is currenly some confusion on what this means. In some
966 compilers one sees the moral equivalent of:
970 refer to the data with a [tocv] qualifier
971 In general, one sees something to indicate that a tocd has been
972 seen, and that would trigger the allocation of data in toc. The IBM
973 docs seem to suggest that anything with the TOCDEFN qualifier should
974 never trigger storage allocation. However, in the kernel32.lib that
975 we've been using for our test bed, there are a couple of variables
976 referenced that fail that test.
978 So it can't work that way.
981 ppc_record_data_in_toc_entry(abfd
, info
, sec
, sym
, toc_kind
)
983 struct bfd_link_info
*info
;
986 enum toc_type toc_kind
;
989 bfd_byte
*old_contents
;
994 struct ppc_coff_link_hash_entry
*h
= 0;
995 struct coff_symbol_struct
*target
;
1001 h
= (struct ppc_coff_link_hash_entry
*) (obj_coff_sym_hashes (abfd
)[sym
]);
1005 local_syms
= obj_coff_local_toc_table(abfd
);
1006 if (local_syms
== 0)
1009 /* allocate a table */
1011 (int *) bfd_zalloc (abfd
,
1012 obj_raw_syment_count(abfd
) * sizeof(int));
1013 if (local_syms
== 0)
1015 obj_coff_local_toc_table(abfd
) = local_syms
;
1016 for (i
= 0; i
< obj_raw_syment_count(abfd
); ++i
)
1018 SET_UNALLOCATED(local_syms
[i
]);
1022 if (IS_UNALLOCATED(local_syms
[sym
]))
1024 local_syms
[sym
] = global_toc_size
;
1025 ret_val
= global_toc_size
;
1026 global_toc_size
+= 4;
1029 "Setting data_in_toc_offset for local sym %d to %d\n",
1035 ret_val
= local_syms
[sym
];
1038 "data_in_toc_offset already set for local sym %d to %d\n",
1045 CHECK_EYE(h
->eye_catcher
);
1047 name
= h
->root
.root
.root
.string
;
1049 /* check to see if there's a toc slot allocated. If not, do it
1050 here. It will be used in relocate_section */
1051 if (IS_UNALLOCATED(h
->toc_offset
))
1054 h
->toc_offset
= global_toc_size
;
1056 ret_val
= global_toc_size
;
1057 /* We're allocating a chunk of the toc, as opposed to a slot */
1058 /* FIXME: alignment? */
1060 global_toc_size
+= 4;
1063 "Setting data_in_toc_offset for sym %d (%s) [h=%p] to %d\n",
1064 sym
, name
, h
, ret_val
);
1069 ret_val
= h
->toc_offset
;
1072 "data_in_toc_offset already set for sym %d (%s) [h=%p] to %d\n",
1073 sym
, name
, h
, ret_val
);
1081 /* record a toc offset against a symbol */
1083 ppc_mark_symbol_as_glue(abfd
, sym
, rel
)
1086 struct internal_reloc
*rel
;
1088 struct ppc_coff_link_hash_entry
*h
;
1090 h
= (struct ppc_coff_link_hash_entry
*) (obj_coff_sym_hashes (abfd
)[sym
]);
1092 CHECK_EYE(h
->eye_catcher
);
1094 h
->symbol_is_glue
= 1;
1095 h
->glue_insn
= bfd_get_32 (abfd
, (bfd_byte
*) &rel
->r_vaddr
);
1101 /* Provided the symbol, returns the value reffed */
1102 static long get_symbol_value
PARAMS ((asymbol
*));
1105 get_symbol_value (symbol
)
1108 long relocation
= 0;
1110 if (bfd_is_com_section (symbol
->section
))
1116 relocation
= symbol
->value
+
1117 symbol
->section
->output_section
->vma
+
1118 symbol
->section
->output_offset
;
1124 /* Return true if this relocation should
1125 appear in the output .reloc section. */
1127 static boolean
in_reloc_p(abfd
, howto
)
1129 reloc_howto_type
*howto
;
1132 (! howto
->pc_relative
)
1133 && (howto
->type
!= IMAGE_REL_PPC_TOCREL16
)
1134 && (howto
->type
!= IMAGE_REL_PPC_IMGLUE
);
1137 /* this function is in charge of performing all the ppc PE relocations */
1138 /* Don't yet know if we want to do this this particular way ... (krk) */
1139 /* FIXME: (it is not yet enabled) */
1141 static bfd_reloc_status_type
1142 pe_ppc_reloc (abfd
, reloc_entry
, symbol_in
, data
, input_section
, output_bfd
,
1145 arelent
*reloc_entry
;
1148 asection
*input_section
;
1150 char **error_message
;
1152 /* the consth relocation comes in two parts, we have to remember
1153 the state between calls, in these variables */
1154 static boolean part1_consth_active
= false;
1155 static unsigned long part1_consth_value
;
1158 unsigned long sym_value
;
1159 unsigned long unsigned_value
;
1160 unsigned short r_type
;
1163 unsigned long addr
= reloc_entry
->address
; /*+ input_section->vma*/
1164 bfd_byte
*hit_data
=addr
+ (bfd_byte
*)(data
);
1166 fprintf(stderr
, "pe_ppc_reloc (%s)\n", TARGET_LITTLE_NAME
);
1168 r_type
= reloc_entry
->howto
->type
;
1172 /* Partial linking - do nothing */
1173 reloc_entry
->address
+= input_section
->output_offset
;
1174 return bfd_reloc_ok
;
1177 if (symbol_in
!= NULL
1178 && bfd_is_und_section (symbol_in
->section
))
1180 /* Keep the state machine happy in case we're called again */
1181 if (r_type
== IMAGE_REL_PPC_REFHI
)
1183 part1_consth_active
= true;
1184 part1_consth_value
= 0;
1186 return(bfd_reloc_undefined
);
1189 if ((part1_consth_active
) && (r_type
!= IMAGE_REL_PPC_PAIR
))
1191 part1_consth_active
= false;
1192 *error_message
= (char *) "Missing PAIR";
1193 return(bfd_reloc_dangerous
);
1197 sym_value
= get_symbol_value(symbol_in
);
1199 return(bfd_reloc_ok
);
1202 /* The reloc processing routine for the optimized COFF linker. */
1205 coff_ppc_relocate_section (output_bfd
, info
, input_bfd
, input_section
,
1206 contents
, relocs
, syms
, sections
)
1208 struct bfd_link_info
*info
;
1210 asection
*input_section
;
1212 struct internal_reloc
*relocs
;
1213 struct internal_syment
*syms
;
1214 asection
**sections
;
1216 struct internal_reloc
*rel
;
1217 struct internal_reloc
*relend
;
1220 asection
*toc_section
= 0;
1222 reloc_howto_type
*howto
= 0;
1226 "pe_ppc_relocate_section (%s) for %s \n",
1228 input_section
->name
);
1232 /* If we are performing a relocateable link, we don't need to do a
1233 thing. The caller will take care of adjusting the reloc
1234 addresses and symbol indices. */
1235 if (info
->relocateable
)
1242 relend
= rel
+ input_section
->reloc_count
;
1243 for (; rel
< relend
; rel
++)
1246 struct ppc_coff_link_hash_entry
*h
;
1247 struct internal_syment
*sym
;
1251 bfd_reloc_status_type rstat
;
1254 unsigned short r_type
= EXTRACT_TYPE (rel
->r_type
);
1255 unsigned short r_flags
= EXTRACT_FLAGS(rel
->r_type
);
1256 unsigned short junk
= EXTRACT_JUNK (rel
->r_type
);
1259 /* now examine flags */
1262 fprintf (stderr
, "Reloc with flags found!");
1263 if ( r_flags
& IMAGE_REL_PPC_NEG
)
1264 fprintf (stderr
, " NEG");
1265 if ( r_flags
& IMAGE_REL_PPC_BRTAKEN
)
1266 fprintf (stderr
, " BRTAKEN");
1267 if ( r_flags
& IMAGE_REL_PPC_BRNTAKEN
)
1268 fprintf (stderr
, " BRNTAKEN");
1269 if ( r_flags
& IMAGE_REL_PPC_TOCDEFN
)
1270 fprintf (stderr
, " TOCDEFN");
1271 fprintf(stderr
, "\n");
1275 symndx
= rel
->r_symndx
;
1276 loc
= contents
+ rel
->r_vaddr
- input_section
->vma
;
1278 /* FIXME: check bounds on r_type */
1279 howto
= ppc_coff_howto_table
+ r_type
;
1288 h
= (struct ppc_coff_link_hash_entry
*)
1289 (obj_coff_sym_hashes (input_bfd
)[symndx
]);
1292 CHECK_EYE(h
->eye_catcher
);
1295 sym
= syms
+ symndx
;
1301 /* FIXME: PAIR unsupported in the following code */
1305 sec
= bfd_abs_section_ptr
;
1308 sec
= sections
[symndx
];
1309 val
= (sec
->output_section
->vma
1310 + sec
->output_offset
1317 CHECK_EYE(h
->eye_catcher
);
1319 if (h
->root
.root
.type
== bfd_link_hash_defined
1320 || h
->root
.root
.type
== bfd_link_hash_defweak
)
1322 sec
= h
->root
.root
.u
.def
.section
;
1323 val
= (h
->root
.root
.u
.def
.value
1324 + sec
->output_section
->vma
1325 + sec
->output_offset
);
1329 if (! ((*info
->callbacks
->undefined_symbol
)
1330 (info
, h
->root
.root
.root
.string
, input_bfd
, input_section
,
1331 rel
->r_vaddr
- input_section
->vma
)))
1336 rstat
= bfd_reloc_ok
;
1338 /* Each case must do its own relocation, setting rstat appropriately */
1343 "ERROR: during reloc processing -- unsupported reloc %s\n",
1345 bfd_set_error (bfd_error_bad_value
);
1348 case IMAGE_REL_PPC_TOCREL16
:
1350 bfd_vma our_toc_offset
;
1353 DUMP_RELOC2(howto
->name
, rel
);
1355 if (toc_section
== 0)
1357 toc_section
= bfd_get_section_by_name (bfd_of_toc_owner
,
1362 "BFD of toc owner %p, section addr of %s %p\n",
1363 bfd_of_toc_owner
, TOC_SECTION_NAME
, toc_section
);
1366 if ( toc_section
== NULL
)
1368 fprintf(stderr
, "No Toc section!\n");
1374 * Amazing bit tricks present. As we may have seen earlier, we
1375 * use the 1 bit to tell us whether or not a toc offset has been
1376 * allocated. Now that they've all been allocated, we will use
1377 * the 1 bit to tell us if we've written this particular toc
1382 { /* it is a file local symbol */
1383 int *local_toc_table
;
1386 sym
= syms
+ symndx
;
1387 name
= sym
->_n
._n_name
;
1389 local_toc_table
= obj_coff_local_toc_table(input_bfd
);
1390 our_toc_offset
= local_toc_table
[symndx
];
1392 if (IS_WRITTEN(our_toc_offset
))
1394 /* if it has been written out, it is marked with the
1395 1 bit. Fix up our offset, but do not write it out
1398 MAKE_ADDR_AGAIN(our_toc_offset
);
1402 "Not writing out toc_offset of %d for %s\n",
1403 our_toc_offset
, name
);
1408 /* write out the toc entry */
1409 record_toc(toc_section
, our_toc_offset
, priv
, strdup(name
));
1412 "Writing out toc_offset "
1413 "toc_section (%p,%p)+%d val %d for %s\n",
1415 toc_section
->contents
,
1421 bfd_put_32(output_bfd
,
1423 toc_section
->contents
+ our_toc_offset
);
1425 MARK_AS_WRITTEN(local_toc_table
[symndx
]);
1431 const char *name
= h
->root
.root
.root
.string
;
1432 our_toc_offset
= h
->toc_offset
;
1434 if ((r_flags
& IMAGE_REL_PPC_TOCDEFN
)
1435 == IMAGE_REL_PPC_TOCDEFN
1436 && IS_UNALLOCATED(our_toc_offset
))
1438 /* This is unbelievable cheese. Some knowledgable asm
1439 hacker has decided to use r2 as a base for loading
1440 a value. He/She does this by setting the tocdefn bit,
1441 and not supplying a toc definition. The behaviour is
1442 then to use the difference between the value of the
1443 symbol and the actual location of the toc as the toc
1446 In fact, what is usually happening is, because the
1447 Import Address Table is mapped immediately following
1448 the toc, some trippy library code trying for speed on
1449 dll linkage, takes advantage of that and considers
1450 the IAT to be part of the toc, thus saving a load.
1452 our_toc_offset
= val
-
1453 (toc_section
->output_section
->vma
+
1454 toc_section
->output_offset
);
1456 /* The size must still fit in a 16bit displacment */
1457 if (our_toc_offset
>= 65535)
1460 "TOCDEFN Relocation exceeded "
1461 "displacment of 65535\n");
1465 record_toc(toc_section
, our_toc_offset
, pub
, strdup(name
));
1467 else if (IS_WRITTEN(our_toc_offset
))
1469 /* if it has been written out, it is marked with the
1470 1 bit. Fix up our offset, but do not write it out
1473 MAKE_ADDR_AGAIN(our_toc_offset
);
1476 "Not writing out toc_offset of %d for %s\n",
1477 our_toc_offset
, name
);
1482 record_toc(toc_section
, our_toc_offset
, pub
, strdup(name
));
1485 /* write out the toc entry */
1487 "Writing out toc_offset "
1488 "toc_section (%p,%p)+%d val %d for %s\n",
1490 toc_section
->contents
,
1496 /* write out the toc entry */
1497 bfd_put_32(output_bfd
,
1499 toc_section
->contents
+ our_toc_offset
);
1501 MARK_AS_WRITTEN(h
->toc_offset
);
1502 /* The tricky part is that this is the address that */
1503 /* needs a .reloc entry for it */
1508 if (fixit
&& info
->base_file
)
1510 /* So if this is non pcrelative, and is referenced
1511 to a section or a common symbol, then it needs a reloc */
1513 /* relocation to a symbol in a section which
1514 isn't absolute - we output the address here
1517 bfd_vma addr
= toc_section
->output_section
->vma
1518 + toc_section
->output_offset
+ our_toc_offset
;
1521 " Toc Section reloc candidate\n");
1523 if (coff_data(output_bfd
)->pe
)
1524 addr
-= pe_data(output_bfd
)->pe_opthdr
.ImageBase
;
1525 fwrite (&addr
, 1,4, (FILE *) info
->base_file
);
1529 /* FIXME: this test is conservative */
1530 if ( (r_flags
& IMAGE_REL_PPC_TOCDEFN
) != IMAGE_REL_PPC_TOCDEFN
&&
1531 our_toc_offset
> toc_section
->_raw_size
)
1534 "reloc offset is bigger than the toc size!\n");
1538 /* Now we know the relocation for this toc reference */
1539 relocation
= our_toc_offset
+ TOC_LOAD_ADJUSTMENT
;
1540 rstat
= _bfd_relocate_contents (howto
,
1546 case IMAGE_REL_PPC_IFGLUE
:
1548 /* To solve this, we need to know whether or not the symbol */
1549 /* appearing on the call instruction is a glue function or not. */
1550 /* A glue function must announce itself via a IMGLUE reloc, and */
1551 /* the reloc contains the required toc restore instruction */
1554 const char *my_name
;
1555 DUMP_RELOC2(howto
->name
, rel
);
1559 my_name
= h
->root
.root
.root
.string
;
1560 if (h
->symbol_is_glue
== 1)
1562 x
= bfd_get_32(input_bfd
, loc
);
1563 bfd_put_32(input_bfd
, h
->glue_insn
, loc
);
1568 case IMAGE_REL_PPC_SECREL
:
1569 /* Unimplemented: codeview debugging information */
1570 /* For fast access to the header of the section
1571 containing the item. */
1573 case IMAGE_REL_PPC_SECTION
:
1574 /* Unimplemented: codeview debugging information */
1575 /* Is used to indicate that the value should be relative
1576 to the beginning of the section that contains the
1579 case IMAGE_REL_PPC_ABSOLUTE
:
1581 const char *my_name
;
1583 my_name
= (syms
+symndx
)->_n
._n_name
;
1586 my_name
= h
->root
.root
.root
.string
;
1590 "Warning: unsupported reloc %s <file %s, section %s>\n",
1592 bfd_get_filename(input_bfd
),
1593 input_section
->name
);
1595 fprintf(stderr
,"sym %d (%s), r_vaddr %d (%x)\n",
1596 rel
->r_symndx
, my_name
, rel
->r_vaddr
, rel
->r_vaddr
);
1599 case IMAGE_REL_PPC_IMGLUE
:
1601 /* There is nothing to do now. This reloc was noted in the first
1602 pass over the relocs, and the glue instruction extracted */
1603 const char *my_name
;
1604 if (h
->symbol_is_glue
== 1)
1606 my_name
= h
->root
.root
.root
.string
;
1608 "Warning: previously missed IMGLUE reloc %s <file %s, section %s>\n",
1610 bfd_get_filename(input_bfd
),
1611 input_section
->name
);
1617 case IMAGE_REL_PPC_ADDR32NB
:
1619 struct coff_link_hash_entry
*myh
= 0;
1620 const char *name
= 0;
1621 DUMP_RELOC2(howto
->name
, rel
);
1623 { /* it is a file local symbol */
1624 sym
= syms
+ symndx
;
1625 name
= sym
->_n
._n_name
;
1631 name
= h
->root
.root
.root
.string
;
1632 if (strcmp(".idata$2", name
) == 0)
1633 target
= "__idata2_magic__";
1634 else if (strcmp(".idata$4", name
) == 0)
1635 target
= "__idata4_magic__";
1636 else if (strcmp(".idata$5", name
) == 0)
1637 target
= "__idata5_magic__";
1643 myh
= coff_link_hash_lookup (coff_hash_table (info
),
1645 false, false, true);
1648 fprintf(stderr
, "Missing idata magic cookies, "
1649 "this cannot work anyway...\n");
1653 val
= myh
->root
.u
.def
.value
+
1654 sec
->output_section
->vma
+ sec
->output_offset
;
1655 if (first_thunk_address
== 0)
1658 myh
= coff_link_hash_lookup (coff_hash_table (info
),
1660 false, false, true);
1661 first_thunk_address
= myh
->root
.u
.def
.value
+
1662 sec
->output_section
->vma
+
1663 sec
->output_offset
-
1664 pe_data(output_bfd
)->pe_opthdr
.ImageBase
;
1666 idata5offset
= myh
->root
.u
.def
.value
;
1667 myh
= coff_link_hash_lookup (coff_hash_table (info
),
1669 false, false, true);
1671 thunk_size
= myh
->root
.u
.def
.value
- idata5offset
;
1672 myh
= coff_link_hash_lookup (coff_hash_table (info
),
1674 false, false, true);
1675 import_table_size
= myh
->root
.u
.def
.value
;
1680 rstat
= _bfd_relocate_contents (howto
,
1683 pe_data(output_bfd
)->pe_opthdr
.ImageBase
,
1688 case IMAGE_REL_PPC_REL24
:
1689 DUMP_RELOC2(howto
->name
, rel
);
1690 val
-= (input_section
->output_section
->vma
1691 + input_section
->output_offset
);
1693 rstat
= _bfd_relocate_contents (howto
,
1698 case IMAGE_REL_PPC_ADDR16
:
1699 case IMAGE_REL_PPC_ADDR24
:
1700 case IMAGE_REL_PPC_ADDR32
:
1701 DUMP_RELOC2(howto
->name
, rel
);
1702 rstat
= _bfd_relocate_contents (howto
,
1709 if ( info
->base_file
)
1711 /* So if this is non pcrelative, and is referenced
1712 to a section or a common symbol, then it needs a reloc */
1713 if (sym
&& pe_data(output_bfd
)->in_reloc_p(output_bfd
, howto
))
1715 /* relocation to a symbol in a section which
1716 isn't absolute - we output the address here
1718 bfd_vma addr
= rel
->r_vaddr
1719 - input_section
->vma
1720 + input_section
->output_offset
1721 + input_section
->output_section
->vma
;
1723 if (coff_data(output_bfd
)->pe
)
1725 addr
-= pe_data(output_bfd
)->pe_opthdr
.ImageBase
;
1727 " adjusted down to %d", addr
);
1729 fprintf(stderr
, "\n");
1731 fwrite (&addr
, 1,4, (FILE *) info
->base_file
);
1741 case bfd_reloc_overflow
:
1744 char buf
[SYMNMLEN
+ 1];
1749 name
= h
->root
.root
.root
.string
;
1750 else if (sym
== NULL
)
1752 else if (sym
->_n
._n_n
._n_zeroes
== 0
1753 && sym
->_n
._n_n
._n_offset
!= 0)
1754 name
= obj_coff_strings (input_bfd
) + sym
->_n
._n_n
._n_offset
;
1757 strncpy (buf
, sym
->_n
._n_name
, SYMNMLEN
);
1758 buf
[SYMNMLEN
] = '\0';
1764 name
= _bfd_coff_internal_syment_name (input_bfd
, sym
, buf
);
1770 if (! ((*info
->callbacks
->reloc_overflow
)
1771 (info
, name
, howto
->name
,
1772 (bfd_vma
) 0, input_bfd
,
1773 input_section
, rel
->r_vaddr
- input_section
->vma
)))
1783 #ifdef COFF_IMAGE_WITH_PE
1785 long int global_toc_size
= 0;
1787 bfd
* bfd_of_toc_owner
= 0;
1789 long int import_table_size
;
1790 long int first_thunk_address
;
1791 long int thunk_size
;
1793 struct list_ele
*head
;
1794 struct list_ele
*tail
;
1797 h1
= "\n\t\t\tTOC MAPPING\n\n";
1799 h2
= " TOC disassembly Comments Name\n";
1801 h3
= " Offset spelling (if present)\n";
1814 for(t
= head
; t
!= 0; t
=t
->next
)
1820 else if (t
->cat
== pub
)
1822 else if (t
->cat
== data
)
1823 cat
= "data-in-toc ";
1825 if (t
->offset
> global_toc_size
)
1827 if (t
->offset
<= global_toc_size
+ thunk_size
)
1828 cat
= "IAT reference ";
1830 cat
= "Out of bounds!";
1834 " %04lx (%d)", t
->offset
, t
->offset
- 32768);
1841 fprintf(file
, "\n");
1845 ppc_allocate_toc_section (info
)
1846 struct bfd_link_info
*info
;
1850 static char test_char
= '1';
1852 if ( global_toc_size
== 0 ) /* FIXME: does this get me in trouble? */
1855 if (bfd_of_toc_owner
== 0)
1858 "There is no bfd that owns the toc section!\n");
1862 s
= bfd_get_section_by_name ( bfd_of_toc_owner
, TOC_SECTION_NAME
);
1865 fprintf(stderr
, "No Toc section!\n");
1869 foo
= bfd_alloc(bfd_of_toc_owner
, global_toc_size
);
1870 memset(foo
, test_char
, global_toc_size
);
1872 s
->_raw_size
= s
->_cooked_size
= global_toc_size
;
1879 ppc_process_before_allocation (abfd
, info
)
1881 struct bfd_link_info
*info
;
1884 struct internal_reloc
*i
, *rel
;
1888 "ppc_process_before_allocation: BFD %s\n",
1889 bfd_get_filename(abfd
));
1892 /* here we have a bfd that is to be included on the link. We have a hook
1893 to do reloc rummaging, before section sizes are nailed down. */
1895 _bfd_coff_get_external_symbols(abfd
);
1897 /* rummage around all the relocs and map the toc */
1898 sec
= abfd
->sections
;
1905 for (; sec
!= 0; sec
= sec
->next
)
1911 " section %s reloc count %d\n",
1916 if (sec
->reloc_count
== 0)
1919 /* load the relocs */
1920 /* FIXME: there may be a storage leak here */
1921 i
=_bfd_coff_read_internal_relocs(abfd
,sec
,1,0,0,0);
1926 for (rel
=i
;rel
<i
+sec
->reloc_count
;++rel
)
1928 unsigned short r_type
= EXTRACT_TYPE (rel
->r_type
);
1929 unsigned short r_flags
= EXTRACT_FLAGS(rel
->r_type
);
1930 unsigned short junk
= EXTRACT_JUNK (rel
->r_type
);
1933 /* now examine flags */
1936 fprintf (stderr
, "Reloc with flags found!");
1937 if ( r_flags
& IMAGE_REL_PPC_NEG
)
1938 fprintf (stderr
, " NEG");
1939 if ( r_flags
& IMAGE_REL_PPC_BRTAKEN
)
1940 fprintf (stderr
, " BRTAKEN");
1941 if ( r_flags
& IMAGE_REL_PPC_BRNTAKEN
)
1942 fprintf (stderr
, " BRNTAKEN");
1943 if ( r_flags
& IMAGE_REL_PPC_TOCDEFN
)
1944 fprintf (stderr
, " TOCDEFN");
1945 fprintf(stderr
, "\n");
1949 DUMP_RELOC2(ppc_coff_howto_table
[r_type
].name
, rel
);
1953 case IMAGE_REL_PPC_TOCREL16
:
1956 This remains unimplemented for now, as it currently adds
1957 un-necessary elements to the toc. All we need to do today
1958 is not do anything if TOCDEFN is on.
1960 if ( r_flags
& IMAGE_REL_PPC_TOCDEFN
)
1961 toc_offset
= ppc_record_data_in_toc_entry(abfd
, info
, sec
,
1965 toc_offset
= ppc_record_toc_entry(abfd
, info
, sec
,
1966 rel
->r_symndx
, default_toc
);
1968 if ( (r_flags
& IMAGE_REL_PPC_TOCDEFN
) != IMAGE_REL_PPC_TOCDEFN
)
1969 toc_offset
= ppc_record_toc_entry(abfd
, info
, sec
,
1970 rel
->r_symndx
, default_toc
);
1972 case IMAGE_REL_PPC_IMGLUE
:
1973 ppc_mark_symbol_as_glue(abfd
, rel
->r_symndx
, rel
);
1985 static bfd_reloc_status_type
1986 ppc_refhi_reloc (abfd
,
1994 arelent
*reloc_entry
;
1997 asection
*input_section
;
1999 char **error_message
;
2002 DUMP_RELOC("REFHI",reloc_entry
);
2004 if (output_bfd
== (bfd
*) NULL
)
2005 return bfd_reloc_continue
;
2007 return bfd_reloc_undefined
;
2010 static bfd_reloc_status_type
2011 ppc_reflo_reloc (abfd
,
2019 arelent
*reloc_entry
;
2022 asection
*input_section
;
2024 char **error_message
;
2027 DUMP_RELOC("REFLO",reloc_entry
);
2029 if (output_bfd
== (bfd
*) NULL
)
2030 return bfd_reloc_continue
;
2032 return bfd_reloc_undefined
;
2035 static bfd_reloc_status_type
2036 ppc_pair_reloc (abfd
,
2044 arelent
*reloc_entry
;
2047 asection
*input_section
;
2049 char **error_message
;
2052 DUMP_RELOC("PAIR",reloc_entry
);
2054 if (output_bfd
== (bfd
*) NULL
)
2055 return bfd_reloc_continue
;
2057 return bfd_reloc_undefined
;
2061 static bfd_reloc_status_type
2062 ppc_toc16_reloc (abfd
,
2070 arelent
*reloc_entry
;
2073 asection
*input_section
;
2075 char **error_message
;
2077 UN_IMPL("TOCREL16");
2078 DUMP_RELOC("TOCREL16",reloc_entry
);
2080 if (output_bfd
== (bfd
*) NULL
)
2082 return bfd_reloc_continue
;
2085 return bfd_reloc_ok
;
2088 /* ADDR32NB : 32 bit address relative to the virtual origin. */
2089 /* (On the alpha, this is always a linker generated thunk)*/
2090 /* (i.e. 32bit addr relative to the image base) */
2094 static bfd_reloc_status_type
2095 ppc_addr32nb_reloc (abfd
,
2103 arelent
*reloc_entry
;
2106 asection
*input_section
;
2108 char **error_message
;
2110 UN_IMPL("ADDR32NB");
2111 DUMP_RELOC("ADDR32NB",reloc_entry
);
2113 return bfd_reloc_ok
;
2116 static bfd_reloc_status_type
2117 ppc_secrel_reloc (abfd
,
2125 arelent
*reloc_entry
;
2128 asection
*input_section
;
2130 char **error_message
;
2133 DUMP_RELOC("SECREL",reloc_entry
);
2135 if (output_bfd
== (bfd
*) NULL
)
2136 return bfd_reloc_continue
;
2138 return bfd_reloc_ok
;
2141 static bfd_reloc_status_type
2142 ppc_section_reloc (abfd
,
2150 arelent
*reloc_entry
;
2153 asection
*input_section
;
2155 char **error_message
;
2158 DUMP_RELOC("SECTION",reloc_entry
);
2160 if (output_bfd
== (bfd
*) NULL
)
2161 return bfd_reloc_continue
;
2163 return bfd_reloc_ok
;
2166 static bfd_reloc_status_type
2167 ppc_imglue_reloc (abfd
,
2175 arelent
*reloc_entry
;
2178 asection
*input_section
;
2180 char **error_message
;
2183 DUMP_RELOC("IMGLUE",reloc_entry
);
2185 if (output_bfd
== (bfd
*) NULL
)
2186 return bfd_reloc_continue
;
2188 return bfd_reloc_ok
;
2193 #define MAX_RELOC_INDEX \
2194 (sizeof(ppc_coff_howto_table) / sizeof(ppc_coff_howto_table[0]) - 1)
2197 /* FIXME: There is a possiblity that when we read in a reloc from a file,
2198 that there are some bits encoded in the upper portion of the
2199 type field. Not yet implemented.
2201 static void ppc_coff_rtype2howto
PARAMS ((arelent
*relent
,
2202 struct internal_reloc
*internal
));
2205 ppc_coff_rtype2howto (relent
, internal
)
2207 struct internal_reloc
*internal
;
2210 /* We can encode one of three things in the type field, aside from the
2212 1. IMAGE_REL_PPC_NEG - indicates the value field is a subtraction
2213 value, rather than an addition value
2214 2. IMAGE_REL_PPC_BRTAKEN, IMAGE_REL_PPC_BRNTAKEN - indicates that
2215 the branch is expected to be taken or not.
2216 3. IMAGE_REL_PPC_TOCDEFN - toc slot definition in the file
2217 For now, we just strip this stuff to find the type, and ignore it other
2220 reloc_howto_type
*howto
;
2221 unsigned short r_type
= EXTRACT_TYPE (internal
->r_type
);
2222 unsigned short r_flags
= EXTRACT_FLAGS(internal
->r_type
);
2223 unsigned short junk
= EXTRACT_JUNK (internal
->r_type
);
2225 /* the masking process only slices off the bottom byte for r_type. */
2226 if ( r_type
> MAX_RELOC_INDEX
)
2229 "ppc_coff_rtype2howto: reloc index %d out of range [%d, %d]\n",
2230 internal
->r_type
, 0, MAX_RELOC_INDEX
);
2234 /* check for absolute crap */
2238 "ppc_coff_rtype2howto: reloc index %d contains junk %d\n",
2239 internal
->r_type
, junk
);
2244 /* now examine flags */
2247 fprintf (stderr
, "Reloc with flags found!");
2248 if ( r_flags
& IMAGE_REL_PPC_NEG
)
2249 fprintf (stderr
, " NEG");
2250 if ( r_flags
& IMAGE_REL_PPC_BRTAKEN
)
2251 fprintf (stderr
, " BRTAKEN");
2252 if ( r_flags
& IMAGE_REL_PPC_BRNTAKEN
)
2253 fprintf (stderr
, " BRNTAKEN");
2254 if ( r_flags
& IMAGE_REL_PPC_TOCDEFN
)
2255 fprintf (stderr
, " TOCDEFN");
2256 fprintf(stderr
, "\n");
2262 case IMAGE_REL_PPC_ADDR16
:
2263 case IMAGE_REL_PPC_REL24
:
2264 case IMAGE_REL_PPC_ADDR24
:
2265 case IMAGE_REL_PPC_ADDR32
:
2266 case IMAGE_REL_PPC_IFGLUE
:
2267 case IMAGE_REL_PPC_ADDR32NB
:
2268 case IMAGE_REL_PPC_SECTION
:
2269 case IMAGE_REL_PPC_SECREL
:
2270 DUMP_RELOC2(ppc_coff_howto_table
[r_type
].name
, internal
);
2271 howto
= ppc_coff_howto_table
+ r_type
;
2273 case IMAGE_REL_PPC_IMGLUE
:
2274 DUMP_RELOC2(ppc_coff_howto_table
[r_type
].name
, internal
);
2275 howto
= ppc_coff_howto_table
+ r_type
;
2277 case IMAGE_REL_PPC_TOCREL16
:
2278 DUMP_RELOC2(ppc_coff_howto_table
[r_type
].name
, internal
);
2279 if (r_flags
& IMAGE_REL_PPC_TOCDEFN
)
2280 howto
= ppc_coff_howto_table
+ IMAGE_REL_PPC_TOCREL16_DEFN
;
2282 howto
= ppc_coff_howto_table
+ IMAGE_REL_PPC_TOCREL16
;
2286 "Warning: Unsupported reloc %s [%d] used -- it may not work.\n",
2287 ppc_coff_howto_table
[r_type
].name
,
2289 howto
= ppc_coff_howto_table
+ r_type
;
2293 relent
->howto
= howto
;
2297 static reloc_howto_type
*
2298 coff_ppc_rtype_to_howto (abfd
, sec
, rel
, h
, sym
, addendp
)
2301 struct internal_reloc
*rel
;
2302 struct coff_link_hash_entry
*h
;
2303 struct internal_syment
*sym
;
2306 reloc_howto_type
*howto
;
2308 /* We can encode one of three things in the type field, aside from the
2310 1. IMAGE_REL_PPC_NEG - indicates the value field is a subtraction
2311 value, rather than an addition value
2312 2. IMAGE_REL_PPC_BRTAKEN, IMAGE_REL_PPC_BRNTAKEN - indicates that
2313 the branch is expected to be taken or not.
2314 3. IMAGE_REL_PPC_TOCDEFN - toc slot definition in the file
2315 For now, we just strip this stuff to find the type, and ignore it other
2319 unsigned short r_type
= EXTRACT_TYPE (rel
->r_type
);
2320 unsigned short r_flags
= EXTRACT_FLAGS(rel
->r_type
);
2321 unsigned short junk
= EXTRACT_JUNK (rel
->r_type
);
2323 /* the masking process only slices off the bottom byte for r_type. */
2324 if ( r_type
> MAX_RELOC_INDEX
)
2327 "coff_ppc_rtype_to_howto: index %d out of range [%d, %d]\n",
2328 r_type
, 0, MAX_RELOC_INDEX
);
2332 /* check for absolute crap */
2336 "coff_ppc_rtype_to_howto: reloc index %d contains junk %d\n",
2342 /* now examine flags */
2345 fprintf (stderr
, "Reloc with flags found!");
2346 if ( r_flags
& IMAGE_REL_PPC_NEG
)
2347 fprintf (stderr
, " NEG");
2348 if ( r_flags
& IMAGE_REL_PPC_BRTAKEN
)
2349 fprintf (stderr
, " BRTAKEN");
2350 if ( r_flags
& IMAGE_REL_PPC_BRNTAKEN
)
2351 fprintf (stderr
, " BRNTAKEN");
2352 if ( r_flags
& IMAGE_REL_PPC_TOCDEFN
)
2353 fprintf (stderr
, " TOCDEFN");
2354 fprintf(stderr
, "\n");
2360 case IMAGE_REL_PPC_ADDR32NB
:
2361 DUMP_RELOC2(ppc_coff_howto_table
[r_type
].name
, rel
);
2362 *addendp
-= pe_data(sec
->output_section
->owner
)->pe_opthdr
.ImageBase
;
2363 howto
= ppc_coff_howto_table
+ r_type
;
2365 case IMAGE_REL_PPC_TOCREL16
:
2366 DUMP_RELOC2(ppc_coff_howto_table
[r_type
].name
, rel
);
2367 if (r_flags
& IMAGE_REL_PPC_TOCDEFN
)
2368 howto
= ppc_coff_howto_table
+ IMAGE_REL_PPC_TOCREL16_DEFN
;
2370 howto
= ppc_coff_howto_table
+ IMAGE_REL_PPC_TOCREL16
;
2372 case IMAGE_REL_PPC_ADDR16
:
2373 case IMAGE_REL_PPC_REL24
:
2374 case IMAGE_REL_PPC_ADDR24
:
2375 case IMAGE_REL_PPC_ADDR32
:
2376 case IMAGE_REL_PPC_IFGLUE
:
2377 case IMAGE_REL_PPC_SECTION
:
2378 case IMAGE_REL_PPC_SECREL
:
2379 DUMP_RELOC2(ppc_coff_howto_table
[r_type
].name
, rel
);
2380 howto
= ppc_coff_howto_table
+ r_type
;
2382 case IMAGE_REL_PPC_IMGLUE
:
2383 DUMP_RELOC2(ppc_coff_howto_table
[r_type
].name
, rel
);
2384 howto
= ppc_coff_howto_table
+ r_type
;
2388 "Warning: Unsupported reloc %s [%d] used -- it may not work.\n",
2389 ppc_coff_howto_table
[r_type
].name
,
2391 howto
= ppc_coff_howto_table
+ r_type
;
2399 /* a cheesy little macro to make the code a little more readable */
2400 #define HOW2MAP(bfd_rtype,ppc_rtype) \
2401 case bfd_rtype: return &ppc_coff_howto_table[ppc_rtype]
2403 static reloc_howto_type
*ppc_coff_reloc_type_lookup
2404 PARAMS ((bfd
*, bfd_reloc_code_real_type
));
2406 static reloc_howto_type
*
2407 ppc_coff_reloc_type_lookup (abfd
, code
)
2409 bfd_reloc_code_real_type code
;
2413 fprintf(stderr
, "ppc_coff_reloc_type_lookup for %s\n",
2414 bfd_get_reloc_code_name(code
));
2419 HOW2MAP(BFD_RELOC_32_GOTOFF
, IMAGE_REL_PPC_IMGLUE
);
2420 HOW2MAP(BFD_RELOC_16_GOT_PCREL
, IMAGE_REL_PPC_IFGLUE
);
2421 HOW2MAP(BFD_RELOC_16
, IMAGE_REL_PPC_ADDR16
);
2422 HOW2MAP(BFD_RELOC_PPC_B26
, IMAGE_REL_PPC_REL24
);
2423 HOW2MAP(BFD_RELOC_PPC_BA26
, IMAGE_REL_PPC_ADDR24
);
2424 HOW2MAP(BFD_RELOC_PPC_TOC16
, IMAGE_REL_PPC_TOCREL16
);
2425 HOW2MAP(BFD_RELOC_16_GOTOFF
, IMAGE_REL_PPC_TOCREL16_DEFN
);
2426 HOW2MAP(BFD_RELOC_32
, IMAGE_REL_PPC_ADDR32
);
2427 HOW2MAP(BFD_RELOC_RVA
, IMAGE_REL_PPC_ADDR32NB
);
2438 /* Tailor coffcode.h -- macro heaven. */
2440 #define RTYPE2HOWTO(cache_ptr, dst) ppc_coff_rtype2howto (cache_ptr, dst)
2442 #ifndef COFF_IMAGE_WITH_PE
2444 ppc_coff_swap_sym_in_hook ();
2447 /* We use the special COFF backend linker, with our own special touch. */
2449 #define coff_bfd_reloc_type_lookup ppc_coff_reloc_type_lookup
2450 #define coff_rtype_to_howto coff_ppc_rtype_to_howto
2451 #define coff_relocate_section coff_ppc_relocate_section
2453 #ifndef COFF_IMAGE_WITH_PE
2454 #define coff_swap_sym_in_hook ppc_coff_swap_sym_in_hook
2457 #define SELECT_RELOC(internal, howto) {internal.r_type=howto->type;}
2459 #define COFF_PAGE_SIZE 0x1000
2461 #define POWERPC_LE_PE
2463 #include "coffcode.h"
2467 #ifndef COFF_IMAGE_WITH_PE
2469 What we're trying to do here is allocate a toc section (early), and attach
2470 it to the last bfd to be processed. This avoids the problem of having a toc
2471 written out before all files have been processed. This code allocates
2472 a toc section for every file, and records the last one seen. There are
2473 at least two problems with this approach:
2474 1. We allocate whole bunches of toc sections that are ignored, but at
2475 at least we will not allocate a toc if no .toc is present.
2476 2. It's not clear to me that being the last bfd read necessarily means
2477 that you are the last bfd closed.
2478 3. Doing it on a "swap in" hook depends on when the "swap in" is called,
2479 and how often, etc. It's not clear to me that there isn't a hole here.
2483 ppc_coff_swap_sym_in_hook (abfd
, ext1
, in1
)
2488 SYMENT
*ext
= (SYMENT
*)ext1
;
2489 struct internal_syment
*in
= (struct internal_syment
*)in1
;
2492 if (bfd_of_toc_owner
!= 0) /* we already have a toc, so go home */
2496 if (strcmp(in
->_n
._n_name
, ".toc") == 0)
2499 register asection
*s
;
2502 s
= bfd_get_section_by_name ( abfd
, TOC_SECTION_NAME
);
2508 flags
= SEC_ALLOC
| SEC_LOAD
| SEC_HAS_CONTENTS
| SEC_IN_MEMORY
;
2512 "ppc_coff_swap_sym_in_hook: about to create the %s section\n",
2516 s
= bfd_make_section (abfd
, TOC_SECTION_NAME
);
2519 || !bfd_set_section_flags (abfd
, s
, flags
)
2520 || !bfd_set_section_alignment (abfd
, s
, 2))
2523 "toc section allocation failed!\n");
2527 /* save the bfd for later allocation */
2528 bfd_of_toc_owner
= abfd
;
2537 /* The transfer vectors that lead the outside world to all of the above. */
2539 #ifdef TARGET_LITTLE_SYM
2543 TARGET_LITTLE_NAME
, /* name or coff-arm-little */
2544 bfd_target_coff_flavour
,
2545 false, /* data byte order is little */
2546 false, /* header byte order is little */
2548 (HAS_RELOC
| EXEC_P
| /* FIXME: object flags */
2549 HAS_LINENO
| HAS_DEBUG
|
2550 HAS_SYMS
| HAS_LOCALS
| WP_TEXT
),
2552 (SEC_HAS_CONTENTS
| SEC_ALLOC
| SEC_LOAD
| SEC_RELOC
), /* section flags */
2553 0, /* leading char */
2554 '/', /* ar_pad_char */
2555 15, /* ar_max_namelen??? FIXMEmgo */
2557 bfd_getl64
, bfd_getl_signed_64
, bfd_putl64
,
2558 bfd_getl32
, bfd_getl_signed_32
, bfd_putl32
,
2559 bfd_getl16
, bfd_getl_signed_16
, bfd_putl16
, /* data */
2561 bfd_getl64
, bfd_getl_signed_64
, bfd_putl64
,
2562 bfd_getl32
, bfd_getl_signed_32
, bfd_putl32
,
2563 bfd_getl16
, bfd_getl_signed_16
, bfd_putl16
, /* hdrs */
2565 {_bfd_dummy_target
, coff_object_p
, /* bfd_check_format */
2566 bfd_generic_archive_p
, /* _bfd_dummy_target */ coff_object_p
},
2567 {bfd_false
, coff_mkobject
, _bfd_generic_mkarchive
, /* bfd_set_format */
2569 {bfd_false
, coff_write_object_contents
, /* bfd_write_contents */
2570 _bfd_write_archive_contents
, bfd_false
},
2572 BFD_JUMP_TABLE_GENERIC (coff
),
2573 BFD_JUMP_TABLE_COPY (coff
),
2574 BFD_JUMP_TABLE_CORE (_bfd_nocore
),
2575 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff
),
2576 BFD_JUMP_TABLE_SYMBOLS (coff
),
2577 BFD_JUMP_TABLE_RELOCS (coff
),
2578 BFD_JUMP_TABLE_WRITE (coff
),
2579 BFD_JUMP_TABLE_LINK (coff
),
2580 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic
),
2586 #ifdef TARGET_BIG_SYM
2591 bfd_target_coff_flavour
,
2592 true, /* data byte order is big */
2593 true, /* header byte order is big */
2595 (HAS_RELOC
| EXEC_P
| /* FIXME: object flags */
2596 HAS_LINENO
| HAS_DEBUG
|
2597 HAS_SYMS
| HAS_LOCALS
| WP_TEXT
),
2599 (SEC_HAS_CONTENTS
| SEC_ALLOC
| SEC_LOAD
| SEC_RELOC
), /* section flags */
2600 0, /* leading char */
2601 '/', /* ar_pad_char */
2602 15, /* ar_max_namelen??? FIXMEmgo */
2604 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
2605 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
2606 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* data */
2608 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
2609 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
2610 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* hdrs */
2612 {_bfd_dummy_target
, coff_object_p
, /* bfd_check_format */
2613 bfd_generic_archive_p
, /* _bfd_dummy_target */ coff_object_p
},
2614 {bfd_false
, coff_mkobject
, _bfd_generic_mkarchive
, /* bfd_set_format */
2616 {bfd_false
, coff_write_object_contents
, /* bfd_write_contents */
2617 _bfd_write_archive_contents
, bfd_false
},
2619 BFD_JUMP_TABLE_GENERIC (coff
),
2620 BFD_JUMP_TABLE_COPY (coff
),
2621 BFD_JUMP_TABLE_CORE (_bfd_nocore
),
2622 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff
),
2623 BFD_JUMP_TABLE_SYMBOLS (coff
),
2624 BFD_JUMP_TABLE_RELOCS (coff
),
2625 BFD_JUMP_TABLE_WRITE (coff
),
2626 BFD_JUMP_TABLE_LINK (coff
),
2627 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic
),