elf32-spu.h 3.7 KB

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