ldso.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * Copyright (C) 2000-2005 by Erik Andersen <andersen@codepoet.org>
  4. *
  5. * GNU Lesser General Public License version 2.1 or later.
  6. */
  7. #ifndef _LDSO_H_
  8. #define _LDSO_H_
  9. #include <features.h>
  10. /* Prepare for the case that `__builtin_expect' is not available. */
  11. #if __GNUC__ == 2 && __GNUC_MINOR__ < 96
  12. #define __builtin_expect(x, expected_value) (x)
  13. #endif
  14. #ifndef likely
  15. # define likely(x) __builtin_expect((!!(x)),1)
  16. #endif
  17. #ifndef unlikely
  18. # define unlikely(x) __builtin_expect((!!(x)),0)
  19. #endif
  20. #ifndef __LINUX_COMPILER_H
  21. #define __LINUX_COMPILER_H
  22. #endif
  23. /* Pull in compiler and arch stuff */
  24. #include <stdlib.h>
  25. #include <stdarg.h>
  26. #include <bits/wordsize.h>
  27. /* Pull in the arch specific type information */
  28. #include <sys/types.h>
  29. /* Pull in the arch specific page size */
  30. #include <bits/uClibc_page.h>
  31. /* Pull in the ldso syscalls and string functions */
  32. #include <dl-syscall.h>
  33. #include <dl-string.h>
  34. /* Now the ldso specific headers */
  35. #include <dl-elf.h>
  36. #include <dl-hash.h>
  37. /* For INIT/FINI dependency sorting. */
  38. struct init_fini_list {
  39. struct init_fini_list *next;
  40. struct elf_resolve *tpnt;
  41. };
  42. /* Global variables used within the shared library loader */
  43. extern char *_dl_library_path; /* Where we look for libraries */
  44. extern char *_dl_preload; /* Things to be loaded before the libs */
  45. extern char *_dl_ldsopath; /* Where the shared lib loader was found */
  46. extern const char *_dl_progname; /* The name of the executable being run */
  47. extern int _dl_secure; /* Are we dealing with setuid stuff? */
  48. extern size_t _dl_pagesize; /* Store the page size for use later */
  49. #ifdef __SUPPORT_LD_DEBUG__
  50. extern char *_dl_debug;
  51. extern char *_dl_debug_symbols;
  52. extern char *_dl_debug_move;
  53. extern char *_dl_debug_reloc;
  54. extern char *_dl_debug_detail;
  55. extern char *_dl_debug_nofixups;
  56. extern char *_dl_debug_bindings;
  57. extern int _dl_debug_file;
  58. # define __dl_debug_dprint(fmt, args...) \
  59. _dl_dprintf(_dl_debug_file, "%s:%i: " fmt, __FUNCTION__, __LINE__, ## args);
  60. # define _dl_if_debug_dprint(fmt, args...) \
  61. do { if (_dl_debug) __dl_debug_dprint(fmt, ## args); } while (0)
  62. #else
  63. # define _dl_debug_dprint(fmt, args...)
  64. # define _dl_if_debug_dprint(fmt, args...)
  65. # define _dl_debug_file 2
  66. #endif /* __SUPPORT_LD_DEBUG__ */
  67. #ifdef __SUPPORT_LD_DEBUG_EARLY__
  68. # define _dl_debug_early(fmt, args...) __dl_debug_dprint(fmt, ## args)
  69. #else
  70. # define _dl_debug_early(fmt, args...)
  71. #endif /* __SUPPORT_LD_DEBUG_EARLY__ */
  72. #ifndef NULL
  73. #define NULL ((void *) 0)
  74. #endif
  75. extern void *_dl_malloc(int size);
  76. extern char *_dl_getenv(const char *symbol, char **envp);
  77. extern void _dl_unsetenv(const char *symbol, char **envp);
  78. extern char *_dl_strdup(const char *string);
  79. extern void _dl_dprintf(int, const char *, ...);
  80. extern void _dl_get_ready_to_run(struct elf_resolve *tpnt, ElfW(Addr) load_addr,
  81. ElfW(auxv_t) auxvt[AT_EGID + 1], char **envp, char **argv);
  82. #endif /* _LDSO_H_ */