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 /* common align masks, if not specified by sysdep headers */
44 #define ADDR_ALIGN (_dl_pagesize - 1)
48 #define PAGE_ALIGN (~ADDR_ALIGN)
52 #define OFFS_ALIGN (PAGE_ALIGN & ~(1ul << (sizeof(_dl_pagesize) * 8 - 1)))
55 /* For INIT/FINI dependency sorting. */
56 struct init_fini_list {
57 struct init_fini_list *next;
58 struct elf_resolve *tpnt;
61 /* Global variables used within the shared library loader */
62 extern char *_dl_library_path; /* Where we look for libraries */
63 extern char *_dl_preload; /* Things to be loaded before the libs */
64 extern char *_dl_ldsopath; /* Where the shared lib loader was found */
65 extern const char *_dl_progname; /* The name of the executable being run */
66 //now static: extern int _dl_secure; /* Are we dealing with setuid stuff? */
67 extern size_t _dl_pagesize; /* Store the page size for use later */
69 #ifdef __SUPPORT_LD_DEBUG__
70 extern char *_dl_debug;
71 extern char *_dl_debug_symbols;
72 extern char *_dl_debug_move;
73 extern char *_dl_debug_reloc;
74 extern char *_dl_debug_detail;
75 extern char *_dl_debug_nofixups;
76 extern char *_dl_debug_bindings;
77 extern int _dl_debug_file;
78 # define __dl_debug_dprint(fmt, args...) \
79 _dl_dprintf(_dl_debug_file, "%s:%i: " fmt, __FUNCTION__, __LINE__, ## args);
80 # define _dl_if_debug_dprint(fmt, args...) \
81 do { if (_dl_debug) __dl_debug_dprint(fmt, ## args); } while (0)
83 # define __dl_debug_dprint(fmt, args...) do {} while (0)
84 # define _dl_if_debug_dprint(fmt, args...) do {} while (0)
85 # define _dl_debug_file 2
86 #endif /* __SUPPORT_LD_DEBUG__ */
89 # ifdef __SUPPORT_LD_DEBUG__
90 # define _dl_assert(expr) \
93 __dl_debug_dprint("assert(%s)\n", #expr); \
98 # define _dl_assert(expr) ((void)0)
102 # define _dl_assert(expr) assert(expr)
105 #ifdef __SUPPORT_LD_DEBUG_EARLY__
106 # define _dl_debug_early(fmt, args...) __dl_debug_dprint(fmt, ## args)
108 # define _dl_debug_early(fmt, args...) do {} while (0)
109 #endif /* __SUPPORT_LD_DEBUG_EARLY__ */
112 #define NULL ((void *) 0)
115 extern void *_dl_malloc(size_t size);
116 extern void _dl_free(void *);
117 extern char *_dl_getenv(const char *symbol, char **envp);
118 extern void _dl_unsetenv(const char *symbol, char **envp);
119 extern char *_dl_strdup(const char *string);
120 extern void _dl_dprintf(int, const char *, ...);
122 #ifndef DL_GET_READY_TO_RUN_EXTRA_PARMS
123 # define DL_GET_READY_TO_RUN_EXTRA_PARMS
125 #ifndef DL_GET_READY_TO_RUN_EXTRA_ARGS
126 # define DL_GET_READY_TO_RUN_EXTRA_ARGS
129 extern void _dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr,
130 ElfW(auxv_t) auxvt[AT_EGID + 1], char **envp, char **argv
131 DL_GET_READY_TO_RUN_EXTRA_PARMS);
133 #ifdef HAVE_DL_INLINES_H
134 #include <dl-inlines.h>
137 #endif /* _LDSO_H_ */