From d5d45b8d1a836ac2738a378b567b4195ef3dd0ae Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Sun, 23 Jan 2005 04:32:47 +0000 Subject: [PATCH] Fix alloca support for Cygwin. On cygwin its __alloca not __builtin_alloca llvm-svn: 19776 --- llvm/lib/Target/CBackend/Writer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Target/CBackend/Writer.cpp b/llvm/lib/Target/CBackend/Writer.cpp index 0efdb65050e8..6195b7678dc2 100644 --- a/llvm/lib/Target/CBackend/Writer.cpp +++ b/llvm/lib/Target/CBackend/Writer.cpp @@ -723,7 +723,10 @@ void CWriter::writeOperand(Value *Operand) { static void generateCompilerSpecificCode(std::ostream& Out) { // Alloca is hard to get, and we don't want to include stdlib.h here... Out << "/* get a declaration for alloca */\n" - << "#if defined(__CYGWIN__) || defined(__APPLE__)\n" + << "#if defined(__CYGWIN__)\n" + << "extern void *_alloca(unsigned long);\n" + << "#define alloca(x) _alloca(x)\n" + << "#elif defined(__APPLE__)\n" << "extern void *__builtin_alloca(unsigned long);\n" << "#define alloca(x) __builtin_alloca(x)\n" << "#elif defined(__sun__)\n"