summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlordrasmus <lordrasmus@gmail.com>2023-05-29 20:32:24 +0200
committerWaldemar Brodkorb <wbx@openadk.org>2023-08-14 10:18:17 +0200
commitde0cfd949a68888515e0e83c942df12a610ffe8a (patch)
tree3924d0bee0c8e2854b3106e056281925771d90b3
parent3d781a52bae133907ba61bfbe987604f8cb00373 (diff)
add vsdo support
-rwxr-xr-x[-rw-r--r--]extra/Configs/Config.in17
-rwxr-xr-x[-rw-r--r--]extra/Configs/Config.mips1
-rwxr-xr-xldso/include/ldso.h7
-rw-r--r--ldso/ldso/Makefile.in5
-rw-r--r--ldso/ldso/dl-startup.c3
-rwxr-xr-xldso/ldso/ldso.c4
6 files changed, 34 insertions, 3 deletions
diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in
index 6bbb6f572..323c2092f 100644..100755
--- a/extra/Configs/Config.in
+++ b/extra/Configs/Config.in
@@ -455,6 +455,22 @@ config LDSO_PRELINK_SUPPORT
time. It also is able to load and handle prelinked libraries and
binaries at runtime.
+config ARCH_VDSO_SUPPORT
+ bool
+
+config VDSO_SUPPORT
+ bool "Dynamic linker vDSO support"
+ depends on ARCH_VDSO_SUPPORT
+ help
+ Enable this option to support vDSO loading
+
+ vDSO provides access to some kernel function without a systemcall
+ if provided by the kernel
+
+ most archs support gettimeofday() and clock_gettime()
+
+ vDSO loading can be disabled via VDSO_DISABLE environment variable
+
config UCLIBC_STATIC_LDCONFIG
bool "Link ldconfig statically"
depends on HAVE_SHARED
@@ -2321,6 +2337,7 @@ config SUPPORT_LD_DEBUG
nofixups never fixes up jump relocations
bindings displays the resolve processing (function calls);
detail shows the relocation patch
+ vdso display vdso symbol table processing
all Enable everything!
The additional environment variable:
diff --git a/extra/Configs/Config.mips b/extra/Configs/Config.mips
index 8137d8be4..14b784fcc 100644..100755
--- a/extra/Configs/Config.mips
+++ b/extra/Configs/Config.mips
@@ -13,6 +13,7 @@ config FORCE_OPTIONS_FOR_ARCH
select ARCH_ANY_ENDIAN
select ARCH_HAS_UCONTEXT
select ARCH_HAS_DEPRECATED_SYSCALLS
+ select ARCH_VDSO_SUPPORT
choice
prompt "Target ABI"
diff --git a/ldso/include/ldso.h b/ldso/include/ldso.h
index c035b3b52..8d9d057a0 100755
--- a/ldso/include/ldso.h
+++ b/ldso/include/ldso.h
@@ -109,6 +109,7 @@ extern char *_dl_debug_reloc;
extern char *_dl_debug_detail;
extern char *_dl_debug_nofixups;
extern char *_dl_debug_bindings;
+extern char *_dl_debug_vdso;
extern int _dl_debug_file;
# define __dl_debug_dprint(fmt, args...) \
_dl_dprintf(_dl_debug_file, "%s:%i: " fmt, __func__, __LINE__, ## args);
@@ -193,4 +194,10 @@ extern void *_dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE loa
#define AUX_MAX_AT_ID 40
extern ElfW(auxv_t) _dl_auxvt[AUX_MAX_AT_ID];
+void load_vdso( uint32_t sys_info_ehdr, char **envp );
+
+#ifdef __VDSO_SUPPORT__
+extern void* _dl__vdso_gettimeofday;
+#endif
+
#endif /* _LDSO_H */
diff --git a/ldso/ldso/Makefile.in b/ldso/ldso/Makefile.in
index 2d3886d73..6e8a0c388 100644
--- a/ldso/ldso/Makefile.in
+++ b/ldso/ldso/Makefile.in
@@ -63,14 +63,15 @@ ldso_FULL_NAME := $(UCLIBC_LDSO_NAME)-$(VERSION).so
$(UCLIBC_LDSO_NAME)_DIR := $(top_srcdir)ldso/ldso
$(UCLIBC_LDSO_NAME)_OUT := $(top_builddir)ldso/ldso
-$(UCLIBC_LDSO_NAME)_CSRC := $($(UCLIBC_LDSO_NAME)_DIR)/ldso.c
+$(UCLIBC_LDSO_NAME)_CSRC := $($(UCLIBC_LDSO_NAME)_DIR)/ldso.c $($(UCLIBC_LDSO_NAME)_DIR)/dl-vdso.c
# prerequesites
$($(UCLIBC_LDSO_NAME)_OUT)/ldso.o $($(UCLIBC_LDSO_NAME)_OUT)/ldso.oS: \
$($(UCLIBC_LDSO_NAME)_DIR)/dl-debug.c \
$($(UCLIBC_LDSO_NAME)_DIR)/dl-startup.c \
$($(UCLIBC_LDSO_NAME)_DIR)/dl-array.c \
$($(UCLIBC_LDSO_NAME)_DIR)/dl-hash.c \
- $($(UCLIBC_LDSO_NAME)_DIR)/dl-elf.c
+ $($(UCLIBC_LDSO_NAME)_DIR)/dl-elf.c \
+ $($(UCLIBC_LDSO_NAME)_DIR)/dl-vdso.c
$(UCLIBC_LDSO_NAME)_COBJ := $(patsubst $($(UCLIBC_LDSO_NAME)_DIR)/%.c,$($(UCLIBC_LDSO_NAME)_OUT)/%.o,$($(UCLIBC_LDSO_NAME)_CSRC))
$(UCLIBC_LDSO_NAME)_SSRC := $(wildcard $($(UCLIBC_LDSO_NAME)_DIR)/$(TARGET_ARCH)/*.S)
diff --git a/ldso/ldso/dl-startup.c b/ldso/ldso/dl-startup.c
index e36d688b4..989711fcc 100644
--- a/ldso/ldso/dl-startup.c
+++ b/ldso/ldso/dl-startup.c
@@ -367,6 +367,9 @@ DL_START(unsigned long args)
_dl_get_ready_to_run(tpnt, load_addr, envp, argv
DL_GET_READY_TO_RUN_EXTRA_ARGS);
+
+ load_vdso(_dl_auxvt[AT_SYSINFO_EHDR].a_un.a_val, envp);
+
/* Transfer control to the application. */
SEND_STDERR_DEBUG("transfering control to application @ ");
SEND_ADDRESS_STDERR_DEBUG(_dl_elf_main, 1);
diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c
index 8e4914df5..435bd43bc 100755
--- a/ldso/ldso/ldso.c
+++ b/ldso/ldso/ldso.c
@@ -73,6 +73,7 @@ char *_dl_debug_reloc = NULL;
char *_dl_debug_detail = NULL;
char *_dl_debug_nofixups = NULL;
char *_dl_debug_bindings = NULL;
+char *_dl_debug_vdso = NULL;
int _dl_debug_file = 2;
#endif
@@ -791,7 +792,7 @@ of this helper program; chances are you did not intend to run this program.\n\
if (_dl_debug) {
if (_dl_strstr(_dl_debug, "all")) {
_dl_debug_detail = _dl_debug_move = _dl_debug_symbols
- = _dl_debug_reloc = _dl_debug_bindings = _dl_debug_nofixups = (void*)1;
+ = _dl_debug_reloc = _dl_debug_bindings = _dl_debug_nofixups = _dl_debug_vdso = (void*)1;
} else {
_dl_debug_detail = _dl_strstr(_dl_debug, "detail");
_dl_debug_move = _dl_strstr(_dl_debug, "move");
@@ -799,6 +800,7 @@ of this helper program; chances are you did not intend to run this program.\n\
_dl_debug_reloc = _dl_strstr(_dl_debug, "reloc");
_dl_debug_nofixups = _dl_strstr(_dl_debug, "nofix");
_dl_debug_bindings = _dl_strstr(_dl_debug, "bind");
+ _dl_debug_vdso = _dl_strstr(_dl_debug, "vdso");
}
}