linuxelf.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /* This should eventually appear in the distribution version of linux/elf.h */
  2. #ifndef R_SPARC_NONE
  3. #define R_SPARC_NONE 0
  4. #define R_SPARC_8 1
  5. #define R_SPARC_16 2
  6. #define R_SPARC_32 3
  7. #define R_SPARC_DISP8 4
  8. #define R_SPARC_DISP16 5
  9. #define R_SPARC_DISP32 6
  10. #define R_SPARC_WDISP30 7
  11. #define R_SPARC_WDISP22 8
  12. #define R_SPARC_HI22 9
  13. #define R_SPARC_22 10
  14. #define R_SPARC_13 11
  15. #define R_SPARC_LO10 12
  16. #define R_SPARC_GOT10 13
  17. #define R_SPARC_GOT13 14
  18. #define R_SPARC_GOT22 15
  19. #define R_SPARC_PC10 16
  20. #define R_SPARC_PC22 17
  21. #define R_SPARC_WPLT30 18
  22. #define R_SPARC_COPY 19
  23. #define R_SPARC_GLOB_DAT 20
  24. #define R_SPARC_JMP_SLOT 21
  25. #define R_SPARC_RELATIVE 22
  26. #define R_SPARC_UA32 23
  27. #endif
  28. #ifndef R_68K_NONE
  29. #define R_68K_NONE 0
  30. #define R_68K_32 1
  31. #define R_68K_16 2
  32. #define R_68K_8 3
  33. #define R_68K_PC32 4
  34. #define R_68K_PC16 5
  35. #define R_68K_PC8 6
  36. #define R_68K_GOT32 7
  37. #define R_68K_GOT16 8
  38. #define R_68K_GOT8 9
  39. #define R_68K_GOT32O 10
  40. #define R_68K_GOT16O 11
  41. #define R_68K_GOT8O 12
  42. #define R_68K_PLT32 13
  43. #define R_68K_PLT16 14
  44. #define R_68K_PLT8 15
  45. #define R_68K_PLT32O 16
  46. #define R_68K_PLT16O 17
  47. #define R_68K_PLT8O 18
  48. #define R_68K_COPY 19
  49. #define R_68K_GLOB_DAT 20
  50. #define R_68K_JMP_SLOT 21
  51. #define R_68K_RELATIVE 22
  52. #define R_68K_NUM 23
  53. #endif
  54. /*
  55. * These constants define the elements of the auxiliary vector used to
  56. * pass additional information from the kernel to an ELF application.
  57. */
  58. #ifndef AT_NULL
  59. typedef struct
  60. {
  61. int a_type;
  62. union{
  63. long a_val;
  64. void *p_ptr;
  65. void (*a_fcn)();
  66. } a_un;
  67. } auxv_t;
  68. /*
  69. * Values of a_type... These often appear in the file /usr/include/sys/auxv.h
  70. * on SVr4 systems.
  71. */
  72. #define AT_NULL 0
  73. #define AT_IGNORE 1
  74. #define AT_EXECFD 2
  75. #define AT_PHDR 3
  76. #define AT_PHENT 4
  77. #define AT_PHNUM 5
  78. #define AT_PAGESZ 6
  79. #define AT_BASE 7
  80. #define AT_FLAGS 8
  81. #define AT_ENTRY 9
  82. #endif
  83. #ifndef AT_NOTELF
  84. #define AT_NOTELF 10 /* program is not ELF */
  85. #define AT_UID 11 /* real uid */
  86. #define AT_EUID 12 /* effective uid */
  87. #define AT_GID 13 /* real gid */
  88. #define AT_EGID 14 /* effective gid */
  89. #endif
  90. extern int _dl_linux_resolve(void);
  91. extern struct elf_resolve * _dl_load_shared_library(int secure,
  92. struct elf_resolve *, char * libname);
  93. extern void * _dl_malloc(int size);
  94. extern int _dl_map_cache(void);
  95. extern int _dl_unmap_cache(void);
  96. extern struct elf_resolve * _dl_load_elf_shared_library(int secure,
  97. char * libname, int);
  98. int _dl_copy_fixups(struct dyn_elf * tpnt);
  99. extern int linux_run(int argc, char * argv[]);
  100. extern void _dl_parse_lazy_relocation_information(struct elf_resolve * tpnt, int rel_addr,
  101. int rel_size, int type);
  102. extern int _dl_parse_relocation_information(struct elf_resolve * tpnt, int rel_addr,
  103. int rel_size, int type);
  104. extern int _dl_parse_copy_information(struct dyn_elf * rpnt, int rel_addr,
  105. int rel_size, int type);
  106. /* This means that we may be forced to manually search for copy fixups
  107. which were omitted by the linker. We cannot depend upon the DT_TEXTREL
  108. to tell us whether there are fixups in a text section or not. */
  109. #ifndef SVR4_BUGCOMPAT
  110. #define SVR4_BUGCOMPAT 1
  111. #endif
  112. #ifndef PF_R
  113. #define PF_R 4
  114. #define PF_W 2
  115. #define PF_X 1
  116. #endif
  117. /* Convert between the Linux flags for page protections and the
  118. ones specified in the ELF standard. */
  119. #define LXFLAGS(X) ( (((X) & PF_R) ? PROT_READ : 0) | \
  120. (((X) & PF_W) ? PROT_WRITE : 0) | \
  121. (((X) & PF_X) ? PROT_EXEC : 0))