From 8b6d8ffe409b377cc974de9534cf951a74f05590 Mon Sep 17 00:00:00 2001 From: midipix Date: Tue, 13 May 2025 02:53:35 +0000 Subject: ldso: dlsym(): pass the return address to __dlsym() as its third parameter. --- src/ldso/nt32/dlsym.s | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/ldso/nt32/dlsym.s') diff --git a/src/ldso/nt32/dlsym.s b/src/ldso/nt32/dlsym.s index e69de29..f9e104d 100644 --- a/src/ldso/nt32/dlsym.s +++ b/src/ldso/nt32/dlsym.s @@ -0,0 +1,24 @@ +############################################################################ +## 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: + movl %esp,%ecx # save stack pointer + push (%ecx) # original return address + push 12(%ecx) # original second argument + push 12(%ecx) # original first argument + call ___dlsym + movl %ecx,%esp # restore stack pointer + + .section .got$_dlsym,"r" + .global __imp__dlsym +__imp__dlsym: + .long _dlsym + .linkonce discard -- cgit v1.2.3