cris.h 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. /* CRIS ELF support for BFD.
  2. Copyright (C) 2000-2022 Free Software Foundation, Inc.
  3. Contributed by Axis Communications AB, Lund, Sweden.
  4. Written by Hans-Peter Nilsson.
  5. This file is part of BFD, the Binary File Descriptor library.
  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.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program; if not, write to the Free Software Foundation,
  16. Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
  17. #ifndef _ELF_CRIS_H
  18. #define _ELF_CRIS_H
  19. #include "elf/reloc-macros.h"
  20. /* Relocations. */
  21. START_RELOC_NUMBERS (elf_cris_reloc_type)
  22. RELOC_NUMBER (R_CRIS_NONE, 0)
  23. RELOC_NUMBER (R_CRIS_8, 1)
  24. RELOC_NUMBER (R_CRIS_16, 2)
  25. RELOC_NUMBER (R_CRIS_32, 3)
  26. /* The "PC" position is the location right after the relocation. */
  27. RELOC_NUMBER (R_CRIS_8_PCREL, 4)
  28. RELOC_NUMBER (R_CRIS_16_PCREL, 5)
  29. RELOC_NUMBER (R_CRIS_32_PCREL, 6)
  30. RELOC_NUMBER (R_CRIS_GNU_VTINHERIT, 7)
  31. RELOC_NUMBER (R_CRIS_GNU_VTENTRY, 8)
  32. /* Copy contents at dynlinking. Generated by the linker.
  33. The BFD equivalent is BFD_RELOC_CRIS_COPY. */
  34. RELOC_NUMBER (R_CRIS_COPY, 9)
  35. /* Create GOT entry. Generated by the linker.
  36. The BFD equivalent is BFD_RELOC_CRIS_GLOB_DAT. */
  37. RELOC_NUMBER (R_CRIS_GLOB_DAT, 10)
  38. /* Create PLT entry. Generated by the linker.
  39. The BFD equivalent is BFD_RELOC_CRIS_JUMP_SLOT. */
  40. RELOC_NUMBER (R_CRIS_JUMP_SLOT, 11)
  41. /* Adjust by program base. Generated by the linker.
  42. The BFD equivalent is BFD_RELOC_CRIS_RELATIVE. */
  43. RELOC_NUMBER (R_CRIS_RELATIVE, 12)
  44. /* A 16-bit offset to entry in GOT and request to create GOT entry for
  45. that symbol.
  46. The BFD equivalent is BFD_RELOC_CRIS_16_GOT. */
  47. RELOC_NUMBER (R_CRIS_16_GOT, 13)
  48. /* A 32-bit offset to entry in GOT and request to create GOT entry for
  49. that symbol.
  50. The BFD equivalent is BFD_RELOC_CRIS_32_GOT. */
  51. RELOC_NUMBER (R_CRIS_32_GOT, 14)
  52. /* A 16-bit offset to entry in PLT part of GOT and request to create PLT
  53. entry for that symbol.
  54. The BFD equivalent is BFD_RELOC_CRIS_16_GOTPLT. */
  55. RELOC_NUMBER (R_CRIS_16_GOTPLT, 15)
  56. /* A 32-bit offset to entry in PLT part of GOT and request to create PLT
  57. entry for that symbol.
  58. The BFD equivalent is BFD_RELOC_CRIS_32_GOTPLT. */
  59. RELOC_NUMBER (R_CRIS_32_GOTPLT, 16)
  60. /* A 32-bit offset from GOT to (local) symbol: no GOT entry should be
  61. necessary.
  62. The BFD equivalent is BFD_RELOC_CRIS_32_GOTREL. */
  63. RELOC_NUMBER (R_CRIS_32_GOTREL, 17)
  64. /* A 32-bit offset from GOT to entry for this symbol in PLT and request
  65. to create PLT entry for symbol.
  66. The BFD equivalent is BFD_RELOC_CRIS_32_GOTREL. */
  67. RELOC_NUMBER (R_CRIS_32_PLT_GOTREL, 18)
  68. /* A 32-bit offset from location after this relocation (addend specifies
  69. offset) to entry for this symbol in PLT and request to create PLT
  70. entry for symbol.
  71. The BFD equivalent is BFD_RELOC_CRIS_32_PLT_PCREL. */
  72. RELOC_NUMBER (R_CRIS_32_PLT_PCREL, 19)
  73. /* An assembler-generated-only relocation, instructing the linker to
  74. reserve two GOT slots, carrying the R_CRIS_DTP relocation for the
  75. symbol (pointing to the first slot, the relocation fills in
  76. both). The value is a 32-bit-value, relative to the start of the
  77. GOT. Assembly syntax: "sym:GDGOTREL". */
  78. RELOC_NUMBER (R_CRIS_32_GOT_GD, 20)
  79. /* Similar to R_CRIS_32_GOT_GD, but the value is a 16-bit unsigned
  80. number, limiting access to 65536/4 global symbols per module (or
  81. 65536/8 thread variables; loosely speaking G*4+T*8 < 65536, where
  82. T is the number of thread variables and G is the number of other
  83. external global variables and functions). Assembly syntax:
  84. "sym:GDGOTREL16". */
  85. RELOC_NUMBER (R_CRIS_16_GOT_GD, 21)
  86. /* Similar to R_CRIS_32_GOT_GD, but the value is the absolute
  87. address of the GOT entry. Disallowed in DSOs created with
  88. -shared. Assembly syntax: "sym:GD". */
  89. RELOC_NUMBER (R_CRIS_32_GD, 22)
  90. /* A linker-generated-only relocation, instructing the dynamic
  91. linker to fill in the module ID and module-relative-TLS-block
  92. offset of the symbol in question, used for GOT entries. Note
  93. that this relocation instructs to fill in two 32-bit values. */
  94. RELOC_NUMBER (R_CRIS_DTP, 23)
  95. /* An assembler-generated-only relocation, instructing the linker to
  96. reserve the first two GOT slots, and attach the R_CRIS_DTPMOD
  97. relocation(*) for the module to the first slot, the second
  98. containing zero. The value is 32 bits, the offset from the start
  99. of the TLS block of the module to the thread-local symbol
  100. mentioned in the relocation. This relocation must only be applied
  101. to module-local symbols. Assembly syntax: "expr:DTPREL". */
  102. RELOC_NUMBER (R_CRIS_32_DTPREL, 24)
  103. /* Similar to R_CRIS_32_DTPREL, but the value is a 16-bit signed
  104. number, limiting the size of thread-variables of the DSO to 32768
  105. bytes. (Note: matches both model 1 and 2 and allows use of addo.w
  106. as the instruction where this relocation is used.) Assembly
  107. syntax: "expr:DTPREL16". */
  108. RELOC_NUMBER (R_CRIS_16_DTPREL, 25)
  109. /* An assembler-generated-only relocation, instructing the linker to
  110. reserve a GOT slot and attach the R_CRIS_32_TPREL relocation for
  111. the symbol in question. The value is 32 bits, which is the
  112. GOT-relative offset of the slot. Assembly syntax:
  113. "sym:TPOFFGOT". */
  114. RELOC_NUMBER (R_CRIS_32_GOT_TPREL, 26)
  115. /* Similar to R_CRIS_32_TPREL, but the value is a 16-bit positive
  116. number, limiting the number of thread- and global variables of
  117. the DSO to 32768/4. Assembly syntax: "sym:TPOFFGOT16". */
  118. RELOC_NUMBER (R_CRIS_16_GOT_TPREL, 27)
  119. /* An assembler- and linker-generated relocation, instructing to
  120. resolve the symbol in question yielding the TLS offset of the
  121. thread variable, relative to the global TLS block. Not allowed
  122. as input when generating a DSO. Assembly syntax:
  123. "expr:TPOFF". */
  124. RELOC_NUMBER (R_CRIS_32_TPREL, 28)
  125. /* Similar to R_CRIS_32_TPREL, but only applicable to executables
  126. compiled with -msmall-tls. Not allowed in a DSO. The value is a
  127. 16-bit signed number, limiting the size of thread-variables of
  128. the executable to 32768 bytes. (Note: being signed makes it match
  129. both model 1 and 2 and allows use of addo.w as the instruction
  130. where this relocation is applied.) Assembly syntax:
  131. "expr:TPOFF16". */
  132. RELOC_NUMBER (R_CRIS_16_TPREL, 29)
  133. /* A linker-generated-only relocation, instructing the dynamic
  134. linker to fill in the current module ID, used for GOT entries
  135. (usually the fourth one). */
  136. RELOC_NUMBER (R_CRIS_DTPMOD, 30)
  137. /* Similar to R_CRIS_32_GOT_TPREL, but the value is the absolute
  138. address of the GOT entry. Disallowed in DSOs created with
  139. -shared. Assembly syntax: "sym:IE". */
  140. RELOC_NUMBER (R_CRIS_32_IE, 31)
  141. /* No other relocs must be visible outside the assembler. */
  142. END_RELOC_NUMBERS (R_CRIS_max)
  143. /* User symbols in this file have a leading underscore. */
  144. #define EF_CRIS_UNDERSCORE 0x00000001
  145. /* This is a mask for different incompatible machine variants. */
  146. #define EF_CRIS_VARIANT_MASK 0x0000000e
  147. /* Variant 0; may contain v0..10 object. */
  148. #define EF_CRIS_VARIANT_ANY_V0_V10 0x00000000
  149. /* Variant 1; contains v32 object. */
  150. #define EF_CRIS_VARIANT_V32 0x00000002
  151. /* Variant 2; contains object compatible with v32 and v10. */
  152. #define EF_CRIS_VARIANT_COMMON_V10_V32 0x00000004
  153. #endif /* _ELF_CRIS_H */