summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2019-06-19 21:04:44 +0000
committermidipix <writeonce@midipix.org>2019-06-19 21:04:44 +0000
commit724fbc5ff7174cf2d710d6d839b46794d5150329 (patch)
treee1fb718d7c963e5a68fcdcb3da757b79c60ae066 /src
parente9e8eb8f240ace9f334d4dac96dc3ebe68a07989 (diff)
downloadmmglue-724fbc5ff7174cf2d710d6d839b46794d5150329.tar.bz2
mmglue-724fbc5ff7174cf2d710d6d839b46794d5150329.tar.xz
midipix targets: ldso: added <sys/ldso.h>, __dldopen(), __dlsopen().
Diffstat (limited to 'src')
-rw-r--r--src/ldso/nt32/dynlink.c52
-rw-r--r--src/ldso/nt64/dynlink.c52
2 files changed, 104 insertions, 0 deletions
diff --git a/src/ldso/nt32/dynlink.c b/src/ldso/nt32/dynlink.c
index a585fbb..c0a1f04 100644
--- a/src/ldso/nt32/dynlink.c
+++ b/src/ldso/nt32/dynlink.c
@@ -106,6 +106,58 @@ void * dlopen(const char * file, int mode)
return base;
}
+void * __dldopen(int fd, int mode)
+{
+ int status;
+ void * base;
+ int cs;
+
+ /* prolog */
+ pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
+ pthread_rwlock_wrlock(&__ldso_lock);
+ __inhibit_ptc();
+
+ /* dldopen */
+ base = __ldso_vtbl->dldopen(fd,mode,&status);
+
+ /* epilog */
+ __release_ptc();
+ pthread_rwlock_unlock(&__ldso_lock);
+
+ if (base)
+ __psx_vtbl->do_global_ctors_fn();
+
+ pthread_setcancelstate(cs, 0);
+
+ return base;
+}
+
+void * __dlsopen(const char * file, int mode)
+{
+ int status;
+ void * base;
+ int cs;
+
+ /* prolog */
+ pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
+ pthread_rwlock_wrlock(&__ldso_lock);
+ __inhibit_ptc();
+
+ /* dlsopen */
+ base = __ldso_vtbl->dlsopen(file,mode,&status);
+
+ /* epilog */
+ __release_ptc();
+ pthread_rwlock_unlock(&__ldso_lock);
+
+ if (base)
+ __psx_vtbl->do_global_ctors_fn();
+
+ pthread_setcancelstate(cs, 0);
+
+ return base;
+}
+
int __dladdr(const void * addr, Dl_info * info)
{
return __ldso_vtbl->dladdr(addr,info);
diff --git a/src/ldso/nt64/dynlink.c b/src/ldso/nt64/dynlink.c
index a585fbb..c0a1f04 100644
--- a/src/ldso/nt64/dynlink.c
+++ b/src/ldso/nt64/dynlink.c
@@ -106,6 +106,58 @@ void * dlopen(const char * file, int mode)
return base;
}
+void * __dldopen(int fd, int mode)
+{
+ int status;
+ void * base;
+ int cs;
+
+ /* prolog */
+ pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
+ pthread_rwlock_wrlock(&__ldso_lock);
+ __inhibit_ptc();
+
+ /* dldopen */
+ base = __ldso_vtbl->dldopen(fd,mode,&status);
+
+ /* epilog */
+ __release_ptc();
+ pthread_rwlock_unlock(&__ldso_lock);
+
+ if (base)
+ __psx_vtbl->do_global_ctors_fn();
+
+ pthread_setcancelstate(cs, 0);
+
+ return base;
+}
+
+void * __dlsopen(const char * file, int mode)
+{
+ int status;
+ void * base;
+ int cs;
+
+ /* prolog */
+ pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
+ pthread_rwlock_wrlock(&__ldso_lock);
+ __inhibit_ptc();
+
+ /* dlsopen */
+ base = __ldso_vtbl->dlsopen(file,mode,&status);
+
+ /* epilog */
+ __release_ptc();
+ pthread_rwlock_unlock(&__ldso_lock);
+
+ if (base)
+ __psx_vtbl->do_global_ctors_fn();
+
+ pthread_setcancelstate(cs, 0);
+
+ return base;
+}
+
int __dladdr(const void * addr, Dl_info * info)
{
return __ldso_vtbl->dladdr(addr,info);