ldso.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. #include <bits/wordsize.h>
  21. /* Pull in the arch specific type information */
  22. #include <sys/types.h>
  23. /* Pull in the ldso syscalls and string functions */
  24. #include <dl-syscall.h>
  25. #include <dl-string.h>
  26. /* Pull in the arch specific page size */
  27. #include <bits/uClibc_page.h>
  28. /* Now the ldso specific headers */
  29. #include <dl-elf.h>
  30. #include <dl-hash.h>
  31. /* For INIT/FINI dependency sorting. */
  32. struct init_fini_list {
  33. struct init_fini_list *next;
  34. struct elf_resolve *tpnt;
  35. };
  36. /* Global variables used within the shared library loader */
  37. extern char *_dl_library_path; /* Where we look for libraries */
  38. extern char *_dl_preload; /* Things to be loaded before the libs */
  39. extern char *_dl_ldsopath; /* Where the shared lib loader was found */
  40. extern const char *_dl_progname; /* The name of the executable being run */
  41. extern int _dl_secure; /* Are we dealing with setuid stuff? */
  42. extern size_t _dl_pagesize; /* Store the page size for use later */
  43. #ifdef __SUPPORT_LD_DEBUG__
  44. extern char *_dl_debug;
  45. extern char *_dl_debug_symbols;
  46. extern char *_dl_debug_move;
  47. extern char *_dl_debug_reloc;
  48. extern char *_dl_debug_detail;
  49. extern char *_dl_debug_nofixups;
  50. extern char *_dl_debug_bindings;
  51. extern int _dl_debug_file;
  52. # define __dl_debug_dprint(fmt, args...) \
  53. _dl_dprintf(_dl_debug_file, "%s:%i: " fmt, __FUNCTION__, __LINE__, ## args);
  54. # define _dl_if_debug_dprint(fmt, args...) \
  55. do { if (_dl_debug) __dl_debug_dprint(fmt, ## args); } while (0)
  56. #else
  57. # define _dl_debug_dprint(fmt, args...)
  58. # define _dl_if_debug_dprint(fmt, args...)
  59. # define _dl_debug_file 2
  60. #endif /* __SUPPORT_LD_DEBUG__ */
  61. #ifdef __SUPPORT_LD_DEBUG_EARLY__
  62. # define _dl_debug_early(fmt, args...) __dl_debug_dprint(fmt, ## args)
  63. #else
  64. # define _dl_debug_early(fmt, args...)
  65. #endif /* __SUPPORT_LD_DEBUG_EARLY__ */
  66. #ifndef NULL
  67. #define NULL ((void *) 0)
  68. #endif
  69. extern void *_dl_malloc(int size);
  70. extern char *_dl_getenv(const char *symbol, char **envp);
  71. extern void _dl_unsetenv(const char *symbol, char **envp);
  72. extern char *_dl_strdup(const char *string);
  73. extern void _dl_dprintf(int, const char *, ...);
  74. extern void _dl_get_ready_to_run(struct elf_resolve *tpnt, unsigned long load_addr,
  75. ElfW(auxv_t) auxvt[AT_EGID + 1], char **envp, char **argv);
  76. #endif /* _LDSO_H_ */