Blame src/ldso/nt64/dynlink.c
|
|
860627 |
#define _BSD_SOURCE
|
|
|
860627 |
|
|
|
ca0f58 |
#include <stdlib.h>
|
|
|
860627 |
#include <dlfcn.h>
|
|
|
3c3117 |
#include "psxglue.h"
|
|
|
860627 |
#include "pthread_impl.h"
|
|
|
860627 |
|
|
|
3c3117 |
extern struct __ldso_vtbl * __ldso_vtbl;
|
|
|
3c3117 |
|
|
|
860627 |
int __dladdr(const void * addr, Dl_info * info)
|
|
|
860627 |
{
|
|
|
3c3117 |
return __ldso_vtbl->dladdr(addr,info);
|
|
|
860627 |
}
|
|
|
860627 |
|
|
|
860627 |
int __dlinfo(void * dso, int req, void * res)
|
|
|
860627 |
{
|
|
|
3c3117 |
return __ldso_vtbl->dlinfo(dso,req,res);
|
|
|
860627 |
}
|
|
|
860627 |
|
|
|
860627 |
void *__dlsym(void * restrict p, const char * restrict s, void * restrict ra)
|
|
|
860627 |
{
|
|
|
3c3117 |
return __ldso_vtbl->dlsym(p,s,ra);
|
|
|
860627 |
}
|
|
|
860627 |
|
|
|
860627 |
void * dlopen(const char * file, int mode)
|
|
|
860627 |
{
|
|
|
ca0f58 |
return __ldso_vtbl->dlopen(
|
|
|
ca0f58 |
file,mode,
|
|
|
ca0f58 |
getenv("LD_LIBRARY_PATH"),
|
|
|
ca0f58 |
0);
|
|
|
860627 |
}
|
|
|
860627 |
|
|
|
860627 |
int dlclose(void *p)
|
|
|
860627 |
{
|
|
|
3c3117 |
return __ldso_vtbl->dlclose(p);
|
|
|
860627 |
}
|
|
|
860627 |
|
|
|
860627 |
char * dlerror(void)
|
|
|
860627 |
{
|
|
|
3c3117 |
return __ldso_vtbl->dlerror();
|
|
|
860627 |
}
|
|
|
860627 |
|
|
|
860627 |
void __reset_tls(void)
|
|
|
860627 |
{
|
|
|
3c3117 |
__ldso_vtbl->reset_tls();
|
|
|
860627 |
}
|
|
|
860627 |
|
|
|
860627 |
void *__copy_tls(unsigned char * mem)
|
|
|
860627 |
{
|
|
|
860627 |
/**
|
|
|
860627 |
* this is always the simple case, since:
|
|
|
860627 |
* emutls is based on PE named sections; and
|
|
|
860627 |
* tls allocation and initialization are handled by clone(2)
|
|
|
860627 |
**/
|
|
|
860627 |
|
|
|
860627 |
pthread_t td;
|
|
|
5085e9 |
uintptr_t addr;
|
|
|
860627 |
|
|
|
5085e9 |
addr = (uintptr_t)mem;
|
|
|
5085e9 |
addr >>= 4;
|
|
|
5085e9 |
addr <<= 4;
|
|
|
5085e9 |
addr += 16;
|
|
|
860627 |
|
|
|
5085e9 |
td = (struct __pthread *)addr;
|
|
|
5085e9 |
td->dtv = 0;
|
|
|
860627 |
|
|
|
860627 |
return td;
|
|
|
860627 |
}
|