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