Link error: undefined reference to APIInt functions


I’m getting link error when compiling an executable where llvm::APIInt is used.

Following is the error:

/usr/local/include/llvm/ADT/APInt.h:1372: undefined reference to `llvm::APInt::countLeadingZerosSlowCase() const’

The source file is a simple program, where ConstantInt’s getZExtValue function is called. If I comment out this part, everything goes just fine.

uint64_t val = or_const_op->getZExtValue();

Could you please suggest what the cause of this problem might be?



You need to link libLLVMSupport.a with your program.