[llvm-dev] Issue with HelloWorld pass

Alessandro Fanfarillo via llvm-dev llvm-dev at lists.llvm.org
Tue Aug 2 18:12:59 PDT 2016


Dear all,
I'm new to the LLVM world and I'm trying to run reproduce the hello
world example described here
http://llvm.org/releases/3.8.1/docs/WritingAnLLVMPass.html.

I started with a fresh new llvm-3.8.1 installation based on cmake
(running on Linux x86) using the following command:

cmake -DCMAKE_INSTALL_PREFIX=/path/to/llvm -DLLVM_TARGETS_TO_BUILD="X86" ../

The build directory was inside the top directory of the llvm-3.8.1 source.

I copied and pasted the pass example reported at the end of the "Basic
code required" section and I managed to compile everything correctly
with CMake.
Because there is already a Hello example (with the correspondent
LLVMHello.so file), I decided to call it NewHello.

When I try to test the pass with the following string

opt -load /path/to/llvm-3.8.1.src/build/lib/LLVMNewHello.so -hello <
new_hello.bc > /dev/null

I get the following error:
Expected no forward declarations!
!0 = <temporary!> !{}
incorrect number of operands in llvm.ident metadata
!0 = <temporary!> !{}
opt: -: error: input module is broken!

I've also tried with the LLVMHello.so file but I got the same error message.

Do you have any suggestions?


More information about the llvm-dev mailing list