OSDN Git Service

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