15796c8dcSSimon Schubert /* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically 25796c8dcSSimon Schubert generated from "libcoff-in.h" and "coffcode.h". 35796c8dcSSimon Schubert Run "make headers" in your build bfd/ to regenerate. */ 45796c8dcSSimon Schubert 55796c8dcSSimon Schubert /* BFD COFF object file private structure. 65796c8dcSSimon Schubert Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 7a45ae5f8SJohn Marino 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 85796c8dcSSimon Schubert Free Software Foundation, Inc. 95796c8dcSSimon Schubert Written by Cygnus Support. 105796c8dcSSimon Schubert 115796c8dcSSimon Schubert This file is part of BFD, the Binary File Descriptor library. 125796c8dcSSimon Schubert 135796c8dcSSimon Schubert This program is free software; you can redistribute it and/or modify 145796c8dcSSimon Schubert it under the terms of the GNU General Public License as published by 155796c8dcSSimon Schubert the Free Software Foundation; either version 3 of the License, or 165796c8dcSSimon Schubert (at your option) any later version. 175796c8dcSSimon Schubert 185796c8dcSSimon Schubert This program is distributed in the hope that it will be useful, 195796c8dcSSimon Schubert but WITHOUT ANY WARRANTY; without even the implied warranty of 205796c8dcSSimon Schubert MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 215796c8dcSSimon Schubert GNU General Public License for more details. 225796c8dcSSimon Schubert 235796c8dcSSimon Schubert You should have received a copy of the GNU General Public License 245796c8dcSSimon Schubert along with this program; if not, write to the Free Software 255796c8dcSSimon Schubert Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, 265796c8dcSSimon Schubert MA 02110-1301, USA. */ 275796c8dcSSimon Schubert 285796c8dcSSimon Schubert #include "bfdlink.h" 295796c8dcSSimon Schubert 305796c8dcSSimon Schubert /* Object file tdata; access macros. */ 315796c8dcSSimon Schubert 325796c8dcSSimon Schubert #define coff_data(bfd) ((bfd)->tdata.coff_obj_data) 335796c8dcSSimon Schubert #define obj_pe(bfd) (coff_data (bfd)->pe) 345796c8dcSSimon Schubert #define obj_symbols(bfd) (coff_data (bfd)->symbols) 355796c8dcSSimon Schubert #define obj_sym_filepos(bfd) (coff_data (bfd)->sym_filepos) 365796c8dcSSimon Schubert #define obj_relocbase(bfd) (coff_data (bfd)->relocbase) 375796c8dcSSimon Schubert #define obj_raw_syments(bfd) (coff_data (bfd)->raw_syments) 385796c8dcSSimon Schubert #define obj_raw_syment_count(bfd) (coff_data (bfd)->raw_syment_count) 395796c8dcSSimon Schubert #define obj_convert(bfd) (coff_data (bfd)->conversion_table) 405796c8dcSSimon Schubert #define obj_conv_table_size(bfd) (coff_data (bfd)->conv_table_size) 415796c8dcSSimon Schubert #define obj_coff_external_syms(bfd) (coff_data (bfd)->external_syms) 425796c8dcSSimon Schubert #define obj_coff_keep_syms(bfd) (coff_data (bfd)->keep_syms) 435796c8dcSSimon Schubert #define obj_coff_strings(bfd) (coff_data (bfd)->strings) 445796c8dcSSimon Schubert #define obj_coff_keep_strings(bfd) (coff_data (bfd)->keep_strings) 455796c8dcSSimon Schubert #define obj_coff_sym_hashes(bfd) (coff_data (bfd)->sym_hashes) 465796c8dcSSimon Schubert #define obj_coff_strings_written(bfd) (coff_data (bfd)->strings_written) 475796c8dcSSimon Schubert #define obj_coff_local_toc_table(bfd) (coff_data (bfd)->local_toc_sym_map) 485796c8dcSSimon Schubert 495796c8dcSSimon Schubert /* `Tdata' information kept for COFF files. */ 505796c8dcSSimon Schubert 515796c8dcSSimon Schubert typedef struct coff_tdata 525796c8dcSSimon Schubert { 535796c8dcSSimon Schubert struct coff_symbol_struct *symbols; /* Symtab for input bfd. */ 545796c8dcSSimon Schubert unsigned int *conversion_table; 555796c8dcSSimon Schubert int conv_table_size; 565796c8dcSSimon Schubert file_ptr sym_filepos; 575796c8dcSSimon Schubert 585796c8dcSSimon Schubert struct coff_ptr_struct *raw_syments; 595796c8dcSSimon Schubert unsigned long raw_syment_count; 605796c8dcSSimon Schubert 615796c8dcSSimon Schubert /* These are only valid once writing has begun. */ 625796c8dcSSimon Schubert long int relocbase; 635796c8dcSSimon Schubert 645796c8dcSSimon Schubert /* These members communicate important constants about the symbol table 655796c8dcSSimon Schubert to GDB's symbol-reading code. These `constants' unfortunately vary 665796c8dcSSimon Schubert from coff implementation to implementation... */ 675796c8dcSSimon Schubert unsigned local_n_btmask; 685796c8dcSSimon Schubert unsigned local_n_btshft; 695796c8dcSSimon Schubert unsigned local_n_tmask; 705796c8dcSSimon Schubert unsigned local_n_tshift; 715796c8dcSSimon Schubert unsigned local_symesz; 725796c8dcSSimon Schubert unsigned local_auxesz; 735796c8dcSSimon Schubert unsigned local_linesz; 745796c8dcSSimon Schubert 755796c8dcSSimon Schubert /* The unswapped external symbols. May be NULL. Read by 765796c8dcSSimon Schubert _bfd_coff_get_external_symbols. */ 775796c8dcSSimon Schubert void * external_syms; 785796c8dcSSimon Schubert /* If this is TRUE, the external_syms may not be freed. */ 795796c8dcSSimon Schubert bfd_boolean keep_syms; 805796c8dcSSimon Schubert 815796c8dcSSimon Schubert /* The string table. May be NULL. Read by 825796c8dcSSimon Schubert _bfd_coff_read_string_table. */ 835796c8dcSSimon Schubert char *strings; 845796c8dcSSimon Schubert /* If this is TRUE, the strings may not be freed. */ 855796c8dcSSimon Schubert bfd_boolean keep_strings; 865796c8dcSSimon Schubert /* If this is TRUE, the strings have been written out already. */ 875796c8dcSSimon Schubert bfd_boolean strings_written; 885796c8dcSSimon Schubert 895796c8dcSSimon Schubert /* Is this a PE format coff file? */ 905796c8dcSSimon Schubert int pe; 915796c8dcSSimon Schubert /* Used by the COFF backend linker. */ 925796c8dcSSimon Schubert struct coff_link_hash_entry **sym_hashes; 935796c8dcSSimon Schubert 945796c8dcSSimon Schubert /* Used by the pe linker for PowerPC. */ 955796c8dcSSimon Schubert int *local_toc_sym_map; 965796c8dcSSimon Schubert 975796c8dcSSimon Schubert struct bfd_link_info *link_info; 985796c8dcSSimon Schubert 995796c8dcSSimon Schubert /* Used by coff_find_nearest_line. */ 1005796c8dcSSimon Schubert void * line_info; 1015796c8dcSSimon Schubert 1025796c8dcSSimon Schubert /* A place to stash dwarf2 info for this bfd. */ 1035796c8dcSSimon Schubert void * dwarf2_find_line_info; 1045796c8dcSSimon Schubert 1055796c8dcSSimon Schubert /* The timestamp from the COFF file header. */ 1065796c8dcSSimon Schubert long timestamp; 1075796c8dcSSimon Schubert 1085796c8dcSSimon Schubert /* Copy of some of the f_flags bits in the COFF filehdr structure, 1095796c8dcSSimon Schubert used by ARM code. */ 1105796c8dcSSimon Schubert flagword flags; 1115796c8dcSSimon Schubert 1125796c8dcSSimon Schubert /* coff-stgo32 EXE stub header after BFD tdata has been allocated. Its data 1135796c8dcSSimon Schubert is kept in internal_filehdr.go32stub beforehand. */ 1145796c8dcSSimon Schubert char *go32stub; 1155796c8dcSSimon Schubert } coff_data_type; 1165796c8dcSSimon Schubert 1175796c8dcSSimon Schubert /* Tdata for pe image files. */ 1185796c8dcSSimon Schubert typedef struct pe_tdata 1195796c8dcSSimon Schubert { 1205796c8dcSSimon Schubert coff_data_type coff; 1215796c8dcSSimon Schubert struct internal_extra_pe_aouthdr pe_opthdr; 1225796c8dcSSimon Schubert int dll; 1235796c8dcSSimon Schubert int has_reloc_section; 124cf7f2e2dSJohn Marino int dont_strip_reloc; 1255796c8dcSSimon Schubert bfd_boolean (*in_reloc_p) (bfd *, reloc_howto_type *); 1265796c8dcSSimon Schubert flagword real_flags; 1275796c8dcSSimon Schubert } pe_data_type; 1285796c8dcSSimon Schubert 1295796c8dcSSimon Schubert #define pe_data(bfd) ((bfd)->tdata.pe_obj_data) 1305796c8dcSSimon Schubert 1315796c8dcSSimon Schubert /* Tdata for XCOFF files. */ 1325796c8dcSSimon Schubert 1335796c8dcSSimon Schubert struct xcoff_tdata 1345796c8dcSSimon Schubert { 1355796c8dcSSimon Schubert /* Basic COFF information. */ 1365796c8dcSSimon Schubert coff_data_type coff; 1375796c8dcSSimon Schubert 1385796c8dcSSimon Schubert /* TRUE if this is an XCOFF64 file. */ 1395796c8dcSSimon Schubert bfd_boolean xcoff64; 1405796c8dcSSimon Schubert 1415796c8dcSSimon Schubert /* TRUE if a large a.out header should be generated. */ 1425796c8dcSSimon Schubert bfd_boolean full_aouthdr; 1435796c8dcSSimon Schubert 1445796c8dcSSimon Schubert /* TOC value. */ 1455796c8dcSSimon Schubert bfd_vma toc; 1465796c8dcSSimon Schubert 1475796c8dcSSimon Schubert /* Index of section holding TOC. */ 1485796c8dcSSimon Schubert int sntoc; 1495796c8dcSSimon Schubert 1505796c8dcSSimon Schubert /* Index of section holding entry point. */ 1515796c8dcSSimon Schubert int snentry; 1525796c8dcSSimon Schubert 1535796c8dcSSimon Schubert /* .text alignment from optional header. */ 1545796c8dcSSimon Schubert int text_align_power; 1555796c8dcSSimon Schubert 1565796c8dcSSimon Schubert /* .data alignment from optional header. */ 1575796c8dcSSimon Schubert int data_align_power; 1585796c8dcSSimon Schubert 1595796c8dcSSimon Schubert /* modtype from optional header. */ 1605796c8dcSSimon Schubert short modtype; 1615796c8dcSSimon Schubert 1625796c8dcSSimon Schubert /* cputype from optional header. */ 1635796c8dcSSimon Schubert short cputype; 1645796c8dcSSimon Schubert 1655796c8dcSSimon Schubert /* maxdata from optional header. */ 1665796c8dcSSimon Schubert bfd_vma maxdata; 1675796c8dcSSimon Schubert 1685796c8dcSSimon Schubert /* maxstack from optional header. */ 1695796c8dcSSimon Schubert bfd_vma maxstack; 1705796c8dcSSimon Schubert 1715796c8dcSSimon Schubert /* Used by the XCOFF backend linker. */ 1725796c8dcSSimon Schubert asection **csects; 1735796c8dcSSimon Schubert long *debug_indices; 1745796c8dcSSimon Schubert unsigned int *lineno_counts; 1755796c8dcSSimon Schubert unsigned int import_file_id; 1765796c8dcSSimon Schubert }; 1775796c8dcSSimon Schubert 1785796c8dcSSimon Schubert #define xcoff_data(abfd) ((abfd)->tdata.xcoff_obj_data) 1795796c8dcSSimon Schubert 1805796c8dcSSimon Schubert /* We take the address of the first element of an asymbol to ensure that the 1815796c8dcSSimon Schubert macro is only ever applied to an asymbol. */ 1825796c8dcSSimon Schubert #define coffsymbol(asymbol) ((coff_symbol_type *)(&((asymbol)->the_bfd))) 1835796c8dcSSimon Schubert 1845796c8dcSSimon Schubert /* The used_by_bfd field of a section may be set to a pointer to this 1855796c8dcSSimon Schubert structure. */ 1865796c8dcSSimon Schubert 1875796c8dcSSimon Schubert struct coff_section_tdata 1885796c8dcSSimon Schubert { 1895796c8dcSSimon Schubert /* The relocs, swapped into COFF internal form. This may be NULL. */ 1905796c8dcSSimon Schubert struct internal_reloc *relocs; 1915796c8dcSSimon Schubert /* If this is TRUE, the relocs entry may not be freed. */ 1925796c8dcSSimon Schubert bfd_boolean keep_relocs; 1935796c8dcSSimon Schubert /* The section contents. This may be NULL. */ 1945796c8dcSSimon Schubert bfd_byte *contents; 1955796c8dcSSimon Schubert /* If this is TRUE, the contents entry may not be freed. */ 1965796c8dcSSimon Schubert bfd_boolean keep_contents; 1975796c8dcSSimon Schubert /* Information cached by coff_find_nearest_line. */ 1985796c8dcSSimon Schubert bfd_vma offset; 1995796c8dcSSimon Schubert unsigned int i; 2005796c8dcSSimon Schubert const char *function; 2015796c8dcSSimon Schubert /* Optional information about a COMDAT entry; NULL if not COMDAT. */ 2025796c8dcSSimon Schubert struct coff_comdat_info *comdat; 2035796c8dcSSimon Schubert int line_base; 2045796c8dcSSimon Schubert /* A pointer used for .stab linking optimizations. */ 2055796c8dcSSimon Schubert void * stab_info; 2065796c8dcSSimon Schubert /* Available for individual backends. */ 2075796c8dcSSimon Schubert void * tdata; 2085796c8dcSSimon Schubert }; 2095796c8dcSSimon Schubert 2105796c8dcSSimon Schubert /* An accessor macro for the coff_section_tdata structure. */ 2115796c8dcSSimon Schubert #define coff_section_data(abfd, sec) \ 2125796c8dcSSimon Schubert ((struct coff_section_tdata *) (sec)->used_by_bfd) 2135796c8dcSSimon Schubert 2145796c8dcSSimon Schubert /* Tdata for sections in XCOFF files. This is used by the linker. */ 2155796c8dcSSimon Schubert 2165796c8dcSSimon Schubert struct xcoff_section_tdata 2175796c8dcSSimon Schubert { 2185796c8dcSSimon Schubert /* Used for XCOFF csects created by the linker; points to the real 2195796c8dcSSimon Schubert XCOFF section which contains this csect. */ 2205796c8dcSSimon Schubert asection *enclosing; 2215796c8dcSSimon Schubert /* The lineno_count field for the enclosing section, because we are 2225796c8dcSSimon Schubert going to clobber it there. */ 2235796c8dcSSimon Schubert unsigned int lineno_count; 2245796c8dcSSimon Schubert /* The first and last symbol indices for symbols used by this csect. */ 2255796c8dcSSimon Schubert unsigned long first_symndx; 2265796c8dcSSimon Schubert unsigned long last_symndx; 2275796c8dcSSimon Schubert }; 2285796c8dcSSimon Schubert 2295796c8dcSSimon Schubert /* An accessor macro the xcoff_section_tdata structure. */ 2305796c8dcSSimon Schubert #define xcoff_section_data(abfd, sec) \ 2315796c8dcSSimon Schubert ((struct xcoff_section_tdata *) coff_section_data ((abfd), (sec))->tdata) 2325796c8dcSSimon Schubert 2335796c8dcSSimon Schubert /* Tdata for sections in PE files. */ 2345796c8dcSSimon Schubert 2355796c8dcSSimon Schubert struct pei_section_tdata 2365796c8dcSSimon Schubert { 2375796c8dcSSimon Schubert /* The virtual size of the section. */ 2385796c8dcSSimon Schubert bfd_size_type virt_size; 2395796c8dcSSimon Schubert /* The PE section flags. */ 2405796c8dcSSimon Schubert long pe_flags; 2415796c8dcSSimon Schubert }; 2425796c8dcSSimon Schubert 2435796c8dcSSimon Schubert /* An accessor macro for the pei_section_tdata structure. */ 2445796c8dcSSimon Schubert #define pei_section_data(abfd, sec) \ 2455796c8dcSSimon Schubert ((struct pei_section_tdata *) coff_section_data ((abfd), (sec))->tdata) 2465796c8dcSSimon Schubert 2475796c8dcSSimon Schubert /* COFF linker hash table entries. */ 2485796c8dcSSimon Schubert 2495796c8dcSSimon Schubert struct coff_link_hash_entry 2505796c8dcSSimon Schubert { 2515796c8dcSSimon Schubert struct bfd_link_hash_entry root; 2525796c8dcSSimon Schubert 2535796c8dcSSimon Schubert /* Symbol index in output file. Set to -1 initially. Set to -2 if 2545796c8dcSSimon Schubert there is a reloc against this symbol. */ 2555796c8dcSSimon Schubert long indx; 2565796c8dcSSimon Schubert 2575796c8dcSSimon Schubert /* Symbol type. */ 2585796c8dcSSimon Schubert unsigned short type; 2595796c8dcSSimon Schubert 2605796c8dcSSimon Schubert /* Symbol class. */ 2615796c8dcSSimon Schubert unsigned char symbol_class; 2625796c8dcSSimon Schubert 2635796c8dcSSimon Schubert /* Number of auxiliary entries. */ 2645796c8dcSSimon Schubert char numaux; 2655796c8dcSSimon Schubert 2665796c8dcSSimon Schubert /* BFD to take auxiliary entries from. */ 2675796c8dcSSimon Schubert bfd *auxbfd; 2685796c8dcSSimon Schubert 2695796c8dcSSimon Schubert /* Pointer to array of auxiliary entries, if any. */ 2705796c8dcSSimon Schubert union internal_auxent *aux; 2715796c8dcSSimon Schubert 2725796c8dcSSimon Schubert /* Flag word; legal values follow. */ 2735796c8dcSSimon Schubert unsigned short coff_link_hash_flags; 2745796c8dcSSimon Schubert /* Symbol is a PE section symbol. */ 2755796c8dcSSimon Schubert #define COFF_LINK_HASH_PE_SECTION_SYMBOL (01) 2765796c8dcSSimon Schubert }; 2775796c8dcSSimon Schubert 2785796c8dcSSimon Schubert /* COFF linker hash table. */ 2795796c8dcSSimon Schubert 2805796c8dcSSimon Schubert struct coff_link_hash_table 2815796c8dcSSimon Schubert { 2825796c8dcSSimon Schubert struct bfd_link_hash_table root; 2835796c8dcSSimon Schubert /* A pointer to information used to link stabs in sections. */ 2845796c8dcSSimon Schubert struct stab_info stab_info; 2855796c8dcSSimon Schubert }; 2865796c8dcSSimon Schubert 2875796c8dcSSimon Schubert /* Look up an entry in a COFF linker hash table. */ 2885796c8dcSSimon Schubert 2895796c8dcSSimon Schubert #define coff_link_hash_lookup(table, string, create, copy, follow) \ 2905796c8dcSSimon Schubert ((struct coff_link_hash_entry *) \ 2915796c8dcSSimon Schubert bfd_link_hash_lookup (&(table)->root, (string), (create), \ 2925796c8dcSSimon Schubert (copy), (follow))) 2935796c8dcSSimon Schubert 2945796c8dcSSimon Schubert /* Traverse a COFF linker hash table. */ 2955796c8dcSSimon Schubert 2965796c8dcSSimon Schubert #define coff_link_hash_traverse(table, func, info) \ 2975796c8dcSSimon Schubert (bfd_link_hash_traverse \ 2985796c8dcSSimon Schubert (&(table)->root, \ 2995796c8dcSSimon Schubert (bfd_boolean (*) (struct bfd_link_hash_entry *, void *)) (func), \ 3005796c8dcSSimon Schubert (info))) 3015796c8dcSSimon Schubert 3025796c8dcSSimon Schubert /* Get the COFF linker hash table from a link_info structure. */ 3035796c8dcSSimon Schubert 3045796c8dcSSimon Schubert #define coff_hash_table(p) ((struct coff_link_hash_table *) ((p)->hash)) 3055796c8dcSSimon Schubert 3065796c8dcSSimon Schubert /* Functions in coffgen.c. */ 3075796c8dcSSimon Schubert extern const bfd_target *coff_object_p 3085796c8dcSSimon Schubert (bfd *); 3095796c8dcSSimon Schubert extern struct bfd_section *coff_section_from_bfd_index 3105796c8dcSSimon Schubert (bfd *, int); 3115796c8dcSSimon Schubert extern long coff_get_symtab_upper_bound 3125796c8dcSSimon Schubert (bfd *); 3135796c8dcSSimon Schubert extern long coff_canonicalize_symtab 3145796c8dcSSimon Schubert (bfd *, asymbol **); 3155796c8dcSSimon Schubert extern int coff_count_linenumbers 3165796c8dcSSimon Schubert (bfd *); 3175796c8dcSSimon Schubert extern struct coff_symbol_struct *coff_symbol_from 3185796c8dcSSimon Schubert (bfd *, asymbol *); 3195796c8dcSSimon Schubert extern bfd_boolean coff_renumber_symbols 3205796c8dcSSimon Schubert (bfd *, int *); 3215796c8dcSSimon Schubert extern void coff_mangle_symbols 3225796c8dcSSimon Schubert (bfd *); 3235796c8dcSSimon Schubert extern bfd_boolean coff_write_symbols 3245796c8dcSSimon Schubert (bfd *); 325a45ae5f8SJohn Marino extern bfd_boolean coff_write_alien_symbol 326a45ae5f8SJohn Marino (bfd *, asymbol *, struct internal_syment *, bfd_vma *, 327a45ae5f8SJohn Marino bfd_size_type *, asection **, bfd_size_type *); 3285796c8dcSSimon Schubert extern bfd_boolean coff_write_linenumbers 3295796c8dcSSimon Schubert (bfd *); 3305796c8dcSSimon Schubert extern alent *coff_get_lineno 3315796c8dcSSimon Schubert (bfd *, asymbol *); 3325796c8dcSSimon Schubert extern asymbol *coff_section_symbol 3335796c8dcSSimon Schubert (bfd *, char *); 3345796c8dcSSimon Schubert extern bfd_boolean _bfd_coff_get_external_symbols 3355796c8dcSSimon Schubert (bfd *); 3365796c8dcSSimon Schubert extern const char *_bfd_coff_read_string_table 3375796c8dcSSimon Schubert (bfd *); 3385796c8dcSSimon Schubert extern bfd_boolean _bfd_coff_free_symbols 3395796c8dcSSimon Schubert (bfd *); 3405796c8dcSSimon Schubert extern struct coff_ptr_struct *coff_get_normalized_symtab 3415796c8dcSSimon Schubert (bfd *); 3425796c8dcSSimon Schubert extern long coff_get_reloc_upper_bound 3435796c8dcSSimon Schubert (bfd *, sec_ptr); 3445796c8dcSSimon Schubert extern asymbol *coff_make_empty_symbol 3455796c8dcSSimon Schubert (bfd *); 3465796c8dcSSimon Schubert extern void coff_print_symbol 3475796c8dcSSimon Schubert (bfd *, void * filep, asymbol *, bfd_print_symbol_type); 3485796c8dcSSimon Schubert extern void coff_get_symbol_info 3495796c8dcSSimon Schubert (bfd *, asymbol *, symbol_info *ret); 3505796c8dcSSimon Schubert extern bfd_boolean _bfd_coff_is_local_label_name 3515796c8dcSSimon Schubert (bfd *, const char *); 3525796c8dcSSimon Schubert extern asymbol *coff_bfd_make_debug_symbol 3535796c8dcSSimon Schubert (bfd *, void *, unsigned long); 3545796c8dcSSimon Schubert extern bfd_boolean coff_find_nearest_line 3555796c8dcSSimon Schubert (bfd *, asection *, asymbol **, bfd_vma, const char **, 3565796c8dcSSimon Schubert const char **, unsigned int *); 357*ef5ccd6cSJohn Marino extern bfd_boolean coff_find_nearest_line_discriminator 358*ef5ccd6cSJohn Marino (bfd *, asection *, asymbol **, bfd_vma, const char **, 359*ef5ccd6cSJohn Marino const char **, unsigned int *, unsigned int *); 360a45ae5f8SJohn Marino struct dwarf_debug_section; 361a45ae5f8SJohn Marino extern bfd_boolean coff_find_nearest_line_with_names 362a45ae5f8SJohn Marino (bfd *, const struct dwarf_debug_section *, asection *, asymbol **, 363a45ae5f8SJohn Marino bfd_vma, const char **, const char **, unsigned int *); 3645796c8dcSSimon Schubert extern bfd_boolean coff_find_inliner_info 3655796c8dcSSimon Schubert (bfd *, const char **, const char **, unsigned int *); 3665796c8dcSSimon Schubert extern int coff_sizeof_headers 3675796c8dcSSimon Schubert (bfd *, struct bfd_link_info *); 3685796c8dcSSimon Schubert extern bfd_boolean bfd_coff_reloc16_relax_section 3695796c8dcSSimon Schubert (bfd *, asection *, struct bfd_link_info *, bfd_boolean *); 3705796c8dcSSimon Schubert extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents 3715796c8dcSSimon Schubert (bfd *, struct bfd_link_info *, struct bfd_link_order *, 3725796c8dcSSimon Schubert bfd_byte *, bfd_boolean, asymbol **); 3735796c8dcSSimon Schubert extern bfd_vma bfd_coff_reloc16_get_value 3745796c8dcSSimon Schubert (arelent *, struct bfd_link_info *, asection *); 3755796c8dcSSimon Schubert extern void bfd_perform_slip 3765796c8dcSSimon Schubert (bfd *, unsigned int, asection *, bfd_vma); 3775796c8dcSSimon Schubert 3785796c8dcSSimon Schubert /* Functions and types in cofflink.c. */ 3795796c8dcSSimon Schubert 3805796c8dcSSimon Schubert #define STRING_SIZE_SIZE 4 3815796c8dcSSimon Schubert 3825796c8dcSSimon Schubert /* We use a hash table to merge identical enum, struct, and union 3835796c8dcSSimon Schubert definitions in the linker. */ 3845796c8dcSSimon Schubert 3855796c8dcSSimon Schubert /* Information we keep for a single element (an enum value, a 3865796c8dcSSimon Schubert structure or union field) in the debug merge hash table. */ 3875796c8dcSSimon Schubert 3885796c8dcSSimon Schubert struct coff_debug_merge_element 3895796c8dcSSimon Schubert { 3905796c8dcSSimon Schubert /* Next element. */ 3915796c8dcSSimon Schubert struct coff_debug_merge_element *next; 3925796c8dcSSimon Schubert 3935796c8dcSSimon Schubert /* Name. */ 3945796c8dcSSimon Schubert const char *name; 3955796c8dcSSimon Schubert 3965796c8dcSSimon Schubert /* Type. */ 3975796c8dcSSimon Schubert unsigned int type; 3985796c8dcSSimon Schubert 3995796c8dcSSimon Schubert /* Symbol index for complex type. */ 4005796c8dcSSimon Schubert long tagndx; 4015796c8dcSSimon Schubert }; 4025796c8dcSSimon Schubert 4035796c8dcSSimon Schubert /* A linked list of debug merge entries for a given name. */ 4045796c8dcSSimon Schubert 4055796c8dcSSimon Schubert struct coff_debug_merge_type 4065796c8dcSSimon Schubert { 4075796c8dcSSimon Schubert /* Next type with the same name. */ 4085796c8dcSSimon Schubert struct coff_debug_merge_type *next; 4095796c8dcSSimon Schubert 4105796c8dcSSimon Schubert /* Class of type. */ 4115796c8dcSSimon Schubert int type_class; 4125796c8dcSSimon Schubert 4135796c8dcSSimon Schubert /* Symbol index where this type is defined. */ 4145796c8dcSSimon Schubert long indx; 4155796c8dcSSimon Schubert 4165796c8dcSSimon Schubert /* List of elements. */ 4175796c8dcSSimon Schubert struct coff_debug_merge_element *elements; 4185796c8dcSSimon Schubert }; 4195796c8dcSSimon Schubert 4205796c8dcSSimon Schubert /* Information we store in the debug merge hash table. */ 4215796c8dcSSimon Schubert 4225796c8dcSSimon Schubert struct coff_debug_merge_hash_entry 4235796c8dcSSimon Schubert { 4245796c8dcSSimon Schubert struct bfd_hash_entry root; 4255796c8dcSSimon Schubert 4265796c8dcSSimon Schubert /* A list of types with this name. */ 4275796c8dcSSimon Schubert struct coff_debug_merge_type *types; 4285796c8dcSSimon Schubert }; 4295796c8dcSSimon Schubert 4305796c8dcSSimon Schubert /* The debug merge hash table. */ 4315796c8dcSSimon Schubert 4325796c8dcSSimon Schubert struct coff_debug_merge_hash_table 4335796c8dcSSimon Schubert { 4345796c8dcSSimon Schubert struct bfd_hash_table root; 4355796c8dcSSimon Schubert }; 4365796c8dcSSimon Schubert 4375796c8dcSSimon Schubert /* Initialize a COFF debug merge hash table. */ 4385796c8dcSSimon Schubert 4395796c8dcSSimon Schubert #define coff_debug_merge_hash_table_init(table) \ 4405796c8dcSSimon Schubert (bfd_hash_table_init (&(table)->root, _bfd_coff_debug_merge_hash_newfunc, \ 4415796c8dcSSimon Schubert sizeof (struct coff_debug_merge_hash_entry))) 4425796c8dcSSimon Schubert 4435796c8dcSSimon Schubert /* Free a COFF debug merge hash table. */ 4445796c8dcSSimon Schubert 4455796c8dcSSimon Schubert #define coff_debug_merge_hash_table_free(table) \ 4465796c8dcSSimon Schubert (bfd_hash_table_free (&(table)->root)) 4475796c8dcSSimon Schubert 4485796c8dcSSimon Schubert /* Look up an entry in a COFF debug merge hash table. */ 4495796c8dcSSimon Schubert 4505796c8dcSSimon Schubert #define coff_debug_merge_hash_lookup(table, string, create, copy) \ 4515796c8dcSSimon Schubert ((struct coff_debug_merge_hash_entry *) \ 4525796c8dcSSimon Schubert bfd_hash_lookup (&(table)->root, (string), (create), (copy))) 4535796c8dcSSimon Schubert 4545796c8dcSSimon Schubert /* Information we keep for each section in the output file when doing 4555796c8dcSSimon Schubert a relocatable link. */ 4565796c8dcSSimon Schubert 4575796c8dcSSimon Schubert struct coff_link_section_info 4585796c8dcSSimon Schubert { 4595796c8dcSSimon Schubert /* The relocs to be output. */ 4605796c8dcSSimon Schubert struct internal_reloc *relocs; 4615796c8dcSSimon Schubert /* For each reloc against a global symbol whose index was not known 4625796c8dcSSimon Schubert when the reloc was handled, the global hash table entry. */ 4635796c8dcSSimon Schubert struct coff_link_hash_entry **rel_hashes; 4645796c8dcSSimon Schubert }; 4655796c8dcSSimon Schubert 4665796c8dcSSimon Schubert /* Information that we pass around while doing the final link step. */ 4675796c8dcSSimon Schubert 4685796c8dcSSimon Schubert struct coff_final_link_info 4695796c8dcSSimon Schubert { 4705796c8dcSSimon Schubert /* General link information. */ 4715796c8dcSSimon Schubert struct bfd_link_info *info; 4725796c8dcSSimon Schubert /* Output BFD. */ 4735796c8dcSSimon Schubert bfd *output_bfd; 4745796c8dcSSimon Schubert /* Used to indicate failure in traversal routine. */ 4755796c8dcSSimon Schubert bfd_boolean failed; 4765796c8dcSSimon Schubert /* If doing "task linking" set only during the time when we want the 4775796c8dcSSimon Schubert global symbol writer to convert the storage class of defined global 4785796c8dcSSimon Schubert symbols from global to static. */ 4795796c8dcSSimon Schubert bfd_boolean global_to_static; 4805796c8dcSSimon Schubert /* Hash table for long symbol names. */ 4815796c8dcSSimon Schubert struct bfd_strtab_hash *strtab; 4825796c8dcSSimon Schubert /* When doing a relocatable link, an array of information kept for 4835796c8dcSSimon Schubert each output section, indexed by the target_index field. */ 4845796c8dcSSimon Schubert struct coff_link_section_info *section_info; 4855796c8dcSSimon Schubert /* Symbol index of last C_FILE symbol (-1 if none). */ 4865796c8dcSSimon Schubert long last_file_index; 4875796c8dcSSimon Schubert /* Contents of last C_FILE symbol. */ 4885796c8dcSSimon Schubert struct internal_syment last_file; 4895796c8dcSSimon Schubert /* Symbol index of first aux entry of last .bf symbol with an empty 4905796c8dcSSimon Schubert endndx field (-1 if none). */ 4915796c8dcSSimon Schubert long last_bf_index; 4925796c8dcSSimon Schubert /* Contents of last_bf_index aux entry. */ 4935796c8dcSSimon Schubert union internal_auxent last_bf; 4945796c8dcSSimon Schubert /* Hash table used to merge debug information. */ 4955796c8dcSSimon Schubert struct coff_debug_merge_hash_table debug_merge; 4965796c8dcSSimon Schubert /* Buffer large enough to hold swapped symbols of any input file. */ 4975796c8dcSSimon Schubert struct internal_syment *internal_syms; 4985796c8dcSSimon Schubert /* Buffer large enough to hold sections of symbols of any input file. */ 4995796c8dcSSimon Schubert asection **sec_ptrs; 5005796c8dcSSimon Schubert /* Buffer large enough to hold output indices of symbols of any 5015796c8dcSSimon Schubert input file. */ 5025796c8dcSSimon Schubert long *sym_indices; 5035796c8dcSSimon Schubert /* Buffer large enough to hold output symbols for any input file. */ 5045796c8dcSSimon Schubert bfd_byte *outsyms; 5055796c8dcSSimon Schubert /* Buffer large enough to hold external line numbers for any input 5065796c8dcSSimon Schubert section. */ 5075796c8dcSSimon Schubert bfd_byte *linenos; 5085796c8dcSSimon Schubert /* Buffer large enough to hold any input section. */ 5095796c8dcSSimon Schubert bfd_byte *contents; 5105796c8dcSSimon Schubert /* Buffer large enough to hold external relocs of any input section. */ 5115796c8dcSSimon Schubert bfd_byte *external_relocs; 5125796c8dcSSimon Schubert /* Buffer large enough to hold swapped relocs of any input section. */ 5135796c8dcSSimon Schubert struct internal_reloc *internal_relocs; 5145796c8dcSSimon Schubert }; 5155796c8dcSSimon Schubert 5165796c8dcSSimon Schubert /* Most COFF variants have no way to record the alignment of a 5175796c8dcSSimon Schubert section. This struct is used to set a specific alignment based on 5185796c8dcSSimon Schubert the name of the section. */ 5195796c8dcSSimon Schubert 5205796c8dcSSimon Schubert struct coff_section_alignment_entry 5215796c8dcSSimon Schubert { 5225796c8dcSSimon Schubert /* The section name. */ 5235796c8dcSSimon Schubert const char *name; 5245796c8dcSSimon Schubert 5255796c8dcSSimon Schubert /* This is either (unsigned int) -1, indicating that the section 5265796c8dcSSimon Schubert name must match exactly, or it is the number of letters which 5275796c8dcSSimon Schubert must match at the start of the name. */ 5285796c8dcSSimon Schubert unsigned int comparison_length; 5295796c8dcSSimon Schubert 5305796c8dcSSimon Schubert /* These macros may be used to fill in the first two fields in a 5315796c8dcSSimon Schubert structure initialization. */ 5325796c8dcSSimon Schubert #define COFF_SECTION_NAME_EXACT_MATCH(name) (name), ((unsigned int) -1) 5335796c8dcSSimon Schubert #define COFF_SECTION_NAME_PARTIAL_MATCH(name) (name), (sizeof (name) - 1) 5345796c8dcSSimon Schubert 5355796c8dcSSimon Schubert /* Only use this entry if the default section alignment for this 5365796c8dcSSimon Schubert target is at least that much (as a power of two). If this field 5375796c8dcSSimon Schubert is COFF_ALIGNMENT_FIELD_EMPTY, it should be ignored. */ 5385796c8dcSSimon Schubert unsigned int default_alignment_min; 5395796c8dcSSimon Schubert 5405796c8dcSSimon Schubert /* Only use this entry if the default section alignment for this 5415796c8dcSSimon Schubert target is no greater than this (as a power of two). If this 5425796c8dcSSimon Schubert field is COFF_ALIGNMENT_FIELD_EMPTY, it should be ignored. */ 5435796c8dcSSimon Schubert unsigned int default_alignment_max; 5445796c8dcSSimon Schubert 5455796c8dcSSimon Schubert #define COFF_ALIGNMENT_FIELD_EMPTY ((unsigned int) -1) 5465796c8dcSSimon Schubert 5475796c8dcSSimon Schubert /* The desired alignment for this section (as a power of two). */ 5485796c8dcSSimon Schubert unsigned int alignment_power; 5495796c8dcSSimon Schubert }; 5505796c8dcSSimon Schubert 5515796c8dcSSimon Schubert extern struct bfd_hash_entry *_bfd_coff_link_hash_newfunc 5525796c8dcSSimon Schubert (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); 5535796c8dcSSimon Schubert extern bfd_boolean _bfd_coff_link_hash_table_init 5545796c8dcSSimon Schubert (struct coff_link_hash_table *, bfd *, 5555796c8dcSSimon Schubert struct bfd_hash_entry *(*) (struct bfd_hash_entry *, 5565796c8dcSSimon Schubert struct bfd_hash_table *, 5575796c8dcSSimon Schubert const char *), 5585796c8dcSSimon Schubert unsigned int); 5595796c8dcSSimon Schubert extern struct bfd_link_hash_table *_bfd_coff_link_hash_table_create 5605796c8dcSSimon Schubert (bfd *); 5615796c8dcSSimon Schubert extern const char *_bfd_coff_internal_syment_name 5625796c8dcSSimon Schubert (bfd *, const struct internal_syment *, char *); 563a45ae5f8SJohn Marino extern bfd_boolean _bfd_coff_section_already_linked 564a45ae5f8SJohn Marino (bfd *, asection *, struct bfd_link_info *); 5655796c8dcSSimon Schubert extern bfd_boolean _bfd_coff_link_add_symbols 5665796c8dcSSimon Schubert (bfd *, struct bfd_link_info *); 5675796c8dcSSimon Schubert extern bfd_boolean _bfd_coff_final_link 5685796c8dcSSimon Schubert (bfd *, struct bfd_link_info *); 5695796c8dcSSimon Schubert extern struct internal_reloc *_bfd_coff_read_internal_relocs 5705796c8dcSSimon Schubert (bfd *, asection *, bfd_boolean, bfd_byte *, bfd_boolean, 5715796c8dcSSimon Schubert struct internal_reloc *); 5725796c8dcSSimon Schubert extern bfd_boolean _bfd_coff_generic_relocate_section 5735796c8dcSSimon Schubert (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, 5745796c8dcSSimon Schubert struct internal_reloc *, struct internal_syment *, asection **); 5755796c8dcSSimon Schubert extern struct bfd_hash_entry *_bfd_coff_debug_merge_hash_newfunc 5765796c8dcSSimon Schubert (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); 5775796c8dcSSimon Schubert extern bfd_boolean _bfd_coff_write_global_sym 578a45ae5f8SJohn Marino (struct bfd_hash_entry *, void *); 5795796c8dcSSimon Schubert extern bfd_boolean _bfd_coff_write_task_globals 5805796c8dcSSimon Schubert (struct coff_link_hash_entry *, void *); 5815796c8dcSSimon Schubert extern bfd_boolean _bfd_coff_link_input_bfd 5825796c8dcSSimon Schubert (struct coff_final_link_info *, bfd *); 5835796c8dcSSimon Schubert extern bfd_boolean _bfd_coff_reloc_link_order 5845796c8dcSSimon Schubert (bfd *, struct coff_final_link_info *, asection *, 5855796c8dcSSimon Schubert struct bfd_link_order *); 5865796c8dcSSimon Schubert 5875796c8dcSSimon Schubert 5885796c8dcSSimon Schubert #define coff_get_section_contents_in_window \ 5895796c8dcSSimon Schubert _bfd_generic_get_section_contents_in_window 5905796c8dcSSimon Schubert 5915796c8dcSSimon Schubert /* Functions in xcofflink.c. */ 5925796c8dcSSimon Schubert 5935796c8dcSSimon Schubert extern long _bfd_xcoff_get_dynamic_symtab_upper_bound 5945796c8dcSSimon Schubert (bfd *); 5955796c8dcSSimon Schubert extern long _bfd_xcoff_canonicalize_dynamic_symtab 5965796c8dcSSimon Schubert (bfd *, asymbol **); 5975796c8dcSSimon Schubert extern long _bfd_xcoff_get_dynamic_reloc_upper_bound 5985796c8dcSSimon Schubert (bfd *); 5995796c8dcSSimon Schubert extern long _bfd_xcoff_canonicalize_dynamic_reloc 6005796c8dcSSimon Schubert (bfd *, arelent **, asymbol **); 6015796c8dcSSimon Schubert extern struct bfd_link_hash_table *_bfd_xcoff_bfd_link_hash_table_create 6025796c8dcSSimon Schubert (bfd *); 6035796c8dcSSimon Schubert extern void _bfd_xcoff_bfd_link_hash_table_free 6045796c8dcSSimon Schubert (struct bfd_link_hash_table *); 6055796c8dcSSimon Schubert extern bfd_boolean _bfd_xcoff_bfd_link_add_symbols 6065796c8dcSSimon Schubert (bfd *, struct bfd_link_info *); 6075796c8dcSSimon Schubert extern bfd_boolean _bfd_xcoff_bfd_final_link 6085796c8dcSSimon Schubert (bfd *, struct bfd_link_info *); 6095796c8dcSSimon Schubert extern bfd_boolean _bfd_xcoff_define_common_symbol 6105796c8dcSSimon Schubert (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *); 6115796c8dcSSimon Schubert extern bfd_boolean _bfd_ppc_xcoff_relocate_section 6125796c8dcSSimon Schubert (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, 6135796c8dcSSimon Schubert struct internal_reloc *, struct internal_syment *, asection **); 6145796c8dcSSimon Schubert 6155796c8dcSSimon Schubert /* Functions in coff-ppc.c. FIXME: These are called by pe.em in the 6165796c8dcSSimon Schubert linker, and so should start with bfd and be declared in bfd.h. */ 6175796c8dcSSimon Schubert 6185796c8dcSSimon Schubert extern bfd_boolean ppc_allocate_toc_section 6195796c8dcSSimon Schubert (struct bfd_link_info *); 6205796c8dcSSimon Schubert extern bfd_boolean ppc_process_before_allocation 6215796c8dcSSimon Schubert (bfd *, struct bfd_link_info *); 6225796c8dcSSimon Schubert /* Extracted from coffcode.h. */ 6235796c8dcSSimon Schubert typedef struct coff_ptr_struct 6245796c8dcSSimon Schubert { 6255796c8dcSSimon Schubert /* Remembers the offset from the first symbol in the file for 6265796c8dcSSimon Schubert this symbol. Generated by coff_renumber_symbols. */ 6275796c8dcSSimon Schubert unsigned int offset; 6285796c8dcSSimon Schubert 6295796c8dcSSimon Schubert /* Should the value of this symbol be renumbered. Used for 6305796c8dcSSimon Schubert XCOFF C_BSTAT symbols. Set by coff_slurp_symbol_table. */ 6315796c8dcSSimon Schubert unsigned int fix_value : 1; 6325796c8dcSSimon Schubert 6335796c8dcSSimon Schubert /* Should the tag field of this symbol be renumbered. 6345796c8dcSSimon Schubert Created by coff_pointerize_aux. */ 6355796c8dcSSimon Schubert unsigned int fix_tag : 1; 6365796c8dcSSimon Schubert 6375796c8dcSSimon Schubert /* Should the endidx field of this symbol be renumbered. 6385796c8dcSSimon Schubert Created by coff_pointerize_aux. */ 6395796c8dcSSimon Schubert unsigned int fix_end : 1; 6405796c8dcSSimon Schubert 6415796c8dcSSimon Schubert /* Should the x_csect.x_scnlen field be renumbered. 6425796c8dcSSimon Schubert Created by coff_pointerize_aux. */ 6435796c8dcSSimon Schubert unsigned int fix_scnlen : 1; 6445796c8dcSSimon Schubert 6455796c8dcSSimon Schubert /* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the 6465796c8dcSSimon Schubert index into the line number entries. Set by coff_slurp_symbol_table. */ 6475796c8dcSSimon Schubert unsigned int fix_line : 1; 6485796c8dcSSimon Schubert 6495796c8dcSSimon Schubert /* The container for the symbol structure as read and translated 6505796c8dcSSimon Schubert from the file. */ 6515796c8dcSSimon Schubert union 6525796c8dcSSimon Schubert { 6535796c8dcSSimon Schubert union internal_auxent auxent; 6545796c8dcSSimon Schubert struct internal_syment syment; 6555796c8dcSSimon Schubert } u; 6565796c8dcSSimon Schubert } combined_entry_type; 6575796c8dcSSimon Schubert 6585796c8dcSSimon Schubert 6595796c8dcSSimon Schubert /* Each canonical asymbol really looks like this: */ 6605796c8dcSSimon Schubert 6615796c8dcSSimon Schubert typedef struct coff_symbol_struct 6625796c8dcSSimon Schubert { 6635796c8dcSSimon Schubert /* The actual symbol which the rest of BFD works with */ 6645796c8dcSSimon Schubert asymbol symbol; 6655796c8dcSSimon Schubert 6665796c8dcSSimon Schubert /* A pointer to the hidden information for this symbol */ 6675796c8dcSSimon Schubert combined_entry_type *native; 6685796c8dcSSimon Schubert 6695796c8dcSSimon Schubert /* A pointer to the linenumber information for this symbol */ 6705796c8dcSSimon Schubert struct lineno_cache_entry *lineno; 6715796c8dcSSimon Schubert 6725796c8dcSSimon Schubert /* Have the line numbers been relocated yet ? */ 6735796c8dcSSimon Schubert bfd_boolean done_lineno; 6745796c8dcSSimon Schubert } coff_symbol_type; 6755796c8dcSSimon Schubert /* COFF symbol classifications. */ 6765796c8dcSSimon Schubert 6775796c8dcSSimon Schubert enum coff_symbol_classification 6785796c8dcSSimon Schubert { 6795796c8dcSSimon Schubert /* Global symbol. */ 6805796c8dcSSimon Schubert COFF_SYMBOL_GLOBAL, 6815796c8dcSSimon Schubert /* Common symbol. */ 6825796c8dcSSimon Schubert COFF_SYMBOL_COMMON, 6835796c8dcSSimon Schubert /* Undefined symbol. */ 6845796c8dcSSimon Schubert COFF_SYMBOL_UNDEFINED, 6855796c8dcSSimon Schubert /* Local symbol. */ 6865796c8dcSSimon Schubert COFF_SYMBOL_LOCAL, 6875796c8dcSSimon Schubert /* PE section symbol. */ 6885796c8dcSSimon Schubert COFF_SYMBOL_PE_SECTION 6895796c8dcSSimon Schubert }; 6905796c8dcSSimon Schubert 6915796c8dcSSimon Schubert typedef struct 6925796c8dcSSimon Schubert { 6935796c8dcSSimon Schubert void (*_bfd_coff_swap_aux_in) 6945796c8dcSSimon Schubert (bfd *, void *, int, int, int, int, void *); 6955796c8dcSSimon Schubert 6965796c8dcSSimon Schubert void (*_bfd_coff_swap_sym_in) 6975796c8dcSSimon Schubert (bfd *, void *, void *); 6985796c8dcSSimon Schubert 6995796c8dcSSimon Schubert void (*_bfd_coff_swap_lineno_in) 7005796c8dcSSimon Schubert (bfd *, void *, void *); 7015796c8dcSSimon Schubert 7025796c8dcSSimon Schubert unsigned int (*_bfd_coff_swap_aux_out) 7035796c8dcSSimon Schubert (bfd *, void *, int, int, int, int, void *); 7045796c8dcSSimon Schubert 7055796c8dcSSimon Schubert unsigned int (*_bfd_coff_swap_sym_out) 7065796c8dcSSimon Schubert (bfd *, void *, void *); 7075796c8dcSSimon Schubert 7085796c8dcSSimon Schubert unsigned int (*_bfd_coff_swap_lineno_out) 7095796c8dcSSimon Schubert (bfd *, void *, void *); 7105796c8dcSSimon Schubert 7115796c8dcSSimon Schubert unsigned int (*_bfd_coff_swap_reloc_out) 7125796c8dcSSimon Schubert (bfd *, void *, void *); 7135796c8dcSSimon Schubert 7145796c8dcSSimon Schubert unsigned int (*_bfd_coff_swap_filehdr_out) 7155796c8dcSSimon Schubert (bfd *, void *, void *); 7165796c8dcSSimon Schubert 7175796c8dcSSimon Schubert unsigned int (*_bfd_coff_swap_aouthdr_out) 7185796c8dcSSimon Schubert (bfd *, void *, void *); 7195796c8dcSSimon Schubert 7205796c8dcSSimon Schubert unsigned int (*_bfd_coff_swap_scnhdr_out) 7215796c8dcSSimon Schubert (bfd *, void *, void *); 7225796c8dcSSimon Schubert 7235796c8dcSSimon Schubert unsigned int _bfd_filhsz; 7245796c8dcSSimon Schubert unsigned int _bfd_aoutsz; 7255796c8dcSSimon Schubert unsigned int _bfd_scnhsz; 7265796c8dcSSimon Schubert unsigned int _bfd_symesz; 7275796c8dcSSimon Schubert unsigned int _bfd_auxesz; 7285796c8dcSSimon Schubert unsigned int _bfd_relsz; 7295796c8dcSSimon Schubert unsigned int _bfd_linesz; 7305796c8dcSSimon Schubert unsigned int _bfd_filnmlen; 7315796c8dcSSimon Schubert bfd_boolean _bfd_coff_long_filenames; 7325796c8dcSSimon Schubert 7335796c8dcSSimon Schubert bfd_boolean _bfd_coff_long_section_names; 7345796c8dcSSimon Schubert bfd_boolean (*_bfd_coff_set_long_section_names) 7355796c8dcSSimon Schubert (bfd *, int); 7365796c8dcSSimon Schubert 7375796c8dcSSimon Schubert unsigned int _bfd_coff_default_section_alignment_power; 7385796c8dcSSimon Schubert bfd_boolean _bfd_coff_force_symnames_in_strings; 7395796c8dcSSimon Schubert unsigned int _bfd_coff_debug_string_prefix_length; 7405796c8dcSSimon Schubert 7415796c8dcSSimon Schubert void (*_bfd_coff_swap_filehdr_in) 7425796c8dcSSimon Schubert (bfd *, void *, void *); 7435796c8dcSSimon Schubert 7445796c8dcSSimon Schubert void (*_bfd_coff_swap_aouthdr_in) 7455796c8dcSSimon Schubert (bfd *, void *, void *); 7465796c8dcSSimon Schubert 7475796c8dcSSimon Schubert void (*_bfd_coff_swap_scnhdr_in) 7485796c8dcSSimon Schubert (bfd *, void *, void *); 7495796c8dcSSimon Schubert 7505796c8dcSSimon Schubert void (*_bfd_coff_swap_reloc_in) 7515796c8dcSSimon Schubert (bfd *abfd, void *, void *); 7525796c8dcSSimon Schubert 7535796c8dcSSimon Schubert bfd_boolean (*_bfd_coff_bad_format_hook) 7545796c8dcSSimon Schubert (bfd *, void *); 7555796c8dcSSimon Schubert 7565796c8dcSSimon Schubert bfd_boolean (*_bfd_coff_set_arch_mach_hook) 7575796c8dcSSimon Schubert (bfd *, void *); 7585796c8dcSSimon Schubert 7595796c8dcSSimon Schubert void * (*_bfd_coff_mkobject_hook) 7605796c8dcSSimon Schubert (bfd *, void *, void *); 7615796c8dcSSimon Schubert 7625796c8dcSSimon Schubert bfd_boolean (*_bfd_styp_to_sec_flags_hook) 7635796c8dcSSimon Schubert (bfd *, void *, const char *, asection *, flagword *); 7645796c8dcSSimon Schubert 7655796c8dcSSimon Schubert void (*_bfd_set_alignment_hook) 7665796c8dcSSimon Schubert (bfd *, asection *, void *); 7675796c8dcSSimon Schubert 7685796c8dcSSimon Schubert bfd_boolean (*_bfd_coff_slurp_symbol_table) 7695796c8dcSSimon Schubert (bfd *); 7705796c8dcSSimon Schubert 7715796c8dcSSimon Schubert bfd_boolean (*_bfd_coff_symname_in_debug) 7725796c8dcSSimon Schubert (bfd *, struct internal_syment *); 7735796c8dcSSimon Schubert 7745796c8dcSSimon Schubert bfd_boolean (*_bfd_coff_pointerize_aux_hook) 7755796c8dcSSimon Schubert (bfd *, combined_entry_type *, combined_entry_type *, 7765796c8dcSSimon Schubert unsigned int, combined_entry_type *); 7775796c8dcSSimon Schubert 7785796c8dcSSimon Schubert bfd_boolean (*_bfd_coff_print_aux) 7795796c8dcSSimon Schubert (bfd *, FILE *, combined_entry_type *, combined_entry_type *, 7805796c8dcSSimon Schubert combined_entry_type *, unsigned int); 7815796c8dcSSimon Schubert 7825796c8dcSSimon Schubert void (*_bfd_coff_reloc16_extra_cases) 7835796c8dcSSimon Schubert (bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *, 7845796c8dcSSimon Schubert bfd_byte *, unsigned int *, unsigned int *); 7855796c8dcSSimon Schubert 7865796c8dcSSimon Schubert int (*_bfd_coff_reloc16_estimate) 7875796c8dcSSimon Schubert (bfd *, asection *, arelent *, unsigned int, 7885796c8dcSSimon Schubert struct bfd_link_info *); 7895796c8dcSSimon Schubert 7905796c8dcSSimon Schubert enum coff_symbol_classification (*_bfd_coff_classify_symbol) 7915796c8dcSSimon Schubert (bfd *, struct internal_syment *); 7925796c8dcSSimon Schubert 7935796c8dcSSimon Schubert bfd_boolean (*_bfd_coff_compute_section_file_positions) 7945796c8dcSSimon Schubert (bfd *); 7955796c8dcSSimon Schubert 7965796c8dcSSimon Schubert bfd_boolean (*_bfd_coff_start_final_link) 7975796c8dcSSimon Schubert (bfd *, struct bfd_link_info *); 7985796c8dcSSimon Schubert 7995796c8dcSSimon Schubert bfd_boolean (*_bfd_coff_relocate_section) 8005796c8dcSSimon Schubert (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, 8015796c8dcSSimon Schubert struct internal_reloc *, struct internal_syment *, asection **); 8025796c8dcSSimon Schubert 8035796c8dcSSimon Schubert reloc_howto_type *(*_bfd_coff_rtype_to_howto) 8045796c8dcSSimon Schubert (bfd *, asection *, struct internal_reloc *, 8055796c8dcSSimon Schubert struct coff_link_hash_entry *, struct internal_syment *, 8065796c8dcSSimon Schubert bfd_vma *); 8075796c8dcSSimon Schubert 8085796c8dcSSimon Schubert bfd_boolean (*_bfd_coff_adjust_symndx) 8095796c8dcSSimon Schubert (bfd *, struct bfd_link_info *, bfd *, asection *, 8105796c8dcSSimon Schubert struct internal_reloc *, bfd_boolean *); 8115796c8dcSSimon Schubert 8125796c8dcSSimon Schubert bfd_boolean (*_bfd_coff_link_add_one_symbol) 8135796c8dcSSimon Schubert (struct bfd_link_info *, bfd *, const char *, flagword, 8145796c8dcSSimon Schubert asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean, 8155796c8dcSSimon Schubert struct bfd_link_hash_entry **); 8165796c8dcSSimon Schubert 8175796c8dcSSimon Schubert bfd_boolean (*_bfd_coff_link_output_has_begun) 8185796c8dcSSimon Schubert (bfd *, struct coff_final_link_info *); 8195796c8dcSSimon Schubert 8205796c8dcSSimon Schubert bfd_boolean (*_bfd_coff_final_link_postscript) 8215796c8dcSSimon Schubert (bfd *, struct coff_final_link_info *); 8225796c8dcSSimon Schubert 8235796c8dcSSimon Schubert bfd_boolean (*_bfd_coff_print_pdata) 8245796c8dcSSimon Schubert (bfd *, void *); 8255796c8dcSSimon Schubert 8265796c8dcSSimon Schubert } bfd_coff_backend_data; 8275796c8dcSSimon Schubert 8285796c8dcSSimon Schubert #define coff_backend_info(abfd) \ 8295796c8dcSSimon Schubert ((bfd_coff_backend_data *) (abfd)->xvec->backend_data) 8305796c8dcSSimon Schubert 8315796c8dcSSimon Schubert #define bfd_coff_swap_aux_in(a,e,t,c,ind,num,i) \ 8325796c8dcSSimon Schubert ((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i)) 8335796c8dcSSimon Schubert 8345796c8dcSSimon Schubert #define bfd_coff_swap_sym_in(a,e,i) \ 8355796c8dcSSimon Schubert ((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i)) 8365796c8dcSSimon Schubert 8375796c8dcSSimon Schubert #define bfd_coff_swap_lineno_in(a,e,i) \ 8385796c8dcSSimon Schubert ((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i)) 8395796c8dcSSimon Schubert 8405796c8dcSSimon Schubert #define bfd_coff_swap_reloc_out(abfd, i, o) \ 8415796c8dcSSimon Schubert ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o)) 8425796c8dcSSimon Schubert 8435796c8dcSSimon Schubert #define bfd_coff_swap_lineno_out(abfd, i, o) \ 8445796c8dcSSimon Schubert ((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o)) 8455796c8dcSSimon Schubert 8465796c8dcSSimon Schubert #define bfd_coff_swap_aux_out(a,i,t,c,ind,num,o) \ 8475796c8dcSSimon Schubert ((coff_backend_info (a)->_bfd_coff_swap_aux_out) (a,i,t,c,ind,num,o)) 8485796c8dcSSimon Schubert 8495796c8dcSSimon Schubert #define bfd_coff_swap_sym_out(abfd, i,o) \ 8505796c8dcSSimon Schubert ((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o)) 8515796c8dcSSimon Schubert 8525796c8dcSSimon Schubert #define bfd_coff_swap_scnhdr_out(abfd, i,o) \ 8535796c8dcSSimon Schubert ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o)) 8545796c8dcSSimon Schubert 8555796c8dcSSimon Schubert #define bfd_coff_swap_filehdr_out(abfd, i,o) \ 8565796c8dcSSimon Schubert ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o)) 8575796c8dcSSimon Schubert 8585796c8dcSSimon Schubert #define bfd_coff_swap_aouthdr_out(abfd, i,o) \ 8595796c8dcSSimon Schubert ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o)) 8605796c8dcSSimon Schubert 8615796c8dcSSimon Schubert #define bfd_coff_filhsz(abfd) (coff_backend_info (abfd)->_bfd_filhsz) 8625796c8dcSSimon Schubert #define bfd_coff_aoutsz(abfd) (coff_backend_info (abfd)->_bfd_aoutsz) 8635796c8dcSSimon Schubert #define bfd_coff_scnhsz(abfd) (coff_backend_info (abfd)->_bfd_scnhsz) 8645796c8dcSSimon Schubert #define bfd_coff_symesz(abfd) (coff_backend_info (abfd)->_bfd_symesz) 8655796c8dcSSimon Schubert #define bfd_coff_auxesz(abfd) (coff_backend_info (abfd)->_bfd_auxesz) 8665796c8dcSSimon Schubert #define bfd_coff_relsz(abfd) (coff_backend_info (abfd)->_bfd_relsz) 8675796c8dcSSimon Schubert #define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz) 8685796c8dcSSimon Schubert #define bfd_coff_filnmlen(abfd) (coff_backend_info (abfd)->_bfd_filnmlen) 8695796c8dcSSimon Schubert #define bfd_coff_long_filenames(abfd) \ 8705796c8dcSSimon Schubert (coff_backend_info (abfd)->_bfd_coff_long_filenames) 8715796c8dcSSimon Schubert #define bfd_coff_long_section_names(abfd) \ 8725796c8dcSSimon Schubert (coff_backend_info (abfd)->_bfd_coff_long_section_names) 8735796c8dcSSimon Schubert #define bfd_coff_set_long_section_names(abfd, enable) \ 8745796c8dcSSimon Schubert ((coff_backend_info (abfd)->_bfd_coff_set_long_section_names) (abfd, enable)) 8755796c8dcSSimon Schubert #define bfd_coff_default_section_alignment_power(abfd) \ 8765796c8dcSSimon Schubert (coff_backend_info (abfd)->_bfd_coff_default_section_alignment_power) 8775796c8dcSSimon Schubert #define bfd_coff_swap_filehdr_in(abfd, i,o) \ 8785796c8dcSSimon Schubert ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o)) 8795796c8dcSSimon Schubert 8805796c8dcSSimon Schubert #define bfd_coff_swap_aouthdr_in(abfd, i,o) \ 8815796c8dcSSimon Schubert ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o)) 8825796c8dcSSimon Schubert 8835796c8dcSSimon Schubert #define bfd_coff_swap_scnhdr_in(abfd, i,o) \ 8845796c8dcSSimon Schubert ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o)) 8855796c8dcSSimon Schubert 8865796c8dcSSimon Schubert #define bfd_coff_swap_reloc_in(abfd, i, o) \ 8875796c8dcSSimon Schubert ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_in) (abfd, i, o)) 8885796c8dcSSimon Schubert 8895796c8dcSSimon Schubert #define bfd_coff_bad_format_hook(abfd, filehdr) \ 8905796c8dcSSimon Schubert ((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr)) 8915796c8dcSSimon Schubert 8925796c8dcSSimon Schubert #define bfd_coff_set_arch_mach_hook(abfd, filehdr)\ 8935796c8dcSSimon Schubert ((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr)) 8945796c8dcSSimon Schubert #define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\ 8955796c8dcSSimon Schubert ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook)\ 8965796c8dcSSimon Schubert (abfd, filehdr, aouthdr)) 8975796c8dcSSimon Schubert 8985796c8dcSSimon Schubert #define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name, section, flags_ptr)\ 8995796c8dcSSimon Schubert ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook)\ 9005796c8dcSSimon Schubert (abfd, scnhdr, name, section, flags_ptr)) 9015796c8dcSSimon Schubert 9025796c8dcSSimon Schubert #define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\ 9035796c8dcSSimon Schubert ((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr)) 9045796c8dcSSimon Schubert 9055796c8dcSSimon Schubert #define bfd_coff_slurp_symbol_table(abfd)\ 9065796c8dcSSimon Schubert ((coff_backend_info (abfd)->_bfd_coff_slurp_symbol_table) (abfd)) 9075796c8dcSSimon Schubert 9085796c8dcSSimon Schubert #define bfd_coff_symname_in_debug(abfd, sym)\ 9095796c8dcSSimon Schubert ((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym)) 9105796c8dcSSimon Schubert 9115796c8dcSSimon Schubert #define bfd_coff_force_symnames_in_strings(abfd)\ 9125796c8dcSSimon Schubert (coff_backend_info (abfd)->_bfd_coff_force_symnames_in_strings) 9135796c8dcSSimon Schubert 9145796c8dcSSimon Schubert #define bfd_coff_debug_string_prefix_length(abfd)\ 9155796c8dcSSimon Schubert (coff_backend_info (abfd)->_bfd_coff_debug_string_prefix_length) 9165796c8dcSSimon Schubert 9175796c8dcSSimon Schubert #define bfd_coff_print_aux(abfd, file, base, symbol, aux, indaux)\ 9185796c8dcSSimon Schubert ((coff_backend_info (abfd)->_bfd_coff_print_aux)\ 9195796c8dcSSimon Schubert (abfd, file, base, symbol, aux, indaux)) 9205796c8dcSSimon Schubert 9215796c8dcSSimon Schubert #define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order,\ 9225796c8dcSSimon Schubert reloc, data, src_ptr, dst_ptr)\ 9235796c8dcSSimon Schubert ((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\ 9245796c8dcSSimon Schubert (abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)) 9255796c8dcSSimon Schubert 9265796c8dcSSimon Schubert #define bfd_coff_reloc16_estimate(abfd, section, reloc, shrink, link_info)\ 9275796c8dcSSimon Schubert ((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\ 9285796c8dcSSimon Schubert (abfd, section, reloc, shrink, link_info)) 9295796c8dcSSimon Schubert 9305796c8dcSSimon Schubert #define bfd_coff_classify_symbol(abfd, sym)\ 9315796c8dcSSimon Schubert ((coff_backend_info (abfd)->_bfd_coff_classify_symbol)\ 9325796c8dcSSimon Schubert (abfd, sym)) 9335796c8dcSSimon Schubert 9345796c8dcSSimon Schubert #define bfd_coff_compute_section_file_positions(abfd)\ 9355796c8dcSSimon Schubert ((coff_backend_info (abfd)->_bfd_coff_compute_section_file_positions)\ 9365796c8dcSSimon Schubert (abfd)) 9375796c8dcSSimon Schubert 9385796c8dcSSimon Schubert #define bfd_coff_start_final_link(obfd, info)\ 9395796c8dcSSimon Schubert ((coff_backend_info (obfd)->_bfd_coff_start_final_link)\ 9405796c8dcSSimon Schubert (obfd, info)) 9415796c8dcSSimon Schubert #define bfd_coff_relocate_section(obfd,info,ibfd,o,con,rel,isyms,secs)\ 9425796c8dcSSimon Schubert ((coff_backend_info (ibfd)->_bfd_coff_relocate_section)\ 9435796c8dcSSimon Schubert (obfd, info, ibfd, o, con, rel, isyms, secs)) 9445796c8dcSSimon Schubert #define bfd_coff_rtype_to_howto(abfd, sec, rel, h, sym, addendp)\ 9455796c8dcSSimon Schubert ((coff_backend_info (abfd)->_bfd_coff_rtype_to_howto)\ 9465796c8dcSSimon Schubert (abfd, sec, rel, h, sym, addendp)) 9475796c8dcSSimon Schubert #define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\ 9485796c8dcSSimon Schubert ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\ 9495796c8dcSSimon Schubert (obfd, info, ibfd, sec, rel, adjustedp)) 9505796c8dcSSimon Schubert #define bfd_coff_link_add_one_symbol(info, abfd, name, flags, section,\ 9515796c8dcSSimon Schubert value, string, cp, coll, hashp)\ 9525796c8dcSSimon Schubert ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\ 9535796c8dcSSimon Schubert (info, abfd, name, flags, section, value, string, cp, coll, hashp)) 9545796c8dcSSimon Schubert 9555796c8dcSSimon Schubert #define bfd_coff_link_output_has_begun(a,p) \ 9565796c8dcSSimon Schubert ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a, p)) 9575796c8dcSSimon Schubert #define bfd_coff_final_link_postscript(a,p) \ 9585796c8dcSSimon Schubert ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a, p)) 9595796c8dcSSimon Schubert 9605796c8dcSSimon Schubert #define bfd_coff_have_print_pdata(a) \ 9615796c8dcSSimon Schubert (coff_backend_info (a)->_bfd_coff_print_pdata) 9625796c8dcSSimon Schubert #define bfd_coff_print_pdata(a,p) \ 9635796c8dcSSimon Schubert ((coff_backend_info (a)->_bfd_coff_print_pdata) (a, p)) 9645796c8dcSSimon Schubert 9655796c8dcSSimon Schubert /* Macro: Returns true if the bfd is a PE executable as opposed to a 9665796c8dcSSimon Schubert PE object file. */ 9675796c8dcSSimon Schubert #define bfd_pei_p(abfd) \ 9685796c8dcSSimon Schubert (CONST_STRNEQ ((abfd)->xvec->name, "pei-")) 969