Skip to content

Commit

Permalink
fix #9339
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash committed Dec 14, 2014
1 parent 5cff519 commit 6dbcf80
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,25 @@ void __attribute__(()) __stack_chk_fail()
fprintf(stderr, "fatal error: stack corruption detected\n");
abort(); // end with abort, since the compiler destroyed the stack upon entry to this function
}

#ifdef _OS_WINDOWS_
#if defined(_CPU_X86_64_)
#if defined(_COMPILER_MINGW_)
extern void ___chkstk_ms(void);
#else
extern void __chkstk(void);
#endif
#else
#if defined(_COMPILER_MINGW_)
extern void _alloca(void);
#else
extern void _chkstk(void);
#endif
#endif
//void *force_chkstk(void) {
// return alloca(40960);
//}
#endif
}

#define DISABLE_FLOAT16
Expand Down Expand Up @@ -4567,6 +4586,27 @@ static void init_julia_llvm_env(Module *m)
resetstkoflw_func = Function::Create(FunctionType::get(T_void, false),
Function::ExternalLinkage, "_resetstkoflw", m);
add_named_global(resetstkoflw_func, (void*)&_resetstkoflw);
#if defined(_CPU_X86_64_)
#if defined(_COMPILER_MINGW_)
Function *chkstk_func = Function::Create(FunctionType::get(T_void, false),
Function::ExternalLinkage, "___chkstk_ms", m);
add_named_global(chkstk_func, (void*)&___chkstk_ms);
#else
Function *chkstk_func = Function::Create(FunctionType::get(T_void, false),
Function::ExternalLinkage, "__chkstk", m);
add_named_global(chkstk_func, (void*)&__chkstk);
#endif
#else
#if defined(_COMPILER_MINGW_)
Function *chkstk_func = Function::Create(FunctionType::get(T_void, false),
Function::ExternalLinkage, "_alloca", m);
add_named_global(chkstk_func, (void*)&_alloca);
#else
Function *chkstk_func = Function::Create(FunctionType::get(T_void, false),
Function::ExternalLinkage, "_chkstk", m);
add_named_global(chkstk_func, (void*)&_chkstk);
#endif
#endif
#endif

std::vector<Type*> lhargs(0);
Expand Down

0 comments on commit 6dbcf80

Please sign in to comment.