From e4a5743d87bb5b389c4505c51714364062704a7b Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Thu, 17 Sep 2009 00:14:44 +0000 Subject: [PATCH] Some platforms may need malloc.h for alloca. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82100 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp b/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp index 12ca9cd1d34..c931081ff68 100644 --- a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp +++ b/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp @@ -33,6 +33,10 @@ #include #include #include +// Some platforms may need malloc.h for alloca. +#ifdef HAVE_MALLOC_H +#include +#endif #ifdef HAVE_FFI_CALL #ifdef HAVE_FFI_H @@ -269,7 +273,7 @@ GenericValue Interpreter::callExternalFunction(Function *F, } else { RawFn = RF->second; } - + FunctionsLock->release(); GenericValue Result; @@ -334,7 +338,7 @@ GenericValue lle_X_sprintf(const FunctionType *FT, // printf should return # chars printed. This is completely incorrect, but // close enough for now. - GenericValue GV; + GenericValue GV; GV.IntVal = APInt(32, strlen(FmtStr)); while (1) { switch (*FmtStr) { @@ -566,4 +570,3 @@ void Interpreter::initializeExternalFunctions() { FuncNames["lle_X_scanf"] = lle_X_scanf; FuncNames["lle_X_fprintf"] = lle_X_fprintf; } - -- 2.34.1