summaryrefslogtreecommitdiffhomepage
path: root/src/ldso/nt64
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2025-05-13 02:53:35 +0000
committermidipix <writeonce@midipix.org>2025-05-13 02:53:35 +0000
commit8b6d8ffe409b377cc974de9534cf951a74f05590 (patch)
tree1ff76fa0e6184ed00e25dbb0e51cf8d9b7cb4fc3 /src/ldso/nt64
parent415adf92a4337acfaf9eac16c72729099440e0e3 (diff)
downloadmmglue-8b6d8ffe409b377cc974de9534cf951a74f05590.tar.bz2
mmglue-8b6d8ffe409b377cc974de9534cf951a74f05590.tar.xz
ldso: dlsym(): pass the return address to __dlsym() as its third parameter.HEADmain
Diffstat (limited to 'src/ldso/nt64')
-rw-r--r--src/ldso/nt64/dlsym.s20
-rw-r--r--src/ldso/nt64/dynlink.c5
2 files changed, 22 insertions, 3 deletions
diff --git a/src/ldso/nt64/dlsym.s b/src/ldso/nt64/dlsym.s
index e69de29..0677d8c 100644
--- a/src/ldso/nt64/dlsym.s
+++ b/src/ldso/nt64/dlsym.s
@@ -0,0 +1,20 @@
+############################################################################
+## mmglue: midipix architecture- and target-specific bits for musl libc ##
+## Copyright (C) 2013--2025 SysDeer Technologies, LLC ##
+## Released under GPLv2 and GPLv3; see COPYING.MMGLUE. ##
+############################################################################
+
+.text
+.global dlsym
+
+.def dlsym; .scl 2; .type 32; .endef
+
+dlsym:
+ movq (%rsp),%r8 # original return address as third parameter
+ jmp __dlsym
+
+ .section .got$dlsym,"r"
+ .global __imp_dlsym
+__imp_dlsym:
+ .quad dlsym
+ .linkonce discard
diff --git a/src/ldso/nt64/dynlink.c b/src/ldso/nt64/dynlink.c
index eddd8cd..032f679 100644
--- a/src/ldso/nt64/dynlink.c
+++ b/src/ldso/nt64/dynlink.c
@@ -173,9 +173,9 @@ int __dlinfo(void * dso, int req, void * res)
return (__ldso_vtbl->dlinfo(dso,req,res)) ? -1 : 0;
}
-void *__dlsym(void * restrict p, const char * restrict s)
+void *__dlsym(void * restrict p, const char * restrict s, void * restrict a)
{
- return __ldso_vtbl->dlsym(p,s,0);
+ return __ldso_vtbl->dlsym(p,s,a);
}
int dlclose(void *p)
@@ -188,6 +188,5 @@ char * dlerror(void)
return __ldso_vtbl->dlerror();
}
-weak_alias(__dlsym,dlsym);
weak_alias(__dladdr,dladdr);
weak_alias(__dlinfo,dlinfo);