Links to llvm libraries

I am developing a compiler based on llvm, and when I try to create an executable file, the following error occurs:

./bin/llvmcode.s: 35: undefined reference to `operator new [] (unsigned long) '

Please note that the function '@_Znam' is called in the generated IR, which is located in one of the llvm libraries. So, I had to link the generated assembly file with this library. Here is the code I used for this:

llvm-as ./bin/llvmcode.ll llc ./bin/llvmcode.bc g++ -g ./bin/llvmcode.s \`llvm-config --cppflags --ldflags --libs core jit native\` -O3 -o executable -rdynamic 

What is wrong with this code? Any help would be appreciated.

+5
source share

Source: https://habr.com/ru/post/1011627/


All Articles