From eb0c90369ad1f927891bc9d6d9813132a296a114 Mon Sep 17 00:00:00 2001 From: Max Wash Date: Sun, 27 Feb 2022 17:03:15 +0000 Subject: [PATCH] Added stub implementations for dl*() functions --- photon/libc/include/dlfcn.h | 14 ++++++++++++++ photon/libc/sys/horizon/dlfcn.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 photon/libc/include/dlfcn.h create mode 100644 photon/libc/sys/horizon/dlfcn.c diff --git a/photon/libc/include/dlfcn.h b/photon/libc/include/dlfcn.h new file mode 100644 index 0000000..f13d306 --- /dev/null +++ b/photon/libc/include/dlfcn.h @@ -0,0 +1,14 @@ +#ifndef DLFCN_H_ +#define DLFCN_H_ + +#define RTLD_LAZY 0 +#define RTLD_NOW 1 +#define RTLD_GLOBAL 2 +#define RTLD_LOCAL 3 + +extern void *dlopen(const char *path, int mode); +extern void *dlsym(void *handle, const char *name); +extern int dlclose(void *handle); +extern char *dlerror(void); + +#endif diff --git a/photon/libc/sys/horizon/dlfcn.c b/photon/libc/sys/horizon/dlfcn.c new file mode 100644 index 0000000..9c45323 --- /dev/null +++ b/photon/libc/sys/horizon/dlfcn.c @@ -0,0 +1,30 @@ +#include +#include +#include + + +__attribute__((weak)) void *dyld_load_object(mx_handle_t handle, int mode) { return NULL; } +__attribute__((weak)) void *dyld_get_symbol(void *handle, const char *name) { return NULL; } +__attribute__((weak)) int dyld_close_object(void *handle) { return 0; } +__attribute__((weak)) char *dyld_get_error(void) { return NULL; } + +void *dlopen(const char *path, int mode) +{ + dyld_load_object(MX_NULL_HANDLE, 0); + return NULL; +} + +void *dlsym(void *handle, const char *name) +{ + return NULL; +} + +int dlclose(void *handle) +{ + return 0; +} + +char *dlerror(void) +{ + return NULL; +}