ldso.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #ifndef _LDSO_H_
  2. #define _LDSO_H_
  3. #include <features.h>
  4. /* Prepare for the case that `__builtin_expect' is not available. */
  5. #if __GNUC__ == 2 && __GNUC_MINOR__ < 96
  6. #define __builtin_expect(x, expected_value) (x)
  7. #endif
  8. #ifndef likely
  9. # define likely(x) __builtin_expect((!!(x)),1)
  10. #endif
  11. #ifndef unlikely
  12. # define unlikely(x) __builtin_expect((!!(x)),0)
  13. #endif
  14. #ifndef __LINUX_COMPILER_H
  15. #define __LINUX_COMPILER_H
  16. #endif
  17. /* Pull in compiler and arch stuff */
  18. #include <stdlib.h>
  19. #include <stdarg.h>
  20. /* Pull in the arch specific type information */
  21. #include <sys/types.h>
  22. /* Pull in the ldso syscalls and string functions */
  23. #include <dl-syscall.h>
  24. #include <dl-string.h>
  25. /* Pull in the arch specific page size */
  26. #include <asm/page.h>
  27. #ifndef PAGE_SIZE
  28. # define PAGE_SHIFT 12
  29. # define PAGE_SIZE (1UL << PAGE_SHIFT)
  30. #endif
  31. /* Now the ldso specific headers */
  32. #include <dl-elf.h>
  33. #include <dl-hash.h>
  34. /* Global variables used within the shared library loader */
  35. extern char *_dl_library_path; /* Where we look for libraries */
  36. extern char *_dl_preload; /* Things to be loaded before the libs */
  37. extern char *_dl_ldsopath; /* Where the shared lib loader was found */
  38. extern const char *_dl_progname; /* The name of the executable being run */
  39. extern unsigned char *_dl_malloc_addr; /* Lets _dl_malloc use the already allocated memory page */
  40. extern unsigned char *_dl_mmap_zero; /* Also used by _dl_malloc */
  41. extern unsigned long *_dl_brkp; /* The end of the data segment for brk and sbrk */
  42. extern unsigned long *_dl_envp; /* The environment address */
  43. extern int _dl_secure; /* Are we dealing with setuid stuff? */
  44. extern size_t _dl_pagesize; /* Store the page size for use later */
  45. extern const char *_dl_progname; /* The name of the shared library loader */
  46. #ifdef __SUPPORT_LD_DEBUG__
  47. extern char *_dl_debug;
  48. extern char *_dl_debug_symbols;
  49. extern char *_dl_debug_move;
  50. extern char *_dl_debug_reloc;
  51. extern char *_dl_debug_detail;
  52. extern char *_dl_debug_nofixups;
  53. extern char *_dl_debug_bindings;
  54. extern int _dl_debug_file;
  55. #else
  56. #define _dl_debug_file 2
  57. #endif
  58. #ifndef NULL
  59. #define NULL ((void *) 0)
  60. #endif
  61. extern void *_dl_malloc(int size);
  62. extern char *_dl_getenv(const char *symbol, char **envp);
  63. extern void _dl_unsetenv(const char *symbol, char **envp);
  64. extern char *_dl_strdup(const char *string);
  65. extern void _dl_dprintf(int, const char *, ...);
  66. extern void _dl_get_ready_to_run(struct elf_resolve *tpnt, struct elf_resolve *app_tpnt,
  67. unsigned long load_addr, unsigned long *hash_addr,
  68. Elf32_auxv_t auxvt[AT_EGID + 1], char **envp, struct r_debug *debug_addr,
  69. unsigned char *malloc_buffer, unsigned char *mmap_zero, char **argv);
  70. #endif /* _LDSO_H_ */