Skip to content

Commit

Permalink
fix stack alignment bug on win32
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash committed Nov 30, 2013
1 parent f6a0f7a commit 8022255
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2648,6 +2648,15 @@ static Function *emit_function(jl_lambda_info_t *lam, bool cstyle)
//TODO: this seems to cause problems, but should be made to work eventually
//if (jlrettype == (jl_value_t*)jl_bottom_type)
// f->setDoesNotReturn();
#if defined(_OS_WINDOWS_) && !defined(_CPU_X86_64_)
#if LLVM32 && !LLVM33
f->addFnAttr(Attributes::getWithStackAlignment(
f->getContext(),16).getKindAsEnum());
#else
f->addFnAttr(Attribute::getWithStackAlignment(
f->getContext(),16).getKindAsEnum());
#endif
#endif
#ifdef DEBUG
#if LLVM32 && !LLVM33
f->addFnAttr(Attributes::StackProtectReq);
Expand Down Expand Up @@ -3595,7 +3604,7 @@ extern "C" void jl_init_codegen(void)
#ifndef LLVM34
options.NoFramePointerElimNonLeaf = true;
#endif
#ifdef __MINGW32__
#if defined(_OS_WINDOWS_) && !defined(_CPU_X86_64_)
options.StackAlignmentOverride = 16;
#endif
#ifdef __APPLE__
Expand Down

1 comment on commit 8022255

@vtjnash
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be applied to 0.2

Please sign in to comment.