1*a9fa9459Szrj /* BFD COFF interfaces used outside of BFD. 2*a9fa9459Szrj Copyright (C) 1990-2016 Free Software Foundation, Inc. 3*a9fa9459Szrj Written by Cygnus Support. 4*a9fa9459Szrj 5*a9fa9459Szrj This file is part of BFD, the Binary File Descriptor library. 6*a9fa9459Szrj 7*a9fa9459Szrj This program is free software; you can redistribute it and/or modify 8*a9fa9459Szrj it under the terms of the GNU General Public License as published by 9*a9fa9459Szrj the Free Software Foundation; either version 3 of the License, or 10*a9fa9459Szrj (at your option) any later version. 11*a9fa9459Szrj 12*a9fa9459Szrj This program is distributed in the hope that it will be useful, 13*a9fa9459Szrj but WITHOUT ANY WARRANTY; without even the implied warranty of 14*a9fa9459Szrj MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15*a9fa9459Szrj GNU General Public License for more details. 16*a9fa9459Szrj 17*a9fa9459Szrj You should have received a copy of the GNU General Public License 18*a9fa9459Szrj along with this program; if not, write to the Free Software 19*a9fa9459Szrj Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, 20*a9fa9459Szrj MA 02110-1301, USA. */ 21*a9fa9459Szrj 22*a9fa9459Szrj /* This structure is used for a comdat section, as in PE. A comdat 23*a9fa9459Szrj section is associated with a particular symbol. When the linker 24*a9fa9459Szrj sees a comdat section, it keeps only one of the sections with a 25*a9fa9459Szrj given name and associated with a given symbol. */ 26*a9fa9459Szrj 27*a9fa9459Szrj struct coff_comdat_info 28*a9fa9459Szrj { 29*a9fa9459Szrj /* The name of the symbol associated with a comdat section. */ 30*a9fa9459Szrj const char *name; 31*a9fa9459Szrj 32*a9fa9459Szrj /* The local symbol table index of the symbol associated with a 33*a9fa9459Szrj comdat section. This is only meaningful to the object file format 34*a9fa9459Szrj specific code; it is not an index into the list returned by 35*a9fa9459Szrj bfd_canonicalize_symtab. */ 36*a9fa9459Szrj long symbol; 37*a9fa9459Szrj }; 38*a9fa9459Szrj 39*a9fa9459Szrj /* The used_by_bfd field of a section may be set to a pointer to this 40*a9fa9459Szrj structure. */ 41*a9fa9459Szrj 42*a9fa9459Szrj struct coff_section_tdata 43*a9fa9459Szrj { 44*a9fa9459Szrj /* The relocs, swapped into COFF internal form. This may be NULL. */ 45*a9fa9459Szrj struct internal_reloc *relocs; 46*a9fa9459Szrj /* If this is TRUE, the relocs entry may not be freed. */ 47*a9fa9459Szrj bfd_boolean keep_relocs; 48*a9fa9459Szrj /* The section contents. This may be NULL. */ 49*a9fa9459Szrj bfd_byte *contents; 50*a9fa9459Szrj /* If this is TRUE, the contents entry may not be freed. */ 51*a9fa9459Szrj bfd_boolean keep_contents; 52*a9fa9459Szrj /* Information cached by coff_find_nearest_line. */ 53*a9fa9459Szrj bfd_vma offset; 54*a9fa9459Szrj unsigned int i; 55*a9fa9459Szrj const char *function; 56*a9fa9459Szrj /* Optional information about a COMDAT entry; NULL if not COMDAT. */ 57*a9fa9459Szrj struct coff_comdat_info *comdat; 58*a9fa9459Szrj int line_base; 59*a9fa9459Szrj /* A pointer used for .stab linking optimizations. */ 60*a9fa9459Szrj void * stab_info; 61*a9fa9459Szrj /* Available for individual backends. */ 62*a9fa9459Szrj void * tdata; 63*a9fa9459Szrj }; 64*a9fa9459Szrj 65*a9fa9459Szrj /* An accessor macro for the coff_section_tdata structure. */ 66*a9fa9459Szrj #define coff_section_data(abfd, sec) \ 67*a9fa9459Szrj ((struct coff_section_tdata *) (sec)->used_by_bfd) 68*a9fa9459Szrj 69*a9fa9459Szrj #define bfd_coff_get_comdat_section(abfd, sec) \ 70*a9fa9459Szrj ((bfd_get_flavour (abfd) == bfd_target_coff_flavour \ 71*a9fa9459Szrj && coff_section_data (abfd, sec) != NULL) \ 72*a9fa9459Szrj ? coff_section_data (abfd, sec)->comdat : NULL) 73*a9fa9459Szrj 74*a9fa9459Szrj #define coff_symbol_from(symbol) \ 75*a9fa9459Szrj ((bfd_family_coff (bfd_asymbol_bfd (symbol)) \ 76*a9fa9459Szrj && bfd_asymbol_bfd (symbol)->tdata.coff_obj_data) \ 77*a9fa9459Szrj ? (coff_symbol_type *) (symbol) : NULL) 78*a9fa9459Szrj 79*a9fa9459Szrj struct internal_syment; 80*a9fa9459Szrj union internal_auxent; 81*a9fa9459Szrj 82*a9fa9459Szrj extern bfd_boolean bfd_coff_get_syment 83*a9fa9459Szrj (bfd *, struct bfd_symbol *, struct internal_syment *); 84*a9fa9459Szrj 85*a9fa9459Szrj extern bfd_boolean bfd_coff_get_auxent 86*a9fa9459Szrj (bfd *, struct bfd_symbol *, int, union internal_auxent *); 87