[LLVMdev] inserting exit function into IR

Joshua Warner joshuawarner32 at gmail.com
Thu Mar 31 12:49:26 PDT 2011


Hi George,

Unless you already inserted the function into the module previously, it
looks like your problem is here:

> Constant *temp = M.getFunction("exit", fType);
>
>
needs to be:

Constant* temp = M.getOrInsertFunction("exit", fType);

In LLVM, declarations are just functions without bodies.  A declaration
(without a body) or definition (with a body) needs to be added for every
function referenced in the module, including "standard" functions like exit.

Let me know if this helps.

-Joshua
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110331/e69c7002/attachment.html>


More information about the llvm-dev mailing list