xref: /dragonfly/contrib/binutils-2.34/ld/ldctor.h (revision fae548d3)
1*fae548d3Szrj /* ldctor.h - linker constructor support
2*fae548d3Szrj    Copyright (C) 1991-2020 Free Software Foundation, Inc.
3*fae548d3Szrj 
4*fae548d3Szrj    This file is part of the GNU Binutils.
5*fae548d3Szrj 
6*fae548d3Szrj    This program is free software; you can redistribute it and/or modify
7*fae548d3Szrj    it under the terms of the GNU General Public License as published by
8*fae548d3Szrj    the Free Software Foundation; either version 3 of the License, or
9*fae548d3Szrj    (at your option) any later version.
10*fae548d3Szrj 
11*fae548d3Szrj    This program is distributed in the hope that it will be useful,
12*fae548d3Szrj    but WITHOUT ANY WARRANTY; without even the implied warranty of
13*fae548d3Szrj    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14*fae548d3Szrj    GNU General Public License for more details.
15*fae548d3Szrj 
16*fae548d3Szrj    You should have received a copy of the GNU General Public License
17*fae548d3Szrj    along with this program; if not, write to the Free Software
18*fae548d3Szrj    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
19*fae548d3Szrj    MA 02110-1301, USA.  */
20*fae548d3Szrj 
21*fae548d3Szrj #ifndef LDCTOR_H
22*fae548d3Szrj #define LDCTOR_H
23*fae548d3Szrj 
24*fae548d3Szrj /* List of statements needed to handle constructors */
25*fae548d3Szrj extern lang_statement_list_type constructor_list;
26*fae548d3Szrj 
27*fae548d3Szrj /* Whether the constructors should be sorted.  Note that this is
28*fae548d3Szrj    global for the entire link; we assume that there is only a single
29*fae548d3Szrj    CONSTRUCTORS command in the linker script.  */
30*fae548d3Szrj extern bfd_boolean constructors_sorted;
31*fae548d3Szrj 
32*fae548d3Szrj /* We keep a list of these structures for each set we build.  */
33*fae548d3Szrj 
34*fae548d3Szrj struct set_info {
35*fae548d3Szrj   struct set_info *next;		/* Next set.  */
36*fae548d3Szrj   struct bfd_link_hash_entry *h;	/* Hash table entry.  */
37*fae548d3Szrj   bfd_reloc_code_real_type reloc;	/* Reloc to use for an entry.  */
38*fae548d3Szrj   size_t count;				/* Number of elements.  */
39*fae548d3Szrj   struct set_element *elements;		/* Elements in set.  */
40*fae548d3Szrj };
41*fae548d3Szrj 
42*fae548d3Szrj struct set_element {
43*fae548d3Szrj   union {
44*fae548d3Szrj     struct set_element *next;		/* Next element.  */
45*fae548d3Szrj     long idx;
46*fae548d3Szrj   } u;
47*fae548d3Szrj   const char *name;			/* Name in set (may be NULL).  */
48*fae548d3Szrj   asection *section;			/* Section of value in set.  */
49*fae548d3Szrj   bfd_vma value;			/* Value in set.  */
50*fae548d3Szrj };
51*fae548d3Szrj 
52*fae548d3Szrj /* The sets we have seen.  */
53*fae548d3Szrj 
54*fae548d3Szrj extern struct set_info *sets;
55*fae548d3Szrj 
56*fae548d3Szrj extern void ldctor_add_set_entry
57*fae548d3Szrj   (struct bfd_link_hash_entry *, bfd_reloc_code_real_type, const char *,
58*fae548d3Szrj    asection *, bfd_vma);
59*fae548d3Szrj extern void ldctor_build_sets
60*fae548d3Szrj   (void);
61*fae548d3Szrj 
62*fae548d3Szrj #endif
63