elf.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_M32R__ELF_H
  3. #define _ASM_M32R__ELF_H
  4. /*
  5. * ELF-specific definitions.
  6. *
  7. * Copyright (C) 1999-2004, Renesas Technology Corp.
  8. * Hirokazu Takata <takata at linux-m32r.org>
  9. */
  10. #include <asm/ptrace.h>
  11. #include <asm/user.h>
  12. #include <asm/page.h>
  13. /* M32R relocation types */
  14. #define R_M32R_NONE 0
  15. #define R_M32R_16 1
  16. #define R_M32R_32 2
  17. #define R_M32R_24 3
  18. #define R_M32R_10_PCREL 4
  19. #define R_M32R_18_PCREL 5
  20. #define R_M32R_26_PCREL 6
  21. #define R_M32R_HI16_ULO 7
  22. #define R_M32R_HI16_SLO 8
  23. #define R_M32R_LO16 9
  24. #define R_M32R_SDA16 10
  25. #define R_M32R_GNU_VTINHERIT 11
  26. #define R_M32R_GNU_VTENTRY 12
  27. #define R_M32R_16_RELA 33
  28. #define R_M32R_32_RELA 34
  29. #define R_M32R_24_RELA 35
  30. #define R_M32R_10_PCREL_RELA 36
  31. #define R_M32R_18_PCREL_RELA 37
  32. #define R_M32R_26_PCREL_RELA 38
  33. #define R_M32R_HI16_ULO_RELA 39
  34. #define R_M32R_HI16_SLO_RELA 40
  35. #define R_M32R_LO16_RELA 41
  36. #define R_M32R_SDA16_RELA 42
  37. #define R_M32R_RELA_GNU_VTINHERIT 43
  38. #define R_M32R_RELA_GNU_VTENTRY 44
  39. #define R_M32R_GOT24 48
  40. #define R_M32R_26_PLTREL 49
  41. #define R_M32R_COPY 50
  42. #define R_M32R_GLOB_DAT 51
  43. #define R_M32R_JMP_SLOT 52
  44. #define R_M32R_RELATIVE 53
  45. #define R_M32R_GOTOFF 54
  46. #define R_M32R_GOTPC24 55
  47. #define R_M32R_GOT16_HI_ULO 56
  48. #define R_M32R_GOT16_HI_SLO 57
  49. #define R_M32R_GOT16_LO 58
  50. #define R_M32R_GOTPC_HI_ULO 59
  51. #define R_M32R_GOTPC_HI_SLO 60
  52. #define R_M32R_GOTPC_LO 61
  53. #define R_M32R_GOTOFF_HI_ULO 62
  54. #define R_M32R_GOTOFF_HI_SLO 63
  55. #define R_M32R_GOTOFF_LO 64
  56. #define R_M32R_NUM 256
  57. /*
  58. * ELF register definitions..
  59. */
  60. #define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))
  61. typedef unsigned long elf_greg_t;
  62. typedef elf_greg_t elf_gregset_t[ELF_NGREG];
  63. /* We have no FP mumumu. */
  64. typedef double elf_fpreg_t;
  65. typedef elf_fpreg_t elf_fpregset_t;
  66. /*
  67. * This is used to ensure we don't load something for the wrong architecture.
  68. */
  69. #define elf_check_arch(x) \
  70. (((x)->e_machine == EM_M32R) || ((x)->e_machine == EM_CYGNUS_M32R))
  71. /*
  72. * These are used to set parameters in the core dumps.
  73. */
  74. #define ELF_CLASS ELFCLASS32
  75. #if defined(__LITTLE_ENDIAN__)
  76. #define ELF_DATA ELFDATA2LSB
  77. #elif defined(__BIG_ENDIAN__)
  78. #define ELF_DATA ELFDATA2MSB
  79. #else
  80. #error no endian defined
  81. #endif
  82. #define ELF_ARCH EM_M32R
  83. /* r0 is set by ld.so to a pointer to a function which might be
  84. * registered using 'atexit'. This provides a mean for the dynamic
  85. * linker to call DT_FINI functions for shared libraries that have
  86. * been loaded before the code runs.
  87. *
  88. * So that we can use the same startup file with static executables,
  89. * we start programs with a value of 0 to indicate that there is no
  90. * such function.
  91. */
  92. #define ELF_PLAT_INIT(_r, load_addr) (_r)->r0 = 0
  93. #define ELF_EXEC_PAGESIZE PAGE_SIZE
  94. /*
  95. * This is the location that an ET_DYN program is loaded if exec'ed.
  96. * Typical use of this is to invoke "./ld.so someprog" to test out a
  97. * new version of the loader. We need to make sure that it is out of
  98. * the way of the program that it will "exec", and that there is
  99. * sufficient room for the brk.
  100. */
  101. #define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2)
  102. /* regs is struct pt_regs, pr_reg is elf_gregset_t (which is
  103. now struct_user_regs, they are different) */
  104. #define ELF_CORE_COPY_REGS(pr_reg, regs) \
  105. memcpy((char *)pr_reg, (char *)regs, sizeof (struct pt_regs));
  106. /* This yields a mask that user programs can use to figure out what
  107. instruction set this CPU supports. */
  108. #define ELF_HWCAP (0)
  109. /* This yields a string that ld.so will use to load implementation
  110. specific libraries for optimization. This is more specific in
  111. intent than poking at uname or /proc/cpuinfo. */
  112. #define ELF_PLATFORM (NULL)
  113. #endif /* _ASM_M32R__ELF_H */