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
= bfd_malloc (sizeof (struct list_ele
));
831 t
->offset
= our_toc_offset
;
834 t
->addr
= toc_section
->output_offset
+ our_toc_offset
;
848 /* record a toc offset against a symbol */
850 ppc_record_toc_entry(abfd
, info
, sec
, sym
, toc_kind
)
852 struct bfd_link_info
*info
;
855 enum toc_type toc_kind
;
858 bfd_byte
*old_contents
;
863 struct ppc_coff_link_hash_entry
*h
;
864 struct coff_symbol_struct
*target
;
872 h
= (struct ppc_coff_link_hash_entry
*) (obj_coff_sym_hashes (abfd
)[sym
]);
875 CHECK_EYE(h
->eye_catcher
);
880 local_syms
= obj_coff_local_toc_table(abfd
);
884 /* allocate a table */
886 (int *) bfd_zalloc (abfd
,
887 obj_raw_syment_count(abfd
) * sizeof(int));
890 obj_coff_local_toc_table(abfd
) = local_syms
;
891 for (i
= 0; i
< obj_raw_syment_count(abfd
); ++i
)
893 SET_UNALLOCATED(local_syms
[i
]);
897 if (IS_UNALLOCATED(local_syms
[sym
]))
899 local_syms
[sym
] = global_toc_size
;
900 ret_val
= global_toc_size
;
901 global_toc_size
+= 4;
903 /* The size must fit in a 16bit displacment */
904 if (global_toc_size
>= 65535)
907 "Exceeded toc size of 65535\n");
913 "Setting toc_offset for local sym %d to %d\n",
919 ret_val
= local_syms
[sym
];
922 "toc_offset already set for local sym %d to %d\n",
929 name
= h
->root
.root
.root
.string
;
931 /* check to see if there's a toc slot allocated. If not, do it
932 here. It will be used in relocate_section */
933 if (IS_UNALLOCATED(h
->toc_offset
))
935 h
->toc_offset
= global_toc_size
;
936 ret_val
= global_toc_size
;
937 global_toc_size
+= 4;
939 /* The size must fit in a 16bit displacment */
940 if (global_toc_size
>= 65535)
943 "Exceeded toc size of 65535\n");
949 "Setting toc_offset for sym %d (%s) [h=%p] to %d\n",
950 sym
, name
, h
, ret_val
);
955 ret_val
= h
->toc_offset
;
958 "toc_offset already set for sym %d (%s) [h=%p] to %d\n",
959 sym
, name
, h
, ret_val
);
966 /* FIXME: record a toc offset against a data-in-toc symbol */
967 /* Now, there is currenly some confusion on what this means. In some
968 compilers one sees the moral equivalent of:
972 refer to the data with a [tocv] qualifier
973 In general, one sees something to indicate that a tocd has been
974 seen, and that would trigger the allocation of data in toc. The IBM
975 docs seem to suggest that anything with the TOCDEFN qualifier should
976 never trigger storage allocation. However, in the kernel32.lib that
977 we've been using for our test bed, there are a couple of variables
978 referenced that fail that test.
980 So it can't work that way.
983 ppc_record_data_in_toc_entry(abfd
, info
, sec
, sym
, toc_kind
)
985 struct bfd_link_info
*info
;
988 enum toc_type toc_kind
;
991 bfd_byte
*old_contents
;
996 struct ppc_coff_link_hash_entry
*h
= 0;
997 struct coff_symbol_struct
*target
;
1003 h
= (struct ppc_coff_link_hash_entry
*) (obj_coff_sym_hashes (abfd
)[sym
]);
1007 local_syms
= obj_coff_local_toc_table(abfd
);
1008 if (local_syms
== 0)
1011 /* allocate a table */
1013 (int *) bfd_zalloc (abfd
,
1014 obj_raw_syment_count(abfd
) * sizeof(int));
1015 if (local_syms
== 0)
1017 obj_coff_local_toc_table(abfd
) = local_syms
;
1018 for (i
= 0; i
< obj_raw_syment_count(abfd
); ++i
)
1020 SET_UNALLOCATED(local_syms
[i
]);
1024 if (IS_UNALLOCATED(local_syms
[sym
]))
1026 local_syms
[sym
] = global_toc_size
;
1027 ret_val
= global_toc_size
;
1028 global_toc_size
+= 4;
1031 "Setting data_in_toc_offset for local sym %d to %d\n",
1037 ret_val
= local_syms
[sym
];
1040 "data_in_toc_offset already set for local sym %d to %d\n",
1047 CHECK_EYE(h
->eye_catcher
);
1049 name
= h
->root
.root
.root
.string
;
1051 /* check to see if there's a toc slot allocated. If not, do it
1052 here. It will be used in relocate_section */
1053 if (IS_UNALLOCATED(h
->toc_offset
))
1056 h
->toc_offset
= global_toc_size
;
1058 ret_val
= global_toc_size
;
1059 /* We're allocating a chunk of the toc, as opposed to a slot */
1060 /* FIXME: alignment? */
1062 global_toc_size
+= 4;
1065 "Setting data_in_toc_offset for sym %d (%s) [h=%p] to %d\n",
1066 sym
, name
, h
, ret_val
);
1071 ret_val
= h
->toc_offset
;
1074 "data_in_toc_offset already set for sym %d (%s) [h=%p] to %d\n",
1075 sym
, name
, h
, ret_val
);
1083 /* record a toc offset against a symbol */
1085 ppc_mark_symbol_as_glue(abfd
, sym
, rel
)
1088 struct internal_reloc
*rel
;
1090 struct ppc_coff_link_hash_entry
*h
;
1092 h
= (struct ppc_coff_link_hash_entry
*) (obj_coff_sym_hashes (abfd
)[sym
]);
1094 CHECK_EYE(h
->eye_catcher
);
1096 h
->symbol_is_glue
= 1;
1097 h
->glue_insn
= bfd_get_32 (abfd
, (bfd_byte
*) &rel
->r_vaddr
);
1103 /* Provided the symbol, returns the value reffed */
1104 static long get_symbol_value
PARAMS ((asymbol
*));
1107 get_symbol_value (symbol
)
1110 long relocation
= 0;
1112 if (bfd_is_com_section (symbol
->section
))
1118 relocation
= symbol
->value
+
1119 symbol
->section
->output_section
->vma
+
1120 symbol
->section
->output_offset
;
1126 /* Return true if this relocation should
1127 appear in the output .reloc section. */
1129 static boolean
in_reloc_p(abfd
, howto
)
1131 reloc_howto_type
*howto
;
1134 (! howto
->pc_relative
)
1135 && (howto
->type
!= IMAGE_REL_PPC_TOCREL16
)
1136 && (howto
->type
!= IMAGE_REL_PPC_IMGLUE
);
1139 /* this function is in charge of performing all the ppc PE relocations */
1140 /* Don't yet know if we want to do this this particular way ... (krk) */
1141 /* FIXME: (it is not yet enabled) */
1143 static bfd_reloc_status_type
1144 pe_ppc_reloc (abfd
, reloc_entry
, symbol_in
, data
, input_section
, output_bfd
,
1147 arelent
*reloc_entry
;
1150 asection
*input_section
;
1152 char **error_message
;
1154 /* the consth relocation comes in two parts, we have to remember
1155 the state between calls, in these variables */
1156 static boolean part1_consth_active
= false;
1157 static unsigned long part1_consth_value
;
1160 unsigned long sym_value
;
1161 unsigned long unsigned_value
;
1162 unsigned short r_type
;
1165 unsigned long addr
= reloc_entry
->address
; /*+ input_section->vma*/
1166 bfd_byte
*hit_data
=addr
+ (bfd_byte
*)(data
);
1168 fprintf(stderr
, "pe_ppc_reloc (%s)\n", TARGET_LITTLE_NAME
);
1170 r_type
= reloc_entry
->howto
->type
;
1174 /* Partial linking - do nothing */
1175 reloc_entry
->address
+= input_section
->output_offset
;
1176 return bfd_reloc_ok
;
1179 if (symbol_in
!= NULL
1180 && bfd_is_und_section (symbol_in
->section
))
1182 /* Keep the state machine happy in case we're called again */
1183 if (r_type
== IMAGE_REL_PPC_REFHI
)
1185 part1_consth_active
= true;
1186 part1_consth_value
= 0;
1188 return(bfd_reloc_undefined
);
1191 if ((part1_consth_active
) && (r_type
!= IMAGE_REL_PPC_PAIR
))
1193 part1_consth_active
= false;
1194 *error_message
= (char *) "Missing PAIR";
1195 return(bfd_reloc_dangerous
);
1199 sym_value
= get_symbol_value(symbol_in
);
1201 return(bfd_reloc_ok
);
1204 /* The reloc processing routine for the optimized COFF linker. */
1207 coff_ppc_relocate_section (output_bfd
, info
, input_bfd
, input_section
,
1208 contents
, relocs
, syms
, sections
)
1210 struct bfd_link_info
*info
;
1212 asection
*input_section
;
1214 struct internal_reloc
*relocs
;
1215 struct internal_syment
*syms
;
1216 asection
**sections
;
1218 struct internal_reloc
*rel
;
1219 struct internal_reloc
*relend
;
1222 asection
*toc_section
= 0;
1224 reloc_howto_type
*howto
= 0;
1228 "pe_ppc_relocate_section (%s) for %s \n",
1230 input_section
->name
);
1234 /* If we are performing a relocateable link, we don't need to do a
1235 thing. The caller will take care of adjusting the reloc
1236 addresses and symbol indices. */
1237 if (info
->relocateable
)
1244 relend
= rel
+ input_section
->reloc_count
;
1245 for (; rel
< relend
; rel
++)
1248 struct ppc_coff_link_hash_entry
*h
;
1249 struct internal_syment
*sym
;
1253 bfd_reloc_status_type rstat
;
1256 unsigned short r_type
= EXTRACT_TYPE (rel
->r_type
);
1257 unsigned short r_flags
= EXTRACT_FLAGS(rel
->r_type
);
1258 unsigned short junk
= EXTRACT_JUNK (rel
->r_type
);
1261 /* now examine flags */
1264 fprintf (stderr
, "Reloc with flags found!");
1265 if ( r_flags
& IMAGE_REL_PPC_NEG
)
1266 fprintf (stderr
, " NEG");
1267 if ( r_flags
& IMAGE_REL_PPC_BRTAKEN
)
1268 fprintf (stderr
, " BRTAKEN");
1269 if ( r_flags
& IMAGE_REL_PPC_BRNTAKEN
)
1270 fprintf (stderr
, " BRNTAKEN");
1271 if ( r_flags
& IMAGE_REL_PPC_TOCDEFN
)
1272 fprintf (stderr
, " TOCDEFN");
1273 fprintf(stderr
, "\n");
1277 symndx
= rel
->r_symndx
;
1278 loc
= contents
+ rel
->r_vaddr
- input_section
->vma
;
1280 /* FIXME: check bounds on r_type */
1281 howto
= ppc_coff_howto_table
+ r_type
;
1290 h
= (struct ppc_coff_link_hash_entry
*)
1291 (obj_coff_sym_hashes (input_bfd
)[symndx
]);
1294 CHECK_EYE(h
->eye_catcher
);
1297 sym
= syms
+ symndx
;
1303 /* FIXME: PAIR unsupported in the following code */
1307 sec
= bfd_abs_section_ptr
;
1310 sec
= sections
[symndx
];
1311 val
= (sec
->output_section
->vma
1312 + sec
->output_offset
1319 CHECK_EYE(h
->eye_catcher
);
1321 if (h
->root
.root
.type
== bfd_link_hash_defined
1322 || h
->root
.root
.type
== bfd_link_hash_defweak
)
1324 sec
= h
->root
.root
.u
.def
.section
;
1325 val
= (h
->root
.root
.u
.def
.value
1326 + sec
->output_section
->vma
1327 + sec
->output_offset
);
1331 if (! ((*info
->callbacks
->undefined_symbol
)
1332 (info
, h
->root
.root
.root
.string
, input_bfd
, input_section
,
1333 rel
->r_vaddr
- input_section
->vma
)))
1338 rstat
= bfd_reloc_ok
;
1340 /* Each case must do its own relocation, setting rstat appropriately */
1345 "ERROR: during reloc processing -- unsupported reloc %s\n",
1347 bfd_set_error (bfd_error_bad_value
);
1350 case IMAGE_REL_PPC_TOCREL16
:
1352 bfd_vma our_toc_offset
;
1355 DUMP_RELOC2(howto
->name
, rel
);
1357 if (toc_section
== 0)
1359 toc_section
= bfd_get_section_by_name (bfd_of_toc_owner
,
1364 "BFD of toc owner %p, section addr of %s %p\n",
1365 bfd_of_toc_owner
, TOC_SECTION_NAME
, toc_section
);
1368 if ( toc_section
== NULL
)
1370 fprintf(stderr
, "No Toc section!\n");
1376 * Amazing bit tricks present. As we may have seen earlier, we
1377 * use the 1 bit to tell us whether or not a toc offset has been
1378 * allocated. Now that they've all been allocated, we will use
1379 * the 1 bit to tell us if we've written this particular toc
1384 { /* it is a file local symbol */
1385 int *local_toc_table
;
1388 sym
= syms
+ symndx
;
1389 name
= sym
->_n
._n_name
;
1391 local_toc_table
= obj_coff_local_toc_table(input_bfd
);
1392 our_toc_offset
= local_toc_table
[symndx
];
1394 if (IS_WRITTEN(our_toc_offset
))
1396 /* if it has been written out, it is marked with the
1397 1 bit. Fix up our offset, but do not write it out
1400 MAKE_ADDR_AGAIN(our_toc_offset
);
1404 "Not writing out toc_offset of %d for %s\n",
1405 our_toc_offset
, name
);
1410 /* write out the toc entry */
1411 record_toc(toc_section
, our_toc_offset
, priv
, strdup(name
));
1414 "Writing out toc_offset "
1415 "toc_section (%p,%p)+%d val %d for %s\n",
1417 toc_section
->contents
,
1423 bfd_put_32(output_bfd
,
1425 toc_section
->contents
+ our_toc_offset
);
1427 MARK_AS_WRITTEN(local_toc_table
[symndx
]);
1433 const char *name
= h
->root
.root
.root
.string
;
1434 our_toc_offset
= h
->toc_offset
;
1436 if ((r_flags
& IMAGE_REL_PPC_TOCDEFN
)
1437 == IMAGE_REL_PPC_TOCDEFN
1438 && IS_UNALLOCATED(our_toc_offset
))
1440 /* This is unbelievable cheese. Some knowledgable asm
1441 hacker has decided to use r2 as a base for loading
1442 a value. He/She does this by setting the tocdefn bit,
1443 and not supplying a toc definition. The behaviour is
1444 then to use the difference between the value of the
1445 symbol and the actual location of the toc as the toc
1448 In fact, what is usually happening is, because the
1449 Import Address Table is mapped immediately following
1450 the toc, some trippy library code trying for speed on
1451 dll linkage, takes advantage of that and considers
1452 the IAT to be part of the toc, thus saving a load.
1454 our_toc_offset
= val
-
1455 (toc_section
->output_section
->vma
+
1456 toc_section
->output_offset
);
1458 /* The size must still fit in a 16bit displacment */
1459 if (our_toc_offset
>= 65535)
1462 "TOCDEFN Relocation exceeded "
1463 "displacment of 65535\n");
1467 record_toc(toc_section
, our_toc_offset
, pub
, strdup(name
));
1469 else if (IS_WRITTEN(our_toc_offset
))
1471 /* if it has been written out, it is marked with the
1472 1 bit. Fix up our offset, but do not write it out
1475 MAKE_ADDR_AGAIN(our_toc_offset
);
1478 "Not writing out toc_offset of %d for %s\n",
1479 our_toc_offset
, name
);
1484 record_toc(toc_section
, our_toc_offset
, pub
, strdup(name
));
1487 /* write out the toc entry */
1489 "Writing out toc_offset "
1490 "toc_section (%p,%p)+%d val %d for %s\n",
1492 toc_section
->contents
,
1498 /* write out the toc entry */
1499 bfd_put_32(output_bfd
,
1501 toc_section
->contents
+ our_toc_offset
);
1503 MARK_AS_WRITTEN(h
->toc_offset
);
1504 /* The tricky part is that this is the address that */
1505 /* needs a .reloc entry for it */
1510 if (fixit
&& info
->base_file
)
1512 /* So if this is non pcrelative, and is referenced
1513 to a section or a common symbol, then it needs a reloc */
1515 /* relocation to a symbol in a section which
1516 isn't absolute - we output the address here
1519 bfd_vma addr
= toc_section
->output_section
->vma
1520 + toc_section
->output_offset
+ our_toc_offset
;
1523 " Toc Section reloc candidate\n");
1525 if (coff_data(output_bfd
)->pe
)
1526 addr
-= pe_data(output_bfd
)->pe_opthdr
.ImageBase
;
1527 fwrite (&addr
, 1,4, (FILE *) info
->base_file
);
1531 /* FIXME: this test is conservative */
1532 if ( (r_flags
& IMAGE_REL_PPC_TOCDEFN
) != IMAGE_REL_PPC_TOCDEFN
&&
1533 our_toc_offset
> toc_section
->_raw_size
)
1536 "reloc offset is bigger than the toc size!\n");
1540 /* Now we know the relocation for this toc reference */
1541 relocation
= our_toc_offset
+ TOC_LOAD_ADJUSTMENT
;
1542 rstat
= _bfd_relocate_contents (howto
,
1548 case IMAGE_REL_PPC_IFGLUE
:
1550 /* To solve this, we need to know whether or not the symbol */
1551 /* appearing on the call instruction is a glue function or not. */
1552 /* A glue function must announce itself via a IMGLUE reloc, and */
1553 /* the reloc contains the required toc restore instruction */
1556 const char *my_name
;
1557 DUMP_RELOC2(howto
->name
, rel
);
1561 my_name
= h
->root
.root
.root
.string
;
1562 if (h
->symbol_is_glue
== 1)
1564 x
= bfd_get_32(input_bfd
, loc
);
1565 bfd_put_32(input_bfd
, h
->glue_insn
, loc
);
1570 case IMAGE_REL_PPC_SECREL
:
1571 /* Unimplemented: codeview debugging information */
1572 /* For fast access to the header of the section
1573 containing the item. */
1575 case IMAGE_REL_PPC_SECTION
:
1576 /* Unimplemented: codeview debugging information */
1577 /* Is used to indicate that the value should be relative
1578 to the beginning of the section that contains the
1581 case IMAGE_REL_PPC_ABSOLUTE
:
1583 const char *my_name
;
1585 my_name
= (syms
+symndx
)->_n
._n_name
;
1588 my_name
= h
->root
.root
.root
.string
;
1592 "Warning: unsupported reloc %s <file %s, section %s>\n",
1594 bfd_get_filename(input_bfd
),
1595 input_section
->name
);
1597 fprintf(stderr
,"sym %d (%s), r_vaddr %d (%x)\n",
1598 rel
->r_symndx
, my_name
, rel
->r_vaddr
, rel
->r_vaddr
);
1601 case IMAGE_REL_PPC_IMGLUE
:
1603 /* There is nothing to do now. This reloc was noted in the first
1604 pass over the relocs, and the glue instruction extracted */
1605 const char *my_name
;
1606 if (h
->symbol_is_glue
== 1)
1608 my_name
= h
->root
.root
.root
.string
;
1610 "Warning: previously missed IMGLUE reloc %s <file %s, section %s>\n",
1612 bfd_get_filename(input_bfd
),
1613 input_section
->name
);
1619 case IMAGE_REL_PPC_ADDR32NB
:
1621 struct coff_link_hash_entry
*myh
= 0;
1622 const char *name
= 0;
1623 DUMP_RELOC2(howto
->name
, rel
);
1625 { /* it is a file local symbol */
1626 sym
= syms
+ symndx
;
1627 name
= sym
->_n
._n_name
;
1633 name
= h
->root
.root
.root
.string
;
1634 if (strcmp(".idata$2", name
) == 0)
1635 target
= "__idata2_magic__";
1636 else if (strcmp(".idata$4", name
) == 0)
1637 target
= "__idata4_magic__";
1638 else if (strcmp(".idata$5", name
) == 0)
1639 target
= "__idata5_magic__";
1645 myh
= coff_link_hash_lookup (coff_hash_table (info
),
1647 false, false, true);
1650 fprintf(stderr
, "Missing idata magic cookies, "
1651 "this cannot work anyway...\n");
1655 val
= myh
->root
.u
.def
.value
+
1656 sec
->output_section
->vma
+ sec
->output_offset
;
1657 if (first_thunk_address
== 0)
1660 myh
= coff_link_hash_lookup (coff_hash_table (info
),
1662 false, false, true);
1663 first_thunk_address
= myh
->root
.u
.def
.value
+
1664 sec
->output_section
->vma
+
1665 sec
->output_offset
-
1666 pe_data(output_bfd
)->pe_opthdr
.ImageBase
;
1668 idata5offset
= myh
->root
.u
.def
.value
;
1669 myh
= coff_link_hash_lookup (coff_hash_table (info
),
1671 false, false, true);
1673 thunk_size
= myh
->root
.u
.def
.value
- idata5offset
;
1674 myh
= coff_link_hash_lookup (coff_hash_table (info
),
1676 false, false, true);
1677 import_table_size
= myh
->root
.u
.def
.value
;
1682 rstat
= _bfd_relocate_contents (howto
,
1685 pe_data(output_bfd
)->pe_opthdr
.ImageBase
,
1690 case IMAGE_REL_PPC_REL24
:
1691 DUMP_RELOC2(howto
->name
, rel
);
1692 val
-= (input_section
->output_section
->vma
1693 + input_section
->output_offset
);
1695 rstat
= _bfd_relocate_contents (howto
,
1700 case IMAGE_REL_PPC_ADDR16
:
1701 case IMAGE_REL_PPC_ADDR24
:
1702 case IMAGE_REL_PPC_ADDR32
:
1703 DUMP_RELOC2(howto
->name
, rel
);
1704 rstat
= _bfd_relocate_contents (howto
,
1711 if ( info
->base_file
)
1713 /* So if this is non pcrelative, and is referenced
1714 to a section or a common symbol, then it needs a reloc */
1715 if (sym
&& pe_data(output_bfd
)->in_reloc_p(output_bfd
, howto
))
1717 /* relocation to a symbol in a section which
1718 isn't absolute - we output the address here
1720 bfd_vma addr
= rel
->r_vaddr
1721 - input_section
->vma
1722 + input_section
->output_offset
1723 + input_section
->output_section
->vma
;
1725 if (coff_data(output_bfd
)->pe
)
1727 addr
-= pe_data(output_bfd
)->pe_opthdr
.ImageBase
;
1729 " adjusted down to %d", addr
);
1731 fprintf(stderr
, "\n");
1733 fwrite (&addr
, 1,4, (FILE *) info
->base_file
);
1743 case bfd_reloc_overflow
:
1746 char buf
[SYMNMLEN
+ 1];
1751 name
= h
->root
.root
.root
.string
;
1752 else if (sym
== NULL
)
1754 else if (sym
->_n
._n_n
._n_zeroes
== 0
1755 && sym
->_n
._n_n
._n_offset
!= 0)
1756 name
= obj_coff_strings (input_bfd
) + sym
->_n
._n_n
._n_offset
;
1759 strncpy (buf
, sym
->_n
._n_name
, SYMNMLEN
);
1760 buf
[SYMNMLEN
] = '\0';
1766 name
= _bfd_coff_internal_syment_name (input_bfd
, sym
, buf
);
1772 if (! ((*info
->callbacks
->reloc_overflow
)
1773 (info
, name
, howto
->name
,
1774 (bfd_vma
) 0, input_bfd
,
1775 input_section
, rel
->r_vaddr
- input_section
->vma
)))
1785 #ifdef COFF_IMAGE_WITH_PE
1787 long int global_toc_size
= 0;
1789 bfd
* bfd_of_toc_owner
= 0;
1791 long int import_table_size
;
1792 long int first_thunk_address
;
1793 long int thunk_size
;
1795 struct list_ele
*head
;
1796 struct list_ele
*tail
;
1799 h1
= "\n\t\t\tTOC MAPPING\n\n";
1801 h2
= " TOC disassembly Comments Name\n";
1803 h3
= " Offset spelling (if present)\n";
1816 for(t
= head
; t
!= 0; t
=t
->next
)
1822 else if (t
->cat
== pub
)
1824 else if (t
->cat
== data
)
1825 cat
= "data-in-toc ";
1827 if (t
->offset
> global_toc_size
)
1829 if (t
->offset
<= global_toc_size
+ thunk_size
)
1830 cat
= "IAT reference ";
1832 cat
= "Out of bounds!";
1836 " %04lx (%d)", t
->offset
, t
->offset
- 32768);
1843 fprintf(file
, "\n");
1847 ppc_allocate_toc_section (info
)
1848 struct bfd_link_info
*info
;
1852 static char test_char
= '1';
1854 if ( global_toc_size
== 0 ) /* FIXME: does this get me in trouble? */
1857 if (bfd_of_toc_owner
== 0)
1860 "There is no bfd that owns the toc section!\n");
1864 s
= bfd_get_section_by_name ( bfd_of_toc_owner
, TOC_SECTION_NAME
);
1867 fprintf(stderr
, "No Toc section!\n");
1871 foo
= bfd_alloc(bfd_of_toc_owner
, global_toc_size
);
1872 memset(foo
, test_char
, global_toc_size
);
1874 s
->_raw_size
= s
->_cooked_size
= global_toc_size
;
1881 ppc_process_before_allocation (abfd
, info
)
1883 struct bfd_link_info
*info
;
1886 struct internal_reloc
*i
, *rel
;
1890 "ppc_process_before_allocation: BFD %s\n",
1891 bfd_get_filename(abfd
));
1894 /* here we have a bfd that is to be included on the link. We have a hook
1895 to do reloc rummaging, before section sizes are nailed down. */
1897 _bfd_coff_get_external_symbols(abfd
);
1899 /* rummage around all the relocs and map the toc */
1900 sec
= abfd
->sections
;
1907 for (; sec
!= 0; sec
= sec
->next
)
1913 " section %s reloc count %d\n",
1918 if (sec
->reloc_count
== 0)
1921 /* load the relocs */
1922 /* FIXME: there may be a storage leak here */
1923 i
=_bfd_coff_read_internal_relocs(abfd
,sec
,1,0,0,0);
1928 for (rel
=i
;rel
<i
+sec
->reloc_count
;++rel
)
1930 unsigned short r_type
= EXTRACT_TYPE (rel
->r_type
);
1931 unsigned short r_flags
= EXTRACT_FLAGS(rel
->r_type
);
1932 unsigned short junk
= EXTRACT_JUNK (rel
->r_type
);
1935 /* now examine flags */
1938 fprintf (stderr
, "Reloc with flags found!");
1939 if ( r_flags
& IMAGE_REL_PPC_NEG
)
1940 fprintf (stderr
, " NEG");
1941 if ( r_flags
& IMAGE_REL_PPC_BRTAKEN
)
1942 fprintf (stderr
, " BRTAKEN");
1943 if ( r_flags
& IMAGE_REL_PPC_BRNTAKEN
)
1944 fprintf (stderr
, " BRNTAKEN");
1945 if ( r_flags
& IMAGE_REL_PPC_TOCDEFN
)
1946 fprintf (stderr
, " TOCDEFN");
1947 fprintf(stderr
, "\n");
1951 DUMP_RELOC2(ppc_coff_howto_table
[r_type
].name
, rel
);
1955 case IMAGE_REL_PPC_TOCREL16
:
1958 This remains unimplemented for now, as it currently adds
1959 un-necessary elements to the toc. All we need to do today
1960 is not do anything if TOCDEFN is on.
1962 if ( r_flags
& IMAGE_REL_PPC_TOCDEFN
)
1963 toc_offset
= ppc_record_data_in_toc_entry(abfd
, info
, sec
,
1967 toc_offset
= ppc_record_toc_entry(abfd
, info
, sec
,
1968 rel
->r_symndx
, default_toc
);
1970 if ( (r_flags
& IMAGE_REL_PPC_TOCDEFN
) != IMAGE_REL_PPC_TOCDEFN
)
1971 toc_offset
= ppc_record_toc_entry(abfd
, info
, sec
,
1972 rel
->r_symndx
, default_toc
);
1974 case IMAGE_REL_PPC_IMGLUE
:
1975 ppc_mark_symbol_as_glue(abfd
, rel
->r_symndx
, rel
);
1987 static bfd_reloc_status_type
1988 ppc_refhi_reloc (abfd
,
1996 arelent
*reloc_entry
;
1999 asection
*input_section
;
2001 char **error_message
;
2004 DUMP_RELOC("REFHI",reloc_entry
);
2006 if (output_bfd
== (bfd
*) NULL
)
2007 return bfd_reloc_continue
;
2009 return bfd_reloc_undefined
;
2012 static bfd_reloc_status_type
2013 ppc_reflo_reloc (abfd
,
2021 arelent
*reloc_entry
;
2024 asection
*input_section
;
2026 char **error_message
;
2029 DUMP_RELOC("REFLO",reloc_entry
);
2031 if (output_bfd
== (bfd
*) NULL
)
2032 return bfd_reloc_continue
;
2034 return bfd_reloc_undefined
;
2037 static bfd_reloc_status_type
2038 ppc_pair_reloc (abfd
,
2046 arelent
*reloc_entry
;
2049 asection
*input_section
;
2051 char **error_message
;
2054 DUMP_RELOC("PAIR",reloc_entry
);
2056 if (output_bfd
== (bfd
*) NULL
)
2057 return bfd_reloc_continue
;
2059 return bfd_reloc_undefined
;
2063 static bfd_reloc_status_type
2064 ppc_toc16_reloc (abfd
,
2072 arelent
*reloc_entry
;
2075 asection
*input_section
;
2077 char **error_message
;
2079 UN_IMPL("TOCREL16");
2080 DUMP_RELOC("TOCREL16",reloc_entry
);
2082 if (output_bfd
== (bfd
*) NULL
)
2084 return bfd_reloc_continue
;
2087 return bfd_reloc_ok
;
2090 /* ADDR32NB : 32 bit address relative to the virtual origin. */
2091 /* (On the alpha, this is always a linker generated thunk)*/
2092 /* (i.e. 32bit addr relative to the image base) */
2096 static bfd_reloc_status_type
2097 ppc_addr32nb_reloc (abfd
,
2105 arelent
*reloc_entry
;
2108 asection
*input_section
;
2110 char **error_message
;
2112 UN_IMPL("ADDR32NB");
2113 DUMP_RELOC("ADDR32NB",reloc_entry
);
2115 return bfd_reloc_ok
;
2118 static bfd_reloc_status_type
2119 ppc_secrel_reloc (abfd
,
2127 arelent
*reloc_entry
;
2130 asection
*input_section
;
2132 char **error_message
;
2135 DUMP_RELOC("SECREL",reloc_entry
);
2137 if (output_bfd
== (bfd
*) NULL
)
2138 return bfd_reloc_continue
;
2140 return bfd_reloc_ok
;
2143 static bfd_reloc_status_type
2144 ppc_section_reloc (abfd
,
2152 arelent
*reloc_entry
;
2155 asection
*input_section
;
2157 char **error_message
;
2160 DUMP_RELOC("SECTION",reloc_entry
);
2162 if (output_bfd
== (bfd
*) NULL
)
2163 return bfd_reloc_continue
;
2165 return bfd_reloc_ok
;
2168 static bfd_reloc_status_type
2169 ppc_imglue_reloc (abfd
,
2177 arelent
*reloc_entry
;
2180 asection
*input_section
;
2182 char **error_message
;
2185 DUMP_RELOC("IMGLUE",reloc_entry
);
2187 if (output_bfd
== (bfd
*) NULL
)
2188 return bfd_reloc_continue
;
2190 return bfd_reloc_ok
;
2195 #define MAX_RELOC_INDEX \
2196 (sizeof(ppc_coff_howto_table) / sizeof(ppc_coff_howto_table[0]) - 1)
2199 /* FIXME: There is a possiblity that when we read in a reloc from a file,
2200 that there are some bits encoded in the upper portion of the
2201 type field. Not yet implemented.
2203 static void ppc_coff_rtype2howto
PARAMS ((arelent
*relent
,
2204 struct internal_reloc
*internal
));
2207 ppc_coff_rtype2howto (relent
, internal
)
2209 struct internal_reloc
*internal
;
2212 /* We can encode one of three things in the type field, aside from the
2214 1. IMAGE_REL_PPC_NEG - indicates the value field is a subtraction
2215 value, rather than an addition value
2216 2. IMAGE_REL_PPC_BRTAKEN, IMAGE_REL_PPC_BRNTAKEN - indicates that
2217 the branch is expected to be taken or not.
2218 3. IMAGE_REL_PPC_TOCDEFN - toc slot definition in the file
2219 For now, we just strip this stuff to find the type, and ignore it other
2222 reloc_howto_type
*howto
;
2223 unsigned short r_type
= EXTRACT_TYPE (internal
->r_type
);
2224 unsigned short r_flags
= EXTRACT_FLAGS(internal
->r_type
);
2225 unsigned short junk
= EXTRACT_JUNK (internal
->r_type
);
2227 /* the masking process only slices off the bottom byte for r_type. */
2228 if ( r_type
> MAX_RELOC_INDEX
)
2231 "ppc_coff_rtype2howto: reloc index %d out of range [%d, %d]\n",
2232 internal
->r_type
, 0, MAX_RELOC_INDEX
);
2236 /* check for absolute crap */
2240 "ppc_coff_rtype2howto: reloc index %d contains junk %d\n",
2241 internal
->r_type
, junk
);
2246 /* now examine flags */
2249 fprintf (stderr
, "Reloc with flags found!");
2250 if ( r_flags
& IMAGE_REL_PPC_NEG
)
2251 fprintf (stderr
, " NEG");
2252 if ( r_flags
& IMAGE_REL_PPC_BRTAKEN
)
2253 fprintf (stderr
, " BRTAKEN");
2254 if ( r_flags
& IMAGE_REL_PPC_BRNTAKEN
)
2255 fprintf (stderr
, " BRNTAKEN");
2256 if ( r_flags
& IMAGE_REL_PPC_TOCDEFN
)
2257 fprintf (stderr
, " TOCDEFN");
2258 fprintf(stderr
, "\n");
2264 case IMAGE_REL_PPC_ADDR16
:
2265 case IMAGE_REL_PPC_REL24
:
2266 case IMAGE_REL_PPC_ADDR24
:
2267 case IMAGE_REL_PPC_ADDR32
:
2268 case IMAGE_REL_PPC_IFGLUE
:
2269 case IMAGE_REL_PPC_ADDR32NB
:
2270 case IMAGE_REL_PPC_SECTION
:
2271 case IMAGE_REL_PPC_SECREL
:
2272 DUMP_RELOC2(ppc_coff_howto_table
[r_type
].name
, internal
);
2273 howto
= ppc_coff_howto_table
+ r_type
;
2275 case IMAGE_REL_PPC_IMGLUE
:
2276 DUMP_RELOC2(ppc_coff_howto_table
[r_type
].name
, internal
);
2277 howto
= ppc_coff_howto_table
+ r_type
;
2279 case IMAGE_REL_PPC_TOCREL16
:
2280 DUMP_RELOC2(ppc_coff_howto_table
[r_type
].name
, internal
);
2281 if (r_flags
& IMAGE_REL_PPC_TOCDEFN
)
2282 howto
= ppc_coff_howto_table
+ IMAGE_REL_PPC_TOCREL16_DEFN
;
2284 howto
= ppc_coff_howto_table
+ IMAGE_REL_PPC_TOCREL16
;
2288 "Warning: Unsupported reloc %s [%d] used -- it may not work.\n",
2289 ppc_coff_howto_table
[r_type
].name
,
2291 howto
= ppc_coff_howto_table
+ r_type
;
2295 relent
->howto
= howto
;
2299 static reloc_howto_type
*
2300 coff_ppc_rtype_to_howto (abfd
, sec
, rel
, h
, sym
, addendp
)
2303 struct internal_reloc
*rel
;
2304 struct coff_link_hash_entry
*h
;
2305 struct internal_syment
*sym
;
2308 reloc_howto_type
*howto
;
2310 /* We can encode one of three things in the type field, aside from the
2312 1. IMAGE_REL_PPC_NEG - indicates the value field is a subtraction
2313 value, rather than an addition value
2314 2. IMAGE_REL_PPC_BRTAKEN, IMAGE_REL_PPC_BRNTAKEN - indicates that
2315 the branch is expected to be taken or not.
2316 3. IMAGE_REL_PPC_TOCDEFN - toc slot definition in the file
2317 For now, we just strip this stuff to find the type, and ignore it other
2321 unsigned short r_type
= EXTRACT_TYPE (rel
->r_type
);
2322 unsigned short r_flags
= EXTRACT_FLAGS(rel
->r_type
);
2323 unsigned short junk
= EXTRACT_JUNK (rel
->r_type
);
2325 /* the masking process only slices off the bottom byte for r_type. */
2326 if ( r_type
> MAX_RELOC_INDEX
)
2329 "coff_ppc_rtype_to_howto: index %d out of range [%d, %d]\n",
2330 r_type
, 0, MAX_RELOC_INDEX
);
2334 /* check for absolute crap */
2338 "coff_ppc_rtype_to_howto: reloc index %d contains junk %d\n",
2344 /* now examine flags */
2347 fprintf (stderr
, "Reloc with flags found!");
2348 if ( r_flags
& IMAGE_REL_PPC_NEG
)
2349 fprintf (stderr
, " NEG");
2350 if ( r_flags
& IMAGE_REL_PPC_BRTAKEN
)
2351 fprintf (stderr
, " BRTAKEN");
2352 if ( r_flags
& IMAGE_REL_PPC_BRNTAKEN
)
2353 fprintf (stderr
, " BRNTAKEN");
2354 if ( r_flags
& IMAGE_REL_PPC_TOCDEFN
)
2355 fprintf (stderr
, " TOCDEFN");
2356 fprintf(stderr
, "\n");
2362 case IMAGE_REL_PPC_ADDR32NB
:
2363 DUMP_RELOC2(ppc_coff_howto_table
[r_type
].name
, rel
);
2364 *addendp
-= pe_data(sec
->output_section
->owner
)->pe_opthdr
.ImageBase
;
2365 howto
= ppc_coff_howto_table
+ r_type
;
2367 case IMAGE_REL_PPC_TOCREL16
:
2368 DUMP_RELOC2(ppc_coff_howto_table
[r_type
].name
, rel
);
2369 if (r_flags
& IMAGE_REL_PPC_TOCDEFN
)
2370 howto
= ppc_coff_howto_table
+ IMAGE_REL_PPC_TOCREL16_DEFN
;
2372 howto
= ppc_coff_howto_table
+ IMAGE_REL_PPC_TOCREL16
;
2374 case IMAGE_REL_PPC_ADDR16
:
2375 case IMAGE_REL_PPC_REL24
:
2376 case IMAGE_REL_PPC_ADDR24
:
2377 case IMAGE_REL_PPC_ADDR32
:
2378 case IMAGE_REL_PPC_IFGLUE
:
2379 case IMAGE_REL_PPC_SECTION
:
2380 case IMAGE_REL_PPC_SECREL
:
2381 DUMP_RELOC2(ppc_coff_howto_table
[r_type
].name
, rel
);
2382 howto
= ppc_coff_howto_table
+ r_type
;
2384 case IMAGE_REL_PPC_IMGLUE
:
2385 DUMP_RELOC2(ppc_coff_howto_table
[r_type
].name
, rel
);
2386 howto
= ppc_coff_howto_table
+ r_type
;
2390 "Warning: Unsupported reloc %s [%d] used -- it may not work.\n",
2391 ppc_coff_howto_table
[r_type
].name
,
2393 howto
= ppc_coff_howto_table
+ r_type
;
2401 /* a cheesy little macro to make the code a little more readable */
2402 #define HOW2MAP(bfd_rtype,ppc_rtype) \
2403 case bfd_rtype: return &ppc_coff_howto_table[ppc_rtype]
2405 static reloc_howto_type
*ppc_coff_reloc_type_lookup
2406 PARAMS ((bfd
*, bfd_reloc_code_real_type
));
2408 static reloc_howto_type
*
2409 ppc_coff_reloc_type_lookup (abfd
, code
)
2411 bfd_reloc_code_real_type code
;
2415 fprintf(stderr
, "ppc_coff_reloc_type_lookup for %s\n",
2416 bfd_get_reloc_code_name(code
));
2421 HOW2MAP(BFD_RELOC_32_GOTOFF
, IMAGE_REL_PPC_IMGLUE
);
2422 HOW2MAP(BFD_RELOC_16_GOT_PCREL
, IMAGE_REL_PPC_IFGLUE
);
2423 HOW2MAP(BFD_RELOC_16
, IMAGE_REL_PPC_ADDR16
);
2424 HOW2MAP(BFD_RELOC_PPC_B26
, IMAGE_REL_PPC_REL24
);
2425 HOW2MAP(BFD_RELOC_PPC_BA26
, IMAGE_REL_PPC_ADDR24
);
2426 HOW2MAP(BFD_RELOC_PPC_TOC16
, IMAGE_REL_PPC_TOCREL16
);
2427 HOW2MAP(BFD_RELOC_16_GOTOFF
, IMAGE_REL_PPC_TOCREL16_DEFN
);
2428 HOW2MAP(BFD_RELOC_32
, IMAGE_REL_PPC_ADDR32
);
2429 HOW2MAP(BFD_RELOC_RVA
, IMAGE_REL_PPC_ADDR32NB
);
2440 /* Tailor coffcode.h -- macro heaven. */
2442 #define RTYPE2HOWTO(cache_ptr, dst) ppc_coff_rtype2howto (cache_ptr, dst)
2444 #ifndef COFF_IMAGE_WITH_PE
2446 ppc_coff_swap_sym_in_hook ();
2449 /* We use the special COFF backend linker, with our own special touch. */
2451 #define coff_bfd_reloc_type_lookup ppc_coff_reloc_type_lookup
2452 #define coff_rtype_to_howto coff_ppc_rtype_to_howto
2453 #define coff_relocate_section coff_ppc_relocate_section
2455 #ifndef COFF_IMAGE_WITH_PE
2456 #define coff_swap_sym_in_hook ppc_coff_swap_sym_in_hook
2459 #define SELECT_RELOC(internal, howto) {internal.r_type=howto->type;}
2461 #define COFF_PAGE_SIZE 0x1000
2463 #define POWERPC_LE_PE
2465 #include "coffcode.h"
2469 #ifndef COFF_IMAGE_WITH_PE
2471 What we're trying to do here is allocate a toc section (early), and attach
2472 it to the last bfd to be processed. This avoids the problem of having a toc
2473 written out before all files have been processed. This code allocates
2474 a toc section for every file, and records the last one seen. There are
2475 at least two problems with this approach:
2476 1. We allocate whole bunches of toc sections that are ignored, but at
2477 at least we will not allocate a toc if no .toc is present.
2478 2. It's not clear to me that being the last bfd read necessarily means
2479 that you are the last bfd closed.
2480 3. Doing it on a "swap in" hook depends on when the "swap in" is called,
2481 and how often, etc. It's not clear to me that there isn't a hole here.
2485 ppc_coff_swap_sym_in_hook (abfd
, ext1
, in1
)
2490 SYMENT
*ext
= (SYMENT
*)ext1
;
2491 struct internal_syment
*in
= (struct internal_syment
*)in1
;
2494 if (bfd_of_toc_owner
!= 0) /* we already have a toc, so go home */
2498 if (strcmp(in
->_n
._n_name
, ".toc") == 0)
2501 register asection
*s
;
2504 s
= bfd_get_section_by_name ( abfd
, TOC_SECTION_NAME
);
2510 flags
= SEC_ALLOC
| SEC_LOAD
| SEC_HAS_CONTENTS
| SEC_IN_MEMORY
;
2514 "ppc_coff_swap_sym_in_hook: about to create the %s section\n",
2518 s
= bfd_make_section (abfd
, TOC_SECTION_NAME
);
2521 || !bfd_set_section_flags (abfd
, s
, flags
)
2522 || !bfd_set_section_alignment (abfd
, s
, 2))
2525 "toc section allocation failed!\n");
2529 /* save the bfd for later allocation */
2530 bfd_of_toc_owner
= abfd
;
2539 /* The transfer vectors that lead the outside world to all of the above. */
2541 #ifdef TARGET_LITTLE_SYM
2545 TARGET_LITTLE_NAME
, /* name or coff-arm-little */
2546 bfd_target_coff_flavour
,
2547 false, /* data byte order is little */
2548 false, /* header byte order is little */
2550 (HAS_RELOC
| EXEC_P
| /* FIXME: object flags */
2551 HAS_LINENO
| HAS_DEBUG
|
2552 HAS_SYMS
| HAS_LOCALS
| WP_TEXT
),
2554 (SEC_HAS_CONTENTS
| SEC_ALLOC
| SEC_LOAD
| SEC_RELOC
), /* section flags */
2555 0, /* leading char */
2556 '/', /* ar_pad_char */
2557 15, /* ar_max_namelen??? FIXMEmgo */
2559 bfd_getl64
, bfd_getl_signed_64
, bfd_putl64
,
2560 bfd_getl32
, bfd_getl_signed_32
, bfd_putl32
,
2561 bfd_getl16
, bfd_getl_signed_16
, bfd_putl16
, /* data */
2563 bfd_getl64
, bfd_getl_signed_64
, bfd_putl64
,
2564 bfd_getl32
, bfd_getl_signed_32
, bfd_putl32
,
2565 bfd_getl16
, bfd_getl_signed_16
, bfd_putl16
, /* hdrs */
2567 {_bfd_dummy_target
, coff_object_p
, /* bfd_check_format */
2568 bfd_generic_archive_p
, /* _bfd_dummy_target */ coff_object_p
},
2569 {bfd_false
, coff_mkobject
, _bfd_generic_mkarchive
, /* bfd_set_format */
2571 {bfd_false
, coff_write_object_contents
, /* bfd_write_contents */
2572 _bfd_write_archive_contents
, bfd_false
},
2574 BFD_JUMP_TABLE_GENERIC (coff
),
2575 BFD_JUMP_TABLE_COPY (coff
),
2576 BFD_JUMP_TABLE_CORE (_bfd_nocore
),
2577 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff
),
2578 BFD_JUMP_TABLE_SYMBOLS (coff
),
2579 BFD_JUMP_TABLE_RELOCS (coff
),
2580 BFD_JUMP_TABLE_WRITE (coff
),
2581 BFD_JUMP_TABLE_LINK (coff
),
2582 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic
),
2588 #ifdef TARGET_BIG_SYM
2593 bfd_target_coff_flavour
,
2594 true, /* data byte order is big */
2595 true, /* header byte order is big */
2597 (HAS_RELOC
| EXEC_P
| /* FIXME: object flags */
2598 HAS_LINENO
| HAS_DEBUG
|
2599 HAS_SYMS
| HAS_LOCALS
| WP_TEXT
),
2601 (SEC_HAS_CONTENTS
| SEC_ALLOC
| SEC_LOAD
| SEC_RELOC
), /* section flags */
2602 0, /* leading char */
2603 '/', /* ar_pad_char */
2604 15, /* ar_max_namelen??? FIXMEmgo */
2606 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
2607 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
2608 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* data */
2610 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
2611 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
2612 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* hdrs */
2614 {_bfd_dummy_target
, coff_object_p
, /* bfd_check_format */
2615 bfd_generic_archive_p
, /* _bfd_dummy_target */ coff_object_p
},
2616 {bfd_false
, coff_mkobject
, _bfd_generic_mkarchive
, /* bfd_set_format */
2618 {bfd_false
, coff_write_object_contents
, /* bfd_write_contents */
2619 _bfd_write_archive_contents
, bfd_false
},
2621 BFD_JUMP_TABLE_GENERIC (coff
),
2622 BFD_JUMP_TABLE_COPY (coff
),
2623 BFD_JUMP_TABLE_CORE (_bfd_nocore
),
2624 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff
),
2625 BFD_JUMP_TABLE_SYMBOLS (coff
),
2626 BFD_JUMP_TABLE_RELOCS (coff
),
2627 BFD_JUMP_TABLE_WRITE (coff
),
2628 BFD_JUMP_TABLE_LINK (coff
),
2629 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic
),