elf.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __ASM_CSKY_ELF_H
  3. #define __ASM_CSKY_ELF_H
  4. #include <asm/ptrace.h>
  5. #include <abi/regdef.h>
  6. #define ELF_ARCH EM_CSKY
  7. #define EM_CSKY_OLD 39
  8. /* CSKY Relocations */
  9. #define R_CSKY_NONE 0
  10. #define R_CSKY_32 1
  11. #define R_CSKY_PCIMM8BY4 2
  12. #define R_CSKY_PCIMM11BY2 3
  13. #define R_CSKY_PCIMM4BY2 4
  14. #define R_CSKY_PC32 5
  15. #define R_CSKY_PCRELJSR_IMM11BY2 6
  16. #define R_CSKY_GNU_VTINHERIT 7
  17. #define R_CSKY_GNU_VTENTRY 8
  18. #define R_CSKY_RELATIVE 9
  19. #define R_CSKY_COPY 10
  20. #define R_CSKY_GLOB_DAT 11
  21. #define R_CSKY_JUMP_SLOT 12
  22. #define R_CSKY_ADDR_HI16 24
  23. #define R_CSKY_ADDR_LO16 25
  24. #define R_CSKY_PCRELJSR_IMM26BY2 40
  25. typedef unsigned long elf_greg_t;
  26. typedef struct user_fp elf_fpregset_t;
  27. /*
  28. * In gdb/bfd elf32-csky.c, csky_elf_grok_prstatus() use fixed size of
  29. * elf_prstatus. It's 148 for abiv1 and 220 for abiv2, the size is enough
  30. * for coredump and no need full sizeof(struct pt_regs).
  31. */
  32. #define ELF_NGREG ((sizeof(struct pt_regs) / sizeof(elf_greg_t)) - 2)
  33. typedef elf_greg_t elf_gregset_t[ELF_NGREG];
  34. /*
  35. * This is used to ensure we don't load something for the wrong architecture.
  36. */
  37. #define elf_check_arch(x) (((x)->e_machine == ELF_ARCH) || \
  38. ((x)->e_machine == EM_CSKY_OLD))
  39. /*
  40. * These are used to set parameters in the core dumps.
  41. */
  42. #define ELF_EXEC_PAGESIZE 4096
  43. #define ELF_CLASS ELFCLASS32
  44. #define ELF_PLAT_INIT(_r, load_addr) { _r->a0 = 0; }
  45. #ifdef __cskyBE__
  46. #define ELF_DATA ELFDATA2MSB
  47. #else
  48. #define ELF_DATA ELFDATA2LSB
  49. #endif
  50. /*
  51. * This is the location that an ET_DYN program is loaded if exec'ed. Typical
  52. * use of this is to invoke "./ld.so someprog" to test out a new version of
  53. * the loader. We need to make sure that it is out of the way of the program
  54. * that it will "exec", and that there is sufficient room for the brk.
  55. */
  56. #define ELF_ET_DYN_BASE 0x0UL
  57. #include <abi/elf.h>
  58. /* Similar, but for a thread other than current. */
  59. struct task_struct;
  60. extern int dump_task_regs(struct task_struct *tsk, elf_gregset_t *elf_regs);
  61. #define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs)
  62. #define ELF_HWCAP (0)
  63. /*
  64. * This yields a string that ld.so will use to load implementation specific
  65. * libraries for optimization. This is more specific in intent than poking
  66. * at uname or /proc/cpuinfo.
  67. */
  68. #define ELF_PLATFORM (NULL)
  69. #define SET_PERSONALITY(ex) set_personality(PER_LINUX)
  70. #define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
  71. struct linux_binprm;
  72. extern int arch_setup_additional_pages(struct linux_binprm *bprm,
  73. int uses_interp);
  74. #endif /* __ASM_CSKY_ELF_H */