-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdlstubs.c
25 lines (20 loc) · 1.01 KB
/
dlstubs.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <sys/types.h>
#include <dlfcn.h>
/* dl*() stub routines for static compilation. Prepared from
/usr/include/dlfcn.h by Hal Pomeranz <[email protected]> */
/*030131 mgp crafted this version for RedHat 8 linux*/
void *dlopen(__const char *__file, int __mode) {}
void *dlsym(void *ptr, const char *str) {}
int dlclose(void *__handle) {}
char *dlerror(void) {}
void *_dlsym(void *__restrict __handle,
__const char *__restrict __name) {}
char *_dlerror(void) {}
/*more from http://www.deer-run.com/~hal/sol-static.txt */
/* To explain avoiding unresolved symbols doing a static compile*/
/*...various dl*() functions are used to control dynamic loading...*/
/*... since we're attempting to build a statically linked binary, the various*/
/* dl*() routiines should never be called in the first place. This means we */
/*could write our own stub routines and link them into our binary. */
/*...The stub functions were simply ripped directly from the prototypes */
/* given in /usr/include/dlfcn.h */