From: Mark Wooding Date: Mon, 25 May 2020 16:36:13 +0000 (+0100) Subject: rand/rand-x86ish.S: Establish GOT pointer before making an i386 PLT call. X-Git-Tag: 2.6.1~1 X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb/commitdiff_plain/9e9c27dad1db5d8520d21daf942e63dc2342b34e rand/rand-x86ish.S: Establish GOT pointer before making an i386 PLT call. Otherwise you just get a segfault. --- diff --git a/rand/rand-x86ish.S b/rand/rand-x86ish.S index b91a9373..399ccb1d 100644 --- a/rand/rand-x86ish.S +++ b/rand/rand-x86ish.S @@ -54,7 +54,8 @@ FUNC(rand_quick_x86ish_rdrand) #if CPUFAM_X86 mov edx, [SP + 4] - stalloc 28 + push ebx + stalloc 24 #endif #if CPUFAM_AMD64 && ABI_SYSV stalloc 8 @@ -82,7 +83,8 @@ FUNC(rand_quick_x86ish_rdseed) #if CPUFAM_X86 mov edx, [SP + 4] - stalloc 28 + push ebx + stalloc 24 #endif #if CPUFAM_AMD64 && ABI_SYSV stalloc 8 @@ -106,6 +108,7 @@ FUNC(rand_quick_x86ish_rdseed) // Success. 1: #if CPUFAM_X86 + ldgot ebx mov [SP + 16], AX lea ecx, [SP + 16] mov dword ptr [SP + 12], 32 @@ -131,7 +134,8 @@ FUNC(rand_quick_x86ish_rdseed) // Done. 9: #if CPUFAM_X86 - stfree 28 + stfree 24 + pop ebx #endif #if CPUFAM_AMD64 && ABI_SYSV stfree 8