LibC: Fix RTLD_* definitions

This commit is contained in:
Bananymous 2025-11-16 19:13:35 +02:00
parent ee507de154
commit 160a9278c9
2 changed files with 11 additions and 6 deletions

View File

@ -7,10 +7,13 @@
__BEGIN_DECLS __BEGIN_DECLS
#define RTLD_LAZY 1 #define RTLD_LAZY 0x0
#define RTLD_NOW 2 #define RTLD_NOW 0x1
#define RTLD_GLOBAL 3 #define RTLD_GLOBAL 0x0
#define RTLD_LOCAL 4 #define RTLD_LOCAL 0x2
#define _RTLD_LAZY_NOW_MASK 0x1
#define _RTLD_GLOBAL_LOCAL_MASK 0x2
#define RTLD_NEXT ((void*)-1) #define RTLD_NEXT ((void*)-1)
#define RTLD_DEFAULT ((void*) 0) #define RTLD_DEFAULT ((void*) 0)

View File

@ -1506,9 +1506,11 @@ char* __dlerror(void)
void* __dlopen(const char* file, int mode) void* __dlopen(const char* file, int mode)
{ {
const bool lazy = !(mode & RTLD_NOW); const bool lazy = (mode & _RTLD_LAZY_NOW_MASK) == RTLD_LAZY;
const bool local = (mode & _RTLD_GLOBAL_LOCAL_MASK) == RTLD_LOCAL;
// FIXME: RTLD_{LOCAL,GLOBAL} if (local)
print(STDDBG_FILENO, "local dlopen is not supported, loading as global\n");
if (file == nullptr) if (file == nullptr)
return &s_loaded_files[0]; return &s_loaded_files[0];