summaryrefslogtreecommitdiff
path: root/ldso/include/ldso.h
diff options
context:
space:
mode:
Diffstat (limited to 'ldso/include/ldso.h')
-rw-r--r--ldso/include/ldso.h77
1 files changed, 69 insertions, 8 deletions
diff --git a/ldso/include/ldso.h b/ldso/include/ldso.h
index 35a72fc5e..e237885b9 100644
--- a/ldso/include/ldso.h
+++ b/ldso/include/ldso.h
@@ -5,8 +5,8 @@
* GNU Lesser General Public License version 2.1 or later.
*/
-#ifndef _LDSO_H_
-#define _LDSO_H_
+#ifndef _LDSO_H
+#define _LDSO_H
#include <features.h>
@@ -27,18 +27,46 @@
/* Pull in compiler and arch stuff */
#include <stdlib.h>
#include <stdarg.h>
+#include <stddef.h> /* for ptrdiff_t */
+#include <stdbool.h>
+#define _FCNTL_H
+/* We need this if arch has only new syscalls defined */
+#ifndef AT_FDCWD
+#define AT_FDCWD -100
+#endif /* AT_FDCWD */
+#include <bits/fcntl.h>
#include <bits/wordsize.h>
/* Pull in the arch specific type information */
#include <sys/types.h>
/* Pull in the arch specific page size */
#include <bits/uClibc_page.h>
+/* Pull in the MIN macro */
+#include <sys/param.h>
/* Pull in the ldso syscalls and string functions */
+#ifndef __ARCH_HAS_NO_SHARED__
#include <dl-syscall.h>
#include <dl-string.h>
/* Now the ldso specific headers */
#include <dl-elf.h>
+#ifdef __UCLIBC_HAS_TLS__
+/* Defines USE_TLS */
+#include <tls.h>
+#endif
#include <dl-hash.h>
+/* common align masks, if not specified by sysdep headers */
+#ifndef ADDR_ALIGN
+#define ADDR_ALIGN (_dl_pagesize - 1)
+#endif
+
+#ifndef PAGE_ALIGN
+#define PAGE_ALIGN (~ADDR_ALIGN)
+#endif
+
+#ifndef OFFS_ALIGN
+#define OFFS_ALIGN (PAGE_ALIGN & ~(1ul << (sizeof(_dl_pagesize) * 8 - 1)))
+#endif
+
/* For INIT/FINI dependency sorting. */
struct init_fini_list {
struct init_fini_list *next;
@@ -48,10 +76,25 @@ struct init_fini_list {
/* Global variables used within the shared library loader */
extern char *_dl_library_path; /* Where we look for libraries */
extern char *_dl_preload; /* Things to be loaded before the libs */
-extern char *_dl_ldsopath; /* Where the shared lib loader was found */
+#ifdef __LDSO_SEARCH_INTERP_PATH__
+extern const char *_dl_ldsopath; /* Where the shared lib loader was found */
+#endif
extern const char *_dl_progname; /* The name of the executable being run */
-extern int _dl_secure; /* Are we dealing with setuid stuff? */
extern size_t _dl_pagesize; /* Store the page size for use later */
+#ifdef __LDSO_PRELINK_SUPPORT__
+extern char *_dl_trace_prelink; /* Library for prelinking trace */
+extern struct elf_resolve *_dl_trace_prelink_map; /* Library map for prelinking trace */
+#else
+#define _dl_trace_prelink 0
+#endif
+#ifdef __DSBT__
+extern void **_dl_ldso_dsbt;
+#endif
+
+#if defined(USE_TLS) && USE_TLS
+extern void _dl_add_to_slotinfo (struct link_map *l);
+extern void ** __attribute__ ((const)) _dl_initial_error_catch_tsd (void);
+#endif
#ifdef __SUPPORT_LD_DEBUG__
extern char *_dl_debug;
@@ -63,13 +106,14 @@ extern char *_dl_debug_nofixups;
extern char *_dl_debug_bindings;
extern int _dl_debug_file;
# define __dl_debug_dprint(fmt, args...) \
- _dl_dprintf(_dl_debug_file, "%s:%i: " fmt, __FUNCTION__, __LINE__, ## args);
+ _dl_dprintf(_dl_debug_file, "%s:%i: " fmt, __func__, __LINE__, ## args);
# define _dl_if_debug_dprint(fmt, args...) \
do { if (_dl_debug) __dl_debug_dprint(fmt, ## args); } while (0)
#else
# define __dl_debug_dprint(fmt, args...) do {} while (0)
# define _dl_if_debug_dprint(fmt, args...) do {} while (0)
-# define _dl_debug_file 2
+/* disabled on purpose, _dl_debug_file should be guarded by __SUPPORT_LD_DEBUG__
+# define _dl_debug_file 2*/
#endif /* __SUPPORT_LD_DEBUG__ */
#ifdef IS_IN_rtld
@@ -100,11 +144,24 @@ extern int _dl_debug_file;
#endif
extern void *_dl_malloc(size_t size);
+extern void *_dl_calloc(size_t __nmemb, size_t __size);
+extern void *_dl_realloc(void *__ptr, size_t __size);
extern void _dl_free(void *);
extern char *_dl_getenv(const char *symbol, char **envp);
extern void _dl_unsetenv(const char *symbol, char **envp);
+#ifdef IS_IN_rtld
extern char *_dl_strdup(const char *string);
extern void _dl_dprintf(int, const char *, ...);
+#else
+# include <string.h>
+# define _dl_strdup strdup
+# include <stdio.h>
+# ifdef __USE_GNU
+# define _dl_dprintf dprintf
+# else
+# define _dl_dprintf(fd, fmt, args...) fprintf(stderr, fmt, ## args)
+# endif
+#endif
#ifndef DL_GET_READY_TO_RUN_EXTRA_PARMS
# define DL_GET_READY_TO_RUN_EXTRA_PARMS
@@ -113,7 +170,7 @@ extern void _dl_dprintf(int, const char *, ...);
# define DL_GET_READY_TO_RUN_EXTRA_ARGS
#endif
-extern void _dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr,
+extern void *_dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr,
ElfW(auxv_t) auxvt[AT_EGID + 1], char **envp, char **argv
DL_GET_READY_TO_RUN_EXTRA_PARMS);
@@ -121,4 +178,8 @@ extern void _dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load
#include <dl-inlines.h>
#endif
-#endif /* _LDSO_H_ */
+#else /* __ARCH_HAS_NO_SHARED__ */
+#include <dl-defs.h>
+#endif
+
+#endif /* _LDSO_H */