ldso.h 2.7 KB

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