ldctor.h 2.0 KB

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