elf.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. /*
  17. * These are used to set parameters in the core dumps.
  18. */
  19. #define ELF_ARCH EM_RISCV
  20. #ifdef CONFIG_64BIT
  21. #define ELF_CLASS ELFCLASS64
  22. #else
  23. #define ELF_CLASS ELFCLASS32
  24. #endif
  25. #if defined(__LITTLE_ENDIAN)
  26. #define ELF_DATA ELFDATA2LSB
  27. #elif defined(__BIG_ENDIAN)
  28. #define ELF_DATA ELFDATA2MSB
  29. #else
  30. #error "Unknown endianness"
  31. #endif
  32. /*
  33. * This is used to ensure we don't load something for the wrong architecture.
  34. */
  35. #define elf_check_arch(x) ((x)->e_machine == EM_RISCV)
  36. #define CORE_DUMP_USE_REGSET
  37. #define ELF_EXEC_PAGESIZE (PAGE_SIZE)
  38. /*
  39. * This is the location that an ET_DYN program is loaded if exec'ed. Typical
  40. * use of this is to invoke "./ld.so someprog" to test out a new version of
  41. * the loader. We need to make sure that it is out of the way of the program
  42. * that it will "exec", and that there is sufficient room for the brk.
  43. */
  44. #define ELF_ET_DYN_BASE ((TASK_SIZE / 3) * 2)
  45. /*
  46. * This yields a mask that user programs can use to figure out what
  47. * instruction set this CPU supports. This could be done in user space,
  48. * but it's not easy, and we've already done it here.
  49. */
  50. #define ELF_HWCAP (elf_hwcap)
  51. extern unsigned long elf_hwcap;
  52. /*
  53. * This yields a string that ld.so will use to load implementation
  54. * specific libraries for optimization. This is more specific in
  55. * intent than poking at uname or /proc/cpuinfo.
  56. */
  57. #define ELF_PLATFORM (NULL)
  58. #define ARCH_DLINFO \
  59. do { \
  60. NEW_AUX_ENT(AT_SYSINFO_EHDR, \
  61. (elf_addr_t)current->mm->context.vdso); \
  62. } while (0)
  63. #define ARCH_HAS_SETUP_ADDITIONAL_PAGES
  64. struct linux_binprm;
  65. extern int arch_setup_additional_pages(struct linux_binprm *bprm,
  66. int uses_interp);
  67. #endif /* _ASM_RISCV_ELF_H */