elf.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
  2. /*
  3. * OpenRISC Linux
  4. *
  5. * Linux architectural port borrowing liberally from similar works of
  6. * others. All original copyrights apply as per the original source
  7. * declaration.
  8. *
  9. * OpenRISC implementation:
  10. * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
  11. * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
  12. * et al.
  13. *
  14. * This program is free software; you can redistribute it and/or modify
  15. * it under the terms of the GNU General Public License as published by
  16. * the Free Software Foundation; either version 2 of the License, or
  17. * (at your option) any later version.
  18. */
  19. #ifndef _UAPI__ASM_OPENRISC_ELF_H
  20. #define _UAPI__ASM_OPENRISC_ELF_H
  21. /*
  22. * This files is partially exported to userspace. This allows us to keep
  23. * the ELF bits in one place which should assist in keeping the kernel and
  24. * userspace in sync.
  25. */
  26. /*
  27. * ELF register definitions..
  28. */
  29. /* for struct user_regs_struct definition */
  30. #include <asm/ptrace.h>
  31. /* The OR1K relocation types... not all relevant for module loader */
  32. #define R_OR1K_NONE 0
  33. #define R_OR1K_32 1
  34. #define R_OR1K_16 2
  35. #define R_OR1K_8 3
  36. #define R_OR1K_LO_16_IN_INSN 4
  37. #define R_OR1K_HI_16_IN_INSN 5
  38. #define R_OR1K_INSN_REL_26 6
  39. #define R_OR1K_GNU_VTENTRY 7
  40. #define R_OR1K_GNU_VTINHERIT 8
  41. #define R_OR1K_32_PCREL 9
  42. #define R_OR1K_16_PCREL 10
  43. #define R_OR1K_8_PCREL 11
  44. #define R_OR1K_GOTPC_HI16 12
  45. #define R_OR1K_GOTPC_LO16 13
  46. #define R_OR1K_GOT16 14
  47. #define R_OR1K_PLT26 15
  48. #define R_OR1K_GOTOFF_HI16 16
  49. #define R_OR1K_GOTOFF_LO16 17
  50. #define R_OR1K_COPY 18
  51. #define R_OR1K_GLOB_DAT 19
  52. #define R_OR1K_JMP_SLOT 20
  53. #define R_OR1K_RELATIVE 21
  54. #define R_OR1K_TLS_GD_HI16 22
  55. #define R_OR1K_TLS_GD_LO16 23
  56. #define R_OR1K_TLS_LDM_HI16 24
  57. #define R_OR1K_TLS_LDM_LO16 25
  58. #define R_OR1K_TLS_LDO_HI16 26
  59. #define R_OR1K_TLS_LDO_LO16 27
  60. #define R_OR1K_TLS_IE_HI16 28
  61. #define R_OR1K_TLS_IE_LO16 29
  62. #define R_OR1K_TLS_LE_HI16 30
  63. #define R_OR1K_TLS_LE_LO16 31
  64. #define R_OR1K_TLS_TPOFF 32
  65. #define R_OR1K_TLS_DTPOFF 33
  66. #define R_OR1K_TLS_DTPMOD 34
  67. #define R_OR1K_AHI16 35
  68. #define R_OR1K_GOTOFF_AHI16 36
  69. #define R_OR1K_TLS_IE_AHI16 37
  70. #define R_OR1K_TLS_LE_AHI16 38
  71. #define R_OR1K_SLO16 39
  72. #define R_OR1K_GOTOFF_SLO16 40
  73. #define R_OR1K_TLS_LE_SLO16 41
  74. #define R_OR1K_PCREL_PG21 42
  75. #define R_OR1K_GOT_PG21 43
  76. #define R_OR1K_TLS_GD_PG21 44
  77. #define R_OR1K_TLS_LDM_PG21 45
  78. #define R_OR1K_TLS_IE_PG21 46
  79. #define R_OR1K_LO13 47
  80. #define R_OR1K_GOT_LO13 48
  81. #define R_OR1K_TLS_GD_LO13 49
  82. #define R_OR1K_TLS_LDM_LO13 50
  83. #define R_OR1K_TLS_IE_LO13 51
  84. #define R_OR1K_SLO13 52
  85. #define R_OR1K_PLTA26 53
  86. #define R_OR1K_GOT_AHI16 54
  87. /* Old relocation names */
  88. #define R_OR32_NONE R_OR1K_NONE
  89. #define R_OR32_32 R_OR1K_32
  90. #define R_OR32_16 R_OR1K_16
  91. #define R_OR32_8 R_OR1K_8
  92. #define R_OR32_CONST R_OR1K_LO_16_IN_INSN
  93. #define R_OR32_CONSTH R_OR1K_HI_16_IN_INSN
  94. #define R_OR32_JUMPTARG R_OR1K_INSN_REL_26
  95. #define R_OR32_VTENTRY R_OR1K_GNU_VTENTRY
  96. #define R_OR32_VTINHERIT R_OR1K_GNU_VTINHERIT
  97. typedef unsigned long elf_greg_t;
  98. /*
  99. * Note that NGREG is defined to ELF_NGREG in include/linux/elfcore.h, and is
  100. * thus exposed to user-space.
  101. */
  102. #define ELF_NGREG (sizeof(struct user_regs_struct) / sizeof(elf_greg_t))
  103. typedef elf_greg_t elf_gregset_t[ELF_NGREG];
  104. typedef struct __or1k_fpu_state elf_fpregset_t;
  105. /* EM_OPENRISC is defined in linux/elf-em.h */
  106. #define EM_OR32 0x8472
  107. /*
  108. * These are used to set parameters in the core dumps.
  109. */
  110. #define ELF_ARCH EM_OR32
  111. #define ELF_CLASS ELFCLASS32
  112. #define ELF_DATA ELFDATA2MSB
  113. #endif /* _UAPI__ASM_OPENRISC_ELF_H */