mmix.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /* MMIX support for BFD.
  2. Copyright (C) 2001-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. /* This file holds definitions specific to the MMIX ELF ABI. */
  17. #ifndef ELF_MMIX_H
  18. #define ELF_MMIX_H
  19. #include "elf/reloc-macros.h"
  20. /* Relocations. See the reloc table in bfd/elf64-mmix.c for details. */
  21. START_RELOC_NUMBERS (elf_mmix_reloc_type)
  22. RELOC_NUMBER (R_MMIX_NONE, 0)
  23. /* Standard absolute relocations. */
  24. RELOC_NUMBER (R_MMIX_8, 1)
  25. RELOC_NUMBER (R_MMIX_16, 2)
  26. RELOC_NUMBER (R_MMIX_24, 3)
  27. RELOC_NUMBER (R_MMIX_32, 4)
  28. RELOC_NUMBER (R_MMIX_64, 5)
  29. /* Standard relative relocations. */
  30. RELOC_NUMBER (R_MMIX_PC_8, 6)
  31. RELOC_NUMBER (R_MMIX_PC_16, 7)
  32. RELOC_NUMBER (R_MMIX_PC_24, 8)
  33. RELOC_NUMBER (R_MMIX_PC_32, 9)
  34. RELOC_NUMBER (R_MMIX_PC_64, 10)
  35. /* GNU extensions for C++ vtables. */
  36. RELOC_NUMBER (R_MMIX_GNU_VTINHERIT, 11)
  37. RELOC_NUMBER (R_MMIX_GNU_VTENTRY, 12)
  38. /* A GETA instruction. */
  39. RELOC_NUMBER (R_MMIX_GETA, 13)
  40. RELOC_NUMBER (R_MMIX_GETA_1, 14)
  41. RELOC_NUMBER (R_MMIX_GETA_2, 15)
  42. RELOC_NUMBER (R_MMIX_GETA_3, 16)
  43. /* A conditional branch instruction. */
  44. RELOC_NUMBER (R_MMIX_CBRANCH, 17)
  45. RELOC_NUMBER (R_MMIX_CBRANCH_J, 18)
  46. RELOC_NUMBER (R_MMIX_CBRANCH_1, 19)
  47. RELOC_NUMBER (R_MMIX_CBRANCH_2, 20)
  48. RELOC_NUMBER (R_MMIX_CBRANCH_3, 21)
  49. /* A PUSHJ instruction. */
  50. RELOC_NUMBER (R_MMIX_PUSHJ, 22)
  51. RELOC_NUMBER (R_MMIX_PUSHJ_1, 23)
  52. RELOC_NUMBER (R_MMIX_PUSHJ_2, 24)
  53. RELOC_NUMBER (R_MMIX_PUSHJ_3, 25)
  54. /* A JMP instruction. */
  55. RELOC_NUMBER (R_MMIX_JMP, 26)
  56. RELOC_NUMBER (R_MMIX_JMP_1, 27)
  57. RELOC_NUMBER (R_MMIX_JMP_2, 28)
  58. RELOC_NUMBER (R_MMIX_JMP_3, 29)
  59. /* A relative address such as in a GETA or a branch. */
  60. RELOC_NUMBER (R_MMIX_ADDR19, 30)
  61. /* A relative address such as in a JMP (only). */
  62. RELOC_NUMBER (R_MMIX_ADDR27, 31)
  63. /* A general register or a number 0..255. */
  64. RELOC_NUMBER (R_MMIX_REG_OR_BYTE, 32)
  65. /* A general register. */
  66. RELOC_NUMBER (R_MMIX_REG, 33)
  67. /* A global register and an offset, the global register (allocated at
  68. link time) contents plus the offset made equivalent to the relocation
  69. expression at link time. The relocation must point at the Y field of
  70. an instruction. */
  71. RELOC_NUMBER (R_MMIX_BASE_PLUS_OFFSET, 34)
  72. /* A LOCAL assertion. */
  73. RELOC_NUMBER (R_MMIX_LOCAL, 35)
  74. /* A PUSHJ instruction, generating a stub if it does not reach. */
  75. RELOC_NUMBER (R_MMIX_PUSHJ_STUBBABLE, 36)
  76. END_RELOC_NUMBERS (R_MMIX_max)
  77. /* Section Attributes. */
  78. /* A section containing necessary information for relaxation. */
  79. #define SHF_MMIX_CANRELAX 0x80000000
  80. /* Symbol attributes. */
  81. /* A symbol with this section-index is a register. */
  82. #define SHN_REGISTER SHN_LOPROC
  83. /* This section holds contents for each initialized register, at VMA
  84. regno*8. A symbol relative to this section will be transformed to an
  85. absolute symbol with the value corresponding to the register number at
  86. final link time. A symbol with a value outside the inclusive range
  87. 32*8 .. 254*8 is an error. It is highly recommended to only use an
  88. upper bound of 253*8 or lower as specified in the (currently
  89. unspecified) ABI. */
  90. #define MMIX_REG_CONTENTS_SECTION_NAME ".MMIX.reg_contents"
  91. /* At link time, a section by this name is created, expected to be
  92. included in MMIX_REG_CONTENTS_SECTION_NAME in the output. */
  93. #define MMIX_LD_ALLOCATED_REG_CONTENTS_SECTION_NAME \
  94. ".MMIX.reg_contents.linker_allocated"
  95. /* This is a faked section holding symbols with SHN_REGISTER. Don't
  96. confuse it with MMIX_REG_CONTENTS_SECTION_NAME; this one has no
  97. contents, just values. It is an error for a value in this section to
  98. be outside the range 32..255 and it must never become an actual section
  99. in an object file. */
  100. #define MMIX_REG_SECTION_NAME "*REG*"
  101. /* Appended with a number N=0..65535, this is a representation of the
  102. mmixal "BSPEC N" ... "ESPEC" directive pair; the contents go into an
  103. ELF section by name ".MMIX.spec_data.N". */
  104. #define MMIX_OTHER_SPEC_SECTION_PREFIX ".MMIX.spec_data."
  105. /* A section SECNAME is noted to start at "__.MMIX.start.SECNAME" by the
  106. presence of this symbol. Currently only implemented for ".text"
  107. through the symbol "__.MMIX.start..text". */
  108. #define MMIX_LOC_SECTION_START_SYMBOL_PREFIX "__.MMIX.start."
  109. /* This symbol is always a function. */
  110. #define MMIX_START_SYMBOL_NAME "Main"
  111. /* We smuggle in a few MMO specifics here. We don't make a specific MMO
  112. file, since we can't reasonably support MMO without ELF; we have to
  113. include this file anyway. */
  114. #define MMO_TEXT_SECTION_NAME ".text"
  115. #define MMO_DATA_SECTION_NAME ".data"
  116. /* A definition for the flags we put in spec data in files. A copy of our
  117. own of some flags to keep immune to BFD flag changes. See section.c of
  118. 2001-07-18 for flag documentation. */
  119. #define MMO_SEC_ALLOC 0x001
  120. #define MMO_SEC_LOAD 0x002
  121. #define MMO_SEC_RELOC 0x004
  122. #define MMO_SEC_READONLY 0x010
  123. #define MMO_SEC_CODE 0x020
  124. #define MMO_SEC_DATA 0x040
  125. #define MMO_SEC_NEVER_LOAD 0x400
  126. #define MMO_SEC_IS_COMMON 0x8000
  127. #define MMO_SEC_DEBUGGING 0x10000
  128. #ifdef BFD_ARCH_SIZE
  129. extern bool _bfd_mmix_before_linker_allocation
  130. (bfd *, struct bfd_link_info *);
  131. extern bool _bfd_mmix_after_linker_allocation
  132. (bfd *, struct bfd_link_info *);
  133. extern bool _bfd_mmix_check_all_relocs
  134. (bfd *, struct bfd_link_info *);
  135. #endif
  136. #endif /* ELF_MMIX_H */