From 9e9c27dad1db5d8520d21daf942e63dc2342b34e Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Mon, 25 May 2020 17:36:13 +0100 Subject: [PATCH] rand/rand-x86ish.S: Establish GOT pointer before making an i386 PLT call. Otherwise you just get a segfault. --- rand/rand-x86ish.S | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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 -- 2.11.0