[LLVMdev] How to halt a program

Duncan Sands baldrick at free.fr
Thu Sep 1 11:32:51 PDT 2011


Hi Victor,

> bytecode. The problem is that LLVM is creating a new abort() function, instead
> of using the one that already exists in libc.

from the bitcode you show, the problem is that you are adding statements to
the abort function turning it from a declaration into a definition.

 > define void @abort() {
 > "assert fail":
 >    call void @abort() noreturn nounwind
 >    unreachable
 > }

Don't add the basic block "assert fail" and its contents to function "abort",
only add them to "main".

Ciao, Duncan.



More information about the llvm-dev mailing list