1*3d8817e4Smiod /* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically 2*3d8817e4Smiod generated from "libcoff-in.h" and "coffcode.h". 3*3d8817e4Smiod Run "make headers" in your build bfd/ to regenerate. */ 4*3d8817e4Smiod 5*3d8817e4Smiod /* BFD COFF object file private structure. 6*3d8817e4Smiod Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 7*3d8817e4Smiod 2000, 2001, 2002, 2003, 2004, 2005, 2006 8*3d8817e4Smiod Free Software Foundation, Inc. 9*3d8817e4Smiod Written by Cygnus Support. 10*3d8817e4Smiod 11*3d8817e4Smiod This file is part of BFD, the Binary File Descriptor library. 12*3d8817e4Smiod 13*3d8817e4Smiod This program is free software; you can redistribute it and/or modify 14*3d8817e4Smiod it under the terms of the GNU General Public License as published by 15*3d8817e4Smiod the Free Software Foundation; either version 2 of the License, or 16*3d8817e4Smiod (at your option) any later version. 17*3d8817e4Smiod 18*3d8817e4Smiod This program is distributed in the hope that it will be useful, 19*3d8817e4Smiod but WITHOUT ANY WARRANTY; without even the implied warranty of 20*3d8817e4Smiod MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21*3d8817e4Smiod GNU General Public License for more details. 22*3d8817e4Smiod 23*3d8817e4Smiod You should have received a copy of the GNU General Public License 24*3d8817e4Smiod along with this program; if not, write to the Free Software 25*3d8817e4Smiod Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 26*3d8817e4Smiod 27*3d8817e4Smiod #include "bfdlink.h" 28*3d8817e4Smiod 29*3d8817e4Smiod /* Object file tdata; access macros. */ 30*3d8817e4Smiod 31*3d8817e4Smiod #define coff_data(bfd) ((bfd)->tdata.coff_obj_data) 32*3d8817e4Smiod #define exec_hdr(bfd) (coff_data (bfd)->hdr) 33*3d8817e4Smiod #define obj_pe(bfd) (coff_data (bfd)->pe) 34*3d8817e4Smiod #define obj_symbols(bfd) (coff_data (bfd)->symbols) 35*3d8817e4Smiod #define obj_sym_filepos(bfd) (coff_data (bfd)->sym_filepos) 36*3d8817e4Smiod #define obj_relocbase(bfd) (coff_data (bfd)->relocbase) 37*3d8817e4Smiod #define obj_raw_syments(bfd) (coff_data (bfd)->raw_syments) 38*3d8817e4Smiod #define obj_raw_syment_count(bfd) (coff_data (bfd)->raw_syment_count) 39*3d8817e4Smiod #define obj_convert(bfd) (coff_data (bfd)->conversion_table) 40*3d8817e4Smiod #define obj_conv_table_size(bfd) (coff_data (bfd)->conv_table_size) 41*3d8817e4Smiod #define obj_coff_external_syms(bfd) (coff_data (bfd)->external_syms) 42*3d8817e4Smiod #define obj_coff_keep_syms(bfd) (coff_data (bfd)->keep_syms) 43*3d8817e4Smiod #define obj_coff_strings(bfd) (coff_data (bfd)->strings) 44*3d8817e4Smiod #define obj_coff_keep_strings(bfd) (coff_data (bfd)->keep_strings) 45*3d8817e4Smiod #define obj_coff_sym_hashes(bfd) (coff_data (bfd)->sym_hashes) 46*3d8817e4Smiod #define obj_coff_strings_written(bfd) (coff_data (bfd)->strings_written) 47*3d8817e4Smiod #define obj_coff_local_toc_table(bfd) (coff_data (bfd)->local_toc_sym_map) 48*3d8817e4Smiod 49*3d8817e4Smiod /* `Tdata' information kept for COFF files. */ 50*3d8817e4Smiod 51*3d8817e4Smiod typedef struct coff_tdata 52*3d8817e4Smiod { 53*3d8817e4Smiod struct coff_symbol_struct *symbols; /* Symtab for input bfd. */ 54*3d8817e4Smiod unsigned int *conversion_table; 55*3d8817e4Smiod int conv_table_size; 56*3d8817e4Smiod file_ptr sym_filepos; 57*3d8817e4Smiod 58*3d8817e4Smiod struct coff_ptr_struct *raw_syments; 59*3d8817e4Smiod unsigned long raw_syment_count; 60*3d8817e4Smiod 61*3d8817e4Smiod /* These are only valid once writing has begun. */ 62*3d8817e4Smiod long int relocbase; 63*3d8817e4Smiod 64*3d8817e4Smiod /* These members communicate important constants about the symbol table 65*3d8817e4Smiod to GDB's symbol-reading code. These `constants' unfortunately vary 66*3d8817e4Smiod from coff implementation to implementation... */ 67*3d8817e4Smiod unsigned local_n_btmask; 68*3d8817e4Smiod unsigned local_n_btshft; 69*3d8817e4Smiod unsigned local_n_tmask; 70*3d8817e4Smiod unsigned local_n_tshift; 71*3d8817e4Smiod unsigned local_symesz; 72*3d8817e4Smiod unsigned local_auxesz; 73*3d8817e4Smiod unsigned local_linesz; 74*3d8817e4Smiod 75*3d8817e4Smiod /* The unswapped external symbols. May be NULL. Read by 76*3d8817e4Smiod _bfd_coff_get_external_symbols. */ 77*3d8817e4Smiod void * external_syms; 78*3d8817e4Smiod /* If this is TRUE, the external_syms may not be freed. */ 79*3d8817e4Smiod bfd_boolean keep_syms; 80*3d8817e4Smiod 81*3d8817e4Smiod /* The string table. May be NULL. Read by 82*3d8817e4Smiod _bfd_coff_read_string_table. */ 83*3d8817e4Smiod char *strings; 84*3d8817e4Smiod /* If this is TRUE, the strings may not be freed. */ 85*3d8817e4Smiod bfd_boolean keep_strings; 86*3d8817e4Smiod /* If this is TRUE, the strings have been written out already. */ 87*3d8817e4Smiod bfd_boolean strings_written; 88*3d8817e4Smiod 89*3d8817e4Smiod /* Is this a PE format coff file? */ 90*3d8817e4Smiod int pe; 91*3d8817e4Smiod /* Used by the COFF backend linker. */ 92*3d8817e4Smiod struct coff_link_hash_entry **sym_hashes; 93*3d8817e4Smiod 94*3d8817e4Smiod /* Used by the pe linker for PowerPC. */ 95*3d8817e4Smiod int *local_toc_sym_map; 96*3d8817e4Smiod 97*3d8817e4Smiod struct bfd_link_info *link_info; 98*3d8817e4Smiod 99*3d8817e4Smiod /* Used by coff_find_nearest_line. */ 100*3d8817e4Smiod void * line_info; 101*3d8817e4Smiod 102*3d8817e4Smiod /* A place to stash dwarf2 info for this bfd. */ 103*3d8817e4Smiod void * dwarf2_find_line_info; 104*3d8817e4Smiod 105*3d8817e4Smiod /* The timestamp from the COFF file header. */ 106*3d8817e4Smiod long timestamp; 107*3d8817e4Smiod 108*3d8817e4Smiod /* Copy of some of the f_flags bits in the COFF filehdr structure, 109*3d8817e4Smiod used by ARM code. */ 110*3d8817e4Smiod flagword flags; 111*3d8817e4Smiod 112*3d8817e4Smiod } coff_data_type; 113*3d8817e4Smiod 114*3d8817e4Smiod /* Tdata for pe image files. */ 115*3d8817e4Smiod typedef struct pe_tdata 116*3d8817e4Smiod { 117*3d8817e4Smiod coff_data_type coff; 118*3d8817e4Smiod struct internal_extra_pe_aouthdr pe_opthdr; 119*3d8817e4Smiod int dll; 120*3d8817e4Smiod int has_reloc_section; 121*3d8817e4Smiod bfd_boolean (*in_reloc_p) (bfd *, reloc_howto_type *); 122*3d8817e4Smiod flagword real_flags; 123*3d8817e4Smiod int target_subsystem; 124*3d8817e4Smiod bfd_boolean force_minimum_alignment; 125*3d8817e4Smiod } pe_data_type; 126*3d8817e4Smiod 127*3d8817e4Smiod #define pe_data(bfd) ((bfd)->tdata.pe_obj_data) 128*3d8817e4Smiod 129*3d8817e4Smiod /* Tdata for XCOFF files. */ 130*3d8817e4Smiod 131*3d8817e4Smiod struct xcoff_tdata 132*3d8817e4Smiod { 133*3d8817e4Smiod /* Basic COFF information. */ 134*3d8817e4Smiod coff_data_type coff; 135*3d8817e4Smiod 136*3d8817e4Smiod /* TRUE if this is an XCOFF64 file. */ 137*3d8817e4Smiod bfd_boolean xcoff64; 138*3d8817e4Smiod 139*3d8817e4Smiod /* TRUE if a large a.out header should be generated. */ 140*3d8817e4Smiod bfd_boolean full_aouthdr; 141*3d8817e4Smiod 142*3d8817e4Smiod /* TOC value. */ 143*3d8817e4Smiod bfd_vma toc; 144*3d8817e4Smiod 145*3d8817e4Smiod /* Index of section holding TOC. */ 146*3d8817e4Smiod int sntoc; 147*3d8817e4Smiod 148*3d8817e4Smiod /* Index of section holding entry point. */ 149*3d8817e4Smiod int snentry; 150*3d8817e4Smiod 151*3d8817e4Smiod /* .text alignment from optional header. */ 152*3d8817e4Smiod int text_align_power; 153*3d8817e4Smiod 154*3d8817e4Smiod /* .data alignment from optional header. */ 155*3d8817e4Smiod int data_align_power; 156*3d8817e4Smiod 157*3d8817e4Smiod /* modtype from optional header. */ 158*3d8817e4Smiod short modtype; 159*3d8817e4Smiod 160*3d8817e4Smiod /* cputype from optional header. */ 161*3d8817e4Smiod short cputype; 162*3d8817e4Smiod 163*3d8817e4Smiod /* maxdata from optional header. */ 164*3d8817e4Smiod bfd_vma maxdata; 165*3d8817e4Smiod 166*3d8817e4Smiod /* maxstack from optional header. */ 167*3d8817e4Smiod bfd_vma maxstack; 168*3d8817e4Smiod 169*3d8817e4Smiod /* Used by the XCOFF backend linker. */ 170*3d8817e4Smiod asection **csects; 171*3d8817e4Smiod unsigned long *debug_indices; 172*3d8817e4Smiod unsigned int import_file_id; 173*3d8817e4Smiod }; 174*3d8817e4Smiod 175*3d8817e4Smiod #define xcoff_data(abfd) ((abfd)->tdata.xcoff_obj_data) 176*3d8817e4Smiod 177*3d8817e4Smiod /* We take the address of the first element of an asymbol to ensure that the 178*3d8817e4Smiod macro is only ever applied to an asymbol. */ 179*3d8817e4Smiod #define coffsymbol(asymbol) ((coff_symbol_type *)(&((asymbol)->the_bfd))) 180*3d8817e4Smiod 181*3d8817e4Smiod /* The used_by_bfd field of a section may be set to a pointer to this 182*3d8817e4Smiod structure. */ 183*3d8817e4Smiod 184*3d8817e4Smiod struct coff_section_tdata 185*3d8817e4Smiod { 186*3d8817e4Smiod /* The relocs, swapped into COFF internal form. This may be NULL. */ 187*3d8817e4Smiod struct internal_reloc *relocs; 188*3d8817e4Smiod /* If this is TRUE, the relocs entry may not be freed. */ 189*3d8817e4Smiod bfd_boolean keep_relocs; 190*3d8817e4Smiod /* The section contents. This may be NULL. */ 191*3d8817e4Smiod bfd_byte *contents; 192*3d8817e4Smiod /* If this is TRUE, the contents entry may not be freed. */ 193*3d8817e4Smiod bfd_boolean keep_contents; 194*3d8817e4Smiod /* Information cached by coff_find_nearest_line. */ 195*3d8817e4Smiod bfd_vma offset; 196*3d8817e4Smiod unsigned int i; 197*3d8817e4Smiod const char *function; 198*3d8817e4Smiod /* Optional information about a COMDAT entry; NULL if not COMDAT. */ 199*3d8817e4Smiod struct coff_comdat_info *comdat; 200*3d8817e4Smiod int line_base; 201*3d8817e4Smiod /* A pointer used for .stab linking optimizations. */ 202*3d8817e4Smiod void * stab_info; 203*3d8817e4Smiod /* Available for individual backends. */ 204*3d8817e4Smiod void * tdata; 205*3d8817e4Smiod }; 206*3d8817e4Smiod 207*3d8817e4Smiod /* An accessor macro for the coff_section_tdata structure. */ 208*3d8817e4Smiod #define coff_section_data(abfd, sec) \ 209*3d8817e4Smiod ((struct coff_section_tdata *) (sec)->used_by_bfd) 210*3d8817e4Smiod 211*3d8817e4Smiod /* Tdata for sections in XCOFF files. This is used by the linker. */ 212*3d8817e4Smiod 213*3d8817e4Smiod struct xcoff_section_tdata 214*3d8817e4Smiod { 215*3d8817e4Smiod /* Used for XCOFF csects created by the linker; points to the real 216*3d8817e4Smiod XCOFF section which contains this csect. */ 217*3d8817e4Smiod asection *enclosing; 218*3d8817e4Smiod /* The lineno_count field for the enclosing section, because we are 219*3d8817e4Smiod going to clobber it there. */ 220*3d8817e4Smiod unsigned int lineno_count; 221*3d8817e4Smiod /* The first and one past the last symbol indices for symbols used 222*3d8817e4Smiod by this csect. */ 223*3d8817e4Smiod unsigned long first_symndx; 224*3d8817e4Smiod unsigned long last_symndx; 225*3d8817e4Smiod }; 226*3d8817e4Smiod 227*3d8817e4Smiod /* An accessor macro the xcoff_section_tdata structure. */ 228*3d8817e4Smiod #define xcoff_section_data(abfd, sec) \ 229*3d8817e4Smiod ((struct xcoff_section_tdata *) coff_section_data ((abfd), (sec))->tdata) 230*3d8817e4Smiod 231*3d8817e4Smiod /* Tdata for sections in PE files. */ 232*3d8817e4Smiod 233*3d8817e4Smiod struct pei_section_tdata 234*3d8817e4Smiod { 235*3d8817e4Smiod /* The virtual size of the section. */ 236*3d8817e4Smiod bfd_size_type virt_size; 237*3d8817e4Smiod /* The PE section flags. */ 238*3d8817e4Smiod long pe_flags; 239*3d8817e4Smiod }; 240*3d8817e4Smiod 241*3d8817e4Smiod /* An accessor macro for the pei_section_tdata structure. */ 242*3d8817e4Smiod #define pei_section_data(abfd, sec) \ 243*3d8817e4Smiod ((struct pei_section_tdata *) coff_section_data ((abfd), (sec))->tdata) 244*3d8817e4Smiod 245*3d8817e4Smiod /* COFF linker hash table entries. */ 246*3d8817e4Smiod 247*3d8817e4Smiod struct coff_link_hash_entry 248*3d8817e4Smiod { 249*3d8817e4Smiod struct bfd_link_hash_entry root; 250*3d8817e4Smiod 251*3d8817e4Smiod /* Symbol index in output file. Set to -1 initially. Set to -2 if 252*3d8817e4Smiod there is a reloc against this symbol. */ 253*3d8817e4Smiod long indx; 254*3d8817e4Smiod 255*3d8817e4Smiod /* Symbol type. */ 256*3d8817e4Smiod unsigned short type; 257*3d8817e4Smiod 258*3d8817e4Smiod /* Symbol class. */ 259*3d8817e4Smiod unsigned char class; 260*3d8817e4Smiod 261*3d8817e4Smiod /* Number of auxiliary entries. */ 262*3d8817e4Smiod char numaux; 263*3d8817e4Smiod 264*3d8817e4Smiod /* BFD to take auxiliary entries from. */ 265*3d8817e4Smiod bfd *auxbfd; 266*3d8817e4Smiod 267*3d8817e4Smiod /* Pointer to array of auxiliary entries, if any. */ 268*3d8817e4Smiod union internal_auxent *aux; 269*3d8817e4Smiod 270*3d8817e4Smiod /* Flag word; legal values follow. */ 271*3d8817e4Smiod unsigned short coff_link_hash_flags; 272*3d8817e4Smiod /* Symbol is a PE section symbol. */ 273*3d8817e4Smiod #define COFF_LINK_HASH_PE_SECTION_SYMBOL (01) 274*3d8817e4Smiod }; 275*3d8817e4Smiod 276*3d8817e4Smiod /* COFF linker hash table. */ 277*3d8817e4Smiod 278*3d8817e4Smiod struct coff_link_hash_table 279*3d8817e4Smiod { 280*3d8817e4Smiod struct bfd_link_hash_table root; 281*3d8817e4Smiod /* A pointer to information used to link stabs in sections. */ 282*3d8817e4Smiod struct stab_info stab_info; 283*3d8817e4Smiod }; 284*3d8817e4Smiod 285*3d8817e4Smiod /* Look up an entry in a COFF linker hash table. */ 286*3d8817e4Smiod 287*3d8817e4Smiod #define coff_link_hash_lookup(table, string, create, copy, follow) \ 288*3d8817e4Smiod ((struct coff_link_hash_entry *) \ 289*3d8817e4Smiod bfd_link_hash_lookup (&(table)->root, (string), (create), \ 290*3d8817e4Smiod (copy), (follow))) 291*3d8817e4Smiod 292*3d8817e4Smiod /* Traverse a COFF linker hash table. */ 293*3d8817e4Smiod 294*3d8817e4Smiod #define coff_link_hash_traverse(table, func, info) \ 295*3d8817e4Smiod (bfd_link_hash_traverse \ 296*3d8817e4Smiod (&(table)->root, \ 297*3d8817e4Smiod (bfd_boolean (*) (struct bfd_link_hash_entry *, void *)) (func), \ 298*3d8817e4Smiod (info))) 299*3d8817e4Smiod 300*3d8817e4Smiod /* Get the COFF linker hash table from a link_info structure. */ 301*3d8817e4Smiod 302*3d8817e4Smiod #define coff_hash_table(p) ((struct coff_link_hash_table *) ((p)->hash)) 303*3d8817e4Smiod 304*3d8817e4Smiod /* Functions in coffgen.c. */ 305*3d8817e4Smiod extern const bfd_target *coff_object_p 306*3d8817e4Smiod (bfd *); 307*3d8817e4Smiod extern struct bfd_section *coff_section_from_bfd_index 308*3d8817e4Smiod (bfd *, int); 309*3d8817e4Smiod extern long coff_get_symtab_upper_bound 310*3d8817e4Smiod (bfd *); 311*3d8817e4Smiod extern long coff_canonicalize_symtab 312*3d8817e4Smiod (bfd *, asymbol **); 313*3d8817e4Smiod extern int coff_count_linenumbers 314*3d8817e4Smiod (bfd *); 315*3d8817e4Smiod extern struct coff_symbol_struct *coff_symbol_from 316*3d8817e4Smiod (bfd *, asymbol *); 317*3d8817e4Smiod extern bfd_boolean coff_renumber_symbols 318*3d8817e4Smiod (bfd *, int *); 319*3d8817e4Smiod extern void coff_mangle_symbols 320*3d8817e4Smiod (bfd *); 321*3d8817e4Smiod extern bfd_boolean coff_write_symbols 322*3d8817e4Smiod (bfd *); 323*3d8817e4Smiod extern bfd_boolean coff_write_linenumbers 324*3d8817e4Smiod (bfd *); 325*3d8817e4Smiod extern alent *coff_get_lineno 326*3d8817e4Smiod (bfd *, asymbol *); 327*3d8817e4Smiod extern asymbol *coff_section_symbol 328*3d8817e4Smiod (bfd *, char *); 329*3d8817e4Smiod extern bfd_boolean _bfd_coff_get_external_symbols 330*3d8817e4Smiod (bfd *); 331*3d8817e4Smiod extern const char *_bfd_coff_read_string_table 332*3d8817e4Smiod (bfd *); 333*3d8817e4Smiod extern bfd_boolean _bfd_coff_free_symbols 334*3d8817e4Smiod (bfd *); 335*3d8817e4Smiod extern struct coff_ptr_struct *coff_get_normalized_symtab 336*3d8817e4Smiod (bfd *); 337*3d8817e4Smiod extern long coff_get_reloc_upper_bound 338*3d8817e4Smiod (bfd *, sec_ptr); 339*3d8817e4Smiod extern asymbol *coff_make_empty_symbol 340*3d8817e4Smiod (bfd *); 341*3d8817e4Smiod extern void coff_print_symbol 342*3d8817e4Smiod (bfd *, void * filep, asymbol *, bfd_print_symbol_type); 343*3d8817e4Smiod extern void coff_get_symbol_info 344*3d8817e4Smiod (bfd *, asymbol *, symbol_info *ret); 345*3d8817e4Smiod extern bfd_boolean _bfd_coff_is_local_label_name 346*3d8817e4Smiod (bfd *, const char *); 347*3d8817e4Smiod extern asymbol *coff_bfd_make_debug_symbol 348*3d8817e4Smiod (bfd *, void *, unsigned long); 349*3d8817e4Smiod extern bfd_boolean coff_find_nearest_line 350*3d8817e4Smiod (bfd *, asection *, asymbol **, bfd_vma, const char **, 351*3d8817e4Smiod const char **, unsigned int *); 352*3d8817e4Smiod extern bfd_boolean coff_find_inliner_info 353*3d8817e4Smiod (bfd *, const char **, const char **, unsigned int *); 354*3d8817e4Smiod extern int coff_sizeof_headers 355*3d8817e4Smiod (bfd *, bfd_boolean); 356*3d8817e4Smiod extern bfd_boolean bfd_coff_reloc16_relax_section 357*3d8817e4Smiod (bfd *, asection *, struct bfd_link_info *, bfd_boolean *); 358*3d8817e4Smiod extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents 359*3d8817e4Smiod (bfd *, struct bfd_link_info *, struct bfd_link_order *, 360*3d8817e4Smiod bfd_byte *, bfd_boolean, asymbol **); 361*3d8817e4Smiod extern bfd_vma bfd_coff_reloc16_get_value 362*3d8817e4Smiod (arelent *, struct bfd_link_info *, asection *); 363*3d8817e4Smiod extern void bfd_perform_slip 364*3d8817e4Smiod (bfd *, unsigned int, asection *, bfd_vma); 365*3d8817e4Smiod 366*3d8817e4Smiod /* Functions and types in cofflink.c. */ 367*3d8817e4Smiod 368*3d8817e4Smiod #define STRING_SIZE_SIZE 4 369*3d8817e4Smiod 370*3d8817e4Smiod /* We use a hash table to merge identical enum, struct, and union 371*3d8817e4Smiod definitions in the linker. */ 372*3d8817e4Smiod 373*3d8817e4Smiod /* Information we keep for a single element (an enum value, a 374*3d8817e4Smiod structure or union field) in the debug merge hash table. */ 375*3d8817e4Smiod 376*3d8817e4Smiod struct coff_debug_merge_element 377*3d8817e4Smiod { 378*3d8817e4Smiod /* Next element. */ 379*3d8817e4Smiod struct coff_debug_merge_element *next; 380*3d8817e4Smiod 381*3d8817e4Smiod /* Name. */ 382*3d8817e4Smiod const char *name; 383*3d8817e4Smiod 384*3d8817e4Smiod /* Type. */ 385*3d8817e4Smiod unsigned int type; 386*3d8817e4Smiod 387*3d8817e4Smiod /* Symbol index for complex type. */ 388*3d8817e4Smiod long tagndx; 389*3d8817e4Smiod }; 390*3d8817e4Smiod 391*3d8817e4Smiod /* A linked list of debug merge entries for a given name. */ 392*3d8817e4Smiod 393*3d8817e4Smiod struct coff_debug_merge_type 394*3d8817e4Smiod { 395*3d8817e4Smiod /* Next type with the same name. */ 396*3d8817e4Smiod struct coff_debug_merge_type *next; 397*3d8817e4Smiod 398*3d8817e4Smiod /* Class of type. */ 399*3d8817e4Smiod int class; 400*3d8817e4Smiod 401*3d8817e4Smiod /* Symbol index where this type is defined. */ 402*3d8817e4Smiod long indx; 403*3d8817e4Smiod 404*3d8817e4Smiod /* List of elements. */ 405*3d8817e4Smiod struct coff_debug_merge_element *elements; 406*3d8817e4Smiod }; 407*3d8817e4Smiod 408*3d8817e4Smiod /* Information we store in the debug merge hash table. */ 409*3d8817e4Smiod 410*3d8817e4Smiod struct coff_debug_merge_hash_entry 411*3d8817e4Smiod { 412*3d8817e4Smiod struct bfd_hash_entry root; 413*3d8817e4Smiod 414*3d8817e4Smiod /* A list of types with this name. */ 415*3d8817e4Smiod struct coff_debug_merge_type *types; 416*3d8817e4Smiod }; 417*3d8817e4Smiod 418*3d8817e4Smiod /* The debug merge hash table. */ 419*3d8817e4Smiod 420*3d8817e4Smiod struct coff_debug_merge_hash_table 421*3d8817e4Smiod { 422*3d8817e4Smiod struct bfd_hash_table root; 423*3d8817e4Smiod }; 424*3d8817e4Smiod 425*3d8817e4Smiod /* Initialize a COFF debug merge hash table. */ 426*3d8817e4Smiod 427*3d8817e4Smiod #define coff_debug_merge_hash_table_init(table) \ 428*3d8817e4Smiod (bfd_hash_table_init (&(table)->root, _bfd_coff_debug_merge_hash_newfunc, \ 429*3d8817e4Smiod sizeof (struct coff_debug_merge_hash_entry))) 430*3d8817e4Smiod 431*3d8817e4Smiod /* Free a COFF debug merge hash table. */ 432*3d8817e4Smiod 433*3d8817e4Smiod #define coff_debug_merge_hash_table_free(table) \ 434*3d8817e4Smiod (bfd_hash_table_free (&(table)->root)) 435*3d8817e4Smiod 436*3d8817e4Smiod /* Look up an entry in a COFF debug merge hash table. */ 437*3d8817e4Smiod 438*3d8817e4Smiod #define coff_debug_merge_hash_lookup(table, string, create, copy) \ 439*3d8817e4Smiod ((struct coff_debug_merge_hash_entry *) \ 440*3d8817e4Smiod bfd_hash_lookup (&(table)->root, (string), (create), (copy))) 441*3d8817e4Smiod 442*3d8817e4Smiod /* Information we keep for each section in the output file when doing 443*3d8817e4Smiod a relocatable link. */ 444*3d8817e4Smiod 445*3d8817e4Smiod struct coff_link_section_info 446*3d8817e4Smiod { 447*3d8817e4Smiod /* The relocs to be output. */ 448*3d8817e4Smiod struct internal_reloc *relocs; 449*3d8817e4Smiod /* For each reloc against a global symbol whose index was not known 450*3d8817e4Smiod when the reloc was handled, the global hash table entry. */ 451*3d8817e4Smiod struct coff_link_hash_entry **rel_hashes; 452*3d8817e4Smiod }; 453*3d8817e4Smiod 454*3d8817e4Smiod /* Information that we pass around while doing the final link step. */ 455*3d8817e4Smiod 456*3d8817e4Smiod struct coff_final_link_info 457*3d8817e4Smiod { 458*3d8817e4Smiod /* General link information. */ 459*3d8817e4Smiod struct bfd_link_info *info; 460*3d8817e4Smiod /* Output BFD. */ 461*3d8817e4Smiod bfd *output_bfd; 462*3d8817e4Smiod /* Used to indicate failure in traversal routine. */ 463*3d8817e4Smiod bfd_boolean failed; 464*3d8817e4Smiod /* If doing "task linking" set only during the time when we want the 465*3d8817e4Smiod global symbol writer to convert the storage class of defined global 466*3d8817e4Smiod symbols from global to static. */ 467*3d8817e4Smiod bfd_boolean global_to_static; 468*3d8817e4Smiod /* Hash table for long symbol names. */ 469*3d8817e4Smiod struct bfd_strtab_hash *strtab; 470*3d8817e4Smiod /* When doing a relocatable link, an array of information kept for 471*3d8817e4Smiod each output section, indexed by the target_index field. */ 472*3d8817e4Smiod struct coff_link_section_info *section_info; 473*3d8817e4Smiod /* Symbol index of last C_FILE symbol (-1 if none). */ 474*3d8817e4Smiod long last_file_index; 475*3d8817e4Smiod /* Contents of last C_FILE symbol. */ 476*3d8817e4Smiod struct internal_syment last_file; 477*3d8817e4Smiod /* Symbol index of first aux entry of last .bf symbol with an empty 478*3d8817e4Smiod endndx field (-1 if none). */ 479*3d8817e4Smiod long last_bf_index; 480*3d8817e4Smiod /* Contents of last_bf_index aux entry. */ 481*3d8817e4Smiod union internal_auxent last_bf; 482*3d8817e4Smiod /* Hash table used to merge debug information. */ 483*3d8817e4Smiod struct coff_debug_merge_hash_table debug_merge; 484*3d8817e4Smiod /* Buffer large enough to hold swapped symbols of any input file. */ 485*3d8817e4Smiod struct internal_syment *internal_syms; 486*3d8817e4Smiod /* Buffer large enough to hold sections of symbols of any input file. */ 487*3d8817e4Smiod asection **sec_ptrs; 488*3d8817e4Smiod /* Buffer large enough to hold output indices of symbols of any 489*3d8817e4Smiod input file. */ 490*3d8817e4Smiod long *sym_indices; 491*3d8817e4Smiod /* Buffer large enough to hold output symbols for any input file. */ 492*3d8817e4Smiod bfd_byte *outsyms; 493*3d8817e4Smiod /* Buffer large enough to hold external line numbers for any input 494*3d8817e4Smiod section. */ 495*3d8817e4Smiod bfd_byte *linenos; 496*3d8817e4Smiod /* Buffer large enough to hold any input section. */ 497*3d8817e4Smiod bfd_byte *contents; 498*3d8817e4Smiod /* Buffer large enough to hold external relocs of any input section. */ 499*3d8817e4Smiod bfd_byte *external_relocs; 500*3d8817e4Smiod /* Buffer large enough to hold swapped relocs of any input section. */ 501*3d8817e4Smiod struct internal_reloc *internal_relocs; 502*3d8817e4Smiod }; 503*3d8817e4Smiod 504*3d8817e4Smiod /* Most COFF variants have no way to record the alignment of a 505*3d8817e4Smiod section. This struct is used to set a specific alignment based on 506*3d8817e4Smiod the name of the section. */ 507*3d8817e4Smiod 508*3d8817e4Smiod struct coff_section_alignment_entry 509*3d8817e4Smiod { 510*3d8817e4Smiod /* The section name. */ 511*3d8817e4Smiod const char *name; 512*3d8817e4Smiod 513*3d8817e4Smiod /* This is either (unsigned int) -1, indicating that the section 514*3d8817e4Smiod name must match exactly, or it is the number of letters which 515*3d8817e4Smiod must match at the start of the name. */ 516*3d8817e4Smiod unsigned int comparison_length; 517*3d8817e4Smiod 518*3d8817e4Smiod /* These macros may be used to fill in the first two fields in a 519*3d8817e4Smiod structure initialization. */ 520*3d8817e4Smiod #define COFF_SECTION_NAME_EXACT_MATCH(name) (name), ((unsigned int) -1) 521*3d8817e4Smiod #define COFF_SECTION_NAME_PARTIAL_MATCH(name) (name), (sizeof (name) - 1) 522*3d8817e4Smiod 523*3d8817e4Smiod /* Only use this entry if the default section alignment for this 524*3d8817e4Smiod target is at least that much (as a power of two). If this field 525*3d8817e4Smiod is COFF_ALIGNMENT_FIELD_EMPTY, it should be ignored. */ 526*3d8817e4Smiod unsigned int default_alignment_min; 527*3d8817e4Smiod 528*3d8817e4Smiod /* Only use this entry if the default section alignment for this 529*3d8817e4Smiod target is no greater than this (as a power of two). If this 530*3d8817e4Smiod field is COFF_ALIGNMENT_FIELD_EMPTY, it should be ignored. */ 531*3d8817e4Smiod unsigned int default_alignment_max; 532*3d8817e4Smiod 533*3d8817e4Smiod #define COFF_ALIGNMENT_FIELD_EMPTY ((unsigned int) -1) 534*3d8817e4Smiod 535*3d8817e4Smiod /* The desired alignment for this section (as a power of two). */ 536*3d8817e4Smiod unsigned int alignment_power; 537*3d8817e4Smiod }; 538*3d8817e4Smiod 539*3d8817e4Smiod extern struct bfd_hash_entry *_bfd_coff_link_hash_newfunc 540*3d8817e4Smiod (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); 541*3d8817e4Smiod extern bfd_boolean _bfd_coff_link_hash_table_init 542*3d8817e4Smiod (struct coff_link_hash_table *, bfd *, 543*3d8817e4Smiod struct bfd_hash_entry *(*) (struct bfd_hash_entry *, 544*3d8817e4Smiod struct bfd_hash_table *, 545*3d8817e4Smiod const char *), 546*3d8817e4Smiod unsigned int); 547*3d8817e4Smiod extern struct bfd_link_hash_table *_bfd_coff_link_hash_table_create 548*3d8817e4Smiod (bfd *); 549*3d8817e4Smiod extern const char *_bfd_coff_internal_syment_name 550*3d8817e4Smiod (bfd *, const struct internal_syment *, char *); 551*3d8817e4Smiod extern bfd_boolean _bfd_coff_link_add_symbols 552*3d8817e4Smiod (bfd *, struct bfd_link_info *); 553*3d8817e4Smiod extern bfd_boolean _bfd_coff_final_link 554*3d8817e4Smiod (bfd *, struct bfd_link_info *); 555*3d8817e4Smiod extern struct internal_reloc *_bfd_coff_read_internal_relocs 556*3d8817e4Smiod (bfd *, asection *, bfd_boolean, bfd_byte *, bfd_boolean, 557*3d8817e4Smiod struct internal_reloc *); 558*3d8817e4Smiod extern bfd_boolean _bfd_coff_generic_relocate_section 559*3d8817e4Smiod (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, 560*3d8817e4Smiod struct internal_reloc *, struct internal_syment *, asection **); 561*3d8817e4Smiod extern struct bfd_hash_entry *_bfd_coff_debug_merge_hash_newfunc 562*3d8817e4Smiod (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); 563*3d8817e4Smiod extern bfd_boolean _bfd_coff_write_global_sym 564*3d8817e4Smiod (struct coff_link_hash_entry *, void *); 565*3d8817e4Smiod extern bfd_boolean _bfd_coff_write_task_globals 566*3d8817e4Smiod (struct coff_link_hash_entry *, void *); 567*3d8817e4Smiod extern bfd_boolean _bfd_coff_link_input_bfd 568*3d8817e4Smiod (struct coff_final_link_info *, bfd *); 569*3d8817e4Smiod extern bfd_boolean _bfd_coff_reloc_link_order 570*3d8817e4Smiod (bfd *, struct coff_final_link_info *, asection *, 571*3d8817e4Smiod struct bfd_link_order *); 572*3d8817e4Smiod 573*3d8817e4Smiod 574*3d8817e4Smiod #define coff_get_section_contents_in_window \ 575*3d8817e4Smiod _bfd_generic_get_section_contents_in_window 576*3d8817e4Smiod 577*3d8817e4Smiod /* Functions in xcofflink.c. */ 578*3d8817e4Smiod 579*3d8817e4Smiod extern long _bfd_xcoff_get_dynamic_symtab_upper_bound 580*3d8817e4Smiod (bfd *); 581*3d8817e4Smiod extern long _bfd_xcoff_canonicalize_dynamic_symtab 582*3d8817e4Smiod (bfd *, asymbol **); 583*3d8817e4Smiod extern long _bfd_xcoff_get_dynamic_reloc_upper_bound 584*3d8817e4Smiod (bfd *); 585*3d8817e4Smiod extern long _bfd_xcoff_canonicalize_dynamic_reloc 586*3d8817e4Smiod (bfd *, arelent **, asymbol **); 587*3d8817e4Smiod extern struct bfd_link_hash_table *_bfd_xcoff_bfd_link_hash_table_create 588*3d8817e4Smiod (bfd *); 589*3d8817e4Smiod extern void _bfd_xcoff_bfd_link_hash_table_free 590*3d8817e4Smiod (struct bfd_link_hash_table *); 591*3d8817e4Smiod extern bfd_boolean _bfd_xcoff_bfd_link_add_symbols 592*3d8817e4Smiod (bfd *, struct bfd_link_info *); 593*3d8817e4Smiod extern bfd_boolean _bfd_xcoff_bfd_final_link 594*3d8817e4Smiod (bfd *, struct bfd_link_info *); 595*3d8817e4Smiod extern bfd_boolean _bfd_ppc_xcoff_relocate_section 596*3d8817e4Smiod (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, 597*3d8817e4Smiod struct internal_reloc *, struct internal_syment *, asection **); 598*3d8817e4Smiod 599*3d8817e4Smiod /* Functions in coff-ppc.c. FIXME: These are called be pe.em in the 600*3d8817e4Smiod linker, and so should start with bfd and be declared in bfd.h. */ 601*3d8817e4Smiod 602*3d8817e4Smiod extern bfd_boolean ppc_allocate_toc_section 603*3d8817e4Smiod (struct bfd_link_info *); 604*3d8817e4Smiod extern bfd_boolean ppc_process_before_allocation 605*3d8817e4Smiod (bfd *, struct bfd_link_info *); 606*3d8817e4Smiod 607*3d8817e4Smiod /* Extracted from coffcode.h. */ 608*3d8817e4Smiod typedef struct coff_ptr_struct 609*3d8817e4Smiod { 610*3d8817e4Smiod /* Remembers the offset from the first symbol in the file for 611*3d8817e4Smiod this symbol. Generated by coff_renumber_symbols. */ 612*3d8817e4Smiod unsigned int offset; 613*3d8817e4Smiod 614*3d8817e4Smiod /* Should the value of this symbol be renumbered. Used for 615*3d8817e4Smiod XCOFF C_BSTAT symbols. Set by coff_slurp_symbol_table. */ 616*3d8817e4Smiod unsigned int fix_value : 1; 617*3d8817e4Smiod 618*3d8817e4Smiod /* Should the tag field of this symbol be renumbered. 619*3d8817e4Smiod Created by coff_pointerize_aux. */ 620*3d8817e4Smiod unsigned int fix_tag : 1; 621*3d8817e4Smiod 622*3d8817e4Smiod /* Should the endidx field of this symbol be renumbered. 623*3d8817e4Smiod Created by coff_pointerize_aux. */ 624*3d8817e4Smiod unsigned int fix_end : 1; 625*3d8817e4Smiod 626*3d8817e4Smiod /* Should the x_csect.x_scnlen field be renumbered. 627*3d8817e4Smiod Created by coff_pointerize_aux. */ 628*3d8817e4Smiod unsigned int fix_scnlen : 1; 629*3d8817e4Smiod 630*3d8817e4Smiod /* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the 631*3d8817e4Smiod index into the line number entries. Set by coff_slurp_symbol_table. */ 632*3d8817e4Smiod unsigned int fix_line : 1; 633*3d8817e4Smiod 634*3d8817e4Smiod /* The container for the symbol structure as read and translated 635*3d8817e4Smiod from the file. */ 636*3d8817e4Smiod union 637*3d8817e4Smiod { 638*3d8817e4Smiod union internal_auxent auxent; 639*3d8817e4Smiod struct internal_syment syment; 640*3d8817e4Smiod } u; 641*3d8817e4Smiod } combined_entry_type; 642*3d8817e4Smiod 643*3d8817e4Smiod 644*3d8817e4Smiod /* Each canonical asymbol really looks like this: */ 645*3d8817e4Smiod 646*3d8817e4Smiod typedef struct coff_symbol_struct 647*3d8817e4Smiod { 648*3d8817e4Smiod /* The actual symbol which the rest of BFD works with */ 649*3d8817e4Smiod asymbol symbol; 650*3d8817e4Smiod 651*3d8817e4Smiod /* A pointer to the hidden information for this symbol */ 652*3d8817e4Smiod combined_entry_type *native; 653*3d8817e4Smiod 654*3d8817e4Smiod /* A pointer to the linenumber information for this symbol */ 655*3d8817e4Smiod struct lineno_cache_entry *lineno; 656*3d8817e4Smiod 657*3d8817e4Smiod /* Have the line numbers been relocated yet ? */ 658*3d8817e4Smiod bfd_boolean done_lineno; 659*3d8817e4Smiod } coff_symbol_type; 660*3d8817e4Smiod /* COFF symbol classifications. */ 661*3d8817e4Smiod 662*3d8817e4Smiod enum coff_symbol_classification 663*3d8817e4Smiod { 664*3d8817e4Smiod /* Global symbol. */ 665*3d8817e4Smiod COFF_SYMBOL_GLOBAL, 666*3d8817e4Smiod /* Common symbol. */ 667*3d8817e4Smiod COFF_SYMBOL_COMMON, 668*3d8817e4Smiod /* Undefined symbol. */ 669*3d8817e4Smiod COFF_SYMBOL_UNDEFINED, 670*3d8817e4Smiod /* Local symbol. */ 671*3d8817e4Smiod COFF_SYMBOL_LOCAL, 672*3d8817e4Smiod /* PE section symbol. */ 673*3d8817e4Smiod COFF_SYMBOL_PE_SECTION 674*3d8817e4Smiod }; 675*3d8817e4Smiod 676*3d8817e4Smiod typedef struct 677*3d8817e4Smiod { 678*3d8817e4Smiod void (*_bfd_coff_swap_aux_in) 679*3d8817e4Smiod (bfd *, void *, int, int, int, int, void *); 680*3d8817e4Smiod 681*3d8817e4Smiod void (*_bfd_coff_swap_sym_in) 682*3d8817e4Smiod (bfd *, void *, void *); 683*3d8817e4Smiod 684*3d8817e4Smiod void (*_bfd_coff_swap_lineno_in) 685*3d8817e4Smiod (bfd *, void *, void *); 686*3d8817e4Smiod 687*3d8817e4Smiod unsigned int (*_bfd_coff_swap_aux_out) 688*3d8817e4Smiod (bfd *, void *, int, int, int, int, void *); 689*3d8817e4Smiod 690*3d8817e4Smiod unsigned int (*_bfd_coff_swap_sym_out) 691*3d8817e4Smiod (bfd *, void *, void *); 692*3d8817e4Smiod 693*3d8817e4Smiod unsigned int (*_bfd_coff_swap_lineno_out) 694*3d8817e4Smiod (bfd *, void *, void *); 695*3d8817e4Smiod 696*3d8817e4Smiod unsigned int (*_bfd_coff_swap_reloc_out) 697*3d8817e4Smiod (bfd *, void *, void *); 698*3d8817e4Smiod 699*3d8817e4Smiod unsigned int (*_bfd_coff_swap_filehdr_out) 700*3d8817e4Smiod (bfd *, void *, void *); 701*3d8817e4Smiod 702*3d8817e4Smiod unsigned int (*_bfd_coff_swap_aouthdr_out) 703*3d8817e4Smiod (bfd *, void *, void *); 704*3d8817e4Smiod 705*3d8817e4Smiod unsigned int (*_bfd_coff_swap_scnhdr_out) 706*3d8817e4Smiod (bfd *, void *, void *); 707*3d8817e4Smiod 708*3d8817e4Smiod unsigned int _bfd_filhsz; 709*3d8817e4Smiod unsigned int _bfd_aoutsz; 710*3d8817e4Smiod unsigned int _bfd_scnhsz; 711*3d8817e4Smiod unsigned int _bfd_symesz; 712*3d8817e4Smiod unsigned int _bfd_auxesz; 713*3d8817e4Smiod unsigned int _bfd_relsz; 714*3d8817e4Smiod unsigned int _bfd_linesz; 715*3d8817e4Smiod unsigned int _bfd_filnmlen; 716*3d8817e4Smiod bfd_boolean _bfd_coff_long_filenames; 717*3d8817e4Smiod bfd_boolean _bfd_coff_long_section_names; 718*3d8817e4Smiod unsigned int _bfd_coff_default_section_alignment_power; 719*3d8817e4Smiod bfd_boolean _bfd_coff_force_symnames_in_strings; 720*3d8817e4Smiod unsigned int _bfd_coff_debug_string_prefix_length; 721*3d8817e4Smiod 722*3d8817e4Smiod void (*_bfd_coff_swap_filehdr_in) 723*3d8817e4Smiod (bfd *, void *, void *); 724*3d8817e4Smiod 725*3d8817e4Smiod void (*_bfd_coff_swap_aouthdr_in) 726*3d8817e4Smiod (bfd *, void *, void *); 727*3d8817e4Smiod 728*3d8817e4Smiod void (*_bfd_coff_swap_scnhdr_in) 729*3d8817e4Smiod (bfd *, void *, void *); 730*3d8817e4Smiod 731*3d8817e4Smiod void (*_bfd_coff_swap_reloc_in) 732*3d8817e4Smiod (bfd *abfd, void *, void *); 733*3d8817e4Smiod 734*3d8817e4Smiod bfd_boolean (*_bfd_coff_bad_format_hook) 735*3d8817e4Smiod (bfd *, void *); 736*3d8817e4Smiod 737*3d8817e4Smiod bfd_boolean (*_bfd_coff_set_arch_mach_hook) 738*3d8817e4Smiod (bfd *, void *); 739*3d8817e4Smiod 740*3d8817e4Smiod void * (*_bfd_coff_mkobject_hook) 741*3d8817e4Smiod (bfd *, void *, void *); 742*3d8817e4Smiod 743*3d8817e4Smiod bfd_boolean (*_bfd_styp_to_sec_flags_hook) 744*3d8817e4Smiod (bfd *, void *, const char *, asection *, flagword *); 745*3d8817e4Smiod 746*3d8817e4Smiod void (*_bfd_set_alignment_hook) 747*3d8817e4Smiod (bfd *, asection *, void *); 748*3d8817e4Smiod 749*3d8817e4Smiod bfd_boolean (*_bfd_coff_slurp_symbol_table) 750*3d8817e4Smiod (bfd *); 751*3d8817e4Smiod 752*3d8817e4Smiod bfd_boolean (*_bfd_coff_symname_in_debug) 753*3d8817e4Smiod (bfd *, struct internal_syment *); 754*3d8817e4Smiod 755*3d8817e4Smiod bfd_boolean (*_bfd_coff_pointerize_aux_hook) 756*3d8817e4Smiod (bfd *, combined_entry_type *, combined_entry_type *, 757*3d8817e4Smiod unsigned int, combined_entry_type *); 758*3d8817e4Smiod 759*3d8817e4Smiod bfd_boolean (*_bfd_coff_print_aux) 760*3d8817e4Smiod (bfd *, FILE *, combined_entry_type *, combined_entry_type *, 761*3d8817e4Smiod combined_entry_type *, unsigned int); 762*3d8817e4Smiod 763*3d8817e4Smiod void (*_bfd_coff_reloc16_extra_cases) 764*3d8817e4Smiod (bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *, 765*3d8817e4Smiod bfd_byte *, unsigned int *, unsigned int *); 766*3d8817e4Smiod 767*3d8817e4Smiod int (*_bfd_coff_reloc16_estimate) 768*3d8817e4Smiod (bfd *, asection *, arelent *, unsigned int, 769*3d8817e4Smiod struct bfd_link_info *); 770*3d8817e4Smiod 771*3d8817e4Smiod enum coff_symbol_classification (*_bfd_coff_classify_symbol) 772*3d8817e4Smiod (bfd *, struct internal_syment *); 773*3d8817e4Smiod 774*3d8817e4Smiod bfd_boolean (*_bfd_coff_compute_section_file_positions) 775*3d8817e4Smiod (bfd *); 776*3d8817e4Smiod 777*3d8817e4Smiod bfd_boolean (*_bfd_coff_start_final_link) 778*3d8817e4Smiod (bfd *, struct bfd_link_info *); 779*3d8817e4Smiod 780*3d8817e4Smiod bfd_boolean (*_bfd_coff_relocate_section) 781*3d8817e4Smiod (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, 782*3d8817e4Smiod struct internal_reloc *, struct internal_syment *, asection **); 783*3d8817e4Smiod 784*3d8817e4Smiod reloc_howto_type *(*_bfd_coff_rtype_to_howto) 785*3d8817e4Smiod (bfd *, asection *, struct internal_reloc *, 786*3d8817e4Smiod struct coff_link_hash_entry *, struct internal_syment *, 787*3d8817e4Smiod bfd_vma *); 788*3d8817e4Smiod 789*3d8817e4Smiod bfd_boolean (*_bfd_coff_adjust_symndx) 790*3d8817e4Smiod (bfd *, struct bfd_link_info *, bfd *, asection *, 791*3d8817e4Smiod struct internal_reloc *, bfd_boolean *); 792*3d8817e4Smiod 793*3d8817e4Smiod bfd_boolean (*_bfd_coff_link_add_one_symbol) 794*3d8817e4Smiod (struct bfd_link_info *, bfd *, const char *, flagword, 795*3d8817e4Smiod asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean, 796*3d8817e4Smiod struct bfd_link_hash_entry **); 797*3d8817e4Smiod 798*3d8817e4Smiod bfd_boolean (*_bfd_coff_link_output_has_begun) 799*3d8817e4Smiod (bfd *, struct coff_final_link_info *); 800*3d8817e4Smiod 801*3d8817e4Smiod bfd_boolean (*_bfd_coff_final_link_postscript) 802*3d8817e4Smiod (bfd *, struct coff_final_link_info *); 803*3d8817e4Smiod 804*3d8817e4Smiod } bfd_coff_backend_data; 805*3d8817e4Smiod 806*3d8817e4Smiod #define coff_backend_info(abfd) \ 807*3d8817e4Smiod ((bfd_coff_backend_data *) (abfd)->xvec->backend_data) 808*3d8817e4Smiod 809*3d8817e4Smiod #define bfd_coff_swap_aux_in(a,e,t,c,ind,num,i) \ 810*3d8817e4Smiod ((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i)) 811*3d8817e4Smiod 812*3d8817e4Smiod #define bfd_coff_swap_sym_in(a,e,i) \ 813*3d8817e4Smiod ((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i)) 814*3d8817e4Smiod 815*3d8817e4Smiod #define bfd_coff_swap_lineno_in(a,e,i) \ 816*3d8817e4Smiod ((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i)) 817*3d8817e4Smiod 818*3d8817e4Smiod #define bfd_coff_swap_reloc_out(abfd, i, o) \ 819*3d8817e4Smiod ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o)) 820*3d8817e4Smiod 821*3d8817e4Smiod #define bfd_coff_swap_lineno_out(abfd, i, o) \ 822*3d8817e4Smiod ((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o)) 823*3d8817e4Smiod 824*3d8817e4Smiod #define bfd_coff_swap_aux_out(a,i,t,c,ind,num,o) \ 825*3d8817e4Smiod ((coff_backend_info (a)->_bfd_coff_swap_aux_out) (a,i,t,c,ind,num,o)) 826*3d8817e4Smiod 827*3d8817e4Smiod #define bfd_coff_swap_sym_out(abfd, i,o) \ 828*3d8817e4Smiod ((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o)) 829*3d8817e4Smiod 830*3d8817e4Smiod #define bfd_coff_swap_scnhdr_out(abfd, i,o) \ 831*3d8817e4Smiod ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o)) 832*3d8817e4Smiod 833*3d8817e4Smiod #define bfd_coff_swap_filehdr_out(abfd, i,o) \ 834*3d8817e4Smiod ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o)) 835*3d8817e4Smiod 836*3d8817e4Smiod #define bfd_coff_swap_aouthdr_out(abfd, i,o) \ 837*3d8817e4Smiod ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o)) 838*3d8817e4Smiod 839*3d8817e4Smiod #define bfd_coff_filhsz(abfd) (coff_backend_info (abfd)->_bfd_filhsz) 840*3d8817e4Smiod #define bfd_coff_aoutsz(abfd) (coff_backend_info (abfd)->_bfd_aoutsz) 841*3d8817e4Smiod #define bfd_coff_scnhsz(abfd) (coff_backend_info (abfd)->_bfd_scnhsz) 842*3d8817e4Smiod #define bfd_coff_symesz(abfd) (coff_backend_info (abfd)->_bfd_symesz) 843*3d8817e4Smiod #define bfd_coff_auxesz(abfd) (coff_backend_info (abfd)->_bfd_auxesz) 844*3d8817e4Smiod #define bfd_coff_relsz(abfd) (coff_backend_info (abfd)->_bfd_relsz) 845*3d8817e4Smiod #define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz) 846*3d8817e4Smiod #define bfd_coff_filnmlen(abfd) (coff_backend_info (abfd)->_bfd_filnmlen) 847*3d8817e4Smiod #define bfd_coff_long_filenames(abfd) \ 848*3d8817e4Smiod (coff_backend_info (abfd)->_bfd_coff_long_filenames) 849*3d8817e4Smiod #define bfd_coff_long_section_names(abfd) \ 850*3d8817e4Smiod (coff_backend_info (abfd)->_bfd_coff_long_section_names) 851*3d8817e4Smiod #define bfd_coff_default_section_alignment_power(abfd) \ 852*3d8817e4Smiod (coff_backend_info (abfd)->_bfd_coff_default_section_alignment_power) 853*3d8817e4Smiod #define bfd_coff_swap_filehdr_in(abfd, i,o) \ 854*3d8817e4Smiod ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o)) 855*3d8817e4Smiod 856*3d8817e4Smiod #define bfd_coff_swap_aouthdr_in(abfd, i,o) \ 857*3d8817e4Smiod ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o)) 858*3d8817e4Smiod 859*3d8817e4Smiod #define bfd_coff_swap_scnhdr_in(abfd, i,o) \ 860*3d8817e4Smiod ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o)) 861*3d8817e4Smiod 862*3d8817e4Smiod #define bfd_coff_swap_reloc_in(abfd, i, o) \ 863*3d8817e4Smiod ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_in) (abfd, i, o)) 864*3d8817e4Smiod 865*3d8817e4Smiod #define bfd_coff_bad_format_hook(abfd, filehdr) \ 866*3d8817e4Smiod ((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr)) 867*3d8817e4Smiod 868*3d8817e4Smiod #define bfd_coff_set_arch_mach_hook(abfd, filehdr)\ 869*3d8817e4Smiod ((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr)) 870*3d8817e4Smiod #define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\ 871*3d8817e4Smiod ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook)\ 872*3d8817e4Smiod (abfd, filehdr, aouthdr)) 873*3d8817e4Smiod 874*3d8817e4Smiod #define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name, section, flags_ptr)\ 875*3d8817e4Smiod ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook)\ 876*3d8817e4Smiod (abfd, scnhdr, name, section, flags_ptr)) 877*3d8817e4Smiod 878*3d8817e4Smiod #define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\ 879*3d8817e4Smiod ((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr)) 880*3d8817e4Smiod 881*3d8817e4Smiod #define bfd_coff_slurp_symbol_table(abfd)\ 882*3d8817e4Smiod ((coff_backend_info (abfd)->_bfd_coff_slurp_symbol_table) (abfd)) 883*3d8817e4Smiod 884*3d8817e4Smiod #define bfd_coff_symname_in_debug(abfd, sym)\ 885*3d8817e4Smiod ((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym)) 886*3d8817e4Smiod 887*3d8817e4Smiod #define bfd_coff_force_symnames_in_strings(abfd)\ 888*3d8817e4Smiod (coff_backend_info (abfd)->_bfd_coff_force_symnames_in_strings) 889*3d8817e4Smiod 890*3d8817e4Smiod #define bfd_coff_debug_string_prefix_length(abfd)\ 891*3d8817e4Smiod (coff_backend_info (abfd)->_bfd_coff_debug_string_prefix_length) 892*3d8817e4Smiod 893*3d8817e4Smiod #define bfd_coff_print_aux(abfd, file, base, symbol, aux, indaux)\ 894*3d8817e4Smiod ((coff_backend_info (abfd)->_bfd_coff_print_aux)\ 895*3d8817e4Smiod (abfd, file, base, symbol, aux, indaux)) 896*3d8817e4Smiod 897*3d8817e4Smiod #define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order,\ 898*3d8817e4Smiod reloc, data, src_ptr, dst_ptr)\ 899*3d8817e4Smiod ((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\ 900*3d8817e4Smiod (abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)) 901*3d8817e4Smiod 902*3d8817e4Smiod #define bfd_coff_reloc16_estimate(abfd, section, reloc, shrink, link_info)\ 903*3d8817e4Smiod ((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\ 904*3d8817e4Smiod (abfd, section, reloc, shrink, link_info)) 905*3d8817e4Smiod 906*3d8817e4Smiod #define bfd_coff_classify_symbol(abfd, sym)\ 907*3d8817e4Smiod ((coff_backend_info (abfd)->_bfd_coff_classify_symbol)\ 908*3d8817e4Smiod (abfd, sym)) 909*3d8817e4Smiod 910*3d8817e4Smiod #define bfd_coff_compute_section_file_positions(abfd)\ 911*3d8817e4Smiod ((coff_backend_info (abfd)->_bfd_coff_compute_section_file_positions)\ 912*3d8817e4Smiod (abfd)) 913*3d8817e4Smiod 914*3d8817e4Smiod #define bfd_coff_start_final_link(obfd, info)\ 915*3d8817e4Smiod ((coff_backend_info (obfd)->_bfd_coff_start_final_link)\ 916*3d8817e4Smiod (obfd, info)) 917*3d8817e4Smiod #define bfd_coff_relocate_section(obfd,info,ibfd,o,con,rel,isyms,secs)\ 918*3d8817e4Smiod ((coff_backend_info (ibfd)->_bfd_coff_relocate_section)\ 919*3d8817e4Smiod (obfd, info, ibfd, o, con, rel, isyms, secs)) 920*3d8817e4Smiod #define bfd_coff_rtype_to_howto(abfd, sec, rel, h, sym, addendp)\ 921*3d8817e4Smiod ((coff_backend_info (abfd)->_bfd_coff_rtype_to_howto)\ 922*3d8817e4Smiod (abfd, sec, rel, h, sym, addendp)) 923*3d8817e4Smiod #define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\ 924*3d8817e4Smiod ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\ 925*3d8817e4Smiod (obfd, info, ibfd, sec, rel, adjustedp)) 926*3d8817e4Smiod #define bfd_coff_link_add_one_symbol(info, abfd, name, flags, section,\ 927*3d8817e4Smiod value, string, cp, coll, hashp)\ 928*3d8817e4Smiod ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\ 929*3d8817e4Smiod (info, abfd, name, flags, section, value, string, cp, coll, hashp)) 930*3d8817e4Smiod 931*3d8817e4Smiod #define bfd_coff_link_output_has_begun(a,p) \ 932*3d8817e4Smiod ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a, p)) 933*3d8817e4Smiod #define bfd_coff_final_link_postscript(a,p) \ 934*3d8817e4Smiod ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a, p)) 935*3d8817e4Smiod 936