1 /* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically
2 generated from "libcoff-in.h" and "coffcode.h".
3 Run "make headers" in your build bfd/ to regenerate. */
5 /* BFD COFF object file private structure.
6 Copyright (C) 1990-2018 Free Software Foundation, Inc.
7 Written by Cygnus Support.
9 This file is part of BFD, the Binary File Descriptor library.
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 3 of the License, or
14 (at your option) any later version.
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
24 MA 02110-1301, USA. */
36 /* Object file tdata; access macros. */
38 #define coff_data(bfd) ((bfd)->tdata.coff_obj_data)
39 #define obj_pe(bfd) (coff_data (bfd)->pe)
40 #define obj_symbols(bfd) (coff_data (bfd)->symbols)
41 #define obj_sym_filepos(bfd) (coff_data (bfd)->sym_filepos)
42 #define obj_relocbase(bfd) (coff_data (bfd)->relocbase)
43 #define obj_raw_syments(bfd) (coff_data (bfd)->raw_syments)
44 #define obj_raw_syment_count(bfd) (coff_data (bfd)->raw_syment_count)
45 #define obj_convert(bfd) (coff_data (bfd)->conversion_table)
46 #define obj_conv_table_size(bfd) (coff_data (bfd)->conv_table_size)
47 #define obj_coff_external_syms(bfd) (coff_data (bfd)->external_syms)
48 #define obj_coff_keep_syms(bfd) (coff_data (bfd)->keep_syms)
49 #define obj_coff_strings(bfd) (coff_data (bfd)->strings)
50 #define obj_coff_strings_len(bfd) (coff_data (bfd)->strings_len)
51 #define obj_coff_keep_strings(bfd) (coff_data (bfd)->keep_strings)
52 #define obj_coff_sym_hashes(bfd) (coff_data (bfd)->sym_hashes)
53 #define obj_coff_strings_written(bfd) (coff_data (bfd)->strings_written)
54 #define obj_coff_local_toc_table(bfd) (coff_data (bfd)->local_toc_sym_map)
56 /* `Tdata' information kept for COFF files. */
58 typedef struct coff_tdata
60 struct coff_symbol_struct *symbols; /* Symtab for input bfd. */
61 unsigned int *conversion_table;
65 struct coff_ptr_struct *raw_syments;
66 unsigned long raw_syment_count;
68 /* These are only valid once writing has begun. */
69 unsigned long int relocbase;
71 /* These members communicate important constants about the symbol table
72 to GDB's symbol-reading code. These `constants' unfortunately vary
73 from coff implementation to implementation... */
74 unsigned local_n_btmask;
75 unsigned local_n_btshft;
76 unsigned local_n_tmask;
77 unsigned local_n_tshift;
78 unsigned local_symesz;
79 unsigned local_auxesz;
80 unsigned local_linesz;
82 /* The unswapped external symbols. May be NULL. Read by
83 _bfd_coff_get_external_symbols. */
85 /* If this is TRUE, the external_syms may not be freed. */
86 bfd_boolean keep_syms;
88 /* The string table. May be NULL. Read by
89 _bfd_coff_read_string_table. */
91 /* The length of the strings table. For error checking. */
92 bfd_size_type strings_len;
93 /* If this is TRUE, the strings may not be freed. */
94 bfd_boolean keep_strings;
95 /* If this is TRUE, the strings have been written out already. */
96 bfd_boolean strings_written;
98 /* Is this a PE format coff file? */
100 /* Used by the COFF backend linker. */
101 struct coff_link_hash_entry **sym_hashes;
103 /* Used by the pe linker for PowerPC. */
104 int *local_toc_sym_map;
106 struct bfd_link_info *link_info;
108 /* Used by coff_find_nearest_line. */
111 /* A place to stash dwarf2 info for this bfd. */
112 void * dwarf2_find_line_info;
114 /* The timestamp from the COFF file header. */
117 /* Copy of some of the f_flags bits in the COFF filehdr structure,
121 /* coff-stgo32 EXE stub header after BFD tdata has been allocated. Its data
122 is kept in internal_filehdr.go32stub beforehand. */
126 /* Tdata for pe image files. */
127 typedef struct pe_tdata
130 struct internal_extra_pe_aouthdr pe_opthdr;
132 int has_reloc_section;
133 int dont_strip_reloc;
134 bfd_boolean insert_timestamp;
135 bfd_boolean (*in_reloc_p) (bfd *, reloc_howto_type *);
141 bfd_boolean (*after_write_object_contents) (bfd *);
147 #define pe_data(bfd) ((bfd)->tdata.pe_obj_data)
149 /* Tdata for XCOFF files. */
153 /* Basic COFF information. */
156 /* TRUE if this is an XCOFF64 file. */
159 /* TRUE if a large a.out header should be generated. */
160 bfd_boolean full_aouthdr;
165 /* Index of section holding TOC. */
168 /* Index of section holding entry point. */
171 /* .text alignment from optional header. */
172 int text_align_power;
174 /* .data alignment from optional header. */
175 int data_align_power;
177 /* modtype from optional header. */
180 /* cputype from optional header. */
183 /* maxdata from optional header. */
186 /* maxstack from optional header. */
189 /* Used by the XCOFF backend linker. */
192 unsigned int *lineno_counts;
193 unsigned int import_file_id;
196 #define xcoff_data(abfd) ((abfd)->tdata.xcoff_obj_data)
198 /* We take the address of the first element of an asymbol to ensure that the
199 macro is only ever applied to an asymbol. */
200 #define coffsymbol(asymbol) ((coff_symbol_type *)(&((asymbol)->the_bfd)))
202 /* Tdata for sections in XCOFF files. This is used by the linker. */
204 struct xcoff_section_tdata
206 /* Used for XCOFF csects created by the linker; points to the real
207 XCOFF section which contains this csect. */
209 /* The lineno_count field for the enclosing section, because we are
210 going to clobber it there. */
211 unsigned int lineno_count;
212 /* The first and last symbol indices for symbols used by this csect. */
213 unsigned long first_symndx;
214 unsigned long last_symndx;
217 /* An accessor macro the xcoff_section_tdata structure. */
218 #define xcoff_section_data(abfd, sec) \
219 ((struct xcoff_section_tdata *) coff_section_data ((abfd), (sec))->tdata)
221 /* Tdata for sections in PE files. */
223 struct pei_section_tdata
225 /* The virtual size of the section. */
226 bfd_size_type virt_size;
227 /* The PE section flags. */
231 /* An accessor macro for the pei_section_tdata structure. */
232 #define pei_section_data(abfd, sec) \
233 ((struct pei_section_tdata *) coff_section_data ((abfd), (sec))->tdata)
235 /* COFF linker hash table entries. */
237 struct coff_link_hash_entry
239 struct bfd_link_hash_entry root;
241 /* Symbol index in output file. Set to -1 initially. Set to -2 if
242 there is a reloc against this symbol. */
249 unsigned char symbol_class;
251 /* Number of auxiliary entries. */
254 /* BFD to take auxiliary entries from. */
257 /* Pointer to array of auxiliary entries, if any. */
258 union internal_auxent *aux;
260 /* Flag word; legal values follow. */
261 unsigned short coff_link_hash_flags;
262 /* Symbol is a PE section symbol. */
263 #define COFF_LINK_HASH_PE_SECTION_SYMBOL (01)
266 /* COFF linker hash table. */
268 struct coff_link_hash_table
270 struct bfd_link_hash_table root;
271 /* A pointer to information used to link stabs in sections. */
272 struct stab_info stab_info;
275 struct coff_reloc_cookie
277 struct internal_reloc * rels;
278 struct internal_reloc * rel;
279 struct internal_reloc * relend;
280 struct coff_symbol_struct * symbols; /* Symtab for input bfd. */
282 struct coff_link_hash_entry ** sym_hashes;
285 /* Look up an entry in a COFF linker hash table. */
287 #define coff_link_hash_lookup(table, string, create, copy, follow) \
288 ((struct coff_link_hash_entry *) \
289 bfd_link_hash_lookup (&(table)->root, (string), (create), \
292 /* Traverse a COFF linker hash table. */
294 #define coff_link_hash_traverse(table, func, info) \
295 (bfd_link_hash_traverse \
297 (bfd_boolean (*) (struct bfd_link_hash_entry *, void *)) (func), \
300 /* Get the COFF linker hash table from a link_info structure. */
302 #define coff_hash_table(p) ((struct coff_link_hash_table *) ((p)->hash))
304 /* Functions in coffgen.c. */
305 extern const bfd_target *coff_object_p
307 extern struct bfd_section *coff_section_from_bfd_index
309 extern long coff_get_symtab_upper_bound
311 extern long coff_canonicalize_symtab
313 extern int coff_count_linenumbers
315 extern bfd_boolean coff_renumber_symbols
317 extern void coff_mangle_symbols
319 extern bfd_boolean coff_write_symbols
321 extern bfd_boolean coff_write_alien_symbol
322 (bfd *, asymbol *, struct internal_syment *, union internal_auxent *,
323 bfd_vma *, bfd_size_type *, asection **, bfd_size_type *);
324 extern bfd_boolean coff_write_linenumbers
326 extern alent *coff_get_lineno
328 extern asymbol *coff_section_symbol
330 extern bfd_boolean _bfd_coff_get_external_symbols
332 extern const char *_bfd_coff_read_string_table
334 extern bfd_boolean _bfd_coff_free_symbols
336 extern struct coff_ptr_struct *coff_get_normalized_symtab
338 extern long coff_get_reloc_upper_bound
340 extern asymbol *coff_make_empty_symbol
342 extern void coff_print_symbol
343 (bfd *, void * filep, asymbol *, bfd_print_symbol_type);
344 extern void coff_get_symbol_info
345 (bfd *, asymbol *, symbol_info *ret);
346 #define coff_get_symbol_version_string \
347 _bfd_nosymbols_get_symbol_version_string
348 extern bfd_boolean _bfd_coff_is_local_label_name
349 (bfd *, const char *);
350 extern asymbol *coff_bfd_make_debug_symbol
351 (bfd *, void *, unsigned long);
352 extern bfd_boolean coff_find_nearest_line
353 (bfd *, asymbol **, asection *, bfd_vma,
354 const char **, const char **, unsigned int *, unsigned int *);
355 #define coff_find_line _bfd_nosymbols_find_line
356 struct dwarf_debug_section;
357 extern bfd_boolean coff_find_nearest_line_with_names
358 (bfd *, asymbol **, asection *, bfd_vma, const char **, const char **,
359 unsigned int *, const struct dwarf_debug_section *);
360 extern bfd_boolean coff_find_inliner_info
361 (bfd *, const char **, const char **, unsigned int *);
362 extern int coff_sizeof_headers
363 (bfd *, struct bfd_link_info *);
364 extern bfd_boolean bfd_coff_reloc16_relax_section
365 (bfd *, asection *, struct bfd_link_info *, bfd_boolean *);
366 extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents
367 (bfd *, struct bfd_link_info *, struct bfd_link_order *,
368 bfd_byte *, bfd_boolean, asymbol **);
369 extern bfd_vma bfd_coff_reloc16_get_value
370 (arelent *, struct bfd_link_info *, asection *);
371 extern void bfd_perform_slip
372 (bfd *, unsigned int, asection *, bfd_vma);
374 /* Functions and types in cofflink.c. */
376 #define STRING_SIZE_SIZE 4
378 /* We use a hash table to merge identical enum, struct, and union
379 definitions in the linker. */
381 /* Information we keep for a single element (an enum value, a
382 structure or union field) in the debug merge hash table. */
384 struct coff_debug_merge_element
387 struct coff_debug_merge_element *next;
395 /* Symbol index for complex type. */
399 /* A linked list of debug merge entries for a given name. */
401 struct coff_debug_merge_type
403 /* Next type with the same name. */
404 struct coff_debug_merge_type *next;
409 /* Symbol index where this type is defined. */
412 /* List of elements. */
413 struct coff_debug_merge_element *elements;
416 /* Information we store in the debug merge hash table. */
418 struct coff_debug_merge_hash_entry
420 struct bfd_hash_entry root;
422 /* A list of types with this name. */
423 struct coff_debug_merge_type *types;
426 /* The debug merge hash table. */
428 struct coff_debug_merge_hash_table
430 struct bfd_hash_table root;
433 /* Initialize a COFF debug merge hash table. */
435 #define coff_debug_merge_hash_table_init(table) \
436 (bfd_hash_table_init (&(table)->root, _bfd_coff_debug_merge_hash_newfunc, \
437 sizeof (struct coff_debug_merge_hash_entry)))
439 /* Free a COFF debug merge hash table. */
441 #define coff_debug_merge_hash_table_free(table) \
442 (bfd_hash_table_free (&(table)->root))
444 /* Look up an entry in a COFF debug merge hash table. */
446 #define coff_debug_merge_hash_lookup(table, string, create, copy) \
447 ((struct coff_debug_merge_hash_entry *) \
448 bfd_hash_lookup (&(table)->root, (string), (create), (copy)))
450 /* Information we keep for each section in the output file when doing
451 a relocatable link. */
453 struct coff_link_section_info
455 /* The relocs to be output. */
456 struct internal_reloc *relocs;
457 /* For each reloc against a global symbol whose index was not known
458 when the reloc was handled, the global hash table entry. */
459 struct coff_link_hash_entry **rel_hashes;
462 /* Information that we pass around while doing the final link step. */
464 struct coff_final_link_info
466 /* General link information. */
467 struct bfd_link_info *info;
470 /* Used to indicate failure in traversal routine. */
472 /* If doing "task linking" set only during the time when we want the
473 global symbol writer to convert the storage class of defined global
474 symbols from global to static. */
475 bfd_boolean global_to_static;
476 /* Hash table for long symbol names. */
477 struct bfd_strtab_hash *strtab;
478 /* When doing a relocatable link, an array of information kept for
479 each output section, indexed by the target_index field. */
480 struct coff_link_section_info *section_info;
481 /* Symbol index of last C_FILE symbol (-1 if none). */
482 long last_file_index;
483 /* Contents of last C_FILE symbol. */
484 struct internal_syment last_file;
485 /* Symbol index of first aux entry of last .bf symbol with an empty
486 endndx field (-1 if none). */
488 /* Contents of last_bf_index aux entry. */
489 union internal_auxent last_bf;
490 /* Hash table used to merge debug information. */
491 struct coff_debug_merge_hash_table debug_merge;
492 /* Buffer large enough to hold swapped symbols of any input file. */
493 struct internal_syment *internal_syms;
494 /* Buffer large enough to hold sections of symbols of any input file. */
496 /* Buffer large enough to hold output indices of symbols of any
499 /* Buffer large enough to hold output symbols for any input file. */
501 /* Buffer large enough to hold external line numbers for any input
504 /* Buffer large enough to hold any input section. */
506 /* Buffer large enough to hold external relocs of any input section. */
507 bfd_byte *external_relocs;
508 /* Buffer large enough to hold swapped relocs of any input section. */
509 struct internal_reloc *internal_relocs;
512 /* Most COFF variants have no way to record the alignment of a
513 section. This struct is used to set a specific alignment based on
514 the name of the section. */
516 struct coff_section_alignment_entry
518 /* The section name. */
521 /* This is either (unsigned int) -1, indicating that the section
522 name must match exactly, or it is the number of letters which
523 must match at the start of the name. */
524 unsigned int comparison_length;
526 /* These macros may be used to fill in the first two fields in a
527 structure initialization. */
528 #define COFF_SECTION_NAME_EXACT_MATCH(name) (name), ((unsigned int) -1)
529 #define COFF_SECTION_NAME_PARTIAL_MATCH(name) (name), (sizeof (name) - 1)
531 /* Only use this entry if the default section alignment for this
532 target is at least that much (as a power of two). If this field
533 is COFF_ALIGNMENT_FIELD_EMPTY, it should be ignored. */
534 unsigned int default_alignment_min;
536 /* Only use this entry if the default section alignment for this
537 target is no greater than this (as a power of two). If this
538 field is COFF_ALIGNMENT_FIELD_EMPTY, it should be ignored. */
539 unsigned int default_alignment_max;
541 #define COFF_ALIGNMENT_FIELD_EMPTY ((unsigned int) -1)
543 /* The desired alignment for this section (as a power of two). */
544 unsigned int alignment_power;
547 extern struct bfd_hash_entry *_bfd_coff_link_hash_newfunc
548 (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
549 extern bfd_boolean _bfd_coff_link_hash_table_init
550 (struct coff_link_hash_table *, bfd *,
551 struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
552 struct bfd_hash_table *,
555 extern struct bfd_link_hash_table *_bfd_coff_link_hash_table_create
557 extern const char *_bfd_coff_internal_syment_name
558 (bfd *, const struct internal_syment *, char *);
559 extern bfd_boolean _bfd_coff_section_already_linked
560 (bfd *, asection *, struct bfd_link_info *);
561 extern bfd_boolean _bfd_coff_link_add_symbols
562 (bfd *, struct bfd_link_info *);
563 extern bfd_boolean _bfd_coff_final_link
564 (bfd *, struct bfd_link_info *);
565 extern struct internal_reloc *_bfd_coff_read_internal_relocs
566 (bfd *, asection *, bfd_boolean, bfd_byte *, bfd_boolean,
567 struct internal_reloc *);
568 extern bfd_boolean _bfd_coff_generic_relocate_section
569 (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
570 struct internal_reloc *, struct internal_syment *, asection **);
571 extern struct bfd_hash_entry *_bfd_coff_debug_merge_hash_newfunc
572 (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
573 extern bfd_boolean _bfd_coff_write_global_sym
574 (struct bfd_hash_entry *, void *);
575 extern bfd_boolean _bfd_coff_write_task_globals
576 (struct coff_link_hash_entry *, void *);
577 extern bfd_boolean _bfd_coff_link_input_bfd
578 (struct coff_final_link_info *, bfd *);
579 extern bfd_boolean _bfd_coff_reloc_link_order
580 (bfd *, struct coff_final_link_info *, asection *,
581 struct bfd_link_order *);
582 extern bfd_boolean bfd_coff_gc_sections
583 (bfd *, struct bfd_link_info *);
586 #define coff_get_section_contents_in_window \
587 _bfd_generic_get_section_contents_in_window
589 /* Functions in xcofflink.c. */
591 extern long _bfd_xcoff_get_dynamic_symtab_upper_bound
593 extern long _bfd_xcoff_canonicalize_dynamic_symtab
595 extern long _bfd_xcoff_get_dynamic_reloc_upper_bound
597 extern long _bfd_xcoff_canonicalize_dynamic_reloc
598 (bfd *, arelent **, asymbol **);
599 extern struct bfd_link_hash_table *_bfd_xcoff_bfd_link_hash_table_create
601 extern bfd_boolean _bfd_xcoff_bfd_link_add_symbols
602 (bfd *, struct bfd_link_info *);
603 extern bfd_boolean _bfd_xcoff_bfd_final_link
604 (bfd *, struct bfd_link_info *);
605 extern bfd_boolean _bfd_xcoff_define_common_symbol
606 (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *);
607 extern bfd_boolean _bfd_ppc_xcoff_relocate_section
608 (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
609 struct internal_reloc *, struct internal_syment *, asection **);
611 /* Functions in coff-ppc.c. FIXME: These are called by pe.em in the
612 linker, and so should start with bfd and be declared in bfd.h. */
614 extern bfd_boolean ppc_allocate_toc_section
615 (struct bfd_link_info *);
616 extern bfd_boolean ppc_process_before_allocation
617 (bfd *, struct bfd_link_info *);
618 /* Extracted from coffcode.h. */
620 typedef struct coff_ptr_struct
622 /* Remembers the offset from the first symbol in the file for
623 this symbol. Generated by coff_renumber_symbols. */
626 /* Should the value of this symbol be renumbered. Used for
627 XCOFF C_BSTAT symbols. Set by coff_slurp_symbol_table. */
628 unsigned int fix_value : 1;
630 /* Should the tag field of this symbol be renumbered.
631 Created by coff_pointerize_aux. */
632 unsigned int fix_tag : 1;
634 /* Should the endidx field of this symbol be renumbered.
635 Created by coff_pointerize_aux. */
636 unsigned int fix_end : 1;
638 /* Should the x_csect.x_scnlen field be renumbered.
639 Created by coff_pointerize_aux. */
640 unsigned int fix_scnlen : 1;
642 /* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the
643 index into the line number entries. Set by coff_slurp_symbol_table. */
644 unsigned int fix_line : 1;
646 /* The container for the symbol structure as read and translated
650 union internal_auxent auxent;
651 struct internal_syment syment;
654 /* Selector for the union above. */
656 } combined_entry_type;
659 /* Each canonical asymbol really looks like this: */
661 typedef struct coff_symbol_struct
663 /* The actual symbol which the rest of BFD works with */
666 /* A pointer to the hidden information for this symbol */
667 combined_entry_type *native;
669 /* A pointer to the linenumber information for this symbol */
670 struct lineno_cache_entry *lineno;
672 /* Have the line numbers been relocated yet ? */
673 bfd_boolean done_lineno;
675 /* COFF symbol classifications. */
677 enum coff_symbol_classification
683 /* Undefined symbol. */
684 COFF_SYMBOL_UNDEFINED,
687 /* PE section symbol. */
688 COFF_SYMBOL_PE_SECTION
691 typedef asection * (*coff_gc_mark_hook_fn)
692 (asection *, struct bfd_link_info *, struct internal_reloc *,
693 struct coff_link_hash_entry *, struct internal_syment *);
697 void (*_bfd_coff_swap_aux_in)
698 (bfd *, void *, int, int, int, int, void *);
700 void (*_bfd_coff_swap_sym_in)
701 (bfd *, void *, void *);
703 void (*_bfd_coff_swap_lineno_in)
704 (bfd *, void *, void *);
706 unsigned int (*_bfd_coff_swap_aux_out)
707 (bfd *, void *, int, int, int, int, void *);
709 unsigned int (*_bfd_coff_swap_sym_out)
710 (bfd *, void *, void *);
712 unsigned int (*_bfd_coff_swap_lineno_out)
713 (bfd *, void *, void *);
715 unsigned int (*_bfd_coff_swap_reloc_out)
716 (bfd *, void *, void *);
718 unsigned int (*_bfd_coff_swap_filehdr_out)
719 (bfd *, void *, void *);
721 unsigned int (*_bfd_coff_swap_aouthdr_out)
722 (bfd *, void *, void *);
724 unsigned int (*_bfd_coff_swap_scnhdr_out)
725 (bfd *, void *, void *);
727 unsigned int _bfd_filhsz;
728 unsigned int _bfd_aoutsz;
729 unsigned int _bfd_scnhsz;
730 unsigned int _bfd_symesz;
731 unsigned int _bfd_auxesz;
732 unsigned int _bfd_relsz;
733 unsigned int _bfd_linesz;
734 unsigned int _bfd_filnmlen;
735 bfd_boolean _bfd_coff_long_filenames;
737 bfd_boolean _bfd_coff_long_section_names;
738 bfd_boolean (*_bfd_coff_set_long_section_names)
741 unsigned int _bfd_coff_default_section_alignment_power;
742 bfd_boolean _bfd_coff_force_symnames_in_strings;
743 unsigned int _bfd_coff_debug_string_prefix_length;
744 unsigned int _bfd_coff_max_nscns;
746 void (*_bfd_coff_swap_filehdr_in)
747 (bfd *, void *, void *);
749 void (*_bfd_coff_swap_aouthdr_in)
750 (bfd *, void *, void *);
752 void (*_bfd_coff_swap_scnhdr_in)
753 (bfd *, void *, void *);
755 void (*_bfd_coff_swap_reloc_in)
756 (bfd *abfd, void *, void *);
758 bfd_boolean (*_bfd_coff_bad_format_hook)
761 bfd_boolean (*_bfd_coff_set_arch_mach_hook)
764 void * (*_bfd_coff_mkobject_hook)
765 (bfd *, void *, void *);
767 bfd_boolean (*_bfd_styp_to_sec_flags_hook)
768 (bfd *, void *, const char *, asection *, flagword *);
770 void (*_bfd_set_alignment_hook)
771 (bfd *, asection *, void *);
773 bfd_boolean (*_bfd_coff_slurp_symbol_table)
776 bfd_boolean (*_bfd_coff_symname_in_debug)
777 (bfd *, struct internal_syment *);
779 bfd_boolean (*_bfd_coff_pointerize_aux_hook)
780 (bfd *, combined_entry_type *, combined_entry_type *,
781 unsigned int, combined_entry_type *);
783 bfd_boolean (*_bfd_coff_print_aux)
784 (bfd *, FILE *, combined_entry_type *, combined_entry_type *,
785 combined_entry_type *, unsigned int);
787 void (*_bfd_coff_reloc16_extra_cases)
788 (bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *,
789 bfd_byte *, unsigned int *, unsigned int *);
791 int (*_bfd_coff_reloc16_estimate)
792 (bfd *, asection *, arelent *, unsigned int,
793 struct bfd_link_info *);
795 enum coff_symbol_classification (*_bfd_coff_classify_symbol)
796 (bfd *, struct internal_syment *);
798 bfd_boolean (*_bfd_coff_compute_section_file_positions)
801 bfd_boolean (*_bfd_coff_start_final_link)
802 (bfd *, struct bfd_link_info *);
804 bfd_boolean (*_bfd_coff_relocate_section)
805 (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
806 struct internal_reloc *, struct internal_syment *, asection **);
808 reloc_howto_type *(*_bfd_coff_rtype_to_howto)
809 (bfd *, asection *, struct internal_reloc *,
810 struct coff_link_hash_entry *, struct internal_syment *, bfd_vma *);
812 bfd_boolean (*_bfd_coff_adjust_symndx)
813 (bfd *, struct bfd_link_info *, bfd *, asection *,
814 struct internal_reloc *, bfd_boolean *);
816 bfd_boolean (*_bfd_coff_link_add_one_symbol)
817 (struct bfd_link_info *, bfd *, const char *, flagword,
818 asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean,
819 struct bfd_link_hash_entry **);
821 bfd_boolean (*_bfd_coff_link_output_has_begun)
822 (bfd *, struct coff_final_link_info *);
824 bfd_boolean (*_bfd_coff_final_link_postscript)
825 (bfd *, struct coff_final_link_info *);
827 bfd_boolean (*_bfd_coff_print_pdata)
830 } bfd_coff_backend_data;
832 #define coff_backend_info(abfd) \
833 ((bfd_coff_backend_data *) (abfd)->xvec->backend_data)
835 #define bfd_coff_swap_aux_in(a,e,t,c,ind,num,i) \
836 ((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i))
838 #define bfd_coff_swap_sym_in(a,e,i) \
839 ((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i))
841 #define bfd_coff_swap_lineno_in(a,e,i) \
842 ((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i))
844 #define bfd_coff_swap_reloc_out(abfd, i, o) \
845 ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o))
847 #define bfd_coff_swap_lineno_out(abfd, i, o) \
848 ((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o))
850 #define bfd_coff_swap_aux_out(a,i,t,c,ind,num,o) \
851 ((coff_backend_info (a)->_bfd_coff_swap_aux_out) (a,i,t,c,ind,num,o))
853 #define bfd_coff_swap_sym_out(abfd, i,o) \
854 ((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o))
856 #define bfd_coff_swap_scnhdr_out(abfd, i,o) \
857 ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o))
859 #define bfd_coff_swap_filehdr_out(abfd, i,o) \
860 ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o))
862 #define bfd_coff_swap_aouthdr_out(abfd, i,o) \
863 ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o))
865 #define bfd_coff_filhsz(abfd) (coff_backend_info (abfd)->_bfd_filhsz)
866 #define bfd_coff_aoutsz(abfd) (coff_backend_info (abfd)->_bfd_aoutsz)
867 #define bfd_coff_scnhsz(abfd) (coff_backend_info (abfd)->_bfd_scnhsz)
868 #define bfd_coff_symesz(abfd) (coff_backend_info (abfd)->_bfd_symesz)
869 #define bfd_coff_auxesz(abfd) (coff_backend_info (abfd)->_bfd_auxesz)
870 #define bfd_coff_relsz(abfd) (coff_backend_info (abfd)->_bfd_relsz)
871 #define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz)
872 #define bfd_coff_filnmlen(abfd) (coff_backend_info (abfd)->_bfd_filnmlen)
873 #define bfd_coff_long_filenames(abfd) \
874 (coff_backend_info (abfd)->_bfd_coff_long_filenames)
875 #define bfd_coff_long_section_names(abfd) \
876 (coff_backend_info (abfd)->_bfd_coff_long_section_names)
877 #define bfd_coff_set_long_section_names(abfd, enable) \
878 ((coff_backend_info (abfd)->_bfd_coff_set_long_section_names) (abfd, enable))
879 #define bfd_coff_default_section_alignment_power(abfd) \
880 (coff_backend_info (abfd)->_bfd_coff_default_section_alignment_power)
881 #define bfd_coff_max_nscns(abfd) \
882 (coff_backend_info (abfd)->_bfd_coff_max_nscns)
884 #define bfd_coff_swap_filehdr_in(abfd, i,o) \
885 ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o))
887 #define bfd_coff_swap_aouthdr_in(abfd, i,o) \
888 ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o))
890 #define bfd_coff_swap_scnhdr_in(abfd, i,o) \
891 ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o))
893 #define bfd_coff_swap_reloc_in(abfd, i, o) \
894 ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_in) (abfd, i, o))
896 #define bfd_coff_bad_format_hook(abfd, filehdr) \
897 ((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr))
899 #define bfd_coff_set_arch_mach_hook(abfd, filehdr)\
900 ((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr))
901 #define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\
902 ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook)\
903 (abfd, filehdr, aouthdr))
905 #define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name, section, flags_ptr)\
906 ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook)\
907 (abfd, scnhdr, name, section, flags_ptr))
909 #define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\
910 ((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr))
912 #define bfd_coff_slurp_symbol_table(abfd)\
913 ((coff_backend_info (abfd)->_bfd_coff_slurp_symbol_table) (abfd))
915 #define bfd_coff_symname_in_debug(abfd, sym)\
916 ((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym))
918 #define bfd_coff_force_symnames_in_strings(abfd)\
919 (coff_backend_info (abfd)->_bfd_coff_force_symnames_in_strings)
921 #define bfd_coff_debug_string_prefix_length(abfd)\
922 (coff_backend_info (abfd)->_bfd_coff_debug_string_prefix_length)
924 #define bfd_coff_print_aux(abfd, file, base, symbol, aux, indaux)\
925 ((coff_backend_info (abfd)->_bfd_coff_print_aux)\
926 (abfd, file, base, symbol, aux, indaux))
928 #define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order,\
929 reloc, data, src_ptr, dst_ptr)\
930 ((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\
931 (abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr))
933 #define bfd_coff_reloc16_estimate(abfd, section, reloc, shrink, link_info)\
934 ((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\
935 (abfd, section, reloc, shrink, link_info))
937 #define bfd_coff_classify_symbol(abfd, sym)\
938 ((coff_backend_info (abfd)->_bfd_coff_classify_symbol)\
941 #define bfd_coff_compute_section_file_positions(abfd)\
942 ((coff_backend_info (abfd)->_bfd_coff_compute_section_file_positions)\
945 #define bfd_coff_start_final_link(obfd, info)\
946 ((coff_backend_info (obfd)->_bfd_coff_start_final_link)\
948 #define bfd_coff_relocate_section(obfd,info,ibfd,o,con,rel,isyms,secs)\
949 ((coff_backend_info (ibfd)->_bfd_coff_relocate_section)\
950 (obfd, info, ibfd, o, con, rel, isyms, secs))
951 #define bfd_coff_rtype_to_howto(abfd, sec, rel, h, sym, addendp)\
952 ((coff_backend_info (abfd)->_bfd_coff_rtype_to_howto)\
953 (abfd, sec, rel, h, sym, addendp))
954 #define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\
955 ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\
956 (obfd, info, ibfd, sec, rel, adjustedp))
957 #define bfd_coff_link_add_one_symbol(info, abfd, name, flags, section,\
958 value, string, cp, coll, hashp)\
959 ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\
960 (info, abfd, name, flags, section, value, string, cp, coll, hashp))
962 #define bfd_coff_link_output_has_begun(a,p) \
963 ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a, p))
964 #define bfd_coff_final_link_postscript(a,p) \
965 ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a, p))
967 #define bfd_coff_have_print_pdata(a) \
968 (coff_backend_info (a)->_bfd_coff_print_pdata)
969 #define bfd_coff_print_pdata(a,p) \
970 ((coff_backend_info (a)->_bfd_coff_print_pdata) (a, p))
972 /* Macro: Returns true if the bfd is a PE executable as opposed to a
974 #define bfd_pei_p(abfd) \
975 (CONST_STRNEQ ((abfd)->xvec->name, "pei-"))