linuxelf.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #ifndef LINUXELF_H
  2. #define LINUXELF_H
  3. /* Forward declarations for stuff defined in hash.h */
  4. struct dyn_elf;
  5. struct elf_resolve;
  6. /* Some function prototypes */
  7. extern void * _dl_malloc(int size);
  8. extern int _dl_map_cache(void);
  9. extern int _dl_unmap_cache(void);
  10. int _dl_copy_fixups(struct dyn_elf * tpnt);
  11. extern int _dl_parse_relocation_information(struct elf_resolve * tpnt, unsigned long rel_addr,
  12. unsigned long rel_size, int type);
  13. extern void _dl_parse_lazy_relocation_information(struct elf_resolve * tpnt, unsigned long rel_addr,
  14. unsigned long rel_size, int type);
  15. extern struct elf_resolve * _dl_load_shared_library(int secure,
  16. struct elf_resolve *, char * libname);
  17. extern struct elf_resolve * _dl_load_elf_shared_library(int secure,
  18. char * libname, int flag);
  19. extern int _dl_parse_copy_information(struct dyn_elf * rpnt, unsigned long rel_addr,
  20. unsigned long rel_size, int type);
  21. extern int _dl_linux_resolve(void);
  22. #define ELF_CLASS ELFCLASS32
  23. #ifndef SVR4_BUGCOMPAT
  24. #define SVR4_BUGCOMPAT 1
  25. #endif
  26. #if ELF_CLASS == ELFCLASS32
  27. #define elfhdr Elf32_Ehdr
  28. #define elf_phdr Elf32_Phdr
  29. #define elf_note Elf32_Nhdr
  30. /*
  31. * Datatype of a relocation on this platform
  32. */
  33. #ifdef ELF_USES_RELOCA
  34. # define ELF_RELOC Elf32_Rela
  35. #else
  36. # define ELF_RELOC Elf32_Rel
  37. #endif
  38. #else
  39. #define elfhdr Elf64_Ehdr
  40. #define elf_phdr Elf64_Phdr
  41. #define elf_note Elf64_Nhdr
  42. /*
  43. * Datatype of a relocation on this platform
  44. */
  45. #ifdef ELF_USES_RELOCA
  46. # define ELF_RELOC Elf64_Rela
  47. #else
  48. # define ELF_RELOC Elf64_Rel
  49. #endif
  50. #endif
  51. /* Convert between the Linux flags for page protections and the
  52. ones specified in the ELF standard. */
  53. #define LXFLAGS(X) ( (((X) & PF_R) ? PROT_READ : 0) | \
  54. (((X) & PF_W) ? PROT_WRITE : 0) | \
  55. (((X) & PF_X) ? PROT_EXEC : 0))
  56. #endif /* LINUXELF_H */