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