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