OSDN Git Service

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