From c1a5360fa16aab9f7da82ed4217398acae320c91 Mon Sep 17 00:00:00 2001 From: Jonghyun Park Date: Thu, 9 Mar 2017 10:27:51 +0900 Subject: [PATCH] [x86/Linux] Correctly adjust stack for double aligned frames (dotnet/coreclr#9998) [x86/Linux] Correct stack align for double aligned frames Commit migrated from https://github.com/dotnet/coreclr/commit/4e9f01623721f8da6b79793812ecb5b85509092d --- src/coreclr/src/jit/lclvars.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/coreclr/src/jit/lclvars.cpp b/src/coreclr/src/jit/lclvars.cpp index 3a5cfdf..e0d7d51 100644 --- a/src/coreclr/src/jit/lclvars.cpp +++ b/src/coreclr/src/jit/lclvars.cpp @@ -5965,10 +5965,14 @@ void Compiler::lvaAlignFrame() } // Align the stack with STACK_ALIGN value. - int adjustFrameSize = compLclFrameSize; + int adjustFrameSize = compLclFrameSize; #if defined(UNIX_X86_ABI) + bool isEbpPushed = codeGen->isFramePointerUsed(); +#if DOUBLE_ALIGN + isEbpPushed |= genDoubleAlign(); +#endif // we need to consider spilled register(s) plus return address and/or EBP - int adjustCount = compCalleeRegsPushed + 1 + (codeGen->isFramePointerUsed() ? 1 : 0); + int adjustCount = compCalleeRegsPushed + 1 + (isEbpPushed ? 1 : 0); adjustFrameSize += (adjustCount * REGSIZE_BYTES) % STACK_ALIGN; #endif if ((adjustFrameSize % STACK_ALIGN) != 0) -- 2.7.4