]>
Commit | Line | Data |
---|---|---|
6054c1eb | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
f2e27cfb MF |
2 | /* |
3 | * Stub dlfcn implementation for systems that lack shared library support | |
4 | * but obviously can still reference compiled-in symbols. | |
5 | */ | |
6 | ||
7 | #ifndef NO_SHARED_LIBS | |
8 | #include_next <dlfcn.h> | |
9 | #else | |
10 | ||
11 | #define RTLD_LAZY 0 | |
e7b24b67 | 12 | #define RTLD_GLOBAL 1 |
f2e27cfb MF |
13 | #define _FAKE_DLFCN_HDL (void *)0xbeefcafe |
14 | ||
15 | static inline void *dlopen(const char *file, int flag) | |
16 | { | |
17 | if (file == NULL) | |
18 | return _FAKE_DLFCN_HDL; | |
19 | else | |
20 | return NULL; | |
21 | } | |
22 | ||
892e2124 | 23 | void *_dlsym(const char *sym); |
f2e27cfb MF |
24 | static inline void *dlsym(void *handle, const char *sym) |
25 | { | |
26 | if (handle != _FAKE_DLFCN_HDL) | |
27 | return NULL; | |
28 | return _dlsym(sym); | |
29 | } | |
30 | ||
31 | static inline char *dlerror(void) | |
32 | { | |
33 | return NULL; | |
34 | } | |
35 | ||
36 | static inline int dlclose(void *handle) | |
37 | { | |
38 | return (handle == _FAKE_DLFCN_HDL) ? 0 : 1; | |
39 | } | |
40 | ||
41 | #endif |