alloca on Win32

Hi

When using lli on Win32 (vs.net-built), on any non-trivial code, I get the following abort

ERROR: Program used external function ‘_alloca’ which could not be resolved!

Checking the assembly from llc, the first alloca call is to allocate local vars in _main. Is this just the state of the code at 2.0 when built with vs.net, or is there something that I’ve managed to mis-build locally?

thanks,
scott

The alloca CRT function isn’t directly supported on windows, although I do have some code somewhere that makes it work. Basically I implemented my own stack alloc functions by using code from the CRT.

Interesting enough, I am getting exactly the same error for my just-built LLVM-2.0 on WinXP/Cygwin, after the trivial patching on Function.cpp:271.

This same error message shows up when I was trying to run HelloWorld.c version to verify my install:
"lli hello.bc"

"Error, Program used external function _alloca which could not be resolved!"

I checked the document, but didn't seem to find a hit.
I feel I might be missing an environment setup, so I tried to put $LLVMINSTALLDIR/lib onto LD_LIBRARY_PATH and/or path, neither worked.

Any suggestion?

Thank you

Chuck

Scott Graham wrote:

Hello, Chuck.

"Error, Program used external function _alloca which could not be resolved!"

I think the problem is the same. But... Cygwin is handled separately,
because it's really more unix-like, that e.g. mingw32. Even more, it
uses "unix" variant of libSystem. Probably you have to introduce the
same hook (as for mingw32 / vcpp) there.

Anton,

Thank you for your reply.

I am new to LLVM, and still in the learning process of getting LLVM 2.0 build and working.
What do you mean "introduce the same hook ..."?
Put the patch file into LLVM source tree and recompile?

Is there a somehow detailed description on what I should do?

I am using LLVM-2.0 on WinXP/Cygwin, GNU Tool Chain (gcc 4.2.0).

Thank you

Chuck

Anton Korobeynikov wrote:

Or,
has the problem been fixed in the most recent CVS tree?
{If I extract source from CVS and build again, will the error go away?}

Thank you

Chuck

Anton Korobeynikov wrote: