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