diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index 5b786d4ccf1..85229ad50c6 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -702,13 +702,12 @@ 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(sun) || defined(__CYGWIN__) || defined(__APPLE__)\n" + << "#if defined(sun) || defined(__CYGWIN__) || defined(__APPLE__) || " + << "defined(__FreeBSD__)\n" << "extern void *__builtin_alloca(unsigned long);\n" << "#define alloca(x) __builtin_alloca(x)\n" << "#else\n" - << "#ifndef __FreeBSD__\n" << "#include \n" - << "#endif\n" << "#endif\n\n"; // We output GCC specific attributes to preserve 'linkonce'ness on globals. diff --git a/lib/Target/CBackend/Writer.cpp b/lib/Target/CBackend/Writer.cpp index 5b786d4ccf1..85229ad50c6 100644 --- a/lib/Target/CBackend/Writer.cpp +++ b/lib/Target/CBackend/Writer.cpp @@ -702,13 +702,12 @@ 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(sun) || defined(__CYGWIN__) || defined(__APPLE__)\n" + << "#if defined(sun) || defined(__CYGWIN__) || defined(__APPLE__) || " + << "defined(__FreeBSD__)\n" << "extern void *__builtin_alloca(unsigned long);\n" << "#define alloca(x) __builtin_alloca(x)\n" << "#else\n" - << "#ifndef __FreeBSD__\n" << "#include \n" - << "#endif\n" << "#endif\n\n"; // We output GCC specific attributes to preserve 'linkonce'ness on globals.