elf.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
  3. * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
  4. * Copyright (C) 2012 Regents of the University of California
  5. *
  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 2 of the License, or
  9. * (at your option) any later version.
  10. */
  11. #ifndef _ASM_RISCV_ELF_H
  12. #define _ASM_RISCV_ELF_H
  13. #include <uapi/asm/elf.h>
  14. #include <asm/auxvec.h>
  15. #include <asm/byteorder.h>
  16. /* TODO: Move definition into include/uapi/linux/elf-em.h */
  17. #define EM_RISCV 0xF3
  18. /*
  19. * These are used to set parameters in the core dumps.
  20. */
  21. #define ELF_ARCH EM_RISCV
  22. #ifdef CONFIG_64BIT
  23. #define ELF_CLASS ELFCLASS64
  24. #else
  25. #define ELF_CLASS ELFCLASS32
  26. #endif
  27. #if defined(__LITTLE_ENDIAN)
  28. #define ELF_DATA ELFDATA2LSB
  29. #elif defined(__BIG_ENDIAN)
  30. #define ELF_DATA ELFDATA2MSB
  31. #else
  32. #error "Unknown endianness"
  33. #endif
  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 == EM_RISCV)
  38. #define CORE_DUMP_USE_REGSET
  39. #define ELF_EXEC_PAGESIZE (PAGE_SIZE)
  40. /*
  41. * This is the location that an ET_DYN program is loaded if exec'ed. Typical
  42. * use of this is to invoke "./ld.so someprog" to test out a new version of
  43. * the loader. We need to make sure that it is out of the way of the program
  44. * that it will "exec", and that there is sufficient room for the brk.
  45. */
  46. #define ELF_ET_DYN_BASE ((TASK_SIZE / 3) * 2)
  47. /*
  48. * This yields a mask that user programs can use to figure out what
  49. * instruction set this CPU supports. This could be done in user space,
  50. * but it's not easy, and we've already done it here.
  51. */
  52. #define ELF_HWCAP (elf_hwcap)
  53. extern unsigned long elf_hwcap;
  54. /*
  55. * This yields a string that ld.so will use to load implementation
  56. * specific libraries for optimization. This is more specific in
  57. * intent than poking at uname or /proc/cpuinfo.
  58. */
  59. #define ELF_PLATFORM (NULL)
  60. #define ARCH_DLINFO \
  61. do { \
  62. NEW_AUX_ENT(AT_SYSINFO_EHDR, \
  63. (elf_addr_t)current->mm->context.vdso); \
  64. } while (0)
  65. #define ARCH_HAS_SETUP_ADDITIONAL_PAGES
  66. struct linux_binprm;
  67. extern int arch_setup_additional_pages(struct linux_binprm *bprm,
  68. int uses_interp);
  69. #endif /* _ASM_RISCV_ELF_H */