[cfe-dev] Builtins.def compile error on Windows

Eli Friedman eli.friedman at gmail.com
Wed Jun 10 13:20:58 PDT 2009


On Wed, Jun 10, 2009 at 12:03 PM, John
Thompson<john.thompson.jtsoftware at gmail.com> wrote:
> The file include/llvm/Config/alloca.h has a "#define alloca _alloca" which
> substitutes the "alloca" in Builtins.def, resulting in the Builtin::BIalloca
> reference in CGBuiltin.cpp being undefined.

Ouch, that's really, really, nasty.

> Changing "LIBBUILTIN(alloca, "v*z",         "f",     "stdlib.h")" to
> "LIBBUILTIN(_alloca, "v*z",         "f",     "stdlib.h")",
> and the one reference to "Builtin::BIalloca" to "Builtin::BI_alloca" in
> CGBuiltin.cpp seems an easy fix, but I don't know if there are other issues
> with this.

That's quite clearly the wrong fix: it's supposed to detect "alloca",
not "_alloca".  The "alloca" being referred to here is from the source
code being compiled and has nothing to do with any alloca function
available on the host.

Can you find where include/llvm/Config/alloca.h is getting included
from?  I can't seem to figure it out.

The whole thing is rather fragile, and should probably be rewritten to
use Tablegen or something like that, but that's a long-term project.

-Eli




More information about the cfe-dev mailing list