My research is to develop a compiler optimization algorithm and implement it using LLVM. As a part of that i am now started to study LLVM. I installed LLVM 8.0 in ubuntu 19.04.
As a beginner, i created 3 files:
one in Transforms directory called header.cpp which defines the function printName() declared in the header file header.h, which is in the subdirectory PrintName of Transforms. And the third file is the **PrintMain.**cpp file in the same subdirectory.
First i issued make command in build subdirectory. It ran successfully. But when i issued the opt command :
~/llvm-8.0.0.src/test$ opt -load /home/aman/build/lib/LLVMPrintMain.so -printmain input.ll
the following error is displayed:
opt: symbol lookup error: /home/aman/build/lib/LLVMPrintMain.so: undefined symbol: _ZN7Printer9printNameEv
Here the function called printName() which is in the Printer class contains only one print statement.
Input.c file contains a simple function which is converted into input.ll using clang command.
The runOnfunction() executes the function returned from the input.ll file accordingly.
It will be very grateful if you could help me in this regard.
Hoping your valuable comments