Skip to content

Commit 8022255

Browse files
committed
fix stack alignment bug on win32
1 parent f6a0f7a commit 8022255

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/codegen.cpp

+10-1
Original file line numberDiff line numberDiff line change
@@ -2648,6 +2648,15 @@ static Function *emit_function(jl_lambda_info_t *lam, bool cstyle)
26482648
//TODO: this seems to cause problems, but should be made to work eventually
26492649
//if (jlrettype == (jl_value_t*)jl_bottom_type)
26502650
// f->setDoesNotReturn();
2651+
#if defined(_OS_WINDOWS_) && !defined(_CPU_X86_64_)
2652+
#if LLVM32 && !LLVM33
2653+
f->addFnAttr(Attributes::getWithStackAlignment(
2654+
f->getContext(),16).getKindAsEnum());
2655+
#else
2656+
f->addFnAttr(Attribute::getWithStackAlignment(
2657+
f->getContext(),16).getKindAsEnum());
2658+
#endif
2659+
#endif
26512660
#ifdef DEBUG
26522661
#if LLVM32 && !LLVM33
26532662
f->addFnAttr(Attributes::StackProtectReq);
@@ -3595,7 +3604,7 @@ extern "C" void jl_init_codegen(void)
35953604
#ifndef LLVM34
35963605
options.NoFramePointerElimNonLeaf = true;
35973606
#endif
3598-
#ifdef __MINGW32__
3607+
#if defined(_OS_WINDOWS_) && !defined(_CPU_X86_64_)
35993608
options.StackAlignmentOverride = 16;
36003609
#endif
36013610
#ifdef __APPLE__

0 commit comments

Comments
 (0)