xref: /openbsd/gnu/usr.bin/binutils/ld/ldctor.h (revision 007c2a45)
12159047fSniklas /* ldctor.h - linker constructor support
2*007c2a45Smiod    Copyright 1991, 1992, 1993, 1994, 1995, 1998, 2000, 2002, 2003
3b55d4692Sfgsch    Free Software Foundation, Inc.
42159047fSniklas 
52159047fSniklas This file is part of GLD, the Gnu Linker.
62159047fSniklas 
72159047fSniklas GLD is free software; you can redistribute it and/or modify
82159047fSniklas it under the terms of the GNU General Public License as published by
92159047fSniklas the Free Software Foundation; either version 2, or (at your option)
102159047fSniklas any later version.
112159047fSniklas 
122159047fSniklas GLD is distributed in the hope that it will be useful,
132159047fSniklas but WITHOUT ANY WARRANTY; without even the implied warranty of
142159047fSniklas MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
152159047fSniklas GNU General Public License for more details.
162159047fSniklas 
172159047fSniklas You should have received a copy of the GNU General Public License
18f7cc78ecSespie along with GLD; see the file COPYING.  If not, write to the Free
19f7cc78ecSespie Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20f7cc78ecSespie 02111-1307, USA.  */
212159047fSniklas 
222159047fSniklas #ifndef LDCTOR_H
232159047fSniklas #define LDCTOR_H
242159047fSniklas 
252159047fSniklas /* List of statements needed to handle constructors */
262159047fSniklas extern lang_statement_list_type constructor_list;
272159047fSniklas 
28f7cc78ecSespie /* Whether the constructors should be sorted.  Note that this is
29f7cc78ecSespie    global for the entire link; we assume that there is only a single
30f7cc78ecSespie    CONSTRUCTORS command in the linker script.  */
31c074d1c9Sdrahn extern bfd_boolean constructors_sorted;
32f7cc78ecSespie 
332159047fSniklas /* We keep a list of these structures for each set we build.  */
342159047fSniklas 
35b55d4692Sfgsch struct set_info {
362159047fSniklas   struct set_info *next;		/* Next set.  */
372159047fSniklas   struct bfd_link_hash_entry *h;	/* Hash table entry.  */
382159047fSniklas   bfd_reloc_code_real_type reloc;	/* Reloc to use for an entry.  */
392159047fSniklas   size_t count;				/* Number of elements.  */
402159047fSniklas   struct set_element *elements;		/* Elements in set.  */
412159047fSniklas };
422159047fSniklas 
43b55d4692Sfgsch struct set_element {
442159047fSniklas   struct set_element *next;		/* Next element.  */
452159047fSniklas   const char *name;			/* Name in set (may be NULL).  */
462159047fSniklas   asection *section;			/* Section of value in set.  */
472159047fSniklas   bfd_vma value;			/* Value in set.  */
482159047fSniklas };
492159047fSniklas 
502159047fSniklas /* The sets we have seen.  */
512159047fSniklas 
522159047fSniklas extern struct set_info *sets;
532159047fSniklas 
54c074d1c9Sdrahn extern void ldctor_add_set_entry
55*007c2a45Smiod   (struct bfd_link_hash_entry *, bfd_reloc_code_real_type, const char *,
56*007c2a45Smiod    asection *, bfd_vma);
57c074d1c9Sdrahn extern void ldctor_build_sets
58*007c2a45Smiod   (void);
592159047fSniklas 
602159047fSniklas #endif
61