diff --git a/libc/dlfcn/dlfcn.c b/libc/dlfcn/dlfcn.c index cbf727e0..74e0ea11 100644 --- a/libc/dlfcn/dlfcn.c +++ b/libc/dlfcn/dlfcn.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013 Jonas 'Sortie' Termansen. + * Copyright (c) 2012, 2013, 2024 Jonas 'Sortie' Termansen. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -22,6 +22,13 @@ static const char* dlerrormsg = NULL; +int dladdr(const void* restrict addr, Dl_info_t* restrict dlip) +{ + (void) addr; + (void) dlip; + return 0; +} + void* dlopen(const char* filename, int mode) { (void) filename; diff --git a/libc/include/dlfcn.h b/libc/include/dlfcn.h index 89da00db..42d2ba38 100644 --- a/libc/include/dlfcn.h +++ b/libc/include/dlfcn.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Jonas 'Sortie' Termansen. + * Copyright (c) 2012, 2024 Jonas 'Sortie' Termansen. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -22,19 +22,32 @@ #include -#ifdef __cplusplus -extern "C" { -#endif - #define RTLD_LAZY (1<<0) #define RTLD_NOW (1<<1) #define RTLD_GLOBAL (1<<8) #define RTLD_LOCAL 0 /* Bit 8 is not set. */ -int dlclose(void* handle); +#if __USE_SORTIX || 202405L <= __USE_POSIX +typedef struct +{ + const char* dli_fname; + void* dli_fbase; + const char* dli_sname; + void* dli_saddr; +} Dl_info_t; +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#if __USE_SORTIX || 202405L <= __USE_POSIX +int dladdr(const void* restrict, Dl_info_t* restrict); +#endif +int dlclose(void*); char* dlerror(void); -void* dlopen(const char* filename, int mode); -void* dlsym(void* handle, const char* name); +void* dlopen(const char*, int); +void* dlsym(void*, const char*); #ifdef __cplusplus } /* extern "C" */