elf32-spu.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /* SPU specific support for 32-bit ELF.
  2. Copyright (C) 2006-2022 Free Software Foundation, Inc.
  3. This file is part of BFD, the Binary File Descriptor library.
  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. struct spu_elf_params
  17. {
  18. /* Stash various callbacks for --auto-overlay. */
  19. void (*place_spu_section) (asection *, asection *, const char *);
  20. bfd_size_type (*spu_elf_load_ovl_mgr) (void);
  21. FILE *(*spu_elf_open_overlay_script) (void);
  22. void (*spu_elf_relink) (void);
  23. /* Bit 0 set if --auto-overlay.
  24. Bit 1 set if --auto-relink.
  25. Bit 2 set if --overlay-rodata. */
  26. unsigned int auto_overlay : 3;
  27. #define AUTO_OVERLAY 1
  28. #define AUTO_RELINK 2
  29. #define OVERLAY_RODATA 4
  30. /* Type of overlays, enum _ovly_flavour. */
  31. unsigned int ovly_flavour : 1;
  32. unsigned int compact_stub : 1;
  33. /* Set if we should emit symbols for stubs. */
  34. unsigned int emit_stub_syms : 1;
  35. /* Set if we want stubs on calls out of overlay regions to
  36. non-overlay regions. */
  37. unsigned int non_overlay_stubs : 1;
  38. /* Set if lr liveness analysis should be done. */
  39. unsigned int lrlive_analysis : 1;
  40. /* Set if stack size analysis should be done. */
  41. unsigned int stack_analysis : 1;
  42. /* Set if __stack_* syms will be emitted. */
  43. unsigned int emit_stack_syms : 1;
  44. /* Set if non-icache code should be allowed in icache lines. */
  45. unsigned int non_ia_text : 1;
  46. /* Set when the .fixup section should be generated. */
  47. unsigned int emit_fixups : 1;
  48. /* Range of valid addresses for loadable sections. */
  49. bfd_vma local_store_lo;
  50. bfd_vma local_store_hi;
  51. /* Control --auto-overlay feature. */
  52. unsigned int num_lines;
  53. unsigned int line_size;
  54. unsigned int max_branch;
  55. unsigned int auto_overlay_fixed;
  56. unsigned int auto_overlay_reserved;
  57. int extra_stack_space;
  58. };
  59. /* Extra info kept for SPU sections. */
  60. struct spu_elf_stack_info;
  61. struct _spu_elf_section_data
  62. {
  63. struct bfd_elf_section_data elf;
  64. union {
  65. /* Info kept for input sections. */
  66. struct {
  67. /* Stack analysis info kept for this section. */
  68. struct spu_elf_stack_info *stack_info;
  69. } i;
  70. /* Info kept for output sections. */
  71. struct {
  72. /* Non-zero for overlay output sections. */
  73. unsigned int ovl_index;
  74. unsigned int ovl_buf;
  75. } o;
  76. } u;
  77. };
  78. #define spu_elf_section_data(sec) \
  79. ((struct _spu_elf_section_data *) elf_section_data (sec))
  80. enum _ovly_flavour
  81. {
  82. ovly_normal,
  83. ovly_soft_icache
  84. };
  85. struct _ovl_stream
  86. {
  87. const void *start;
  88. const void *end;
  89. };
  90. extern void spu_elf_setup (struct bfd_link_info *, struct spu_elf_params *);
  91. extern void spu_elf_plugin (int);
  92. extern bool spu_elf_open_builtin_lib (bfd **, const struct _ovl_stream *);
  93. extern bool spu_elf_create_sections (struct bfd_link_info *);
  94. extern bool spu_elf_size_sections (bfd *, struct bfd_link_info *);
  95. extern int spu_elf_find_overlays (struct bfd_link_info *);
  96. extern int spu_elf_size_stubs (struct bfd_link_info *);
  97. extern void spu_elf_place_overlay_data (struct bfd_link_info *);
  98. extern asection *spu_elf_check_vma (struct bfd_link_info *);