[LLVMdev] Calling C-language variadic functions

Gregory Junker gjunker at dayark.com
Tue May 8 17:13:00 PDT 2012


Such as printf, etc., from IR created using the API (IRBuilder).

Google hasn't provided much help, and I can't find anything relevant in 
the docs (the docs talk about how to do varargs in LLVM ASM, but not how 
to call an external vararg function that exists in a library that gets 
linked to the LLVM module).

Is there something special I need to do? Simply calling 
IRBuilder::CreateCall() isn't working for me. I see the call to the 
variadic function in the asm dump, and also in the generated code, but 
the code (x86_64) doesn't seem to have enough activity going on at the 
call site (and I get a possibly predictable "illegal instruction" abort 
when I try to run the code).

Any ideas?

Thanks
Greg



More information about the llvm-dev mailing list