1 /* vi: set sw=4 ts=4: */
3 * Copyright (C) 2000-2005 by Erik Andersen <andersen@codepoet.org>
5 * GNU Library General Public License (LGPL) version 2 or later.
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)
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 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 */
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__ */
75 #ifdef __SUPPORT_LD_DEBUG_EARLY__
76 # define _dl_debug_early(fmt, args...) __dl_debug_dprint(fmt, ## args)
78 # define _dl_debug_early(fmt, args...)
79 #endif /* __SUPPORT_LD_DEBUG_EARLY__ */
82 #define NULL ((void *) 0)
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 *, ...);
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);