1 /* vi: set sw=4 ts=4: */
3 * Copyright (C) 2000-2005 by Erik Andersen <andersen@codepoet.org>
5 * GNU Lesser General Public License version 2.1 or later.
13 /* Prepare for the case that `__builtin_expect' is not available. */
14 #if defined __GNUC__ && __GNUC__ == 2 && __GNUC_MINOR__ < 96
15 #define __builtin_expect(x, expected_value) (x)
18 # define likely(x) __builtin_expect((!!(x)),1)
21 # define unlikely(x) __builtin_expect((!!(x)),0)
23 #ifndef __LINUX_COMPILER_H
24 #define __LINUX_COMPILER_H
27 /* Pull in compiler and arch stuff */
30 #include <bits/wordsize.h>
31 /* Pull in the arch specific type information */
32 #include <sys/types.h>
33 /* Pull in the arch specific page size */
34 #include <bits/uClibc_page.h>
35 /* Pull in the ldso syscalls and string functions */
36 #include <dl-syscall.h>
37 #include <dl-string.h>
38 /* Now the ldso specific headers */
42 /* For INIT/FINI dependency sorting. */
43 struct init_fini_list {
44 struct init_fini_list *next;
45 struct elf_resolve *tpnt;
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 */
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)
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__ */
76 # ifdef __SUPPORT_LD_DEBUG__
77 # define _dl_assert(expr) \
80 __dl_debug_dprint("assert(%s)\n", #expr); \
85 # define _dl_assert(expr) ((void)0)
89 # define _dl_assert(expr) assert(expr)
92 #ifdef __SUPPORT_LD_DEBUG_EARLY__
93 # define _dl_debug_early(fmt, args...) __dl_debug_dprint(fmt, ## args)
95 # define _dl_debug_early(fmt, args...)
96 #endif /* __SUPPORT_LD_DEBUG_EARLY__ */
99 #define NULL ((void *) 0)
102 extern void *_dl_malloc(size_t size);
103 extern void _dl_free(void *);
104 extern char *_dl_getenv(const char *symbol, char **envp);
105 extern void _dl_unsetenv(const char *symbol, char **envp);
106 extern char *_dl_strdup(const char *string);
107 extern void _dl_dprintf(int, const char *, ...);
109 #ifndef DL_GET_READY_TO_RUN_EXTRA_PARMS
110 # define DL_GET_READY_TO_RUN_EXTRA_PARMS
112 #ifndef DL_GET_READY_TO_RUN_EXTRA_ARGS
113 # define DL_GET_READY_TO_RUN_EXTRA_ARGS
116 extern void _dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr,
117 ElfW(auxv_t) auxvt[AT_EGID + 1], char **envp, char **argv
118 DL_GET_READY_TO_RUN_EXTRA_PARMS);
120 #endif /* _LDSO_H_ */