From 377076ef09772ce4a467c6db307e3c13bc66998a Mon Sep 17 00:00:00 2001 From: SaeHie Park Date: Thu, 9 Feb 2017 16:27:33 +0900 Subject: [PATCH] [x86/Linux] Fix stack alignment in helper stub Add 8 byte padding for stack alignment before making a call --- src/vm/i386/jitinterfacex86.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/vm/i386/jitinterfacex86.cpp b/src/vm/i386/jitinterfacex86.cpp index a80b5e6..01d8119 100644 --- a/src/vm/i386/jitinterfacex86.cpp +++ b/src/vm/i386/jitinterfacex86.cpp @@ -1397,6 +1397,10 @@ void EmitFastGetSharedStaticBase(CPUSTUBLINKER *psl, CodeLabel *init, bool bCCto // DoInit: psl->EmitLabel(DoInit); +#if defined(UNIX_X86_ABI) + // sub esp, 8 ; to align the stack + psl->X86EmitSubEsp(8); +#endif // push edx (must be preserved) psl->X86EmitPushReg(kEDX); @@ -1406,6 +1410,10 @@ void EmitFastGetSharedStaticBase(CPUSTUBLINKER *psl, CodeLabel *init, bool bCCto // pop edx psl->X86EmitPopReg(kEDX); +#if defined(UNIX_X86_ABI) + // add esp, 8 + psl->X86EmitAddEsp(8); +#endif // ret psl->X86EmitReturn(0); } -- 2.7.4